e2e-ai 1.1.2 → 1.3.0
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/README.md +241 -16
- package/agents/feature-analyzer-agent.md +81 -0
- package/agents/scenario-planner-agent.md +68 -0
- package/dist/cli-6c0wsk32.js +165 -0
- package/dist/cli-ba9d3pdp.js +64 -0
- package/dist/cli-cqabyzv3.js +64 -0
- package/dist/cli-fgp618yt.js +13610 -0
- package/dist/cli-g7cc13w2.js +165 -0
- package/dist/cli-ph82pe4b.js +13589 -0
- package/dist/cli.js +4117 -277
- package/dist/config/schema.js +1 -1
- package/dist/index.js +2 -2
- package/dist/mcp.js +14978 -0
- package/package.json +6 -3
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadAgent,
|
|
4
|
+
scanCodebase
|
|
5
|
+
} from "./cli-6c0wsk32.js";
|
|
2
6
|
import {
|
|
3
7
|
getPackageRoot,
|
|
4
8
|
getProjectRoot,
|
|
5
9
|
loadConfig
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
10
|
+
} from "./cli-cqabyzv3.js";
|
|
11
|
+
import"./cli-fgp618yt.js";
|
|
8
12
|
import {
|
|
9
13
|
__commonJS,
|
|
10
14
|
__export,
|
|
@@ -6436,101 +6440,7 @@ function formatTime(sec) {
|
|
|
6436
6440
|
}
|
|
6437
6441
|
|
|
6438
6442
|
// src/commands/scenario.ts
|
|
6439
|
-
import { join as
|
|
6440
|
-
|
|
6441
|
-
// src/agents/loadAgent.ts
|
|
6442
|
-
import { readFileSync as readFileSync2, existsSync as existsSync2 } from "node:fs";
|
|
6443
|
-
import { join as join5 } from "node:path";
|
|
6444
|
-
function loadAgent(agentName, config) {
|
|
6445
|
-
const agentDir = join5(getPackageRoot(), "agents");
|
|
6446
|
-
const filePath = join5(agentDir, `${agentName}.md`);
|
|
6447
|
-
let content;
|
|
6448
|
-
try {
|
|
6449
|
-
content = readFileSync2(filePath, "utf-8");
|
|
6450
|
-
} catch {
|
|
6451
|
-
throw new Error(`Agent file not found: ${filePath}`);
|
|
6452
|
-
}
|
|
6453
|
-
const { frontmatter, body } = parseFrontmatter(content);
|
|
6454
|
-
const agentConfig = extractConfig(frontmatter);
|
|
6455
|
-
let systemPrompt = body;
|
|
6456
|
-
if (config) {
|
|
6457
|
-
const contextPath = join5(getProjectRoot(), config.contextFile);
|
|
6458
|
-
if (existsSync2(contextPath)) {
|
|
6459
|
-
const projectContext = readFileSync2(contextPath, "utf-8").trim();
|
|
6460
|
-
if (projectContext) {
|
|
6461
|
-
systemPrompt = `${body}
|
|
6462
|
-
|
|
6463
|
-
## Project Context
|
|
6464
|
-
|
|
6465
|
-
${projectContext}`;
|
|
6466
|
-
}
|
|
6467
|
-
}
|
|
6468
|
-
if (config.llm.agentModels[agentName]) {
|
|
6469
|
-
agentConfig.model = config.llm.agentModels[agentName];
|
|
6470
|
-
}
|
|
6471
|
-
}
|
|
6472
|
-
const sections = parseSections(body);
|
|
6473
|
-
return {
|
|
6474
|
-
name: frontmatter.agent ?? agentName,
|
|
6475
|
-
systemPrompt,
|
|
6476
|
-
inputSchema: sections["Input Schema"],
|
|
6477
|
-
outputSchema: sections["Output Schema"],
|
|
6478
|
-
rules: sections["Rules"],
|
|
6479
|
-
example: sections["Example"],
|
|
6480
|
-
config: agentConfig
|
|
6481
|
-
};
|
|
6482
|
-
}
|
|
6483
|
-
function parseFrontmatter(content) {
|
|
6484
|
-
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
6485
|
-
if (!match)
|
|
6486
|
-
return { frontmatter: {}, body: content };
|
|
6487
|
-
const frontmatter = {};
|
|
6488
|
-
for (const line of match[1].split(`
|
|
6489
|
-
`)) {
|
|
6490
|
-
const colonIdx = line.indexOf(":");
|
|
6491
|
-
if (colonIdx === -1)
|
|
6492
|
-
continue;
|
|
6493
|
-
const key = line.slice(0, colonIdx).trim();
|
|
6494
|
-
let value = line.slice(colonIdx + 1).trim();
|
|
6495
|
-
if (value.startsWith('"') && value.endsWith('"'))
|
|
6496
|
-
value = value.slice(1, -1);
|
|
6497
|
-
if (value === "true")
|
|
6498
|
-
value = true;
|
|
6499
|
-
if (value === "false")
|
|
6500
|
-
value = false;
|
|
6501
|
-
if (!isNaN(Number(value)) && value !== "")
|
|
6502
|
-
value = Number(value);
|
|
6503
|
-
frontmatter[key] = value;
|
|
6504
|
-
}
|
|
6505
|
-
return { frontmatter, body: match[2] };
|
|
6506
|
-
}
|
|
6507
|
-
function extractConfig(frontmatter) {
|
|
6508
|
-
return {
|
|
6509
|
-
model: frontmatter.model,
|
|
6510
|
-
maxTokens: frontmatter.max_tokens ?? 4096,
|
|
6511
|
-
temperature: frontmatter.temperature ?? 0.2
|
|
6512
|
-
};
|
|
6513
|
-
}
|
|
6514
|
-
function parseSections(body) {
|
|
6515
|
-
const sections = {};
|
|
6516
|
-
const headingRegex = /^##\s+(.+)$/gm;
|
|
6517
|
-
const headings = [];
|
|
6518
|
-
let match;
|
|
6519
|
-
while ((match = headingRegex.exec(body)) !== null) {
|
|
6520
|
-
headings.push({ title: match[1].trim(), index: match.index });
|
|
6521
|
-
}
|
|
6522
|
-
const systemMatch = body.match(/^#\s+System Prompt\n([\s\S]*?)(?=\n##\s|$)/m);
|
|
6523
|
-
if (systemMatch) {
|
|
6524
|
-
sections["System Prompt"] = systemMatch[1].trim();
|
|
6525
|
-
}
|
|
6526
|
-
for (let i = 0;i < headings.length; i++) {
|
|
6527
|
-
const start = headings[i].index + body.slice(headings[i].index).indexOf(`
|
|
6528
|
-
`) + 1;
|
|
6529
|
-
const end = i + 1 < headings.length ? headings[i + 1].index : body.length;
|
|
6530
|
-
sections[headings[i].title] = body.slice(start, end).trim();
|
|
6531
|
-
}
|
|
6532
|
-
return sections;
|
|
6533
|
-
}
|
|
6443
|
+
import { join as join6 } from "node:path";
|
|
6534
6444
|
|
|
6535
6445
|
// src/agents/callLLM.ts
|
|
6536
6446
|
var DEFAULT_MODELS = {
|
|
@@ -6676,9 +6586,9 @@ function extractYAML(content) {
|
|
|
6676
6586
|
import { dirname as dirname3 } from "node:path";
|
|
6677
6587
|
|
|
6678
6588
|
// src/integrations/jira.ts
|
|
6679
|
-
import { join as
|
|
6589
|
+
import { join as join5 } from "node:path";
|
|
6680
6590
|
async function fetchJiraContext(key, config, workingDir) {
|
|
6681
|
-
const jsonPath =
|
|
6591
|
+
const jsonPath = join5(workingDir, key, `${key}-zephyr-test-case.json`);
|
|
6682
6592
|
if (!fileExists(jsonPath))
|
|
6683
6593
|
return null;
|
|
6684
6594
|
const data = JSON.parse(readFile(jsonPath));
|
|
@@ -6839,8 +6749,8 @@ function registerScenario(program2) {
|
|
|
6839
6749
|
let codegenContent;
|
|
6840
6750
|
let transcriptContent;
|
|
6841
6751
|
if (ctx.key) {
|
|
6842
|
-
const keyDir =
|
|
6843
|
-
const recordingsDir =
|
|
6752
|
+
const keyDir = join6(ctx.paths.workingDir, ctx.key);
|
|
6753
|
+
const recordingsDir = join6(keyDir, "recordings");
|
|
6844
6754
|
const codegenFile = findFileWithPattern(keyDir, /codegen-.*\.ts$/);
|
|
6845
6755
|
const transcriptFile = findFileWithPattern(keyDir, /transcript\.json$/) ?? findFileWithPattern(recordingsDir, /voice-.*\.json$/) ?? findFileWithPattern(keyDir, /voice-.*\.json$/);
|
|
6846
6756
|
if (codegenFile)
|
|
@@ -6848,8 +6758,8 @@ function registerScenario(program2) {
|
|
|
6848
6758
|
if (transcriptFile)
|
|
6849
6759
|
transcriptContent = readFile(transcriptFile);
|
|
6850
6760
|
} else if (session) {
|
|
6851
|
-
const codegenPath =
|
|
6852
|
-
const transcriptPath =
|
|
6761
|
+
const codegenPath = join6(ctx.paths.recordingsDir, `${session}.ts`);
|
|
6762
|
+
const transcriptPath = join6(ctx.paths.transcriptsDir, `${session}-transcript.json`);
|
|
6853
6763
|
if (fileExists(codegenPath))
|
|
6854
6764
|
codegenContent = readFile(codegenPath);
|
|
6855
6765
|
if (fileExists(transcriptPath))
|
|
@@ -6914,8 +6824,8 @@ function registerScenario(program2) {
|
|
|
6914
6824
|
spinner2.stop();
|
|
6915
6825
|
const scenarioYaml = extractYAML(scenarioResponse.content);
|
|
6916
6826
|
const scenarioName = ctx.key ?? session ?? "scenario";
|
|
6917
|
-
const scenarioDir =
|
|
6918
|
-
const scenarioPath =
|
|
6827
|
+
const scenarioDir = join6(ctx.paths.testsDir, scenarioName);
|
|
6828
|
+
const scenarioPath = join6(scenarioDir, `${scenarioName}.yaml`);
|
|
6919
6829
|
ensureDir(scenarioDir);
|
|
6920
6830
|
writeFile(scenarioPath, scenarioYaml);
|
|
6921
6831
|
success(`Scenario saved: ${scenarioPath}`);
|
|
@@ -6923,18 +6833,18 @@ function registerScenario(program2) {
|
|
|
6923
6833
|
}
|
|
6924
6834
|
|
|
6925
6835
|
// src/commands/generate.ts
|
|
6926
|
-
import { join as
|
|
6836
|
+
import { join as join7, basename as basename2 } from "node:path";
|
|
6927
6837
|
function registerGenerate(program2) {
|
|
6928
6838
|
program2.command("generate [scenario]").description("Generate Playwright test from YAML scenario").action(async (scenarioArg) => {
|
|
6929
6839
|
const ctx = await resolveCommandContext(program2);
|
|
6930
6840
|
const root = ctx.paths.projectRoot;
|
|
6931
6841
|
let scenarioPath;
|
|
6932
|
-
if (scenarioArg && fileExists(
|
|
6933
|
-
scenarioPath =
|
|
6842
|
+
if (scenarioArg && fileExists(join7(root, scenarioArg))) {
|
|
6843
|
+
scenarioPath = join7(root, scenarioArg);
|
|
6934
6844
|
} else if (ctx.key) {
|
|
6935
|
-
scenarioPath =
|
|
6845
|
+
scenarioPath = join7(ctx.paths.testsDir, ctx.key, `${ctx.key}.yaml`);
|
|
6936
6846
|
} else if (scenarioArg) {
|
|
6937
|
-
scenarioPath =
|
|
6847
|
+
scenarioPath = join7(ctx.paths.testsDir, scenarioArg, `${scenarioArg}.yaml`);
|
|
6938
6848
|
} else {
|
|
6939
6849
|
error("Provide a scenario file path or --key");
|
|
6940
6850
|
process.exit(1);
|
|
@@ -6966,8 +6876,8 @@ function registerGenerate(program2) {
|
|
|
6966
6876
|
testContent = testContent.replace(/^```\w*\n/, "").replace(/\n```$/, "");
|
|
6967
6877
|
}
|
|
6968
6878
|
const testName = scenario.issueKey ?? ctx.key ?? basename2(scenarioPath, ".yaml");
|
|
6969
|
-
const testDir =
|
|
6970
|
-
const testPath =
|
|
6879
|
+
const testDir = join7(ctx.paths.testsDir, testName);
|
|
6880
|
+
const testPath = join7(testDir, `${testName}.test.ts`);
|
|
6971
6881
|
ensureDir(testDir);
|
|
6972
6882
|
writeFile(testPath, testContent);
|
|
6973
6883
|
success(`Test generated: ${testPath}`);
|
|
@@ -6992,16 +6902,16 @@ function registerGenerate(program2) {
|
|
|
6992
6902
|
}
|
|
6993
6903
|
|
|
6994
6904
|
// src/commands/refine.ts
|
|
6995
|
-
import { join as
|
|
6905
|
+
import { join as join8 } from "node:path";
|
|
6996
6906
|
function registerRefine(program2) {
|
|
6997
6907
|
program2.command("refine [test]").description("Refactor/improve test with AI").action(async (testArg) => {
|
|
6998
6908
|
const ctx = await resolveCommandContext(program2);
|
|
6999
6909
|
const root = ctx.paths.projectRoot;
|
|
7000
6910
|
let testPath;
|
|
7001
|
-
if (testArg && fileExists(
|
|
7002
|
-
testPath =
|
|
6911
|
+
if (testArg && fileExists(join8(root, testArg))) {
|
|
6912
|
+
testPath = join8(root, testArg);
|
|
7003
6913
|
} else if (ctx.key) {
|
|
7004
|
-
testPath =
|
|
6914
|
+
testPath = join8(ctx.paths.testsDir, ctx.key, `${ctx.key}.test.ts`);
|
|
7005
6915
|
} else {
|
|
7006
6916
|
error("Provide a test file path or --key");
|
|
7007
6917
|
process.exit(1);
|
|
@@ -7038,16 +6948,16 @@ function registerRefine(program2) {
|
|
|
7038
6948
|
}
|
|
7039
6949
|
|
|
7040
6950
|
// src/commands/test.ts
|
|
7041
|
-
import { join as
|
|
6951
|
+
import { join as join9 } from "node:path";
|
|
7042
6952
|
function registerTest(program2) {
|
|
7043
6953
|
program2.command("test [test]").description("Run Playwright test with traces").action(async (testArg) => {
|
|
7044
6954
|
const ctx = await resolveCommandContext(program2);
|
|
7045
6955
|
const root = ctx.paths.projectRoot;
|
|
7046
6956
|
let testPath;
|
|
7047
|
-
if (testArg && fileExists(
|
|
7048
|
-
testPath =
|
|
6957
|
+
if (testArg && fileExists(join9(root, testArg))) {
|
|
6958
|
+
testPath = join9(root, testArg);
|
|
7049
6959
|
} else if (ctx.key) {
|
|
7050
|
-
testPath =
|
|
6960
|
+
testPath = join9(ctx.paths.testsDir, ctx.key, `${ctx.key}.test.ts`);
|
|
7051
6961
|
} else {
|
|
7052
6962
|
error("Provide a test file path or --key");
|
|
7053
6963
|
process.exit(1);
|
|
@@ -7082,7 +6992,7 @@ async function runPlaywrightTest(testPath, root) {
|
|
|
7082
6992
|
"--project",
|
|
7083
6993
|
config.playwright.browser
|
|
7084
6994
|
];
|
|
7085
|
-
const pkgConfigPath =
|
|
6995
|
+
const pkgConfigPath = join9(projectRoot, "packages", "e2e-ai", "playwright.e2e-ai.config.ts");
|
|
7086
6996
|
if (fileExists(pkgConfigPath)) {
|
|
7087
6997
|
args.push("--config", pkgConfigPath);
|
|
7088
6998
|
}
|
|
@@ -7109,17 +7019,17 @@ async function runPlaywrightTest(testPath, root) {
|
|
|
7109
7019
|
}
|
|
7110
7020
|
|
|
7111
7021
|
// src/commands/heal.ts
|
|
7112
|
-
import { join as
|
|
7022
|
+
import { join as join10 } from "node:path";
|
|
7113
7023
|
var MAX_HEAL_RETRIES = 3;
|
|
7114
7024
|
function registerHeal(program2) {
|
|
7115
7025
|
program2.command("heal [test]").description("Self-heal a failing test").action(async (testArg) => {
|
|
7116
7026
|
const ctx = await resolveCommandContext(program2);
|
|
7117
7027
|
const root = ctx.paths.projectRoot;
|
|
7118
7028
|
let testPath;
|
|
7119
|
-
if (testArg && fileExists(
|
|
7120
|
-
testPath =
|
|
7029
|
+
if (testArg && fileExists(join10(root, testArg))) {
|
|
7030
|
+
testPath = join10(root, testArg);
|
|
7121
7031
|
} else if (ctx.key) {
|
|
7122
|
-
testPath =
|
|
7032
|
+
testPath = join10(ctx.paths.testsDir, ctx.key, `${ctx.key}.test.ts`);
|
|
7123
7033
|
} else {
|
|
7124
7034
|
error("Provide a test file path or --key");
|
|
7125
7035
|
process.exit(1);
|
|
@@ -7192,16 +7102,16 @@ function registerHeal(program2) {
|
|
|
7192
7102
|
}
|
|
7193
7103
|
|
|
7194
7104
|
// src/commands/qa.ts
|
|
7195
|
-
import { join as
|
|
7105
|
+
import { join as join11 } from "node:path";
|
|
7196
7106
|
function registerQa(program2) {
|
|
7197
7107
|
program2.command("qa [test]").description("Generate QA documentation").action(async (testArg) => {
|
|
7198
7108
|
const ctx = await resolveCommandContext(program2);
|
|
7199
7109
|
const root = ctx.paths.projectRoot;
|
|
7200
7110
|
let testPath;
|
|
7201
|
-
if (testArg && fileExists(
|
|
7202
|
-
testPath =
|
|
7111
|
+
if (testArg && fileExists(join11(root, testArg))) {
|
|
7112
|
+
testPath = join11(root, testArg);
|
|
7203
7113
|
} else if (ctx.key) {
|
|
7204
|
-
testPath =
|
|
7114
|
+
testPath = join11(ctx.paths.testsDir, ctx.key, `${ctx.key}.test.ts`);
|
|
7205
7115
|
} else {
|
|
7206
7116
|
error("Provide a test file path or --key");
|
|
7207
7117
|
process.exit(1);
|
|
@@ -7213,7 +7123,7 @@ function registerQa(program2) {
|
|
|
7213
7123
|
const testContent = readFile(testPath);
|
|
7214
7124
|
let scenario;
|
|
7215
7125
|
if (ctx.key) {
|
|
7216
|
-
const scenarioPath =
|
|
7126
|
+
const scenarioPath = join11(ctx.paths.testsDir, ctx.key, `${ctx.key}.yaml`);
|
|
7217
7127
|
if (fileExists(scenarioPath)) {
|
|
7218
7128
|
const yaml = await import("./index-54ycasgv.js");
|
|
7219
7129
|
scenario = yaml.parse(readFile(scenarioPath));
|
|
@@ -7223,7 +7133,7 @@ function registerQa(program2) {
|
|
|
7223
7133
|
let existingTestCase;
|
|
7224
7134
|
if (ctx.key) {
|
|
7225
7135
|
issueContext = await fetchIssueContext(ctx.key, ctx.config, ctx.paths);
|
|
7226
|
-
const existingJsonPath =
|
|
7136
|
+
const existingJsonPath = join11(ctx.paths.workingDir, ctx.key, `${ctx.key}-zephyr-test-case.json`);
|
|
7227
7137
|
if (fileExists(existingJsonPath)) {
|
|
7228
7138
|
existingTestCase = JSON.parse(readFile(existingJsonPath));
|
|
7229
7139
|
}
|
|
@@ -7261,7 +7171,7 @@ function registerQa(program2) {
|
|
|
7261
7171
|
if (qaResult.markdown && ctx.config.outputTarget !== "zephyr") {
|
|
7262
7172
|
const qaDir = ctx.paths.qaDir;
|
|
7263
7173
|
const testId = ctx.key ?? "test";
|
|
7264
|
-
const qaMdPath =
|
|
7174
|
+
const qaMdPath = join11(qaDir, `${testId}.md`);
|
|
7265
7175
|
ensureDir(qaDir);
|
|
7266
7176
|
writeFile(qaMdPath, qaResult.markdown);
|
|
7267
7177
|
success(`QA document: ${qaMdPath}`);
|
|
@@ -7271,7 +7181,7 @@ function registerQa(program2) {
|
|
|
7271
7181
|
}
|
|
7272
7182
|
|
|
7273
7183
|
// src/commands/run.ts
|
|
7274
|
-
import { join as
|
|
7184
|
+
import { join as join12 } from "node:path";
|
|
7275
7185
|
|
|
7276
7186
|
// src/pipeline/runPipeline.ts
|
|
7277
7187
|
async function runPipeline(steps, ctx, options) {
|
|
@@ -7383,7 +7293,7 @@ function buildSteps() {
|
|
|
7383
7293
|
args.push("--no-voice");
|
|
7384
7294
|
if (ctx.config.noTrace)
|
|
7385
7295
|
args.push("--no-trace");
|
|
7386
|
-
const scriptPath =
|
|
7296
|
+
const scriptPath = join12(pkgRoot, "scripts", "codegen-env.mjs");
|
|
7387
7297
|
const child = spawnInteractive("node", [scriptPath, ...args], {
|
|
7388
7298
|
cwd: ctx.projectRoot,
|
|
7389
7299
|
env: {
|
|
@@ -7397,8 +7307,8 @@ function buildSteps() {
|
|
|
7397
7307
|
if (exitCode !== 0)
|
|
7398
7308
|
return { success: false, output: null, error: new Error(`Recording exited with code ${exitCode}`) };
|
|
7399
7309
|
if (ctx.key) {
|
|
7400
|
-
ctx.codegenPath = findFileWithPattern(
|
|
7401
|
-
ctx.audioPath = findFileWithPattern(
|
|
7310
|
+
ctx.codegenPath = findFileWithPattern(join12(ctx.paths.workingDir, ctx.key), /codegen-.*\.ts$/);
|
|
7311
|
+
ctx.audioPath = findFileWithPattern(join12(ctx.paths.workingDir, ctx.key, "recordings"), /\.wav$/);
|
|
7402
7312
|
}
|
|
7403
7313
|
return { success: true, output: { codegenPath: ctx.codegenPath, audioPath: ctx.audioPath } };
|
|
7404
7314
|
}
|
|
@@ -7413,16 +7323,16 @@ function buildSteps() {
|
|
|
7413
7323
|
if (!ctx.audioPath)
|
|
7414
7324
|
return { success: true, output: null, nonBlocking: true };
|
|
7415
7325
|
const pkgRoot = getPackageRoot();
|
|
7416
|
-
const transcriber = await import(
|
|
7326
|
+
const transcriber = await import(join12(pkgRoot, "scripts", "voice", "transcriber.mjs"));
|
|
7417
7327
|
const segments = await transcriber.transcribe(ctx.audioPath);
|
|
7418
7328
|
if (!segments?.length)
|
|
7419
7329
|
return { success: true, output: { segments: [] }, nonBlocking: true };
|
|
7420
|
-
const outputDir = ctx.key ?
|
|
7421
|
-
const jsonPath =
|
|
7330
|
+
const outputDir = ctx.key ? join12(ctx.paths.workingDir, ctx.key) : ctx.paths.transcriptsDir;
|
|
7331
|
+
const jsonPath = join12(outputDir, `${ctx.sessionName}-transcript.json`);
|
|
7422
7332
|
writeFile(jsonPath, JSON.stringify(segments, null, 2));
|
|
7423
7333
|
ctx.transcriptPath = jsonPath;
|
|
7424
7334
|
if (ctx.codegenPath) {
|
|
7425
|
-
const merger = await import(
|
|
7335
|
+
const merger = await import(join12(pkgRoot, "scripts", "voice", "merger.mjs"));
|
|
7426
7336
|
const content = readFile(ctx.codegenPath);
|
|
7427
7337
|
const merged = merger.merge(content, segments, segments[segments.length - 1].end);
|
|
7428
7338
|
writeFile(ctx.codegenPath, merged);
|
|
@@ -7473,9 +7383,9 @@ function buildSteps() {
|
|
|
7473
7383
|
maxTokens: agent.config.maxTokens,
|
|
7474
7384
|
temperature: agent.config.temperature
|
|
7475
7385
|
});
|
|
7476
|
-
const scenarioDir =
|
|
7386
|
+
const scenarioDir = join12(ctx.paths.testsDir, ctx.sessionName);
|
|
7477
7387
|
ensureDir(scenarioDir);
|
|
7478
|
-
const scenarioPath =
|
|
7388
|
+
const scenarioPath = join12(scenarioDir, `${ctx.sessionName}.yaml`);
|
|
7479
7389
|
writeFile(scenarioPath, resp.content.trim());
|
|
7480
7390
|
ctx.scenarioPath = scenarioPath;
|
|
7481
7391
|
return { success: true, output: { scenarioPath } };
|
|
@@ -7502,8 +7412,8 @@ function buildSteps() {
|
|
|
7502
7412
|
if (testContent.startsWith("```"))
|
|
7503
7413
|
testContent = testContent.replace(/^```\w*\n/, "").replace(/\n```$/, "");
|
|
7504
7414
|
const testName = ctx.key ?? ctx.sessionName;
|
|
7505
|
-
const testDir =
|
|
7506
|
-
ctx.testPath =
|
|
7415
|
+
const testDir = join12(ctx.paths.testsDir, testName);
|
|
7416
|
+
ctx.testPath = join12(testDir, `${testName}.test.ts`);
|
|
7507
7417
|
ensureDir(testDir);
|
|
7508
7418
|
writeFile(ctx.testPath, testContent);
|
|
7509
7419
|
return { success: true, output: { testPath: ctx.testPath } };
|
|
@@ -7633,7 +7543,8 @@ function buildSteps() {
|
|
|
7633
7543
|
}
|
|
7634
7544
|
|
|
7635
7545
|
// src/commands/init.ts
|
|
7636
|
-
import { join as
|
|
7546
|
+
import { join as join13 } from "node:path";
|
|
7547
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync2, existsSync as existsSync2 } from "node:fs";
|
|
7637
7548
|
// node_modules/@inquirer/core/dist/lib/key.js
|
|
7638
7549
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
7639
7550
|
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
@@ -9149,7 +9060,7 @@ function registerInit(program2) {
|
|
|
9149
9060
|
header("e2e-ai init");
|
|
9150
9061
|
const answers = cmdOpts?.nonInteractive ? getDefaultAnswers() : await askConfigQuestions();
|
|
9151
9062
|
const config = buildConfigFromAnswers(answers);
|
|
9152
|
-
const configPath =
|
|
9063
|
+
const configPath = join13(projectRoot, "e2e-ai.config.ts");
|
|
9153
9064
|
if (fileExists(configPath)) {
|
|
9154
9065
|
warn(`Config already exists: ${configPath}`);
|
|
9155
9066
|
const overwrite = cmdOpts?.nonInteractive ? false : await dist_default4({ message: "Overwrite existing config?", default: false });
|
|
@@ -9163,29 +9074,28 @@ function registerInit(program2) {
|
|
|
9163
9074
|
writeFile(configPath, generateConfigFile(config));
|
|
9164
9075
|
success(`Config written: ${configPath}`);
|
|
9165
9076
|
}
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
}
|
|
9187
|
-
|
|
9188
|
-
Initialization complete!`);
|
|
9077
|
+
const spinner = createSpinner();
|
|
9078
|
+
spinner.start("Scanning codebase for test patterns...");
|
|
9079
|
+
const scan = await scanCodebase(projectRoot);
|
|
9080
|
+
spinner.stop();
|
|
9081
|
+
if (scan.testFiles.length === 0 && scan.configFiles.length === 0) {
|
|
9082
|
+
warn("No test files found. Scan results will be minimal.");
|
|
9083
|
+
} else {
|
|
9084
|
+
info(`Found ${scan.testFiles.length} test files, ${scan.configFiles.length} config files`);
|
|
9085
|
+
}
|
|
9086
|
+
const instructionsContent = generateInstructionsFile(scan);
|
|
9087
|
+
const instructionsPath = join13(projectRoot, "e2e-ai.instructions.md");
|
|
9088
|
+
writeFile(instructionsPath, instructionsContent);
|
|
9089
|
+
success(`Instructions written: ${instructionsPath}`);
|
|
9090
|
+
const copiedCount = await copyAgentsToLocal(projectRoot, !!cmdOpts?.nonInteractive);
|
|
9091
|
+
console.log("");
|
|
9092
|
+
success(`Initialization complete!
|
|
9093
|
+
`);
|
|
9094
|
+
console.log(import_picocolors2.default.bold("Next steps:"));
|
|
9095
|
+
console.log(` 1. Open ${import_picocolors2.default.cyan("e2e-ai.instructions.md")} with your AI tool`);
|
|
9096
|
+
console.log(` 2. Review the generated ${import_picocolors2.default.cyan(".e2e-ai/context.md")}`);
|
|
9097
|
+
console.log(` 3. Customize agents in ${import_picocolors2.default.cyan(".e2e-ai/agents/")} if needed`);
|
|
9098
|
+
console.log(` 4. Run: ${import_picocolors2.default.cyan("e2e-ai run --key PROJ-101")}`);
|
|
9189
9099
|
});
|
|
9190
9100
|
}
|
|
9191
9101
|
function getDefaultAnswers() {
|
|
@@ -9248,7 +9158,7 @@ function buildConfigFromAnswers(answers) {
|
|
|
9248
9158
|
outputTarget: answers.outputTarget,
|
|
9249
9159
|
voice: { enabled: answers.voiceEnabled },
|
|
9250
9160
|
llm: { provider: answers.provider },
|
|
9251
|
-
contextFile: "e2e-ai
|
|
9161
|
+
contextFile: ".e2e-ai/context.md"
|
|
9252
9162
|
};
|
|
9253
9163
|
if (answers.baseUrl) {
|
|
9254
9164
|
config.baseUrl = answers.baseUrl;
|
|
@@ -9280,124 +9190,4051 @@ function generateConfigFile(config) {
|
|
|
9280
9190
|
return lines.join(`
|
|
9281
9191
|
`);
|
|
9282
9192
|
}
|
|
9283
|
-
|
|
9284
|
-
const
|
|
9285
|
-
const
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9193
|
+
function generateInstructionsFile(scan) {
|
|
9194
|
+
const packageRoot = getPackageRoot();
|
|
9195
|
+
const sections = [];
|
|
9196
|
+
sections.push(`# e2e-ai: Context Generation Instructions
|
|
9197
|
+
|
|
9198
|
+
This file was generated by \`e2e-ai init\`. It contains everything an AI tool needs to generate \`.e2e-ai/context.md\` for your project.
|
|
9199
|
+
|
|
9200
|
+
## How to Use
|
|
9201
|
+
|
|
9202
|
+
1. Open this file in your AI tool (Claude Code, Cursor, Gemini CLI, etc.)
|
|
9203
|
+
2. Ask it to follow these instructions to generate \`.e2e-ai/context.md\`
|
|
9204
|
+
3. Review the generated file and adjust as needed
|
|
9205
|
+
|
|
9206
|
+
Alternatively, if the e2e-ai MCP server is configured, your AI tool can call \`e2e_ai_scan_codebase\` and \`e2e_ai_validate_context\` directly.
|
|
9207
|
+
|
|
9208
|
+
---`);
|
|
9209
|
+
sections.push(`## Task
|
|
9210
|
+
|
|
9211
|
+
Scan this codebase and generate a file at \`.e2e-ai/context.md\` that documents the project's test infrastructure, conventions, and patterns. This context file is consumed by downstream AI agents (scenario, generator, refiner, healer, QA) to produce Playwright tests that match the project's existing style.`);
|
|
9212
|
+
sections.push(`## Codebase Scan Results
|
|
9213
|
+
|
|
9214
|
+
The following was pre-computed during \`e2e-ai init\`:
|
|
9215
|
+
|
|
9216
|
+
### Test Files (${scan.testFiles.length} found)
|
|
9217
|
+
${scan.testFiles.length > 0 ? scan.testFiles.slice(0, 20).map((f) => `- \`${f}\``).join(`
|
|
9218
|
+
`) : "_No test files found_"}
|
|
9219
|
+
${scan.testFiles.length > 20 ? `
|
|
9220
|
+
_(${scan.testFiles.length - 20} more not shown)_` : ""}
|
|
9221
|
+
|
|
9222
|
+
### Config Files
|
|
9223
|
+
${scan.configFiles.length > 0 ? scan.configFiles.map((f) => `- \`${f}\``).join(`
|
|
9224
|
+
`) : "_None found_"}
|
|
9225
|
+
|
|
9226
|
+
### Fixture Files
|
|
9227
|
+
${scan.fixtureFiles.length > 0 ? scan.fixtureFiles.slice(0, 10).map((f) => `- \`${f}\``).join(`
|
|
9228
|
+
`) : "_None found_"}
|
|
9229
|
+
|
|
9230
|
+
### Feature Files
|
|
9231
|
+
${scan.featureFiles.length > 0 ? scan.featureFiles.slice(0, 20).map((f) => `- \`${f}\``).join(`
|
|
9232
|
+
`) : "_None found_"}
|
|
9233
|
+
|
|
9234
|
+
### Path Aliases (from tsconfig.json)
|
|
9235
|
+
${Object.keys(scan.tsconfigPaths).length > 0 ? Object.entries(scan.tsconfigPaths).map(([alias, targets]) => `- \`${alias}\` -> \`${targets.join(", ")}\``).join(`
|
|
9236
|
+
`) : "_None configured_"}
|
|
9237
|
+
|
|
9238
|
+
### Playwright Config
|
|
9239
|
+
${scan.playwrightConfig ? `Found: \`${scan.playwrightConfig}\`` : "_Not found_"}
|
|
9240
|
+
|
|
9241
|
+
### Sample Test Content
|
|
9242
|
+
${scan.sampleTestContent ? "```typescript\n" + scan.sampleTestContent + "\n```" : "_No sample available_"}`);
|
|
9243
|
+
let agentChecklist = "";
|
|
9244
|
+
try {
|
|
9245
|
+
const agentContent = readFileSync2(join13(packageRoot, "agents", "init-agent.md"), "utf-8");
|
|
9246
|
+
const bodyMatch = agentContent.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
|
|
9247
|
+
if (bodyMatch) {
|
|
9248
|
+
agentChecklist = bodyMatch[1].trim();
|
|
9323
9249
|
}
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9250
|
+
} catch {}
|
|
9251
|
+
if (agentChecklist) {
|
|
9252
|
+
sections.push(`## What to Look For
|
|
9253
|
+
|
|
9254
|
+
The following guidance comes from the e2e-ai init agent:
|
|
9255
|
+
|
|
9256
|
+
${agentChecklist}`);
|
|
9257
|
+
}
|
|
9258
|
+
sections.push(`## Output Format
|
|
9259
|
+
|
|
9260
|
+
The generated \`.e2e-ai/context.md\` MUST contain these sections:
|
|
9261
|
+
|
|
9262
|
+
\`\`\`markdown
|
|
9263
|
+
# Project Context for e2e-ai
|
|
9264
|
+
|
|
9265
|
+
## Application
|
|
9266
|
+
<name, description, tech stack, base URL>
|
|
9267
|
+
|
|
9268
|
+
## Test Infrastructure
|
|
9269
|
+
<fixtures, helpers, auth pattern>
|
|
9270
|
+
|
|
9271
|
+
## Feature Methods
|
|
9272
|
+
<method signatures grouped by module>
|
|
9273
|
+
|
|
9274
|
+
## Import Conventions
|
|
9275
|
+
<path aliases, standard imports>
|
|
9276
|
+
|
|
9277
|
+
## Selector Conventions
|
|
9278
|
+
<preferred selector strategies, patterns>
|
|
9279
|
+
|
|
9280
|
+
## Test Structure Template
|
|
9281
|
+
<code template showing standard test layout>
|
|
9282
|
+
|
|
9283
|
+
## Utility Patterns
|
|
9284
|
+
<timeouts, waits, assertion patterns>
|
|
9285
|
+
\`\`\`
|
|
9286
|
+
|
|
9287
|
+
All sections are required. The file should be 100-300 lines, self-contained, and use actual code from the project (not generic Playwright examples).`);
|
|
9288
|
+
sections.push(`## How Context is Used
|
|
9289
|
+
|
|
9290
|
+
Each pipeline agent reads \`.e2e-ai/context.md\` to understand project conventions:
|
|
9291
|
+
|
|
9292
|
+
| Agent | Uses context for |
|
|
9293
|
+
|-------|-----------------|
|
|
9294
|
+
| **scenario-agent** | Structuring test steps to match project patterns |
|
|
9295
|
+
| **playwright-generator-agent** | Generating code with correct imports, fixtures, selectors |
|
|
9296
|
+
| **refactor-agent** | Applying project-specific refactoring patterns |
|
|
9297
|
+
| **self-healing-agent** | Understanding expected test structure when fixing failures |
|
|
9298
|
+
| **qa-testcase-agent** | Formatting QA documentation to match conventions |`);
|
|
9299
|
+
let exampleContent = "";
|
|
9300
|
+
try {
|
|
9301
|
+
exampleContent = readFileSync2(join13(packageRoot, "templates", "e2e-ai.context.example.md"), "utf-8");
|
|
9302
|
+
} catch {}
|
|
9303
|
+
if (exampleContent) {
|
|
9304
|
+
sections.push(`## Complete Example
|
|
9305
|
+
|
|
9306
|
+
Below is a full example of a well-structured context file:
|
|
9307
|
+
|
|
9308
|
+
${exampleContent}`);
|
|
9309
|
+
}
|
|
9310
|
+
return sections.join(`
|
|
9311
|
+
|
|
9312
|
+
`);
|
|
9313
|
+
}
|
|
9314
|
+
async function copyAgentsToLocal(projectRoot, nonInteractive) {
|
|
9315
|
+
const packageRoot = getPackageRoot();
|
|
9316
|
+
const sourceDir = join13(packageRoot, "agents");
|
|
9317
|
+
const targetDir = join13(projectRoot, ".e2e-ai", "agents");
|
|
9318
|
+
let agentFiles;
|
|
9319
|
+
try {
|
|
9320
|
+
agentFiles = readdirSync2(sourceDir).filter((f) => f.endsWith(".md"));
|
|
9321
|
+
} catch {
|
|
9322
|
+
warn("Could not read package agents directory");
|
|
9323
|
+
return 0;
|
|
9324
|
+
}
|
|
9325
|
+
if (agentFiles.length === 0)
|
|
9326
|
+
return 0;
|
|
9327
|
+
const targetExists = existsSync2(targetDir);
|
|
9328
|
+
if (targetExists) {
|
|
9329
|
+
const existingFiles = readdirSync2(targetDir).filter((f) => f.endsWith(".md"));
|
|
9330
|
+
if (existingFiles.length > 0) {
|
|
9331
|
+
if (nonInteractive) {
|
|
9332
|
+
info("Agent files already exist in .e2e-ai/agents/, skipping");
|
|
9333
|
+
return 0;
|
|
9334
|
+
}
|
|
9335
|
+
const overwrite = await dist_default4({
|
|
9336
|
+
message: `Agent files already exist in .e2e-ai/agents/ (${existingFiles.length} files). Overwrite?`,
|
|
9337
|
+
default: false
|
|
9338
|
+
});
|
|
9339
|
+
if (!overwrite) {
|
|
9340
|
+
info("Skipping agent copy");
|
|
9341
|
+
return 0;
|
|
9342
|
+
}
|
|
9337
9343
|
}
|
|
9338
9344
|
}
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9345
|
+
ensureDir(targetDir);
|
|
9346
|
+
for (const file of agentFiles) {
|
|
9347
|
+
const content = readFileSync2(join13(sourceDir, file), "utf-8");
|
|
9348
|
+
writeFile(join13(targetDir, file), content);
|
|
9342
9349
|
}
|
|
9343
|
-
|
|
9350
|
+
success(`Agents copied to .e2e-ai/agents/ (${agentFiles.length} files)`);
|
|
9351
|
+
return agentFiles.length;
|
|
9344
9352
|
}
|
|
9345
|
-
async function runInitConversation(scan, provider, model) {
|
|
9346
|
-
const agent = loadAgent("init-agent");
|
|
9347
|
-
const separator = import_picocolors2.default.dim("─".repeat(60));
|
|
9348
|
-
const messages = [];
|
|
9349
|
-
const scanMessage = JSON.stringify({
|
|
9350
|
-
testFiles: scan.testFiles.slice(0, 20),
|
|
9351
|
-
configFiles: scan.configFiles,
|
|
9352
|
-
fixtureFiles: scan.fixtureFiles.slice(0, 10),
|
|
9353
|
-
featureFiles: scan.featureFiles.slice(0, 20),
|
|
9354
|
-
tsconfigPaths: scan.tsconfigPaths,
|
|
9355
|
-
playwrightConfig: scan.playwrightConfig,
|
|
9356
|
-
sampleTestContent: scan.sampleTestContent
|
|
9357
|
-
}, null, 2);
|
|
9358
|
-
messages.push({ role: "user", content: `Here are the scan results from the project:
|
|
9359
9353
|
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
for (let turn = 0;turn < MAX_TURNS; turn++) {
|
|
9363
|
-
const userContent = messages.filter((m) => m.role === "user").map((m) => m.content).join(`
|
|
9354
|
+
// src/commands/scan.ts
|
|
9355
|
+
import { join as join15 } from "node:path";
|
|
9364
9356
|
|
|
9365
|
-
|
|
9357
|
+
// src/scanner/scanner.ts
|
|
9358
|
+
import { readFileSync as readFileSync4, existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
9359
|
+
import { resolve, relative as relative2 } from "node:path";
|
|
9360
|
+
import { createHash } from "node:crypto";
|
|
9366
9361
|
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9362
|
+
// node_modules/glob/dist/esm/index.min.js
|
|
9363
|
+
import { fileURLToPath as Wi } from "node:url";
|
|
9364
|
+
import { posix as mi, win32 as re } from "node:path";
|
|
9365
|
+
import { fileURLToPath as gi } from "node:url";
|
|
9366
|
+
import { lstatSync as wi, readdir as yi, readdirSync as bi, readlinkSync as Si, realpathSync as Ei } from "fs";
|
|
9367
|
+
import * as xi from "node:fs";
|
|
9368
|
+
import { lstat as Ci, readdir as Ti, readlink as Ai, realpath as ki } from "node:fs/promises";
|
|
9369
|
+
import { EventEmitter as ee } from "node:events";
|
|
9370
|
+
import Pe from "node:stream";
|
|
9371
|
+
import { StringDecoder as ni } from "node:string_decoder";
|
|
9372
|
+
var Gt = (n, t, e) => {
|
|
9373
|
+
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
9374
|
+
return r && { start: r[0], end: r[1], pre: e.slice(0, r[0]), body: e.slice(r[0] + s.length, r[1]), post: e.slice(r[1] + i.length) };
|
|
9375
|
+
};
|
|
9376
|
+
var ce = (n, t) => {
|
|
9377
|
+
let e = t.match(n);
|
|
9378
|
+
return e ? e[0] : null;
|
|
9379
|
+
};
|
|
9380
|
+
var ss = (n, t, e) => {
|
|
9381
|
+
let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
|
|
9382
|
+
if (a >= 0 && l > 0) {
|
|
9383
|
+
if (n === t)
|
|
9384
|
+
return [a, l];
|
|
9385
|
+
for (s = [], r = e.length;u >= 0 && !h; ) {
|
|
9386
|
+
if (u === a)
|
|
9387
|
+
s.push(u), a = e.indexOf(n, u + 1);
|
|
9388
|
+
else if (s.length === 1) {
|
|
9389
|
+
let c = s.pop();
|
|
9390
|
+
c !== undefined && (h = [c, l]);
|
|
9391
|
+
} else
|
|
9392
|
+
i = s.pop(), i !== undefined && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
|
|
9393
|
+
u = a < l && a >= 0 ? a : l;
|
|
9394
|
+
}
|
|
9395
|
+
s.length && o !== undefined && (h = [r, o]);
|
|
9396
|
+
}
|
|
9397
|
+
return h;
|
|
9398
|
+
};
|
|
9399
|
+
var fe = "\x00SLASH" + Math.random() + "\x00";
|
|
9400
|
+
var ue = "\x00OPEN" + Math.random() + "\x00";
|
|
9401
|
+
var qt = "\x00CLOSE" + Math.random() + "\x00";
|
|
9402
|
+
var de = "\x00COMMA" + Math.random() + "\x00";
|
|
9403
|
+
var pe = "\x00PERIOD" + Math.random() + "\x00";
|
|
9404
|
+
var is = new RegExp(fe, "g");
|
|
9405
|
+
var rs = new RegExp(ue, "g");
|
|
9406
|
+
var ns = new RegExp(qt, "g");
|
|
9407
|
+
var os2 = new RegExp(de, "g");
|
|
9408
|
+
var hs = new RegExp(pe, "g");
|
|
9409
|
+
var as = /\\\\/g;
|
|
9410
|
+
var ls = /\\{/g;
|
|
9411
|
+
var cs = /\\}/g;
|
|
9412
|
+
var fs = /\\,/g;
|
|
9413
|
+
var us = /\\./g;
|
|
9414
|
+
var ds = 1e5;
|
|
9415
|
+
function Ht(n) {
|
|
9416
|
+
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
9417
|
+
}
|
|
9418
|
+
function ps(n) {
|
|
9419
|
+
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
|
|
9420
|
+
}
|
|
9421
|
+
function ms(n) {
|
|
9422
|
+
return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os2, ",").replace(hs, ".");
|
|
9423
|
+
}
|
|
9424
|
+
function me(n) {
|
|
9425
|
+
if (!n)
|
|
9426
|
+
return [""];
|
|
9427
|
+
let t = [], e = Gt("{", "}", n);
|
|
9428
|
+
if (!e)
|
|
9429
|
+
return n.split(",");
|
|
9430
|
+
let { pre: s, body: i, post: r } = e, o = s.split(",");
|
|
9431
|
+
o[o.length - 1] += "{" + i + "}";
|
|
9432
|
+
let h = me(r);
|
|
9433
|
+
return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
|
|
9434
|
+
}
|
|
9435
|
+
function ge(n, t = {}) {
|
|
9436
|
+
if (!n)
|
|
9437
|
+
return [];
|
|
9438
|
+
let { max: e = ds } = t;
|
|
9439
|
+
return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, true).map(ms);
|
|
9440
|
+
}
|
|
9441
|
+
function gs(n) {
|
|
9442
|
+
return "{" + n + "}";
|
|
9443
|
+
}
|
|
9444
|
+
function ws(n) {
|
|
9445
|
+
return /^-?0\d/.test(n);
|
|
9446
|
+
}
|
|
9447
|
+
function ys(n, t) {
|
|
9448
|
+
return n <= t;
|
|
9449
|
+
}
|
|
9450
|
+
function bs(n, t) {
|
|
9451
|
+
return n >= t;
|
|
9452
|
+
}
|
|
9453
|
+
function ht(n, t, e) {
|
|
9454
|
+
let s = [], i = Gt("{", "}", n);
|
|
9455
|
+
if (!i)
|
|
9456
|
+
return [n];
|
|
9457
|
+
let r = i.pre, o = i.post.length ? ht(i.post, t, false) : [""];
|
|
9458
|
+
if (/\$$/.test(i.pre))
|
|
9459
|
+
for (let h = 0;h < o.length && h < t; h++) {
|
|
9460
|
+
let a = r + "{" + i.body + "}" + o[h];
|
|
9461
|
+
s.push(a);
|
|
9462
|
+
}
|
|
9463
|
+
else {
|
|
9464
|
+
let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
|
|
9465
|
+
if (!l && !u)
|
|
9466
|
+
return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, true)) : [n];
|
|
9467
|
+
let c;
|
|
9468
|
+
if (l)
|
|
9469
|
+
c = i.body.split(/\.\./);
|
|
9470
|
+
else if (c = me(i.body), c.length === 1 && c[0] !== undefined && (c = ht(c[0], t, false).map(gs), c.length === 1))
|
|
9471
|
+
return o.map((f) => i.pre + c[0] + f);
|
|
9472
|
+
let d;
|
|
9473
|
+
if (l && c[0] !== undefined && c[1] !== undefined) {
|
|
9474
|
+
let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== undefined ? Math.abs(Ht(c[2])) : 1, g = ys;
|
|
9475
|
+
m < f && (w *= -1, g = bs);
|
|
9476
|
+
let E = c.some(ws);
|
|
9477
|
+
d = [];
|
|
9478
|
+
for (let y = f;g(y, m); y += w) {
|
|
9479
|
+
let b;
|
|
9480
|
+
if (a)
|
|
9481
|
+
b = String.fromCharCode(y), b === "\\" && (b = "");
|
|
9482
|
+
else if (b = String(y), E) {
|
|
9483
|
+
let z = p - b.length;
|
|
9484
|
+
if (z > 0) {
|
|
9485
|
+
let $ = new Array(z + 1).join("0");
|
|
9486
|
+
y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
|
|
9487
|
+
}
|
|
9488
|
+
}
|
|
9489
|
+
d.push(b);
|
|
9490
|
+
}
|
|
9395
9491
|
} else {
|
|
9396
|
-
|
|
9492
|
+
d = [];
|
|
9493
|
+
for (let f = 0;f < c.length; f++)
|
|
9494
|
+
d.push.apply(d, ht(c[f], t, false));
|
|
9397
9495
|
}
|
|
9496
|
+
for (let f = 0;f < d.length; f++)
|
|
9497
|
+
for (let m = 0;m < o.length && s.length < t; m++) {
|
|
9498
|
+
let p = r + d[f] + o[m];
|
|
9499
|
+
(!e || l || p) && s.push(p);
|
|
9500
|
+
}
|
|
9398
9501
|
}
|
|
9399
|
-
|
|
9400
|
-
|
|
9502
|
+
return s;
|
|
9503
|
+
}
|
|
9504
|
+
var at = (n) => {
|
|
9505
|
+
if (typeof n != "string")
|
|
9506
|
+
throw new TypeError("invalid pattern");
|
|
9507
|
+
if (n.length > 65536)
|
|
9508
|
+
throw new TypeError("pattern is too long");
|
|
9509
|
+
};
|
|
9510
|
+
var Ss = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true], "[:alpha:]": ["\\p{L}\\p{Nl}", true], "[:ascii:]": ["\\x00-\\x7f", false], "[:blank:]": ["\\p{Zs}\\t", true], "[:cntrl:]": ["\\p{Cc}", true], "[:digit:]": ["\\p{Nd}", true], "[:graph:]": ["\\p{Z}\\p{C}", true, true], "[:lower:]": ["\\p{Ll}", true], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}", true], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true], "[:upper:]": ["\\p{Lu}", true], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true], "[:xdigit:]": ["A-Fa-f0-9", false] };
|
|
9511
|
+
var lt = (n) => n.replace(/[[\]\\-]/g, "\\$&");
|
|
9512
|
+
var Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
9513
|
+
var we = (n) => n.join("");
|
|
9514
|
+
var ye = (n, t) => {
|
|
9515
|
+
let e = t;
|
|
9516
|
+
if (n.charAt(e) !== "[")
|
|
9517
|
+
throw new Error("not in a brace expression");
|
|
9518
|
+
let s = [], i = [], r = e + 1, o = false, h = false, a = false, l = false, u = e, c = "";
|
|
9519
|
+
t:
|
|
9520
|
+
for (;r < n.length; ) {
|
|
9521
|
+
let p = n.charAt(r);
|
|
9522
|
+
if ((p === "!" || p === "^") && r === e + 1) {
|
|
9523
|
+
l = true, r++;
|
|
9524
|
+
continue;
|
|
9525
|
+
}
|
|
9526
|
+
if (p === "]" && o && !a) {
|
|
9527
|
+
u = r + 1;
|
|
9528
|
+
break;
|
|
9529
|
+
}
|
|
9530
|
+
if (o = true, p === "\\" && !a) {
|
|
9531
|
+
a = true, r++;
|
|
9532
|
+
continue;
|
|
9533
|
+
}
|
|
9534
|
+
if (p === "[" && !a) {
|
|
9535
|
+
for (let [w, [g, S, E]] of Object.entries(Ss))
|
|
9536
|
+
if (n.startsWith(w, r)) {
|
|
9537
|
+
if (c)
|
|
9538
|
+
return ["$.", false, n.length - e, true];
|
|
9539
|
+
r += w.length, E ? i.push(g) : s.push(g), h = h || S;
|
|
9540
|
+
continue t;
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9543
|
+
if (a = false, c) {
|
|
9544
|
+
p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
|
|
9545
|
+
continue;
|
|
9546
|
+
}
|
|
9547
|
+
if (n.startsWith("-]", r + 1)) {
|
|
9548
|
+
s.push(lt(p + "-")), r += 2;
|
|
9549
|
+
continue;
|
|
9550
|
+
}
|
|
9551
|
+
if (n.startsWith("-", r + 1)) {
|
|
9552
|
+
c = p, r += 2;
|
|
9553
|
+
continue;
|
|
9554
|
+
}
|
|
9555
|
+
s.push(lt(p)), r++;
|
|
9556
|
+
}
|
|
9557
|
+
if (u < r)
|
|
9558
|
+
return ["", false, 0, false];
|
|
9559
|
+
if (!s.length && !i.length)
|
|
9560
|
+
return ["$.", false, n.length - e, true];
|
|
9561
|
+
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) {
|
|
9562
|
+
let p = s[0].length === 2 ? s[0].slice(-1) : s[0];
|
|
9563
|
+
return [Es(p), false, u - e, false];
|
|
9564
|
+
}
|
|
9565
|
+
let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
|
|
9566
|
+
return [s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f, h, u - e, true];
|
|
9567
|
+
};
|
|
9568
|
+
var W = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
9569
|
+
var xs = new Set(["!", "?", "+", "*", "@"]);
|
|
9570
|
+
var be = (n) => xs.has(n);
|
|
9571
|
+
var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
9572
|
+
var Ct = "(?!\\.)";
|
|
9573
|
+
var Cs = new Set(["[", "."]);
|
|
9574
|
+
var Ts = new Set(["..", "."]);
|
|
9575
|
+
var As = new Set("().*{}+?[]^$\\!");
|
|
9576
|
+
var ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
9577
|
+
var Kt = "[^/]";
|
|
9578
|
+
var Se = Kt + "*?";
|
|
9579
|
+
var Ee = Kt + "+?";
|
|
9580
|
+
var Q = class n {
|
|
9581
|
+
type;
|
|
9582
|
+
#t;
|
|
9583
|
+
#s;
|
|
9584
|
+
#n = false;
|
|
9585
|
+
#r = [];
|
|
9586
|
+
#o;
|
|
9587
|
+
#S;
|
|
9588
|
+
#w;
|
|
9589
|
+
#c = false;
|
|
9590
|
+
#h;
|
|
9591
|
+
#u;
|
|
9592
|
+
#f = false;
|
|
9593
|
+
constructor(t, e, s = {}) {
|
|
9594
|
+
this.type = t, t && (this.#s = true), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
|
|
9595
|
+
}
|
|
9596
|
+
get hasMagic() {
|
|
9597
|
+
if (this.#s !== undefined)
|
|
9598
|
+
return this.#s;
|
|
9599
|
+
for (let t of this.#r)
|
|
9600
|
+
if (typeof t != "string" && (t.type || t.hasMagic))
|
|
9601
|
+
return this.#s = true;
|
|
9602
|
+
return this.#s;
|
|
9603
|
+
}
|
|
9604
|
+
toString() {
|
|
9605
|
+
return this.#u !== undefined ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
|
|
9606
|
+
}
|
|
9607
|
+
#a() {
|
|
9608
|
+
if (this !== this.#t)
|
|
9609
|
+
throw new Error("should only call on root");
|
|
9610
|
+
if (this.#c)
|
|
9611
|
+
return this;
|
|
9612
|
+
this.toString(), this.#c = true;
|
|
9613
|
+
let t;
|
|
9614
|
+
for (;t = this.#w.pop(); ) {
|
|
9615
|
+
if (t.type !== "!")
|
|
9616
|
+
continue;
|
|
9617
|
+
let e = t, s = e.#o;
|
|
9618
|
+
for (;s; ) {
|
|
9619
|
+
for (let i = e.#S + 1;!s.type && i < s.#r.length; i++)
|
|
9620
|
+
for (let r of t.#r) {
|
|
9621
|
+
if (typeof r == "string")
|
|
9622
|
+
throw new Error("string part in extglob AST??");
|
|
9623
|
+
r.copyIn(s.#r[i]);
|
|
9624
|
+
}
|
|
9625
|
+
e = s, s = e.#o;
|
|
9626
|
+
}
|
|
9627
|
+
}
|
|
9628
|
+
return this;
|
|
9629
|
+
}
|
|
9630
|
+
push(...t) {
|
|
9631
|
+
for (let e of t)
|
|
9632
|
+
if (e !== "") {
|
|
9633
|
+
if (typeof e != "string" && !(e instanceof n && e.#o === this))
|
|
9634
|
+
throw new Error("invalid part: " + e);
|
|
9635
|
+
this.#r.push(e);
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
toJSON() {
|
|
9639
|
+
let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
|
|
9640
|
+
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
|
|
9641
|
+
}
|
|
9642
|
+
isStart() {
|
|
9643
|
+
if (this.#t === this)
|
|
9644
|
+
return true;
|
|
9645
|
+
if (!this.#o?.isStart())
|
|
9646
|
+
return false;
|
|
9647
|
+
if (this.#S === 0)
|
|
9648
|
+
return true;
|
|
9649
|
+
let t = this.#o;
|
|
9650
|
+
for (let e = 0;e < this.#S; e++) {
|
|
9651
|
+
let s = t.#r[e];
|
|
9652
|
+
if (!(s instanceof n && s.type === "!"))
|
|
9653
|
+
return false;
|
|
9654
|
+
}
|
|
9655
|
+
return true;
|
|
9656
|
+
}
|
|
9657
|
+
isEnd() {
|
|
9658
|
+
if (this.#t === this || this.#o?.type === "!")
|
|
9659
|
+
return true;
|
|
9660
|
+
if (!this.#o?.isEnd())
|
|
9661
|
+
return false;
|
|
9662
|
+
if (!this.type)
|
|
9663
|
+
return this.#o?.isEnd();
|
|
9664
|
+
let t = this.#o ? this.#o.#r.length : 0;
|
|
9665
|
+
return this.#S === t - 1;
|
|
9666
|
+
}
|
|
9667
|
+
copyIn(t) {
|
|
9668
|
+
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
9669
|
+
}
|
|
9670
|
+
clone(t) {
|
|
9671
|
+
let e = new n(this.type, t);
|
|
9672
|
+
for (let s of this.#r)
|
|
9673
|
+
e.copyIn(s);
|
|
9674
|
+
return e;
|
|
9675
|
+
}
|
|
9676
|
+
static #i(t, e, s, i) {
|
|
9677
|
+
let r = false, o = false, h = -1, a = false;
|
|
9678
|
+
if (e.type === null) {
|
|
9679
|
+
let f = s, m = "";
|
|
9680
|
+
for (;f < t.length; ) {
|
|
9681
|
+
let p = t.charAt(f++);
|
|
9682
|
+
if (r || p === "\\") {
|
|
9683
|
+
r = !r, m += p;
|
|
9684
|
+
continue;
|
|
9685
|
+
}
|
|
9686
|
+
if (o) {
|
|
9687
|
+
f === h + 1 ? (p === "^" || p === "!") && (a = true) : p === "]" && !(f === h + 2 && a) && (o = false), m += p;
|
|
9688
|
+
continue;
|
|
9689
|
+
} else if (p === "[") {
|
|
9690
|
+
o = true, h = f, a = false, m += p;
|
|
9691
|
+
continue;
|
|
9692
|
+
}
|
|
9693
|
+
if (!i.noext && be(p) && t.charAt(f) === "(") {
|
|
9694
|
+
e.push(m), m = "";
|
|
9695
|
+
let w = new n(p, e);
|
|
9696
|
+
f = n.#i(t, w, f, i), e.push(w);
|
|
9697
|
+
continue;
|
|
9698
|
+
}
|
|
9699
|
+
m += p;
|
|
9700
|
+
}
|
|
9701
|
+
return e.push(m), f;
|
|
9702
|
+
}
|
|
9703
|
+
let l = s + 1, u = new n(null, e), c = [], d = "";
|
|
9704
|
+
for (;l < t.length; ) {
|
|
9705
|
+
let f = t.charAt(l++);
|
|
9706
|
+
if (r || f === "\\") {
|
|
9707
|
+
r = !r, d += f;
|
|
9708
|
+
continue;
|
|
9709
|
+
}
|
|
9710
|
+
if (o) {
|
|
9711
|
+
l === h + 1 ? (f === "^" || f === "!") && (a = true) : f === "]" && !(l === h + 2 && a) && (o = false), d += f;
|
|
9712
|
+
continue;
|
|
9713
|
+
} else if (f === "[") {
|
|
9714
|
+
o = true, h = l, a = false, d += f;
|
|
9715
|
+
continue;
|
|
9716
|
+
}
|
|
9717
|
+
if (be(f) && t.charAt(l) === "(") {
|
|
9718
|
+
u.push(d), d = "";
|
|
9719
|
+
let m = new n(f, u);
|
|
9720
|
+
u.push(m), l = n.#i(t, m, l, i);
|
|
9721
|
+
continue;
|
|
9722
|
+
}
|
|
9723
|
+
if (f === "|") {
|
|
9724
|
+
u.push(d), d = "", c.push(u), u = new n(null, e);
|
|
9725
|
+
continue;
|
|
9726
|
+
}
|
|
9727
|
+
if (f === ")")
|
|
9728
|
+
return d === "" && e.#r.length === 0 && (e.#f = true), u.push(d), d = "", e.push(...c, u), l;
|
|
9729
|
+
d += f;
|
|
9730
|
+
}
|
|
9731
|
+
return e.type = null, e.#s = undefined, e.#r = [t.substring(s - 1)], l;
|
|
9732
|
+
}
|
|
9733
|
+
static fromGlob(t, e = {}) {
|
|
9734
|
+
let s = new n(null, undefined, e);
|
|
9735
|
+
return n.#i(t, s, 0, e), s;
|
|
9736
|
+
}
|
|
9737
|
+
toMMPattern() {
|
|
9738
|
+
if (this !== this.#t)
|
|
9739
|
+
return this.#t.toMMPattern();
|
|
9740
|
+
let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
9741
|
+
if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
|
|
9742
|
+
return s;
|
|
9743
|
+
let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
|
|
9744
|
+
return Object.assign(new RegExp(`^${e}$`, h), { _src: e, _glob: t });
|
|
9745
|
+
}
|
|
9746
|
+
get options() {
|
|
9747
|
+
return this.#h;
|
|
9748
|
+
}
|
|
9749
|
+
toRegExpSource(t) {
|
|
9750
|
+
let e = t ?? !!this.#h.dot;
|
|
9751
|
+
if (this.#t === this && this.#a(), !this.type) {
|
|
9752
|
+
let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
|
|
9753
|
+
let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
|
|
9754
|
+
return this.#s = this.#s || w, this.#n = this.#n || g, m;
|
|
9755
|
+
}).join(""), u = "";
|
|
9756
|
+
if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
|
|
9757
|
+
let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
|
|
9758
|
+
u = p ? vs : w ? Ct : "";
|
|
9759
|
+
}
|
|
9760
|
+
let c = "";
|
|
9761
|
+
return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [u + l + c, W(l), this.#s = !!this.#s, this.#n];
|
|
9762
|
+
}
|
|
9763
|
+
let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
|
|
9764
|
+
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
9765
|
+
let a = this.toString();
|
|
9766
|
+
return this.#r = [a], this.type = null, this.#s = undefined, [a, W(this.toString()), false, false];
|
|
9767
|
+
}
|
|
9768
|
+
let o = !s || t || e || !Ct ? "" : this.#d(true);
|
|
9769
|
+
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
9770
|
+
let h = "";
|
|
9771
|
+
if (this.type === "!" && this.#f)
|
|
9772
|
+
h = (this.isStart() && !e ? Ct : "") + Ee;
|
|
9773
|
+
else {
|
|
9774
|
+
let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
9775
|
+
h = i + r + a;
|
|
9776
|
+
}
|
|
9777
|
+
return [h, W(r), this.#s = !!this.#s, this.#n];
|
|
9778
|
+
}
|
|
9779
|
+
#d(t) {
|
|
9780
|
+
return this.#r.map((e) => {
|
|
9781
|
+
if (typeof e == "string")
|
|
9782
|
+
throw new Error("string type in extglob ast??");
|
|
9783
|
+
let [s, i, r, o] = e.toRegExpSource(t);
|
|
9784
|
+
return this.#n = this.#n || o, s;
|
|
9785
|
+
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
9786
|
+
}
|
|
9787
|
+
static #E(t, e, s = false) {
|
|
9788
|
+
let i = false, r = "", o = false, h = false;
|
|
9789
|
+
for (let a = 0;a < t.length; a++) {
|
|
9790
|
+
let l = t.charAt(a);
|
|
9791
|
+
if (i) {
|
|
9792
|
+
i = false, r += (As.has(l) ? "\\" : "") + l;
|
|
9793
|
+
continue;
|
|
9794
|
+
}
|
|
9795
|
+
if (l === "*") {
|
|
9796
|
+
if (h)
|
|
9797
|
+
continue;
|
|
9798
|
+
h = true, r += s && /^[*]+$/.test(t) ? Ee : Se, e = true;
|
|
9799
|
+
continue;
|
|
9800
|
+
} else
|
|
9801
|
+
h = false;
|
|
9802
|
+
if (l === "\\") {
|
|
9803
|
+
a === t.length - 1 ? r += "\\\\" : i = true;
|
|
9804
|
+
continue;
|
|
9805
|
+
}
|
|
9806
|
+
if (l === "[") {
|
|
9807
|
+
let [u, c, d, f] = ye(t, a);
|
|
9808
|
+
if (d) {
|
|
9809
|
+
r += u, o = o || c, a += d - 1, e = e || f;
|
|
9810
|
+
continue;
|
|
9811
|
+
}
|
|
9812
|
+
}
|
|
9813
|
+
if (l === "?") {
|
|
9814
|
+
r += Kt, e = true;
|
|
9815
|
+
continue;
|
|
9816
|
+
}
|
|
9817
|
+
r += ks(l);
|
|
9818
|
+
}
|
|
9819
|
+
return [r, W(t), !!e, o];
|
|
9820
|
+
}
|
|
9821
|
+
};
|
|
9822
|
+
var tt = (n2, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n2.replace(/[?*()[\]{}]/g, "[$&]") : n2.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n2.replace(/[?*()[\]]/g, "[$&]") : n2.replace(/[?*()[\]\\]/g, "\\$&");
|
|
9823
|
+
var O = (n2, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? false : new D(t, e).match(n2));
|
|
9824
|
+
var Rs = /^\*+([^+@!?\*\[\(]*)$/;
|
|
9825
|
+
var Os = (n2) => (t) => !t.startsWith(".") && t.endsWith(n2);
|
|
9826
|
+
var Fs = (n2) => (t) => t.endsWith(n2);
|
|
9827
|
+
var Ds = (n2) => (n2 = n2.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n2));
|
|
9828
|
+
var Ms = (n2) => (n2 = n2.toLowerCase(), (t) => t.toLowerCase().endsWith(n2));
|
|
9829
|
+
var Ns = /^\*+\.\*+$/;
|
|
9830
|
+
var _s = (n2) => !n2.startsWith(".") && n2.includes(".");
|
|
9831
|
+
var Ls = (n2) => n2 !== "." && n2 !== ".." && n2.includes(".");
|
|
9832
|
+
var Ws = /^\.\*+$/;
|
|
9833
|
+
var Ps = (n2) => n2 !== "." && n2 !== ".." && n2.startsWith(".");
|
|
9834
|
+
var js = /^\*+$/;
|
|
9835
|
+
var Is = (n2) => n2.length !== 0 && !n2.startsWith(".");
|
|
9836
|
+
var zs = (n2) => n2.length !== 0 && n2 !== "." && n2 !== "..";
|
|
9837
|
+
var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
9838
|
+
var Us = ([n2, t = ""]) => {
|
|
9839
|
+
let e = Ce([n2]);
|
|
9840
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
9841
|
+
};
|
|
9842
|
+
var $s = ([n2, t = ""]) => {
|
|
9843
|
+
let e = Te([n2]);
|
|
9844
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
9845
|
+
};
|
|
9846
|
+
var Gs = ([n2, t = ""]) => {
|
|
9847
|
+
let e = Te([n2]);
|
|
9848
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
9849
|
+
};
|
|
9850
|
+
var Hs = ([n2, t = ""]) => {
|
|
9851
|
+
let e = Ce([n2]);
|
|
9852
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
9853
|
+
};
|
|
9854
|
+
var Ce = ([n2]) => {
|
|
9855
|
+
let t = n2.length;
|
|
9856
|
+
return (e) => e.length === t && !e.startsWith(".");
|
|
9857
|
+
};
|
|
9858
|
+
var Te = ([n2]) => {
|
|
9859
|
+
let t = n2.length;
|
|
9860
|
+
return (e) => e.length === t && e !== "." && e !== "..";
|
|
9861
|
+
};
|
|
9862
|
+
var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
9863
|
+
var xe = { win32: { sep: "\\" }, posix: { sep: "/" } };
|
|
9864
|
+
var qs = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
|
|
9865
|
+
O.sep = qs;
|
|
9866
|
+
var A = Symbol("globstar **");
|
|
9867
|
+
O.GLOBSTAR = A;
|
|
9868
|
+
var Ks = "[^/]";
|
|
9869
|
+
var Vs = Ks + "*?";
|
|
9870
|
+
var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
9871
|
+
var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
9872
|
+
var Js = (n2, t = {}) => (e) => O(e, n2, t);
|
|
9873
|
+
O.filter = Js;
|
|
9874
|
+
var N = (n2, t = {}) => Object.assign({}, n2, t);
|
|
9875
|
+
var Zs = (n2) => {
|
|
9876
|
+
if (!n2 || typeof n2 != "object" || !Object.keys(n2).length)
|
|
9877
|
+
return O;
|
|
9878
|
+
let t = O;
|
|
9879
|
+
return Object.assign((s, i, r = {}) => t(s, i, N(n2, r)), { Minimatch: class extends t.Minimatch {
|
|
9880
|
+
constructor(i, r = {}) {
|
|
9881
|
+
super(i, N(n2, r));
|
|
9882
|
+
}
|
|
9883
|
+
static defaults(i) {
|
|
9884
|
+
return t.defaults(N(n2, i)).Minimatch;
|
|
9885
|
+
}
|
|
9886
|
+
}, AST: class extends t.AST {
|
|
9887
|
+
constructor(i, r, o = {}) {
|
|
9888
|
+
super(i, r, N(n2, o));
|
|
9889
|
+
}
|
|
9890
|
+
static fromGlob(i, r = {}) {
|
|
9891
|
+
return t.AST.fromGlob(i, N(n2, r));
|
|
9892
|
+
}
|
|
9893
|
+
}, unescape: (s, i = {}) => t.unescape(s, N(n2, i)), escape: (s, i = {}) => t.escape(s, N(n2, i)), filter: (s, i = {}) => t.filter(s, N(n2, i)), defaults: (s) => t.defaults(N(n2, s)), makeRe: (s, i = {}) => t.makeRe(s, N(n2, i)), braceExpand: (s, i = {}) => t.braceExpand(s, N(n2, i)), match: (s, i, r = {}) => t.match(s, i, N(n2, r)), sep: t.sep, GLOBSTAR: A });
|
|
9894
|
+
};
|
|
9895
|
+
O.defaults = Zs;
|
|
9896
|
+
var ke = (n2, t = {}) => (at(n2), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n2) ? [n2] : ge(n2, { max: t.braceExpandMax }));
|
|
9897
|
+
O.braceExpand = ke;
|
|
9898
|
+
var Qs = (n2, t = {}) => new D(n2, t).makeRe();
|
|
9899
|
+
O.makeRe = Qs;
|
|
9900
|
+
var ti = (n2, t, e = {}) => {
|
|
9901
|
+
let s = new D(t, e);
|
|
9902
|
+
return n2 = n2.filter((i) => s.match(i)), s.options.nonull && !n2.length && n2.push(t), n2;
|
|
9903
|
+
};
|
|
9904
|
+
O.match = ti;
|
|
9905
|
+
var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
9906
|
+
var ei = (n2) => n2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
9907
|
+
var D = class {
|
|
9908
|
+
options;
|
|
9909
|
+
set;
|
|
9910
|
+
pattern;
|
|
9911
|
+
windowsPathsNoEscape;
|
|
9912
|
+
nonegate;
|
|
9913
|
+
negate;
|
|
9914
|
+
comment;
|
|
9915
|
+
empty;
|
|
9916
|
+
preserveMultipleSlashes;
|
|
9917
|
+
partial;
|
|
9918
|
+
globSet;
|
|
9919
|
+
globParts;
|
|
9920
|
+
nocase;
|
|
9921
|
+
isWindows;
|
|
9922
|
+
platform;
|
|
9923
|
+
windowsNoMagicRoot;
|
|
9924
|
+
regexp;
|
|
9925
|
+
constructor(t, e = {}) {
|
|
9926
|
+
at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
|
|
9927
|
+
let s = "allowWindowsEscape";
|
|
9928
|
+
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== undefined ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
|
|
9929
|
+
}
|
|
9930
|
+
hasMagic() {
|
|
9931
|
+
if (this.options.magicalBraces && this.set.length > 1)
|
|
9932
|
+
return true;
|
|
9933
|
+
for (let t of this.set)
|
|
9934
|
+
for (let e of t)
|
|
9935
|
+
if (typeof e != "string")
|
|
9936
|
+
return true;
|
|
9937
|
+
return false;
|
|
9938
|
+
}
|
|
9939
|
+
debug(...t) {}
|
|
9940
|
+
make() {
|
|
9941
|
+
let t = this.pattern, e = this.options;
|
|
9942
|
+
if (!e.nocomment && t.charAt(0) === "#") {
|
|
9943
|
+
this.comment = true;
|
|
9944
|
+
return;
|
|
9945
|
+
}
|
|
9946
|
+
if (!t) {
|
|
9947
|
+
this.empty = true;
|
|
9948
|
+
return;
|
|
9949
|
+
}
|
|
9950
|
+
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
|
|
9951
|
+
let s = this.globSet.map((r) => this.slashSplit(r));
|
|
9952
|
+
this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
|
|
9953
|
+
let i = this.globParts.map((r, o, h) => {
|
|
9954
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
9955
|
+
let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
|
|
9956
|
+
if (a)
|
|
9957
|
+
return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
|
|
9958
|
+
if (l)
|
|
9959
|
+
return [r[0], ...r.slice(1).map((u) => this.parse(u))];
|
|
9960
|
+
}
|
|
9961
|
+
return r.map((a) => this.parse(a));
|
|
9962
|
+
});
|
|
9963
|
+
if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows)
|
|
9964
|
+
for (let r = 0;r < this.set.length; r++) {
|
|
9965
|
+
let o = this.set[r];
|
|
9966
|
+
o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
|
|
9967
|
+
}
|
|
9968
|
+
this.debug(this.pattern, this.set);
|
|
9969
|
+
}
|
|
9970
|
+
preprocess(t) {
|
|
9971
|
+
if (this.options.noglobstar)
|
|
9972
|
+
for (let s = 0;s < t.length; s++)
|
|
9973
|
+
for (let i = 0;i < t[s].length; i++)
|
|
9974
|
+
t[s][i] === "**" && (t[s][i] = "*");
|
|
9975
|
+
let { optimizationLevel: e = 1 } = this.options;
|
|
9976
|
+
return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
|
|
9977
|
+
}
|
|
9978
|
+
adjascentGlobstarOptimize(t) {
|
|
9979
|
+
return t.map((e) => {
|
|
9980
|
+
let s = -1;
|
|
9981
|
+
for (;(s = e.indexOf("**", s + 1)) !== -1; ) {
|
|
9982
|
+
let i = s;
|
|
9983
|
+
for (;e[i + 1] === "**"; )
|
|
9984
|
+
i++;
|
|
9985
|
+
i !== s && e.splice(s, i - s);
|
|
9986
|
+
}
|
|
9987
|
+
return e;
|
|
9988
|
+
});
|
|
9989
|
+
}
|
|
9990
|
+
levelOneOptimize(t) {
|
|
9991
|
+
return t.map((e) => (e = e.reduce((s, i) => {
|
|
9992
|
+
let r = s[s.length - 1];
|
|
9993
|
+
return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
|
|
9994
|
+
}, []), e.length === 0 ? [""] : e));
|
|
9995
|
+
}
|
|
9996
|
+
levelTwoFileOptimize(t) {
|
|
9997
|
+
Array.isArray(t) || (t = this.slashSplit(t));
|
|
9998
|
+
let e = false;
|
|
9999
|
+
do {
|
|
10000
|
+
if (e = false, !this.preserveMultipleSlashes) {
|
|
10001
|
+
for (let i = 1;i < t.length - 1; i++) {
|
|
10002
|
+
let r = t[i];
|
|
10003
|
+
i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i, 1), i--);
|
|
10004
|
+
}
|
|
10005
|
+
t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop());
|
|
10006
|
+
}
|
|
10007
|
+
let s = 0;
|
|
10008
|
+
for (;(s = t.indexOf("..", s + 1)) !== -1; ) {
|
|
10009
|
+
let i = t[s - 1];
|
|
10010
|
+
i && i !== "." && i !== ".." && i !== "**" && (e = true, t.splice(s - 1, 2), s -= 2);
|
|
10011
|
+
}
|
|
10012
|
+
} while (e);
|
|
10013
|
+
return t.length === 0 ? [""] : t;
|
|
10014
|
+
}
|
|
10015
|
+
firstPhasePreProcess(t) {
|
|
10016
|
+
let e = false;
|
|
10017
|
+
do {
|
|
10018
|
+
e = false;
|
|
10019
|
+
for (let s of t) {
|
|
10020
|
+
let i = -1;
|
|
10021
|
+
for (;(i = s.indexOf("**", i + 1)) !== -1; ) {
|
|
10022
|
+
let o = i;
|
|
10023
|
+
for (;s[o + 1] === "**"; )
|
|
10024
|
+
o++;
|
|
10025
|
+
o > i && s.splice(i + 1, o - i);
|
|
10026
|
+
let h = s[i + 1], a = s[i + 2], l = s[i + 3];
|
|
10027
|
+
if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..")
|
|
10028
|
+
continue;
|
|
10029
|
+
e = true, s.splice(i, 1);
|
|
10030
|
+
let u = s.slice(0);
|
|
10031
|
+
u[i] = "**", t.push(u), i--;
|
|
10032
|
+
}
|
|
10033
|
+
if (!this.preserveMultipleSlashes) {
|
|
10034
|
+
for (let o = 1;o < s.length - 1; o++) {
|
|
10035
|
+
let h = s[o];
|
|
10036
|
+
o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = true, s.splice(o, 1), o--);
|
|
10037
|
+
}
|
|
10038
|
+
s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop());
|
|
10039
|
+
}
|
|
10040
|
+
let r = 0;
|
|
10041
|
+
for (;(r = s.indexOf("..", r + 1)) !== -1; ) {
|
|
10042
|
+
let o = s[r - 1];
|
|
10043
|
+
if (o && o !== "." && o !== ".." && o !== "**") {
|
|
10044
|
+
e = true;
|
|
10045
|
+
let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
|
|
10046
|
+
s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
|
|
10047
|
+
}
|
|
10048
|
+
}
|
|
10049
|
+
}
|
|
10050
|
+
} while (e);
|
|
10051
|
+
return t;
|
|
10052
|
+
}
|
|
10053
|
+
secondPhasePreProcess(t) {
|
|
10054
|
+
for (let e = 0;e < t.length - 1; e++)
|
|
10055
|
+
for (let s = e + 1;s < t.length; s++) {
|
|
10056
|
+
let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
10057
|
+
if (i) {
|
|
10058
|
+
t[e] = [], t[s] = i;
|
|
10059
|
+
break;
|
|
10060
|
+
}
|
|
10061
|
+
}
|
|
10062
|
+
return t.filter((e) => e.length);
|
|
10063
|
+
}
|
|
10064
|
+
partsMatch(t, e, s = false) {
|
|
10065
|
+
let i = 0, r = 0, o = [], h = "";
|
|
10066
|
+
for (;i < t.length && r < e.length; )
|
|
10067
|
+
if (t[i] === e[r])
|
|
10068
|
+
o.push(h === "b" ? e[r] : t[i]), i++, r++;
|
|
10069
|
+
else if (s && t[i] === "**" && e[r] === t[i + 1])
|
|
10070
|
+
o.push(t[i]), i++;
|
|
10071
|
+
else if (s && e[r] === "**" && t[i] === e[r + 1])
|
|
10072
|
+
o.push(e[r]), r++;
|
|
10073
|
+
else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
|
|
10074
|
+
if (h === "b")
|
|
10075
|
+
return false;
|
|
10076
|
+
h = "a", o.push(t[i]), i++, r++;
|
|
10077
|
+
} else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
10078
|
+
if (h === "a")
|
|
10079
|
+
return false;
|
|
10080
|
+
h = "b", o.push(e[r]), i++, r++;
|
|
10081
|
+
} else
|
|
10082
|
+
return false;
|
|
10083
|
+
return t.length === e.length && o;
|
|
10084
|
+
}
|
|
10085
|
+
parseNegate() {
|
|
10086
|
+
if (this.nonegate)
|
|
10087
|
+
return;
|
|
10088
|
+
let t = this.pattern, e = false, s = 0;
|
|
10089
|
+
for (let i = 0;i < t.length && t.charAt(i) === "!"; i++)
|
|
10090
|
+
e = !e, s++;
|
|
10091
|
+
s && (this.pattern = t.slice(s)), this.negate = e;
|
|
10092
|
+
}
|
|
10093
|
+
matchOne(t, e, s = false) {
|
|
10094
|
+
let i = this.options;
|
|
10095
|
+
if (this.isWindows) {
|
|
10096
|
+
let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w ? 3 : p ? 0 : undefined, y = S ? 3 : g ? 0 : undefined;
|
|
10097
|
+
if (typeof E == "number" && typeof y == "number") {
|
|
10098
|
+
let [b, z] = [t[E], e[y]];
|
|
10099
|
+
b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
|
|
10100
|
+
}
|
|
10101
|
+
}
|
|
10102
|
+
let { optimizationLevel: r = 1 } = this.options;
|
|
10103
|
+
r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
|
|
10104
|
+
for (var o = 0, h = 0, a = t.length, l = e.length;o < a && h < l; o++, h++) {
|
|
10105
|
+
this.debug("matchOne loop");
|
|
10106
|
+
var u = e[h], c = t[o];
|
|
10107
|
+
if (this.debug(e, u, c), u === false)
|
|
10108
|
+
return false;
|
|
10109
|
+
if (u === A) {
|
|
10110
|
+
this.debug("GLOBSTAR", [e, u, c]);
|
|
10111
|
+
var d = o, f = h + 1;
|
|
10112
|
+
if (f === l) {
|
|
10113
|
+
for (this.debug("** at the end");o < a; o++)
|
|
10114
|
+
if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".")
|
|
10115
|
+
return false;
|
|
10116
|
+
return true;
|
|
10117
|
+
}
|
|
10118
|
+
for (;d < a; ) {
|
|
10119
|
+
var m = t[d];
|
|
10120
|
+
if (this.debug(`
|
|
10121
|
+
globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s))
|
|
10122
|
+
return this.debug("globstar found match!", d, a, m), true;
|
|
10123
|
+
if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
|
|
10124
|
+
this.debug("dot detected!", t, d, e, f);
|
|
10125
|
+
break;
|
|
10126
|
+
}
|
|
10127
|
+
this.debug("globstar swallow a segment, and continue"), d++;
|
|
10128
|
+
}
|
|
10129
|
+
return !!(s && (this.debug(`
|
|
10130
|
+
>>> no match, partial?`, t, d, e, f), d === a));
|
|
10131
|
+
}
|
|
10132
|
+
let p;
|
|
10133
|
+
if (typeof u == "string" ? (p = c === u, this.debug("string match", u, c, p)) : (p = u.test(c), this.debug("pattern match", u, c, p)), !p)
|
|
10134
|
+
return false;
|
|
10135
|
+
}
|
|
10136
|
+
if (o === a && h === l)
|
|
10137
|
+
return true;
|
|
10138
|
+
if (o === a)
|
|
10139
|
+
return s;
|
|
10140
|
+
if (h === l)
|
|
10141
|
+
return o === a - 1 && t[o] === "";
|
|
10142
|
+
throw new Error("wtf?");
|
|
10143
|
+
}
|
|
10144
|
+
braceExpand() {
|
|
10145
|
+
return ke(this.pattern, this.options);
|
|
10146
|
+
}
|
|
10147
|
+
parse(t) {
|
|
10148
|
+
at(t);
|
|
10149
|
+
let e = this.options;
|
|
10150
|
+
if (t === "**")
|
|
10151
|
+
return A;
|
|
10152
|
+
if (t === "")
|
|
10153
|
+
return "";
|
|
10154
|
+
let s, i = null;
|
|
10155
|
+
(s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
|
|
10156
|
+
let r = Q.fromGlob(t, this.options).toMMPattern();
|
|
10157
|
+
return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
|
|
10158
|
+
}
|
|
10159
|
+
makeRe() {
|
|
10160
|
+
if (this.regexp || this.regexp === false)
|
|
10161
|
+
return this.regexp;
|
|
10162
|
+
let t = this.set;
|
|
10163
|
+
if (!t.length)
|
|
10164
|
+
return this.regexp = false, this.regexp;
|
|
10165
|
+
let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
|
|
10166
|
+
let l = a.map((c) => {
|
|
10167
|
+
if (c instanceof RegExp)
|
|
10168
|
+
for (let d of c.flags.split(""))
|
|
10169
|
+
i.add(d);
|
|
10170
|
+
return typeof c == "string" ? ei(c) : c === A ? A : c._src;
|
|
10171
|
+
});
|
|
10172
|
+
l.forEach((c, d) => {
|
|
10173
|
+
let f = l[d + 1], m = l[d - 1];
|
|
10174
|
+
c !== A || m === A || (m === undefined ? f !== undefined && f !== A ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === undefined ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A));
|
|
10175
|
+
});
|
|
10176
|
+
let u = l.filter((c) => c !== A);
|
|
10177
|
+
if (this.partial && u.length >= 1) {
|
|
10178
|
+
let c = [];
|
|
10179
|
+
for (let d = 1;d <= u.length; d++)
|
|
10180
|
+
c.push(u.slice(0, d).join("/"));
|
|
10181
|
+
return "(?:" + c.join("|") + ")";
|
|
10182
|
+
}
|
|
10183
|
+
return u.join("/");
|
|
10184
|
+
}).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
10185
|
+
r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
|
|
10186
|
+
try {
|
|
10187
|
+
this.regexp = new RegExp(r, [...i].join(""));
|
|
10188
|
+
} catch {
|
|
10189
|
+
this.regexp = false;
|
|
10190
|
+
}
|
|
10191
|
+
return this.regexp;
|
|
10192
|
+
}
|
|
10193
|
+
slashSplit(t) {
|
|
10194
|
+
return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
|
|
10195
|
+
}
|
|
10196
|
+
match(t, e = this.partial) {
|
|
10197
|
+
if (this.debug("match", t, this.pattern), this.comment)
|
|
10198
|
+
return false;
|
|
10199
|
+
if (this.empty)
|
|
10200
|
+
return t === "";
|
|
10201
|
+
if (t === "/" && e)
|
|
10202
|
+
return true;
|
|
10203
|
+
let s = this.options;
|
|
10204
|
+
this.isWindows && (t = t.split("\\").join("/"));
|
|
10205
|
+
let i = this.slashSplit(t);
|
|
10206
|
+
this.debug(this.pattern, "split", i);
|
|
10207
|
+
let r = this.set;
|
|
10208
|
+
this.debug(this.pattern, "set", r);
|
|
10209
|
+
let o = i[i.length - 1];
|
|
10210
|
+
if (!o)
|
|
10211
|
+
for (let h = i.length - 2;!o && h >= 0; h--)
|
|
10212
|
+
o = i[h];
|
|
10213
|
+
for (let h = 0;h < r.length; h++) {
|
|
10214
|
+
let a = r[h], l = i;
|
|
10215
|
+
if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e))
|
|
10216
|
+
return s.flipNegate ? true : !this.negate;
|
|
10217
|
+
}
|
|
10218
|
+
return s.flipNegate ? false : this.negate;
|
|
10219
|
+
}
|
|
10220
|
+
static defaults(t) {
|
|
10221
|
+
return O.defaults(t).Minimatch;
|
|
10222
|
+
}
|
|
10223
|
+
};
|
|
10224
|
+
O.AST = Q;
|
|
10225
|
+
O.Minimatch = D;
|
|
10226
|
+
O.escape = tt;
|
|
10227
|
+
O.unescape = W;
|
|
10228
|
+
var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
10229
|
+
var Oe = new Set;
|
|
10230
|
+
var Vt = typeof process == "object" && process ? process : {};
|
|
10231
|
+
var Fe = (n2, t, e, s) => {
|
|
10232
|
+
typeof Vt.emitWarning == "function" ? Vt.emitWarning(n2, t, e, s) : console.error(`[${e}] ${t}: ${n2}`);
|
|
10233
|
+
};
|
|
10234
|
+
var At = globalThis.AbortController;
|
|
10235
|
+
var Re = globalThis.AbortSignal;
|
|
10236
|
+
if (typeof At > "u") {
|
|
10237
|
+
Re = class {
|
|
10238
|
+
onabort;
|
|
10239
|
+
_onabort = [];
|
|
10240
|
+
reason;
|
|
10241
|
+
aborted = false;
|
|
10242
|
+
addEventListener(e, s) {
|
|
10243
|
+
this._onabort.push(s);
|
|
10244
|
+
}
|
|
10245
|
+
}, At = class {
|
|
10246
|
+
constructor() {
|
|
10247
|
+
t();
|
|
10248
|
+
}
|
|
10249
|
+
signal = new Re;
|
|
10250
|
+
abort(e) {
|
|
10251
|
+
if (!this.signal.aborted) {
|
|
10252
|
+
this.signal.reason = e, this.signal.aborted = true;
|
|
10253
|
+
for (let s of this.signal._onabort)
|
|
10254
|
+
s(e);
|
|
10255
|
+
this.signal.onabort?.(e);
|
|
10256
|
+
}
|
|
10257
|
+
}
|
|
10258
|
+
};
|
|
10259
|
+
let n2 = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
10260
|
+
n2 && (n2 = false, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
10261
|
+
};
|
|
10262
|
+
}
|
|
10263
|
+
var ii = (n2) => !Oe.has(n2);
|
|
10264
|
+
var q = (n2) => n2 && n2 === Math.floor(n2) && n2 > 0 && isFinite(n2);
|
|
10265
|
+
var De = (n2) => q(n2) ? n2 <= Math.pow(2, 8) ? Uint8Array : n2 <= Math.pow(2, 16) ? Uint16Array : n2 <= Math.pow(2, 32) ? Uint32Array : n2 <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
|
|
10266
|
+
var Tt = class extends Array {
|
|
10267
|
+
constructor(n2) {
|
|
10268
|
+
super(n2), this.fill(0);
|
|
10269
|
+
}
|
|
10270
|
+
};
|
|
10271
|
+
var ri = class ct {
|
|
10272
|
+
heap;
|
|
10273
|
+
length;
|
|
10274
|
+
static #t = false;
|
|
10275
|
+
static create(t) {
|
|
10276
|
+
let e = De(t);
|
|
10277
|
+
if (!e)
|
|
10278
|
+
return [];
|
|
10279
|
+
ct.#t = true;
|
|
10280
|
+
let s = new ct(t, e);
|
|
10281
|
+
return ct.#t = false, s;
|
|
10282
|
+
}
|
|
10283
|
+
constructor(t, e) {
|
|
10284
|
+
if (!ct.#t)
|
|
10285
|
+
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
10286
|
+
this.heap = new e(t), this.length = 0;
|
|
10287
|
+
}
|
|
10288
|
+
push(t) {
|
|
10289
|
+
this.heap[this.length++] = t;
|
|
10290
|
+
}
|
|
10291
|
+
pop() {
|
|
10292
|
+
return this.heap[--this.length];
|
|
10293
|
+
}
|
|
10294
|
+
};
|
|
10295
|
+
var ft = class Me {
|
|
10296
|
+
#t;
|
|
10297
|
+
#s;
|
|
10298
|
+
#n;
|
|
10299
|
+
#r;
|
|
10300
|
+
#o;
|
|
10301
|
+
#S;
|
|
10302
|
+
#w;
|
|
10303
|
+
#c;
|
|
10304
|
+
get perf() {
|
|
10305
|
+
return this.#c;
|
|
10306
|
+
}
|
|
10307
|
+
ttl;
|
|
10308
|
+
ttlResolution;
|
|
10309
|
+
ttlAutopurge;
|
|
10310
|
+
updateAgeOnGet;
|
|
10311
|
+
updateAgeOnHas;
|
|
10312
|
+
allowStale;
|
|
10313
|
+
noDisposeOnSet;
|
|
10314
|
+
noUpdateTTL;
|
|
10315
|
+
maxEntrySize;
|
|
10316
|
+
sizeCalculation;
|
|
10317
|
+
noDeleteOnFetchRejection;
|
|
10318
|
+
noDeleteOnStaleGet;
|
|
10319
|
+
allowStaleOnFetchAbort;
|
|
10320
|
+
allowStaleOnFetchRejection;
|
|
10321
|
+
ignoreFetchAbort;
|
|
10322
|
+
#h;
|
|
10323
|
+
#u;
|
|
10324
|
+
#f;
|
|
10325
|
+
#a;
|
|
10326
|
+
#i;
|
|
10327
|
+
#d;
|
|
10328
|
+
#E;
|
|
10329
|
+
#b;
|
|
10330
|
+
#p;
|
|
10331
|
+
#R;
|
|
10332
|
+
#m;
|
|
10333
|
+
#C;
|
|
10334
|
+
#T;
|
|
10335
|
+
#g;
|
|
10336
|
+
#y;
|
|
10337
|
+
#x;
|
|
10338
|
+
#A;
|
|
10339
|
+
#e;
|
|
10340
|
+
#_;
|
|
10341
|
+
static unsafeExposeInternals(t) {
|
|
10342
|
+
return { starts: t.#T, ttls: t.#g, autopurgeTimers: t.#y, sizes: t.#C, keyMap: t.#f, keyList: t.#a, valList: t.#i, next: t.#d, prev: t.#E, get head() {
|
|
10343
|
+
return t.#b;
|
|
10344
|
+
}, get tail() {
|
|
10345
|
+
return t.#p;
|
|
10346
|
+
}, free: t.#R, isBackgroundFetch: (e) => t.#l(e), backgroundFetch: (e, s, i, r) => t.#U(e, s, i, r), moveToTail: (e) => t.#W(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#D(e), isStale: (e) => t.#v(e) };
|
|
10347
|
+
}
|
|
10348
|
+
get max() {
|
|
10349
|
+
return this.#t;
|
|
10350
|
+
}
|
|
10351
|
+
get maxSize() {
|
|
10352
|
+
return this.#s;
|
|
10353
|
+
}
|
|
10354
|
+
get calculatedSize() {
|
|
10355
|
+
return this.#u;
|
|
10356
|
+
}
|
|
10357
|
+
get size() {
|
|
10358
|
+
return this.#h;
|
|
10359
|
+
}
|
|
10360
|
+
get fetchMethod() {
|
|
10361
|
+
return this.#S;
|
|
10362
|
+
}
|
|
10363
|
+
get memoMethod() {
|
|
10364
|
+
return this.#w;
|
|
10365
|
+
}
|
|
10366
|
+
get dispose() {
|
|
10367
|
+
return this.#n;
|
|
10368
|
+
}
|
|
10369
|
+
get onInsert() {
|
|
10370
|
+
return this.#r;
|
|
10371
|
+
}
|
|
10372
|
+
get disposeAfter() {
|
|
10373
|
+
return this.#o;
|
|
10374
|
+
}
|
|
10375
|
+
constructor(t) {
|
|
10376
|
+
let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: u, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: f, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: w, fetchMethod: g, memoMethod: S, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
|
|
10377
|
+
if (J !== undefined && typeof J?.now != "function")
|
|
10378
|
+
throw new TypeError("perf option must have a now() method if specified");
|
|
10379
|
+
if (this.#c = J ?? si, e !== 0 && !q(e))
|
|
10380
|
+
throw new TypeError("max option must be a nonnegative integer");
|
|
10381
|
+
let Z = e ? De(e) : Array;
|
|
10382
|
+
if (!Z)
|
|
10383
|
+
throw new Error("invalid max value: " + e);
|
|
10384
|
+
if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
|
|
10385
|
+
if (!this.#s && !this.maxEntrySize)
|
|
10386
|
+
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
10387
|
+
if (typeof this.sizeCalculation != "function")
|
|
10388
|
+
throw new TypeError("sizeCalculation set to non-function");
|
|
10389
|
+
}
|
|
10390
|
+
if (S !== undefined && typeof S != "function")
|
|
10391
|
+
throw new TypeError("memoMethod must be a function if defined");
|
|
10392
|
+
if (this.#w = S, g !== undefined && typeof g != "function")
|
|
10393
|
+
throw new TypeError("fetchMethod must be a function if specified");
|
|
10394
|
+
if (this.#S = g, this.#A = !!g, this.#f = new Map, this.#a = new Array(e).fill(undefined), this.#i = new Array(e).fill(undefined), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = undefined, this.#m = undefined), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
|
|
10395
|
+
if (this.#s !== 0 && !q(this.#s))
|
|
10396
|
+
throw new TypeError("maxSize must be a positive integer if specified");
|
|
10397
|
+
if (!q(this.maxEntrySize))
|
|
10398
|
+
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
10399
|
+
this.#G();
|
|
10400
|
+
}
|
|
10401
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
|
|
10402
|
+
if (!q(this.ttl))
|
|
10403
|
+
throw new TypeError("ttl must be a positive integer if specified");
|
|
10404
|
+
this.#M();
|
|
10405
|
+
}
|
|
10406
|
+
if (this.#t === 0 && this.ttl === 0 && this.#s === 0)
|
|
10407
|
+
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
10408
|
+
if (!this.ttlAutopurge && !this.#t && !this.#s) {
|
|
10409
|
+
let $t = "LRU_CACHE_UNBOUNDED";
|
|
10410
|
+
ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10413
|
+
getRemainingTTL(t) {
|
|
10414
|
+
return this.#f.has(t) ? 1 / 0 : 0;
|
|
10415
|
+
}
|
|
10416
|
+
#M() {
|
|
10417
|
+
let t = new Tt(this.#t), e = new Tt(this.#t);
|
|
10418
|
+
this.#g = t, this.#T = e;
|
|
10419
|
+
let s = this.ttlAutopurge ? new Array(this.#t) : undefined;
|
|
10420
|
+
this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
|
|
10421
|
+
if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = undefined), h !== 0 && s) {
|
|
10422
|
+
let l = setTimeout(() => {
|
|
10423
|
+
this.#v(o) && this.#O(this.#a[o], "expire");
|
|
10424
|
+
}, h + 1);
|
|
10425
|
+
l.unref && l.unref(), s[o] = l;
|
|
10426
|
+
}
|
|
10427
|
+
}, this.#k = (o) => {
|
|
10428
|
+
e[o] = t[o] !== 0 ? this.#c.now() : 0;
|
|
10429
|
+
}, this.#N = (o, h) => {
|
|
10430
|
+
if (t[h]) {
|
|
10431
|
+
let a = t[h], l = e[h];
|
|
10432
|
+
if (!a || !l)
|
|
10433
|
+
return;
|
|
10434
|
+
o.ttl = a, o.start = l, o.now = i || r();
|
|
10435
|
+
let u = o.now - l;
|
|
10436
|
+
o.remainingTTL = a - u;
|
|
10437
|
+
}
|
|
10438
|
+
};
|
|
10439
|
+
let i = 0, r = () => {
|
|
10440
|
+
let o = this.#c.now();
|
|
10441
|
+
if (this.ttlResolution > 0) {
|
|
10442
|
+
i = o;
|
|
10443
|
+
let h = setTimeout(() => i = 0, this.ttlResolution);
|
|
10444
|
+
h.unref && h.unref();
|
|
10445
|
+
}
|
|
10446
|
+
return o;
|
|
10447
|
+
};
|
|
10448
|
+
this.getRemainingTTL = (o) => {
|
|
10449
|
+
let h = this.#f.get(o);
|
|
10450
|
+
if (h === undefined)
|
|
10451
|
+
return 0;
|
|
10452
|
+
let a = t[h], l = e[h];
|
|
10453
|
+
if (!a || !l)
|
|
10454
|
+
return 1 / 0;
|
|
10455
|
+
let u = (i || r()) - l;
|
|
10456
|
+
return a - u;
|
|
10457
|
+
}, this.#v = (o) => {
|
|
10458
|
+
let h = e[o], a = t[o];
|
|
10459
|
+
return !!a && !!h && (i || r()) - h > a;
|
|
10460
|
+
};
|
|
10461
|
+
}
|
|
10462
|
+
#k = () => {};
|
|
10463
|
+
#N = () => {};
|
|
10464
|
+
#j = () => {};
|
|
10465
|
+
#v = () => false;
|
|
10466
|
+
#G() {
|
|
10467
|
+
let t = new Tt(this.#t);
|
|
10468
|
+
this.#u = 0, this.#C = t, this.#P = (e) => {
|
|
10469
|
+
this.#u -= t[e], t[e] = 0;
|
|
10470
|
+
}, this.#I = (e, s, i, r) => {
|
|
10471
|
+
if (this.#l(s))
|
|
10472
|
+
return 0;
|
|
10473
|
+
if (!q(i))
|
|
10474
|
+
if (r) {
|
|
10475
|
+
if (typeof r != "function")
|
|
10476
|
+
throw new TypeError("sizeCalculation must be a function");
|
|
10477
|
+
if (i = r(s, e), !q(i))
|
|
10478
|
+
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
10479
|
+
} else
|
|
10480
|
+
throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
10481
|
+
return i;
|
|
10482
|
+
}, this.#L = (e, s, i) => {
|
|
10483
|
+
if (t[e] = s, this.#s) {
|
|
10484
|
+
let r = this.#s - t[e];
|
|
10485
|
+
for (;this.#u > r; )
|
|
10486
|
+
this.#B(true);
|
|
10487
|
+
}
|
|
10488
|
+
this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
|
|
10489
|
+
};
|
|
10490
|
+
}
|
|
10491
|
+
#P = (t) => {};
|
|
10492
|
+
#L = (t, e, s) => {};
|
|
10493
|
+
#I = (t, e, s, i) => {
|
|
10494
|
+
if (s || i)
|
|
10495
|
+
throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
10496
|
+
return 0;
|
|
10497
|
+
};
|
|
10498
|
+
*#F({ allowStale: t = this.allowStale } = {}) {
|
|
10499
|
+
if (this.#h)
|
|
10500
|
+
for (let e = this.#p;!(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b)); )
|
|
10501
|
+
e = this.#E[e];
|
|
10502
|
+
}
|
|
10503
|
+
*#D({ allowStale: t = this.allowStale } = {}) {
|
|
10504
|
+
if (this.#h)
|
|
10505
|
+
for (let e = this.#b;!(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p)); )
|
|
10506
|
+
e = this.#d[e];
|
|
10507
|
+
}
|
|
10508
|
+
#z(t) {
|
|
10509
|
+
return t !== undefined && this.#f.get(this.#a[t]) === t;
|
|
10510
|
+
}
|
|
10511
|
+
*entries() {
|
|
10512
|
+
for (let t of this.#F())
|
|
10513
|
+
this.#i[t] !== undefined && this.#a[t] !== undefined && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
|
|
10514
|
+
}
|
|
10515
|
+
*rentries() {
|
|
10516
|
+
for (let t of this.#D())
|
|
10517
|
+
this.#i[t] !== undefined && this.#a[t] !== undefined && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
|
|
10518
|
+
}
|
|
10519
|
+
*keys() {
|
|
10520
|
+
for (let t of this.#F()) {
|
|
10521
|
+
let e = this.#a[t];
|
|
10522
|
+
e !== undefined && !this.#l(this.#i[t]) && (yield e);
|
|
10523
|
+
}
|
|
10524
|
+
}
|
|
10525
|
+
*rkeys() {
|
|
10526
|
+
for (let t of this.#D()) {
|
|
10527
|
+
let e = this.#a[t];
|
|
10528
|
+
e !== undefined && !this.#l(this.#i[t]) && (yield e);
|
|
10529
|
+
}
|
|
10530
|
+
}
|
|
10531
|
+
*values() {
|
|
10532
|
+
for (let t of this.#F())
|
|
10533
|
+
this.#i[t] !== undefined && !this.#l(this.#i[t]) && (yield this.#i[t]);
|
|
10534
|
+
}
|
|
10535
|
+
*rvalues() {
|
|
10536
|
+
for (let t of this.#D())
|
|
10537
|
+
this.#i[t] !== undefined && !this.#l(this.#i[t]) && (yield this.#i[t]);
|
|
10538
|
+
}
|
|
10539
|
+
[Symbol.iterator]() {
|
|
10540
|
+
return this.entries();
|
|
10541
|
+
}
|
|
10542
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
10543
|
+
find(t, e = {}) {
|
|
10544
|
+
for (let s of this.#F()) {
|
|
10545
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
10546
|
+
if (r !== undefined && t(r, this.#a[s], this))
|
|
10547
|
+
return this.get(this.#a[s], e);
|
|
10548
|
+
}
|
|
10549
|
+
}
|
|
10550
|
+
forEach(t, e = this) {
|
|
10551
|
+
for (let s of this.#F()) {
|
|
10552
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
10553
|
+
r !== undefined && t.call(e, r, this.#a[s], this);
|
|
10554
|
+
}
|
|
10555
|
+
}
|
|
10556
|
+
rforEach(t, e = this) {
|
|
10557
|
+
for (let s of this.#D()) {
|
|
10558
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
10559
|
+
r !== undefined && t.call(e, r, this.#a[s], this);
|
|
10560
|
+
}
|
|
10561
|
+
}
|
|
10562
|
+
purgeStale() {
|
|
10563
|
+
let t = false;
|
|
10564
|
+
for (let e of this.#D({ allowStale: true }))
|
|
10565
|
+
this.#v(e) && (this.#O(this.#a[e], "expire"), t = true);
|
|
10566
|
+
return t;
|
|
10567
|
+
}
|
|
10568
|
+
info(t) {
|
|
10569
|
+
let e = this.#f.get(t);
|
|
10570
|
+
if (e === undefined)
|
|
10571
|
+
return;
|
|
10572
|
+
let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
|
|
10573
|
+
if (i === undefined)
|
|
10574
|
+
return;
|
|
10575
|
+
let r = { value: i };
|
|
10576
|
+
if (this.#g && this.#T) {
|
|
10577
|
+
let o = this.#g[e], h = this.#T[e];
|
|
10578
|
+
if (o && h) {
|
|
10579
|
+
let a = o - (this.#c.now() - h);
|
|
10580
|
+
r.ttl = a, r.start = Date.now();
|
|
10581
|
+
}
|
|
10582
|
+
}
|
|
10583
|
+
return this.#C && (r.size = this.#C[e]), r;
|
|
10584
|
+
}
|
|
10585
|
+
dump() {
|
|
10586
|
+
let t = [];
|
|
10587
|
+
for (let e of this.#F({ allowStale: true })) {
|
|
10588
|
+
let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
10589
|
+
if (r === undefined || s === undefined)
|
|
10590
|
+
continue;
|
|
10591
|
+
let o = { value: r };
|
|
10592
|
+
if (this.#g && this.#T) {
|
|
10593
|
+
o.ttl = this.#g[e];
|
|
10594
|
+
let h = this.#c.now() - this.#T[e];
|
|
10595
|
+
o.start = Math.floor(Date.now() - h);
|
|
10596
|
+
}
|
|
10597
|
+
this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
|
|
10598
|
+
}
|
|
10599
|
+
return t;
|
|
10600
|
+
}
|
|
10601
|
+
load(t) {
|
|
10602
|
+
this.clear();
|
|
10603
|
+
for (let [e, s] of t) {
|
|
10604
|
+
if (s.start) {
|
|
10605
|
+
let i = Date.now() - s.start;
|
|
10606
|
+
s.start = this.#c.now() - i;
|
|
10607
|
+
}
|
|
10608
|
+
this.set(e, s.value, s);
|
|
10609
|
+
}
|
|
10610
|
+
}
|
|
10611
|
+
set(t, e, s = {}) {
|
|
10612
|
+
if (e === undefined)
|
|
10613
|
+
return this.delete(t), this;
|
|
10614
|
+
let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u = this.#I(t, e, s.size || 0, h);
|
|
10615
|
+
if (this.maxEntrySize && u > this.maxEntrySize)
|
|
10616
|
+
return a && (a.set = "miss", a.maxEntrySizeExceeded = true), this.#O(t, "set"), this;
|
|
10617
|
+
let c = this.#h === 0 ? undefined : this.#f.get(t);
|
|
10618
|
+
if (c === undefined)
|
|
10619
|
+
c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(false) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u, a), a && (a.set = "add"), l = false, this.#_ && this.#r?.(e, t, "add");
|
|
10620
|
+
else {
|
|
10621
|
+
this.#W(c);
|
|
10622
|
+
let d = this.#i[c];
|
|
10623
|
+
if (e !== d) {
|
|
10624
|
+
if (this.#A && this.#l(d)) {
|
|
10625
|
+
d.__abortController.abort(new Error("replaced"));
|
|
10626
|
+
let { __staleWhileFetching: f } = d;
|
|
10627
|
+
f !== undefined && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([f, t, "set"]));
|
|
10628
|
+
} else
|
|
10629
|
+
o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([d, t, "set"]));
|
|
10630
|
+
if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
|
|
10631
|
+
a.set = "replace";
|
|
10632
|
+
let f = d && this.#l(d) ? d.__staleWhileFetching : d;
|
|
10633
|
+
f !== undefined && (a.oldValue = f);
|
|
10634
|
+
}
|
|
10635
|
+
} else
|
|
10636
|
+
a && (a.set = "update");
|
|
10637
|
+
this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
10638
|
+
}
|
|
10639
|
+
if (i !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i, r), a && this.#N(a, c)), !o && this.#e && this.#m) {
|
|
10640
|
+
let d = this.#m, f;
|
|
10641
|
+
for (;f = d?.shift(); )
|
|
10642
|
+
this.#o?.(...f);
|
|
10643
|
+
}
|
|
10644
|
+
return this;
|
|
10645
|
+
}
|
|
10646
|
+
pop() {
|
|
10647
|
+
try {
|
|
10648
|
+
for (;this.#h; ) {
|
|
10649
|
+
let t = this.#i[this.#b];
|
|
10650
|
+
if (this.#B(true), this.#l(t)) {
|
|
10651
|
+
if (t.__staleWhileFetching)
|
|
10652
|
+
return t.__staleWhileFetching;
|
|
10653
|
+
} else if (t !== undefined)
|
|
10654
|
+
return t;
|
|
10655
|
+
}
|
|
10656
|
+
} finally {
|
|
10657
|
+
if (this.#e && this.#m) {
|
|
10658
|
+
let t = this.#m, e;
|
|
10659
|
+
for (;e = t?.shift(); )
|
|
10660
|
+
this.#o?.(...e);
|
|
10661
|
+
}
|
|
10662
|
+
}
|
|
10663
|
+
}
|
|
10664
|
+
#B(t) {
|
|
10665
|
+
let e = this.#b, s = this.#a[e], i = this.#i[e];
|
|
10666
|
+
return this.#A && this.#l(i) ? i.__abortController.abort(new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([i, s, "evict"])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = undefined), t && (this.#a[e] = undefined, this.#i[e] = undefined, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
|
|
10667
|
+
}
|
|
10668
|
+
has(t, e = {}) {
|
|
10669
|
+
let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
|
|
10670
|
+
if (r !== undefined) {
|
|
10671
|
+
let o = this.#i[r];
|
|
10672
|
+
if (this.#l(o) && o.__staleWhileFetching === undefined)
|
|
10673
|
+
return false;
|
|
10674
|
+
if (this.#v(r))
|
|
10675
|
+
i && (i.has = "stale", this.#N(i, r));
|
|
10676
|
+
else
|
|
10677
|
+
return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), true;
|
|
10678
|
+
} else
|
|
10679
|
+
i && (i.has = "miss");
|
|
10680
|
+
return false;
|
|
10681
|
+
}
|
|
10682
|
+
peek(t, e = {}) {
|
|
10683
|
+
let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
|
|
10684
|
+
if (i === undefined || !s && this.#v(i))
|
|
10685
|
+
return;
|
|
10686
|
+
let r = this.#i[i];
|
|
10687
|
+
return this.#l(r) ? r.__staleWhileFetching : r;
|
|
10688
|
+
}
|
|
10689
|
+
#U(t, e, s, i) {
|
|
10690
|
+
let r = e === undefined ? undefined : this.#i[e];
|
|
10691
|
+
if (this.#l(r))
|
|
10692
|
+
return r;
|
|
10693
|
+
let o = new At, { signal: h } = s;
|
|
10694
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
10695
|
+
let a = { signal: o.signal, options: s, context: i }, l = (p, w = false) => {
|
|
10696
|
+
let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== undefined, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== undefined);
|
|
10697
|
+
if (s.status && (g && !w ? (s.status.fetchAborted = true, s.status.fetchError = o.signal.reason, S && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), g && !S && !w)
|
|
10698
|
+
return c(o.signal.reason, E);
|
|
10699
|
+
let y = f, b = this.#i[e];
|
|
10700
|
+
return (b === f || S && w && b === undefined) && (p === undefined ? y.__staleWhileFetching !== undefined ? this.#i[e] = y.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.set(t, p, a.options))), p;
|
|
10701
|
+
}, u = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, w) => {
|
|
10702
|
+
let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
|
|
10703
|
+
if (this.#i[e] === f && (!y || !w && b.__staleWhileFetching === undefined ? this.#O(t, "fetch") : S || (this.#i[e] = b.__staleWhileFetching)), E)
|
|
10704
|
+
return s.status && b.__staleWhileFetching !== undefined && (s.status.returnedStale = true), b.__staleWhileFetching;
|
|
10705
|
+
if (b.__returned === b)
|
|
10706
|
+
throw p;
|
|
10707
|
+
}, d = (p, w) => {
|
|
10708
|
+
let g = this.#S?.(t, r, a);
|
|
10709
|
+
g && g instanceof Promise && g.then((S) => p(S === undefined ? undefined : S), w), o.signal.addEventListener("abort", () => {
|
|
10710
|
+
(!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(undefined), s.allowStaleOnFetchAbort && (p = (S) => l(S, true)));
|
|
10711
|
+
});
|
|
10712
|
+
};
|
|
10713
|
+
s.status && (s.status.fetchDispatched = true);
|
|
10714
|
+
let f = new Promise(d).then(l, u), m = Object.assign(f, { __abortController: o, __staleWhileFetching: r, __returned: undefined });
|
|
10715
|
+
return e === undefined ? (this.set(t, m, { ...a.options, status: undefined }), e = this.#f.get(t)) : this.#i[e] = m, m;
|
|
10716
|
+
}
|
|
10717
|
+
#l(t) {
|
|
10718
|
+
if (!this.#A)
|
|
10719
|
+
return false;
|
|
10720
|
+
let e = t;
|
|
10721
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
|
|
10722
|
+
}
|
|
10723
|
+
async fetch(t, e = {}) {
|
|
10724
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: w = false, status: g, signal: S } = e;
|
|
10725
|
+
if (!this.#A)
|
|
10726
|
+
return g && (g.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: g });
|
|
10727
|
+
let E = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: o, noDisposeOnSet: h, size: a, sizeCalculation: l, noUpdateTTL: u, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: m, ignoreFetchAbort: f, status: g, signal: S }, y = this.#f.get(t);
|
|
10728
|
+
if (y === undefined) {
|
|
10729
|
+
g && (g.fetch = "miss");
|
|
10730
|
+
let b = this.#U(t, y, E, p);
|
|
10731
|
+
return b.__returned = b;
|
|
10732
|
+
} else {
|
|
10733
|
+
let b = this.#i[y];
|
|
10734
|
+
if (this.#l(b)) {
|
|
10735
|
+
let Z = s && b.__staleWhileFetching !== undefined;
|
|
10736
|
+
return g && (g.fetch = "inflight", Z && (g.returnedStale = true)), Z ? b.__staleWhileFetching : b.__returned = b;
|
|
10737
|
+
}
|
|
10738
|
+
let z = this.#v(y);
|
|
10739
|
+
if (!w && !z)
|
|
10740
|
+
return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
|
|
10741
|
+
let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== undefined && s;
|
|
10742
|
+
return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = true)), J ? $.__staleWhileFetching : $.__returned = $;
|
|
10743
|
+
}
|
|
10744
|
+
}
|
|
10745
|
+
async forceFetch(t, e = {}) {
|
|
10746
|
+
let s = await this.fetch(t, e);
|
|
10747
|
+
if (s === undefined)
|
|
10748
|
+
throw new Error("fetch() returned undefined");
|
|
10749
|
+
return s;
|
|
10750
|
+
}
|
|
10751
|
+
memo(t, e = {}) {
|
|
10752
|
+
let s = this.#w;
|
|
10753
|
+
if (!s)
|
|
10754
|
+
throw new Error("no memoMethod provided to constructor");
|
|
10755
|
+
let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
|
|
10756
|
+
if (!r && h !== undefined)
|
|
10757
|
+
return h;
|
|
10758
|
+
let a = s(t, h, { options: o, context: i });
|
|
10759
|
+
return this.set(t, a, o), a;
|
|
10760
|
+
}
|
|
10761
|
+
get(t, e = {}) {
|
|
10762
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
|
|
10763
|
+
if (h !== undefined) {
|
|
10764
|
+
let a = this.#i[h], l = this.#l(a);
|
|
10765
|
+
return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a.__staleWhileFetching !== undefined && (o.returnedStale = true), s ? a.__staleWhileFetching : undefined) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = true), s ? a : undefined)) : (o && (o.get = "hit"), l ? a.__staleWhileFetching : (this.#W(h), i && this.#k(h), a));
|
|
10766
|
+
} else
|
|
10767
|
+
o && (o.get = "miss");
|
|
10768
|
+
}
|
|
10769
|
+
#$(t, e) {
|
|
10770
|
+
this.#E[e] = t, this.#d[t] = e;
|
|
10771
|
+
}
|
|
10772
|
+
#W(t) {
|
|
10773
|
+
t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
|
|
10774
|
+
}
|
|
10775
|
+
delete(t) {
|
|
10776
|
+
return this.#O(t, "delete");
|
|
10777
|
+
}
|
|
10778
|
+
#O(t, e) {
|
|
10779
|
+
let s = false;
|
|
10780
|
+
if (this.#h !== 0) {
|
|
10781
|
+
let i = this.#f.get(t);
|
|
10782
|
+
if (i !== undefined)
|
|
10783
|
+
if (this.#y?.[i] && (clearTimeout(this.#y?.[i]), this.#y[i] = undefined), s = true, this.#h === 1)
|
|
10784
|
+
this.#H(e);
|
|
10785
|
+
else {
|
|
10786
|
+
this.#P(i);
|
|
10787
|
+
let r = this.#i[i];
|
|
10788
|
+
if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([r, t, e])), this.#f.delete(t), this.#a[i] = undefined, this.#i[i] = undefined, i === this.#p)
|
|
10789
|
+
this.#p = this.#E[i];
|
|
10790
|
+
else if (i === this.#b)
|
|
10791
|
+
this.#b = this.#d[i];
|
|
10792
|
+
else {
|
|
10793
|
+
let o = this.#E[i];
|
|
10794
|
+
this.#d[o] = this.#d[i];
|
|
10795
|
+
let h = this.#d[i];
|
|
10796
|
+
this.#E[h] = this.#E[i];
|
|
10797
|
+
}
|
|
10798
|
+
this.#h--, this.#R.push(i);
|
|
10799
|
+
}
|
|
10800
|
+
}
|
|
10801
|
+
if (this.#e && this.#m?.length) {
|
|
10802
|
+
let i = this.#m, r;
|
|
10803
|
+
for (;r = i?.shift(); )
|
|
10804
|
+
this.#o?.(...r);
|
|
10805
|
+
}
|
|
10806
|
+
return s;
|
|
10807
|
+
}
|
|
10808
|
+
clear() {
|
|
10809
|
+
return this.#H("delete");
|
|
10810
|
+
}
|
|
10811
|
+
#H(t) {
|
|
10812
|
+
for (let e of this.#D({ allowStale: true })) {
|
|
10813
|
+
let s = this.#i[e];
|
|
10814
|
+
if (this.#l(s))
|
|
10815
|
+
s.__abortController.abort(new Error("deleted"));
|
|
10816
|
+
else {
|
|
10817
|
+
let i = this.#a[e];
|
|
10818
|
+
this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([s, i, t]);
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10821
|
+
if (this.#f.clear(), this.#i.fill(undefined), this.#a.fill(undefined), this.#g && this.#T) {
|
|
10822
|
+
this.#g.fill(0), this.#T.fill(0);
|
|
10823
|
+
for (let e of this.#y ?? [])
|
|
10824
|
+
e !== undefined && clearTimeout(e);
|
|
10825
|
+
this.#y?.fill(undefined);
|
|
10826
|
+
}
|
|
10827
|
+
if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
|
|
10828
|
+
let e = this.#m, s;
|
|
10829
|
+
for (;s = e?.shift(); )
|
|
10830
|
+
this.#o?.(...s);
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
};
|
|
10834
|
+
var Ne = typeof process == "object" && process ? process : { stdout: null, stderr: null };
|
|
10835
|
+
var oi = (n2) => !!n2 && typeof n2 == "object" && (n2 instanceof V || n2 instanceof Pe || hi(n2) || ai(n2));
|
|
10836
|
+
var hi = (n2) => !!n2 && typeof n2 == "object" && n2 instanceof ee && typeof n2.pipe == "function" && n2.pipe !== Pe.Writable.prototype.pipe;
|
|
10837
|
+
var ai = (n2) => !!n2 && typeof n2 == "object" && n2 instanceof ee && typeof n2.write == "function" && typeof n2.end == "function";
|
|
10838
|
+
var G = Symbol("EOF");
|
|
10839
|
+
var H = Symbol("maybeEmitEnd");
|
|
10840
|
+
var K = Symbol("emittedEnd");
|
|
10841
|
+
var kt = Symbol("emittingEnd");
|
|
10842
|
+
var ut = Symbol("emittedError");
|
|
10843
|
+
var Rt = Symbol("closed");
|
|
10844
|
+
var _e = Symbol("read");
|
|
10845
|
+
var Ot = Symbol("flush");
|
|
10846
|
+
var Le = Symbol("flushChunk");
|
|
10847
|
+
var P = Symbol("encoding");
|
|
10848
|
+
var et = Symbol("decoder");
|
|
10849
|
+
var v = Symbol("flowing");
|
|
10850
|
+
var dt = Symbol("paused");
|
|
10851
|
+
var st = Symbol("resume");
|
|
10852
|
+
var C = Symbol("buffer");
|
|
10853
|
+
var F = Symbol("pipes");
|
|
10854
|
+
var T = Symbol("bufferLength");
|
|
10855
|
+
var Yt = Symbol("bufferPush");
|
|
10856
|
+
var Ft = Symbol("bufferShift");
|
|
10857
|
+
var k = Symbol("objectMode");
|
|
10858
|
+
var x = Symbol("destroyed");
|
|
10859
|
+
var Xt = Symbol("error");
|
|
10860
|
+
var Jt = Symbol("emitData");
|
|
10861
|
+
var We = Symbol("emitEnd");
|
|
10862
|
+
var Zt = Symbol("emitEnd2");
|
|
10863
|
+
var B = Symbol("async");
|
|
10864
|
+
var Qt = Symbol("abort");
|
|
10865
|
+
var Dt = Symbol("aborted");
|
|
10866
|
+
var pt = Symbol("signal");
|
|
10867
|
+
var Y = Symbol("dataListeners");
|
|
10868
|
+
var M = Symbol("discarded");
|
|
10869
|
+
var mt = (n2) => Promise.resolve().then(n2);
|
|
10870
|
+
var li = (n2) => n2();
|
|
10871
|
+
var ci = (n2) => n2 === "end" || n2 === "finish" || n2 === "prefinish";
|
|
10872
|
+
var fi = (n2) => n2 instanceof ArrayBuffer || !!n2 && typeof n2 == "object" && n2.constructor && n2.constructor.name === "ArrayBuffer" && n2.byteLength >= 0;
|
|
10873
|
+
var ui = (n2) => !Buffer.isBuffer(n2) && ArrayBuffer.isView(n2);
|
|
10874
|
+
var Mt = class {
|
|
10875
|
+
src;
|
|
10876
|
+
dest;
|
|
10877
|
+
opts;
|
|
10878
|
+
ondrain;
|
|
10879
|
+
constructor(t, e, s) {
|
|
10880
|
+
this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
|
|
10881
|
+
}
|
|
10882
|
+
unpipe() {
|
|
10883
|
+
this.dest.removeListener("drain", this.ondrain);
|
|
10884
|
+
}
|
|
10885
|
+
proxyErrors(t) {}
|
|
10886
|
+
end() {
|
|
10887
|
+
this.unpipe(), this.opts.end && this.dest.end();
|
|
10888
|
+
}
|
|
10889
|
+
};
|
|
10890
|
+
var te = class extends Mt {
|
|
10891
|
+
unpipe() {
|
|
10892
|
+
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
10893
|
+
}
|
|
10894
|
+
constructor(t, e, s) {
|
|
10895
|
+
super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
|
|
10896
|
+
}
|
|
10897
|
+
};
|
|
10898
|
+
var di = (n2) => !!n2.objectMode;
|
|
10899
|
+
var pi = (n2) => !n2.objectMode && !!n2.encoding && n2.encoding !== "buffer";
|
|
10900
|
+
var V = class extends ee {
|
|
10901
|
+
[v] = false;
|
|
10902
|
+
[dt] = false;
|
|
10903
|
+
[F] = [];
|
|
10904
|
+
[C] = [];
|
|
10905
|
+
[k];
|
|
10906
|
+
[P];
|
|
10907
|
+
[B];
|
|
10908
|
+
[et];
|
|
10909
|
+
[G] = false;
|
|
10910
|
+
[K] = false;
|
|
10911
|
+
[kt] = false;
|
|
10912
|
+
[Rt] = false;
|
|
10913
|
+
[ut] = null;
|
|
10914
|
+
[T] = 0;
|
|
10915
|
+
[x] = false;
|
|
10916
|
+
[pt];
|
|
10917
|
+
[Dt] = false;
|
|
10918
|
+
[Y] = 0;
|
|
10919
|
+
[M] = false;
|
|
10920
|
+
writable = true;
|
|
10921
|
+
readable = true;
|
|
10922
|
+
constructor(...t) {
|
|
10923
|
+
let e = t[0] || {};
|
|
10924
|
+
if (super(), e.objectMode && typeof e.encoding == "string")
|
|
10925
|
+
throw new TypeError("Encoding and objectMode may not be used together");
|
|
10926
|
+
di(e) ? (this[k] = true, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = false) : (this[k] = false, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new ni(this[P]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[F] });
|
|
10927
|
+
let { signal: s } = e;
|
|
10928
|
+
s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
|
|
10929
|
+
}
|
|
10930
|
+
get bufferLength() {
|
|
10931
|
+
return this[T];
|
|
10932
|
+
}
|
|
10933
|
+
get encoding() {
|
|
10934
|
+
return this[P];
|
|
10935
|
+
}
|
|
10936
|
+
set encoding(t) {
|
|
10937
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
10938
|
+
}
|
|
10939
|
+
setEncoding(t) {
|
|
10940
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
10941
|
+
}
|
|
10942
|
+
get objectMode() {
|
|
10943
|
+
return this[k];
|
|
10944
|
+
}
|
|
10945
|
+
set objectMode(t) {
|
|
10946
|
+
throw new Error("objectMode must be set at instantiation time");
|
|
10947
|
+
}
|
|
10948
|
+
get async() {
|
|
10949
|
+
return this[B];
|
|
10950
|
+
}
|
|
10951
|
+
set async(t) {
|
|
10952
|
+
this[B] = this[B] || !!t;
|
|
10953
|
+
}
|
|
10954
|
+
[Qt]() {
|
|
10955
|
+
this[Dt] = true, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
|
|
10956
|
+
}
|
|
10957
|
+
get aborted() {
|
|
10958
|
+
return this[Dt];
|
|
10959
|
+
}
|
|
10960
|
+
set aborted(t) {}
|
|
10961
|
+
write(t, e, s) {
|
|
10962
|
+
if (this[Dt])
|
|
10963
|
+
return false;
|
|
10964
|
+
if (this[G])
|
|
10965
|
+
throw new Error("write after end");
|
|
10966
|
+
if (this[x])
|
|
10967
|
+
return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
|
|
10968
|
+
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
10969
|
+
let i = this[B] ? mt : li;
|
|
10970
|
+
if (!this[k] && !Buffer.isBuffer(t)) {
|
|
10971
|
+
if (ui(t))
|
|
10972
|
+
t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
10973
|
+
else if (fi(t))
|
|
10974
|
+
t = Buffer.from(t);
|
|
10975
|
+
else if (typeof t != "string")
|
|
10976
|
+
throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
10977
|
+
}
|
|
10978
|
+
return this[k] ? (this[v] && this[T] !== 0 && this[Ot](true), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](true), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
|
|
10979
|
+
}
|
|
10980
|
+
read(t) {
|
|
10981
|
+
if (this[x])
|
|
10982
|
+
return null;
|
|
10983
|
+
if (this[M] = false, this[T] === 0 || t === 0 || t && t > this[T])
|
|
10984
|
+
return this[H](), null;
|
|
10985
|
+
this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
|
|
10986
|
+
let e = this[_e](t || null, this[C][0]);
|
|
10987
|
+
return this[H](), e;
|
|
10988
|
+
}
|
|
10989
|
+
[_e](t, e) {
|
|
10990
|
+
if (this[k])
|
|
10991
|
+
this[Ft]();
|
|
10992
|
+
else {
|
|
10993
|
+
let s = e;
|
|
10994
|
+
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
|
|
10995
|
+
}
|
|
10996
|
+
return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
|
|
10997
|
+
}
|
|
10998
|
+
end(t, e, s) {
|
|
10999
|
+
return typeof t == "function" && (s = t, t = undefined), typeof e == "function" && (s = e, e = "utf8"), t !== undefined && this.write(t, e), s && this.once("end", s), this[G] = true, this.writable = false, (this[v] || !this[dt]) && this[H](), this;
|
|
11000
|
+
}
|
|
11001
|
+
[st]() {
|
|
11002
|
+
this[x] || (!this[Y] && !this[F].length && (this[M] = true), this[dt] = false, this[v] = true, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
|
|
11003
|
+
}
|
|
11004
|
+
resume() {
|
|
11005
|
+
return this[st]();
|
|
11006
|
+
}
|
|
11007
|
+
pause() {
|
|
11008
|
+
this[v] = false, this[dt] = true, this[M] = false;
|
|
11009
|
+
}
|
|
11010
|
+
get destroyed() {
|
|
11011
|
+
return this[x];
|
|
11012
|
+
}
|
|
11013
|
+
get flowing() {
|
|
11014
|
+
return this[v];
|
|
11015
|
+
}
|
|
11016
|
+
get paused() {
|
|
11017
|
+
return this[dt];
|
|
11018
|
+
}
|
|
11019
|
+
[Yt](t) {
|
|
11020
|
+
this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
|
|
11021
|
+
}
|
|
11022
|
+
[Ft]() {
|
|
11023
|
+
return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
|
|
11024
|
+
}
|
|
11025
|
+
[Ot](t = false) {
|
|
11026
|
+
do
|
|
11027
|
+
;
|
|
11028
|
+
while (this[Le](this[Ft]()) && this[C].length);
|
|
11029
|
+
!t && !this[C].length && !this[G] && this.emit("drain");
|
|
11030
|
+
}
|
|
11031
|
+
[Le](t) {
|
|
11032
|
+
return this.emit("data", t), this[v];
|
|
11033
|
+
}
|
|
11034
|
+
pipe(t, e) {
|
|
11035
|
+
if (this[x])
|
|
11036
|
+
return t;
|
|
11037
|
+
this[M] = false;
|
|
11038
|
+
let s = this[K];
|
|
11039
|
+
return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
|
|
11040
|
+
}
|
|
11041
|
+
unpipe(t) {
|
|
11042
|
+
let e = this[F].find((s) => s.dest === t);
|
|
11043
|
+
e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = false), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
|
|
11044
|
+
}
|
|
11045
|
+
addListener(t, e) {
|
|
11046
|
+
return this.on(t, e);
|
|
11047
|
+
}
|
|
11048
|
+
on(t, e) {
|
|
11049
|
+
let s = super.on(t, e);
|
|
11050
|
+
if (t === "data")
|
|
11051
|
+
this[M] = false, this[Y]++, !this[F].length && !this[v] && this[st]();
|
|
11052
|
+
else if (t === "readable" && this[T] !== 0)
|
|
11053
|
+
super.emit("readable");
|
|
11054
|
+
else if (ci(t) && this[K])
|
|
11055
|
+
super.emit(t), this.removeAllListeners(t);
|
|
11056
|
+
else if (t === "error" && this[ut]) {
|
|
11057
|
+
let i = e;
|
|
11058
|
+
this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
|
|
11059
|
+
}
|
|
11060
|
+
return s;
|
|
11061
|
+
}
|
|
11062
|
+
removeListener(t, e) {
|
|
11063
|
+
return this.off(t, e);
|
|
11064
|
+
}
|
|
11065
|
+
off(t, e) {
|
|
11066
|
+
let s = super.off(t, e);
|
|
11067
|
+
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = false)), s;
|
|
11068
|
+
}
|
|
11069
|
+
removeAllListeners(t) {
|
|
11070
|
+
let e = super.removeAllListeners(t);
|
|
11071
|
+
return (t === "data" || t === undefined) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = false)), e;
|
|
11072
|
+
}
|
|
11073
|
+
get emittedEnd() {
|
|
11074
|
+
return this[K];
|
|
11075
|
+
}
|
|
11076
|
+
[H]() {
|
|
11077
|
+
!this[kt] && !this[K] && !this[x] && this[C].length === 0 && this[G] && (this[kt] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = false);
|
|
11078
|
+
}
|
|
11079
|
+
emit(t, ...e) {
|
|
11080
|
+
let s = e[0];
|
|
11081
|
+
if (t !== "error" && t !== "close" && t !== x && this[x])
|
|
11082
|
+
return false;
|
|
11083
|
+
if (t === "data")
|
|
11084
|
+
return !this[k] && !s ? false : this[B] ? (mt(() => this[Jt](s)), true) : this[Jt](s);
|
|
11085
|
+
if (t === "end")
|
|
11086
|
+
return this[We]();
|
|
11087
|
+
if (t === "close") {
|
|
11088
|
+
if (this[Rt] = true, !this[K] && !this[x])
|
|
11089
|
+
return false;
|
|
11090
|
+
let r = super.emit("close");
|
|
11091
|
+
return this.removeAllListeners("close"), r;
|
|
11092
|
+
} else if (t === "error") {
|
|
11093
|
+
this[ut] = s, super.emit(Xt, s);
|
|
11094
|
+
let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : false;
|
|
11095
|
+
return this[H](), r;
|
|
11096
|
+
} else if (t === "resume") {
|
|
11097
|
+
let r = super.emit("resume");
|
|
11098
|
+
return this[H](), r;
|
|
11099
|
+
} else if (t === "finish" || t === "prefinish") {
|
|
11100
|
+
let r = super.emit(t);
|
|
11101
|
+
return this.removeAllListeners(t), r;
|
|
11102
|
+
}
|
|
11103
|
+
let i = super.emit(t, ...e);
|
|
11104
|
+
return this[H](), i;
|
|
11105
|
+
}
|
|
11106
|
+
[Jt](t) {
|
|
11107
|
+
for (let s of this[F])
|
|
11108
|
+
s.dest.write(t) === false && this.pause();
|
|
11109
|
+
let e = this[M] ? false : super.emit("data", t);
|
|
11110
|
+
return this[H](), e;
|
|
11111
|
+
}
|
|
11112
|
+
[We]() {
|
|
11113
|
+
return this[K] ? false : (this[K] = true, this.readable = false, this[B] ? (mt(() => this[Zt]()), true) : this[Zt]());
|
|
11114
|
+
}
|
|
11115
|
+
[Zt]() {
|
|
11116
|
+
if (this[et]) {
|
|
11117
|
+
let e = this[et].end();
|
|
11118
|
+
if (e) {
|
|
11119
|
+
for (let s of this[F])
|
|
11120
|
+
s.dest.write(e);
|
|
11121
|
+
this[M] || super.emit("data", e);
|
|
11122
|
+
}
|
|
11123
|
+
}
|
|
11124
|
+
for (let e of this[F])
|
|
11125
|
+
e.end();
|
|
11126
|
+
let t = super.emit("end");
|
|
11127
|
+
return this.removeAllListeners("end"), t;
|
|
11128
|
+
}
|
|
11129
|
+
async collect() {
|
|
11130
|
+
let t = Object.assign([], { dataLength: 0 });
|
|
11131
|
+
this[k] || (t.dataLength = 0);
|
|
11132
|
+
let e = this.promise();
|
|
11133
|
+
return this.on("data", (s) => {
|
|
11134
|
+
t.push(s), this[k] || (t.dataLength += s.length);
|
|
11135
|
+
}), await e, t;
|
|
11136
|
+
}
|
|
11137
|
+
async concat() {
|
|
11138
|
+
if (this[k])
|
|
11139
|
+
throw new Error("cannot concat in objectMode");
|
|
11140
|
+
let t = await this.collect();
|
|
11141
|
+
return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
11142
|
+
}
|
|
11143
|
+
async promise() {
|
|
11144
|
+
return new Promise((t, e) => {
|
|
11145
|
+
this.on(x, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
|
|
11146
|
+
});
|
|
11147
|
+
}
|
|
11148
|
+
[Symbol.asyncIterator]() {
|
|
11149
|
+
this[M] = false;
|
|
11150
|
+
let t = false, e = async () => (this.pause(), t = true, { value: undefined, done: true });
|
|
11151
|
+
return { next: () => {
|
|
11152
|
+
if (t)
|
|
11153
|
+
return e();
|
|
11154
|
+
let i = this.read();
|
|
11155
|
+
if (i !== null)
|
|
11156
|
+
return Promise.resolve({ done: false, value: i });
|
|
11157
|
+
if (this[G])
|
|
11158
|
+
return e();
|
|
11159
|
+
let r, o, h = (c) => {
|
|
11160
|
+
this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
|
|
11161
|
+
}, a = (c) => {
|
|
11162
|
+
this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({ value: c, done: !!this[G] });
|
|
11163
|
+
}, l = () => {
|
|
11164
|
+
this.off("error", h), this.off("data", a), this.off(x, u), e(), r({ done: true, value: undefined });
|
|
11165
|
+
}, u = () => h(new Error("stream destroyed"));
|
|
11166
|
+
return new Promise((c, d) => {
|
|
11167
|
+
o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
11168
|
+
});
|
|
11169
|
+
}, throw: e, return: e, [Symbol.asyncIterator]() {
|
|
11170
|
+
return this;
|
|
11171
|
+
}, [Symbol.asyncDispose]: async () => {} };
|
|
11172
|
+
}
|
|
11173
|
+
[Symbol.iterator]() {
|
|
11174
|
+
this[M] = false;
|
|
11175
|
+
let t = false, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = true, { done: true, value: undefined }), s = () => {
|
|
11176
|
+
if (t)
|
|
11177
|
+
return e();
|
|
11178
|
+
let i = this.read();
|
|
11179
|
+
return i === null ? e() : { done: false, value: i };
|
|
11180
|
+
};
|
|
11181
|
+
return this.once("end", e), this.once(Xt, e), this.once(x, e), { next: s, throw: e, return: e, [Symbol.iterator]() {
|
|
11182
|
+
return this;
|
|
11183
|
+
}, [Symbol.dispose]: () => {} };
|
|
11184
|
+
}
|
|
11185
|
+
destroy(t) {
|
|
11186
|
+
if (this[x])
|
|
11187
|
+
return t ? this.emit("error", t) : this.emit(x), this;
|
|
11188
|
+
this[x] = true, this[M] = true, this[C].length = 0, this[T] = 0;
|
|
11189
|
+
let e = this;
|
|
11190
|
+
return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
|
|
11191
|
+
}
|
|
11192
|
+
static get isStream() {
|
|
11193
|
+
return oi;
|
|
11194
|
+
}
|
|
11195
|
+
};
|
|
11196
|
+
var vi = Ei.native;
|
|
11197
|
+
var wt = { lstatSync: wi, readdir: yi, readdirSync: bi, readlinkSync: Si, realpathSync: vi, promises: { lstat: Ci, readdir: Ti, readlink: Ai, realpath: ki } };
|
|
11198
|
+
var Ue = (n2) => !n2 || n2 === wt || n2 === xi ? wt : { ...wt, ...n2, promises: { ...wt.promises, ...n2.promises || {} } };
|
|
11199
|
+
var $e = /^\\\\\?\\([a-z]:)\\?$/i;
|
|
11200
|
+
var Ri = (n2) => n2.replace(/\//g, "\\").replace($e, "$1\\");
|
|
11201
|
+
var Oi = /[\\\/]/;
|
|
11202
|
+
var L = 0;
|
|
11203
|
+
var Ge = 1;
|
|
11204
|
+
var He = 2;
|
|
11205
|
+
var U = 4;
|
|
11206
|
+
var qe = 6;
|
|
11207
|
+
var Ke = 8;
|
|
11208
|
+
var X = 10;
|
|
11209
|
+
var Ve = 12;
|
|
11210
|
+
var _ = 15;
|
|
11211
|
+
var gt = ~_;
|
|
11212
|
+
var se = 16;
|
|
11213
|
+
var je = 32;
|
|
11214
|
+
var yt = 64;
|
|
11215
|
+
var j = 128;
|
|
11216
|
+
var Nt = 256;
|
|
11217
|
+
var Lt = 512;
|
|
11218
|
+
var Ie = yt | j | Lt;
|
|
11219
|
+
var Fi = 1023;
|
|
11220
|
+
var ie = (n2) => n2.isFile() ? Ke : n2.isDirectory() ? U : n2.isSymbolicLink() ? X : n2.isCharacterDevice() ? He : n2.isBlockDevice() ? qe : n2.isSocket() ? Ve : n2.isFIFO() ? Ge : L;
|
|
11221
|
+
var ze = new ft({ max: 2 ** 12 });
|
|
11222
|
+
var bt = (n2) => {
|
|
11223
|
+
let t = ze.get(n2);
|
|
11224
|
+
if (t)
|
|
11225
|
+
return t;
|
|
11226
|
+
let e = n2.normalize("NFKD");
|
|
11227
|
+
return ze.set(n2, e), e;
|
|
11228
|
+
};
|
|
11229
|
+
var Be = new ft({ max: 2 ** 12 });
|
|
11230
|
+
var _t = (n2) => {
|
|
11231
|
+
let t = Be.get(n2);
|
|
11232
|
+
if (t)
|
|
11233
|
+
return t;
|
|
11234
|
+
let e = bt(n2.toLowerCase());
|
|
11235
|
+
return Be.set(n2, e), e;
|
|
11236
|
+
};
|
|
11237
|
+
var Wt = class extends ft {
|
|
11238
|
+
constructor() {
|
|
11239
|
+
super({ max: 256 });
|
|
11240
|
+
}
|
|
11241
|
+
};
|
|
11242
|
+
var ne = class extends ft {
|
|
11243
|
+
constructor(t = 16 * 1024) {
|
|
11244
|
+
super({ maxSize: t, sizeCalculation: (e) => e.length + 1 });
|
|
11245
|
+
}
|
|
11246
|
+
};
|
|
11247
|
+
var Ye = Symbol("PathScurry setAsCwd");
|
|
11248
|
+
var R = class {
|
|
11249
|
+
name;
|
|
11250
|
+
root;
|
|
11251
|
+
roots;
|
|
11252
|
+
parent;
|
|
11253
|
+
nocase;
|
|
11254
|
+
isCWD = false;
|
|
11255
|
+
#t;
|
|
11256
|
+
#s;
|
|
11257
|
+
get dev() {
|
|
11258
|
+
return this.#s;
|
|
11259
|
+
}
|
|
11260
|
+
#n;
|
|
11261
|
+
get mode() {
|
|
11262
|
+
return this.#n;
|
|
11263
|
+
}
|
|
11264
|
+
#r;
|
|
11265
|
+
get nlink() {
|
|
11266
|
+
return this.#r;
|
|
11267
|
+
}
|
|
11268
|
+
#o;
|
|
11269
|
+
get uid() {
|
|
11270
|
+
return this.#o;
|
|
11271
|
+
}
|
|
11272
|
+
#S;
|
|
11273
|
+
get gid() {
|
|
11274
|
+
return this.#S;
|
|
11275
|
+
}
|
|
11276
|
+
#w;
|
|
11277
|
+
get rdev() {
|
|
11278
|
+
return this.#w;
|
|
11279
|
+
}
|
|
11280
|
+
#c;
|
|
11281
|
+
get blksize() {
|
|
11282
|
+
return this.#c;
|
|
11283
|
+
}
|
|
11284
|
+
#h;
|
|
11285
|
+
get ino() {
|
|
11286
|
+
return this.#h;
|
|
11287
|
+
}
|
|
11288
|
+
#u;
|
|
11289
|
+
get size() {
|
|
11290
|
+
return this.#u;
|
|
11291
|
+
}
|
|
11292
|
+
#f;
|
|
11293
|
+
get blocks() {
|
|
11294
|
+
return this.#f;
|
|
11295
|
+
}
|
|
11296
|
+
#a;
|
|
11297
|
+
get atimeMs() {
|
|
11298
|
+
return this.#a;
|
|
11299
|
+
}
|
|
11300
|
+
#i;
|
|
11301
|
+
get mtimeMs() {
|
|
11302
|
+
return this.#i;
|
|
11303
|
+
}
|
|
11304
|
+
#d;
|
|
11305
|
+
get ctimeMs() {
|
|
11306
|
+
return this.#d;
|
|
11307
|
+
}
|
|
11308
|
+
#E;
|
|
11309
|
+
get birthtimeMs() {
|
|
11310
|
+
return this.#E;
|
|
11311
|
+
}
|
|
11312
|
+
#b;
|
|
11313
|
+
get atime() {
|
|
11314
|
+
return this.#b;
|
|
11315
|
+
}
|
|
11316
|
+
#p;
|
|
11317
|
+
get mtime() {
|
|
11318
|
+
return this.#p;
|
|
11319
|
+
}
|
|
11320
|
+
#R;
|
|
11321
|
+
get ctime() {
|
|
11322
|
+
return this.#R;
|
|
11323
|
+
}
|
|
11324
|
+
#m;
|
|
11325
|
+
get birthtime() {
|
|
11326
|
+
return this.#m;
|
|
11327
|
+
}
|
|
11328
|
+
#C;
|
|
11329
|
+
#T;
|
|
11330
|
+
#g;
|
|
11331
|
+
#y;
|
|
11332
|
+
#x;
|
|
11333
|
+
#A;
|
|
11334
|
+
#e;
|
|
11335
|
+
#_;
|
|
11336
|
+
#M;
|
|
11337
|
+
#k;
|
|
11338
|
+
get parentPath() {
|
|
11339
|
+
return (this.parent || this).fullpath();
|
|
11340
|
+
}
|
|
11341
|
+
get path() {
|
|
11342
|
+
return this.parentPath;
|
|
11343
|
+
}
|
|
11344
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
11345
|
+
this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
|
|
11346
|
+
}
|
|
11347
|
+
depth() {
|
|
11348
|
+
return this.#T !== undefined ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
|
|
11349
|
+
}
|
|
11350
|
+
childrenCache() {
|
|
11351
|
+
return this.#_;
|
|
11352
|
+
}
|
|
11353
|
+
resolve(t) {
|
|
11354
|
+
if (!t)
|
|
11355
|
+
return this;
|
|
11356
|
+
let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
|
|
11357
|
+
return e ? this.getRoot(e).#N(i) : this.#N(i);
|
|
11358
|
+
}
|
|
11359
|
+
#N(t) {
|
|
11360
|
+
let e = this;
|
|
11361
|
+
for (let s of t)
|
|
11362
|
+
e = e.child(s);
|
|
11363
|
+
return e;
|
|
11364
|
+
}
|
|
11365
|
+
children() {
|
|
11366
|
+
let t = this.#_.get(this);
|
|
11367
|
+
if (t)
|
|
11368
|
+
return t;
|
|
11369
|
+
let e = Object.assign([], { provisional: 0 });
|
|
11370
|
+
return this.#_.set(this, e), this.#e &= ~se, e;
|
|
11371
|
+
}
|
|
11372
|
+
child(t, e) {
|
|
11373
|
+
if (t === "" || t === ".")
|
|
11374
|
+
return this;
|
|
11375
|
+
if (t === "..")
|
|
11376
|
+
return this.parent || this;
|
|
11377
|
+
let s = this.children(), i = this.nocase ? _t(t) : bt(t);
|
|
11378
|
+
for (let a of s)
|
|
11379
|
+
if (a.#C === i)
|
|
11380
|
+
return a;
|
|
11381
|
+
let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : undefined, h = this.newChild(t, L, { ...e, parent: this, fullpath: o });
|
|
11382
|
+
return this.canReaddir() || (h.#e |= j), s.push(h), h;
|
|
11383
|
+
}
|
|
11384
|
+
relative() {
|
|
11385
|
+
if (this.isCWD)
|
|
11386
|
+
return "";
|
|
11387
|
+
if (this.#x !== undefined)
|
|
11388
|
+
return this.#x;
|
|
11389
|
+
let t = this.name, e = this.parent;
|
|
11390
|
+
if (!e)
|
|
11391
|
+
return this.#x = this.name;
|
|
11392
|
+
let s = e.relative();
|
|
11393
|
+
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
11394
|
+
}
|
|
11395
|
+
relativePosix() {
|
|
11396
|
+
if (this.sep === "/")
|
|
11397
|
+
return this.relative();
|
|
11398
|
+
if (this.isCWD)
|
|
11399
|
+
return "";
|
|
11400
|
+
if (this.#A !== undefined)
|
|
11401
|
+
return this.#A;
|
|
11402
|
+
let t = this.name, e = this.parent;
|
|
11403
|
+
if (!e)
|
|
11404
|
+
return this.#A = this.fullpathPosix();
|
|
11405
|
+
let s = e.relativePosix();
|
|
11406
|
+
return s + (!s || !e.parent ? "" : "/") + t;
|
|
11407
|
+
}
|
|
11408
|
+
fullpath() {
|
|
11409
|
+
if (this.#g !== undefined)
|
|
11410
|
+
return this.#g;
|
|
11411
|
+
let t = this.name, e = this.parent;
|
|
11412
|
+
if (!e)
|
|
11413
|
+
return this.#g = this.name;
|
|
11414
|
+
let i = e.fullpath() + (e.parent ? this.sep : "") + t;
|
|
11415
|
+
return this.#g = i;
|
|
11416
|
+
}
|
|
11417
|
+
fullpathPosix() {
|
|
11418
|
+
if (this.#y !== undefined)
|
|
11419
|
+
return this.#y;
|
|
11420
|
+
if (this.sep === "/")
|
|
11421
|
+
return this.#y = this.fullpath();
|
|
11422
|
+
if (!this.parent) {
|
|
11423
|
+
let i = this.fullpath().replace(/\\/g, "/");
|
|
11424
|
+
return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
|
|
11425
|
+
}
|
|
11426
|
+
let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
11427
|
+
return this.#y = s;
|
|
11428
|
+
}
|
|
11429
|
+
isUnknown() {
|
|
11430
|
+
return (this.#e & _) === L;
|
|
11431
|
+
}
|
|
11432
|
+
isType(t) {
|
|
11433
|
+
return this[`is${t}`]();
|
|
11434
|
+
}
|
|
11435
|
+
getType() {
|
|
11436
|
+
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
11437
|
+
}
|
|
11438
|
+
isFile() {
|
|
11439
|
+
return (this.#e & _) === Ke;
|
|
11440
|
+
}
|
|
11441
|
+
isDirectory() {
|
|
11442
|
+
return (this.#e & _) === U;
|
|
11443
|
+
}
|
|
11444
|
+
isCharacterDevice() {
|
|
11445
|
+
return (this.#e & _) === He;
|
|
11446
|
+
}
|
|
11447
|
+
isBlockDevice() {
|
|
11448
|
+
return (this.#e & _) === qe;
|
|
11449
|
+
}
|
|
11450
|
+
isFIFO() {
|
|
11451
|
+
return (this.#e & _) === Ge;
|
|
11452
|
+
}
|
|
11453
|
+
isSocket() {
|
|
11454
|
+
return (this.#e & _) === Ve;
|
|
11455
|
+
}
|
|
11456
|
+
isSymbolicLink() {
|
|
11457
|
+
return (this.#e & X) === X;
|
|
11458
|
+
}
|
|
11459
|
+
lstatCached() {
|
|
11460
|
+
return this.#e & je ? this : undefined;
|
|
11461
|
+
}
|
|
11462
|
+
readlinkCached() {
|
|
11463
|
+
return this.#M;
|
|
11464
|
+
}
|
|
11465
|
+
realpathCached() {
|
|
11466
|
+
return this.#k;
|
|
11467
|
+
}
|
|
11468
|
+
readdirCached() {
|
|
11469
|
+
let t = this.children();
|
|
11470
|
+
return t.slice(0, t.provisional);
|
|
11471
|
+
}
|
|
11472
|
+
canReadlink() {
|
|
11473
|
+
if (this.#M)
|
|
11474
|
+
return true;
|
|
11475
|
+
if (!this.parent)
|
|
11476
|
+
return false;
|
|
11477
|
+
let t = this.#e & _;
|
|
11478
|
+
return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
|
|
11479
|
+
}
|
|
11480
|
+
calledReaddir() {
|
|
11481
|
+
return !!(this.#e & se);
|
|
11482
|
+
}
|
|
11483
|
+
isENOENT() {
|
|
11484
|
+
return !!(this.#e & j);
|
|
11485
|
+
}
|
|
11486
|
+
isNamed(t) {
|
|
11487
|
+
return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
|
|
11488
|
+
}
|
|
11489
|
+
async readlink() {
|
|
11490
|
+
let t = this.#M;
|
|
11491
|
+
if (t)
|
|
11492
|
+
return t;
|
|
11493
|
+
if (this.canReadlink() && this.parent)
|
|
11494
|
+
try {
|
|
11495
|
+
let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
|
|
11496
|
+
if (s)
|
|
11497
|
+
return this.#M = s;
|
|
11498
|
+
} catch (e) {
|
|
11499
|
+
this.#D(e.code);
|
|
11500
|
+
return;
|
|
11501
|
+
}
|
|
11502
|
+
}
|
|
11503
|
+
readlinkSync() {
|
|
11504
|
+
let t = this.#M;
|
|
11505
|
+
if (t)
|
|
11506
|
+
return t;
|
|
11507
|
+
if (this.canReadlink() && this.parent)
|
|
11508
|
+
try {
|
|
11509
|
+
let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
|
|
11510
|
+
if (s)
|
|
11511
|
+
return this.#M = s;
|
|
11512
|
+
} catch (e) {
|
|
11513
|
+
this.#D(e.code);
|
|
11514
|
+
return;
|
|
11515
|
+
}
|
|
11516
|
+
}
|
|
11517
|
+
#j(t) {
|
|
11518
|
+
this.#e |= se;
|
|
11519
|
+
for (let e = t.provisional;e < t.length; e++) {
|
|
11520
|
+
let s = t[e];
|
|
11521
|
+
s && s.#v();
|
|
11522
|
+
}
|
|
11523
|
+
}
|
|
11524
|
+
#v() {
|
|
11525
|
+
this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
|
|
11526
|
+
}
|
|
11527
|
+
#G() {
|
|
11528
|
+
let t = this.children();
|
|
11529
|
+
t.provisional = 0;
|
|
11530
|
+
for (let e of t)
|
|
11531
|
+
e.#v();
|
|
11532
|
+
}
|
|
11533
|
+
#P() {
|
|
11534
|
+
this.#e |= Lt, this.#L();
|
|
11535
|
+
}
|
|
11536
|
+
#L() {
|
|
11537
|
+
if (this.#e & yt)
|
|
11538
|
+
return;
|
|
11539
|
+
let t = this.#e;
|
|
11540
|
+
(t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
|
|
11541
|
+
}
|
|
11542
|
+
#I(t = "") {
|
|
11543
|
+
t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
|
|
11544
|
+
}
|
|
11545
|
+
#F(t = "") {
|
|
11546
|
+
t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
|
|
11547
|
+
}
|
|
11548
|
+
#D(t = "") {
|
|
11549
|
+
let e = this.#e;
|
|
11550
|
+
e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
|
|
11551
|
+
}
|
|
11552
|
+
#z(t, e) {
|
|
11553
|
+
return this.#U(t, e) || this.#B(t, e);
|
|
11554
|
+
}
|
|
11555
|
+
#B(t, e) {
|
|
11556
|
+
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
|
|
11557
|
+
return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
|
|
11558
|
+
}
|
|
11559
|
+
#U(t, e) {
|
|
11560
|
+
for (let s = e.provisional;s < e.length; s++) {
|
|
11561
|
+
let i = e[s];
|
|
11562
|
+
if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C)
|
|
11563
|
+
return this.#l(t, i, s, e);
|
|
11564
|
+
}
|
|
11565
|
+
}
|
|
11566
|
+
#l(t, e, s, i) {
|
|
11567
|
+
let r = e.name;
|
|
11568
|
+
return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
|
|
11569
|
+
}
|
|
11570
|
+
async lstat() {
|
|
11571
|
+
if ((this.#e & j) === 0)
|
|
11572
|
+
try {
|
|
11573
|
+
return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
|
|
11574
|
+
} catch (t) {
|
|
11575
|
+
this.#F(t.code);
|
|
11576
|
+
}
|
|
11577
|
+
}
|
|
11578
|
+
lstatSync() {
|
|
11579
|
+
if ((this.#e & j) === 0)
|
|
11580
|
+
try {
|
|
11581
|
+
return this.#$(this.#t.lstatSync(this.fullpath())), this;
|
|
11582
|
+
} catch (t) {
|
|
11583
|
+
this.#F(t.code);
|
|
11584
|
+
}
|
|
11585
|
+
}
|
|
11586
|
+
#$(t) {
|
|
11587
|
+
let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
|
|
11588
|
+
this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
|
|
11589
|
+
let y = ie(t);
|
|
11590
|
+
this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
|
|
11591
|
+
}
|
|
11592
|
+
#W = [];
|
|
11593
|
+
#O = false;
|
|
11594
|
+
#H(t) {
|
|
11595
|
+
this.#O = false;
|
|
11596
|
+
let e = this.#W.slice();
|
|
11597
|
+
this.#W.length = 0, e.forEach((s) => s(null, t));
|
|
11598
|
+
}
|
|
11599
|
+
readdirCB(t, e = false) {
|
|
11600
|
+
if (!this.canReaddir()) {
|
|
11601
|
+
e ? t(null, []) : queueMicrotask(() => t(null, []));
|
|
11602
|
+
return;
|
|
11603
|
+
}
|
|
11604
|
+
let s = this.children();
|
|
11605
|
+
if (this.calledReaddir()) {
|
|
11606
|
+
let r = s.slice(0, s.provisional);
|
|
11607
|
+
e ? t(null, r) : queueMicrotask(() => t(null, r));
|
|
11608
|
+
return;
|
|
11609
|
+
}
|
|
11610
|
+
if (this.#W.push(t), this.#O)
|
|
11611
|
+
return;
|
|
11612
|
+
this.#O = true;
|
|
11613
|
+
let i = this.fullpath();
|
|
11614
|
+
this.#t.readdir(i, { withFileTypes: true }, (r, o) => {
|
|
11615
|
+
if (r)
|
|
11616
|
+
this.#I(r.code), s.provisional = 0;
|
|
11617
|
+
else {
|
|
11618
|
+
for (let h of o)
|
|
11619
|
+
this.#z(h, s);
|
|
11620
|
+
this.#j(s);
|
|
11621
|
+
}
|
|
11622
|
+
this.#H(s.slice(0, s.provisional));
|
|
11623
|
+
});
|
|
11624
|
+
}
|
|
11625
|
+
#q;
|
|
11626
|
+
async readdir() {
|
|
11627
|
+
if (!this.canReaddir())
|
|
11628
|
+
return [];
|
|
11629
|
+
let t = this.children();
|
|
11630
|
+
if (this.calledReaddir())
|
|
11631
|
+
return t.slice(0, t.provisional);
|
|
11632
|
+
let e = this.fullpath();
|
|
11633
|
+
if (this.#q)
|
|
11634
|
+
await this.#q;
|
|
11635
|
+
else {
|
|
11636
|
+
let s = () => {};
|
|
11637
|
+
this.#q = new Promise((i) => s = i);
|
|
11638
|
+
try {
|
|
11639
|
+
for (let i of await this.#t.promises.readdir(e, { withFileTypes: true }))
|
|
11640
|
+
this.#z(i, t);
|
|
11641
|
+
this.#j(t);
|
|
11642
|
+
} catch (i) {
|
|
11643
|
+
this.#I(i.code), t.provisional = 0;
|
|
11644
|
+
}
|
|
11645
|
+
this.#q = undefined, s();
|
|
11646
|
+
}
|
|
11647
|
+
return t.slice(0, t.provisional);
|
|
11648
|
+
}
|
|
11649
|
+
readdirSync() {
|
|
11650
|
+
if (!this.canReaddir())
|
|
11651
|
+
return [];
|
|
11652
|
+
let t = this.children();
|
|
11653
|
+
if (this.calledReaddir())
|
|
11654
|
+
return t.slice(0, t.provisional);
|
|
11655
|
+
let e = this.fullpath();
|
|
11656
|
+
try {
|
|
11657
|
+
for (let s of this.#t.readdirSync(e, { withFileTypes: true }))
|
|
11658
|
+
this.#z(s, t);
|
|
11659
|
+
this.#j(t);
|
|
11660
|
+
} catch (s) {
|
|
11661
|
+
this.#I(s.code), t.provisional = 0;
|
|
11662
|
+
}
|
|
11663
|
+
return t.slice(0, t.provisional);
|
|
11664
|
+
}
|
|
11665
|
+
canReaddir() {
|
|
11666
|
+
if (this.#e & Ie)
|
|
11667
|
+
return false;
|
|
11668
|
+
let t = _ & this.#e;
|
|
11669
|
+
return t === L || t === U || t === X;
|
|
11670
|
+
}
|
|
11671
|
+
shouldWalk(t, e) {
|
|
11672
|
+
return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
|
|
11673
|
+
}
|
|
11674
|
+
async realpath() {
|
|
11675
|
+
if (this.#k)
|
|
11676
|
+
return this.#k;
|
|
11677
|
+
if (!((Lt | Nt | j) & this.#e))
|
|
11678
|
+
try {
|
|
11679
|
+
let t = await this.#t.promises.realpath(this.fullpath());
|
|
11680
|
+
return this.#k = this.resolve(t);
|
|
11681
|
+
} catch {
|
|
11682
|
+
this.#P();
|
|
11683
|
+
}
|
|
11684
|
+
}
|
|
11685
|
+
realpathSync() {
|
|
11686
|
+
if (this.#k)
|
|
11687
|
+
return this.#k;
|
|
11688
|
+
if (!((Lt | Nt | j) & this.#e))
|
|
11689
|
+
try {
|
|
11690
|
+
let t = this.#t.realpathSync(this.fullpath());
|
|
11691
|
+
return this.#k = this.resolve(t);
|
|
11692
|
+
} catch {
|
|
11693
|
+
this.#P();
|
|
11694
|
+
}
|
|
11695
|
+
}
|
|
11696
|
+
[Ye](t) {
|
|
11697
|
+
if (t === this)
|
|
11698
|
+
return;
|
|
11699
|
+
t.isCWD = false, this.isCWD = true;
|
|
11700
|
+
let e = new Set([]), s = [], i = this;
|
|
11701
|
+
for (;i && i.parent; )
|
|
11702
|
+
e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
|
|
11703
|
+
for (i = t;i && i.parent && !e.has(i); )
|
|
11704
|
+
i.#x = undefined, i.#A = undefined, i = i.parent;
|
|
11705
|
+
}
|
|
11706
|
+
};
|
|
11707
|
+
var Pt = class n2 extends R {
|
|
11708
|
+
sep = "\\";
|
|
11709
|
+
splitSep = Oi;
|
|
11710
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
11711
|
+
super(t, e, s, i, r, o, h);
|
|
11712
|
+
}
|
|
11713
|
+
newChild(t, e = L, s = {}) {
|
|
11714
|
+
return new n2(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
11715
|
+
}
|
|
11716
|
+
getRootString(t) {
|
|
11717
|
+
return re.parse(t).root;
|
|
11718
|
+
}
|
|
11719
|
+
getRoot(t) {
|
|
11720
|
+
if (t = Ri(t.toUpperCase()), t === this.root.name)
|
|
11721
|
+
return this.root;
|
|
11722
|
+
for (let [e, s] of Object.entries(this.roots))
|
|
11723
|
+
if (this.sameRoot(t, e))
|
|
11724
|
+
return this.roots[t] = s;
|
|
11725
|
+
return this.roots[t] = new it(t, this).root;
|
|
11726
|
+
}
|
|
11727
|
+
sameRoot(t, e = this.root.name) {
|
|
11728
|
+
return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
|
|
11729
|
+
}
|
|
11730
|
+
};
|
|
11731
|
+
var jt = class n3 extends R {
|
|
11732
|
+
splitSep = "/";
|
|
11733
|
+
sep = "/";
|
|
11734
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
11735
|
+
super(t, e, s, i, r, o, h);
|
|
11736
|
+
}
|
|
11737
|
+
getRootString(t) {
|
|
11738
|
+
return t.startsWith("/") ? "/" : "";
|
|
11739
|
+
}
|
|
11740
|
+
getRoot(t) {
|
|
11741
|
+
return this.root;
|
|
11742
|
+
}
|
|
11743
|
+
newChild(t, e = L, s = {}) {
|
|
11744
|
+
return new n3(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
11745
|
+
}
|
|
11746
|
+
};
|
|
11747
|
+
var It = class {
|
|
11748
|
+
root;
|
|
11749
|
+
rootPath;
|
|
11750
|
+
roots;
|
|
11751
|
+
cwd;
|
|
11752
|
+
#t;
|
|
11753
|
+
#s;
|
|
11754
|
+
#n;
|
|
11755
|
+
nocase;
|
|
11756
|
+
#r;
|
|
11757
|
+
constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
|
|
11758
|
+
this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = gi(t));
|
|
11759
|
+
let h = e.resolve(t);
|
|
11760
|
+
this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt, this.#s = new Wt, this.#n = new ne(r);
|
|
11761
|
+
let a = h.substring(this.rootPath.length).split(s);
|
|
11762
|
+
if (a.length === 1 && !a[0] && a.pop(), i === undefined)
|
|
11763
|
+
throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
11764
|
+
this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
|
|
11765
|
+
let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = false;
|
|
11766
|
+
for (let m of a) {
|
|
11767
|
+
let p = u--;
|
|
11768
|
+
l = l.child(m, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d += (f ? "" : c) + m }), f = true;
|
|
11769
|
+
}
|
|
11770
|
+
this.cwd = l;
|
|
11771
|
+
}
|
|
11772
|
+
depth(t = this.cwd) {
|
|
11773
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
|
|
11774
|
+
}
|
|
11775
|
+
childrenCache() {
|
|
11776
|
+
return this.#n;
|
|
11777
|
+
}
|
|
11778
|
+
resolve(...t) {
|
|
11779
|
+
let e = "";
|
|
11780
|
+
for (let r = t.length - 1;r >= 0; r--) {
|
|
11781
|
+
let o = t[r];
|
|
11782
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o)))
|
|
11783
|
+
break;
|
|
11784
|
+
}
|
|
11785
|
+
let s = this.#t.get(e);
|
|
11786
|
+
if (s !== undefined)
|
|
11787
|
+
return s;
|
|
11788
|
+
let i = this.cwd.resolve(e).fullpath();
|
|
11789
|
+
return this.#t.set(e, i), i;
|
|
11790
|
+
}
|
|
11791
|
+
resolvePosix(...t) {
|
|
11792
|
+
let e = "";
|
|
11793
|
+
for (let r = t.length - 1;r >= 0; r--) {
|
|
11794
|
+
let o = t[r];
|
|
11795
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o)))
|
|
11796
|
+
break;
|
|
11797
|
+
}
|
|
11798
|
+
let s = this.#s.get(e);
|
|
11799
|
+
if (s !== undefined)
|
|
11800
|
+
return s;
|
|
11801
|
+
let i = this.cwd.resolve(e).fullpathPosix();
|
|
11802
|
+
return this.#s.set(e, i), i;
|
|
11803
|
+
}
|
|
11804
|
+
relative(t = this.cwd) {
|
|
11805
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
|
|
11806
|
+
}
|
|
11807
|
+
relativePosix(t = this.cwd) {
|
|
11808
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
|
|
11809
|
+
}
|
|
11810
|
+
basename(t = this.cwd) {
|
|
11811
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
|
|
11812
|
+
}
|
|
11813
|
+
dirname(t = this.cwd) {
|
|
11814
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
11815
|
+
}
|
|
11816
|
+
async readdir(t = this.cwd, e = { withFileTypes: true }) {
|
|
11817
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11818
|
+
let { withFileTypes: s } = e;
|
|
11819
|
+
if (t.canReaddir()) {
|
|
11820
|
+
let i = await t.readdir();
|
|
11821
|
+
return s ? i : i.map((r) => r.name);
|
|
11822
|
+
} else
|
|
11823
|
+
return [];
|
|
11824
|
+
}
|
|
11825
|
+
readdirSync(t = this.cwd, e = { withFileTypes: true }) {
|
|
11826
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11827
|
+
let { withFileTypes: s = true } = e;
|
|
11828
|
+
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
11829
|
+
}
|
|
11830
|
+
async lstat(t = this.cwd) {
|
|
11831
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
|
|
11832
|
+
}
|
|
11833
|
+
lstatSync(t = this.cwd) {
|
|
11834
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
11835
|
+
}
|
|
11836
|
+
async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
|
|
11837
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
11838
|
+
let s = await t.readlink();
|
|
11839
|
+
return e ? s : s?.fullpath();
|
|
11840
|
+
}
|
|
11841
|
+
readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
|
|
11842
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
11843
|
+
let s = t.readlinkSync();
|
|
11844
|
+
return e ? s : s?.fullpath();
|
|
11845
|
+
}
|
|
11846
|
+
async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
|
|
11847
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
11848
|
+
let s = await t.realpath();
|
|
11849
|
+
return e ? s : s?.fullpath();
|
|
11850
|
+
}
|
|
11851
|
+
realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
|
|
11852
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
11853
|
+
let s = t.realpathSync();
|
|
11854
|
+
return e ? s : s?.fullpath();
|
|
11855
|
+
}
|
|
11856
|
+
async walk(t = this.cwd, e = {}) {
|
|
11857
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11858
|
+
let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
|
|
11859
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
11860
|
+
let a = new Set, l = (c, d) => {
|
|
11861
|
+
a.add(c), c.readdirCB((f, m) => {
|
|
11862
|
+
if (f)
|
|
11863
|
+
return d(f);
|
|
11864
|
+
let p = m.length;
|
|
11865
|
+
if (!p)
|
|
11866
|
+
return d();
|
|
11867
|
+
let w = () => {
|
|
11868
|
+
--p === 0 && d();
|
|
11869
|
+
};
|
|
11870
|
+
for (let g of m)
|
|
11871
|
+
(!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
|
|
11872
|
+
}, true);
|
|
11873
|
+
}, u = t;
|
|
11874
|
+
return new Promise((c, d) => {
|
|
11875
|
+
l(u, (f) => {
|
|
11876
|
+
if (f)
|
|
11877
|
+
return d(f);
|
|
11878
|
+
c(h);
|
|
11879
|
+
});
|
|
11880
|
+
});
|
|
11881
|
+
}
|
|
11882
|
+
walkSync(t = this.cwd, e = {}) {
|
|
11883
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11884
|
+
let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
|
|
11885
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
11886
|
+
let a = new Set([t]);
|
|
11887
|
+
for (let l of a) {
|
|
11888
|
+
let u = l.readdirSync();
|
|
11889
|
+
for (let c of u) {
|
|
11890
|
+
(!r || r(c)) && h.push(s ? c : c.fullpath());
|
|
11891
|
+
let d = c;
|
|
11892
|
+
if (c.isSymbolicLink()) {
|
|
11893
|
+
if (!(i && (d = c.realpathSync())))
|
|
11894
|
+
continue;
|
|
11895
|
+
d.isUnknown() && d.lstatSync();
|
|
11896
|
+
}
|
|
11897
|
+
d.shouldWalk(a, o) && a.add(d);
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
return h;
|
|
11901
|
+
}
|
|
11902
|
+
[Symbol.asyncIterator]() {
|
|
11903
|
+
return this.iterate();
|
|
11904
|
+
}
|
|
11905
|
+
iterate(t = this.cwd, e = {}) {
|
|
11906
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
11907
|
+
}
|
|
11908
|
+
[Symbol.iterator]() {
|
|
11909
|
+
return this.iterateSync();
|
|
11910
|
+
}
|
|
11911
|
+
*iterateSync(t = this.cwd, e = {}) {
|
|
11912
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11913
|
+
let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e;
|
|
11914
|
+
(!r || r(t)) && (yield s ? t : t.fullpath());
|
|
11915
|
+
let h = new Set([t]);
|
|
11916
|
+
for (let a of h) {
|
|
11917
|
+
let l = a.readdirSync();
|
|
11918
|
+
for (let u of l) {
|
|
11919
|
+
(!r || r(u)) && (yield s ? u : u.fullpath());
|
|
11920
|
+
let c = u;
|
|
11921
|
+
if (u.isSymbolicLink()) {
|
|
11922
|
+
if (!(i && (c = u.realpathSync())))
|
|
11923
|
+
continue;
|
|
11924
|
+
c.isUnknown() && c.lstatSync();
|
|
11925
|
+
}
|
|
11926
|
+
c.shouldWalk(h, o) && h.add(c);
|
|
11927
|
+
}
|
|
11928
|
+
}
|
|
11929
|
+
}
|
|
11930
|
+
stream(t = this.cwd, e = {}) {
|
|
11931
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11932
|
+
let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true });
|
|
11933
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
11934
|
+
let a = new Set, l = [t], u = 0, c = () => {
|
|
11935
|
+
let d = false;
|
|
11936
|
+
for (;!d; ) {
|
|
11937
|
+
let f = l.shift();
|
|
11938
|
+
if (!f) {
|
|
11939
|
+
u === 0 && h.end();
|
|
11940
|
+
return;
|
|
11941
|
+
}
|
|
11942
|
+
u++, a.add(f);
|
|
11943
|
+
let m = (w, g, S = false) => {
|
|
11944
|
+
if (w)
|
|
11945
|
+
return h.emit("error", w);
|
|
11946
|
+
if (i && !S) {
|
|
11947
|
+
let E = [];
|
|
11948
|
+
for (let y of g)
|
|
11949
|
+
y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
|
|
11950
|
+
if (E.length) {
|
|
11951
|
+
Promise.all(E).then(() => m(null, g, true));
|
|
11952
|
+
return;
|
|
11953
|
+
}
|
|
11954
|
+
}
|
|
11955
|
+
for (let E of g)
|
|
11956
|
+
E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = true));
|
|
11957
|
+
u--;
|
|
11958
|
+
for (let E of g) {
|
|
11959
|
+
let y = E.realpathCached() || E;
|
|
11960
|
+
y.shouldWalk(a, o) && l.push(y);
|
|
11961
|
+
}
|
|
11962
|
+
d && !h.flowing ? h.once("drain", c) : p || c();
|
|
11963
|
+
}, p = true;
|
|
11964
|
+
f.readdirCB(m, true), p = false;
|
|
11965
|
+
}
|
|
11966
|
+
};
|
|
11967
|
+
return c(), h;
|
|
11968
|
+
}
|
|
11969
|
+
streamSync(t = this.cwd, e = {}) {
|
|
11970
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
11971
|
+
let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true }), a = new Set;
|
|
11972
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
11973
|
+
let l = [t], u = 0, c = () => {
|
|
11974
|
+
let d = false;
|
|
11975
|
+
for (;!d; ) {
|
|
11976
|
+
let f = l.shift();
|
|
11977
|
+
if (!f) {
|
|
11978
|
+
u === 0 && h.end();
|
|
11979
|
+
return;
|
|
11980
|
+
}
|
|
11981
|
+
u++, a.add(f);
|
|
11982
|
+
let m = f.readdirSync();
|
|
11983
|
+
for (let p of m)
|
|
11984
|
+
(!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = true));
|
|
11985
|
+
u--;
|
|
11986
|
+
for (let p of m) {
|
|
11987
|
+
let w = p;
|
|
11988
|
+
if (p.isSymbolicLink()) {
|
|
11989
|
+
if (!(i && (w = p.realpathSync())))
|
|
11990
|
+
continue;
|
|
11991
|
+
w.isUnknown() && w.lstatSync();
|
|
11992
|
+
}
|
|
11993
|
+
w.shouldWalk(a, o) && l.push(w);
|
|
11994
|
+
}
|
|
11995
|
+
}
|
|
11996
|
+
d && !h.flowing && h.once("drain", c);
|
|
11997
|
+
};
|
|
11998
|
+
return c(), h;
|
|
11999
|
+
}
|
|
12000
|
+
chdir(t = this.cwd) {
|
|
12001
|
+
let e = this.cwd;
|
|
12002
|
+
this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
|
|
12003
|
+
}
|
|
12004
|
+
};
|
|
12005
|
+
var it = class extends It {
|
|
12006
|
+
sep = "\\";
|
|
12007
|
+
constructor(t = process.cwd(), e = {}) {
|
|
12008
|
+
let { nocase: s = true } = e;
|
|
12009
|
+
super(t, re, "\\", { ...e, nocase: s }), this.nocase = s;
|
|
12010
|
+
for (let i = this.cwd;i; i = i.parent)
|
|
12011
|
+
i.nocase = this.nocase;
|
|
12012
|
+
}
|
|
12013
|
+
parseRootPath(t) {
|
|
12014
|
+
return re.parse(t).root.toUpperCase();
|
|
12015
|
+
}
|
|
12016
|
+
newRoot(t) {
|
|
12017
|
+
return new Pt(this.rootPath, U, undefined, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
12018
|
+
}
|
|
12019
|
+
isAbsolute(t) {
|
|
12020
|
+
return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
|
|
12021
|
+
}
|
|
12022
|
+
};
|
|
12023
|
+
var rt = class extends It {
|
|
12024
|
+
sep = "/";
|
|
12025
|
+
constructor(t = process.cwd(), e = {}) {
|
|
12026
|
+
let { nocase: s = false } = e;
|
|
12027
|
+
super(t, mi, "/", { ...e, nocase: s }), this.nocase = s;
|
|
12028
|
+
}
|
|
12029
|
+
parseRootPath(t) {
|
|
12030
|
+
return "/";
|
|
12031
|
+
}
|
|
12032
|
+
newRoot(t) {
|
|
12033
|
+
return new jt(this.rootPath, U, undefined, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
12034
|
+
}
|
|
12035
|
+
isAbsolute(t) {
|
|
12036
|
+
return t.startsWith("/");
|
|
12037
|
+
}
|
|
12038
|
+
};
|
|
12039
|
+
var St = class extends rt {
|
|
12040
|
+
constructor(t = process.cwd(), e = {}) {
|
|
12041
|
+
let { nocase: s = true } = e;
|
|
12042
|
+
super(t, { ...e, nocase: s });
|
|
12043
|
+
}
|
|
12044
|
+
};
|
|
12045
|
+
var Cr = process.platform === "win32" ? Pt : jt;
|
|
12046
|
+
var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
|
|
12047
|
+
var Di = (n4) => n4.length >= 1;
|
|
12048
|
+
var Mi = (n4) => n4.length >= 1;
|
|
12049
|
+
var Ni = Symbol.for("nodejs.util.inspect.custom");
|
|
12050
|
+
var nt = class n4 {
|
|
12051
|
+
#t;
|
|
12052
|
+
#s;
|
|
12053
|
+
#n;
|
|
12054
|
+
length;
|
|
12055
|
+
#r;
|
|
12056
|
+
#o;
|
|
12057
|
+
#S;
|
|
12058
|
+
#w;
|
|
12059
|
+
#c;
|
|
12060
|
+
#h;
|
|
12061
|
+
#u = true;
|
|
12062
|
+
constructor(t, e, s, i) {
|
|
12063
|
+
if (!Di(t))
|
|
12064
|
+
throw new TypeError("empty pattern list");
|
|
12065
|
+
if (!Mi(e))
|
|
12066
|
+
throw new TypeError("empty glob list");
|
|
12067
|
+
if (e.length !== t.length)
|
|
12068
|
+
throw new TypeError("mismatched pattern list and glob list lengths");
|
|
12069
|
+
if (this.length = t.length, s < 0 || s >= this.length)
|
|
12070
|
+
throw new TypeError("index out of range");
|
|
12071
|
+
if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
|
|
12072
|
+
if (this.isUNC()) {
|
|
12073
|
+
let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
|
|
12074
|
+
l[0] === "" && (l.shift(), m.shift());
|
|
12075
|
+
let p = [r, o, h, a, ""].join("/"), w = [u, c, d, f, ""].join("/");
|
|
12076
|
+
this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
|
|
12077
|
+
} else if (this.isDrive() || this.isAbsolute()) {
|
|
12078
|
+
let [r, ...o] = this.#t, [h, ...a] = this.#s;
|
|
12079
|
+
o[0] === "" && (o.shift(), a.shift());
|
|
12080
|
+
let l = r + "/", u = h + "/";
|
|
12081
|
+
this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
|
|
12082
|
+
}
|
|
12083
|
+
}
|
|
12084
|
+
}
|
|
12085
|
+
[Ni]() {
|
|
12086
|
+
return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
|
|
12087
|
+
}
|
|
12088
|
+
pattern() {
|
|
12089
|
+
return this.#t[this.#n];
|
|
12090
|
+
}
|
|
12091
|
+
isString() {
|
|
12092
|
+
return typeof this.#t[this.#n] == "string";
|
|
12093
|
+
}
|
|
12094
|
+
isGlobstar() {
|
|
12095
|
+
return this.#t[this.#n] === A;
|
|
12096
|
+
}
|
|
12097
|
+
isRegExp() {
|
|
12098
|
+
return this.#t[this.#n] instanceof RegExp;
|
|
12099
|
+
}
|
|
12100
|
+
globString() {
|
|
12101
|
+
return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
|
|
12102
|
+
}
|
|
12103
|
+
hasMore() {
|
|
12104
|
+
return this.length > this.#n + 1;
|
|
12105
|
+
}
|
|
12106
|
+
rest() {
|
|
12107
|
+
return this.#o !== undefined ? this.#o : this.hasMore() ? (this.#o = new n4(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
|
|
12108
|
+
}
|
|
12109
|
+
isUNC() {
|
|
12110
|
+
let t = this.#t;
|
|
12111
|
+
return this.#c !== undefined ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
|
|
12112
|
+
}
|
|
12113
|
+
isDrive() {
|
|
12114
|
+
let t = this.#t;
|
|
12115
|
+
return this.#w !== undefined ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
|
|
12116
|
+
}
|
|
12117
|
+
isAbsolute() {
|
|
12118
|
+
let t = this.#t;
|
|
12119
|
+
return this.#h !== undefined ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
|
|
12120
|
+
}
|
|
12121
|
+
root() {
|
|
12122
|
+
let t = this.#t[0];
|
|
12123
|
+
return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
|
|
12124
|
+
}
|
|
12125
|
+
checkFollowGlobstar() {
|
|
12126
|
+
return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
|
|
12127
|
+
}
|
|
12128
|
+
markFollowGlobstar() {
|
|
12129
|
+
return this.#n === 0 || !this.isGlobstar() || !this.#u ? false : (this.#u = false, true);
|
|
12130
|
+
}
|
|
12131
|
+
};
|
|
12132
|
+
var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
|
|
12133
|
+
var ot = class {
|
|
12134
|
+
relative;
|
|
12135
|
+
relativeChildren;
|
|
12136
|
+
absolute;
|
|
12137
|
+
absoluteChildren;
|
|
12138
|
+
platform;
|
|
12139
|
+
mmopts;
|
|
12140
|
+
constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
|
|
12141
|
+
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, optimizationLevel: 2, platform: o, nocomment: true, nonegate: true };
|
|
12142
|
+
for (let h of t)
|
|
12143
|
+
this.add(h);
|
|
12144
|
+
}
|
|
12145
|
+
add(t) {
|
|
12146
|
+
let e = new D(t, this.mmopts);
|
|
12147
|
+
for (let s = 0;s < e.set.length; s++) {
|
|
12148
|
+
let i = e.set[s], r = e.globParts[s];
|
|
12149
|
+
if (!i || !r)
|
|
12150
|
+
throw new Error("invalid pattern object");
|
|
12151
|
+
for (;i[0] === "." && r[0] === "."; )
|
|
12152
|
+
i.shift(), r.shift();
|
|
12153
|
+
let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
|
|
12154
|
+
l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
|
|
12155
|
+
}
|
|
12156
|
+
}
|
|
12157
|
+
ignored(t) {
|
|
12158
|
+
let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
|
|
12159
|
+
for (let o of this.relative)
|
|
12160
|
+
if (o.match(i) || o.match(r))
|
|
12161
|
+
return true;
|
|
12162
|
+
for (let o of this.absolute)
|
|
12163
|
+
if (o.match(e) || o.match(s))
|
|
12164
|
+
return true;
|
|
12165
|
+
return false;
|
|
12166
|
+
}
|
|
12167
|
+
childrenIgnored(t) {
|
|
12168
|
+
let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
|
|
12169
|
+
for (let i of this.relativeChildren)
|
|
12170
|
+
if (i.match(s))
|
|
12171
|
+
return true;
|
|
12172
|
+
for (let i of this.absoluteChildren)
|
|
12173
|
+
if (i.match(e))
|
|
12174
|
+
return true;
|
|
12175
|
+
return false;
|
|
12176
|
+
}
|
|
12177
|
+
};
|
|
12178
|
+
var oe = class n5 {
|
|
12179
|
+
store;
|
|
12180
|
+
constructor(t = new Map) {
|
|
12181
|
+
this.store = t;
|
|
12182
|
+
}
|
|
12183
|
+
copy() {
|
|
12184
|
+
return new n5(new Map(this.store));
|
|
12185
|
+
}
|
|
12186
|
+
hasWalked(t, e) {
|
|
12187
|
+
return this.store.get(t.fullpath())?.has(e.globString());
|
|
12188
|
+
}
|
|
12189
|
+
storeWalked(t, e) {
|
|
12190
|
+
let s = t.fullpath(), i = this.store.get(s);
|
|
12191
|
+
i ? i.add(e.globString()) : this.store.set(s, new Set([e.globString()]));
|
|
12192
|
+
}
|
|
12193
|
+
};
|
|
12194
|
+
var he = class {
|
|
12195
|
+
store = new Map;
|
|
12196
|
+
add(t, e, s) {
|
|
12197
|
+
let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
|
|
12198
|
+
this.store.set(t, r === undefined ? i : i & r);
|
|
12199
|
+
}
|
|
12200
|
+
entries() {
|
|
12201
|
+
return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]);
|
|
12202
|
+
}
|
|
12203
|
+
};
|
|
12204
|
+
var ae = class {
|
|
12205
|
+
store = new Map;
|
|
12206
|
+
add(t, e) {
|
|
12207
|
+
if (!t.canReaddir())
|
|
12208
|
+
return;
|
|
12209
|
+
let s = this.store.get(t);
|
|
12210
|
+
s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
|
|
12211
|
+
}
|
|
12212
|
+
get(t) {
|
|
12213
|
+
let e = this.store.get(t);
|
|
12214
|
+
if (!e)
|
|
12215
|
+
throw new Error("attempting to walk unknown path");
|
|
12216
|
+
return e;
|
|
12217
|
+
}
|
|
12218
|
+
entries() {
|
|
12219
|
+
return this.keys().map((t) => [t, this.store.get(t)]);
|
|
12220
|
+
}
|
|
12221
|
+
keys() {
|
|
12222
|
+
return [...this.store.keys()].filter((t) => t.canReaddir());
|
|
12223
|
+
}
|
|
12224
|
+
};
|
|
12225
|
+
var Et = class n6 {
|
|
12226
|
+
hasWalkedCache;
|
|
12227
|
+
matches = new he;
|
|
12228
|
+
subwalks = new ae;
|
|
12229
|
+
patterns;
|
|
12230
|
+
follow;
|
|
12231
|
+
dot;
|
|
12232
|
+
opts;
|
|
12233
|
+
constructor(t, e) {
|
|
12234
|
+
this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe;
|
|
12235
|
+
}
|
|
12236
|
+
processPatterns(t, e) {
|
|
12237
|
+
this.patterns = e;
|
|
12238
|
+
let s = e.map((i) => [t, i]);
|
|
12239
|
+
for (let [i, r] of s) {
|
|
12240
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
12241
|
+
let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== false;
|
|
12242
|
+
if (o) {
|
|
12243
|
+
i = i.resolve(o === "/" && this.opts.root !== undefined ? this.opts.root : o);
|
|
12244
|
+
let c = r.rest();
|
|
12245
|
+
if (c)
|
|
12246
|
+
r = c;
|
|
12247
|
+
else {
|
|
12248
|
+
this.matches.add(i, true, false);
|
|
12249
|
+
continue;
|
|
12250
|
+
}
|
|
12251
|
+
}
|
|
12252
|
+
if (i.isENOENT())
|
|
12253
|
+
continue;
|
|
12254
|
+
let a, l, u = false;
|
|
12255
|
+
for (;typeof (a = r.pattern()) == "string" && (l = r.rest()); )
|
|
12256
|
+
i = i.resolve(a), r = l, u = true;
|
|
12257
|
+
if (a = r.pattern(), l = r.rest(), u) {
|
|
12258
|
+
if (this.hasWalkedCache.hasWalked(i, r))
|
|
12259
|
+
continue;
|
|
12260
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
12261
|
+
}
|
|
12262
|
+
if (typeof a == "string") {
|
|
12263
|
+
let c = a === ".." || a === "" || a === ".";
|
|
12264
|
+
this.matches.add(i.resolve(a), h, c);
|
|
12265
|
+
continue;
|
|
12266
|
+
} else if (a === A) {
|
|
12267
|
+
(!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
|
|
12268
|
+
let c = l?.pattern(), d = l?.rest();
|
|
12269
|
+
if (!l || (c === "" || c === ".") && !d)
|
|
12270
|
+
this.matches.add(i, h, c === "" || c === ".");
|
|
12271
|
+
else if (c === "..") {
|
|
12272
|
+
let f = i.parent || i;
|
|
12273
|
+
d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, true);
|
|
12274
|
+
}
|
|
12275
|
+
} else
|
|
12276
|
+
a instanceof RegExp && this.subwalks.add(i, r);
|
|
12277
|
+
}
|
|
12278
|
+
return this;
|
|
12279
|
+
}
|
|
12280
|
+
subwalkTargets() {
|
|
12281
|
+
return this.subwalks.keys();
|
|
12282
|
+
}
|
|
12283
|
+
child() {
|
|
12284
|
+
return new n6(this.opts, this.hasWalkedCache);
|
|
12285
|
+
}
|
|
12286
|
+
filterEntries(t, e) {
|
|
12287
|
+
let s = this.subwalks.get(t), i = this.child();
|
|
12288
|
+
for (let r of e)
|
|
12289
|
+
for (let o of s) {
|
|
12290
|
+
let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
|
|
12291
|
+
a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
|
|
12292
|
+
}
|
|
12293
|
+
return i;
|
|
12294
|
+
}
|
|
12295
|
+
testGlobstar(t, e, s, i) {
|
|
12296
|
+
if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, false), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
|
|
12297
|
+
let r = s.pattern();
|
|
12298
|
+
if (typeof r == "string" && r !== ".." && r !== "" && r !== ".")
|
|
12299
|
+
this.testString(t, r, s.rest(), i);
|
|
12300
|
+
else if (r === "..") {
|
|
12301
|
+
let o = t.parent || t;
|
|
12302
|
+
this.subwalks.add(o, s);
|
|
12303
|
+
} else
|
|
12304
|
+
r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
|
|
12305
|
+
}
|
|
12306
|
+
}
|
|
12307
|
+
testRegExp(t, e, s, i) {
|
|
12308
|
+
e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
|
|
12309
|
+
}
|
|
12310
|
+
testString(t, e, s, i) {
|
|
12311
|
+
t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
|
|
12312
|
+
}
|
|
12313
|
+
};
|
|
12314
|
+
var Li = (n7, t) => typeof n7 == "string" ? new ot([n7], t) : Array.isArray(n7) ? new ot(n7, t) : n7;
|
|
12315
|
+
var zt = class {
|
|
12316
|
+
path;
|
|
12317
|
+
patterns;
|
|
12318
|
+
opts;
|
|
12319
|
+
seen = new Set;
|
|
12320
|
+
paused = false;
|
|
12321
|
+
aborted = false;
|
|
12322
|
+
#t = [];
|
|
12323
|
+
#s;
|
|
12324
|
+
#n;
|
|
12325
|
+
signal;
|
|
12326
|
+
maxDepth;
|
|
12327
|
+
includeChildMatches;
|
|
12328
|
+
constructor(t, e, s) {
|
|
12329
|
+
if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) {
|
|
12330
|
+
let i = "cannot ignore child matches, ignore lacks add() method.";
|
|
12331
|
+
throw new Error(i);
|
|
12332
|
+
}
|
|
12333
|
+
this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
|
|
12334
|
+
this.#t.length = 0;
|
|
12335
|
+
}));
|
|
12336
|
+
}
|
|
12337
|
+
#r(t) {
|
|
12338
|
+
return this.seen.has(t) || !!this.#s?.ignored?.(t);
|
|
12339
|
+
}
|
|
12340
|
+
#o(t) {
|
|
12341
|
+
return !!this.#s?.childrenIgnored?.(t);
|
|
12342
|
+
}
|
|
12343
|
+
pause() {
|
|
12344
|
+
this.paused = true;
|
|
12345
|
+
}
|
|
12346
|
+
resume() {
|
|
12347
|
+
if (this.signal?.aborted)
|
|
12348
|
+
return;
|
|
12349
|
+
this.paused = false;
|
|
12350
|
+
let t;
|
|
12351
|
+
for (;!this.paused && (t = this.#t.shift()); )
|
|
12352
|
+
t();
|
|
12353
|
+
}
|
|
12354
|
+
onResume(t) {
|
|
12355
|
+
this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
|
|
12356
|
+
}
|
|
12357
|
+
async matchCheck(t, e) {
|
|
12358
|
+
if (e && this.opts.nodir)
|
|
12359
|
+
return;
|
|
12360
|
+
let s;
|
|
12361
|
+
if (this.opts.realpath) {
|
|
12362
|
+
if (s = t.realpathCached() || await t.realpath(), !s)
|
|
12363
|
+
return;
|
|
12364
|
+
t = s;
|
|
12365
|
+
}
|
|
12366
|
+
let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
|
|
12367
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
12368
|
+
let o = await r.realpath();
|
|
12369
|
+
o && (o.isUnknown() || this.opts.stat) && await o.lstat();
|
|
12370
|
+
}
|
|
12371
|
+
return this.matchCheckTest(r, e);
|
|
12372
|
+
}
|
|
12373
|
+
matchCheckTest(t, e) {
|
|
12374
|
+
return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : undefined;
|
|
12375
|
+
}
|
|
12376
|
+
matchCheckSync(t, e) {
|
|
12377
|
+
if (e && this.opts.nodir)
|
|
12378
|
+
return;
|
|
12379
|
+
let s;
|
|
12380
|
+
if (this.opts.realpath) {
|
|
12381
|
+
if (s = t.realpathCached() || t.realpathSync(), !s)
|
|
12382
|
+
return;
|
|
12383
|
+
t = s;
|
|
12384
|
+
}
|
|
12385
|
+
let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
|
|
12386
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
12387
|
+
let o = r.realpathSync();
|
|
12388
|
+
o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
|
|
12389
|
+
}
|
|
12390
|
+
return this.matchCheckTest(r, e);
|
|
12391
|
+
}
|
|
12392
|
+
matchFinish(t, e) {
|
|
12393
|
+
if (this.#r(t))
|
|
12394
|
+
return;
|
|
12395
|
+
if (!this.includeChildMatches && this.#s?.add) {
|
|
12396
|
+
let r = `${t.relativePosix()}/**`;
|
|
12397
|
+
this.#s.add(r);
|
|
12398
|
+
}
|
|
12399
|
+
let s = this.opts.absolute === undefined ? e : this.opts.absolute;
|
|
12400
|
+
this.seen.add(t);
|
|
12401
|
+
let i = this.opts.mark && t.isDirectory() ? this.#n : "";
|
|
12402
|
+
if (this.opts.withFileTypes)
|
|
12403
|
+
this.matchEmit(t);
|
|
12404
|
+
else if (s) {
|
|
12405
|
+
let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
|
|
12406
|
+
this.matchEmit(r + i);
|
|
12407
|
+
} else {
|
|
12408
|
+
let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
|
|
12409
|
+
this.matchEmit(r ? o + r + i : "." + i);
|
|
12410
|
+
}
|
|
12411
|
+
}
|
|
12412
|
+
async match(t, e, s) {
|
|
12413
|
+
let i = await this.matchCheck(t, s);
|
|
12414
|
+
i && this.matchFinish(i, e);
|
|
12415
|
+
}
|
|
12416
|
+
matchSync(t, e, s) {
|
|
12417
|
+
let i = this.matchCheckSync(t, s);
|
|
12418
|
+
i && this.matchFinish(i, e);
|
|
12419
|
+
}
|
|
12420
|
+
walkCB(t, e, s) {
|
|
12421
|
+
this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
|
|
12422
|
+
}
|
|
12423
|
+
walkCB2(t, e, s, i) {
|
|
12424
|
+
if (this.#o(t))
|
|
12425
|
+
return i();
|
|
12426
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
12427
|
+
this.onResume(() => this.walkCB2(t, e, s, i));
|
|
12428
|
+
return;
|
|
12429
|
+
}
|
|
12430
|
+
s.processPatterns(t, e);
|
|
12431
|
+
let r = 1, o = () => {
|
|
12432
|
+
--r === 0 && i();
|
|
12433
|
+
};
|
|
12434
|
+
for (let [h, a, l] of s.matches.entries())
|
|
12435
|
+
this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
|
|
12436
|
+
for (let h of s.subwalkTargets()) {
|
|
12437
|
+
if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth)
|
|
12438
|
+
continue;
|
|
12439
|
+
r++;
|
|
12440
|
+
let a = h.readdirCached();
|
|
12441
|
+
h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), true);
|
|
12442
|
+
}
|
|
12443
|
+
o();
|
|
12444
|
+
}
|
|
12445
|
+
walkCB3(t, e, s, i) {
|
|
12446
|
+
s = s.filterEntries(t, e);
|
|
12447
|
+
let r = 1, o = () => {
|
|
12448
|
+
--r === 0 && i();
|
|
12449
|
+
};
|
|
12450
|
+
for (let [h, a, l] of s.matches.entries())
|
|
12451
|
+
this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
|
|
12452
|
+
for (let [h, a] of s.subwalks.entries())
|
|
12453
|
+
r++, this.walkCB2(h, a, s.child(), o);
|
|
12454
|
+
o();
|
|
12455
|
+
}
|
|
12456
|
+
walkCBSync(t, e, s) {
|
|
12457
|
+
this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
|
|
12458
|
+
}
|
|
12459
|
+
walkCB2Sync(t, e, s, i) {
|
|
12460
|
+
if (this.#o(t))
|
|
12461
|
+
return i();
|
|
12462
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
12463
|
+
this.onResume(() => this.walkCB2Sync(t, e, s, i));
|
|
12464
|
+
return;
|
|
12465
|
+
}
|
|
12466
|
+
s.processPatterns(t, e);
|
|
12467
|
+
let r = 1, o = () => {
|
|
12468
|
+
--r === 0 && i();
|
|
12469
|
+
};
|
|
12470
|
+
for (let [h, a, l] of s.matches.entries())
|
|
12471
|
+
this.#r(h) || this.matchSync(h, a, l);
|
|
12472
|
+
for (let h of s.subwalkTargets()) {
|
|
12473
|
+
if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth)
|
|
12474
|
+
continue;
|
|
12475
|
+
r++;
|
|
12476
|
+
let a = h.readdirSync();
|
|
12477
|
+
this.walkCB3Sync(h, a, s, o);
|
|
12478
|
+
}
|
|
12479
|
+
o();
|
|
12480
|
+
}
|
|
12481
|
+
walkCB3Sync(t, e, s, i) {
|
|
12482
|
+
s = s.filterEntries(t, e);
|
|
12483
|
+
let r = 1, o = () => {
|
|
12484
|
+
--r === 0 && i();
|
|
12485
|
+
};
|
|
12486
|
+
for (let [h, a, l] of s.matches.entries())
|
|
12487
|
+
this.#r(h) || this.matchSync(h, a, l);
|
|
12488
|
+
for (let [h, a] of s.subwalks.entries())
|
|
12489
|
+
r++, this.walkCB2Sync(h, a, s.child(), o);
|
|
12490
|
+
o();
|
|
12491
|
+
}
|
|
12492
|
+
};
|
|
12493
|
+
var xt = class extends zt {
|
|
12494
|
+
matches = new Set;
|
|
12495
|
+
constructor(t, e, s) {
|
|
12496
|
+
super(t, e, s);
|
|
12497
|
+
}
|
|
12498
|
+
matchEmit(t) {
|
|
12499
|
+
this.matches.add(t);
|
|
12500
|
+
}
|
|
12501
|
+
async walk() {
|
|
12502
|
+
if (this.signal?.aborted)
|
|
12503
|
+
throw this.signal.reason;
|
|
12504
|
+
return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
|
|
12505
|
+
this.walkCB(this.path, this.patterns, () => {
|
|
12506
|
+
this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
|
|
12507
|
+
});
|
|
12508
|
+
}), this.matches;
|
|
12509
|
+
}
|
|
12510
|
+
walkSync() {
|
|
12511
|
+
if (this.signal?.aborted)
|
|
12512
|
+
throw this.signal.reason;
|
|
12513
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
|
|
12514
|
+
if (this.signal?.aborted)
|
|
12515
|
+
throw this.signal.reason;
|
|
12516
|
+
}), this.matches;
|
|
12517
|
+
}
|
|
12518
|
+
};
|
|
12519
|
+
var vt = class extends zt {
|
|
12520
|
+
results;
|
|
12521
|
+
constructor(t, e, s) {
|
|
12522
|
+
super(t, e, s), this.results = new V({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
12523
|
+
}
|
|
12524
|
+
matchEmit(t) {
|
|
12525
|
+
this.results.write(t), this.results.flowing || this.pause();
|
|
12526
|
+
}
|
|
12527
|
+
stream() {
|
|
12528
|
+
let t = this.path;
|
|
12529
|
+
return t.isUnknown() ? t.lstat().then(() => {
|
|
12530
|
+
this.walkCB(t, this.patterns, () => this.results.end());
|
|
12531
|
+
}) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
|
|
12532
|
+
}
|
|
12533
|
+
streamSync() {
|
|
12534
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
|
|
12535
|
+
}
|
|
12536
|
+
};
|
|
12537
|
+
var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
|
|
12538
|
+
var I = class {
|
|
12539
|
+
absolute;
|
|
12540
|
+
cwd;
|
|
12541
|
+
root;
|
|
12542
|
+
dot;
|
|
12543
|
+
dotRelative;
|
|
12544
|
+
follow;
|
|
12545
|
+
ignore;
|
|
12546
|
+
magicalBraces;
|
|
12547
|
+
mark;
|
|
12548
|
+
matchBase;
|
|
12549
|
+
maxDepth;
|
|
12550
|
+
nobrace;
|
|
12551
|
+
nocase;
|
|
12552
|
+
nodir;
|
|
12553
|
+
noext;
|
|
12554
|
+
noglobstar;
|
|
12555
|
+
pattern;
|
|
12556
|
+
platform;
|
|
12557
|
+
realpath;
|
|
12558
|
+
scurry;
|
|
12559
|
+
stat;
|
|
12560
|
+
signal;
|
|
12561
|
+
windowsPathsNoEscape;
|
|
12562
|
+
withFileTypes;
|
|
12563
|
+
includeChildMatches;
|
|
12564
|
+
opts;
|
|
12565
|
+
patterns;
|
|
12566
|
+
constructor(t, e) {
|
|
12567
|
+
if (!e)
|
|
12568
|
+
throw new TypeError("glob options required");
|
|
12569
|
+
if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = Wi(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== undefined)
|
|
12570
|
+
throw new Error("cannot set absolute and withFileTypes:true");
|
|
12571
|
+
if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
|
|
12572
|
+
if (e.noglobstar)
|
|
12573
|
+
throw new TypeError("base matching requires globstar");
|
|
12574
|
+
t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
|
|
12575
|
+
}
|
|
12576
|
+
if (this.pattern = t, this.platform = e.platform || Pi, this.opts = { ...e, platform: this.platform }, e.scurry) {
|
|
12577
|
+
if (this.scurry = e.scurry, e.nocase !== undefined && e.nocase !== e.scurry.nocase)
|
|
12578
|
+
throw new Error("nocase option contradicts provided scurry option");
|
|
12579
|
+
} else {
|
|
12580
|
+
let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
|
|
12581
|
+
this.scurry = new a(this.cwd, { nocase: e.nocase, fs: e.fs });
|
|
12582
|
+
}
|
|
12583
|
+
this.nocase = this.scurry.nocase;
|
|
12584
|
+
let s = this.platform === "darwin" || this.platform === "win32", i = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: s, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape, debug: !!this.opts.debug }, r = this.pattern.map((a) => new D(a, i)), [o, h] = r.reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
|
|
12585
|
+
this.patterns = o.map((a, l) => {
|
|
12586
|
+
let u = h[l];
|
|
12587
|
+
if (!u)
|
|
12588
|
+
throw new Error("invalid pattern object");
|
|
12589
|
+
return new nt(a, u, 0, this.platform);
|
|
12590
|
+
});
|
|
12591
|
+
}
|
|
12592
|
+
async walk() {
|
|
12593
|
+
return [...await new xt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk()];
|
|
12594
|
+
}
|
|
12595
|
+
walkSync() {
|
|
12596
|
+
return [...new xt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync()];
|
|
12597
|
+
}
|
|
12598
|
+
stream() {
|
|
12599
|
+
return new vt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream();
|
|
12600
|
+
}
|
|
12601
|
+
streamSync() {
|
|
12602
|
+
return new vt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync();
|
|
12603
|
+
}
|
|
12604
|
+
iterateSync() {
|
|
12605
|
+
return this.streamSync()[Symbol.iterator]();
|
|
12606
|
+
}
|
|
12607
|
+
[Symbol.iterator]() {
|
|
12608
|
+
return this.iterateSync();
|
|
12609
|
+
}
|
|
12610
|
+
iterate() {
|
|
12611
|
+
return this.stream()[Symbol.asyncIterator]();
|
|
12612
|
+
}
|
|
12613
|
+
[Symbol.asyncIterator]() {
|
|
12614
|
+
return this.iterate();
|
|
12615
|
+
}
|
|
12616
|
+
};
|
|
12617
|
+
var le = (n7, t = {}) => {
|
|
12618
|
+
Array.isArray(n7) || (n7 = [n7]);
|
|
12619
|
+
for (let e of n7)
|
|
12620
|
+
if (new D(e, t).hasMagic())
|
|
12621
|
+
return true;
|
|
12622
|
+
return false;
|
|
12623
|
+
};
|
|
12624
|
+
function Bt(n7, t = {}) {
|
|
12625
|
+
return new I(n7, t).streamSync();
|
|
12626
|
+
}
|
|
12627
|
+
function Qe(n7, t = {}) {
|
|
12628
|
+
return new I(n7, t).stream();
|
|
12629
|
+
}
|
|
12630
|
+
function ts(n7, t = {}) {
|
|
12631
|
+
return new I(n7, t).walkSync();
|
|
12632
|
+
}
|
|
12633
|
+
async function Je(n7, t = {}) {
|
|
12634
|
+
return new I(n7, t).walk();
|
|
12635
|
+
}
|
|
12636
|
+
function Ut(n7, t = {}) {
|
|
12637
|
+
return new I(n7, t).iterateSync();
|
|
12638
|
+
}
|
|
12639
|
+
function es(n7, t = {}) {
|
|
12640
|
+
return new I(n7, t).iterate();
|
|
12641
|
+
}
|
|
12642
|
+
var ji = Bt;
|
|
12643
|
+
var Ii = Object.assign(Qe, { sync: Bt });
|
|
12644
|
+
var zi = Ut;
|
|
12645
|
+
var Bi = Object.assign(es, { sync: Ut });
|
|
12646
|
+
var Ui = Object.assign(ts, { stream: Bt, iterate: Ut });
|
|
12647
|
+
var Ze = Object.assign(Je, { glob: Je, globSync: ts, sync: Ui, globStream: Qe, stream: Ii, globStreamSync: Bt, streamSync: ji, globIterate: es, iterate: Bi, globIterateSync: Ut, iterateSync: zi, Glob: I, hasMagic: le, escape: tt, unescape: W });
|
|
12648
|
+
Ze.glob = Ze;
|
|
12649
|
+
|
|
12650
|
+
// src/scanner/parsers/typescript.ts
|
|
12651
|
+
class TypeScriptParser {
|
|
12652
|
+
extensions = [".ts", ".tsx", ".js", ".jsx"];
|
|
12653
|
+
async parse(filePath, content) {
|
|
12654
|
+
const lines = content.split(`
|
|
12655
|
+
`);
|
|
12656
|
+
const imports = this.extractImports(content);
|
|
12657
|
+
const exports = this.extractExports(content);
|
|
12658
|
+
const components = this.extractComponents(filePath, content);
|
|
12659
|
+
const hooks = this.extractHooks(filePath, content);
|
|
12660
|
+
const file = {
|
|
12661
|
+
path: filePath,
|
|
12662
|
+
language: filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ? "tsx" : "typescript",
|
|
12663
|
+
lines: lines.length,
|
|
12664
|
+
exports,
|
|
12665
|
+
imports
|
|
12666
|
+
};
|
|
12667
|
+
const dependencies = imports.map((imp) => ({
|
|
12668
|
+
from: filePath,
|
|
12669
|
+
to: imp.source,
|
|
12670
|
+
specifiers: imp.specifiers
|
|
12671
|
+
}));
|
|
12672
|
+
return {
|
|
12673
|
+
file,
|
|
12674
|
+
routes: [],
|
|
12675
|
+
components,
|
|
12676
|
+
hooks,
|
|
12677
|
+
dependencies
|
|
12678
|
+
};
|
|
12679
|
+
}
|
|
12680
|
+
extractImports(content) {
|
|
12681
|
+
const imports = [];
|
|
12682
|
+
const importRegex = /^import\s+(?:(?:(\w+)|(\{[^}]+\})|\*\s+as\s+(\w+))\s+from\s+)?["']([^"']+)["']/gm;
|
|
12683
|
+
let match;
|
|
12684
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
12685
|
+
const defaultImport = match[1];
|
|
12686
|
+
const namedImports = match[2];
|
|
12687
|
+
const namespaceImport = match[3];
|
|
12688
|
+
const source = match[4];
|
|
12689
|
+
const specifiers = [];
|
|
12690
|
+
let isDefault = false;
|
|
12691
|
+
if (defaultImport) {
|
|
12692
|
+
specifiers.push(defaultImport);
|
|
12693
|
+
isDefault = true;
|
|
12694
|
+
}
|
|
12695
|
+
if (namedImports) {
|
|
12696
|
+
const names = namedImports.replace(/[{}]/g, "").split(",").map((s) => s.trim().split(/\s+as\s+/)[0].trim()).filter(Boolean);
|
|
12697
|
+
specifiers.push(...names);
|
|
12698
|
+
}
|
|
12699
|
+
if (namespaceImport) {
|
|
12700
|
+
specifiers.push(`* as ${namespaceImport}`);
|
|
12701
|
+
}
|
|
12702
|
+
imports.push({ source, specifiers, isDefault });
|
|
12703
|
+
}
|
|
12704
|
+
return imports;
|
|
12705
|
+
}
|
|
12706
|
+
extractExports(content) {
|
|
12707
|
+
const exports = [];
|
|
12708
|
+
const namedExportRegex = /^export\s+(?:default\s+)?(?:async\s+)?(?:function|const|let|var|class|type|interface|enum)\s+(\w+)/gm;
|
|
12709
|
+
let match;
|
|
12710
|
+
while ((match = namedExportRegex.exec(content)) !== null) {
|
|
12711
|
+
exports.push(match[1]);
|
|
12712
|
+
}
|
|
12713
|
+
if (/^export\s+default\s+/m.test(content)) {
|
|
12714
|
+
if (!exports.includes("default")) {
|
|
12715
|
+
exports.push("default");
|
|
12716
|
+
}
|
|
12717
|
+
}
|
|
12718
|
+
const reExportRegex = /^export\s+\{([^}]+)\}/gm;
|
|
12719
|
+
while ((match = reExportRegex.exec(content)) !== null) {
|
|
12720
|
+
const names = match[1].split(",").map((s) => s.trim().split(/\s+as\s+/).pop()?.trim()).filter((s) => !!s);
|
|
12721
|
+
exports.push(...names);
|
|
12722
|
+
}
|
|
12723
|
+
return [...new Set(exports)];
|
|
12724
|
+
}
|
|
12725
|
+
extractComponents(filePath, content) {
|
|
12726
|
+
const components = [];
|
|
12727
|
+
const isTSX = filePath.endsWith(".tsx") || filePath.endsWith(".jsx");
|
|
12728
|
+
if (!isTSX && !content.includes("React.createElement"))
|
|
12729
|
+
return components;
|
|
12730
|
+
const funcComponentRegex = /(?:export\s+(?:default\s+)?)?(?:async\s+)?function\s+([A-Z]\w+)\s*\(([^)]*)\)/g;
|
|
12731
|
+
const arrowComponentRegex = /(?:export\s+(?:default\s+)?)?(?:const|let)\s+([A-Z]\w+)\s*(?::\s*\w+(?:<[^>]+>)?\s*)?=\s*(?:\([^)]*\)|(\w+))\s*(?::\s*\w+(?:<[^>]+>)?\s*)?=>/g;
|
|
12732
|
+
let match;
|
|
12733
|
+
while ((match = funcComponentRegex.exec(content)) !== null) {
|
|
12734
|
+
const name = match[1];
|
|
12735
|
+
const paramsStr = match[2];
|
|
12736
|
+
components.push({
|
|
12737
|
+
name,
|
|
12738
|
+
filePath,
|
|
12739
|
+
props: this.extractPropsFromParams(paramsStr, content),
|
|
12740
|
+
isExported: content.includes("export") && content.substring(Math.max(0, match.index - 30), match.index + match[0].length).includes("export"),
|
|
12741
|
+
hasJSX: true,
|
|
12742
|
+
hookCalls: this.extractHookCalls(content, match.index)
|
|
12743
|
+
});
|
|
12744
|
+
}
|
|
12745
|
+
while ((match = arrowComponentRegex.exec(content)) !== null) {
|
|
12746
|
+
const name = match[1];
|
|
12747
|
+
components.push({
|
|
12748
|
+
name,
|
|
12749
|
+
filePath,
|
|
12750
|
+
props: this.extractPropsFromContext(name, content),
|
|
12751
|
+
isExported: content.substring(Math.max(0, match.index - 20), match.index + match[0].length).includes("export"),
|
|
12752
|
+
hasJSX: true,
|
|
12753
|
+
hookCalls: this.extractHookCalls(content, match.index)
|
|
12754
|
+
});
|
|
12755
|
+
}
|
|
12756
|
+
return components;
|
|
12757
|
+
}
|
|
12758
|
+
extractPropsFromParams(paramsStr, _content) {
|
|
12759
|
+
if (!paramsStr.trim())
|
|
12760
|
+
return [];
|
|
12761
|
+
const destructured = paramsStr.match(/\{\s*([^}]+)\s*\}/);
|
|
12762
|
+
if (destructured) {
|
|
12763
|
+
return destructured[1].split(",").map((p) => p.trim().split(/[=:]/)[0].trim()).filter(Boolean);
|
|
12764
|
+
}
|
|
12765
|
+
const typed = paramsStr.match(/(\w+)\s*:\s*(\w+)/);
|
|
12766
|
+
if (typed) {
|
|
12767
|
+
return [typed[1]];
|
|
12768
|
+
}
|
|
12769
|
+
return [];
|
|
12770
|
+
}
|
|
12771
|
+
extractPropsFromContext(componentName, content) {
|
|
12772
|
+
const propsTypeRegex = new RegExp(`(?:interface|type)\\s+${componentName}Props\\s*(?:=\\s*)?\\{([^}]+)\\}`);
|
|
12773
|
+
const match = content.match(propsTypeRegex);
|
|
12774
|
+
if (match) {
|
|
12775
|
+
return match[1].split(/[;\n]/).map((line) => line.trim().split(/[?:]/)[0].trim()).filter(Boolean);
|
|
12776
|
+
}
|
|
12777
|
+
return [];
|
|
12778
|
+
}
|
|
12779
|
+
extractHookCalls(content, startIndex) {
|
|
12780
|
+
const hookCalls = [];
|
|
12781
|
+
const bodyStart = content.indexOf("{", startIndex);
|
|
12782
|
+
if (bodyStart === -1)
|
|
12783
|
+
return hookCalls;
|
|
12784
|
+
let depth = 0;
|
|
12785
|
+
let bodyEnd = bodyStart;
|
|
12786
|
+
for (let i = bodyStart;i < content.length; i++) {
|
|
12787
|
+
if (content[i] === "{")
|
|
12788
|
+
depth++;
|
|
12789
|
+
if (content[i] === "}")
|
|
12790
|
+
depth--;
|
|
12791
|
+
if (depth === 0) {
|
|
12792
|
+
bodyEnd = i;
|
|
12793
|
+
break;
|
|
12794
|
+
}
|
|
12795
|
+
}
|
|
12796
|
+
const body = content.substring(bodyStart, bodyEnd);
|
|
12797
|
+
const hookRegex = /\b(use\w+)\s*\(/g;
|
|
12798
|
+
let match;
|
|
12799
|
+
while ((match = hookRegex.exec(body)) !== null) {
|
|
12800
|
+
if (!hookCalls.includes(match[1])) {
|
|
12801
|
+
hookCalls.push(match[1]);
|
|
12802
|
+
}
|
|
12803
|
+
}
|
|
12804
|
+
return hookCalls;
|
|
12805
|
+
}
|
|
12806
|
+
extractHooks(filePath, content) {
|
|
12807
|
+
const hooks = [];
|
|
12808
|
+
const hookDefRegex = /(?:export\s+)?(?:function|const)\s+(use[A-Z]\w+)/g;
|
|
12809
|
+
let match;
|
|
12810
|
+
while ((match = hookDefRegex.exec(content)) !== null) {
|
|
12811
|
+
const name = match[1];
|
|
12812
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
12813
|
+
if (bodyStart === -1)
|
|
12814
|
+
continue;
|
|
12815
|
+
const deps = [];
|
|
12816
|
+
let depth = 0;
|
|
12817
|
+
let bodyEnd = bodyStart;
|
|
12818
|
+
for (let i = bodyStart;i < content.length; i++) {
|
|
12819
|
+
if (content[i] === "{")
|
|
12820
|
+
depth++;
|
|
12821
|
+
if (content[i] === "}")
|
|
12822
|
+
depth--;
|
|
12823
|
+
if (depth === 0) {
|
|
12824
|
+
bodyEnd = i;
|
|
12825
|
+
break;
|
|
12826
|
+
}
|
|
12827
|
+
}
|
|
12828
|
+
const body = content.substring(bodyStart, bodyEnd);
|
|
12829
|
+
const depRegex = /\b(use\w+)\s*\(/g;
|
|
12830
|
+
let depMatch;
|
|
12831
|
+
while ((depMatch = depRegex.exec(body)) !== null) {
|
|
12832
|
+
if (depMatch[1] !== name && !deps.includes(depMatch[1])) {
|
|
12833
|
+
deps.push(depMatch[1]);
|
|
12834
|
+
}
|
|
12835
|
+
}
|
|
12836
|
+
hooks.push({
|
|
12837
|
+
name,
|
|
12838
|
+
filePath,
|
|
12839
|
+
isCustom: true,
|
|
12840
|
+
dependencies: deps
|
|
12841
|
+
});
|
|
12842
|
+
}
|
|
12843
|
+
return hooks;
|
|
12844
|
+
}
|
|
12845
|
+
}
|
|
12846
|
+
|
|
12847
|
+
// src/scanner/extractors/routes.ts
|
|
12848
|
+
import { readdirSync as readdirSync3, statSync, readFileSync as readFileSync3 } from "node:fs";
|
|
12849
|
+
import { join as join14, relative, basename as basename3, dirname as dirname4 } from "node:path";
|
|
12850
|
+
function extractRoutes(scanDir) {
|
|
12851
|
+
const routes = [];
|
|
12852
|
+
const appDirs = ["app", "src/app"].map((d) => join14(scanDir, d));
|
|
12853
|
+
for (const appDir of appDirs) {
|
|
12854
|
+
try {
|
|
12855
|
+
if (statSync(appDir).isDirectory()) {
|
|
12856
|
+
extractAppRouterRoutes(appDir, appDir, routes);
|
|
12857
|
+
}
|
|
12858
|
+
} catch {}
|
|
12859
|
+
}
|
|
12860
|
+
const pagesDirs = ["pages", "src/pages"].map((d) => join14(scanDir, d));
|
|
12861
|
+
for (const pagesDir of pagesDirs) {
|
|
12862
|
+
try {
|
|
12863
|
+
if (statSync(pagesDir).isDirectory()) {
|
|
12864
|
+
extractPagesRouterRoutes(pagesDir, pagesDir, routes);
|
|
12865
|
+
}
|
|
12866
|
+
} catch {}
|
|
12867
|
+
}
|
|
12868
|
+
return routes;
|
|
12869
|
+
}
|
|
12870
|
+
function extractAppRouterRoutes(dir, baseDir, routes) {
|
|
12871
|
+
const entries = readdirSync3(dir, { withFileTypes: true });
|
|
12872
|
+
for (const entry of entries) {
|
|
12873
|
+
const fullPath = join14(dir, entry.name);
|
|
12874
|
+
if (entry.isDirectory()) {
|
|
12875
|
+
extractAppRouterRoutes(fullPath, baseDir, routes);
|
|
12876
|
+
continue;
|
|
12877
|
+
}
|
|
12878
|
+
const name = basename3(entry.name, entry.name.substring(entry.name.indexOf(".")));
|
|
12879
|
+
const ext = entry.name.substring(entry.name.indexOf("."));
|
|
12880
|
+
if (![".ts", ".tsx", ".js", ".jsx"].some((e) => entry.name.endsWith(e)))
|
|
12881
|
+
continue;
|
|
12882
|
+
if (name === "page") {
|
|
12883
|
+
const routePath = dirToRoutePath(relative(baseDir, dir));
|
|
12884
|
+
const layoutFile = findLayoutFile(dir, baseDir);
|
|
12885
|
+
routes.push({
|
|
12886
|
+
path: routePath,
|
|
12887
|
+
filePath: relative(process.cwd(), fullPath),
|
|
12888
|
+
isDynamic: routePath.includes("["),
|
|
12889
|
+
layoutFile: layoutFile ? relative(process.cwd(), layoutFile) : undefined
|
|
12890
|
+
});
|
|
12891
|
+
}
|
|
12892
|
+
if (name === "route") {
|
|
12893
|
+
const routePath = dirToRoutePath(relative(baseDir, dir));
|
|
12894
|
+
const methods = extractApiMethods(fullPath);
|
|
12895
|
+
for (const method of methods) {
|
|
12896
|
+
routes.push({
|
|
12897
|
+
path: routePath,
|
|
12898
|
+
filePath: relative(process.cwd(), fullPath),
|
|
12899
|
+
method,
|
|
12900
|
+
isDynamic: routePath.includes("[")
|
|
12901
|
+
});
|
|
12902
|
+
}
|
|
12903
|
+
}
|
|
12904
|
+
}
|
|
12905
|
+
}
|
|
12906
|
+
function extractPagesRouterRoutes(dir, baseDir, routes) {
|
|
12907
|
+
const entries = readdirSync3(dir, { withFileTypes: true });
|
|
12908
|
+
for (const entry of entries) {
|
|
12909
|
+
const fullPath = join14(dir, entry.name);
|
|
12910
|
+
if (entry.isDirectory()) {
|
|
12911
|
+
if (entry.name === "api") {
|
|
12912
|
+
extractPagesApiRoutes(fullPath, baseDir, routes);
|
|
12913
|
+
} else {
|
|
12914
|
+
extractPagesRouterRoutes(fullPath, baseDir, routes);
|
|
12915
|
+
}
|
|
12916
|
+
continue;
|
|
12917
|
+
}
|
|
12918
|
+
if (![".ts", ".tsx", ".js", ".jsx"].some((e) => entry.name.endsWith(e)))
|
|
12919
|
+
continue;
|
|
12920
|
+
if (entry.name.startsWith("_"))
|
|
12921
|
+
continue;
|
|
12922
|
+
const name = basename3(entry.name).replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
12923
|
+
const relDir = relative(baseDir, dir);
|
|
12924
|
+
const routePath = `/${relDir ? relDir + "/" : ""}${name === "index" ? "" : name}`.replace(/\/+/g, "/") || "/";
|
|
12925
|
+
routes.push({
|
|
12926
|
+
path: routePath,
|
|
12927
|
+
filePath: relative(process.cwd(), fullPath),
|
|
12928
|
+
isDynamic: routePath.includes("[")
|
|
12929
|
+
});
|
|
12930
|
+
}
|
|
12931
|
+
}
|
|
12932
|
+
function extractPagesApiRoutes(dir, baseDir, routes) {
|
|
12933
|
+
const entries = readdirSync3(dir, { withFileTypes: true });
|
|
12934
|
+
for (const entry of entries) {
|
|
12935
|
+
const fullPath = join14(dir, entry.name);
|
|
12936
|
+
if (entry.isDirectory()) {
|
|
12937
|
+
extractPagesApiRoutes(fullPath, baseDir, routes);
|
|
12938
|
+
continue;
|
|
12939
|
+
}
|
|
12940
|
+
if (![".ts", ".tsx", ".js", ".jsx"].some((e) => entry.name.endsWith(e)))
|
|
12941
|
+
continue;
|
|
12942
|
+
const name = basename3(entry.name).replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
12943
|
+
const relDir = relative(baseDir, dir);
|
|
12944
|
+
const routePath = `/${relDir ? relDir + "/" : ""}${name === "index" ? "" : name}`.replace(/\/+/g, "/");
|
|
12945
|
+
routes.push({
|
|
12946
|
+
path: routePath,
|
|
12947
|
+
filePath: relative(process.cwd(), fullPath),
|
|
12948
|
+
method: "handler",
|
|
12949
|
+
isDynamic: routePath.includes("[")
|
|
12950
|
+
});
|
|
12951
|
+
}
|
|
12952
|
+
}
|
|
12953
|
+
function dirToRoutePath(relPath) {
|
|
12954
|
+
if (!relPath)
|
|
12955
|
+
return "/";
|
|
12956
|
+
const cleaned = relPath.split("/").filter((segment) => !segment.startsWith("(")).join("/");
|
|
12957
|
+
return `/${cleaned}` || "/";
|
|
12958
|
+
}
|
|
12959
|
+
function findLayoutFile(dir, baseDir) {
|
|
12960
|
+
let current = dir;
|
|
12961
|
+
while (current.startsWith(baseDir)) {
|
|
12962
|
+
for (const ext of [".tsx", ".ts", ".jsx", ".js"]) {
|
|
12963
|
+
const layoutPath = join14(current, `layout${ext}`);
|
|
12964
|
+
try {
|
|
12965
|
+
statSync(layoutPath);
|
|
12966
|
+
return layoutPath;
|
|
12967
|
+
} catch {}
|
|
12968
|
+
}
|
|
12969
|
+
current = dirname4(current);
|
|
12970
|
+
}
|
|
12971
|
+
return;
|
|
12972
|
+
}
|
|
12973
|
+
function extractApiMethods(filePath) {
|
|
12974
|
+
try {
|
|
12975
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
12976
|
+
const methods = [];
|
|
12977
|
+
const methodRegex = /export\s+(?:async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\b/g;
|
|
12978
|
+
let match;
|
|
12979
|
+
while ((match = methodRegex.exec(content)) !== null) {
|
|
12980
|
+
methods.push(match[1]);
|
|
12981
|
+
}
|
|
12982
|
+
return methods.length > 0 ? methods : ["handler"];
|
|
12983
|
+
} catch {
|
|
12984
|
+
return ["handler"];
|
|
12985
|
+
}
|
|
12986
|
+
}
|
|
12987
|
+
// src/scanner/scanner.ts
|
|
12988
|
+
async function runStage1(config) {
|
|
12989
|
+
const scanDir = resolve(config.scanDir);
|
|
12990
|
+
const cacheDir = resolve(config.cacheDir, "ast");
|
|
12991
|
+
mkdirSync2(cacheDir, { recursive: true });
|
|
12992
|
+
const manifestPath = resolve(cacheDir, "manifest.json");
|
|
12993
|
+
let manifest = { files: {} };
|
|
12994
|
+
if (existsSync3(manifestPath)) {
|
|
12995
|
+
try {
|
|
12996
|
+
manifest = JSON.parse(readFileSync4(manifestPath, "utf-8"));
|
|
12997
|
+
} catch {
|
|
12998
|
+
manifest = { files: {} };
|
|
12999
|
+
}
|
|
13000
|
+
}
|
|
13001
|
+
const files = collectFiles(scanDir, config.include, config.exclude);
|
|
13002
|
+
verbose(`Found ${files.length} files to scan`);
|
|
13003
|
+
const parser = new TypeScriptParser;
|
|
13004
|
+
const allFiles = [];
|
|
13005
|
+
const allComponents = [];
|
|
13006
|
+
const allHooks = [];
|
|
13007
|
+
const allDependencies = [];
|
|
13008
|
+
let totalLines = 0;
|
|
13009
|
+
let cachedCount = 0;
|
|
13010
|
+
for (const filePath of files) {
|
|
13011
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
13012
|
+
const hash = createHash("md5").update(content).digest("hex");
|
|
13013
|
+
const relPath = relative2(process.cwd(), filePath);
|
|
13014
|
+
const cached = manifest.files[relPath];
|
|
13015
|
+
if (cached && cached.hash === hash) {
|
|
13016
|
+
const cacheFile = resolve(cacheDir, cached.resultFile);
|
|
13017
|
+
if (existsSync3(cacheFile)) {
|
|
13018
|
+
try {
|
|
13019
|
+
const cachedResult = JSON.parse(readFileSync4(cacheFile, "utf-8"));
|
|
13020
|
+
allFiles.push(cachedResult.file);
|
|
13021
|
+
allComponents.push(...cachedResult.components);
|
|
13022
|
+
allHooks.push(...cachedResult.hooks);
|
|
13023
|
+
allDependencies.push(...cachedResult.dependencies);
|
|
13024
|
+
totalLines += cachedResult.file.lines;
|
|
13025
|
+
cachedCount++;
|
|
13026
|
+
continue;
|
|
13027
|
+
} catch {}
|
|
13028
|
+
}
|
|
13029
|
+
}
|
|
13030
|
+
const result = await parser.parse(relPath, content);
|
|
13031
|
+
allFiles.push(result.file);
|
|
13032
|
+
allComponents.push(...result.components);
|
|
13033
|
+
allHooks.push(...result.hooks);
|
|
13034
|
+
allDependencies.push(...result.dependencies);
|
|
13035
|
+
totalLines += result.file.lines;
|
|
13036
|
+
const resultFile = `${hash}.json`;
|
|
13037
|
+
writeFileSync2(resolve(cacheDir, resultFile), JSON.stringify({
|
|
13038
|
+
file: result.file,
|
|
13039
|
+
components: result.components,
|
|
13040
|
+
hooks: result.hooks,
|
|
13041
|
+
dependencies: result.dependencies
|
|
13042
|
+
}));
|
|
13043
|
+
manifest.files[relPath] = { hash, resultFile };
|
|
13044
|
+
}
|
|
13045
|
+
writeFileSync2(manifestPath, JSON.stringify(manifest, null, 2));
|
|
13046
|
+
if (cachedCount > 0) {
|
|
13047
|
+
verbose(`${cachedCount} files from cache, ${files.length - cachedCount} re-parsed`);
|
|
13048
|
+
}
|
|
13049
|
+
const routes = extractRoutes(scanDir);
|
|
13050
|
+
verbose(`Found ${routes.length} routes`);
|
|
13051
|
+
verbose(`Found ${allComponents.length} components`);
|
|
13052
|
+
verbose(`Found ${allHooks.length} custom hooks`);
|
|
13053
|
+
return {
|
|
13054
|
+
version: "1.0",
|
|
13055
|
+
scannedAt: new Date().toISOString(),
|
|
13056
|
+
language: "typescript",
|
|
13057
|
+
stats: { totalFiles: files.length, totalLines },
|
|
13058
|
+
files: allFiles,
|
|
13059
|
+
routes,
|
|
13060
|
+
components: allComponents,
|
|
13061
|
+
hooks: allHooks,
|
|
13062
|
+
dependencies: allDependencies
|
|
13063
|
+
};
|
|
13064
|
+
}
|
|
13065
|
+
function collectFiles(dir, includePatterns, excludePatterns) {
|
|
13066
|
+
const files = [];
|
|
13067
|
+
for (const pattern of includePatterns) {
|
|
13068
|
+
const matches = ts(pattern, {
|
|
13069
|
+
cwd: dir,
|
|
13070
|
+
absolute: true,
|
|
13071
|
+
ignore: excludePatterns
|
|
13072
|
+
});
|
|
13073
|
+
files.push(...matches);
|
|
13074
|
+
}
|
|
13075
|
+
return [...new Set(files)].sort();
|
|
13076
|
+
}
|
|
13077
|
+
|
|
13078
|
+
// src/commands/scan.ts
|
|
13079
|
+
function registerScan(program2) {
|
|
13080
|
+
program2.command("scan").description("Scan codebase AST (routes, components, hooks, imports)").option("--output <file>", "Write output to specific file").option("--scan-dir <dir>", "Directory to scan (default: from config)").option("--no-cache", "Disable file-level caching").action(async (opts) => {
|
|
13081
|
+
const ctx = await resolveCommandContext(program2);
|
|
13082
|
+
const root = ctx.paths.projectRoot;
|
|
13083
|
+
const scanDir = opts.scanDir ?? ctx.config.scanner.scanDir;
|
|
13084
|
+
const cacheDir = join15(root, ctx.config.scanner.cacheDir);
|
|
13085
|
+
const scanConfig = {
|
|
13086
|
+
scanDir: join15(root, scanDir),
|
|
13087
|
+
include: ctx.config.scanner.include,
|
|
13088
|
+
exclude: ctx.config.scanner.exclude,
|
|
13089
|
+
cacheDir: opts.cache === false ? join15(cacheDir, `no-cache-${Date.now()}`) : cacheDir
|
|
13090
|
+
};
|
|
13091
|
+
const spinner = createSpinner();
|
|
13092
|
+
spinner.start("Scanning codebase...");
|
|
13093
|
+
const ast = await runStage1(scanConfig);
|
|
13094
|
+
spinner.stop();
|
|
13095
|
+
const outputPath = opts.output ?? (ctx.key ? join15(ctx.paths.workingDir, ctx.key, "ast-scan.json") : join15(root, ".e2e-ai", "ast-scan.json"));
|
|
13096
|
+
writeFile(outputPath, JSON.stringify(ast, null, 2));
|
|
13097
|
+
success(`AST written to ${outputPath}`);
|
|
13098
|
+
info(` Files: ${ast.stats.totalFiles} (${ast.stats.totalLines} lines)`);
|
|
13099
|
+
info(` Routes: ${ast.routes.length}`);
|
|
13100
|
+
info(` Components: ${ast.components.length}`);
|
|
13101
|
+
info(` Hooks: ${ast.hooks.length}`);
|
|
13102
|
+
});
|
|
13103
|
+
}
|
|
13104
|
+
|
|
13105
|
+
// src/commands/push.ts
|
|
13106
|
+
import { join as join16 } from "node:path";
|
|
13107
|
+
|
|
13108
|
+
// src/scanner/push.ts
|
|
13109
|
+
async function pushToApi(payload, apiUrl, apiKey) {
|
|
13110
|
+
const response = await fetch(apiUrl, {
|
|
13111
|
+
method: "POST",
|
|
13112
|
+
headers: {
|
|
13113
|
+
"Content-Type": "application/json",
|
|
13114
|
+
Authorization: `Bearer ${apiKey}`
|
|
13115
|
+
},
|
|
13116
|
+
body: JSON.stringify(payload)
|
|
13117
|
+
});
|
|
13118
|
+
if (!response.ok) {
|
|
13119
|
+
const body = await response.text();
|
|
13120
|
+
throw new Error(`Push failed (${response.status}): ${body}`);
|
|
13121
|
+
}
|
|
13122
|
+
return response.json();
|
|
13123
|
+
}
|
|
13124
|
+
|
|
13125
|
+
// src/commands/push.ts
|
|
13126
|
+
function registerPush(program2) {
|
|
13127
|
+
program2.command("push [input]").description("Push QA map to remote API").option("--commit-sha <sha>", "Git commit SHA to associate").action(async (inputArg, opts) => {
|
|
13128
|
+
const ctx = await resolveCommandContext(program2);
|
|
13129
|
+
const apiUrl = ctx.config.push?.apiUrl ?? process.env.E2E_AI_API_URL;
|
|
13130
|
+
const apiKey = ctx.config.push?.apiKey ?? process.env.E2E_AI_API_KEY;
|
|
13131
|
+
if (!apiUrl) {
|
|
13132
|
+
error("No push.apiUrl configured. Set it in e2e-ai.config.ts or E2E_AI_API_URL env var.");
|
|
13133
|
+
process.exit(1);
|
|
13134
|
+
}
|
|
13135
|
+
if (!apiKey) {
|
|
13136
|
+
error("No push.apiKey configured. Set it in e2e-ai.config.ts or E2E_AI_API_KEY env var.");
|
|
13137
|
+
process.exit(1);
|
|
13138
|
+
}
|
|
13139
|
+
const root = ctx.paths.projectRoot;
|
|
13140
|
+
let inputPath;
|
|
13141
|
+
if (inputArg) {
|
|
13142
|
+
inputPath = join16(root, inputArg);
|
|
13143
|
+
} else if (ctx.key) {
|
|
13144
|
+
inputPath = join16(ctx.paths.workingDir, ctx.key, "qa-map.json");
|
|
13145
|
+
} else {
|
|
13146
|
+
inputPath = join16(root, ".e2e-ai", "qa-map.json");
|
|
13147
|
+
}
|
|
13148
|
+
if (!fileExists(inputPath)) {
|
|
13149
|
+
error(`QA map not found: ${inputPath}`);
|
|
13150
|
+
process.exit(1);
|
|
13151
|
+
}
|
|
13152
|
+
const payload = JSON.parse(readFile(inputPath));
|
|
13153
|
+
if (opts?.commitSha) {
|
|
13154
|
+
payload.commitSha = opts.commitSha;
|
|
13155
|
+
}
|
|
13156
|
+
info(`Pushing: ${payload.features.length} features, ${payload.workflows.length} workflows, ${payload.scenarios.length} scenarios`);
|
|
13157
|
+
const spinner = createSpinner();
|
|
13158
|
+
spinner.start("Pushing to API...");
|
|
13159
|
+
const result = await pushToApi(payload, apiUrl, apiKey);
|
|
13160
|
+
spinner.stop();
|
|
13161
|
+
success("Push successful!");
|
|
13162
|
+
info(` Version: ${result.version} (schema v${result.schemaVersion})`);
|
|
13163
|
+
info(` Auto-linked scenarios: ${result.stats.autoLinkedScenarios}`);
|
|
13164
|
+
});
|
|
13165
|
+
}
|
|
13166
|
+
|
|
13167
|
+
// src/commands/analyze.ts
|
|
13168
|
+
import { join as join17 } from "node:path";
|
|
13169
|
+
function registerAnalyze(program2) {
|
|
13170
|
+
program2.command("analyze [input]").description("Analyze AST scan with AI to generate QA map (features, workflows, scenarios)").option("--output <file>", "Write QA map to specific file").option("--skip-scenarios", "Only run feature analysis (skip scenario generation)").action(async (inputArg, opts) => {
|
|
13171
|
+
const ctx = await resolveCommandContext(program2);
|
|
13172
|
+
const root = ctx.paths.projectRoot;
|
|
13173
|
+
let inputPath;
|
|
13174
|
+
if (inputArg) {
|
|
13175
|
+
inputPath = join17(root, inputArg);
|
|
13176
|
+
} else if (ctx.key) {
|
|
13177
|
+
inputPath = join17(ctx.paths.workingDir, ctx.key, "ast-scan.json");
|
|
13178
|
+
} else {
|
|
13179
|
+
inputPath = join17(root, ".e2e-ai", "ast-scan.json");
|
|
13180
|
+
}
|
|
13181
|
+
if (!fileExists(inputPath)) {
|
|
13182
|
+
error(`AST scan not found: ${inputPath}. Run "e2e-ai scan" first.`);
|
|
13183
|
+
process.exit(1);
|
|
13184
|
+
}
|
|
13185
|
+
const ast = JSON.parse(readFile(inputPath));
|
|
13186
|
+
const spinner = createSpinner();
|
|
13187
|
+
spinner.start("Analyzing features and workflows...");
|
|
13188
|
+
const featureAgent = loadAgent("feature-analyzer-agent", ctx.config);
|
|
13189
|
+
const featureResponse = await callLLM({
|
|
13190
|
+
provider: ctx.provider,
|
|
13191
|
+
model: ctx.model ?? featureAgent.config.model,
|
|
13192
|
+
systemPrompt: featureAgent.systemPrompt,
|
|
13193
|
+
userMessage: JSON.stringify({ ast }),
|
|
13194
|
+
maxTokens: featureAgent.config.maxTokens,
|
|
13195
|
+
temperature: featureAgent.config.temperature,
|
|
13196
|
+
jsonMode: true
|
|
13197
|
+
});
|
|
13198
|
+
spinner.stop();
|
|
13199
|
+
const qaMap = JSON.parse(extractJSON(featureResponse.content));
|
|
13200
|
+
if (!qaMap?.features) {
|
|
13201
|
+
error("Feature analysis failed: invalid response");
|
|
13202
|
+
process.exit(1);
|
|
13203
|
+
}
|
|
13204
|
+
success(`Identified ${qaMap.features.length} features, ${qaMap.workflows.length} workflows, ${qaMap.components.length} components`);
|
|
13205
|
+
let finalPayload = qaMap;
|
|
13206
|
+
if (!opts?.skipScenarios) {
|
|
13207
|
+
spinner.start("Generating test scenarios...");
|
|
13208
|
+
const scenarioAgent = loadAgent("scenario-planner-agent", ctx.config);
|
|
13209
|
+
const scenarioResponse = await callLLM({
|
|
13210
|
+
provider: ctx.provider,
|
|
13211
|
+
model: ctx.model ?? scenarioAgent.config.model,
|
|
13212
|
+
systemPrompt: scenarioAgent.systemPrompt,
|
|
13213
|
+
userMessage: JSON.stringify(qaMap),
|
|
13214
|
+
maxTokens: scenarioAgent.config.maxTokens,
|
|
13215
|
+
temperature: scenarioAgent.config.temperature,
|
|
13216
|
+
jsonMode: true
|
|
13217
|
+
});
|
|
13218
|
+
spinner.stop();
|
|
13219
|
+
try {
|
|
13220
|
+
finalPayload = JSON.parse(extractJSON(scenarioResponse.content));
|
|
13221
|
+
} catch {
|
|
13222
|
+
warn("Scenario generation returned invalid JSON, using feature map only");
|
|
13223
|
+
finalPayload = { ...qaMap, scenarios: [] };
|
|
13224
|
+
}
|
|
13225
|
+
if (!finalPayload?.scenarios) {
|
|
13226
|
+
warn("Scenario generation returned no scenarios, using feature map only");
|
|
13227
|
+
finalPayload = { ...qaMap, scenarios: [] };
|
|
13228
|
+
} else {
|
|
13229
|
+
success(`Generated ${finalPayload.scenarios.length} scenarios`);
|
|
13230
|
+
}
|
|
13231
|
+
} else {
|
|
13232
|
+
finalPayload = { ...qaMap, scenarios: [] };
|
|
13233
|
+
}
|
|
13234
|
+
const outputPath = opts?.output ?? (ctx.key ? join17(ctx.paths.workingDir, ctx.key, "qa-map.json") : join17(root, ".e2e-ai", "qa-map.json"));
|
|
13235
|
+
writeFile(outputPath, JSON.stringify(finalPayload, null, 2));
|
|
13236
|
+
success(`QA map written to ${outputPath}`);
|
|
13237
|
+
});
|
|
9401
13238
|
}
|
|
9402
13239
|
|
|
9403
13240
|
// src/cli.ts
|
|
@@ -9420,4 +13257,7 @@ registerTest(program2);
|
|
|
9420
13257
|
registerHeal(program2);
|
|
9421
13258
|
registerQa(program2);
|
|
9422
13259
|
registerRun(program2);
|
|
13260
|
+
registerScan(program2);
|
|
13261
|
+
registerPush(program2);
|
|
13262
|
+
registerAnalyze(program2);
|
|
9423
13263
|
program2.parse();
|