@c4a/extract 0.7.0 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -26
- package/README.zh-CN.md +17 -17
- package/bin/c4a-extract-code.js +7 -5
- package/index.js +990 -56
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -13156,6 +13156,8 @@ function keyTokens(key) {
|
|
|
13156
13156
|
return key.replace(/([a-z0-9])([A-Z])/gu, "$1-$2").replace(/[^A-Za-z0-9]+/gu, "-").toLowerCase().split("-").filter(Boolean);
|
|
13157
13157
|
}
|
|
13158
13158
|
function sensitiveKey(key, value) {
|
|
13159
|
+
if (value === INDEXER_OUTPUT_REDACTION_MARKER)
|
|
13160
|
+
return false;
|
|
13159
13161
|
const tokens = keyTokens(key);
|
|
13160
13162
|
if (tokens.length === 0)
|
|
13161
13163
|
return false;
|
|
@@ -13197,12 +13199,12 @@ function replaceWithCount(value, pattern, replacement, count) {
|
|
|
13197
13199
|
function redactKnownText(value, count) {
|
|
13198
13200
|
let output = value;
|
|
13199
13201
|
output = replaceWithCount(output, /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----[\s\S]*?-----END (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/gu, INDEXER_OUTPUT_REDACTION_MARKER, count);
|
|
13200
|
-
output = replaceWithCount(output,
|
|
13202
|
+
output = replaceWithCount(output, new RegExp(`(\\bauthorization\\s*:\\s*(?:bearer|basic)\\s+)` + `(?!${escapeRegExp(INDEXER_OUTPUT_REDACTION_MARKER)})[^\\s,;]+`, "giu"), (_match, prefix) => `${prefix}${INDEXER_OUTPUT_REDACTION_MARKER}`, count);
|
|
13201
13203
|
output = replaceWithCount(output, /([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/giu, (_match, prefix) => `${prefix}${INDEXER_OUTPUT_REDACTION_MARKER}@`, count);
|
|
13202
|
-
output = replaceWithCount(output,
|
|
13204
|
+
output = replaceWithCount(output, new RegExp(`([?&](?:access_token|refresh_token|api_key|password|secret)=)` + `(?!${escapeRegExp(INDEXER_OUTPUT_REDACTION_MARKER)})[^&#\\s]+`, "giu"), (_match, prefix) => `${prefix}${INDEXER_OUTPUT_REDACTION_MARKER}`, count);
|
|
13203
13205
|
const key = "(?:[A-Za-z0-9_.-]*(?:password|passwd|pwd|secret|token|credential|cookie)[A-Za-z0-9_.-]*|api[-_]?key|access[-_]?(?:key|token)|private[-_]?key|client[-_]?secret|authorization)";
|
|
13204
13206
|
const assignment = `(?:=\\s*|:\\s+(?=\\S)|:\\s*(?=["']))`;
|
|
13205
|
-
output = replaceWithCount(output, new RegExp(`((?:["']?${key}["']?)\\s*${assignment})(?:"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|[^\\s,;}\\]]+)`, "giu"), (_match, prefix) => `${prefix}"${INDEXER_OUTPUT_REDACTION_MARKER}"`, count);
|
|
13207
|
+
output = replaceWithCount(output, new RegExp(`((?:["']?${key}["']?)\\s*${assignment})` + `(?!["']?${escapeRegExp(INDEXER_OUTPUT_REDACTION_MARKER)})` + `(?:"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|[^\\s,;}\\]]+)`, "giu"), (_match, prefix) => `${prefix}"${INDEXER_OUTPUT_REDACTION_MARKER}"`, count);
|
|
13206
13208
|
return output;
|
|
13207
13209
|
}
|
|
13208
13210
|
function redactBlockedText(value, blocked, count) {
|
|
@@ -15552,7 +15554,7 @@ function selectedEntryFiles(input) {
|
|
|
15552
15554
|
for (const entry of input.detected.entries) {
|
|
15553
15555
|
const sourcePath = input.module.path === "." ? safeSourceRelativePath(entry.path) : safeSourceRelativePath(`${input.module.path}/${entry.path}`);
|
|
15554
15556
|
if (!includedSourceFiles.has(sourcePath)) {
|
|
15555
|
-
throw new Error(`Auto-detected entry is outside
|
|
15557
|
+
throw new Error(`Auto-detected entry is outside the parser include: ${sourcePath}. Update the Provider include or configured entries.`);
|
|
15556
15558
|
}
|
|
15557
15559
|
}
|
|
15558
15560
|
return input.detected.entries;
|
|
@@ -15563,7 +15565,7 @@ function selectedEntryFiles(input) {
|
|
|
15563
15565
|
}
|
|
15564
15566
|
return sourceEntries.map((sourcePath, index) => {
|
|
15565
15567
|
if (!includedSourceFiles.has(sourcePath)) {
|
|
15566
|
-
throw new Error(`Configured extraction entry is missing or outside
|
|
15568
|
+
throw new Error(`Configured extraction entry is missing or outside the parser include: ${sourcePath}. Update the Provider entries or include.`);
|
|
15567
15569
|
}
|
|
15568
15570
|
const modulePath = moduleRelativeEntryPath(input.module.path, sourcePath);
|
|
15569
15571
|
return {
|
|
@@ -16260,6 +16262,10 @@ var runCodeExtractCliFromFile = async (inputFile) => {
|
|
|
16260
16262
|
};
|
|
16261
16263
|
// src/evidenceAdapter.ts
|
|
16262
16264
|
function fact2(input) {
|
|
16265
|
+
const payload = redactIndexerOutput({
|
|
16266
|
+
channel: "success-payload",
|
|
16267
|
+
value: input.payload
|
|
16268
|
+
}).value;
|
|
16263
16269
|
return createIndexerEvidenceAdapterFact({
|
|
16264
16270
|
source_ref: input.sourceRef,
|
|
16265
16271
|
module_ref: input.moduleRef,
|
|
@@ -16267,10 +16273,21 @@ function fact2(input) {
|
|
|
16267
16273
|
qualified_item_path: input.qualifiedItemPath,
|
|
16268
16274
|
kind: input.kind,
|
|
16269
16275
|
signature: input.signature,
|
|
16270
|
-
payload
|
|
16276
|
+
payload,
|
|
16271
16277
|
denominator: input.denominator
|
|
16272
16278
|
});
|
|
16273
16279
|
}
|
|
16280
|
+
function uniqueFacts(facts) {
|
|
16281
|
+
const byRef = new Map;
|
|
16282
|
+
for (const value of facts) {
|
|
16283
|
+
const previous = byRef.get(value.fact_ref);
|
|
16284
|
+
if (previous !== undefined && indexerEvidenceAdapterProtocolDigest(previous) !== indexerEvidenceAdapterProtocolDigest(value)) {
|
|
16285
|
+
throw new TypeError(`ExtractionResult emits conflicting facts for ${value.fact_ref}`);
|
|
16286
|
+
}
|
|
16287
|
+
byRef.set(value.fact_ref, previous ?? value);
|
|
16288
|
+
}
|
|
16289
|
+
return [...byRef.values()];
|
|
16290
|
+
}
|
|
16274
16291
|
function semanticExtractionPayload(extraction) {
|
|
16275
16292
|
return {
|
|
16276
16293
|
version: extraction.version,
|
|
@@ -16287,7 +16304,9 @@ function semanticExtractionPayload(extraction) {
|
|
|
16287
16304
|
stats: extraction.stats
|
|
16288
16305
|
};
|
|
16289
16306
|
}
|
|
16290
|
-
function relationSourceFile(relation, symbols) {
|
|
16307
|
+
function relationSourceFile(relation, symbols, filePaths) {
|
|
16308
|
+
if (filePaths.has(relation.from))
|
|
16309
|
+
return relation.from;
|
|
16291
16310
|
const candidates = symbols.filter((symbol) => symbol.name === relation.from);
|
|
16292
16311
|
if (candidates.length === 1)
|
|
16293
16312
|
return candidates[0].file;
|
|
@@ -16298,6 +16317,13 @@ function relationSourceFile(relation, symbols) {
|
|
|
16298
16317
|
}
|
|
16299
16318
|
return null;
|
|
16300
16319
|
}
|
|
16320
|
+
function relationQualifiedItemPath(relation) {
|
|
16321
|
+
const identityDigest = indexerEvidenceAdapterProtocolDigest({
|
|
16322
|
+
from: relation.from,
|
|
16323
|
+
to: relation.to
|
|
16324
|
+
});
|
|
16325
|
+
return `relation:${relation.type}@${relation.line ?? 0}#${identityDigest}`;
|
|
16326
|
+
}
|
|
16301
16327
|
function diagnosticPayload(diagnostic) {
|
|
16302
16328
|
return {
|
|
16303
16329
|
code: diagnostic.code,
|
|
@@ -16317,6 +16343,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16317
16343
|
}
|
|
16318
16344
|
const coverageByPath = new Map(coverage.files.map((file) => [file.path, file]));
|
|
16319
16345
|
const fileInfoByPath = new Map(extraction.files.map((file) => [file.path, file]));
|
|
16346
|
+
const filePaths = new Set([...coverageByPath.keys(), ...fileInfoByPath.keys()]);
|
|
16320
16347
|
for (const file of extraction.files) {
|
|
16321
16348
|
if (!coverageByPath.has(file.path)) {
|
|
16322
16349
|
throw new TypeError(`ExtractionResult file ${file.path} has no coverage disposition`);
|
|
@@ -16333,7 +16360,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16333
16360
|
const generatedDiagnostics = [];
|
|
16334
16361
|
const relationsByFile = new Map;
|
|
16335
16362
|
for (const relation of extraction.relations) {
|
|
16336
|
-
const file = relationSourceFile(relation, extraction.symbols);
|
|
16363
|
+
const file = relationSourceFile(relation, extraction.symbols, filePaths);
|
|
16337
16364
|
if (file === null || coverageByPath.get(file)?.disposition !== "analyzed") {
|
|
16338
16365
|
generatedDiagnostics.push({
|
|
16339
16366
|
code: "relation-locator-unresolved",
|
|
@@ -16403,7 +16430,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16403
16430
|
sourceRef: invocation.authorized_scope.source_ref,
|
|
16404
16431
|
moduleRef: invocation.module_ref,
|
|
16405
16432
|
normalizedPath,
|
|
16406
|
-
qualifiedItemPath:
|
|
16433
|
+
qualifiedItemPath: relationQualifiedItemPath(relation),
|
|
16407
16434
|
kind: "code-relation",
|
|
16408
16435
|
signature: relation,
|
|
16409
16436
|
payload: relation,
|
|
@@ -16419,7 +16446,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16419
16446
|
role,
|
|
16420
16447
|
coverage_tier: coverage.tier,
|
|
16421
16448
|
disposition: coverageFile.disposition,
|
|
16422
|
-
facts
|
|
16449
|
+
facts: uniqueFacts(facts)
|
|
16423
16450
|
};
|
|
16424
16451
|
});
|
|
16425
16452
|
const diagnostics = [
|
|
@@ -16463,6 +16490,845 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16463
16490
|
function extractionResultToEvidenceAdapterMaterialization(extraction, invocation) {
|
|
16464
16491
|
return materializeIndexerEvidenceAdapterResult(extractionResultToEvidenceAdapterResult(extraction, invocation));
|
|
16465
16492
|
}
|
|
16493
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
16494
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
16495
|
+
const len = text.length;
|
|
16496
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
16497
|
+
function scanHexDigits(count, exact) {
|
|
16498
|
+
let digits = 0;
|
|
16499
|
+
let value2 = 0;
|
|
16500
|
+
while (digits < count || !exact) {
|
|
16501
|
+
let ch = text.charCodeAt(pos);
|
|
16502
|
+
if (ch >= 48 && ch <= 57) {
|
|
16503
|
+
value2 = value2 * 16 + ch - 48;
|
|
16504
|
+
} else if (ch >= 65 && ch <= 70) {
|
|
16505
|
+
value2 = value2 * 16 + ch - 65 + 10;
|
|
16506
|
+
} else if (ch >= 97 && ch <= 102) {
|
|
16507
|
+
value2 = value2 * 16 + ch - 97 + 10;
|
|
16508
|
+
} else {
|
|
16509
|
+
break;
|
|
16510
|
+
}
|
|
16511
|
+
pos++;
|
|
16512
|
+
digits++;
|
|
16513
|
+
}
|
|
16514
|
+
if (digits < count) {
|
|
16515
|
+
value2 = -1;
|
|
16516
|
+
}
|
|
16517
|
+
return value2;
|
|
16518
|
+
}
|
|
16519
|
+
function setPosition(newPosition) {
|
|
16520
|
+
pos = newPosition;
|
|
16521
|
+
value = "";
|
|
16522
|
+
tokenOffset = 0;
|
|
16523
|
+
token = 16;
|
|
16524
|
+
scanError = 0;
|
|
16525
|
+
}
|
|
16526
|
+
function scanNumber() {
|
|
16527
|
+
let start = pos;
|
|
16528
|
+
if (text.charCodeAt(pos) === 48) {
|
|
16529
|
+
pos++;
|
|
16530
|
+
} else {
|
|
16531
|
+
pos++;
|
|
16532
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16533
|
+
pos++;
|
|
16534
|
+
}
|
|
16535
|
+
}
|
|
16536
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
16537
|
+
pos++;
|
|
16538
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16539
|
+
pos++;
|
|
16540
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16541
|
+
pos++;
|
|
16542
|
+
}
|
|
16543
|
+
} else {
|
|
16544
|
+
scanError = 3;
|
|
16545
|
+
return text.substring(start, pos);
|
|
16546
|
+
}
|
|
16547
|
+
}
|
|
16548
|
+
let end = pos;
|
|
16549
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
16550
|
+
pos++;
|
|
16551
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
16552
|
+
pos++;
|
|
16553
|
+
}
|
|
16554
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16555
|
+
pos++;
|
|
16556
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16557
|
+
pos++;
|
|
16558
|
+
}
|
|
16559
|
+
end = pos;
|
|
16560
|
+
} else {
|
|
16561
|
+
scanError = 3;
|
|
16562
|
+
}
|
|
16563
|
+
}
|
|
16564
|
+
return text.substring(start, end);
|
|
16565
|
+
}
|
|
16566
|
+
function scanString() {
|
|
16567
|
+
let result = "", start = pos;
|
|
16568
|
+
while (true) {
|
|
16569
|
+
if (pos >= len) {
|
|
16570
|
+
result += text.substring(start, pos);
|
|
16571
|
+
scanError = 2;
|
|
16572
|
+
break;
|
|
16573
|
+
}
|
|
16574
|
+
const ch = text.charCodeAt(pos);
|
|
16575
|
+
if (ch === 34) {
|
|
16576
|
+
result += text.substring(start, pos);
|
|
16577
|
+
pos++;
|
|
16578
|
+
break;
|
|
16579
|
+
}
|
|
16580
|
+
if (ch === 92) {
|
|
16581
|
+
result += text.substring(start, pos);
|
|
16582
|
+
pos++;
|
|
16583
|
+
if (pos >= len) {
|
|
16584
|
+
scanError = 2;
|
|
16585
|
+
break;
|
|
16586
|
+
}
|
|
16587
|
+
const ch2 = text.charCodeAt(pos++);
|
|
16588
|
+
switch (ch2) {
|
|
16589
|
+
case 34:
|
|
16590
|
+
result += '"';
|
|
16591
|
+
break;
|
|
16592
|
+
case 92:
|
|
16593
|
+
result += "\\";
|
|
16594
|
+
break;
|
|
16595
|
+
case 47:
|
|
16596
|
+
result += "/";
|
|
16597
|
+
break;
|
|
16598
|
+
case 98:
|
|
16599
|
+
result += "\b";
|
|
16600
|
+
break;
|
|
16601
|
+
case 102:
|
|
16602
|
+
result += "\f";
|
|
16603
|
+
break;
|
|
16604
|
+
case 110:
|
|
16605
|
+
result += `
|
|
16606
|
+
`;
|
|
16607
|
+
break;
|
|
16608
|
+
case 114:
|
|
16609
|
+
result += "\r";
|
|
16610
|
+
break;
|
|
16611
|
+
case 116:
|
|
16612
|
+
result += "\t";
|
|
16613
|
+
break;
|
|
16614
|
+
case 117:
|
|
16615
|
+
const ch3 = scanHexDigits(4, true);
|
|
16616
|
+
if (ch3 >= 0) {
|
|
16617
|
+
result += String.fromCharCode(ch3);
|
|
16618
|
+
} else {
|
|
16619
|
+
scanError = 4;
|
|
16620
|
+
}
|
|
16621
|
+
break;
|
|
16622
|
+
default:
|
|
16623
|
+
scanError = 5;
|
|
16624
|
+
}
|
|
16625
|
+
start = pos;
|
|
16626
|
+
continue;
|
|
16627
|
+
}
|
|
16628
|
+
if (ch >= 0 && ch <= 31) {
|
|
16629
|
+
if (isLineBreak(ch)) {
|
|
16630
|
+
result += text.substring(start, pos);
|
|
16631
|
+
scanError = 2;
|
|
16632
|
+
break;
|
|
16633
|
+
} else {
|
|
16634
|
+
scanError = 6;
|
|
16635
|
+
}
|
|
16636
|
+
}
|
|
16637
|
+
pos++;
|
|
16638
|
+
}
|
|
16639
|
+
return result;
|
|
16640
|
+
}
|
|
16641
|
+
function scanNext() {
|
|
16642
|
+
value = "";
|
|
16643
|
+
scanError = 0;
|
|
16644
|
+
tokenOffset = pos;
|
|
16645
|
+
lineStartOffset = lineNumber;
|
|
16646
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
16647
|
+
if (pos >= len) {
|
|
16648
|
+
tokenOffset = len;
|
|
16649
|
+
return token = 17;
|
|
16650
|
+
}
|
|
16651
|
+
let code = text.charCodeAt(pos);
|
|
16652
|
+
if (isWhiteSpace(code)) {
|
|
16653
|
+
do {
|
|
16654
|
+
pos++;
|
|
16655
|
+
value += String.fromCharCode(code);
|
|
16656
|
+
code = text.charCodeAt(pos);
|
|
16657
|
+
} while (isWhiteSpace(code));
|
|
16658
|
+
return token = 15;
|
|
16659
|
+
}
|
|
16660
|
+
if (isLineBreak(code)) {
|
|
16661
|
+
pos++;
|
|
16662
|
+
value += String.fromCharCode(code);
|
|
16663
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
16664
|
+
pos++;
|
|
16665
|
+
value += `
|
|
16666
|
+
`;
|
|
16667
|
+
}
|
|
16668
|
+
lineNumber++;
|
|
16669
|
+
tokenLineStartOffset = pos;
|
|
16670
|
+
return token = 14;
|
|
16671
|
+
}
|
|
16672
|
+
switch (code) {
|
|
16673
|
+
case 123:
|
|
16674
|
+
pos++;
|
|
16675
|
+
return token = 1;
|
|
16676
|
+
case 125:
|
|
16677
|
+
pos++;
|
|
16678
|
+
return token = 2;
|
|
16679
|
+
case 91:
|
|
16680
|
+
pos++;
|
|
16681
|
+
return token = 3;
|
|
16682
|
+
case 93:
|
|
16683
|
+
pos++;
|
|
16684
|
+
return token = 4;
|
|
16685
|
+
case 58:
|
|
16686
|
+
pos++;
|
|
16687
|
+
return token = 6;
|
|
16688
|
+
case 44:
|
|
16689
|
+
pos++;
|
|
16690
|
+
return token = 5;
|
|
16691
|
+
case 34:
|
|
16692
|
+
pos++;
|
|
16693
|
+
value = scanString();
|
|
16694
|
+
return token = 10;
|
|
16695
|
+
case 47:
|
|
16696
|
+
const start = pos - 1;
|
|
16697
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
16698
|
+
pos += 2;
|
|
16699
|
+
while (pos < len) {
|
|
16700
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
16701
|
+
break;
|
|
16702
|
+
}
|
|
16703
|
+
pos++;
|
|
16704
|
+
}
|
|
16705
|
+
value = text.substring(start, pos);
|
|
16706
|
+
return token = 12;
|
|
16707
|
+
}
|
|
16708
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
16709
|
+
pos += 2;
|
|
16710
|
+
const safeLength = len - 1;
|
|
16711
|
+
let commentClosed = false;
|
|
16712
|
+
while (pos < safeLength) {
|
|
16713
|
+
const ch = text.charCodeAt(pos);
|
|
16714
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
16715
|
+
pos += 2;
|
|
16716
|
+
commentClosed = true;
|
|
16717
|
+
break;
|
|
16718
|
+
}
|
|
16719
|
+
pos++;
|
|
16720
|
+
if (isLineBreak(ch)) {
|
|
16721
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
16722
|
+
pos++;
|
|
16723
|
+
}
|
|
16724
|
+
lineNumber++;
|
|
16725
|
+
tokenLineStartOffset = pos;
|
|
16726
|
+
}
|
|
16727
|
+
}
|
|
16728
|
+
if (!commentClosed) {
|
|
16729
|
+
pos++;
|
|
16730
|
+
scanError = 1;
|
|
16731
|
+
}
|
|
16732
|
+
value = text.substring(start, pos);
|
|
16733
|
+
return token = 13;
|
|
16734
|
+
}
|
|
16735
|
+
value += String.fromCharCode(code);
|
|
16736
|
+
pos++;
|
|
16737
|
+
return token = 16;
|
|
16738
|
+
case 45:
|
|
16739
|
+
value += String.fromCharCode(code);
|
|
16740
|
+
pos++;
|
|
16741
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
16742
|
+
return token = 16;
|
|
16743
|
+
}
|
|
16744
|
+
case 48:
|
|
16745
|
+
case 49:
|
|
16746
|
+
case 50:
|
|
16747
|
+
case 51:
|
|
16748
|
+
case 52:
|
|
16749
|
+
case 53:
|
|
16750
|
+
case 54:
|
|
16751
|
+
case 55:
|
|
16752
|
+
case 56:
|
|
16753
|
+
case 57:
|
|
16754
|
+
value += scanNumber();
|
|
16755
|
+
return token = 11;
|
|
16756
|
+
default:
|
|
16757
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
16758
|
+
pos++;
|
|
16759
|
+
code = text.charCodeAt(pos);
|
|
16760
|
+
}
|
|
16761
|
+
if (tokenOffset !== pos) {
|
|
16762
|
+
value = text.substring(tokenOffset, pos);
|
|
16763
|
+
switch (value) {
|
|
16764
|
+
case "true":
|
|
16765
|
+
return token = 8;
|
|
16766
|
+
case "false":
|
|
16767
|
+
return token = 9;
|
|
16768
|
+
case "null":
|
|
16769
|
+
return token = 7;
|
|
16770
|
+
}
|
|
16771
|
+
return token = 16;
|
|
16772
|
+
}
|
|
16773
|
+
value += String.fromCharCode(code);
|
|
16774
|
+
pos++;
|
|
16775
|
+
return token = 16;
|
|
16776
|
+
}
|
|
16777
|
+
}
|
|
16778
|
+
function isUnknownContentCharacter(code) {
|
|
16779
|
+
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
16780
|
+
return false;
|
|
16781
|
+
}
|
|
16782
|
+
switch (code) {
|
|
16783
|
+
case 125:
|
|
16784
|
+
case 93:
|
|
16785
|
+
case 123:
|
|
16786
|
+
case 91:
|
|
16787
|
+
case 34:
|
|
16788
|
+
case 58:
|
|
16789
|
+
case 44:
|
|
16790
|
+
case 47:
|
|
16791
|
+
return false;
|
|
16792
|
+
}
|
|
16793
|
+
return true;
|
|
16794
|
+
}
|
|
16795
|
+
function scanNextNonTrivia() {
|
|
16796
|
+
let result;
|
|
16797
|
+
do {
|
|
16798
|
+
result = scanNext();
|
|
16799
|
+
} while (result >= 12 && result <= 15);
|
|
16800
|
+
return result;
|
|
16801
|
+
}
|
|
16802
|
+
return {
|
|
16803
|
+
setPosition,
|
|
16804
|
+
getPosition: () => pos,
|
|
16805
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
16806
|
+
getToken: () => token,
|
|
16807
|
+
getTokenValue: () => value,
|
|
16808
|
+
getTokenOffset: () => tokenOffset,
|
|
16809
|
+
getTokenLength: () => pos - tokenOffset,
|
|
16810
|
+
getTokenStartLine: () => lineStartOffset,
|
|
16811
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
16812
|
+
getTokenError: () => scanError
|
|
16813
|
+
};
|
|
16814
|
+
}
|
|
16815
|
+
function isWhiteSpace(ch) {
|
|
16816
|
+
return ch === 32 || ch === 9;
|
|
16817
|
+
}
|
|
16818
|
+
function isLineBreak(ch) {
|
|
16819
|
+
return ch === 10 || ch === 13;
|
|
16820
|
+
}
|
|
16821
|
+
function isDigit(ch) {
|
|
16822
|
+
return ch >= 48 && ch <= 57;
|
|
16823
|
+
}
|
|
16824
|
+
var CharacterCodes;
|
|
16825
|
+
(function(CharacterCodes2) {
|
|
16826
|
+
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
16827
|
+
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
16828
|
+
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
16829
|
+
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
16830
|
+
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
16831
|
+
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
16832
|
+
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
16833
|
+
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
16834
|
+
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
16835
|
+
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
16836
|
+
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
16837
|
+
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
16838
|
+
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
16839
|
+
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
16840
|
+
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
16841
|
+
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
16842
|
+
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
16843
|
+
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
16844
|
+
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
16845
|
+
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
16846
|
+
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
16847
|
+
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
16848
|
+
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
16849
|
+
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
16850
|
+
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
16851
|
+
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
16852
|
+
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
16853
|
+
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
16854
|
+
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
16855
|
+
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
16856
|
+
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
16857
|
+
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
16858
|
+
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
16859
|
+
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
16860
|
+
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
16861
|
+
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
16862
|
+
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
16863
|
+
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
16864
|
+
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
16865
|
+
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
16866
|
+
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
16867
|
+
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
16868
|
+
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
16869
|
+
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
16870
|
+
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
16871
|
+
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
16872
|
+
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
16873
|
+
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
16874
|
+
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
16875
|
+
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
16876
|
+
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
16877
|
+
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
16878
|
+
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
16879
|
+
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
16880
|
+
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
16881
|
+
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
16882
|
+
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
16883
|
+
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
16884
|
+
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
16885
|
+
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
16886
|
+
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
16887
|
+
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
16888
|
+
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
16889
|
+
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
16890
|
+
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
16891
|
+
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
16892
|
+
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
16893
|
+
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
16894
|
+
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
16895
|
+
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
16896
|
+
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
16897
|
+
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
16898
|
+
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
16899
|
+
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
16900
|
+
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
16901
|
+
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
16902
|
+
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
16903
|
+
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
16904
|
+
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
16905
|
+
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
16906
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
16907
|
+
|
|
16908
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
16909
|
+
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
16910
|
+
return " ".repeat(index);
|
|
16911
|
+
});
|
|
16912
|
+
var maxCachedValues = 200;
|
|
16913
|
+
var cachedBreakLinesWithSpaces = {
|
|
16914
|
+
" ": {
|
|
16915
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16916
|
+
return `
|
|
16917
|
+
` + " ".repeat(index);
|
|
16918
|
+
}),
|
|
16919
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16920
|
+
return "\r" + " ".repeat(index);
|
|
16921
|
+
}),
|
|
16922
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16923
|
+
return `\r
|
|
16924
|
+
` + " ".repeat(index);
|
|
16925
|
+
})
|
|
16926
|
+
},
|
|
16927
|
+
"\t": {
|
|
16928
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16929
|
+
return `
|
|
16930
|
+
` + "\t".repeat(index);
|
|
16931
|
+
}),
|
|
16932
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16933
|
+
return "\r" + "\t".repeat(index);
|
|
16934
|
+
}),
|
|
16935
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16936
|
+
return `\r
|
|
16937
|
+
` + "\t".repeat(index);
|
|
16938
|
+
})
|
|
16939
|
+
}
|
|
16940
|
+
};
|
|
16941
|
+
|
|
16942
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
16943
|
+
var ParseOptions;
|
|
16944
|
+
(function(ParseOptions2) {
|
|
16945
|
+
ParseOptions2.DEFAULT = {
|
|
16946
|
+
allowTrailingComma: false
|
|
16947
|
+
};
|
|
16948
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
16949
|
+
function parseTree(text, errors3 = [], options = ParseOptions.DEFAULT) {
|
|
16950
|
+
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
|
|
16951
|
+
function ensurePropertyComplete(endOffset) {
|
|
16952
|
+
if (currentParent.type === "property") {
|
|
16953
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
16954
|
+
currentParent = currentParent.parent;
|
|
16955
|
+
}
|
|
16956
|
+
}
|
|
16957
|
+
function onValue(valueNode) {
|
|
16958
|
+
currentParent.children.push(valueNode);
|
|
16959
|
+
return valueNode;
|
|
16960
|
+
}
|
|
16961
|
+
const visitor = {
|
|
16962
|
+
onObjectBegin: (offset) => {
|
|
16963
|
+
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
16964
|
+
},
|
|
16965
|
+
onObjectProperty: (name, offset, length) => {
|
|
16966
|
+
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
16967
|
+
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
16968
|
+
},
|
|
16969
|
+
onObjectEnd: (offset, length) => {
|
|
16970
|
+
ensurePropertyComplete(offset + length);
|
|
16971
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
16972
|
+
currentParent = currentParent.parent;
|
|
16973
|
+
ensurePropertyComplete(offset + length);
|
|
16974
|
+
},
|
|
16975
|
+
onArrayBegin: (offset, length) => {
|
|
16976
|
+
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
16977
|
+
},
|
|
16978
|
+
onArrayEnd: (offset, length) => {
|
|
16979
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
16980
|
+
currentParent = currentParent.parent;
|
|
16981
|
+
ensurePropertyComplete(offset + length);
|
|
16982
|
+
},
|
|
16983
|
+
onLiteralValue: (value, offset, length) => {
|
|
16984
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
16985
|
+
ensurePropertyComplete(offset + length);
|
|
16986
|
+
},
|
|
16987
|
+
onSeparator: (sep2, offset, length) => {
|
|
16988
|
+
if (currentParent.type === "property") {
|
|
16989
|
+
if (sep2 === ":") {
|
|
16990
|
+
currentParent.colonOffset = offset;
|
|
16991
|
+
} else if (sep2 === ",") {
|
|
16992
|
+
ensurePropertyComplete(offset);
|
|
16993
|
+
}
|
|
16994
|
+
}
|
|
16995
|
+
},
|
|
16996
|
+
onError: (error, offset, length) => {
|
|
16997
|
+
errors3.push({ error, offset, length });
|
|
16998
|
+
}
|
|
16999
|
+
};
|
|
17000
|
+
visit(text, visitor, options);
|
|
17001
|
+
const result = currentParent.children[0];
|
|
17002
|
+
if (result) {
|
|
17003
|
+
delete result.parent;
|
|
17004
|
+
}
|
|
17005
|
+
return result;
|
|
17006
|
+
}
|
|
17007
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
17008
|
+
const _scanner = createScanner(text, false);
|
|
17009
|
+
const _jsonPath = [];
|
|
17010
|
+
let suppressedCallbacks = 0;
|
|
17011
|
+
function toNoArgVisit(visitFunction) {
|
|
17012
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
17013
|
+
}
|
|
17014
|
+
function toOneArgVisit(visitFunction) {
|
|
17015
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
17016
|
+
}
|
|
17017
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
17018
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
17019
|
+
}
|
|
17020
|
+
function toBeginVisit(visitFunction) {
|
|
17021
|
+
return visitFunction ? () => {
|
|
17022
|
+
if (suppressedCallbacks > 0) {
|
|
17023
|
+
suppressedCallbacks++;
|
|
17024
|
+
} else {
|
|
17025
|
+
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
17026
|
+
if (cbReturn === false) {
|
|
17027
|
+
suppressedCallbacks = 1;
|
|
17028
|
+
}
|
|
17029
|
+
}
|
|
17030
|
+
} : () => true;
|
|
17031
|
+
}
|
|
17032
|
+
function toEndVisit(visitFunction) {
|
|
17033
|
+
return visitFunction ? () => {
|
|
17034
|
+
if (suppressedCallbacks > 0) {
|
|
17035
|
+
suppressedCallbacks--;
|
|
17036
|
+
}
|
|
17037
|
+
if (suppressedCallbacks === 0) {
|
|
17038
|
+
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
17039
|
+
}
|
|
17040
|
+
} : () => true;
|
|
17041
|
+
}
|
|
17042
|
+
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
17043
|
+
const disallowComments = options && options.disallowComments;
|
|
17044
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
17045
|
+
function scanNext() {
|
|
17046
|
+
while (true) {
|
|
17047
|
+
const token = _scanner.scan();
|
|
17048
|
+
switch (_scanner.getTokenError()) {
|
|
17049
|
+
case 4:
|
|
17050
|
+
handleError(14);
|
|
17051
|
+
break;
|
|
17052
|
+
case 5:
|
|
17053
|
+
handleError(15);
|
|
17054
|
+
break;
|
|
17055
|
+
case 3:
|
|
17056
|
+
handleError(13);
|
|
17057
|
+
break;
|
|
17058
|
+
case 1:
|
|
17059
|
+
if (!disallowComments) {
|
|
17060
|
+
handleError(11);
|
|
17061
|
+
}
|
|
17062
|
+
break;
|
|
17063
|
+
case 2:
|
|
17064
|
+
handleError(12);
|
|
17065
|
+
break;
|
|
17066
|
+
case 6:
|
|
17067
|
+
handleError(16);
|
|
17068
|
+
break;
|
|
17069
|
+
}
|
|
17070
|
+
switch (token) {
|
|
17071
|
+
case 12:
|
|
17072
|
+
case 13:
|
|
17073
|
+
if (disallowComments) {
|
|
17074
|
+
handleError(10);
|
|
17075
|
+
} else {
|
|
17076
|
+
onComment();
|
|
17077
|
+
}
|
|
17078
|
+
break;
|
|
17079
|
+
case 16:
|
|
17080
|
+
handleError(1);
|
|
17081
|
+
break;
|
|
17082
|
+
case 15:
|
|
17083
|
+
case 14:
|
|
17084
|
+
break;
|
|
17085
|
+
default:
|
|
17086
|
+
return token;
|
|
17087
|
+
}
|
|
17088
|
+
}
|
|
17089
|
+
}
|
|
17090
|
+
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
17091
|
+
onError(error);
|
|
17092
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
17093
|
+
let token = _scanner.getToken();
|
|
17094
|
+
while (token !== 17) {
|
|
17095
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
17096
|
+
scanNext();
|
|
17097
|
+
break;
|
|
17098
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
17099
|
+
break;
|
|
17100
|
+
}
|
|
17101
|
+
token = scanNext();
|
|
17102
|
+
}
|
|
17103
|
+
}
|
|
17104
|
+
}
|
|
17105
|
+
function parseString(isValue) {
|
|
17106
|
+
const value = _scanner.getTokenValue();
|
|
17107
|
+
if (isValue) {
|
|
17108
|
+
onLiteralValue(value);
|
|
17109
|
+
} else {
|
|
17110
|
+
onObjectProperty(value);
|
|
17111
|
+
_jsonPath.push(value);
|
|
17112
|
+
}
|
|
17113
|
+
scanNext();
|
|
17114
|
+
return true;
|
|
17115
|
+
}
|
|
17116
|
+
function parseLiteral() {
|
|
17117
|
+
switch (_scanner.getToken()) {
|
|
17118
|
+
case 11:
|
|
17119
|
+
const tokenValue = _scanner.getTokenValue();
|
|
17120
|
+
let value = Number(tokenValue);
|
|
17121
|
+
if (isNaN(value)) {
|
|
17122
|
+
handleError(2);
|
|
17123
|
+
value = 0;
|
|
17124
|
+
}
|
|
17125
|
+
onLiteralValue(value);
|
|
17126
|
+
break;
|
|
17127
|
+
case 7:
|
|
17128
|
+
onLiteralValue(null);
|
|
17129
|
+
break;
|
|
17130
|
+
case 8:
|
|
17131
|
+
onLiteralValue(true);
|
|
17132
|
+
break;
|
|
17133
|
+
case 9:
|
|
17134
|
+
onLiteralValue(false);
|
|
17135
|
+
break;
|
|
17136
|
+
default:
|
|
17137
|
+
return false;
|
|
17138
|
+
}
|
|
17139
|
+
scanNext();
|
|
17140
|
+
return true;
|
|
17141
|
+
}
|
|
17142
|
+
function parseProperty() {
|
|
17143
|
+
if (_scanner.getToken() !== 10) {
|
|
17144
|
+
handleError(3, [], [2, 5]);
|
|
17145
|
+
return false;
|
|
17146
|
+
}
|
|
17147
|
+
parseString(false);
|
|
17148
|
+
if (_scanner.getToken() === 6) {
|
|
17149
|
+
onSeparator(":");
|
|
17150
|
+
scanNext();
|
|
17151
|
+
if (!parseValue()) {
|
|
17152
|
+
handleError(4, [], [2, 5]);
|
|
17153
|
+
}
|
|
17154
|
+
} else {
|
|
17155
|
+
handleError(5, [], [2, 5]);
|
|
17156
|
+
}
|
|
17157
|
+
_jsonPath.pop();
|
|
17158
|
+
return true;
|
|
17159
|
+
}
|
|
17160
|
+
function parseObject() {
|
|
17161
|
+
onObjectBegin();
|
|
17162
|
+
scanNext();
|
|
17163
|
+
let needsComma = false;
|
|
17164
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
17165
|
+
if (_scanner.getToken() === 5) {
|
|
17166
|
+
if (!needsComma) {
|
|
17167
|
+
handleError(4, [], []);
|
|
17168
|
+
}
|
|
17169
|
+
onSeparator(",");
|
|
17170
|
+
scanNext();
|
|
17171
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
17172
|
+
break;
|
|
17173
|
+
}
|
|
17174
|
+
} else if (needsComma) {
|
|
17175
|
+
handleError(6, [], []);
|
|
17176
|
+
}
|
|
17177
|
+
if (!parseProperty()) {
|
|
17178
|
+
handleError(4, [], [2, 5]);
|
|
17179
|
+
}
|
|
17180
|
+
needsComma = true;
|
|
17181
|
+
}
|
|
17182
|
+
onObjectEnd();
|
|
17183
|
+
if (_scanner.getToken() !== 2) {
|
|
17184
|
+
handleError(7, [2], []);
|
|
17185
|
+
} else {
|
|
17186
|
+
scanNext();
|
|
17187
|
+
}
|
|
17188
|
+
return true;
|
|
17189
|
+
}
|
|
17190
|
+
function parseArray() {
|
|
17191
|
+
onArrayBegin();
|
|
17192
|
+
scanNext();
|
|
17193
|
+
let isFirstElement = true;
|
|
17194
|
+
let needsComma = false;
|
|
17195
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
17196
|
+
if (_scanner.getToken() === 5) {
|
|
17197
|
+
if (!needsComma) {
|
|
17198
|
+
handleError(4, [], []);
|
|
17199
|
+
}
|
|
17200
|
+
onSeparator(",");
|
|
17201
|
+
scanNext();
|
|
17202
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
17203
|
+
break;
|
|
17204
|
+
}
|
|
17205
|
+
} else if (needsComma) {
|
|
17206
|
+
handleError(6, [], []);
|
|
17207
|
+
}
|
|
17208
|
+
if (isFirstElement) {
|
|
17209
|
+
_jsonPath.push(0);
|
|
17210
|
+
isFirstElement = false;
|
|
17211
|
+
} else {
|
|
17212
|
+
_jsonPath[_jsonPath.length - 1]++;
|
|
17213
|
+
}
|
|
17214
|
+
if (!parseValue()) {
|
|
17215
|
+
handleError(4, [], [4, 5]);
|
|
17216
|
+
}
|
|
17217
|
+
needsComma = true;
|
|
17218
|
+
}
|
|
17219
|
+
onArrayEnd();
|
|
17220
|
+
if (!isFirstElement) {
|
|
17221
|
+
_jsonPath.pop();
|
|
17222
|
+
}
|
|
17223
|
+
if (_scanner.getToken() !== 4) {
|
|
17224
|
+
handleError(8, [4], []);
|
|
17225
|
+
} else {
|
|
17226
|
+
scanNext();
|
|
17227
|
+
}
|
|
17228
|
+
return true;
|
|
17229
|
+
}
|
|
17230
|
+
function parseValue() {
|
|
17231
|
+
switch (_scanner.getToken()) {
|
|
17232
|
+
case 3:
|
|
17233
|
+
return parseArray();
|
|
17234
|
+
case 1:
|
|
17235
|
+
return parseObject();
|
|
17236
|
+
case 10:
|
|
17237
|
+
return parseString(true);
|
|
17238
|
+
default:
|
|
17239
|
+
return parseLiteral();
|
|
17240
|
+
}
|
|
17241
|
+
}
|
|
17242
|
+
scanNext();
|
|
17243
|
+
if (_scanner.getToken() === 17) {
|
|
17244
|
+
if (options.allowEmptyContent) {
|
|
17245
|
+
return true;
|
|
17246
|
+
}
|
|
17247
|
+
handleError(4, [], []);
|
|
17248
|
+
return false;
|
|
17249
|
+
}
|
|
17250
|
+
if (!parseValue()) {
|
|
17251
|
+
handleError(4, [], []);
|
|
17252
|
+
return false;
|
|
17253
|
+
}
|
|
17254
|
+
if (_scanner.getToken() !== 17) {
|
|
17255
|
+
handleError(9, [], []);
|
|
17256
|
+
}
|
|
17257
|
+
return true;
|
|
17258
|
+
}
|
|
17259
|
+
function getNodeType(value) {
|
|
17260
|
+
switch (typeof value) {
|
|
17261
|
+
case "boolean":
|
|
17262
|
+
return "boolean";
|
|
17263
|
+
case "number":
|
|
17264
|
+
return "number";
|
|
17265
|
+
case "string":
|
|
17266
|
+
return "string";
|
|
17267
|
+
case "object": {
|
|
17268
|
+
if (!value) {
|
|
17269
|
+
return "null";
|
|
17270
|
+
} else if (Array.isArray(value)) {
|
|
17271
|
+
return "array";
|
|
17272
|
+
}
|
|
17273
|
+
return "object";
|
|
17274
|
+
}
|
|
17275
|
+
default:
|
|
17276
|
+
return "null";
|
|
17277
|
+
}
|
|
17278
|
+
}
|
|
17279
|
+
|
|
17280
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
17281
|
+
var ScanError;
|
|
17282
|
+
(function(ScanError2) {
|
|
17283
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
17284
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
17285
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
17286
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
17287
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
17288
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
17289
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
17290
|
+
})(ScanError || (ScanError = {}));
|
|
17291
|
+
var SyntaxKind;
|
|
17292
|
+
(function(SyntaxKind2) {
|
|
17293
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
17294
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
17295
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
17296
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
17297
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
17298
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
17299
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
17300
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
17301
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
17302
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
17303
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
17304
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
17305
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
17306
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
17307
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
17308
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
17309
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
17310
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
17311
|
+
var parseTree2 = parseTree;
|
|
17312
|
+
var ParseErrorCode;
|
|
17313
|
+
(function(ParseErrorCode2) {
|
|
17314
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
17315
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
17316
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
17317
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
17318
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
17319
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
17320
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
17321
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
17322
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
17323
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
17324
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
17325
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
17326
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
17327
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
17328
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
17329
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
17330
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
17331
|
+
|
|
16466
17332
|
// ../../node_modules/.bun/eslint-visitor-keys@5.0.1/node_modules/eslint-visitor-keys/lib/visitor-keys.js
|
|
16467
17333
|
var KEYS = {
|
|
16468
17334
|
ArrayExpression: ["elements"],
|
|
@@ -16766,7 +17632,7 @@ function isControl(cp) {
|
|
|
16766
17632
|
function isWhitespace(cp) {
|
|
16767
17633
|
return cp === CodePoint.TABULATION || cp === CodePoint.SPACE;
|
|
16768
17634
|
}
|
|
16769
|
-
function
|
|
17635
|
+
function isEOL2(cp) {
|
|
16770
17636
|
return cp === CodePoint.LINE_FEED || cp === CodePoint.CARRIAGE_RETURN;
|
|
16771
17637
|
}
|
|
16772
17638
|
function isUpperLetter(cp) {
|
|
@@ -16778,11 +17644,11 @@ function isLowerLetter(cp) {
|
|
|
16778
17644
|
function isLetter(cp) {
|
|
16779
17645
|
return isLowerLetter(cp) || isUpperLetter(cp);
|
|
16780
17646
|
}
|
|
16781
|
-
function
|
|
17647
|
+
function isDigit2(cp) {
|
|
16782
17648
|
return cp >= CodePoint.DIGIT_0 && cp <= CodePoint.DIGIT_9;
|
|
16783
17649
|
}
|
|
16784
17650
|
function isHexDig(cp) {
|
|
16785
|
-
return
|
|
17651
|
+
return isDigit2(cp) || cp >= CodePoint.LATIN_SMALL_A && cp <= CodePoint.LATIN_SMALL_F || cp >= CodePoint.LATIN_CAPITAL_A && cp <= CodePoint.LATIN_CAPITAL_F;
|
|
16786
17652
|
}
|
|
16787
17653
|
function isOctalDig(cp) {
|
|
16788
17654
|
return cp >= CodePoint.DIGIT_0 && cp <= CodePoint.DIGIT_7;
|
|
@@ -17044,7 +17910,7 @@ var Tokenizer = class {
|
|
|
17044
17910
|
}
|
|
17045
17911
|
}
|
|
17046
17912
|
DATA(cp) {
|
|
17047
|
-
while (isWhitespace(cp) ||
|
|
17913
|
+
while (isWhitespace(cp) || isEOL2(cp))
|
|
17048
17914
|
cp = this.nextCode();
|
|
17049
17915
|
if (cp === CodePoint.HASH) {
|
|
17050
17916
|
this.startToken();
|
|
@@ -17071,7 +17937,7 @@ var Tokenizer = class {
|
|
|
17071
17937
|
this.startToken();
|
|
17072
17938
|
return this.back("NAN_OR_INF");
|
|
17073
17939
|
}
|
|
17074
|
-
if (
|
|
17940
|
+
if (isDigit2(cp)) {
|
|
17075
17941
|
this.startToken();
|
|
17076
17942
|
return this.back("NUMBER");
|
|
17077
17943
|
}
|
|
@@ -17095,7 +17961,7 @@ var Tokenizer = class {
|
|
|
17095
17961
|
if (isControlOtherThanTab(c))
|
|
17096
17962
|
this.reportParseErrorControlChar();
|
|
17097
17963
|
};
|
|
17098
|
-
while (!
|
|
17964
|
+
while (!isEOL2(cp) && cp !== CodePoint.EOF) {
|
|
17099
17965
|
processCommentChar(cp);
|
|
17100
17966
|
cp = this.nextCode();
|
|
17101
17967
|
}
|
|
@@ -17285,7 +18151,7 @@ var Tokenizer = class {
|
|
|
17285
18151
|
SIGN(cp) {
|
|
17286
18152
|
if (cp === CodePoint.LATIN_SMALL_N || cp === CodePoint.LATIN_SMALL_I)
|
|
17287
18153
|
return this.back("NAN_OR_INF");
|
|
17288
|
-
if (
|
|
18154
|
+
if (isDigit2(cp))
|
|
17289
18155
|
return this.back("NUMBER");
|
|
17290
18156
|
return this.reportParseError("unexpected-char");
|
|
17291
18157
|
}
|
|
@@ -17314,7 +18180,7 @@ var Tokenizer = class {
|
|
|
17314
18180
|
if (sign === CodePoint.NULL) {
|
|
17315
18181
|
const startPos = this.codePointIterator.start;
|
|
17316
18182
|
const nextCp$1 = this.nextCode();
|
|
17317
|
-
if (
|
|
18183
|
+
if (isDigit2(nextCp$1)) {
|
|
17318
18184
|
const nextNextCp = this.nextCode();
|
|
17319
18185
|
if (nextNextCp === CodePoint.COLON) {
|
|
17320
18186
|
this.data = {
|
|
@@ -17328,9 +18194,9 @@ var Tokenizer = class {
|
|
|
17328
18194
|
};
|
|
17329
18195
|
return "TIME_MINUTE";
|
|
17330
18196
|
}
|
|
17331
|
-
if (
|
|
18197
|
+
if (isDigit2(nextNextCp)) {
|
|
17332
18198
|
const nextNextNextCp = this.nextCode();
|
|
17333
|
-
if (
|
|
18199
|
+
if (isDigit2(nextNextNextCp) && this.eatCode(CodePoint.DASH)) {
|
|
17334
18200
|
this.data = {
|
|
17335
18201
|
hasDate: true,
|
|
17336
18202
|
year: Number(String.fromCodePoint(CodePoint.DIGIT_0, nextCp$1, nextNextCp, nextNextNextCp)),
|
|
@@ -17371,7 +18237,7 @@ var Tokenizer = class {
|
|
|
17371
18237
|
this.endToken("Integer", "start", "0", 10);
|
|
17372
18238
|
return this.back("DATA");
|
|
17373
18239
|
}
|
|
17374
|
-
const { out, nextCp, hasUnderscore } = this.parseDigits(cp,
|
|
18240
|
+
const { out, nextCp, hasUnderscore } = this.parseDigits(cp, isDigit2);
|
|
17375
18241
|
if (nextCp === CodePoint.DASH && sign === CodePoint.NULL && !hasUnderscore && out.length === 4) {
|
|
17376
18242
|
this.data = {
|
|
17377
18243
|
hasDate: true,
|
|
@@ -17430,7 +18296,7 @@ var Tokenizer = class {
|
|
|
17430
18296
|
}
|
|
17431
18297
|
FRACTIONAL_RIGHT(cp) {
|
|
17432
18298
|
const { minus, absInt } = this.data;
|
|
17433
|
-
const { out, nextCp } = this.parseDigits(cp,
|
|
18299
|
+
const { out, nextCp } = this.parseDigits(cp, isDigit2);
|
|
17434
18300
|
const absNum = [
|
|
17435
18301
|
...absInt,
|
|
17436
18302
|
CodePoint.DOT,
|
|
@@ -17454,7 +18320,7 @@ var Tokenizer = class {
|
|
|
17454
18320
|
minus = cp === CodePoint.DASH;
|
|
17455
18321
|
cp = this.nextCode();
|
|
17456
18322
|
}
|
|
17457
|
-
const { out } = this.parseDigits(cp,
|
|
18323
|
+
const { out } = this.parseDigits(cp, isDigit2);
|
|
17458
18324
|
const right = out;
|
|
17459
18325
|
if (minus)
|
|
17460
18326
|
right.unshift(CodePoint.DASH);
|
|
@@ -17482,10 +18348,10 @@ var Tokenizer = class {
|
|
|
17482
18348
|
}
|
|
17483
18349
|
DATE_MONTH(cp) {
|
|
17484
18350
|
const start = this.codePointIterator.start;
|
|
17485
|
-
if (!
|
|
18351
|
+
if (!isDigit2(cp))
|
|
17486
18352
|
return this.reportParseError("unexpected-char");
|
|
17487
18353
|
cp = this.nextCode();
|
|
17488
|
-
if (!
|
|
18354
|
+
if (!isDigit2(cp))
|
|
17489
18355
|
return this.reportParseError("unexpected-char");
|
|
17490
18356
|
cp = this.nextCode();
|
|
17491
18357
|
if (cp !== CodePoint.DASH)
|
|
@@ -17497,10 +18363,10 @@ var Tokenizer = class {
|
|
|
17497
18363
|
}
|
|
17498
18364
|
DATE_DAY(cp) {
|
|
17499
18365
|
const start = this.codePointIterator.start;
|
|
17500
|
-
if (!
|
|
18366
|
+
if (!isDigit2(cp))
|
|
17501
18367
|
return this.reportParseError("unexpected-char");
|
|
17502
18368
|
cp = this.nextCode();
|
|
17503
|
-
if (!
|
|
18369
|
+
if (!isDigit2(cp))
|
|
17504
18370
|
return this.reportParseError("unexpected-char");
|
|
17505
18371
|
const end = this.codePointIterator.end;
|
|
17506
18372
|
const data = this.data;
|
|
@@ -17512,7 +18378,7 @@ var Tokenizer = class {
|
|
|
17512
18378
|
return "TIME_HOUR";
|
|
17513
18379
|
if (cp === CodePoint.SPACE) {
|
|
17514
18380
|
const startPos = this.codePointIterator.start;
|
|
17515
|
-
if (
|
|
18381
|
+
if (isDigit2(this.nextCode()) && isDigit2(this.nextCode())) {
|
|
17516
18382
|
this.moveAt(startPos);
|
|
17517
18383
|
return "TIME_HOUR";
|
|
17518
18384
|
}
|
|
@@ -17524,10 +18390,10 @@ var Tokenizer = class {
|
|
|
17524
18390
|
}
|
|
17525
18391
|
TIME_HOUR(cp) {
|
|
17526
18392
|
const start = this.codePointIterator.start;
|
|
17527
|
-
if (!
|
|
18393
|
+
if (!isDigit2(cp))
|
|
17528
18394
|
return this.reportParseError("unexpected-char");
|
|
17529
18395
|
cp = this.nextCode();
|
|
17530
|
-
if (!
|
|
18396
|
+
if (!isDigit2(cp))
|
|
17531
18397
|
return this.reportParseError("unexpected-char");
|
|
17532
18398
|
cp = this.nextCode();
|
|
17533
18399
|
if (cp !== CodePoint.COLON)
|
|
@@ -17539,10 +18405,10 @@ var Tokenizer = class {
|
|
|
17539
18405
|
}
|
|
17540
18406
|
TIME_MINUTE(cp) {
|
|
17541
18407
|
const start = this.codePointIterator.start;
|
|
17542
|
-
if (!
|
|
18408
|
+
if (!isDigit2(cp))
|
|
17543
18409
|
return this.reportParseError("unexpected-char");
|
|
17544
18410
|
cp = this.nextCode();
|
|
17545
|
-
if (!
|
|
18411
|
+
if (!isDigit2(cp))
|
|
17546
18412
|
return this.reportParseError("unexpected-char");
|
|
17547
18413
|
const end = this.codePointIterator.end;
|
|
17548
18414
|
const data = this.data;
|
|
@@ -17558,10 +18424,10 @@ var Tokenizer = class {
|
|
|
17558
18424
|
}
|
|
17559
18425
|
TIME_SECOND(cp) {
|
|
17560
18426
|
const start = this.codePointIterator.start;
|
|
17561
|
-
if (!
|
|
18427
|
+
if (!isDigit2(cp))
|
|
17562
18428
|
return this.reportParseError("unexpected-char");
|
|
17563
18429
|
cp = this.nextCode();
|
|
17564
|
-
if (!
|
|
18430
|
+
if (!isDigit2(cp))
|
|
17565
18431
|
return this.reportParseError("unexpected-char");
|
|
17566
18432
|
const end = this.codePointIterator.end;
|
|
17567
18433
|
const data = this.data;
|
|
@@ -17574,10 +18440,10 @@ var Tokenizer = class {
|
|
|
17574
18440
|
return this.processTimeEnd(cp, data);
|
|
17575
18441
|
}
|
|
17576
18442
|
TIME_SEC_FRAC(cp) {
|
|
17577
|
-
if (!
|
|
18443
|
+
if (!isDigit2(cp))
|
|
17578
18444
|
return this.reportParseError("unexpected-char");
|
|
17579
18445
|
const start = this.codePointIterator.start;
|
|
17580
|
-
while (
|
|
18446
|
+
while (isDigit2(cp))
|
|
17581
18447
|
cp = this.nextCode();
|
|
17582
18448
|
const end = this.codePointIterator.start;
|
|
17583
18449
|
const data = this.data;
|
|
@@ -17604,11 +18470,11 @@ var Tokenizer = class {
|
|
|
17604
18470
|
return this.back("DATA");
|
|
17605
18471
|
}
|
|
17606
18472
|
TIME_OFFSET(cp) {
|
|
17607
|
-
if (!
|
|
18473
|
+
if (!isDigit2(cp))
|
|
17608
18474
|
return this.reportParseError("unexpected-char");
|
|
17609
18475
|
const hourStart = this.codePointIterator.start;
|
|
17610
18476
|
cp = this.nextCode();
|
|
17611
|
-
if (!
|
|
18477
|
+
if (!isDigit2(cp))
|
|
17612
18478
|
return this.reportParseError("unexpected-char");
|
|
17613
18479
|
cp = this.nextCode();
|
|
17614
18480
|
if (cp !== CodePoint.COLON)
|
|
@@ -17616,10 +18482,10 @@ var Tokenizer = class {
|
|
|
17616
18482
|
const hourEnd = this.codePointIterator.start;
|
|
17617
18483
|
cp = this.nextCode();
|
|
17618
18484
|
const minuteStart = this.codePointIterator.start;
|
|
17619
|
-
if (!
|
|
18485
|
+
if (!isDigit2(cp))
|
|
17620
18486
|
return this.reportParseError("unexpected-char");
|
|
17621
18487
|
cp = this.nextCode();
|
|
17622
|
-
if (!
|
|
18488
|
+
if (!isDigit2(cp))
|
|
17623
18489
|
return this.reportParseError("unexpected-char");
|
|
17624
18490
|
const minuteEnd = this.codePointIterator.end;
|
|
17625
18491
|
const hour = Number(this.text.slice(hourStart, hourEnd));
|
|
@@ -17683,7 +18549,7 @@ var Tokenizer = class {
|
|
|
17683
18549
|
}
|
|
17684
18550
|
};
|
|
17685
18551
|
function isUnquotedKeyChar(cp, tomlVersion) {
|
|
17686
|
-
if (isLetter(cp) ||
|
|
18552
|
+
if (isLetter(cp) || isDigit2(cp) || cp === CodePoint.UNDERSCORE || cp === CodePoint.DASH)
|
|
17687
18553
|
return true;
|
|
17688
18554
|
if (tomlVersion.lt(1, 1))
|
|
17689
18555
|
return false;
|
|
@@ -18762,11 +19628,9 @@ function yamlLocation(document, lineCounter, logicalPath, documentPrefixLength)
|
|
|
18762
19628
|
const position = lineCounter.linePos(offset);
|
|
18763
19629
|
return { line: position.line, column: position.col };
|
|
18764
19630
|
}
|
|
18765
|
-
function parseYamlLike(context, source
|
|
18766
|
-
if (strictJson)
|
|
18767
|
-
JSON.parse(source);
|
|
19631
|
+
function parseYamlLike(context, source) {
|
|
18768
19632
|
const lineCounter = new import_yaml2.LineCounter;
|
|
18769
|
-
const documents =
|
|
19633
|
+
const documents = import_yaml2.parseAllDocuments(source, { lineCounter, strict: true, uniqueKeys: true });
|
|
18770
19634
|
if (documents.length === 0)
|
|
18771
19635
|
throw new TypeError("configuration document is empty");
|
|
18772
19636
|
for (const [documentIndex, document] of documents.entries()) {
|
|
@@ -18778,6 +19642,74 @@ function parseYamlLike(context, source, strictJson) {
|
|
|
18778
19642
|
walkValue(context, value, prefix, (path5) => yamlLocation(document, lineCounter, path5, prefix.length));
|
|
18779
19643
|
}
|
|
18780
19644
|
}
|
|
19645
|
+
function jsonLineStarts(source) {
|
|
19646
|
+
const starts = [0];
|
|
19647
|
+
for (let index = 0;index < source.length; index += 1) {
|
|
19648
|
+
if (source.charCodeAt(index) === 10)
|
|
19649
|
+
starts.push(index + 1);
|
|
19650
|
+
}
|
|
19651
|
+
return starts;
|
|
19652
|
+
}
|
|
19653
|
+
function jsonLocation(lineStarts, offset) {
|
|
19654
|
+
let low = 0;
|
|
19655
|
+
let high = lineStarts.length;
|
|
19656
|
+
while (low + 1 < high) {
|
|
19657
|
+
const middle = Math.floor((low + high) / 2);
|
|
19658
|
+
if (lineStarts[middle] <= offset)
|
|
19659
|
+
low = middle;
|
|
19660
|
+
else
|
|
19661
|
+
high = middle;
|
|
19662
|
+
}
|
|
19663
|
+
return { line: low + 1, column: offset - lineStarts[low] + 1 };
|
|
19664
|
+
}
|
|
19665
|
+
function jsonScalar(node2) {
|
|
19666
|
+
if (node2.type === "null")
|
|
19667
|
+
return null;
|
|
19668
|
+
if (node2.type === "string" || node2.type === "number" || node2.type === "boolean") {
|
|
19669
|
+
return node2.value;
|
|
19670
|
+
}
|
|
19671
|
+
throw new TypeError(`unsupported JSON scalar node ${node2.type}`);
|
|
19672
|
+
}
|
|
19673
|
+
function walkJsonNode(context, node2, keyPath, lineStarts) {
|
|
19674
|
+
const location = jsonLocation(lineStarts, node2.offset);
|
|
19675
|
+
if (node2.type === "object") {
|
|
19676
|
+
addValue(context, keyPath, {}, location);
|
|
19677
|
+
const keys = new Set;
|
|
19678
|
+
for (const property of node2.children ?? []) {
|
|
19679
|
+
const [keyNode, valueNode] = property.children ?? [];
|
|
19680
|
+
if (property.type !== "property" || keyNode?.type !== "string" || typeof keyNode.value !== "string" || valueNode === undefined) {
|
|
19681
|
+
throw new TypeError("JSON object property is unstable");
|
|
19682
|
+
}
|
|
19683
|
+
if (keys.has(keyNode.value))
|
|
19684
|
+
throw new TypeError("JSON object contains a duplicate key");
|
|
19685
|
+
keys.add(keyNode.value);
|
|
19686
|
+
walkJsonNode(context, valueNode, [...keyPath, keyNode.value], lineStarts);
|
|
19687
|
+
}
|
|
19688
|
+
return;
|
|
19689
|
+
}
|
|
19690
|
+
if (node2.type === "array") {
|
|
19691
|
+
addValue(context, keyPath, [], location);
|
|
19692
|
+
for (const [index, child] of (node2.children ?? []).entries()) {
|
|
19693
|
+
walkJsonNode(context, child, [...keyPath, String(index)], lineStarts);
|
|
19694
|
+
}
|
|
19695
|
+
return;
|
|
19696
|
+
}
|
|
19697
|
+
if (node2.type === "property")
|
|
19698
|
+
throw new TypeError("JSON property cannot be a value root");
|
|
19699
|
+
addValue(context, keyPath, jsonScalar(node2), location);
|
|
19700
|
+
}
|
|
19701
|
+
function parseJsonLike(context, source) {
|
|
19702
|
+
const errors3 = [];
|
|
19703
|
+
const root = parseTree2(source, errors3, {
|
|
19704
|
+
allowTrailingComma: true,
|
|
19705
|
+
disallowComments: false,
|
|
19706
|
+
allowEmptyContent: false
|
|
19707
|
+
});
|
|
19708
|
+
if (root === undefined || errors3.length > 0) {
|
|
19709
|
+
throw new TypeError("JSON configuration syntax is invalid");
|
|
19710
|
+
}
|
|
19711
|
+
walkJsonNode(context, root, [], jsonLineStarts(source));
|
|
19712
|
+
}
|
|
18781
19713
|
function tomlKey(node2) {
|
|
18782
19714
|
return node2.keys.map((item) => item.type === "TOMLBare" ? item.name : item.value);
|
|
18783
19715
|
}
|
|
@@ -18860,31 +19792,33 @@ function validatedAllowlists(options) {
|
|
|
18860
19792
|
}
|
|
18861
19793
|
return byFile;
|
|
18862
19794
|
}
|
|
18863
|
-
function parseOne(path5, source,
|
|
18864
|
-
if (
|
|
18865
|
-
return { path: path5, format, disposition: "excluded", values: [], diagnostics: [] };
|
|
19795
|
+
function parseOne(path5, source, format2, allowlist) {
|
|
19796
|
+
if (format2 === "excluded")
|
|
19797
|
+
return { path: path5, format: format2, disposition: "excluded", values: [], diagnostics: [] };
|
|
18866
19798
|
const context = {
|
|
18867
19799
|
path: path5,
|
|
18868
|
-
format,
|
|
18869
|
-
configRef: `config:${indexerEvidenceAdapterProtocolDigest({ path: path5, format })}`,
|
|
19800
|
+
format: format2,
|
|
19801
|
+
configRef: `config:${indexerEvidenceAdapterProtocolDigest({ path: path5, format: format2 })}`,
|
|
18870
19802
|
allowlist,
|
|
18871
19803
|
diagnostics: [],
|
|
18872
19804
|
values: []
|
|
18873
19805
|
};
|
|
18874
19806
|
try {
|
|
18875
|
-
if (
|
|
19807
|
+
if (format2 === "toml")
|
|
18876
19808
|
parseToml(context, source);
|
|
19809
|
+
else if (format2 === "json")
|
|
19810
|
+
parseJsonLike(context, source);
|
|
18877
19811
|
else
|
|
18878
|
-
parseYamlLike(context, source
|
|
18879
|
-
return { path: path5, format, disposition: "analyzed", values: context.values, diagnostics: context.diagnostics };
|
|
19812
|
+
parseYamlLike(context, source);
|
|
19813
|
+
return { path: path5, format: format2, disposition: "analyzed", values: context.values, diagnostics: context.diagnostics };
|
|
18880
19814
|
} catch {
|
|
18881
19815
|
const root = locator(path5, [], { line: 1, column: 1 });
|
|
18882
19816
|
return {
|
|
18883
19817
|
path: path5,
|
|
18884
|
-
format,
|
|
19818
|
+
format: format2,
|
|
18885
19819
|
disposition: "unsupported",
|
|
18886
19820
|
values: [],
|
|
18887
|
-
diagnostics: [{ code: "config-source-unsupported", severity: "error", locator: root, detail: `${
|
|
19821
|
+
diagnostics: [{ code: "config-source-unsupported", severity: "error", locator: root, detail: `${format2} configuration could not be analyzed` }]
|
|
18888
19822
|
};
|
|
18889
19823
|
}
|
|
18890
19824
|
}
|
|
@@ -19119,7 +20053,7 @@ var detectTechStack = async (repoPath) => {
|
|
|
19119
20053
|
};
|
|
19120
20054
|
|
|
19121
20055
|
// src/index.ts
|
|
19122
|
-
var CONFIG_EVIDENCE_ADAPTER_EXPORT = "
|
|
20056
|
+
var CONFIG_EVIDENCE_ADAPTER_EXPORT = "configSourcesToEvidenceAdapterMaterialization";
|
|
19123
20057
|
export {
|
|
19124
20058
|
visibilitySchema,
|
|
19125
20059
|
truncateSourceSpanHash,
|