@rohal12/spindle-lsp 0.15.2 → 0.15.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/dist/bin.js +2524 -589
- package/dist/bin.js.map +4 -4
- package/package.json +2 -1
package/dist/bin.js
CHANGED
|
@@ -55,7 +55,7 @@ var VERSION;
|
|
|
55
55
|
var init_version = __esm({
|
|
56
56
|
"src/version.ts"() {
|
|
57
57
|
"use strict";
|
|
58
|
-
VERSION = false ? pkg.version : "0.15.
|
|
58
|
+
VERSION = false ? pkg.version : "0.15.3";
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -8045,15 +8045,15 @@ function escapeOffsets(raw, at3, value, escapes) {
|
|
|
8045
8045
|
let i2 = 0;
|
|
8046
8046
|
while (offsets.length < value.length) {
|
|
8047
8047
|
if (i2 >= raw.length) return void 0;
|
|
8048
|
-
const
|
|
8049
|
-
if (!
|
|
8048
|
+
const escape3 = raw[i2] === "\\" ? escapeAt(raw, i2, escapes) : void 0;
|
|
8049
|
+
if (!escape3) {
|
|
8050
8050
|
offsets.push(at3 + i2++);
|
|
8051
8051
|
continue;
|
|
8052
8052
|
}
|
|
8053
|
-
if (!value.startsWith(
|
|
8054
|
-
for (let k2 = 0; k2 <
|
|
8053
|
+
if (!value.startsWith(escape3.text, offsets.length)) return void 0;
|
|
8054
|
+
for (let k2 = 0; k2 < escape3.text.length; k2++) offsets.push(at3 + i2);
|
|
8055
8055
|
escaped = true;
|
|
8056
|
-
i2 +=
|
|
8056
|
+
i2 += escape3.length;
|
|
8057
8057
|
}
|
|
8058
8058
|
offsets.push(at3 + i2);
|
|
8059
8059
|
return escaped ? offsets : void 0;
|
|
@@ -8568,18 +8568,18 @@ function parseDeclarations(content2, sigil = "$") {
|
|
|
8568
8568
|
lineStart += rawLine.length + 1;
|
|
8569
8569
|
const line = rawLine.trim();
|
|
8570
8570
|
if (!line) continue;
|
|
8571
|
-
const
|
|
8571
|
+
const match2 = line.match(DECLARATION_RE);
|
|
8572
8572
|
const error48 = (code, start, end, message) => errors.push({
|
|
8573
8573
|
code,
|
|
8574
8574
|
offset: start,
|
|
8575
8575
|
end,
|
|
8576
8576
|
message
|
|
8577
8577
|
});
|
|
8578
|
-
if (!
|
|
8578
|
+
if (!match2) {
|
|
8579
8579
|
error48("invalid-declaration", at3, at3 + line.length, `Invalid declaration: "${line}". Expected: ${sigil}name = value`);
|
|
8580
8580
|
continue;
|
|
8581
8581
|
}
|
|
8582
|
-
const [, name, expr] =
|
|
8582
|
+
const [, name, expr] = match2;
|
|
8583
8583
|
const nameStart = at3 + sigil.length;
|
|
8584
8584
|
const nameEnd = nameStart + name.length;
|
|
8585
8585
|
const nameError = variableNameError(name, sigil + name);
|
|
@@ -8617,7 +8617,7 @@ function parseDeclarations(content2, sigil = "$") {
|
|
|
8617
8617
|
};
|
|
8618
8618
|
}
|
|
8619
8619
|
function checkReference(ref2, declared) {
|
|
8620
|
-
const label2 = (
|
|
8620
|
+
const label2 = (path2) => ref2.sigil + [ref2.name, ...path2].join(".");
|
|
8621
8621
|
const nameError = variableNameError(ref2.name, ref2.sigil + ref2.name);
|
|
8622
8622
|
if (nameError) return {
|
|
8623
8623
|
code: "reserved-name",
|
|
@@ -8666,15 +8666,15 @@ function referenceAt(code, sigil, name, start, end, at3) {
|
|
|
8666
8666
|
}
|
|
8667
8667
|
function termReferenceAt(term, index, at3) {
|
|
8668
8668
|
VAR_PATH_RE.lastIndex = index;
|
|
8669
|
-
const
|
|
8670
|
-
if (!
|
|
8671
|
-
const [name, ...
|
|
8669
|
+
const match2 = VAR_PATH_RE.exec(term);
|
|
8670
|
+
if (!match2) return void 0;
|
|
8671
|
+
const [name, ...path2] = match2[2].split(".");
|
|
8672
8672
|
return {
|
|
8673
|
-
sigil:
|
|
8673
|
+
sigil: match2[1],
|
|
8674
8674
|
name,
|
|
8675
|
-
path,
|
|
8675
|
+
path: path2,
|
|
8676
8676
|
start: at3(index),
|
|
8677
|
-
end: at3(index +
|
|
8677
|
+
end: at3(index + match2[0].length)
|
|
8678
8678
|
};
|
|
8679
8679
|
}
|
|
8680
8680
|
function scanSigilReferences(value, at3, emit) {
|
|
@@ -8759,11 +8759,11 @@ function collectTokenRefs(content2, tokens2, at3, emit, options) {
|
|
|
8759
8759
|
if (options.all && token.type !== "macro" && token.type !== "html" && token.type !== "text") scanSelectors(content2, token, at3, emit, options);
|
|
8760
8760
|
if (token.type === "variable") {
|
|
8761
8761
|
if ((token.scope === "variable" || token.scope === "transient") && token.name) {
|
|
8762
|
-
const [name, ...
|
|
8762
|
+
const [name, ...path2] = token.name.split(".");
|
|
8763
8763
|
emit({
|
|
8764
8764
|
sigil: token.scope === "variable" ? "$" : "%",
|
|
8765
8765
|
name,
|
|
8766
|
-
path,
|
|
8766
|
+
path: path2,
|
|
8767
8767
|
start: at3(token.nameStart - 1),
|
|
8768
8768
|
end: at3(token.nameEnd)
|
|
8769
8769
|
});
|
|
@@ -8786,12 +8786,12 @@ function collectTokenRefs(content2, tokens2, at3, emit, options) {
|
|
|
8786
8786
|
const first = token.rawArgs.trim().split(/\s+/)[0] ?? "";
|
|
8787
8787
|
const quoted = QUOTED_VAR_ARG_RE.exec(first);
|
|
8788
8788
|
if (quoted) {
|
|
8789
|
-
const [name, ...
|
|
8789
|
+
const [name, ...path2] = quoted[1].split(".");
|
|
8790
8790
|
const start = token.argsStart + lead + 1;
|
|
8791
8791
|
emit({
|
|
8792
8792
|
sigil: "$",
|
|
8793
8793
|
name,
|
|
8794
|
-
path,
|
|
8794
|
+
path: path2,
|
|
8795
8795
|
start: at3(start),
|
|
8796
8796
|
end: at3(start + 1 + quoted[1].length)
|
|
8797
8797
|
});
|
|
@@ -9665,14 +9665,14 @@ function tokenizeCharacterReference(effects, ok, nok) {
|
|
|
9665
9665
|
effects.enter("characterReferenceMarkerNumeric");
|
|
9666
9666
|
effects.consume(code);
|
|
9667
9667
|
effects.exit("characterReferenceMarkerNumeric");
|
|
9668
|
-
return
|
|
9668
|
+
return numeric2;
|
|
9669
9669
|
}
|
|
9670
9670
|
effects.enter("characterReferenceValue");
|
|
9671
9671
|
max = 31;
|
|
9672
9672
|
test = asciiAlphanumeric;
|
|
9673
9673
|
return value(code);
|
|
9674
9674
|
}
|
|
9675
|
-
function
|
|
9675
|
+
function numeric2(code) {
|
|
9676
9676
|
if (code === 88 || code === 120) {
|
|
9677
9677
|
effects.enter("characterReferenceMarkerHexadecimal");
|
|
9678
9678
|
effects.consume(code);
|
|
@@ -10361,9 +10361,9 @@ function factoryTitle(effects, ok, nok, type, markerType, stringType2) {
|
|
|
10361
10361
|
return atBreak(code);
|
|
10362
10362
|
}
|
|
10363
10363
|
effects.consume(code);
|
|
10364
|
-
return code === 92 ?
|
|
10364
|
+
return code === 92 ? escape3 : inside;
|
|
10365
10365
|
}
|
|
10366
|
-
function
|
|
10366
|
+
function escape3(code) {
|
|
10367
10367
|
if (code === marker || code === 92) {
|
|
10368
10368
|
effects.consume(code);
|
|
10369
10369
|
return inside;
|
|
@@ -12083,10 +12083,10 @@ function preprocess() {
|
|
|
12083
12083
|
}
|
|
12084
12084
|
while (startPosition < value.length) {
|
|
12085
12085
|
search.lastIndex = startPosition;
|
|
12086
|
-
const
|
|
12087
|
-
const endPosition =
|
|
12086
|
+
const match2 = search.exec(value);
|
|
12087
|
+
const endPosition = match2 && match2.index !== void 0 ? match2.index : value.length;
|
|
12088
12088
|
const code = value.charCodeAt(endPosition);
|
|
12089
|
-
if (!
|
|
12089
|
+
if (!match2) {
|
|
12090
12090
|
buffer = value.slice(startPosition);
|
|
12091
12091
|
break;
|
|
12092
12092
|
}
|
|
@@ -12572,54 +12572,54 @@ function resolveTable(events, context) {
|
|
|
12572
12572
|
}
|
|
12573
12573
|
return events;
|
|
12574
12574
|
}
|
|
12575
|
-
function flushCell(map2, context,
|
|
12575
|
+
function flushCell(map2, context, range2, rowKind, rowEnd, previousCell) {
|
|
12576
12576
|
const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
|
|
12577
12577
|
const valueName = "tableContent";
|
|
12578
|
-
if (
|
|
12579
|
-
previousCell.end = Object.assign({}, getPoint(context.events,
|
|
12580
|
-
map2.add(
|
|
12578
|
+
if (range2[0] !== 0) {
|
|
12579
|
+
previousCell.end = Object.assign({}, getPoint(context.events, range2[0]));
|
|
12580
|
+
map2.add(range2[0], 0, [[
|
|
12581
12581
|
"exit",
|
|
12582
12582
|
previousCell,
|
|
12583
12583
|
context
|
|
12584
12584
|
]]);
|
|
12585
12585
|
}
|
|
12586
|
-
const now = getPoint(context.events,
|
|
12586
|
+
const now = getPoint(context.events, range2[1]);
|
|
12587
12587
|
previousCell = {
|
|
12588
12588
|
type: groupName,
|
|
12589
12589
|
start: Object.assign({}, now),
|
|
12590
12590
|
end: Object.assign({}, now)
|
|
12591
12591
|
};
|
|
12592
|
-
map2.add(
|
|
12592
|
+
map2.add(range2[1], 0, [[
|
|
12593
12593
|
"enter",
|
|
12594
12594
|
previousCell,
|
|
12595
12595
|
context
|
|
12596
12596
|
]]);
|
|
12597
|
-
if (
|
|
12598
|
-
const relatedStart = getPoint(context.events,
|
|
12599
|
-
const relatedEnd = getPoint(context.events,
|
|
12597
|
+
if (range2[2] !== 0) {
|
|
12598
|
+
const relatedStart = getPoint(context.events, range2[2]);
|
|
12599
|
+
const relatedEnd = getPoint(context.events, range2[3]);
|
|
12600
12600
|
const valueToken = {
|
|
12601
12601
|
type: valueName,
|
|
12602
12602
|
start: Object.assign({}, relatedStart),
|
|
12603
12603
|
end: Object.assign({}, relatedEnd)
|
|
12604
12604
|
};
|
|
12605
|
-
map2.add(
|
|
12605
|
+
map2.add(range2[2], 0, [[
|
|
12606
12606
|
"enter",
|
|
12607
12607
|
valueToken,
|
|
12608
12608
|
context
|
|
12609
12609
|
]]);
|
|
12610
12610
|
if (rowKind !== 2) {
|
|
12611
|
-
const start = context.events[
|
|
12612
|
-
const end = context.events[
|
|
12611
|
+
const start = context.events[range2[2]];
|
|
12612
|
+
const end = context.events[range2[3]];
|
|
12613
12613
|
start[1].end = Object.assign({}, end[1].end);
|
|
12614
12614
|
start[1].type = "chunkText";
|
|
12615
12615
|
start[1].contentType = "text";
|
|
12616
|
-
if (
|
|
12617
|
-
const a =
|
|
12618
|
-
const b =
|
|
12616
|
+
if (range2[3] > range2[2] + 1) {
|
|
12617
|
+
const a = range2[2] + 1;
|
|
12618
|
+
const b = range2[3] - range2[2] - 1;
|
|
12619
12619
|
map2.add(a, b, []);
|
|
12620
12620
|
}
|
|
12621
12621
|
}
|
|
12622
|
-
map2.add(
|
|
12622
|
+
map2.add(range2[3] + 1, 0, [[
|
|
12623
12623
|
"exit",
|
|
12624
12624
|
valueToken,
|
|
12625
12625
|
context
|
|
@@ -12863,13 +12863,13 @@ function scanSpindleMarkup(text3) {
|
|
|
12863
12863
|
const doBlocks = [];
|
|
12864
12864
|
let open;
|
|
12865
12865
|
const push2 = (t, inAttribute) => {
|
|
12866
|
-
const
|
|
12866
|
+
const match2 = {
|
|
12867
12867
|
start: t.start,
|
|
12868
12868
|
end: t.end,
|
|
12869
12869
|
token: text3.slice(t.start, t.end)
|
|
12870
12870
|
};
|
|
12871
|
-
if (inAttribute)
|
|
12872
|
-
tokens2.push(
|
|
12871
|
+
if (inAttribute) match2.inAttribute = true;
|
|
12872
|
+
tokens2.push(match2);
|
|
12873
12873
|
};
|
|
12874
12874
|
for (const t of tokenizeMarkupTolerant(text3).tokens) if (t.type === "html") {
|
|
12875
12875
|
tags.push({
|
|
@@ -12925,9 +12925,9 @@ function lineHasTag(tags, start, end) {
|
|
|
12925
12925
|
function replaceSvgBlocks(html) {
|
|
12926
12926
|
const tokens2 = [];
|
|
12927
12927
|
return {
|
|
12928
|
-
text: html.replace(/<svg[\s>][\s\S]*?<\/svg>/gi, (
|
|
12928
|
+
text: html.replace(/<svg[\s>][\s\S]*?<\/svg>/gi, (match2) => {
|
|
12929
12929
|
const idx = tokens2.length;
|
|
12930
|
-
tokens2.push(
|
|
12930
|
+
tokens2.push(match2);
|
|
12931
12931
|
return `<!--SVG:${idx}-->`;
|
|
12932
12932
|
}),
|
|
12933
12933
|
tokens: tokens2
|
|
@@ -15006,15 +15006,15 @@ var init_story_variables = __esm({
|
|
|
15006
15006
|
for (; ; ) {
|
|
15007
15007
|
skipWhiteSpace.lastIndex = start;
|
|
15008
15008
|
start += skipWhiteSpace.exec(this.input)[0].length;
|
|
15009
|
-
var
|
|
15010
|
-
if (!
|
|
15011
|
-
if ((
|
|
15012
|
-
skipWhiteSpace.lastIndex = start +
|
|
15009
|
+
var match2 = literal.exec(this.input.slice(start));
|
|
15010
|
+
if (!match2) return false;
|
|
15011
|
+
if ((match2[1] || match2[2]) === "use strict") {
|
|
15012
|
+
skipWhiteSpace.lastIndex = start + match2[0].length;
|
|
15013
15013
|
var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
|
|
15014
15014
|
var next = this.input.charAt(end);
|
|
15015
15015
|
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=" || next === "i" && keywordOpAt(this, end));
|
|
15016
15016
|
}
|
|
15017
|
-
start +=
|
|
15017
|
+
start += match2[0].length;
|
|
15018
15018
|
skipWhiteSpace.lastIndex = start;
|
|
15019
15019
|
start += skipWhiteSpace.exec(this.input)[0].length;
|
|
15020
15020
|
if (this.input[start] === ";") start++;
|
|
@@ -19004,12 +19004,12 @@ var init_story_variables = __esm({
|
|
|
19004
19004
|
i2++;
|
|
19005
19005
|
while (/\s/.test(src.charAt(i2))) i2++;
|
|
19006
19006
|
}
|
|
19007
|
-
const
|
|
19008
|
-
if (
|
|
19009
|
-
this.i = i2 +
|
|
19010
|
-
if (!
|
|
19007
|
+
const match2 = this.numberAt(i2);
|
|
19008
|
+
if (match2) {
|
|
19009
|
+
this.i = i2 + match2[0].length;
|
|
19010
|
+
if (!match2[1]) return { shape: { type: "number" } };
|
|
19011
19011
|
if (sign === "+") return { throws: "Cannot convert a BigInt value to a number" };
|
|
19012
|
-
const digits = bigintValue(
|
|
19012
|
+
const digits = bigintValue(match2[0].slice(0, -1));
|
|
19013
19013
|
return digits === void 0 ? void 0 : {
|
|
19014
19014
|
unsupported: "bigint",
|
|
19015
19015
|
value: sign === "-" && digits !== "0" ? `-${digits}` : digits
|
|
@@ -19197,13 +19197,13 @@ var init_story_variables = __esm({
|
|
|
19197
19197
|
}
|
|
19198
19198
|
/** A number as a key: the whole literal, named as the runtime names it. */
|
|
19199
19199
|
numberKey() {
|
|
19200
|
-
const
|
|
19201
|
-
if (!
|
|
19202
|
-
this.i +=
|
|
19200
|
+
const match2 = this.numberAt(this.i);
|
|
19201
|
+
if (!match2) return void 0;
|
|
19202
|
+
this.i += match2[0].length;
|
|
19203
19203
|
if (/[\w$]/.test(this.src.charAt(this.i))) return void 0;
|
|
19204
|
-
const digits =
|
|
19204
|
+
const digits = match2[0].replace(/_/g, "");
|
|
19205
19205
|
if (/^0\d/.test(digits)) return void 0;
|
|
19206
|
-
if (
|
|
19206
|
+
if (match2[1]) return bigintValue(digits.slice(0, -1));
|
|
19207
19207
|
const value = Number(digits);
|
|
19208
19208
|
return Number.isNaN(value) ? void 0 : String(value);
|
|
19209
19209
|
}
|
|
@@ -23704,17 +23704,17 @@ var require_visit = __commonJS({
|
|
|
23704
23704
|
visit.BREAK = BREAK;
|
|
23705
23705
|
visit.SKIP = SKIP;
|
|
23706
23706
|
visit.REMOVE = REMOVE;
|
|
23707
|
-
function visit_(key, node, visitor,
|
|
23708
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
23707
|
+
function visit_(key, node, visitor, path2) {
|
|
23708
|
+
const ctrl = callVisitor(key, node, visitor, path2);
|
|
23709
23709
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
23710
|
-
replaceNode(key,
|
|
23711
|
-
return visit_(key, ctrl, visitor,
|
|
23710
|
+
replaceNode(key, path2, ctrl);
|
|
23711
|
+
return visit_(key, ctrl, visitor, path2);
|
|
23712
23712
|
}
|
|
23713
23713
|
if (typeof ctrl !== "symbol") {
|
|
23714
23714
|
if (identity.isCollection(node)) {
|
|
23715
|
-
|
|
23715
|
+
path2 = Object.freeze(path2.concat(node));
|
|
23716
23716
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
23717
|
-
const ci2 = visit_(i2, node.items[i2], visitor,
|
|
23717
|
+
const ci2 = visit_(i2, node.items[i2], visitor, path2);
|
|
23718
23718
|
if (typeof ci2 === "number")
|
|
23719
23719
|
i2 = ci2 - 1;
|
|
23720
23720
|
else if (ci2 === BREAK)
|
|
@@ -23725,13 +23725,13 @@ var require_visit = __commonJS({
|
|
|
23725
23725
|
}
|
|
23726
23726
|
}
|
|
23727
23727
|
} else if (identity.isPair(node)) {
|
|
23728
|
-
|
|
23729
|
-
const ck = visit_("key", node.key, visitor,
|
|
23728
|
+
path2 = Object.freeze(path2.concat(node));
|
|
23729
|
+
const ck = visit_("key", node.key, visitor, path2);
|
|
23730
23730
|
if (ck === BREAK)
|
|
23731
23731
|
return BREAK;
|
|
23732
23732
|
else if (ck === REMOVE)
|
|
23733
23733
|
node.key = null;
|
|
23734
|
-
const cv = visit_("value", node.value, visitor,
|
|
23734
|
+
const cv = visit_("value", node.value, visitor, path2);
|
|
23735
23735
|
if (cv === BREAK)
|
|
23736
23736
|
return BREAK;
|
|
23737
23737
|
else if (cv === REMOVE)
|
|
@@ -23752,17 +23752,17 @@ var require_visit = __commonJS({
|
|
|
23752
23752
|
visitAsync.BREAK = BREAK;
|
|
23753
23753
|
visitAsync.SKIP = SKIP;
|
|
23754
23754
|
visitAsync.REMOVE = REMOVE;
|
|
23755
|
-
async function visitAsync_(key, node, visitor,
|
|
23756
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
23755
|
+
async function visitAsync_(key, node, visitor, path2) {
|
|
23756
|
+
const ctrl = await callVisitor(key, node, visitor, path2);
|
|
23757
23757
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
23758
|
-
replaceNode(key,
|
|
23759
|
-
return visitAsync_(key, ctrl, visitor,
|
|
23758
|
+
replaceNode(key, path2, ctrl);
|
|
23759
|
+
return visitAsync_(key, ctrl, visitor, path2);
|
|
23760
23760
|
}
|
|
23761
23761
|
if (typeof ctrl !== "symbol") {
|
|
23762
23762
|
if (identity.isCollection(node)) {
|
|
23763
|
-
|
|
23763
|
+
path2 = Object.freeze(path2.concat(node));
|
|
23764
23764
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
23765
|
-
const ci2 = await visitAsync_(i2, node.items[i2], visitor,
|
|
23765
|
+
const ci2 = await visitAsync_(i2, node.items[i2], visitor, path2);
|
|
23766
23766
|
if (typeof ci2 === "number")
|
|
23767
23767
|
i2 = ci2 - 1;
|
|
23768
23768
|
else if (ci2 === BREAK)
|
|
@@ -23773,13 +23773,13 @@ var require_visit = __commonJS({
|
|
|
23773
23773
|
}
|
|
23774
23774
|
}
|
|
23775
23775
|
} else if (identity.isPair(node)) {
|
|
23776
|
-
|
|
23777
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
23776
|
+
path2 = Object.freeze(path2.concat(node));
|
|
23777
|
+
const ck = await visitAsync_("key", node.key, visitor, path2);
|
|
23778
23778
|
if (ck === BREAK)
|
|
23779
23779
|
return BREAK;
|
|
23780
23780
|
else if (ck === REMOVE)
|
|
23781
23781
|
node.key = null;
|
|
23782
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
23782
|
+
const cv = await visitAsync_("value", node.value, visitor, path2);
|
|
23783
23783
|
if (cv === BREAK)
|
|
23784
23784
|
return BREAK;
|
|
23785
23785
|
else if (cv === REMOVE)
|
|
@@ -23806,23 +23806,23 @@ var require_visit = __commonJS({
|
|
|
23806
23806
|
}
|
|
23807
23807
|
return visitor;
|
|
23808
23808
|
}
|
|
23809
|
-
function callVisitor(key, node, visitor,
|
|
23809
|
+
function callVisitor(key, node, visitor, path2) {
|
|
23810
23810
|
if (typeof visitor === "function")
|
|
23811
|
-
return visitor(key, node,
|
|
23811
|
+
return visitor(key, node, path2);
|
|
23812
23812
|
if (identity.isMap(node))
|
|
23813
|
-
return visitor.Map?.(key, node,
|
|
23813
|
+
return visitor.Map?.(key, node, path2);
|
|
23814
23814
|
if (identity.isSeq(node))
|
|
23815
|
-
return visitor.Seq?.(key, node,
|
|
23815
|
+
return visitor.Seq?.(key, node, path2);
|
|
23816
23816
|
if (identity.isPair(node))
|
|
23817
|
-
return visitor.Pair?.(key, node,
|
|
23817
|
+
return visitor.Pair?.(key, node, path2);
|
|
23818
23818
|
if (identity.isScalar(node))
|
|
23819
|
-
return visitor.Scalar?.(key, node,
|
|
23819
|
+
return visitor.Scalar?.(key, node, path2);
|
|
23820
23820
|
if (identity.isAlias(node))
|
|
23821
|
-
return visitor.Alias?.(key, node,
|
|
23821
|
+
return visitor.Alias?.(key, node, path2);
|
|
23822
23822
|
return void 0;
|
|
23823
23823
|
}
|
|
23824
|
-
function replaceNode(key,
|
|
23825
|
-
const parent =
|
|
23824
|
+
function replaceNode(key, path2, node) {
|
|
23825
|
+
const parent = path2[path2.length - 1];
|
|
23826
23826
|
if (identity.isCollection(parent)) {
|
|
23827
23827
|
parent.items[key] = node;
|
|
23828
23828
|
} else if (identity.isPair(parent)) {
|
|
@@ -24362,8 +24362,8 @@ var require_createNode = __commonJS({
|
|
|
24362
24362
|
var defaultTagPrefix = "tag:yaml.org,2002:";
|
|
24363
24363
|
function findTagObject(value, tagName, tags) {
|
|
24364
24364
|
if (tagName) {
|
|
24365
|
-
const
|
|
24366
|
-
const tagObj =
|
|
24365
|
+
const match2 = tags.filter((t) => t.tag === tagName);
|
|
24366
|
+
const tagObj = match2.find((t) => !t.format) ?? match2[0];
|
|
24367
24367
|
if (!tagObj)
|
|
24368
24368
|
throw new Error(`Tag ${tagName} not found`);
|
|
24369
24369
|
return tagObj;
|
|
@@ -24434,10 +24434,10 @@ var require_Collection = __commonJS({
|
|
|
24434
24434
|
var createNode = require_createNode();
|
|
24435
24435
|
var identity = require_identity();
|
|
24436
24436
|
var Node3 = require_Node();
|
|
24437
|
-
function collectionFromPath(schema,
|
|
24437
|
+
function collectionFromPath(schema, path2, value) {
|
|
24438
24438
|
let v2 = value;
|
|
24439
|
-
for (let i2 =
|
|
24440
|
-
const k2 =
|
|
24439
|
+
for (let i2 = path2.length - 1; i2 >= 0; --i2) {
|
|
24440
|
+
const k2 = path2[i2];
|
|
24441
24441
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
24442
24442
|
const a = [];
|
|
24443
24443
|
a[k2] = v2;
|
|
@@ -24456,7 +24456,7 @@ var require_Collection = __commonJS({
|
|
|
24456
24456
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
24457
24457
|
});
|
|
24458
24458
|
}
|
|
24459
|
-
var isEmptyPath = (
|
|
24459
|
+
var isEmptyPath = (path2) => path2 == null || typeof path2 === "object" && !!path2[Symbol.iterator]().next().done;
|
|
24460
24460
|
var Collection = class extends Node3.NodeBase {
|
|
24461
24461
|
constructor(type, schema) {
|
|
24462
24462
|
super(type);
|
|
@@ -24486,11 +24486,11 @@ var require_Collection = __commonJS({
|
|
|
24486
24486
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
24487
24487
|
* that already exists in the map.
|
|
24488
24488
|
*/
|
|
24489
|
-
addIn(
|
|
24490
|
-
if (isEmptyPath(
|
|
24489
|
+
addIn(path2, value) {
|
|
24490
|
+
if (isEmptyPath(path2))
|
|
24491
24491
|
this.add(value);
|
|
24492
24492
|
else {
|
|
24493
|
-
const [key, ...rest] =
|
|
24493
|
+
const [key, ...rest] = path2;
|
|
24494
24494
|
const node = this.get(key, true);
|
|
24495
24495
|
if (identity.isCollection(node))
|
|
24496
24496
|
node.addIn(rest, value);
|
|
@@ -24504,8 +24504,8 @@ var require_Collection = __commonJS({
|
|
|
24504
24504
|
* Removes a value from the collection.
|
|
24505
24505
|
* @returns `true` if the item was found and removed.
|
|
24506
24506
|
*/
|
|
24507
|
-
deleteIn(
|
|
24508
|
-
const [key, ...rest] =
|
|
24507
|
+
deleteIn(path2) {
|
|
24508
|
+
const [key, ...rest] = path2;
|
|
24509
24509
|
if (rest.length === 0)
|
|
24510
24510
|
return this.delete(key);
|
|
24511
24511
|
const node = this.get(key, true);
|
|
@@ -24519,8 +24519,8 @@ var require_Collection = __commonJS({
|
|
|
24519
24519
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
24520
24520
|
* `true` (collections are always returned intact).
|
|
24521
24521
|
*/
|
|
24522
|
-
getIn(
|
|
24523
|
-
const [key, ...rest] =
|
|
24522
|
+
getIn(path2, keepScalar) {
|
|
24523
|
+
const [key, ...rest] = path2;
|
|
24524
24524
|
const node = this.get(key, true);
|
|
24525
24525
|
if (rest.length === 0)
|
|
24526
24526
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -24538,8 +24538,8 @@ var require_Collection = __commonJS({
|
|
|
24538
24538
|
/**
|
|
24539
24539
|
* Checks if the collection includes a value with the key `key`.
|
|
24540
24540
|
*/
|
|
24541
|
-
hasIn(
|
|
24542
|
-
const [key, ...rest] =
|
|
24541
|
+
hasIn(path2) {
|
|
24542
|
+
const [key, ...rest] = path2;
|
|
24543
24543
|
if (rest.length === 0)
|
|
24544
24544
|
return this.has(key);
|
|
24545
24545
|
const node = this.get(key, true);
|
|
@@ -24549,8 +24549,8 @@ var require_Collection = __commonJS({
|
|
|
24549
24549
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
24550
24550
|
* boolean to add/remove the item from the set.
|
|
24551
24551
|
*/
|
|
24552
|
-
setIn(
|
|
24553
|
-
const [key, ...rest] =
|
|
24552
|
+
setIn(path2, value) {
|
|
24553
|
+
const [key, ...rest] = path2;
|
|
24554
24554
|
if (rest.length === 0) {
|
|
24555
24555
|
this.set(key, value);
|
|
24556
24556
|
} else {
|
|
@@ -25058,21 +25058,21 @@ var require_stringify = __commonJS({
|
|
|
25058
25058
|
}
|
|
25059
25059
|
function getTagObject(tags, item) {
|
|
25060
25060
|
if (item.tag) {
|
|
25061
|
-
const
|
|
25062
|
-
if (
|
|
25063
|
-
return
|
|
25061
|
+
const match2 = tags.filter((t) => t.tag === item.tag);
|
|
25062
|
+
if (match2.length > 0)
|
|
25063
|
+
return match2.find((t) => t.format === item.format) ?? match2[0];
|
|
25064
25064
|
}
|
|
25065
25065
|
let tagObj = void 0;
|
|
25066
25066
|
let obj;
|
|
25067
25067
|
if (identity.isScalar(item)) {
|
|
25068
25068
|
obj = item.value;
|
|
25069
|
-
let
|
|
25070
|
-
if (
|
|
25071
|
-
const testMatch =
|
|
25069
|
+
let match2 = tags.filter((t) => t.identify?.(obj));
|
|
25070
|
+
if (match2.length > 1) {
|
|
25071
|
+
const testMatch = match2.filter((t) => t.test);
|
|
25072
25072
|
if (testMatch.length > 0)
|
|
25073
|
-
|
|
25073
|
+
match2 = testMatch;
|
|
25074
25074
|
}
|
|
25075
|
-
tagObj =
|
|
25075
|
+
tagObj = match2.find((t) => t.format === item.format) ?? match2.find((t) => !t.format);
|
|
25076
25076
|
} else {
|
|
25077
25077
|
obj = item;
|
|
25078
25078
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
@@ -26714,13 +26714,13 @@ var require_timestamp = __commonJS({
|
|
|
26714
26714
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
26715
26715
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
26716
26716
|
resolve(str) {
|
|
26717
|
-
const
|
|
26718
|
-
if (!
|
|
26717
|
+
const match2 = str.match(timestamp.test);
|
|
26718
|
+
if (!match2)
|
|
26719
26719
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
26720
|
-
const [, year, month, day, hour, minute, second] =
|
|
26721
|
-
const millisec =
|
|
26720
|
+
const [, year, month, day, hour, minute, second] = match2.map(Number);
|
|
26721
|
+
const millisec = match2[7] ? Number((match2[7] + "00").substr(1, 3)) : 0;
|
|
26722
26722
|
let date5 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
|
26723
|
-
const tz =
|
|
26723
|
+
const tz = match2[8];
|
|
26724
26724
|
if (tz && tz !== "Z") {
|
|
26725
26725
|
let d = parseSexagesimal(tz, false);
|
|
26726
26726
|
if (Math.abs(d) < 30)
|
|
@@ -27065,9 +27065,9 @@ var require_Document = __commonJS({
|
|
|
27065
27065
|
this.contents.add(value);
|
|
27066
27066
|
}
|
|
27067
27067
|
/** Adds a value to the document. */
|
|
27068
|
-
addIn(
|
|
27068
|
+
addIn(path2, value) {
|
|
27069
27069
|
if (assertCollection(this.contents))
|
|
27070
|
-
this.contents.addIn(
|
|
27070
|
+
this.contents.addIn(path2, value);
|
|
27071
27071
|
}
|
|
27072
27072
|
/**
|
|
27073
27073
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -27142,14 +27142,14 @@ var require_Document = __commonJS({
|
|
|
27142
27142
|
* Removes a value from the document.
|
|
27143
27143
|
* @returns `true` if the item was found and removed.
|
|
27144
27144
|
*/
|
|
27145
|
-
deleteIn(
|
|
27146
|
-
if (Collection.isEmptyPath(
|
|
27145
|
+
deleteIn(path2) {
|
|
27146
|
+
if (Collection.isEmptyPath(path2)) {
|
|
27147
27147
|
if (this.contents == null)
|
|
27148
27148
|
return false;
|
|
27149
27149
|
this.contents = null;
|
|
27150
27150
|
return true;
|
|
27151
27151
|
}
|
|
27152
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
27152
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path2) : false;
|
|
27153
27153
|
}
|
|
27154
27154
|
/**
|
|
27155
27155
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -27164,10 +27164,10 @@ var require_Document = __commonJS({
|
|
|
27164
27164
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
27165
27165
|
* `true` (collections are always returned intact).
|
|
27166
27166
|
*/
|
|
27167
|
-
getIn(
|
|
27168
|
-
if (Collection.isEmptyPath(
|
|
27167
|
+
getIn(path2, keepScalar) {
|
|
27168
|
+
if (Collection.isEmptyPath(path2))
|
|
27169
27169
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
27170
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
27170
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : void 0;
|
|
27171
27171
|
}
|
|
27172
27172
|
/**
|
|
27173
27173
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -27178,10 +27178,10 @@ var require_Document = __commonJS({
|
|
|
27178
27178
|
/**
|
|
27179
27179
|
* Checks if the document includes a value at `path`.
|
|
27180
27180
|
*/
|
|
27181
|
-
hasIn(
|
|
27182
|
-
if (Collection.isEmptyPath(
|
|
27181
|
+
hasIn(path2) {
|
|
27182
|
+
if (Collection.isEmptyPath(path2))
|
|
27183
27183
|
return this.contents !== void 0;
|
|
27184
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
27184
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
|
|
27185
27185
|
}
|
|
27186
27186
|
/**
|
|
27187
27187
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -27198,13 +27198,13 @@ var require_Document = __commonJS({
|
|
|
27198
27198
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
27199
27199
|
* boolean to add/remove the item from the set.
|
|
27200
27200
|
*/
|
|
27201
|
-
setIn(
|
|
27202
|
-
if (Collection.isEmptyPath(
|
|
27201
|
+
setIn(path2, value) {
|
|
27202
|
+
if (Collection.isEmptyPath(path2)) {
|
|
27203
27203
|
this.contents = value;
|
|
27204
27204
|
} else if (this.contents == null) {
|
|
27205
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
27205
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path2), value);
|
|
27206
27206
|
} else if (assertCollection(this.contents)) {
|
|
27207
|
-
this.contents.setIn(
|
|
27207
|
+
this.contents.setIn(path2, value);
|
|
27208
27208
|
}
|
|
27209
27209
|
}
|
|
27210
27210
|
/**
|
|
@@ -27590,10 +27590,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
27590
27590
|
let offset2 = bm.offset;
|
|
27591
27591
|
let commentEnd = null;
|
|
27592
27592
|
for (const collItem of bm.items) {
|
|
27593
|
-
const { start, key, sep:
|
|
27593
|
+
const { start, key, sep: sep3, value } = collItem;
|
|
27594
27594
|
const keyProps = resolveProps.resolveProps(start, {
|
|
27595
27595
|
indicator: "explicit-key-ind",
|
|
27596
|
-
next: key ??
|
|
27596
|
+
next: key ?? sep3?.[0],
|
|
27597
27597
|
offset: offset2,
|
|
27598
27598
|
onError,
|
|
27599
27599
|
parentIndent: bm.indent,
|
|
@@ -27607,7 +27607,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
27607
27607
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
27608
27608
|
onError(offset2, "BAD_INDENT", startColMsg);
|
|
27609
27609
|
}
|
|
27610
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
27610
|
+
if (!keyProps.anchor && !keyProps.tag && !sep3) {
|
|
27611
27611
|
commentEnd = keyProps.end;
|
|
27612
27612
|
if (keyProps.comment) {
|
|
27613
27613
|
if (map2.comment)
|
|
@@ -27631,7 +27631,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
27631
27631
|
ctx.atKey = false;
|
|
27632
27632
|
if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
|
|
27633
27633
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
27634
|
-
const valueProps = resolveProps.resolveProps(
|
|
27634
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
27635
27635
|
indicator: "map-value-ind",
|
|
27636
27636
|
next: value,
|
|
27637
27637
|
offset: keyNode.range[2],
|
|
@@ -27647,7 +27647,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
27647
27647
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
27648
27648
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
27649
27649
|
}
|
|
27650
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset2,
|
|
27650
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset2, sep3, null, valueProps, onError);
|
|
27651
27651
|
if (ctx.schema.compat)
|
|
27652
27652
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
27653
27653
|
offset2 = valueNode.range[2];
|
|
@@ -27738,7 +27738,7 @@ var require_resolve_end = __commonJS({
|
|
|
27738
27738
|
let comment = "";
|
|
27739
27739
|
if (end) {
|
|
27740
27740
|
let hasSpace = false;
|
|
27741
|
-
let
|
|
27741
|
+
let sep3 = "";
|
|
27742
27742
|
for (const token of end) {
|
|
27743
27743
|
const { source, type } = token;
|
|
27744
27744
|
switch (type) {
|
|
@@ -27752,13 +27752,13 @@ var require_resolve_end = __commonJS({
|
|
|
27752
27752
|
if (!comment)
|
|
27753
27753
|
comment = cb;
|
|
27754
27754
|
else
|
|
27755
|
-
comment +=
|
|
27756
|
-
|
|
27755
|
+
comment += sep3 + cb;
|
|
27756
|
+
sep3 = "";
|
|
27757
27757
|
break;
|
|
27758
27758
|
}
|
|
27759
27759
|
case "newline":
|
|
27760
27760
|
if (comment)
|
|
27761
|
-
|
|
27761
|
+
sep3 += source;
|
|
27762
27762
|
hasSpace = true;
|
|
27763
27763
|
break;
|
|
27764
27764
|
default:
|
|
@@ -27801,18 +27801,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
27801
27801
|
let offset2 = fc.offset + fc.start.source.length;
|
|
27802
27802
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
27803
27803
|
const collItem = fc.items[i2];
|
|
27804
|
-
const { start, key, sep:
|
|
27804
|
+
const { start, key, sep: sep3, value } = collItem;
|
|
27805
27805
|
const props = resolveProps.resolveProps(start, {
|
|
27806
27806
|
flow: fcName,
|
|
27807
27807
|
indicator: "explicit-key-ind",
|
|
27808
|
-
next: key ??
|
|
27808
|
+
next: key ?? sep3?.[0],
|
|
27809
27809
|
offset: offset2,
|
|
27810
27810
|
onError,
|
|
27811
27811
|
parentIndent: fc.indent,
|
|
27812
27812
|
startOnNewline: false
|
|
27813
27813
|
});
|
|
27814
27814
|
if (!props.found) {
|
|
27815
|
-
if (!props.anchor && !props.tag && !
|
|
27815
|
+
if (!props.anchor && !props.tag && !sep3 && !value) {
|
|
27816
27816
|
if (i2 === 0 && props.comma)
|
|
27817
27817
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
27818
27818
|
else if (i2 < fc.items.length - 1)
|
|
@@ -27866,8 +27866,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
27866
27866
|
}
|
|
27867
27867
|
}
|
|
27868
27868
|
}
|
|
27869
|
-
if (!isMap2 && !
|
|
27870
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
27869
|
+
if (!isMap2 && !sep3 && !props.found) {
|
|
27870
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep3, null, props, onError);
|
|
27871
27871
|
coll.items.push(valueNode);
|
|
27872
27872
|
offset2 = valueNode.range[2];
|
|
27873
27873
|
if (isBlock(value))
|
|
@@ -27879,7 +27879,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
27879
27879
|
if (isBlock(key))
|
|
27880
27880
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
27881
27881
|
ctx.atKey = false;
|
|
27882
|
-
const valueProps = resolveProps.resolveProps(
|
|
27882
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
27883
27883
|
flow: fcName,
|
|
27884
27884
|
indicator: "map-value-ind",
|
|
27885
27885
|
next: value,
|
|
@@ -27890,8 +27890,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
27890
27890
|
});
|
|
27891
27891
|
if (valueProps.found) {
|
|
27892
27892
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
27893
|
-
if (
|
|
27894
|
-
for (const st2 of
|
|
27893
|
+
if (sep3)
|
|
27894
|
+
for (const st2 of sep3) {
|
|
27895
27895
|
if (st2 === valueProps.found)
|
|
27896
27896
|
break;
|
|
27897
27897
|
if (st2.type === "newline") {
|
|
@@ -27908,7 +27908,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
27908
27908
|
else
|
|
27909
27909
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
27910
27910
|
}
|
|
27911
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
27911
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep3, null, valueProps, onError) : null;
|
|
27912
27912
|
if (valueNode) {
|
|
27913
27913
|
if (isBlock(value))
|
|
27914
27914
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -28088,7 +28088,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
28088
28088
|
chompStart = i2 + 1;
|
|
28089
28089
|
}
|
|
28090
28090
|
let value = "";
|
|
28091
|
-
let
|
|
28091
|
+
let sep3 = "";
|
|
28092
28092
|
let prevMoreIndented = false;
|
|
28093
28093
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
28094
28094
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -28105,24 +28105,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
28105
28105
|
indent = "";
|
|
28106
28106
|
}
|
|
28107
28107
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
28108
|
-
value +=
|
|
28109
|
-
|
|
28108
|
+
value += sep3 + indent.slice(trimIndent) + content2;
|
|
28109
|
+
sep3 = "\n";
|
|
28110
28110
|
} else if (indent.length > trimIndent || content2[0] === " ") {
|
|
28111
|
-
if (
|
|
28112
|
-
|
|
28113
|
-
else if (!prevMoreIndented &&
|
|
28114
|
-
|
|
28115
|
-
value +=
|
|
28116
|
-
|
|
28111
|
+
if (sep3 === " ")
|
|
28112
|
+
sep3 = "\n";
|
|
28113
|
+
else if (!prevMoreIndented && sep3 === "\n")
|
|
28114
|
+
sep3 = "\n\n";
|
|
28115
|
+
value += sep3 + indent.slice(trimIndent) + content2;
|
|
28116
|
+
sep3 = "\n";
|
|
28117
28117
|
prevMoreIndented = true;
|
|
28118
28118
|
} else if (content2 === "") {
|
|
28119
|
-
if (
|
|
28119
|
+
if (sep3 === "\n")
|
|
28120
28120
|
value += "\n";
|
|
28121
28121
|
else
|
|
28122
|
-
|
|
28122
|
+
sep3 = "\n";
|
|
28123
28123
|
} else {
|
|
28124
|
-
value +=
|
|
28125
|
-
|
|
28124
|
+
value += sep3 + content2;
|
|
28125
|
+
sep3 = " ";
|
|
28126
28126
|
prevMoreIndented = false;
|
|
28127
28127
|
}
|
|
28128
28128
|
}
|
|
@@ -28293,8 +28293,8 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
28293
28293
|
}
|
|
28294
28294
|
function unfoldLines(source) {
|
|
28295
28295
|
const line = /(.*?)\r?\n/sy;
|
|
28296
|
-
let
|
|
28297
|
-
if (!
|
|
28296
|
+
let match2 = line.exec(source);
|
|
28297
|
+
if (!match2)
|
|
28298
28298
|
return source;
|
|
28299
28299
|
let trimEnd, trimBoth;
|
|
28300
28300
|
try {
|
|
@@ -28304,26 +28304,26 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
28304
28304
|
trimEnd = /[ \t]+$/;
|
|
28305
28305
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
28306
28306
|
}
|
|
28307
|
-
let res =
|
|
28308
|
-
let
|
|
28307
|
+
let res = match2[1].replace(trimEnd, "");
|
|
28308
|
+
let sep3 = " ";
|
|
28309
28309
|
let pos = line.lastIndex;
|
|
28310
|
-
while (
|
|
28311
|
-
const lm =
|
|
28310
|
+
while (match2 = line.exec(source)) {
|
|
28311
|
+
const lm = match2[1].replace(trimBoth, "");
|
|
28312
28312
|
if (lm === "") {
|
|
28313
|
-
if (
|
|
28314
|
-
res +=
|
|
28313
|
+
if (sep3 === "\n")
|
|
28314
|
+
res += sep3;
|
|
28315
28315
|
else
|
|
28316
|
-
|
|
28316
|
+
sep3 = "\n";
|
|
28317
28317
|
} else {
|
|
28318
|
-
res +=
|
|
28319
|
-
|
|
28318
|
+
res += sep3 + lm;
|
|
28319
|
+
sep3 = " ";
|
|
28320
28320
|
}
|
|
28321
28321
|
pos = line.lastIndex;
|
|
28322
28322
|
}
|
|
28323
28323
|
const last2 = /[ \t]*(.*)/sy;
|
|
28324
28324
|
last2.lastIndex = pos;
|
|
28325
|
-
|
|
28326
|
-
return res +
|
|
28325
|
+
match2 = last2.exec(source);
|
|
28326
|
+
return res + sep3 + (match2?.[1] ?? "");
|
|
28327
28327
|
}
|
|
28328
28328
|
function doubleQuotedValue(source, onError) {
|
|
28329
28329
|
let res = "";
|
|
@@ -28445,7 +28445,7 @@ var require_compose_scalar = __commonJS({
|
|
|
28445
28445
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
28446
28446
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
28447
28447
|
function composeScalar(ctx, token, tagToken, onError) {
|
|
28448
|
-
const { value, type, comment, range } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
|
|
28448
|
+
const { value, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
|
|
28449
28449
|
const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
|
|
28450
28450
|
let tag;
|
|
28451
28451
|
if (ctx.options.stringKeys && ctx.atKey) {
|
|
@@ -28465,7 +28465,7 @@ var require_compose_scalar = __commonJS({
|
|
|
28465
28465
|
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
|
|
28466
28466
|
scalar = new Scalar.Scalar(value);
|
|
28467
28467
|
}
|
|
28468
|
-
scalar.range =
|
|
28468
|
+
scalar.range = range2;
|
|
28469
28469
|
scalar.source = value;
|
|
28470
28470
|
if (type)
|
|
28471
28471
|
scalar.type = type;
|
|
@@ -29133,14 +29133,14 @@ var require_cst_stringify = __commonJS({
|
|
|
29133
29133
|
}
|
|
29134
29134
|
}
|
|
29135
29135
|
}
|
|
29136
|
-
function stringifyItem({ start, key, sep:
|
|
29136
|
+
function stringifyItem({ start, key, sep: sep3, value }) {
|
|
29137
29137
|
let res = "";
|
|
29138
29138
|
for (const st2 of start)
|
|
29139
29139
|
res += st2.source;
|
|
29140
29140
|
if (key)
|
|
29141
29141
|
res += stringifyToken(key);
|
|
29142
|
-
if (
|
|
29143
|
-
for (const st2 of
|
|
29142
|
+
if (sep3)
|
|
29143
|
+
for (const st2 of sep3)
|
|
29144
29144
|
res += st2.source;
|
|
29145
29145
|
if (value)
|
|
29146
29146
|
res += stringifyToken(value);
|
|
@@ -29165,9 +29165,9 @@ var require_cst_visit = __commonJS({
|
|
|
29165
29165
|
visit.BREAK = BREAK;
|
|
29166
29166
|
visit.SKIP = SKIP;
|
|
29167
29167
|
visit.REMOVE = REMOVE;
|
|
29168
|
-
visit.itemAtPath = (cst,
|
|
29168
|
+
visit.itemAtPath = (cst, path2) => {
|
|
29169
29169
|
let item = cst;
|
|
29170
|
-
for (const [field, index] of
|
|
29170
|
+
for (const [field, index] of path2) {
|
|
29171
29171
|
const tok = item?.[field];
|
|
29172
29172
|
if (tok && "items" in tok) {
|
|
29173
29173
|
item = tok.items[index];
|
|
@@ -29176,23 +29176,23 @@ var require_cst_visit = __commonJS({
|
|
|
29176
29176
|
}
|
|
29177
29177
|
return item;
|
|
29178
29178
|
};
|
|
29179
|
-
visit.parentCollection = (cst,
|
|
29180
|
-
const parent = visit.itemAtPath(cst,
|
|
29181
|
-
const field =
|
|
29179
|
+
visit.parentCollection = (cst, path2) => {
|
|
29180
|
+
const parent = visit.itemAtPath(cst, path2.slice(0, -1));
|
|
29181
|
+
const field = path2[path2.length - 1][0];
|
|
29182
29182
|
const coll = parent?.[field];
|
|
29183
29183
|
if (coll && "items" in coll)
|
|
29184
29184
|
return coll;
|
|
29185
29185
|
throw new Error("Parent collection not found");
|
|
29186
29186
|
};
|
|
29187
|
-
function _visit(
|
|
29188
|
-
let ctrl = visitor(item,
|
|
29187
|
+
function _visit(path2, item, visitor) {
|
|
29188
|
+
let ctrl = visitor(item, path2);
|
|
29189
29189
|
if (typeof ctrl === "symbol")
|
|
29190
29190
|
return ctrl;
|
|
29191
29191
|
for (const field of ["key", "value"]) {
|
|
29192
29192
|
const token = item[field];
|
|
29193
29193
|
if (token && "items" in token) {
|
|
29194
29194
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
29195
|
-
const ci2 = _visit(Object.freeze(
|
|
29195
|
+
const ci2 = _visit(Object.freeze(path2.concat([[field, i2]])), token.items[i2], visitor);
|
|
29196
29196
|
if (typeof ci2 === "number")
|
|
29197
29197
|
i2 = ci2 - 1;
|
|
29198
29198
|
else if (ci2 === BREAK)
|
|
@@ -29203,10 +29203,10 @@ var require_cst_visit = __commonJS({
|
|
|
29203
29203
|
}
|
|
29204
29204
|
}
|
|
29205
29205
|
if (typeof ctrl === "function" && field === "key")
|
|
29206
|
-
ctrl = ctrl(item,
|
|
29206
|
+
ctrl = ctrl(item, path2);
|
|
29207
29207
|
}
|
|
29208
29208
|
}
|
|
29209
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
29209
|
+
return typeof ctrl === "function" ? ctrl(item, path2) : ctrl;
|
|
29210
29210
|
}
|
|
29211
29211
|
exports.visit = visit;
|
|
29212
29212
|
}
|
|
@@ -30307,18 +30307,18 @@ var require_parser = __commonJS({
|
|
|
30307
30307
|
if (this.type === "map-value-ind") {
|
|
30308
30308
|
const prev = getPrevProps(this.peek(2));
|
|
30309
30309
|
const start = getFirstKeyStartProps(prev);
|
|
30310
|
-
let
|
|
30310
|
+
let sep3;
|
|
30311
30311
|
if (scalar.end) {
|
|
30312
|
-
|
|
30313
|
-
|
|
30312
|
+
sep3 = scalar.end;
|
|
30313
|
+
sep3.push(this.sourceToken);
|
|
30314
30314
|
delete scalar.end;
|
|
30315
30315
|
} else
|
|
30316
|
-
|
|
30316
|
+
sep3 = [this.sourceToken];
|
|
30317
30317
|
const map2 = {
|
|
30318
30318
|
type: "block-map",
|
|
30319
30319
|
offset: scalar.offset,
|
|
30320
30320
|
indent: scalar.indent,
|
|
30321
|
-
items: [{ start, key: scalar, sep:
|
|
30321
|
+
items: [{ start, key: scalar, sep: sep3 }]
|
|
30322
30322
|
};
|
|
30323
30323
|
this.onKeyLine = true;
|
|
30324
30324
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -30471,15 +30471,15 @@ var require_parser = __commonJS({
|
|
|
30471
30471
|
} else if (isFlowToken(it2.key) && !includesToken(it2.sep, "newline")) {
|
|
30472
30472
|
const start2 = getFirstKeyStartProps(it2.start);
|
|
30473
30473
|
const key = it2.key;
|
|
30474
|
-
const
|
|
30475
|
-
|
|
30474
|
+
const sep3 = it2.sep;
|
|
30475
|
+
sep3.push(this.sourceToken);
|
|
30476
30476
|
delete it2.key;
|
|
30477
30477
|
delete it2.sep;
|
|
30478
30478
|
this.stack.push({
|
|
30479
30479
|
type: "block-map",
|
|
30480
30480
|
offset: this.offset,
|
|
30481
30481
|
indent: this.indent,
|
|
30482
|
-
items: [{ start: start2, key, sep:
|
|
30482
|
+
items: [{ start: start2, key, sep: sep3 }]
|
|
30483
30483
|
});
|
|
30484
30484
|
} else if (start.length > 0) {
|
|
30485
30485
|
it2.sep = it2.sep.concat(start, this.sourceToken);
|
|
@@ -30673,13 +30673,13 @@ var require_parser = __commonJS({
|
|
|
30673
30673
|
const prev = getPrevProps(parent);
|
|
30674
30674
|
const start = getFirstKeyStartProps(prev);
|
|
30675
30675
|
fixFlowSeqItems(fc);
|
|
30676
|
-
const
|
|
30677
|
-
|
|
30676
|
+
const sep3 = fc.end.splice(1, fc.end.length);
|
|
30677
|
+
sep3.push(this.sourceToken);
|
|
30678
30678
|
const map2 = {
|
|
30679
30679
|
type: "block-map",
|
|
30680
30680
|
offset: fc.offset,
|
|
30681
30681
|
indent: fc.indent,
|
|
30682
|
-
items: [{ start, key: fc, sep:
|
|
30682
|
+
items: [{ start, key: fc, sep: sep3 }]
|
|
30683
30683
|
};
|
|
30684
30684
|
this.onKeyLine = true;
|
|
30685
30685
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -31643,7 +31643,7 @@ var init_variable_tracker = __esm({
|
|
|
31643
31643
|
}
|
|
31644
31644
|
/** The executable usage or declaration containing the cursor, in source coordinates. */
|
|
31645
31645
|
referenceAt(uri, position) {
|
|
31646
|
-
const contains = (
|
|
31646
|
+
const contains = (range2) => (position.line > range2.start.line || position.line === range2.start.line && position.character >= range2.start.character) && (position.line < range2.end.line || position.line === range2.end.line && position.character <= range2.end.character);
|
|
31647
31647
|
let atEnd = null;
|
|
31648
31648
|
for (const [sigil, usages, declarations] of [
|
|
31649
31649
|
["$", this.usagesByUri.get(uri), this.variables.occurrences],
|
|
@@ -31711,11 +31711,11 @@ var init_variable_tracker = __esm({
|
|
|
31711
31711
|
getInvalidTransientDeclarations() {
|
|
31712
31712
|
const collisions = [];
|
|
31713
31713
|
if (this.variables.present) {
|
|
31714
|
-
for (const [name,
|
|
31714
|
+
for (const [name, range2] of this.transients.names) {
|
|
31715
31715
|
if (!this.variables.names.has(name)) continue;
|
|
31716
31716
|
collisions.push({
|
|
31717
31717
|
message: `StoryTransients: Variable "${name}" is already declared in StoryVariables. Names must be unique across scopes.`,
|
|
31718
|
-
range
|
|
31718
|
+
range: range2
|
|
31719
31719
|
});
|
|
31720
31720
|
}
|
|
31721
31721
|
}
|
|
@@ -31872,8 +31872,8 @@ function isExcludedSegment(segment) {
|
|
|
31872
31872
|
function isMacroSource(uriOrPath) {
|
|
31873
31873
|
return MACRO_SOURCE_PATTERN.test(uriOrPath);
|
|
31874
31874
|
}
|
|
31875
|
-
function isExcludedProjectFile(
|
|
31876
|
-
return (root ? relative2(root,
|
|
31875
|
+
function isExcludedProjectFile(path2, root) {
|
|
31876
|
+
return (root ? relative2(root, path2) : path2).split(/[\\/]/).some(isExcludedSegment);
|
|
31877
31877
|
}
|
|
31878
31878
|
function findMacroSourceFiles(root) {
|
|
31879
31879
|
return findProjectFiles(root, MACRO_SOURCE_GLOB);
|
|
@@ -31889,8 +31889,8 @@ function findProjectFiles(root, pattern) {
|
|
|
31889
31889
|
ignore: { ignored: excluded, childrenIgnored: excluded }
|
|
31890
31890
|
});
|
|
31891
31891
|
}
|
|
31892
|
-
function isWithin(
|
|
31893
|
-
const rel = relative2(dir,
|
|
31892
|
+
function isWithin(path2, dir) {
|
|
31893
|
+
const rel = relative2(dir, path2);
|
|
31894
31894
|
return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
|
|
31895
31895
|
}
|
|
31896
31896
|
function commonDirectory(files) {
|
|
@@ -31978,8 +31978,8 @@ function aWorkspaceMemberDeclaresSpindle(dir, pkg) {
|
|
|
31978
31978
|
return ts(members, { cwd: dir, ignore }).some((file2) => declaresSpindle(readPackageJson(join3(dir, file2))));
|
|
31979
31979
|
}
|
|
31980
31980
|
function readSpindlePackageVersion(file2) {
|
|
31981
|
-
const
|
|
31982
|
-
return findUp(dirname2(
|
|
31981
|
+
const path2 = file2.startsWith("file:") ? fileURLToPath(file2) : file2;
|
|
31982
|
+
return findUp(dirname2(path2), (dir) => {
|
|
31983
31983
|
const candidate = join3(dir, "package.json");
|
|
31984
31984
|
if (!existsSync3(candidate)) return void 0;
|
|
31985
31985
|
const pkg = readPackageJson(candidate);
|
|
@@ -33899,7 +33899,7 @@ function markupDiagnostics(passage, story, workspace) {
|
|
|
33899
33899
|
return (story.markup.get(passage) ?? []).map((found) => fromMarkup(passage, found, workspace));
|
|
33900
33900
|
}
|
|
33901
33901
|
function fromMarkup(passage, found, workspace) {
|
|
33902
|
-
const
|
|
33902
|
+
const range2 = passage.range(...visibleSpan(passage.content, found.start, found.end));
|
|
33903
33903
|
const name = text2(found.data?.name);
|
|
33904
33904
|
let code = MARKUP_CODES[found.code];
|
|
33905
33905
|
let data2;
|
|
@@ -33910,7 +33910,7 @@ function fromMarkup(passage, found, workspace) {
|
|
|
33910
33910
|
kind: "unknown-macro",
|
|
33911
33911
|
name,
|
|
33912
33912
|
suggestions: list2(found.data?.suggestions),
|
|
33913
|
-
nameRange: token ? passage.range(token.nameStart, token.nameEnd) :
|
|
33913
|
+
nameRange: token ? passage.range(token.nameStart, token.nameEnd) : range2
|
|
33914
33914
|
};
|
|
33915
33915
|
break;
|
|
33916
33916
|
}
|
|
@@ -33934,7 +33934,7 @@ function fromMarkup(passage, found, workspace) {
|
|
|
33934
33934
|
break;
|
|
33935
33935
|
}
|
|
33936
33936
|
}
|
|
33937
|
-
return makeDiag(
|
|
33937
|
+
return makeDiag(range2, code, found.message, data2);
|
|
33938
33938
|
}
|
|
33939
33939
|
function visibleSpan(content2, start, end) {
|
|
33940
33940
|
if (end > start) return [start, end];
|
|
@@ -34048,15 +34048,15 @@ function parentDiagnostics(passage, token, ancestors, workspace) {
|
|
|
34048
34048
|
if (!parents || parents.length === 0 || BRANCH_MACROS2.has(name)) return [];
|
|
34049
34049
|
const allowed = new Set(parents.map((parent) => parent.toLowerCase()));
|
|
34050
34050
|
const parentList = parents.join(", ");
|
|
34051
|
-
const
|
|
34051
|
+
const range2 = passage.range(token.start, token.end);
|
|
34052
34052
|
if (DIRECT_CHILD_MACROS.has(name)) {
|
|
34053
34053
|
const parent = ancestors[ancestors.length - 1];
|
|
34054
34054
|
if (parent && !parent.element && allowed.has(parent.name)) return [];
|
|
34055
34055
|
const where2 = parent ? parent.element ? `, not inside <${parent.name}>` : `, not inside {${parent.name}}` : "";
|
|
34056
|
-
return [makeDiag(
|
|
34056
|
+
return [makeDiag(range2, DiagnosticCode.InvalidChildren, `Invalid: {${token.name}} can only be directly inside {${parentList}}${where2}`)];
|
|
34057
34057
|
}
|
|
34058
34058
|
if (ancestors.some((ancestor) => !ancestor.element && allowed.has(ancestor.name))) return [];
|
|
34059
|
-
return [makeDiag(
|
|
34059
|
+
return [makeDiag(range2, DiagnosticCode.InvalidChildren, `Invalid: {${token.name}} can only be inside {${parentList}}`)];
|
|
34060
34060
|
}
|
|
34061
34061
|
function childDiagnostics(passage, node, token, workspace) {
|
|
34062
34062
|
const constraints = workspace.macros.getMacro(token.name)?.children;
|
|
@@ -34070,19 +34070,19 @@ function childDiagnostics(passage, node, token, workspace) {
|
|
|
34070
34070
|
if (workspace.macros.getMacro(key)) counts[key] = (counts[key] ?? 0) + 1;
|
|
34071
34071
|
}
|
|
34072
34072
|
const diagnostics = [];
|
|
34073
|
-
const
|
|
34073
|
+
const range2 = passage.range(token.start, token.end);
|
|
34074
34074
|
for (const constraint of constraints) {
|
|
34075
34075
|
const count = counts[constraint.name.toLowerCase()] ?? 0;
|
|
34076
34076
|
if (constraint.max !== void 0 && count > constraint.max) {
|
|
34077
34077
|
diagnostics.push(makeDiag(
|
|
34078
|
-
|
|
34078
|
+
range2,
|
|
34079
34079
|
DiagnosticCode.ChildMaxExceeded,
|
|
34080
34080
|
`Too many {${constraint.name}} in {${token.name}} (max ${constraint.max}, found ${count})`
|
|
34081
34081
|
));
|
|
34082
34082
|
}
|
|
34083
34083
|
if (constraint.min !== void 0 && count < constraint.min) {
|
|
34084
34084
|
diagnostics.push(makeDiag(
|
|
34085
|
-
|
|
34085
|
+
range2,
|
|
34086
34086
|
DiagnosticCode.ChildMinNotMet,
|
|
34087
34087
|
`Too few {${constraint.name}} in {${token.name}} (min ${constraint.min}, found ${count})`
|
|
34088
34088
|
));
|
|
@@ -34208,11 +34208,11 @@ function argumentDiagnostics(passage, workspace) {
|
|
|
34208
34208
|
} catch {
|
|
34209
34209
|
continue;
|
|
34210
34210
|
}
|
|
34211
|
-
const
|
|
34211
|
+
const range2 = passage.range(token.start, token.end);
|
|
34212
34212
|
const args2 = lexArguments(token.rawArgs);
|
|
34213
34213
|
if (params.isEmpty()) {
|
|
34214
34214
|
if (args2.length > 0) {
|
|
34215
|
-
diagnostics.push(makeDiag(
|
|
34215
|
+
diagnostics.push(makeDiag(range2, DiagnosticCode.ExpectedNoArguments, `Expected no arguments for {${token.name}}, got ${args2.length}`));
|
|
34216
34216
|
}
|
|
34217
34217
|
continue;
|
|
34218
34218
|
}
|
|
@@ -34220,10 +34220,10 @@ function argumentDiagnostics(passage, workspace) {
|
|
|
34220
34220
|
if (result2.variantIndex === null) continue;
|
|
34221
34221
|
for (const error48 of result2.errors) {
|
|
34222
34222
|
const code = error48.message.startsWith("Too many arguments") ? DiagnosticCode.TooManyArguments : DiagnosticCode.ParameterTypeError;
|
|
34223
|
-
diagnostics.push(makeDiag(
|
|
34223
|
+
diagnostics.push(makeDiag(range2, code, `{${token.name}}: ${error48.message}`));
|
|
34224
34224
|
}
|
|
34225
34225
|
for (const warning of result2.warnings) {
|
|
34226
|
-
diagnostics.push(makeDiag(
|
|
34226
|
+
diagnostics.push(makeDiag(range2, DiagnosticCode.ParameterWarning, `{${token.name}}: ${warning.message}`));
|
|
34227
34227
|
}
|
|
34228
34228
|
}
|
|
34229
34229
|
return diagnostics;
|
|
@@ -34322,9 +34322,9 @@ function lineLengthDiagnostics(doc, maxLength) {
|
|
|
34322
34322
|
}
|
|
34323
34323
|
return diagnostics;
|
|
34324
34324
|
}
|
|
34325
|
-
function makeDiag(
|
|
34325
|
+
function makeDiag(range2, code, message, data2) {
|
|
34326
34326
|
const diagnostic = {
|
|
34327
|
-
range,
|
|
34327
|
+
range: range2,
|
|
34328
34328
|
message,
|
|
34329
34329
|
severity: getSeverity(code),
|
|
34330
34330
|
code,
|
|
@@ -34718,7 +34718,7 @@ async function runCheck(args2) {
|
|
|
34718
34718
|
return 1;
|
|
34719
34719
|
}
|
|
34720
34720
|
}
|
|
34721
|
-
const fileContents = new Map([...contents].map(([
|
|
34721
|
+
const fileContents = new Map([...contents].map(([path2, text3]) => [pathToFileURL3(path2).toString(), text3]));
|
|
34722
34722
|
const storyFormat = await findStoryFormat(fileContents.values(), commonDir);
|
|
34723
34723
|
if (!storyFormat.isSpindle) {
|
|
34724
34724
|
console.error(skippedFormatNote(storyFormat));
|
|
@@ -34838,25 +34838,1975 @@ var init_segment = __esm({
|
|
|
34838
34838
|
}
|
|
34839
34839
|
});
|
|
34840
34840
|
|
|
34841
|
+
// node_modules/balanced-match/dist/esm/index.js
|
|
34842
|
+
var balanced, maybeMatch, range;
|
|
34843
|
+
var init_esm = __esm({
|
|
34844
|
+
"node_modules/balanced-match/dist/esm/index.js"() {
|
|
34845
|
+
balanced = (a, b, str) => {
|
|
34846
|
+
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
34847
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
34848
|
+
const r = ma !== null && mb != null && range(ma, mb, str);
|
|
34849
|
+
return r && {
|
|
34850
|
+
start: r[0],
|
|
34851
|
+
end: r[1],
|
|
34852
|
+
pre: str.slice(0, r[0]),
|
|
34853
|
+
body: str.slice(r[0] + ma.length, r[1]),
|
|
34854
|
+
post: str.slice(r[1] + mb.length)
|
|
34855
|
+
};
|
|
34856
|
+
};
|
|
34857
|
+
maybeMatch = (reg, str) => {
|
|
34858
|
+
const m = str.match(reg);
|
|
34859
|
+
return m ? m[0] : null;
|
|
34860
|
+
};
|
|
34861
|
+
range = (a, b, str) => {
|
|
34862
|
+
let begs, beg, left, right = void 0, result2;
|
|
34863
|
+
let ai2 = str.indexOf(a);
|
|
34864
|
+
let bi2 = str.indexOf(b, ai2 + 1);
|
|
34865
|
+
let i2 = ai2;
|
|
34866
|
+
if (ai2 >= 0 && bi2 > 0) {
|
|
34867
|
+
if (a === b) {
|
|
34868
|
+
return [ai2, bi2];
|
|
34869
|
+
}
|
|
34870
|
+
begs = [];
|
|
34871
|
+
left = str.length;
|
|
34872
|
+
while (i2 >= 0 && !result2) {
|
|
34873
|
+
if (i2 === ai2) {
|
|
34874
|
+
begs.push(i2);
|
|
34875
|
+
ai2 = str.indexOf(a, i2 + 1);
|
|
34876
|
+
} else if (begs.length === 1) {
|
|
34877
|
+
const r = begs.pop();
|
|
34878
|
+
if (r !== void 0)
|
|
34879
|
+
result2 = [r, bi2];
|
|
34880
|
+
} else {
|
|
34881
|
+
beg = begs.pop();
|
|
34882
|
+
if (beg !== void 0 && beg < left) {
|
|
34883
|
+
left = beg;
|
|
34884
|
+
right = bi2;
|
|
34885
|
+
}
|
|
34886
|
+
bi2 = str.indexOf(b, i2 + 1);
|
|
34887
|
+
}
|
|
34888
|
+
i2 = ai2 < bi2 && ai2 >= 0 ? ai2 : bi2;
|
|
34889
|
+
}
|
|
34890
|
+
if (begs.length && right !== void 0) {
|
|
34891
|
+
result2 = [left, right];
|
|
34892
|
+
}
|
|
34893
|
+
}
|
|
34894
|
+
return result2;
|
|
34895
|
+
};
|
|
34896
|
+
}
|
|
34897
|
+
});
|
|
34898
|
+
|
|
34899
|
+
// node_modules/brace-expansion/dist/esm/index.js
|
|
34900
|
+
function numeric(str) {
|
|
34901
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
34902
|
+
}
|
|
34903
|
+
function escapeBraces(str) {
|
|
34904
|
+
return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
34905
|
+
}
|
|
34906
|
+
function unescapeBraces(str) {
|
|
34907
|
+
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
34908
|
+
}
|
|
34909
|
+
function pushAll(target, items) {
|
|
34910
|
+
for (let i2 = 0; i2 < items.length; i2++) {
|
|
34911
|
+
target.push(items[i2]);
|
|
34912
|
+
}
|
|
34913
|
+
}
|
|
34914
|
+
function parseCommaParts(str) {
|
|
34915
|
+
const parts = [];
|
|
34916
|
+
let carry = "";
|
|
34917
|
+
for (; ; ) {
|
|
34918
|
+
const m = balanced("{", "}", str);
|
|
34919
|
+
if (!m) {
|
|
34920
|
+
const tail = str.split(",");
|
|
34921
|
+
tail[0] = carry + tail[0];
|
|
34922
|
+
pushAll(parts, tail);
|
|
34923
|
+
return parts;
|
|
34924
|
+
}
|
|
34925
|
+
const { pre, body, post } = m;
|
|
34926
|
+
const p = pre.split(",");
|
|
34927
|
+
p[0] = carry + p[0];
|
|
34928
|
+
p[p.length - 1] += "{" + body + "}";
|
|
34929
|
+
if (!post.length) {
|
|
34930
|
+
pushAll(parts, p);
|
|
34931
|
+
return parts;
|
|
34932
|
+
}
|
|
34933
|
+
carry = p.pop();
|
|
34934
|
+
pushAll(parts, p);
|
|
34935
|
+
str = post;
|
|
34936
|
+
}
|
|
34937
|
+
}
|
|
34938
|
+
function expand2(str, options = {}) {
|
|
34939
|
+
if (!str) {
|
|
34940
|
+
return [];
|
|
34941
|
+
}
|
|
34942
|
+
const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options;
|
|
34943
|
+
if (str.slice(0, 2) === "{}") {
|
|
34944
|
+
str = "\\{\\}" + str.slice(2);
|
|
34945
|
+
}
|
|
34946
|
+
return expand_(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
|
|
34947
|
+
}
|
|
34948
|
+
function embrace(str) {
|
|
34949
|
+
return "{" + str + "}";
|
|
34950
|
+
}
|
|
34951
|
+
function isPadded(el) {
|
|
34952
|
+
return /^-?0\d/.test(el);
|
|
34953
|
+
}
|
|
34954
|
+
function lte(i2, y) {
|
|
34955
|
+
return i2 <= y;
|
|
34956
|
+
}
|
|
34957
|
+
function gte(i2, y) {
|
|
34958
|
+
return i2 >= y;
|
|
34959
|
+
}
|
|
34960
|
+
function combine(acc, pre, values, max, maxLength, dropEmpties) {
|
|
34961
|
+
const out = [];
|
|
34962
|
+
let length = 0;
|
|
34963
|
+
for (let a = 0; a < acc.length; a++) {
|
|
34964
|
+
for (let v2 = 0; v2 < values.length; v2++) {
|
|
34965
|
+
if (out.length >= max)
|
|
34966
|
+
return out;
|
|
34967
|
+
const expansion = acc[a] + pre + values[v2];
|
|
34968
|
+
if (dropEmpties && !expansion)
|
|
34969
|
+
continue;
|
|
34970
|
+
if (length + expansion.length > maxLength)
|
|
34971
|
+
return out;
|
|
34972
|
+
out.push(expansion);
|
|
34973
|
+
length += expansion.length;
|
|
34974
|
+
}
|
|
34975
|
+
}
|
|
34976
|
+
return out;
|
|
34977
|
+
}
|
|
34978
|
+
function expandSequence(body, isAlphaSequence, max, maxLength) {
|
|
34979
|
+
const n7 = body.split(/\.\./);
|
|
34980
|
+
const N2 = [];
|
|
34981
|
+
if (n7[0] === void 0 || n7[1] === void 0) {
|
|
34982
|
+
return N2;
|
|
34983
|
+
}
|
|
34984
|
+
const x2 = numeric(n7[0]);
|
|
34985
|
+
const y = numeric(n7[1]);
|
|
34986
|
+
const width = Math.max(n7[0].length, n7[1].length);
|
|
34987
|
+
let incr = n7.length === 3 && n7[2] !== void 0 ? Math.max(Math.abs(numeric(n7[2])), 1) : 1;
|
|
34988
|
+
let test = lte;
|
|
34989
|
+
const reverse = y < x2;
|
|
34990
|
+
if (reverse) {
|
|
34991
|
+
incr *= -1;
|
|
34992
|
+
test = gte;
|
|
34993
|
+
}
|
|
34994
|
+
const pad = n7.some(isPadded);
|
|
34995
|
+
let length = 0;
|
|
34996
|
+
for (let i2 = x2; test(i2, y) && N2.length < max; i2 += incr) {
|
|
34997
|
+
let c;
|
|
34998
|
+
if (isAlphaSequence) {
|
|
34999
|
+
c = String.fromCharCode(i2);
|
|
35000
|
+
if (c === "\\") {
|
|
35001
|
+
c = "";
|
|
35002
|
+
}
|
|
35003
|
+
} else {
|
|
35004
|
+
c = String(i2);
|
|
35005
|
+
if (pad) {
|
|
35006
|
+
const need = width - c.length;
|
|
35007
|
+
if (need > 0) {
|
|
35008
|
+
const z2 = new Array(need + 1).join("0");
|
|
35009
|
+
if (i2 < 0) {
|
|
35010
|
+
c = "-" + z2 + c.slice(1);
|
|
35011
|
+
} else {
|
|
35012
|
+
c = z2 + c;
|
|
35013
|
+
}
|
|
35014
|
+
}
|
|
35015
|
+
}
|
|
35016
|
+
}
|
|
35017
|
+
if (length + c.length > maxLength)
|
|
35018
|
+
break;
|
|
35019
|
+
N2.push(c);
|
|
35020
|
+
length += c.length;
|
|
35021
|
+
}
|
|
35022
|
+
return N2;
|
|
35023
|
+
}
|
|
35024
|
+
function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
|
|
35025
|
+
if (depth > maxDepth) {
|
|
35026
|
+
return [str];
|
|
35027
|
+
}
|
|
35028
|
+
let acc = [""];
|
|
35029
|
+
let rewrites = 0;
|
|
35030
|
+
let dropEmpties = false;
|
|
35031
|
+
let firstGroup = true;
|
|
35032
|
+
for (; ; ) {
|
|
35033
|
+
const m = balanced("{", "}", str);
|
|
35034
|
+
if (!m) {
|
|
35035
|
+
return combine(acc, str, [""], max, maxLength, dropEmpties);
|
|
35036
|
+
}
|
|
35037
|
+
const pre = m.pre;
|
|
35038
|
+
if (/\$$/.test(pre)) {
|
|
35039
|
+
acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
|
|
35040
|
+
firstGroup = false;
|
|
35041
|
+
if (!m.post.length)
|
|
35042
|
+
break;
|
|
35043
|
+
str = m.post;
|
|
35044
|
+
continue;
|
|
35045
|
+
}
|
|
35046
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
35047
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
35048
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
35049
|
+
const isOptions = m.body.indexOf(",") >= 0;
|
|
35050
|
+
if (!isSequence && !isOptions) {
|
|
35051
|
+
if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
|
|
35052
|
+
rewrites++;
|
|
35053
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
35054
|
+
isTop = true;
|
|
35055
|
+
continue;
|
|
35056
|
+
}
|
|
35057
|
+
return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
|
|
35058
|
+
}
|
|
35059
|
+
if (firstGroup) {
|
|
35060
|
+
dropEmpties = isTop && !isSequence;
|
|
35061
|
+
firstGroup = false;
|
|
35062
|
+
}
|
|
35063
|
+
let values;
|
|
35064
|
+
if (isSequence) {
|
|
35065
|
+
values = expandSequence(m.body, isAlphaSequence, max, maxLength);
|
|
35066
|
+
} else {
|
|
35067
|
+
let n7 = parseCommaParts(m.body);
|
|
35068
|
+
if (n7.length === 1 && n7[0] !== void 0) {
|
|
35069
|
+
n7 = expand_(n7[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
|
|
35070
|
+
if (n7.length === 1) {
|
|
35071
|
+
acc = combine(acc, pre + n7[0], [""], max, maxLength, dropEmpties && !m.post.length);
|
|
35072
|
+
if (!m.post.length)
|
|
35073
|
+
break;
|
|
35074
|
+
str = m.post;
|
|
35075
|
+
continue;
|
|
35076
|
+
}
|
|
35077
|
+
}
|
|
35078
|
+
let dropsEmpties = dropEmpties && !m.post.length && !pre;
|
|
35079
|
+
for (let d = 0; dropsEmpties && d < acc.length; d++) {
|
|
35080
|
+
if (acc[d]) {
|
|
35081
|
+
dropsEmpties = false;
|
|
35082
|
+
}
|
|
35083
|
+
}
|
|
35084
|
+
values = [];
|
|
35085
|
+
let valuesLength = 0;
|
|
35086
|
+
outer: for (let j2 = 0; j2 < n7.length; j2++) {
|
|
35087
|
+
const expanded = expand_(n7[j2], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
|
|
35088
|
+
for (let k2 = 0; k2 < expanded.length; k2++) {
|
|
35089
|
+
const v2 = expanded[k2];
|
|
35090
|
+
if (dropsEmpties && !v2)
|
|
35091
|
+
continue;
|
|
35092
|
+
if (values.length >= max || valuesLength + v2.length > maxLength) {
|
|
35093
|
+
break outer;
|
|
35094
|
+
}
|
|
35095
|
+
values.push(v2);
|
|
35096
|
+
valuesLength += v2.length;
|
|
35097
|
+
}
|
|
35098
|
+
}
|
|
35099
|
+
}
|
|
35100
|
+
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
|
|
35101
|
+
if (!m.post.length)
|
|
35102
|
+
break;
|
|
35103
|
+
str = m.post;
|
|
35104
|
+
}
|
|
35105
|
+
return acc;
|
|
35106
|
+
}
|
|
35107
|
+
var escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX, EXPANSION_MAX_LENGTH, EXPANSION_MAX_DEPTH, EXPANSION_MAX_REWRITES;
|
|
35108
|
+
var init_esm2 = __esm({
|
|
35109
|
+
"node_modules/brace-expansion/dist/esm/index.js"() {
|
|
35110
|
+
init_esm();
|
|
35111
|
+
escSlash = "\0SLASH" + Math.random() + "\0";
|
|
35112
|
+
escOpen = "\0OPEN" + Math.random() + "\0";
|
|
35113
|
+
escClose = "\0CLOSE" + Math.random() + "\0";
|
|
35114
|
+
escComma = "\0COMMA" + Math.random() + "\0";
|
|
35115
|
+
escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
35116
|
+
escSlashPattern = new RegExp(escSlash, "g");
|
|
35117
|
+
escOpenPattern = new RegExp(escOpen, "g");
|
|
35118
|
+
escClosePattern = new RegExp(escClose, "g");
|
|
35119
|
+
escCommaPattern = new RegExp(escComma, "g");
|
|
35120
|
+
escPeriodPattern = new RegExp(escPeriod, "g");
|
|
35121
|
+
slashPattern = /\\\\/g;
|
|
35122
|
+
openPattern = /\\{/g;
|
|
35123
|
+
closePattern = /\\}/g;
|
|
35124
|
+
commaPattern = /\\,/g;
|
|
35125
|
+
periodPattern = /\\\./g;
|
|
35126
|
+
EXPANSION_MAX = 1e5;
|
|
35127
|
+
EXPANSION_MAX_LENGTH = 4e6;
|
|
35128
|
+
EXPANSION_MAX_DEPTH = 1e3;
|
|
35129
|
+
EXPANSION_MAX_REWRITES = 1e3;
|
|
35130
|
+
}
|
|
35131
|
+
});
|
|
35132
|
+
|
|
35133
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
35134
|
+
var MAX_PATTERN_LENGTH, assertValidPattern;
|
|
35135
|
+
var init_assert_valid_pattern = __esm({
|
|
35136
|
+
"node_modules/minimatch/dist/esm/assert-valid-pattern.js"() {
|
|
35137
|
+
MAX_PATTERN_LENGTH = 1024 * 64;
|
|
35138
|
+
assertValidPattern = (pattern) => {
|
|
35139
|
+
if (typeof pattern !== "string") {
|
|
35140
|
+
throw new TypeError("invalid pattern");
|
|
35141
|
+
}
|
|
35142
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
35143
|
+
throw new TypeError("pattern is too long");
|
|
35144
|
+
}
|
|
35145
|
+
};
|
|
35146
|
+
}
|
|
35147
|
+
});
|
|
35148
|
+
|
|
35149
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
35150
|
+
var posixClasses, braceEscape, regexpEscape, rangesToString, parseClass;
|
|
35151
|
+
var init_brace_expressions = __esm({
|
|
35152
|
+
"node_modules/minimatch/dist/esm/brace-expressions.js"() {
|
|
35153
|
+
posixClasses = {
|
|
35154
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
35155
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
35156
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
35157
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
35158
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
35159
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
35160
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
35161
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
35162
|
+
"[:print:]": ["\\p{C}", true],
|
|
35163
|
+
"[:punct:]": ["\\p{P}", true],
|
|
35164
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
35165
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
35166
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
35167
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
35168
|
+
};
|
|
35169
|
+
braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
35170
|
+
regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
35171
|
+
rangesToString = (ranges) => ranges.join("");
|
|
35172
|
+
parseClass = (glob, position) => {
|
|
35173
|
+
const pos = position;
|
|
35174
|
+
if (glob.charAt(pos) !== "[") {
|
|
35175
|
+
throw new Error("not in a brace expression");
|
|
35176
|
+
}
|
|
35177
|
+
const ranges = [];
|
|
35178
|
+
const negs = [];
|
|
35179
|
+
let i2 = pos + 1;
|
|
35180
|
+
let sawStart = false;
|
|
35181
|
+
let uflag = false;
|
|
35182
|
+
let escaping = false;
|
|
35183
|
+
let negate = false;
|
|
35184
|
+
let endPos = pos;
|
|
35185
|
+
let rangeStart = "";
|
|
35186
|
+
WHILE: while (i2 < glob.length) {
|
|
35187
|
+
const c = glob.charAt(i2);
|
|
35188
|
+
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
35189
|
+
negate = true;
|
|
35190
|
+
i2++;
|
|
35191
|
+
continue;
|
|
35192
|
+
}
|
|
35193
|
+
if (c === "]" && sawStart && !escaping) {
|
|
35194
|
+
endPos = i2 + 1;
|
|
35195
|
+
break;
|
|
35196
|
+
}
|
|
35197
|
+
sawStart = true;
|
|
35198
|
+
if (c === "\\") {
|
|
35199
|
+
if (!escaping) {
|
|
35200
|
+
escaping = true;
|
|
35201
|
+
i2++;
|
|
35202
|
+
continue;
|
|
35203
|
+
}
|
|
35204
|
+
}
|
|
35205
|
+
if (c === "[" && !escaping) {
|
|
35206
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
35207
|
+
if (glob.startsWith(cls, i2)) {
|
|
35208
|
+
if (rangeStart) {
|
|
35209
|
+
return ["$.", false, glob.length - pos, true];
|
|
35210
|
+
}
|
|
35211
|
+
i2 += cls.length;
|
|
35212
|
+
if (neg)
|
|
35213
|
+
negs.push(unip);
|
|
35214
|
+
else
|
|
35215
|
+
ranges.push(unip);
|
|
35216
|
+
uflag = uflag || u;
|
|
35217
|
+
continue WHILE;
|
|
35218
|
+
}
|
|
35219
|
+
}
|
|
35220
|
+
}
|
|
35221
|
+
escaping = false;
|
|
35222
|
+
if (rangeStart) {
|
|
35223
|
+
if (c > rangeStart) {
|
|
35224
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
35225
|
+
} else if (c === rangeStart) {
|
|
35226
|
+
ranges.push(braceEscape(c));
|
|
35227
|
+
}
|
|
35228
|
+
rangeStart = "";
|
|
35229
|
+
i2++;
|
|
35230
|
+
continue;
|
|
35231
|
+
}
|
|
35232
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
35233
|
+
ranges.push(braceEscape(c + "-"));
|
|
35234
|
+
i2 += 2;
|
|
35235
|
+
continue;
|
|
35236
|
+
}
|
|
35237
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
35238
|
+
rangeStart = c;
|
|
35239
|
+
i2 += 2;
|
|
35240
|
+
continue;
|
|
35241
|
+
}
|
|
35242
|
+
ranges.push(braceEscape(c));
|
|
35243
|
+
i2++;
|
|
35244
|
+
}
|
|
35245
|
+
if (endPos < i2) {
|
|
35246
|
+
return ["", false, 0, false];
|
|
35247
|
+
}
|
|
35248
|
+
if (!ranges.length && !negs.length) {
|
|
35249
|
+
return ["$.", false, glob.length - pos, true];
|
|
35250
|
+
}
|
|
35251
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
35252
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
35253
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
35254
|
+
}
|
|
35255
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
35256
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
35257
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
35258
|
+
return [comb, uflag, endPos - pos, true];
|
|
35259
|
+
};
|
|
35260
|
+
}
|
|
35261
|
+
});
|
|
35262
|
+
|
|
35263
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
35264
|
+
var unescape2;
|
|
35265
|
+
var init_unescape = __esm({
|
|
35266
|
+
"node_modules/minimatch/dist/esm/unescape.js"() {
|
|
35267
|
+
unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
35268
|
+
if (magicalBraces) {
|
|
35269
|
+
return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
|
|
35270
|
+
}
|
|
35271
|
+
return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
35272
|
+
};
|
|
35273
|
+
}
|
|
35274
|
+
});
|
|
35275
|
+
|
|
35276
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
35277
|
+
var _a, types2, isExtglobType, isExtglobAST, adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, ID, AST;
|
|
35278
|
+
var init_ast = __esm({
|
|
35279
|
+
"node_modules/minimatch/dist/esm/ast.js"() {
|
|
35280
|
+
init_brace_expressions();
|
|
35281
|
+
init_unescape();
|
|
35282
|
+
types2 = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
35283
|
+
isExtglobType = (c) => types2.has(c);
|
|
35284
|
+
isExtglobAST = (c) => isExtglobType(c.type);
|
|
35285
|
+
adoptionMap = /* @__PURE__ */ new Map([
|
|
35286
|
+
["!", ["@"]],
|
|
35287
|
+
["?", ["?", "@"]],
|
|
35288
|
+
["@", ["@"]],
|
|
35289
|
+
["*", ["*", "+", "?", "@"]],
|
|
35290
|
+
["+", ["+", "@"]]
|
|
35291
|
+
]);
|
|
35292
|
+
adoptionWithSpaceMap = /* @__PURE__ */ new Map([
|
|
35293
|
+
["!", ["?"]],
|
|
35294
|
+
["@", ["?"]],
|
|
35295
|
+
["+", ["?", "*"]]
|
|
35296
|
+
]);
|
|
35297
|
+
adoptionAnyMap = /* @__PURE__ */ new Map([
|
|
35298
|
+
["!", ["?", "@"]],
|
|
35299
|
+
["?", ["?", "@"]],
|
|
35300
|
+
["@", ["?", "@"]],
|
|
35301
|
+
["*", ["*", "+", "?", "@"]],
|
|
35302
|
+
["+", ["+", "@", "?", "*"]]
|
|
35303
|
+
]);
|
|
35304
|
+
usurpMap = /* @__PURE__ */ new Map([
|
|
35305
|
+
["!", /* @__PURE__ */ new Map([["!", "@"]])],
|
|
35306
|
+
[
|
|
35307
|
+
"?",
|
|
35308
|
+
/* @__PURE__ */ new Map([
|
|
35309
|
+
["*", "*"],
|
|
35310
|
+
["+", "*"]
|
|
35311
|
+
])
|
|
35312
|
+
],
|
|
35313
|
+
[
|
|
35314
|
+
"@",
|
|
35315
|
+
/* @__PURE__ */ new Map([
|
|
35316
|
+
["!", "!"],
|
|
35317
|
+
["?", "?"],
|
|
35318
|
+
["@", "@"],
|
|
35319
|
+
["*", "*"],
|
|
35320
|
+
["+", "+"]
|
|
35321
|
+
])
|
|
35322
|
+
],
|
|
35323
|
+
[
|
|
35324
|
+
"+",
|
|
35325
|
+
/* @__PURE__ */ new Map([
|
|
35326
|
+
["?", "*"],
|
|
35327
|
+
["*", "*"]
|
|
35328
|
+
])
|
|
35329
|
+
]
|
|
35330
|
+
]);
|
|
35331
|
+
startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
35332
|
+
startNoDot = "(?!\\.)";
|
|
35333
|
+
addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
35334
|
+
justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
35335
|
+
reSpecials = new Set("().*{}+?[]^$\\!");
|
|
35336
|
+
regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
35337
|
+
qmark = "[^/]";
|
|
35338
|
+
star = qmark + "*?";
|
|
35339
|
+
starNoEmpty = qmark + "+?";
|
|
35340
|
+
ID = 0;
|
|
35341
|
+
AST = class {
|
|
35342
|
+
type;
|
|
35343
|
+
#root;
|
|
35344
|
+
#hasMagic;
|
|
35345
|
+
#uflag = false;
|
|
35346
|
+
#parts = [];
|
|
35347
|
+
#parent;
|
|
35348
|
+
#parentIndex;
|
|
35349
|
+
#negs;
|
|
35350
|
+
#filledNegs = false;
|
|
35351
|
+
#options;
|
|
35352
|
+
#toString;
|
|
35353
|
+
// set to true if it's an extglob with no children
|
|
35354
|
+
// (which really means one child of '')
|
|
35355
|
+
#emptyExt = false;
|
|
35356
|
+
id = ++ID;
|
|
35357
|
+
get depth() {
|
|
35358
|
+
return (this.#parent?.depth ?? -1) + 1;
|
|
35359
|
+
}
|
|
35360
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
35361
|
+
return {
|
|
35362
|
+
"@@type": "AST",
|
|
35363
|
+
id: this.id,
|
|
35364
|
+
type: this.type,
|
|
35365
|
+
root: this.#root.id,
|
|
35366
|
+
parent: this.#parent?.id,
|
|
35367
|
+
depth: this.depth,
|
|
35368
|
+
partsLength: this.#parts.length,
|
|
35369
|
+
parts: this.#parts
|
|
35370
|
+
};
|
|
35371
|
+
}
|
|
35372
|
+
constructor(type, parent, options = {}) {
|
|
35373
|
+
this.type = type;
|
|
35374
|
+
if (type)
|
|
35375
|
+
this.#hasMagic = true;
|
|
35376
|
+
this.#parent = parent;
|
|
35377
|
+
this.#root = this.#parent ? this.#parent.#root : this;
|
|
35378
|
+
this.#options = this.#root === this ? options : this.#root.#options;
|
|
35379
|
+
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
35380
|
+
if (type === "!" && !this.#root.#filledNegs)
|
|
35381
|
+
this.#negs.push(this);
|
|
35382
|
+
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
|
35383
|
+
}
|
|
35384
|
+
get hasMagic() {
|
|
35385
|
+
if (this.#hasMagic !== void 0)
|
|
35386
|
+
return this.#hasMagic;
|
|
35387
|
+
for (const p of this.#parts) {
|
|
35388
|
+
if (typeof p === "string")
|
|
35389
|
+
continue;
|
|
35390
|
+
if (p.type || p.hasMagic)
|
|
35391
|
+
return this.#hasMagic = true;
|
|
35392
|
+
}
|
|
35393
|
+
return this.#hasMagic;
|
|
35394
|
+
}
|
|
35395
|
+
// reconstructs the pattern
|
|
35396
|
+
toString() {
|
|
35397
|
+
return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
|
|
35398
|
+
}
|
|
35399
|
+
#fillNegs() {
|
|
35400
|
+
if (this !== this.#root)
|
|
35401
|
+
throw new Error("should only call on root");
|
|
35402
|
+
if (this.#filledNegs)
|
|
35403
|
+
return this;
|
|
35404
|
+
this.toString();
|
|
35405
|
+
this.#filledNegs = true;
|
|
35406
|
+
let n7;
|
|
35407
|
+
while (n7 = this.#negs.pop()) {
|
|
35408
|
+
if (n7.type !== "!")
|
|
35409
|
+
continue;
|
|
35410
|
+
let p = n7;
|
|
35411
|
+
let pp2 = p.#parent;
|
|
35412
|
+
while (pp2) {
|
|
35413
|
+
for (let i2 = p.#parentIndex + 1; !pp2.type && i2 < pp2.#parts.length; i2++) {
|
|
35414
|
+
for (const part of n7.#parts) {
|
|
35415
|
+
if (typeof part === "string") {
|
|
35416
|
+
throw new Error("string part in extglob AST??");
|
|
35417
|
+
}
|
|
35418
|
+
part.copyIn(pp2.#parts[i2]);
|
|
35419
|
+
}
|
|
35420
|
+
}
|
|
35421
|
+
p = pp2;
|
|
35422
|
+
pp2 = p.#parent;
|
|
35423
|
+
}
|
|
35424
|
+
}
|
|
35425
|
+
return this;
|
|
35426
|
+
}
|
|
35427
|
+
push(...parts) {
|
|
35428
|
+
for (const p of parts) {
|
|
35429
|
+
if (p === "")
|
|
35430
|
+
continue;
|
|
35431
|
+
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
|
|
35432
|
+
throw new Error("invalid part: " + p);
|
|
35433
|
+
}
|
|
35434
|
+
this.#parts.push(p);
|
|
35435
|
+
}
|
|
35436
|
+
}
|
|
35437
|
+
toJSON() {
|
|
35438
|
+
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
35439
|
+
if (this.isStart() && !this.type)
|
|
35440
|
+
ret.unshift([]);
|
|
35441
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
|
|
35442
|
+
ret.push({});
|
|
35443
|
+
}
|
|
35444
|
+
return ret;
|
|
35445
|
+
}
|
|
35446
|
+
isStart() {
|
|
35447
|
+
if (this.#root === this)
|
|
35448
|
+
return true;
|
|
35449
|
+
if (!this.#parent?.isStart())
|
|
35450
|
+
return false;
|
|
35451
|
+
if (this.#parentIndex === 0)
|
|
35452
|
+
return true;
|
|
35453
|
+
const p = this.#parent;
|
|
35454
|
+
for (let i2 = 0; i2 < this.#parentIndex; i2++) {
|
|
35455
|
+
const pp2 = p.#parts[i2];
|
|
35456
|
+
if (!(pp2 instanceof _a && pp2.type === "!")) {
|
|
35457
|
+
return false;
|
|
35458
|
+
}
|
|
35459
|
+
}
|
|
35460
|
+
return true;
|
|
35461
|
+
}
|
|
35462
|
+
isEnd() {
|
|
35463
|
+
if (this.#root === this)
|
|
35464
|
+
return true;
|
|
35465
|
+
if (this.#parent?.type === "!")
|
|
35466
|
+
return true;
|
|
35467
|
+
if (!this.#parent?.isEnd())
|
|
35468
|
+
return false;
|
|
35469
|
+
if (!this.type)
|
|
35470
|
+
return this.#parent?.isEnd();
|
|
35471
|
+
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
35472
|
+
return this.#parentIndex === pl - 1;
|
|
35473
|
+
}
|
|
35474
|
+
copyIn(part) {
|
|
35475
|
+
if (typeof part === "string")
|
|
35476
|
+
this.push(part);
|
|
35477
|
+
else
|
|
35478
|
+
this.push(part.clone(this));
|
|
35479
|
+
}
|
|
35480
|
+
clone(parent) {
|
|
35481
|
+
const c = new _a(this.type, parent);
|
|
35482
|
+
for (const p of this.#parts) {
|
|
35483
|
+
c.copyIn(p);
|
|
35484
|
+
}
|
|
35485
|
+
return c;
|
|
35486
|
+
}
|
|
35487
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
35488
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
35489
|
+
let escaping = false;
|
|
35490
|
+
let inBrace = false;
|
|
35491
|
+
let braceStart = -1;
|
|
35492
|
+
let braceNeg = false;
|
|
35493
|
+
if (ast.type === null) {
|
|
35494
|
+
let i3 = pos;
|
|
35495
|
+
let acc2 = "";
|
|
35496
|
+
while (i3 < str.length) {
|
|
35497
|
+
const c = str.charAt(i3++);
|
|
35498
|
+
if (escaping || c === "\\") {
|
|
35499
|
+
escaping = !escaping;
|
|
35500
|
+
acc2 += c;
|
|
35501
|
+
continue;
|
|
35502
|
+
}
|
|
35503
|
+
if (inBrace) {
|
|
35504
|
+
if (i3 === braceStart + 1) {
|
|
35505
|
+
if (c === "^" || c === "!") {
|
|
35506
|
+
braceNeg = true;
|
|
35507
|
+
}
|
|
35508
|
+
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
|
|
35509
|
+
inBrace = false;
|
|
35510
|
+
}
|
|
35511
|
+
acc2 += c;
|
|
35512
|
+
continue;
|
|
35513
|
+
} else if (c === "[") {
|
|
35514
|
+
inBrace = true;
|
|
35515
|
+
braceStart = i3;
|
|
35516
|
+
braceNeg = false;
|
|
35517
|
+
acc2 += c;
|
|
35518
|
+
continue;
|
|
35519
|
+
}
|
|
35520
|
+
const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i3) === "(" && extDepth <= maxDepth;
|
|
35521
|
+
if (doRecurse) {
|
|
35522
|
+
ast.push(acc2);
|
|
35523
|
+
acc2 = "";
|
|
35524
|
+
const ext2 = new _a(c, ast);
|
|
35525
|
+
i3 = _a.#parseAST(str, ext2, i3, opt, extDepth + 1);
|
|
35526
|
+
ast.push(ext2);
|
|
35527
|
+
continue;
|
|
35528
|
+
}
|
|
35529
|
+
acc2 += c;
|
|
35530
|
+
}
|
|
35531
|
+
ast.push(acc2);
|
|
35532
|
+
return i3;
|
|
35533
|
+
}
|
|
35534
|
+
let i2 = pos + 1;
|
|
35535
|
+
let part = new _a(null, ast);
|
|
35536
|
+
const parts = [];
|
|
35537
|
+
let acc = "";
|
|
35538
|
+
while (i2 < str.length) {
|
|
35539
|
+
const c = str.charAt(i2++);
|
|
35540
|
+
if (escaping || c === "\\") {
|
|
35541
|
+
escaping = !escaping;
|
|
35542
|
+
acc += c;
|
|
35543
|
+
continue;
|
|
35544
|
+
}
|
|
35545
|
+
if (inBrace) {
|
|
35546
|
+
if (i2 === braceStart + 1) {
|
|
35547
|
+
if (c === "^" || c === "!") {
|
|
35548
|
+
braceNeg = true;
|
|
35549
|
+
}
|
|
35550
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
35551
|
+
inBrace = false;
|
|
35552
|
+
}
|
|
35553
|
+
acc += c;
|
|
35554
|
+
continue;
|
|
35555
|
+
} else if (c === "[") {
|
|
35556
|
+
inBrace = true;
|
|
35557
|
+
braceStart = i2;
|
|
35558
|
+
braceNeg = false;
|
|
35559
|
+
acc += c;
|
|
35560
|
+
continue;
|
|
35561
|
+
}
|
|
35562
|
+
const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i2) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
|
|
35563
|
+
(extDepth <= maxDepth || ast && ast.#canAdoptType(c));
|
|
35564
|
+
if (doRecurse) {
|
|
35565
|
+
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
35566
|
+
part.push(acc);
|
|
35567
|
+
acc = "";
|
|
35568
|
+
const ext2 = new _a(c, part);
|
|
35569
|
+
part.push(ext2);
|
|
35570
|
+
i2 = _a.#parseAST(str, ext2, i2, opt, extDepth + depthAdd);
|
|
35571
|
+
continue;
|
|
35572
|
+
}
|
|
35573
|
+
if (c === "|") {
|
|
35574
|
+
part.push(acc);
|
|
35575
|
+
acc = "";
|
|
35576
|
+
parts.push(part);
|
|
35577
|
+
part = new _a(null, ast);
|
|
35578
|
+
continue;
|
|
35579
|
+
}
|
|
35580
|
+
if (c === ")") {
|
|
35581
|
+
if (acc === "" && ast.#parts.length === 0) {
|
|
35582
|
+
ast.#emptyExt = true;
|
|
35583
|
+
}
|
|
35584
|
+
part.push(acc);
|
|
35585
|
+
acc = "";
|
|
35586
|
+
ast.push(...parts, part);
|
|
35587
|
+
return i2;
|
|
35588
|
+
}
|
|
35589
|
+
acc += c;
|
|
35590
|
+
}
|
|
35591
|
+
ast.type = null;
|
|
35592
|
+
ast.#hasMagic = void 0;
|
|
35593
|
+
ast.#parts = [str.substring(pos - 1)];
|
|
35594
|
+
return i2;
|
|
35595
|
+
}
|
|
35596
|
+
#canAdoptWithSpace(child) {
|
|
35597
|
+
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
35598
|
+
}
|
|
35599
|
+
#canAdopt(child, map2 = adoptionMap) {
|
|
35600
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
|
|
35601
|
+
return false;
|
|
35602
|
+
}
|
|
35603
|
+
const gc = child.#parts[0];
|
|
35604
|
+
if (!gc || typeof gc !== "object" || gc.type === null) {
|
|
35605
|
+
return false;
|
|
35606
|
+
}
|
|
35607
|
+
return this.#canAdoptType(gc.type, map2);
|
|
35608
|
+
}
|
|
35609
|
+
#canAdoptType(c, map2 = adoptionAnyMap) {
|
|
35610
|
+
return !!map2.get(this.type)?.includes(c);
|
|
35611
|
+
}
|
|
35612
|
+
#adoptWithSpace(child, index) {
|
|
35613
|
+
const gc = child.#parts[0];
|
|
35614
|
+
const blank = new _a(null, gc, this.options);
|
|
35615
|
+
blank.#parts.push("");
|
|
35616
|
+
gc.push(blank);
|
|
35617
|
+
this.#adopt(child, index);
|
|
35618
|
+
}
|
|
35619
|
+
#adopt(child, index) {
|
|
35620
|
+
const gc = child.#parts[0];
|
|
35621
|
+
this.#parts.splice(index, 1, ...gc.#parts);
|
|
35622
|
+
for (const p of gc.#parts) {
|
|
35623
|
+
if (typeof p === "object")
|
|
35624
|
+
p.#parent = this;
|
|
35625
|
+
}
|
|
35626
|
+
this.#toString = void 0;
|
|
35627
|
+
}
|
|
35628
|
+
#canUsurpType(c) {
|
|
35629
|
+
const m = usurpMap.get(this.type);
|
|
35630
|
+
return !!m?.has(c);
|
|
35631
|
+
}
|
|
35632
|
+
#canUsurp(child) {
|
|
35633
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
|
|
35634
|
+
return false;
|
|
35635
|
+
}
|
|
35636
|
+
const gc = child.#parts[0];
|
|
35637
|
+
if (!gc || typeof gc !== "object" || gc.type === null) {
|
|
35638
|
+
return false;
|
|
35639
|
+
}
|
|
35640
|
+
return this.#canUsurpType(gc.type);
|
|
35641
|
+
}
|
|
35642
|
+
#usurp(child) {
|
|
35643
|
+
const m = usurpMap.get(this.type);
|
|
35644
|
+
const gc = child.#parts[0];
|
|
35645
|
+
const nt2 = m?.get(gc.type);
|
|
35646
|
+
if (!nt2)
|
|
35647
|
+
return false;
|
|
35648
|
+
this.#parts = gc.#parts;
|
|
35649
|
+
for (const p of this.#parts) {
|
|
35650
|
+
if (typeof p === "object") {
|
|
35651
|
+
p.#parent = this;
|
|
35652
|
+
}
|
|
35653
|
+
}
|
|
35654
|
+
this.type = nt2;
|
|
35655
|
+
this.#toString = void 0;
|
|
35656
|
+
this.#emptyExt = false;
|
|
35657
|
+
}
|
|
35658
|
+
static fromGlob(pattern, options = {}) {
|
|
35659
|
+
const ast = new _a(null, void 0, options);
|
|
35660
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
35661
|
+
return ast;
|
|
35662
|
+
}
|
|
35663
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
35664
|
+
// string if not.
|
|
35665
|
+
toMMPattern() {
|
|
35666
|
+
if (this !== this.#root)
|
|
35667
|
+
return this.#root.toMMPattern();
|
|
35668
|
+
const glob = this.toString();
|
|
35669
|
+
const [re2, body, hasMagic, uflag] = this.toRegExpSource();
|
|
35670
|
+
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
35671
|
+
if (!anyMagic) {
|
|
35672
|
+
return body;
|
|
35673
|
+
}
|
|
35674
|
+
const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
35675
|
+
return Object.assign(new RegExp(`^${re2}$`, flags), {
|
|
35676
|
+
_src: re2,
|
|
35677
|
+
_glob: glob
|
|
35678
|
+
});
|
|
35679
|
+
}
|
|
35680
|
+
get options() {
|
|
35681
|
+
return this.#options;
|
|
35682
|
+
}
|
|
35683
|
+
// returns the string match, the regexp source, whether there's magic
|
|
35684
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
35685
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
35686
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
35687
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
35688
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
35689
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
35690
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
35691
|
+
//
|
|
35692
|
+
// In part-matching mode, the start is:
|
|
35693
|
+
// - if not isStart: nothing
|
|
35694
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
35695
|
+
// - if dots allowed or not possible: ^
|
|
35696
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
35697
|
+
// end is:
|
|
35698
|
+
// - if not isEnd(): nothing
|
|
35699
|
+
// - else: $
|
|
35700
|
+
//
|
|
35701
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
35702
|
+
// pattern, so start is:
|
|
35703
|
+
// - if first pattern: same as part-matching mode
|
|
35704
|
+
// - if not isStart(): nothing
|
|
35705
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
35706
|
+
// - if dots allowed or not possible: /
|
|
35707
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
35708
|
+
// end is:
|
|
35709
|
+
// - if last pattern, same as part-matching mode
|
|
35710
|
+
// - else nothing
|
|
35711
|
+
//
|
|
35712
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
35713
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
35714
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
35715
|
+
// the pattern.
|
|
35716
|
+
//
|
|
35717
|
+
// We can just always return the same end, and leave it up to the caller
|
|
35718
|
+
// to know whether it's going to be used joined or in parts.
|
|
35719
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
35720
|
+
// - if not isStart: nothing
|
|
35721
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
35722
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
35723
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
35724
|
+
//
|
|
35725
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
35726
|
+
// performance, so probably better to return both start options.
|
|
35727
|
+
//
|
|
35728
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
35729
|
+
// and the start always gets applied.
|
|
35730
|
+
//
|
|
35731
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
35732
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
35733
|
+
//
|
|
35734
|
+
// So the todo is:
|
|
35735
|
+
// - better detect what kind of start is needed
|
|
35736
|
+
// - return both flavors of starting pattern
|
|
35737
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
35738
|
+
//
|
|
35739
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
35740
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
35741
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
35742
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
35743
|
+
//
|
|
35744
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
35745
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
35746
|
+
// use the (?:^|/) style of start binding.
|
|
35747
|
+
//
|
|
35748
|
+
// Even simplified further:
|
|
35749
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
35750
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
35751
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
35752
|
+
toRegExpSource(allowDot) {
|
|
35753
|
+
const dot = allowDot ?? !!this.#options.dot;
|
|
35754
|
+
if (this.#root === this) {
|
|
35755
|
+
this.#flatten();
|
|
35756
|
+
this.#fillNegs();
|
|
35757
|
+
}
|
|
35758
|
+
if (!isExtglobAST(this)) {
|
|
35759
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
35760
|
+
const src = this.#parts.map((p) => {
|
|
35761
|
+
const [re2, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
35762
|
+
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
35763
|
+
this.#uflag = this.#uflag || uflag;
|
|
35764
|
+
return re2;
|
|
35765
|
+
}).join("");
|
|
35766
|
+
let start2 = "";
|
|
35767
|
+
if (this.isStart()) {
|
|
35768
|
+
if (typeof this.#parts[0] === "string") {
|
|
35769
|
+
const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
|
|
35770
|
+
if (!dotTravAllowed) {
|
|
35771
|
+
const aps = addPatternStart;
|
|
35772
|
+
const needNoTrav = (
|
|
35773
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
35774
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
35775
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
35776
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
35777
|
+
);
|
|
35778
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
35779
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
35780
|
+
}
|
|
35781
|
+
}
|
|
35782
|
+
}
|
|
35783
|
+
let end = "";
|
|
35784
|
+
if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
|
|
35785
|
+
end = "(?:$|\\/)";
|
|
35786
|
+
}
|
|
35787
|
+
const final2 = start2 + src + end;
|
|
35788
|
+
return [
|
|
35789
|
+
final2,
|
|
35790
|
+
unescape2(src),
|
|
35791
|
+
this.#hasMagic = !!this.#hasMagic,
|
|
35792
|
+
this.#uflag
|
|
35793
|
+
];
|
|
35794
|
+
}
|
|
35795
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
35796
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
35797
|
+
let body = this.#partsToRegExp(dot);
|
|
35798
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
35799
|
+
const s = this.toString();
|
|
35800
|
+
const me2 = this;
|
|
35801
|
+
me2.#parts = [s];
|
|
35802
|
+
me2.type = null;
|
|
35803
|
+
me2.#hasMagic = void 0;
|
|
35804
|
+
return [s, unescape2(this.toString()), false, false];
|
|
35805
|
+
}
|
|
35806
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
|
35807
|
+
if (bodyDotAllowed === body) {
|
|
35808
|
+
bodyDotAllowed = "";
|
|
35809
|
+
}
|
|
35810
|
+
if (bodyDotAllowed) {
|
|
35811
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
35812
|
+
}
|
|
35813
|
+
let final = "";
|
|
35814
|
+
if (this.type === "!" && this.#emptyExt) {
|
|
35815
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
35816
|
+
} else {
|
|
35817
|
+
const close = this.type === "!" ? (
|
|
35818
|
+
// !() must match something,but !(x) can match ''
|
|
35819
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
35820
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
35821
|
+
final = start + body + close;
|
|
35822
|
+
}
|
|
35823
|
+
return [
|
|
35824
|
+
final,
|
|
35825
|
+
unescape2(body),
|
|
35826
|
+
this.#hasMagic = !!this.#hasMagic,
|
|
35827
|
+
this.#uflag
|
|
35828
|
+
];
|
|
35829
|
+
}
|
|
35830
|
+
#flatten() {
|
|
35831
|
+
if (!isExtglobAST(this)) {
|
|
35832
|
+
for (const p of this.#parts) {
|
|
35833
|
+
if (typeof p === "object") {
|
|
35834
|
+
p.#flatten();
|
|
35835
|
+
}
|
|
35836
|
+
}
|
|
35837
|
+
} else {
|
|
35838
|
+
let iterations = 0;
|
|
35839
|
+
let done = false;
|
|
35840
|
+
do {
|
|
35841
|
+
done = true;
|
|
35842
|
+
for (let i2 = 0; i2 < this.#parts.length; i2++) {
|
|
35843
|
+
const c = this.#parts[i2];
|
|
35844
|
+
if (typeof c === "object") {
|
|
35845
|
+
c.#flatten();
|
|
35846
|
+
if (this.#canAdopt(c)) {
|
|
35847
|
+
done = false;
|
|
35848
|
+
this.#adopt(c, i2);
|
|
35849
|
+
} else if (this.#canAdoptWithSpace(c)) {
|
|
35850
|
+
done = false;
|
|
35851
|
+
this.#adoptWithSpace(c, i2);
|
|
35852
|
+
} else if (this.#canUsurp(c)) {
|
|
35853
|
+
done = false;
|
|
35854
|
+
this.#usurp(c);
|
|
35855
|
+
}
|
|
35856
|
+
}
|
|
35857
|
+
}
|
|
35858
|
+
} while (!done && ++iterations < 10);
|
|
35859
|
+
}
|
|
35860
|
+
this.#toString = void 0;
|
|
35861
|
+
}
|
|
35862
|
+
#partsToRegExp(dot) {
|
|
35863
|
+
return this.#parts.map((p) => {
|
|
35864
|
+
if (typeof p === "string") {
|
|
35865
|
+
throw new Error("string type in extglob ast??");
|
|
35866
|
+
}
|
|
35867
|
+
const [re2, _2, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
35868
|
+
this.#uflag = this.#uflag || uflag;
|
|
35869
|
+
return re2;
|
|
35870
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
35871
|
+
}
|
|
35872
|
+
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
35873
|
+
let escaping = false;
|
|
35874
|
+
let re2 = "";
|
|
35875
|
+
let uflag = false;
|
|
35876
|
+
let inStar = false;
|
|
35877
|
+
for (let i2 = 0; i2 < glob.length; i2++) {
|
|
35878
|
+
const c = glob.charAt(i2);
|
|
35879
|
+
if (escaping) {
|
|
35880
|
+
escaping = false;
|
|
35881
|
+
re2 += (reSpecials.has(c) ? "\\" : "") + c;
|
|
35882
|
+
continue;
|
|
35883
|
+
}
|
|
35884
|
+
if (c === "*") {
|
|
35885
|
+
if (inStar)
|
|
35886
|
+
continue;
|
|
35887
|
+
inStar = true;
|
|
35888
|
+
re2 += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
|
|
35889
|
+
hasMagic = true;
|
|
35890
|
+
continue;
|
|
35891
|
+
} else {
|
|
35892
|
+
inStar = false;
|
|
35893
|
+
}
|
|
35894
|
+
if (c === "\\") {
|
|
35895
|
+
if (i2 === glob.length - 1) {
|
|
35896
|
+
re2 += "\\\\";
|
|
35897
|
+
} else {
|
|
35898
|
+
escaping = true;
|
|
35899
|
+
}
|
|
35900
|
+
continue;
|
|
35901
|
+
}
|
|
35902
|
+
if (c === "[") {
|
|
35903
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
35904
|
+
if (consumed) {
|
|
35905
|
+
re2 += src;
|
|
35906
|
+
uflag = uflag || needUflag;
|
|
35907
|
+
i2 += consumed - 1;
|
|
35908
|
+
hasMagic = hasMagic || magic;
|
|
35909
|
+
continue;
|
|
35910
|
+
}
|
|
35911
|
+
}
|
|
35912
|
+
if (c === "?") {
|
|
35913
|
+
re2 += qmark;
|
|
35914
|
+
hasMagic = true;
|
|
35915
|
+
continue;
|
|
35916
|
+
}
|
|
35917
|
+
re2 += regExpEscape(c);
|
|
35918
|
+
}
|
|
35919
|
+
return [re2, unescape2(glob), !!hasMagic, uflag];
|
|
35920
|
+
}
|
|
35921
|
+
};
|
|
35922
|
+
_a = AST;
|
|
35923
|
+
}
|
|
35924
|
+
});
|
|
35925
|
+
|
|
35926
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
35927
|
+
var escape2;
|
|
35928
|
+
var init_escape = __esm({
|
|
35929
|
+
"node_modules/minimatch/dist/esm/escape.js"() {
|
|
35930
|
+
escape2 = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
35931
|
+
if (magicalBraces) {
|
|
35932
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
35933
|
+
}
|
|
35934
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
35935
|
+
};
|
|
35936
|
+
}
|
|
35937
|
+
});
|
|
35938
|
+
|
|
35939
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
35940
|
+
var minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep2, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
35941
|
+
var init_esm3 = __esm({
|
|
35942
|
+
"node_modules/minimatch/dist/esm/index.js"() {
|
|
35943
|
+
init_esm2();
|
|
35944
|
+
init_assert_valid_pattern();
|
|
35945
|
+
init_ast();
|
|
35946
|
+
init_escape();
|
|
35947
|
+
init_unescape();
|
|
35948
|
+
init_ast();
|
|
35949
|
+
init_escape();
|
|
35950
|
+
init_unescape();
|
|
35951
|
+
minimatch = (p, pattern, options = {}) => {
|
|
35952
|
+
assertValidPattern(pattern);
|
|
35953
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
35954
|
+
return false;
|
|
35955
|
+
}
|
|
35956
|
+
return new Minimatch(pattern, options).match(p);
|
|
35957
|
+
};
|
|
35958
|
+
starDotExtRE = /^\*+([^+@!?*[(]*)$/;
|
|
35959
|
+
starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
35960
|
+
starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
35961
|
+
starDotExtTestNocase = (ext2) => {
|
|
35962
|
+
ext2 = ext2.toLowerCase();
|
|
35963
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
35964
|
+
};
|
|
35965
|
+
starDotExtTestNocaseDot = (ext2) => {
|
|
35966
|
+
ext2 = ext2.toLowerCase();
|
|
35967
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
35968
|
+
};
|
|
35969
|
+
starDotStarRE = /^\*+\.\*+$/;
|
|
35970
|
+
starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
35971
|
+
starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
35972
|
+
dotStarRE = /^\.\*+$/;
|
|
35973
|
+
dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
35974
|
+
starRE = /^\*+$/;
|
|
35975
|
+
starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
35976
|
+
starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
35977
|
+
qmarksRE = /^\?+([^+@!?*[(]*)?$/;
|
|
35978
|
+
qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
35979
|
+
const noext = qmarksTestNoExt([$0]);
|
|
35980
|
+
if (!ext2)
|
|
35981
|
+
return noext;
|
|
35982
|
+
ext2 = ext2.toLowerCase();
|
|
35983
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
35984
|
+
};
|
|
35985
|
+
qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
35986
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
35987
|
+
if (!ext2)
|
|
35988
|
+
return noext;
|
|
35989
|
+
ext2 = ext2.toLowerCase();
|
|
35990
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
35991
|
+
};
|
|
35992
|
+
qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
35993
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
35994
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
35995
|
+
};
|
|
35996
|
+
qmarksTest = ([$0, ext2 = ""]) => {
|
|
35997
|
+
const noext = qmarksTestNoExt([$0]);
|
|
35998
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
35999
|
+
};
|
|
36000
|
+
qmarksTestNoExt = ([$0]) => {
|
|
36001
|
+
const len = $0.length;
|
|
36002
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
36003
|
+
};
|
|
36004
|
+
qmarksTestNoExtDot = ([$0]) => {
|
|
36005
|
+
const len = $0.length;
|
|
36006
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
36007
|
+
};
|
|
36008
|
+
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
36009
|
+
path = {
|
|
36010
|
+
win32: { sep: "\\" },
|
|
36011
|
+
posix: { sep: "/" }
|
|
36012
|
+
};
|
|
36013
|
+
sep2 = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
36014
|
+
minimatch.sep = sep2;
|
|
36015
|
+
GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
|
|
36016
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
36017
|
+
qmark2 = "[^/]";
|
|
36018
|
+
star2 = qmark2 + "*?";
|
|
36019
|
+
twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
36020
|
+
twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
36021
|
+
filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
36022
|
+
minimatch.filter = filter;
|
|
36023
|
+
ext = (a, b = {}) => Object.assign({}, a, b);
|
|
36024
|
+
defaults = (def) => {
|
|
36025
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
36026
|
+
return minimatch;
|
|
36027
|
+
}
|
|
36028
|
+
const orig = minimatch;
|
|
36029
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
36030
|
+
return Object.assign(m, {
|
|
36031
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
36032
|
+
constructor(pattern, options = {}) {
|
|
36033
|
+
super(pattern, ext(def, options));
|
|
36034
|
+
}
|
|
36035
|
+
static defaults(options) {
|
|
36036
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
36037
|
+
}
|
|
36038
|
+
},
|
|
36039
|
+
AST: class AST extends orig.AST {
|
|
36040
|
+
/* c8 ignore start */
|
|
36041
|
+
constructor(type, parent, options = {}) {
|
|
36042
|
+
super(type, parent, ext(def, options));
|
|
36043
|
+
}
|
|
36044
|
+
/* c8 ignore stop */
|
|
36045
|
+
static fromGlob(pattern, options = {}) {
|
|
36046
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
36047
|
+
}
|
|
36048
|
+
},
|
|
36049
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
36050
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
36051
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
36052
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
36053
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
36054
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
36055
|
+
match: (list3, pattern, options = {}) => orig.match(list3, pattern, ext(def, options)),
|
|
36056
|
+
sep: orig.sep,
|
|
36057
|
+
GLOBSTAR
|
|
36058
|
+
});
|
|
36059
|
+
};
|
|
36060
|
+
minimatch.defaults = defaults;
|
|
36061
|
+
braceExpand = (pattern, options = {}) => {
|
|
36062
|
+
assertValidPattern(pattern);
|
|
36063
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
36064
|
+
return [pattern];
|
|
36065
|
+
}
|
|
36066
|
+
return expand2(pattern, { max: options.braceExpandMax });
|
|
36067
|
+
};
|
|
36068
|
+
minimatch.braceExpand = braceExpand;
|
|
36069
|
+
makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
36070
|
+
minimatch.makeRe = makeRe;
|
|
36071
|
+
match = (list3, pattern, options = {}) => {
|
|
36072
|
+
const mm = new Minimatch(pattern, options);
|
|
36073
|
+
list3 = list3.filter((f) => mm.match(f));
|
|
36074
|
+
if (mm.options.nonull && !list3.length) {
|
|
36075
|
+
list3.push(pattern);
|
|
36076
|
+
}
|
|
36077
|
+
return list3;
|
|
36078
|
+
};
|
|
36079
|
+
minimatch.match = match;
|
|
36080
|
+
globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
36081
|
+
regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
36082
|
+
Minimatch = class {
|
|
36083
|
+
options;
|
|
36084
|
+
set;
|
|
36085
|
+
pattern;
|
|
36086
|
+
windowsPathsNoEscape;
|
|
36087
|
+
nonegate;
|
|
36088
|
+
negate;
|
|
36089
|
+
comment;
|
|
36090
|
+
empty;
|
|
36091
|
+
preserveMultipleSlashes;
|
|
36092
|
+
partial;
|
|
36093
|
+
globSet;
|
|
36094
|
+
globParts;
|
|
36095
|
+
nocase;
|
|
36096
|
+
isWindows;
|
|
36097
|
+
platform;
|
|
36098
|
+
windowsNoMagicRoot;
|
|
36099
|
+
maxGlobstarRecursion;
|
|
36100
|
+
regexp;
|
|
36101
|
+
constructor(pattern, options = {}) {
|
|
36102
|
+
assertValidPattern(pattern);
|
|
36103
|
+
options = options || {};
|
|
36104
|
+
this.options = options;
|
|
36105
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
36106
|
+
this.pattern = pattern;
|
|
36107
|
+
this.platform = options.platform || defaultPlatform;
|
|
36108
|
+
this.isWindows = this.platform === "win32";
|
|
36109
|
+
const awe = "allowWindowsEscape";
|
|
36110
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
|
|
36111
|
+
if (this.windowsPathsNoEscape) {
|
|
36112
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
36113
|
+
}
|
|
36114
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
36115
|
+
this.regexp = null;
|
|
36116
|
+
this.negate = false;
|
|
36117
|
+
this.nonegate = !!options.nonegate;
|
|
36118
|
+
this.comment = false;
|
|
36119
|
+
this.empty = false;
|
|
36120
|
+
this.partial = !!options.partial;
|
|
36121
|
+
this.nocase = !!this.options.nocase;
|
|
36122
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
36123
|
+
this.globSet = [];
|
|
36124
|
+
this.globParts = [];
|
|
36125
|
+
this.set = [];
|
|
36126
|
+
this.make();
|
|
36127
|
+
}
|
|
36128
|
+
hasMagic() {
|
|
36129
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
36130
|
+
return true;
|
|
36131
|
+
}
|
|
36132
|
+
for (const pattern of this.set) {
|
|
36133
|
+
for (const part of pattern) {
|
|
36134
|
+
if (typeof part !== "string")
|
|
36135
|
+
return true;
|
|
36136
|
+
}
|
|
36137
|
+
}
|
|
36138
|
+
return false;
|
|
36139
|
+
}
|
|
36140
|
+
debug(..._2) {
|
|
36141
|
+
}
|
|
36142
|
+
make() {
|
|
36143
|
+
const pattern = this.pattern;
|
|
36144
|
+
const options = this.options;
|
|
36145
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
36146
|
+
this.comment = true;
|
|
36147
|
+
return;
|
|
36148
|
+
}
|
|
36149
|
+
if (!pattern) {
|
|
36150
|
+
this.empty = true;
|
|
36151
|
+
return;
|
|
36152
|
+
}
|
|
36153
|
+
this.parseNegate();
|
|
36154
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
36155
|
+
if (options.debug) {
|
|
36156
|
+
this.debug = (...args2) => console.error(...args2);
|
|
36157
|
+
}
|
|
36158
|
+
this.debug(this.pattern, this.globSet);
|
|
36159
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
36160
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
36161
|
+
this.debug(this.pattern, this.globParts);
|
|
36162
|
+
let set2 = this.globParts.map((s, _2, __) => {
|
|
36163
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
36164
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
36165
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
36166
|
+
if (isUNC) {
|
|
36167
|
+
return [
|
|
36168
|
+
...s.slice(0, 4),
|
|
36169
|
+
...s.slice(4).map((ss2) => this.parse(ss2))
|
|
36170
|
+
];
|
|
36171
|
+
} else if (isDrive) {
|
|
36172
|
+
return [s[0], ...s.slice(1).map((ss2) => this.parse(ss2))];
|
|
36173
|
+
}
|
|
36174
|
+
}
|
|
36175
|
+
return s.map((ss2) => this.parse(ss2));
|
|
36176
|
+
});
|
|
36177
|
+
this.debug(this.pattern, set2);
|
|
36178
|
+
this.set = set2.filter((s) => s.indexOf(false) === -1);
|
|
36179
|
+
if (this.isWindows) {
|
|
36180
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
36181
|
+
const p = this.set[i2];
|
|
36182
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
36183
|
+
p[2] = "?";
|
|
36184
|
+
}
|
|
36185
|
+
}
|
|
36186
|
+
}
|
|
36187
|
+
this.debug(this.pattern, this.set);
|
|
36188
|
+
}
|
|
36189
|
+
// various transforms to equivalent pattern sets that are
|
|
36190
|
+
// faster to process in a filesystem walk. The goal is to
|
|
36191
|
+
// eliminate what we can, and push all ** patterns as far
|
|
36192
|
+
// to the right as possible, even if it increases the number
|
|
36193
|
+
// of patterns that we have to process.
|
|
36194
|
+
preprocess(globParts) {
|
|
36195
|
+
if (this.options.noglobstar) {
|
|
36196
|
+
for (const partset of globParts) {
|
|
36197
|
+
for (let j2 = 0; j2 < partset.length; j2++) {
|
|
36198
|
+
if (partset[j2] === "**") {
|
|
36199
|
+
partset[j2] = "*";
|
|
36200
|
+
}
|
|
36201
|
+
}
|
|
36202
|
+
}
|
|
36203
|
+
}
|
|
36204
|
+
const { optimizationLevel = 1 } = this.options;
|
|
36205
|
+
if (optimizationLevel >= 2) {
|
|
36206
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
36207
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
36208
|
+
} else if (optimizationLevel >= 1) {
|
|
36209
|
+
globParts = this.levelOneOptimize(globParts);
|
|
36210
|
+
} else {
|
|
36211
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
36212
|
+
}
|
|
36213
|
+
return globParts;
|
|
36214
|
+
}
|
|
36215
|
+
// just get rid of adjascent ** portions
|
|
36216
|
+
adjascentGlobstarOptimize(globParts) {
|
|
36217
|
+
return globParts.map((parts) => {
|
|
36218
|
+
let gs2 = -1;
|
|
36219
|
+
while (-1 !== (gs2 = parts.indexOf("**", gs2 + 1))) {
|
|
36220
|
+
let i2 = gs2;
|
|
36221
|
+
while (parts[i2 + 1] === "**") {
|
|
36222
|
+
i2++;
|
|
36223
|
+
}
|
|
36224
|
+
if (i2 !== gs2) {
|
|
36225
|
+
parts.splice(gs2, i2 - gs2);
|
|
36226
|
+
}
|
|
36227
|
+
}
|
|
36228
|
+
return parts;
|
|
36229
|
+
});
|
|
36230
|
+
}
|
|
36231
|
+
// get rid of adjascent ** and resolve .. portions
|
|
36232
|
+
levelOneOptimize(globParts) {
|
|
36233
|
+
return globParts.map((parts) => {
|
|
36234
|
+
parts = parts.reduce((set2, part) => {
|
|
36235
|
+
const prev = set2[set2.length - 1];
|
|
36236
|
+
if (part === "**" && prev === "**") {
|
|
36237
|
+
return set2;
|
|
36238
|
+
}
|
|
36239
|
+
if (part === "..") {
|
|
36240
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
36241
|
+
set2.pop();
|
|
36242
|
+
return set2;
|
|
36243
|
+
}
|
|
36244
|
+
}
|
|
36245
|
+
set2.push(part);
|
|
36246
|
+
return set2;
|
|
36247
|
+
}, []);
|
|
36248
|
+
return parts.length === 0 ? [""] : parts;
|
|
36249
|
+
});
|
|
36250
|
+
}
|
|
36251
|
+
levelTwoFileOptimize(parts) {
|
|
36252
|
+
if (!Array.isArray(parts)) {
|
|
36253
|
+
parts = this.slashSplit(parts);
|
|
36254
|
+
}
|
|
36255
|
+
let didSomething = false;
|
|
36256
|
+
do {
|
|
36257
|
+
didSomething = false;
|
|
36258
|
+
if (!this.preserveMultipleSlashes) {
|
|
36259
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
36260
|
+
const p = parts[i2];
|
|
36261
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
36262
|
+
continue;
|
|
36263
|
+
if (p === "." || p === "") {
|
|
36264
|
+
didSomething = true;
|
|
36265
|
+
parts.splice(i2, 1);
|
|
36266
|
+
i2--;
|
|
36267
|
+
}
|
|
36268
|
+
}
|
|
36269
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
36270
|
+
didSomething = true;
|
|
36271
|
+
parts.pop();
|
|
36272
|
+
}
|
|
36273
|
+
}
|
|
36274
|
+
let dd = 0;
|
|
36275
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
36276
|
+
const p = parts[dd - 1];
|
|
36277
|
+
if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
|
|
36278
|
+
didSomething = true;
|
|
36279
|
+
parts.splice(dd - 1, 2);
|
|
36280
|
+
dd -= 2;
|
|
36281
|
+
}
|
|
36282
|
+
}
|
|
36283
|
+
} while (didSomething);
|
|
36284
|
+
return parts.length === 0 ? [""] : parts;
|
|
36285
|
+
}
|
|
36286
|
+
// First phase: single-pattern processing
|
|
36287
|
+
// <pre> is 1 or more portions
|
|
36288
|
+
// <rest> is 1 or more portions
|
|
36289
|
+
// <p> is any portion other than ., .., '', or **
|
|
36290
|
+
// <e> is . or ''
|
|
36291
|
+
//
|
|
36292
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
36293
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
36294
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
36295
|
+
// or most strings (other than .., ., and '') can be.
|
|
36296
|
+
//
|
|
36297
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
36298
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
36299
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
36300
|
+
// **/**/<rest> -> **/<rest>
|
|
36301
|
+
//
|
|
36302
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
36303
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
36304
|
+
firstPhasePreProcess(globParts) {
|
|
36305
|
+
let didSomething = false;
|
|
36306
|
+
do {
|
|
36307
|
+
didSomething = false;
|
|
36308
|
+
for (let parts of globParts) {
|
|
36309
|
+
let gs2 = -1;
|
|
36310
|
+
while (-1 !== (gs2 = parts.indexOf("**", gs2 + 1))) {
|
|
36311
|
+
let gss = gs2;
|
|
36312
|
+
while (parts[gss + 1] === "**") {
|
|
36313
|
+
gss++;
|
|
36314
|
+
}
|
|
36315
|
+
if (gss > gs2) {
|
|
36316
|
+
parts.splice(gs2 + 1, gss - gs2);
|
|
36317
|
+
}
|
|
36318
|
+
let next = parts[gs2 + 1];
|
|
36319
|
+
const p = parts[gs2 + 2];
|
|
36320
|
+
const p2 = parts[gs2 + 3];
|
|
36321
|
+
if (next !== "..")
|
|
36322
|
+
continue;
|
|
36323
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
36324
|
+
continue;
|
|
36325
|
+
}
|
|
36326
|
+
didSomething = true;
|
|
36327
|
+
parts.splice(gs2, 1);
|
|
36328
|
+
const other = parts.slice(0);
|
|
36329
|
+
other[gs2] = "**";
|
|
36330
|
+
globParts.push(other);
|
|
36331
|
+
gs2--;
|
|
36332
|
+
}
|
|
36333
|
+
if (!this.preserveMultipleSlashes) {
|
|
36334
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
36335
|
+
const p = parts[i2];
|
|
36336
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
36337
|
+
continue;
|
|
36338
|
+
if (p === "." || p === "") {
|
|
36339
|
+
didSomething = true;
|
|
36340
|
+
parts.splice(i2, 1);
|
|
36341
|
+
i2--;
|
|
36342
|
+
}
|
|
36343
|
+
}
|
|
36344
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
36345
|
+
didSomething = true;
|
|
36346
|
+
parts.pop();
|
|
36347
|
+
}
|
|
36348
|
+
}
|
|
36349
|
+
let dd = 0;
|
|
36350
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
36351
|
+
const p = parts[dd - 1];
|
|
36352
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
36353
|
+
didSomething = true;
|
|
36354
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
36355
|
+
const splin = needDot ? ["."] : [];
|
|
36356
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
36357
|
+
if (parts.length === 0)
|
|
36358
|
+
parts.push("");
|
|
36359
|
+
dd -= 2;
|
|
36360
|
+
}
|
|
36361
|
+
}
|
|
36362
|
+
}
|
|
36363
|
+
} while (didSomething);
|
|
36364
|
+
return globParts;
|
|
36365
|
+
}
|
|
36366
|
+
// second phase: multi-pattern dedupes
|
|
36367
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
36368
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
36369
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
36370
|
+
//
|
|
36371
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
36372
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
36373
|
+
secondPhasePreProcess(globParts) {
|
|
36374
|
+
for (let i2 = 0; i2 < globParts.length - 1; i2++) {
|
|
36375
|
+
for (let j2 = i2 + 1; j2 < globParts.length; j2++) {
|
|
36376
|
+
const matched = this.partsMatch(globParts[i2], globParts[j2], !this.preserveMultipleSlashes);
|
|
36377
|
+
if (matched) {
|
|
36378
|
+
globParts[i2] = [];
|
|
36379
|
+
globParts[j2] = matched;
|
|
36380
|
+
break;
|
|
36381
|
+
}
|
|
36382
|
+
}
|
|
36383
|
+
}
|
|
36384
|
+
return globParts.filter((gs2) => gs2.length);
|
|
36385
|
+
}
|
|
36386
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
36387
|
+
let ai2 = 0;
|
|
36388
|
+
let bi2 = 0;
|
|
36389
|
+
let result2 = [];
|
|
36390
|
+
let which = "";
|
|
36391
|
+
while (ai2 < a.length && bi2 < b.length) {
|
|
36392
|
+
if (a[ai2] === b[bi2]) {
|
|
36393
|
+
result2.push(which === "b" ? b[bi2] : a[ai2]);
|
|
36394
|
+
ai2++;
|
|
36395
|
+
bi2++;
|
|
36396
|
+
} else if (emptyGSMatch && a[ai2] === "**" && b[bi2] === a[ai2 + 1]) {
|
|
36397
|
+
result2.push(a[ai2]);
|
|
36398
|
+
ai2++;
|
|
36399
|
+
} else if (emptyGSMatch && b[bi2] === "**" && a[ai2] === b[bi2 + 1]) {
|
|
36400
|
+
result2.push(b[bi2]);
|
|
36401
|
+
bi2++;
|
|
36402
|
+
} else if (a[ai2] === "*" && b[bi2] && (this.options.dot || !b[bi2].startsWith(".")) && b[bi2] !== "**") {
|
|
36403
|
+
if (which === "b")
|
|
36404
|
+
return false;
|
|
36405
|
+
which = "a";
|
|
36406
|
+
result2.push(a[ai2]);
|
|
36407
|
+
ai2++;
|
|
36408
|
+
bi2++;
|
|
36409
|
+
} else if (b[bi2] === "*" && a[ai2] && (this.options.dot || !a[ai2].startsWith(".")) && a[ai2] !== "**") {
|
|
36410
|
+
if (which === "a")
|
|
36411
|
+
return false;
|
|
36412
|
+
which = "b";
|
|
36413
|
+
result2.push(b[bi2]);
|
|
36414
|
+
ai2++;
|
|
36415
|
+
bi2++;
|
|
36416
|
+
} else {
|
|
36417
|
+
return false;
|
|
36418
|
+
}
|
|
36419
|
+
}
|
|
36420
|
+
return a.length === b.length && result2;
|
|
36421
|
+
}
|
|
36422
|
+
parseNegate() {
|
|
36423
|
+
if (this.nonegate)
|
|
36424
|
+
return;
|
|
36425
|
+
const pattern = this.pattern;
|
|
36426
|
+
let negate = false;
|
|
36427
|
+
let negateOffset = 0;
|
|
36428
|
+
for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
|
|
36429
|
+
negate = !negate;
|
|
36430
|
+
negateOffset++;
|
|
36431
|
+
}
|
|
36432
|
+
if (negateOffset)
|
|
36433
|
+
this.pattern = pattern.slice(negateOffset);
|
|
36434
|
+
this.negate = negate;
|
|
36435
|
+
}
|
|
36436
|
+
// set partial to true to test if, for example,
|
|
36437
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
36438
|
+
// Partial means, if you run out of file before you run
|
|
36439
|
+
// out of pattern, then that's fine, as long as all
|
|
36440
|
+
// the parts match.
|
|
36441
|
+
matchOne(file2, pattern, partial2 = false) {
|
|
36442
|
+
let fileStartIndex = 0;
|
|
36443
|
+
let patternStartIndex = 0;
|
|
36444
|
+
if (this.isWindows) {
|
|
36445
|
+
const fileDrive = typeof file2[0] === "string" && /^[a-z]:$/i.test(file2[0]);
|
|
36446
|
+
const fileUNC = !fileDrive && file2[0] === "" && file2[1] === "" && file2[2] === "?" && /^[a-z]:$/i.test(file2[3]);
|
|
36447
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
36448
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
36449
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
36450
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
36451
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
36452
|
+
const [fd, pd] = [
|
|
36453
|
+
file2[fdi],
|
|
36454
|
+
pattern[pdi]
|
|
36455
|
+
];
|
|
36456
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
36457
|
+
pattern[pdi] = fd;
|
|
36458
|
+
patternStartIndex = pdi;
|
|
36459
|
+
fileStartIndex = fdi;
|
|
36460
|
+
}
|
|
36461
|
+
}
|
|
36462
|
+
}
|
|
36463
|
+
const { optimizationLevel = 1 } = this.options;
|
|
36464
|
+
if (optimizationLevel >= 2) {
|
|
36465
|
+
file2 = this.levelTwoFileOptimize(file2);
|
|
36466
|
+
}
|
|
36467
|
+
if (pattern.includes(GLOBSTAR)) {
|
|
36468
|
+
return this.#matchGlobstar(file2, pattern, partial2, fileStartIndex, patternStartIndex);
|
|
36469
|
+
}
|
|
36470
|
+
return this.#matchOne(file2, pattern, partial2, fileStartIndex, patternStartIndex);
|
|
36471
|
+
}
|
|
36472
|
+
#matchGlobstar(file2, pattern, partial2, fileIndex, patternIndex) {
|
|
36473
|
+
const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
|
|
36474
|
+
const lastgs = pattern.lastIndexOf(GLOBSTAR);
|
|
36475
|
+
const [head, body, tail] = partial2 ? [
|
|
36476
|
+
pattern.slice(patternIndex, firstgs),
|
|
36477
|
+
pattern.slice(firstgs + 1),
|
|
36478
|
+
[]
|
|
36479
|
+
] : [
|
|
36480
|
+
pattern.slice(patternIndex, firstgs),
|
|
36481
|
+
pattern.slice(firstgs + 1, lastgs),
|
|
36482
|
+
pattern.slice(lastgs + 1)
|
|
36483
|
+
];
|
|
36484
|
+
if (head.length) {
|
|
36485
|
+
const fileHead = file2.slice(fileIndex, fileIndex + head.length);
|
|
36486
|
+
if (!this.#matchOne(fileHead, head, partial2, 0, 0)) {
|
|
36487
|
+
return false;
|
|
36488
|
+
}
|
|
36489
|
+
fileIndex += head.length;
|
|
36490
|
+
patternIndex += head.length;
|
|
36491
|
+
}
|
|
36492
|
+
let fileTailMatch = 0;
|
|
36493
|
+
if (tail.length) {
|
|
36494
|
+
if (tail.length + fileIndex > file2.length)
|
|
36495
|
+
return false;
|
|
36496
|
+
let tailStart = file2.length - tail.length;
|
|
36497
|
+
if (this.#matchOne(file2, tail, partial2, tailStart, 0)) {
|
|
36498
|
+
fileTailMatch = tail.length;
|
|
36499
|
+
} else {
|
|
36500
|
+
if (file2[file2.length - 1] !== "" || fileIndex + tail.length === file2.length) {
|
|
36501
|
+
return false;
|
|
36502
|
+
}
|
|
36503
|
+
tailStart--;
|
|
36504
|
+
if (!this.#matchOne(file2, tail, partial2, tailStart, 0)) {
|
|
36505
|
+
return false;
|
|
36506
|
+
}
|
|
36507
|
+
fileTailMatch = tail.length + 1;
|
|
36508
|
+
}
|
|
36509
|
+
}
|
|
36510
|
+
if (!body.length) {
|
|
36511
|
+
let sawSome = !!fileTailMatch;
|
|
36512
|
+
for (let i3 = fileIndex; i3 < file2.length - fileTailMatch; i3++) {
|
|
36513
|
+
const f = String(file2[i3]);
|
|
36514
|
+
sawSome = true;
|
|
36515
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
|
36516
|
+
return false;
|
|
36517
|
+
}
|
|
36518
|
+
}
|
|
36519
|
+
return partial2 || sawSome;
|
|
36520
|
+
}
|
|
36521
|
+
const bodySegments = [[[], 0]];
|
|
36522
|
+
let currentBody = bodySegments[0];
|
|
36523
|
+
let nonGsParts = 0;
|
|
36524
|
+
const nonGsPartsSums = [0];
|
|
36525
|
+
for (const b of body) {
|
|
36526
|
+
if (b === GLOBSTAR) {
|
|
36527
|
+
nonGsPartsSums.push(nonGsParts);
|
|
36528
|
+
currentBody = [[], 0];
|
|
36529
|
+
bodySegments.push(currentBody);
|
|
36530
|
+
} else {
|
|
36531
|
+
currentBody[0].push(b);
|
|
36532
|
+
nonGsParts++;
|
|
36533
|
+
}
|
|
36534
|
+
}
|
|
36535
|
+
let i2 = bodySegments.length - 1;
|
|
36536
|
+
const fileLength = file2.length - fileTailMatch;
|
|
36537
|
+
for (const b of bodySegments) {
|
|
36538
|
+
b[1] = fileLength - (nonGsPartsSums[i2--] + b[0].length);
|
|
36539
|
+
}
|
|
36540
|
+
return !!this.#matchGlobStarBodySections(file2, bodySegments, fileIndex, 0, partial2, 0, !!fileTailMatch);
|
|
36541
|
+
}
|
|
36542
|
+
// return false for "nope, not matching"
|
|
36543
|
+
// return null for "not matching, cannot keep trying"
|
|
36544
|
+
#matchGlobStarBodySections(file2, bodySegments, fileIndex, bodyIndex, partial2, globStarDepth, sawTail) {
|
|
36545
|
+
const bs2 = bodySegments[bodyIndex];
|
|
36546
|
+
if (!bs2) {
|
|
36547
|
+
for (let i2 = fileIndex; i2 < file2.length; i2++) {
|
|
36548
|
+
sawTail = true;
|
|
36549
|
+
const f = file2[i2];
|
|
36550
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
|
36551
|
+
return false;
|
|
36552
|
+
}
|
|
36553
|
+
}
|
|
36554
|
+
return sawTail;
|
|
36555
|
+
}
|
|
36556
|
+
const [body, after] = bs2;
|
|
36557
|
+
while (fileIndex <= after) {
|
|
36558
|
+
const m = this.#matchOne(file2.slice(0, fileIndex + body.length), body, partial2, fileIndex, 0);
|
|
36559
|
+
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
|
36560
|
+
const sub = this.#matchGlobStarBodySections(file2, bodySegments, fileIndex + body.length, bodyIndex + 1, partial2, globStarDepth + 1, sawTail);
|
|
36561
|
+
if (sub !== false) {
|
|
36562
|
+
return sub;
|
|
36563
|
+
}
|
|
36564
|
+
}
|
|
36565
|
+
const f = file2[fileIndex];
|
|
36566
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
|
36567
|
+
return false;
|
|
36568
|
+
}
|
|
36569
|
+
fileIndex++;
|
|
36570
|
+
}
|
|
36571
|
+
return partial2 || null;
|
|
36572
|
+
}
|
|
36573
|
+
#matchOne(file2, pattern, partial2, fileIndex, patternIndex) {
|
|
36574
|
+
let fi2;
|
|
36575
|
+
let pi2;
|
|
36576
|
+
let pl;
|
|
36577
|
+
let fl;
|
|
36578
|
+
for (fi2 = fileIndex, pi2 = patternIndex, fl = file2.length, pl = pattern.length; fi2 < fl && pi2 < pl; fi2++, pi2++) {
|
|
36579
|
+
this.debug("matchOne loop");
|
|
36580
|
+
let p = pattern[pi2];
|
|
36581
|
+
let f = file2[fi2];
|
|
36582
|
+
this.debug(pattern, p, f);
|
|
36583
|
+
if (p === false || p === GLOBSTAR) {
|
|
36584
|
+
return false;
|
|
36585
|
+
}
|
|
36586
|
+
let hit;
|
|
36587
|
+
if (typeof p === "string") {
|
|
36588
|
+
hit = f === p;
|
|
36589
|
+
this.debug("string match", p, f, hit);
|
|
36590
|
+
} else {
|
|
36591
|
+
hit = p.test(f);
|
|
36592
|
+
this.debug("pattern match", p, f, hit);
|
|
36593
|
+
}
|
|
36594
|
+
if (!hit)
|
|
36595
|
+
return false;
|
|
36596
|
+
}
|
|
36597
|
+
if (fi2 === fl && pi2 === pl) {
|
|
36598
|
+
return true;
|
|
36599
|
+
} else if (fi2 === fl) {
|
|
36600
|
+
return partial2;
|
|
36601
|
+
} else if (pi2 === pl) {
|
|
36602
|
+
return fi2 === fl - 1 && file2[fi2] === "";
|
|
36603
|
+
} else {
|
|
36604
|
+
throw new Error("wtf?");
|
|
36605
|
+
}
|
|
36606
|
+
}
|
|
36607
|
+
braceExpand() {
|
|
36608
|
+
return braceExpand(this.pattern, this.options);
|
|
36609
|
+
}
|
|
36610
|
+
parse(pattern) {
|
|
36611
|
+
assertValidPattern(pattern);
|
|
36612
|
+
const options = this.options;
|
|
36613
|
+
if (pattern === "**")
|
|
36614
|
+
return GLOBSTAR;
|
|
36615
|
+
if (pattern === "")
|
|
36616
|
+
return "";
|
|
36617
|
+
let m;
|
|
36618
|
+
let fastTest = null;
|
|
36619
|
+
if (m = pattern.match(starRE)) {
|
|
36620
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
36621
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
36622
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
36623
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
36624
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
36625
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
36626
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
36627
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
36628
|
+
fastTest = dotStarTest;
|
|
36629
|
+
}
|
|
36630
|
+
const re2 = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
36631
|
+
if (fastTest && typeof re2 === "object") {
|
|
36632
|
+
Reflect.defineProperty(re2, "test", { value: fastTest });
|
|
36633
|
+
}
|
|
36634
|
+
return re2;
|
|
36635
|
+
}
|
|
36636
|
+
makeRe() {
|
|
36637
|
+
if (this.regexp || this.regexp === false)
|
|
36638
|
+
return this.regexp;
|
|
36639
|
+
const set2 = this.set;
|
|
36640
|
+
if (!set2.length) {
|
|
36641
|
+
this.regexp = false;
|
|
36642
|
+
return this.regexp;
|
|
36643
|
+
}
|
|
36644
|
+
const options = this.options;
|
|
36645
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
36646
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
36647
|
+
let re2 = set2.map((pattern) => {
|
|
36648
|
+
const pp2 = pattern.map((p) => {
|
|
36649
|
+
if (p instanceof RegExp) {
|
|
36650
|
+
for (const f of p.flags.split(""))
|
|
36651
|
+
flags.add(f);
|
|
36652
|
+
}
|
|
36653
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
36654
|
+
});
|
|
36655
|
+
pp2.forEach((p, i2) => {
|
|
36656
|
+
const next = pp2[i2 + 1];
|
|
36657
|
+
const prev = pp2[i2 - 1];
|
|
36658
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
36659
|
+
return;
|
|
36660
|
+
}
|
|
36661
|
+
if (prev === void 0) {
|
|
36662
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
36663
|
+
pp2[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
36664
|
+
} else {
|
|
36665
|
+
pp2[i2] = twoStar;
|
|
36666
|
+
}
|
|
36667
|
+
} else if (next === void 0) {
|
|
36668
|
+
pp2[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
36669
|
+
} else if (next !== GLOBSTAR) {
|
|
36670
|
+
pp2[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
36671
|
+
pp2[i2 + 1] = GLOBSTAR;
|
|
36672
|
+
}
|
|
36673
|
+
});
|
|
36674
|
+
const filtered = pp2.filter((p) => p !== GLOBSTAR);
|
|
36675
|
+
if (this.partial && filtered.length >= 1) {
|
|
36676
|
+
const prefixes = [];
|
|
36677
|
+
for (let i2 = 1; i2 <= filtered.length; i2++) {
|
|
36678
|
+
prefixes.push(filtered.slice(0, i2).join("/"));
|
|
36679
|
+
}
|
|
36680
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
36681
|
+
}
|
|
36682
|
+
return filtered.join("/");
|
|
36683
|
+
}).join("|");
|
|
36684
|
+
const [open, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
36685
|
+
re2 = "^" + open + re2 + close + "$";
|
|
36686
|
+
if (this.partial) {
|
|
36687
|
+
re2 = "^(?:\\/|" + open + re2.slice(1, -1) + close + ")$";
|
|
36688
|
+
}
|
|
36689
|
+
if (this.negate)
|
|
36690
|
+
re2 = "^(?!" + re2 + ").+$";
|
|
36691
|
+
try {
|
|
36692
|
+
this.regexp = new RegExp(re2, [...flags].join(""));
|
|
36693
|
+
} catch {
|
|
36694
|
+
this.regexp = false;
|
|
36695
|
+
}
|
|
36696
|
+
return this.regexp;
|
|
36697
|
+
}
|
|
36698
|
+
slashSplit(p) {
|
|
36699
|
+
if (this.preserveMultipleSlashes) {
|
|
36700
|
+
return p.split("/");
|
|
36701
|
+
} else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
|
|
36702
|
+
return ["", ...p.split(/\/+/)];
|
|
36703
|
+
} else {
|
|
36704
|
+
return p.split(/\/+/);
|
|
36705
|
+
}
|
|
36706
|
+
}
|
|
36707
|
+
match(f, partial2 = this.partial) {
|
|
36708
|
+
this.debug("match", f, this.pattern);
|
|
36709
|
+
if (this.comment) {
|
|
36710
|
+
return false;
|
|
36711
|
+
}
|
|
36712
|
+
if (this.empty) {
|
|
36713
|
+
return f === "";
|
|
36714
|
+
}
|
|
36715
|
+
if (f === "/" && partial2) {
|
|
36716
|
+
return true;
|
|
36717
|
+
}
|
|
36718
|
+
const options = this.options;
|
|
36719
|
+
if (this.isWindows) {
|
|
36720
|
+
f = f.split("\\").join("/");
|
|
36721
|
+
}
|
|
36722
|
+
const ff = this.slashSplit(f);
|
|
36723
|
+
this.debug(this.pattern, "split", ff);
|
|
36724
|
+
const set2 = this.set;
|
|
36725
|
+
this.debug(this.pattern, "set", set2);
|
|
36726
|
+
let filename = ff[ff.length - 1];
|
|
36727
|
+
if (!filename) {
|
|
36728
|
+
for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
|
|
36729
|
+
filename = ff[i2];
|
|
36730
|
+
}
|
|
36731
|
+
}
|
|
36732
|
+
for (const pattern of set2) {
|
|
36733
|
+
let file2 = ff;
|
|
36734
|
+
if (options.matchBase && pattern.length === 1) {
|
|
36735
|
+
file2 = [filename];
|
|
36736
|
+
}
|
|
36737
|
+
const hit = this.matchOne(file2, pattern, partial2);
|
|
36738
|
+
if (hit) {
|
|
36739
|
+
if (options.flipNegate) {
|
|
36740
|
+
return true;
|
|
36741
|
+
}
|
|
36742
|
+
return !this.negate;
|
|
36743
|
+
}
|
|
36744
|
+
}
|
|
36745
|
+
if (options.flipNegate) {
|
|
36746
|
+
return false;
|
|
36747
|
+
}
|
|
36748
|
+
return this.negate;
|
|
36749
|
+
}
|
|
36750
|
+
static defaults(def) {
|
|
36751
|
+
return minimatch.defaults(def).Minimatch;
|
|
36752
|
+
}
|
|
36753
|
+
};
|
|
36754
|
+
minimatch.AST = AST;
|
|
36755
|
+
minimatch.Minimatch = Minimatch;
|
|
36756
|
+
minimatch.escape = escape2;
|
|
36757
|
+
minimatch.unescape = unescape2;
|
|
36758
|
+
}
|
|
36759
|
+
});
|
|
36760
|
+
|
|
34841
36761
|
// src/plugins/format/prettier-bridge.ts
|
|
34842
|
-
import {
|
|
36762
|
+
import { readFile } from "node:fs/promises";
|
|
36763
|
+
import { basename, dirname as dirname3, extname, relative as relative3, resolve as resolve5 } from "node:path";
|
|
34843
36764
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
34844
36765
|
async function loadPrettier(filePath) {
|
|
34845
36766
|
prettier ??= import("prettier").catch(() => null);
|
|
34846
36767
|
const p = await prettier;
|
|
34847
36768
|
if (!p) return void 0;
|
|
36769
|
+
let resolved = null;
|
|
34848
36770
|
try {
|
|
34849
|
-
const
|
|
34850
|
-
const
|
|
34851
|
-
|
|
36771
|
+
const path2 = filePath?.startsWith("file:") ? fileURLToPath3(filePath) : filePath;
|
|
36772
|
+
const target = path2 ?? resolve5(process.cwd(), "story.tw");
|
|
36773
|
+
resolved = process.env.SPINDLE_LSP_TRUSTED_FORMAT === "1" ? await p.resolveConfig(target, { useCache: false }) : await loadDataConfig(p, target);
|
|
34852
36774
|
} catch {
|
|
34853
|
-
return { prettier: p, options: { tabWidth: 2 } };
|
|
34854
36775
|
}
|
|
36776
|
+
return { prettier: p, options: { tabWidth: 2, ...resolved, endOfLine: "lf" } };
|
|
36777
|
+
}
|
|
36778
|
+
async function loadDataConfig(p, target) {
|
|
36779
|
+
const configFile = await p.resolveConfigFile(target);
|
|
36780
|
+
if (!configFile || !["", ".json", ".yaml", ".yml"].includes(extname(configFile))) return null;
|
|
36781
|
+
const source = await readFile(configFile, "utf8");
|
|
36782
|
+
let config2 = extname(configFile) === ".json" ? JSON.parse(source) : (0, import_yaml2.parse)(source);
|
|
36783
|
+
if (["package.json", "package.yaml"].includes(basename(configFile))) config2 = config2?.prettier;
|
|
36784
|
+
if (!config2 || typeof config2 !== "object" || Array.isArray(config2)) return null;
|
|
36785
|
+
const { overrides, ...base } = config2;
|
|
36786
|
+
let options = base;
|
|
36787
|
+
const file2 = relative3(dirname3(configFile), resolve5(target)).replaceAll("\\", "/");
|
|
36788
|
+
for (const override of Array.isArray(overrides) ? overrides : []) {
|
|
36789
|
+
if (matchesPatterns(file2, override.files, override.excludeFiles)) {
|
|
36790
|
+
options = { ...options, ...override.options };
|
|
36791
|
+
}
|
|
36792
|
+
}
|
|
36793
|
+
const { plugins: _plugins, $schema: _schema, ...safe } = options;
|
|
36794
|
+
return safe;
|
|
36795
|
+
}
|
|
36796
|
+
function matchesPatterns(file2, patterns, excludedPatterns) {
|
|
36797
|
+
const excluded = Array.isArray(excludedPatterns) ? excludedPatterns : [excludedPatterns];
|
|
36798
|
+
return (Array.isArray(patterns) ? patterns : [patterns]).some((pattern) => {
|
|
36799
|
+
if (typeof pattern !== "string") return false;
|
|
36800
|
+
const options = { matchBase: !pattern.includes("/"), dot: true };
|
|
36801
|
+
return minimatch(file2, pattern, options) && !excluded.some((exclude) => typeof exclude === "string" && minimatch(file2, exclude, options));
|
|
36802
|
+
});
|
|
34855
36803
|
}
|
|
34856
|
-
var prettier;
|
|
36804
|
+
var import_yaml2, prettier;
|
|
34857
36805
|
var init_prettier_bridge = __esm({
|
|
34858
36806
|
"src/plugins/format/prettier-bridge.ts"() {
|
|
34859
36807
|
"use strict";
|
|
36808
|
+
init_esm3();
|
|
36809
|
+
import_yaml2 = __toESM(require_dist(), 1);
|
|
34860
36810
|
}
|
|
34861
36811
|
});
|
|
34862
36812
|
|
|
@@ -34968,11 +36918,11 @@ var init_format = __esm({
|
|
|
34968
36918
|
ctx.connection.onDocumentRangeFormatting(async (params) => {
|
|
34969
36919
|
const text3 = ctx.workspace.documents.getText(params.textDocument.uri);
|
|
34970
36920
|
if (text3 === void 0) return [];
|
|
34971
|
-
const
|
|
36921
|
+
const range2 = {
|
|
34972
36922
|
start: { line: params.range.start.line, character: params.range.start.character },
|
|
34973
36923
|
end: { line: params.range.end.line, character: params.range.end.character }
|
|
34974
36924
|
};
|
|
34975
|
-
const formatted = await formatRange(text3,
|
|
36925
|
+
const formatted = await formatRange(text3, range2, { ...formatOpts, filePath: params.textDocument.uri });
|
|
34976
36926
|
if (formatted === text3) return [];
|
|
34977
36927
|
const lines = text3.split("\n");
|
|
34978
36928
|
return [{
|
|
@@ -35500,8 +37450,8 @@ var init_parseUtil = __esm({
|
|
|
35500
37450
|
init_errors();
|
|
35501
37451
|
init_en();
|
|
35502
37452
|
makeIssue = (params) => {
|
|
35503
|
-
const { data: data2, path, errorMaps, issueData } = params;
|
|
35504
|
-
const fullPath = [...
|
|
37453
|
+
const { data: data2, path: path2, errorMaps, issueData } = params;
|
|
37454
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
35505
37455
|
const fullIssue = {
|
|
35506
37456
|
...issueData,
|
|
35507
37457
|
path: fullPath
|
|
@@ -35781,11 +37731,11 @@ var init_types = __esm({
|
|
|
35781
37731
|
init_parseUtil();
|
|
35782
37732
|
init_util();
|
|
35783
37733
|
ParseInputLazyPath = class {
|
|
35784
|
-
constructor(parent, value,
|
|
37734
|
+
constructor(parent, value, path2, key) {
|
|
35785
37735
|
this._cachedPath = [];
|
|
35786
37736
|
this.parent = parent;
|
|
35787
37737
|
this.data = value;
|
|
35788
|
-
this._path =
|
|
37738
|
+
this._path = path2;
|
|
35789
37739
|
this._key = key;
|
|
35790
37740
|
}
|
|
35791
37741
|
get path() {
|
|
@@ -37856,9 +39806,9 @@ var init_types = __esm({
|
|
|
37856
39806
|
return this._def.options;
|
|
37857
39807
|
}
|
|
37858
39808
|
};
|
|
37859
|
-
ZodUnion.create = (
|
|
39809
|
+
ZodUnion.create = (types3, params) => {
|
|
37860
39810
|
return new ZodUnion({
|
|
37861
|
-
options:
|
|
39811
|
+
options: types3,
|
|
37862
39812
|
typeName: ZodFirstPartyTypeKind.ZodUnion,
|
|
37863
39813
|
...processCreateParams(params)
|
|
37864
39814
|
});
|
|
@@ -39071,10 +41021,10 @@ function $constructor(name, initializer3, params) {
|
|
|
39071
41021
|
}
|
|
39072
41022
|
Object.defineProperty(Definition, "name", { value: name });
|
|
39073
41023
|
function _2(def) {
|
|
39074
|
-
var
|
|
41024
|
+
var _a3;
|
|
39075
41025
|
const inst = params?.Parent ? new Definition() : this;
|
|
39076
41026
|
init(inst, def);
|
|
39077
|
-
(
|
|
41027
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
39078
41028
|
for (const fn of inst._zod.deferred) {
|
|
39079
41029
|
fn();
|
|
39080
41030
|
}
|
|
@@ -39236,9 +41186,9 @@ function floatSafeRemainder2(val, step) {
|
|
|
39236
41186
|
const stepString = step.toString();
|
|
39237
41187
|
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
39238
41188
|
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
39239
|
-
const
|
|
39240
|
-
if (
|
|
39241
|
-
stepDecCount = Number.parseInt(
|
|
41189
|
+
const match2 = stepString.match(/\d?e-(\d?)/);
|
|
41190
|
+
if (match2?.[1]) {
|
|
41191
|
+
stepDecCount = Number.parseInt(match2[1]);
|
|
39242
41192
|
}
|
|
39243
41193
|
}
|
|
39244
41194
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
@@ -39290,10 +41240,10 @@ function mergeDefs(...defs) {
|
|
|
39290
41240
|
function cloneDef(schema) {
|
|
39291
41241
|
return mergeDefs(schema._zod.def);
|
|
39292
41242
|
}
|
|
39293
|
-
function getElementAtPath(obj,
|
|
39294
|
-
if (!
|
|
41243
|
+
function getElementAtPath(obj, path2) {
|
|
41244
|
+
if (!path2)
|
|
39295
41245
|
return obj;
|
|
39296
|
-
return
|
|
41246
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
39297
41247
|
}
|
|
39298
41248
|
function promiseAllObject(promisesObj) {
|
|
39299
41249
|
const keys = Object.keys(promisesObj);
|
|
@@ -39605,11 +41555,11 @@ function aborted(x2, startIndex = 0) {
|
|
|
39605
41555
|
}
|
|
39606
41556
|
return false;
|
|
39607
41557
|
}
|
|
39608
|
-
function prefixIssues(
|
|
41558
|
+
function prefixIssues(path2, issues) {
|
|
39609
41559
|
return issues.map((iss) => {
|
|
39610
|
-
var
|
|
39611
|
-
(
|
|
39612
|
-
iss.path.unshift(
|
|
41560
|
+
var _a3;
|
|
41561
|
+
(_a3 = iss).path ?? (_a3.path = []);
|
|
41562
|
+
iss.path.unshift(path2);
|
|
39613
41563
|
return iss;
|
|
39614
41564
|
});
|
|
39615
41565
|
}
|
|
@@ -39851,8 +41801,8 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
39851
41801
|
}
|
|
39852
41802
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
39853
41803
|
const result2 = { errors: [] };
|
|
39854
|
-
const processError = (error49,
|
|
39855
|
-
var
|
|
41804
|
+
const processError = (error49, path2 = []) => {
|
|
41805
|
+
var _a3, _b;
|
|
39856
41806
|
for (const issue2 of error49.issues) {
|
|
39857
41807
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
39858
41808
|
issue2.errors.map((issues) => processError({ issues }, issue2.path));
|
|
@@ -39861,7 +41811,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
39861
41811
|
} else if (issue2.code === "invalid_element") {
|
|
39862
41812
|
processError({ issues: issue2.issues }, issue2.path);
|
|
39863
41813
|
} else {
|
|
39864
|
-
const fullpath = [...
|
|
41814
|
+
const fullpath = [...path2, ...issue2.path];
|
|
39865
41815
|
if (fullpath.length === 0) {
|
|
39866
41816
|
result2.errors.push(mapper(issue2));
|
|
39867
41817
|
continue;
|
|
@@ -39873,7 +41823,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
39873
41823
|
const terminal = i2 === fullpath.length - 1;
|
|
39874
41824
|
if (typeof el === "string") {
|
|
39875
41825
|
curr.properties ?? (curr.properties = {});
|
|
39876
|
-
(
|
|
41826
|
+
(_a3 = curr.properties)[el] ?? (_a3[el] = { errors: [] });
|
|
39877
41827
|
curr = curr.properties[el];
|
|
39878
41828
|
} else {
|
|
39879
41829
|
curr.items ?? (curr.items = []);
|
|
@@ -39893,8 +41843,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
39893
41843
|
}
|
|
39894
41844
|
function toDotPath(_path) {
|
|
39895
41845
|
const segs = [];
|
|
39896
|
-
const
|
|
39897
|
-
for (const seg of
|
|
41846
|
+
const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
41847
|
+
for (const seg of path2) {
|
|
39898
41848
|
if (typeof seg === "number")
|
|
39899
41849
|
segs.push(`[${seg}]`);
|
|
39900
41850
|
else if (typeof seg === "symbol")
|
|
@@ -40217,10 +42167,10 @@ var init_checks = __esm({
|
|
|
40217
42167
|
init_regexes();
|
|
40218
42168
|
init_util2();
|
|
40219
42169
|
$ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
40220
|
-
var
|
|
42170
|
+
var _a3;
|
|
40221
42171
|
inst._zod ?? (inst._zod = {});
|
|
40222
42172
|
inst._zod.def = def;
|
|
40223
|
-
(
|
|
42173
|
+
(_a3 = inst._zod).onattach ?? (_a3.onattach = []);
|
|
40224
42174
|
});
|
|
40225
42175
|
numericOriginMap = {
|
|
40226
42176
|
number: "number",
|
|
@@ -40286,8 +42236,8 @@ var init_checks = __esm({
|
|
|
40286
42236
|
$ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
40287
42237
|
$ZodCheck.init(inst, def);
|
|
40288
42238
|
inst._zod.onattach.push((inst2) => {
|
|
40289
|
-
var
|
|
40290
|
-
(
|
|
42239
|
+
var _a3;
|
|
42240
|
+
(_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
|
|
40291
42241
|
});
|
|
40292
42242
|
inst._zod.check = (payload) => {
|
|
40293
42243
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -40420,9 +42370,9 @@ var init_checks = __esm({
|
|
|
40420
42370
|
};
|
|
40421
42371
|
});
|
|
40422
42372
|
$ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
40423
|
-
var
|
|
42373
|
+
var _a3;
|
|
40424
42374
|
$ZodCheck.init(inst, def);
|
|
40425
|
-
(
|
|
42375
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
40426
42376
|
const val = payload.value;
|
|
40427
42377
|
return !nullish(val) && val.size !== void 0;
|
|
40428
42378
|
});
|
|
@@ -40448,9 +42398,9 @@ var init_checks = __esm({
|
|
|
40448
42398
|
};
|
|
40449
42399
|
});
|
|
40450
42400
|
$ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
|
|
40451
|
-
var
|
|
42401
|
+
var _a3;
|
|
40452
42402
|
$ZodCheck.init(inst, def);
|
|
40453
|
-
(
|
|
42403
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
40454
42404
|
const val = payload.value;
|
|
40455
42405
|
return !nullish(val) && val.size !== void 0;
|
|
40456
42406
|
});
|
|
@@ -40476,9 +42426,9 @@ var init_checks = __esm({
|
|
|
40476
42426
|
};
|
|
40477
42427
|
});
|
|
40478
42428
|
$ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
40479
|
-
var
|
|
42429
|
+
var _a3;
|
|
40480
42430
|
$ZodCheck.init(inst, def);
|
|
40481
|
-
(
|
|
42431
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
40482
42432
|
const val = payload.value;
|
|
40483
42433
|
return !nullish(val) && val.size !== void 0;
|
|
40484
42434
|
});
|
|
@@ -40506,9 +42456,9 @@ var init_checks = __esm({
|
|
|
40506
42456
|
};
|
|
40507
42457
|
});
|
|
40508
42458
|
$ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
40509
|
-
var
|
|
42459
|
+
var _a3;
|
|
40510
42460
|
$ZodCheck.init(inst, def);
|
|
40511
|
-
(
|
|
42461
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
40512
42462
|
const val = payload.value;
|
|
40513
42463
|
return !nullish(val) && val.length !== void 0;
|
|
40514
42464
|
});
|
|
@@ -40535,9 +42485,9 @@ var init_checks = __esm({
|
|
|
40535
42485
|
};
|
|
40536
42486
|
});
|
|
40537
42487
|
$ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
40538
|
-
var
|
|
42488
|
+
var _a3;
|
|
40539
42489
|
$ZodCheck.init(inst, def);
|
|
40540
|
-
(
|
|
42490
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
40541
42491
|
const val = payload.value;
|
|
40542
42492
|
return !nullish(val) && val.length !== void 0;
|
|
40543
42493
|
});
|
|
@@ -40564,9 +42514,9 @@ var init_checks = __esm({
|
|
|
40564
42514
|
};
|
|
40565
42515
|
});
|
|
40566
42516
|
$ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
40567
|
-
var
|
|
42517
|
+
var _a3;
|
|
40568
42518
|
$ZodCheck.init(inst, def);
|
|
40569
|
-
(
|
|
42519
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
|
|
40570
42520
|
const val = payload.value;
|
|
40571
42521
|
return !nullish(val) && val.length !== void 0;
|
|
40572
42522
|
});
|
|
@@ -40595,7 +42545,7 @@ var init_checks = __esm({
|
|
|
40595
42545
|
};
|
|
40596
42546
|
});
|
|
40597
42547
|
$ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
40598
|
-
var
|
|
42548
|
+
var _a3, _b;
|
|
40599
42549
|
$ZodCheck.init(inst, def);
|
|
40600
42550
|
inst._zod.onattach.push((inst2) => {
|
|
40601
42551
|
const bag = inst2._zod.bag;
|
|
@@ -40606,7 +42556,7 @@ var init_checks = __esm({
|
|
|
40606
42556
|
}
|
|
40607
42557
|
});
|
|
40608
42558
|
if (def.pattern)
|
|
40609
|
-
(
|
|
42559
|
+
(_a3 = inst._zod).check ?? (_a3.check = (payload) => {
|
|
40610
42560
|
def.pattern.lastIndex = 0;
|
|
40611
42561
|
if (def.pattern.test(payload.value))
|
|
40612
42562
|
return;
|
|
@@ -41183,7 +43133,7 @@ var init_schemas = __esm({
|
|
|
41183
43133
|
init_versions();
|
|
41184
43134
|
init_util2();
|
|
41185
43135
|
$ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
41186
|
-
var
|
|
43136
|
+
var _a3;
|
|
41187
43137
|
inst ?? (inst = {});
|
|
41188
43138
|
inst._zod.def = def;
|
|
41189
43139
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -41198,7 +43148,7 @@ var init_schemas = __esm({
|
|
|
41198
43148
|
}
|
|
41199
43149
|
}
|
|
41200
43150
|
if (checks.length === 0) {
|
|
41201
|
-
(
|
|
43151
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
41202
43152
|
inst._zod.deferred?.push(() => {
|
|
41203
43153
|
inst._zod.run = inst._zod.parse;
|
|
41204
43154
|
});
|
|
@@ -48723,7 +50673,7 @@ var init_locales = __esm({
|
|
|
48723
50673
|
function registry() {
|
|
48724
50674
|
return new $ZodRegistry();
|
|
48725
50675
|
}
|
|
48726
|
-
var
|
|
50676
|
+
var _a2, $output, $input, $ZodRegistry, globalRegistry;
|
|
48727
50677
|
var init_registries = __esm({
|
|
48728
50678
|
"node_modules/zod/v4/core/registries.js"() {
|
|
48729
50679
|
$output = /* @__PURE__ */ Symbol("ZodOutput");
|
|
@@ -48768,7 +50718,7 @@ var init_registries = __esm({
|
|
|
48768
50718
|
return this._map.has(schema);
|
|
48769
50719
|
}
|
|
48770
50720
|
};
|
|
48771
|
-
(
|
|
50721
|
+
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
48772
50722
|
globalRegistry = globalThis.__zod_globalRegistry;
|
|
48773
50723
|
}
|
|
48774
50724
|
});
|
|
@@ -49419,10 +51369,10 @@ function _property(property, schema, params) {
|
|
|
49419
51369
|
});
|
|
49420
51370
|
}
|
|
49421
51371
|
// @__NO_SIDE_EFFECTS__
|
|
49422
|
-
function _mime(
|
|
51372
|
+
function _mime(types3, params) {
|
|
49423
51373
|
return new $ZodCheckMimeType({
|
|
49424
51374
|
check: "mime_type",
|
|
49425
|
-
mime:
|
|
51375
|
+
mime: types3,
|
|
49426
51376
|
...normalizeParams(params)
|
|
49427
51377
|
});
|
|
49428
51378
|
}
|
|
@@ -49844,7 +51794,7 @@ function initializeContext(params) {
|
|
|
49844
51794
|
};
|
|
49845
51795
|
}
|
|
49846
51796
|
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
49847
|
-
var
|
|
51797
|
+
var _a3;
|
|
49848
51798
|
const def = schema._zod.def;
|
|
49849
51799
|
const seen = ctx.seen.get(schema);
|
|
49850
51800
|
if (seen) {
|
|
@@ -49892,7 +51842,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
49892
51842
|
delete result2.schema.default;
|
|
49893
51843
|
}
|
|
49894
51844
|
if (ctx.io === "input" && result2.schema._prefault)
|
|
49895
|
-
(
|
|
51845
|
+
(_a3 = result2.schema).default ?? (_a3.default = result2.schema._prefault);
|
|
49896
51846
|
delete result2.schema._prefault;
|
|
49897
51847
|
const _result = ctx.seen.get(schema);
|
|
49898
51848
|
return _result.schema;
|
|
@@ -49964,8 +51914,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
49964
51914
|
continue;
|
|
49965
51915
|
}
|
|
49966
51916
|
if (ctx.external) {
|
|
49967
|
-
const
|
|
49968
|
-
if (schema !== entry[0] &&
|
|
51917
|
+
const ext2 = ctx.external.registry.get(entry[0])?.id;
|
|
51918
|
+
if (schema !== entry[0] && ext2) {
|
|
49969
51919
|
extractToDef(entry);
|
|
49970
51920
|
continue;
|
|
49971
51921
|
}
|
|
@@ -51314,11 +53264,11 @@ function normalizeObjectSchema(schema) {
|
|
|
51314
53264
|
}
|
|
51315
53265
|
return void 0;
|
|
51316
53266
|
}
|
|
51317
|
-
function getDotPath(
|
|
51318
|
-
if (
|
|
53267
|
+
function getDotPath(path2) {
|
|
53268
|
+
if (path2.length === 0) {
|
|
51319
53269
|
return "object root";
|
|
51320
53270
|
}
|
|
51321
|
-
return
|
|
53271
|
+
return path2.reduce((acc, seg, index) => {
|
|
51322
53272
|
if (index === 0) {
|
|
51323
53273
|
return String(seg);
|
|
51324
53274
|
}
|
|
@@ -52667,7 +54617,7 @@ var init_schemas3 = __esm({
|
|
|
52667
54617
|
inst._zod.processJSONSchema = (ctx, json2, params) => fileProcessor(inst, ctx, json2, params);
|
|
52668
54618
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
52669
54619
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
52670
|
-
inst.mime = (
|
|
54620
|
+
inst.mime = (types3, params) => inst.check(_mime(Array.isArray(types3) ? types3 : [types3], params));
|
|
52671
54621
|
});
|
|
52672
54622
|
ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
52673
54623
|
$ZodTransform.init(inst, def);
|
|
@@ -52860,13 +54810,13 @@ function resolveRef(ref2, ctx) {
|
|
|
52860
54810
|
if (!ref2.startsWith("#")) {
|
|
52861
54811
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
52862
54812
|
}
|
|
52863
|
-
const
|
|
52864
|
-
if (
|
|
54813
|
+
const path2 = ref2.slice(1).split("/").filter(Boolean);
|
|
54814
|
+
if (path2.length === 0) {
|
|
52865
54815
|
return ctx.rootSchema;
|
|
52866
54816
|
}
|
|
52867
54817
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
52868
|
-
if (
|
|
52869
|
-
const key =
|
|
54818
|
+
if (path2[0] === defsKey) {
|
|
54819
|
+
const key = path2[1];
|
|
52870
54820
|
if (!key || !ctx.defs[key]) {
|
|
52871
54821
|
throw new Error(`Reference not found: ${ref2}`);
|
|
52872
54822
|
}
|
|
@@ -56064,15 +58014,15 @@ function parseUnionDef(def, refs) {
|
|
|
56064
58014
|
return asAnyOf(def, refs);
|
|
56065
58015
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
56066
58016
|
if (options.every((x2) => x2._def.typeName in primitiveMappings && (!x2._def.checks || !x2._def.checks.length))) {
|
|
56067
|
-
const
|
|
58017
|
+
const types3 = options.reduce((types4, x2) => {
|
|
56068
58018
|
const type = primitiveMappings[x2._def.typeName];
|
|
56069
|
-
return type && !
|
|
58019
|
+
return type && !types4.includes(type) ? [...types4, type] : types4;
|
|
56070
58020
|
}, []);
|
|
56071
58021
|
return {
|
|
56072
|
-
type:
|
|
58022
|
+
type: types3.length > 1 ? types3 : types3[0]
|
|
56073
58023
|
};
|
|
56074
58024
|
} else if (options.every((x2) => x2._def.typeName === "ZodLiteral" && !x2.description)) {
|
|
56075
|
-
const
|
|
58025
|
+
const types3 = options.reduce((acc, x2) => {
|
|
56076
58026
|
const type = typeof x2._def.value;
|
|
56077
58027
|
switch (type) {
|
|
56078
58028
|
case "string":
|
|
@@ -56091,8 +58041,8 @@ function parseUnionDef(def, refs) {
|
|
|
56091
58041
|
return acc;
|
|
56092
58042
|
}
|
|
56093
58043
|
}, []);
|
|
56094
|
-
if (
|
|
56095
|
-
const uniqueTypes =
|
|
58044
|
+
if (types3.length === options.length) {
|
|
58045
|
+
const uniqueTypes = types3.filter((x2, i2, a) => a.indexOf(x2) === i2);
|
|
56096
58046
|
return {
|
|
56097
58047
|
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
56098
58048
|
enum: options.reduce((acc, x2) => {
|
|
@@ -56707,7 +58657,7 @@ var init_zodToJsonSchema = __esm({
|
|
|
56707
58657
|
});
|
|
56708
58658
|
|
|
56709
58659
|
// node_modules/zod-to-json-schema/dist/esm/index.js
|
|
56710
|
-
var
|
|
58660
|
+
var init_esm4 = __esm({
|
|
56711
58661
|
"node_modules/zod-to-json-schema/dist/esm/index.js"() {
|
|
56712
58662
|
init_Options();
|
|
56713
58663
|
init_Refs();
|
|
@@ -56796,7 +58746,7 @@ var init_zod_json_schema_compat = __esm({
|
|
|
56796
58746
|
"node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js"() {
|
|
56797
58747
|
init_v4_mini();
|
|
56798
58748
|
init_zod_compat();
|
|
56799
|
-
|
|
58749
|
+
init_esm4();
|
|
56800
58750
|
}
|
|
56801
58751
|
});
|
|
56802
58752
|
|
|
@@ -57829,12 +59779,12 @@ var require_code = __commonJS({
|
|
|
57829
59779
|
return item === "" || item === '""';
|
|
57830
59780
|
}
|
|
57831
59781
|
get str() {
|
|
57832
|
-
var
|
|
57833
|
-
return (
|
|
59782
|
+
var _a3;
|
|
59783
|
+
return (_a3 = this._str) !== null && _a3 !== void 0 ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
|
|
57834
59784
|
}
|
|
57835
59785
|
get names() {
|
|
57836
|
-
var
|
|
57837
|
-
return (
|
|
59786
|
+
var _a3;
|
|
59787
|
+
return (_a3 = this._names) !== null && _a3 !== void 0 ? _a3 : this._names = this._items.reduce((names, c) => {
|
|
57838
59788
|
if (c instanceof Name)
|
|
57839
59789
|
names[c.str] = (names[c.str] || 0) + 1;
|
|
57840
59790
|
return names;
|
|
@@ -57980,8 +59930,8 @@ var require_scope = __commonJS({
|
|
|
57980
59930
|
return `${prefix}${ng.index++}`;
|
|
57981
59931
|
}
|
|
57982
59932
|
_nameGroup(prefix) {
|
|
57983
|
-
var
|
|
57984
|
-
if (((_b = (
|
|
59933
|
+
var _a3, _b;
|
|
59934
|
+
if (((_b = (_a3 = this._parent) === null || _a3 === void 0 ? void 0 : _a3._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
|
|
57985
59935
|
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
|
57986
59936
|
}
|
|
57987
59937
|
return this._names[prefix] = { prefix, index: 0 };
|
|
@@ -58014,12 +59964,12 @@ var require_scope = __commonJS({
|
|
|
58014
59964
|
return new ValueScopeName(prefix, this._newName(prefix));
|
|
58015
59965
|
}
|
|
58016
59966
|
value(nameOrPrefix, value) {
|
|
58017
|
-
var
|
|
59967
|
+
var _a3;
|
|
58018
59968
|
if (value.ref === void 0)
|
|
58019
59969
|
throw new Error("CodeGen: ref must be passed in value");
|
|
58020
59970
|
const name = this.toName(nameOrPrefix);
|
|
58021
59971
|
const { prefix } = name;
|
|
58022
|
-
const valueKey = (
|
|
59972
|
+
const valueKey = (_a3 = value.key) !== null && _a3 !== void 0 ? _a3 : value.ref;
|
|
58023
59973
|
let vs2 = this._values[prefix];
|
|
58024
59974
|
if (vs2) {
|
|
58025
59975
|
const _name = vs2.get(valueKey);
|
|
@@ -58337,8 +60287,8 @@ var require_codegen = __commonJS({
|
|
|
58337
60287
|
return this;
|
|
58338
60288
|
}
|
|
58339
60289
|
optimizeNames(names, constants) {
|
|
58340
|
-
var
|
|
58341
|
-
this.else = (
|
|
60290
|
+
var _a3;
|
|
60291
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants);
|
|
58342
60292
|
if (!(super.optimizeNames(names, constants) || this.else))
|
|
58343
60293
|
return;
|
|
58344
60294
|
this.condition = optimizeExpr(this.condition, names, constants);
|
|
@@ -58442,16 +60392,16 @@ var require_codegen = __commonJS({
|
|
|
58442
60392
|
return code;
|
|
58443
60393
|
}
|
|
58444
60394
|
optimizeNodes() {
|
|
58445
|
-
var
|
|
60395
|
+
var _a3, _b;
|
|
58446
60396
|
super.optimizeNodes();
|
|
58447
|
-
(
|
|
60397
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNodes();
|
|
58448
60398
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
58449
60399
|
return this;
|
|
58450
60400
|
}
|
|
58451
60401
|
optimizeNames(names, constants) {
|
|
58452
|
-
var
|
|
60402
|
+
var _a3, _b;
|
|
58453
60403
|
super.optimizeNames(names, constants);
|
|
58454
|
-
(
|
|
60404
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants);
|
|
58455
60405
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
|
|
58456
60406
|
return this;
|
|
58457
60407
|
}
|
|
@@ -59231,8 +61181,8 @@ var require_applicability = __commonJS({
|
|
|
59231
61181
|
}
|
|
59232
61182
|
exports.shouldUseGroup = shouldUseGroup;
|
|
59233
61183
|
function shouldUseRule(schema, rule) {
|
|
59234
|
-
var
|
|
59235
|
-
return schema[rule.keyword] !== void 0 || ((
|
|
61184
|
+
var _a3;
|
|
61185
|
+
return schema[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema[kwd] !== void 0));
|
|
59236
61186
|
}
|
|
59237
61187
|
exports.shouldUseRule = shouldUseRule;
|
|
59238
61188
|
}
|
|
@@ -59255,37 +61205,37 @@ var require_dataType = __commonJS({
|
|
|
59255
61205
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
59256
61206
|
})(DataType || (exports.DataType = DataType = {}));
|
|
59257
61207
|
function getSchemaTypes(schema) {
|
|
59258
|
-
const
|
|
59259
|
-
const hasNull =
|
|
61208
|
+
const types3 = getJSONTypes(schema.type);
|
|
61209
|
+
const hasNull = types3.includes("null");
|
|
59260
61210
|
if (hasNull) {
|
|
59261
61211
|
if (schema.nullable === false)
|
|
59262
61212
|
throw new Error("type: null contradicts nullable: false");
|
|
59263
61213
|
} else {
|
|
59264
|
-
if (!
|
|
61214
|
+
if (!types3.length && schema.nullable !== void 0) {
|
|
59265
61215
|
throw new Error('"nullable" cannot be used without "type"');
|
|
59266
61216
|
}
|
|
59267
61217
|
if (schema.nullable === true)
|
|
59268
|
-
|
|
61218
|
+
types3.push("null");
|
|
59269
61219
|
}
|
|
59270
|
-
return
|
|
61220
|
+
return types3;
|
|
59271
61221
|
}
|
|
59272
61222
|
exports.getSchemaTypes = getSchemaTypes;
|
|
59273
61223
|
function getJSONTypes(ts2) {
|
|
59274
|
-
const
|
|
59275
|
-
if (
|
|
59276
|
-
return
|
|
59277
|
-
throw new Error("type must be JSONType or JSONType[]: " +
|
|
61224
|
+
const types3 = Array.isArray(ts2) ? ts2 : ts2 ? [ts2] : [];
|
|
61225
|
+
if (types3.every(rules_1.isJSONType))
|
|
61226
|
+
return types3;
|
|
61227
|
+
throw new Error("type must be JSONType or JSONType[]: " + types3.join(","));
|
|
59278
61228
|
}
|
|
59279
61229
|
exports.getJSONTypes = getJSONTypes;
|
|
59280
|
-
function coerceAndCheckDataType(it2,
|
|
61230
|
+
function coerceAndCheckDataType(it2, types3) {
|
|
59281
61231
|
const { gen, data: data2, opts } = it2;
|
|
59282
|
-
const coerceTo = coerceToTypes(
|
|
59283
|
-
const checkTypes =
|
|
61232
|
+
const coerceTo = coerceToTypes(types3, opts.coerceTypes);
|
|
61233
|
+
const checkTypes = types3.length > 0 && !(coerceTo.length === 0 && types3.length === 1 && (0, applicability_1.schemaHasRulesForType)(it2, types3[0]));
|
|
59284
61234
|
if (checkTypes) {
|
|
59285
|
-
const wrongType = checkDataTypes(
|
|
61235
|
+
const wrongType = checkDataTypes(types3, data2, opts.strictNumbers, DataType.Wrong);
|
|
59286
61236
|
gen.if(wrongType, () => {
|
|
59287
61237
|
if (coerceTo.length)
|
|
59288
|
-
coerceData(it2,
|
|
61238
|
+
coerceData(it2, types3, coerceTo);
|
|
59289
61239
|
else
|
|
59290
61240
|
reportTypeError(it2);
|
|
59291
61241
|
});
|
|
@@ -59294,15 +61244,15 @@ var require_dataType = __commonJS({
|
|
|
59294
61244
|
}
|
|
59295
61245
|
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
|
59296
61246
|
var COERCIBLE = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
59297
|
-
function coerceToTypes(
|
|
59298
|
-
return coerceTypes ?
|
|
61247
|
+
function coerceToTypes(types3, coerceTypes) {
|
|
61248
|
+
return coerceTypes ? types3.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
|
|
59299
61249
|
}
|
|
59300
|
-
function coerceData(it2,
|
|
61250
|
+
function coerceData(it2, types3, coerceTo) {
|
|
59301
61251
|
const { gen, data: data2, opts } = it2;
|
|
59302
61252
|
const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data2}`);
|
|
59303
61253
|
const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
|
|
59304
61254
|
if (opts.coerceTypes === "array") {
|
|
59305
|
-
gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data2}) && ${data2}.length == 1`, () => gen.assign(data2, (0, codegen_1._)`${data2}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data2}`).if(checkDataTypes(
|
|
61255
|
+
gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data2}) && ${data2}.length == 1`, () => gen.assign(data2, (0, codegen_1._)`${data2}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data2}`).if(checkDataTypes(types3, data2, opts.strictNumbers), () => gen.assign(coerced, data2)));
|
|
59306
61256
|
}
|
|
59307
61257
|
gen.if((0, codegen_1._)`${coerced} !== undefined`);
|
|
59308
61258
|
for (const t of coerceTo) {
|
|
@@ -59378,19 +61328,19 @@ var require_dataType = __commonJS({
|
|
|
59378
61328
|
return checkDataType(dataTypes[0], data2, strictNums, correct);
|
|
59379
61329
|
}
|
|
59380
61330
|
let cond;
|
|
59381
|
-
const
|
|
59382
|
-
if (
|
|
61331
|
+
const types3 = (0, util_1.toHash)(dataTypes);
|
|
61332
|
+
if (types3.array && types3.object) {
|
|
59383
61333
|
const notObj = (0, codegen_1._)`typeof ${data2} != "object"`;
|
|
59384
|
-
cond =
|
|
59385
|
-
delete
|
|
59386
|
-
delete
|
|
59387
|
-
delete
|
|
61334
|
+
cond = types3.null ? notObj : (0, codegen_1._)`!${data2} || ${notObj}`;
|
|
61335
|
+
delete types3.null;
|
|
61336
|
+
delete types3.array;
|
|
61337
|
+
delete types3.object;
|
|
59388
61338
|
} else {
|
|
59389
61339
|
cond = codegen_1.nil;
|
|
59390
61340
|
}
|
|
59391
|
-
if (
|
|
59392
|
-
delete
|
|
59393
|
-
for (const t in
|
|
61341
|
+
if (types3.number)
|
|
61342
|
+
delete types3.integer;
|
|
61343
|
+
for (const t in types3)
|
|
59394
61344
|
cond = (0, codegen_1.and)(cond, checkDataType(t, data2, strictNums, correct));
|
|
59395
61345
|
return cond;
|
|
59396
61346
|
}
|
|
@@ -59620,14 +61570,14 @@ var require_keyword = __commonJS({
|
|
|
59620
61570
|
}
|
|
59621
61571
|
exports.macroKeywordCode = macroKeywordCode;
|
|
59622
61572
|
function funcKeywordCode(cxt, def) {
|
|
59623
|
-
var
|
|
61573
|
+
var _a3;
|
|
59624
61574
|
const { gen, keyword, schema, parentSchema, $data, it: it2 } = cxt;
|
|
59625
61575
|
checkAsyncKeyword(it2, def);
|
|
59626
61576
|
const validate = !$data && def.compile ? def.compile.call(it2.self, schema, parentSchema, it2) : def.validate;
|
|
59627
61577
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
59628
61578
|
const valid = gen.let("valid");
|
|
59629
61579
|
cxt.block$data(valid, validateKeyword);
|
|
59630
|
-
cxt.ok((
|
|
61580
|
+
cxt.ok((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid);
|
|
59631
61581
|
function validateKeyword() {
|
|
59632
61582
|
if (def.errors === false) {
|
|
59633
61583
|
assignValid();
|
|
@@ -59658,8 +61608,8 @@ var require_keyword = __commonJS({
|
|
|
59658
61608
|
gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
|
59659
61609
|
}
|
|
59660
61610
|
function reportErrs(errors) {
|
|
59661
|
-
var
|
|
59662
|
-
gen.if((0, codegen_1.not)((
|
|
61611
|
+
var _a4;
|
|
61612
|
+
gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid), errors);
|
|
59663
61613
|
}
|
|
59664
61614
|
}
|
|
59665
61615
|
exports.funcKeywordCode = funcKeywordCode;
|
|
@@ -60195,9 +62145,9 @@ var require_validate = __commonJS({
|
|
|
60195
62145
|
function typeAndKeywords(it2, errsCount) {
|
|
60196
62146
|
if (it2.opts.jtd)
|
|
60197
62147
|
return schemaKeywords(it2, [], false, errsCount);
|
|
60198
|
-
const
|
|
60199
|
-
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it2,
|
|
60200
|
-
schemaKeywords(it2,
|
|
62148
|
+
const types3 = (0, dataType_1.getSchemaTypes)(it2.schema);
|
|
62149
|
+
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it2, types3);
|
|
62150
|
+
schemaKeywords(it2, types3, !checkedTypes, errsCount);
|
|
60201
62151
|
}
|
|
60202
62152
|
function checkRefsAndKeywords(it2) {
|
|
60203
62153
|
const { schema, errSchemaPath, opts, self } = it2;
|
|
@@ -60247,7 +62197,7 @@ var require_validate = __commonJS({
|
|
|
60247
62197
|
if (items instanceof codegen_1.Name)
|
|
60248
62198
|
gen.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
60249
62199
|
}
|
|
60250
|
-
function schemaKeywords(it2,
|
|
62200
|
+
function schemaKeywords(it2, types3, typeErrors, errsCount) {
|
|
60251
62201
|
const { gen, schema, data: data2, allErrors, opts, self } = it2;
|
|
60252
62202
|
const { RULES } = self;
|
|
60253
62203
|
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
|
|
@@ -60255,7 +62205,7 @@ var require_validate = __commonJS({
|
|
|
60255
62205
|
return;
|
|
60256
62206
|
}
|
|
60257
62207
|
if (!opts.jtd)
|
|
60258
|
-
checkStrictTypes(it2,
|
|
62208
|
+
checkStrictTypes(it2, types3);
|
|
60259
62209
|
gen.block(() => {
|
|
60260
62210
|
for (const group of RULES.rules)
|
|
60261
62211
|
groupKeywords(group);
|
|
@@ -60267,7 +62217,7 @@ var require_validate = __commonJS({
|
|
|
60267
62217
|
if (group.type) {
|
|
60268
62218
|
gen.if((0, dataType_2.checkDataType)(group.type, data2, opts.strictNumbers));
|
|
60269
62219
|
iterateKeywords(it2, group);
|
|
60270
|
-
if (
|
|
62220
|
+
if (types3.length === 1 && types3[0] === group.type && typeErrors) {
|
|
60271
62221
|
gen.else();
|
|
60272
62222
|
(0, dataType_2.reportTypeError)(it2);
|
|
60273
62223
|
}
|
|
@@ -60291,27 +62241,27 @@ var require_validate = __commonJS({
|
|
|
60291
62241
|
}
|
|
60292
62242
|
});
|
|
60293
62243
|
}
|
|
60294
|
-
function checkStrictTypes(it2,
|
|
62244
|
+
function checkStrictTypes(it2, types3) {
|
|
60295
62245
|
if (it2.schemaEnv.meta || !it2.opts.strictTypes)
|
|
60296
62246
|
return;
|
|
60297
|
-
checkContextTypes(it2,
|
|
62247
|
+
checkContextTypes(it2, types3);
|
|
60298
62248
|
if (!it2.opts.allowUnionTypes)
|
|
60299
|
-
checkMultipleTypes(it2,
|
|
62249
|
+
checkMultipleTypes(it2, types3);
|
|
60300
62250
|
checkKeywordTypes(it2, it2.dataTypes);
|
|
60301
62251
|
}
|
|
60302
|
-
function checkContextTypes(it2,
|
|
60303
|
-
if (!
|
|
62252
|
+
function checkContextTypes(it2, types3) {
|
|
62253
|
+
if (!types3.length)
|
|
60304
62254
|
return;
|
|
60305
62255
|
if (!it2.dataTypes.length) {
|
|
60306
|
-
it2.dataTypes =
|
|
62256
|
+
it2.dataTypes = types3;
|
|
60307
62257
|
return;
|
|
60308
62258
|
}
|
|
60309
|
-
|
|
62259
|
+
types3.forEach((t) => {
|
|
60310
62260
|
if (!includesType(it2.dataTypes, t)) {
|
|
60311
62261
|
strictTypesError(it2, `type "${t}" not allowed by context "${it2.dataTypes.join(",")}"`);
|
|
60312
62262
|
}
|
|
60313
62263
|
});
|
|
60314
|
-
narrowSchemaTypes(it2,
|
|
62264
|
+
narrowSchemaTypes(it2, types3);
|
|
60315
62265
|
}
|
|
60316
62266
|
function checkMultipleTypes(it2, ts2) {
|
|
60317
62267
|
if (ts2.length > 1 && !(ts2.length === 2 && ts2.includes("null"))) {
|
|
@@ -60627,7 +62577,7 @@ var require_compile = __commonJS({
|
|
|
60627
62577
|
var validate_1 = require_validate();
|
|
60628
62578
|
var SchemaEnv = class {
|
|
60629
62579
|
constructor(env) {
|
|
60630
|
-
var
|
|
62580
|
+
var _a3;
|
|
60631
62581
|
this.refs = {};
|
|
60632
62582
|
this.dynamicAnchors = {};
|
|
60633
62583
|
let schema;
|
|
@@ -60636,7 +62586,7 @@ var require_compile = __commonJS({
|
|
|
60636
62586
|
this.schema = env.schema;
|
|
60637
62587
|
this.schemaId = env.schemaId;
|
|
60638
62588
|
this.root = env.root || this;
|
|
60639
|
-
this.baseId = (
|
|
62589
|
+
this.baseId = (_a3 = env.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
60640
62590
|
this.schemaPath = env.schemaPath;
|
|
60641
62591
|
this.localRefs = env.localRefs;
|
|
60642
62592
|
this.meta = env.meta;
|
|
@@ -60732,14 +62682,14 @@ var require_compile = __commonJS({
|
|
|
60732
62682
|
}
|
|
60733
62683
|
exports.compileSchema = compileSchema;
|
|
60734
62684
|
function resolveRef2(root, baseId, ref2) {
|
|
60735
|
-
var
|
|
62685
|
+
var _a3;
|
|
60736
62686
|
ref2 = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref2);
|
|
60737
62687
|
const schOrFunc = root.refs[ref2];
|
|
60738
62688
|
if (schOrFunc)
|
|
60739
62689
|
return schOrFunc;
|
|
60740
62690
|
let _sch = resolve7.call(this, root, ref2);
|
|
60741
62691
|
if (_sch === void 0) {
|
|
60742
|
-
const schema = (
|
|
62692
|
+
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref2];
|
|
60743
62693
|
const { schemaId } = this.opts;
|
|
60744
62694
|
if (schema)
|
|
60745
62695
|
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
@@ -60808,8 +62758,8 @@ var require_compile = __commonJS({
|
|
|
60808
62758
|
"definitions"
|
|
60809
62759
|
]);
|
|
60810
62760
|
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
60811
|
-
var
|
|
60812
|
-
if (((
|
|
62761
|
+
var _a3;
|
|
62762
|
+
if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/")
|
|
60813
62763
|
return;
|
|
60814
62764
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
60815
62765
|
if (typeof schema === "boolean")
|
|
@@ -60979,8 +62929,8 @@ var require_utils = __commonJS({
|
|
|
60979
62929
|
}
|
|
60980
62930
|
return ind;
|
|
60981
62931
|
}
|
|
60982
|
-
function removeDotSegments(
|
|
60983
|
-
let input =
|
|
62932
|
+
function removeDotSegments(path2) {
|
|
62933
|
+
let input = path2;
|
|
60984
62934
|
const output = [];
|
|
60985
62935
|
let nextSlash = -1;
|
|
60986
62936
|
let len = 0;
|
|
@@ -61179,8 +63129,8 @@ var require_schemes = __commonJS({
|
|
|
61179
63129
|
wsComponent.secure = void 0;
|
|
61180
63130
|
}
|
|
61181
63131
|
if (wsComponent.resourceName) {
|
|
61182
|
-
const [
|
|
61183
|
-
wsComponent.path =
|
|
63132
|
+
const [path2, query] = wsComponent.resourceName.split("?");
|
|
63133
|
+
wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
|
|
61184
63134
|
wsComponent.query = query;
|
|
61185
63135
|
wsComponent.resourceName = void 0;
|
|
61186
63136
|
}
|
|
@@ -61345,49 +63295,49 @@ var require_fast_uri = __commonJS({
|
|
|
61345
63295
|
schemelessOptions.skipEscape = true;
|
|
61346
63296
|
return serialize(resolved, schemelessOptions);
|
|
61347
63297
|
}
|
|
61348
|
-
function resolveComponent(base,
|
|
63298
|
+
function resolveComponent(base, relative4, options, skipNormalization) {
|
|
61349
63299
|
const target = {};
|
|
61350
63300
|
if (!skipNormalization) {
|
|
61351
63301
|
base = parse6(serialize(base, options), options);
|
|
61352
|
-
|
|
63302
|
+
relative4 = parse6(serialize(relative4, options), options);
|
|
61353
63303
|
}
|
|
61354
63304
|
options = options || {};
|
|
61355
|
-
if (!options.tolerant &&
|
|
61356
|
-
target.scheme =
|
|
61357
|
-
target.userinfo =
|
|
61358
|
-
target.host =
|
|
61359
|
-
target.port =
|
|
61360
|
-
target.path = removeDotSegments(
|
|
61361
|
-
target.query =
|
|
63305
|
+
if (!options.tolerant && relative4.scheme) {
|
|
63306
|
+
target.scheme = relative4.scheme;
|
|
63307
|
+
target.userinfo = relative4.userinfo;
|
|
63308
|
+
target.host = relative4.host;
|
|
63309
|
+
target.port = relative4.port;
|
|
63310
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
63311
|
+
target.query = relative4.query;
|
|
61362
63312
|
} else {
|
|
61363
|
-
if (
|
|
61364
|
-
target.userinfo =
|
|
61365
|
-
target.host =
|
|
61366
|
-
target.port =
|
|
61367
|
-
target.path = removeDotSegments(
|
|
61368
|
-
target.query =
|
|
63313
|
+
if (relative4.userinfo !== void 0 || relative4.host !== void 0 || relative4.port !== void 0) {
|
|
63314
|
+
target.userinfo = relative4.userinfo;
|
|
63315
|
+
target.host = relative4.host;
|
|
63316
|
+
target.port = relative4.port;
|
|
63317
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
63318
|
+
target.query = relative4.query;
|
|
61369
63319
|
} else {
|
|
61370
|
-
if (!
|
|
63320
|
+
if (!relative4.path) {
|
|
61371
63321
|
target.path = base.path;
|
|
61372
|
-
if (
|
|
61373
|
-
target.query =
|
|
63322
|
+
if (relative4.query !== void 0) {
|
|
63323
|
+
target.query = relative4.query;
|
|
61374
63324
|
} else {
|
|
61375
63325
|
target.query = base.query;
|
|
61376
63326
|
}
|
|
61377
63327
|
} else {
|
|
61378
|
-
if (
|
|
61379
|
-
target.path = removeDotSegments(
|
|
63328
|
+
if (relative4.path[0] === "/") {
|
|
63329
|
+
target.path = removeDotSegments(relative4.path);
|
|
61380
63330
|
} else {
|
|
61381
63331
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
61382
|
-
target.path = "/" +
|
|
63332
|
+
target.path = "/" + relative4.path;
|
|
61383
63333
|
} else if (!base.path) {
|
|
61384
|
-
target.path =
|
|
63334
|
+
target.path = relative4.path;
|
|
61385
63335
|
} else {
|
|
61386
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
63336
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
|
|
61387
63337
|
}
|
|
61388
63338
|
target.path = removeDotSegments(target.path);
|
|
61389
63339
|
}
|
|
61390
|
-
target.query =
|
|
63340
|
+
target.query = relative4.query;
|
|
61391
63341
|
}
|
|
61392
63342
|
target.userinfo = base.userinfo;
|
|
61393
63343
|
target.host = base.host;
|
|
@@ -61395,7 +63345,7 @@ var require_fast_uri = __commonJS({
|
|
|
61395
63345
|
}
|
|
61396
63346
|
target.scheme = base.scheme;
|
|
61397
63347
|
}
|
|
61398
|
-
target.fragment =
|
|
63348
|
+
target.fragment = relative4.fragment;
|
|
61399
63349
|
return target;
|
|
61400
63350
|
}
|
|
61401
63351
|
function equal(uriA, uriB, options) {
|
|
@@ -61670,9 +63620,9 @@ var require_core = __commonJS({
|
|
|
61670
63620
|
};
|
|
61671
63621
|
var MAX_EXPRESSION = 200;
|
|
61672
63622
|
function requiredOptions(o) {
|
|
61673
|
-
var
|
|
63623
|
+
var _a3, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s2, _t2, _u, _v, _w, _x, _y, _z, _0;
|
|
61674
63624
|
const s = o.strict;
|
|
61675
|
-
const _optz = (
|
|
63625
|
+
const _optz = (_a3 = o.code) === null || _a3 === void 0 ? void 0 : _a3.optimize;
|
|
61676
63626
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
61677
63627
|
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
61678
63628
|
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
@@ -62146,7 +64096,7 @@ var require_core = __commonJS({
|
|
|
62146
64096
|
}
|
|
62147
64097
|
}
|
|
62148
64098
|
function addRule(keyword, definition2, dataType) {
|
|
62149
|
-
var
|
|
64099
|
+
var _a3;
|
|
62150
64100
|
const post = definition2 === null || definition2 === void 0 ? void 0 : definition2.post;
|
|
62151
64101
|
if (dataType && post)
|
|
62152
64102
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
@@ -62172,7 +64122,7 @@ var require_core = __commonJS({
|
|
|
62172
64122
|
else
|
|
62173
64123
|
ruleGroup.rules.push(rule);
|
|
62174
64124
|
RULES.all[keyword] = rule;
|
|
62175
|
-
(
|
|
64125
|
+
(_a3 = definition2.implements) === null || _a3 === void 0 ? void 0 : _a3.forEach((kwd) => this.addKeyword(kwd));
|
|
62176
64126
|
}
|
|
62177
64127
|
function addBeforeRule(ruleGroup, rule, before) {
|
|
62178
64128
|
const i2 = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
@@ -62306,10 +64256,10 @@ var require_ref = __commonJS({
|
|
|
62306
64256
|
gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
|
|
62307
64257
|
}
|
|
62308
64258
|
function addEvaluatedFrom(source) {
|
|
62309
|
-
var
|
|
64259
|
+
var _a3;
|
|
62310
64260
|
if (!it2.opts.unevaluated)
|
|
62311
64261
|
return;
|
|
62312
|
-
const schEvaluated = (
|
|
64262
|
+
const schEvaluated = (_a3 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a3 === void 0 ? void 0 : _a3.evaluated;
|
|
62313
64263
|
if (it2.props !== true) {
|
|
62314
64264
|
if (schEvaluated && !schEvaluated.dynamicProps) {
|
|
62315
64265
|
if (schEvaluated.props !== void 0) {
|
|
@@ -63960,7 +65910,7 @@ var require_discriminator = __commonJS({
|
|
|
63960
65910
|
return _valid;
|
|
63961
65911
|
}
|
|
63962
65912
|
function getMapping() {
|
|
63963
|
-
var
|
|
65913
|
+
var _a3;
|
|
63964
65914
|
const oneOfMapping = {};
|
|
63965
65915
|
const topRequired = hasRequired(parentSchema);
|
|
63966
65916
|
let tagRequired = true;
|
|
@@ -63974,7 +65924,7 @@ var require_discriminator = __commonJS({
|
|
|
63974
65924
|
if (sch === void 0)
|
|
63975
65925
|
throw new ref_error_1.default(it2.opts.uriResolver, it2.baseId, ref2);
|
|
63976
65926
|
}
|
|
63977
|
-
const propSch = (
|
|
65927
|
+
const propSch = (_a3 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a3 === void 0 ? void 0 : _a3[tagName];
|
|
63978
65928
|
if (typeof propSch != "object") {
|
|
63979
65929
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
|
|
63980
65930
|
}
|
|
@@ -64543,9 +66493,9 @@ var require_dist2 = __commonJS({
|
|
|
64543
66493
|
return f;
|
|
64544
66494
|
};
|
|
64545
66495
|
function addFormats(ajv, list3, fs2, exportName) {
|
|
64546
|
-
var
|
|
66496
|
+
var _a3;
|
|
64547
66497
|
var _b;
|
|
64548
|
-
(
|
|
66498
|
+
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
64549
66499
|
for (const f of list3)
|
|
64550
66500
|
ajv.addFormat(f, fs2[f]);
|
|
64551
66501
|
}
|
|
@@ -66349,7 +68299,7 @@ var init_stdio2 = __esm({
|
|
|
66349
68299
|
// src/mcp/play/sessions.ts
|
|
66350
68300
|
import { randomBytes } from "node:crypto";
|
|
66351
68301
|
import { statSync as statSync2 } from "node:fs";
|
|
66352
|
-
import { dirname as
|
|
68302
|
+
import { dirname as dirname4, resolve as resolve6 } from "node:path";
|
|
66353
68303
|
function missingPlayMessage() {
|
|
66354
68304
|
return `spindle_play needs @rohal12/spindle ${PLAY_SPINDLE_VERSION} or later`;
|
|
66355
68305
|
}
|
|
@@ -66386,7 +68336,7 @@ async function loadPlay(importer = () => import(PLAY_SPECIFIER), locate2 = () =>
|
|
|
66386
68336
|
function runtimeNote(storyPath, runtime) {
|
|
66387
68337
|
if (runtime === void 0) return [];
|
|
66388
68338
|
const isDirectory = statSync2(storyPath, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
66389
|
-
const installed = readInstalledSpindleVersion(isDirectory ? storyPath :
|
|
68339
|
+
const installed = readInstalledSpindleVersion(isDirectory ? storyPath : dirname4(storyPath));
|
|
66390
68340
|
if (installed === void 0 || installed === runtime) return [];
|
|
66391
68341
|
return [
|
|
66392
68342
|
`The project has Spindle ${installed} installed; spindle_play runs the story on Spindle ${runtime}, the copy spindle-lsp ships with.`
|
|
@@ -66439,10 +68389,11 @@ var init_sessions = __esm({
|
|
|
66439
68389
|
this.starting++;
|
|
66440
68390
|
try {
|
|
66441
68391
|
const play = await this.load();
|
|
66442
|
-
const
|
|
66443
|
-
const { html, notes: storyNotes } = await play.resolveStoryHtml({ path });
|
|
66444
|
-
const notes = [...storyNotes, ...runtimeNote(
|
|
66445
|
-
const
|
|
68392
|
+
const path2 = resolve6(process.cwd(), storyPath);
|
|
68393
|
+
const { html, notes: storyNotes } = await play.resolveStoryHtml({ path: path2 });
|
|
68394
|
+
const notes = [...storyNotes, ...runtimeNote(path2, play.version)];
|
|
68395
|
+
const sessionOptions = { html, trusted: this.trustedHostCode };
|
|
68396
|
+
const session = await play.openPlaySession(sessionOptions);
|
|
66446
68397
|
let observation;
|
|
66447
68398
|
try {
|
|
66448
68399
|
observation = passage === void 0 ? await session.observe() : await session.goto(passage);
|
|
@@ -66727,7 +68678,7 @@ function filterBySeverity2(diagnostics, minSeverity) {
|
|
|
66727
68678
|
});
|
|
66728
68679
|
}
|
|
66729
68680
|
function readFiles(files) {
|
|
66730
|
-
return new Map([...readFileContents(files)].map(([
|
|
68681
|
+
return new Map([...readFileContents(files)].map(([path2, text3]) => [pathToFileURL4(path2).toString(), text3]));
|
|
66731
68682
|
}
|
|
66732
68683
|
async function skippedReason(fileContents, files) {
|
|
66733
68684
|
const format = await findStoryFormat(fileContents.values(), commonDirectory(files));
|
|
@@ -70316,8 +72267,8 @@ var init_main = __esm({
|
|
|
70316
72267
|
Range2.is = is2;
|
|
70317
72268
|
})(Range || (Range = {}));
|
|
70318
72269
|
(function(Location2) {
|
|
70319
|
-
function create(uri,
|
|
70320
|
-
return { uri, range };
|
|
72270
|
+
function create(uri, range2) {
|
|
72271
|
+
return { uri, range: range2 };
|
|
70321
72272
|
}
|
|
70322
72273
|
Location2.create = create;
|
|
70323
72274
|
function is2(value) {
|
|
@@ -70354,9 +72305,9 @@ var init_main = __esm({
|
|
|
70354
72305
|
Color2.is = is2;
|
|
70355
72306
|
})(Color || (Color = {}));
|
|
70356
72307
|
(function(ColorInformation2) {
|
|
70357
|
-
function create(
|
|
72308
|
+
function create(range2, color) {
|
|
70358
72309
|
return {
|
|
70359
|
-
range,
|
|
72310
|
+
range: range2,
|
|
70360
72311
|
color
|
|
70361
72312
|
};
|
|
70362
72313
|
}
|
|
@@ -70446,8 +72397,8 @@ var init_main = __esm({
|
|
|
70446
72397
|
CodeDescription2.is = is2;
|
|
70447
72398
|
})(CodeDescription || (CodeDescription = {}));
|
|
70448
72399
|
(function(Diagnostic2) {
|
|
70449
|
-
function create(
|
|
70450
|
-
const result2 = { range, message };
|
|
72400
|
+
function create(range2, message, severity, code, source, relatedInformation) {
|
|
72401
|
+
const result2 = { range: range2, message };
|
|
70451
72402
|
if (Is2.defined(severity)) {
|
|
70452
72403
|
result2.severity = severity;
|
|
70453
72404
|
}
|
|
@@ -70464,9 +72415,9 @@ var init_main = __esm({
|
|
|
70464
72415
|
}
|
|
70465
72416
|
Diagnostic2.create = create;
|
|
70466
72417
|
function is2(value) {
|
|
70467
|
-
var
|
|
72418
|
+
var _a3;
|
|
70468
72419
|
const candidate = value;
|
|
70469
|
-
return Is2.defined(candidate) && Range.is(candidate.range) && (Is2.string(candidate.message) || MarkupContent.is(candidate.message)) && (Is2.number(candidate.severity) || Is2.undefined(candidate.severity)) && (Is2.integer(candidate.code) || Is2.string(candidate.code) || Is2.undefined(candidate.code)) && (Is2.undefined(candidate.codeDescription) || Is2.string((
|
|
72420
|
+
return Is2.defined(candidate) && Range.is(candidate.range) && (Is2.string(candidate.message) || MarkupContent.is(candidate.message)) && (Is2.number(candidate.severity) || Is2.undefined(candidate.severity)) && (Is2.integer(candidate.code) || Is2.string(candidate.code) || Is2.undefined(candidate.code)) && (Is2.undefined(candidate.codeDescription) || Is2.string((_a3 = candidate.codeDescription) === null || _a3 === void 0 ? void 0 : _a3.href)) && (Is2.string(candidate.source) || Is2.undefined(candidate.source)) && (Is2.undefined(candidate.relatedInformation) || Is2.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
|
|
70470
72421
|
}
|
|
70471
72422
|
Diagnostic2.is = is2;
|
|
70472
72423
|
function is3_17(value) {
|
|
@@ -70500,16 +72451,16 @@ var init_main = __esm({
|
|
|
70500
72451
|
Command2.is = is2;
|
|
70501
72452
|
})(Command || (Command = {}));
|
|
70502
72453
|
(function(TextEdit2) {
|
|
70503
|
-
function replace2(
|
|
70504
|
-
return { range, newText };
|
|
72454
|
+
function replace2(range2, newText) {
|
|
72455
|
+
return { range: range2, newText };
|
|
70505
72456
|
}
|
|
70506
72457
|
TextEdit2.replace = replace2;
|
|
70507
72458
|
function insert(position, newText) {
|
|
70508
72459
|
return { range: { start: position, end: position }, newText };
|
|
70509
72460
|
}
|
|
70510
72461
|
TextEdit2.insert = insert;
|
|
70511
|
-
function del(
|
|
70512
|
-
return { range, newText: "" };
|
|
72462
|
+
function del(range2) {
|
|
72463
|
+
return { range: range2, newText: "" };
|
|
70513
72464
|
}
|
|
70514
72465
|
TextEdit2.del = del;
|
|
70515
72466
|
function is2(value) {
|
|
@@ -70544,16 +72495,16 @@ var init_main = __esm({
|
|
|
70544
72495
|
ChangeAnnotationIdentifier2.is = is2;
|
|
70545
72496
|
})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
|
|
70546
72497
|
(function(AnnotatedTextEdit2) {
|
|
70547
|
-
function replace2(
|
|
70548
|
-
return { range, newText, annotationId: annotation };
|
|
72498
|
+
function replace2(range2, newText, annotation) {
|
|
72499
|
+
return { range: range2, newText, annotationId: annotation };
|
|
70549
72500
|
}
|
|
70550
72501
|
AnnotatedTextEdit2.replace = replace2;
|
|
70551
72502
|
function insert(position, newText, annotation) {
|
|
70552
72503
|
return { range: { start: position, end: position }, newText, annotationId: annotation };
|
|
70553
72504
|
}
|
|
70554
72505
|
AnnotatedTextEdit2.insert = insert;
|
|
70555
|
-
function del(
|
|
70556
|
-
return { range, newText: "", annotationId: annotation };
|
|
72506
|
+
function del(range2, annotation) {
|
|
72507
|
+
return { range: range2, newText: "", annotationId: annotation };
|
|
70557
72508
|
}
|
|
70558
72509
|
AnnotatedTextEdit2.del = del;
|
|
70559
72510
|
function is2(value) {
|
|
@@ -70673,36 +72624,36 @@ var init_main = __esm({
|
|
|
70673
72624
|
return id;
|
|
70674
72625
|
}
|
|
70675
72626
|
}
|
|
70676
|
-
replace(
|
|
72627
|
+
replace(range2, newText, annotation) {
|
|
70677
72628
|
let edit;
|
|
70678
72629
|
let id;
|
|
70679
72630
|
if (annotation === void 0) {
|
|
70680
|
-
edit = TextEdit.replace(
|
|
72631
|
+
edit = TextEdit.replace(range2, newText);
|
|
70681
72632
|
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
70682
72633
|
id = annotation;
|
|
70683
|
-
edit = AnnotatedTextEdit.replace(
|
|
72634
|
+
edit = AnnotatedTextEdit.replace(range2, newText, annotation);
|
|
70684
72635
|
} else {
|
|
70685
72636
|
this.assertChangeAnnotations(this.changeAnnotations);
|
|
70686
72637
|
id = this.changeAnnotations.manage(annotation);
|
|
70687
|
-
edit = AnnotatedTextEdit.replace(
|
|
72638
|
+
edit = AnnotatedTextEdit.replace(range2, newText, id);
|
|
70688
72639
|
}
|
|
70689
72640
|
this.edits.push(edit);
|
|
70690
72641
|
if (id !== void 0) {
|
|
70691
72642
|
return id;
|
|
70692
72643
|
}
|
|
70693
72644
|
}
|
|
70694
|
-
delete(
|
|
72645
|
+
delete(range2, annotation) {
|
|
70695
72646
|
let edit;
|
|
70696
72647
|
let id;
|
|
70697
72648
|
if (annotation === void 0) {
|
|
70698
|
-
edit = TextEdit.del(
|
|
72649
|
+
edit = TextEdit.del(range2);
|
|
70699
72650
|
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
70700
72651
|
id = annotation;
|
|
70701
|
-
edit = AnnotatedTextEdit.del(
|
|
72652
|
+
edit = AnnotatedTextEdit.del(range2, annotation);
|
|
70702
72653
|
} else {
|
|
70703
72654
|
this.assertChangeAnnotations(this.changeAnnotations);
|
|
70704
72655
|
id = this.changeAnnotations.manage(annotation);
|
|
70705
|
-
edit = AnnotatedTextEdit.del(
|
|
72656
|
+
edit = AnnotatedTextEdit.del(range2, id);
|
|
70706
72657
|
}
|
|
70707
72658
|
this.edits.push(edit);
|
|
70708
72659
|
if (id !== void 0) {
|
|
@@ -71165,8 +73116,8 @@ var init_main = __esm({
|
|
|
71165
73116
|
DocumentHighlightKind2.Write = 3;
|
|
71166
73117
|
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
|
|
71167
73118
|
(function(DocumentHighlight2) {
|
|
71168
|
-
function create(
|
|
71169
|
-
const result2 = { range };
|
|
73119
|
+
function create(range2, kind) {
|
|
73120
|
+
const result2 = { range: range2 };
|
|
71170
73121
|
if (Is2.number(kind)) {
|
|
71171
73122
|
result2.kind = kind;
|
|
71172
73123
|
}
|
|
@@ -71206,11 +73157,11 @@ var init_main = __esm({
|
|
|
71206
73157
|
SymbolTag2.Deprecated = 1;
|
|
71207
73158
|
})(SymbolTag || (SymbolTag = {}));
|
|
71208
73159
|
(function(SymbolInformation2) {
|
|
71209
|
-
function create(name, kind,
|
|
73160
|
+
function create(name, kind, range2, uri, containerName) {
|
|
71210
73161
|
const result2 = {
|
|
71211
73162
|
name,
|
|
71212
73163
|
kind,
|
|
71213
|
-
location: { uri, range }
|
|
73164
|
+
location: { uri, range: range2 }
|
|
71214
73165
|
};
|
|
71215
73166
|
if (containerName) {
|
|
71216
73167
|
result2.containerName = containerName;
|
|
@@ -71220,18 +73171,18 @@ var init_main = __esm({
|
|
|
71220
73171
|
SymbolInformation2.create = create;
|
|
71221
73172
|
})(SymbolInformation || (SymbolInformation = {}));
|
|
71222
73173
|
(function(WorkspaceSymbol2) {
|
|
71223
|
-
function create(name, kind, uri,
|
|
71224
|
-
return
|
|
73174
|
+
function create(name, kind, uri, range2) {
|
|
73175
|
+
return range2 !== void 0 ? { name, kind, location: { uri, range: range2 } } : { name, kind, location: { uri } };
|
|
71225
73176
|
}
|
|
71226
73177
|
WorkspaceSymbol2.create = create;
|
|
71227
73178
|
})(WorkspaceSymbol || (WorkspaceSymbol = {}));
|
|
71228
73179
|
(function(DocumentSymbol2) {
|
|
71229
|
-
function create(name, detail, kind,
|
|
73180
|
+
function create(name, detail, kind, range2, selectionRange, children) {
|
|
71230
73181
|
const result2 = {
|
|
71231
73182
|
name,
|
|
71232
73183
|
detail,
|
|
71233
73184
|
kind,
|
|
71234
|
-
range,
|
|
73185
|
+
range: range2,
|
|
71235
73186
|
selectionRange
|
|
71236
73187
|
};
|
|
71237
73188
|
if (children !== void 0) {
|
|
@@ -71313,8 +73264,8 @@ var init_main = __esm({
|
|
|
71313
73264
|
CodeAction2.is = is2;
|
|
71314
73265
|
})(CodeAction || (CodeAction = {}));
|
|
71315
73266
|
(function(CodeLens2) {
|
|
71316
|
-
function create(
|
|
71317
|
-
const result2 = { range };
|
|
73267
|
+
function create(range2, data2) {
|
|
73268
|
+
const result2 = { range: range2 };
|
|
71318
73269
|
if (Is2.defined(data2)) {
|
|
71319
73270
|
result2.data = data2;
|
|
71320
73271
|
}
|
|
@@ -71339,8 +73290,8 @@ var init_main = __esm({
|
|
|
71339
73290
|
FormattingOptions2.is = is2;
|
|
71340
73291
|
})(FormattingOptions || (FormattingOptions = {}));
|
|
71341
73292
|
(function(DocumentLink2) {
|
|
71342
|
-
function create(
|
|
71343
|
-
return { range, target, data: data2 };
|
|
73293
|
+
function create(range2, target, data2) {
|
|
73294
|
+
return { range: range2, target, data: data2 };
|
|
71344
73295
|
}
|
|
71345
73296
|
DocumentLink2.create = create;
|
|
71346
73297
|
function is2(value) {
|
|
@@ -71350,8 +73301,8 @@ var init_main = __esm({
|
|
|
71350
73301
|
DocumentLink2.is = is2;
|
|
71351
73302
|
})(DocumentLink || (DocumentLink = {}));
|
|
71352
73303
|
(function(SelectionRange2) {
|
|
71353
|
-
function create(
|
|
71354
|
-
return { range, parent };
|
|
73304
|
+
function create(range2, parent) {
|
|
73305
|
+
return { range: range2, parent };
|
|
71355
73306
|
}
|
|
71356
73307
|
SelectionRange2.create = create;
|
|
71357
73308
|
function is2(value) {
|
|
@@ -71406,8 +73357,8 @@ var init_main = __esm({
|
|
|
71406
73357
|
SemanticTokens2.is = is2;
|
|
71407
73358
|
})(SemanticTokens || (SemanticTokens = {}));
|
|
71408
73359
|
(function(InlineValueText2) {
|
|
71409
|
-
function create(
|
|
71410
|
-
return { range, text: text3 };
|
|
73360
|
+
function create(range2, text3) {
|
|
73361
|
+
return { range: range2, text: text3 };
|
|
71411
73362
|
}
|
|
71412
73363
|
InlineValueText2.create = create;
|
|
71413
73364
|
function is2(value) {
|
|
@@ -71417,8 +73368,8 @@ var init_main = __esm({
|
|
|
71417
73368
|
InlineValueText2.is = is2;
|
|
71418
73369
|
})(InlineValueText || (InlineValueText = {}));
|
|
71419
73370
|
(function(InlineValueVariableLookup2) {
|
|
71420
|
-
function create(
|
|
71421
|
-
return { range, variableName, caseSensitiveLookup };
|
|
73371
|
+
function create(range2, variableName, caseSensitiveLookup) {
|
|
73372
|
+
return { range: range2, variableName, caseSensitiveLookup };
|
|
71422
73373
|
}
|
|
71423
73374
|
InlineValueVariableLookup2.create = create;
|
|
71424
73375
|
function is2(value) {
|
|
@@ -71428,8 +73379,8 @@ var init_main = __esm({
|
|
|
71428
73379
|
InlineValueVariableLookup2.is = is2;
|
|
71429
73380
|
})(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
|
|
71430
73381
|
(function(InlineValueEvaluatableExpression2) {
|
|
71431
|
-
function create(
|
|
71432
|
-
return { range, expression };
|
|
73382
|
+
function create(range2, expression) {
|
|
73383
|
+
return { range: range2, expression };
|
|
71433
73384
|
}
|
|
71434
73385
|
InlineValueEvaluatableExpression2.create = create;
|
|
71435
73386
|
function is2(value) {
|
|
@@ -71495,8 +73446,8 @@ var init_main = __esm({
|
|
|
71495
73446
|
StringValue2.isSnippet = isSnippet;
|
|
71496
73447
|
})(StringValue || (StringValue = {}));
|
|
71497
73448
|
(function(InlineCompletionItem2) {
|
|
71498
|
-
function create(insertText, filterText,
|
|
71499
|
-
return { insertText, filterText, range, command };
|
|
73449
|
+
function create(insertText, filterText, range2, command) {
|
|
73450
|
+
return { insertText, filterText, range: range2, command };
|
|
71500
73451
|
}
|
|
71501
73452
|
InlineCompletionItem2.create = create;
|
|
71502
73453
|
})(InlineCompletionItem || (InlineCompletionItem = {}));
|
|
@@ -71511,8 +73462,8 @@ var init_main = __esm({
|
|
|
71511
73462
|
InlineCompletionTriggerKind2.Automatic = 2;
|
|
71512
73463
|
})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
|
|
71513
73464
|
(function(SelectedCompletionInfo2) {
|
|
71514
|
-
function create(
|
|
71515
|
-
return { range, text: text3 };
|
|
73465
|
+
function create(range2, text3) {
|
|
73466
|
+
return { range: range2, text: text3 };
|
|
71516
73467
|
}
|
|
71517
73468
|
SelectedCompletionInfo2.create = create;
|
|
71518
73469
|
})(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
|
|
@@ -71610,10 +73561,10 @@ var init_main = __esm({
|
|
|
71610
73561
|
get version() {
|
|
71611
73562
|
return this._version;
|
|
71612
73563
|
}
|
|
71613
|
-
getText(
|
|
71614
|
-
if (
|
|
71615
|
-
const start = this.offsetAt(
|
|
71616
|
-
const end = this.offsetAt(
|
|
73564
|
+
getText(range2) {
|
|
73565
|
+
if (range2) {
|
|
73566
|
+
const start = this.offsetAt(range2.start);
|
|
73567
|
+
const end = this.offsetAt(range2.end);
|
|
71617
73568
|
return this._content.substring(start, end);
|
|
71618
73569
|
}
|
|
71619
73570
|
return this._content;
|
|
@@ -75411,7 +77362,7 @@ var require_server = __commonJS({
|
|
|
75411
77362
|
};
|
|
75412
77363
|
}
|
|
75413
77364
|
function combineFeatures(one, two) {
|
|
75414
|
-
function
|
|
77365
|
+
function combine2(one2, two2, func) {
|
|
75415
77366
|
if (one2 && two2) {
|
|
75416
77367
|
return func(one2, two2);
|
|
75417
77368
|
} else if (one2) {
|
|
@@ -75422,14 +77373,14 @@ var require_server = __commonJS({
|
|
|
75422
77373
|
}
|
|
75423
77374
|
const result2 = {
|
|
75424
77375
|
__brand: "features",
|
|
75425
|
-
console:
|
|
75426
|
-
tracer:
|
|
75427
|
-
telemetry:
|
|
75428
|
-
client:
|
|
75429
|
-
window:
|
|
75430
|
-
workspace:
|
|
75431
|
-
languages:
|
|
75432
|
-
notebooks:
|
|
77376
|
+
console: combine2(one.console, two.console, combineConsoleFeatures),
|
|
77377
|
+
tracer: combine2(one.tracer, two.tracer, combineTracerFeatures),
|
|
77378
|
+
telemetry: combine2(one.telemetry, two.telemetry, combineTelemetryFeatures),
|
|
77379
|
+
client: combine2(one.client, two.client, combineClientFeatures),
|
|
77380
|
+
window: combine2(one.window, two.window, combineWindowFeatures),
|
|
77381
|
+
workspace: combine2(one.workspace, two.workspace, combineWorkspaceFeatures),
|
|
77382
|
+
languages: combine2(one.languages, two.languages, combineLanguagesFeatures),
|
|
77383
|
+
notebooks: combine2(one.notebooks, two.notebooks, combineNotebooksFeatures)
|
|
75433
77384
|
};
|
|
75434
77385
|
return result2;
|
|
75435
77386
|
}
|
|
@@ -75739,7 +77690,7 @@ var require_files = __commonJS({
|
|
|
75739
77690
|
exports.resolveGlobalYarnPath = resolveGlobalYarnPath;
|
|
75740
77691
|
exports.resolveModulePath = resolveModulePath;
|
|
75741
77692
|
var url2 = __importStar(__require("url"));
|
|
75742
|
-
var
|
|
77693
|
+
var path2 = __importStar(__require("path"));
|
|
75743
77694
|
var fs2 = __importStar(__require("fs"));
|
|
75744
77695
|
var child_process_1 = __require("child_process");
|
|
75745
77696
|
function uriToFilePath(uri) {
|
|
@@ -75758,7 +77709,7 @@ var require_files = __commonJS({
|
|
|
75758
77709
|
segments.shift();
|
|
75759
77710
|
}
|
|
75760
77711
|
}
|
|
75761
|
-
return
|
|
77712
|
+
return path2.normalize(segments.join("/"));
|
|
75762
77713
|
}
|
|
75763
77714
|
function isWindows() {
|
|
75764
77715
|
return process.platform === "win32";
|
|
@@ -75788,7 +77739,7 @@ var require_files = __commonJS({
|
|
|
75788
77739
|
Object.keys(env).forEach((key) => newEnv[key] = env[key]);
|
|
75789
77740
|
if (nodePath && fs2.existsSync(nodePath)) {
|
|
75790
77741
|
if (newEnv[nodePathKey]) {
|
|
75791
|
-
newEnv[nodePathKey] = nodePath +
|
|
77742
|
+
newEnv[nodePathKey] = nodePath + path2.delimiter + newEnv[nodePathKey];
|
|
75792
77743
|
} else {
|
|
75793
77744
|
newEnv[nodePathKey] = nodePath;
|
|
75794
77745
|
}
|
|
@@ -75860,9 +77811,9 @@ var require_files = __commonJS({
|
|
|
75860
77811
|
}
|
|
75861
77812
|
if (prefix.length > 0) {
|
|
75862
77813
|
if (isWindows()) {
|
|
75863
|
-
return
|
|
77814
|
+
return path2.join(prefix, "node_modules");
|
|
75864
77815
|
} else {
|
|
75865
|
-
return
|
|
77816
|
+
return path2.join(prefix, "lib", "node_modules");
|
|
75866
77817
|
}
|
|
75867
77818
|
}
|
|
75868
77819
|
return void 0;
|
|
@@ -75901,7 +77852,7 @@ var require_files = __commonJS({
|
|
|
75901
77852
|
try {
|
|
75902
77853
|
const yarn = JSON.parse(line);
|
|
75903
77854
|
if (yarn.type === "log") {
|
|
75904
|
-
return
|
|
77855
|
+
return path2.join(yarn.data, "node_modules");
|
|
75905
77856
|
}
|
|
75906
77857
|
} catch (e) {
|
|
75907
77858
|
}
|
|
@@ -75930,17 +77881,17 @@ var require_files = __commonJS({
|
|
|
75930
77881
|
FileSystem2.isCaseSensitive = isCaseSensitive;
|
|
75931
77882
|
function isParent(parent, child) {
|
|
75932
77883
|
if (isCaseSensitive()) {
|
|
75933
|
-
return
|
|
77884
|
+
return path2.normalize(child).indexOf(path2.normalize(parent)) === 0;
|
|
75934
77885
|
} else {
|
|
75935
|
-
return
|
|
77886
|
+
return path2.normalize(child).toLowerCase().indexOf(path2.normalize(parent).toLowerCase()) === 0;
|
|
75936
77887
|
}
|
|
75937
77888
|
}
|
|
75938
77889
|
FileSystem2.isParent = isParent;
|
|
75939
77890
|
})(FileSystem || (exports.FileSystem = FileSystem = {}));
|
|
75940
77891
|
function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {
|
|
75941
77892
|
if (nodePath) {
|
|
75942
|
-
if (!
|
|
75943
|
-
nodePath =
|
|
77893
|
+
if (!path2.isAbsolute(nodePath)) {
|
|
77894
|
+
nodePath = path2.join(workspaceRoot, nodePath);
|
|
75944
77895
|
}
|
|
75945
77896
|
return resolve7(moduleName, nodePath, nodePath, tracer).then((value) => {
|
|
75946
77897
|
if (FileSystem.isParent(nodePath, value)) {
|
|
@@ -76173,7 +78124,7 @@ var require_main = __commonJS({
|
|
|
76173
78124
|
exports.createMessageConnection = createMessageConnection;
|
|
76174
78125
|
var ril_1 = __importDefault(require_ril());
|
|
76175
78126
|
ril_1.default.install();
|
|
76176
|
-
var
|
|
78127
|
+
var path2 = __importStar(__require("path"));
|
|
76177
78128
|
var os2 = __importStar(__require("os"));
|
|
76178
78129
|
var fs2 = __importStar(__require("fs"));
|
|
76179
78130
|
var crypto_1 = __require("crypto");
|
|
@@ -76325,7 +78276,7 @@ var require_main = __commonJS({
|
|
|
76325
78276
|
throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
|
|
76326
78277
|
}
|
|
76327
78278
|
const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString("hex");
|
|
76328
|
-
return
|
|
78279
|
+
return path2.join(tmpDir, `lsp-${randomSuffix}.sock`);
|
|
76329
78280
|
}
|
|
76330
78281
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
76331
78282
|
let connectResolve;
|
|
@@ -76825,18 +78776,18 @@ function computeLineOffsets(text3, isAtLineStart, textOffset = 0) {
|
|
|
76825
78776
|
function isEOL(char) {
|
|
76826
78777
|
return char === 13 || char === 10;
|
|
76827
78778
|
}
|
|
76828
|
-
function getWellformedRange(
|
|
76829
|
-
const start =
|
|
76830
|
-
const end =
|
|
78779
|
+
function getWellformedRange(range2) {
|
|
78780
|
+
const start = range2.start;
|
|
78781
|
+
const end = range2.end;
|
|
76831
78782
|
if (start.line > end.line || start.line === end.line && start.character > end.character) {
|
|
76832
78783
|
return { start: end, end: start };
|
|
76833
78784
|
}
|
|
76834
|
-
return
|
|
78785
|
+
return range2;
|
|
76835
78786
|
}
|
|
76836
78787
|
function getWellformedEdit(textEdit) {
|
|
76837
|
-
const
|
|
76838
|
-
if (
|
|
76839
|
-
return { newText: textEdit.newText, range };
|
|
78788
|
+
const range2 = getWellformedRange(textEdit.range);
|
|
78789
|
+
if (range2 !== textEdit.range) {
|
|
78790
|
+
return { newText: textEdit.newText, range: range2 };
|
|
76840
78791
|
}
|
|
76841
78792
|
return textEdit;
|
|
76842
78793
|
}
|
|
@@ -76861,10 +78812,10 @@ var init_main2 = __esm({
|
|
|
76861
78812
|
get version() {
|
|
76862
78813
|
return this._version;
|
|
76863
78814
|
}
|
|
76864
|
-
getText(
|
|
76865
|
-
if (
|
|
76866
|
-
const start = this.offsetAt(
|
|
76867
|
-
const end = this.offsetAt(
|
|
78815
|
+
getText(range2) {
|
|
78816
|
+
if (range2) {
|
|
78817
|
+
const start = this.offsetAt(range2.start);
|
|
78818
|
+
const end = this.offsetAt(range2.end);
|
|
76868
78819
|
return this._content.substring(start, end);
|
|
76869
78820
|
}
|
|
76870
78821
|
return this._content;
|
|
@@ -76872,12 +78823,12 @@ var init_main2 = __esm({
|
|
|
76872
78823
|
update(changes, version2) {
|
|
76873
78824
|
for (const change of changes) {
|
|
76874
78825
|
if (_FullTextDocument.isIncremental(change)) {
|
|
76875
|
-
const
|
|
76876
|
-
const startOffset = this.offsetAt(
|
|
76877
|
-
const endOffset = this.offsetAt(
|
|
78826
|
+
const range2 = getWellformedRange(change.range);
|
|
78827
|
+
const startOffset = this.offsetAt(range2.start);
|
|
78828
|
+
const endOffset = this.offsetAt(range2.end);
|
|
76878
78829
|
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
|
|
76879
|
-
const startLine = Math.max(
|
|
76880
|
-
const endLine = Math.max(
|
|
78830
|
+
const startLine = Math.max(range2.start.line, 0);
|
|
78831
|
+
const endLine = Math.max(range2.end.line, 0);
|
|
76881
78832
|
let lineOffsets = this._lineOffsets;
|
|
76882
78833
|
const addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
|
|
76883
78834
|
if (endLine - startLine === addedLineOffsets.length) {
|
|
@@ -77358,8 +79309,8 @@ function getCompletions(uri, position, triggerChar, workspace) {
|
|
|
77358
79309
|
const { passage, content: content2, at: at3 } = cursor;
|
|
77359
79310
|
const before = cursor.lineBefore;
|
|
77360
79311
|
const editing = (items, start, end) => {
|
|
77361
|
-
const
|
|
77362
|
-
return items.map((item) => ({ ...item, textEdit: { range, newText: item.insertText ?? item.label } }));
|
|
79312
|
+
const range2 = passage.range(start, end);
|
|
79313
|
+
return items.map((item) => ({ ...item, textEdit: { range: range2, newText: item.insertText ?? item.label } }));
|
|
77363
79314
|
};
|
|
77364
79315
|
const typedEdit = (items, typed, tailPattern = /^[\w$]*/) => editing(items, at3 - typed, at3 + tailPattern.exec(content2.slice(at3))[0].length);
|
|
77365
79316
|
const head = cursor.headBeingTyped();
|
|
@@ -77367,6 +79318,9 @@ function getCompletions(uri, position, triggerChar, workspace) {
|
|
|
77367
79318
|
const tail = /^[\w-]*\}?/.exec(content2.slice(at3))[0].length;
|
|
77368
79319
|
return editing(getClosingMacroCompletions(cursor, head.brace), head.brace, at3 + tail);
|
|
77369
79320
|
}
|
|
79321
|
+
const target = cursor.linkTarget();
|
|
79322
|
+
if (target) return editing(getPassageNameCompletions(workspace), target.start, target.end);
|
|
79323
|
+
if (head && !head.typed.startsWith("_")) return typedEdit(getMacroCompletions(workspace), head.typed.length, /^[\w-]*/);
|
|
77370
79324
|
const dotPath = /([$%])([\w$]+)\.([A-Za-z_$][\w$]*)?$/.exec(before);
|
|
77371
79325
|
if (dotPath) {
|
|
77372
79326
|
const sigil = dotPath[1];
|
|
@@ -77400,9 +79354,6 @@ function getCompletions(uri, position, triggerChar, workspace) {
|
|
|
77400
79354
|
if (transientVar) {
|
|
77401
79355
|
return typedEdit(getVariableCompletions("%", workspace), transientVar[1].length);
|
|
77402
79356
|
}
|
|
77403
|
-
const target = cursor.linkTarget();
|
|
77404
|
-
if (target) return editing(getPassageNameCompletions(workspace), target.start, target.end);
|
|
77405
|
-
if (head) return typedEdit(getMacroCompletions(workspace), head.typed.length, /^[\w-]*/);
|
|
77406
79357
|
return [];
|
|
77407
79358
|
}
|
|
77408
79359
|
function getClosingMacroCompletions(cursor, brace) {
|
|
@@ -77538,7 +79489,7 @@ function getHoverInfo(uri, position, workspace) {
|
|
|
77538
79489
|
function getMacroHover(passage, at3, workspace) {
|
|
77539
79490
|
for (const macro of macroTokens(passage)) {
|
|
77540
79491
|
if (at3 < macro.nameStart || at3 > macro.nameEnd) continue;
|
|
77541
|
-
const
|
|
79492
|
+
const range2 = passage.range(macro.nameStart, macro.nameEnd);
|
|
77542
79493
|
const info = workspace.macros.getMacro(macro.name);
|
|
77543
79494
|
if (info) {
|
|
77544
79495
|
const parts = [];
|
|
@@ -77549,10 +79500,10 @@ function getMacroHover(passage, at3, workspace) {
|
|
|
77549
79500
|
if (info.parameters && info.parameters.length > 0) {
|
|
77550
79501
|
parts.push("", `Parameters: \`${info.parameters.join(" ")}\``);
|
|
77551
79502
|
}
|
|
77552
|
-
return { contents: parts.join("\n"), range };
|
|
79503
|
+
return { contents: parts.join("\n"), range: range2 };
|
|
77553
79504
|
}
|
|
77554
79505
|
const widget = workspace.widgets.getWidget(macro.name);
|
|
77555
|
-
if (widget) return buildWidgetHover(widget,
|
|
79506
|
+
if (widget) return buildWidgetHover(widget, range2);
|
|
77556
79507
|
}
|
|
77557
79508
|
return null;
|
|
77558
79509
|
}
|
|
@@ -77569,7 +79520,7 @@ Fields: ${fields.map((f) => `\`${f}\``).join(", ")}` : "";
|
|
|
77569
79520
|
range: passage.range(use.start, use.end)
|
|
77570
79521
|
};
|
|
77571
79522
|
}
|
|
77572
|
-
function buildWidgetHover(widget,
|
|
79523
|
+
function buildWidgetHover(widget, range2) {
|
|
77573
79524
|
const sig = widget.params.length > 0 ? widget.params.join(", ") : "no parameters";
|
|
77574
79525
|
return {
|
|
77575
79526
|
contents: `**Widget** \`${widget.name}\`
|
|
@@ -77577,7 +79528,7 @@ function buildWidgetHover(widget, range) {
|
|
|
77577
79528
|
Parameters: ${sig}
|
|
77578
79529
|
|
|
77579
79530
|
Defined in: \`${widget.uri}\``,
|
|
77580
|
-
range
|
|
79531
|
+
range: range2
|
|
77581
79532
|
};
|
|
77582
79533
|
}
|
|
77583
79534
|
function toLspRange(r) {
|
|
@@ -77997,7 +79948,7 @@ function findTransientReferences(varName, workspace, includeDeclaration) {
|
|
|
77997
79948
|
}
|
|
77998
79949
|
return results;
|
|
77999
79950
|
}
|
|
78000
|
-
function findWidgetReferences(widgetName2, workspace, includeDeclaration) {
|
|
79951
|
+
function findWidgetReferences(widgetName2, workspace, includeDeclaration, includeClosingTags = true) {
|
|
78001
79952
|
const locations = [];
|
|
78002
79953
|
const widget = workspace.widgets.getWidget(widgetName2);
|
|
78003
79954
|
if (includeDeclaration && widget) {
|
|
@@ -78010,7 +79961,7 @@ function findWidgetReferences(widgetName2, workspace, includeDeclaration) {
|
|
|
78010
79961
|
const doc = workspace.markup.get(docUri);
|
|
78011
79962
|
if (!doc) continue;
|
|
78012
79963
|
for (const head of documentMacroHeads(doc)) {
|
|
78013
|
-
if (head.closing && !isBlock) continue;
|
|
79964
|
+
if (head.closing && (!isBlock || !includeClosingTags)) continue;
|
|
78014
79965
|
if (head.name.toLowerCase() === lowerName2) {
|
|
78015
79966
|
locations.push({ uri: docUri, range: head.range });
|
|
78016
79967
|
}
|
|
@@ -78084,9 +80035,9 @@ function computeRename(uri, position, newName, workspace) {
|
|
|
78084
80035
|
const symbol2 = resolveSymbolAtCursor(uri, position, workspace);
|
|
78085
80036
|
if (!symbol2) return /* @__PURE__ */ new Map();
|
|
78086
80037
|
const edits = /* @__PURE__ */ new Map();
|
|
78087
|
-
function addEdit(editUri,
|
|
80038
|
+
function addEdit(editUri, range2, text3) {
|
|
78088
80039
|
const existing = edits.get(editUri) ?? [];
|
|
78089
|
-
existing.push({ range, newText: text3 });
|
|
80040
|
+
existing.push({ range: range2, newText: text3 });
|
|
78090
80041
|
edits.set(editUri, existing);
|
|
78091
80042
|
}
|
|
78092
80043
|
switch (symbol2.kind) {
|
|
@@ -78322,12 +80273,12 @@ var init_rename = __esm({
|
|
|
78322
80273
|
uri;
|
|
78323
80274
|
range;
|
|
78324
80275
|
/** The same error, naming the 1-based position it concerns. */
|
|
78325
|
-
at(uri,
|
|
80276
|
+
at(uri, range2) {
|
|
78326
80277
|
const located = new _RenameError(
|
|
78327
|
-
`${this.message} (at ${uri}:${
|
|
80278
|
+
`${this.message} (at ${uri}:${range2.start.line + 1}:${range2.start.character + 1})`
|
|
78328
80279
|
);
|
|
78329
80280
|
located.uri = uri;
|
|
78330
|
-
located.range =
|
|
80281
|
+
located.range = range2;
|
|
78331
80282
|
return located;
|
|
78332
80283
|
}
|
|
78333
80284
|
};
|
|
@@ -78386,6 +80337,15 @@ function computeCodeLenses(uri, workspace) {
|
|
|
78386
80337
|
if (text3 === void 0) return [];
|
|
78387
80338
|
const lines = splitLines(text3);
|
|
78388
80339
|
const lenses = [];
|
|
80340
|
+
const addLens = (line, title) => {
|
|
80341
|
+
lenses.push({
|
|
80342
|
+
range: {
|
|
80343
|
+
start: { line, character: 0 },
|
|
80344
|
+
end: { line, character: lines[line].length }
|
|
80345
|
+
},
|
|
80346
|
+
command: { title }
|
|
80347
|
+
});
|
|
80348
|
+
};
|
|
78389
80349
|
const storyVarsPassage = workspace.passages.getStoryVariables();
|
|
78390
80350
|
const widgetLines = new Map(workspace.widgets.getAllWidgets().filter((w) => w.uri === uri).map((w) => [w.range.start.line, w.name]));
|
|
78391
80351
|
for (let lineNum = 0; lineNum < lines.length; lineNum++) {
|
|
@@ -78395,46 +80355,20 @@ function computeCodeLenses(uri, workspace) {
|
|
|
78395
80355
|
const passageName = header.name;
|
|
78396
80356
|
if (passageName === "StoryData") continue;
|
|
78397
80357
|
const refCount = findPassageReferences(passageName, workspace, false).length;
|
|
78398
|
-
|
|
78399
|
-
range: {
|
|
78400
|
-
start: { line: lineNum, character: 0 },
|
|
78401
|
-
end: { line: lineNum, character: line.length }
|
|
78402
|
-
},
|
|
78403
|
-
command: {
|
|
78404
|
-
title: `${refCount} reference${refCount !== 1 ? "s" : ""}`
|
|
78405
|
-
}
|
|
78406
|
-
});
|
|
80358
|
+
addLens(lineNum, `${refCount} reference${refCount !== 1 ? "s" : ""}`);
|
|
78407
80359
|
continue;
|
|
78408
80360
|
}
|
|
78409
80361
|
const widgetName2 = widgetLines.get(lineNum);
|
|
78410
80362
|
if (widgetName2 !== void 0) {
|
|
78411
|
-
const
|
|
78412
|
-
|
|
78413
|
-
lenses.push({
|
|
78414
|
-
range: {
|
|
78415
|
-
start: { line: lineNum, character: 0 },
|
|
78416
|
-
end: { line: lineNum, character: line.length }
|
|
78417
|
-
},
|
|
78418
|
-
command: {
|
|
78419
|
-
title: `${usageCount} usage${usageCount !== 1 ? "s" : ""}`
|
|
78420
|
-
}
|
|
78421
|
-
});
|
|
80363
|
+
const usageCount = findWidgetReferences(widgetName2, workspace, false, false).length;
|
|
80364
|
+
addLens(lineNum, `${usageCount} usage${usageCount !== 1 ? "s" : ""}`);
|
|
78422
80365
|
}
|
|
78423
80366
|
if (storyVarsPassage && storyVarsPassage.uri === uri && lineNum > storyVarsPassage.range.start.line && lineNum <= storyVarsPassage.range.end.line) {
|
|
78424
80367
|
const varDeclMatch = line.match(/^\$(\w+)\s*=/);
|
|
78425
80368
|
if (varDeclMatch) {
|
|
78426
80369
|
const varName = varDeclMatch[1];
|
|
78427
|
-
const
|
|
78428
|
-
|
|
78429
|
-
lenses.push({
|
|
78430
|
-
range: {
|
|
78431
|
-
start: { line: lineNum, character: 0 },
|
|
78432
|
-
end: { line: lineNum, character: line.length }
|
|
78433
|
-
},
|
|
78434
|
-
command: {
|
|
78435
|
-
title: `${usageCount} usage${usageCount !== 1 ? "s" : ""}`
|
|
78436
|
-
}
|
|
78437
|
-
});
|
|
80370
|
+
const usageCount = findVariableReferences(varName, workspace, false).length;
|
|
80371
|
+
addLens(lineNum, `${usageCount} usage${usageCount !== 1 ? "s" : ""}`);
|
|
78438
80372
|
}
|
|
78439
80373
|
}
|
|
78440
80374
|
}
|
|
@@ -78478,11 +80412,11 @@ var init_code_lens = __esm({
|
|
|
78478
80412
|
});
|
|
78479
80413
|
|
|
78480
80414
|
// src/plugins/inlay-hints.ts
|
|
78481
|
-
function computeInlayHints(uri,
|
|
80415
|
+
function computeInlayHints(uri, range2, workspace) {
|
|
78482
80416
|
const markup = workspace.markup.get(uri);
|
|
78483
80417
|
if (markup === void 0) return [];
|
|
78484
80418
|
const hints = [];
|
|
78485
|
-
const inRange = (line) => line >=
|
|
80419
|
+
const inRange = (line) => line >= range2.start.line && line <= range2.end.line;
|
|
78486
80420
|
addWidgetParamHints(markup.passages, inRange, workspace, hints);
|
|
78487
80421
|
addTypeHints(workspace.passages.getStoryVariables(), markup.passages, inRange, hints);
|
|
78488
80422
|
addTypeHints(workspace.passages.getStoryTransients(), markup.passages, inRange, hints);
|
|
@@ -78538,11 +80472,11 @@ var init_inlay_hints = __esm({
|
|
|
78538
80472
|
},
|
|
78539
80473
|
initialize(ctx) {
|
|
78540
80474
|
ctx.connection.languages.inlayHint.on((params) => {
|
|
78541
|
-
const
|
|
80475
|
+
const range2 = {
|
|
78542
80476
|
start: { line: params.range.start.line, character: params.range.start.character },
|
|
78543
80477
|
end: { line: params.range.end.line, character: params.range.end.character }
|
|
78544
80478
|
};
|
|
78545
|
-
const hints = computeInlayHints(params.textDocument.uri,
|
|
80479
|
+
const hints = computeInlayHints(params.textDocument.uri, range2, ctx.workspace);
|
|
78546
80480
|
return hints.map((h) => ({
|
|
78547
80481
|
position: { line: h.position.line, character: h.position.character },
|
|
78548
80482
|
label: h.label,
|
|
@@ -78573,12 +80507,12 @@ function computeSemanticTokensAbsolute(uri, workspace) {
|
|
|
78573
80507
|
if (!doc || doc.passages.length === 0) return [];
|
|
78574
80508
|
const tokens2 = [];
|
|
78575
80509
|
const push2 = (passage, start, end, tokenType, modifiers) => {
|
|
78576
|
-
const
|
|
78577
|
-
if (
|
|
80510
|
+
const range2 = passage.range(start, end);
|
|
80511
|
+
if (range2.start.line !== range2.end.line) return;
|
|
78578
80512
|
tokens2.push({
|
|
78579
|
-
line:
|
|
78580
|
-
startChar:
|
|
78581
|
-
length:
|
|
80513
|
+
line: range2.start.line,
|
|
80514
|
+
startChar: range2.start.character,
|
|
80515
|
+
length: range2.end.character - range2.start.character,
|
|
78582
80516
|
tokenType: encodeType(tokenType),
|
|
78583
80517
|
tokenModifiers: encodeModifiers(modifiers)
|
|
78584
80518
|
});
|
|
@@ -78695,7 +80629,7 @@ var init_semantic_tokens = __esm({
|
|
|
78695
80629
|
|
|
78696
80630
|
// src/plugins/code-actions.ts
|
|
78697
80631
|
import { readFileSync as readFileSync7 } from "node:fs";
|
|
78698
|
-
import { basename, dirname as
|
|
80632
|
+
import { basename as basename2, dirname as dirname5, join as join4 } from "node:path";
|
|
78699
80633
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL5 } from "node:url";
|
|
78700
80634
|
function computeCodeActions(uri, diagnostics, workspace, options = {}) {
|
|
78701
80635
|
const actions = [];
|
|
@@ -78749,7 +80683,7 @@ function addMacroToConfig(uri, macroName, workspace, options) {
|
|
|
78749
80683
|
const configPath = existingPath ?? join4(root, DEFAULT_CONFIG_FILENAME);
|
|
78750
80684
|
const configUri = pathToFileURL5(configPath).toString();
|
|
78751
80685
|
const action = {
|
|
78752
|
-
title: `Add '${macroName}' to ${
|
|
80686
|
+
title: `Add '${macroName}' to ${basename2(configPath)}`,
|
|
78753
80687
|
kind: "quickfix",
|
|
78754
80688
|
diagnosticCodes: [DiagnosticCode.UndefinedMacro]
|
|
78755
80689
|
};
|
|
@@ -78761,7 +80695,7 @@ function addMacroToConfig(uri, macroName, workspace, options) {
|
|
|
78761
80695
|
edits: [{
|
|
78762
80696
|
uri: configUri,
|
|
78763
80697
|
range: { start, end: start },
|
|
78764
|
-
newText: (0,
|
|
80698
|
+
newText: (0, import_yaml3.stringify)({ macros: { [macroName]: NEW_MACRO_ENTRY } })
|
|
78765
80699
|
}]
|
|
78766
80700
|
};
|
|
78767
80701
|
}
|
|
@@ -78782,11 +80716,11 @@ function resolveConfigRoot(uri, workspaceRoot) {
|
|
|
78782
80716
|
return workspaceRoot.startsWith("file:") ? fileURLToPath4(workspaceRoot) : workspaceRoot;
|
|
78783
80717
|
}
|
|
78784
80718
|
if (!uri.startsWith("file:")) return null;
|
|
78785
|
-
const docDir =
|
|
80719
|
+
const docDir = dirname5(fileURLToPath4(uri));
|
|
78786
80720
|
let search2 = docDir;
|
|
78787
80721
|
for (let i2 = 0; i2 < 10; i2++) {
|
|
78788
80722
|
if (findConfigFile(search2)) return search2;
|
|
78789
|
-
const parent =
|
|
80723
|
+
const parent = dirname5(search2);
|
|
78790
80724
|
if (parent === search2) break;
|
|
78791
80725
|
search2 = parent;
|
|
78792
80726
|
}
|
|
@@ -78802,20 +80736,20 @@ function definesMacro(macros, macroName) {
|
|
|
78802
80736
|
return Object.keys(macros).some((k2) => k2.toLowerCase() === lower);
|
|
78803
80737
|
}
|
|
78804
80738
|
function addMacroToYamlConfig(text3, macroName) {
|
|
78805
|
-
const doc = (0,
|
|
80739
|
+
const doc = (0, import_yaml3.parseDocument)(text3);
|
|
78806
80740
|
if (doc.errors.length > 0) return null;
|
|
78807
|
-
if (doc.contents !== null && !(0,
|
|
78808
|
-
const
|
|
78809
|
-
const parent =
|
|
78810
|
-
const macros = doc.getIn(
|
|
78811
|
-
if ((0,
|
|
78812
|
-
if ((0,
|
|
78813
|
-
const macrosKey = parent.items.find((p) => (0,
|
|
80741
|
+
if (doc.contents !== null && !(0, import_yaml3.isMap)(doc.contents)) return null;
|
|
80742
|
+
const path2 = macrosPath(doc.toJS());
|
|
80743
|
+
const parent = path2.length > 1 ? doc.getIn(path2.slice(0, -1), true) : doc.contents;
|
|
80744
|
+
const macros = doc.getIn(path2, true);
|
|
80745
|
+
if ((0, import_yaml3.isMap)(macros) && definesMacro(macros.toJS(doc), macroName)) return null;
|
|
80746
|
+
if ((0, import_yaml3.isMap)(parent) && (0, import_yaml3.isMap)(macros) && !macros.flow && macros.items.length > 0 && macros.range) {
|
|
80747
|
+
const macrosKey = parent.items.find((p) => (0, import_yaml3.isScalar)(p.key) && p.key.value === "macros")?.key;
|
|
78814
80748
|
const firstKey = macros.items[0].key;
|
|
78815
|
-
if ((0,
|
|
80749
|
+
if ((0, import_yaml3.isScalar)(macrosKey) && macrosKey.range && (0, import_yaml3.isScalar)(firstKey) && firstKey.range) {
|
|
78816
80750
|
const indent = columnOf2(text3, firstKey.range[0]);
|
|
78817
80751
|
const step = Math.max(indent - columnOf2(text3, macrosKey.range[0]), 1);
|
|
78818
|
-
const entry = (0,
|
|
80752
|
+
const entry = (0, import_yaml3.stringify)({ [macroName]: NEW_MACRO_ENTRY }, { indent: step }).replace(/^(?=.)/gm, " ".repeat(indent));
|
|
78819
80753
|
let offset2 = macros.range[1];
|
|
78820
80754
|
if (offset2 > 0 && text3[offset2 - 1] !== "\n") {
|
|
78821
80755
|
const nl = text3.indexOf("\n", offset2);
|
|
@@ -78826,10 +80760,10 @@ function addMacroToYamlConfig(text3, macroName) {
|
|
|
78826
80760
|
return { range: { start: pos, end: pos }, newText: lead + entry };
|
|
78827
80761
|
}
|
|
78828
80762
|
}
|
|
78829
|
-
if ((0,
|
|
80763
|
+
if ((0, import_yaml3.isMap)(macros)) {
|
|
78830
80764
|
macros.set(macroName, doc.createNode(NEW_MACRO_ENTRY));
|
|
78831
80765
|
} else {
|
|
78832
|
-
doc.setIn(
|
|
80766
|
+
doc.setIn(path2, doc.createNode({ [macroName]: NEW_MACRO_ENTRY }));
|
|
78833
80767
|
}
|
|
78834
80768
|
return minimalEdit(text3, doc.toString({ lineWidth: 0 }));
|
|
78835
80769
|
}
|
|
@@ -78841,8 +80775,8 @@ function addMacroToJsonConfig(text3, macroName) {
|
|
|
78841
80775
|
return null;
|
|
78842
80776
|
}
|
|
78843
80777
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
78844
|
-
const
|
|
78845
|
-
const container =
|
|
80778
|
+
const path2 = macrosPath(raw);
|
|
80779
|
+
const container = path2.length > 1 ? raw[path2[0]] : raw;
|
|
78846
80780
|
const macros = container.macros;
|
|
78847
80781
|
if (definesMacro(macros, macroName)) return null;
|
|
78848
80782
|
if (macros !== null && typeof macros === "object" && !Array.isArray(macros)) {
|
|
@@ -79024,11 +80958,11 @@ function toLspRange6(r) {
|
|
|
79024
80958
|
end: { line: r.end.line, character: r.end.character }
|
|
79025
80959
|
};
|
|
79026
80960
|
}
|
|
79027
|
-
var
|
|
80961
|
+
var import_yaml3, DEFAULT_CONFIG_FILENAME, NEW_MACRO_ENTRY, fixUndeclaredVariable, fixUndeclaredTransient, codeActionsPlugin;
|
|
79028
80962
|
var init_code_actions = __esm({
|
|
79029
80963
|
"src/plugins/code-actions.ts"() {
|
|
79030
80964
|
"use strict";
|
|
79031
|
-
|
|
80965
|
+
import_yaml3 = __toESM(require_dist(), 1);
|
|
79032
80966
|
init_diagnostic_codes();
|
|
79033
80967
|
init_config_loader();
|
|
79034
80968
|
init_story_variables_owner();
|
|
@@ -79406,7 +81340,7 @@ __export(server_exports2, {
|
|
|
79406
81340
|
});
|
|
79407
81341
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
79408
81342
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
79409
|
-
import { basename as
|
|
81343
|
+
import { basename as basename3 } from "node:path";
|
|
79410
81344
|
function uriToFsPath(uri) {
|
|
79411
81345
|
try {
|
|
79412
81346
|
return fileURLToPath5(uri);
|
|
@@ -79418,7 +81352,7 @@ function fsPathToUri(fsPath) {
|
|
|
79418
81352
|
return pathToFileURL6(fsPath).toString();
|
|
79419
81353
|
}
|
|
79420
81354
|
function isConfigFileUri(uri) {
|
|
79421
|
-
const name =
|
|
81355
|
+
const name = basename3(uriToFsPath(uri));
|
|
79422
81356
|
return name.startsWith("spindle.config.") || name.includes("twee-config.");
|
|
79423
81357
|
}
|
|
79424
81358
|
function startServer(args2) {
|
|
@@ -79658,7 +81592,8 @@ Options:
|
|
|
79658
81592
|
--help, -h Show this help message
|
|
79659
81593
|
--version, -v Show version number
|
|
79660
81594
|
|
|
79661
|
-
|
|
81595
|
+
Host trust environment:
|
|
81596
|
+
SPINDLE_LSP_TRUSTED_FORMAT=1 Allow executable Prettier configs and plugins (CLI, LSP and MCP)
|
|
79662
81597
|
SPINDLE_LSP_TRUSTED_PLAY=1 Allow trusted stories to access host files, environment and commands
|
|
79663
81598
|
|
|
79664
81599
|
Check options:
|