@ev-ai/agent-hook 1.4.0 → 1.4.1
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/COLLECTED-DATA.md +8 -8
- package/README.md +1 -1
- package/dist/cli.mjs +50 -46
- package/dist/hook.mjs +46 -42
- package/dist/managed-hooks-snippet.cjs +3555 -195
- package/dist/managed-hooks-snippet.mjs +3601 -241
- package/dist/plugin-hooks.mjs +4664 -4
- package/package.json +1 -1
|
@@ -38,7 +38,7 @@ var require_mcp_launch_identity = __commonJS({
|
|
|
38
38
|
exports.MCP_MISSING_LAUNCH_SERIALIZED = exports.MCP_LAUNCH_IDENTITY_ALGORITHM = void 0;
|
|
39
39
|
exports.foldMcpName = foldMcpName;
|
|
40
40
|
exports.buildMcpFamilyCanonicalKey = buildMcpFamilyCanonicalKey;
|
|
41
|
-
exports.launchContainsCredentials =
|
|
41
|
+
exports.launchContainsCredentials = launchContainsCredentials2;
|
|
42
42
|
exports.serializeMcpLaunchIdentity = serializeMcpLaunchIdentity;
|
|
43
43
|
exports.hashMcpLaunchIdentity = hashMcpLaunchIdentity;
|
|
44
44
|
exports.projectMcpMissingLaunchIdentity = projectMcpMissingLaunchIdentity;
|
|
@@ -72,7 +72,7 @@ var require_mcp_launch_identity = __commonJS({
|
|
|
72
72
|
function lengthPrefixed(value) {
|
|
73
73
|
return `${Buffer.byteLength(value, "utf8")}:${value}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function launchContainsCredentials2(input) {
|
|
76
76
|
if (input.kind === "url") {
|
|
77
77
|
return urlContainsCredentials(input.url);
|
|
78
78
|
}
|
|
@@ -201,12 +201,14 @@ var require_npx_package = __commonJS({
|
|
|
201
201
|
"../composition-identity/dist/npx-package.js"(exports) {
|
|
202
202
|
"use strict";
|
|
203
203
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
204
|
-
exports.PACKAGE_FIELD_MAX = void 0;
|
|
205
|
-
exports.npxExecBin =
|
|
206
|
-
exports.
|
|
207
|
-
exports.
|
|
204
|
+
exports.LOCAL_BIN_PACKAGE_VERSION_SOURCE = exports.PACKAGE_FIELD_MAX = void 0;
|
|
205
|
+
exports.npxExecBin = npxExecBin2;
|
|
206
|
+
exports.isExactNpmVersion = isExactNpmVersion3;
|
|
207
|
+
exports.isNodeModulesBinCommand = isNodeModulesBinCommand2;
|
|
208
|
+
exports.packageNameFromSpec = packageNameFromSpec4;
|
|
209
|
+
exports.pinnedPackageVersionFromSpec = pinnedPackageVersionFromSpec2;
|
|
208
210
|
exports.pinnedPackageVersionFromNpx = pinnedPackageVersionFromNpx;
|
|
209
|
-
exports.npxPackageSpecs =
|
|
211
|
+
exports.npxPackageSpecs = npxPackageSpecs2;
|
|
210
212
|
exports.PACKAGE_FIELD_MAX = 128;
|
|
211
213
|
var PACKAGE_NAME_RE = /^(?:@[A-Za-z0-9~-][A-Za-z0-9._~-]*\/)?[A-Za-z0-9~-][A-Za-z0-9._~-]*$/;
|
|
212
214
|
var PACKAGE_FLAGS = /* @__PURE__ */ new Set(["-p", "--package"]);
|
|
@@ -243,7 +245,7 @@ var require_npx_package = __commonJS({
|
|
|
243
245
|
function booleanFlag(flag) {
|
|
244
246
|
return BOOLEAN_FLAGS.has(flag) || NEGATED_FLAG_RE.test(flag);
|
|
245
247
|
}
|
|
246
|
-
function
|
|
248
|
+
function npxExecBin2(command) {
|
|
247
249
|
const base = command.replace(/\\/g, "/").split("/").pop() ?? "";
|
|
248
250
|
const bare = base.replace(/\.(cmd|exe|bat|ps1)$/i, "").toLowerCase();
|
|
249
251
|
if (bare === "npx") {
|
|
@@ -251,8 +253,16 @@ var require_npx_package = __commonJS({
|
|
|
251
253
|
}
|
|
252
254
|
return bare === "npm" ? "npm" : null;
|
|
253
255
|
}
|
|
254
|
-
var
|
|
255
|
-
function
|
|
256
|
+
var STRICT_SEMVER_RE = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
257
|
+
function isExactNpmVersion3(version) {
|
|
258
|
+
return version.length <= exports.PACKAGE_FIELD_MAX && STRICT_SEMVER_RE.test(version);
|
|
259
|
+
}
|
|
260
|
+
exports.LOCAL_BIN_PACKAGE_VERSION_SOURCE = "node_modules_local";
|
|
261
|
+
var NODE_MODULES_BIN_RE = /(?:^|\/)node_modules\/\.bin\/[^/]+$/;
|
|
262
|
+
function isNodeModulesBinCommand2(command) {
|
|
263
|
+
return NODE_MODULES_BIN_RE.test(command.replaceAll("\\", "/"));
|
|
264
|
+
}
|
|
265
|
+
function packageNameFromSpec4(spec) {
|
|
256
266
|
if (spec.length === 0 || spec.length > exports.PACKAGE_FIELD_MAX) {
|
|
257
267
|
return null;
|
|
258
268
|
}
|
|
@@ -260,25 +270,25 @@ var require_npx_package = __commonJS({
|
|
|
260
270
|
const name = at > 0 ? spec.slice(0, at) : spec;
|
|
261
271
|
return PACKAGE_NAME_RE.test(name) ? name : null;
|
|
262
272
|
}
|
|
263
|
-
function
|
|
264
|
-
const name =
|
|
273
|
+
function pinnedPackageVersionFromSpec2(spec) {
|
|
274
|
+
const name = packageNameFromSpec4(spec);
|
|
265
275
|
if (name === null || !spec.startsWith(`${name}@`)) {
|
|
266
276
|
return void 0;
|
|
267
277
|
}
|
|
268
278
|
const selector = spec.slice(name.length + 1);
|
|
269
|
-
return
|
|
279
|
+
return isExactNpmVersion3(selector) ? selector : void 0;
|
|
270
280
|
}
|
|
271
281
|
function pinnedPackageVersionFromNpx(command, args) {
|
|
272
|
-
for (const spec of
|
|
273
|
-
const pinned =
|
|
282
|
+
for (const spec of npxPackageSpecs2(command, args)) {
|
|
283
|
+
const pinned = pinnedPackageVersionFromSpec2(spec);
|
|
274
284
|
if (pinned !== void 0) {
|
|
275
285
|
return pinned;
|
|
276
286
|
}
|
|
277
287
|
}
|
|
278
288
|
return void 0;
|
|
279
289
|
}
|
|
280
|
-
function
|
|
281
|
-
const bin =
|
|
290
|
+
function npxPackageSpecs2(command, args) {
|
|
291
|
+
const bin = npxExecBin2(command);
|
|
282
292
|
if (bin === null) {
|
|
283
293
|
return [];
|
|
284
294
|
}
|
|
@@ -327,9 +337,9 @@ var require_npx_package = __commonJS({
|
|
|
327
337
|
return [];
|
|
328
338
|
}
|
|
329
339
|
if (explicit.length > 0) {
|
|
330
|
-
return explicit.every((spec) =>
|
|
340
|
+
return explicit.every((spec) => packageNameFromSpec4(spec) !== null) ? explicit : [];
|
|
331
341
|
}
|
|
332
|
-
if (firstPositional === null ||
|
|
342
|
+
if (firstPositional === null || packageNameFromSpec4(firstPositional) === null) {
|
|
333
343
|
return [];
|
|
334
344
|
}
|
|
335
345
|
return [firstPositional];
|
|
@@ -344,13 +354,13 @@ var require_mcp_package_identity = __commonJS({
|
|
|
344
354
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
345
355
|
exports.McpPackageEcosystem = void 0;
|
|
346
356
|
exports.resolveMcpPackageIdentity = resolveMcpPackageIdentity;
|
|
357
|
+
exports.resolveLocalBinPackageIdentity = resolveLocalBinPackageIdentity;
|
|
347
358
|
var mcp_launch_identity_js_1 = require_mcp_launch_identity();
|
|
348
359
|
var npx_package_js_1 = require_npx_package();
|
|
349
360
|
exports.McpPackageEcosystem = {
|
|
350
361
|
NPM: "npm",
|
|
351
362
|
PYPI: "pypi"
|
|
352
363
|
};
|
|
353
|
-
var NPM_EXACT_VERSION_RE = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
354
364
|
var PYPI_NAME_RE = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
355
365
|
var PYPI_EXACT_VERSION_RE = /^(?:\d+!)?\d+(?:\.\d+)*(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?(?:\+[0-9A-Za-z]+(?:[.][0-9A-Za-z]+)*)?$/;
|
|
356
366
|
function pythonRunnerBin(command) {
|
|
@@ -483,7 +493,7 @@ var require_mcp_package_identity = __commonJS({
|
|
|
483
493
|
return null;
|
|
484
494
|
}
|
|
485
495
|
const version = spec.slice(packageName.length + 1);
|
|
486
|
-
if (!
|
|
496
|
+
if (!(0, npx_package_js_1.isExactNpmVersion)(version)) {
|
|
487
497
|
return null;
|
|
488
498
|
}
|
|
489
499
|
return { ecosystem: exports.McpPackageEcosystem.NPM, packageName, version };
|
|
@@ -507,6 +517,19 @@ var require_mcp_package_identity = __commonJS({
|
|
|
507
517
|
}
|
|
508
518
|
return void 0;
|
|
509
519
|
}
|
|
520
|
+
function resolveLocalBinPackageIdentity(launch, hook) {
|
|
521
|
+
if (launch?.kind !== "command" || (0, mcp_launch_identity_js_1.launchContainsCredentials)(launch)) {
|
|
522
|
+
return void 0;
|
|
523
|
+
}
|
|
524
|
+
if (!(0, npx_package_js_1.isNodeModulesBinCommand)(launch.command) || hook.packageVersionSource !== npx_package_js_1.LOCAL_BIN_PACKAGE_VERSION_SOURCE) {
|
|
525
|
+
return void 0;
|
|
526
|
+
}
|
|
527
|
+
const { packageName, packageVersion } = hook;
|
|
528
|
+
if (packageName === void 0 || packageVersion === void 0 || (0, npx_package_js_1.packageNameFromSpec)(packageName) !== packageName || !(0, npx_package_js_1.isExactNpmVersion)(packageVersion)) {
|
|
529
|
+
return void 0;
|
|
530
|
+
}
|
|
531
|
+
return { ecosystem: exports.McpPackageEcosystem.NPM, packageName, version: packageVersion };
|
|
532
|
+
}
|
|
510
533
|
}
|
|
511
534
|
});
|
|
512
535
|
|
|
@@ -657,6 +680,10 @@ var require_mcp_provenance = __commonJS({
|
|
|
657
680
|
}
|
|
658
681
|
return classified;
|
|
659
682
|
}
|
|
683
|
+
if ((0, npx_package_js_1.isNodeModulesBinCommand)(launch.command)) {
|
|
684
|
+
const hookPackageName = typeof input.packageName === "string" ? (0, npx_package_js_1.packageNameFromSpec)(input.packageName) : null;
|
|
685
|
+
return hookPackageName === null || hookPackageName !== input.packageName ? { origin: "UNKNOWN" } : classifyRegistryPackage(hookPackageName, launch.arguments, input.publisherName);
|
|
686
|
+
}
|
|
660
687
|
if (isRepoRelativeCommand(launch.command)) {
|
|
661
688
|
return { origin: "INTERNAL" };
|
|
662
689
|
}
|
|
@@ -879,7 +906,7 @@ var require_dist = __commonJS({
|
|
|
879
906
|
"../composition-identity/dist/index.js"(exports) {
|
|
880
907
|
"use strict";
|
|
881
908
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
882
|
-
exports.redactComponentSource = exports.prepareComponentInspectionText = exports.fitSnapshotInspectionTextBudget = exports.componentSourceContainsRedactableSecret = exports.capComponentTextBytes = exports.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES = exports.COMPONENT_SOURCE_REDACTION_PLACEHOLDER = exports.COMPONENT_INSPECTION_TEXT_MAX_BYTES = exports.usableCatalogText = exports.parseFrontmatterField = exports.parseFrontmatterDescription = exports.mcpServerToolSegmentForms = exports.mcpServerNameMatchesToolSegment = exports.isNpmRegistryPublisher = exports.EMPTY_NPM_PUBLISHER = exports.displayPublisherName = exports.classifyMcpProvenance = exports.resolveMcpPackageIdentity = exports.McpPackageEcosystem = exports.pinnedPackageVersionFromSpec = exports.pinnedPackageVersionFromNpx = exports.packageNameFromSpec = exports.npxPackageSpecs = exports.npxExecBin = exports.PACKAGE_FIELD_MAX = exports.serializeMcpLaunchIdentity = exports.projectMcpMissingLaunchIdentity = exports.projectMcpLaunchIdentity = exports.normalizeMcpToolNames = exports.MCP_MISSING_LAUNCH_SERIALIZED = exports.MCP_LAUNCH_IDENTITY_ALGORITHM = exports.maskMcpLaunchForDisplay = exports.launchContainsCredentials = exports.hashMcpLaunchIdentity = exports.foldMcpName = exports.buildMcpFamilyCanonicalKey = exports.ComponentKind = void 0;
|
|
909
|
+
exports.redactComponentSource = exports.prepareComponentInspectionText = exports.fitSnapshotInspectionTextBudget = exports.componentSourceContainsRedactableSecret = exports.capComponentTextBytes = exports.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES = exports.COMPONENT_SOURCE_REDACTION_PLACEHOLDER = exports.COMPONENT_INSPECTION_TEXT_MAX_BYTES = exports.usableCatalogText = exports.parseFrontmatterField = exports.parseFrontmatterDescription = exports.mcpServerToolSegmentForms = exports.mcpServerNameMatchesToolSegment = exports.isNpmRegistryPublisher = exports.EMPTY_NPM_PUBLISHER = exports.displayPublisherName = exports.classifyMcpProvenance = exports.resolveMcpPackageIdentity = exports.resolveLocalBinPackageIdentity = exports.McpPackageEcosystem = exports.pinnedPackageVersionFromSpec = exports.pinnedPackageVersionFromNpx = exports.packageNameFromSpec = exports.npxPackageSpecs = exports.npxExecBin = exports.isNodeModulesBinCommand = exports.isExactNpmVersion = exports.LOCAL_BIN_PACKAGE_VERSION_SOURCE = exports.PACKAGE_FIELD_MAX = exports.serializeMcpLaunchIdentity = exports.projectMcpMissingLaunchIdentity = exports.projectMcpLaunchIdentity = exports.normalizeMcpToolNames = exports.MCP_MISSING_LAUNCH_SERIALIZED = exports.MCP_LAUNCH_IDENTITY_ALGORITHM = exports.maskMcpLaunchForDisplay = exports.launchContainsCredentials = exports.hashMcpLaunchIdentity = exports.foldMcpName = exports.buildMcpFamilyCanonicalKey = exports.ComponentKind = void 0;
|
|
883
910
|
exports.userConfigRootFromPath = userConfigRootFromPath;
|
|
884
911
|
exports.installationRootExternalKey = installationRootExternalKey;
|
|
885
912
|
exports.normalizeRepositoryRelativePath = normalizeRepositoryRelativePath;
|
|
@@ -1032,6 +1059,15 @@ var require_dist = __commonJS({
|
|
|
1032
1059
|
Object.defineProperty(exports, "PACKAGE_FIELD_MAX", { enumerable: true, get: function() {
|
|
1033
1060
|
return npx_package_js_1.PACKAGE_FIELD_MAX;
|
|
1034
1061
|
} });
|
|
1062
|
+
Object.defineProperty(exports, "LOCAL_BIN_PACKAGE_VERSION_SOURCE", { enumerable: true, get: function() {
|
|
1063
|
+
return npx_package_js_1.LOCAL_BIN_PACKAGE_VERSION_SOURCE;
|
|
1064
|
+
} });
|
|
1065
|
+
Object.defineProperty(exports, "isExactNpmVersion", { enumerable: true, get: function() {
|
|
1066
|
+
return npx_package_js_1.isExactNpmVersion;
|
|
1067
|
+
} });
|
|
1068
|
+
Object.defineProperty(exports, "isNodeModulesBinCommand", { enumerable: true, get: function() {
|
|
1069
|
+
return npx_package_js_1.isNodeModulesBinCommand;
|
|
1070
|
+
} });
|
|
1035
1071
|
Object.defineProperty(exports, "npxExecBin", { enumerable: true, get: function() {
|
|
1036
1072
|
return npx_package_js_1.npxExecBin;
|
|
1037
1073
|
} });
|
|
@@ -1051,6 +1087,9 @@ var require_dist = __commonJS({
|
|
|
1051
1087
|
Object.defineProperty(exports, "McpPackageEcosystem", { enumerable: true, get: function() {
|
|
1052
1088
|
return mcp_package_identity_js_1.McpPackageEcosystem;
|
|
1053
1089
|
} });
|
|
1090
|
+
Object.defineProperty(exports, "resolveLocalBinPackageIdentity", { enumerable: true, get: function() {
|
|
1091
|
+
return mcp_package_identity_js_1.resolveLocalBinPackageIdentity;
|
|
1092
|
+
} });
|
|
1054
1093
|
Object.defineProperty(exports, "resolveMcpPackageIdentity", { enumerable: true, get: function() {
|
|
1055
1094
|
return mcp_package_identity_js_1.resolveMcpPackageIdentity;
|
|
1056
1095
|
} });
|
|
@@ -1112,212 +1151,3198 @@ var require_dist = __commonJS({
|
|
|
1112
1151
|
}
|
|
1113
1152
|
});
|
|
1114
1153
|
|
|
1115
|
-
//
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
// `managed_config.toml` is deliberately absent: it carries org defaults,
|
|
1195
|
-
// so it is probed by `managed` rather than counted as user settings.
|
|
1196
|
-
settings: [".codex/hooks.json", ".codex/config.toml"],
|
|
1197
|
-
mcpToml: [".codex/config.toml"]
|
|
1198
|
-
},
|
|
1199
|
-
homeOnly: { memory: [[".codex/AGENTS.override.md", ".codex/AGENTS.md"]], managed: "codex" }
|
|
1200
|
-
},
|
|
1201
|
-
// GitHub Copilot (CLI + VS Code). Mirrors REPO_GITHUB_COPILOT in
|
|
1202
|
-
// common/platform-component-ownership: project surfaces under `.github/`,
|
|
1203
|
-
// user ones under `~/.copilot/`. `dirs` cannot differ by scope, so both trees
|
|
1204
|
-
// are listed; the one that does not apply at a scope simply never exists.
|
|
1205
|
-
// `.github/hooks/*.json` is a directory of hook files, which `settings` (a
|
|
1206
|
-
// file list) cannot express — left for a later pass, like `plugins` / `managed`.
|
|
1207
|
-
//
|
|
1208
|
-
// Copilot also reads other runners' files: `.claude/skills` and
|
|
1209
|
-
// `.agents/skills` (Copilot CLI, and VS Code local sessions, which also read
|
|
1210
|
-
// `~/.claude/skills`), plus `AGENTS.md`, `CLAUDE.md` and `.claude/CLAUDE.md`
|
|
1211
|
-
// in the repo. Listing them here is what lets a Copilot-only machine report
|
|
1212
|
-
// them; `local-spec-owner.ts` attributes them to Copilot as well.
|
|
1213
|
-
// Sources: GitHub "Creating agent skills" and "Adding custom instructions"
|
|
1214
|
-
// for Copilot CLI, and VS Code "Agent skills" and "MCP servers".
|
|
1215
|
-
copilot: {
|
|
1216
|
-
shared: {
|
|
1217
|
-
skillRoots: [".claude/skills", ".agents/skills"],
|
|
1218
|
-
dirs: [
|
|
1219
|
-
{ dir: ".github/agents", kind: "SUBAGENT", extensions: [".md"] },
|
|
1220
|
-
// Copilot prompt files are `<name>.prompt.md`, run as `/<name>`.
|
|
1221
|
-
{ dir: ".github/prompts", kind: "COMMAND", extensions: [".prompt.md"] },
|
|
1222
|
-
// Copilot only loads `<name>.instructions.md` here; repo-syncer names the rule `<name>`.
|
|
1223
|
-
{ dir: ".github/instructions", kind: "RULE", extensions: [".instructions.md"] },
|
|
1224
|
-
{ dir: ".copilot/agents", kind: "SUBAGENT", extensions: [".md"] },
|
|
1225
|
-
// User-level instruction files (`~/.copilot/instructions/**`).
|
|
1226
|
-
{ dir: ".copilot/instructions", kind: "RULE", extensions: [".instructions.md"] }
|
|
1227
|
-
],
|
|
1228
|
-
memory: [],
|
|
1229
|
-
settings: []
|
|
1230
|
-
},
|
|
1231
|
-
homeOnly: {
|
|
1232
|
-
skillRoots: [".copilot/skills"],
|
|
1233
|
-
memory: [[".copilot/copilot-instructions.md"]],
|
|
1234
|
-
settings: [".copilot/config.json"],
|
|
1235
|
-
mcpJson: [".copilot/mcp-config.json"]
|
|
1236
|
-
},
|
|
1237
|
-
projectOnly: {
|
|
1238
|
-
skillRoots: [".github/skills"],
|
|
1239
|
-
memory: [
|
|
1240
|
-
[".github/copilot-instructions.md"],
|
|
1241
|
-
["AGENTS.md"],
|
|
1242
|
-
["CLAUDE.md"],
|
|
1243
|
-
[".claude/CLAUDE.md"]
|
|
1244
|
-
],
|
|
1245
|
-
settings: [".github/copilot/settings.json"],
|
|
1246
|
-
// VS Code's workspace file keys servers under `servers`, not `mcpServers`.
|
|
1247
|
-
mcpJson: [".github/mcp.json", ".vscode/mcp.json"]
|
|
1248
|
-
}
|
|
1154
|
+
// ../../node_modules/braces/lib/utils.js
|
|
1155
|
+
var require_utils = __commonJS({
|
|
1156
|
+
"../../node_modules/braces/lib/utils.js"(exports) {
|
|
1157
|
+
"use strict";
|
|
1158
|
+
exports.isInteger = (num) => {
|
|
1159
|
+
if (typeof num === "number") {
|
|
1160
|
+
return Number.isInteger(num);
|
|
1161
|
+
}
|
|
1162
|
+
if (typeof num === "string" && num.trim() !== "") {
|
|
1163
|
+
return Number.isInteger(Number(num));
|
|
1164
|
+
}
|
|
1165
|
+
return false;
|
|
1166
|
+
};
|
|
1167
|
+
exports.find = (node, type) => node.nodes.find((node2) => node2.type === type);
|
|
1168
|
+
exports.exceedsLimit = (min, max, step = 1, limit) => {
|
|
1169
|
+
if (limit === false) return false;
|
|
1170
|
+
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
|
1171
|
+
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
1172
|
+
};
|
|
1173
|
+
exports.escapeNode = (block, n = 0, type) => {
|
|
1174
|
+
const node = block.nodes[n];
|
|
1175
|
+
if (!node) return;
|
|
1176
|
+
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
1177
|
+
if (node.escaped !== true) {
|
|
1178
|
+
node.value = "\\" + node.value;
|
|
1179
|
+
node.escaped = true;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
exports.encloseBrace = (node) => {
|
|
1184
|
+
if (node.type !== "brace") return false;
|
|
1185
|
+
if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
|
1186
|
+
node.invalid = true;
|
|
1187
|
+
return true;
|
|
1188
|
+
}
|
|
1189
|
+
return false;
|
|
1190
|
+
};
|
|
1191
|
+
exports.isInvalidBrace = (block) => {
|
|
1192
|
+
if (block.type !== "brace") return false;
|
|
1193
|
+
if (block.invalid === true || block.dollar) return true;
|
|
1194
|
+
if (block.commas >> 0 + block.ranges >> 0 === 0) {
|
|
1195
|
+
block.invalid = true;
|
|
1196
|
+
return true;
|
|
1197
|
+
}
|
|
1198
|
+
if (block.open !== true || block.close !== true) {
|
|
1199
|
+
block.invalid = true;
|
|
1200
|
+
return true;
|
|
1201
|
+
}
|
|
1202
|
+
return false;
|
|
1203
|
+
};
|
|
1204
|
+
exports.isOpenOrClose = (node) => {
|
|
1205
|
+
if (node.type === "open" || node.type === "close") {
|
|
1206
|
+
return true;
|
|
1207
|
+
}
|
|
1208
|
+
return node.open === true || node.close === true;
|
|
1209
|
+
};
|
|
1210
|
+
exports.reduce = (nodes) => nodes.reduce((acc, node) => {
|
|
1211
|
+
if (node.type === "text") acc.push(node.value);
|
|
1212
|
+
if (node.type === "range") node.type = "text";
|
|
1213
|
+
return acc;
|
|
1214
|
+
}, []);
|
|
1215
|
+
exports.flatten = (...args) => {
|
|
1216
|
+
const result = [];
|
|
1217
|
+
const flat = (arr) => {
|
|
1218
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1219
|
+
const ele = arr[i];
|
|
1220
|
+
if (Array.isArray(ele)) {
|
|
1221
|
+
flat(ele);
|
|
1222
|
+
continue;
|
|
1223
|
+
}
|
|
1224
|
+
if (ele !== void 0) {
|
|
1225
|
+
result.push(ele);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
return result;
|
|
1229
|
+
};
|
|
1230
|
+
flat(args);
|
|
1231
|
+
return result;
|
|
1232
|
+
};
|
|
1249
1233
|
}
|
|
1250
|
-
};
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
// ../../node_modules/braces/lib/stringify.js
|
|
1237
|
+
var require_stringify = __commonJS({
|
|
1238
|
+
"../../node_modules/braces/lib/stringify.js"(exports, module) {
|
|
1239
|
+
"use strict";
|
|
1240
|
+
var utils = require_utils();
|
|
1241
|
+
module.exports = (ast, options = {}) => {
|
|
1242
|
+
const stringify = (node, parent = {}) => {
|
|
1243
|
+
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
1244
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
1245
|
+
let output = "";
|
|
1246
|
+
if (node.value) {
|
|
1247
|
+
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
|
1248
|
+
return "\\" + node.value;
|
|
1249
|
+
}
|
|
1250
|
+
return node.value;
|
|
1251
|
+
}
|
|
1252
|
+
if (node.value) {
|
|
1253
|
+
return node.value;
|
|
1254
|
+
}
|
|
1255
|
+
if (node.nodes) {
|
|
1256
|
+
for (const child of node.nodes) {
|
|
1257
|
+
output += stringify(child);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
return output;
|
|
1261
|
+
};
|
|
1262
|
+
return stringify(ast);
|
|
1263
|
+
};
|
|
1254
1264
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
mcpJson: concatOptional(shared.mcpJson, delta.mcpJson),
|
|
1265
|
-
mcpToml: concatOptional(shared.mcpToml, delta.mcpToml),
|
|
1266
|
-
plugins: delta.plugins ?? shared.plugins,
|
|
1267
|
-
managed: delta.managed ?? shared.managed
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
function layoutsForScope(scope) {
|
|
1271
|
-
return Object.fromEntries(
|
|
1272
|
-
Object.entries(RUNNER_LAYOUT).map(([runner, entry]) => [
|
|
1273
|
-
runner,
|
|
1274
|
-
layoutForScope(entry, entry[scope])
|
|
1275
|
-
])
|
|
1276
|
-
);
|
|
1277
|
-
}
|
|
1278
|
-
var PLATFORM_USER_LAYOUT = layoutsForScope("homeOnly");
|
|
1279
|
-
var PLATFORM_PROJECT_LAYOUT = layoutsForScope("projectOnly");
|
|
1280
|
-
function uniqueRels(rels) {
|
|
1281
|
-
return [...new Set(rels)];
|
|
1282
|
-
}
|
|
1283
|
-
function userScopePathsFromLayouts(layouts) {
|
|
1284
|
-
const skills = [];
|
|
1285
|
-
const subagents = [];
|
|
1286
|
-
const commands = [];
|
|
1287
|
-
const rules = [];
|
|
1288
|
-
const memory = [];
|
|
1289
|
-
const settings = [];
|
|
1290
|
-
const mcp = [];
|
|
1291
|
-
for (const layout of layouts) {
|
|
1292
|
-
skills.push(...layout.skillRoots);
|
|
1293
|
-
for (const entry of layout.dirs) {
|
|
1294
|
-
if (entry.kind === "SUBAGENT") {
|
|
1295
|
-
subagents.push(entry.dir);
|
|
1296
|
-
} else if (entry.kind === "COMMAND") {
|
|
1297
|
-
commands.push(entry.dir);
|
|
1298
|
-
} else {
|
|
1299
|
-
rules.push(entry.dir);
|
|
1265
|
+
});
|
|
1266
|
+
|
|
1267
|
+
// ../../node_modules/is-number/index.js
|
|
1268
|
+
var require_is_number = __commonJS({
|
|
1269
|
+
"../../node_modules/is-number/index.js"(exports, module) {
|
|
1270
|
+
"use strict";
|
|
1271
|
+
module.exports = function(num) {
|
|
1272
|
+
if (typeof num === "number") {
|
|
1273
|
+
return num - num === 0;
|
|
1300
1274
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1275
|
+
if (typeof num === "string" && num.trim() !== "") {
|
|
1276
|
+
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
|
1277
|
+
}
|
|
1278
|
+
return false;
|
|
1279
|
+
};
|
|
1305
1280
|
}
|
|
1306
|
-
|
|
1307
|
-
skills: uniqueRels(skills),
|
|
1308
|
-
subagents: uniqueRels(subagents),
|
|
1309
|
-
commands: uniqueRels(commands),
|
|
1310
|
-
rules: uniqueRels(rules),
|
|
1311
|
-
memory: uniqueRels(memory),
|
|
1312
|
-
settings: uniqueRels(settings),
|
|
1313
|
-
mcp: uniqueRels(mcp)
|
|
1314
|
-
};
|
|
1315
|
-
}
|
|
1316
|
-
var USER_SCOPE_PATHS = userScopePathsFromLayouts(
|
|
1317
|
-
Object.values(PLATFORM_USER_LAYOUT)
|
|
1318
|
-
);
|
|
1281
|
+
});
|
|
1319
1282
|
|
|
1320
|
-
//
|
|
1283
|
+
// ../../node_modules/to-regex-range/index.js
|
|
1284
|
+
var require_to_regex_range = __commonJS({
|
|
1285
|
+
"../../node_modules/to-regex-range/index.js"(exports, module) {
|
|
1286
|
+
"use strict";
|
|
1287
|
+
var isNumber = require_is_number();
|
|
1288
|
+
var toRegexRange = (min, max, options) => {
|
|
1289
|
+
if (isNumber(min) === false) {
|
|
1290
|
+
throw new TypeError("toRegexRange: expected the first argument to be a number");
|
|
1291
|
+
}
|
|
1292
|
+
if (max === void 0 || min === max) {
|
|
1293
|
+
return String(min);
|
|
1294
|
+
}
|
|
1295
|
+
if (isNumber(max) === false) {
|
|
1296
|
+
throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
|
1297
|
+
}
|
|
1298
|
+
let opts = { relaxZeros: true, ...options };
|
|
1299
|
+
if (typeof opts.strictZeros === "boolean") {
|
|
1300
|
+
opts.relaxZeros = opts.strictZeros === false;
|
|
1301
|
+
}
|
|
1302
|
+
let relax = String(opts.relaxZeros);
|
|
1303
|
+
let shorthand = String(opts.shorthand);
|
|
1304
|
+
let capture = String(opts.capture);
|
|
1305
|
+
let wrap = String(opts.wrap);
|
|
1306
|
+
let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
|
|
1307
|
+
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
1308
|
+
return toRegexRange.cache[cacheKey].result;
|
|
1309
|
+
}
|
|
1310
|
+
let a = Math.min(min, max);
|
|
1311
|
+
let b = Math.max(min, max);
|
|
1312
|
+
if (Math.abs(a - b) === 1) {
|
|
1313
|
+
let result = min + "|" + max;
|
|
1314
|
+
if (opts.capture) {
|
|
1315
|
+
return `(${result})`;
|
|
1316
|
+
}
|
|
1317
|
+
if (opts.wrap === false) {
|
|
1318
|
+
return result;
|
|
1319
|
+
}
|
|
1320
|
+
return `(?:${result})`;
|
|
1321
|
+
}
|
|
1322
|
+
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1323
|
+
let state = { min, max, a, b };
|
|
1324
|
+
let positives = [];
|
|
1325
|
+
let negatives = [];
|
|
1326
|
+
if (isPadded) {
|
|
1327
|
+
state.isPadded = isPadded;
|
|
1328
|
+
state.maxLen = String(state.max).length;
|
|
1329
|
+
}
|
|
1330
|
+
if (a < 0) {
|
|
1331
|
+
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
1332
|
+
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
1333
|
+
a = state.a = 0;
|
|
1334
|
+
}
|
|
1335
|
+
if (b >= 0) {
|
|
1336
|
+
positives = splitToPatterns(a, b, state, opts);
|
|
1337
|
+
}
|
|
1338
|
+
state.negatives = negatives;
|
|
1339
|
+
state.positives = positives;
|
|
1340
|
+
state.result = collatePatterns(negatives, positives, opts);
|
|
1341
|
+
if (opts.capture === true) {
|
|
1342
|
+
state.result = `(${state.result})`;
|
|
1343
|
+
} else if (opts.wrap !== false && positives.length + negatives.length > 1) {
|
|
1344
|
+
state.result = `(?:${state.result})`;
|
|
1345
|
+
}
|
|
1346
|
+
toRegexRange.cache[cacheKey] = state;
|
|
1347
|
+
return state.result;
|
|
1348
|
+
};
|
|
1349
|
+
function collatePatterns(neg, pos, options) {
|
|
1350
|
+
let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
|
|
1351
|
+
let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
|
|
1352
|
+
let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
|
|
1353
|
+
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
1354
|
+
return subpatterns.join("|");
|
|
1355
|
+
}
|
|
1356
|
+
function splitToRanges(min, max) {
|
|
1357
|
+
let nines = 1;
|
|
1358
|
+
let zeros = 1;
|
|
1359
|
+
let stop = countNines(min, nines);
|
|
1360
|
+
let stops = /* @__PURE__ */ new Set([max]);
|
|
1361
|
+
while (min <= stop && stop <= max) {
|
|
1362
|
+
stops.add(stop);
|
|
1363
|
+
nines += 1;
|
|
1364
|
+
stop = countNines(min, nines);
|
|
1365
|
+
}
|
|
1366
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
1367
|
+
while (min < stop && stop <= max) {
|
|
1368
|
+
stops.add(stop);
|
|
1369
|
+
zeros += 1;
|
|
1370
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
1371
|
+
}
|
|
1372
|
+
stops = [...stops];
|
|
1373
|
+
stops.sort(compare);
|
|
1374
|
+
return stops;
|
|
1375
|
+
}
|
|
1376
|
+
function rangeToPattern(start, stop, options) {
|
|
1377
|
+
if (start === stop) {
|
|
1378
|
+
return { pattern: start, count: [], digits: 0 };
|
|
1379
|
+
}
|
|
1380
|
+
let zipped = zip(start, stop);
|
|
1381
|
+
let digits = zipped.length;
|
|
1382
|
+
let pattern = "";
|
|
1383
|
+
let count = 0;
|
|
1384
|
+
for (let i = 0; i < digits; i++) {
|
|
1385
|
+
let [startDigit, stopDigit] = zipped[i];
|
|
1386
|
+
if (startDigit === stopDigit) {
|
|
1387
|
+
pattern += startDigit;
|
|
1388
|
+
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
1389
|
+
pattern += toCharacterClass(startDigit, stopDigit, options);
|
|
1390
|
+
} else {
|
|
1391
|
+
count++;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
if (count) {
|
|
1395
|
+
pattern += options.shorthand === true ? "\\d" : "[0-9]";
|
|
1396
|
+
}
|
|
1397
|
+
return { pattern, count: [count], digits };
|
|
1398
|
+
}
|
|
1399
|
+
function splitToPatterns(min, max, tok, options) {
|
|
1400
|
+
let ranges = splitToRanges(min, max);
|
|
1401
|
+
let tokens = [];
|
|
1402
|
+
let start = min;
|
|
1403
|
+
let prev;
|
|
1404
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
1405
|
+
let max2 = ranges[i];
|
|
1406
|
+
let obj = rangeToPattern(String(start), String(max2), options);
|
|
1407
|
+
let zeros = "";
|
|
1408
|
+
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
1409
|
+
if (prev.count.length > 1) {
|
|
1410
|
+
prev.count.pop();
|
|
1411
|
+
}
|
|
1412
|
+
prev.count.push(obj.count[0]);
|
|
1413
|
+
prev.string = prev.pattern + toQuantifier(prev.count);
|
|
1414
|
+
start = max2 + 1;
|
|
1415
|
+
continue;
|
|
1416
|
+
}
|
|
1417
|
+
if (tok.isPadded) {
|
|
1418
|
+
zeros = padZeros(max2, tok, options);
|
|
1419
|
+
}
|
|
1420
|
+
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
|
1421
|
+
tokens.push(obj);
|
|
1422
|
+
start = max2 + 1;
|
|
1423
|
+
prev = obj;
|
|
1424
|
+
}
|
|
1425
|
+
return tokens;
|
|
1426
|
+
}
|
|
1427
|
+
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
|
1428
|
+
let result = [];
|
|
1429
|
+
for (let ele of arr) {
|
|
1430
|
+
let { string } = ele;
|
|
1431
|
+
if (!intersection && !contains(comparison, "string", string)) {
|
|
1432
|
+
result.push(prefix + string);
|
|
1433
|
+
}
|
|
1434
|
+
if (intersection && contains(comparison, "string", string)) {
|
|
1435
|
+
result.push(prefix + string);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
return result;
|
|
1439
|
+
}
|
|
1440
|
+
function zip(a, b) {
|
|
1441
|
+
let arr = [];
|
|
1442
|
+
for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
|
|
1443
|
+
return arr;
|
|
1444
|
+
}
|
|
1445
|
+
function compare(a, b) {
|
|
1446
|
+
return a > b ? 1 : b > a ? -1 : 0;
|
|
1447
|
+
}
|
|
1448
|
+
function contains(arr, key, val) {
|
|
1449
|
+
return arr.some((ele) => ele[key] === val);
|
|
1450
|
+
}
|
|
1451
|
+
function countNines(min, len) {
|
|
1452
|
+
return Number(String(min).slice(0, -len) + "9".repeat(len));
|
|
1453
|
+
}
|
|
1454
|
+
function countZeros(integer, zeros) {
|
|
1455
|
+
return integer - integer % Math.pow(10, zeros);
|
|
1456
|
+
}
|
|
1457
|
+
function toQuantifier(digits) {
|
|
1458
|
+
let [start = 0, stop = ""] = digits;
|
|
1459
|
+
if (stop || start > 1) {
|
|
1460
|
+
return `{${start + (stop ? "," + stop : "")}}`;
|
|
1461
|
+
}
|
|
1462
|
+
return "";
|
|
1463
|
+
}
|
|
1464
|
+
function toCharacterClass(a, b, options) {
|
|
1465
|
+
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
|
1466
|
+
}
|
|
1467
|
+
function hasPadding(str) {
|
|
1468
|
+
return /^-?(0+)\d/.test(str);
|
|
1469
|
+
}
|
|
1470
|
+
function padZeros(value, tok, options) {
|
|
1471
|
+
if (!tok.isPadded) {
|
|
1472
|
+
return value;
|
|
1473
|
+
}
|
|
1474
|
+
let diff = Math.abs(tok.maxLen - String(value).length);
|
|
1475
|
+
let relax = options.relaxZeros !== false;
|
|
1476
|
+
switch (diff) {
|
|
1477
|
+
case 0:
|
|
1478
|
+
return "";
|
|
1479
|
+
case 1:
|
|
1480
|
+
return relax ? "0?" : "0";
|
|
1481
|
+
case 2:
|
|
1482
|
+
return relax ? "0{0,2}" : "00";
|
|
1483
|
+
default: {
|
|
1484
|
+
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
toRegexRange.cache = {};
|
|
1489
|
+
toRegexRange.clearCache = () => toRegexRange.cache = {};
|
|
1490
|
+
module.exports = toRegexRange;
|
|
1491
|
+
}
|
|
1492
|
+
});
|
|
1493
|
+
|
|
1494
|
+
// ../../node_modules/fill-range/index.js
|
|
1495
|
+
var require_fill_range = __commonJS({
|
|
1496
|
+
"../../node_modules/fill-range/index.js"(exports, module) {
|
|
1497
|
+
"use strict";
|
|
1498
|
+
var util = __require("util");
|
|
1499
|
+
var toRegexRange = require_to_regex_range();
|
|
1500
|
+
var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
1501
|
+
var transform = (toNumber) => {
|
|
1502
|
+
return (value) => toNumber === true ? Number(value) : String(value);
|
|
1503
|
+
};
|
|
1504
|
+
var isValidValue = (value) => {
|
|
1505
|
+
return typeof value === "number" || typeof value === "string" && value !== "";
|
|
1506
|
+
};
|
|
1507
|
+
var isNumber = (num) => Number.isInteger(+num);
|
|
1508
|
+
var zeros = (input) => {
|
|
1509
|
+
let value = `${input}`;
|
|
1510
|
+
let index = -1;
|
|
1511
|
+
if (value[0] === "-") value = value.slice(1);
|
|
1512
|
+
if (value === "0") return false;
|
|
1513
|
+
while (value[++index] === "0") ;
|
|
1514
|
+
return index > 0;
|
|
1515
|
+
};
|
|
1516
|
+
var stringify = (start, end, options) => {
|
|
1517
|
+
if (typeof start === "string" || typeof end === "string") {
|
|
1518
|
+
return true;
|
|
1519
|
+
}
|
|
1520
|
+
return options.stringify === true;
|
|
1521
|
+
};
|
|
1522
|
+
var pad = (input, maxLength, toNumber) => {
|
|
1523
|
+
if (maxLength > 0) {
|
|
1524
|
+
let dash = input[0] === "-" ? "-" : "";
|
|
1525
|
+
if (dash) input = input.slice(1);
|
|
1526
|
+
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
|
1527
|
+
}
|
|
1528
|
+
if (toNumber === false) {
|
|
1529
|
+
return String(input);
|
|
1530
|
+
}
|
|
1531
|
+
return input;
|
|
1532
|
+
};
|
|
1533
|
+
var toMaxLen = (input, maxLength) => {
|
|
1534
|
+
let negative = input[0] === "-" ? "-" : "";
|
|
1535
|
+
if (negative) {
|
|
1536
|
+
input = input.slice(1);
|
|
1537
|
+
maxLength--;
|
|
1538
|
+
}
|
|
1539
|
+
while (input.length < maxLength) input = "0" + input;
|
|
1540
|
+
return negative ? "-" + input : input;
|
|
1541
|
+
};
|
|
1542
|
+
var toSequence = (parts, options, maxLen) => {
|
|
1543
|
+
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
1544
|
+
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
1545
|
+
let prefix = options.capture ? "" : "?:";
|
|
1546
|
+
let positives = "";
|
|
1547
|
+
let negatives = "";
|
|
1548
|
+
let result;
|
|
1549
|
+
if (parts.positives.length) {
|
|
1550
|
+
positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
|
|
1551
|
+
}
|
|
1552
|
+
if (parts.negatives.length) {
|
|
1553
|
+
negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
|
|
1554
|
+
}
|
|
1555
|
+
if (positives && negatives) {
|
|
1556
|
+
result = `${positives}|${negatives}`;
|
|
1557
|
+
} else {
|
|
1558
|
+
result = positives || negatives;
|
|
1559
|
+
}
|
|
1560
|
+
if (options.wrap) {
|
|
1561
|
+
return `(${prefix}${result})`;
|
|
1562
|
+
}
|
|
1563
|
+
return result;
|
|
1564
|
+
};
|
|
1565
|
+
var toRange = (a, b, isNumbers, options) => {
|
|
1566
|
+
if (isNumbers) {
|
|
1567
|
+
return toRegexRange(a, b, { wrap: false, ...options });
|
|
1568
|
+
}
|
|
1569
|
+
let start = String.fromCharCode(a);
|
|
1570
|
+
if (a === b) return start;
|
|
1571
|
+
let stop = String.fromCharCode(b);
|
|
1572
|
+
return `[${start}-${stop}]`;
|
|
1573
|
+
};
|
|
1574
|
+
var toRegex = (start, end, options) => {
|
|
1575
|
+
if (Array.isArray(start)) {
|
|
1576
|
+
let wrap = options.wrap === true;
|
|
1577
|
+
let prefix = options.capture ? "" : "?:";
|
|
1578
|
+
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
|
1579
|
+
}
|
|
1580
|
+
return toRegexRange(start, end, options);
|
|
1581
|
+
};
|
|
1582
|
+
var rangeError = (...args) => {
|
|
1583
|
+
return new RangeError("Invalid range arguments: " + util.inspect(...args));
|
|
1584
|
+
};
|
|
1585
|
+
var invalidRange = (start, end, options) => {
|
|
1586
|
+
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
1587
|
+
return [];
|
|
1588
|
+
};
|
|
1589
|
+
var invalidStep = (step, options) => {
|
|
1590
|
+
if (options.strictRanges === true) {
|
|
1591
|
+
throw new TypeError(`Expected step "${step}" to be a number`);
|
|
1592
|
+
}
|
|
1593
|
+
return [];
|
|
1594
|
+
};
|
|
1595
|
+
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
1596
|
+
let a = Number(start);
|
|
1597
|
+
let b = Number(end);
|
|
1598
|
+
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
1599
|
+
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
1600
|
+
return [];
|
|
1601
|
+
}
|
|
1602
|
+
if (a === 0) a = 0;
|
|
1603
|
+
if (b === 0) b = 0;
|
|
1604
|
+
let descending = a > b;
|
|
1605
|
+
let startString = String(start);
|
|
1606
|
+
let endString = String(end);
|
|
1607
|
+
let stepString = String(step);
|
|
1608
|
+
step = Math.max(Math.abs(step), 1);
|
|
1609
|
+
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
1610
|
+
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
1611
|
+
let toNumber = padded === false && stringify(start, end, options) === false;
|
|
1612
|
+
let format = options.transform || transform(toNumber);
|
|
1613
|
+
if (options.toRegex && step === 1) {
|
|
1614
|
+
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
|
1615
|
+
}
|
|
1616
|
+
let parts = { negatives: [], positives: [] };
|
|
1617
|
+
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
1618
|
+
let range = [];
|
|
1619
|
+
let index = 0;
|
|
1620
|
+
while (descending ? a >= b : a <= b) {
|
|
1621
|
+
if (options.toRegex === true && step > 1) {
|
|
1622
|
+
push(a);
|
|
1623
|
+
} else {
|
|
1624
|
+
range.push(pad(format(a, index), maxLen, toNumber));
|
|
1625
|
+
}
|
|
1626
|
+
a = descending ? a - step : a + step;
|
|
1627
|
+
index++;
|
|
1628
|
+
}
|
|
1629
|
+
if (options.toRegex === true) {
|
|
1630
|
+
return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options });
|
|
1631
|
+
}
|
|
1632
|
+
return range;
|
|
1633
|
+
};
|
|
1634
|
+
var fillLetters = (start, end, step = 1, options = {}) => {
|
|
1635
|
+
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
|
|
1636
|
+
return invalidRange(start, end, options);
|
|
1637
|
+
}
|
|
1638
|
+
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
1639
|
+
let a = `${start}`.charCodeAt(0);
|
|
1640
|
+
let b = `${end}`.charCodeAt(0);
|
|
1641
|
+
let descending = a > b;
|
|
1642
|
+
let min = Math.min(a, b);
|
|
1643
|
+
let max = Math.max(a, b);
|
|
1644
|
+
if (options.toRegex && step === 1) {
|
|
1645
|
+
return toRange(min, max, false, options);
|
|
1646
|
+
}
|
|
1647
|
+
let range = [];
|
|
1648
|
+
let index = 0;
|
|
1649
|
+
while (descending ? a >= b : a <= b) {
|
|
1650
|
+
range.push(format(a, index));
|
|
1651
|
+
a = descending ? a - step : a + step;
|
|
1652
|
+
index++;
|
|
1653
|
+
}
|
|
1654
|
+
if (options.toRegex === true) {
|
|
1655
|
+
return toRegex(range, null, { wrap: false, options });
|
|
1656
|
+
}
|
|
1657
|
+
return range;
|
|
1658
|
+
};
|
|
1659
|
+
var fill = (start, end, step, options = {}) => {
|
|
1660
|
+
if (end == null && isValidValue(start)) {
|
|
1661
|
+
return [start];
|
|
1662
|
+
}
|
|
1663
|
+
if (!isValidValue(start) || !isValidValue(end)) {
|
|
1664
|
+
return invalidRange(start, end, options);
|
|
1665
|
+
}
|
|
1666
|
+
if (typeof step === "function") {
|
|
1667
|
+
return fill(start, end, 1, { transform: step });
|
|
1668
|
+
}
|
|
1669
|
+
if (isObject(step)) {
|
|
1670
|
+
return fill(start, end, 0, step);
|
|
1671
|
+
}
|
|
1672
|
+
let opts = { ...options };
|
|
1673
|
+
if (opts.capture === true) opts.wrap = true;
|
|
1674
|
+
step = step || opts.step || 1;
|
|
1675
|
+
if (!isNumber(step)) {
|
|
1676
|
+
if (step != null && !isObject(step)) return invalidStep(step, opts);
|
|
1677
|
+
return fill(start, end, 1, step);
|
|
1678
|
+
}
|
|
1679
|
+
if (isNumber(start) && isNumber(end)) {
|
|
1680
|
+
return fillNumbers(start, end, step, opts);
|
|
1681
|
+
}
|
|
1682
|
+
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
|
1683
|
+
};
|
|
1684
|
+
module.exports = fill;
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1688
|
+
// ../../node_modules/braces/lib/compile.js
|
|
1689
|
+
var require_compile = __commonJS({
|
|
1690
|
+
"../../node_modules/braces/lib/compile.js"(exports, module) {
|
|
1691
|
+
"use strict";
|
|
1692
|
+
var fill = require_fill_range();
|
|
1693
|
+
var utils = require_utils();
|
|
1694
|
+
var compile = (ast, options = {}) => {
|
|
1695
|
+
const walk = (node, parent = {}) => {
|
|
1696
|
+
const invalidBlock = utils.isInvalidBrace(parent);
|
|
1697
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
1698
|
+
const invalid = invalidBlock === true || invalidNode === true;
|
|
1699
|
+
const prefix = options.escapeInvalid === true ? "\\" : "";
|
|
1700
|
+
let output = "";
|
|
1701
|
+
if (node.isOpen === true) {
|
|
1702
|
+
return prefix + node.value;
|
|
1703
|
+
}
|
|
1704
|
+
if (node.isClose === true) {
|
|
1705
|
+
console.log("node.isClose", prefix, node.value);
|
|
1706
|
+
return prefix + node.value;
|
|
1707
|
+
}
|
|
1708
|
+
if (node.type === "open") {
|
|
1709
|
+
return invalid ? prefix + node.value : "(";
|
|
1710
|
+
}
|
|
1711
|
+
if (node.type === "close") {
|
|
1712
|
+
return invalid ? prefix + node.value : ")";
|
|
1713
|
+
}
|
|
1714
|
+
if (node.type === "comma") {
|
|
1715
|
+
return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
|
1716
|
+
}
|
|
1717
|
+
if (node.value) {
|
|
1718
|
+
return node.value;
|
|
1719
|
+
}
|
|
1720
|
+
if (node.nodes && node.ranges > 0) {
|
|
1721
|
+
const args = utils.reduce(node.nodes);
|
|
1722
|
+
const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
|
1723
|
+
if (range.length !== 0) {
|
|
1724
|
+
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
if (node.nodes) {
|
|
1728
|
+
for (const child of node.nodes) {
|
|
1729
|
+
output += walk(child, node);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
return output;
|
|
1733
|
+
};
|
|
1734
|
+
return walk(ast);
|
|
1735
|
+
};
|
|
1736
|
+
module.exports = compile;
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
|
|
1740
|
+
// ../../node_modules/braces/lib/expand.js
|
|
1741
|
+
var require_expand = __commonJS({
|
|
1742
|
+
"../../node_modules/braces/lib/expand.js"(exports, module) {
|
|
1743
|
+
"use strict";
|
|
1744
|
+
var fill = require_fill_range();
|
|
1745
|
+
var stringify = require_stringify();
|
|
1746
|
+
var utils = require_utils();
|
|
1747
|
+
var append = (queue = "", stash = "", enclose = false) => {
|
|
1748
|
+
const result = [];
|
|
1749
|
+
queue = [].concat(queue);
|
|
1750
|
+
stash = [].concat(stash);
|
|
1751
|
+
if (!stash.length) return queue;
|
|
1752
|
+
if (!queue.length) {
|
|
1753
|
+
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
|
1754
|
+
}
|
|
1755
|
+
for (const item of queue) {
|
|
1756
|
+
if (Array.isArray(item)) {
|
|
1757
|
+
for (const value of item) {
|
|
1758
|
+
result.push(append(value, stash, enclose));
|
|
1759
|
+
}
|
|
1760
|
+
} else {
|
|
1761
|
+
for (let ele of stash) {
|
|
1762
|
+
if (enclose === true && typeof ele === "string") ele = `{${ele}}`;
|
|
1763
|
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
return utils.flatten(result);
|
|
1768
|
+
};
|
|
1769
|
+
var expand = (ast, options = {}) => {
|
|
1770
|
+
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
1771
|
+
const walk = (node, parent = {}) => {
|
|
1772
|
+
node.queue = [];
|
|
1773
|
+
let p = parent;
|
|
1774
|
+
let q = parent.queue;
|
|
1775
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
1776
|
+
p = p.parent;
|
|
1777
|
+
q = p.queue;
|
|
1778
|
+
}
|
|
1779
|
+
if (node.invalid || node.dollar) {
|
|
1780
|
+
q.push(append(q.pop(), stringify(node, options)));
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1783
|
+
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
1784
|
+
q.push(append(q.pop(), ["{}"]));
|
|
1785
|
+
return;
|
|
1786
|
+
}
|
|
1787
|
+
if (node.nodes && node.ranges > 0) {
|
|
1788
|
+
const args = utils.reduce(node.nodes);
|
|
1789
|
+
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
1790
|
+
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
|
1791
|
+
}
|
|
1792
|
+
let range = fill(...args, options);
|
|
1793
|
+
if (range.length === 0) {
|
|
1794
|
+
range = stringify(node, options);
|
|
1795
|
+
}
|
|
1796
|
+
q.push(append(q.pop(), range));
|
|
1797
|
+
node.nodes = [];
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
const enclose = utils.encloseBrace(node);
|
|
1801
|
+
let queue = node.queue;
|
|
1802
|
+
let block = node;
|
|
1803
|
+
while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
|
1804
|
+
block = block.parent;
|
|
1805
|
+
queue = block.queue;
|
|
1806
|
+
}
|
|
1807
|
+
for (let i = 0; i < node.nodes.length; i++) {
|
|
1808
|
+
const child = node.nodes[i];
|
|
1809
|
+
if (child.type === "comma" && node.type === "brace") {
|
|
1810
|
+
if (i === 1) queue.push("");
|
|
1811
|
+
queue.push("");
|
|
1812
|
+
continue;
|
|
1813
|
+
}
|
|
1814
|
+
if (child.type === "close") {
|
|
1815
|
+
q.push(append(q.pop(), queue, enclose));
|
|
1816
|
+
continue;
|
|
1817
|
+
}
|
|
1818
|
+
if (child.value && child.type !== "open") {
|
|
1819
|
+
queue.push(append(queue.pop(), child.value));
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1822
|
+
if (child.nodes) {
|
|
1823
|
+
walk(child, node);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
return queue;
|
|
1827
|
+
};
|
|
1828
|
+
return utils.flatten(walk(ast));
|
|
1829
|
+
};
|
|
1830
|
+
module.exports = expand;
|
|
1831
|
+
}
|
|
1832
|
+
});
|
|
1833
|
+
|
|
1834
|
+
// ../../node_modules/braces/lib/constants.js
|
|
1835
|
+
var require_constants = __commonJS({
|
|
1836
|
+
"../../node_modules/braces/lib/constants.js"(exports, module) {
|
|
1837
|
+
"use strict";
|
|
1838
|
+
module.exports = {
|
|
1839
|
+
MAX_LENGTH: 1e4,
|
|
1840
|
+
// Digits
|
|
1841
|
+
CHAR_0: "0",
|
|
1842
|
+
/* 0 */
|
|
1843
|
+
CHAR_9: "9",
|
|
1844
|
+
/* 9 */
|
|
1845
|
+
// Alphabet chars.
|
|
1846
|
+
CHAR_UPPERCASE_A: "A",
|
|
1847
|
+
/* A */
|
|
1848
|
+
CHAR_LOWERCASE_A: "a",
|
|
1849
|
+
/* a */
|
|
1850
|
+
CHAR_UPPERCASE_Z: "Z",
|
|
1851
|
+
/* Z */
|
|
1852
|
+
CHAR_LOWERCASE_Z: "z",
|
|
1853
|
+
/* z */
|
|
1854
|
+
CHAR_LEFT_PARENTHESES: "(",
|
|
1855
|
+
/* ( */
|
|
1856
|
+
CHAR_RIGHT_PARENTHESES: ")",
|
|
1857
|
+
/* ) */
|
|
1858
|
+
CHAR_ASTERISK: "*",
|
|
1859
|
+
/* * */
|
|
1860
|
+
// Non-alphabetic chars.
|
|
1861
|
+
CHAR_AMPERSAND: "&",
|
|
1862
|
+
/* & */
|
|
1863
|
+
CHAR_AT: "@",
|
|
1864
|
+
/* @ */
|
|
1865
|
+
CHAR_BACKSLASH: "\\",
|
|
1866
|
+
/* \ */
|
|
1867
|
+
CHAR_BACKTICK: "`",
|
|
1868
|
+
/* ` */
|
|
1869
|
+
CHAR_CARRIAGE_RETURN: "\r",
|
|
1870
|
+
/* \r */
|
|
1871
|
+
CHAR_CIRCUMFLEX_ACCENT: "^",
|
|
1872
|
+
/* ^ */
|
|
1873
|
+
CHAR_COLON: ":",
|
|
1874
|
+
/* : */
|
|
1875
|
+
CHAR_COMMA: ",",
|
|
1876
|
+
/* , */
|
|
1877
|
+
CHAR_DOLLAR: "$",
|
|
1878
|
+
/* . */
|
|
1879
|
+
CHAR_DOT: ".",
|
|
1880
|
+
/* . */
|
|
1881
|
+
CHAR_DOUBLE_QUOTE: '"',
|
|
1882
|
+
/* " */
|
|
1883
|
+
CHAR_EQUAL: "=",
|
|
1884
|
+
/* = */
|
|
1885
|
+
CHAR_EXCLAMATION_MARK: "!",
|
|
1886
|
+
/* ! */
|
|
1887
|
+
CHAR_FORM_FEED: "\f",
|
|
1888
|
+
/* \f */
|
|
1889
|
+
CHAR_FORWARD_SLASH: "/",
|
|
1890
|
+
/* / */
|
|
1891
|
+
CHAR_HASH: "#",
|
|
1892
|
+
/* # */
|
|
1893
|
+
CHAR_HYPHEN_MINUS: "-",
|
|
1894
|
+
/* - */
|
|
1895
|
+
CHAR_LEFT_ANGLE_BRACKET: "<",
|
|
1896
|
+
/* < */
|
|
1897
|
+
CHAR_LEFT_CURLY_BRACE: "{",
|
|
1898
|
+
/* { */
|
|
1899
|
+
CHAR_LEFT_SQUARE_BRACKET: "[",
|
|
1900
|
+
/* [ */
|
|
1901
|
+
CHAR_LINE_FEED: "\n",
|
|
1902
|
+
/* \n */
|
|
1903
|
+
CHAR_NO_BREAK_SPACE: "\xA0",
|
|
1904
|
+
/* \u00A0 */
|
|
1905
|
+
CHAR_PERCENT: "%",
|
|
1906
|
+
/* % */
|
|
1907
|
+
CHAR_PLUS: "+",
|
|
1908
|
+
/* + */
|
|
1909
|
+
CHAR_QUESTION_MARK: "?",
|
|
1910
|
+
/* ? */
|
|
1911
|
+
CHAR_RIGHT_ANGLE_BRACKET: ">",
|
|
1912
|
+
/* > */
|
|
1913
|
+
CHAR_RIGHT_CURLY_BRACE: "}",
|
|
1914
|
+
/* } */
|
|
1915
|
+
CHAR_RIGHT_SQUARE_BRACKET: "]",
|
|
1916
|
+
/* ] */
|
|
1917
|
+
CHAR_SEMICOLON: ";",
|
|
1918
|
+
/* ; */
|
|
1919
|
+
CHAR_SINGLE_QUOTE: "'",
|
|
1920
|
+
/* ' */
|
|
1921
|
+
CHAR_SPACE: " ",
|
|
1922
|
+
/* */
|
|
1923
|
+
CHAR_TAB: " ",
|
|
1924
|
+
/* \t */
|
|
1925
|
+
CHAR_UNDERSCORE: "_",
|
|
1926
|
+
/* _ */
|
|
1927
|
+
CHAR_VERTICAL_LINE: "|",
|
|
1928
|
+
/* | */
|
|
1929
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
|
1930
|
+
/* \uFEFF */
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
|
|
1935
|
+
// ../../node_modules/braces/lib/parse.js
|
|
1936
|
+
var require_parse = __commonJS({
|
|
1937
|
+
"../../node_modules/braces/lib/parse.js"(exports, module) {
|
|
1938
|
+
"use strict";
|
|
1939
|
+
var stringify = require_stringify();
|
|
1940
|
+
var {
|
|
1941
|
+
MAX_LENGTH,
|
|
1942
|
+
CHAR_BACKSLASH,
|
|
1943
|
+
/* \ */
|
|
1944
|
+
CHAR_BACKTICK,
|
|
1945
|
+
/* ` */
|
|
1946
|
+
CHAR_COMMA,
|
|
1947
|
+
/* , */
|
|
1948
|
+
CHAR_DOT,
|
|
1949
|
+
/* . */
|
|
1950
|
+
CHAR_LEFT_PARENTHESES,
|
|
1951
|
+
/* ( */
|
|
1952
|
+
CHAR_RIGHT_PARENTHESES,
|
|
1953
|
+
/* ) */
|
|
1954
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
1955
|
+
/* { */
|
|
1956
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
1957
|
+
/* } */
|
|
1958
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
1959
|
+
/* [ */
|
|
1960
|
+
CHAR_RIGHT_SQUARE_BRACKET,
|
|
1961
|
+
/* ] */
|
|
1962
|
+
CHAR_DOUBLE_QUOTE,
|
|
1963
|
+
/* " */
|
|
1964
|
+
CHAR_SINGLE_QUOTE,
|
|
1965
|
+
/* ' */
|
|
1966
|
+
CHAR_NO_BREAK_SPACE,
|
|
1967
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
1968
|
+
} = require_constants();
|
|
1969
|
+
var parse = (input, options = {}) => {
|
|
1970
|
+
if (typeof input !== "string") {
|
|
1971
|
+
throw new TypeError("Expected a string");
|
|
1972
|
+
}
|
|
1973
|
+
const opts = options || {};
|
|
1974
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1975
|
+
if (input.length > max) {
|
|
1976
|
+
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
1977
|
+
}
|
|
1978
|
+
const ast = { type: "root", input, nodes: [] };
|
|
1979
|
+
const stack = [ast];
|
|
1980
|
+
let block = ast;
|
|
1981
|
+
let prev = ast;
|
|
1982
|
+
let brackets = 0;
|
|
1983
|
+
const length = input.length;
|
|
1984
|
+
let index = 0;
|
|
1985
|
+
let depth = 0;
|
|
1986
|
+
let value;
|
|
1987
|
+
const advance = () => input[index++];
|
|
1988
|
+
const push = (node) => {
|
|
1989
|
+
if (node.type === "text" && prev.type === "dot") {
|
|
1990
|
+
prev.type = "text";
|
|
1991
|
+
}
|
|
1992
|
+
if (prev && prev.type === "text" && node.type === "text") {
|
|
1993
|
+
prev.value += node.value;
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
block.nodes.push(node);
|
|
1997
|
+
node.parent = block;
|
|
1998
|
+
node.prev = prev;
|
|
1999
|
+
prev = node;
|
|
2000
|
+
return node;
|
|
2001
|
+
};
|
|
2002
|
+
push({ type: "bos" });
|
|
2003
|
+
while (index < length) {
|
|
2004
|
+
block = stack[stack.length - 1];
|
|
2005
|
+
value = advance();
|
|
2006
|
+
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
2007
|
+
continue;
|
|
2008
|
+
}
|
|
2009
|
+
if (value === CHAR_BACKSLASH) {
|
|
2010
|
+
push({ type: "text", value: (options.keepEscaping ? value : "") + advance() });
|
|
2011
|
+
continue;
|
|
2012
|
+
}
|
|
2013
|
+
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
2014
|
+
push({ type: "text", value: "\\" + value });
|
|
2015
|
+
continue;
|
|
2016
|
+
}
|
|
2017
|
+
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
2018
|
+
brackets++;
|
|
2019
|
+
let next;
|
|
2020
|
+
while (index < length && (next = advance())) {
|
|
2021
|
+
value += next;
|
|
2022
|
+
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
|
2023
|
+
brackets++;
|
|
2024
|
+
continue;
|
|
2025
|
+
}
|
|
2026
|
+
if (next === CHAR_BACKSLASH) {
|
|
2027
|
+
value += advance();
|
|
2028
|
+
continue;
|
|
2029
|
+
}
|
|
2030
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
2031
|
+
brackets--;
|
|
2032
|
+
if (brackets === 0) {
|
|
2033
|
+
break;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
push({ type: "text", value });
|
|
2038
|
+
continue;
|
|
2039
|
+
}
|
|
2040
|
+
if (value === CHAR_LEFT_PARENTHESES) {
|
|
2041
|
+
block = push({ type: "paren", nodes: [] });
|
|
2042
|
+
stack.push(block);
|
|
2043
|
+
push({ type: "text", value });
|
|
2044
|
+
continue;
|
|
2045
|
+
}
|
|
2046
|
+
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
2047
|
+
if (block.type !== "paren") {
|
|
2048
|
+
push({ type: "text", value });
|
|
2049
|
+
continue;
|
|
2050
|
+
}
|
|
2051
|
+
block = stack.pop();
|
|
2052
|
+
push({ type: "text", value });
|
|
2053
|
+
block = stack[stack.length - 1];
|
|
2054
|
+
continue;
|
|
2055
|
+
}
|
|
2056
|
+
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
2057
|
+
const open = value;
|
|
2058
|
+
let next;
|
|
2059
|
+
if (options.keepQuotes !== true) {
|
|
2060
|
+
value = "";
|
|
2061
|
+
}
|
|
2062
|
+
while (index < length && (next = advance())) {
|
|
2063
|
+
if (next === CHAR_BACKSLASH) {
|
|
2064
|
+
value += next + advance();
|
|
2065
|
+
continue;
|
|
2066
|
+
}
|
|
2067
|
+
if (next === open) {
|
|
2068
|
+
if (options.keepQuotes === true) value += next;
|
|
2069
|
+
break;
|
|
2070
|
+
}
|
|
2071
|
+
value += next;
|
|
2072
|
+
}
|
|
2073
|
+
push({ type: "text", value });
|
|
2074
|
+
continue;
|
|
2075
|
+
}
|
|
2076
|
+
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
2077
|
+
depth++;
|
|
2078
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
|
2079
|
+
const brace = {
|
|
2080
|
+
type: "brace",
|
|
2081
|
+
open: true,
|
|
2082
|
+
close: false,
|
|
2083
|
+
dollar,
|
|
2084
|
+
depth,
|
|
2085
|
+
commas: 0,
|
|
2086
|
+
ranges: 0,
|
|
2087
|
+
nodes: []
|
|
2088
|
+
};
|
|
2089
|
+
block = push(brace);
|
|
2090
|
+
stack.push(block);
|
|
2091
|
+
push({ type: "open", value });
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2094
|
+
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
2095
|
+
if (block.type !== "brace") {
|
|
2096
|
+
push({ type: "text", value });
|
|
2097
|
+
continue;
|
|
2098
|
+
}
|
|
2099
|
+
const type = "close";
|
|
2100
|
+
block = stack.pop();
|
|
2101
|
+
block.close = true;
|
|
2102
|
+
push({ type, value });
|
|
2103
|
+
depth--;
|
|
2104
|
+
block = stack[stack.length - 1];
|
|
2105
|
+
continue;
|
|
2106
|
+
}
|
|
2107
|
+
if (value === CHAR_COMMA && depth > 0) {
|
|
2108
|
+
if (block.ranges > 0) {
|
|
2109
|
+
block.ranges = 0;
|
|
2110
|
+
const open = block.nodes.shift();
|
|
2111
|
+
block.nodes = [open, { type: "text", value: stringify(block) }];
|
|
2112
|
+
}
|
|
2113
|
+
push({ type: "comma", value });
|
|
2114
|
+
block.commas++;
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
|
2118
|
+
const siblings = block.nodes;
|
|
2119
|
+
if (depth === 0 || siblings.length === 0) {
|
|
2120
|
+
push({ type: "text", value });
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
2123
|
+
if (prev.type === "dot") {
|
|
2124
|
+
block.range = [];
|
|
2125
|
+
prev.value += value;
|
|
2126
|
+
prev.type = "range";
|
|
2127
|
+
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
|
2128
|
+
block.invalid = true;
|
|
2129
|
+
block.ranges = 0;
|
|
2130
|
+
prev.type = "text";
|
|
2131
|
+
continue;
|
|
2132
|
+
}
|
|
2133
|
+
block.ranges++;
|
|
2134
|
+
block.args = [];
|
|
2135
|
+
continue;
|
|
2136
|
+
}
|
|
2137
|
+
if (prev.type === "range") {
|
|
2138
|
+
siblings.pop();
|
|
2139
|
+
const before = siblings[siblings.length - 1];
|
|
2140
|
+
before.value += prev.value + value;
|
|
2141
|
+
prev = before;
|
|
2142
|
+
block.ranges--;
|
|
2143
|
+
continue;
|
|
2144
|
+
}
|
|
2145
|
+
push({ type: "dot", value });
|
|
2146
|
+
continue;
|
|
2147
|
+
}
|
|
2148
|
+
push({ type: "text", value });
|
|
2149
|
+
}
|
|
2150
|
+
do {
|
|
2151
|
+
block = stack.pop();
|
|
2152
|
+
if (block.type !== "root") {
|
|
2153
|
+
block.nodes.forEach((node) => {
|
|
2154
|
+
if (!node.nodes) {
|
|
2155
|
+
if (node.type === "open") node.isOpen = true;
|
|
2156
|
+
if (node.type === "close") node.isClose = true;
|
|
2157
|
+
if (!node.nodes) node.type = "text";
|
|
2158
|
+
node.invalid = true;
|
|
2159
|
+
}
|
|
2160
|
+
});
|
|
2161
|
+
const parent = stack[stack.length - 1];
|
|
2162
|
+
const index2 = parent.nodes.indexOf(block);
|
|
2163
|
+
parent.nodes.splice(index2, 1, ...block.nodes);
|
|
2164
|
+
}
|
|
2165
|
+
} while (stack.length > 0);
|
|
2166
|
+
push({ type: "eos" });
|
|
2167
|
+
return ast;
|
|
2168
|
+
};
|
|
2169
|
+
module.exports = parse;
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
|
|
2173
|
+
// ../../node_modules/braces/index.js
|
|
2174
|
+
var require_braces = __commonJS({
|
|
2175
|
+
"../../node_modules/braces/index.js"(exports, module) {
|
|
2176
|
+
"use strict";
|
|
2177
|
+
var stringify = require_stringify();
|
|
2178
|
+
var compile = require_compile();
|
|
2179
|
+
var expand = require_expand();
|
|
2180
|
+
var parse = require_parse();
|
|
2181
|
+
var braces = (input, options = {}) => {
|
|
2182
|
+
let output = [];
|
|
2183
|
+
if (Array.isArray(input)) {
|
|
2184
|
+
for (const pattern of input) {
|
|
2185
|
+
const result = braces.create(pattern, options);
|
|
2186
|
+
if (Array.isArray(result)) {
|
|
2187
|
+
output.push(...result);
|
|
2188
|
+
} else {
|
|
2189
|
+
output.push(result);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
} else {
|
|
2193
|
+
output = [].concat(braces.create(input, options));
|
|
2194
|
+
}
|
|
2195
|
+
if (options && options.expand === true && options.nodupes === true) {
|
|
2196
|
+
output = [...new Set(output)];
|
|
2197
|
+
}
|
|
2198
|
+
return output;
|
|
2199
|
+
};
|
|
2200
|
+
braces.parse = (input, options = {}) => parse(input, options);
|
|
2201
|
+
braces.stringify = (input, options = {}) => {
|
|
2202
|
+
if (typeof input === "string") {
|
|
2203
|
+
return stringify(braces.parse(input, options), options);
|
|
2204
|
+
}
|
|
2205
|
+
return stringify(input, options);
|
|
2206
|
+
};
|
|
2207
|
+
braces.compile = (input, options = {}) => {
|
|
2208
|
+
if (typeof input === "string") {
|
|
2209
|
+
input = braces.parse(input, options);
|
|
2210
|
+
}
|
|
2211
|
+
return compile(input, options);
|
|
2212
|
+
};
|
|
2213
|
+
braces.expand = (input, options = {}) => {
|
|
2214
|
+
if (typeof input === "string") {
|
|
2215
|
+
input = braces.parse(input, options);
|
|
2216
|
+
}
|
|
2217
|
+
let result = expand(input, options);
|
|
2218
|
+
if (options.noempty === true) {
|
|
2219
|
+
result = result.filter(Boolean);
|
|
2220
|
+
}
|
|
2221
|
+
if (options.nodupes === true) {
|
|
2222
|
+
result = [...new Set(result)];
|
|
2223
|
+
}
|
|
2224
|
+
return result;
|
|
2225
|
+
};
|
|
2226
|
+
braces.create = (input, options = {}) => {
|
|
2227
|
+
if (input === "" || input.length < 3) {
|
|
2228
|
+
return [input];
|
|
2229
|
+
}
|
|
2230
|
+
return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
|
|
2231
|
+
};
|
|
2232
|
+
module.exports = braces;
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
|
|
2236
|
+
// ../../node_modules/micromatch/node_modules/picomatch/lib/constants.js
|
|
2237
|
+
var require_constants2 = __commonJS({
|
|
2238
|
+
"../../node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports, module) {
|
|
2239
|
+
"use strict";
|
|
2240
|
+
var path = __require("path");
|
|
2241
|
+
var WIN_SLASH = "\\\\/";
|
|
2242
|
+
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2243
|
+
var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
2244
|
+
var DOT_LITERAL = "\\.";
|
|
2245
|
+
var PLUS_LITERAL = "\\+";
|
|
2246
|
+
var QMARK_LITERAL = "\\?";
|
|
2247
|
+
var SLASH_LITERAL = "\\/";
|
|
2248
|
+
var ONE_CHAR = "(?=.)";
|
|
2249
|
+
var QMARK = "[^/]";
|
|
2250
|
+
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
2251
|
+
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
2252
|
+
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
2253
|
+
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
2254
|
+
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
2255
|
+
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
2256
|
+
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
2257
|
+
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
2258
|
+
var STAR = `${QMARK}*?`;
|
|
2259
|
+
var POSIX_CHARS = {
|
|
2260
|
+
DOT_LITERAL,
|
|
2261
|
+
PLUS_LITERAL,
|
|
2262
|
+
QMARK_LITERAL,
|
|
2263
|
+
SLASH_LITERAL,
|
|
2264
|
+
ONE_CHAR,
|
|
2265
|
+
QMARK,
|
|
2266
|
+
END_ANCHOR,
|
|
2267
|
+
DOTS_SLASH,
|
|
2268
|
+
NO_DOT,
|
|
2269
|
+
NO_DOTS,
|
|
2270
|
+
NO_DOT_SLASH,
|
|
2271
|
+
NO_DOTS_SLASH,
|
|
2272
|
+
QMARK_NO_DOT,
|
|
2273
|
+
STAR,
|
|
2274
|
+
START_ANCHOR
|
|
2275
|
+
};
|
|
2276
|
+
var WINDOWS_CHARS = {
|
|
2277
|
+
...POSIX_CHARS,
|
|
2278
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
2279
|
+
QMARK: WIN_NO_SLASH,
|
|
2280
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
2281
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
2282
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
2283
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2284
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
2285
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2286
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
2287
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
2288
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
2289
|
+
};
|
|
2290
|
+
var POSIX_REGEX_SOURCE = {
|
|
2291
|
+
__proto__: null,
|
|
2292
|
+
alnum: "a-zA-Z0-9",
|
|
2293
|
+
alpha: "a-zA-Z",
|
|
2294
|
+
ascii: "\\x00-\\x7F",
|
|
2295
|
+
blank: " \\t",
|
|
2296
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
2297
|
+
digit: "0-9",
|
|
2298
|
+
graph: "\\x21-\\x7E",
|
|
2299
|
+
lower: "a-z",
|
|
2300
|
+
print: "\\x20-\\x7E ",
|
|
2301
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
2302
|
+
space: " \\t\\r\\n\\v\\f",
|
|
2303
|
+
upper: "A-Z",
|
|
2304
|
+
word: "A-Za-z0-9_",
|
|
2305
|
+
xdigit: "A-Fa-f0-9"
|
|
2306
|
+
};
|
|
2307
|
+
module.exports = {
|
|
2308
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
2309
|
+
MAX_LENGTH: 1024 * 64,
|
|
2310
|
+
POSIX_REGEX_SOURCE,
|
|
2311
|
+
// regular expressions
|
|
2312
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
2313
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
2314
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
2315
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
2316
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
2317
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2318
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2319
|
+
REPLACEMENTS: {
|
|
2320
|
+
__proto__: null,
|
|
2321
|
+
"***": "*",
|
|
2322
|
+
"**/**": "**",
|
|
2323
|
+
"**/**/**": "**"
|
|
2324
|
+
},
|
|
2325
|
+
// Digits
|
|
2326
|
+
CHAR_0: 48,
|
|
2327
|
+
/* 0 */
|
|
2328
|
+
CHAR_9: 57,
|
|
2329
|
+
/* 9 */
|
|
2330
|
+
// Alphabet chars.
|
|
2331
|
+
CHAR_UPPERCASE_A: 65,
|
|
2332
|
+
/* A */
|
|
2333
|
+
CHAR_LOWERCASE_A: 97,
|
|
2334
|
+
/* a */
|
|
2335
|
+
CHAR_UPPERCASE_Z: 90,
|
|
2336
|
+
/* Z */
|
|
2337
|
+
CHAR_LOWERCASE_Z: 122,
|
|
2338
|
+
/* z */
|
|
2339
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
2340
|
+
/* ( */
|
|
2341
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
2342
|
+
/* ) */
|
|
2343
|
+
CHAR_ASTERISK: 42,
|
|
2344
|
+
/* * */
|
|
2345
|
+
// Non-alphabetic chars.
|
|
2346
|
+
CHAR_AMPERSAND: 38,
|
|
2347
|
+
/* & */
|
|
2348
|
+
CHAR_AT: 64,
|
|
2349
|
+
/* @ */
|
|
2350
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
2351
|
+
/* \ */
|
|
2352
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
2353
|
+
/* \r */
|
|
2354
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
2355
|
+
/* ^ */
|
|
2356
|
+
CHAR_COLON: 58,
|
|
2357
|
+
/* : */
|
|
2358
|
+
CHAR_COMMA: 44,
|
|
2359
|
+
/* , */
|
|
2360
|
+
CHAR_DOT: 46,
|
|
2361
|
+
/* . */
|
|
2362
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
2363
|
+
/* " */
|
|
2364
|
+
CHAR_EQUAL: 61,
|
|
2365
|
+
/* = */
|
|
2366
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
2367
|
+
/* ! */
|
|
2368
|
+
CHAR_FORM_FEED: 12,
|
|
2369
|
+
/* \f */
|
|
2370
|
+
CHAR_FORWARD_SLASH: 47,
|
|
2371
|
+
/* / */
|
|
2372
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
2373
|
+
/* ` */
|
|
2374
|
+
CHAR_HASH: 35,
|
|
2375
|
+
/* # */
|
|
2376
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
2377
|
+
/* - */
|
|
2378
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
2379
|
+
/* < */
|
|
2380
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
2381
|
+
/* { */
|
|
2382
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
2383
|
+
/* [ */
|
|
2384
|
+
CHAR_LINE_FEED: 10,
|
|
2385
|
+
/* \n */
|
|
2386
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
2387
|
+
/* \u00A0 */
|
|
2388
|
+
CHAR_PERCENT: 37,
|
|
2389
|
+
/* % */
|
|
2390
|
+
CHAR_PLUS: 43,
|
|
2391
|
+
/* + */
|
|
2392
|
+
CHAR_QUESTION_MARK: 63,
|
|
2393
|
+
/* ? */
|
|
2394
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
2395
|
+
/* > */
|
|
2396
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
2397
|
+
/* } */
|
|
2398
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
2399
|
+
/* ] */
|
|
2400
|
+
CHAR_SEMICOLON: 59,
|
|
2401
|
+
/* ; */
|
|
2402
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
2403
|
+
/* ' */
|
|
2404
|
+
CHAR_SPACE: 32,
|
|
2405
|
+
/* */
|
|
2406
|
+
CHAR_TAB: 9,
|
|
2407
|
+
/* \t */
|
|
2408
|
+
CHAR_UNDERSCORE: 95,
|
|
2409
|
+
/* _ */
|
|
2410
|
+
CHAR_VERTICAL_LINE: 124,
|
|
2411
|
+
/* | */
|
|
2412
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
2413
|
+
/* \uFEFF */
|
|
2414
|
+
SEP: path.sep,
|
|
2415
|
+
/**
|
|
2416
|
+
* Create EXTGLOB_CHARS
|
|
2417
|
+
*/
|
|
2418
|
+
extglobChars(chars) {
|
|
2419
|
+
return {
|
|
2420
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
2421
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
2422
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
2423
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
2424
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
2425
|
+
};
|
|
2426
|
+
},
|
|
2427
|
+
/**
|
|
2428
|
+
* Create GLOB_CHARS
|
|
2429
|
+
*/
|
|
2430
|
+
globChars(win32) {
|
|
2431
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
|
|
2437
|
+
// ../../node_modules/micromatch/node_modules/picomatch/lib/utils.js
|
|
2438
|
+
var require_utils2 = __commonJS({
|
|
2439
|
+
"../../node_modules/micromatch/node_modules/picomatch/lib/utils.js"(exports) {
|
|
2440
|
+
"use strict";
|
|
2441
|
+
var path = __require("path");
|
|
2442
|
+
var win32 = process.platform === "win32";
|
|
2443
|
+
var {
|
|
2444
|
+
REGEX_BACKSLASH,
|
|
2445
|
+
REGEX_REMOVE_BACKSLASH,
|
|
2446
|
+
REGEX_SPECIAL_CHARS,
|
|
2447
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
2448
|
+
} = require_constants2();
|
|
2449
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
2450
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
2451
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
2452
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
2453
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
2454
|
+
exports.removeBackslashes = (str) => {
|
|
2455
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
2456
|
+
return match === "\\" ? "" : match;
|
|
2457
|
+
});
|
|
2458
|
+
};
|
|
2459
|
+
exports.supportsLookbehinds = () => {
|
|
2460
|
+
const segs = process.version.slice(1).split(".").map(Number);
|
|
2461
|
+
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
|
2462
|
+
return true;
|
|
2463
|
+
}
|
|
2464
|
+
return false;
|
|
2465
|
+
};
|
|
2466
|
+
exports.isWindows = (options) => {
|
|
2467
|
+
if (options && typeof options.windows === "boolean") {
|
|
2468
|
+
return options.windows;
|
|
2469
|
+
}
|
|
2470
|
+
return win32 === true || path.sep === "\\";
|
|
2471
|
+
};
|
|
2472
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
2473
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
2474
|
+
if (idx === -1) return input;
|
|
2475
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
2476
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
2477
|
+
};
|
|
2478
|
+
exports.removePrefix = (input, state = {}) => {
|
|
2479
|
+
let output = input;
|
|
2480
|
+
if (output.startsWith("./")) {
|
|
2481
|
+
output = output.slice(2);
|
|
2482
|
+
state.prefix = "./";
|
|
2483
|
+
}
|
|
2484
|
+
return output;
|
|
2485
|
+
};
|
|
2486
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
2487
|
+
const prepend = options.contains ? "" : "^";
|
|
2488
|
+
const append = options.contains ? "" : "$";
|
|
2489
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
2490
|
+
if (state.negated === true) {
|
|
2491
|
+
output = `(?:^(?!${output}).*$)`;
|
|
2492
|
+
}
|
|
2493
|
+
return output;
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2497
|
+
|
|
2498
|
+
// ../../node_modules/micromatch/node_modules/picomatch/lib/scan.js
|
|
2499
|
+
var require_scan = __commonJS({
|
|
2500
|
+
"../../node_modules/micromatch/node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
2501
|
+
"use strict";
|
|
2502
|
+
var utils = require_utils2();
|
|
2503
|
+
var {
|
|
2504
|
+
CHAR_ASTERISK,
|
|
2505
|
+
/* * */
|
|
2506
|
+
CHAR_AT,
|
|
2507
|
+
/* @ */
|
|
2508
|
+
CHAR_BACKWARD_SLASH,
|
|
2509
|
+
/* \ */
|
|
2510
|
+
CHAR_COMMA,
|
|
2511
|
+
/* , */
|
|
2512
|
+
CHAR_DOT,
|
|
2513
|
+
/* . */
|
|
2514
|
+
CHAR_EXCLAMATION_MARK,
|
|
2515
|
+
/* ! */
|
|
2516
|
+
CHAR_FORWARD_SLASH,
|
|
2517
|
+
/* / */
|
|
2518
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
2519
|
+
/* { */
|
|
2520
|
+
CHAR_LEFT_PARENTHESES,
|
|
2521
|
+
/* ( */
|
|
2522
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
2523
|
+
/* [ */
|
|
2524
|
+
CHAR_PLUS,
|
|
2525
|
+
/* + */
|
|
2526
|
+
CHAR_QUESTION_MARK,
|
|
2527
|
+
/* ? */
|
|
2528
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
2529
|
+
/* } */
|
|
2530
|
+
CHAR_RIGHT_PARENTHESES,
|
|
2531
|
+
/* ) */
|
|
2532
|
+
CHAR_RIGHT_SQUARE_BRACKET
|
|
2533
|
+
/* ] */
|
|
2534
|
+
} = require_constants2();
|
|
2535
|
+
var isPathSeparator = (code) => {
|
|
2536
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
2537
|
+
};
|
|
2538
|
+
var depth = (token) => {
|
|
2539
|
+
if (token.isPrefix !== true) {
|
|
2540
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2543
|
+
var scan = (input, options) => {
|
|
2544
|
+
const opts = options || {};
|
|
2545
|
+
const length = input.length - 1;
|
|
2546
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
2547
|
+
const slashes = [];
|
|
2548
|
+
const tokens = [];
|
|
2549
|
+
const parts = [];
|
|
2550
|
+
let str = input;
|
|
2551
|
+
let index = -1;
|
|
2552
|
+
let start = 0;
|
|
2553
|
+
let lastIndex = 0;
|
|
2554
|
+
let isBrace = false;
|
|
2555
|
+
let isBracket = false;
|
|
2556
|
+
let isGlob = false;
|
|
2557
|
+
let isExtglob = false;
|
|
2558
|
+
let isGlobstar = false;
|
|
2559
|
+
let braceEscaped = false;
|
|
2560
|
+
let backslashes = false;
|
|
2561
|
+
let negated = false;
|
|
2562
|
+
let negatedExtglob = false;
|
|
2563
|
+
let finished = false;
|
|
2564
|
+
let braces = 0;
|
|
2565
|
+
let prev;
|
|
2566
|
+
let code;
|
|
2567
|
+
let token = { value: "", depth: 0, isGlob: false };
|
|
2568
|
+
const eos = () => index >= length;
|
|
2569
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
2570
|
+
const advance = () => {
|
|
2571
|
+
prev = code;
|
|
2572
|
+
return str.charCodeAt(++index);
|
|
2573
|
+
};
|
|
2574
|
+
while (index < length) {
|
|
2575
|
+
code = advance();
|
|
2576
|
+
let next;
|
|
2577
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
2578
|
+
backslashes = token.backslashes = true;
|
|
2579
|
+
code = advance();
|
|
2580
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
2581
|
+
braceEscaped = true;
|
|
2582
|
+
}
|
|
2583
|
+
continue;
|
|
2584
|
+
}
|
|
2585
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
2586
|
+
braces++;
|
|
2587
|
+
while (eos() !== true && (code = advance())) {
|
|
2588
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
2589
|
+
backslashes = token.backslashes = true;
|
|
2590
|
+
advance();
|
|
2591
|
+
continue;
|
|
2592
|
+
}
|
|
2593
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
2594
|
+
braces++;
|
|
2595
|
+
continue;
|
|
2596
|
+
}
|
|
2597
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
2598
|
+
isBrace = token.isBrace = true;
|
|
2599
|
+
isGlob = token.isGlob = true;
|
|
2600
|
+
finished = true;
|
|
2601
|
+
if (scanToEnd === true) {
|
|
2602
|
+
continue;
|
|
2603
|
+
}
|
|
2604
|
+
break;
|
|
2605
|
+
}
|
|
2606
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
2607
|
+
isBrace = token.isBrace = true;
|
|
2608
|
+
isGlob = token.isGlob = true;
|
|
2609
|
+
finished = true;
|
|
2610
|
+
if (scanToEnd === true) {
|
|
2611
|
+
continue;
|
|
2612
|
+
}
|
|
2613
|
+
break;
|
|
2614
|
+
}
|
|
2615
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
2616
|
+
braces--;
|
|
2617
|
+
if (braces === 0) {
|
|
2618
|
+
braceEscaped = false;
|
|
2619
|
+
isBrace = token.isBrace = true;
|
|
2620
|
+
finished = true;
|
|
2621
|
+
break;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
if (scanToEnd === true) {
|
|
2626
|
+
continue;
|
|
2627
|
+
}
|
|
2628
|
+
break;
|
|
2629
|
+
}
|
|
2630
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
2631
|
+
slashes.push(index);
|
|
2632
|
+
tokens.push(token);
|
|
2633
|
+
token = { value: "", depth: 0, isGlob: false };
|
|
2634
|
+
if (finished === true) continue;
|
|
2635
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
2636
|
+
start += 2;
|
|
2637
|
+
continue;
|
|
2638
|
+
}
|
|
2639
|
+
lastIndex = index + 1;
|
|
2640
|
+
continue;
|
|
2641
|
+
}
|
|
2642
|
+
if (opts.noext !== true) {
|
|
2643
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
2644
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
2645
|
+
isGlob = token.isGlob = true;
|
|
2646
|
+
isExtglob = token.isExtglob = true;
|
|
2647
|
+
finished = true;
|
|
2648
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
2649
|
+
negatedExtglob = true;
|
|
2650
|
+
}
|
|
2651
|
+
if (scanToEnd === true) {
|
|
2652
|
+
while (eos() !== true && (code = advance())) {
|
|
2653
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
2654
|
+
backslashes = token.backslashes = true;
|
|
2655
|
+
code = advance();
|
|
2656
|
+
continue;
|
|
2657
|
+
}
|
|
2658
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
2659
|
+
isGlob = token.isGlob = true;
|
|
2660
|
+
finished = true;
|
|
2661
|
+
break;
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
continue;
|
|
2665
|
+
}
|
|
2666
|
+
break;
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
if (code === CHAR_ASTERISK) {
|
|
2670
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
2671
|
+
isGlob = token.isGlob = true;
|
|
2672
|
+
finished = true;
|
|
2673
|
+
if (scanToEnd === true) {
|
|
2674
|
+
continue;
|
|
2675
|
+
}
|
|
2676
|
+
break;
|
|
2677
|
+
}
|
|
2678
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
2679
|
+
isGlob = token.isGlob = true;
|
|
2680
|
+
finished = true;
|
|
2681
|
+
if (scanToEnd === true) {
|
|
2682
|
+
continue;
|
|
2683
|
+
}
|
|
2684
|
+
break;
|
|
2685
|
+
}
|
|
2686
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
2687
|
+
while (eos() !== true && (next = advance())) {
|
|
2688
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
2689
|
+
backslashes = token.backslashes = true;
|
|
2690
|
+
advance();
|
|
2691
|
+
continue;
|
|
2692
|
+
}
|
|
2693
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
2694
|
+
isBracket = token.isBracket = true;
|
|
2695
|
+
isGlob = token.isGlob = true;
|
|
2696
|
+
finished = true;
|
|
2697
|
+
break;
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
if (scanToEnd === true) {
|
|
2701
|
+
continue;
|
|
2702
|
+
}
|
|
2703
|
+
break;
|
|
2704
|
+
}
|
|
2705
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
2706
|
+
negated = token.negated = true;
|
|
2707
|
+
start++;
|
|
2708
|
+
continue;
|
|
2709
|
+
}
|
|
2710
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
2711
|
+
isGlob = token.isGlob = true;
|
|
2712
|
+
if (scanToEnd === true) {
|
|
2713
|
+
while (eos() !== true && (code = advance())) {
|
|
2714
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
2715
|
+
backslashes = token.backslashes = true;
|
|
2716
|
+
code = advance();
|
|
2717
|
+
continue;
|
|
2718
|
+
}
|
|
2719
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
2720
|
+
finished = true;
|
|
2721
|
+
break;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
continue;
|
|
2725
|
+
}
|
|
2726
|
+
break;
|
|
2727
|
+
}
|
|
2728
|
+
if (isGlob === true) {
|
|
2729
|
+
finished = true;
|
|
2730
|
+
if (scanToEnd === true) {
|
|
2731
|
+
continue;
|
|
2732
|
+
}
|
|
2733
|
+
break;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
if (opts.noext === true) {
|
|
2737
|
+
isExtglob = false;
|
|
2738
|
+
isGlob = false;
|
|
2739
|
+
}
|
|
2740
|
+
let base = str;
|
|
2741
|
+
let prefix = "";
|
|
2742
|
+
let glob = "";
|
|
2743
|
+
if (start > 0) {
|
|
2744
|
+
prefix = str.slice(0, start);
|
|
2745
|
+
str = str.slice(start);
|
|
2746
|
+
lastIndex -= start;
|
|
2747
|
+
}
|
|
2748
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
2749
|
+
base = str.slice(0, lastIndex);
|
|
2750
|
+
glob = str.slice(lastIndex);
|
|
2751
|
+
} else if (isGlob === true) {
|
|
2752
|
+
base = "";
|
|
2753
|
+
glob = str;
|
|
2754
|
+
} else {
|
|
2755
|
+
base = str;
|
|
2756
|
+
}
|
|
2757
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
2758
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
2759
|
+
base = base.slice(0, -1);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
if (opts.unescape === true) {
|
|
2763
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
2764
|
+
if (base && backslashes === true) {
|
|
2765
|
+
base = utils.removeBackslashes(base);
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
const state = {
|
|
2769
|
+
prefix,
|
|
2770
|
+
input,
|
|
2771
|
+
start,
|
|
2772
|
+
base,
|
|
2773
|
+
glob,
|
|
2774
|
+
isBrace,
|
|
2775
|
+
isBracket,
|
|
2776
|
+
isGlob,
|
|
2777
|
+
isExtglob,
|
|
2778
|
+
isGlobstar,
|
|
2779
|
+
negated,
|
|
2780
|
+
negatedExtglob
|
|
2781
|
+
};
|
|
2782
|
+
if (opts.tokens === true) {
|
|
2783
|
+
state.maxDepth = 0;
|
|
2784
|
+
if (!isPathSeparator(code)) {
|
|
2785
|
+
tokens.push(token);
|
|
2786
|
+
}
|
|
2787
|
+
state.tokens = tokens;
|
|
2788
|
+
}
|
|
2789
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
2790
|
+
let prevIndex;
|
|
2791
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
2792
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
2793
|
+
const i = slashes[idx];
|
|
2794
|
+
const value = input.slice(n, i);
|
|
2795
|
+
if (opts.tokens) {
|
|
2796
|
+
if (idx === 0 && start !== 0) {
|
|
2797
|
+
tokens[idx].isPrefix = true;
|
|
2798
|
+
tokens[idx].value = prefix;
|
|
2799
|
+
} else {
|
|
2800
|
+
tokens[idx].value = value;
|
|
2801
|
+
}
|
|
2802
|
+
depth(tokens[idx]);
|
|
2803
|
+
state.maxDepth += tokens[idx].depth;
|
|
2804
|
+
}
|
|
2805
|
+
if (idx !== 0 || value !== "") {
|
|
2806
|
+
parts.push(value);
|
|
2807
|
+
}
|
|
2808
|
+
prevIndex = i;
|
|
2809
|
+
}
|
|
2810
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
2811
|
+
const value = input.slice(prevIndex + 1);
|
|
2812
|
+
parts.push(value);
|
|
2813
|
+
if (opts.tokens) {
|
|
2814
|
+
tokens[tokens.length - 1].value = value;
|
|
2815
|
+
depth(tokens[tokens.length - 1]);
|
|
2816
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
state.slashes = slashes;
|
|
2820
|
+
state.parts = parts;
|
|
2821
|
+
}
|
|
2822
|
+
return state;
|
|
2823
|
+
};
|
|
2824
|
+
module.exports = scan;
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
|
|
2828
|
+
// ../../node_modules/micromatch/node_modules/picomatch/lib/parse.js
|
|
2829
|
+
var require_parse2 = __commonJS({
|
|
2830
|
+
"../../node_modules/micromatch/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
2831
|
+
"use strict";
|
|
2832
|
+
var constants2 = require_constants2();
|
|
2833
|
+
var utils = require_utils2();
|
|
2834
|
+
var {
|
|
2835
|
+
MAX_LENGTH,
|
|
2836
|
+
POSIX_REGEX_SOURCE,
|
|
2837
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
2838
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
2839
|
+
REPLACEMENTS
|
|
2840
|
+
} = constants2;
|
|
2841
|
+
var expandRange = (args, options) => {
|
|
2842
|
+
if (typeof options.expandRange === "function") {
|
|
2843
|
+
return options.expandRange(...args, options);
|
|
2844
|
+
}
|
|
2845
|
+
args.sort();
|
|
2846
|
+
const value = `[${args.join("-")}]`;
|
|
2847
|
+
try {
|
|
2848
|
+
new RegExp(value);
|
|
2849
|
+
} catch (ex) {
|
|
2850
|
+
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
2851
|
+
}
|
|
2852
|
+
return value;
|
|
2853
|
+
};
|
|
2854
|
+
var syntaxError = (type, char) => {
|
|
2855
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
2856
|
+
};
|
|
2857
|
+
var splitTopLevel = (input) => {
|
|
2858
|
+
const parts = [];
|
|
2859
|
+
let bracket = 0;
|
|
2860
|
+
let paren = 0;
|
|
2861
|
+
let quote = 0;
|
|
2862
|
+
let value = "";
|
|
2863
|
+
let escaped = false;
|
|
2864
|
+
for (const ch of input) {
|
|
2865
|
+
if (escaped === true) {
|
|
2866
|
+
value += ch;
|
|
2867
|
+
escaped = false;
|
|
2868
|
+
continue;
|
|
2869
|
+
}
|
|
2870
|
+
if (ch === "\\") {
|
|
2871
|
+
value += ch;
|
|
2872
|
+
escaped = true;
|
|
2873
|
+
continue;
|
|
2874
|
+
}
|
|
2875
|
+
if (ch === '"') {
|
|
2876
|
+
quote = quote === 1 ? 0 : 1;
|
|
2877
|
+
value += ch;
|
|
2878
|
+
continue;
|
|
2879
|
+
}
|
|
2880
|
+
if (quote === 0) {
|
|
2881
|
+
if (ch === "[") {
|
|
2882
|
+
bracket++;
|
|
2883
|
+
} else if (ch === "]" && bracket > 0) {
|
|
2884
|
+
bracket--;
|
|
2885
|
+
} else if (bracket === 0) {
|
|
2886
|
+
if (ch === "(") {
|
|
2887
|
+
paren++;
|
|
2888
|
+
} else if (ch === ")" && paren > 0) {
|
|
2889
|
+
paren--;
|
|
2890
|
+
} else if (ch === "|" && paren === 0) {
|
|
2891
|
+
parts.push(value);
|
|
2892
|
+
value = "";
|
|
2893
|
+
continue;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
value += ch;
|
|
2898
|
+
}
|
|
2899
|
+
parts.push(value);
|
|
2900
|
+
return parts;
|
|
2901
|
+
};
|
|
2902
|
+
var isPlainBranch = (branch) => {
|
|
2903
|
+
let escaped = false;
|
|
2904
|
+
for (const ch of branch) {
|
|
2905
|
+
if (escaped === true) {
|
|
2906
|
+
escaped = false;
|
|
2907
|
+
continue;
|
|
2908
|
+
}
|
|
2909
|
+
if (ch === "\\") {
|
|
2910
|
+
escaped = true;
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
2914
|
+
return false;
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
return true;
|
|
2918
|
+
};
|
|
2919
|
+
var normalizeSimpleBranch = (branch) => {
|
|
2920
|
+
let value = branch.trim();
|
|
2921
|
+
let changed = true;
|
|
2922
|
+
while (changed === true) {
|
|
2923
|
+
changed = false;
|
|
2924
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
2925
|
+
value = value.slice(2, -1);
|
|
2926
|
+
changed = true;
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
if (!isPlainBranch(value)) {
|
|
2930
|
+
return;
|
|
2931
|
+
}
|
|
2932
|
+
return value.replace(/\\(.)/g, "$1");
|
|
2933
|
+
};
|
|
2934
|
+
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
2935
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
2936
|
+
for (let i = 0; i < values.length; i++) {
|
|
2937
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
2938
|
+
const a = values[i];
|
|
2939
|
+
const b = values[j];
|
|
2940
|
+
const char = a[0];
|
|
2941
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
2942
|
+
continue;
|
|
2943
|
+
}
|
|
2944
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
2945
|
+
return true;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
return false;
|
|
2950
|
+
};
|
|
2951
|
+
var parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
2952
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
|
|
2953
|
+
return;
|
|
2954
|
+
}
|
|
2955
|
+
let bracket = 0;
|
|
2956
|
+
let paren = 0;
|
|
2957
|
+
let quote = 0;
|
|
2958
|
+
let escaped = false;
|
|
2959
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
2960
|
+
const ch = pattern[i];
|
|
2961
|
+
if (escaped === true) {
|
|
2962
|
+
escaped = false;
|
|
2963
|
+
continue;
|
|
2964
|
+
}
|
|
2965
|
+
if (ch === "\\") {
|
|
2966
|
+
escaped = true;
|
|
2967
|
+
continue;
|
|
2968
|
+
}
|
|
2969
|
+
if (ch === '"') {
|
|
2970
|
+
quote = quote === 1 ? 0 : 1;
|
|
2971
|
+
continue;
|
|
2972
|
+
}
|
|
2973
|
+
if (quote === 1) {
|
|
2974
|
+
continue;
|
|
2975
|
+
}
|
|
2976
|
+
if (ch === "[") {
|
|
2977
|
+
bracket++;
|
|
2978
|
+
continue;
|
|
2979
|
+
}
|
|
2980
|
+
if (ch === "]" && bracket > 0) {
|
|
2981
|
+
bracket--;
|
|
2982
|
+
continue;
|
|
2983
|
+
}
|
|
2984
|
+
if (bracket > 0) {
|
|
2985
|
+
continue;
|
|
2986
|
+
}
|
|
2987
|
+
if (ch === "(") {
|
|
2988
|
+
paren++;
|
|
2989
|
+
continue;
|
|
2990
|
+
}
|
|
2991
|
+
if (ch === ")") {
|
|
2992
|
+
paren--;
|
|
2993
|
+
if (paren === 0) {
|
|
2994
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
2997
|
+
return {
|
|
2998
|
+
type: pattern[0],
|
|
2999
|
+
body: pattern.slice(2, i),
|
|
3000
|
+
end: i
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
var getStarExtglobSequenceOutput = (pattern) => {
|
|
3007
|
+
let index = 0;
|
|
3008
|
+
const chars = [];
|
|
3009
|
+
while (index < pattern.length) {
|
|
3010
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
3011
|
+
if (!match || match.type !== "*") {
|
|
3012
|
+
return;
|
|
3013
|
+
}
|
|
3014
|
+
const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
|
|
3015
|
+
if (branches.length !== 1) {
|
|
3016
|
+
return;
|
|
3017
|
+
}
|
|
3018
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
3019
|
+
if (!branch || branch.length !== 1) {
|
|
3020
|
+
return;
|
|
3021
|
+
}
|
|
3022
|
+
chars.push(branch);
|
|
3023
|
+
index += match.end + 1;
|
|
3024
|
+
}
|
|
3025
|
+
if (chars.length < 1) {
|
|
3026
|
+
return;
|
|
3027
|
+
}
|
|
3028
|
+
const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
|
|
3029
|
+
return `${source}*`;
|
|
3030
|
+
};
|
|
3031
|
+
var repeatedExtglobRecursion = (pattern) => {
|
|
3032
|
+
let depth = 0;
|
|
3033
|
+
let value = pattern.trim();
|
|
3034
|
+
let match = parseRepeatedExtglob(value);
|
|
3035
|
+
while (match) {
|
|
3036
|
+
depth++;
|
|
3037
|
+
value = match.body.trim();
|
|
3038
|
+
match = parseRepeatedExtglob(value);
|
|
3039
|
+
}
|
|
3040
|
+
return depth;
|
|
3041
|
+
};
|
|
3042
|
+
var analyzeRepeatedExtglob = (body, options) => {
|
|
3043
|
+
if (options.maxExtglobRecursion === false) {
|
|
3044
|
+
return { risky: false };
|
|
3045
|
+
}
|
|
3046
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
3047
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
3048
|
+
if (branches.length > 1) {
|
|
3049
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
3050
|
+
return { risky: true };
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
for (const branch of branches) {
|
|
3054
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
3055
|
+
if (safeOutput) {
|
|
3056
|
+
return { risky: true, safeOutput };
|
|
3057
|
+
}
|
|
3058
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
3059
|
+
return { risky: true };
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
return { risky: false };
|
|
3063
|
+
};
|
|
3064
|
+
var parse = (input, options) => {
|
|
3065
|
+
if (typeof input !== "string") {
|
|
3066
|
+
throw new TypeError("Expected a string");
|
|
3067
|
+
}
|
|
3068
|
+
input = REPLACEMENTS[input] || input;
|
|
3069
|
+
const opts = { ...options };
|
|
3070
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3071
|
+
let len = input.length;
|
|
3072
|
+
if (len > max) {
|
|
3073
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
3074
|
+
}
|
|
3075
|
+
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
3076
|
+
const tokens = [bos];
|
|
3077
|
+
const capture = opts.capture ? "" : "?:";
|
|
3078
|
+
const win32 = utils.isWindows(options);
|
|
3079
|
+
const PLATFORM_CHARS = constants2.globChars(win32);
|
|
3080
|
+
const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
|
|
3081
|
+
const {
|
|
3082
|
+
DOT_LITERAL,
|
|
3083
|
+
PLUS_LITERAL,
|
|
3084
|
+
SLASH_LITERAL,
|
|
3085
|
+
ONE_CHAR,
|
|
3086
|
+
DOTS_SLASH,
|
|
3087
|
+
NO_DOT,
|
|
3088
|
+
NO_DOT_SLASH,
|
|
3089
|
+
NO_DOTS_SLASH,
|
|
3090
|
+
QMARK,
|
|
3091
|
+
QMARK_NO_DOT,
|
|
3092
|
+
STAR,
|
|
3093
|
+
START_ANCHOR
|
|
3094
|
+
} = PLATFORM_CHARS;
|
|
3095
|
+
const globstar = (opts2) => {
|
|
3096
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
3097
|
+
};
|
|
3098
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
3099
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
3100
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
3101
|
+
if (opts.capture) {
|
|
3102
|
+
star = `(${star})`;
|
|
3103
|
+
}
|
|
3104
|
+
if (typeof opts.noext === "boolean") {
|
|
3105
|
+
opts.noextglob = opts.noext;
|
|
3106
|
+
}
|
|
3107
|
+
const state = {
|
|
3108
|
+
input,
|
|
3109
|
+
index: -1,
|
|
3110
|
+
start: 0,
|
|
3111
|
+
dot: opts.dot === true,
|
|
3112
|
+
consumed: "",
|
|
3113
|
+
output: "",
|
|
3114
|
+
prefix: "",
|
|
3115
|
+
backtrack: false,
|
|
3116
|
+
negated: false,
|
|
3117
|
+
brackets: 0,
|
|
3118
|
+
braces: 0,
|
|
3119
|
+
parens: 0,
|
|
3120
|
+
quotes: 0,
|
|
3121
|
+
globstar: false,
|
|
3122
|
+
tokens
|
|
3123
|
+
};
|
|
3124
|
+
input = utils.removePrefix(input, state);
|
|
3125
|
+
len = input.length;
|
|
3126
|
+
const extglobs = [];
|
|
3127
|
+
const braces = [];
|
|
3128
|
+
const stack = [];
|
|
3129
|
+
let prev = bos;
|
|
3130
|
+
let value;
|
|
3131
|
+
const eos = () => state.index === len - 1;
|
|
3132
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
3133
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
3134
|
+
const remaining = () => input.slice(state.index + 1);
|
|
3135
|
+
const consume = (value2 = "", num = 0) => {
|
|
3136
|
+
state.consumed += value2;
|
|
3137
|
+
state.index += num;
|
|
3138
|
+
};
|
|
3139
|
+
const append = (token) => {
|
|
3140
|
+
state.output += token.output != null ? token.output : token.value;
|
|
3141
|
+
consume(token.value);
|
|
3142
|
+
};
|
|
3143
|
+
const negate = () => {
|
|
3144
|
+
let count = 1;
|
|
3145
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
3146
|
+
advance();
|
|
3147
|
+
state.start++;
|
|
3148
|
+
count++;
|
|
3149
|
+
}
|
|
3150
|
+
if (count % 2 === 0) {
|
|
3151
|
+
return false;
|
|
3152
|
+
}
|
|
3153
|
+
state.negated = true;
|
|
3154
|
+
state.start++;
|
|
3155
|
+
return true;
|
|
3156
|
+
};
|
|
3157
|
+
const increment = (type) => {
|
|
3158
|
+
state[type]++;
|
|
3159
|
+
stack.push(type);
|
|
3160
|
+
};
|
|
3161
|
+
const decrement = (type) => {
|
|
3162
|
+
state[type]--;
|
|
3163
|
+
stack.pop();
|
|
3164
|
+
};
|
|
3165
|
+
const push = (tok) => {
|
|
3166
|
+
if (prev.type === "globstar") {
|
|
3167
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
3168
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
3169
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
3170
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
3171
|
+
prev.type = "star";
|
|
3172
|
+
prev.value = "*";
|
|
3173
|
+
prev.output = star;
|
|
3174
|
+
state.output += prev.output;
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
3178
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
3179
|
+
}
|
|
3180
|
+
if (tok.value || tok.output) append(tok);
|
|
3181
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
3182
|
+
prev.value += tok.value;
|
|
3183
|
+
prev.output = (prev.output || "") + tok.value;
|
|
3184
|
+
return;
|
|
3185
|
+
}
|
|
3186
|
+
tok.prev = prev;
|
|
3187
|
+
tokens.push(tok);
|
|
3188
|
+
prev = tok;
|
|
3189
|
+
};
|
|
3190
|
+
const extglobOpen = (type, value2) => {
|
|
3191
|
+
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
3192
|
+
token.prev = prev;
|
|
3193
|
+
token.parens = state.parens;
|
|
3194
|
+
token.output = state.output;
|
|
3195
|
+
token.startIndex = state.index;
|
|
3196
|
+
token.tokensIndex = tokens.length;
|
|
3197
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
3198
|
+
increment("parens");
|
|
3199
|
+
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
3200
|
+
push({ type: "paren", extglob: true, value: advance(), output });
|
|
3201
|
+
extglobs.push(token);
|
|
3202
|
+
};
|
|
3203
|
+
const extglobClose = (token) => {
|
|
3204
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
3205
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
3206
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
3207
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
3208
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
3209
|
+
const open = tokens[token.tokensIndex];
|
|
3210
|
+
open.type = "text";
|
|
3211
|
+
open.value = literal;
|
|
3212
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
3213
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
3214
|
+
tokens[i].value = "";
|
|
3215
|
+
tokens[i].output = "";
|
|
3216
|
+
delete tokens[i].suffix;
|
|
3217
|
+
}
|
|
3218
|
+
state.output = token.output + open.output;
|
|
3219
|
+
state.backtrack = true;
|
|
3220
|
+
push({ type: "paren", extglob: true, value, output: "" });
|
|
3221
|
+
decrement("parens");
|
|
3222
|
+
return;
|
|
3223
|
+
}
|
|
3224
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
3225
|
+
let rest;
|
|
3226
|
+
if (token.type === "negate") {
|
|
3227
|
+
let extglobStar = star;
|
|
3228
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
3229
|
+
extglobStar = globstar(opts);
|
|
3230
|
+
}
|
|
3231
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
3232
|
+
output = token.close = `)$))${extglobStar}`;
|
|
3233
|
+
}
|
|
3234
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
3235
|
+
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
3236
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
3237
|
+
}
|
|
3238
|
+
if (token.prev.type === "bos") {
|
|
3239
|
+
state.negatedExtglob = true;
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
push({ type: "paren", extglob: true, value, output });
|
|
3243
|
+
decrement("parens");
|
|
3244
|
+
};
|
|
3245
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
3246
|
+
let backslashes = false;
|
|
3247
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
3248
|
+
if (first === "\\") {
|
|
3249
|
+
backslashes = true;
|
|
3250
|
+
return m;
|
|
3251
|
+
}
|
|
3252
|
+
if (first === "?") {
|
|
3253
|
+
if (esc) {
|
|
3254
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
3255
|
+
}
|
|
3256
|
+
if (index === 0) {
|
|
3257
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
3258
|
+
}
|
|
3259
|
+
return QMARK.repeat(chars.length);
|
|
3260
|
+
}
|
|
3261
|
+
if (first === ".") {
|
|
3262
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
3263
|
+
}
|
|
3264
|
+
if (first === "*") {
|
|
3265
|
+
if (esc) {
|
|
3266
|
+
return esc + first + (rest ? star : "");
|
|
3267
|
+
}
|
|
3268
|
+
return star;
|
|
3269
|
+
}
|
|
3270
|
+
return esc ? m : `\\${m}`;
|
|
3271
|
+
});
|
|
3272
|
+
if (backslashes === true) {
|
|
3273
|
+
if (opts.unescape === true) {
|
|
3274
|
+
output = output.replace(/\\/g, "");
|
|
3275
|
+
} else {
|
|
3276
|
+
output = output.replace(/\\+/g, (m) => {
|
|
3277
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
3278
|
+
});
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
if (output === input && opts.contains === true) {
|
|
3282
|
+
state.output = input;
|
|
3283
|
+
return state;
|
|
3284
|
+
}
|
|
3285
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
3286
|
+
return state;
|
|
3287
|
+
}
|
|
3288
|
+
while (!eos()) {
|
|
3289
|
+
value = advance();
|
|
3290
|
+
if (value === "\0") {
|
|
3291
|
+
continue;
|
|
3292
|
+
}
|
|
3293
|
+
if (value === "\\") {
|
|
3294
|
+
const next = peek();
|
|
3295
|
+
if (next === "/" && opts.bash !== true) {
|
|
3296
|
+
continue;
|
|
3297
|
+
}
|
|
3298
|
+
if (next === "." || next === ";") {
|
|
3299
|
+
continue;
|
|
3300
|
+
}
|
|
3301
|
+
if (!next) {
|
|
3302
|
+
value += "\\";
|
|
3303
|
+
push({ type: "text", value });
|
|
3304
|
+
continue;
|
|
3305
|
+
}
|
|
3306
|
+
const match = /^\\+/.exec(remaining());
|
|
3307
|
+
let slashes = 0;
|
|
3308
|
+
if (match && match[0].length > 2) {
|
|
3309
|
+
slashes = match[0].length;
|
|
3310
|
+
state.index += slashes;
|
|
3311
|
+
if (slashes % 2 !== 0) {
|
|
3312
|
+
value += "\\";
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
if (opts.unescape === true) {
|
|
3316
|
+
value = advance();
|
|
3317
|
+
} else {
|
|
3318
|
+
value += advance();
|
|
3319
|
+
}
|
|
3320
|
+
if (state.brackets === 0) {
|
|
3321
|
+
push({ type: "text", value });
|
|
3322
|
+
continue;
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
3326
|
+
if (opts.posix !== false && value === ":") {
|
|
3327
|
+
const inner = prev.value.slice(1);
|
|
3328
|
+
if (inner.includes("[")) {
|
|
3329
|
+
prev.posix = true;
|
|
3330
|
+
if (inner.includes(":")) {
|
|
3331
|
+
const idx = prev.value.lastIndexOf("[");
|
|
3332
|
+
const pre = prev.value.slice(0, idx);
|
|
3333
|
+
const rest2 = prev.value.slice(idx + 2);
|
|
3334
|
+
const posix = POSIX_REGEX_SOURCE[rest2];
|
|
3335
|
+
if (posix) {
|
|
3336
|
+
prev.value = pre + posix;
|
|
3337
|
+
state.backtrack = true;
|
|
3338
|
+
advance();
|
|
3339
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
3340
|
+
bos.output = ONE_CHAR;
|
|
3341
|
+
}
|
|
3342
|
+
continue;
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
3348
|
+
value = `\\${value}`;
|
|
3349
|
+
}
|
|
3350
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
3351
|
+
value = `\\${value}`;
|
|
3352
|
+
}
|
|
3353
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
3354
|
+
value = "^";
|
|
3355
|
+
}
|
|
3356
|
+
prev.value += value;
|
|
3357
|
+
append({ value });
|
|
3358
|
+
continue;
|
|
3359
|
+
}
|
|
3360
|
+
if (state.quotes === 1 && value !== '"') {
|
|
3361
|
+
value = utils.escapeRegex(value);
|
|
3362
|
+
prev.value += value;
|
|
3363
|
+
append({ value });
|
|
3364
|
+
continue;
|
|
3365
|
+
}
|
|
3366
|
+
if (value === '"') {
|
|
3367
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
3368
|
+
if (opts.keepQuotes === true) {
|
|
3369
|
+
push({ type: "text", value });
|
|
3370
|
+
}
|
|
3371
|
+
continue;
|
|
3372
|
+
}
|
|
3373
|
+
if (value === "(") {
|
|
3374
|
+
increment("parens");
|
|
3375
|
+
push({ type: "paren", value });
|
|
3376
|
+
continue;
|
|
3377
|
+
}
|
|
3378
|
+
if (value === ")") {
|
|
3379
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
3380
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
3381
|
+
}
|
|
3382
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
3383
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
3384
|
+
extglobClose(extglobs.pop());
|
|
3385
|
+
continue;
|
|
3386
|
+
}
|
|
3387
|
+
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
3388
|
+
decrement("parens");
|
|
3389
|
+
continue;
|
|
3390
|
+
}
|
|
3391
|
+
if (value === "[") {
|
|
3392
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
3393
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
3394
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
3395
|
+
}
|
|
3396
|
+
value = `\\${value}`;
|
|
3397
|
+
} else {
|
|
3398
|
+
increment("brackets");
|
|
3399
|
+
}
|
|
3400
|
+
push({ type: "bracket", value });
|
|
3401
|
+
continue;
|
|
3402
|
+
}
|
|
3403
|
+
if (value === "]") {
|
|
3404
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
3405
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
3406
|
+
continue;
|
|
3407
|
+
}
|
|
3408
|
+
if (state.brackets === 0) {
|
|
3409
|
+
if (opts.strictBrackets === true) {
|
|
3410
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
3411
|
+
}
|
|
3412
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
3413
|
+
continue;
|
|
3414
|
+
}
|
|
3415
|
+
decrement("brackets");
|
|
3416
|
+
const prevValue = prev.value.slice(1);
|
|
3417
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
3418
|
+
value = `/${value}`;
|
|
3419
|
+
}
|
|
3420
|
+
prev.value += value;
|
|
3421
|
+
append({ value });
|
|
3422
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
3423
|
+
continue;
|
|
3424
|
+
}
|
|
3425
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
3426
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
3427
|
+
if (opts.literalBrackets === true) {
|
|
3428
|
+
state.output += escaped;
|
|
3429
|
+
prev.value = escaped;
|
|
3430
|
+
continue;
|
|
3431
|
+
}
|
|
3432
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
3433
|
+
state.output += prev.value;
|
|
3434
|
+
continue;
|
|
3435
|
+
}
|
|
3436
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
3437
|
+
increment("braces");
|
|
3438
|
+
const open = {
|
|
3439
|
+
type: "brace",
|
|
3440
|
+
value,
|
|
3441
|
+
output: "(",
|
|
3442
|
+
outputIndex: state.output.length,
|
|
3443
|
+
tokensIndex: state.tokens.length
|
|
3444
|
+
};
|
|
3445
|
+
braces.push(open);
|
|
3446
|
+
push(open);
|
|
3447
|
+
continue;
|
|
3448
|
+
}
|
|
3449
|
+
if (value === "}") {
|
|
3450
|
+
const brace = braces[braces.length - 1];
|
|
3451
|
+
if (opts.nobrace === true || !brace) {
|
|
3452
|
+
push({ type: "text", value, output: value });
|
|
3453
|
+
continue;
|
|
3454
|
+
}
|
|
3455
|
+
let output = ")";
|
|
3456
|
+
if (brace.dots === true) {
|
|
3457
|
+
const arr = tokens.slice();
|
|
3458
|
+
const range = [];
|
|
3459
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
3460
|
+
tokens.pop();
|
|
3461
|
+
if (arr[i].type === "brace") {
|
|
3462
|
+
break;
|
|
3463
|
+
}
|
|
3464
|
+
if (arr[i].type !== "dots") {
|
|
3465
|
+
range.unshift(arr[i].value);
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
output = expandRange(range, opts);
|
|
3469
|
+
state.backtrack = true;
|
|
3470
|
+
}
|
|
3471
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
3472
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
3473
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
3474
|
+
brace.value = brace.output = "\\{";
|
|
3475
|
+
value = output = "\\}";
|
|
3476
|
+
state.output = out;
|
|
3477
|
+
for (const t of toks) {
|
|
3478
|
+
state.output += t.output || t.value;
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
push({ type: "brace", value, output });
|
|
3482
|
+
decrement("braces");
|
|
3483
|
+
braces.pop();
|
|
3484
|
+
continue;
|
|
3485
|
+
}
|
|
3486
|
+
if (value === "|") {
|
|
3487
|
+
if (extglobs.length > 0) {
|
|
3488
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
3489
|
+
}
|
|
3490
|
+
push({ type: "text", value });
|
|
3491
|
+
continue;
|
|
3492
|
+
}
|
|
3493
|
+
if (value === ",") {
|
|
3494
|
+
let output = value;
|
|
3495
|
+
const brace = braces[braces.length - 1];
|
|
3496
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
3497
|
+
brace.comma = true;
|
|
3498
|
+
output = "|";
|
|
3499
|
+
}
|
|
3500
|
+
push({ type: "comma", value, output });
|
|
3501
|
+
continue;
|
|
3502
|
+
}
|
|
3503
|
+
if (value === "/") {
|
|
3504
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
3505
|
+
state.start = state.index + 1;
|
|
3506
|
+
state.consumed = "";
|
|
3507
|
+
state.output = "";
|
|
3508
|
+
tokens.pop();
|
|
3509
|
+
prev = bos;
|
|
3510
|
+
continue;
|
|
3511
|
+
}
|
|
3512
|
+
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
3513
|
+
continue;
|
|
3514
|
+
}
|
|
3515
|
+
if (value === ".") {
|
|
3516
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
3517
|
+
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
3518
|
+
const brace = braces[braces.length - 1];
|
|
3519
|
+
prev.type = "dots";
|
|
3520
|
+
prev.output += value;
|
|
3521
|
+
prev.value += value;
|
|
3522
|
+
brace.dots = true;
|
|
3523
|
+
continue;
|
|
3524
|
+
}
|
|
3525
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
3526
|
+
push({ type: "text", value, output: DOT_LITERAL });
|
|
3527
|
+
continue;
|
|
3528
|
+
}
|
|
3529
|
+
push({ type: "dot", value, output: DOT_LITERAL });
|
|
3530
|
+
continue;
|
|
3531
|
+
}
|
|
3532
|
+
if (value === "?") {
|
|
3533
|
+
const isGroup = prev && prev.value === "(";
|
|
3534
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
3535
|
+
extglobOpen("qmark", value);
|
|
3536
|
+
continue;
|
|
3537
|
+
}
|
|
3538
|
+
if (prev && prev.type === "paren") {
|
|
3539
|
+
const next = peek();
|
|
3540
|
+
let output = value;
|
|
3541
|
+
if (next === "<" && !utils.supportsLookbehinds()) {
|
|
3542
|
+
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
3543
|
+
}
|
|
3544
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
3545
|
+
output = `\\${value}`;
|
|
3546
|
+
}
|
|
3547
|
+
push({ type: "text", value, output });
|
|
3548
|
+
continue;
|
|
3549
|
+
}
|
|
3550
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
3551
|
+
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
3552
|
+
continue;
|
|
3553
|
+
}
|
|
3554
|
+
push({ type: "qmark", value, output: QMARK });
|
|
3555
|
+
continue;
|
|
3556
|
+
}
|
|
3557
|
+
if (value === "!") {
|
|
3558
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
3559
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
3560
|
+
extglobOpen("negate", value);
|
|
3561
|
+
continue;
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
3565
|
+
negate();
|
|
3566
|
+
continue;
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
if (value === "+") {
|
|
3570
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
3571
|
+
extglobOpen("plus", value);
|
|
3572
|
+
continue;
|
|
3573
|
+
}
|
|
3574
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
3575
|
+
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
3576
|
+
continue;
|
|
3577
|
+
}
|
|
3578
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
3579
|
+
push({ type: "plus", value });
|
|
3580
|
+
continue;
|
|
3581
|
+
}
|
|
3582
|
+
push({ type: "plus", value: PLUS_LITERAL });
|
|
3583
|
+
continue;
|
|
3584
|
+
}
|
|
3585
|
+
if (value === "@") {
|
|
3586
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
3587
|
+
push({ type: "at", extglob: true, value, output: "" });
|
|
3588
|
+
continue;
|
|
3589
|
+
}
|
|
3590
|
+
push({ type: "text", value });
|
|
3591
|
+
continue;
|
|
3592
|
+
}
|
|
3593
|
+
if (value !== "*") {
|
|
3594
|
+
if (value === "$" || value === "^") {
|
|
3595
|
+
value = `\\${value}`;
|
|
3596
|
+
}
|
|
3597
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
3598
|
+
if (match) {
|
|
3599
|
+
value += match[0];
|
|
3600
|
+
state.index += match[0].length;
|
|
3601
|
+
}
|
|
3602
|
+
push({ type: "text", value });
|
|
3603
|
+
continue;
|
|
3604
|
+
}
|
|
3605
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
3606
|
+
prev.type = "star";
|
|
3607
|
+
prev.star = true;
|
|
3608
|
+
prev.value += value;
|
|
3609
|
+
prev.output = star;
|
|
3610
|
+
state.backtrack = true;
|
|
3611
|
+
state.globstar = true;
|
|
3612
|
+
consume(value);
|
|
3613
|
+
continue;
|
|
3614
|
+
}
|
|
3615
|
+
let rest = remaining();
|
|
3616
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
3617
|
+
extglobOpen("star", value);
|
|
3618
|
+
continue;
|
|
3619
|
+
}
|
|
3620
|
+
if (prev.type === "star") {
|
|
3621
|
+
if (opts.noglobstar === true) {
|
|
3622
|
+
consume(value);
|
|
3623
|
+
continue;
|
|
3624
|
+
}
|
|
3625
|
+
const prior = prev.prev;
|
|
3626
|
+
const before = prior.prev;
|
|
3627
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
3628
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
3629
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
3630
|
+
push({ type: "star", value, output: "" });
|
|
3631
|
+
continue;
|
|
3632
|
+
}
|
|
3633
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
3634
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
3635
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
3636
|
+
push({ type: "star", value, output: "" });
|
|
3637
|
+
continue;
|
|
3638
|
+
}
|
|
3639
|
+
while (rest.slice(0, 3) === "/**") {
|
|
3640
|
+
const after = input[state.index + 4];
|
|
3641
|
+
if (after && after !== "/") {
|
|
3642
|
+
break;
|
|
3643
|
+
}
|
|
3644
|
+
rest = rest.slice(3);
|
|
3645
|
+
consume("/**", 3);
|
|
3646
|
+
}
|
|
3647
|
+
if (prior.type === "bos" && eos()) {
|
|
3648
|
+
prev.type = "globstar";
|
|
3649
|
+
prev.value += value;
|
|
3650
|
+
prev.output = globstar(opts);
|
|
3651
|
+
state.output = prev.output;
|
|
3652
|
+
state.globstar = true;
|
|
3653
|
+
consume(value);
|
|
3654
|
+
continue;
|
|
3655
|
+
}
|
|
3656
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
3657
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
3658
|
+
prior.output = `(?:${prior.output}`;
|
|
3659
|
+
prev.type = "globstar";
|
|
3660
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
3661
|
+
prev.value += value;
|
|
3662
|
+
state.globstar = true;
|
|
3663
|
+
state.output += prior.output + prev.output;
|
|
3664
|
+
consume(value);
|
|
3665
|
+
continue;
|
|
3666
|
+
}
|
|
3667
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
3668
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
3669
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
3670
|
+
prior.output = `(?:${prior.output}`;
|
|
3671
|
+
prev.type = "globstar";
|
|
3672
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
3673
|
+
prev.value += value;
|
|
3674
|
+
state.output += prior.output + prev.output;
|
|
3675
|
+
state.globstar = true;
|
|
3676
|
+
consume(value + advance());
|
|
3677
|
+
push({ type: "slash", value: "/", output: "" });
|
|
3678
|
+
continue;
|
|
3679
|
+
}
|
|
3680
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
3681
|
+
prev.type = "globstar";
|
|
3682
|
+
prev.value += value;
|
|
3683
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
3684
|
+
state.output = prev.output;
|
|
3685
|
+
state.globstar = true;
|
|
3686
|
+
consume(value + advance());
|
|
3687
|
+
push({ type: "slash", value: "/", output: "" });
|
|
3688
|
+
continue;
|
|
3689
|
+
}
|
|
3690
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
3691
|
+
prev.type = "globstar";
|
|
3692
|
+
prev.output = globstar(opts);
|
|
3693
|
+
prev.value += value;
|
|
3694
|
+
state.output += prev.output;
|
|
3695
|
+
state.globstar = true;
|
|
3696
|
+
consume(value);
|
|
3697
|
+
continue;
|
|
3698
|
+
}
|
|
3699
|
+
const token = { type: "star", value, output: star };
|
|
3700
|
+
if (opts.bash === true) {
|
|
3701
|
+
token.output = ".*?";
|
|
3702
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
3703
|
+
token.output = nodot + token.output;
|
|
3704
|
+
}
|
|
3705
|
+
push(token);
|
|
3706
|
+
continue;
|
|
3707
|
+
}
|
|
3708
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
3709
|
+
token.output = value;
|
|
3710
|
+
push(token);
|
|
3711
|
+
continue;
|
|
3712
|
+
}
|
|
3713
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
3714
|
+
if (prev.type === "dot") {
|
|
3715
|
+
state.output += NO_DOT_SLASH;
|
|
3716
|
+
prev.output += NO_DOT_SLASH;
|
|
3717
|
+
} else if (opts.dot === true) {
|
|
3718
|
+
state.output += NO_DOTS_SLASH;
|
|
3719
|
+
prev.output += NO_DOTS_SLASH;
|
|
3720
|
+
} else {
|
|
3721
|
+
state.output += nodot;
|
|
3722
|
+
prev.output += nodot;
|
|
3723
|
+
}
|
|
3724
|
+
if (peek() !== "*") {
|
|
3725
|
+
state.output += ONE_CHAR;
|
|
3726
|
+
prev.output += ONE_CHAR;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
push(token);
|
|
3730
|
+
}
|
|
3731
|
+
while (state.brackets > 0) {
|
|
3732
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
3733
|
+
state.output = utils.escapeLast(state.output, "[");
|
|
3734
|
+
decrement("brackets");
|
|
3735
|
+
}
|
|
3736
|
+
while (state.parens > 0) {
|
|
3737
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
3738
|
+
state.output = utils.escapeLast(state.output, "(");
|
|
3739
|
+
decrement("parens");
|
|
3740
|
+
}
|
|
3741
|
+
while (state.braces > 0) {
|
|
3742
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
3743
|
+
state.output = utils.escapeLast(state.output, "{");
|
|
3744
|
+
decrement("braces");
|
|
3745
|
+
}
|
|
3746
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
3747
|
+
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
3748
|
+
}
|
|
3749
|
+
if (state.backtrack === true) {
|
|
3750
|
+
state.output = "";
|
|
3751
|
+
for (const token of state.tokens) {
|
|
3752
|
+
state.output += token.output != null ? token.output : token.value;
|
|
3753
|
+
if (token.suffix) {
|
|
3754
|
+
state.output += token.suffix;
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
return state;
|
|
3759
|
+
};
|
|
3760
|
+
parse.fastpaths = (input, options) => {
|
|
3761
|
+
const opts = { ...options };
|
|
3762
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3763
|
+
const len = input.length;
|
|
3764
|
+
if (len > max) {
|
|
3765
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
3766
|
+
}
|
|
3767
|
+
input = REPLACEMENTS[input] || input;
|
|
3768
|
+
const win32 = utils.isWindows(options);
|
|
3769
|
+
const {
|
|
3770
|
+
DOT_LITERAL,
|
|
3771
|
+
SLASH_LITERAL,
|
|
3772
|
+
ONE_CHAR,
|
|
3773
|
+
DOTS_SLASH,
|
|
3774
|
+
NO_DOT,
|
|
3775
|
+
NO_DOTS,
|
|
3776
|
+
NO_DOTS_SLASH,
|
|
3777
|
+
STAR,
|
|
3778
|
+
START_ANCHOR
|
|
3779
|
+
} = constants2.globChars(win32);
|
|
3780
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
3781
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
3782
|
+
const capture = opts.capture ? "" : "?:";
|
|
3783
|
+
const state = { negated: false, prefix: "" };
|
|
3784
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
3785
|
+
if (opts.capture) {
|
|
3786
|
+
star = `(${star})`;
|
|
3787
|
+
}
|
|
3788
|
+
const globstar = (opts2) => {
|
|
3789
|
+
if (opts2.noglobstar === true) return star;
|
|
3790
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
3791
|
+
};
|
|
3792
|
+
const create = (str) => {
|
|
3793
|
+
switch (str) {
|
|
3794
|
+
case "*":
|
|
3795
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
3796
|
+
case ".*":
|
|
3797
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3798
|
+
case "*.*":
|
|
3799
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3800
|
+
case "*/*":
|
|
3801
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
3802
|
+
case "**":
|
|
3803
|
+
return nodot + globstar(opts);
|
|
3804
|
+
case "**/*":
|
|
3805
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
3806
|
+
case "**/*.*":
|
|
3807
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3808
|
+
case "**/.*":
|
|
3809
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3810
|
+
default: {
|
|
3811
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
3812
|
+
if (!match) return;
|
|
3813
|
+
const source2 = create(match[1]);
|
|
3814
|
+
if (!source2) return;
|
|
3815
|
+
return source2 + DOT_LITERAL + match[2];
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
};
|
|
3819
|
+
const output = utils.removePrefix(input, state);
|
|
3820
|
+
let source = create(output);
|
|
3821
|
+
if (source && opts.strictSlashes !== true) {
|
|
3822
|
+
source += `${SLASH_LITERAL}?`;
|
|
3823
|
+
}
|
|
3824
|
+
return source;
|
|
3825
|
+
};
|
|
3826
|
+
module.exports = parse;
|
|
3827
|
+
}
|
|
3828
|
+
});
|
|
3829
|
+
|
|
3830
|
+
// ../../node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
|
|
3831
|
+
var require_picomatch = __commonJS({
|
|
3832
|
+
"../../node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
3833
|
+
"use strict";
|
|
3834
|
+
var path = __require("path");
|
|
3835
|
+
var scan = require_scan();
|
|
3836
|
+
var parse = require_parse2();
|
|
3837
|
+
var utils = require_utils2();
|
|
3838
|
+
var constants2 = require_constants2();
|
|
3839
|
+
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
3840
|
+
var picomatch = (glob, options, returnState = false) => {
|
|
3841
|
+
if (Array.isArray(glob)) {
|
|
3842
|
+
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
3843
|
+
const arrayMatcher = (str) => {
|
|
3844
|
+
for (const isMatch of fns) {
|
|
3845
|
+
const state2 = isMatch(str);
|
|
3846
|
+
if (state2) return state2;
|
|
3847
|
+
}
|
|
3848
|
+
return false;
|
|
3849
|
+
};
|
|
3850
|
+
return arrayMatcher;
|
|
3851
|
+
}
|
|
3852
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
3853
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
3854
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
3855
|
+
}
|
|
3856
|
+
const opts = options || {};
|
|
3857
|
+
const posix = utils.isWindows(options);
|
|
3858
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
3859
|
+
const state = regex.state;
|
|
3860
|
+
delete regex.state;
|
|
3861
|
+
let isIgnored = () => false;
|
|
3862
|
+
if (opts.ignore) {
|
|
3863
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
3864
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
3865
|
+
}
|
|
3866
|
+
const matcher = (input, returnObject = false) => {
|
|
3867
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
3868
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
3869
|
+
if (typeof opts.onResult === "function") {
|
|
3870
|
+
opts.onResult(result);
|
|
3871
|
+
}
|
|
3872
|
+
if (isMatch === false) {
|
|
3873
|
+
result.isMatch = false;
|
|
3874
|
+
return returnObject ? result : false;
|
|
3875
|
+
}
|
|
3876
|
+
if (isIgnored(input)) {
|
|
3877
|
+
if (typeof opts.onIgnore === "function") {
|
|
3878
|
+
opts.onIgnore(result);
|
|
3879
|
+
}
|
|
3880
|
+
result.isMatch = false;
|
|
3881
|
+
return returnObject ? result : false;
|
|
3882
|
+
}
|
|
3883
|
+
if (typeof opts.onMatch === "function") {
|
|
3884
|
+
opts.onMatch(result);
|
|
3885
|
+
}
|
|
3886
|
+
return returnObject ? result : true;
|
|
3887
|
+
};
|
|
3888
|
+
if (returnState) {
|
|
3889
|
+
matcher.state = state;
|
|
3890
|
+
}
|
|
3891
|
+
return matcher;
|
|
3892
|
+
};
|
|
3893
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
3894
|
+
if (typeof input !== "string") {
|
|
3895
|
+
throw new TypeError("Expected input to be a string");
|
|
3896
|
+
}
|
|
3897
|
+
if (input === "") {
|
|
3898
|
+
return { isMatch: false, output: "" };
|
|
3899
|
+
}
|
|
3900
|
+
const opts = options || {};
|
|
3901
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
3902
|
+
let match = input === glob;
|
|
3903
|
+
let output = match && format ? format(input) : input;
|
|
3904
|
+
if (match === false) {
|
|
3905
|
+
output = format ? format(input) : input;
|
|
3906
|
+
match = output === glob;
|
|
3907
|
+
}
|
|
3908
|
+
if (match === false || opts.capture === true) {
|
|
3909
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
3910
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
3911
|
+
} else {
|
|
3912
|
+
match = regex.exec(output);
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
return { isMatch: Boolean(match), match, output };
|
|
3916
|
+
};
|
|
3917
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
3918
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
3919
|
+
return regex.test(path.basename(input));
|
|
3920
|
+
};
|
|
3921
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
3922
|
+
picomatch.parse = (pattern, options) => {
|
|
3923
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
3924
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
3925
|
+
};
|
|
3926
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
3927
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
3928
|
+
if (returnOutput === true) {
|
|
3929
|
+
return state.output;
|
|
3930
|
+
}
|
|
3931
|
+
const opts = options || {};
|
|
3932
|
+
const prepend = opts.contains ? "" : "^";
|
|
3933
|
+
const append = opts.contains ? "" : "$";
|
|
3934
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
3935
|
+
if (state && state.negated === true) {
|
|
3936
|
+
source = `^(?!${source}).*$`;
|
|
3937
|
+
}
|
|
3938
|
+
const regex = picomatch.toRegex(source, options);
|
|
3939
|
+
if (returnState === true) {
|
|
3940
|
+
regex.state = state;
|
|
3941
|
+
}
|
|
3942
|
+
return regex;
|
|
3943
|
+
};
|
|
3944
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
3945
|
+
if (!input || typeof input !== "string") {
|
|
3946
|
+
throw new TypeError("Expected a non-empty string");
|
|
3947
|
+
}
|
|
3948
|
+
let parsed = { negated: false, fastpaths: true };
|
|
3949
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
3950
|
+
parsed.output = parse.fastpaths(input, options);
|
|
3951
|
+
}
|
|
3952
|
+
if (!parsed.output) {
|
|
3953
|
+
parsed = parse(input, options);
|
|
3954
|
+
}
|
|
3955
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
3956
|
+
};
|
|
3957
|
+
picomatch.toRegex = (source, options) => {
|
|
3958
|
+
try {
|
|
3959
|
+
const opts = options || {};
|
|
3960
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
3961
|
+
} catch (err) {
|
|
3962
|
+
if (options && options.debug === true) throw err;
|
|
3963
|
+
return /$^/;
|
|
3964
|
+
}
|
|
3965
|
+
};
|
|
3966
|
+
picomatch.constants = constants2;
|
|
3967
|
+
module.exports = picomatch;
|
|
3968
|
+
}
|
|
3969
|
+
});
|
|
3970
|
+
|
|
3971
|
+
// ../../node_modules/micromatch/node_modules/picomatch/index.js
|
|
3972
|
+
var require_picomatch2 = __commonJS({
|
|
3973
|
+
"../../node_modules/micromatch/node_modules/picomatch/index.js"(exports, module) {
|
|
3974
|
+
"use strict";
|
|
3975
|
+
module.exports = require_picomatch();
|
|
3976
|
+
}
|
|
3977
|
+
});
|
|
3978
|
+
|
|
3979
|
+
// ../../node_modules/micromatch/index.js
|
|
3980
|
+
var require_micromatch = __commonJS({
|
|
3981
|
+
"../../node_modules/micromatch/index.js"(exports, module) {
|
|
3982
|
+
"use strict";
|
|
3983
|
+
var util = __require("util");
|
|
3984
|
+
var braces = require_braces();
|
|
3985
|
+
var picomatch = require_picomatch2();
|
|
3986
|
+
var utils = require_utils2();
|
|
3987
|
+
var isEmptyString = (v) => v === "" || v === "./";
|
|
3988
|
+
var hasBraces = (v) => {
|
|
3989
|
+
const index = v.indexOf("{");
|
|
3990
|
+
return index > -1 && v.indexOf("}", index) > -1;
|
|
3991
|
+
};
|
|
3992
|
+
var micromatch2 = (list, patterns, options) => {
|
|
3993
|
+
patterns = [].concat(patterns);
|
|
3994
|
+
list = [].concat(list);
|
|
3995
|
+
let omit = /* @__PURE__ */ new Set();
|
|
3996
|
+
let keep = /* @__PURE__ */ new Set();
|
|
3997
|
+
let items = /* @__PURE__ */ new Set();
|
|
3998
|
+
let negatives = 0;
|
|
3999
|
+
let onResult = (state) => {
|
|
4000
|
+
items.add(state.output);
|
|
4001
|
+
if (options && options.onResult) {
|
|
4002
|
+
options.onResult(state);
|
|
4003
|
+
}
|
|
4004
|
+
};
|
|
4005
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
4006
|
+
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
|
|
4007
|
+
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
4008
|
+
if (negated) negatives++;
|
|
4009
|
+
for (let item of list) {
|
|
4010
|
+
let matched = isMatch(item, true);
|
|
4011
|
+
let match = negated ? !matched.isMatch : matched.isMatch;
|
|
4012
|
+
if (!match) continue;
|
|
4013
|
+
if (negated) {
|
|
4014
|
+
omit.add(matched.output);
|
|
4015
|
+
} else {
|
|
4016
|
+
omit.delete(matched.output);
|
|
4017
|
+
keep.add(matched.output);
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
let result = negatives === patterns.length ? [...items] : [...keep];
|
|
4022
|
+
let matches = result.filter((item) => !omit.has(item));
|
|
4023
|
+
if (options && matches.length === 0) {
|
|
4024
|
+
if (options.failglob === true) {
|
|
4025
|
+
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4026
|
+
}
|
|
4027
|
+
if (options.nonull === true || options.nullglob === true) {
|
|
4028
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
return matches;
|
|
4032
|
+
};
|
|
4033
|
+
micromatch2.match = micromatch2;
|
|
4034
|
+
micromatch2.matcher = (pattern, options) => picomatch(pattern, options);
|
|
4035
|
+
micromatch2.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4036
|
+
micromatch2.any = micromatch2.isMatch;
|
|
4037
|
+
micromatch2.not = (list, patterns, options = {}) => {
|
|
4038
|
+
patterns = [].concat(patterns).map(String);
|
|
4039
|
+
let result = /* @__PURE__ */ new Set();
|
|
4040
|
+
let items = [];
|
|
4041
|
+
let onResult = (state) => {
|
|
4042
|
+
if (options.onResult) options.onResult(state);
|
|
4043
|
+
items.push(state.output);
|
|
4044
|
+
};
|
|
4045
|
+
let matches = new Set(micromatch2(list, patterns, { ...options, onResult }));
|
|
4046
|
+
for (let item of items) {
|
|
4047
|
+
if (!matches.has(item)) {
|
|
4048
|
+
result.add(item);
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
return [...result];
|
|
4052
|
+
};
|
|
4053
|
+
micromatch2.contains = (str, pattern, options) => {
|
|
4054
|
+
if (typeof str !== "string") {
|
|
4055
|
+
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4056
|
+
}
|
|
4057
|
+
if (Array.isArray(pattern)) {
|
|
4058
|
+
return pattern.some((p) => micromatch2.contains(str, p, options));
|
|
4059
|
+
}
|
|
4060
|
+
if (typeof pattern === "string") {
|
|
4061
|
+
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
4062
|
+
return false;
|
|
4063
|
+
}
|
|
4064
|
+
if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
|
|
4065
|
+
return true;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
return micromatch2.isMatch(str, pattern, { ...options, contains: true });
|
|
4069
|
+
};
|
|
4070
|
+
micromatch2.matchKeys = (obj, patterns, options) => {
|
|
4071
|
+
if (!utils.isObject(obj)) {
|
|
4072
|
+
throw new TypeError("Expected the first argument to be an object");
|
|
4073
|
+
}
|
|
4074
|
+
let keys = micromatch2(Object.keys(obj), patterns, options);
|
|
4075
|
+
let res = {};
|
|
4076
|
+
for (let key of keys) res[key] = obj[key];
|
|
4077
|
+
return res;
|
|
4078
|
+
};
|
|
4079
|
+
micromatch2.some = (list, patterns, options) => {
|
|
4080
|
+
let items = [].concat(list);
|
|
4081
|
+
for (let pattern of [].concat(patterns)) {
|
|
4082
|
+
let isMatch = picomatch(String(pattern), options);
|
|
4083
|
+
if (items.some((item) => isMatch(item))) {
|
|
4084
|
+
return true;
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
return false;
|
|
4088
|
+
};
|
|
4089
|
+
micromatch2.every = (list, patterns, options) => {
|
|
4090
|
+
let items = [].concat(list);
|
|
4091
|
+
for (let pattern of [].concat(patterns)) {
|
|
4092
|
+
let isMatch = picomatch(String(pattern), options);
|
|
4093
|
+
if (!items.every((item) => isMatch(item))) {
|
|
4094
|
+
return false;
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
return true;
|
|
4098
|
+
};
|
|
4099
|
+
micromatch2.all = (str, patterns, options) => {
|
|
4100
|
+
if (typeof str !== "string") {
|
|
4101
|
+
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4102
|
+
}
|
|
4103
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
4104
|
+
};
|
|
4105
|
+
micromatch2.capture = (glob, input, options) => {
|
|
4106
|
+
let posix = utils.isWindows(options);
|
|
4107
|
+
let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
|
|
4108
|
+
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
4109
|
+
if (match) {
|
|
4110
|
+
return match.slice(1).map((v) => v === void 0 ? "" : v);
|
|
4111
|
+
}
|
|
4112
|
+
};
|
|
4113
|
+
micromatch2.makeRe = (...args) => picomatch.makeRe(...args);
|
|
4114
|
+
micromatch2.scan = (...args) => picomatch.scan(...args);
|
|
4115
|
+
micromatch2.parse = (patterns, options) => {
|
|
4116
|
+
let res = [];
|
|
4117
|
+
for (let pattern of [].concat(patterns || [])) {
|
|
4118
|
+
for (let str of braces(String(pattern), options)) {
|
|
4119
|
+
res.push(picomatch.parse(str, options));
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
return res;
|
|
4123
|
+
};
|
|
4124
|
+
micromatch2.braces = (pattern, options) => {
|
|
4125
|
+
if (typeof pattern !== "string") throw new TypeError("Expected a string");
|
|
4126
|
+
if (options && options.nobrace === true || !hasBraces(pattern)) {
|
|
4127
|
+
return [pattern];
|
|
4128
|
+
}
|
|
4129
|
+
return braces(pattern, options);
|
|
4130
|
+
};
|
|
4131
|
+
micromatch2.braceExpand = (pattern, options) => {
|
|
4132
|
+
if (typeof pattern !== "string") throw new TypeError("Expected a string");
|
|
4133
|
+
return micromatch2.braces(pattern, { ...options, expand: true });
|
|
4134
|
+
};
|
|
4135
|
+
micromatch2.hasBraces = hasBraces;
|
|
4136
|
+
module.exports = micromatch2;
|
|
4137
|
+
}
|
|
4138
|
+
});
|
|
4139
|
+
|
|
4140
|
+
// src/launcher/constants.ts
|
|
4141
|
+
var READY_BYTE = Buffer.from([1]);
|
|
4142
|
+
var STDIN_BACKLOG_MAX = 1024 * 1024;
|
|
4143
|
+
var STDIN_REPLAY_MAX = 4 * 1024 * 1024;
|
|
4144
|
+
var STDOUT_CAP = 64 * 1024;
|
|
4145
|
+
var STDERR_CAP = 64 * 1024;
|
|
4146
|
+
var CLASSIFY_MAX = 64 * 1024;
|
|
4147
|
+
var HOOK_MJS_MAX = 4 * 1024 * 1024;
|
|
4148
|
+
|
|
4149
|
+
// src/config/collector-url-resolve.ts
|
|
4150
|
+
var DEFAULT_COLLECTOR_BASE_URL = "https://hooks.ev-ai.ai";
|
|
4151
|
+
var MAX_JSON_FILE_BYTES = 1024 * 1024;
|
|
4152
|
+
function buildCollectorUrl(orgToken, baseUrl = DEFAULT_COLLECTOR_BASE_URL) {
|
|
4153
|
+
const normalizedBase = baseUrl.replace(/\/+$/, "");
|
|
4154
|
+
const token = orgToken.trim();
|
|
4155
|
+
return `${normalizedBase}/${token}/hook`;
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
// src/collectors/userSpec/layout.ts
|
|
4159
|
+
var RUNNER_LAYOUT = {
|
|
4160
|
+
claude: {
|
|
4161
|
+
shared: {
|
|
4162
|
+
skillRoots: [".claude/skills"],
|
|
4163
|
+
dirs: [
|
|
4164
|
+
{ dir: ".claude/agents", kind: "SUBAGENT", extensions: [".md"] },
|
|
4165
|
+
{ dir: ".claude/commands", kind: "COMMAND", extensions: [".md"] },
|
|
4166
|
+
{ dir: ".claude/rules", kind: "RULE", extensions: [".mdc", ".md"] }
|
|
4167
|
+
],
|
|
4168
|
+
// Claude's memory walk runs to the filesystem root, so a `~/CLAUDE.md`
|
|
4169
|
+
// covering every tree under home is in context and no project anchor
|
|
4170
|
+
// collects it (the parent walk stops before home).
|
|
4171
|
+
memory: [["CLAUDE.md"], ["CLAUDE.local.md"], [".claude/CLAUDE.md"]],
|
|
4172
|
+
// `remote-settings.json` is deliberately absent: it is the cached
|
|
4173
|
+
// server-managed payload, so it belongs to `managed` (which probes and
|
|
4174
|
+
// parses it) rather than to the operator's own settings.
|
|
4175
|
+
settings: [".claude/settings.json", ".claude/settings.local.json", ".claude/hooks.json"]
|
|
4176
|
+
},
|
|
4177
|
+
// The only field where the two scopes name different files rather than one
|
|
4178
|
+
// scope adding to the other: user MCP servers live in `~/.claude.json`,
|
|
4179
|
+
// project ones in a checked-in `.mcp.json` at the tree root.
|
|
4180
|
+
homeOnly: { mcpJson: [".claude.json"], plugins: "claude", managed: "claude" },
|
|
4181
|
+
projectOnly: { mcpJson: [".mcp.json", "mcp.json"] }
|
|
4182
|
+
},
|
|
4183
|
+
cursor: {
|
|
4184
|
+
shared: {
|
|
4185
|
+
skillRoots: [".cursor/skills"],
|
|
4186
|
+
dirs: [
|
|
4187
|
+
{ dir: ".cursor/agents", kind: "SUBAGENT", extensions: [".md"] },
|
|
4188
|
+
{ dir: ".cursor/commands", kind: "COMMAND", extensions: [".md"] },
|
|
4189
|
+
{ dir: ".cursor/rules", kind: "RULE", extensions: [".mdc", ".md"] }
|
|
4190
|
+
],
|
|
4191
|
+
memory: [["AGENTS.md"]],
|
|
4192
|
+
// Dedicated hooks file plus sandbox / permissions posture. CLI permissions
|
|
4193
|
+
// live in `cli-config.json` at home and `cli.json` at a project anchor —
|
|
4194
|
+
// see the scope deltas; Cursor never reads `cli-config.json` at project
|
|
4195
|
+
// scope.
|
|
4196
|
+
settings: [".cursor/hooks.json", ".cursor/sandbox.json", ".cursor/permissions.json"],
|
|
4197
|
+
mcpJson: [".cursor/mcp.json"]
|
|
4198
|
+
},
|
|
4199
|
+
// `skills-cursor` is the IDE-managed product-internal skills dir and never
|
|
4200
|
+
// appears in a repo; `.cursor/AGENTS.md` is a home-only memory location.
|
|
4201
|
+
homeOnly: {
|
|
4202
|
+
skillRoots: [".cursor/skills-cursor"],
|
|
4203
|
+
memory: [[".cursor/AGENTS.md"]],
|
|
4204
|
+
settings: [".cursor/cli-config.json"],
|
|
4205
|
+
plugins: "cursor",
|
|
4206
|
+
managed: "cursor"
|
|
4207
|
+
},
|
|
4208
|
+
projectOnly: { skillRoots: [".agents/skills"], settings: [".cursor/cli.json"] }
|
|
4209
|
+
},
|
|
4210
|
+
codex: {
|
|
4211
|
+
shared: {
|
|
4212
|
+
skillRoots: [".agents/skills", ".codex/skills"],
|
|
4213
|
+
dirs: [
|
|
4214
|
+
{ dir: ".codex/agents", kind: "SUBAGENT", extensions: [".toml", ".md"] },
|
|
4215
|
+
{ dir: ".codex/prompts", kind: "COMMAND", extensions: [".md"] },
|
|
4216
|
+
{ dir: ".codex/rules", kind: "RULE", extensions: [".md", ".rules"] }
|
|
4217
|
+
],
|
|
4218
|
+
memory: [["AGENTS.override.md", "AGENTS.md"]],
|
|
4219
|
+
// `managed_config.toml` is deliberately absent: it carries org defaults,
|
|
4220
|
+
// so it is probed by `managed` rather than counted as user settings.
|
|
4221
|
+
settings: [".codex/hooks.json", ".codex/config.toml"],
|
|
4222
|
+
mcpToml: [".codex/config.toml"]
|
|
4223
|
+
},
|
|
4224
|
+
homeOnly: { memory: [[".codex/AGENTS.override.md", ".codex/AGENTS.md"]], managed: "codex" }
|
|
4225
|
+
},
|
|
4226
|
+
// GitHub Copilot (CLI + VS Code). Mirrors REPO_GITHUB_COPILOT in
|
|
4227
|
+
// common/platform-component-ownership: project surfaces under `.github/`,
|
|
4228
|
+
// user ones under `~/.copilot/`. `dirs` cannot differ by scope, so both trees
|
|
4229
|
+
// are listed; the one that does not apply at a scope simply never exists.
|
|
4230
|
+
// `.github/hooks/*.json` is a directory of hook files, which `settings` (a
|
|
4231
|
+
// file list) cannot express — left for a later pass, like `plugins` / `managed`.
|
|
4232
|
+
//
|
|
4233
|
+
// Copilot also reads other runners' files: `.claude/skills` and
|
|
4234
|
+
// `.agents/skills` (Copilot CLI, and VS Code local sessions, which also read
|
|
4235
|
+
// `~/.claude/skills`), plus `AGENTS.md`, `CLAUDE.md` and `.claude/CLAUDE.md`
|
|
4236
|
+
// in the repo. Listing them here is what lets a Copilot-only machine report
|
|
4237
|
+
// them; `local-spec-owner.ts` attributes them to Copilot as well.
|
|
4238
|
+
// Sources: GitHub "Creating agent skills" and "Adding custom instructions"
|
|
4239
|
+
// for Copilot CLI, and VS Code "Agent skills" and "MCP servers".
|
|
4240
|
+
copilot: {
|
|
4241
|
+
shared: {
|
|
4242
|
+
skillRoots: [".claude/skills", ".agents/skills"],
|
|
4243
|
+
dirs: [
|
|
4244
|
+
{ dir: ".github/agents", kind: "SUBAGENT", extensions: [".md"] },
|
|
4245
|
+
// Copilot prompt files are `<name>.prompt.md`, run as `/<name>`.
|
|
4246
|
+
{ dir: ".github/prompts", kind: "COMMAND", extensions: [".prompt.md"] },
|
|
4247
|
+
// Copilot only loads `<name>.instructions.md` here; repo-syncer names the rule `<name>`.
|
|
4248
|
+
{ dir: ".github/instructions", kind: "RULE", extensions: [".instructions.md"] },
|
|
4249
|
+
{ dir: ".copilot/agents", kind: "SUBAGENT", extensions: [".md"] },
|
|
4250
|
+
// User-level instruction files (`~/.copilot/instructions/**`).
|
|
4251
|
+
{ dir: ".copilot/instructions", kind: "RULE", extensions: [".instructions.md"] }
|
|
4252
|
+
],
|
|
4253
|
+
memory: [],
|
|
4254
|
+
settings: []
|
|
4255
|
+
},
|
|
4256
|
+
homeOnly: {
|
|
4257
|
+
skillRoots: [".copilot/skills"],
|
|
4258
|
+
memory: [[".copilot/copilot-instructions.md"]],
|
|
4259
|
+
settings: [".copilot/config.json"],
|
|
4260
|
+
mcpJson: [".copilot/mcp-config.json"]
|
|
4261
|
+
},
|
|
4262
|
+
projectOnly: {
|
|
4263
|
+
skillRoots: [".github/skills"],
|
|
4264
|
+
memory: [
|
|
4265
|
+
[".github/copilot-instructions.md"],
|
|
4266
|
+
["AGENTS.md"],
|
|
4267
|
+
["CLAUDE.md"],
|
|
4268
|
+
[".claude/CLAUDE.md"]
|
|
4269
|
+
],
|
|
4270
|
+
settings: [".github/copilot/settings.json"],
|
|
4271
|
+
// VS Code's workspace file keys servers under `servers`, not `mcpServers`.
|
|
4272
|
+
mcpJson: [".github/mcp.json", ".vscode/mcp.json"]
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
};
|
|
4276
|
+
function concatOptional(shared, delta) {
|
|
4277
|
+
if (!shared && !delta) {
|
|
4278
|
+
return void 0;
|
|
4279
|
+
}
|
|
4280
|
+
return [...shared ?? [], ...delta ?? []];
|
|
4281
|
+
}
|
|
4282
|
+
function layoutForScope(runner, delta = {}) {
|
|
4283
|
+
const { shared } = runner;
|
|
4284
|
+
return {
|
|
4285
|
+
skillRoots: [...shared.skillRoots, ...delta.skillRoots ?? []],
|
|
4286
|
+
dirs: shared.dirs,
|
|
4287
|
+
memory: [...shared.memory, ...delta.memory ?? []],
|
|
4288
|
+
settings: [...shared.settings, ...delta.settings ?? []],
|
|
4289
|
+
mcpJson: concatOptional(shared.mcpJson, delta.mcpJson),
|
|
4290
|
+
mcpToml: concatOptional(shared.mcpToml, delta.mcpToml),
|
|
4291
|
+
plugins: delta.plugins ?? shared.plugins,
|
|
4292
|
+
managed: delta.managed ?? shared.managed
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
function layoutsForScope(scope) {
|
|
4296
|
+
return Object.fromEntries(
|
|
4297
|
+
Object.entries(RUNNER_LAYOUT).map(([runner, entry]) => [
|
|
4298
|
+
runner,
|
|
4299
|
+
layoutForScope(entry, entry[scope])
|
|
4300
|
+
])
|
|
4301
|
+
);
|
|
4302
|
+
}
|
|
4303
|
+
var PLATFORM_USER_LAYOUT = layoutsForScope("homeOnly");
|
|
4304
|
+
var PLATFORM_PROJECT_LAYOUT = layoutsForScope("projectOnly");
|
|
4305
|
+
function uniqueRels(rels) {
|
|
4306
|
+
return [...new Set(rels)];
|
|
4307
|
+
}
|
|
4308
|
+
function userScopePathsFromLayouts(layouts) {
|
|
4309
|
+
const skills = [];
|
|
4310
|
+
const subagents = [];
|
|
4311
|
+
const commands = [];
|
|
4312
|
+
const rules = [];
|
|
4313
|
+
const memory = [];
|
|
4314
|
+
const settings = [];
|
|
4315
|
+
const mcp = [];
|
|
4316
|
+
for (const layout of layouts) {
|
|
4317
|
+
skills.push(...layout.skillRoots);
|
|
4318
|
+
for (const entry of layout.dirs) {
|
|
4319
|
+
if (entry.kind === "SUBAGENT") {
|
|
4320
|
+
subagents.push(entry.dir);
|
|
4321
|
+
} else if (entry.kind === "COMMAND") {
|
|
4322
|
+
commands.push(entry.dir);
|
|
4323
|
+
} else {
|
|
4324
|
+
rules.push(entry.dir);
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
memory.push(...layout.memory.flat());
|
|
4328
|
+
settings.push(...layout.settings);
|
|
4329
|
+
mcp.push(...layout.mcpJson ?? [], ...layout.mcpToml ?? []);
|
|
4330
|
+
}
|
|
4331
|
+
return {
|
|
4332
|
+
skills: uniqueRels(skills),
|
|
4333
|
+
subagents: uniqueRels(subagents),
|
|
4334
|
+
commands: uniqueRels(commands),
|
|
4335
|
+
rules: uniqueRels(rules),
|
|
4336
|
+
memory: uniqueRels(memory),
|
|
4337
|
+
settings: uniqueRels(settings),
|
|
4338
|
+
mcp: uniqueRels(mcp)
|
|
4339
|
+
};
|
|
4340
|
+
}
|
|
4341
|
+
var USER_SCOPE_PATHS = userScopePathsFromLayouts(
|
|
4342
|
+
Object.values(PLATFORM_USER_LAYOUT)
|
|
4343
|
+
);
|
|
4344
|
+
|
|
4345
|
+
// src/extract/layout-resolve.ts
|
|
1321
4346
|
function uniqueOrderedRoots(preferred, available) {
|
|
1322
4347
|
const remaining = new Set(available);
|
|
1323
4348
|
const ordered = [];
|
|
@@ -1350,10 +4375,7 @@ var USER_SKILL_ROOTS = uniqueOrderedRoots(
|
|
|
1350
4375
|
);
|
|
1351
4376
|
|
|
1352
4377
|
// src/extract/rule-extract.ts
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1355
|
-
// src/collectors/sys.ts
|
|
1356
|
-
var BYTES_PER_MB = 1024 * 1024;
|
|
4378
|
+
var import_composition_identity5 = __toESM(require_dist(), 1);
|
|
1357
4379
|
|
|
1358
4380
|
// src/shared/file-logger.ts
|
|
1359
4381
|
var LOG_MAX_BYTES = 1024 * 1024;
|
|
@@ -1363,17 +4385,367 @@ var LOG_PURGE_AFTER_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
|
1363
4385
|
var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
|
|
1364
4386
|
var RUN_LOG_WINDOWS_FILE_MAX_BYTES = 64 * 1024;
|
|
1365
4387
|
|
|
4388
|
+
// src/collectors/identity/cursor-cloud-metadata.ts
|
|
4389
|
+
var CURSOR_OWNER_UNVERIFIED_BOOT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
4390
|
+
var CURSOR_OWNER_EMPTY_TTL_MS = 10 * 60 * 1e3;
|
|
4391
|
+
var CURSOR_OWNER_FORBIDDEN_TTL_MS = 60 * 60 * 1e3;
|
|
4392
|
+
var CURSOR_OWNER_ERROR_TTL_MS = 60 * 1e3;
|
|
4393
|
+
|
|
4394
|
+
// src/collectors/sys.ts
|
|
4395
|
+
var BYTES_PER_MB = 1024 * 1024;
|
|
4396
|
+
|
|
4397
|
+
// src/shared/constants.ts
|
|
4398
|
+
var HOOK_BINARY_NAME = "ev-ai-agent-hook";
|
|
4399
|
+
var GLOBAL_HOOK_BINARY_RELATIVE = `current/${HOOK_BINARY_NAME}`;
|
|
4400
|
+
var PROJECT_HOOK_BINARY_RELATIVE = `.ev-ai/agent-hook/${HOOK_BINARY_NAME}`;
|
|
4401
|
+
var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
|
|
4402
|
+
var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
|
|
4403
|
+
var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
|
|
4404
|
+
var GZIP_MIN_BYTES = 32 * 1024;
|
|
4405
|
+
var PACKAGE_VERSION = "1.4.1";
|
|
4406
|
+
var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
|
|
4407
|
+
var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
|
|
4408
|
+
|
|
4409
|
+
// src/hook/sanitizeHookInput.ts
|
|
4410
|
+
var STRING_TRUNCATE_MARKER = "\u2026[truncated]\u2026";
|
|
4411
|
+
var STRING_TRUNCATE_MARKER_BYTES = Buffer.byteLength(STRING_TRUNCATE_MARKER, "utf8");
|
|
4412
|
+
|
|
4413
|
+
// ../../common/repo-manifest/src/index.ts
|
|
4414
|
+
var import_micromatch = __toESM(require_micromatch());
|
|
4415
|
+
var EXCLUDE_PATTERNS = [
|
|
4416
|
+
"**/node_modules/**",
|
|
4417
|
+
"**/dist/**",
|
|
4418
|
+
"**/build/**",
|
|
4419
|
+
"**/.git/**",
|
|
4420
|
+
"**/.trash/**",
|
|
4421
|
+
// Claude runtime cache (changelog, model catalog).
|
|
4422
|
+
"**/.claude/cache/**",
|
|
4423
|
+
"**/.codex/skills/.system/**",
|
|
4424
|
+
"**/vendor/**",
|
|
4425
|
+
"**/.yarn/**",
|
|
4426
|
+
"**/coverage/**",
|
|
4427
|
+
"**/.next/**"
|
|
4428
|
+
];
|
|
4429
|
+
var EXCLUDED_DIR_MATCHERS = EXCLUDE_PATTERNS.map(
|
|
4430
|
+
(pattern) => import_micromatch.default.matcher(pattern, { dot: true })
|
|
4431
|
+
);
|
|
4432
|
+
|
|
4433
|
+
// src/collectors/userSpec/files.ts
|
|
4434
|
+
var USER_SPEC_TEXT_MAX_LENGTH = 100 * 1024;
|
|
4435
|
+
|
|
4436
|
+
// src/collectors/userSpec/mcp-attributes.ts
|
|
4437
|
+
var import_composition_identity = __toESM(require_dist(), 1);
|
|
4438
|
+
var NPX_PACKAGE_ATTRIBUTE_KEYS = [
|
|
4439
|
+
"package_name",
|
|
4440
|
+
"package_spec",
|
|
4441
|
+
"package_version",
|
|
4442
|
+
"package_version_source"
|
|
4443
|
+
];
|
|
4444
|
+
var TOOL_LIST_RAW_KEYS = [
|
|
4445
|
+
{ raw: "tools", attr: "tools" },
|
|
4446
|
+
{ raw: "autoApprove", attr: "auto_approve" },
|
|
4447
|
+
{ raw: "auto_approve", attr: "auto_approve" },
|
|
4448
|
+
{ raw: "alwaysAllow", attr: "always_allow" },
|
|
4449
|
+
{ raw: "always_allow", attr: "always_allow" },
|
|
4450
|
+
{ raw: "enabledTools", attr: "enabled_tools" },
|
|
4451
|
+
{ raw: "enabled_tools", attr: "enabled_tools" },
|
|
4452
|
+
{ raw: "disabledTools", attr: "disabled_tools" },
|
|
4453
|
+
{ raw: "disabled_tools", attr: "disabled_tools" }
|
|
4454
|
+
];
|
|
4455
|
+
var TOOL_LIST_ATTRS = new Set(TOOL_LIST_RAW_KEYS.map((entry) => entry.attr));
|
|
4456
|
+
var ENABLED_RAW_KEYS = ["enabled", "disabled"];
|
|
4457
|
+
var SCALAR_RAW_KEYS = [
|
|
4458
|
+
"serverUrl",
|
|
4459
|
+
"auth",
|
|
4460
|
+
"bearer_token_env_var",
|
|
4461
|
+
"default_tools_approval_mode",
|
|
4462
|
+
"defaultToolsApprovalMode",
|
|
4463
|
+
"env_vars",
|
|
4464
|
+
"env_http_headers",
|
|
4465
|
+
"http_headers"
|
|
4466
|
+
];
|
|
4467
|
+
var MCP_SERVER_READ_KEYS = /* @__PURE__ */ new Set([
|
|
4468
|
+
"type",
|
|
4469
|
+
"command",
|
|
4470
|
+
"url",
|
|
4471
|
+
"args",
|
|
4472
|
+
"env",
|
|
4473
|
+
"envVars",
|
|
4474
|
+
"headers",
|
|
4475
|
+
...ENABLED_RAW_KEYS,
|
|
4476
|
+
...SCALAR_RAW_KEYS,
|
|
4477
|
+
...TOOL_LIST_RAW_KEYS.map((entry) => entry.raw)
|
|
4478
|
+
]);
|
|
4479
|
+
var DERIVED_KEYS = /* @__PURE__ */ new Set([
|
|
4480
|
+
"transport",
|
|
4481
|
+
"command_or_url",
|
|
4482
|
+
"args",
|
|
4483
|
+
"env_var_names",
|
|
4484
|
+
"headers_present",
|
|
4485
|
+
"auth",
|
|
4486
|
+
"bearer_token_env_var",
|
|
4487
|
+
"default_tools_approval_mode",
|
|
4488
|
+
"env_http_header_names",
|
|
4489
|
+
...NPX_PACKAGE_ATTRIBUTE_KEYS,
|
|
4490
|
+
...TOOL_LIST_ATTRS,
|
|
4491
|
+
...[...TOOL_LIST_ATTRS].map((attr) => `${attr}_truncated`)
|
|
4492
|
+
]);
|
|
4493
|
+
|
|
4494
|
+
// src/collectors/permission-key.ts
|
|
4495
|
+
var PATH_PLACEHOLDER = "<path>";
|
|
4496
|
+
var PATH_CONTINUATION_PATTERN = new RegExp(
|
|
4497
|
+
`${PATH_PLACEHOLDER}(?:\\s+[A-Za-z.][^\\s,)]*[\\\\/][^\\s,)]*)+`,
|
|
4498
|
+
"g"
|
|
4499
|
+
);
|
|
4500
|
+
|
|
4501
|
+
// src/collectors/userSpec/settings.ts
|
|
4502
|
+
var SETTINGS_JSON_MAX_BYTES = 16 * 1024;
|
|
4503
|
+
|
|
4504
|
+
// src/collectors/userSpec/mcp-config-file.ts
|
|
4505
|
+
var AUTH_TABLE = {
|
|
4506
|
+
CLIENT_ID: "keep",
|
|
4507
|
+
CLIENT_SECRET: "secret",
|
|
4508
|
+
scopes: "string_list",
|
|
4509
|
+
redirectPort: "keep"
|
|
4510
|
+
// source-only
|
|
4511
|
+
};
|
|
4512
|
+
var OAUTH_TABLE = {
|
|
4513
|
+
clientId: "keep",
|
|
4514
|
+
client_id: "keep",
|
|
4515
|
+
clientSecret: "secret",
|
|
4516
|
+
client_secret: "secret",
|
|
4517
|
+
callbackPort: "keep",
|
|
4518
|
+
callback_port: "keep",
|
|
4519
|
+
// source-only
|
|
4520
|
+
callback_url: "url",
|
|
4521
|
+
// source-only
|
|
4522
|
+
redirectUri: "url",
|
|
4523
|
+
// source-only
|
|
4524
|
+
redirect_uri: "url",
|
|
4525
|
+
// source-only
|
|
4526
|
+
authServerMetadataUrl: "url",
|
|
4527
|
+
auth_server_metadata_url: "url",
|
|
4528
|
+
// source-only
|
|
4529
|
+
authorizationUrl: "url",
|
|
4530
|
+
tokenUrl: "url",
|
|
4531
|
+
issuer: "url",
|
|
4532
|
+
// source-only
|
|
4533
|
+
registrationUrl: "url",
|
|
4534
|
+
// source-only
|
|
4535
|
+
clientMetadataUrl: "url",
|
|
4536
|
+
// source-only
|
|
4537
|
+
scopes: { by: { string: "keep", array: "string_list" } },
|
|
4538
|
+
scope: "keep",
|
|
4539
|
+
// source-only
|
|
4540
|
+
oauthScopes: "string_list",
|
|
4541
|
+
// source-only
|
|
4542
|
+
audiences: "string_list",
|
|
4543
|
+
enabled: "keep",
|
|
4544
|
+
allowPrivateNetwork: "keep",
|
|
4545
|
+
// source-only
|
|
4546
|
+
authorizationResponseIssParameterSupported: "keep",
|
|
4547
|
+
// source-only
|
|
4548
|
+
tokenParamName: "keep"
|
|
4549
|
+
};
|
|
4550
|
+
var MCP_CONFIG_SANDBOX_TABLE = {
|
|
4551
|
+
filesystem: {
|
|
4552
|
+
object: {
|
|
4553
|
+
allowWrite: "path",
|
|
4554
|
+
denyRead: "path",
|
|
4555
|
+
denyWrite: "path"
|
|
4556
|
+
}
|
|
4557
|
+
},
|
|
4558
|
+
network: {
|
|
4559
|
+
object: {
|
|
4560
|
+
allowedDomains: "string_list",
|
|
4561
|
+
deniedDomains: "string_list"
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
};
|
|
4565
|
+
var DEV_TABLE = {
|
|
4566
|
+
watch: "path",
|
|
4567
|
+
debug: { object: { type: "keep", debugpyPath: "path" } }
|
|
4568
|
+
};
|
|
4569
|
+
var REQUEST_OPTIONS_TABLE = {
|
|
4570
|
+
headers: "secret_map",
|
|
4571
|
+
proxy: "url",
|
|
4572
|
+
caBundlePath: "path",
|
|
4573
|
+
timeout: "keep",
|
|
4574
|
+
verifySsl: "keep",
|
|
4575
|
+
noProxy: "string_list",
|
|
4576
|
+
extraBodyProperties: "omit",
|
|
4577
|
+
clientCertificate: { object: { cert: "omit", key: "omit", passphrase: "secret" } }
|
|
4578
|
+
};
|
|
4579
|
+
var TIMEOUT_TABLE = { startup: "keep", catalog: "keep", execution: "keep" };
|
|
4580
|
+
var CODEX_TOOL_TABLE = { approval_mode: "keep", output_token_limit: "keep" };
|
|
4581
|
+
var TRANSPORT_TABLE = {
|
|
4582
|
+
type: "transport_type",
|
|
4583
|
+
command: "command",
|
|
4584
|
+
args: "args",
|
|
4585
|
+
cwd: "path",
|
|
4586
|
+
env: "secret_map",
|
|
4587
|
+
url: "url",
|
|
4588
|
+
headers: "secret_map"
|
|
4589
|
+
};
|
|
4590
|
+
var TOOL_LIST_ALIASES = Object.fromEntries(
|
|
4591
|
+
TOOL_LIST_RAW_KEYS.map(({ raw }) => [raw, "tool_list"])
|
|
4592
|
+
);
|
|
4593
|
+
var MCP_CONFIG_SERVER_KEY_TREATMENT = {
|
|
4594
|
+
...TOOL_LIST_ALIASES,
|
|
4595
|
+
// Identity / transport / enablement
|
|
4596
|
+
type: "transport_type",
|
|
4597
|
+
transportType: "keep",
|
|
4598
|
+
// source-only
|
|
4599
|
+
transport: { by: { string: "keep", object: { object: TRANSPORT_TABLE } } },
|
|
4600
|
+
disabled: "keep",
|
|
4601
|
+
enabled: "keep",
|
|
4602
|
+
required: "keep",
|
|
4603
|
+
remote: "keep",
|
|
4604
|
+
// source-only
|
|
4605
|
+
remoteConfigured: "keep",
|
|
4606
|
+
// source-only
|
|
4607
|
+
source: "keep",
|
|
4608
|
+
// source-only
|
|
4609
|
+
version: "keep",
|
|
4610
|
+
gallery: { by: { boolean: "keep", string: "url" } },
|
|
4611
|
+
description: "omit",
|
|
4612
|
+
name: "keep",
|
|
4613
|
+
serverName: "keep",
|
|
4614
|
+
// source-only
|
|
4615
|
+
faviconUrl: "url",
|
|
4616
|
+
// source-only
|
|
4617
|
+
sourceFile: "path",
|
|
4618
|
+
sourceSlug: "keep",
|
|
4619
|
+
environment_id: "keep",
|
|
4620
|
+
protocol: "keep",
|
|
4621
|
+
pool: "keep",
|
|
4622
|
+
codemode: "keep",
|
|
4623
|
+
trust: "keep",
|
|
4624
|
+
alwaysLoad: "keep",
|
|
4625
|
+
deferTools: "keep",
|
|
4626
|
+
// source-only
|
|
4627
|
+
supports_parallel_tool_calls: "keep",
|
|
4628
|
+
tool_input_schema_max_bytes: "keep",
|
|
4629
|
+
startup_readiness: "keep",
|
|
4630
|
+
extension: "omit",
|
|
4631
|
+
// source-only
|
|
4632
|
+
metadata: "omit",
|
|
4633
|
+
// source-only
|
|
4634
|
+
settings: "omit",
|
|
4635
|
+
// source-only
|
|
4636
|
+
// stdio / process
|
|
4637
|
+
command: {
|
|
4638
|
+
by: {
|
|
4639
|
+
string: "command",
|
|
4640
|
+
array: "args",
|
|
4641
|
+
// Zed legacy `command: { path, args, env }`.
|
|
4642
|
+
object: { object: { path: "command", args: "args", env: "secret_map" } }
|
|
4643
|
+
}
|
|
4644
|
+
},
|
|
4645
|
+
args: "args",
|
|
4646
|
+
env: "secret_map",
|
|
4647
|
+
environment: "secret_map",
|
|
4648
|
+
env_vars: {
|
|
4649
|
+
list: {
|
|
4650
|
+
by: { string: "env_name", object: { object: { name: "env_name", source: "keep" } } }
|
|
4651
|
+
}
|
|
4652
|
+
},
|
|
4653
|
+
envVars: "secret_map",
|
|
4654
|
+
envFile: "path",
|
|
4655
|
+
cwd: "path",
|
|
4656
|
+
watchPaths: "path",
|
|
4657
|
+
dev: { object: DEV_TABLE },
|
|
4658
|
+
sandboxEnabled: "keep",
|
|
4659
|
+
sandbox: { object: MCP_CONFIG_SANDBOX_TABLE },
|
|
4660
|
+
// Remote / HTTP
|
|
4661
|
+
url: "url",
|
|
4662
|
+
serverUrl: "url",
|
|
4663
|
+
httpUrl: "url",
|
|
4664
|
+
tcp: "url",
|
|
4665
|
+
// source-only
|
|
4666
|
+
headers: "secret_map",
|
|
4667
|
+
http_headers: "secret_map",
|
|
4668
|
+
env_http_headers: "env_name_map",
|
|
4669
|
+
bearer_token_env_var: "env_name",
|
|
4670
|
+
headersHelper: "helper_command",
|
|
4671
|
+
http_headers_helper: "helper_command",
|
|
4672
|
+
apiKey: "secret",
|
|
4673
|
+
// source-only
|
|
4674
|
+
requestOptions: { object: REQUEST_OPTIONS_TABLE },
|
|
4675
|
+
// source-only
|
|
4676
|
+
auth: { by: { string: "mode", object: { object: AUTH_TABLE } } },
|
|
4677
|
+
oauth: { by: { boolean: "keep", object: { object: OAUTH_TABLE } } },
|
|
4678
|
+
oauthClientId: "keep",
|
|
4679
|
+
oauthClientSecret: "secret",
|
|
4680
|
+
oauthResource: "url",
|
|
4681
|
+
oauth_resource: "url",
|
|
4682
|
+
oauthScopes: "string_list",
|
|
4683
|
+
scopes: { by: { string: "keep", array: "string_list" } },
|
|
4684
|
+
oauthPublicClient: "keep",
|
|
4685
|
+
// source-only
|
|
4686
|
+
oauthGrantType: "keep",
|
|
4687
|
+
// source-only
|
|
4688
|
+
authProviderType: "keep",
|
|
4689
|
+
targetAudience: "keep",
|
|
4690
|
+
targetServiceAccount: "keep",
|
|
4691
|
+
// Tool filtering / approval
|
|
4692
|
+
tools: {
|
|
4693
|
+
by: {
|
|
4694
|
+
array: "tool_list",
|
|
4695
|
+
boolean: "tool_list",
|
|
4696
|
+
string: "tool_list",
|
|
4697
|
+
object: { map: { object: CODEX_TOOL_TABLE } }
|
|
4698
|
+
}
|
|
4699
|
+
},
|
|
4700
|
+
includeTools: "tool_list",
|
|
4701
|
+
excludeTools: "tool_list",
|
|
4702
|
+
omit_tools_from: "tool_list",
|
|
4703
|
+
default_tools_approval_mode: "keep",
|
|
4704
|
+
defaultToolsApprovalMode: "keep",
|
|
4705
|
+
// Timeouts
|
|
4706
|
+
timeout: { by: { number: "keep", object: { object: TIMEOUT_TABLE } } },
|
|
4707
|
+
startup_timeout_sec: "keep",
|
|
4708
|
+
startup_timeout_ms: "keep",
|
|
4709
|
+
tool_timeout_sec: "keep",
|
|
4710
|
+
connectionTimeout: "keep"
|
|
4711
|
+
// source-only
|
|
4712
|
+
};
|
|
4713
|
+
|
|
4714
|
+
// src/collectors/userSpec/npx-package.ts
|
|
4715
|
+
var import_composition_identity4 = __toESM(require_dist(), 1);
|
|
4716
|
+
|
|
4717
|
+
// src/collectors/userSpec/local-bin-package.ts
|
|
4718
|
+
var import_composition_identity3 = __toESM(require_dist(), 1);
|
|
4719
|
+
|
|
4720
|
+
// src/collectors/userSpec/install-state.ts
|
|
4721
|
+
import { closeSync, constants, fstatSync, openSync, readSync, statSync } from "node:fs";
|
|
4722
|
+
var import_composition_identity2 = __toESM(require_dist(), 1);
|
|
4723
|
+
var INSTALL_STATE_MAX_BYTES = 16 * 1024 * 1024;
|
|
4724
|
+
var OPEN_FLAGS = constants.O_RDONLY | (process.platform === "win32" ? 0 : constants.O_NONBLOCK);
|
|
4725
|
+
|
|
4726
|
+
// src/collectors/userSpec/local-bin-package.ts
|
|
4727
|
+
var MANIFEST_MAX_BYTES = 1024 * 1024;
|
|
4728
|
+
|
|
4729
|
+
// src/collectors/userSpec/mcp.ts
|
|
4730
|
+
var MCP_CONFIG_TEXT_MAX_BYTES = 64 * 1024;
|
|
4731
|
+
|
|
4732
|
+
// src/collectors/userSpec/budget.ts
|
|
4733
|
+
var USER_SPEC_MAX_BYTES = 2 * 1024 * 1024;
|
|
4734
|
+
|
|
4735
|
+
// src/shared/git-config.ts
|
|
4736
|
+
var GIT_CONFIG_CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
4737
|
+
|
|
1366
4738
|
// src/extract/rule-extract.ts
|
|
1367
4739
|
var RULE_LAYOUT_ROOTS = userScopePathsFromLayouts(Object.values(PLATFORM_PROJECT_LAYOUT)).rules;
|
|
1368
4740
|
|
|
1369
4741
|
// src/extract/command-extract.ts
|
|
1370
|
-
var
|
|
4742
|
+
var import_composition_identity6 = __toESM(require_dist(), 1);
|
|
1371
4743
|
var COMMAND_LAYOUT_ROOTS = userScopePathsFromLayouts(
|
|
1372
4744
|
Object.values(PLATFORM_PROJECT_LAYOUT)
|
|
1373
4745
|
).commands;
|
|
1374
4746
|
|
|
1375
4747
|
// src/hook/runner.ts
|
|
1376
|
-
var
|
|
4748
|
+
var import_composition_identity7 = __toESM(require_dist(), 1);
|
|
1377
4749
|
function isInProcessEvent(runnerEvent, platform) {
|
|
1378
4750
|
const lower = runnerEvent.toLowerCase();
|
|
1379
4751
|
if (lower === "sessionend" || lower === "stopfailure" || lower === "subagentstop") {
|
|
@@ -1382,18 +4754,6 @@ function isInProcessEvent(runnerEvent, platform) {
|
|
|
1382
4754
|
return lower === "stop" && platform === "codex";
|
|
1383
4755
|
}
|
|
1384
4756
|
|
|
1385
|
-
// src/shared/constants.ts
|
|
1386
|
-
var HOOK_BINARY_NAME = "ev-ai-agent-hook";
|
|
1387
|
-
var GLOBAL_HOOK_BINARY_RELATIVE = `current/${HOOK_BINARY_NAME}`;
|
|
1388
|
-
var PROJECT_HOOK_BINARY_RELATIVE = `.ev-ai/agent-hook/${HOOK_BINARY_NAME}`;
|
|
1389
|
-
var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
|
|
1390
|
-
var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
|
|
1391
|
-
var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
|
|
1392
|
-
var GZIP_MIN_BYTES = 32 * 1024;
|
|
1393
|
-
var PACKAGE_VERSION = "1.4.0";
|
|
1394
|
-
var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
|
|
1395
|
-
var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
|
|
1396
|
-
|
|
1397
4757
|
// src/config/hook-config.ts
|
|
1398
4758
|
var HOOK_CONFIG_FETCHED_AT_BUMP_MS = 24 * 60 * 60 * 1e3;
|
|
1399
4759
|
var HOOK_CONFIG_FILE_MAX_BYTES2 = 1024 * 1024;
|