@c4a/extract 0.6.2 → 0.6.3
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/bin/c4a-extract-code.js +196 -346
- package/index.js +337 -364
- package/package.json +4 -1
package/bin/c4a-extract-code.js
CHANGED
|
@@ -321,26 +321,26 @@ var require_directives = __commonJS((exports) => {
|
|
|
321
321
|
return false;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
tagName(
|
|
325
|
-
if (
|
|
324
|
+
tagName(source, onError) {
|
|
325
|
+
if (source === "!")
|
|
326
326
|
return "!";
|
|
327
|
-
if (
|
|
328
|
-
onError(`Not a valid tag: ${
|
|
327
|
+
if (source[0] !== "!") {
|
|
328
|
+
onError(`Not a valid tag: ${source}`);
|
|
329
329
|
return null;
|
|
330
330
|
}
|
|
331
|
-
if (
|
|
332
|
-
const verbatim =
|
|
331
|
+
if (source[1] === "<") {
|
|
332
|
+
const verbatim = source.slice(2, -1);
|
|
333
333
|
if (verbatim === "!" || verbatim === "!!") {
|
|
334
|
-
onError(`Verbatim tags aren't resolved, so ${
|
|
334
|
+
onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
|
|
335
335
|
return null;
|
|
336
336
|
}
|
|
337
|
-
if (
|
|
337
|
+
if (source[source.length - 1] !== ">")
|
|
338
338
|
onError("Verbatim tags must end with a >");
|
|
339
339
|
return verbatim;
|
|
340
340
|
}
|
|
341
|
-
const [, handle, suffix] =
|
|
341
|
+
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
|
|
342
342
|
if (!suffix)
|
|
343
|
-
onError(`The ${
|
|
343
|
+
onError(`The ${source} tag has no suffix`);
|
|
344
344
|
const prefix = this.tags[handle];
|
|
345
345
|
if (prefix) {
|
|
346
346
|
try {
|
|
@@ -351,8 +351,8 @@ var require_directives = __commonJS((exports) => {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
if (handle === "!")
|
|
354
|
-
return
|
|
355
|
-
onError(`Could not resolve tag: ${
|
|
354
|
+
return source;
|
|
355
|
+
onError(`Could not resolve tag: ${source}`);
|
|
356
356
|
return null;
|
|
357
357
|
}
|
|
358
358
|
tagString(tag) {
|
|
@@ -424,21 +424,21 @@ var require_anchors = __commonJS((exports) => {
|
|
|
424
424
|
const sourceObjects = new Map;
|
|
425
425
|
let prevAnchors = null;
|
|
426
426
|
return {
|
|
427
|
-
onAnchor: (
|
|
428
|
-
aliasObjects.push(
|
|
427
|
+
onAnchor: (source) => {
|
|
428
|
+
aliasObjects.push(source);
|
|
429
429
|
prevAnchors ?? (prevAnchors = anchorNames(doc));
|
|
430
430
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
431
431
|
prevAnchors.add(anchor);
|
|
432
432
|
return anchor;
|
|
433
433
|
},
|
|
434
434
|
setAnchors: () => {
|
|
435
|
-
for (const
|
|
436
|
-
const ref = sourceObjects.get(
|
|
435
|
+
for (const source of aliasObjects) {
|
|
436
|
+
const ref = sourceObjects.get(source);
|
|
437
437
|
if (typeof ref === "object" && ref.anchor && (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {
|
|
438
438
|
ref.node.anchor = ref.anchor;
|
|
439
439
|
} else {
|
|
440
440
|
const error = new Error("Failed to resolve repeated object (this should not happen)");
|
|
441
|
-
error.source =
|
|
441
|
+
error.source = source;
|
|
442
442
|
throw error;
|
|
443
443
|
}
|
|
444
444
|
}
|
|
@@ -572,9 +572,9 @@ var require_Alias = __commonJS((exports) => {
|
|
|
572
572
|
var toJS = require_toJS();
|
|
573
573
|
|
|
574
574
|
class Alias extends Node.NodeBase {
|
|
575
|
-
constructor(
|
|
575
|
+
constructor(source) {
|
|
576
576
|
super(identity.ALIAS);
|
|
577
|
-
this.source =
|
|
577
|
+
this.source = source;
|
|
578
578
|
Object.defineProperty(this, "tag", {
|
|
579
579
|
set() {
|
|
580
580
|
throw new Error("Alias nodes cannot have tags");
|
|
@@ -609,15 +609,15 @@ var require_Alias = __commonJS((exports) => {
|
|
|
609
609
|
if (!ctx)
|
|
610
610
|
return { source: this.source };
|
|
611
611
|
const { anchors: anchors2, doc, maxAliasCount } = ctx;
|
|
612
|
-
const
|
|
613
|
-
if (!
|
|
612
|
+
const source = this.resolve(doc, ctx);
|
|
613
|
+
if (!source) {
|
|
614
614
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
615
615
|
throw new ReferenceError(msg);
|
|
616
616
|
}
|
|
617
|
-
let data = anchors2.get(
|
|
617
|
+
let data = anchors2.get(source);
|
|
618
618
|
if (!data) {
|
|
619
|
-
toJS.toJS(
|
|
620
|
-
data = anchors2.get(
|
|
619
|
+
toJS.toJS(source, null, ctx);
|
|
620
|
+
data = anchors2.get(source);
|
|
621
621
|
}
|
|
622
622
|
if (data?.res === undefined) {
|
|
623
623
|
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
@@ -626,7 +626,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
626
626
|
if (maxAliasCount >= 0) {
|
|
627
627
|
data.count += 1;
|
|
628
628
|
if (data.aliasCount === 0)
|
|
629
|
-
data.aliasCount = getAliasCount(doc,
|
|
629
|
+
data.aliasCount = getAliasCount(doc, source, anchors2);
|
|
630
630
|
if (data.count * data.aliasCount > maxAliasCount) {
|
|
631
631
|
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
632
632
|
throw new ReferenceError(msg);
|
|
@@ -650,8 +650,8 @@ var require_Alias = __commonJS((exports) => {
|
|
|
650
650
|
}
|
|
651
651
|
function getAliasCount(doc, node2, anchors2) {
|
|
652
652
|
if (identity.isAlias(node2)) {
|
|
653
|
-
const
|
|
654
|
-
const anchor = anchors2 &&
|
|
653
|
+
const source = node2.resolve(doc);
|
|
654
|
+
const anchor = anchors2 && source && anchors2.get(source);
|
|
655
655
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
656
656
|
} else if (identity.isCollection(node2)) {
|
|
657
657
|
let count = 0;
|
|
@@ -1641,10 +1641,10 @@ var require_merge = __commonJS((exports) => {
|
|
|
1641
1641
|
mergeValue(ctx, map, value);
|
|
1642
1642
|
}
|
|
1643
1643
|
function mergeValue(ctx, map, value) {
|
|
1644
|
-
const
|
|
1645
|
-
if (!identity.isMap(
|
|
1644
|
+
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1645
|
+
if (!identity.isMap(source))
|
|
1646
1646
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1647
|
-
const srcMap =
|
|
1647
|
+
const srcMap = source.toJSON(null, ctx, Map);
|
|
1648
1648
|
for (const [key, value2] of srcMap) {
|
|
1649
1649
|
if (map instanceof Map) {
|
|
1650
1650
|
if (!map.has(key))
|
|
@@ -2195,7 +2195,7 @@ var require_null = __commonJS((exports) => {
|
|
|
2195
2195
|
tag: "tag:yaml.org,2002:null",
|
|
2196
2196
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
2197
2197
|
resolve: () => new Scalar.Scalar(null),
|
|
2198
|
-
stringify: ({ source
|
|
2198
|
+
stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
|
|
2199
2199
|
};
|
|
2200
2200
|
exports.nullTag = nullTag;
|
|
2201
2201
|
});
|
|
@@ -2209,11 +2209,11 @@ var require_bool = __commonJS((exports) => {
|
|
|
2209
2209
|
tag: "tag:yaml.org,2002:bool",
|
|
2210
2210
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
2211
2211
|
resolve: (str) => new Scalar.Scalar(str[0] === "t" || str[0] === "T"),
|
|
2212
|
-
stringify({ source
|
|
2213
|
-
if (
|
|
2214
|
-
const sv =
|
|
2212
|
+
stringify({ source, value }, ctx) {
|
|
2213
|
+
if (source && boolTag.test.test(source)) {
|
|
2214
|
+
const sv = source[0] === "t" || source[0] === "T";
|
|
2215
2215
|
if (value === sv)
|
|
2216
|
-
return
|
|
2216
|
+
return source;
|
|
2217
2217
|
}
|
|
2218
2218
|
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
|
2219
2219
|
}
|
|
@@ -2624,10 +2624,10 @@ var require_omap = __commonJS((exports) => {
|
|
|
2624
2624
|
// ../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2625
2625
|
var require_bool2 = __commonJS((exports) => {
|
|
2626
2626
|
var Scalar = require_Scalar();
|
|
2627
|
-
function boolStringify({ value, source
|
|
2627
|
+
function boolStringify({ value, source }, ctx) {
|
|
2628
2628
|
const boolObj = value ? trueTag : falseTag;
|
|
2629
|
-
if (
|
|
2630
|
-
return
|
|
2629
|
+
if (source && boolObj.test.test(source))
|
|
2630
|
+
return source;
|
|
2631
2631
|
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
|
2632
2632
|
}
|
|
2633
2633
|
var trueTag = {
|
|
@@ -3840,7 +3840,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
3840
3840
|
let hasSpace = false;
|
|
3841
3841
|
let sep = "";
|
|
3842
3842
|
for (const token of end) {
|
|
3843
|
-
const { source
|
|
3843
|
+
const { source, type } = token;
|
|
3844
3844
|
switch (type) {
|
|
3845
3845
|
case "space":
|
|
3846
3846
|
hasSpace = true;
|
|
@@ -3848,7 +3848,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
3848
3848
|
case "comment": {
|
|
3849
3849
|
if (reqSpace && !hasSpace)
|
|
3850
3850
|
onError(token, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
3851
|
-
const cb =
|
|
3851
|
+
const cb = source.substring(1) || " ";
|
|
3852
3852
|
if (!comment)
|
|
3853
3853
|
comment = cb;
|
|
3854
3854
|
else
|
|
@@ -3858,13 +3858,13 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
3858
3858
|
}
|
|
3859
3859
|
case "newline":
|
|
3860
3860
|
if (comment)
|
|
3861
|
-
sep +=
|
|
3861
|
+
sep += source;
|
|
3862
3862
|
hasSpace = true;
|
|
3863
3863
|
break;
|
|
3864
3864
|
default:
|
|
3865
3865
|
onError(token, "UNEXPECTED_TOKEN", `Unexpected ${type} at node end`);
|
|
3866
3866
|
}
|
|
3867
|
-
offset +=
|
|
3867
|
+
offset += source.length;
|
|
3868
3868
|
}
|
|
3869
3869
|
}
|
|
3870
3870
|
return { comment, offset };
|
|
@@ -4252,13 +4252,13 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4252
4252
|
onError(props[0], "IMPOSSIBLE", "Block scalar header not found");
|
|
4253
4253
|
return null;
|
|
4254
4254
|
}
|
|
4255
|
-
const { source
|
|
4256
|
-
const mode =
|
|
4255
|
+
const { source } = props[0];
|
|
4256
|
+
const mode = source[0];
|
|
4257
4257
|
let indent = 0;
|
|
4258
4258
|
let chomp = "";
|
|
4259
4259
|
let error = -1;
|
|
4260
|
-
for (let i = 1;i <
|
|
4261
|
-
const ch =
|
|
4260
|
+
for (let i = 1;i < source.length; ++i) {
|
|
4261
|
+
const ch = source[i];
|
|
4262
4262
|
if (!chomp && (ch === "-" || ch === "+"))
|
|
4263
4263
|
chomp = ch;
|
|
4264
4264
|
else {
|
|
@@ -4270,10 +4270,10 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4270
4270
|
}
|
|
4271
4271
|
}
|
|
4272
4272
|
if (error !== -1)
|
|
4273
|
-
onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${
|
|
4273
|
+
onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`);
|
|
4274
4274
|
let hasSpace = false;
|
|
4275
4275
|
let comment = "";
|
|
4276
|
-
let length =
|
|
4276
|
+
let length = source.length;
|
|
4277
4277
|
for (let i = 1;i < props.length; ++i) {
|
|
4278
4278
|
const token = props[i];
|
|
4279
4279
|
switch (token.type) {
|
|
@@ -4305,8 +4305,8 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
4305
4305
|
}
|
|
4306
4306
|
return { mode, indent, chomp, comment, length };
|
|
4307
4307
|
}
|
|
4308
|
-
function splitLines(
|
|
4309
|
-
const split =
|
|
4308
|
+
function splitLines(source) {
|
|
4309
|
+
const split = source.split(/\n( *)/);
|
|
4310
4310
|
const first = split[0];
|
|
4311
4311
|
const m = first.match(/^( *)/);
|
|
4312
4312
|
const line0 = m?.[1] ? [m[1], first.slice(m[1].length)] : ["", first];
|
|
@@ -4323,22 +4323,22 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4323
4323
|
var Scalar = require_Scalar();
|
|
4324
4324
|
var resolveEnd = require_resolve_end();
|
|
4325
4325
|
function resolveFlowScalar(scalar, strict, onError) {
|
|
4326
|
-
const { offset, type, source
|
|
4326
|
+
const { offset, type, source, end } = scalar;
|
|
4327
4327
|
let _type;
|
|
4328
4328
|
let value;
|
|
4329
4329
|
const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
|
|
4330
4330
|
switch (type) {
|
|
4331
4331
|
case "scalar":
|
|
4332
4332
|
_type = Scalar.Scalar.PLAIN;
|
|
4333
|
-
value = plainValue(
|
|
4333
|
+
value = plainValue(source, _onError);
|
|
4334
4334
|
break;
|
|
4335
4335
|
case "single-quoted-scalar":
|
|
4336
4336
|
_type = Scalar.Scalar.QUOTE_SINGLE;
|
|
4337
|
-
value = singleQuotedValue(
|
|
4337
|
+
value = singleQuotedValue(source, _onError);
|
|
4338
4338
|
break;
|
|
4339
4339
|
case "double-quoted-scalar":
|
|
4340
4340
|
_type = Scalar.Scalar.QUOTE_DOUBLE;
|
|
4341
|
-
value = doubleQuotedValue(
|
|
4341
|
+
value = doubleQuotedValue(source, _onError);
|
|
4342
4342
|
break;
|
|
4343
4343
|
default:
|
|
4344
4344
|
onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
|
|
@@ -4346,10 +4346,10 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4346
4346
|
value: "",
|
|
4347
4347
|
type: null,
|
|
4348
4348
|
comment: "",
|
|
4349
|
-
range: [offset, offset +
|
|
4349
|
+
range: [offset, offset + source.length, offset + source.length]
|
|
4350
4350
|
};
|
|
4351
4351
|
}
|
|
4352
|
-
const valueEnd = offset +
|
|
4352
|
+
const valueEnd = offset + source.length;
|
|
4353
4353
|
const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);
|
|
4354
4354
|
return {
|
|
4355
4355
|
value,
|
|
@@ -4358,9 +4358,9 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4358
4358
|
range: [offset, valueEnd, re.offset]
|
|
4359
4359
|
};
|
|
4360
4360
|
}
|
|
4361
|
-
function plainValue(
|
|
4361
|
+
function plainValue(source, onError) {
|
|
4362
4362
|
let badChar = "";
|
|
4363
|
-
switch (
|
|
4363
|
+
switch (source[0]) {
|
|
4364
4364
|
case "\t":
|
|
4365
4365
|
badChar = "a tab character";
|
|
4366
4366
|
break;
|
|
@@ -4372,25 +4372,25 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4372
4372
|
break;
|
|
4373
4373
|
case "|":
|
|
4374
4374
|
case ">": {
|
|
4375
|
-
badChar = `block scalar indicator ${
|
|
4375
|
+
badChar = `block scalar indicator ${source[0]}`;
|
|
4376
4376
|
break;
|
|
4377
4377
|
}
|
|
4378
4378
|
case "@":
|
|
4379
4379
|
case "`": {
|
|
4380
|
-
badChar = `reserved character ${
|
|
4380
|
+
badChar = `reserved character ${source[0]}`;
|
|
4381
4381
|
break;
|
|
4382
4382
|
}
|
|
4383
4383
|
}
|
|
4384
4384
|
if (badChar)
|
|
4385
4385
|
onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
|
|
4386
|
-
return foldLines(
|
|
4386
|
+
return foldLines(source);
|
|
4387
4387
|
}
|
|
4388
|
-
function singleQuotedValue(
|
|
4389
|
-
if (
|
|
4390
|
-
onError(
|
|
4391
|
-
return foldLines(
|
|
4388
|
+
function singleQuotedValue(source, onError) {
|
|
4389
|
+
if (source[source.length - 1] !== "'" || source.length === 1)
|
|
4390
|
+
onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
|
|
4391
|
+
return foldLines(source.slice(1, -1)).replace(/''/g, "'");
|
|
4392
4392
|
}
|
|
4393
|
-
function foldLines(
|
|
4393
|
+
function foldLines(source) {
|
|
4394
4394
|
let first, line;
|
|
4395
4395
|
try {
|
|
4396
4396
|
first = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -4401,14 +4401,14 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4401
4401
|
first = /(.*?)[ \t]*\r?\n/sy;
|
|
4402
4402
|
line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
|
|
4403
4403
|
}
|
|
4404
|
-
let match = first.exec(
|
|
4404
|
+
let match = first.exec(source);
|
|
4405
4405
|
if (!match)
|
|
4406
|
-
return
|
|
4406
|
+
return source;
|
|
4407
4407
|
let res = match[1];
|
|
4408
4408
|
let sep = " ";
|
|
4409
4409
|
let pos = first.lastIndex;
|
|
4410
4410
|
line.lastIndex = pos;
|
|
4411
|
-
while (match = line.exec(
|
|
4411
|
+
while (match = line.exec(source)) {
|
|
4412
4412
|
if (match[1] === "") {
|
|
4413
4413
|
if (sep === `
|
|
4414
4414
|
`)
|
|
@@ -4424,68 +4424,68 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4424
4424
|
}
|
|
4425
4425
|
const last = /[ \t]*(.*)/sy;
|
|
4426
4426
|
last.lastIndex = pos;
|
|
4427
|
-
match = last.exec(
|
|
4427
|
+
match = last.exec(source);
|
|
4428
4428
|
return res + sep + (match?.[1] ?? "");
|
|
4429
4429
|
}
|
|
4430
|
-
function doubleQuotedValue(
|
|
4430
|
+
function doubleQuotedValue(source, onError) {
|
|
4431
4431
|
let res = "";
|
|
4432
|
-
for (let i = 1;i <
|
|
4433
|
-
const ch =
|
|
4434
|
-
if (ch === "\r" &&
|
|
4432
|
+
for (let i = 1;i < source.length - 1; ++i) {
|
|
4433
|
+
const ch = source[i];
|
|
4434
|
+
if (ch === "\r" && source[i + 1] === `
|
|
4435
4435
|
`)
|
|
4436
4436
|
continue;
|
|
4437
4437
|
if (ch === `
|
|
4438
4438
|
`) {
|
|
4439
|
-
const { fold, offset } = foldNewline(
|
|
4439
|
+
const { fold, offset } = foldNewline(source, i);
|
|
4440
4440
|
res += fold;
|
|
4441
4441
|
i = offset;
|
|
4442
4442
|
} else if (ch === "\\") {
|
|
4443
|
-
let next =
|
|
4443
|
+
let next = source[++i];
|
|
4444
4444
|
const cc = escapeCodes[next];
|
|
4445
4445
|
if (cc)
|
|
4446
4446
|
res += cc;
|
|
4447
4447
|
else if (next === `
|
|
4448
4448
|
`) {
|
|
4449
|
-
next =
|
|
4449
|
+
next = source[i + 1];
|
|
4450
4450
|
while (next === " " || next === "\t")
|
|
4451
|
-
next =
|
|
4452
|
-
} else if (next === "\r" &&
|
|
4451
|
+
next = source[++i + 1];
|
|
4452
|
+
} else if (next === "\r" && source[i + 1] === `
|
|
4453
4453
|
`) {
|
|
4454
|
-
next =
|
|
4454
|
+
next = source[++i + 1];
|
|
4455
4455
|
while (next === " " || next === "\t")
|
|
4456
|
-
next =
|
|
4456
|
+
next = source[++i + 1];
|
|
4457
4457
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
4458
4458
|
const length = { x: 2, u: 4, U: 8 }[next];
|
|
4459
|
-
res += parseCharCode(
|
|
4459
|
+
res += parseCharCode(source, i + 1, length, onError);
|
|
4460
4460
|
i += length;
|
|
4461
4461
|
} else {
|
|
4462
|
-
const raw =
|
|
4462
|
+
const raw = source.substr(i - 1, 2);
|
|
4463
4463
|
onError(i - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
4464
4464
|
res += raw;
|
|
4465
4465
|
}
|
|
4466
4466
|
} else if (ch === " " || ch === "\t") {
|
|
4467
4467
|
const wsStart = i;
|
|
4468
|
-
let next =
|
|
4468
|
+
let next = source[i + 1];
|
|
4469
4469
|
while (next === " " || next === "\t")
|
|
4470
|
-
next =
|
|
4470
|
+
next = source[++i + 1];
|
|
4471
4471
|
if (next !== `
|
|
4472
|
-
` && !(next === "\r" &&
|
|
4472
|
+
` && !(next === "\r" && source[i + 2] === `
|
|
4473
4473
|
`))
|
|
4474
|
-
res += i > wsStart ?
|
|
4474
|
+
res += i > wsStart ? source.slice(wsStart, i + 1) : ch;
|
|
4475
4475
|
} else {
|
|
4476
4476
|
res += ch;
|
|
4477
4477
|
}
|
|
4478
4478
|
}
|
|
4479
|
-
if (
|
|
4480
|
-
onError(
|
|
4479
|
+
if (source[source.length - 1] !== '"' || source.length === 1)
|
|
4480
|
+
onError(source.length, "MISSING_CHAR", 'Missing closing "quote');
|
|
4481
4481
|
return res;
|
|
4482
4482
|
}
|
|
4483
|
-
function foldNewline(
|
|
4483
|
+
function foldNewline(source, offset) {
|
|
4484
4484
|
let fold = "";
|
|
4485
|
-
let ch =
|
|
4485
|
+
let ch = source[offset + 1];
|
|
4486
4486
|
while (ch === " " || ch === "\t" || ch === `
|
|
4487
4487
|
` || ch === "\r") {
|
|
4488
|
-
if (ch === "\r" &&
|
|
4488
|
+
if (ch === "\r" && source[offset + 2] !== `
|
|
4489
4489
|
`)
|
|
4490
4490
|
break;
|
|
4491
4491
|
if (ch === `
|
|
@@ -4493,7 +4493,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4493
4493
|
fold += `
|
|
4494
4494
|
`;
|
|
4495
4495
|
offset += 1;
|
|
4496
|
-
ch =
|
|
4496
|
+
ch = source[offset + 1];
|
|
4497
4497
|
}
|
|
4498
4498
|
if (!fold)
|
|
4499
4499
|
fold = " ";
|
|
@@ -4520,12 +4520,12 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
4520
4520
|
"\\": "\\",
|
|
4521
4521
|
"\t": "\t"
|
|
4522
4522
|
};
|
|
4523
|
-
function parseCharCode(
|
|
4524
|
-
const cc =
|
|
4523
|
+
function parseCharCode(source, offset, length, onError) {
|
|
4524
|
+
const cc = source.substr(offset, length);
|
|
4525
4525
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
4526
4526
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
4527
4527
|
if (isNaN(code)) {
|
|
4528
|
-
const raw =
|
|
4528
|
+
const raw = source.substr(offset - 2, length + 2);
|
|
4529
4529
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
4530
4530
|
return raw;
|
|
4531
4531
|
}
|
|
@@ -4720,13 +4720,13 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
4720
4720
|
}
|
|
4721
4721
|
return node2;
|
|
4722
4722
|
}
|
|
4723
|
-
function composeAlias({ options }, { offset, source
|
|
4724
|
-
const alias = new Alias.Alias(
|
|
4723
|
+
function composeAlias({ options }, { offset, source, end }, onError) {
|
|
4724
|
+
const alias = new Alias.Alias(source.substring(1));
|
|
4725
4725
|
if (alias.source === "")
|
|
4726
4726
|
onError(offset, "BAD_ALIAS", "Alias cannot be an empty string");
|
|
4727
4727
|
if (alias.source.endsWith(":"))
|
|
4728
|
-
onError(offset +
|
|
4729
|
-
const valueEnd = offset +
|
|
4728
|
+
onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
|
|
4729
|
+
const valueEnd = offset + source.length;
|
|
4730
4730
|
const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
|
|
4731
4731
|
alias.range = [offset, valueEnd, re.offset];
|
|
4732
4732
|
if (re.comment)
|
|
@@ -4791,21 +4791,21 @@ var require_composer = __commonJS((exports) => {
|
|
|
4791
4791
|
return [src, src + 1];
|
|
4792
4792
|
if (Array.isArray(src))
|
|
4793
4793
|
return src.length === 2 ? src : [src[0], src[1]];
|
|
4794
|
-
const { offset, source
|
|
4795
|
-
return [offset, offset + (typeof
|
|
4794
|
+
const { offset, source } = src;
|
|
4795
|
+
return [offset, offset + (typeof source === "string" ? source.length : 1)];
|
|
4796
4796
|
}
|
|
4797
4797
|
function parsePrelude(prelude) {
|
|
4798
4798
|
let comment = "";
|
|
4799
4799
|
let atComment = false;
|
|
4800
4800
|
let afterEmptyLine = false;
|
|
4801
4801
|
for (let i = 0;i < prelude.length; ++i) {
|
|
4802
|
-
const
|
|
4803
|
-
switch (
|
|
4802
|
+
const source = prelude[i];
|
|
4803
|
+
switch (source[0]) {
|
|
4804
4804
|
case "#":
|
|
4805
4805
|
comment += (comment === "" ? "" : afterEmptyLine ? `
|
|
4806
4806
|
|
|
4807
4807
|
` : `
|
|
4808
|
-
`) + (
|
|
4808
|
+
`) + (source.substring(1) || " ");
|
|
4809
4809
|
atComment = true;
|
|
4810
4810
|
afterEmptyLine = false;
|
|
4811
4811
|
break;
|
|
@@ -4830,8 +4830,8 @@ var require_composer = __commonJS((exports) => {
|
|
|
4830
4830
|
this.prelude = [];
|
|
4831
4831
|
this.errors = [];
|
|
4832
4832
|
this.warnings = [];
|
|
4833
|
-
this.onError = (
|
|
4834
|
-
const pos = getErrorPos(
|
|
4833
|
+
this.onError = (source, code, message, warning) => {
|
|
4834
|
+
const pos = getErrorPos(source);
|
|
4835
4835
|
if (warning)
|
|
4836
4836
|
this.warnings.push(new errors2.YAMLWarning(pos, code, message));
|
|
4837
4837
|
else
|
|
@@ -4994,7 +4994,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
4994
4994
|
}
|
|
4995
4995
|
function createScalarToken(value, context) {
|
|
4996
4996
|
const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } = context;
|
|
4997
|
-
const
|
|
4997
|
+
const source = stringifyString.stringifyString({ type, value }, {
|
|
4998
4998
|
implicitKey,
|
|
4999
4999
|
indent: indent > 0 ? " ".repeat(indent) : "",
|
|
5000
5000
|
inFlow,
|
|
@@ -5004,13 +5004,13 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5004
5004
|
{ type: "newline", offset: -1, indent, source: `
|
|
5005
5005
|
` }
|
|
5006
5006
|
];
|
|
5007
|
-
switch (
|
|
5007
|
+
switch (source[0]) {
|
|
5008
5008
|
case "|":
|
|
5009
5009
|
case ">": {
|
|
5010
|
-
const he =
|
|
5010
|
+
const he = source.indexOf(`
|
|
5011
5011
|
`);
|
|
5012
|
-
const head =
|
|
5013
|
-
const body =
|
|
5012
|
+
const head = source.substring(0, he);
|
|
5013
|
+
const body = source.substring(he + 1) + `
|
|
5014
5014
|
`;
|
|
5015
5015
|
const props = [
|
|
5016
5016
|
{ type: "block-scalar-header", offset, indent, source: head }
|
|
@@ -5021,11 +5021,11 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5021
5021
|
return { type: "block-scalar", offset, indent, props, source: body };
|
|
5022
5022
|
}
|
|
5023
5023
|
case '"':
|
|
5024
|
-
return { type: "double-quoted-scalar", offset, indent, source
|
|
5024
|
+
return { type: "double-quoted-scalar", offset, indent, source, end };
|
|
5025
5025
|
case "'":
|
|
5026
|
-
return { type: "single-quoted-scalar", offset, indent, source
|
|
5026
|
+
return { type: "single-quoted-scalar", offset, indent, source, end };
|
|
5027
5027
|
default:
|
|
5028
|
-
return { type: "scalar", offset, indent, source
|
|
5028
|
+
return { type: "scalar", offset, indent, source, end };
|
|
5029
5029
|
}
|
|
5030
5030
|
}
|
|
5031
5031
|
function setScalarValue(token, value, context = {}) {
|
|
@@ -5051,32 +5051,32 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5051
5051
|
default:
|
|
5052
5052
|
type = "PLAIN";
|
|
5053
5053
|
}
|
|
5054
|
-
const
|
|
5054
|
+
const source = stringifyString.stringifyString({ type, value }, {
|
|
5055
5055
|
implicitKey: implicitKey || indent === null,
|
|
5056
5056
|
indent: indent !== null && indent > 0 ? " ".repeat(indent) : "",
|
|
5057
5057
|
inFlow,
|
|
5058
5058
|
options: { blockQuote: true, lineWidth: -1 }
|
|
5059
5059
|
});
|
|
5060
|
-
switch (
|
|
5060
|
+
switch (source[0]) {
|
|
5061
5061
|
case "|":
|
|
5062
5062
|
case ">":
|
|
5063
|
-
setBlockScalarValue(token,
|
|
5063
|
+
setBlockScalarValue(token, source);
|
|
5064
5064
|
break;
|
|
5065
5065
|
case '"':
|
|
5066
|
-
setFlowScalarValue(token,
|
|
5066
|
+
setFlowScalarValue(token, source, "double-quoted-scalar");
|
|
5067
5067
|
break;
|
|
5068
5068
|
case "'":
|
|
5069
|
-
setFlowScalarValue(token,
|
|
5069
|
+
setFlowScalarValue(token, source, "single-quoted-scalar");
|
|
5070
5070
|
break;
|
|
5071
5071
|
default:
|
|
5072
|
-
setFlowScalarValue(token,
|
|
5072
|
+
setFlowScalarValue(token, source, "scalar");
|
|
5073
5073
|
}
|
|
5074
5074
|
}
|
|
5075
|
-
function setBlockScalarValue(token,
|
|
5076
|
-
const he =
|
|
5075
|
+
function setBlockScalarValue(token, source) {
|
|
5076
|
+
const he = source.indexOf(`
|
|
5077
5077
|
`);
|
|
5078
|
-
const head =
|
|
5079
|
-
const body =
|
|
5078
|
+
const head = source.substring(0, he);
|
|
5079
|
+
const body = source.substring(he + 1) + `
|
|
5080
5080
|
`;
|
|
5081
5081
|
if (token.type === "block-scalar") {
|
|
5082
5082
|
const header = token.props[0];
|
|
@@ -5113,32 +5113,32 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5113
5113
|
}
|
|
5114
5114
|
return false;
|
|
5115
5115
|
}
|
|
5116
|
-
function setFlowScalarValue(token,
|
|
5116
|
+
function setFlowScalarValue(token, source, type) {
|
|
5117
5117
|
switch (token.type) {
|
|
5118
5118
|
case "scalar":
|
|
5119
5119
|
case "double-quoted-scalar":
|
|
5120
5120
|
case "single-quoted-scalar":
|
|
5121
5121
|
token.type = type;
|
|
5122
|
-
token.source =
|
|
5122
|
+
token.source = source;
|
|
5123
5123
|
break;
|
|
5124
5124
|
case "block-scalar": {
|
|
5125
5125
|
const end = token.props.slice(1);
|
|
5126
|
-
let oa =
|
|
5126
|
+
let oa = source.length;
|
|
5127
5127
|
if (token.props[0].type === "block-scalar-header")
|
|
5128
5128
|
oa -= token.props[0].source.length;
|
|
5129
5129
|
for (const tok of end)
|
|
5130
5130
|
tok.offset += oa;
|
|
5131
5131
|
delete token.props;
|
|
5132
|
-
Object.assign(token, { type, source
|
|
5132
|
+
Object.assign(token, { type, source, end });
|
|
5133
5133
|
break;
|
|
5134
5134
|
}
|
|
5135
5135
|
case "block-map":
|
|
5136
5136
|
case "block-seq": {
|
|
5137
|
-
const offset = token.offset +
|
|
5137
|
+
const offset = token.offset + source.length;
|
|
5138
5138
|
const nl = { type: "newline", offset, indent: token.indent, source: `
|
|
5139
5139
|
` };
|
|
5140
5140
|
delete token.items;
|
|
5141
|
-
Object.assign(token, { type, source
|
|
5141
|
+
Object.assign(token, { type, source, end: [nl] });
|
|
5142
5142
|
break;
|
|
5143
5143
|
}
|
|
5144
5144
|
default: {
|
|
@@ -5147,7 +5147,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
5147
5147
|
for (const key of Object.keys(token))
|
|
5148
5148
|
if (key !== "type" && key !== "offset")
|
|
5149
5149
|
delete token[key];
|
|
5150
|
-
Object.assign(token, { type, indent, source
|
|
5150
|
+
Object.assign(token, { type, indent, source, end });
|
|
5151
5151
|
}
|
|
5152
5152
|
}
|
|
5153
5153
|
}
|
|
@@ -5298,8 +5298,8 @@ var require_cst = __commonJS((exports) => {
|
|
|
5298
5298
|
return JSON.stringify(token);
|
|
5299
5299
|
}
|
|
5300
5300
|
}
|
|
5301
|
-
function tokenType(
|
|
5302
|
-
switch (
|
|
5301
|
+
function tokenType(source) {
|
|
5302
|
+
switch (source) {
|
|
5303
5303
|
case BOM:
|
|
5304
5304
|
return "byte-order-mark";
|
|
5305
5305
|
case DOCUMENT:
|
|
@@ -5335,7 +5335,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
5335
5335
|
case ",":
|
|
5336
5336
|
return "comma";
|
|
5337
5337
|
}
|
|
5338
|
-
switch (
|
|
5338
|
+
switch (source[0]) {
|
|
5339
5339
|
case " ":
|
|
5340
5340
|
case "\t":
|
|
5341
5341
|
return "space";
|
|
@@ -5411,11 +5411,11 @@ var require_lexer = __commonJS((exports) => {
|
|
|
5411
5411
|
this.next = null;
|
|
5412
5412
|
this.pos = 0;
|
|
5413
5413
|
}
|
|
5414
|
-
*lex(
|
|
5415
|
-
if (
|
|
5416
|
-
if (typeof
|
|
5414
|
+
*lex(source, incomplete = false) {
|
|
5415
|
+
if (source) {
|
|
5416
|
+
if (typeof source !== "string")
|
|
5417
5417
|
throw TypeError("source is not a string");
|
|
5418
|
-
this.buffer = this.buffer ? this.buffer +
|
|
5418
|
+
this.buffer = this.buffer ? this.buffer + source : source;
|
|
5419
5419
|
this.lineEndPos = null;
|
|
5420
5420
|
}
|
|
5421
5421
|
this.atEnd = !incomplete;
|
|
@@ -6089,29 +6089,29 @@ var require_parser = __commonJS((exports) => {
|
|
|
6089
6089
|
this.lexer = new lexer.Lexer;
|
|
6090
6090
|
this.onNewLine = onNewLine;
|
|
6091
6091
|
}
|
|
6092
|
-
*parse(
|
|
6092
|
+
*parse(source, incomplete = false) {
|
|
6093
6093
|
if (this.onNewLine && this.offset === 0)
|
|
6094
6094
|
this.onNewLine(0);
|
|
6095
|
-
for (const lexeme of this.lexer.lex(
|
|
6095
|
+
for (const lexeme of this.lexer.lex(source, incomplete))
|
|
6096
6096
|
yield* this.next(lexeme);
|
|
6097
6097
|
if (!incomplete)
|
|
6098
6098
|
yield* this.end();
|
|
6099
6099
|
}
|
|
6100
|
-
*next(
|
|
6101
|
-
this.source =
|
|
6100
|
+
*next(source) {
|
|
6101
|
+
this.source = source;
|
|
6102
6102
|
if (node_process.env.LOG_TOKENS)
|
|
6103
|
-
console.log("|", cst.prettyToken(
|
|
6103
|
+
console.log("|", cst.prettyToken(source));
|
|
6104
6104
|
if (this.atScalar) {
|
|
6105
6105
|
this.atScalar = false;
|
|
6106
6106
|
yield* this.step();
|
|
6107
|
-
this.offset +=
|
|
6107
|
+
this.offset += source.length;
|
|
6108
6108
|
return;
|
|
6109
6109
|
}
|
|
6110
|
-
const type = cst.tokenType(
|
|
6110
|
+
const type = cst.tokenType(source);
|
|
6111
6111
|
if (!type) {
|
|
6112
|
-
const message = `Not a YAML token: ${
|
|
6113
|
-
yield* this.pop({ type: "error", offset: this.offset, message, source
|
|
6114
|
-
this.offset +=
|
|
6112
|
+
const message = `Not a YAML token: ${source}`;
|
|
6113
|
+
yield* this.pop({ type: "error", offset: this.offset, message, source });
|
|
6114
|
+
this.offset += source.length;
|
|
6115
6115
|
} else if (type === "scalar") {
|
|
6116
6116
|
this.atNewLine = false;
|
|
6117
6117
|
this.atScalar = true;
|
|
@@ -6124,17 +6124,17 @@ var require_parser = __commonJS((exports) => {
|
|
|
6124
6124
|
this.atNewLine = true;
|
|
6125
6125
|
this.indent = 0;
|
|
6126
6126
|
if (this.onNewLine)
|
|
6127
|
-
this.onNewLine(this.offset +
|
|
6127
|
+
this.onNewLine(this.offset + source.length);
|
|
6128
6128
|
break;
|
|
6129
6129
|
case "space":
|
|
6130
|
-
if (this.atNewLine &&
|
|
6131
|
-
this.indent +=
|
|
6130
|
+
if (this.atNewLine && source[0] === " ")
|
|
6131
|
+
this.indent += source.length;
|
|
6132
6132
|
break;
|
|
6133
6133
|
case "explicit-key-ind":
|
|
6134
6134
|
case "map-value-ind":
|
|
6135
6135
|
case "seq-item-ind":
|
|
6136
6136
|
if (this.atNewLine)
|
|
6137
|
-
this.indent +=
|
|
6137
|
+
this.indent += source.length;
|
|
6138
6138
|
break;
|
|
6139
6139
|
case "doc-mode":
|
|
6140
6140
|
case "flow-error-end":
|
|
@@ -6142,7 +6142,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
6142
6142
|
default:
|
|
6143
6143
|
this.atNewLine = false;
|
|
6144
6144
|
}
|
|
6145
|
-
this.offset +=
|
|
6145
|
+
this.offset += source.length;
|
|
6146
6146
|
}
|
|
6147
6147
|
}
|
|
6148
6148
|
*end() {
|
|
@@ -6851,26 +6851,26 @@ var require_public_api = __commonJS((exports) => {
|
|
|
6851
6851
|
const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter || null;
|
|
6852
6852
|
return { lineCounter: lineCounter$1, prettyErrors };
|
|
6853
6853
|
}
|
|
6854
|
-
function parseAllDocuments(
|
|
6854
|
+
function parseAllDocuments(source, options = {}) {
|
|
6855
6855
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
6856
6856
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
6857
6857
|
const composer$1 = new composer.Composer(options);
|
|
6858
|
-
const docs = Array.from(composer$1.compose(parser$1.parse(
|
|
6858
|
+
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
6859
6859
|
if (prettyErrors && lineCounter2)
|
|
6860
6860
|
for (const doc of docs) {
|
|
6861
|
-
doc.errors.forEach(errors2.prettifyError(
|
|
6862
|
-
doc.warnings.forEach(errors2.prettifyError(
|
|
6861
|
+
doc.errors.forEach(errors2.prettifyError(source, lineCounter2));
|
|
6862
|
+
doc.warnings.forEach(errors2.prettifyError(source, lineCounter2));
|
|
6863
6863
|
}
|
|
6864
6864
|
if (docs.length > 0)
|
|
6865
6865
|
return docs;
|
|
6866
6866
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
6867
6867
|
}
|
|
6868
|
-
function parseDocument(
|
|
6868
|
+
function parseDocument(source, options = {}) {
|
|
6869
6869
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
6870
6870
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
6871
6871
|
const composer$1 = new composer.Composer(options);
|
|
6872
6872
|
let doc = null;
|
|
6873
|
-
for (const _doc of composer$1.compose(parser$1.parse(
|
|
6873
|
+
for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
|
|
6874
6874
|
if (!doc)
|
|
6875
6875
|
doc = _doc;
|
|
6876
6876
|
else if (doc.options.logLevel !== "silent") {
|
|
@@ -6879,8 +6879,8 @@ var require_public_api = __commonJS((exports) => {
|
|
|
6879
6879
|
}
|
|
6880
6880
|
}
|
|
6881
6881
|
if (prettyErrors && lineCounter2) {
|
|
6882
|
-
doc.errors.forEach(errors2.prettifyError(
|
|
6883
|
-
doc.warnings.forEach(errors2.prettifyError(
|
|
6882
|
+
doc.errors.forEach(errors2.prettifyError(source, lineCounter2));
|
|
6883
|
+
doc.warnings.forEach(errors2.prettifyError(source, lineCounter2));
|
|
6884
6884
|
}
|
|
6885
6885
|
return doc;
|
|
6886
6886
|
}
|
|
@@ -7701,8 +7701,8 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
7701
7701
|
if (chars.length < 1) {
|
|
7702
7702
|
return;
|
|
7703
7703
|
}
|
|
7704
|
-
const
|
|
7705
|
-
return `${
|
|
7704
|
+
const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
|
|
7705
|
+
return `${source}*`;
|
|
7706
7706
|
};
|
|
7707
7707
|
var repeatedExtglobRecursion = (pattern) => {
|
|
7708
7708
|
let depth = 0;
|
|
@@ -8488,19 +8488,19 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
8488
8488
|
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
8489
8489
|
if (!match)
|
|
8490
8490
|
return;
|
|
8491
|
-
const
|
|
8492
|
-
if (!
|
|
8491
|
+
const source2 = create(match[1]);
|
|
8492
|
+
if (!source2)
|
|
8493
8493
|
return;
|
|
8494
|
-
return
|
|
8494
|
+
return source2 + DOT_LITERAL + match[2];
|
|
8495
8495
|
}
|
|
8496
8496
|
}
|
|
8497
8497
|
};
|
|
8498
8498
|
const output = utils.removePrefix(input, state);
|
|
8499
|
-
let
|
|
8500
|
-
if (
|
|
8501
|
-
|
|
8499
|
+
let source = create(output);
|
|
8500
|
+
if (source && opts.strictSlashes !== true) {
|
|
8501
|
+
source += `${SLASH_LITERAL}?`;
|
|
8502
8502
|
}
|
|
8503
|
-
return
|
|
8503
|
+
return source;
|
|
8504
8504
|
};
|
|
8505
8505
|
module.exports = parse;
|
|
8506
8506
|
});
|
|
@@ -8608,11 +8608,11 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
8608
8608
|
const opts = options || {};
|
|
8609
8609
|
const prepend = opts.contains ? "" : "^";
|
|
8610
8610
|
const append = opts.contains ? "" : "$";
|
|
8611
|
-
let
|
|
8611
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
8612
8612
|
if (state && state.negated === true) {
|
|
8613
|
-
|
|
8613
|
+
source = `^(?!${source}).*$`;
|
|
8614
8614
|
}
|
|
8615
|
-
const regex = picomatch.toRegex(
|
|
8615
|
+
const regex = picomatch.toRegex(source, options);
|
|
8616
8616
|
if (returnState === true) {
|
|
8617
8617
|
regex.state = state;
|
|
8618
8618
|
}
|
|
@@ -8631,10 +8631,10 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
8631
8631
|
}
|
|
8632
8632
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
8633
8633
|
};
|
|
8634
|
-
picomatch.toRegex = (
|
|
8634
|
+
picomatch.toRegex = (source, options) => {
|
|
8635
8635
|
try {
|
|
8636
8636
|
const opts = options || {};
|
|
8637
|
-
return new RegExp(
|
|
8637
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
8638
8638
|
} catch (err) {
|
|
8639
8639
|
if (options && options.debug === true)
|
|
8640
8640
|
throw err;
|
|
@@ -12755,156 +12755,6 @@ var FactRelation;
|
|
|
12755
12755
|
FactRelation2["Supersedes"] = "supersedes";
|
|
12756
12756
|
FactRelation2["References"] = "references";
|
|
12757
12757
|
})(FactRelation ||= {});
|
|
12758
|
-
// ../core/src/types/serverConfig.ts
|
|
12759
|
-
var DEFAULT_SERVER_CONFIG = {
|
|
12760
|
-
server: {
|
|
12761
|
-
port: 5100,
|
|
12762
|
-
host: "::"
|
|
12763
|
-
},
|
|
12764
|
-
git_hosts: [],
|
|
12765
|
-
daemon_scheduler: {
|
|
12766
|
-
enabled: true,
|
|
12767
|
-
host: "localhost",
|
|
12768
|
-
port: 5110,
|
|
12769
|
-
workspace: "./data/daemon-workspace",
|
|
12770
|
-
max_daemons: 20
|
|
12771
|
-
},
|
|
12772
|
-
doc_db: {
|
|
12773
|
-
provider: "sqlite",
|
|
12774
|
-
sqlite: {
|
|
12775
|
-
path: "./data/c4a.db"
|
|
12776
|
-
},
|
|
12777
|
-
mongodb: {
|
|
12778
|
-
uri: "mongodb://localhost:27017/c4a?directConnection=true",
|
|
12779
|
-
database: "c4a"
|
|
12780
|
-
}
|
|
12781
|
-
},
|
|
12782
|
-
graph_db: {
|
|
12783
|
-
provider: "neo4j",
|
|
12784
|
-
neo4j: {
|
|
12785
|
-
uri: "bolt://localhost:7687",
|
|
12786
|
-
username: "neo4j",
|
|
12787
|
-
password: ""
|
|
12788
|
-
},
|
|
12789
|
-
nebulagraph: {
|
|
12790
|
-
uri: "localhost:9669",
|
|
12791
|
-
username: "root",
|
|
12792
|
-
password: "nebula",
|
|
12793
|
-
space: "c4a"
|
|
12794
|
-
},
|
|
12795
|
-
duckdb: {
|
|
12796
|
-
path: "./data/c4a-graph.duckdb"
|
|
12797
|
-
}
|
|
12798
|
-
},
|
|
12799
|
-
vector_db: {
|
|
12800
|
-
provider: "lancedb",
|
|
12801
|
-
collection_prefix: "c4a_",
|
|
12802
|
-
qdrant: {
|
|
12803
|
-
url: "http://localhost:6333",
|
|
12804
|
-
api_key: ""
|
|
12805
|
-
},
|
|
12806
|
-
milvus: {
|
|
12807
|
-
address: "localhost:19530"
|
|
12808
|
-
},
|
|
12809
|
-
lancedb: {
|
|
12810
|
-
path: "./data/lancedb"
|
|
12811
|
-
}
|
|
12812
|
-
},
|
|
12813
|
-
llm: {
|
|
12814
|
-
provider: "openai",
|
|
12815
|
-
openai: {
|
|
12816
|
-
api_key: "",
|
|
12817
|
-
base_url: "",
|
|
12818
|
-
default_model: "gpt-5.3-codex",
|
|
12819
|
-
wire_api: "chat"
|
|
12820
|
-
},
|
|
12821
|
-
anthropic: {
|
|
12822
|
-
api_key: "",
|
|
12823
|
-
base_url: "",
|
|
12824
|
-
default_model: "claude-opus-4-6"
|
|
12825
|
-
},
|
|
12826
|
-
google: {
|
|
12827
|
-
api_key: "",
|
|
12828
|
-
base_url: "",
|
|
12829
|
-
default_model: "gemini-3-pro-preview"
|
|
12830
|
-
}
|
|
12831
|
-
},
|
|
12832
|
-
task: {
|
|
12833
|
-
concurrency: {
|
|
12834
|
-
code_index: 2,
|
|
12835
|
-
doc_index: 2,
|
|
12836
|
-
remote_clone: 2,
|
|
12837
|
-
modeling: 1
|
|
12838
|
-
},
|
|
12839
|
-
default_timeout_ms: 150 * 60 * 1000,
|
|
12840
|
-
memory_ttl_ms: 48 * 60 * 60 * 1000,
|
|
12841
|
-
cleanup_interval_ms: 10 * 60 * 1000,
|
|
12842
|
-
log_max_entries: 500
|
|
12843
|
-
},
|
|
12844
|
-
indexing: {
|
|
12845
|
-
task_timeout_ms: 150 * 60 * 1000,
|
|
12846
|
-
file_timeout_ms: 15 * 60 * 1000
|
|
12847
|
-
},
|
|
12848
|
-
intent_router: {
|
|
12849
|
-
provider: "huggingface",
|
|
12850
|
-
huggingface: {
|
|
12851
|
-
model_id: "context4ai/intent-router-onnx",
|
|
12852
|
-
cache_dir: "./models/intent-router"
|
|
12853
|
-
},
|
|
12854
|
-
xenova: {
|
|
12855
|
-
model_id: "context4ai/intent-router-onnx",
|
|
12856
|
-
cache_dir: "./models/intent-router"
|
|
12857
|
-
}
|
|
12858
|
-
},
|
|
12859
|
-
embedding: {
|
|
12860
|
-
provider: "huggingface",
|
|
12861
|
-
huggingface: {
|
|
12862
|
-
model_id: "Xenova/all-MiniLM-L6-v2",
|
|
12863
|
-
dtype: "q8",
|
|
12864
|
-
cache_dir: "./models/embedding"
|
|
12865
|
-
},
|
|
12866
|
-
xenova: {
|
|
12867
|
-
model_id: "Xenova/bge-m3",
|
|
12868
|
-
dtype: "q8",
|
|
12869
|
-
cache_dir: "./models/embedding"
|
|
12870
|
-
},
|
|
12871
|
-
openai: {
|
|
12872
|
-
api_key: "",
|
|
12873
|
-
base_url: "",
|
|
12874
|
-
model_id: "text-embedding-3-small"
|
|
12875
|
-
},
|
|
12876
|
-
google: {
|
|
12877
|
-
api_key: "",
|
|
12878
|
-
model_id: "text-embedding-004"
|
|
12879
|
-
}
|
|
12880
|
-
},
|
|
12881
|
-
reranker: {
|
|
12882
|
-
enabled: false,
|
|
12883
|
-
provider: "huggingface",
|
|
12884
|
-
huggingface: {
|
|
12885
|
-
model_id: "onnx-community/bge-reranker-v2-m3-ONNX",
|
|
12886
|
-
dtype: "q8",
|
|
12887
|
-
cache_dir: "./models/reranker"
|
|
12888
|
-
},
|
|
12889
|
-
xenova: {
|
|
12890
|
-
model_id: "onnx-community/bge-reranker-v2-m3-ONNX",
|
|
12891
|
-
dtype: "q8",
|
|
12892
|
-
cache_dir: "./models/reranker"
|
|
12893
|
-
},
|
|
12894
|
-
max_rerank: 20
|
|
12895
|
-
}
|
|
12896
|
-
};
|
|
12897
|
-
// ../core/src/types/daemon.ts
|
|
12898
|
-
var CODE_PACKAGE_FILES = new Set([
|
|
12899
|
-
"package.json",
|
|
12900
|
-
"pyproject.toml",
|
|
12901
|
-
"setup.py",
|
|
12902
|
-
"go.mod",
|
|
12903
|
-
"cargo.toml",
|
|
12904
|
-
"pom.xml",
|
|
12905
|
-
"build.gradle",
|
|
12906
|
-
"build.gradle.kts"
|
|
12907
|
-
]);
|
|
12908
12758
|
// ../core/src/types/docDigest.ts
|
|
12909
12759
|
var confidenceAtomSchema = exports_external.number().min(0).max(1).optional().catch(undefined);
|
|
12910
12760
|
var entityAtomSchema = exports_external.object({
|
|
@@ -13572,10 +13422,10 @@ var normalizeDoc = (value) => {
|
|
|
13572
13422
|
`).replace(/[ \t]+$/gmu, "").trim();
|
|
13573
13423
|
return normalized.length > 0 ? normalized : undefined;
|
|
13574
13424
|
};
|
|
13575
|
-
var resolveVersion = (label,
|
|
13425
|
+
var resolveVersion = (label, source) => {
|
|
13576
13426
|
const canonical = typeof label === "string" ? canonicalizeCodeVersionLabel(label) : null;
|
|
13577
13427
|
if (canonical) {
|
|
13578
|
-
return { version_label: canonical, version_source:
|
|
13428
|
+
return { version_label: canonical, version_source: source ?? "package-json" };
|
|
13579
13429
|
}
|
|
13580
13430
|
return { version_label: FALLBACK_VERSION_LABEL, version_source: "fallback-0.0.1" };
|
|
13581
13431
|
};
|
|
@@ -13589,7 +13439,7 @@ var commonCommit = (rows) => {
|
|
|
13589
13439
|
const commits = new Set(rows.digests.map((row) => row.dir_commit).filter((commit) => commit && commit !== "unknown"));
|
|
13590
13440
|
return commits.size === 1 ? Array.from(commits)[0] : null;
|
|
13591
13441
|
};
|
|
13592
|
-
var metaText = (manifest,
|
|
13442
|
+
var metaText = (manifest, source, rows) => {
|
|
13593
13443
|
const digestByModule = new Map(rows.digests.map((row) => [row.module_path, row]));
|
|
13594
13444
|
const meta = {
|
|
13595
13445
|
schema_version: CODE_SNAPSHOT_META_SCHEMA_VERSION,
|
|
@@ -13615,7 +13465,7 @@ var metaText = (manifest, source2, rows) => {
|
|
|
13615
13465
|
code_snapshot_contract_version: manifest.code_snapshot_contract_version,
|
|
13616
13466
|
snapshot_content_hash: manifest.snapshot_content_hash,
|
|
13617
13467
|
toolchain: manifest.toolchain,
|
|
13618
|
-
version_policy:
|
|
13468
|
+
version_policy: source.version_policy,
|
|
13619
13469
|
...manifest.version_label ? { version_label: manifest.version_label } : {},
|
|
13620
13470
|
...manifest.version_source ? { version_source: manifest.version_source } : {},
|
|
13621
13471
|
head_commit: manifest.head_commit,
|
|
@@ -13778,7 +13628,7 @@ var buildCodeSnapshot = (input) => {
|
|
|
13778
13628
|
};
|
|
13779
13629
|
const snapshotContentHash = hashStable(sourceHashInput);
|
|
13780
13630
|
const dirty = rows.digests.some((row) => row.dirty);
|
|
13781
|
-
const
|
|
13631
|
+
const source = {
|
|
13782
13632
|
source_id: input.sourceId,
|
|
13783
13633
|
source_slug: input.sourceSlug,
|
|
13784
13634
|
source_type: "aspect-code",
|
|
@@ -13794,13 +13644,13 @@ var buildCodeSnapshot = (input) => {
|
|
|
13794
13644
|
const commonVersionLabel = commonVersionField(rows.digests, "version_label");
|
|
13795
13645
|
const commonVersionSource = commonVersionField(rows.digests, "version_source");
|
|
13796
13646
|
if (commonVersionLabel && commonVersionLabel !== "mixed") {
|
|
13797
|
-
|
|
13647
|
+
source.version_label = commonVersionLabel;
|
|
13798
13648
|
}
|
|
13799
13649
|
if (commonVersionSource) {
|
|
13800
|
-
|
|
13650
|
+
source.version_source = commonVersionSource;
|
|
13801
13651
|
}
|
|
13802
13652
|
const files = {
|
|
13803
|
-
"source.yaml": manifestText(
|
|
13653
|
+
"source.yaml": manifestText(source),
|
|
13804
13654
|
"digests.jsonl": jsonl(rows.digests),
|
|
13805
13655
|
"source-files.jsonl": jsonl(rows.sourceFiles),
|
|
13806
13656
|
"packages.jsonl": jsonl(rows.packages),
|
|
@@ -13818,9 +13668,9 @@ var buildCodeSnapshot = (input) => {
|
|
|
13818
13668
|
dirty,
|
|
13819
13669
|
script_hash: input.scriptHash,
|
|
13820
13670
|
toolchain: input.toolchain,
|
|
13821
|
-
version_policy:
|
|
13822
|
-
...
|
|
13823
|
-
...
|
|
13671
|
+
version_policy: source.version_policy,
|
|
13672
|
+
...source.version_label ? { version_label: source.version_label } : {},
|
|
13673
|
+
...source.version_source ? { version_source: source.version_source } : {},
|
|
13824
13674
|
snapshot_content_hash: snapshotContentHash,
|
|
13825
13675
|
...input.worktreeContentHash ? { worktree_content_hash: input.worktreeContentHash } : {},
|
|
13826
13676
|
module_count: rows.packages.length,
|
|
@@ -13831,7 +13681,7 @@ var buildCodeSnapshot = (input) => {
|
|
|
13831
13681
|
let converged = false;
|
|
13832
13682
|
for (let i = 0;i < 50; i++) {
|
|
13833
13683
|
files["manifest.json"] = manifestText(manifest);
|
|
13834
|
-
files["_meta.yaml"] = metaText(manifest,
|
|
13684
|
+
files["_meta.yaml"] = metaText(manifest, source, rows);
|
|
13835
13685
|
const totalBytes = Object.values(files).reduce((sum, content) => sum + byteLength(content), 0);
|
|
13836
13686
|
if (totalBytes === manifest.total_bytes) {
|
|
13837
13687
|
converged = true;
|
|
@@ -13843,8 +13693,8 @@ var buildCodeSnapshot = (input) => {
|
|
|
13843
13693
|
throw new Error("code snapshot manifest total_bytes did not converge");
|
|
13844
13694
|
}
|
|
13845
13695
|
files["manifest.json"] = manifestText(manifest);
|
|
13846
|
-
files["_meta.yaml"] = metaText(manifest,
|
|
13847
|
-
return { source
|
|
13696
|
+
files["_meta.yaml"] = metaText(manifest, source, rows);
|
|
13697
|
+
return { source, manifest, rows, files };
|
|
13848
13698
|
};
|
|
13849
13699
|
|
|
13850
13700
|
// src/repository.ts
|
|
@@ -13865,9 +13715,9 @@ class ExtractionPluginRegistry {
|
|
|
13865
13715
|
register(plugin) {
|
|
13866
13716
|
this.#plugins.push(plugin);
|
|
13867
13717
|
}
|
|
13868
|
-
resolve(
|
|
13869
|
-
const declaredLanguage =
|
|
13870
|
-
const manifestLanguages = new Set(
|
|
13718
|
+
resolve(source) {
|
|
13719
|
+
const declaredLanguage = source.language?.toLowerCase();
|
|
13720
|
+
const manifestLanguages = new Set(source.manifests.flatMap((manifest) => MANIFEST_LANGUAGE_CANDIDATES[manifest.type] ?? []));
|
|
13871
13721
|
const candidates = this.#plugins.filter((plugin) => {
|
|
13872
13722
|
const pluginLanguages = plugin.languages.map((language) => language.toLowerCase());
|
|
13873
13723
|
if (declaredLanguage) {
|
|
@@ -13879,7 +13729,7 @@ class ExtractionPluginRegistry {
|
|
|
13879
13729
|
return pluginLanguages.some((language) => manifestLanguages.has(language));
|
|
13880
13730
|
});
|
|
13881
13731
|
for (const plugin of candidates) {
|
|
13882
|
-
if (plugin.canHandle(
|
|
13732
|
+
if (plugin.canHandle(source)) {
|
|
13883
13733
|
return plugin;
|
|
13884
13734
|
}
|
|
13885
13735
|
}
|
|
@@ -14454,8 +14304,8 @@ var normalizeExtractionPaths = (extraction, entryDetection, modulePath, commitHa
|
|
|
14454
14304
|
entryDetection: prefixEntryDetectionPaths(entryDetection, modulePath),
|
|
14455
14305
|
extraction: prefixExtractionPaths(extraction, modulePath, commitHash)
|
|
14456
14306
|
});
|
|
14457
|
-
var extractLeadingJsDoc = (
|
|
14458
|
-
const match =
|
|
14307
|
+
var extractLeadingJsDoc = (source) => {
|
|
14308
|
+
const match = source.match(/^\s*\/\*\*([\s\S]*?)\*\//u);
|
|
14459
14309
|
if (!match?.[1])
|
|
14460
14310
|
return;
|
|
14461
14311
|
const doc = match[1].replace(/^\s*\* ?/gmu, "").replace(/\r\n?/gu, `
|