@c4a/extract 0.7.1 → 0.7.5
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 +994 -55
- 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,
|
|
@@ -16300,6 +16317,13 @@ function relationSourceFile(relation, symbols, filePaths) {
|
|
|
16300
16317
|
}
|
|
16301
16318
|
return null;
|
|
16302
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
|
+
}
|
|
16303
16327
|
function diagnosticPayload(diagnostic) {
|
|
16304
16328
|
return {
|
|
16305
16329
|
code: diagnostic.code,
|
|
@@ -16362,6 +16386,10 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16362
16386
|
}
|
|
16363
16387
|
const facts = [];
|
|
16364
16388
|
if (coverageFile.disposition === "analyzed" && fileInfo) {
|
|
16389
|
+
const source = invocation.source_files?.[normalizedPath];
|
|
16390
|
+
if (invocation.source_files !== undefined && source === undefined) {
|
|
16391
|
+
throw new TypeError(`Analyzed file ${normalizedPath} has no scoped source text`);
|
|
16392
|
+
}
|
|
16365
16393
|
facts.push(fact2({
|
|
16366
16394
|
sourceRef: invocation.authorized_scope.source_ref,
|
|
16367
16395
|
moduleRef: invocation.module_ref,
|
|
@@ -16369,7 +16397,11 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16369
16397
|
qualifiedItemPath: "file",
|
|
16370
16398
|
kind: "source-file",
|
|
16371
16399
|
signature: { path: normalizedPath, language: fileInfo.language },
|
|
16372
|
-
payload: fileInfo
|
|
16400
|
+
payload: source === undefined ? fileInfo : {
|
|
16401
|
+
...fileInfo,
|
|
16402
|
+
line: 1,
|
|
16403
|
+
endLine: source.split(/\r\n|\r|\n/u).length
|
|
16404
|
+
},
|
|
16373
16405
|
denominator: ownsDenominators ? "eligible-file" : "none"
|
|
16374
16406
|
}));
|
|
16375
16407
|
facts.push(fact2({
|
|
@@ -16406,7 +16438,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16406
16438
|
sourceRef: invocation.authorized_scope.source_ref,
|
|
16407
16439
|
moduleRef: invocation.module_ref,
|
|
16408
16440
|
normalizedPath,
|
|
16409
|
-
qualifiedItemPath:
|
|
16441
|
+
qualifiedItemPath: relationQualifiedItemPath(relation),
|
|
16410
16442
|
kind: "code-relation",
|
|
16411
16443
|
signature: relation,
|
|
16412
16444
|
payload: relation,
|
|
@@ -16422,7 +16454,7 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16422
16454
|
role,
|
|
16423
16455
|
coverage_tier: coverage.tier,
|
|
16424
16456
|
disposition: coverageFile.disposition,
|
|
16425
|
-
facts
|
|
16457
|
+
facts: uniqueFacts(facts)
|
|
16426
16458
|
};
|
|
16427
16459
|
});
|
|
16428
16460
|
const diagnostics = [
|
|
@@ -16466,6 +16498,845 @@ function extractionResultToEvidenceAdapterResult(extraction, invocation) {
|
|
|
16466
16498
|
function extractionResultToEvidenceAdapterMaterialization(extraction, invocation) {
|
|
16467
16499
|
return materializeIndexerEvidenceAdapterResult(extractionResultToEvidenceAdapterResult(extraction, invocation));
|
|
16468
16500
|
}
|
|
16501
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
16502
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
16503
|
+
const len = text.length;
|
|
16504
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
16505
|
+
function scanHexDigits(count, exact) {
|
|
16506
|
+
let digits = 0;
|
|
16507
|
+
let value2 = 0;
|
|
16508
|
+
while (digits < count || !exact) {
|
|
16509
|
+
let ch = text.charCodeAt(pos);
|
|
16510
|
+
if (ch >= 48 && ch <= 57) {
|
|
16511
|
+
value2 = value2 * 16 + ch - 48;
|
|
16512
|
+
} else if (ch >= 65 && ch <= 70) {
|
|
16513
|
+
value2 = value2 * 16 + ch - 65 + 10;
|
|
16514
|
+
} else if (ch >= 97 && ch <= 102) {
|
|
16515
|
+
value2 = value2 * 16 + ch - 97 + 10;
|
|
16516
|
+
} else {
|
|
16517
|
+
break;
|
|
16518
|
+
}
|
|
16519
|
+
pos++;
|
|
16520
|
+
digits++;
|
|
16521
|
+
}
|
|
16522
|
+
if (digits < count) {
|
|
16523
|
+
value2 = -1;
|
|
16524
|
+
}
|
|
16525
|
+
return value2;
|
|
16526
|
+
}
|
|
16527
|
+
function setPosition(newPosition) {
|
|
16528
|
+
pos = newPosition;
|
|
16529
|
+
value = "";
|
|
16530
|
+
tokenOffset = 0;
|
|
16531
|
+
token = 16;
|
|
16532
|
+
scanError = 0;
|
|
16533
|
+
}
|
|
16534
|
+
function scanNumber() {
|
|
16535
|
+
let start = pos;
|
|
16536
|
+
if (text.charCodeAt(pos) === 48) {
|
|
16537
|
+
pos++;
|
|
16538
|
+
} else {
|
|
16539
|
+
pos++;
|
|
16540
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16541
|
+
pos++;
|
|
16542
|
+
}
|
|
16543
|
+
}
|
|
16544
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
16545
|
+
pos++;
|
|
16546
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16547
|
+
pos++;
|
|
16548
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16549
|
+
pos++;
|
|
16550
|
+
}
|
|
16551
|
+
} else {
|
|
16552
|
+
scanError = 3;
|
|
16553
|
+
return text.substring(start, pos);
|
|
16554
|
+
}
|
|
16555
|
+
}
|
|
16556
|
+
let end = pos;
|
|
16557
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
16558
|
+
pos++;
|
|
16559
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
16560
|
+
pos++;
|
|
16561
|
+
}
|
|
16562
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16563
|
+
pos++;
|
|
16564
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
16565
|
+
pos++;
|
|
16566
|
+
}
|
|
16567
|
+
end = pos;
|
|
16568
|
+
} else {
|
|
16569
|
+
scanError = 3;
|
|
16570
|
+
}
|
|
16571
|
+
}
|
|
16572
|
+
return text.substring(start, end);
|
|
16573
|
+
}
|
|
16574
|
+
function scanString() {
|
|
16575
|
+
let result = "", start = pos;
|
|
16576
|
+
while (true) {
|
|
16577
|
+
if (pos >= len) {
|
|
16578
|
+
result += text.substring(start, pos);
|
|
16579
|
+
scanError = 2;
|
|
16580
|
+
break;
|
|
16581
|
+
}
|
|
16582
|
+
const ch = text.charCodeAt(pos);
|
|
16583
|
+
if (ch === 34) {
|
|
16584
|
+
result += text.substring(start, pos);
|
|
16585
|
+
pos++;
|
|
16586
|
+
break;
|
|
16587
|
+
}
|
|
16588
|
+
if (ch === 92) {
|
|
16589
|
+
result += text.substring(start, pos);
|
|
16590
|
+
pos++;
|
|
16591
|
+
if (pos >= len) {
|
|
16592
|
+
scanError = 2;
|
|
16593
|
+
break;
|
|
16594
|
+
}
|
|
16595
|
+
const ch2 = text.charCodeAt(pos++);
|
|
16596
|
+
switch (ch2) {
|
|
16597
|
+
case 34:
|
|
16598
|
+
result += '"';
|
|
16599
|
+
break;
|
|
16600
|
+
case 92:
|
|
16601
|
+
result += "\\";
|
|
16602
|
+
break;
|
|
16603
|
+
case 47:
|
|
16604
|
+
result += "/";
|
|
16605
|
+
break;
|
|
16606
|
+
case 98:
|
|
16607
|
+
result += "\b";
|
|
16608
|
+
break;
|
|
16609
|
+
case 102:
|
|
16610
|
+
result += "\f";
|
|
16611
|
+
break;
|
|
16612
|
+
case 110:
|
|
16613
|
+
result += `
|
|
16614
|
+
`;
|
|
16615
|
+
break;
|
|
16616
|
+
case 114:
|
|
16617
|
+
result += "\r";
|
|
16618
|
+
break;
|
|
16619
|
+
case 116:
|
|
16620
|
+
result += "\t";
|
|
16621
|
+
break;
|
|
16622
|
+
case 117:
|
|
16623
|
+
const ch3 = scanHexDigits(4, true);
|
|
16624
|
+
if (ch3 >= 0) {
|
|
16625
|
+
result += String.fromCharCode(ch3);
|
|
16626
|
+
} else {
|
|
16627
|
+
scanError = 4;
|
|
16628
|
+
}
|
|
16629
|
+
break;
|
|
16630
|
+
default:
|
|
16631
|
+
scanError = 5;
|
|
16632
|
+
}
|
|
16633
|
+
start = pos;
|
|
16634
|
+
continue;
|
|
16635
|
+
}
|
|
16636
|
+
if (ch >= 0 && ch <= 31) {
|
|
16637
|
+
if (isLineBreak(ch)) {
|
|
16638
|
+
result += text.substring(start, pos);
|
|
16639
|
+
scanError = 2;
|
|
16640
|
+
break;
|
|
16641
|
+
} else {
|
|
16642
|
+
scanError = 6;
|
|
16643
|
+
}
|
|
16644
|
+
}
|
|
16645
|
+
pos++;
|
|
16646
|
+
}
|
|
16647
|
+
return result;
|
|
16648
|
+
}
|
|
16649
|
+
function scanNext() {
|
|
16650
|
+
value = "";
|
|
16651
|
+
scanError = 0;
|
|
16652
|
+
tokenOffset = pos;
|
|
16653
|
+
lineStartOffset = lineNumber;
|
|
16654
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
16655
|
+
if (pos >= len) {
|
|
16656
|
+
tokenOffset = len;
|
|
16657
|
+
return token = 17;
|
|
16658
|
+
}
|
|
16659
|
+
let code = text.charCodeAt(pos);
|
|
16660
|
+
if (isWhiteSpace(code)) {
|
|
16661
|
+
do {
|
|
16662
|
+
pos++;
|
|
16663
|
+
value += String.fromCharCode(code);
|
|
16664
|
+
code = text.charCodeAt(pos);
|
|
16665
|
+
} while (isWhiteSpace(code));
|
|
16666
|
+
return token = 15;
|
|
16667
|
+
}
|
|
16668
|
+
if (isLineBreak(code)) {
|
|
16669
|
+
pos++;
|
|
16670
|
+
value += String.fromCharCode(code);
|
|
16671
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
16672
|
+
pos++;
|
|
16673
|
+
value += `
|
|
16674
|
+
`;
|
|
16675
|
+
}
|
|
16676
|
+
lineNumber++;
|
|
16677
|
+
tokenLineStartOffset = pos;
|
|
16678
|
+
return token = 14;
|
|
16679
|
+
}
|
|
16680
|
+
switch (code) {
|
|
16681
|
+
case 123:
|
|
16682
|
+
pos++;
|
|
16683
|
+
return token = 1;
|
|
16684
|
+
case 125:
|
|
16685
|
+
pos++;
|
|
16686
|
+
return token = 2;
|
|
16687
|
+
case 91:
|
|
16688
|
+
pos++;
|
|
16689
|
+
return token = 3;
|
|
16690
|
+
case 93:
|
|
16691
|
+
pos++;
|
|
16692
|
+
return token = 4;
|
|
16693
|
+
case 58:
|
|
16694
|
+
pos++;
|
|
16695
|
+
return token = 6;
|
|
16696
|
+
case 44:
|
|
16697
|
+
pos++;
|
|
16698
|
+
return token = 5;
|
|
16699
|
+
case 34:
|
|
16700
|
+
pos++;
|
|
16701
|
+
value = scanString();
|
|
16702
|
+
return token = 10;
|
|
16703
|
+
case 47:
|
|
16704
|
+
const start = pos - 1;
|
|
16705
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
16706
|
+
pos += 2;
|
|
16707
|
+
while (pos < len) {
|
|
16708
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
16709
|
+
break;
|
|
16710
|
+
}
|
|
16711
|
+
pos++;
|
|
16712
|
+
}
|
|
16713
|
+
value = text.substring(start, pos);
|
|
16714
|
+
return token = 12;
|
|
16715
|
+
}
|
|
16716
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
16717
|
+
pos += 2;
|
|
16718
|
+
const safeLength = len - 1;
|
|
16719
|
+
let commentClosed = false;
|
|
16720
|
+
while (pos < safeLength) {
|
|
16721
|
+
const ch = text.charCodeAt(pos);
|
|
16722
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
16723
|
+
pos += 2;
|
|
16724
|
+
commentClosed = true;
|
|
16725
|
+
break;
|
|
16726
|
+
}
|
|
16727
|
+
pos++;
|
|
16728
|
+
if (isLineBreak(ch)) {
|
|
16729
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
16730
|
+
pos++;
|
|
16731
|
+
}
|
|
16732
|
+
lineNumber++;
|
|
16733
|
+
tokenLineStartOffset = pos;
|
|
16734
|
+
}
|
|
16735
|
+
}
|
|
16736
|
+
if (!commentClosed) {
|
|
16737
|
+
pos++;
|
|
16738
|
+
scanError = 1;
|
|
16739
|
+
}
|
|
16740
|
+
value = text.substring(start, pos);
|
|
16741
|
+
return token = 13;
|
|
16742
|
+
}
|
|
16743
|
+
value += String.fromCharCode(code);
|
|
16744
|
+
pos++;
|
|
16745
|
+
return token = 16;
|
|
16746
|
+
case 45:
|
|
16747
|
+
value += String.fromCharCode(code);
|
|
16748
|
+
pos++;
|
|
16749
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
16750
|
+
return token = 16;
|
|
16751
|
+
}
|
|
16752
|
+
case 48:
|
|
16753
|
+
case 49:
|
|
16754
|
+
case 50:
|
|
16755
|
+
case 51:
|
|
16756
|
+
case 52:
|
|
16757
|
+
case 53:
|
|
16758
|
+
case 54:
|
|
16759
|
+
case 55:
|
|
16760
|
+
case 56:
|
|
16761
|
+
case 57:
|
|
16762
|
+
value += scanNumber();
|
|
16763
|
+
return token = 11;
|
|
16764
|
+
default:
|
|
16765
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
16766
|
+
pos++;
|
|
16767
|
+
code = text.charCodeAt(pos);
|
|
16768
|
+
}
|
|
16769
|
+
if (tokenOffset !== pos) {
|
|
16770
|
+
value = text.substring(tokenOffset, pos);
|
|
16771
|
+
switch (value) {
|
|
16772
|
+
case "true":
|
|
16773
|
+
return token = 8;
|
|
16774
|
+
case "false":
|
|
16775
|
+
return token = 9;
|
|
16776
|
+
case "null":
|
|
16777
|
+
return token = 7;
|
|
16778
|
+
}
|
|
16779
|
+
return token = 16;
|
|
16780
|
+
}
|
|
16781
|
+
value += String.fromCharCode(code);
|
|
16782
|
+
pos++;
|
|
16783
|
+
return token = 16;
|
|
16784
|
+
}
|
|
16785
|
+
}
|
|
16786
|
+
function isUnknownContentCharacter(code) {
|
|
16787
|
+
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
16788
|
+
return false;
|
|
16789
|
+
}
|
|
16790
|
+
switch (code) {
|
|
16791
|
+
case 125:
|
|
16792
|
+
case 93:
|
|
16793
|
+
case 123:
|
|
16794
|
+
case 91:
|
|
16795
|
+
case 34:
|
|
16796
|
+
case 58:
|
|
16797
|
+
case 44:
|
|
16798
|
+
case 47:
|
|
16799
|
+
return false;
|
|
16800
|
+
}
|
|
16801
|
+
return true;
|
|
16802
|
+
}
|
|
16803
|
+
function scanNextNonTrivia() {
|
|
16804
|
+
let result;
|
|
16805
|
+
do {
|
|
16806
|
+
result = scanNext();
|
|
16807
|
+
} while (result >= 12 && result <= 15);
|
|
16808
|
+
return result;
|
|
16809
|
+
}
|
|
16810
|
+
return {
|
|
16811
|
+
setPosition,
|
|
16812
|
+
getPosition: () => pos,
|
|
16813
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
16814
|
+
getToken: () => token,
|
|
16815
|
+
getTokenValue: () => value,
|
|
16816
|
+
getTokenOffset: () => tokenOffset,
|
|
16817
|
+
getTokenLength: () => pos - tokenOffset,
|
|
16818
|
+
getTokenStartLine: () => lineStartOffset,
|
|
16819
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
16820
|
+
getTokenError: () => scanError
|
|
16821
|
+
};
|
|
16822
|
+
}
|
|
16823
|
+
function isWhiteSpace(ch) {
|
|
16824
|
+
return ch === 32 || ch === 9;
|
|
16825
|
+
}
|
|
16826
|
+
function isLineBreak(ch) {
|
|
16827
|
+
return ch === 10 || ch === 13;
|
|
16828
|
+
}
|
|
16829
|
+
function isDigit(ch) {
|
|
16830
|
+
return ch >= 48 && ch <= 57;
|
|
16831
|
+
}
|
|
16832
|
+
var CharacterCodes;
|
|
16833
|
+
(function(CharacterCodes2) {
|
|
16834
|
+
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
16835
|
+
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
16836
|
+
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
16837
|
+
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
16838
|
+
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
16839
|
+
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
16840
|
+
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
16841
|
+
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
16842
|
+
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
16843
|
+
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
16844
|
+
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
16845
|
+
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
16846
|
+
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
16847
|
+
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
16848
|
+
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
16849
|
+
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
16850
|
+
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
16851
|
+
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
16852
|
+
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
16853
|
+
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
16854
|
+
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
16855
|
+
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
16856
|
+
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
16857
|
+
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
16858
|
+
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
16859
|
+
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
16860
|
+
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
16861
|
+
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
16862
|
+
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
16863
|
+
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
16864
|
+
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
16865
|
+
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
16866
|
+
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
16867
|
+
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
16868
|
+
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
16869
|
+
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
16870
|
+
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
16871
|
+
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
16872
|
+
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
16873
|
+
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
16874
|
+
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
16875
|
+
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
16876
|
+
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
16877
|
+
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
16878
|
+
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
16879
|
+
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
16880
|
+
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
16881
|
+
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
16882
|
+
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
16883
|
+
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
16884
|
+
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
16885
|
+
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
16886
|
+
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
16887
|
+
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
16888
|
+
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
16889
|
+
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
16890
|
+
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
16891
|
+
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
16892
|
+
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
16893
|
+
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
16894
|
+
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
16895
|
+
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
16896
|
+
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
16897
|
+
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
16898
|
+
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
16899
|
+
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
16900
|
+
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
16901
|
+
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
16902
|
+
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
16903
|
+
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
16904
|
+
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
16905
|
+
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
16906
|
+
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
16907
|
+
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
16908
|
+
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
16909
|
+
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
16910
|
+
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
16911
|
+
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
16912
|
+
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
16913
|
+
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
16914
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
16915
|
+
|
|
16916
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
16917
|
+
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
16918
|
+
return " ".repeat(index);
|
|
16919
|
+
});
|
|
16920
|
+
var maxCachedValues = 200;
|
|
16921
|
+
var cachedBreakLinesWithSpaces = {
|
|
16922
|
+
" ": {
|
|
16923
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16924
|
+
return `
|
|
16925
|
+
` + " ".repeat(index);
|
|
16926
|
+
}),
|
|
16927
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16928
|
+
return "\r" + " ".repeat(index);
|
|
16929
|
+
}),
|
|
16930
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16931
|
+
return `\r
|
|
16932
|
+
` + " ".repeat(index);
|
|
16933
|
+
})
|
|
16934
|
+
},
|
|
16935
|
+
"\t": {
|
|
16936
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16937
|
+
return `
|
|
16938
|
+
` + "\t".repeat(index);
|
|
16939
|
+
}),
|
|
16940
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16941
|
+
return "\r" + "\t".repeat(index);
|
|
16942
|
+
}),
|
|
16943
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
16944
|
+
return `\r
|
|
16945
|
+
` + "\t".repeat(index);
|
|
16946
|
+
})
|
|
16947
|
+
}
|
|
16948
|
+
};
|
|
16949
|
+
|
|
16950
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
16951
|
+
var ParseOptions;
|
|
16952
|
+
(function(ParseOptions2) {
|
|
16953
|
+
ParseOptions2.DEFAULT = {
|
|
16954
|
+
allowTrailingComma: false
|
|
16955
|
+
};
|
|
16956
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
16957
|
+
function parseTree(text, errors3 = [], options = ParseOptions.DEFAULT) {
|
|
16958
|
+
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
|
|
16959
|
+
function ensurePropertyComplete(endOffset) {
|
|
16960
|
+
if (currentParent.type === "property") {
|
|
16961
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
16962
|
+
currentParent = currentParent.parent;
|
|
16963
|
+
}
|
|
16964
|
+
}
|
|
16965
|
+
function onValue(valueNode) {
|
|
16966
|
+
currentParent.children.push(valueNode);
|
|
16967
|
+
return valueNode;
|
|
16968
|
+
}
|
|
16969
|
+
const visitor = {
|
|
16970
|
+
onObjectBegin: (offset) => {
|
|
16971
|
+
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
16972
|
+
},
|
|
16973
|
+
onObjectProperty: (name, offset, length) => {
|
|
16974
|
+
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
16975
|
+
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
16976
|
+
},
|
|
16977
|
+
onObjectEnd: (offset, length) => {
|
|
16978
|
+
ensurePropertyComplete(offset + length);
|
|
16979
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
16980
|
+
currentParent = currentParent.parent;
|
|
16981
|
+
ensurePropertyComplete(offset + length);
|
|
16982
|
+
},
|
|
16983
|
+
onArrayBegin: (offset, length) => {
|
|
16984
|
+
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
16985
|
+
},
|
|
16986
|
+
onArrayEnd: (offset, length) => {
|
|
16987
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
16988
|
+
currentParent = currentParent.parent;
|
|
16989
|
+
ensurePropertyComplete(offset + length);
|
|
16990
|
+
},
|
|
16991
|
+
onLiteralValue: (value, offset, length) => {
|
|
16992
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
16993
|
+
ensurePropertyComplete(offset + length);
|
|
16994
|
+
},
|
|
16995
|
+
onSeparator: (sep2, offset, length) => {
|
|
16996
|
+
if (currentParent.type === "property") {
|
|
16997
|
+
if (sep2 === ":") {
|
|
16998
|
+
currentParent.colonOffset = offset;
|
|
16999
|
+
} else if (sep2 === ",") {
|
|
17000
|
+
ensurePropertyComplete(offset);
|
|
17001
|
+
}
|
|
17002
|
+
}
|
|
17003
|
+
},
|
|
17004
|
+
onError: (error, offset, length) => {
|
|
17005
|
+
errors3.push({ error, offset, length });
|
|
17006
|
+
}
|
|
17007
|
+
};
|
|
17008
|
+
visit(text, visitor, options);
|
|
17009
|
+
const result = currentParent.children[0];
|
|
17010
|
+
if (result) {
|
|
17011
|
+
delete result.parent;
|
|
17012
|
+
}
|
|
17013
|
+
return result;
|
|
17014
|
+
}
|
|
17015
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
17016
|
+
const _scanner = createScanner(text, false);
|
|
17017
|
+
const _jsonPath = [];
|
|
17018
|
+
let suppressedCallbacks = 0;
|
|
17019
|
+
function toNoArgVisit(visitFunction) {
|
|
17020
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
17021
|
+
}
|
|
17022
|
+
function toOneArgVisit(visitFunction) {
|
|
17023
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
17024
|
+
}
|
|
17025
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
17026
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
17027
|
+
}
|
|
17028
|
+
function toBeginVisit(visitFunction) {
|
|
17029
|
+
return visitFunction ? () => {
|
|
17030
|
+
if (suppressedCallbacks > 0) {
|
|
17031
|
+
suppressedCallbacks++;
|
|
17032
|
+
} else {
|
|
17033
|
+
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
17034
|
+
if (cbReturn === false) {
|
|
17035
|
+
suppressedCallbacks = 1;
|
|
17036
|
+
}
|
|
17037
|
+
}
|
|
17038
|
+
} : () => true;
|
|
17039
|
+
}
|
|
17040
|
+
function toEndVisit(visitFunction) {
|
|
17041
|
+
return visitFunction ? () => {
|
|
17042
|
+
if (suppressedCallbacks > 0) {
|
|
17043
|
+
suppressedCallbacks--;
|
|
17044
|
+
}
|
|
17045
|
+
if (suppressedCallbacks === 0) {
|
|
17046
|
+
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
17047
|
+
}
|
|
17048
|
+
} : () => true;
|
|
17049
|
+
}
|
|
17050
|
+
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);
|
|
17051
|
+
const disallowComments = options && options.disallowComments;
|
|
17052
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
17053
|
+
function scanNext() {
|
|
17054
|
+
while (true) {
|
|
17055
|
+
const token = _scanner.scan();
|
|
17056
|
+
switch (_scanner.getTokenError()) {
|
|
17057
|
+
case 4:
|
|
17058
|
+
handleError(14);
|
|
17059
|
+
break;
|
|
17060
|
+
case 5:
|
|
17061
|
+
handleError(15);
|
|
17062
|
+
break;
|
|
17063
|
+
case 3:
|
|
17064
|
+
handleError(13);
|
|
17065
|
+
break;
|
|
17066
|
+
case 1:
|
|
17067
|
+
if (!disallowComments) {
|
|
17068
|
+
handleError(11);
|
|
17069
|
+
}
|
|
17070
|
+
break;
|
|
17071
|
+
case 2:
|
|
17072
|
+
handleError(12);
|
|
17073
|
+
break;
|
|
17074
|
+
case 6:
|
|
17075
|
+
handleError(16);
|
|
17076
|
+
break;
|
|
17077
|
+
}
|
|
17078
|
+
switch (token) {
|
|
17079
|
+
case 12:
|
|
17080
|
+
case 13:
|
|
17081
|
+
if (disallowComments) {
|
|
17082
|
+
handleError(10);
|
|
17083
|
+
} else {
|
|
17084
|
+
onComment();
|
|
17085
|
+
}
|
|
17086
|
+
break;
|
|
17087
|
+
case 16:
|
|
17088
|
+
handleError(1);
|
|
17089
|
+
break;
|
|
17090
|
+
case 15:
|
|
17091
|
+
case 14:
|
|
17092
|
+
break;
|
|
17093
|
+
default:
|
|
17094
|
+
return token;
|
|
17095
|
+
}
|
|
17096
|
+
}
|
|
17097
|
+
}
|
|
17098
|
+
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
17099
|
+
onError(error);
|
|
17100
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
17101
|
+
let token = _scanner.getToken();
|
|
17102
|
+
while (token !== 17) {
|
|
17103
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
17104
|
+
scanNext();
|
|
17105
|
+
break;
|
|
17106
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
17107
|
+
break;
|
|
17108
|
+
}
|
|
17109
|
+
token = scanNext();
|
|
17110
|
+
}
|
|
17111
|
+
}
|
|
17112
|
+
}
|
|
17113
|
+
function parseString(isValue) {
|
|
17114
|
+
const value = _scanner.getTokenValue();
|
|
17115
|
+
if (isValue) {
|
|
17116
|
+
onLiteralValue(value);
|
|
17117
|
+
} else {
|
|
17118
|
+
onObjectProperty(value);
|
|
17119
|
+
_jsonPath.push(value);
|
|
17120
|
+
}
|
|
17121
|
+
scanNext();
|
|
17122
|
+
return true;
|
|
17123
|
+
}
|
|
17124
|
+
function parseLiteral() {
|
|
17125
|
+
switch (_scanner.getToken()) {
|
|
17126
|
+
case 11:
|
|
17127
|
+
const tokenValue = _scanner.getTokenValue();
|
|
17128
|
+
let value = Number(tokenValue);
|
|
17129
|
+
if (isNaN(value)) {
|
|
17130
|
+
handleError(2);
|
|
17131
|
+
value = 0;
|
|
17132
|
+
}
|
|
17133
|
+
onLiteralValue(value);
|
|
17134
|
+
break;
|
|
17135
|
+
case 7:
|
|
17136
|
+
onLiteralValue(null);
|
|
17137
|
+
break;
|
|
17138
|
+
case 8:
|
|
17139
|
+
onLiteralValue(true);
|
|
17140
|
+
break;
|
|
17141
|
+
case 9:
|
|
17142
|
+
onLiteralValue(false);
|
|
17143
|
+
break;
|
|
17144
|
+
default:
|
|
17145
|
+
return false;
|
|
17146
|
+
}
|
|
17147
|
+
scanNext();
|
|
17148
|
+
return true;
|
|
17149
|
+
}
|
|
17150
|
+
function parseProperty() {
|
|
17151
|
+
if (_scanner.getToken() !== 10) {
|
|
17152
|
+
handleError(3, [], [2, 5]);
|
|
17153
|
+
return false;
|
|
17154
|
+
}
|
|
17155
|
+
parseString(false);
|
|
17156
|
+
if (_scanner.getToken() === 6) {
|
|
17157
|
+
onSeparator(":");
|
|
17158
|
+
scanNext();
|
|
17159
|
+
if (!parseValue()) {
|
|
17160
|
+
handleError(4, [], [2, 5]);
|
|
17161
|
+
}
|
|
17162
|
+
} else {
|
|
17163
|
+
handleError(5, [], [2, 5]);
|
|
17164
|
+
}
|
|
17165
|
+
_jsonPath.pop();
|
|
17166
|
+
return true;
|
|
17167
|
+
}
|
|
17168
|
+
function parseObject() {
|
|
17169
|
+
onObjectBegin();
|
|
17170
|
+
scanNext();
|
|
17171
|
+
let needsComma = false;
|
|
17172
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
17173
|
+
if (_scanner.getToken() === 5) {
|
|
17174
|
+
if (!needsComma) {
|
|
17175
|
+
handleError(4, [], []);
|
|
17176
|
+
}
|
|
17177
|
+
onSeparator(",");
|
|
17178
|
+
scanNext();
|
|
17179
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
17180
|
+
break;
|
|
17181
|
+
}
|
|
17182
|
+
} else if (needsComma) {
|
|
17183
|
+
handleError(6, [], []);
|
|
17184
|
+
}
|
|
17185
|
+
if (!parseProperty()) {
|
|
17186
|
+
handleError(4, [], [2, 5]);
|
|
17187
|
+
}
|
|
17188
|
+
needsComma = true;
|
|
17189
|
+
}
|
|
17190
|
+
onObjectEnd();
|
|
17191
|
+
if (_scanner.getToken() !== 2) {
|
|
17192
|
+
handleError(7, [2], []);
|
|
17193
|
+
} else {
|
|
17194
|
+
scanNext();
|
|
17195
|
+
}
|
|
17196
|
+
return true;
|
|
17197
|
+
}
|
|
17198
|
+
function parseArray() {
|
|
17199
|
+
onArrayBegin();
|
|
17200
|
+
scanNext();
|
|
17201
|
+
let isFirstElement = true;
|
|
17202
|
+
let needsComma = false;
|
|
17203
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
17204
|
+
if (_scanner.getToken() === 5) {
|
|
17205
|
+
if (!needsComma) {
|
|
17206
|
+
handleError(4, [], []);
|
|
17207
|
+
}
|
|
17208
|
+
onSeparator(",");
|
|
17209
|
+
scanNext();
|
|
17210
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
17211
|
+
break;
|
|
17212
|
+
}
|
|
17213
|
+
} else if (needsComma) {
|
|
17214
|
+
handleError(6, [], []);
|
|
17215
|
+
}
|
|
17216
|
+
if (isFirstElement) {
|
|
17217
|
+
_jsonPath.push(0);
|
|
17218
|
+
isFirstElement = false;
|
|
17219
|
+
} else {
|
|
17220
|
+
_jsonPath[_jsonPath.length - 1]++;
|
|
17221
|
+
}
|
|
17222
|
+
if (!parseValue()) {
|
|
17223
|
+
handleError(4, [], [4, 5]);
|
|
17224
|
+
}
|
|
17225
|
+
needsComma = true;
|
|
17226
|
+
}
|
|
17227
|
+
onArrayEnd();
|
|
17228
|
+
if (!isFirstElement) {
|
|
17229
|
+
_jsonPath.pop();
|
|
17230
|
+
}
|
|
17231
|
+
if (_scanner.getToken() !== 4) {
|
|
17232
|
+
handleError(8, [4], []);
|
|
17233
|
+
} else {
|
|
17234
|
+
scanNext();
|
|
17235
|
+
}
|
|
17236
|
+
return true;
|
|
17237
|
+
}
|
|
17238
|
+
function parseValue() {
|
|
17239
|
+
switch (_scanner.getToken()) {
|
|
17240
|
+
case 3:
|
|
17241
|
+
return parseArray();
|
|
17242
|
+
case 1:
|
|
17243
|
+
return parseObject();
|
|
17244
|
+
case 10:
|
|
17245
|
+
return parseString(true);
|
|
17246
|
+
default:
|
|
17247
|
+
return parseLiteral();
|
|
17248
|
+
}
|
|
17249
|
+
}
|
|
17250
|
+
scanNext();
|
|
17251
|
+
if (_scanner.getToken() === 17) {
|
|
17252
|
+
if (options.allowEmptyContent) {
|
|
17253
|
+
return true;
|
|
17254
|
+
}
|
|
17255
|
+
handleError(4, [], []);
|
|
17256
|
+
return false;
|
|
17257
|
+
}
|
|
17258
|
+
if (!parseValue()) {
|
|
17259
|
+
handleError(4, [], []);
|
|
17260
|
+
return false;
|
|
17261
|
+
}
|
|
17262
|
+
if (_scanner.getToken() !== 17) {
|
|
17263
|
+
handleError(9, [], []);
|
|
17264
|
+
}
|
|
17265
|
+
return true;
|
|
17266
|
+
}
|
|
17267
|
+
function getNodeType(value) {
|
|
17268
|
+
switch (typeof value) {
|
|
17269
|
+
case "boolean":
|
|
17270
|
+
return "boolean";
|
|
17271
|
+
case "number":
|
|
17272
|
+
return "number";
|
|
17273
|
+
case "string":
|
|
17274
|
+
return "string";
|
|
17275
|
+
case "object": {
|
|
17276
|
+
if (!value) {
|
|
17277
|
+
return "null";
|
|
17278
|
+
} else if (Array.isArray(value)) {
|
|
17279
|
+
return "array";
|
|
17280
|
+
}
|
|
17281
|
+
return "object";
|
|
17282
|
+
}
|
|
17283
|
+
default:
|
|
17284
|
+
return "null";
|
|
17285
|
+
}
|
|
17286
|
+
}
|
|
17287
|
+
|
|
17288
|
+
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
17289
|
+
var ScanError;
|
|
17290
|
+
(function(ScanError2) {
|
|
17291
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
17292
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
17293
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
17294
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
17295
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
17296
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
17297
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
17298
|
+
})(ScanError || (ScanError = {}));
|
|
17299
|
+
var SyntaxKind;
|
|
17300
|
+
(function(SyntaxKind2) {
|
|
17301
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
17302
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
17303
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
17304
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
17305
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
17306
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
17307
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
17308
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
17309
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
17310
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
17311
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
17312
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
17313
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
17314
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
17315
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
17316
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
17317
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
17318
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
17319
|
+
var parseTree2 = parseTree;
|
|
17320
|
+
var ParseErrorCode;
|
|
17321
|
+
(function(ParseErrorCode2) {
|
|
17322
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
17323
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
17324
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
17325
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
17326
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
17327
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
17328
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
17329
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
17330
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
17331
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
17332
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
17333
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
17334
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
17335
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
17336
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
17337
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
17338
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
17339
|
+
|
|
16469
17340
|
// ../../node_modules/.bun/eslint-visitor-keys@5.0.1/node_modules/eslint-visitor-keys/lib/visitor-keys.js
|
|
16470
17341
|
var KEYS = {
|
|
16471
17342
|
ArrayExpression: ["elements"],
|
|
@@ -16769,7 +17640,7 @@ function isControl(cp) {
|
|
|
16769
17640
|
function isWhitespace(cp) {
|
|
16770
17641
|
return cp === CodePoint.TABULATION || cp === CodePoint.SPACE;
|
|
16771
17642
|
}
|
|
16772
|
-
function
|
|
17643
|
+
function isEOL2(cp) {
|
|
16773
17644
|
return cp === CodePoint.LINE_FEED || cp === CodePoint.CARRIAGE_RETURN;
|
|
16774
17645
|
}
|
|
16775
17646
|
function isUpperLetter(cp) {
|
|
@@ -16781,11 +17652,11 @@ function isLowerLetter(cp) {
|
|
|
16781
17652
|
function isLetter(cp) {
|
|
16782
17653
|
return isLowerLetter(cp) || isUpperLetter(cp);
|
|
16783
17654
|
}
|
|
16784
|
-
function
|
|
17655
|
+
function isDigit2(cp) {
|
|
16785
17656
|
return cp >= CodePoint.DIGIT_0 && cp <= CodePoint.DIGIT_9;
|
|
16786
17657
|
}
|
|
16787
17658
|
function isHexDig(cp) {
|
|
16788
|
-
return
|
|
17659
|
+
return isDigit2(cp) || cp >= CodePoint.LATIN_SMALL_A && cp <= CodePoint.LATIN_SMALL_F || cp >= CodePoint.LATIN_CAPITAL_A && cp <= CodePoint.LATIN_CAPITAL_F;
|
|
16789
17660
|
}
|
|
16790
17661
|
function isOctalDig(cp) {
|
|
16791
17662
|
return cp >= CodePoint.DIGIT_0 && cp <= CodePoint.DIGIT_7;
|
|
@@ -17047,7 +17918,7 @@ var Tokenizer = class {
|
|
|
17047
17918
|
}
|
|
17048
17919
|
}
|
|
17049
17920
|
DATA(cp) {
|
|
17050
|
-
while (isWhitespace(cp) ||
|
|
17921
|
+
while (isWhitespace(cp) || isEOL2(cp))
|
|
17051
17922
|
cp = this.nextCode();
|
|
17052
17923
|
if (cp === CodePoint.HASH) {
|
|
17053
17924
|
this.startToken();
|
|
@@ -17074,7 +17945,7 @@ var Tokenizer = class {
|
|
|
17074
17945
|
this.startToken();
|
|
17075
17946
|
return this.back("NAN_OR_INF");
|
|
17076
17947
|
}
|
|
17077
|
-
if (
|
|
17948
|
+
if (isDigit2(cp)) {
|
|
17078
17949
|
this.startToken();
|
|
17079
17950
|
return this.back("NUMBER");
|
|
17080
17951
|
}
|
|
@@ -17098,7 +17969,7 @@ var Tokenizer = class {
|
|
|
17098
17969
|
if (isControlOtherThanTab(c))
|
|
17099
17970
|
this.reportParseErrorControlChar();
|
|
17100
17971
|
};
|
|
17101
|
-
while (!
|
|
17972
|
+
while (!isEOL2(cp) && cp !== CodePoint.EOF) {
|
|
17102
17973
|
processCommentChar(cp);
|
|
17103
17974
|
cp = this.nextCode();
|
|
17104
17975
|
}
|
|
@@ -17288,7 +18159,7 @@ var Tokenizer = class {
|
|
|
17288
18159
|
SIGN(cp) {
|
|
17289
18160
|
if (cp === CodePoint.LATIN_SMALL_N || cp === CodePoint.LATIN_SMALL_I)
|
|
17290
18161
|
return this.back("NAN_OR_INF");
|
|
17291
|
-
if (
|
|
18162
|
+
if (isDigit2(cp))
|
|
17292
18163
|
return this.back("NUMBER");
|
|
17293
18164
|
return this.reportParseError("unexpected-char");
|
|
17294
18165
|
}
|
|
@@ -17317,7 +18188,7 @@ var Tokenizer = class {
|
|
|
17317
18188
|
if (sign === CodePoint.NULL) {
|
|
17318
18189
|
const startPos = this.codePointIterator.start;
|
|
17319
18190
|
const nextCp$1 = this.nextCode();
|
|
17320
|
-
if (
|
|
18191
|
+
if (isDigit2(nextCp$1)) {
|
|
17321
18192
|
const nextNextCp = this.nextCode();
|
|
17322
18193
|
if (nextNextCp === CodePoint.COLON) {
|
|
17323
18194
|
this.data = {
|
|
@@ -17331,9 +18202,9 @@ var Tokenizer = class {
|
|
|
17331
18202
|
};
|
|
17332
18203
|
return "TIME_MINUTE";
|
|
17333
18204
|
}
|
|
17334
|
-
if (
|
|
18205
|
+
if (isDigit2(nextNextCp)) {
|
|
17335
18206
|
const nextNextNextCp = this.nextCode();
|
|
17336
|
-
if (
|
|
18207
|
+
if (isDigit2(nextNextNextCp) && this.eatCode(CodePoint.DASH)) {
|
|
17337
18208
|
this.data = {
|
|
17338
18209
|
hasDate: true,
|
|
17339
18210
|
year: Number(String.fromCodePoint(CodePoint.DIGIT_0, nextCp$1, nextNextCp, nextNextNextCp)),
|
|
@@ -17374,7 +18245,7 @@ var Tokenizer = class {
|
|
|
17374
18245
|
this.endToken("Integer", "start", "0", 10);
|
|
17375
18246
|
return this.back("DATA");
|
|
17376
18247
|
}
|
|
17377
|
-
const { out, nextCp, hasUnderscore } = this.parseDigits(cp,
|
|
18248
|
+
const { out, nextCp, hasUnderscore } = this.parseDigits(cp, isDigit2);
|
|
17378
18249
|
if (nextCp === CodePoint.DASH && sign === CodePoint.NULL && !hasUnderscore && out.length === 4) {
|
|
17379
18250
|
this.data = {
|
|
17380
18251
|
hasDate: true,
|
|
@@ -17433,7 +18304,7 @@ var Tokenizer = class {
|
|
|
17433
18304
|
}
|
|
17434
18305
|
FRACTIONAL_RIGHT(cp) {
|
|
17435
18306
|
const { minus, absInt } = this.data;
|
|
17436
|
-
const { out, nextCp } = this.parseDigits(cp,
|
|
18307
|
+
const { out, nextCp } = this.parseDigits(cp, isDigit2);
|
|
17437
18308
|
const absNum = [
|
|
17438
18309
|
...absInt,
|
|
17439
18310
|
CodePoint.DOT,
|
|
@@ -17457,7 +18328,7 @@ var Tokenizer = class {
|
|
|
17457
18328
|
minus = cp === CodePoint.DASH;
|
|
17458
18329
|
cp = this.nextCode();
|
|
17459
18330
|
}
|
|
17460
|
-
const { out } = this.parseDigits(cp,
|
|
18331
|
+
const { out } = this.parseDigits(cp, isDigit2);
|
|
17461
18332
|
const right = out;
|
|
17462
18333
|
if (minus)
|
|
17463
18334
|
right.unshift(CodePoint.DASH);
|
|
@@ -17485,10 +18356,10 @@ var Tokenizer = class {
|
|
|
17485
18356
|
}
|
|
17486
18357
|
DATE_MONTH(cp) {
|
|
17487
18358
|
const start = this.codePointIterator.start;
|
|
17488
|
-
if (!
|
|
18359
|
+
if (!isDigit2(cp))
|
|
17489
18360
|
return this.reportParseError("unexpected-char");
|
|
17490
18361
|
cp = this.nextCode();
|
|
17491
|
-
if (!
|
|
18362
|
+
if (!isDigit2(cp))
|
|
17492
18363
|
return this.reportParseError("unexpected-char");
|
|
17493
18364
|
cp = this.nextCode();
|
|
17494
18365
|
if (cp !== CodePoint.DASH)
|
|
@@ -17500,10 +18371,10 @@ var Tokenizer = class {
|
|
|
17500
18371
|
}
|
|
17501
18372
|
DATE_DAY(cp) {
|
|
17502
18373
|
const start = this.codePointIterator.start;
|
|
17503
|
-
if (!
|
|
18374
|
+
if (!isDigit2(cp))
|
|
17504
18375
|
return this.reportParseError("unexpected-char");
|
|
17505
18376
|
cp = this.nextCode();
|
|
17506
|
-
if (!
|
|
18377
|
+
if (!isDigit2(cp))
|
|
17507
18378
|
return this.reportParseError("unexpected-char");
|
|
17508
18379
|
const end = this.codePointIterator.end;
|
|
17509
18380
|
const data = this.data;
|
|
@@ -17515,7 +18386,7 @@ var Tokenizer = class {
|
|
|
17515
18386
|
return "TIME_HOUR";
|
|
17516
18387
|
if (cp === CodePoint.SPACE) {
|
|
17517
18388
|
const startPos = this.codePointIterator.start;
|
|
17518
|
-
if (
|
|
18389
|
+
if (isDigit2(this.nextCode()) && isDigit2(this.nextCode())) {
|
|
17519
18390
|
this.moveAt(startPos);
|
|
17520
18391
|
return "TIME_HOUR";
|
|
17521
18392
|
}
|
|
@@ -17527,10 +18398,10 @@ var Tokenizer = class {
|
|
|
17527
18398
|
}
|
|
17528
18399
|
TIME_HOUR(cp) {
|
|
17529
18400
|
const start = this.codePointIterator.start;
|
|
17530
|
-
if (!
|
|
18401
|
+
if (!isDigit2(cp))
|
|
17531
18402
|
return this.reportParseError("unexpected-char");
|
|
17532
18403
|
cp = this.nextCode();
|
|
17533
|
-
if (!
|
|
18404
|
+
if (!isDigit2(cp))
|
|
17534
18405
|
return this.reportParseError("unexpected-char");
|
|
17535
18406
|
cp = this.nextCode();
|
|
17536
18407
|
if (cp !== CodePoint.COLON)
|
|
@@ -17542,10 +18413,10 @@ var Tokenizer = class {
|
|
|
17542
18413
|
}
|
|
17543
18414
|
TIME_MINUTE(cp) {
|
|
17544
18415
|
const start = this.codePointIterator.start;
|
|
17545
|
-
if (!
|
|
18416
|
+
if (!isDigit2(cp))
|
|
17546
18417
|
return this.reportParseError("unexpected-char");
|
|
17547
18418
|
cp = this.nextCode();
|
|
17548
|
-
if (!
|
|
18419
|
+
if (!isDigit2(cp))
|
|
17549
18420
|
return this.reportParseError("unexpected-char");
|
|
17550
18421
|
const end = this.codePointIterator.end;
|
|
17551
18422
|
const data = this.data;
|
|
@@ -17561,10 +18432,10 @@ var Tokenizer = class {
|
|
|
17561
18432
|
}
|
|
17562
18433
|
TIME_SECOND(cp) {
|
|
17563
18434
|
const start = this.codePointIterator.start;
|
|
17564
|
-
if (!
|
|
18435
|
+
if (!isDigit2(cp))
|
|
17565
18436
|
return this.reportParseError("unexpected-char");
|
|
17566
18437
|
cp = this.nextCode();
|
|
17567
|
-
if (!
|
|
18438
|
+
if (!isDigit2(cp))
|
|
17568
18439
|
return this.reportParseError("unexpected-char");
|
|
17569
18440
|
const end = this.codePointIterator.end;
|
|
17570
18441
|
const data = this.data;
|
|
@@ -17577,10 +18448,10 @@ var Tokenizer = class {
|
|
|
17577
18448
|
return this.processTimeEnd(cp, data);
|
|
17578
18449
|
}
|
|
17579
18450
|
TIME_SEC_FRAC(cp) {
|
|
17580
|
-
if (!
|
|
18451
|
+
if (!isDigit2(cp))
|
|
17581
18452
|
return this.reportParseError("unexpected-char");
|
|
17582
18453
|
const start = this.codePointIterator.start;
|
|
17583
|
-
while (
|
|
18454
|
+
while (isDigit2(cp))
|
|
17584
18455
|
cp = this.nextCode();
|
|
17585
18456
|
const end = this.codePointIterator.start;
|
|
17586
18457
|
const data = this.data;
|
|
@@ -17607,11 +18478,11 @@ var Tokenizer = class {
|
|
|
17607
18478
|
return this.back("DATA");
|
|
17608
18479
|
}
|
|
17609
18480
|
TIME_OFFSET(cp) {
|
|
17610
|
-
if (!
|
|
18481
|
+
if (!isDigit2(cp))
|
|
17611
18482
|
return this.reportParseError("unexpected-char");
|
|
17612
18483
|
const hourStart = this.codePointIterator.start;
|
|
17613
18484
|
cp = this.nextCode();
|
|
17614
|
-
if (!
|
|
18485
|
+
if (!isDigit2(cp))
|
|
17615
18486
|
return this.reportParseError("unexpected-char");
|
|
17616
18487
|
cp = this.nextCode();
|
|
17617
18488
|
if (cp !== CodePoint.COLON)
|
|
@@ -17619,10 +18490,10 @@ var Tokenizer = class {
|
|
|
17619
18490
|
const hourEnd = this.codePointIterator.start;
|
|
17620
18491
|
cp = this.nextCode();
|
|
17621
18492
|
const minuteStart = this.codePointIterator.start;
|
|
17622
|
-
if (!
|
|
18493
|
+
if (!isDigit2(cp))
|
|
17623
18494
|
return this.reportParseError("unexpected-char");
|
|
17624
18495
|
cp = this.nextCode();
|
|
17625
|
-
if (!
|
|
18496
|
+
if (!isDigit2(cp))
|
|
17626
18497
|
return this.reportParseError("unexpected-char");
|
|
17627
18498
|
const minuteEnd = this.codePointIterator.end;
|
|
17628
18499
|
const hour = Number(this.text.slice(hourStart, hourEnd));
|
|
@@ -17686,7 +18557,7 @@ var Tokenizer = class {
|
|
|
17686
18557
|
}
|
|
17687
18558
|
};
|
|
17688
18559
|
function isUnquotedKeyChar(cp, tomlVersion) {
|
|
17689
|
-
if (isLetter(cp) ||
|
|
18560
|
+
if (isLetter(cp) || isDigit2(cp) || cp === CodePoint.UNDERSCORE || cp === CodePoint.DASH)
|
|
17690
18561
|
return true;
|
|
17691
18562
|
if (tomlVersion.lt(1, 1))
|
|
17692
18563
|
return false;
|
|
@@ -18765,11 +19636,9 @@ function yamlLocation(document, lineCounter, logicalPath, documentPrefixLength)
|
|
|
18765
19636
|
const position = lineCounter.linePos(offset);
|
|
18766
19637
|
return { line: position.line, column: position.col };
|
|
18767
19638
|
}
|
|
18768
|
-
function parseYamlLike(context, source
|
|
18769
|
-
if (strictJson)
|
|
18770
|
-
JSON.parse(source);
|
|
19639
|
+
function parseYamlLike(context, source) {
|
|
18771
19640
|
const lineCounter = new import_yaml2.LineCounter;
|
|
18772
|
-
const documents =
|
|
19641
|
+
const documents = import_yaml2.parseAllDocuments(source, { lineCounter, strict: true, uniqueKeys: true });
|
|
18773
19642
|
if (documents.length === 0)
|
|
18774
19643
|
throw new TypeError("configuration document is empty");
|
|
18775
19644
|
for (const [documentIndex, document] of documents.entries()) {
|
|
@@ -18781,6 +19650,74 @@ function parseYamlLike(context, source, strictJson) {
|
|
|
18781
19650
|
walkValue(context, value, prefix, (path5) => yamlLocation(document, lineCounter, path5, prefix.length));
|
|
18782
19651
|
}
|
|
18783
19652
|
}
|
|
19653
|
+
function jsonLineStarts(source) {
|
|
19654
|
+
const starts = [0];
|
|
19655
|
+
for (let index = 0;index < source.length; index += 1) {
|
|
19656
|
+
if (source.charCodeAt(index) === 10)
|
|
19657
|
+
starts.push(index + 1);
|
|
19658
|
+
}
|
|
19659
|
+
return starts;
|
|
19660
|
+
}
|
|
19661
|
+
function jsonLocation(lineStarts, offset) {
|
|
19662
|
+
let low = 0;
|
|
19663
|
+
let high = lineStarts.length;
|
|
19664
|
+
while (low + 1 < high) {
|
|
19665
|
+
const middle = Math.floor((low + high) / 2);
|
|
19666
|
+
if (lineStarts[middle] <= offset)
|
|
19667
|
+
low = middle;
|
|
19668
|
+
else
|
|
19669
|
+
high = middle;
|
|
19670
|
+
}
|
|
19671
|
+
return { line: low + 1, column: offset - lineStarts[low] + 1 };
|
|
19672
|
+
}
|
|
19673
|
+
function jsonScalar(node2) {
|
|
19674
|
+
if (node2.type === "null")
|
|
19675
|
+
return null;
|
|
19676
|
+
if (node2.type === "string" || node2.type === "number" || node2.type === "boolean") {
|
|
19677
|
+
return node2.value;
|
|
19678
|
+
}
|
|
19679
|
+
throw new TypeError(`unsupported JSON scalar node ${node2.type}`);
|
|
19680
|
+
}
|
|
19681
|
+
function walkJsonNode(context, node2, keyPath, lineStarts) {
|
|
19682
|
+
const location = jsonLocation(lineStarts, node2.offset);
|
|
19683
|
+
if (node2.type === "object") {
|
|
19684
|
+
addValue(context, keyPath, {}, location);
|
|
19685
|
+
const keys = new Set;
|
|
19686
|
+
for (const property of node2.children ?? []) {
|
|
19687
|
+
const [keyNode, valueNode] = property.children ?? [];
|
|
19688
|
+
if (property.type !== "property" || keyNode?.type !== "string" || typeof keyNode.value !== "string" || valueNode === undefined) {
|
|
19689
|
+
throw new TypeError("JSON object property is unstable");
|
|
19690
|
+
}
|
|
19691
|
+
if (keys.has(keyNode.value))
|
|
19692
|
+
throw new TypeError("JSON object contains a duplicate key");
|
|
19693
|
+
keys.add(keyNode.value);
|
|
19694
|
+
walkJsonNode(context, valueNode, [...keyPath, keyNode.value], lineStarts);
|
|
19695
|
+
}
|
|
19696
|
+
return;
|
|
19697
|
+
}
|
|
19698
|
+
if (node2.type === "array") {
|
|
19699
|
+
addValue(context, keyPath, [], location);
|
|
19700
|
+
for (const [index, child] of (node2.children ?? []).entries()) {
|
|
19701
|
+
walkJsonNode(context, child, [...keyPath, String(index)], lineStarts);
|
|
19702
|
+
}
|
|
19703
|
+
return;
|
|
19704
|
+
}
|
|
19705
|
+
if (node2.type === "property")
|
|
19706
|
+
throw new TypeError("JSON property cannot be a value root");
|
|
19707
|
+
addValue(context, keyPath, jsonScalar(node2), location);
|
|
19708
|
+
}
|
|
19709
|
+
function parseJsonLike(context, source) {
|
|
19710
|
+
const errors3 = [];
|
|
19711
|
+
const root = parseTree2(source, errors3, {
|
|
19712
|
+
allowTrailingComma: true,
|
|
19713
|
+
disallowComments: false,
|
|
19714
|
+
allowEmptyContent: false
|
|
19715
|
+
});
|
|
19716
|
+
if (root === undefined || errors3.length > 0) {
|
|
19717
|
+
throw new TypeError("JSON configuration syntax is invalid");
|
|
19718
|
+
}
|
|
19719
|
+
walkJsonNode(context, root, [], jsonLineStarts(source));
|
|
19720
|
+
}
|
|
18784
19721
|
function tomlKey(node2) {
|
|
18785
19722
|
return node2.keys.map((item) => item.type === "TOMLBare" ? item.name : item.value);
|
|
18786
19723
|
}
|
|
@@ -18863,31 +19800,33 @@ function validatedAllowlists(options) {
|
|
|
18863
19800
|
}
|
|
18864
19801
|
return byFile;
|
|
18865
19802
|
}
|
|
18866
|
-
function parseOne(path5, source,
|
|
18867
|
-
if (
|
|
18868
|
-
return { path: path5, format, disposition: "excluded", values: [], diagnostics: [] };
|
|
19803
|
+
function parseOne(path5, source, format2, allowlist) {
|
|
19804
|
+
if (format2 === "excluded")
|
|
19805
|
+
return { path: path5, format: format2, disposition: "excluded", values: [], diagnostics: [] };
|
|
18869
19806
|
const context = {
|
|
18870
19807
|
path: path5,
|
|
18871
|
-
format,
|
|
18872
|
-
configRef: `config:${indexerEvidenceAdapterProtocolDigest({ path: path5, format })}`,
|
|
19808
|
+
format: format2,
|
|
19809
|
+
configRef: `config:${indexerEvidenceAdapterProtocolDigest({ path: path5, format: format2 })}`,
|
|
18873
19810
|
allowlist,
|
|
18874
19811
|
diagnostics: [],
|
|
18875
19812
|
values: []
|
|
18876
19813
|
};
|
|
18877
19814
|
try {
|
|
18878
|
-
if (
|
|
19815
|
+
if (format2 === "toml")
|
|
18879
19816
|
parseToml(context, source);
|
|
19817
|
+
else if (format2 === "json")
|
|
19818
|
+
parseJsonLike(context, source);
|
|
18880
19819
|
else
|
|
18881
|
-
parseYamlLike(context, source
|
|
18882
|
-
return { path: path5, format, disposition: "analyzed", values: context.values, diagnostics: context.diagnostics };
|
|
19820
|
+
parseYamlLike(context, source);
|
|
19821
|
+
return { path: path5, format: format2, disposition: "analyzed", values: context.values, diagnostics: context.diagnostics };
|
|
18883
19822
|
} catch {
|
|
18884
19823
|
const root = locator(path5, [], { line: 1, column: 1 });
|
|
18885
19824
|
return {
|
|
18886
19825
|
path: path5,
|
|
18887
|
-
format,
|
|
19826
|
+
format: format2,
|
|
18888
19827
|
disposition: "unsupported",
|
|
18889
19828
|
values: [],
|
|
18890
|
-
diagnostics: [{ code: "config-source-unsupported", severity: "error", locator: root, detail: `${
|
|
19829
|
+
diagnostics: [{ code: "config-source-unsupported", severity: "error", locator: root, detail: `${format2} configuration could not be analyzed` }]
|
|
18891
19830
|
};
|
|
18892
19831
|
}
|
|
18893
19832
|
}
|
|
@@ -19122,7 +20061,7 @@ var detectTechStack = async (repoPath) => {
|
|
|
19122
20061
|
};
|
|
19123
20062
|
|
|
19124
20063
|
// src/index.ts
|
|
19125
|
-
var CONFIG_EVIDENCE_ADAPTER_EXPORT = "
|
|
20064
|
+
var CONFIG_EVIDENCE_ADAPTER_EXPORT = "configSourcesToEvidenceAdapterMaterialization";
|
|
19126
20065
|
export {
|
|
19127
20066
|
visibilitySchema,
|
|
19128
20067
|
truncateSourceSpanHash,
|