@lousy-agents/cli 5.17.2 → 5.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/copilot-with-fastify/.devcontainer/devcontainer.json +1 -1
- package/api/copilot-with-fastify/.github/workflows/ci.yml +4 -4
- package/api/copilot-with-fastify/biome.template.json +1 -1
- package/api/copilot-with-fastify/package-lock.json +779 -372
- package/api/copilot-with-fastify/package.json +11 -11
- package/cli/copilot-with-citty/.devcontainer/devcontainer.json +1 -1
- package/cli/copilot-with-citty/.github/workflows/ci.yml +3 -3
- package/cli/copilot-with-citty/biome.template.json +1 -1
- package/cli/copilot-with-citty/package.json +8 -8
- package/dist/316.js +408 -379
- package/dist/653.js +173 -371
- package/dist/index.js +750 -318
- package/package.json +1 -1
- package/ui/copilot-with-react/.devcontainer/devcontainer.json +1 -1
- package/ui/copilot-with-react/.github/workflows/ci.yml +3 -3
- package/ui/copilot-with-react/biome.template.json +1 -1
- package/ui/copilot-with-react/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1009,7 +1009,15 @@ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
};
|
|
1011
1011
|
|
|
1012
|
-
const
|
|
1012
|
+
const buildCharClassStar = chars => {
|
|
1013
|
+
const source = chars.length === 1
|
|
1014
|
+
? utils.escapeRegex(chars[0])
|
|
1015
|
+
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
1016
|
+
|
|
1017
|
+
return `${source}*`;
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
const getStarExtglobSequenceChars = pattern => {
|
|
1013
1021
|
let index = 0;
|
|
1014
1022
|
const chars = [];
|
|
1015
1023
|
|
|
@@ -1038,11 +1046,7 @@ const getStarExtglobSequenceOutput = pattern => {
|
|
|
1038
1046
|
return;
|
|
1039
1047
|
}
|
|
1040
1048
|
|
|
1041
|
-
|
|
1042
|
-
? utils.escapeRegex(chars[0])
|
|
1043
|
-
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
1044
|
-
|
|
1045
|
-
return `${source}*`;
|
|
1049
|
+
return chars;
|
|
1046
1050
|
};
|
|
1047
1051
|
|
|
1048
1052
|
const repeatedExtglobRecursion = pattern => {
|
|
@@ -1081,17 +1085,43 @@ const analyzeRepeatedExtglob = (body, options) => {
|
|
|
1081
1085
|
}
|
|
1082
1086
|
}
|
|
1083
1087
|
|
|
1088
|
+
// A repeated extglob is "risky" (prone to catastrophic backtracking) when a
|
|
1089
|
+
// branch is itself a `*(...)` sequence, since that nests an unbounded quantifier
|
|
1090
|
+
// inside the outer `+(...)`/`*(...)`. When *every* branch reduces to single
|
|
1091
|
+
// characters we can emit one flat, ReDoS-safe character class that preserves the
|
|
1092
|
+
// meaning of ALL branches (e.g. `+(*(a)|*(b))` -> `[ab]*`), rather than dropping
|
|
1093
|
+
// every branch but the first.
|
|
1094
|
+
const safeChars = [];
|
|
1095
|
+
let sawStarSequence = false;
|
|
1096
|
+
let combinable = true;
|
|
1097
|
+
|
|
1084
1098
|
for (const branch of branches) {
|
|
1085
|
-
const
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1099
|
+
const chars = getStarExtglobSequenceChars(branch);
|
|
1100
|
+
if (chars) {
|
|
1101
|
+
sawStarSequence = true;
|
|
1102
|
+
safeChars.push(...chars);
|
|
1103
|
+
continue;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
const literal = normalizeSimpleBranch(branch);
|
|
1107
|
+
if (literal && literal.length === 1) {
|
|
1108
|
+
safeChars.push(literal);
|
|
1109
|
+
continue;
|
|
1088
1110
|
}
|
|
1089
1111
|
|
|
1112
|
+
combinable = false;
|
|
1113
|
+
|
|
1090
1114
|
if (repeatedExtglobRecursion(branch) > max) {
|
|
1091
1115
|
return { risky: true };
|
|
1092
1116
|
}
|
|
1093
1117
|
}
|
|
1094
1118
|
|
|
1119
|
+
if (sawStarSequence) {
|
|
1120
|
+
return combinable
|
|
1121
|
+
? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) }
|
|
1122
|
+
: { risky: true };
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1095
1125
|
return { risky: false };
|
|
1096
1126
|
};
|
|
1097
1127
|
|
|
@@ -2189,6 +2219,18 @@ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
|
2189
2219
|
* const isMatch = picomatch('*.!(*a)');
|
|
2190
2220
|
* console.log(isMatch('a.a')); //=> false
|
|
2191
2221
|
* console.log(isMatch('a.b')); //=> true
|
|
2222
|
+
*
|
|
2223
|
+
* // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
|
|
2224
|
+
* const picomatch = require('picomatch/posix');
|
|
2225
|
+
* // the same API, defaulting to posix paths
|
|
2226
|
+
* const isMatch = picomatch('a/*');
|
|
2227
|
+
* console.log(isMatch('a\\b')); //=> false
|
|
2228
|
+
* console.log(isMatch('a/b')); //=> true
|
|
2229
|
+
*
|
|
2230
|
+
* // you can still configure the matcher function to accept windows paths
|
|
2231
|
+
* const isMatch = picomatch('a/*', { options: windows });
|
|
2232
|
+
* console.log(isMatch('a\\b')); //=> true
|
|
2233
|
+
* console.log(isMatch('a/b')); //=> true
|
|
2192
2234
|
* ```
|
|
2193
2235
|
* @name picomatch
|
|
2194
2236
|
* @param {String|Array} `globs` One or more glob patterns.
|
|
@@ -2326,9 +2368,9 @@ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
2326
2368
|
* @api public
|
|
2327
2369
|
*/
|
|
2328
2370
|
|
|
2329
|
-
picomatch.matchBase = (input, glob, options) => {
|
|
2371
|
+
picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
|
|
2330
2372
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
2331
|
-
return regex.test(utils.basename(input));
|
|
2373
|
+
return regex.test(utils.basename(input, { windows: posix }));
|
|
2332
2374
|
};
|
|
2333
2375
|
|
|
2334
2376
|
/**
|
|
@@ -19128,8 +19170,6 @@ const pathe_M_eThtNZ_path = (/* unused pure expression or super */ null && ({
|
|
|
19128
19170
|
var lib_main = __webpack_require__(5599);
|
|
19129
19171
|
// EXTERNAL MODULE: external "node:assert"
|
|
19130
19172
|
var external_node_assert_ = __webpack_require__(4589);
|
|
19131
|
-
// EXTERNAL MODULE: external "node:v8"
|
|
19132
|
-
var external_node_v8_ = __webpack_require__(8877);
|
|
19133
19173
|
;// CONCATENATED MODULE: ../../node_modules/exsolve/dist/index.mjs
|
|
19134
19174
|
|
|
19135
19175
|
|
|
@@ -19137,9 +19177,6 @@ var external_node_v8_ = __webpack_require__(8877);
|
|
|
19137
19177
|
|
|
19138
19178
|
|
|
19139
19179
|
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
//#region src/internal/builtins.ts
|
|
19143
19180
|
const nodeBuiltins = [
|
|
19144
19181
|
"_http_agent",
|
|
19145
19182
|
"_http_client",
|
|
@@ -19210,12 +19247,8 @@ const nodeBuiltins = [
|
|
|
19210
19247
|
"worker_threads",
|
|
19211
19248
|
"zlib"
|
|
19212
19249
|
];
|
|
19213
|
-
|
|
19214
|
-
//#endregion
|
|
19215
|
-
//#region src/internal/errors.ts
|
|
19216
|
-
const own$1 = {}.hasOwnProperty;
|
|
19217
19250
|
const classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
19218
|
-
const kTypes = new Set([
|
|
19251
|
+
const kTypes = /* @__PURE__ */ new Set([
|
|
19219
19252
|
"string",
|
|
19220
19253
|
"function",
|
|
19221
19254
|
"number",
|
|
@@ -19227,83 +19260,95 @@ const kTypes = new Set([
|
|
|
19227
19260
|
"symbol"
|
|
19228
19261
|
]);
|
|
19229
19262
|
const messages = /* @__PURE__ */ new Map();
|
|
19230
|
-
const nodeInternalPrefix = "__node_internal_";
|
|
19231
|
-
let userStackTraceLimit;
|
|
19232
|
-
/**
|
|
19233
|
-
* Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
|
|
19234
|
-
* We cannot use Intl.ListFormat because it's not available in
|
|
19235
|
-
* --without-intl builds.
|
|
19236
|
-
*
|
|
19237
|
-
* @param {Array<string>} array
|
|
19238
|
-
* An array of strings.
|
|
19239
|
-
* @param {string} [type]
|
|
19240
|
-
* The list type to be inserted before the last element.
|
|
19241
|
-
* @returns {string}
|
|
19242
|
-
*/
|
|
19243
19263
|
function formatList(array, type = "and") {
|
|
19244
|
-
|
|
19264
|
+
switch (array.length) {
|
|
19265
|
+
case 0: return "";
|
|
19266
|
+
case 1: return `${array[0]}`;
|
|
19267
|
+
case 2: return `${array[0]} ${type} ${array[1]}`;
|
|
19268
|
+
case 3: return `${array[0]}, ${array[1]}, ${type} ${array[2]}`;
|
|
19269
|
+
default: return `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
|
|
19270
|
+
}
|
|
19271
|
+
}
|
|
19272
|
+
function getExpectedArgumentLength(message) {
|
|
19273
|
+
let expectedLength = 0;
|
|
19274
|
+
const regex = /%[dfijoOs]/g;
|
|
19275
|
+
while (regex.exec(message) !== null) expectedLength++;
|
|
19276
|
+
return expectedLength;
|
|
19245
19277
|
}
|
|
19246
|
-
/**
|
|
19247
|
-
* Utility function for registering the error codes.
|
|
19248
|
-
*/
|
|
19249
19278
|
function createError(sym, value, constructor) {
|
|
19250
19279
|
messages.set(sym, value);
|
|
19251
19280
|
return makeNodeErrorWithCode(constructor, sym);
|
|
19252
19281
|
}
|
|
19282
|
+
const kIsNodeError = Symbol("kIsNodeError");
|
|
19253
19283
|
function makeNodeErrorWithCode(Base, key) {
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
|
|
19284
|
+
const message = messages.get(key);
|
|
19285
|
+
const expectedLength = typeof message === "string" ? getExpectedArgumentLength(message) : -1;
|
|
19286
|
+
switch (expectedLength) {
|
|
19287
|
+
case 0: {
|
|
19288
|
+
class NodeError extends Base {
|
|
19289
|
+
code = key;
|
|
19290
|
+
constructor(...args) {
|
|
19291
|
+
external_node_assert_.ok(args.length === 0, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`);
|
|
19292
|
+
super(message);
|
|
19293
|
+
}
|
|
19294
|
+
get ["constructor"]() {
|
|
19295
|
+
return Base;
|
|
19296
|
+
}
|
|
19297
|
+
get [kIsNodeError]() {
|
|
19298
|
+
return true;
|
|
19299
|
+
}
|
|
19300
|
+
toString() {
|
|
19301
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
19302
|
+
}
|
|
19303
|
+
}
|
|
19304
|
+
return NodeError;
|
|
19305
|
+
}
|
|
19306
|
+
case -1: {
|
|
19307
|
+
class NodeError extends Base {
|
|
19308
|
+
code = key;
|
|
19309
|
+
constructor(...args) {
|
|
19310
|
+
super();
|
|
19311
|
+
Object.defineProperty(this, "message", {
|
|
19312
|
+
value: getMessage(key, args, this),
|
|
19313
|
+
enumerable: false,
|
|
19314
|
+
writable: true,
|
|
19315
|
+
configurable: true
|
|
19316
|
+
});
|
|
19317
|
+
}
|
|
19318
|
+
get ["constructor"]() {
|
|
19319
|
+
return Base;
|
|
19320
|
+
}
|
|
19321
|
+
get [kIsNodeError]() {
|
|
19322
|
+
return true;
|
|
19323
|
+
}
|
|
19324
|
+
toString() {
|
|
19269
19325
|
return `${this.name} [${key}]: ${this.message}`;
|
|
19270
|
-
}
|
|
19271
|
-
enumerable: false,
|
|
19272
|
-
writable: true,
|
|
19273
|
-
configurable: true
|
|
19326
|
+
}
|
|
19274
19327
|
}
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
}
|
|
19297
|
-
const captureLargerStackTrace = hideStackFrames(function(error) {
|
|
19298
|
-
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
19299
|
-
if (stackTraceLimitIsWritable) {
|
|
19300
|
-
userStackTraceLimit = Error.stackTraceLimit;
|
|
19301
|
-
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
19328
|
+
return NodeError;
|
|
19329
|
+
}
|
|
19330
|
+
default: {
|
|
19331
|
+
class NodeError extends Base {
|
|
19332
|
+
code = key;
|
|
19333
|
+
constructor(...args) {
|
|
19334
|
+
external_node_assert_.ok(args.length === expectedLength, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`);
|
|
19335
|
+
args.unshift(message);
|
|
19336
|
+
super(Reflect.apply(external_node_util_.format, null, args));
|
|
19337
|
+
}
|
|
19338
|
+
get ["constructor"]() {
|
|
19339
|
+
return Base;
|
|
19340
|
+
}
|
|
19341
|
+
get [kIsNodeError]() {
|
|
19342
|
+
return true;
|
|
19343
|
+
}
|
|
19344
|
+
toString() {
|
|
19345
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
19346
|
+
}
|
|
19347
|
+
}
|
|
19348
|
+
return NodeError;
|
|
19349
|
+
}
|
|
19302
19350
|
}
|
|
19303
|
-
|
|
19304
|
-
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
|
19305
|
-
return error;
|
|
19306
|
-
});
|
|
19351
|
+
}
|
|
19307
19352
|
function getMessage(key, parameters, self) {
|
|
19308
19353
|
const message = messages.get(key);
|
|
19309
19354
|
external_node_assert_.ok(message !== void 0, "expected `message` to be found");
|
|
@@ -19311,29 +19356,44 @@ function getMessage(key, parameters, self) {
|
|
|
19311
19356
|
external_node_assert_.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
|
|
19312
19357
|
return Reflect.apply(message, self, parameters);
|
|
19313
19358
|
}
|
|
19314
|
-
const
|
|
19315
|
-
let expectedLength = 0;
|
|
19316
|
-
while (regex.exec(message) !== null) expectedLength++;
|
|
19359
|
+
const expectedLength = getExpectedArgumentLength(message);
|
|
19317
19360
|
external_node_assert_.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
|
|
19318
19361
|
if (parameters.length === 0) return message;
|
|
19319
19362
|
parameters.unshift(message);
|
|
19320
19363
|
return Reflect.apply(external_node_util_.format, null, parameters);
|
|
19321
19364
|
}
|
|
19322
|
-
/**
|
|
19323
|
-
* Determine the specific type of a value for type-mismatch errors.
|
|
19324
|
-
*/
|
|
19325
19365
|
function determineSpecificType(value) {
|
|
19326
|
-
if (value === null
|
|
19327
|
-
if (
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19366
|
+
if (value === null) return "null";
|
|
19367
|
+
else if (value === void 0) return "undefined";
|
|
19368
|
+
const type = typeof value;
|
|
19369
|
+
switch (type) {
|
|
19370
|
+
case "bigint": return `type bigint (${value}n)`;
|
|
19371
|
+
case "number":
|
|
19372
|
+
if (value === 0) return 1 / value === Number.NEGATIVE_INFINITY ? "type number (-0)" : "type number (0)";
|
|
19373
|
+
else if (Number.isNaN(value)) return "type number (NaN)";
|
|
19374
|
+
else if (value === Number.POSITIVE_INFINITY) return "type number (Infinity)";
|
|
19375
|
+
else if (value === Number.NEGATIVE_INFINITY) return "type number (-Infinity)";
|
|
19376
|
+
return `type number (${value})`;
|
|
19377
|
+
case "boolean": return value ? "type boolean (true)" : "type boolean (false)";
|
|
19378
|
+
case "symbol": return `type symbol (${String(value)})`;
|
|
19379
|
+
case "function": return `function ${value.name}`;
|
|
19380
|
+
case "object":
|
|
19381
|
+
if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
|
|
19382
|
+
return `${(0,external_node_util_.inspect)(value, { depth: -1 })}`;
|
|
19383
|
+
case "string": {
|
|
19384
|
+
let string = value;
|
|
19385
|
+
if (string.length > 28) string = `${string.slice(0, 25)}...`;
|
|
19386
|
+
if (!string.includes("'")) return `type string ('${string}')`;
|
|
19387
|
+
return `type string (${JSON.stringify(string)})`;
|
|
19388
|
+
}
|
|
19389
|
+
default: {
|
|
19390
|
+
let inspected = (0,external_node_util_.inspect)(value, { colors: false });
|
|
19391
|
+
if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
|
|
19392
|
+
return `type ${type} (${inspected})`;
|
|
19393
|
+
}
|
|
19331
19394
|
}
|
|
19332
|
-
let inspected = (0,external_node_util_.inspect)(value, { colors: false });
|
|
19333
|
-
if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
|
|
19334
|
-
return `type ${typeof value} (${inspected})`;
|
|
19335
19395
|
}
|
|
19336
|
-
|
|
19396
|
+
createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
19337
19397
|
external_node_assert_.ok(typeof name === "string", "'name' must be a string");
|
|
19338
19398
|
if (!Array.isArray(expected)) expected = [expected];
|
|
19339
19399
|
let message = "The ";
|
|
@@ -19357,7 +19417,7 @@ const ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected
|
|
|
19357
19417
|
if (instances.length > 0) {
|
|
19358
19418
|
const pos = types.indexOf("object");
|
|
19359
19419
|
if (pos !== -1) {
|
|
19360
|
-
types.
|
|
19420
|
+
types.splice(pos, 1);
|
|
19361
19421
|
instances.push("Object");
|
|
19362
19422
|
}
|
|
19363
19423
|
}
|
|
@@ -19377,20 +19437,11 @@ const ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected
|
|
|
19377
19437
|
message += `. Received ${determineSpecificType(actual)}`;
|
|
19378
19438
|
return message;
|
|
19379
19439
|
}, TypeError);
|
|
19380
|
-
const ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
19381
|
-
"
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
* @param {string} [base]
|
|
19386
|
-
*/
|
|
19387
|
-
(request, reason, base) => {
|
|
19388
|
-
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
19389
|
-
},
|
|
19390
|
-
TypeError
|
|
19391
|
-
);
|
|
19392
|
-
const ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => {
|
|
19393
|
-
return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
19440
|
+
const ERR_INVALID_MODULE_SPECIFIER = createError("ERR_INVALID_MODULE_SPECIFIER", (request, reason, base) => {
|
|
19441
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
19442
|
+
}, TypeError);
|
|
19443
|
+
const ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path, base, message) => {
|
|
19444
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
19394
19445
|
}, Error);
|
|
19395
19446
|
const ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = false, base) => {
|
|
19396
19447
|
const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
@@ -19400,39 +19451,30 @@ const ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (pa
|
|
|
19400
19451
|
}
|
|
19401
19452
|
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
|
|
19402
19453
|
}, Error);
|
|
19403
|
-
const ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path
|
|
19404
|
-
|
|
19454
|
+
const ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", function(path, base, exactUrl = false) {
|
|
19455
|
+
if (exactUrl && typeof exactUrl === "string") this.url = `${exactUrl}`;
|
|
19456
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
|
|
19405
19457
|
}, Error);
|
|
19406
|
-
const ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
|
|
19407
19458
|
const ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => {
|
|
19408
19459
|
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
|
|
19409
19460
|
}, TypeError);
|
|
19410
|
-
const ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
19411
|
-
"
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
19419
|
-
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
19420
|
-
},
|
|
19421
|
-
Error
|
|
19422
|
-
);
|
|
19423
|
-
const ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
|
|
19461
|
+
const ERR_PACKAGE_PATH_NOT_EXPORTED = createError("ERR_PACKAGE_PATH_NOT_EXPORTED", (packagePath, subpath, base) => {
|
|
19462
|
+
if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
19463
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
19464
|
+
}, Error);
|
|
19465
|
+
const ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", function(path, base, exactUrl = void 0) {
|
|
19466
|
+
this.url = exactUrl;
|
|
19467
|
+
return `Directory import '${path}' is not supported resolving ES modules imported from ${base}`;
|
|
19468
|
+
}, Error);
|
|
19424
19469
|
const ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError);
|
|
19425
|
-
const ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path
|
|
19426
|
-
return `Unknown file extension "${extension}" for ${path
|
|
19470
|
+
const ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path) => {
|
|
19471
|
+
return `Unknown file extension "${extension}" for ${path}`;
|
|
19427
19472
|
}, TypeError);
|
|
19428
|
-
|
|
19473
|
+
createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
|
|
19429
19474
|
let inspected = (0,external_node_util_.inspect)(value);
|
|
19430
19475
|
if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
|
|
19431
19476
|
return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
19432
19477
|
}, TypeError);
|
|
19433
|
-
|
|
19434
|
-
//#endregion
|
|
19435
|
-
//#region src/internal/package-json-reader.ts
|
|
19436
19478
|
const hasOwnProperty$1 = {}.hasOwnProperty;
|
|
19437
19479
|
const dist_cache = /* @__PURE__ */ new Map();
|
|
19438
19480
|
function read(jsonPath, { base, specifier }) {
|
|
@@ -19489,9 +19531,6 @@ function getPackageScopeConfig(resolved) {
|
|
|
19489
19531
|
type: "none"
|
|
19490
19532
|
};
|
|
19491
19533
|
}
|
|
19492
|
-
|
|
19493
|
-
//#endregion
|
|
19494
|
-
//#region src/internal/get-format.ts
|
|
19495
19534
|
const dist_hasOwnProperty = {}.hasOwnProperty;
|
|
19496
19535
|
const extensionFormatMap = {
|
|
19497
19536
|
__proto__: null,
|
|
@@ -19510,33 +19549,25 @@ const protocolHandlers = {
|
|
|
19510
19549
|
"node:": () => "builtin"
|
|
19511
19550
|
};
|
|
19512
19551
|
function mimeToFormat(mime) {
|
|
19513
|
-
if (mime &&
|
|
19552
|
+
if (mime && /^\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?$/i.test(mime)) return "module";
|
|
19514
19553
|
if (mime === "application/json") return "json";
|
|
19515
19554
|
return null;
|
|
19516
19555
|
}
|
|
19517
19556
|
function getDataProtocolModuleFormat(parsed) {
|
|
19518
|
-
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [
|
|
19557
|
+
const { 1: mime } = /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/.exec(parsed.pathname) || [
|
|
19519
19558
|
null,
|
|
19520
19559
|
null,
|
|
19521
19560
|
null
|
|
19522
19561
|
];
|
|
19523
19562
|
return mimeToFormat(mime);
|
|
19524
19563
|
}
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
*
|
|
19528
|
-
* Should give similar result to
|
|
19529
|
-
* `require('node:path').extname(require('node:url').fileURLToPath(url))`
|
|
19530
|
-
* when used with a `file:` URL.
|
|
19531
|
-
*
|
|
19532
|
-
*/
|
|
19564
|
+
const DOT_CODE = 46;
|
|
19565
|
+
const SLASH_CODE = 47;
|
|
19533
19566
|
function dist_extname(url) {
|
|
19534
19567
|
const pathname = url.pathname;
|
|
19535
|
-
let
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
if (code === 47) return "";
|
|
19539
|
-
if (code === 46) return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
|
|
19568
|
+
for (let i = pathname.length - 1; i > 0; i--) switch (pathname.charCodeAt(i)) {
|
|
19569
|
+
case SLASH_CODE: return "";
|
|
19570
|
+
case DOT_CODE: return pathname.charCodeAt(i - 1) === SLASH_CODE ? "" : pathname.slice(i);
|
|
19540
19571
|
}
|
|
19541
19572
|
return "";
|
|
19542
19573
|
}
|
|
@@ -19549,11 +19580,12 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
|
19549
19580
|
}
|
|
19550
19581
|
if (ext === "") {
|
|
19551
19582
|
const { type: packageType } = getPackageScopeConfig(url);
|
|
19552
|
-
if (packageType === "
|
|
19553
|
-
|
|
19583
|
+
if (packageType === "module") return "module";
|
|
19584
|
+
if (packageType !== "none") return packageType;
|
|
19585
|
+
return "commonjs";
|
|
19554
19586
|
}
|
|
19555
|
-
const format
|
|
19556
|
-
if (format
|
|
19587
|
+
const format = extensionFormatMap[ext];
|
|
19588
|
+
if (format) return format;
|
|
19557
19589
|
if (ignoreErrors) return;
|
|
19558
19590
|
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, (0,external_node_url_.fileURLToPath)(url));
|
|
19559
19591
|
}
|
|
@@ -19562,9 +19594,6 @@ function defaultGetFormatWithoutErrors(url, context) {
|
|
|
19562
19594
|
if (!dist_hasOwnProperty.call(protocolHandlers, protocol)) return null;
|
|
19563
19595
|
return protocolHandlers[protocol](url, context, true) || null;
|
|
19564
19596
|
}
|
|
19565
|
-
|
|
19566
|
-
//#endregion
|
|
19567
|
-
//#region src/internal/resolve.ts
|
|
19568
19597
|
const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
|
19569
19598
|
const own = {}.hasOwnProperty;
|
|
19570
19599
|
const invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i;
|
|
@@ -19589,19 +19618,11 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
19589
19618
|
if (!main) external_node_process_.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
|
|
19590
19619
|
else if (external_node_path_.resolve(packagePath, main) !== urlPath) external_node_process_.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
|
|
19591
19620
|
}
|
|
19592
|
-
function tryStatSync(path
|
|
19621
|
+
function tryStatSync(path) {
|
|
19593
19622
|
try {
|
|
19594
|
-
return (0,external_node_fs_.statSync)(path
|
|
19623
|
+
return (0,external_node_fs_.statSync)(path);
|
|
19595
19624
|
} catch {}
|
|
19596
19625
|
}
|
|
19597
|
-
/**
|
|
19598
|
-
* Legacy CommonJS main resolution:
|
|
19599
|
-
* 1. let M = pkg_url + (json main field)
|
|
19600
|
-
* 2. TRY(M, M.js, M.json, M.node)
|
|
19601
|
-
* 3. TRY(M/index.js, M/index.json, M/index.node)
|
|
19602
|
-
* 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)
|
|
19603
|
-
* 5. NOT_FOUND
|
|
19604
|
-
*/
|
|
19605
19626
|
function dist_fileExists(url) {
|
|
19606
19627
|
const stats = (0,external_node_fs_.statSync)(url, { throwIfNoEntry: false });
|
|
19607
19628
|
const isFile = stats ? stats.isFile() : void 0;
|
|
@@ -19612,7 +19633,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
19612
19633
|
if (packageConfig.main !== void 0) {
|
|
19613
19634
|
guess = new external_node_url_.URL(packageConfig.main, packageJsonUrl);
|
|
19614
19635
|
if (dist_fileExists(guess)) return guess;
|
|
19615
|
-
const tries
|
|
19636
|
+
const tries = [
|
|
19616
19637
|
`./${packageConfig.main}.js`,
|
|
19617
19638
|
`./${packageConfig.main}.json`,
|
|
19618
19639
|
`./${packageConfig.main}.node`,
|
|
@@ -19620,9 +19641,9 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
19620
19641
|
`./${packageConfig.main}/index.json`,
|
|
19621
19642
|
`./${packageConfig.main}/index.node`
|
|
19622
19643
|
];
|
|
19623
|
-
let i
|
|
19624
|
-
while (++i
|
|
19625
|
-
guess = new external_node_url_.URL(tries
|
|
19644
|
+
let i = -1;
|
|
19645
|
+
while (++i < tries.length) {
|
|
19646
|
+
guess = new external_node_url_.URL(tries[i], packageJsonUrl);
|
|
19626
19647
|
if (dist_fileExists(guess)) break;
|
|
19627
19648
|
guess = void 0;
|
|
19628
19649
|
}
|
|
@@ -19754,7 +19775,7 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
19754
19775
|
}
|
|
19755
19776
|
return resolveResult;
|
|
19756
19777
|
}
|
|
19757
|
-
if (lastException === void 0 || lastException === null) return
|
|
19778
|
+
if (lastException === void 0 || lastException === null) return lastException;
|
|
19758
19779
|
throw lastException;
|
|
19759
19780
|
}
|
|
19760
19781
|
if (typeof target === "object" && target !== null) {
|
|
@@ -19774,7 +19795,7 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
19774
19795
|
return resolveResult;
|
|
19775
19796
|
}
|
|
19776
19797
|
}
|
|
19777
|
-
return
|
|
19798
|
+
return;
|
|
19778
19799
|
}
|
|
19779
19800
|
if (target === null) return null;
|
|
19780
19801
|
throw invalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base);
|
|
@@ -19848,7 +19869,7 @@ function patternKeyCompare(a, b) {
|
|
|
19848
19869
|
return 0;
|
|
19849
19870
|
}
|
|
19850
19871
|
function packageImportsResolve(name, base, conditions) {
|
|
19851
|
-
if (name === "#" || name.
|
|
19872
|
+
if (name === "#" || name.endsWith("/")) throw new ERR_INVALID_MODULE_SPECIFIER(name, "is not a valid internal imports specifier name", (0,external_node_url_.fileURLToPath)(base));
|
|
19852
19873
|
let packageJsonUrl;
|
|
19853
19874
|
const packageConfig = getPackageScopeConfig(base);
|
|
19854
19875
|
if (packageConfig.exists) {
|
|
@@ -19882,10 +19903,6 @@ function packageImportsResolve(name, base, conditions) {
|
|
|
19882
19903
|
}
|
|
19883
19904
|
throw importNotDefined(name, packageJsonUrl, base);
|
|
19884
19905
|
}
|
|
19885
|
-
/**
|
|
19886
|
-
* @param {string} specifier
|
|
19887
|
-
* @param {URL} base
|
|
19888
|
-
*/
|
|
19889
19906
|
function parsePackageName(specifier, base) {
|
|
19890
19907
|
let separatorIndex = specifier.indexOf("/");
|
|
19891
19908
|
let validPackageName = true;
|
|
@@ -19920,12 +19937,12 @@ function packageResolve(specifier, base, conditions) {
|
|
|
19920
19937
|
packageJsonPath = (0,external_node_url_.fileURLToPath)(packageJsonUrl);
|
|
19921
19938
|
continue;
|
|
19922
19939
|
}
|
|
19923
|
-
const packageConfig
|
|
19940
|
+
const packageConfig = read(packageJsonPath, {
|
|
19924
19941
|
base,
|
|
19925
19942
|
specifier
|
|
19926
19943
|
});
|
|
19927
|
-
if (packageConfig
|
|
19928
|
-
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig
|
|
19944
|
+
if (packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions);
|
|
19945
|
+
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig, base);
|
|
19929
19946
|
return new external_node_url_.URL(packageSubpath, packageJsonUrl);
|
|
19930
19947
|
} while (packageJsonPath.length !== lastPath.length);
|
|
19931
19948
|
// removed by dead control flow
|
|
@@ -19943,21 +19960,6 @@ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
|
|
19943
19960
|
if (specifier[0] === "/") return true;
|
|
19944
19961
|
return isRelativeSpecifier(specifier);
|
|
19945
19962
|
}
|
|
19946
|
-
/**
|
|
19947
|
-
* The “Resolver Algorithm Specification” as detailed in the Node docs (which is
|
|
19948
|
-
* sync and slightly lower-level than `resolve`).
|
|
19949
|
-
*
|
|
19950
|
-
* @param {string} specifier
|
|
19951
|
-
* `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc.
|
|
19952
|
-
* @param {URL} base
|
|
19953
|
-
* Full URL (to a file) that `specifier` is resolved relative from.
|
|
19954
|
-
* @param {Set<string>} [conditions]
|
|
19955
|
-
* Conditions.
|
|
19956
|
-
* @param {boolean} [preserveSymlinks]
|
|
19957
|
-
* Keep symlinks instead of resolving them.
|
|
19958
|
-
* @returns {URL}
|
|
19959
|
-
* A URL object to the found thing.
|
|
19960
|
-
*/
|
|
19961
19963
|
function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
19962
19964
|
const protocol = base.protocol;
|
|
19963
19965
|
const isData = protocol === "data:";
|
|
@@ -19984,19 +19986,10 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
|
19984
19986
|
if (resolved.protocol !== "file:") return resolved;
|
|
19985
19987
|
return finalizeResolution(resolved, base, preserveSymlinks);
|
|
19986
19988
|
}
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
const
|
|
19991
|
-
const dist_isWindows = /* @__PURE__ */ (() => process.platform === "win32")();
|
|
19992
|
-
const globalCache = /* @__PURE__ */ (() => globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map())();
|
|
19993
|
-
/**
|
|
19994
|
-
* Synchronously resolves a module url based on the options provided.
|
|
19995
|
-
*
|
|
19996
|
-
* @param {string} input - The identifier or path of the module to resolve.
|
|
19997
|
-
* @param {ResolveOptions} [options] - Options to resolve the module. See {@link ResolveOptions}.
|
|
19998
|
-
* @returns {string} The resolved URL as a string.
|
|
19999
|
-
*/
|
|
19989
|
+
const DEFAULT_CONDITIONS_SET = /* #__PURE__ */ new Set(["node", "import"]);
|
|
19990
|
+
const DEFAULT_CONDITIONS_KEY = "2:6:import4:node";
|
|
19991
|
+
const dist_isWindows = /* #__PURE__ */ (() => process.platform === "win32")();
|
|
19992
|
+
const globalCache = /* #__PURE__ */ (() => globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map())();
|
|
20000
19993
|
function resolveModuleURL(input, options) {
|
|
20001
19994
|
const parsedInput = _parseInput(input);
|
|
20002
19995
|
if ("external" in parsedInput) return parsedInput.external;
|
|
@@ -20061,15 +20054,6 @@ function resolveModuleURL(input, options) {
|
|
|
20061
20054
|
if (cacheObj) cacheObj.set(cacheKey, resolved.href);
|
|
20062
20055
|
return resolved.href;
|
|
20063
20056
|
}
|
|
20064
|
-
/**
|
|
20065
|
-
* Synchronously resolves a module then converts it to a file path
|
|
20066
|
-
*
|
|
20067
|
-
* (throws error if reolved path is not file:// scheme)
|
|
20068
|
-
*
|
|
20069
|
-
* @param {string} id - The identifier or path of the module to resolve.
|
|
20070
|
-
* @param {ResolveOptions} [options] - Options to resolve the module. See {@link ResolveOptions}.
|
|
20071
|
-
* @returns {string} The resolved URL as a string.
|
|
20072
|
-
*/
|
|
20073
20057
|
function resolveModulePath(id, options) {
|
|
20074
20058
|
const resolved = resolveModuleURL(id, options);
|
|
20075
20059
|
if (!resolved) return;
|
|
@@ -20129,21 +20113,31 @@ function _fmtPath(input) {
|
|
|
20129
20113
|
return input;
|
|
20130
20114
|
}
|
|
20131
20115
|
}
|
|
20132
|
-
function _cacheKey(id,
|
|
20133
|
-
|
|
20134
|
-
|
|
20135
|
-
|
|
20136
|
-
|
|
20137
|
-
|
|
20138
|
-
|
|
20139
|
-
|
|
20116
|
+
function _cacheKey(id, options) {
|
|
20117
|
+
let from;
|
|
20118
|
+
if (Array.isArray(options?.from)) from = options.from;
|
|
20119
|
+
else if (options?.from) from = [options.from];
|
|
20120
|
+
return _cacheKeyValues([id]) + _conditionsKey(options?.conditions) + _cacheKeyValues(options?.extensions) + _cacheKeyValues(from) + _cacheKeyValues(options?.suffixes);
|
|
20121
|
+
}
|
|
20122
|
+
function _conditionsKey(conditions) {
|
|
20123
|
+
if (!conditions) return DEFAULT_CONDITIONS_KEY;
|
|
20124
|
+
return _cacheKeyValues([...new Set(conditions)].sort());
|
|
20125
|
+
}
|
|
20126
|
+
function _cacheKeyValues(values) {
|
|
20127
|
+
if (!values) return "-";
|
|
20128
|
+
let key = `${values.length}:`;
|
|
20129
|
+
for (const value of values) {
|
|
20130
|
+
const stringValue = String(value);
|
|
20131
|
+
key += `${stringValue.length}:${stringValue}`;
|
|
20132
|
+
}
|
|
20133
|
+
return key;
|
|
20140
20134
|
}
|
|
20141
20135
|
function _join(a, b) {
|
|
20142
20136
|
if (!a || !b || b === "/") return a;
|
|
20143
20137
|
return (a.endsWith("/") ? a : a + "/") + (b.startsWith("/") ? b.slice(1) : b);
|
|
20144
20138
|
}
|
|
20145
|
-
function _normalizeWinPath(path
|
|
20146
|
-
return path
|
|
20139
|
+
function _normalizeWinPath(path) {
|
|
20140
|
+
return path.replace(/\\/g, "/").replace(/^[a-z]:\//, (r) => r.toUpperCase());
|
|
20147
20141
|
}
|
|
20148
20142
|
function _isURL(input) {
|
|
20149
20143
|
return input instanceof URL || input?.constructor?.name === "URL";
|
|
@@ -20175,7 +20169,6 @@ function _parseInput(input) {
|
|
|
20175
20169
|
throw new TypeError("id must be a `string` or `URL`");
|
|
20176
20170
|
}
|
|
20177
20171
|
|
|
20178
|
-
//#endregion
|
|
20179
20172
|
|
|
20180
20173
|
// EXTERNAL MODULE: external "node:module"
|
|
20181
20174
|
var external_node_module_ = __webpack_require__(8995);
|
|
@@ -22378,15 +22371,270 @@ const originalStringify = JSON.stringify;
|
|
|
22378
22371
|
const originalParse = JSON.parse;
|
|
22379
22372
|
const customFormat = /^-?\d+n$/;
|
|
22380
22373
|
|
|
22381
|
-
const bigIntsStringify = /([\[:])?"(-?\d+)n"(
|
|
22382
|
-
const noiseStringify =
|
|
22383
|
-
/([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g;
|
|
22374
|
+
const bigIntsStringify = /([\[:])?"(-?\d+)n"($|\s*[,\}\]])/g;
|
|
22375
|
+
const noiseStringify = /([\[:])?("-?\d+n+)n("$|"\s*[,\}\]])/g;
|
|
22384
22376
|
|
|
22385
22377
|
/**
|
|
22386
22378
|
* @typedef {(this: any, key: string | number | undefined, value: any) => any} Replacer
|
|
22387
22379
|
* @typedef {(key: string | number | undefined, value: any, context?: { source: string }) => any} Reviver
|
|
22388
22380
|
*/
|
|
22389
22381
|
|
|
22382
|
+
/**
|
|
22383
|
+
* Checks if a value is unstringifiable according to native JSON.stringify rules.
|
|
22384
|
+
*
|
|
22385
|
+
* @param {any} val The value to check.
|
|
22386
|
+
* @returns {boolean} True if the value is undefined, a function, or a symbol.
|
|
22387
|
+
*/
|
|
22388
|
+
const isUnstringifiable = (val) =>
|
|
22389
|
+
val === undefined || typeof val === "function" || typeof val === "symbol";
|
|
22390
|
+
|
|
22391
|
+
/**
|
|
22392
|
+
* Checks if a value is a native JSON.rawJSON object (Node.js 22+).
|
|
22393
|
+
*
|
|
22394
|
+
* @param {any} val The value to check.
|
|
22395
|
+
* @returns {boolean} True if the value is a RawJSON instance.
|
|
22396
|
+
*/
|
|
22397
|
+
const isRawJSON = (val) =>
|
|
22398
|
+
val !== null &&
|
|
22399
|
+
typeof val === "object" &&
|
|
22400
|
+
val.constructor &&
|
|
22401
|
+
val.constructor.name === "RawJSON";
|
|
22402
|
+
|
|
22403
|
+
/**
|
|
22404
|
+
* Iteratively converts a JS value to a JSON string.
|
|
22405
|
+
* Used as a fallback when the native JSON.stringify hits the Maximum Call Stack size.
|
|
22406
|
+
* Fully compliant with JSON formatting (space), replacers, and toJSON behaviors.
|
|
22407
|
+
*
|
|
22408
|
+
* @param {any} rootValue The value to stringify.
|
|
22409
|
+
* @param {Replacer | Array<string | number> | null} [replacer] User's custom replacer function.
|
|
22410
|
+
* @param {string | number} [spaceParam] Indentation for pretty-printing.
|
|
22411
|
+
* @returns {string | undefined} The generated JSON string.
|
|
22412
|
+
*/
|
|
22413
|
+
const stringifyIteratively = (rootValue, replacer, spaceParam) => {
|
|
22414
|
+
let space = "";
|
|
22415
|
+
|
|
22416
|
+
if (typeof spaceParam === "number") {
|
|
22417
|
+
space = " ".repeat(Math.min(10, Math.max(0, Math.floor(spaceParam))));
|
|
22418
|
+
} else if (typeof spaceParam === "string") {
|
|
22419
|
+
space = spaceParam.slice(0, 10);
|
|
22420
|
+
}
|
|
22421
|
+
|
|
22422
|
+
const isFunctionReplacer = typeof replacer === "function";
|
|
22423
|
+
const propertyList = Array.isArray(replacer)
|
|
22424
|
+
? new Set(replacer.map(String))
|
|
22425
|
+
: null;
|
|
22426
|
+
|
|
22427
|
+
/**
|
|
22428
|
+
* Prepares a value for stringification by resolving toJSON, handling BigInts,
|
|
22429
|
+
* applying custom replacers, and unwrapping primitive objects.
|
|
22430
|
+
*
|
|
22431
|
+
* @param {object|Array} parent The parent object or array holding the value.
|
|
22432
|
+
* @param {string} key The key associated with the value.
|
|
22433
|
+
* @param {any} val The raw value to process.
|
|
22434
|
+
* @returns {any} The processed value ready for stringification.
|
|
22435
|
+
*/
|
|
22436
|
+
const prepareVal = (parent, key, val) => {
|
|
22437
|
+
const isObject = val !== null && typeof val === "object";
|
|
22438
|
+
const hasToJSON = isObject && typeof val.toJSON === "function";
|
|
22439
|
+
|
|
22440
|
+
if (hasToJSON) {
|
|
22441
|
+
val = val.toJSON(key);
|
|
22442
|
+
}
|
|
22443
|
+
|
|
22444
|
+
const isNoise = typeof val === "string" && noiseValue.test(val);
|
|
22445
|
+
|
|
22446
|
+
if (isNoise) return val + "n";
|
|
22447
|
+
|
|
22448
|
+
const isBigInt = typeof val === "bigint";
|
|
22449
|
+
|
|
22450
|
+
if (isBigInt) {
|
|
22451
|
+
const supportsRawJSON = "rawJSON" in JSON;
|
|
22452
|
+
|
|
22453
|
+
if (supportsRawJSON) return JSON.rawJSON(val.toString());
|
|
22454
|
+
|
|
22455
|
+
return val.toString() + "n";
|
|
22456
|
+
}
|
|
22457
|
+
|
|
22458
|
+
if (isFunctionReplacer) {
|
|
22459
|
+
val = replacer.call(parent, key, val);
|
|
22460
|
+
}
|
|
22461
|
+
|
|
22462
|
+
const isPostReplacerObject = val !== null && typeof val === "object";
|
|
22463
|
+
|
|
22464
|
+
if (isPostReplacerObject) {
|
|
22465
|
+
const isPrimitiveWrapper =
|
|
22466
|
+
val instanceof Number ||
|
|
22467
|
+
val instanceof String ||
|
|
22468
|
+
val instanceof Boolean;
|
|
22469
|
+
|
|
22470
|
+
if (isPrimitiveWrapper) {
|
|
22471
|
+
val = val.valueOf();
|
|
22472
|
+
}
|
|
22473
|
+
}
|
|
22474
|
+
|
|
22475
|
+
return val;
|
|
22476
|
+
};
|
|
22477
|
+
|
|
22478
|
+
const rootProcessed = prepareVal({ "": rootValue }, "", rootValue);
|
|
22479
|
+
|
|
22480
|
+
if (isUnstringifiable(rootProcessed)) {
|
|
22481
|
+
return undefined;
|
|
22482
|
+
}
|
|
22483
|
+
|
|
22484
|
+
const isRootPrimitive =
|
|
22485
|
+
rootProcessed === null || typeof rootProcessed !== "object";
|
|
22486
|
+
const isRootNativeRawJSON = isRawJSON(rootProcessed);
|
|
22487
|
+
|
|
22488
|
+
if (isRootPrimitive || isRootNativeRawJSON) {
|
|
22489
|
+
return originalStringify(rootProcessed);
|
|
22490
|
+
}
|
|
22491
|
+
|
|
22492
|
+
const chunks = [];
|
|
22493
|
+
let level = 0;
|
|
22494
|
+
|
|
22495
|
+
const stack = [
|
|
22496
|
+
{
|
|
22497
|
+
parent: { "": rootProcessed },
|
|
22498
|
+
key: "",
|
|
22499
|
+
val: rootProcessed,
|
|
22500
|
+
isArray: Array.isArray(rootProcessed),
|
|
22501
|
+
keys: Array.isArray(rootProcessed) ? null : Object.keys(rootProcessed),
|
|
22502
|
+
index: 0,
|
|
22503
|
+
first: true,
|
|
22504
|
+
},
|
|
22505
|
+
];
|
|
22506
|
+
|
|
22507
|
+
const visited = new WeakSet([rootProcessed]);
|
|
22508
|
+
|
|
22509
|
+
while (stack.length > 0) {
|
|
22510
|
+
const node = stack[stack.length - 1];
|
|
22511
|
+
|
|
22512
|
+
if (node.index === 0) {
|
|
22513
|
+
chunks.push(node.isArray ? "[" : "{");
|
|
22514
|
+
level++;
|
|
22515
|
+
}
|
|
22516
|
+
|
|
22517
|
+
let isDone = false;
|
|
22518
|
+
|
|
22519
|
+
if (node.isArray) {
|
|
22520
|
+
if (node.index < node.val.length) {
|
|
22521
|
+
if (!node.first) chunks.push(",");
|
|
22522
|
+
|
|
22523
|
+
if (space) chunks.push("\n" + space.repeat(level));
|
|
22524
|
+
|
|
22525
|
+
const childRaw = node.val[node.index];
|
|
22526
|
+
const childVal = prepareVal(node.val, String(node.index), childRaw);
|
|
22527
|
+
|
|
22528
|
+
if (isUnstringifiable(childVal)) {
|
|
22529
|
+
chunks.push("null");
|
|
22530
|
+
node.first = false;
|
|
22531
|
+
node.index++;
|
|
22532
|
+
} else {
|
|
22533
|
+
const isComplexObject =
|
|
22534
|
+
childVal !== null && typeof childVal === "object";
|
|
22535
|
+
const isNativeRaw = isRawJSON(childVal);
|
|
22536
|
+
|
|
22537
|
+
if (isComplexObject && !isNativeRaw) {
|
|
22538
|
+
if (visited.has(childVal)) {
|
|
22539
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
22540
|
+
}
|
|
22541
|
+
|
|
22542
|
+
visited.add(childVal);
|
|
22543
|
+
|
|
22544
|
+
stack.push({
|
|
22545
|
+
parent: node.val,
|
|
22546
|
+
key: String(node.index),
|
|
22547
|
+
val: childVal,
|
|
22548
|
+
isArray: Array.isArray(childVal),
|
|
22549
|
+
keys: Array.isArray(childVal) ? null : Object.keys(childVal),
|
|
22550
|
+
index: 0,
|
|
22551
|
+
first: true,
|
|
22552
|
+
});
|
|
22553
|
+
|
|
22554
|
+
node.first = false;
|
|
22555
|
+
node.index++;
|
|
22556
|
+
} else {
|
|
22557
|
+
chunks.push(originalStringify(childVal));
|
|
22558
|
+
node.first = false;
|
|
22559
|
+
node.index++;
|
|
22560
|
+
}
|
|
22561
|
+
}
|
|
22562
|
+
} else {
|
|
22563
|
+
isDone = true;
|
|
22564
|
+
}
|
|
22565
|
+
} else {
|
|
22566
|
+
while (node.index < node.keys.length) {
|
|
22567
|
+
const k = node.keys[node.index++];
|
|
22568
|
+
|
|
22569
|
+
const isFilteredOutByArray = propertyList && !propertyList.has(k);
|
|
22570
|
+
|
|
22571
|
+
if (isFilteredOutByArray) continue;
|
|
22572
|
+
|
|
22573
|
+
const childRaw = node.val[k];
|
|
22574
|
+
const childVal = prepareVal(node.val, k, childRaw);
|
|
22575
|
+
|
|
22576
|
+
if (isUnstringifiable(childVal)) continue;
|
|
22577
|
+
|
|
22578
|
+
if (!node.first) chunks.push(",");
|
|
22579
|
+
|
|
22580
|
+
if (space) {
|
|
22581
|
+
chunks.push("\n" + space.repeat(level) + originalStringify(k) + ": ");
|
|
22582
|
+
} else {
|
|
22583
|
+
chunks.push(originalStringify(k) + ":");
|
|
22584
|
+
}
|
|
22585
|
+
|
|
22586
|
+
const isComplexObject =
|
|
22587
|
+
childVal !== null && typeof childVal === "object";
|
|
22588
|
+
const isNativeRaw = isRawJSON(childVal);
|
|
22589
|
+
|
|
22590
|
+
if (isComplexObject && !isNativeRaw) {
|
|
22591
|
+
if (visited.has(childVal)) {
|
|
22592
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
22593
|
+
}
|
|
22594
|
+
|
|
22595
|
+
visited.add(childVal);
|
|
22596
|
+
|
|
22597
|
+
stack.push({
|
|
22598
|
+
parent: node.val,
|
|
22599
|
+
key: k,
|
|
22600
|
+
val: childVal,
|
|
22601
|
+
isArray: Array.isArray(childVal),
|
|
22602
|
+
keys: Array.isArray(childVal) ? null : Object.keys(childVal),
|
|
22603
|
+
index: 0,
|
|
22604
|
+
first: true,
|
|
22605
|
+
});
|
|
22606
|
+
|
|
22607
|
+
node.first = false;
|
|
22608
|
+
|
|
22609
|
+
break; // Stop current loop level to process the newly pushed stack node
|
|
22610
|
+
} else {
|
|
22611
|
+
chunks.push(originalStringify(childVal));
|
|
22612
|
+
node.first = false;
|
|
22613
|
+
}
|
|
22614
|
+
}
|
|
22615
|
+
|
|
22616
|
+
const isNodeFullyProcessed =
|
|
22617
|
+
node.index >= node.keys.length && stack[stack.length - 1] === node;
|
|
22618
|
+
|
|
22619
|
+
if (isNodeFullyProcessed) {
|
|
22620
|
+
isDone = true;
|
|
22621
|
+
}
|
|
22622
|
+
}
|
|
22623
|
+
|
|
22624
|
+
if (isDone) {
|
|
22625
|
+
level--;
|
|
22626
|
+
|
|
22627
|
+
if (!node.first && space) chunks.push("\n" + space.repeat(level));
|
|
22628
|
+
|
|
22629
|
+
chunks.push(node.isArray ? "]" : "}");
|
|
22630
|
+
visited.delete(node.val);
|
|
22631
|
+
stack.pop();
|
|
22632
|
+
}
|
|
22633
|
+
}
|
|
22634
|
+
|
|
22635
|
+
return chunks.join("");
|
|
22636
|
+
};
|
|
22637
|
+
|
|
22390
22638
|
/**
|
|
22391
22639
|
* Converts a JavaScript value to a JSON string.
|
|
22392
22640
|
*
|
|
@@ -22398,55 +22646,87 @@ const noiseStringify =
|
|
|
22398
22646
|
*
|
|
22399
22647
|
* @param {*} value The value to convert to a JSON string.
|
|
22400
22648
|
* @param {Replacer | Array<string | number> | null} [replacer]
|
|
22401
|
-
*
|
|
22402
|
-
*
|
|
22649
|
+
* A function that alters the behavior of the stringification process,
|
|
22650
|
+
* or an array of strings/numbers to indicate properties to exclude.
|
|
22403
22651
|
* @param {string | number} [space]
|
|
22404
|
-
*
|
|
22652
|
+
* A string or number to specify indentation or pretty-printing.
|
|
22405
22653
|
* @returns {string} The JSON string representation.
|
|
22406
22654
|
*/
|
|
22407
22655
|
const JSONStringify = (value, replacer, space) => {
|
|
22408
|
-
|
|
22409
|
-
|
|
22656
|
+
try {
|
|
22657
|
+
const supportsRawJSON = "rawJSON" in JSON;
|
|
22658
|
+
|
|
22659
|
+
if (supportsRawJSON) {
|
|
22660
|
+
return originalStringify(
|
|
22661
|
+
value,
|
|
22662
|
+
(key, val) => {
|
|
22663
|
+
if (typeof val === "bigint") return JSON.rawJSON(val.toString());
|
|
22664
|
+
|
|
22665
|
+
const hasFunctionReplacer = typeof replacer === "function";
|
|
22666
|
+
|
|
22667
|
+
if (hasFunctionReplacer) return replacer(key, val);
|
|
22668
|
+
|
|
22669
|
+
const isKeyInArrayReplacer =
|
|
22670
|
+
Array.isArray(replacer) && replacer.includes(key);
|
|
22671
|
+
|
|
22672
|
+
if (isKeyInArrayReplacer) return val;
|
|
22673
|
+
|
|
22674
|
+
return val;
|
|
22675
|
+
},
|
|
22676
|
+
space,
|
|
22677
|
+
);
|
|
22678
|
+
}
|
|
22679
|
+
|
|
22680
|
+
if (!value) return originalStringify(value, replacer, space);
|
|
22681
|
+
|
|
22682
|
+
const convertedToCustomJSON = originalStringify(
|
|
22410
22683
|
value,
|
|
22411
|
-
(key,
|
|
22412
|
-
|
|
22684
|
+
(key, val) => {
|
|
22685
|
+
const isNoise = typeof val === "string" && noiseValue.test(val);
|
|
22413
22686
|
|
|
22414
|
-
if (
|
|
22687
|
+
if (isNoise) return val.toString() + "n"; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
|
|
22415
22688
|
|
|
22416
|
-
if (
|
|
22689
|
+
if (typeof val === "bigint") return val.toString() + "n";
|
|
22417
22690
|
|
|
22418
|
-
|
|
22691
|
+
const hasFunctionReplacer = typeof replacer === "function";
|
|
22692
|
+
|
|
22693
|
+
if (hasFunctionReplacer) return replacer(key, val);
|
|
22694
|
+
|
|
22695
|
+
const isKeyInArrayReplacer =
|
|
22696
|
+
Array.isArray(replacer) && replacer.includes(key);
|
|
22697
|
+
|
|
22698
|
+
if (isKeyInArrayReplacer) return val;
|
|
22699
|
+
|
|
22700
|
+
return val;
|
|
22419
22701
|
},
|
|
22420
22702
|
space,
|
|
22421
22703
|
);
|
|
22422
|
-
}
|
|
22423
22704
|
|
|
22424
|
-
|
|
22705
|
+
const processedJSON = convertedToCustomJSON.replace(
|
|
22706
|
+
bigIntsStringify,
|
|
22707
|
+
"$1$2$3",
|
|
22708
|
+
); // Delete one "n" off the end of every BigInt value
|
|
22425
22709
|
|
|
22426
|
-
|
|
22427
|
-
value,
|
|
22428
|
-
(key, value) => {
|
|
22429
|
-
const isNoise = typeof value === "string" && noiseValue.test(value);
|
|
22710
|
+
const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); // Remove one "n" off the end of every noisy string
|
|
22430
22711
|
|
|
22431
|
-
|
|
22712
|
+
return denoisedJSON;
|
|
22713
|
+
} catch (error) {
|
|
22714
|
+
if (error instanceof RangeError) {
|
|
22715
|
+
const convertedJSON = stringifyIteratively(value, replacer, space);
|
|
22432
22716
|
|
|
22433
|
-
if (
|
|
22717
|
+
if (convertedJSON === undefined) return undefined;
|
|
22434
22718
|
|
|
22435
|
-
|
|
22719
|
+
const supportsRawJSON = "rawJSON" in JSON;
|
|
22436
22720
|
|
|
22437
|
-
if (
|
|
22721
|
+
if (supportsRawJSON) return convertedJSON;
|
|
22438
22722
|
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
const processedJSON = convertedToCustomJSON.replace(
|
|
22444
|
-
bigIntsStringify,
|
|
22445
|
-
"$1$2$3",
|
|
22446
|
-
); // Delete one "n" off the end of every BigInt value
|
|
22447
|
-
const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); // Remove one "n" off the end of every noisy string
|
|
22723
|
+
const processedJSON = convertedJSON.replace(bigIntsStringify, "$1$2$3");
|
|
22724
|
+
|
|
22725
|
+
return processedJSON.replace(noiseStringify, "$1$2$3");
|
|
22726
|
+
}
|
|
22448
22727
|
|
|
22449
|
-
|
|
22728
|
+
throw error;
|
|
22729
|
+
}
|
|
22450
22730
|
};
|
|
22451
22731
|
|
|
22452
22732
|
const featureCache = new Map();
|
|
@@ -22494,12 +22774,15 @@ const isContextSourceSupported = () => {
|
|
|
22494
22774
|
const convertMarkedBigIntsReviver = (key, value, context, userReviver) => {
|
|
22495
22775
|
const isCustomFormatBigInt =
|
|
22496
22776
|
typeof value === "string" && customFormat.test(value);
|
|
22777
|
+
|
|
22497
22778
|
if (isCustomFormatBigInt) return BigInt(value.slice(0, -1));
|
|
22498
22779
|
|
|
22499
22780
|
const isNoiseValue = typeof value === "string" && noiseValue.test(value);
|
|
22500
22781
|
if (isNoiseValue) return value.slice(0, -1);
|
|
22501
22782
|
|
|
22502
|
-
|
|
22783
|
+
const hasUserReviver = typeof userReviver === "function";
|
|
22784
|
+
|
|
22785
|
+
if (!hasUserReviver) return value;
|
|
22503
22786
|
|
|
22504
22787
|
return userReviver(key, value, context);
|
|
22505
22788
|
};
|
|
@@ -22517,15 +22800,18 @@ const convertMarkedBigIntsReviver = (key, value, context, userReviver) => {
|
|
|
22517
22800
|
*/
|
|
22518
22801
|
const JSONParseV2 = (text, reviver) => {
|
|
22519
22802
|
return JSON.parse(text, (key, value, context) => {
|
|
22520
|
-
const
|
|
22521
|
-
|
|
22522
|
-
|
|
22803
|
+
const isNumber = typeof value === "number";
|
|
22804
|
+
const isOutOfBounds =
|
|
22805
|
+
value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER;
|
|
22806
|
+
const isBigNumber = isNumber && isOutOfBounds;
|
|
22523
22807
|
const isInt = context && intRegex.test(context.source);
|
|
22524
22808
|
const isBigInt = isBigNumber && isInt;
|
|
22525
22809
|
|
|
22526
22810
|
if (isBigInt) return BigInt(context.source);
|
|
22527
22811
|
|
|
22528
|
-
|
|
22812
|
+
const hasCustomReviver = typeof reviver === "function";
|
|
22813
|
+
|
|
22814
|
+
if (!hasCustomReviver) return value;
|
|
22529
22815
|
|
|
22530
22816
|
return reviver(key, value, context);
|
|
22531
22817
|
});
|
|
@@ -22537,6 +22823,105 @@ const stringsOrLargeNumbers =
|
|
|
22537
22823
|
/"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g;
|
|
22538
22824
|
const noiseValueWithQuotes = /^"-?\d+n+"$/; // Noise - strings that match the custom format before being converted to it
|
|
22539
22825
|
|
|
22826
|
+
/**
|
|
22827
|
+
* Iteratively traverses the parsed object bottom-up (post-order),
|
|
22828
|
+
* emulating the native JSON.parse reviver behavior.
|
|
22829
|
+
* This avoids Call Stack overflows (RangeError) on deeply nested structures.
|
|
22830
|
+
*
|
|
22831
|
+
* @param {any} parsed The natively parsed JSON object.
|
|
22832
|
+
* @param {Reviver} [userReviver] User's custom reviver function.
|
|
22833
|
+
* @returns {any} The fully processed object.
|
|
22834
|
+
*/
|
|
22835
|
+
const applyReviverIteratively = (parsed, userReviver) => {
|
|
22836
|
+
const rootHolder = { "": parsed };
|
|
22837
|
+
const stack = [{ parent: rootHolder, key: "", visited: false }];
|
|
22838
|
+
|
|
22839
|
+
while (stack.length > 0) {
|
|
22840
|
+
const node = stack[stack.length - 1];
|
|
22841
|
+
|
|
22842
|
+
if (!node.visited) {
|
|
22843
|
+
node.visited = true;
|
|
22844
|
+
|
|
22845
|
+
const value = node.parent[node.key];
|
|
22846
|
+
const isComplexObject = value !== null && typeof value === "object";
|
|
22847
|
+
|
|
22848
|
+
if (isComplexObject) {
|
|
22849
|
+
const keys = Object.keys(value);
|
|
22850
|
+
|
|
22851
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
22852
|
+
stack.push({ parent: value, key: keys[i], visited: false });
|
|
22853
|
+
}
|
|
22854
|
+
}
|
|
22855
|
+
} else {
|
|
22856
|
+
const { parent, key } = node;
|
|
22857
|
+
let value = parent[key];
|
|
22858
|
+
|
|
22859
|
+
if (typeof value === "string") {
|
|
22860
|
+
const isCustomFormatBigInt = customFormat.test(value);
|
|
22861
|
+
|
|
22862
|
+
if (isCustomFormatBigInt) {
|
|
22863
|
+
value = BigInt(value.slice(0, -1));
|
|
22864
|
+
} else {
|
|
22865
|
+
const isNoise = noiseValue.test(value);
|
|
22866
|
+
|
|
22867
|
+
if (isNoise) value = value.slice(0, -1);
|
|
22868
|
+
}
|
|
22869
|
+
}
|
|
22870
|
+
|
|
22871
|
+
const hasUserReviver = typeof userReviver === "function";
|
|
22872
|
+
|
|
22873
|
+
if (hasUserReviver) {
|
|
22874
|
+
value = userReviver.call(parent, key, value);
|
|
22875
|
+
}
|
|
22876
|
+
|
|
22877
|
+
const isDeleted = value === undefined;
|
|
22878
|
+
|
|
22879
|
+
if (isDeleted) {
|
|
22880
|
+
delete parent[key];
|
|
22881
|
+
} else {
|
|
22882
|
+
parent[key] = value;
|
|
22883
|
+
}
|
|
22884
|
+
|
|
22885
|
+
stack.pop();
|
|
22886
|
+
}
|
|
22887
|
+
}
|
|
22888
|
+
|
|
22889
|
+
return rootHolder[""];
|
|
22890
|
+
};
|
|
22891
|
+
|
|
22892
|
+
/**
|
|
22893
|
+
* Pre-processes the JSON string to mark large numbers with an 'n' suffix.
|
|
22894
|
+
*
|
|
22895
|
+
* @param {string} text The raw JSON string.
|
|
22896
|
+
* @returns {string} The serialized string with marked BigInts.
|
|
22897
|
+
*/
|
|
22898
|
+
const serializeBigInts = (text) => {
|
|
22899
|
+
return text.replace(
|
|
22900
|
+
stringsOrLargeNumbers,
|
|
22901
|
+
(match, digits, fractional, exponential) => {
|
|
22902
|
+
const isString = match[0] === '"';
|
|
22903
|
+
const isNoise = isString && noiseValueWithQuotes.test(match);
|
|
22904
|
+
|
|
22905
|
+
if (isNoise) return match.substring(0, match.length - 1) + 'n"'; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
|
|
22906
|
+
|
|
22907
|
+
const hasFractionalOrExponential = fractional || exponential;
|
|
22908
|
+
|
|
22909
|
+
// With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison
|
|
22910
|
+
const isLessThanMaxSafeInt =
|
|
22911
|
+
digits &&
|
|
22912
|
+
(digits.length < MAX_DIGITS ||
|
|
22913
|
+
(digits.length === MAX_DIGITS && digits <= MAX_INT));
|
|
22914
|
+
|
|
22915
|
+
const isStandardValue =
|
|
22916
|
+
isString || hasFractionalOrExponential || isLessThanMaxSafeInt;
|
|
22917
|
+
|
|
22918
|
+
if (isStandardValue) return match;
|
|
22919
|
+
|
|
22920
|
+
return '"' + match + 'n"';
|
|
22921
|
+
},
|
|
22922
|
+
);
|
|
22923
|
+
};
|
|
22924
|
+
|
|
22540
22925
|
/**
|
|
22541
22926
|
* Converts a JSON string into a JavaScript value.
|
|
22542
22927
|
*
|
|
@@ -22548,42 +22933,34 @@ const noiseValueWithQuotes = /^"-?\d+n+"$/; // Noise - strings that match the cu
|
|
|
22548
22933
|
*
|
|
22549
22934
|
* @param {string} text A valid JSON string.
|
|
22550
22935
|
* @param {Reviver} [reviver]
|
|
22551
|
-
*
|
|
22552
|
-
*
|
|
22553
|
-
*
|
|
22936
|
+
* A function that transforms the results. This function is called for each member
|
|
22937
|
+
* of the object. If a member contains nested objects, the nested objects are
|
|
22938
|
+
* transformed before the parent object is.
|
|
22554
22939
|
* @returns {any} The parsed JavaScript value.
|
|
22555
22940
|
* @throws {SyntaxError} If text is not valid JSON.
|
|
22556
22941
|
*/
|
|
22557
22942
|
const JSONParse = (text, reviver) => {
|
|
22558
22943
|
if (!text) return originalParse(text, reviver);
|
|
22559
22944
|
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
// Find and mark big numbers with "n"
|
|
22563
|
-
const serializedData = text.replace(
|
|
22564
|
-
stringsOrLargeNumbers,
|
|
22565
|
-
(text, digits, fractional, exponential) => {
|
|
22566
|
-
const isString = text[0] === '"';
|
|
22567
|
-
const isNoise = isString && noiseValueWithQuotes.test(text);
|
|
22568
|
-
|
|
22569
|
-
if (isNoise) return text.substring(0, text.length - 1) + 'n"'; // Mark noise values with additional "n" to offset the deletion of one "n" during the processing
|
|
22945
|
+
try {
|
|
22946
|
+
if (isContextSourceSupported()) return JSONParseV2(text, reviver); // Shortcut to a faster (2x) and simpler version
|
|
22570
22947
|
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
digits &&
|
|
22574
|
-
(digits.length < MAX_DIGITS ||
|
|
22575
|
-
(digits.length === MAX_DIGITS && digits <= MAX_INT)); // With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison
|
|
22948
|
+
// Find and mark big numbers with "n"
|
|
22949
|
+
const serializedData = serializeBigInts(text);
|
|
22576
22950
|
|
|
22577
|
-
|
|
22578
|
-
|
|
22951
|
+
return originalParse(serializedData, (key, value, context) =>
|
|
22952
|
+
convertMarkedBigIntsReviver(key, value, context, reviver),
|
|
22953
|
+
);
|
|
22954
|
+
} catch (error) {
|
|
22955
|
+
if (error instanceof RangeError) {
|
|
22956
|
+
const serializedData = serializeBigInts(text);
|
|
22957
|
+
const parsed = originalParse(serializedData);
|
|
22579
22958
|
|
|
22580
|
-
return
|
|
22581
|
-
}
|
|
22582
|
-
);
|
|
22959
|
+
return applyReviverIteratively(parsed, reviver);
|
|
22960
|
+
}
|
|
22583
22961
|
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
);
|
|
22962
|
+
throw error;
|
|
22963
|
+
}
|
|
22587
22964
|
};
|
|
22588
22965
|
|
|
22589
22966
|
|
|
@@ -22637,7 +23014,7 @@ class RequestError extends Error {
|
|
|
22637
23014
|
|
|
22638
23015
|
|
|
22639
23016
|
// pkg/dist-src/version.js
|
|
22640
|
-
var dist_bundle_VERSION = "10.0.
|
|
23017
|
+
var dist_bundle_VERSION = "10.0.11";
|
|
22641
23018
|
|
|
22642
23019
|
// pkg/dist-src/defaults.js
|
|
22643
23020
|
var defaults_default = {
|
|
@@ -22794,9 +23171,10 @@ function toErrorMessage(data) {
|
|
|
22794
23171
|
if (data instanceof ArrayBuffer) {
|
|
22795
23172
|
return "Unknown error";
|
|
22796
23173
|
}
|
|
22797
|
-
if ("message" in data) {
|
|
22798
|
-
const
|
|
22799
|
-
|
|
23174
|
+
if (typeof data === "object" && data !== null && "message" in data) {
|
|
23175
|
+
const objectData = data;
|
|
23176
|
+
const suffix = "documentation_url" in objectData ? ` - ${objectData.documentation_url}` : "";
|
|
23177
|
+
return Array.isArray(objectData.errors) ? `${objectData.message}: ${objectData.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${objectData.message}${suffix}`;
|
|
22800
23178
|
}
|
|
22801
23179
|
return `Unknown error: ${JSON.stringify(data)}`;
|
|
22802
23180
|
}
|
|
@@ -29078,6 +29456,7 @@ async function enumerateMcpServers(repoRoot) {
|
|
|
29078
29456
|
|
|
29079
29457
|
|
|
29080
29458
|
|
|
29459
|
+
|
|
29081
29460
|
const MAX_FILE_BYTES = 1_048_576;
|
|
29082
29461
|
const SCANNABLE_EXTENSIONS = new Set([
|
|
29083
29462
|
".md",
|
|
@@ -29180,44 +29559,97 @@ function resolveEdge(rawTarget, type, sourceAbsPath, repoRoot, existingAbsPaths)
|
|
|
29180
29559
|
malformed: false
|
|
29181
29560
|
};
|
|
29182
29561
|
}
|
|
29183
|
-
|
|
29562
|
+
/**
|
|
29563
|
+
* fs-safe's listing/reading rejects symlinks outright, so a symlinked
|
|
29564
|
+
* instruction file or directory (e.g. a repo-root AGENTS.md pointing at a
|
|
29565
|
+
* canonical doc) is reported as neither a file nor a directory and silently
|
|
29566
|
+
* disappears from the scan. Resolve the target ourselves and only follow it
|
|
29567
|
+
* when it stays inside the repo root, mirroring the traversal guard already
|
|
29568
|
+
* used for edge targets. Stats the already-resolved real path (rather than
|
|
29569
|
+
* re-resolving the symlink) so the within-root check and the type check
|
|
29570
|
+
* observe the same target, closing the TOCTOU window between the two.
|
|
29571
|
+
*/ async function resolveSymlink(rootReal, entryAbs) {
|
|
29572
|
+
try {
|
|
29573
|
+
const real = await (0,promises_.realpath)(entryAbs);
|
|
29574
|
+
const isWithinRoot = real === rootReal || real.startsWith(`${rootReal}${external_node_path_.sep}`);
|
|
29575
|
+
if (!isWithinRoot) return null;
|
|
29576
|
+
const targetStat = await (0,promises_.stat)(real);
|
|
29577
|
+
if (targetStat.isDirectory()) return {
|
|
29578
|
+
kind: "directory",
|
|
29579
|
+
real
|
|
29580
|
+
};
|
|
29581
|
+
if (targetStat.isFile()) return {
|
|
29582
|
+
kind: "file",
|
|
29583
|
+
real
|
|
29584
|
+
};
|
|
29585
|
+
return null;
|
|
29586
|
+
} catch {
|
|
29587
|
+
return null;
|
|
29588
|
+
}
|
|
29589
|
+
}
|
|
29590
|
+
/**
|
|
29591
|
+
* Walks the repo tree, tracking two coordinate systems in parallel:
|
|
29592
|
+
* - (listRoot, listRelDir): where fs-safe should actually list/read from.
|
|
29593
|
+
* This starts at topRepoRoot but re-roots to rootReal + a real relative
|
|
29594
|
+
* path once the walk crosses a symlinked directory, since fs-safe cannot
|
|
29595
|
+
* list a path that is itself a symlink.
|
|
29596
|
+
* - logicalPrefix: the repo-root-relative path as it appears in the tree,
|
|
29597
|
+
* used for InventoryRecord.path/absPath so a file's identity reflects
|
|
29598
|
+
* where it's *referenced from*, not where the symlink target physically
|
|
29599
|
+
* lives.
|
|
29600
|
+
*/ async function collectFiles(listRoot, listRelDir, logicalPrefix, topRepoRoot, rootReal, collected, depth = 0) {
|
|
29184
29601
|
if (depth > 10) return;
|
|
29185
29602
|
let entries;
|
|
29186
29603
|
try {
|
|
29187
|
-
entries = await file_system_utils_listDirectoryWithinRoot(
|
|
29604
|
+
entries = await file_system_utils_listDirectoryWithinRoot(listRoot, listRelDir);
|
|
29188
29605
|
} catch {
|
|
29189
29606
|
return;
|
|
29190
29607
|
}
|
|
29191
29608
|
entries.sort((a, b)=>a.name.localeCompare(b.name));
|
|
29192
29609
|
for (const entry of entries){
|
|
29193
|
-
const
|
|
29194
|
-
const
|
|
29195
|
-
|
|
29610
|
+
const listEntryRel = listRelDir ? `${listRelDir}/${entry.name}` : entry.name;
|
|
29611
|
+
const logicalRel = logicalPrefix ? `${logicalPrefix}/${entry.name}` : entry.name;
|
|
29612
|
+
const listEntryAbs = (0,external_node_path_.resolve)(listRoot, listEntryRel);
|
|
29613
|
+
const isDirectory = entry.isDirectory();
|
|
29614
|
+
const isFile = entry.isFile();
|
|
29615
|
+
const symlink = entry.isSymbolicLink() ? await resolveSymlink(rootReal, listEntryAbs) : null;
|
|
29616
|
+
if (isDirectory || symlink?.kind === "directory") {
|
|
29196
29617
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist") {
|
|
29197
29618
|
continue;
|
|
29198
29619
|
}
|
|
29199
|
-
|
|
29200
|
-
|
|
29620
|
+
if (symlink?.kind === "directory") {
|
|
29621
|
+
// Re-root the walk at rootReal so the symlinked directory
|
|
29622
|
+
// (and anything beneath it) is listed via its real,
|
|
29623
|
+
// symlink-free path — fs-safe rejects listing a path that
|
|
29624
|
+
// is itself a symlink.
|
|
29625
|
+
await collectFiles(rootReal, (0,external_node_path_.relative)(rootReal, symlink.real), logicalRel, topRepoRoot, rootReal, collected, depth + 1);
|
|
29626
|
+
} else {
|
|
29627
|
+
await collectFiles(listRoot, listEntryRel, logicalRel, topRepoRoot, rootReal, collected, depth + 1);
|
|
29628
|
+
}
|
|
29629
|
+
} else if ((isFile || symlink?.kind === "file") && isScannableFile(entry.name)) {
|
|
29201
29630
|
collected.push({
|
|
29202
|
-
absPath:
|
|
29203
|
-
relPath:
|
|
29631
|
+
absPath: (0,external_node_path_.resolve)(topRepoRoot, logicalRel),
|
|
29632
|
+
relPath: logicalRel,
|
|
29633
|
+
readRoot: symlink?.kind === "file" ? rootReal : listRoot,
|
|
29634
|
+
readRelPath: symlink?.kind === "file" ? (0,external_node_path_.relative)(rootReal, symlink.real) : listEntryRel
|
|
29204
29635
|
});
|
|
29205
29636
|
}
|
|
29206
29637
|
}
|
|
29207
29638
|
}
|
|
29208
29639
|
async function scanRepository(repoRoot) {
|
|
29209
29640
|
const absRoot = (0,external_node_path_.resolve)(repoRoot);
|
|
29641
|
+
const rootReal = await (0,promises_.realpath)(absRoot);
|
|
29210
29642
|
const allFiles = [];
|
|
29211
|
-
await collectFiles(absRoot, "", allFiles);
|
|
29643
|
+
await collectFiles(absRoot, "", "", absRoot, rootReal, allFiles);
|
|
29212
29644
|
const existingAbsPaths = new Set(allFiles.map((f)=>f.absPath));
|
|
29213
29645
|
const rawRecords = [];
|
|
29214
|
-
for (const { absPath, relPath } of allFiles){
|
|
29646
|
+
for (const { absPath, relPath, readRoot, readRelPath } of allFiles){
|
|
29215
29647
|
const harness = determineHarness(relPath);
|
|
29216
29648
|
if (harness === null) continue;
|
|
29217
29649
|
let content = null;
|
|
29218
29650
|
if (isMarkdownFile(relPath)) {
|
|
29219
29651
|
try {
|
|
29220
|
-
content = await file_system_utils_readTextWithinRoot(
|
|
29652
|
+
content = await file_system_utils_readTextWithinRoot(readRoot, readRelPath, MAX_FILE_BYTES);
|
|
29221
29653
|
} catch {
|
|
29222
29654
|
content = null;
|
|
29223
29655
|
}
|