@megasaver/cli 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist-bundle/mega.mjs +733 -242
- package/package.json +3 -5
package/dist-bundle/mega.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import 'module';
|
|
|
12
12
|
import { readFileSync, mkdirSync, writeFileSync, openSync, fsyncSync, closeSync, renameSync, rmSync, existsSync, lstatSync, readdirSync, writeSync, appendFileSync, statSync, cpSync, readSync, realpathSync } from 'fs';
|
|
13
13
|
import { homedir } from 'os';
|
|
14
14
|
import { randomUUID, createHash } from 'crypto';
|
|
15
|
-
import { access, mkdir, writeFile, readFile, constants,
|
|
15
|
+
import { access, mkdir, writeFile, lstat, readFile, constants, stat, rename, rm, chmod, readdir } from 'fs/promises';
|
|
16
16
|
import { spawn } from 'child_process';
|
|
17
17
|
|
|
18
18
|
const require$1 = createRequire(import.meta.url);
|
|
@@ -4718,10 +4718,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
4718
4718
|
let offset = bm.offset;
|
|
4719
4719
|
let commentEnd = null;
|
|
4720
4720
|
for (const collItem of bm.items) {
|
|
4721
|
-
const { start, key, sep:
|
|
4721
|
+
const { start, key, sep: sep4, value } = collItem;
|
|
4722
4722
|
const keyProps = resolveProps.resolveProps(start, {
|
|
4723
4723
|
indicator: "explicit-key-ind",
|
|
4724
|
-
next: key ??
|
|
4724
|
+
next: key ?? sep4?.[0],
|
|
4725
4725
|
offset,
|
|
4726
4726
|
onError,
|
|
4727
4727
|
parentIndent: bm.indent,
|
|
@@ -4735,7 +4735,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4735
4735
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
4736
4736
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
4737
4737
|
}
|
|
4738
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
4738
|
+
if (!keyProps.anchor && !keyProps.tag && !sep4) {
|
|
4739
4739
|
commentEnd = keyProps.end;
|
|
4740
4740
|
if (keyProps.comment) {
|
|
4741
4741
|
if (map.comment)
|
|
@@ -4759,7 +4759,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4759
4759
|
ctx.atKey = false;
|
|
4760
4760
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
4761
4761
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4762
|
-
const valueProps = resolveProps.resolveProps(
|
|
4762
|
+
const valueProps = resolveProps.resolveProps(sep4 ?? [], {
|
|
4763
4763
|
indicator: "map-value-ind",
|
|
4764
4764
|
next: value,
|
|
4765
4765
|
offset: keyNode.range[2],
|
|
@@ -4775,7 +4775,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4775
4775
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
4776
4776
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
4777
4777
|
}
|
|
4778
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
4778
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep4, null, valueProps, onError);
|
|
4779
4779
|
if (ctx.schema.compat)
|
|
4780
4780
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
4781
4781
|
offset = valueNode.range[2];
|
|
@@ -4864,7 +4864,7 @@ var require_resolve_end = __commonJS({
|
|
|
4864
4864
|
let comment = "";
|
|
4865
4865
|
if (end) {
|
|
4866
4866
|
let hasSpace = false;
|
|
4867
|
-
let
|
|
4867
|
+
let sep4 = "";
|
|
4868
4868
|
for (const token of end) {
|
|
4869
4869
|
const { source, type } = token;
|
|
4870
4870
|
switch (type) {
|
|
@@ -4878,13 +4878,13 @@ var require_resolve_end = __commonJS({
|
|
|
4878
4878
|
if (!comment)
|
|
4879
4879
|
comment = cb;
|
|
4880
4880
|
else
|
|
4881
|
-
comment +=
|
|
4882
|
-
|
|
4881
|
+
comment += sep4 + cb;
|
|
4882
|
+
sep4 = "";
|
|
4883
4883
|
break;
|
|
4884
4884
|
}
|
|
4885
4885
|
case "newline":
|
|
4886
4886
|
if (comment)
|
|
4887
|
-
|
|
4887
|
+
sep4 += source;
|
|
4888
4888
|
hasSpace = true;
|
|
4889
4889
|
break;
|
|
4890
4890
|
default:
|
|
@@ -4926,18 +4926,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4926
4926
|
let offset = fc.offset + fc.start.source.length;
|
|
4927
4927
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
4928
4928
|
const collItem = fc.items[i2];
|
|
4929
|
-
const { start, key, sep:
|
|
4929
|
+
const { start, key, sep: sep4, value } = collItem;
|
|
4930
4930
|
const props = resolveProps.resolveProps(start, {
|
|
4931
4931
|
flow: fcName,
|
|
4932
4932
|
indicator: "explicit-key-ind",
|
|
4933
|
-
next: key ??
|
|
4933
|
+
next: key ?? sep4?.[0],
|
|
4934
4934
|
offset,
|
|
4935
4935
|
onError,
|
|
4936
4936
|
parentIndent: fc.indent,
|
|
4937
4937
|
startOnNewline: false
|
|
4938
4938
|
});
|
|
4939
4939
|
if (!props.found) {
|
|
4940
|
-
if (!props.anchor && !props.tag && !
|
|
4940
|
+
if (!props.anchor && !props.tag && !sep4 && !value) {
|
|
4941
4941
|
if (i2 === 0 && props.comma)
|
|
4942
4942
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
4943
4943
|
else if (i2 < fc.items.length - 1)
|
|
@@ -4991,8 +4991,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4991
4991
|
}
|
|
4992
4992
|
}
|
|
4993
4993
|
}
|
|
4994
|
-
if (!isMap && !
|
|
4995
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
4994
|
+
if (!isMap && !sep4 && !props.found) {
|
|
4995
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep4, null, props, onError);
|
|
4996
4996
|
coll.items.push(valueNode);
|
|
4997
4997
|
offset = valueNode.range[2];
|
|
4998
4998
|
if (isBlock(value))
|
|
@@ -5004,7 +5004,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
5004
5004
|
if (isBlock(key))
|
|
5005
5005
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
5006
5006
|
ctx.atKey = false;
|
|
5007
|
-
const valueProps = resolveProps.resolveProps(
|
|
5007
|
+
const valueProps = resolveProps.resolveProps(sep4 ?? [], {
|
|
5008
5008
|
flow: fcName,
|
|
5009
5009
|
indicator: "map-value-ind",
|
|
5010
5010
|
next: value,
|
|
@@ -5015,8 +5015,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
5015
5015
|
});
|
|
5016
5016
|
if (valueProps.found) {
|
|
5017
5017
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
5018
|
-
if (
|
|
5019
|
-
for (const st of
|
|
5018
|
+
if (sep4)
|
|
5019
|
+
for (const st of sep4) {
|
|
5020
5020
|
if (st === valueProps.found)
|
|
5021
5021
|
break;
|
|
5022
5022
|
if (st.type === "newline") {
|
|
@@ -5033,7 +5033,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
5033
5033
|
else
|
|
5034
5034
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
5035
5035
|
}
|
|
5036
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
5036
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep4, null, valueProps, onError) : null;
|
|
5037
5037
|
if (valueNode) {
|
|
5038
5038
|
if (isBlock(value))
|
|
5039
5039
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -5211,7 +5211,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
5211
5211
|
chompStart = i2 + 1;
|
|
5212
5212
|
}
|
|
5213
5213
|
let value = "";
|
|
5214
|
-
let
|
|
5214
|
+
let sep4 = "";
|
|
5215
5215
|
let prevMoreIndented = false;
|
|
5216
5216
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
5217
5217
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -5228,24 +5228,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
5228
5228
|
indent = "";
|
|
5229
5229
|
}
|
|
5230
5230
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
5231
|
-
value +=
|
|
5232
|
-
|
|
5231
|
+
value += sep4 + indent.slice(trimIndent) + content;
|
|
5232
|
+
sep4 = "\n";
|
|
5233
5233
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
5234
|
-
if (
|
|
5235
|
-
|
|
5236
|
-
else if (!prevMoreIndented &&
|
|
5237
|
-
|
|
5238
|
-
value +=
|
|
5239
|
-
|
|
5234
|
+
if (sep4 === " ")
|
|
5235
|
+
sep4 = "\n";
|
|
5236
|
+
else if (!prevMoreIndented && sep4 === "\n")
|
|
5237
|
+
sep4 = "\n\n";
|
|
5238
|
+
value += sep4 + indent.slice(trimIndent) + content;
|
|
5239
|
+
sep4 = "\n";
|
|
5240
5240
|
prevMoreIndented = true;
|
|
5241
5241
|
} else if (content === "") {
|
|
5242
|
-
if (
|
|
5242
|
+
if (sep4 === "\n")
|
|
5243
5243
|
value += "\n";
|
|
5244
5244
|
else
|
|
5245
|
-
|
|
5245
|
+
sep4 = "\n";
|
|
5246
5246
|
} else {
|
|
5247
|
-
value +=
|
|
5248
|
-
|
|
5247
|
+
value += sep4 + content;
|
|
5248
|
+
sep4 = " ";
|
|
5249
5249
|
prevMoreIndented = false;
|
|
5250
5250
|
}
|
|
5251
5251
|
}
|
|
@@ -5426,25 +5426,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
5426
5426
|
if (!match)
|
|
5427
5427
|
return source;
|
|
5428
5428
|
let res = match[1];
|
|
5429
|
-
let
|
|
5429
|
+
let sep4 = " ";
|
|
5430
5430
|
let pos = first.lastIndex;
|
|
5431
5431
|
line2.lastIndex = pos;
|
|
5432
5432
|
while (match = line2.exec(source)) {
|
|
5433
5433
|
if (match[1] === "") {
|
|
5434
|
-
if (
|
|
5435
|
-
res +=
|
|
5434
|
+
if (sep4 === "\n")
|
|
5435
|
+
res += sep4;
|
|
5436
5436
|
else
|
|
5437
|
-
|
|
5437
|
+
sep4 = "\n";
|
|
5438
5438
|
} else {
|
|
5439
|
-
res +=
|
|
5440
|
-
|
|
5439
|
+
res += sep4 + match[1];
|
|
5440
|
+
sep4 = " ";
|
|
5441
5441
|
}
|
|
5442
5442
|
pos = line2.lastIndex;
|
|
5443
5443
|
}
|
|
5444
5444
|
const last = /[ \t]*(.*)/sy;
|
|
5445
5445
|
last.lastIndex = pos;
|
|
5446
5446
|
match = last.exec(source);
|
|
5447
|
-
return res +
|
|
5447
|
+
return res + sep4 + (match?.[1] ?? "");
|
|
5448
5448
|
}
|
|
5449
5449
|
function doubleQuotedValue(source, onError) {
|
|
5450
5450
|
let res = "";
|
|
@@ -6247,14 +6247,14 @@ var require_cst_stringify = __commonJS({
|
|
|
6247
6247
|
}
|
|
6248
6248
|
}
|
|
6249
6249
|
}
|
|
6250
|
-
function stringifyItem({ start, key, sep:
|
|
6250
|
+
function stringifyItem({ start, key, sep: sep4, value }) {
|
|
6251
6251
|
let res = "";
|
|
6252
6252
|
for (const st of start)
|
|
6253
6253
|
res += st.source;
|
|
6254
6254
|
if (key)
|
|
6255
6255
|
res += stringifyToken(key);
|
|
6256
|
-
if (
|
|
6257
|
-
for (const st of
|
|
6256
|
+
if (sep4)
|
|
6257
|
+
for (const st of sep4)
|
|
6258
6258
|
res += st.source;
|
|
6259
6259
|
if (value)
|
|
6260
6260
|
res += stringifyToken(value);
|
|
@@ -7416,18 +7416,18 @@ var require_parser = __commonJS({
|
|
|
7416
7416
|
if (this.type === "map-value-ind") {
|
|
7417
7417
|
const prev = getPrevProps(this.peek(2));
|
|
7418
7418
|
const start = getFirstKeyStartProps(prev);
|
|
7419
|
-
let
|
|
7419
|
+
let sep4;
|
|
7420
7420
|
if (scalar.end) {
|
|
7421
|
-
|
|
7422
|
-
|
|
7421
|
+
sep4 = scalar.end;
|
|
7422
|
+
sep4.push(this.sourceToken);
|
|
7423
7423
|
delete scalar.end;
|
|
7424
7424
|
} else
|
|
7425
|
-
|
|
7425
|
+
sep4 = [this.sourceToken];
|
|
7426
7426
|
const map = {
|
|
7427
7427
|
type: "block-map",
|
|
7428
7428
|
offset: scalar.offset,
|
|
7429
7429
|
indent: scalar.indent,
|
|
7430
|
-
items: [{ start, key: scalar, sep:
|
|
7430
|
+
items: [{ start, key: scalar, sep: sep4 }]
|
|
7431
7431
|
};
|
|
7432
7432
|
this.onKeyLine = true;
|
|
7433
7433
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -7580,15 +7580,15 @@ var require_parser = __commonJS({
|
|
|
7580
7580
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
7581
7581
|
const start2 = getFirstKeyStartProps(it.start);
|
|
7582
7582
|
const key = it.key;
|
|
7583
|
-
const
|
|
7584
|
-
|
|
7583
|
+
const sep4 = it.sep;
|
|
7584
|
+
sep4.push(this.sourceToken);
|
|
7585
7585
|
delete it.key;
|
|
7586
7586
|
delete it.sep;
|
|
7587
7587
|
this.stack.push({
|
|
7588
7588
|
type: "block-map",
|
|
7589
7589
|
offset: this.offset,
|
|
7590
7590
|
indent: this.indent,
|
|
7591
|
-
items: [{ start: start2, key, sep:
|
|
7591
|
+
items: [{ start: start2, key, sep: sep4 }]
|
|
7592
7592
|
});
|
|
7593
7593
|
} else if (start.length > 0) {
|
|
7594
7594
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -7782,13 +7782,13 @@ var require_parser = __commonJS({
|
|
|
7782
7782
|
const prev = getPrevProps(parent);
|
|
7783
7783
|
const start = getFirstKeyStartProps(prev);
|
|
7784
7784
|
fixFlowSeqItems(fc);
|
|
7785
|
-
const
|
|
7786
|
-
|
|
7785
|
+
const sep4 = fc.end.splice(1, fc.end.length);
|
|
7786
|
+
sep4.push(this.sourceToken);
|
|
7787
7787
|
const map = {
|
|
7788
7788
|
type: "block-map",
|
|
7789
7789
|
offset: fc.offset,
|
|
7790
7790
|
indent: fc.indent,
|
|
7791
|
-
items: [{ start, key: fc, sep:
|
|
7791
|
+
items: [{ start, key: fc, sep: sep4 }]
|
|
7792
7792
|
};
|
|
7793
7793
|
this.onKeyLine = true;
|
|
7794
7794
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -10160,7 +10160,7 @@ var require_typescript = __commonJS({
|
|
|
10160
10160
|
startsWithUseStrict: () => startsWithUseStrict,
|
|
10161
10161
|
stringContainsAt: () => stringContainsAt,
|
|
10162
10162
|
stringToToken: () => stringToToken,
|
|
10163
|
-
stripQuotes: () =>
|
|
10163
|
+
stripQuotes: () => stripQuotes2,
|
|
10164
10164
|
supportedDeclarationExtensions: () => supportedDeclarationExtensions,
|
|
10165
10165
|
supportedJSExtensionsFlat: () => supportedJSExtensionsFlat,
|
|
10166
10166
|
supportedLocaleDirectories: () => supportedLocaleDirectories,
|
|
@@ -16646,7 +16646,7 @@ ${lanes.join("\n")}
|
|
|
16646
16646
|
writeOutputIsTTY() {
|
|
16647
16647
|
return process.stdout.isTTY;
|
|
16648
16648
|
},
|
|
16649
|
-
readFile:
|
|
16649
|
+
readFile: readFile5,
|
|
16650
16650
|
writeFile: writeFile22,
|
|
16651
16651
|
watchFile: watchFile2,
|
|
16652
16652
|
watchDirectory,
|
|
@@ -16852,7 +16852,7 @@ ${lanes.join("\n")}
|
|
|
16852
16852
|
callback
|
|
16853
16853
|
);
|
|
16854
16854
|
}
|
|
16855
|
-
function
|
|
16855
|
+
function readFile5(fileName, _encoding) {
|
|
16856
16856
|
let buffer;
|
|
16857
16857
|
try {
|
|
16858
16858
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -17440,11 +17440,11 @@ ${lanes.join("\n")}
|
|
|
17440
17440
|
return toComponents;
|
|
17441
17441
|
}
|
|
17442
17442
|
const components = toComponents.slice(start);
|
|
17443
|
-
const
|
|
17443
|
+
const relative5 = [];
|
|
17444
17444
|
for (; start < fromComponents.length; start++) {
|
|
17445
|
-
|
|
17445
|
+
relative5.push("..");
|
|
17446
17446
|
}
|
|
17447
|
-
return ["", ...
|
|
17447
|
+
return ["", ...relative5, ...components];
|
|
17448
17448
|
}
|
|
17449
17449
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
17450
17450
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -28605,7 +28605,7 @@ ${lanes.join("\n")}
|
|
|
28605
28605
|
const escapedCharsRegExp = quoteChar === 39 ? jsxSingleQuoteEscapedCharsRegExp : jsxDoubleQuoteEscapedCharsRegExp;
|
|
28606
28606
|
return s2.replace(escapedCharsRegExp, getJsxAttributeStringReplacement);
|
|
28607
28607
|
}
|
|
28608
|
-
function
|
|
28608
|
+
function stripQuotes2(name) {
|
|
28609
28609
|
const length2 = name.length;
|
|
28610
28610
|
if (length2 >= 2 && name.charCodeAt(0) === name.charCodeAt(length2 - 1) && isQuoteOrBacktick(name.charCodeAt(0))) {
|
|
28611
28611
|
return name.substring(1, length2 - 1);
|
|
@@ -53396,7 +53396,7 @@ ${lanes.join("\n")}
|
|
|
53396
53396
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
53397
53397
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
53398
53398
|
}
|
|
53399
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
53399
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile5) {
|
|
53400
53400
|
const options = {};
|
|
53401
53401
|
let watchOptions;
|
|
53402
53402
|
const fileNames = [];
|
|
@@ -53444,7 +53444,7 @@ ${lanes.join("\n")}
|
|
|
53444
53444
|
}
|
|
53445
53445
|
}
|
|
53446
53446
|
function parseResponseFile(fileName) {
|
|
53447
|
-
const text = tryReadFile(fileName,
|
|
53447
|
+
const text = tryReadFile(fileName, readFile5 || ((fileName2) => sys.readFile(fileName2)));
|
|
53448
53448
|
if (!isString(text)) {
|
|
53449
53449
|
errors.push(text);
|
|
53450
53450
|
return;
|
|
@@ -53547,8 +53547,8 @@ ${lanes.join("\n")}
|
|
|
53547
53547
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
53548
53548
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
53549
53549
|
};
|
|
53550
|
-
function parseCommandLine(commandLine,
|
|
53551
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
53550
|
+
function parseCommandLine(commandLine, readFile5) {
|
|
53551
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile5);
|
|
53552
53552
|
}
|
|
53553
53553
|
function getOptionFromName(optionName, allowShort) {
|
|
53554
53554
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -53630,8 +53630,8 @@ ${lanes.join("\n")}
|
|
|
53630
53630
|
watchOptionsToExtend
|
|
53631
53631
|
);
|
|
53632
53632
|
}
|
|
53633
|
-
function readConfigFile(fileName,
|
|
53634
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
53633
|
+
function readConfigFile(fileName, readFile5) {
|
|
53634
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile5);
|
|
53635
53635
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
53636
53636
|
}
|
|
53637
53637
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -53646,14 +53646,14 @@ ${lanes.join("\n")}
|
|
|
53646
53646
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
53647
53647
|
};
|
|
53648
53648
|
}
|
|
53649
|
-
function readJsonConfigFile(fileName,
|
|
53650
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
53649
|
+
function readJsonConfigFile(fileName, readFile5) {
|
|
53650
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile5);
|
|
53651
53651
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
53652
53652
|
}
|
|
53653
|
-
function tryReadFile(fileName,
|
|
53653
|
+
function tryReadFile(fileName, readFile5) {
|
|
53654
53654
|
let text;
|
|
53655
53655
|
try {
|
|
53656
|
-
text =
|
|
53656
|
+
text = readFile5(fileName);
|
|
53657
53657
|
} catch (e2) {
|
|
53658
53658
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e2.message);
|
|
53659
53659
|
}
|
|
@@ -56001,11 +56001,11 @@ ${lanes.join("\n")}
|
|
|
56001
56001
|
if (i2 < rootLength) {
|
|
56002
56002
|
return void 0;
|
|
56003
56003
|
}
|
|
56004
|
-
const
|
|
56005
|
-
if (
|
|
56004
|
+
const sep4 = directory.lastIndexOf(directorySeparator, i2 - 1);
|
|
56005
|
+
if (sep4 === -1) {
|
|
56006
56006
|
return void 0;
|
|
56007
56007
|
}
|
|
56008
|
-
return directory.substr(0, Math.max(
|
|
56008
|
+
return directory.substr(0, Math.max(sep4, rootLength));
|
|
56009
56009
|
}
|
|
56010
56010
|
}
|
|
56011
56011
|
}
|
|
@@ -61425,11 +61425,11 @@ ${lanes.join("\n")}
|
|
|
61425
61425
|
if (!symbol) {
|
|
61426
61426
|
return false;
|
|
61427
61427
|
}
|
|
61428
|
-
const
|
|
61429
|
-
if (visitedSymbols[
|
|
61428
|
+
const symbolId2 = getSymbolId(symbol);
|
|
61429
|
+
if (visitedSymbols[symbolId2]) {
|
|
61430
61430
|
return false;
|
|
61431
61431
|
}
|
|
61432
|
-
visitedSymbols[
|
|
61432
|
+
visitedSymbols[symbolId2] = symbol;
|
|
61433
61433
|
if (!accept(symbol)) {
|
|
61434
61434
|
return true;
|
|
61435
61435
|
}
|
|
@@ -61911,9 +61911,9 @@ ${lanes.join("\n")}
|
|
|
61911
61911
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
61912
61912
|
return;
|
|
61913
61913
|
}
|
|
61914
|
-
const
|
|
61914
|
+
const relative5 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
61915
61915
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
61916
|
-
const option = resolvePath(symlinkDirectory,
|
|
61916
|
+
const option = resolvePath(symlinkDirectory, relative5);
|
|
61917
61917
|
const result2 = cb(option, target === referenceRedirect);
|
|
61918
61918
|
shouldFilterIgnoredPaths = true;
|
|
61919
61919
|
if (result2) return result2;
|
|
@@ -69713,15 +69713,15 @@ ${lanes.join("\n")}
|
|
|
69713
69713
|
var _a;
|
|
69714
69714
|
Debug.assert(chain && 0 <= index && index < chain.length);
|
|
69715
69715
|
const symbol = chain[index];
|
|
69716
|
-
const
|
|
69717
|
-
if ((_a = context.typeParameterSymbolList) == null ? void 0 : _a.has(
|
|
69716
|
+
const symbolId2 = getSymbolId(symbol);
|
|
69717
|
+
if ((_a = context.typeParameterSymbolList) == null ? void 0 : _a.has(symbolId2)) {
|
|
69718
69718
|
return void 0;
|
|
69719
69719
|
}
|
|
69720
69720
|
if (context.mustCreateTypeParameterSymbolList) {
|
|
69721
69721
|
context.mustCreateTypeParameterSymbolList = false;
|
|
69722
69722
|
context.typeParameterSymbolList = new Set(context.typeParameterSymbolList);
|
|
69723
69723
|
}
|
|
69724
|
-
context.typeParameterSymbolList.add(
|
|
69724
|
+
context.typeParameterSymbolList.add(symbolId2);
|
|
69725
69725
|
let typeParameterNodes;
|
|
69726
69726
|
if (context.flags & 512 && index < chain.length - 1) {
|
|
69727
69727
|
const parentSymbol = symbol;
|
|
@@ -70077,7 +70077,7 @@ ${lanes.join("\n")}
|
|
|
70077
70077
|
}
|
|
70078
70078
|
let expression;
|
|
70079
70079
|
if (isSingleOrDoubleQuote(firstChar) && !(symbol2.flags & 8)) {
|
|
70080
|
-
const literalText =
|
|
70080
|
+
const literalText = stripQuotes2(symbolName2).replace(/\\./g, (s2) => s2.substring(1));
|
|
70081
70081
|
context.approximateLength += literalText.length + 2;
|
|
70082
70082
|
expression = factory.createStringLiteral(
|
|
70083
70083
|
literalText,
|
|
@@ -72339,7 +72339,7 @@ ${lanes.join("\n")}
|
|
|
72339
72339
|
context.flags |= 16777216;
|
|
72340
72340
|
const nameCandidate = getNameOfSymbolAsWritten(symbol, context);
|
|
72341
72341
|
restoreFlags();
|
|
72342
|
-
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ?
|
|
72342
|
+
localName = nameCandidate.length > 0 && isSingleOrDoubleQuote(nameCandidate.charCodeAt(0)) ? stripQuotes2(nameCandidate) : nameCandidate;
|
|
72343
72343
|
}
|
|
72344
72344
|
if (localName === "default") {
|
|
72345
72345
|
localName = "_default";
|
|
@@ -131651,7 +131651,7 @@ ${lanes.join("\n")}
|
|
|
131651
131651
|
}
|
|
131652
131652
|
}
|
|
131653
131653
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
131654
|
-
const
|
|
131654
|
+
const resolve8 = factory2.createUniqueName("resolve");
|
|
131655
131655
|
const reject = factory2.createUniqueName("reject");
|
|
131656
131656
|
const parameters = [
|
|
131657
131657
|
factory2.createParameterDeclaration(
|
|
@@ -131660,7 +131660,7 @@ ${lanes.join("\n")}
|
|
|
131660
131660
|
/*dotDotDotToken*/
|
|
131661
131661
|
void 0,
|
|
131662
131662
|
/*name*/
|
|
131663
|
-
|
|
131663
|
+
resolve8
|
|
131664
131664
|
),
|
|
131665
131665
|
factory2.createParameterDeclaration(
|
|
131666
131666
|
/*modifiers*/
|
|
@@ -131677,7 +131677,7 @@ ${lanes.join("\n")}
|
|
|
131677
131677
|
factory2.createIdentifier("require"),
|
|
131678
131678
|
/*typeArguments*/
|
|
131679
131679
|
void 0,
|
|
131680
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
131680
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve8, reject]
|
|
131681
131681
|
)
|
|
131682
131682
|
)
|
|
131683
131683
|
]);
|
|
@@ -143207,12 +143207,12 @@ ${lanes.join("\n")}
|
|
|
143207
143207
|
function createCompilerHost(options, setParentNodes) {
|
|
143208
143208
|
return createCompilerHostWorker(options, setParentNodes);
|
|
143209
143209
|
}
|
|
143210
|
-
function createGetSourceFile(
|
|
143210
|
+
function createGetSourceFile(readFile5, setParentNodes) {
|
|
143211
143211
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
143212
143212
|
let text;
|
|
143213
143213
|
try {
|
|
143214
143214
|
mark("beforeIORead");
|
|
143215
|
-
text =
|
|
143215
|
+
text = readFile5(fileName);
|
|
143216
143216
|
mark("afterIORead");
|
|
143217
143217
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
143218
143218
|
} catch (e2) {
|
|
@@ -144116,7 +144116,7 @@ ${lanes.join("\n")}
|
|
|
144116
144116
|
getRedirectFromOutput,
|
|
144117
144117
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
144118
144118
|
});
|
|
144119
|
-
const
|
|
144119
|
+
const readFile5 = host.readFile.bind(host);
|
|
144120
144120
|
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
144121
144121
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
144122
144122
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
@@ -144342,7 +144342,7 @@ ${lanes.join("\n")}
|
|
|
144342
144342
|
shouldTransformImportCall,
|
|
144343
144343
|
emitBuildInfo,
|
|
144344
144344
|
fileExists,
|
|
144345
|
-
readFile:
|
|
144345
|
+
readFile: readFile5,
|
|
144346
144346
|
directoryExists,
|
|
144347
144347
|
getSymlinkCache,
|
|
144348
144348
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
@@ -144482,9 +144482,9 @@ ${lanes.join("\n")}
|
|
|
144482
144482
|
/*ignoreCase*/
|
|
144483
144483
|
false
|
|
144484
144484
|
)) {
|
|
144485
|
-
const
|
|
144486
|
-
if (
|
|
144487
|
-
const name = removeSuffix(removePrefix(
|
|
144485
|
+
const basename3 = getBaseFileName(a2.fileName);
|
|
144486
|
+
if (basename3 === "lib.d.ts" || basename3 === "lib.es6.d.ts") return 0;
|
|
144487
|
+
const name = removeSuffix(removePrefix(basename3, "lib."), ".d.ts");
|
|
144488
144488
|
const index = libs.indexOf(name);
|
|
144489
144489
|
if (index !== -1) return index + 1;
|
|
144490
144490
|
}
|
|
@@ -148331,8 +148331,8 @@ ${lanes.join("\n")}
|
|
|
148331
148331
|
const root = [];
|
|
148332
148332
|
if (state.compilerOptions.outFile) {
|
|
148333
148333
|
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
|
|
148334
|
-
const
|
|
148335
|
-
tryAddRoot(key,
|
|
148334
|
+
const fileId2 = toFileId(key);
|
|
148335
|
+
tryAddRoot(key, fileId2);
|
|
148336
148336
|
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
|
|
148337
148337
|
});
|
|
148338
148338
|
const buildInfo2 = {
|
|
@@ -148365,9 +148365,9 @@ ${lanes.join("\n")}
|
|
|
148365
148365
|
let emitSignatures;
|
|
148366
148366
|
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
|
|
148367
148367
|
var _a2, _b2;
|
|
148368
|
-
const
|
|
148369
|
-
tryAddRoot(key,
|
|
148370
|
-
Debug.assert(fileNames[
|
|
148368
|
+
const fileId2 = toFileId(key);
|
|
148369
|
+
tryAddRoot(key, fileId2);
|
|
148370
|
+
Debug.assert(fileNames[fileId2 - 1] === relativeToBuildInfo(key));
|
|
148371
148371
|
const oldSignature = (_a2 = state.oldSignatures) == null ? void 0 : _a2.get(key);
|
|
148372
148372
|
const actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value.signature;
|
|
148373
148373
|
if (state.compilerOptions.composite) {
|
|
@@ -148377,10 +148377,10 @@ ${lanes.join("\n")}
|
|
|
148377
148377
|
if (emitSignature !== actualSignature) {
|
|
148378
148378
|
emitSignatures = append(
|
|
148379
148379
|
emitSignatures,
|
|
148380
|
-
emitSignature === void 0 ?
|
|
148380
|
+
emitSignature === void 0 ? fileId2 : (
|
|
148381
148381
|
// There is no emit, encode as false
|
|
148382
148382
|
// fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
|
|
148383
|
-
[
|
|
148383
|
+
[fileId2, !isString(emitSignature) && emitSignature[0] === actualSignature ? emptyArray : emitSignature]
|
|
148384
148384
|
)
|
|
148385
148385
|
);
|
|
148386
148386
|
}
|
|
@@ -148422,14 +148422,14 @@ ${lanes.join("\n")}
|
|
|
148422
148422
|
if (tryAddToSet(seenFiles, path2)) {
|
|
148423
148423
|
const file = state.program.getSourceFileByPath(path2);
|
|
148424
148424
|
if (!file || !sourceFileMayBeEmitted(file, state.program)) continue;
|
|
148425
|
-
const
|
|
148425
|
+
const fileId2 = toFileId(path2), pendingEmit = state.affectedFilesPendingEmit.get(path2);
|
|
148426
148426
|
affectedFilesPendingEmit = append(
|
|
148427
148427
|
affectedFilesPendingEmit,
|
|
148428
|
-
pendingEmit === fullEmitForOptions ?
|
|
148428
|
+
pendingEmit === fullEmitForOptions ? fileId2 : (
|
|
148429
148429
|
// Pending full emit per options
|
|
148430
|
-
pendingEmit === 24 ? [
|
|
148430
|
+
pendingEmit === 24 ? [fileId2] : (
|
|
148431
148431
|
// Pending on Dts only
|
|
148432
|
-
[
|
|
148432
|
+
[fileId2, pendingEmit]
|
|
148433
148433
|
)
|
|
148434
148434
|
)
|
|
148435
148435
|
// Anything else
|
|
@@ -148463,12 +148463,12 @@ ${lanes.join("\n")}
|
|
|
148463
148463
|
return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path2, state.program.getCanonicalFileName));
|
|
148464
148464
|
}
|
|
148465
148465
|
function toFileId(path2) {
|
|
148466
|
-
let
|
|
148467
|
-
if (
|
|
148466
|
+
let fileId2 = fileNameToFileId.get(path2);
|
|
148467
|
+
if (fileId2 === void 0) {
|
|
148468
148468
|
fileNames.push(relativeToBuildInfo(path2));
|
|
148469
|
-
fileNameToFileId.set(path2,
|
|
148469
|
+
fileNameToFileId.set(path2, fileId2 = fileNames.length);
|
|
148470
148470
|
}
|
|
148471
|
-
return
|
|
148471
|
+
return fileId2;
|
|
148472
148472
|
}
|
|
148473
148473
|
function toFileIdListId(set) {
|
|
148474
148474
|
const fileIds = arrayFrom(set.keys(), toFileId).sort(compareValues);
|
|
@@ -148480,20 +148480,20 @@ ${lanes.join("\n")}
|
|
|
148480
148480
|
}
|
|
148481
148481
|
return fileIdListId;
|
|
148482
148482
|
}
|
|
148483
|
-
function tryAddRoot(path2,
|
|
148483
|
+
function tryAddRoot(path2, fileId2) {
|
|
148484
148484
|
const file = state.program.getSourceFile(path2);
|
|
148485
148485
|
if (!state.program.getFileIncludeReasons().get(file.path).some(
|
|
148486
148486
|
(r3) => r3.kind === 0
|
|
148487
148487
|
/* RootFile */
|
|
148488
148488
|
)) return;
|
|
148489
|
-
if (!root.length) return root.push(
|
|
148489
|
+
if (!root.length) return root.push(fileId2);
|
|
148490
148490
|
const last2 = root[root.length - 1];
|
|
148491
148491
|
const isLastStartEnd = isArray(last2);
|
|
148492
|
-
if (isLastStartEnd && last2[1] ===
|
|
148493
|
-
if (isLastStartEnd || root.length === 1 || last2 !==
|
|
148492
|
+
if (isLastStartEnd && last2[1] === fileId2 - 1) return last2[1] = fileId2;
|
|
148493
|
+
if (isLastStartEnd || root.length === 1 || last2 !== fileId2 - 1) return root.push(fileId2);
|
|
148494
148494
|
const lastButOne = root[root.length - 2];
|
|
148495
|
-
if (!isNumber(lastButOne) || lastButOne !== last2 - 1) return root.push(
|
|
148496
|
-
root[root.length - 2] = [lastButOne,
|
|
148495
|
+
if (!isNumber(lastButOne) || lastButOne !== last2 - 1) return root.push(fileId2);
|
|
148496
|
+
root[root.length - 2] = [lastButOne, fileId2];
|
|
148497
148497
|
return root.length = root.length - 1;
|
|
148498
148498
|
}
|
|
148499
148499
|
function toResolvedRoot() {
|
|
@@ -149192,8 +149192,8 @@ ${lanes.join("\n")}
|
|
|
149192
149192
|
function toAbsolutePath(path2) {
|
|
149193
149193
|
return getNormalizedAbsolutePath(path2, buildInfoDirectory);
|
|
149194
149194
|
}
|
|
149195
|
-
function toFilePath(
|
|
149196
|
-
return filePaths[
|
|
149195
|
+
function toFilePath(fileId2) {
|
|
149196
|
+
return filePaths[fileId2 - 1];
|
|
149197
149197
|
}
|
|
149198
149198
|
function toFilePathsSet(fileIdsListId) {
|
|
149199
149199
|
return filePathsSetList[fileIdsListId - 1];
|
|
@@ -149201,7 +149201,7 @@ ${lanes.join("\n")}
|
|
|
149201
149201
|
function toManyToManyPathMap(referenceMap, options) {
|
|
149202
149202
|
const map2 = BuilderState.createReferencedMap(options);
|
|
149203
149203
|
if (!map2 || !referenceMap) return map2;
|
|
149204
|
-
referenceMap.forEach(([
|
|
149204
|
+
referenceMap.forEach(([fileId2, fileIdListId]) => map2.set(toFilePath(fileId2), toFilePathsSet(fileIdListId)));
|
|
149205
149205
|
return map2;
|
|
149206
149206
|
}
|
|
149207
149207
|
function toPerFileSemanticDiagnostics(diagnostics) {
|
|
@@ -149234,21 +149234,21 @@ ${lanes.join("\n")}
|
|
|
149234
149234
|
fileInfos.set(path2, version22);
|
|
149235
149235
|
if (rootIndex < program.root.length) {
|
|
149236
149236
|
const current = program.root[rootIndex];
|
|
149237
|
-
const
|
|
149237
|
+
const fileId2 = index + 1;
|
|
149238
149238
|
if (isArray(current)) {
|
|
149239
|
-
if (current[0] <=
|
|
149240
|
-
addRoot(
|
|
149241
|
-
if (current[1] ===
|
|
149239
|
+
if (current[0] <= fileId2 && fileId2 <= current[1]) {
|
|
149240
|
+
addRoot(fileId2, path2);
|
|
149241
|
+
if (current[1] === fileId2) rootIndex++;
|
|
149242
149242
|
}
|
|
149243
|
-
} else if (current ===
|
|
149244
|
-
addRoot(
|
|
149243
|
+
} else if (current === fileId2) {
|
|
149244
|
+
addRoot(fileId2, path2);
|
|
149245
149245
|
rootIndex++;
|
|
149246
149246
|
}
|
|
149247
149247
|
}
|
|
149248
149248
|
});
|
|
149249
149249
|
return { fileInfos, roots };
|
|
149250
|
-
function addRoot(
|
|
149251
|
-
const root = resolvedRoots.get(
|
|
149250
|
+
function addRoot(fileId2, path2) {
|
|
149251
|
+
const root = resolvedRoots.get(fileId2);
|
|
149252
149252
|
if (root) {
|
|
149253
149253
|
roots.set(toPath(program.fileNames[root - 1], buildInfoDirectory, getCanonicalFileName), path2);
|
|
149254
149254
|
} else {
|
|
@@ -158932,7 +158932,7 @@ ${lanes.join("\n")}
|
|
|
158932
158932
|
function quote(sourceFile, preferences, text) {
|
|
158933
158933
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
158934
158934
|
const quoted = JSON.stringify(text);
|
|
158935
|
-
return quotePreference === 0 ? `'${
|
|
158935
|
+
return quotePreference === 0 ? `'${stripQuotes2(quoted).replace(/'/g, () => "\\'").replace(/\\"/g, '"')}'` : quoted;
|
|
158936
158936
|
}
|
|
158937
158937
|
function isEqualityOperatorKind(kind) {
|
|
158938
158938
|
switch (kind) {
|
|
@@ -159229,7 +159229,7 @@ ${lanes.join("\n")}
|
|
|
159229
159229
|
return cached2;
|
|
159230
159230
|
}
|
|
159231
159231
|
}
|
|
159232
|
-
const declaredModuleSpecifier =
|
|
159232
|
+
const declaredModuleSpecifier = stripQuotes2(moduleSymbol.getName());
|
|
159233
159233
|
if (isAllowedCoreNodeModulesImport(declaredModuleSpecifier)) {
|
|
159234
159234
|
ambientModuleCache.set(moduleSymbol, true);
|
|
159235
159235
|
return true;
|
|
@@ -159410,7 +159410,7 @@ ${lanes.join("\n")}
|
|
|
159410
159410
|
);
|
|
159411
159411
|
}
|
|
159412
159412
|
function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
|
|
159413
|
-
return moduleSpecifierToValidIdentifier(removeFileExtension(
|
|
159413
|
+
return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes2(moduleSymbol.name)), target, forceCapitalize);
|
|
159414
159414
|
}
|
|
159415
159415
|
function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
|
|
159416
159416
|
const baseName = getBaseFileName(removeSuffix(removeFileExtension(moduleSpecifier), "/index"));
|
|
@@ -159676,7 +159676,7 @@ ${lanes.join("\n")}
|
|
|
159676
159676
|
);
|
|
159677
159677
|
const symbolName2 = typeof names === "string" ? names : names[0];
|
|
159678
159678
|
const capitalizedSymbolName = typeof names === "string" ? void 0 : names[1];
|
|
159679
|
-
const moduleName =
|
|
159679
|
+
const moduleName = stripQuotes2(moduleSymbol.name);
|
|
159680
159680
|
const id = exportInfoId++;
|
|
159681
159681
|
const target = skipAlias(symbol, checker);
|
|
159682
159682
|
const storedSymbol = symbol.flags & 33554432 ? void 0 : symbol;
|
|
@@ -159819,7 +159819,7 @@ ${lanes.join("\n")}
|
|
|
159819
159819
|
var _a;
|
|
159820
159820
|
if (!toFile) {
|
|
159821
159821
|
let useNodePrefix;
|
|
159822
|
-
const moduleName =
|
|
159822
|
+
const moduleName = stripQuotes2(toModule.name);
|
|
159823
159823
|
if (nodeCoreModules.has(moduleName) && (useNodePrefix = shouldUseUriStyleNodeCoreModules(fromFile, program)) !== void 0) {
|
|
159824
159824
|
return useNodePrefix === startsWith(moduleName, "node:");
|
|
159825
159825
|
}
|
|
@@ -169154,10 +169154,10 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
169154
169154
|
}
|
|
169155
169155
|
}
|
|
169156
169156
|
function recordUsage(n2, usage, isTypeNode2) {
|
|
169157
|
-
const
|
|
169158
|
-
if (
|
|
169157
|
+
const symbolId2 = recordUsagebySymbol(n2, usage, isTypeNode2);
|
|
169158
|
+
if (symbolId2) {
|
|
169159
169159
|
for (let i2 = 0; i2 < scopes.length; i2++) {
|
|
169160
|
-
const substitution = substitutionsPerScope[i2].get(
|
|
169160
|
+
const substitution = substitutionsPerScope[i2].get(symbolId2);
|
|
169161
169161
|
if (substitution) {
|
|
169162
169162
|
usagesPerScope[i2].substitutions.set(getNodeId(n2).toString(), substitution);
|
|
169163
169163
|
}
|
|
@@ -169169,12 +169169,12 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
169169
169169
|
if (!symbol) {
|
|
169170
169170
|
return void 0;
|
|
169171
169171
|
}
|
|
169172
|
-
const
|
|
169173
|
-
const lastUsage = seenUsages.get(
|
|
169172
|
+
const symbolId2 = getSymbolId(symbol).toString();
|
|
169173
|
+
const lastUsage = seenUsages.get(symbolId2);
|
|
169174
169174
|
if (lastUsage && lastUsage >= usage) {
|
|
169175
|
-
return
|
|
169175
|
+
return symbolId2;
|
|
169176
169176
|
}
|
|
169177
|
-
seenUsages.set(
|
|
169177
|
+
seenUsages.set(symbolId2, usage);
|
|
169178
169178
|
if (lastUsage) {
|
|
169179
169179
|
for (const perScope of usagesPerScope) {
|
|
169180
169180
|
const prevEntry = perScope.usages.get(identifier.text);
|
|
@@ -169182,7 +169182,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
169182
169182
|
perScope.usages.set(identifier.text, { usage, symbol, node: identifier });
|
|
169183
169183
|
}
|
|
169184
169184
|
}
|
|
169185
|
-
return
|
|
169185
|
+
return symbolId2;
|
|
169186
169186
|
}
|
|
169187
169187
|
const decls = symbol.getDeclarations();
|
|
169188
169188
|
const declInFile = decls && find(decls, (d2) => d2.getSourceFile() === sourceFile);
|
|
@@ -169213,10 +169213,10 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
169213
169213
|
if (resolvedSymbol === symbol) {
|
|
169214
169214
|
continue;
|
|
169215
169215
|
}
|
|
169216
|
-
if (!substitutionsPerScope[i2].has(
|
|
169216
|
+
if (!substitutionsPerScope[i2].has(symbolId2)) {
|
|
169217
169217
|
const substitution = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.exportSymbol || symbol, scope, isTypeName);
|
|
169218
169218
|
if (substitution) {
|
|
169219
|
-
substitutionsPerScope[i2].set(
|
|
169219
|
+
substitutionsPerScope[i2].set(symbolId2, substitution);
|
|
169220
169220
|
} else if (isTypeName) {
|
|
169221
169221
|
if (!(symbol.flags & 262144)) {
|
|
169222
169222
|
const diag2 = createDiagnosticForNode(identifier, Messages.typeWillNotBeVisibleInTheNewScope);
|
|
@@ -169228,7 +169228,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
169228
169228
|
}
|
|
169229
169229
|
}
|
|
169230
169230
|
}
|
|
169231
|
-
return
|
|
169231
|
+
return symbolId2;
|
|
169232
169232
|
}
|
|
169233
169233
|
function checkForUsedDeclarations(node) {
|
|
169234
169234
|
if (node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.includes(node)) {
|
|
@@ -176972,7 +176972,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
176972
176972
|
exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
|
|
176973
176973
|
Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
|
|
176974
176974
|
} else {
|
|
176975
|
-
exportInfos = pathIsBareSpecifier(
|
|
176975
|
+
exportInfos = pathIsBareSpecifier(stripQuotes2(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
|
|
176976
176976
|
Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
|
|
176977
176977
|
}
|
|
176978
176978
|
const useRequire = shouldUseRequire(sourceFile, program);
|
|
@@ -177631,7 +177631,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
177631
177631
|
void 0,
|
|
177632
177632
|
preferences
|
|
177633
177633
|
);
|
|
177634
|
-
const moduleSpecifierWithoutQuotes =
|
|
177634
|
+
const moduleSpecifierWithoutQuotes = stripQuotes2(moduleSpecifier);
|
|
177635
177635
|
return includeSymbolNameInDescription ? [Diagnostics.Import_0_from_1, symbolName2, moduleSpecifierWithoutQuotes] : [Diagnostics.Update_import_from_0, moduleSpecifierWithoutQuotes];
|
|
177636
177636
|
}
|
|
177637
177637
|
case 3: {
|
|
@@ -185352,7 +185352,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
185352
185352
|
}
|
|
185353
185353
|
const { origin } = Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host));
|
|
185354
185354
|
const info = exportMap.get(file.path, entry.data.exportMapKey);
|
|
185355
|
-
const result = info && context.tryResolve(info, !isExternalModuleNameRelative(
|
|
185355
|
+
const result = info && context.tryResolve(info, !isExternalModuleNameRelative(stripQuotes2(origin.moduleSymbol.name)));
|
|
185356
185356
|
if (result === "skipped") return entry;
|
|
185357
185357
|
if (!result || result === "failed") {
|
|
185358
185358
|
(_a = host.log) == null ? void 0 : _a.call(host, `Unexpected failure resolving auto import for '${entry.name}' from '${entry.source}'`);
|
|
@@ -186657,7 +186657,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
186657
186657
|
}
|
|
186658
186658
|
}
|
|
186659
186659
|
function originToCompletionEntryData(origin) {
|
|
186660
|
-
const ambientModuleName = origin.fileName ? void 0 :
|
|
186660
|
+
const ambientModuleName = origin.fileName ? void 0 : stripQuotes2(origin.moduleSymbol.name);
|
|
186661
186661
|
const isPackageJsonImport = origin.isFromPackageJson ? true : void 0;
|
|
186662
186662
|
if (originIsResolvedExport(origin)) {
|
|
186663
186663
|
const resolvedData = {
|
|
@@ -186674,7 +186674,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
186674
186674
|
exportName: origin.exportName,
|
|
186675
186675
|
exportMapKey: origin.exportMapKey,
|
|
186676
186676
|
fileName: origin.fileName,
|
|
186677
|
-
ambientModuleName: origin.fileName ? void 0 :
|
|
186677
|
+
ambientModuleName: origin.fileName ? void 0 : stripQuotes2(origin.moduleSymbol.name),
|
|
186678
186678
|
isPackageJsonImport: origin.isFromPackageJson ? true : void 0
|
|
186679
186679
|
};
|
|
186680
186680
|
return unresolvedData;
|
|
@@ -186752,7 +186752,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
186752
186752
|
}
|
|
186753
186753
|
function getSourceFromOrigin(origin) {
|
|
186754
186754
|
if (originIsExport(origin)) {
|
|
186755
|
-
return
|
|
186755
|
+
return stripQuotes2(origin.moduleSymbol.name);
|
|
186756
186756
|
}
|
|
186757
186757
|
if (originIsResolvedExport(origin)) {
|
|
186758
186758
|
return origin.moduleSpecifier;
|
|
@@ -187673,7 +187673,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
187673
187673
|
/* SymbolMemberNoExport */
|
|
187674
187674
|
) };
|
|
187675
187675
|
} else {
|
|
187676
|
-
const fileName = isExternalModuleNameRelative(
|
|
187676
|
+
const fileName = isExternalModuleNameRelative(stripQuotes2(moduleSymbol.name)) ? (_a = getSourceFileOfModule(moduleSymbol)) == null ? void 0 : _a.fileName : void 0;
|
|
187677
187677
|
const { moduleSpecifier } = (importSpecifierResolver || (importSpecifierResolver = ts_codefix_exports.createImportSpecifierResolver(sourceFile, program, host, preferences))).getModuleSpecifierForBestExportInfo(
|
|
187678
187678
|
[{
|
|
187679
187679
|
exportKind: 0,
|
|
@@ -187908,7 +187908,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
187908
187908
|
return charactersFuzzyMatchInString(symbolName2, lowerCaseTokenText);
|
|
187909
187909
|
},
|
|
187910
187910
|
(info, symbolName2, isFromAmbientModule, exportMapKey) => {
|
|
187911
|
-
if (detailsEntryId && !some(info, (i2) => detailsEntryId.source ===
|
|
187911
|
+
if (detailsEntryId && !some(info, (i2) => detailsEntryId.source === stripQuotes2(i2.moduleSymbol.name))) {
|
|
187912
187912
|
return;
|
|
187913
187913
|
}
|
|
187914
187914
|
info = filter(info, isImportableExportInfo);
|
|
@@ -187955,12 +187955,12 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
187955
187955
|
}
|
|
187956
187956
|
}
|
|
187957
187957
|
function pushAutoImportSymbol(symbol, origin) {
|
|
187958
|
-
const
|
|
187959
|
-
if (symbolToSortTextMap[
|
|
187958
|
+
const symbolId2 = getSymbolId(symbol);
|
|
187959
|
+
if (symbolToSortTextMap[symbolId2] === SortText.GlobalsOrKeywords) {
|
|
187960
187960
|
return;
|
|
187961
187961
|
}
|
|
187962
187962
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
187963
|
-
symbolToSortTextMap[
|
|
187963
|
+
symbolToSortTextMap[symbolId2] = importStatementCompletion ? SortText.LocationPriority : SortText.AutoImportSuggestions;
|
|
187964
187964
|
symbols.push(symbol);
|
|
187965
187965
|
}
|
|
187966
187966
|
function collectObjectLiteralMethodSymbols(members, enclosingDeclaration) {
|
|
@@ -188616,8 +188616,8 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
188616
188616
|
function setSortTextToOptionalMember() {
|
|
188617
188617
|
symbols.forEach((m2) => {
|
|
188618
188618
|
if (m2.flags & 16777216) {
|
|
188619
|
-
const
|
|
188620
|
-
symbolToSortTextMap[
|
|
188619
|
+
const symbolId2 = getSymbolId(m2);
|
|
188620
|
+
symbolToSortTextMap[symbolId2] = symbolToSortTextMap[symbolId2] ?? SortText.OptionalMember;
|
|
188621
188621
|
}
|
|
188622
188622
|
});
|
|
188623
188623
|
}
|
|
@@ -188634,7 +188634,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
188634
188634
|
function transformObjectLiteralMembersSortText(start2) {
|
|
188635
188635
|
for (let i2 = start2; i2 < symbols.length; i2++) {
|
|
188636
188636
|
const symbol = symbols[i2];
|
|
188637
|
-
const
|
|
188637
|
+
const symbolId2 = getSymbolId(symbol);
|
|
188638
188638
|
const origin = symbolToOriginInfoMap == null ? void 0 : symbolToOriginInfoMap[i2];
|
|
188639
188639
|
const target = getEmitScriptTarget(compilerOptions);
|
|
188640
188640
|
const displayName = getCompletionEntryDisplayNameForSymbol(
|
|
@@ -188646,9 +188646,9 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
188646
188646
|
false
|
|
188647
188647
|
);
|
|
188648
188648
|
if (displayName) {
|
|
188649
|
-
const originalSortText = symbolToSortTextMap[
|
|
188649
|
+
const originalSortText = symbolToSortTextMap[symbolId2] ?? SortText.LocationPriority;
|
|
188650
188650
|
const { name } = displayName;
|
|
188651
|
-
symbolToSortTextMap[
|
|
188651
|
+
symbolToSortTextMap[symbolId2] = SortText.ObjectLiteralProperty(originalSortText, name);
|
|
188652
188652
|
}
|
|
188653
188653
|
}
|
|
188654
188654
|
}
|
|
@@ -190249,7 +190249,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
190249
190249
|
return path2[0] === directorySeparator ? path2.slice(1) : path2;
|
|
190250
190250
|
}
|
|
190251
190251
|
function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
|
|
190252
|
-
const ambientModules = checker.getAmbientModules().map((sym) =>
|
|
190252
|
+
const ambientModules = checker.getAmbientModules().map((sym) => stripQuotes2(sym.name));
|
|
190253
190253
|
const nonRelativeModuleNames = ambientModules.filter((moduleName) => startsWith(moduleName, fragment) && !moduleName.includes("*"));
|
|
190254
190254
|
if (fragmentDirectory !== void 0) {
|
|
190255
190255
|
const moduleNameWithSeparator = ensureTrailingDirectorySeparator(fragmentDirectory);
|
|
@@ -191889,7 +191889,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
191889
191889
|
/** @param allSearchSymbols set of additional symbols for use by `includes`. */
|
|
191890
191890
|
createSearch(location, symbol, comingFrom, searchOptions = {}) {
|
|
191891
191891
|
const {
|
|
191892
|
-
text =
|
|
191892
|
+
text = stripQuotes2(symbolName(getLocalSymbolForExportDefault(symbol) || getNonModuleSymbolOfMergedModuleSymbol(symbol) || symbol)),
|
|
191893
191893
|
allSearchSymbols = [symbol]
|
|
191894
191894
|
} = searchOptions;
|
|
191895
191895
|
const escapedText = escapeLeadingUnderscores(text);
|
|
@@ -191901,10 +191901,10 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
191901
191901
|
* This initializes a reference group, so only call this if you will add at least one reference.
|
|
191902
191902
|
*/
|
|
191903
191903
|
referenceAdder(searchSymbol) {
|
|
191904
|
-
const
|
|
191905
|
-
let references = this.symbolIdToReferences[
|
|
191904
|
+
const symbolId2 = getSymbolId(searchSymbol);
|
|
191905
|
+
let references = this.symbolIdToReferences[symbolId2];
|
|
191906
191906
|
if (!references) {
|
|
191907
|
-
references = this.symbolIdToReferences[
|
|
191907
|
+
references = this.symbolIdToReferences[symbolId2] = [];
|
|
191908
191908
|
this.result.push({ definition: { type: 0, symbol: searchSymbol }, references });
|
|
191909
191909
|
}
|
|
191910
191910
|
return (node, kind) => references.push(nodeEntry(node, kind));
|
|
@@ -196097,7 +196097,7 @@ ${content}
|
|
|
196097
196097
|
return getRenameInfoError(wouldRenameNodeModules);
|
|
196098
196098
|
}
|
|
196099
196099
|
const kind = ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, node);
|
|
196100
|
-
const specifierName = isImportOrExportSpecifierName(node) || isStringOrNumericLiteralLike(node) && node.parent.kind === 168 ?
|
|
196100
|
+
const specifierName = isImportOrExportSpecifierName(node) || isStringOrNumericLiteralLike(node) && node.parent.kind === 168 ? stripQuotes2(getTextOfIdentifierOrLiteral(node)) : void 0;
|
|
196101
196101
|
const displayName = specifierName || typeChecker.symbolToString(symbol);
|
|
196102
196102
|
const fullDisplayName = specifierName || typeChecker.getFullyQualifiedName(symbol);
|
|
196103
196103
|
return getRenameInfoSuccess(displayName, fullDisplayName, kind, ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol), node, sourceFile);
|
|
@@ -205500,7 +205500,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
205500
205500
|
startsWithUseStrict: () => startsWithUseStrict,
|
|
205501
205501
|
stringContainsAt: () => stringContainsAt,
|
|
205502
205502
|
stringToToken: () => stringToToken,
|
|
205503
|
-
stripQuotes: () =>
|
|
205503
|
+
stripQuotes: () => stripQuotes2,
|
|
205504
205504
|
supportedDeclarationExtensions: () => supportedDeclarationExtensions,
|
|
205505
205505
|
supportedJSExtensionsFlat: () => supportedJSExtensionsFlat,
|
|
205506
205506
|
supportedLocaleDirectories: () => supportedLocaleDirectories,
|
|
@@ -208184,8 +208184,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
208184
208184
|
}
|
|
208185
208185
|
};
|
|
208186
208186
|
for (const file of files) {
|
|
208187
|
-
const
|
|
208188
|
-
if (
|
|
208187
|
+
const basename3 = getBaseFileName(file);
|
|
208188
|
+
if (basename3 === "package.json" || basename3 === "bower.json") {
|
|
208189
208189
|
createProjectWatcher(
|
|
208190
208190
|
file,
|
|
208191
208191
|
"FileWatcher"
|
|
@@ -208899,7 +208899,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
208899
208899
|
var _a, _b;
|
|
208900
208900
|
const sourceFiles = program.getSourceFiles();
|
|
208901
208901
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getUnresolvedImports", { count: sourceFiles.length });
|
|
208902
|
-
const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) =>
|
|
208902
|
+
const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) => stripQuotes2(mod.getName()));
|
|
208903
208903
|
const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
|
|
208904
208904
|
program,
|
|
208905
208905
|
sourceFile,
|
|
@@ -211857,8 +211857,8 @@ All files are: ${JSON.stringify(names)}`,
|
|
|
211857
211857
|
var _a;
|
|
211858
211858
|
const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
|
|
211859
211859
|
if (!fileOrDirectoryPath) return;
|
|
211860
|
-
const
|
|
211861
|
-
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (
|
|
211860
|
+
const basename3 = getBaseFileName(fileOrDirectoryPath);
|
|
211861
|
+
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename3 === "package.json" || basename3 === "node_modules")) {
|
|
211862
211862
|
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
211863
211863
|
var _a2;
|
|
211864
211864
|
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
@@ -218344,8 +218344,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
218344
218344
|
installPackage(options) {
|
|
218345
218345
|
this.packageInstallId++;
|
|
218346
218346
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
218347
|
-
const promise = new Promise((
|
|
218348
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
218347
|
+
const promise = new Promise((resolve8, reject) => {
|
|
218348
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve8, reject });
|
|
218349
218349
|
});
|
|
218350
218350
|
this.installer.send(request);
|
|
218351
218351
|
return promise;
|
|
@@ -221941,7 +221941,7 @@ var require_compile = __commonJS({
|
|
|
221941
221941
|
const schOrFunc = root.refs[ref];
|
|
221942
221942
|
if (schOrFunc)
|
|
221943
221943
|
return schOrFunc;
|
|
221944
|
-
let _sch =
|
|
221944
|
+
let _sch = resolve8.call(this, root, ref);
|
|
221945
221945
|
if (_sch === void 0) {
|
|
221946
221946
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
221947
221947
|
const { schemaId } = this.opts;
|
|
@@ -221968,7 +221968,7 @@ var require_compile = __commonJS({
|
|
|
221968
221968
|
function sameSchemaEnv(s1, s2) {
|
|
221969
221969
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
221970
221970
|
}
|
|
221971
|
-
function
|
|
221971
|
+
function resolve8(root, ref) {
|
|
221972
221972
|
let sch;
|
|
221973
221973
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
221974
221974
|
ref = sch;
|
|
@@ -222596,55 +222596,55 @@ var require_fast_uri = __commonJS({
|
|
|
222596
222596
|
}
|
|
222597
222597
|
return uri;
|
|
222598
222598
|
}
|
|
222599
|
-
function
|
|
222599
|
+
function resolve8(baseURI, relativeURI, options) {
|
|
222600
222600
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
222601
222601
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
222602
222602
|
schemelessOptions.skipEscape = true;
|
|
222603
222603
|
return serialize(resolved, schemelessOptions);
|
|
222604
222604
|
}
|
|
222605
|
-
function resolveComponent(base,
|
|
222605
|
+
function resolveComponent(base, relative5, options, skipNormalization) {
|
|
222606
222606
|
const target = {};
|
|
222607
222607
|
if (!skipNormalization) {
|
|
222608
222608
|
base = parse3(serialize(base, options), options);
|
|
222609
|
-
|
|
222609
|
+
relative5 = parse3(serialize(relative5, options), options);
|
|
222610
222610
|
}
|
|
222611
222611
|
options = options || {};
|
|
222612
|
-
if (!options.tolerant &&
|
|
222613
|
-
target.scheme =
|
|
222614
|
-
target.userinfo =
|
|
222615
|
-
target.host =
|
|
222616
|
-
target.port =
|
|
222617
|
-
target.path = removeDotSegments(
|
|
222618
|
-
target.query =
|
|
222612
|
+
if (!options.tolerant && relative5.scheme) {
|
|
222613
|
+
target.scheme = relative5.scheme;
|
|
222614
|
+
target.userinfo = relative5.userinfo;
|
|
222615
|
+
target.host = relative5.host;
|
|
222616
|
+
target.port = relative5.port;
|
|
222617
|
+
target.path = removeDotSegments(relative5.path || "");
|
|
222618
|
+
target.query = relative5.query;
|
|
222619
222619
|
} else {
|
|
222620
|
-
if (
|
|
222621
|
-
target.userinfo =
|
|
222622
|
-
target.host =
|
|
222623
|
-
target.port =
|
|
222624
|
-
target.path = removeDotSegments(
|
|
222625
|
-
target.query =
|
|
222620
|
+
if (relative5.userinfo !== void 0 || relative5.host !== void 0 || relative5.port !== void 0) {
|
|
222621
|
+
target.userinfo = relative5.userinfo;
|
|
222622
|
+
target.host = relative5.host;
|
|
222623
|
+
target.port = relative5.port;
|
|
222624
|
+
target.path = removeDotSegments(relative5.path || "");
|
|
222625
|
+
target.query = relative5.query;
|
|
222626
222626
|
} else {
|
|
222627
|
-
if (!
|
|
222627
|
+
if (!relative5.path) {
|
|
222628
222628
|
target.path = base.path;
|
|
222629
|
-
if (
|
|
222630
|
-
target.query =
|
|
222629
|
+
if (relative5.query !== void 0) {
|
|
222630
|
+
target.query = relative5.query;
|
|
222631
222631
|
} else {
|
|
222632
222632
|
target.query = base.query;
|
|
222633
222633
|
}
|
|
222634
222634
|
} else {
|
|
222635
|
-
if (
|
|
222636
|
-
target.path = removeDotSegments(
|
|
222635
|
+
if (relative5.path[0] === "/") {
|
|
222636
|
+
target.path = removeDotSegments(relative5.path);
|
|
222637
222637
|
} else {
|
|
222638
222638
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
222639
|
-
target.path = "/" +
|
|
222639
|
+
target.path = "/" + relative5.path;
|
|
222640
222640
|
} else if (!base.path) {
|
|
222641
|
-
target.path =
|
|
222641
|
+
target.path = relative5.path;
|
|
222642
222642
|
} else {
|
|
222643
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
222643
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative5.path;
|
|
222644
222644
|
}
|
|
222645
222645
|
target.path = removeDotSegments(target.path);
|
|
222646
222646
|
}
|
|
222647
|
-
target.query =
|
|
222647
|
+
target.query = relative5.query;
|
|
222648
222648
|
}
|
|
222649
222649
|
target.userinfo = base.userinfo;
|
|
222650
222650
|
target.host = base.host;
|
|
@@ -222652,7 +222652,7 @@ var require_fast_uri = __commonJS({
|
|
|
222652
222652
|
}
|
|
222653
222653
|
target.scheme = base.scheme;
|
|
222654
222654
|
}
|
|
222655
|
-
target.fragment =
|
|
222655
|
+
target.fragment = relative5.fragment;
|
|
222656
222656
|
return target;
|
|
222657
222657
|
}
|
|
222658
222658
|
function equal(uriA, uriB, options) {
|
|
@@ -222854,7 +222854,7 @@ var require_fast_uri = __commonJS({
|
|
|
222854
222854
|
var fastUri = {
|
|
222855
222855
|
SCHEMES,
|
|
222856
222856
|
normalize: normalize2,
|
|
222857
|
-
resolve:
|
|
222857
|
+
resolve: resolve8,
|
|
222858
222858
|
resolveComponent,
|
|
222859
222859
|
equal,
|
|
222860
222860
|
serialize,
|
|
@@ -231867,6 +231867,20 @@ var HARD_WRAP_THRESHOLD_TOKENS = 2e3;
|
|
|
231867
231867
|
function estimateTokens(text) {
|
|
231868
231868
|
return Math.ceil(Buffer.byteLength(text, "utf8") / 4);
|
|
231869
231869
|
}
|
|
231870
|
+
function chunkByLines(text, linesPerChunk) {
|
|
231871
|
+
if (text === "") return [];
|
|
231872
|
+
const lines = text.split("\n");
|
|
231873
|
+
const chunks = [];
|
|
231874
|
+
for (let start = 0; start < lines.length; start += linesPerChunk) {
|
|
231875
|
+
const slice = lines.slice(start, start + linesPerChunk);
|
|
231876
|
+
chunks.push({
|
|
231877
|
+
text: slice.join("\n"),
|
|
231878
|
+
startLine: start + 1,
|
|
231879
|
+
endLine: start + slice.length
|
|
231880
|
+
});
|
|
231881
|
+
}
|
|
231882
|
+
return chunks;
|
|
231883
|
+
}
|
|
231870
231884
|
var MASK = (1n << 64n) - 1n;
|
|
231871
231885
|
function hashToken(token) {
|
|
231872
231886
|
let h2 = 1469598103934665603n;
|
|
@@ -231936,20 +231950,6 @@ function effectiveBudget(maxReturnedBytes, modeBudget) {
|
|
|
231936
231950
|
if (maxReturnedBytes === void 0) return modeBudget;
|
|
231937
231951
|
return Math.min(maxReturnedBytes, HARD_CEILING_BYTES);
|
|
231938
231952
|
}
|
|
231939
|
-
function chunkByLines(text, linesPerChunk) {
|
|
231940
|
-
if (text === "") return [];
|
|
231941
|
-
const lines = text.split("\n");
|
|
231942
|
-
const chunks = [];
|
|
231943
|
-
for (let start = 0; start < lines.length; start += linesPerChunk) {
|
|
231944
|
-
const slice = lines.slice(start, start + linesPerChunk);
|
|
231945
|
-
chunks.push({
|
|
231946
|
-
text: slice.join("\n"),
|
|
231947
|
-
startLine: start + 1,
|
|
231948
|
-
endLine: start + slice.length
|
|
231949
|
-
});
|
|
231950
|
-
}
|
|
231951
|
-
return chunks;
|
|
231952
|
-
}
|
|
231953
231953
|
var RESULT_LINE = /^test result:/m;
|
|
231954
231954
|
var STDOUT_HEADER = /^---- .+ stdout ----$/;
|
|
231955
231955
|
var SUMMARY_LINE = /^(?:failures:|test result:)/;
|
|
@@ -232207,6 +232207,24 @@ var filterOutputInputSchema = external_exports.object({
|
|
|
232207
232207
|
external_exports.object({ kind: external_exports.literal("fetch"), url: external_exports.string() })
|
|
232208
232208
|
]).optional()
|
|
232209
232209
|
}).strict();
|
|
232210
|
+
var GENERIC_FALLBACK_LINES_PER_CHUNK = 40;
|
|
232211
|
+
function truncateToBytes(text, maxBytes) {
|
|
232212
|
+
const buf = Buffer.from(text, "utf8");
|
|
232213
|
+
if (buf.length <= maxBytes) return text;
|
|
232214
|
+
let end = maxBytes;
|
|
232215
|
+
while (end > 0) {
|
|
232216
|
+
const byte = buf[end];
|
|
232217
|
+
if (byte === void 0 || (byte & 192) !== 128) break;
|
|
232218
|
+
end -= 1;
|
|
232219
|
+
}
|
|
232220
|
+
return buf.toString("utf8", 0, end);
|
|
232221
|
+
}
|
|
232222
|
+
function truncateChunkToBytes(chunk, maxBytes) {
|
|
232223
|
+
const text = truncateToBytes(chunk.text, maxBytes);
|
|
232224
|
+
if (text === chunk.text) return chunk;
|
|
232225
|
+
const endLine = chunk.startLine + text.split("\n").length - 1;
|
|
232226
|
+
return { ...chunk, text, endLine };
|
|
232227
|
+
}
|
|
232210
232228
|
function excerptOf(chunk) {
|
|
232211
232229
|
const base = {
|
|
232212
232230
|
text: chunk.text,
|
|
@@ -232248,9 +232266,30 @@ function filterOutput(input) {
|
|
|
232248
232266
|
const deduped = dedupe(ranked);
|
|
232249
232267
|
const ordered = [...deduped].sort((a2, b2) => b2.score - a2.score);
|
|
232250
232268
|
const budget = effectiveBudget(maxReturnedBytes, modeToBudget(mode));
|
|
232251
|
-
|
|
232252
|
-
|
|
232253
|
-
|
|
232269
|
+
let kept = decision === "compressed" ? fitBudget(deduped, budget) : ordered;
|
|
232270
|
+
let omitted = deduped.filter((c3) => !kept.includes(c3));
|
|
232271
|
+
let droppedCount = deduped.length - kept.length;
|
|
232272
|
+
if (kept.length === 0 && normalized.trim() !== "") {
|
|
232273
|
+
const scoredFallback = chunkByLines(normalized, GENERIC_FALLBACK_LINES_PER_CHUNK).map(
|
|
232274
|
+
(c3) => scoreChunk(intent, c3, sessionHints)
|
|
232275
|
+
);
|
|
232276
|
+
const fallback = engineEnabled ? applyEngineRanking(scoredFallback, sessionHints) : scoredFallback;
|
|
232277
|
+
const fallbackOrdered = [...fallback].sort((a2, b2) => b2.score - a2.score);
|
|
232278
|
+
const fitted = fitBudget(fallback, budget);
|
|
232279
|
+
const top = fallbackOrdered[0];
|
|
232280
|
+
if (fitted.length > 0) {
|
|
232281
|
+
kept = fitted;
|
|
232282
|
+
omitted = fallbackOrdered.filter((c3) => !kept.includes(c3));
|
|
232283
|
+
droppedCount = fallbackOrdered.length - fitted.length;
|
|
232284
|
+
} else if (top !== void 0) {
|
|
232285
|
+
kept = [truncateChunkToBytes(top, budget)];
|
|
232286
|
+
omitted = fallbackOrdered.slice(1);
|
|
232287
|
+
droppedCount = fallbackOrdered.length - 1;
|
|
232288
|
+
}
|
|
232289
|
+
if (kept.length > 0) {
|
|
232290
|
+
warnings.push("specialized compression produced no excerpts; returned generic excerpt");
|
|
232291
|
+
}
|
|
232292
|
+
}
|
|
232254
232293
|
const summary = decision === "passthrough" ? `passthrough: ${rawTokens} tokens below compression threshold` : summarize(mode, kept, droppedCount);
|
|
232255
232294
|
const excerpts = kept.map(excerptOf);
|
|
232256
232295
|
const returnedBytes = Buffer.byteLength(summary, "utf8") + excerpts.reduce((sum, e2) => sum + Buffer.byteLength(e2.text, "utf8"), 0);
|
|
@@ -233612,7 +233651,7 @@ async function runOutputPipeline(input) {
|
|
|
233612
233651
|
var KILL_GRACE_MS = 2e3;
|
|
233613
233652
|
var MAX_RETURNED_CEILING = 2 * modeToBudget("safe");
|
|
233614
233653
|
function runChild(input) {
|
|
233615
|
-
return new Promise((
|
|
233654
|
+
return new Promise((resolve8) => {
|
|
233616
233655
|
let child;
|
|
233617
233656
|
try {
|
|
233618
233657
|
child = input.spawn(input.command, [...input.args], {
|
|
@@ -233622,7 +233661,7 @@ function runChild(input) {
|
|
|
233622
233661
|
env: { ...process.env, MEGASAVER_ORIGIN_PID: input.originPid }
|
|
233623
233662
|
});
|
|
233624
233663
|
} catch (err) {
|
|
233625
|
-
|
|
233664
|
+
resolve8({ ok: false, reason: "command_failed", detail: messageOf(err) });
|
|
233626
233665
|
return;
|
|
233627
233666
|
}
|
|
233628
233667
|
const buffers = [];
|
|
@@ -233660,14 +233699,14 @@ function runChild(input) {
|
|
|
233660
233699
|
settled = true;
|
|
233661
233700
|
clearTimeout(timeoutTimer);
|
|
233662
233701
|
if (killTimer !== void 0) clearTimeout(killTimer);
|
|
233663
|
-
|
|
233702
|
+
resolve8({ ok: false, reason: "command_failed", detail: err.message });
|
|
233664
233703
|
});
|
|
233665
233704
|
child.on("close", (code) => {
|
|
233666
233705
|
if (settled) return;
|
|
233667
233706
|
settled = true;
|
|
233668
233707
|
clearTimeout(timeoutTimer);
|
|
233669
233708
|
if (killTimer !== void 0) clearTimeout(killTimer);
|
|
233670
|
-
|
|
233709
|
+
resolve8({
|
|
233671
233710
|
ok: true,
|
|
233672
233711
|
capture: {
|
|
233673
233712
|
raw: Buffer.concat(buffers).toString("utf8"),
|
|
@@ -238731,7 +238770,7 @@ ConnectorContextSchema.superRefine((context, ctx) => {
|
|
|
238731
238770
|
var HOOK_MATCHER = "Read|Bash|Grep|Glob|LS";
|
|
238732
238771
|
var DEFAULT_HOOK_COMMAND = "mega hooks log";
|
|
238733
238772
|
var SAVER_HOOK_COMMAND = "mega hooks saver";
|
|
238734
|
-
var SAVER_HOOK_MATCHER = "Read|Bash|Grep|Glob|LS";
|
|
238773
|
+
var SAVER_HOOK_MATCHER = "Read|Bash|Grep|Glob|LS|WebFetch";
|
|
238735
238774
|
function asSettings(value) {
|
|
238736
238775
|
return typeof value === "object" && value !== null ? { ...value } : {};
|
|
238737
238776
|
}
|
|
@@ -239284,12 +239323,12 @@ async function runGithubPrComment(input) {
|
|
|
239284
239323
|
}
|
|
239285
239324
|
async function defaultSpawnPost(prNumber, body) {
|
|
239286
239325
|
const { spawn } = await import('child_process');
|
|
239287
|
-
return await new Promise((
|
|
239326
|
+
return await new Promise((resolve8) => {
|
|
239288
239327
|
const child = spawn("gh", ["pr", "comment", prNumber, "--body-file", "-"], {
|
|
239289
239328
|
stdio: ["pipe", "inherit", "inherit"]
|
|
239290
239329
|
});
|
|
239291
|
-
child.on("error", () =>
|
|
239292
|
-
child.on("close", (code) =>
|
|
239330
|
+
child.on("error", () => resolve8(1));
|
|
239331
|
+
child.on("close", (code) => resolve8(code ?? 1));
|
|
239293
239332
|
child.stdin.write(body);
|
|
239294
239333
|
child.stdin.end();
|
|
239295
239334
|
});
|
|
@@ -239416,12 +239455,18 @@ var TOOL_SOURCE = {
|
|
|
239416
239455
|
LS: "file",
|
|
239417
239456
|
Bash: "command",
|
|
239418
239457
|
Grep: "grep",
|
|
239419
|
-
Glob: "grep"
|
|
239458
|
+
Glob: "grep",
|
|
239459
|
+
WebFetch: "fetch"
|
|
239420
239460
|
};
|
|
239421
239461
|
var PASSTHROUGH = { passthrough: true };
|
|
239422
239462
|
function readOutputShape(toolOutput) {
|
|
239463
|
+
if (typeof toolOutput === "string") {
|
|
239464
|
+
return toolOutput.length === 0 ? null : { raw: toolOutput, rebuild: (t2) => t2 };
|
|
239465
|
+
}
|
|
239423
239466
|
if (typeof toolOutput !== "object" || toolOutput === null) return null;
|
|
239424
239467
|
const o3 = toolOutput;
|
|
239468
|
+
if (typeof o3["result"] === "string")
|
|
239469
|
+
return { raw: o3["result"], rebuild: (t2) => ({ ...o3, result: t2 }) };
|
|
239425
239470
|
if (typeof o3["stdout"] === "string")
|
|
239426
239471
|
return { raw: o3["stdout"], rebuild: (t2) => ({ ...o3, stdout: t2 }) };
|
|
239427
239472
|
if (typeof o3["content"] === "string") {
|
|
@@ -239464,7 +239509,10 @@ function labelOf(toolInput, fallback) {
|
|
|
239464
239509
|
asStr(i2["file_path"]) ?? // biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature
|
|
239465
239510
|
asStr(i2["path"]) ?? // biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature
|
|
239466
239511
|
asStr(i2["command"]) ?? // biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature
|
|
239467
|
-
asStr(i2["pattern"]) ??
|
|
239512
|
+
asStr(i2["pattern"]) ?? // WebFetch labels by url; the fetch chunk-set source validates it as a URL,
|
|
239513
|
+
// so a bad fallback ("WebFetch") would fail persistence and blank the save.
|
|
239514
|
+
// biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature
|
|
239515
|
+
asStr(i2["url"]) ?? fallback
|
|
239468
239516
|
);
|
|
239469
239517
|
}
|
|
239470
239518
|
async function buildSaverDecision(payload, deps) {
|
|
@@ -245895,7 +245943,7 @@ var Protocol = class {
|
|
|
245895
245943
|
return;
|
|
245896
245944
|
}
|
|
245897
245945
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
245898
|
-
await new Promise((
|
|
245946
|
+
await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
|
|
245899
245947
|
options?.signal?.throwIfAborted();
|
|
245900
245948
|
}
|
|
245901
245949
|
} catch (error2) {
|
|
@@ -245912,7 +245960,7 @@ var Protocol = class {
|
|
|
245912
245960
|
*/
|
|
245913
245961
|
request(request, resultSchema, options) {
|
|
245914
245962
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
245915
|
-
return new Promise((
|
|
245963
|
+
return new Promise((resolve8, reject) => {
|
|
245916
245964
|
const earlyReject = (error2) => {
|
|
245917
245965
|
reject(error2);
|
|
245918
245966
|
};
|
|
@@ -245990,7 +246038,7 @@ var Protocol = class {
|
|
|
245990
246038
|
if (!parseResult.success) {
|
|
245991
246039
|
reject(parseResult.error);
|
|
245992
246040
|
} else {
|
|
245993
|
-
|
|
246041
|
+
resolve8(parseResult.data);
|
|
245994
246042
|
}
|
|
245995
246043
|
} catch (error2) {
|
|
245996
246044
|
reject(error2);
|
|
@@ -246251,12 +246299,12 @@ var Protocol = class {
|
|
|
246251
246299
|
}
|
|
246252
246300
|
} catch {
|
|
246253
246301
|
}
|
|
246254
|
-
return new Promise((
|
|
246302
|
+
return new Promise((resolve8, reject) => {
|
|
246255
246303
|
if (signal.aborted) {
|
|
246256
246304
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
246257
246305
|
return;
|
|
246258
246306
|
}
|
|
246259
|
-
const timeoutId = setTimeout(
|
|
246307
|
+
const timeoutId = setTimeout(resolve8, interval);
|
|
246260
246308
|
signal.addEventListener("abort", () => {
|
|
246261
246309
|
clearTimeout(timeoutId);
|
|
246262
246310
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -247110,12 +247158,12 @@ var StdioServerTransport = class {
|
|
|
247110
247158
|
this.onclose?.();
|
|
247111
247159
|
}
|
|
247112
247160
|
send(message) {
|
|
247113
|
-
return new Promise((
|
|
247161
|
+
return new Promise((resolve8) => {
|
|
247114
247162
|
const json = serializeMessage(message);
|
|
247115
247163
|
if (this._stdout.write(json)) {
|
|
247116
|
-
|
|
247164
|
+
resolve8();
|
|
247117
247165
|
} else {
|
|
247118
|
-
this._stdout.once("drain",
|
|
247166
|
+
this._stdout.once("drain", resolve8);
|
|
247119
247167
|
}
|
|
247120
247168
|
});
|
|
247121
247169
|
}
|
|
@@ -248929,12 +248977,12 @@ async function runMcpServe(deps) {
|
|
|
248929
248977
|
}
|
|
248930
248978
|
}
|
|
248931
248979
|
function waitForStdioShutdown() {
|
|
248932
|
-
return new Promise((
|
|
248980
|
+
return new Promise((resolve8) => {
|
|
248933
248981
|
const done = () => {
|
|
248934
248982
|
process.stdin.off("end", done);
|
|
248935
248983
|
process.off("SIGINT", done);
|
|
248936
248984
|
process.off("SIGTERM", done);
|
|
248937
|
-
|
|
248985
|
+
resolve8();
|
|
248938
248986
|
};
|
|
248939
248987
|
process.stdin.once("end", done);
|
|
248940
248988
|
process.once("SIGINT", done);
|
|
@@ -249585,6 +249633,448 @@ var memoryExplainCommand = defineCommand({
|
|
|
249585
249633
|
}
|
|
249586
249634
|
});
|
|
249587
249635
|
|
|
249636
|
+
// ../../packages/memory-graph/dist/index.js
|
|
249637
|
+
var nodeKindSchema = external_exports.enum([
|
|
249638
|
+
"project",
|
|
249639
|
+
"session",
|
|
249640
|
+
"memory",
|
|
249641
|
+
"evidence",
|
|
249642
|
+
"chunkset",
|
|
249643
|
+
"file",
|
|
249644
|
+
"symbol",
|
|
249645
|
+
"wiki"
|
|
249646
|
+
]);
|
|
249647
|
+
var edgeKindSchema = external_exports.enum([
|
|
249648
|
+
"contains",
|
|
249649
|
+
"scope",
|
|
249650
|
+
"project-memory",
|
|
249651
|
+
"cites",
|
|
249652
|
+
"chunk-of",
|
|
249653
|
+
"from-session",
|
|
249654
|
+
"conflict",
|
|
249655
|
+
"supersede",
|
|
249656
|
+
"duplicate",
|
|
249657
|
+
"code-link",
|
|
249658
|
+
"wiki-link",
|
|
249659
|
+
"wiki-source",
|
|
249660
|
+
"wiki-cite"
|
|
249661
|
+
]);
|
|
249662
|
+
var graphNodeSchema = external_exports.object({
|
|
249663
|
+
id: external_exports.string().min(1),
|
|
249664
|
+
kind: nodeKindSchema,
|
|
249665
|
+
label: external_exports.string(),
|
|
249666
|
+
meta: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
249667
|
+
}).strict();
|
|
249668
|
+
var graphEdgeSchema = external_exports.object({
|
|
249669
|
+
id: external_exports.string().min(1),
|
|
249670
|
+
kind: edgeKindSchema,
|
|
249671
|
+
from: external_exports.string().min(1),
|
|
249672
|
+
to: external_exports.string().min(1)
|
|
249673
|
+
}).strict();
|
|
249674
|
+
external_exports.object({
|
|
249675
|
+
nodes: external_exports.array(graphNodeSchema),
|
|
249676
|
+
edges: external_exports.array(graphEdgeSchema),
|
|
249677
|
+
stats: external_exports.object({ nodeCount: external_exports.number().int(), edgeCount: external_exports.number().int() })
|
|
249678
|
+
}).strict();
|
|
249679
|
+
var canonFilePath = (p) => p.startsWith("./") ? p.slice(2) : p;
|
|
249680
|
+
var fileId = (path2) => `file:${canonFilePath(path2)}`;
|
|
249681
|
+
var symbolId = (symbol) => `symbol:${symbol}`;
|
|
249682
|
+
var wikiId = (path2) => `wiki:${path2}`;
|
|
249683
|
+
function buildGraph(input) {
|
|
249684
|
+
const nodes = [];
|
|
249685
|
+
const ids = /* @__PURE__ */ new Set();
|
|
249686
|
+
const add = (n2) => {
|
|
249687
|
+
if (ids.has(n2.id)) return;
|
|
249688
|
+
nodes.push(n2);
|
|
249689
|
+
ids.add(n2.id);
|
|
249690
|
+
};
|
|
249691
|
+
for (const p of input.projects) add({ id: p.id, kind: "project", label: p.name, meta: {} });
|
|
249692
|
+
for (const s2 of input.sessions)
|
|
249693
|
+
add({ id: s2.id, kind: "session", label: s2.id.slice(0, 8), meta: { projectId: s2.projectId } });
|
|
249694
|
+
for (const m2 of input.memories)
|
|
249695
|
+
add({
|
|
249696
|
+
id: m2.id,
|
|
249697
|
+
kind: "memory",
|
|
249698
|
+
label: m2.title,
|
|
249699
|
+
meta: {
|
|
249700
|
+
memoryType: m2.memoryType,
|
|
249701
|
+
approval: m2.approval,
|
|
249702
|
+
confidence: m2.confidence,
|
|
249703
|
+
source: m2.source,
|
|
249704
|
+
scope: m2.scope,
|
|
249705
|
+
stale: m2.stale
|
|
249706
|
+
}
|
|
249707
|
+
});
|
|
249708
|
+
for (const e2 of input.evidence)
|
|
249709
|
+
add({
|
|
249710
|
+
id: e2.evidenceId,
|
|
249711
|
+
kind: "evidence",
|
|
249712
|
+
label: `${e2.sourceKind} ${e2.evidenceId.slice(0, 6)}`,
|
|
249713
|
+
meta: { status: e2.status }
|
|
249714
|
+
});
|
|
249715
|
+
for (const c3 of input.chunkSets)
|
|
249716
|
+
add({ id: c3.chunkSetId, kind: "chunkset", label: c3.label, meta: { redacted: c3.redacted } });
|
|
249717
|
+
for (const w2 of input.wikiPages)
|
|
249718
|
+
add({
|
|
249719
|
+
id: wikiId(w2.path),
|
|
249720
|
+
kind: "wiki",
|
|
249721
|
+
label: w2.title,
|
|
249722
|
+
meta: { tags: w2.tags, status: w2.status }
|
|
249723
|
+
});
|
|
249724
|
+
for (const f3 of input.files) {
|
|
249725
|
+
const path2 = canonFilePath(f3.path);
|
|
249726
|
+
add({ id: fileId(f3.path), kind: "file", label: path2.split("/").pop() ?? path2, meta: { path: path2 } });
|
|
249727
|
+
}
|
|
249728
|
+
for (const sym of input.symbols)
|
|
249729
|
+
add({ id: symbolId(sym.symbol), kind: "symbol", label: sym.symbol, meta: {} });
|
|
249730
|
+
const wikiResolve = /* @__PURE__ */ new Map();
|
|
249731
|
+
const ambiguous = /* @__PURE__ */ new Set();
|
|
249732
|
+
const addKey = (key, path2, allowAmbiguous) => {
|
|
249733
|
+
const lo = key.toLowerCase();
|
|
249734
|
+
if (allowAmbiguous && (ambiguous.has(lo) || wikiResolve.has(lo) && wikiResolve.get(lo) !== path2)) {
|
|
249735
|
+
ambiguous.add(lo);
|
|
249736
|
+
wikiResolve.delete(lo);
|
|
249737
|
+
return;
|
|
249738
|
+
}
|
|
249739
|
+
if (!ambiguous.has(lo)) wikiResolve.set(lo, path2);
|
|
249740
|
+
};
|
|
249741
|
+
for (const w2 of input.wikiPages) {
|
|
249742
|
+
const p = w2.path;
|
|
249743
|
+
const withoutMd = p.endsWith(".md") ? p.slice(0, -3) : p;
|
|
249744
|
+
addKey(p, p, false);
|
|
249745
|
+
addKey(withoutMd, p, false);
|
|
249746
|
+
addKey(withoutMd.split("/").pop() ?? withoutMd, p, true);
|
|
249747
|
+
addKey(w2.title, p, true);
|
|
249748
|
+
}
|
|
249749
|
+
const resolveWiki = (raw) => {
|
|
249750
|
+
const lo = raw.toLowerCase();
|
|
249751
|
+
return wikiResolve.get(lo) ?? wikiResolve.get(`${lo}.md`);
|
|
249752
|
+
};
|
|
249753
|
+
const edges = [];
|
|
249754
|
+
const seen = /* @__PURE__ */ new Set();
|
|
249755
|
+
const undirected = /* @__PURE__ */ new Set(["conflict", "duplicate"]);
|
|
249756
|
+
const link = (kind, from, to) => {
|
|
249757
|
+
if (!ids.has(from) || !ids.has(to)) return;
|
|
249758
|
+
const [a2, b2] = undirected.has(kind) && from > to ? [to, from] : [from, to];
|
|
249759
|
+
const id = `${kind}:${a2}->${b2}`;
|
|
249760
|
+
if (seen.has(id)) return;
|
|
249761
|
+
seen.add(id);
|
|
249762
|
+
edges.push({ id, kind, from: a2, to: b2 });
|
|
249763
|
+
};
|
|
249764
|
+
for (const s2 of input.sessions) if (s2.projectId) link("contains", s2.projectId, s2.id);
|
|
249765
|
+
for (const m2 of input.memories) {
|
|
249766
|
+
if (m2.scope === "session" && m2.sessionId) link("scope", m2.sessionId, m2.id);
|
|
249767
|
+
else if (m2.scope === "project" && m2.projectId) link("project-memory", m2.projectId, m2.id);
|
|
249768
|
+
for (const evId of m2.evidenceIds) link("cites", m2.id, evId);
|
|
249769
|
+
for (const fp of m2.relatedFiles) link("code-link", m2.id, fileId(fp));
|
|
249770
|
+
for (const sym of m2.relatedSymbols) link("code-link", m2.id, symbolId(sym));
|
|
249771
|
+
}
|
|
249772
|
+
for (const e2 of input.evidence) {
|
|
249773
|
+
if (e2.sessionId) link("from-session", e2.evidenceId, e2.sessionId);
|
|
249774
|
+
for (const cs of e2.chunkSetIds) link("chunk-of", e2.evidenceId, cs);
|
|
249775
|
+
}
|
|
249776
|
+
for (const c3 of input.conflicts) link(c3.kind, c3.from, c3.to);
|
|
249777
|
+
for (const w2 of input.wikiPages) {
|
|
249778
|
+
for (const lnk of w2.links) {
|
|
249779
|
+
const resolved = resolveWiki(lnk);
|
|
249780
|
+
if (resolved) link("wiki-link", wikiId(w2.path), wikiId(resolved));
|
|
249781
|
+
}
|
|
249782
|
+
for (const src2 of w2.sources) {
|
|
249783
|
+
const resolved = resolveWiki(src2);
|
|
249784
|
+
if (resolved) link("wiki-source", wikiId(w2.path), wikiId(resolved));
|
|
249785
|
+
}
|
|
249786
|
+
for (const cite of w2.fileCites) link("wiki-cite", wikiId(w2.path), fileId(cite));
|
|
249787
|
+
}
|
|
249788
|
+
return { nodes, edges, stats: { nodeCount: nodes.length, edgeCount: edges.length } };
|
|
249789
|
+
}
|
|
249790
|
+
function canonicalizeFilePath(s2) {
|
|
249791
|
+
let out = s2.trim();
|
|
249792
|
+
if (out.startsWith("`") && out.endsWith("`") || out.startsWith("'") && out.endsWith("'") || out.startsWith('"') && out.endsWith('"')) {
|
|
249793
|
+
out = out.slice(1, -1).trim();
|
|
249794
|
+
}
|
|
249795
|
+
out = out.replace(/:\d+(?:[-–]\d+)?$/, "").trim();
|
|
249796
|
+
if (out.startsWith("./")) out = out.slice(2);
|
|
249797
|
+
return out;
|
|
249798
|
+
}
|
|
249799
|
+
function stripQuotes(s2) {
|
|
249800
|
+
const t2 = s2.trim();
|
|
249801
|
+
return t2.startsWith("'") && t2.endsWith("'") || t2.startsWith('"') && t2.endsWith('"') ? t2.slice(1, -1) : t2;
|
|
249802
|
+
}
|
|
249803
|
+
function parseInlineArray(s2) {
|
|
249804
|
+
const t2 = s2.trim();
|
|
249805
|
+
if (!t2.startsWith("[") || !t2.endsWith("]")) return [];
|
|
249806
|
+
return t2.slice(1, -1).split(",").map((x2) => stripQuotes(x2).trim()).filter((x2) => x2.length > 0);
|
|
249807
|
+
}
|
|
249808
|
+
function basename2(relPath) {
|
|
249809
|
+
const last = relPath.split("/").pop() ?? relPath;
|
|
249810
|
+
return last.endsWith(".md") ? last.slice(0, -3) : last;
|
|
249811
|
+
}
|
|
249812
|
+
function looksLikePath(s2) {
|
|
249813
|
+
return s2.includes("/") || /\.[A-Za-z0-9]+$/.test(s2);
|
|
249814
|
+
}
|
|
249815
|
+
function parseWikiPage(relPath, content) {
|
|
249816
|
+
let title = basename2(relPath);
|
|
249817
|
+
const tags = [];
|
|
249818
|
+
const sources = [];
|
|
249819
|
+
let status = "active";
|
|
249820
|
+
const fm = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
249821
|
+
if (fm) {
|
|
249822
|
+
const lines = fm[1].split(/\r?\n/);
|
|
249823
|
+
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
249824
|
+
const line2 = lines[i2].replace(/\r$/, "");
|
|
249825
|
+
const m2 = line2.match(/^([A-Za-z_]+):\s*(.*)$/);
|
|
249826
|
+
if (!m2) continue;
|
|
249827
|
+
const key = m2[1];
|
|
249828
|
+
const rest = m2[2].trim();
|
|
249829
|
+
const collectList = () => {
|
|
249830
|
+
if (rest.startsWith("[")) return parseInlineArray(rest);
|
|
249831
|
+
const out = [];
|
|
249832
|
+
while (i2 + 1 < lines.length && /^\s*-\s+/.test(lines[i2 + 1])) {
|
|
249833
|
+
out.push(
|
|
249834
|
+
stripQuotes(lines[++i2].replace(/\r$/, "").replace(/^\s*-\s+/, "")).trim()
|
|
249835
|
+
);
|
|
249836
|
+
}
|
|
249837
|
+
return out;
|
|
249838
|
+
};
|
|
249839
|
+
if (key === "title") title = stripQuotes(rest) || title;
|
|
249840
|
+
else if (key === "status") status = stripQuotes(rest) || status;
|
|
249841
|
+
else if (key === "tags") tags.push(...collectList());
|
|
249842
|
+
else if (key === "sources") sources.push(...collectList());
|
|
249843
|
+
}
|
|
249844
|
+
}
|
|
249845
|
+
const body = fm ? content.slice(fm[0].length) : content;
|
|
249846
|
+
const links = [...body.matchAll(/\[\[([^\]]+)\]\]/g)].map((mm) => {
|
|
249847
|
+
const ref = mm[1];
|
|
249848
|
+
const withoutAlias = ref.split("|")[0] ?? ref;
|
|
249849
|
+
return (withoutAlias.split("#")[0] ?? withoutAlias).trim();
|
|
249850
|
+
});
|
|
249851
|
+
const fileCites = [
|
|
249852
|
+
...new Set(
|
|
249853
|
+
[...body.matchAll(/\(source:\s*([^)]+)\)/g)].map((mm) => {
|
|
249854
|
+
let s2 = mm[1].trim();
|
|
249855
|
+
if (s2.startsWith("[[")) return null;
|
|
249856
|
+
s2 = s2.replace(/\s+#\S.*$/, "").trim();
|
|
249857
|
+
return canonicalizeFilePath(s2);
|
|
249858
|
+
}).filter((s2) => s2 !== null && looksLikePath(s2))
|
|
249859
|
+
)
|
|
249860
|
+
];
|
|
249861
|
+
return { path: relPath, title, tags, status, links, sources, fileCites };
|
|
249862
|
+
}
|
|
249863
|
+
var memoryInputSchema = external_exports.object({
|
|
249864
|
+
id: external_exports.string(),
|
|
249865
|
+
scope: external_exports.enum(["project", "session"]),
|
|
249866
|
+
sessionId: external_exports.string().nullable(),
|
|
249867
|
+
projectId: external_exports.string().nullable(),
|
|
249868
|
+
memoryType: external_exports.string(),
|
|
249869
|
+
title: external_exports.string(),
|
|
249870
|
+
approval: external_exports.string(),
|
|
249871
|
+
confidence: external_exports.string(),
|
|
249872
|
+
source: external_exports.string(),
|
|
249873
|
+
stale: external_exports.boolean(),
|
|
249874
|
+
evidenceIds: external_exports.array(external_exports.string()),
|
|
249875
|
+
relatedFiles: external_exports.array(external_exports.string()).default([]),
|
|
249876
|
+
relatedSymbols: external_exports.array(external_exports.string()).default([])
|
|
249877
|
+
});
|
|
249878
|
+
var evidenceInputSchema = external_exports.object({
|
|
249879
|
+
evidenceId: external_exports.string(),
|
|
249880
|
+
sourceKind: external_exports.string(),
|
|
249881
|
+
sessionId: external_exports.string().nullable(),
|
|
249882
|
+
chunkSetIds: external_exports.array(external_exports.string()),
|
|
249883
|
+
status: external_exports.string()
|
|
249884
|
+
});
|
|
249885
|
+
var sessionInputSchema = external_exports.object({ id: external_exports.string(), projectId: external_exports.string().nullable() });
|
|
249886
|
+
var projectInputSchema = external_exports.object({ id: external_exports.string(), name: external_exports.string() });
|
|
249887
|
+
var chunkSetInputSchema = external_exports.object({
|
|
249888
|
+
chunkSetId: external_exports.string(),
|
|
249889
|
+
label: external_exports.string(),
|
|
249890
|
+
redacted: external_exports.boolean()
|
|
249891
|
+
});
|
|
249892
|
+
var conflictPairSchema = external_exports.object({
|
|
249893
|
+
from: external_exports.string(),
|
|
249894
|
+
to: external_exports.string(),
|
|
249895
|
+
kind: external_exports.enum(["conflict", "supersede", "duplicate"])
|
|
249896
|
+
});
|
|
249897
|
+
var fileInputSchema = external_exports.object({ path: external_exports.string() });
|
|
249898
|
+
var symbolInputSchema = external_exports.object({ symbol: external_exports.string() });
|
|
249899
|
+
var wikiInputSchema = external_exports.object({
|
|
249900
|
+
path: external_exports.string(),
|
|
249901
|
+
title: external_exports.string(),
|
|
249902
|
+
tags: external_exports.array(external_exports.string()),
|
|
249903
|
+
status: external_exports.string(),
|
|
249904
|
+
links: external_exports.array(external_exports.string()),
|
|
249905
|
+
sources: external_exports.array(external_exports.string()),
|
|
249906
|
+
fileCites: external_exports.array(external_exports.string())
|
|
249907
|
+
});
|
|
249908
|
+
external_exports.object({
|
|
249909
|
+
projects: external_exports.array(projectInputSchema),
|
|
249910
|
+
sessions: external_exports.array(sessionInputSchema),
|
|
249911
|
+
memories: external_exports.array(memoryInputSchema),
|
|
249912
|
+
evidence: external_exports.array(evidenceInputSchema),
|
|
249913
|
+
chunkSets: external_exports.array(chunkSetInputSchema),
|
|
249914
|
+
conflicts: external_exports.array(conflictPairSchema),
|
|
249915
|
+
files: external_exports.array(fileInputSchema).default([]),
|
|
249916
|
+
symbols: external_exports.array(symbolInputSchema).default([]),
|
|
249917
|
+
wikiPages: external_exports.array(wikiInputSchema).default([])
|
|
249918
|
+
});
|
|
249919
|
+
var WIKI_FOLDERS = ["entities", "concepts", "decisions", "syntheses", "workflows", "sources"];
|
|
249920
|
+
async function readWikiPages(rootPath) {
|
|
249921
|
+
const wikiRoot = resolve(join(rootPath, "wiki"));
|
|
249922
|
+
const results = [];
|
|
249923
|
+
async function walkDir(dir) {
|
|
249924
|
+
const entries = await readdir(dir, { withFileTypes: true }).catch(() => null);
|
|
249925
|
+
if (entries === null) return;
|
|
249926
|
+
for (const entry of entries) {
|
|
249927
|
+
const fullPath = join(dir, entry.name);
|
|
249928
|
+
if (entry.isSymbolicLink()) continue;
|
|
249929
|
+
if (entry.isDirectory()) {
|
|
249930
|
+
await walkDir(fullPath);
|
|
249931
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
249932
|
+
let content;
|
|
249933
|
+
try {
|
|
249934
|
+
content = await readFile(fullPath, "utf8");
|
|
249935
|
+
} catch {
|
|
249936
|
+
continue;
|
|
249937
|
+
}
|
|
249938
|
+
const relPath = relative(wikiRoot, fullPath).split(sep).join("/");
|
|
249939
|
+
results.push(parseWikiPage(relPath, content));
|
|
249940
|
+
}
|
|
249941
|
+
}
|
|
249942
|
+
}
|
|
249943
|
+
for (const folder of WIKI_FOLDERS) {
|
|
249944
|
+
const folderPath = join(wikiRoot, folder);
|
|
249945
|
+
const st = await lstat(folderPath).catch(() => null);
|
|
249946
|
+
if (st === null || st.isSymbolicLink()) continue;
|
|
249947
|
+
await walkDir(folderPath);
|
|
249948
|
+
}
|
|
249949
|
+
return results;
|
|
249950
|
+
}
|
|
249951
|
+
|
|
249952
|
+
// src/commands/memory/graph.ts
|
|
249953
|
+
async function runMemoryGraph(input) {
|
|
249954
|
+
let rootDir;
|
|
249955
|
+
try {
|
|
249956
|
+
rootDir = resolveStorePath({
|
|
249957
|
+
storeFlag: input.storeFlag,
|
|
249958
|
+
cwd: input.cwd,
|
|
249959
|
+
home: input.home,
|
|
249960
|
+
xdgDataHome: input.xdgDataHome,
|
|
249961
|
+
platform: input.platform,
|
|
249962
|
+
localAppData: input.localAppData
|
|
249963
|
+
});
|
|
249964
|
+
} catch (err) {
|
|
249965
|
+
const cli = mapErrorToCliMessage(err, { kind: "store" });
|
|
249966
|
+
input.stderr(cli.message);
|
|
249967
|
+
return cli.exitCode;
|
|
249968
|
+
}
|
|
249969
|
+
let projectName;
|
|
249970
|
+
try {
|
|
249971
|
+
projectName = projectNameSchema.parse(input.projectName);
|
|
249972
|
+
} catch (err) {
|
|
249973
|
+
const cli = mapErrorToCliMessage(err, { kind: "name" });
|
|
249974
|
+
input.stderr(cli.message);
|
|
249975
|
+
return cli.exitCode;
|
|
249976
|
+
}
|
|
249977
|
+
try {
|
|
249978
|
+
const { registry: registry2, initialized } = await ensureStoreReady(rootDir);
|
|
249979
|
+
if (initialized) input.stderr(`note: initialized store at ${rootDir}`);
|
|
249980
|
+
const project = registry2.listProjects().find((p) => p.name === projectName);
|
|
249981
|
+
if (!project) {
|
|
249982
|
+
const cli = projectNotFoundMessage(projectName);
|
|
249983
|
+
input.stderr(cli.message);
|
|
249984
|
+
return cli.exitCode;
|
|
249985
|
+
}
|
|
249986
|
+
const sessions = registry2.listSessions(project.id);
|
|
249987
|
+
const memories = registry2.listMemoryEntries(project.id);
|
|
249988
|
+
const approvedActive = memories.filter((m2) => m2.approval === "approved" && !m2.stale);
|
|
249989
|
+
const conflicts = [];
|
|
249990
|
+
for (const candidate of memories) {
|
|
249991
|
+
const baseline2 = approvedActive.filter((m2) => m2.id !== candidate.id);
|
|
249992
|
+
const result = checkConflicts(candidate, baseline2);
|
|
249993
|
+
if (result.outcome === "unrelated") continue;
|
|
249994
|
+
const kind = result.outcome === "duplicate" ? "duplicate" : result.outcome === "supersession" ? "supersede" : "conflict";
|
|
249995
|
+
for (const conflictId of result.conflictIds) {
|
|
249996
|
+
conflicts.push({ from: candidate.id, to: conflictId, kind });
|
|
249997
|
+
}
|
|
249998
|
+
}
|
|
249999
|
+
const wikiPages = await readWikiPages(project.rootPath);
|
|
250000
|
+
const memoryInputs = memories.map((m2) => ({
|
|
250001
|
+
id: m2.id,
|
|
250002
|
+
scope: m2.scope,
|
|
250003
|
+
sessionId: m2.sessionId,
|
|
250004
|
+
projectId: m2.projectId,
|
|
250005
|
+
memoryType: m2.type,
|
|
250006
|
+
title: m2.title,
|
|
250007
|
+
approval: m2.approval,
|
|
250008
|
+
confidence: m2.confidence,
|
|
250009
|
+
source: m2.source,
|
|
250010
|
+
stale: m2.stale,
|
|
250011
|
+
evidenceIds: m2.evidence ?? [],
|
|
250012
|
+
// Mirror parse-wiki's fileCite canonicalization so a memory relatedFile and a
|
|
250013
|
+
// wiki source: citation for the same path collapse to ONE file node.
|
|
250014
|
+
relatedFiles: (m2.relatedFiles ?? []).map((f3) => canonicalizeFilePath(f3)),
|
|
250015
|
+
relatedSymbols: m2.relatedSymbols ?? []
|
|
250016
|
+
}));
|
|
250017
|
+
const filePathSet = /* @__PURE__ */ new Set();
|
|
250018
|
+
for (const m2 of memoryInputs) for (const fp of m2.relatedFiles) filePathSet.add(fp);
|
|
250019
|
+
for (const w2 of wikiPages) for (const fc of w2.fileCites) filePathSet.add(fc);
|
|
250020
|
+
const files = Array.from(filePathSet).map((path2) => ({ path: path2 }));
|
|
250021
|
+
const symbolSet = /* @__PURE__ */ new Set();
|
|
250022
|
+
for (const m2 of memoryInputs) for (const sym of m2.relatedSymbols) symbolSet.add(sym);
|
|
250023
|
+
const symbols = Array.from(symbolSet).map((symbol) => ({ symbol }));
|
|
250024
|
+
const graphInput = {
|
|
250025
|
+
projects: [{ id: project.id, name: project.name }],
|
|
250026
|
+
sessions: sessions.map((s2) => ({ id: s2.id, projectId: s2.projectId })),
|
|
250027
|
+
memories: memoryInputs,
|
|
250028
|
+
// Evidence and chunkSets are workspace-keyed and handled by the GUI
|
|
250029
|
+
// overlay path; the project-scoped CLI view omits them deliberately to
|
|
250030
|
+
// keep this command purely project-registry-driven.
|
|
250031
|
+
evidence: [],
|
|
250032
|
+
chunkSets: [],
|
|
250033
|
+
conflicts,
|
|
250034
|
+
files,
|
|
250035
|
+
symbols,
|
|
250036
|
+
wikiPages
|
|
250037
|
+
};
|
|
250038
|
+
const graph = buildGraph(graphInput);
|
|
250039
|
+
if (input.jsonFlag) {
|
|
250040
|
+
input.stdout(JSON.stringify(graph));
|
|
250041
|
+
} else {
|
|
250042
|
+
input.stdout(`nodes=${graph.stats.nodeCount} edges=${graph.stats.edgeCount}`);
|
|
250043
|
+
}
|
|
250044
|
+
return 0;
|
|
250045
|
+
} catch (err) {
|
|
250046
|
+
const cli = mapErrorToCliMessage(err);
|
|
250047
|
+
input.stderr(cli.message);
|
|
250048
|
+
return cli.exitCode;
|
|
250049
|
+
}
|
|
250050
|
+
}
|
|
250051
|
+
var memoryGraphCommand = defineCommand({
|
|
250052
|
+
meta: { name: "graph", description: "Print the memory graph for a project as JSON." },
|
|
250053
|
+
args: {
|
|
250054
|
+
projectName: {
|
|
250055
|
+
type: "positional",
|
|
250056
|
+
required: true,
|
|
250057
|
+
description: "Project name (must already exist)."
|
|
250058
|
+
},
|
|
250059
|
+
store: { type: "string", description: "Override store directory." },
|
|
250060
|
+
json: {
|
|
250061
|
+
type: "boolean",
|
|
250062
|
+
default: false,
|
|
250063
|
+
description: "Emit JSON output."
|
|
250064
|
+
}
|
|
250065
|
+
},
|
|
250066
|
+
async run({ args }) {
|
|
250067
|
+
const code = await runMemoryGraph({
|
|
250068
|
+
...readStoreEnv(typeof args.store === "string" ? args.store : void 0),
|
|
250069
|
+
projectName: typeof args.projectName === "string" ? args.projectName : "",
|
|
250070
|
+
jsonFlag: args.json === true,
|
|
250071
|
+
stdout: (line2) => console.log(line2),
|
|
250072
|
+
stderr: (line2) => console.error(line2)
|
|
250073
|
+
});
|
|
250074
|
+
if (code !== 0) process.exitCode = code;
|
|
250075
|
+
}
|
|
250076
|
+
});
|
|
250077
|
+
|
|
249588
250078
|
// src/commands/memory/list.ts
|
|
249589
250079
|
async function runMemoryList(input) {
|
|
249590
250080
|
let rootDir;
|
|
@@ -250139,7 +250629,8 @@ var memoryCommand = defineCommand({
|
|
|
250139
250629
|
reject: memoryRejectCommand,
|
|
250140
250630
|
delete: memoryDeleteCommand,
|
|
250141
250631
|
explain: memoryExplainCommand,
|
|
250142
|
-
review: memoryReviewCommand
|
|
250632
|
+
review: memoryReviewCommand,
|
|
250633
|
+
graph: memoryGraphCommand
|
|
250143
250634
|
}
|
|
250144
250635
|
});
|
|
250145
250636
|
|
|
@@ -252505,9 +252996,9 @@ var sessionCommand = defineCommand({
|
|
|
252505
252996
|
function parseStepFlags(value) {
|
|
252506
252997
|
const raw = toStringArray5(value);
|
|
252507
252998
|
return raw.map((entry, i2) => {
|
|
252508
|
-
const
|
|
252509
|
-
const type =
|
|
252510
|
-
const title =
|
|
252999
|
+
const sep4 = entry.indexOf(":");
|
|
253000
|
+
const type = sep4 === -1 ? entry : entry.slice(0, sep4);
|
|
253001
|
+
const title = sep4 === -1 ? entry : entry.slice(sep4 + 1);
|
|
252511
253002
|
return {
|
|
252512
253003
|
type: type.trim(),
|
|
252513
253004
|
title: title.trim(),
|
|
@@ -253281,7 +253772,7 @@ var toolsCommand = defineCommand({
|
|
|
253281
253772
|
});
|
|
253282
253773
|
|
|
253283
253774
|
// src/main.ts
|
|
253284
|
-
var version2 = "1.0.
|
|
253775
|
+
var version2 = "1.0.4" ;
|
|
253285
253776
|
var mainCommand = defineCommand({
|
|
253286
253777
|
meta: {
|
|
253287
253778
|
name: "mega",
|