@hanseltime/esm-interop-tools 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bin/get-esm-packages.js +2 -1
- package/dist/cjs/bin/get-esm-packages.js.map +1 -1
- package/dist/esm/bin/get-esm-packages.mjs +5 -3
- package/dist/esm/bin/get-esm-packages.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/operations/getESMPackages.mjs +1 -1
- package/dist/esm/operations/getESMPackages.mjs.map +1 -1
- package/dist/esm/operations/index.mjs +2 -2
- package/dist/esm/operations/index.mjs.map +1 -1
- package/dist/esm/packageGraphs/PackageGraph.mjs +1 -1
- package/dist/esm/packageGraphs/PackageGraph.mjs.map +1 -1
- package/dist/esm/packageGraphs/getYarnInfoPackageGraph.mjs +1 -1
- package/dist/esm/packageGraphs/getYarnInfoPackageGraph.mjs.map +1 -1
- package/dist/esm/packageGraphs/index.mjs +4 -4
- package/dist/esm/packageGraphs/index.mjs.map +1 -1
- package/dist/types/bin/get-esm-packages.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/bin/get-esm-packages.js +0 -17
- package/dist/bin/get-esm-packages.js.map +0 -1
|
@@ -32,6 +32,7 @@ _commander().program.addOption(new (_commander()).Option("-p, --pkgManager <pkgM
|
|
|
32
32
|
"none"
|
|
33
33
|
]).default("console", "writes each package to the a line")).option("--cwd <cwd>").option("-r, --recurse", "get all dependencies and not just direct ones", false).option("-f, --file <file>", "the file to output json to").option("-q, --quiet", "if we should not output any values", false);
|
|
34
34
|
const options = _commander().program.parse(process.argv).opts();
|
|
35
|
+
const commandStr = `get-esm-packages ${process.argv.slice(2).join(" ")}`;
|
|
35
36
|
async function main(options) {
|
|
36
37
|
const { pkgManager, cwd = process.cwd(), recurse, output, file, quiet } = options;
|
|
37
38
|
let packageGraph;
|
|
@@ -59,7 +60,7 @@ async function main(options) {
|
|
|
59
60
|
}
|
|
60
61
|
function writeESMModuleOutput(packages, file) {
|
|
61
62
|
(0, _fs().writeFileSync)(file, JSON.stringify({
|
|
62
|
-
description: `This is a programmatically created file via ${
|
|
63
|
+
description: `This is a programmatically created file via ${commandStr}`,
|
|
63
64
|
packages: packages
|
|
64
65
|
}, null, 4));
|
|
65
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/get-esm-packages.ts"],"sourcesContent":["import { program, Option } from \"commander\";\nimport { EsmPackagesFile, getESMPackages } from \"../operations\";\nimport { getYarnInfoPackageGraph, PackageGraph } from \"../packageGraphs\";\nimport { writeFileSync } from \"fs\";\n\nprogram\n\t.addOption(\n\t\tnew Option(\n\t\t\t\"-p, --pkgManager <pkgManager>\",\n\t\t\t\"The package manager that you are running under - will be used to resolve modules\",\n\t\t)\n\t\t\t.choices([\"yarnv2+\"])\n\t\t\t.makeOptionMandatory(),\n\t)\n\t.addOption(\n\t\tnew Option(\"-o, --output <output>\", \"How to output the package info\")\n\t\t\t.choices([\"json\", \"console\", \"none\"])\n\t\t\t.default(\"console\", \"writes each package to the a line\"),\n\t)\n\t.option(\"--cwd <cwd>\")\n\t.option(\n\t\t\"-r, --recurse\",\n\t\t\"get all dependencies and not just direct ones\",\n\t\tfalse,\n\t)\n\t.option(\"-f, --file <file>\", \"the file to output json to\")\n\t.option(\"-q, --quiet\", \"if we should not output any values\", false);\n\nconst options = program.parse(process.argv).opts<CliOpts>();\n\ninterface CliOpts {\n\tpkgManager: \"yarnv2+\" | \"npm\";\n\tcwd?: string;\n\trecurse: boolean;\n\toutput: \"console\" | \"json\";\n\tfile?: string;\n\tquiet: boolean;\n}\n\nasync function main(options: CliOpts) {\n\tconst {\n\t\tpkgManager,\n\t\tcwd = process.cwd(),\n\t\trecurse,\n\t\toutput,\n\t\tfile,\n\t\tquiet,\n\t} = options;\n\tlet packageGraph: PackageGraph;\n\tswitch (pkgManager) {\n\t\tcase \"yarnv2+\":\n\t\t\tpackageGraph = await getYarnInfoPackageGraph(cwd, recurse);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t\"Unimplemented package manager GetPackagesGraphFn mapping!\",\n\t\t\t);\n\t}\n\tpackageGraph.validate();\n\n\tconst packages = (await getESMPackages(packageGraph)).sort();\n\n\tif (!quiet) {\n\t\tswitch (output) {\n\t\t\tcase \"json\":\n\t\t\t\tconsole.log(JSON.stringify(packages));\n\t\t\t\tbreak;\n\t\t\tcase \"console\":\n\t\t\t\tconsole.log(packages.join(\"\\n\"));\n\t\t}\n\t}\n\n\tif (file) {\n\t\twriteESMModuleOutput(packages, file);\n\t}\n}\n\nexport function writeESMModuleOutput(packages: string[], file: string) {\n\twriteFileSync(\n\t\tfile,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdescription: `This is a programmatically created file via ${
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/get-esm-packages.ts"],"sourcesContent":["import { program, Option } from \"commander\";\nimport { EsmPackagesFile, getESMPackages } from \"../operations\";\nimport { getYarnInfoPackageGraph, PackageGraph } from \"../packageGraphs\";\nimport { writeFileSync } from \"fs\";\n\nprogram\n\t.addOption(\n\t\tnew Option(\n\t\t\t\"-p, --pkgManager <pkgManager>\",\n\t\t\t\"The package manager that you are running under - will be used to resolve modules\",\n\t\t)\n\t\t\t.choices([\"yarnv2+\"])\n\t\t\t.makeOptionMandatory(),\n\t)\n\t.addOption(\n\t\tnew Option(\"-o, --output <output>\", \"How to output the package info\")\n\t\t\t.choices([\"json\", \"console\", \"none\"])\n\t\t\t.default(\"console\", \"writes each package to the a line\"),\n\t)\n\t.option(\"--cwd <cwd>\")\n\t.option(\n\t\t\"-r, --recurse\",\n\t\t\"get all dependencies and not just direct ones\",\n\t\tfalse,\n\t)\n\t.option(\"-f, --file <file>\", \"the file to output json to\")\n\t.option(\"-q, --quiet\", \"if we should not output any values\", false);\n\nconst options = program.parse(process.argv).opts<CliOpts>();\n\ninterface CliOpts {\n\tpkgManager: \"yarnv2+\" | \"npm\";\n\tcwd?: string;\n\trecurse: boolean;\n\toutput: \"console\" | \"json\";\n\tfile?: string;\n\tquiet: boolean;\n}\n\nconst commandStr = `get-esm-packages ${process.argv.slice(2).join(\" \")}`;\n\nasync function main(options: CliOpts) {\n\tconst {\n\t\tpkgManager,\n\t\tcwd = process.cwd(),\n\t\trecurse,\n\t\toutput,\n\t\tfile,\n\t\tquiet,\n\t} = options;\n\tlet packageGraph: PackageGraph;\n\tswitch (pkgManager) {\n\t\tcase \"yarnv2+\":\n\t\t\tpackageGraph = await getYarnInfoPackageGraph(cwd, recurse);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t\"Unimplemented package manager GetPackagesGraphFn mapping!\",\n\t\t\t);\n\t}\n\tpackageGraph.validate();\n\n\tconst packages = (await getESMPackages(packageGraph)).sort();\n\n\tif (!quiet) {\n\t\tswitch (output) {\n\t\t\tcase \"json\":\n\t\t\t\tconsole.log(JSON.stringify(packages));\n\t\t\t\tbreak;\n\t\t\tcase \"console\":\n\t\t\t\tconsole.log(packages.join(\"\\n\"));\n\t\t}\n\t}\n\n\tif (file) {\n\t\twriteESMModuleOutput(packages, file);\n\t}\n}\n\nexport function writeESMModuleOutput(packages: string[], file: string) {\n\twriteFileSync(\n\t\tfile,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdescription: `This is a programmatically created file via ${commandStr}`,\n\t\t\t\tpackages: packages,\n\t\t\t} as EsmPackagesFile,\n\t\t\tnull,\n\t\t\t4,\n\t\t),\n\t);\n}\n\nvoid main(options)\n\t.then(() => {\n\t\tprocess.exit();\n\t})\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(5);\n\t});\n"],"names":["writeESMModuleOutput","program","addOption","Option","choices","makeOptionMandatory","default","option","options","parse","process","argv","opts","commandStr","slice","join","main","pkgManager","cwd","recurse","output","file","quiet","packageGraph","getYarnInfoPackageGraph","Error","validate","packages","getESMPackages","sort","console","log","JSON","stringify","writeFileSync","description","then","exit","catch","err","error"],"mappings":";;;;+BA+EgBA;;;eAAAA;;;;yBA/EgB;;;;;;4BACgB;+BACM;;yBACxB;;;;;;AAE9BC,oBAAO,CACLC,SAAS,CACT,IAAIC,CAAAA,YAAK,QAAC,CACT,iCACA,oFAECC,OAAO,CAAC;IAAC;CAAU,EACnBC,mBAAmB,IAErBH,SAAS,CACT,IAAIC,CAAAA,YAAK,QAAC,CAAC,yBAAyB,kCAClCC,OAAO,CAAC;IAAC;IAAQ;IAAW;CAAO,EACnCE,OAAO,CAAC,WAAW,sCAErBC,MAAM,CAAC,eACPA,MAAM,CACN,iBACA,iDACA,OAEAA,MAAM,CAAC,qBAAqB,8BAC5BA,MAAM,CAAC,eAAe,sCAAsC;AAE9D,MAAMC,UAAUP,oBAAO,CAACQ,KAAK,CAACC,QAAQC,IAAI,EAAEC,IAAI;AAWhD,MAAMC,aAAa,CAAC,iBAAiB,EAAEH,QAAQC,IAAI,CAACG,KAAK,CAAC,GAAGC,IAAI,CAAC,MAAM;AAExE,eAAeC,KAAKR,OAAgB;IACnC,MAAM,EACLS,UAAU,EACVC,MAAMR,QAAQQ,GAAG,EAAE,EACnBC,OAAO,EACPC,MAAM,EACNC,IAAI,EACJC,KAAK,EACL,GAAGd;IACJ,IAAIe;IACJ,OAAQN;QACP,KAAK;YACJM,eAAe,MAAMC,IAAAA,sCAAuB,EAACN,KAAKC;YAClD;QACD;YACC,MAAM,IAAIM,MACT;IAEH;IACAF,aAAaG,QAAQ;IAErB,MAAMC,WAAW,AAAC,CAAA,MAAMC,IAAAA,0BAAc,EAACL,aAAY,EAAGM,IAAI;IAE1D,IAAI,CAACP,OAAO;QACX,OAAQF;YACP,KAAK;gBACJU,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACN;gBAC3B;YACD,KAAK;gBACJG,QAAQC,GAAG,CAACJ,SAASZ,IAAI,CAAC;QAC5B;IACD;IAEA,IAAIM,MAAM;QACTrB,qBAAqB2B,UAAUN;IAChC;AACD;AAEO,SAASrB,qBAAqB2B,QAAkB,EAAEN,IAAY;IACpEa,IAAAA,mBAAa,EACZb,MACAW,KAAKC,SAAS,CACb;QACCE,aAAa,CAAC,4CAA4C,EAAEtB,YAAY;QACxEc,UAAUA;IACX,GACA,MACA;AAGH;AAEA,KAAKX,KAAKR,SACR4B,IAAI,CAAC;IACL1B,QAAQ2B,IAAI;AACb,GACCC,KAAK,CAAC,CAACC;IACPT,QAAQU,KAAK,CAACD;IACd7B,QAAQ2B,IAAI,CAAC;AACd"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
3
|
try {
|
|
3
4
|
var info = gen[key](arg);
|
|
@@ -28,8 +29,8 @@ function _async_to_generator(fn) {
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
import { program, Option } from "commander";
|
|
31
|
-
import { getESMPackages } from "../operations";
|
|
32
|
-
import { getYarnInfoPackageGraph } from "../packageGraphs";
|
|
32
|
+
import { getESMPackages } from "../operations/index.mjs";
|
|
33
|
+
import { getYarnInfoPackageGraph } from "../packageGraphs/index.mjs";
|
|
33
34
|
import { writeFileSync } from "fs";
|
|
34
35
|
program.addOption(new Option("-p, --pkgManager <pkgManager>", "The package manager that you are running under - will be used to resolve modules").choices([
|
|
35
36
|
"yarnv2+"
|
|
@@ -39,6 +40,7 @@ program.addOption(new Option("-p, --pkgManager <pkgManager>", "The package manag
|
|
|
39
40
|
"none"
|
|
40
41
|
]).default("console", "writes each package to the a line")).option("--cwd <cwd>").option("-r, --recurse", "get all dependencies and not just direct ones", false).option("-f, --file <file>", "the file to output json to").option("-q, --quiet", "if we should not output any values", false);
|
|
41
42
|
const options = program.parse(process.argv).opts();
|
|
43
|
+
const commandStr = `get-esm-packages ${process.argv.slice(2).join(" ")}`;
|
|
42
44
|
function main(options) {
|
|
43
45
|
return _main.apply(this, arguments);
|
|
44
46
|
}
|
|
@@ -72,7 +74,7 @@ function _main() {
|
|
|
72
74
|
}
|
|
73
75
|
export function writeESMModuleOutput(packages, file) {
|
|
74
76
|
writeFileSync(file, JSON.stringify({
|
|
75
|
-
description: `This is a programmatically created file via ${
|
|
77
|
+
description: `This is a programmatically created file via ${commandStr}`,
|
|
76
78
|
packages: packages
|
|
77
79
|
}, null, 4));
|
|
78
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/get-esm-packages.ts"],"sourcesContent":["import { program, Option } from \"commander\";\nimport { EsmPackagesFile, getESMPackages } from \"../operations\";\nimport { getYarnInfoPackageGraph, PackageGraph } from \"../packageGraphs\";\nimport { writeFileSync } from \"fs\";\n\nprogram\n\t.addOption(\n\t\tnew Option(\n\t\t\t\"-p, --pkgManager <pkgManager>\",\n\t\t\t\"The package manager that you are running under - will be used to resolve modules\",\n\t\t)\n\t\t\t.choices([\"yarnv2+\"])\n\t\t\t.makeOptionMandatory(),\n\t)\n\t.addOption(\n\t\tnew Option(\"-o, --output <output>\", \"How to output the package info\")\n\t\t\t.choices([\"json\", \"console\", \"none\"])\n\t\t\t.default(\"console\", \"writes each package to the a line\"),\n\t)\n\t.option(\"--cwd <cwd>\")\n\t.option(\n\t\t\"-r, --recurse\",\n\t\t\"get all dependencies and not just direct ones\",\n\t\tfalse,\n\t)\n\t.option(\"-f, --file <file>\", \"the file to output json to\")\n\t.option(\"-q, --quiet\", \"if we should not output any values\", false);\n\nconst options = program.parse(process.argv).opts<CliOpts>();\n\ninterface CliOpts {\n\tpkgManager: \"yarnv2+\" | \"npm\";\n\tcwd?: string;\n\trecurse: boolean;\n\toutput: \"console\" | \"json\";\n\tfile?: string;\n\tquiet: boolean;\n}\n\nasync function main(options: CliOpts) {\n\tconst {\n\t\tpkgManager,\n\t\tcwd = process.cwd(),\n\t\trecurse,\n\t\toutput,\n\t\tfile,\n\t\tquiet,\n\t} = options;\n\tlet packageGraph: PackageGraph;\n\tswitch (pkgManager) {\n\t\tcase \"yarnv2+\":\n\t\t\tpackageGraph = await getYarnInfoPackageGraph(cwd, recurse);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t\"Unimplemented package manager GetPackagesGraphFn mapping!\",\n\t\t\t);\n\t}\n\tpackageGraph.validate();\n\n\tconst packages = (await getESMPackages(packageGraph)).sort();\n\n\tif (!quiet) {\n\t\tswitch (output) {\n\t\t\tcase \"json\":\n\t\t\t\tconsole.log(JSON.stringify(packages));\n\t\t\t\tbreak;\n\t\t\tcase \"console\":\n\t\t\t\tconsole.log(packages.join(\"\\n\"));\n\t\t}\n\t}\n\n\tif (file) {\n\t\twriteESMModuleOutput(packages, file);\n\t}\n}\n\nexport function writeESMModuleOutput(packages: string[], file: string) {\n\twriteFileSync(\n\t\tfile,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdescription: `This is a programmatically created file via ${
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/get-esm-packages.ts"],"sourcesContent":["import { program, Option } from \"commander\";\nimport { EsmPackagesFile, getESMPackages } from \"../operations\";\nimport { getYarnInfoPackageGraph, PackageGraph } from \"../packageGraphs\";\nimport { writeFileSync } from \"fs\";\n\nprogram\n\t.addOption(\n\t\tnew Option(\n\t\t\t\"-p, --pkgManager <pkgManager>\",\n\t\t\t\"The package manager that you are running under - will be used to resolve modules\",\n\t\t)\n\t\t\t.choices([\"yarnv2+\"])\n\t\t\t.makeOptionMandatory(),\n\t)\n\t.addOption(\n\t\tnew Option(\"-o, --output <output>\", \"How to output the package info\")\n\t\t\t.choices([\"json\", \"console\", \"none\"])\n\t\t\t.default(\"console\", \"writes each package to the a line\"),\n\t)\n\t.option(\"--cwd <cwd>\")\n\t.option(\n\t\t\"-r, --recurse\",\n\t\t\"get all dependencies and not just direct ones\",\n\t\tfalse,\n\t)\n\t.option(\"-f, --file <file>\", \"the file to output json to\")\n\t.option(\"-q, --quiet\", \"if we should not output any values\", false);\n\nconst options = program.parse(process.argv).opts<CliOpts>();\n\ninterface CliOpts {\n\tpkgManager: \"yarnv2+\" | \"npm\";\n\tcwd?: string;\n\trecurse: boolean;\n\toutput: \"console\" | \"json\";\n\tfile?: string;\n\tquiet: boolean;\n}\n\nconst commandStr = `get-esm-packages ${process.argv.slice(2).join(\" \")}`;\n\nasync function main(options: CliOpts) {\n\tconst {\n\t\tpkgManager,\n\t\tcwd = process.cwd(),\n\t\trecurse,\n\t\toutput,\n\t\tfile,\n\t\tquiet,\n\t} = options;\n\tlet packageGraph: PackageGraph;\n\tswitch (pkgManager) {\n\t\tcase \"yarnv2+\":\n\t\t\tpackageGraph = await getYarnInfoPackageGraph(cwd, recurse);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t\"Unimplemented package manager GetPackagesGraphFn mapping!\",\n\t\t\t);\n\t}\n\tpackageGraph.validate();\n\n\tconst packages = (await getESMPackages(packageGraph)).sort();\n\n\tif (!quiet) {\n\t\tswitch (output) {\n\t\t\tcase \"json\":\n\t\t\t\tconsole.log(JSON.stringify(packages));\n\t\t\t\tbreak;\n\t\t\tcase \"console\":\n\t\t\t\tconsole.log(packages.join(\"\\n\"));\n\t\t}\n\t}\n\n\tif (file) {\n\t\twriteESMModuleOutput(packages, file);\n\t}\n}\n\nexport function writeESMModuleOutput(packages: string[], file: string) {\n\twriteFileSync(\n\t\tfile,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdescription: `This is a programmatically created file via ${commandStr}`,\n\t\t\t\tpackages: packages,\n\t\t\t} as EsmPackagesFile,\n\t\t\tnull,\n\t\t\t4,\n\t\t),\n\t);\n}\n\nvoid main(options)\n\t.then(() => {\n\t\tprocess.exit();\n\t})\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(5);\n\t});\n"],"names":["program","Option","getESMPackages","getYarnInfoPackageGraph","writeFileSync","addOption","choices","makeOptionMandatory","default","option","options","parse","process","argv","opts","commandStr","slice","join","main","pkgManager","cwd","recurse","output","file","quiet","packageGraph","Error","validate","packages","sort","console","log","JSON","stringify","writeESMModuleOutput","description","then","exit","catch","err","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,SAA0BC,cAAc,QAAQ,0BAAgB;AAChE,SAASC,uBAAuB,QAAsB,6BAAmB;AACzE,SAASC,aAAa,QAAQ,KAAK;AAEnCJ,QACEK,SAAS,CACT,IAAIJ,OACH,iCACA,oFAECK,OAAO,CAAC;IAAC;CAAU,EACnBC,mBAAmB,IAErBF,SAAS,CACT,IAAIJ,OAAO,yBAAyB,kCAClCK,OAAO,CAAC;IAAC;IAAQ;IAAW;CAAO,EACnCE,OAAO,CAAC,WAAW,sCAErBC,MAAM,CAAC,eACPA,MAAM,CACN,iBACA,iDACA,OAEAA,MAAM,CAAC,qBAAqB,8BAC5BA,MAAM,CAAC,eAAe,sCAAsC;AAE9D,MAAMC,UAAUV,QAAQW,KAAK,CAACC,QAAQC,IAAI,EAAEC,IAAI;AAWhD,MAAMC,aAAa,CAAC,iBAAiB,EAAEH,QAAQC,IAAI,CAACG,KAAK,CAAC,GAAGC,IAAI,CAAC,MAAM;SAEzDC,KAAKR,OAAgB;WAArBQ;;SAAAA;IAAAA,QAAf,oBAAA,UAAoBR,OAAgB;QACnC,MAAM,EACLS,UAAU,EACVC,MAAMR,QAAQQ,GAAG,EAAE,EACnBC,OAAO,EACPC,MAAM,EACNC,IAAI,EACJC,KAAK,EACL,GAAGd;QACJ,IAAIe;QACJ,OAAQN;YACP,KAAK;gBACJM,eAAe,MAAMtB,wBAAwBiB,KAAKC;gBAClD;YACD;gBACC,MAAM,IAAIK,MACT;QAEH;QACAD,aAAaE,QAAQ;QAErB,MAAMC,WAAW,AAAC,CAAA,MAAM1B,eAAeuB,aAAY,EAAGI,IAAI;QAE1D,IAAI,CAACL,OAAO;YACX,OAAQF;gBACP,KAAK;oBACJQ,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACL;oBAC3B;gBACD,KAAK;oBACJE,QAAQC,GAAG,CAACH,SAASX,IAAI,CAAC;YAC5B;QACD;QAEA,IAAIM,MAAM;YACTW,qBAAqBN,UAAUL;QAChC;IACD;WApCeL;;AAsCf,OAAO,SAASgB,qBAAqBN,QAAkB,EAAEL,IAAY;IACpEnB,cACCmB,MACAS,KAAKC,SAAS,CACb;QACCE,aAAa,CAAC,4CAA4C,EAAEpB,YAAY;QACxEa,UAAUA;IACX,GACA,MACA;AAGH;AAEA,KAAKV,KAAKR,SACR0B,IAAI,CAAC;IACLxB,QAAQyB,IAAI;AACb,GACCC,KAAK,CAAC,CAACC;IACPT,QAAQU,KAAK,CAACD;IACd3B,QAAQyB,IAAI,CAAC;AACd"}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./operations\";\nexport * from \"./packageGraphs\";\n"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./operations\";\nexport * from \"./packageGraphs\";\n"],"names":[],"mappings":"AAAA,cAAc,yBAAe;AAC7B,cAAc,4BAAkB"}
|
|
@@ -27,7 +27,7 @@ function _async_to_generator(fn) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
import { readFile } from "fs/promises";
|
|
30
|
+
import { readFile } from "node:fs/promises";
|
|
31
31
|
import resolvePackagePath from "resolve-package-path";
|
|
32
32
|
import { join } from "path";
|
|
33
33
|
function resolvePkgPath(pkgDir, pkgName, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/operations/getESMPackages.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await readFile(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n"],"names":["readFile","resolvePackagePath","join","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","path","Error","getESMPackages","pkgGraph","packagePathsMap","resolvePackageJsons","currentNode","previousOptions","jsonPath","parentPkgPath","value","name","optionalDependencies","pkgInfos","some","info","packageJsonPath","contents","json","JSON","parse","toString","push","isModule","type","topDownVisitAsync","Array","from","Object","keys","reduce","mods","p","infos","forEach","add","Set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../src/operations/getESMPackages.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await readFile(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n"],"names":["readFile","resolvePackagePath","join","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","path","Error","getESMPackages","pkgGraph","packagePathsMap","resolvePackageJsons","currentNode","previousOptions","jsonPath","parentPkgPath","value","name","optionalDependencies","pkgInfos","some","info","packageJsonPath","contents","json","JSON","parse","toString","push","isModule","type","topDownVisitAsync","Array","from","Object","keys","reduce","mods","p","infos","forEach","add","Set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,mBAAc;AACvC,OAAOC,wBAAwB,uBAAuB;AAOtD,SAASC,IAAI,QAAQ,OAAO;AAE5B,SAASC,eACRC,MAAc,EACdC,OAAe,EACfC,OAOC;IAED,MAAM,EAAEC,sBAAsB,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH;IACpD,MAAMI,OAAOT,mBAAmBI,SAASD;IACzC,IAAI,CAACM,QAAQ,EAACH,mCAAAA,6CAAAA,sBAAwB,CAACF,QAAQ,KAAI,CAACG,SAAS;QAC5D,IAAIC,QAAQ;YACX,8DAA8D;YAC9D,OAAOP,KAAKE,QAAQ;QACrB;QACA,MAAM,IAAIO,MACT,CAAC,4CAA4C,EAAEN,QAAQ,mBAAmB,EAAED,QAAQ;IAEtF;IACA,OAAOM;AACR;AAsBA;;;;CAIC,GACD,gBAAsBE,eAAeC,QAAsB;WAArCD;;SAAAA;IAAAA,kBAAf,oBAAA,UAA8BC,QAAsB;QAC1D,MAAMC,kBAGF,CAAC;iBAEUC,oBACdC,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AC,CAACC,MAAMC;YAC1C,MAAMC,QAAQ7B,eAAe,CAAC4B,EAAE;YAChCC,MAAMC,OAAO,CAAC,CAACnB;gBACd,IAAIA,KAAKQ,QAAQ,EAAE;oBAClBQ,KAAKI,GAAG,CAACH;gBACV;YACD;YACA,OAAOD;QACR,GAAG,IAAIK;IAET;WAhEsBlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/operations/index.ts"],"sourcesContent":["export * from \"./getESMPackages\";\nexport * from \"./jest\";\n"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/operations/index.ts"],"sourcesContent":["export * from \"./getESMPackages\";\nexport * from \"./jest\";\n"],"names":[],"mappings":"AAAA,cAAc,uBAAmB;AACjC,cAAc,aAAS"}
|
|
@@ -12,7 +12,7 @@ function _define_property(obj, key, value) {
|
|
|
12
12
|
return obj;
|
|
13
13
|
}
|
|
14
14
|
import { resolve } from "path";
|
|
15
|
-
import { Graph } from "./Graph";
|
|
15
|
+
import { Graph } from "./Graph.mjs";
|
|
16
16
|
/**
|
|
17
17
|
* A graph of package names and their dependencies
|
|
18
18
|
*/ export class PackageGraph extends Graph {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/packageGraphs/PackageGraph.ts"],"sourcesContent":["import { resolve } from \"path\";\nimport { Graph } from \"./Graph\";\n\nexport interface PackageInfo {\n\tname: string;\n\tversion: string;\n\t// We need this because some patches will register as dependencies but won't be able to resolve things\n\tisPatch: boolean;\n\t// We need this because some trees will contain the base package which won't self-resolve\n\tisRoot: boolean;\n}\n\nexport interface PackageInfoKey {\n\tname: string;\n\tversion: string;\n}\n\n/**\n * A graph of package names and their dependencies\n */\nexport class PackageGraph extends Graph<PackageInfo, PackageInfoKey> {\n\treadonly pkgDir: string;\n\tconstructor(pkgDir: string) {\n\t\tsuper((node: PackageInfoKey) => `${node.name}@${node.version}`);\n\n\t\tif (!pkgDir) {\n\t\t\tthrow new Error(\"Must supply a pkgDir!\");\n\t\t}\n\t\tthis.pkgDir = resolve(pkgDir);\n\t}\n}\n"],"names":["resolve","Graph","PackageGraph","constructor","pkgDir","node","name","version","Error"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../src/packageGraphs/PackageGraph.ts"],"sourcesContent":["import { resolve } from \"path\";\nimport { Graph } from \"./Graph\";\n\nexport interface PackageInfo {\n\tname: string;\n\tversion: string;\n\t// We need this because some patches will register as dependencies but won't be able to resolve things\n\tisPatch: boolean;\n\t// We need this because some trees will contain the base package which won't self-resolve\n\tisRoot: boolean;\n}\n\nexport interface PackageInfoKey {\n\tname: string;\n\tversion: string;\n}\n\n/**\n * A graph of package names and their dependencies\n */\nexport class PackageGraph extends Graph<PackageInfo, PackageInfoKey> {\n\treadonly pkgDir: string;\n\tconstructor(pkgDir: string) {\n\t\tsuper((node: PackageInfoKey) => `${node.name}@${node.version}`);\n\n\t\tif (!pkgDir) {\n\t\t\tthrow new Error(\"Must supply a pkgDir!\");\n\t\t}\n\t\tthis.pkgDir = resolve(pkgDir);\n\t}\n}\n"],"names":["resolve","Graph","PackageGraph","constructor","pkgDir","node","name","version","Error"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,KAAK,QAAQ,cAAU;AAgBhC;;CAEC,GACD,OAAO,MAAMC,qBAAqBD;IAEjCE,YAAYC,MAAc,CAAE;QAC3B,KAAK,CAAC,CAACC,OAAyB,GAAGA,KAAKC,IAAI,CAAC,CAAC,EAAED,KAAKE,OAAO,EAAE,GAF/D,uBAASH,UAAT,KAAA;QAIC,IAAI,CAACA,QAAQ;YACZ,MAAM,IAAII,MAAM;QACjB;QACA,IAAI,CAACJ,MAAM,GAAGJ,QAAQI;IACvB;AACD"}
|
|
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
import { execSync } from "child_process";
|
|
31
|
-
import { PackageGraph } from "./PackageGraph";
|
|
31
|
+
import { PackageGraph } from "./PackageGraph.mjs";
|
|
32
32
|
import { existsSync, readFileSync } from "fs";
|
|
33
33
|
import { dirname, join } from "path";
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/packageGraphs/getYarnInfoPackageGraph.ts"],"sourcesContent":["import { execSync } from \"child_process\";\nimport { PackageGraph, PackageInfoKey } from \"./PackageGraph\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\n\n/**\n * Gets the first package.json that can be found\n */\nfunction getRootPackageJson(start: string, curDir?: string) {\n\tconst dir = curDir ?? start;\n\tconst testPath = join(dir, \"package.json\");\n\tif (existsSync(testPath)) {\n\t\treturn testPath;\n\t}\n\tconst oneUp = dirname(dir);\n\n\tif (!oneUp) {\n\t\tthrow new Error(\n\t\t\t`Could not find package.json traveling up from start dir at ${start}`,\n\t\t);\n\t}\n\treturn getRootPackageJson(start, oneUp);\n}\n\n/**\n * Retrieves the dependencies for a package in a PackageGraph\n * @param pkgDir - the directory where the top-level package is\n * @param recurse - get all the packages through all immediate dependencies\n * @returns\n */\nexport async function getYarnInfoPackageGraph(\n\tpkgDir: string,\n\trecurse: boolean,\n): Promise<PackageGraph> {\n\tconst query = execSync(`yarn info ${recurse ? \"-R\" : \"\"} --json`, {\n\t\tcwd: pkgDir,\n\t\tstdio: \"pipe\",\n\t});\n\n\t// Get the current package name so we can determine the root\n\tconst rootPkgJsonPath = getRootPackageJson(pkgDir);\n\tlet rootPkgName = \"\";\n\ttry {\n\t\trootPkgName = JSON.parse(readFileSync(rootPkgJsonPath).toString()).name;\n\t} catch (e) {\n\t\tconsole.error(\"Error retrieving root package name!\");\n\t\tthrow e;\n\t}\n\n\tconst packageGraph = new PackageGraph(pkgDir);\n\t// Since the info shows multiple versions we keep a dedup set of the serialized key to avoid longer times\n\tconst dedupSet = new Set<string>();\n\n\treturn query\n\t\t.toString()\n\t\t.split(\"\\n\")\n\t\t.reduce((pkgGraph, q) => {\n\t\t\t// Make sure we have an actual value\n\t\t\tif (q.trim()) {\n\t\t\t\tconst pkgInfo = JSON.parse(q) as YamlInfoDeps;\n\t\t\t\tconst { name, version, isPatch } = parsePackage(pkgInfo.value);\n\t\t\t\tconst nameKey = packageGraph.keySerializer({\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t});\n\t\t\t\tif (!dedupSet.has(nameKey)) {\n\t\t\t\t\tdedupSet.add(nameKey);\n\t\t\t\t\t// List of package names as dependencies\n\t\t\t\t\tlet deps: PackageInfoKey[];\n\t\t\t\t\tif (recurse) {\n\t\t\t\t\t\tdeps =\n\t\t\t\t\t\t\tpkgInfo.children?.Dependencies?.map((deps) => {\n\t\t\t\t\t\t\t\tconst info = parsePackage(deps.locator);\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tname: info.name,\n\t\t\t\t\t\t\t\t\tversion: info.version,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}) ?? [];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We don't actually set up the dependencies because that would make the graph incomplete\n\t\t\t\t\t\tdeps = [];\n\t\t\t\t\t}\n\t\t\t\t\tpackageGraph.addDownstreamNode({\n\t\t\t\t\t\tself: {\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\tisPatch,\n\t\t\t\t\t\t\tisRoot: name === rootPkgName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tto: deps ?? [],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn pkgGraph;\n\t\t}, packageGraph);\n}\n\nfunction parsePackage(pkgAndVersion: string): {\n\tname: string;\n\tversion: string;\n\tisPatch: boolean;\n} {\n\tconst versionIdx = pkgAndVersion.indexOf(\"@\", 1);\n\tif (versionIdx < 0) {\n\t\tthrow new Error(`could not find version from name: ${pkgAndVersion}`);\n\t}\n\tlet version = pkgAndVersion.substring(versionIdx + 1);\n\t// Parse out virtual versions since those are just file directors used by yarn\n\tif (version.startsWith(\"virtual:\")) {\n\t\tconst hashIdx = version.lastIndexOf(\"#\");\n\t\tif (hashIdx < 1) {\n\t\t\tthrow new Error(\n\t\t\t\t`could not find the expected # for virtual locator information`,\n\t\t\t);\n\t\t}\n\t\tversion = version.substring(hashIdx + 1);\n\t}\n\treturn {\n\t\tname: pkgAndVersion.substring(0, versionIdx),\n\t\tversion,\n\t\tisPatch: version.includes(\"patch\"),\n\t};\n}\n\ninterface YamlInfoDeps {\n\tvalue: string;\n\tchildren?: {\n\t\tInstances: number;\n\t\tVersion: string;\n\t\tDependencies?: {\n\t\t\tdescriptor: string;\n\t\t\tlocator: string;\n\t\t}[];\n\t};\n}\n"],"names":["execSync","PackageGraph","existsSync","readFileSync","dirname","join","getRootPackageJson","start","curDir","dir","testPath","oneUp","Error","getYarnInfoPackageGraph","pkgDir","recurse","query","cwd","stdio","rootPkgJsonPath","rootPkgName","JSON","parse","toString","name","e","console","error","packageGraph","dedupSet","Set","split","reduce","pkgGraph","q","trim","pkgInfo","version","isPatch","parsePackage","value","nameKey","keySerializer","has","add","deps","children","Dependencies","map","info","locator","addDownstreamNode","self","isRoot","to","pkgAndVersion","versionIdx","indexOf","substring","startsWith","hashIdx","lastIndexOf","includes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,YAAY,QAAwB,
|
|
1
|
+
{"version":3,"sources":["../../../src/packageGraphs/getYarnInfoPackageGraph.ts"],"sourcesContent":["import { execSync } from \"child_process\";\nimport { PackageGraph, PackageInfoKey } from \"./PackageGraph\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\n\n/**\n * Gets the first package.json that can be found\n */\nfunction getRootPackageJson(start: string, curDir?: string) {\n\tconst dir = curDir ?? start;\n\tconst testPath = join(dir, \"package.json\");\n\tif (existsSync(testPath)) {\n\t\treturn testPath;\n\t}\n\tconst oneUp = dirname(dir);\n\n\tif (!oneUp) {\n\t\tthrow new Error(\n\t\t\t`Could not find package.json traveling up from start dir at ${start}`,\n\t\t);\n\t}\n\treturn getRootPackageJson(start, oneUp);\n}\n\n/**\n * Retrieves the dependencies for a package in a PackageGraph\n * @param pkgDir - the directory where the top-level package is\n * @param recurse - get all the packages through all immediate dependencies\n * @returns\n */\nexport async function getYarnInfoPackageGraph(\n\tpkgDir: string,\n\trecurse: boolean,\n): Promise<PackageGraph> {\n\tconst query = execSync(`yarn info ${recurse ? \"-R\" : \"\"} --json`, {\n\t\tcwd: pkgDir,\n\t\tstdio: \"pipe\",\n\t});\n\n\t// Get the current package name so we can determine the root\n\tconst rootPkgJsonPath = getRootPackageJson(pkgDir);\n\tlet rootPkgName = \"\";\n\ttry {\n\t\trootPkgName = JSON.parse(readFileSync(rootPkgJsonPath).toString()).name;\n\t} catch (e) {\n\t\tconsole.error(\"Error retrieving root package name!\");\n\t\tthrow e;\n\t}\n\n\tconst packageGraph = new PackageGraph(pkgDir);\n\t// Since the info shows multiple versions we keep a dedup set of the serialized key to avoid longer times\n\tconst dedupSet = new Set<string>();\n\n\treturn query\n\t\t.toString()\n\t\t.split(\"\\n\")\n\t\t.reduce((pkgGraph, q) => {\n\t\t\t// Make sure we have an actual value\n\t\t\tif (q.trim()) {\n\t\t\t\tconst pkgInfo = JSON.parse(q) as YamlInfoDeps;\n\t\t\t\tconst { name, version, isPatch } = parsePackage(pkgInfo.value);\n\t\t\t\tconst nameKey = packageGraph.keySerializer({\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t});\n\t\t\t\tif (!dedupSet.has(nameKey)) {\n\t\t\t\t\tdedupSet.add(nameKey);\n\t\t\t\t\t// List of package names as dependencies\n\t\t\t\t\tlet deps: PackageInfoKey[];\n\t\t\t\t\tif (recurse) {\n\t\t\t\t\t\tdeps =\n\t\t\t\t\t\t\tpkgInfo.children?.Dependencies?.map((deps) => {\n\t\t\t\t\t\t\t\tconst info = parsePackage(deps.locator);\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tname: info.name,\n\t\t\t\t\t\t\t\t\tversion: info.version,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}) ?? [];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We don't actually set up the dependencies because that would make the graph incomplete\n\t\t\t\t\t\tdeps = [];\n\t\t\t\t\t}\n\t\t\t\t\tpackageGraph.addDownstreamNode({\n\t\t\t\t\t\tself: {\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\tisPatch,\n\t\t\t\t\t\t\tisRoot: name === rootPkgName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tto: deps ?? [],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn pkgGraph;\n\t\t}, packageGraph);\n}\n\nfunction parsePackage(pkgAndVersion: string): {\n\tname: string;\n\tversion: string;\n\tisPatch: boolean;\n} {\n\tconst versionIdx = pkgAndVersion.indexOf(\"@\", 1);\n\tif (versionIdx < 0) {\n\t\tthrow new Error(`could not find version from name: ${pkgAndVersion}`);\n\t}\n\tlet version = pkgAndVersion.substring(versionIdx + 1);\n\t// Parse out virtual versions since those are just file directors used by yarn\n\tif (version.startsWith(\"virtual:\")) {\n\t\tconst hashIdx = version.lastIndexOf(\"#\");\n\t\tif (hashIdx < 1) {\n\t\t\tthrow new Error(\n\t\t\t\t`could not find the expected # for virtual locator information`,\n\t\t\t);\n\t\t}\n\t\tversion = version.substring(hashIdx + 1);\n\t}\n\treturn {\n\t\tname: pkgAndVersion.substring(0, versionIdx),\n\t\tversion,\n\t\tisPatch: version.includes(\"patch\"),\n\t};\n}\n\ninterface YamlInfoDeps {\n\tvalue: string;\n\tchildren?: {\n\t\tInstances: number;\n\t\tVersion: string;\n\t\tDependencies?: {\n\t\t\tdescriptor: string;\n\t\t\tlocator: string;\n\t\t}[];\n\t};\n}\n"],"names":["execSync","PackageGraph","existsSync","readFileSync","dirname","join","getRootPackageJson","start","curDir","dir","testPath","oneUp","Error","getYarnInfoPackageGraph","pkgDir","recurse","query","cwd","stdio","rootPkgJsonPath","rootPkgName","JSON","parse","toString","name","e","console","error","packageGraph","dedupSet","Set","split","reduce","pkgGraph","q","trim","pkgInfo","version","isPatch","parsePackage","value","nameKey","keySerializer","has","add","deps","children","Dependencies","map","info","locator","addDownstreamNode","self","isRoot","to","pkgAndVersion","versionIdx","indexOf","substring","startsWith","hashIdx","lastIndexOf","includes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,YAAY,QAAwB,qBAAiB;AAC9D,SAASC,UAAU,EAAEC,YAAY,QAAQ,KAAK;AAC9C,SAASC,OAAO,EAAEC,IAAI,QAAQ,OAAO;AAErC;;CAEC,GACD,SAASC,mBAAmBC,KAAa,EAAEC,MAAe;IACzD,MAAMC,MAAMD,mBAAAA,oBAAAA,SAAUD;IACtB,MAAMG,WAAWL,KAAKI,KAAK;IAC3B,IAAIP,WAAWQ,WAAW;QACzB,OAAOA;IACR;IACA,MAAMC,QAAQP,QAAQK;IAEtB,IAAI,CAACE,OAAO;QACX,MAAM,IAAIC,MACT,CAAC,2DAA2D,EAAEL,OAAO;IAEvE;IACA,OAAOD,mBAAmBC,OAAOI;AAClC;AAEA;;;;;CAKC,GACD,gBAAsBE,wBACrBC,MAAc,EACdC,OAAgB;WAFKF;;SAAAA;IAAAA,2BAAf,oBAAA,UACNC,MAAc,EACdC,OAAgB;Q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auB,iBAAiB,CAAC;wBAC9BC,MAAM;4BACL5B;4BACAa;wBACD;wBACAG,OAAO;4BACNhB;4BACAa;4BACAC;4BACAe,QAAQ7B,SAASJ;wBAClB;wBACAkC,IAAIT,iBAAAA,kBAAAA,OAAQ,EAAE;oBACf;gBACD;YACD;YACA,OAAOZ;QACR,GAAGL;IACL;WArEsBf;;AAuEtB,SAAS0B,aAAagB,aAAqB;IAK1C,MAAMC,aAAaD,cAAcE,OAAO,CAAC,KAAK;IAC9C,IAAID,aAAa,GAAG;QACnB,MAAM,IAAI5C,MAAM,CAAC,kCAAkC,EAAE2C,eAAe;IACrE;IACA,IAAIlB,UAAUkB,cAAcG,SAAS,CAACF,aAAa;IACnD,8EAA8E;IAC9E,IAAInB,QAAQsB,UAAU,CAAC,aAAa;QACnC,MAAMC,UAAUvB,QAAQwB,WAAW,CAAC;QACpC,IAAID,UAAU,GAAG;YAChB,MAAM,IAAIhD,MACT,CAAC,6DAA6D,CAAC;QAEjE;QACAyB,UAAUA,QAAQqB,SAAS,CAACE,UAAU;IACvC;IACA,OAAO;QACNpC,MAAM+B,cAAcG,SAAS,CAAC,GAAGF;QACjCnB;QACAC,SAASD,QAAQyB,QAAQ,CAAC;IAC3B;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./Graph";
|
|
3
|
-
export * from "./PackageGraph";
|
|
4
|
-
export * from "./getYarnInfoPackageGraph";
|
|
1
|
+
export * from "./types.mjs";
|
|
2
|
+
export * from "./Graph.mjs";
|
|
3
|
+
export * from "./PackageGraph.mjs";
|
|
4
|
+
export * from "./getYarnInfoPackageGraph.mjs";
|
|
5
5
|
|
|
6
6
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/packageGraphs/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./Graph\";\nexport * from \"./PackageGraph\";\nexport * from \"./getYarnInfoPackageGraph\";\n"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/packageGraphs/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./Graph\";\nexport * from \"./PackageGraph\";\nexport * from \"./getYarnInfoPackageGraph\";\n"],"names":[],"mappings":"AAAA,cAAc,cAAU;AACxB,cAAc,cAAU;AACxB,cAAc,qBAAiB;AAC/B,cAAc,gCAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-esm-packages.d.ts","sourceRoot":"","sources":["../../../src/bin/get-esm-packages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-esm-packages.d.ts","sourceRoot":"","sources":["../../../src/bin/get-esm-packages.ts"],"names":[],"mappings":"AA+EA,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,QAYpE"}
|
package/package.json
CHANGED
|
@@ -3,23 +3,21 @@
|
|
|
3
3
|
"main": "dist/cjs/index.js",
|
|
4
4
|
"types": "dist/types/index.d.ts",
|
|
5
5
|
"bin": {
|
|
6
|
-
"get-esm-packages": "dist/bin/get-esm-packages.
|
|
6
|
+
"get-esm-packages": "dist/esm/bin/get-esm-packages.mjs"
|
|
7
7
|
},
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"require": "./dist/cjs/index.js",
|
|
11
11
|
"import": "./dist/esm/index.mjs",
|
|
12
|
-
"types": "./dist/types/index.d.ts"
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"default": "./dist/esm/index.js"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"README.md"
|
|
18
|
-
],
|
|
16
|
+
"files": ["dist", "README.md"],
|
|
19
17
|
"scripts": {
|
|
20
18
|
"build:esm": "tswc -- src -d dist/esm --config-file .esm.swcrc --strip-leading-paths --out-file-extension mjs",
|
|
21
19
|
"build:cjs": "tswc -- src -d dist/cjs --config-file .cjs.swcrc --strip-leading-paths",
|
|
22
|
-
"build:bin": "
|
|
20
|
+
"build:bin": "node ./bin-build.js",
|
|
23
21
|
"build:types": "tsc",
|
|
24
22
|
"build": "yarn build:types && yarn build:esm && yarn build:cjs && yarn build:bin",
|
|
25
23
|
"lint": "biome lint",
|
|
@@ -32,13 +30,14 @@
|
|
|
32
30
|
"devDependencies": {
|
|
33
31
|
"@biomejs/biome": "1.9.4",
|
|
34
32
|
"@commitlint/config-angular": "^19.6.0",
|
|
33
|
+
"@hanseltime/pkgtest": "^1.0.0",
|
|
35
34
|
"@hanseltime/swc-plugin-node-globals-inject": "^1.0.0",
|
|
36
35
|
"@rspack/cli": "^1.1.6",
|
|
37
36
|
"@rspack/core": "^1.1.6",
|
|
38
37
|
"@semantic-release/changelog": "^6.0.3",
|
|
39
38
|
"@semantic-release/git": "^10.0.1",
|
|
40
|
-
"@swc/cli": "^0.
|
|
41
|
-
"@swc/core": "^1.10.
|
|
39
|
+
"@swc/cli": "^0.6.0",
|
|
40
|
+
"@swc/core": "^1.10.18",
|
|
42
41
|
"@types/jest": "^29.5.14",
|
|
43
42
|
"@types/node": "^18",
|
|
44
43
|
"commitlint": "^19.6.1",
|
|
@@ -53,6 +52,7 @@
|
|
|
53
52
|
"typescript": "^5.0.0"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
55
|
+
"@semantic-release/exec": "^7.0.3",
|
|
56
56
|
"commander": "^12.1.0",
|
|
57
57
|
"resolve-package-path": "^4.0.3"
|
|
58
58
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"packageManager": "yarn@4.5.3",
|
|
63
|
-
"version": "1.0.
|
|
63
|
+
"version": "1.0.2"
|
|
64
64
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
(()=>{var e={606:function(e){"use strict";e.exports=function(){return/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?/}},863:function(e,t,i){"use strict";var r=i(606);e.exports=function(e){if("string"!=typeof e)throw TypeError("expected a string");var t=r().exec(e);if(t)return t[0]}},164:function(e,t,i){"use strict";let r=i(926);e.exports=class{constructor(){this.MODULE_ENTRY=new r,this.PATH=new r,this.REAL_FILE_PATH=new r,this.REAL_DIRECTORY_PATH=new r,Object.freeze(this)}}},926:function(e){"use strict";e.exports=class{constructor(){this._store=function(){let e=Object.create(null);return e._cache=1,delete e._cache,e}()}set(e,t){return this._store[e]=t}get(e){return this._store[e]}has(e){return e in this._store}delete(e){delete this._store[e]}get size(){return Object.keys(this._store).length}}},554:function(e,t,i){"use strict";let r;var n,s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};let o=s(i(17)),a=s(i(57)),l=s(i(586)),h=["MODULE_NOT_FOUND","UNDECLARED_DEPENDENCY","MISSING_PEER_DEPENDENCY","MISSING_DEPENDENCY"],u=i(164),c=i(926),p=a.default._getRealFilePath,d=a.default._getRealDirectoryPath,m=a.default._findUpPackagePath,f=new u,g=new c;try{r=i(125)}catch(e){}function _(e,t){let i;return m(i=null==t||!0===t?g:!1===t?new c:t,o.default.resolve(e))}function O(e,t,i){let n,s;n=null==i||!0===i?f:!1===i?new u:i,t.charAt(t.length-1)!==o.default.sep&&(t=`${t}${o.default.sep}`);let c=e+"\0"+t;if(n.PATH.has(c))s=n.PATH.get(c);else{try{s=r?r.resolveToUnqualified(e+"/package.json",t):(0,a.default)(n,e,t)}catch(e){(0,l.default)(e,...h),s=null}n.PATH.set(c,s)}return s}O._resetCache=function(){f=new u,g=new c},(n=O||(O={}))._FIND_UP_CACHE=g,n.findUpPackagePath=_,Object.defineProperty(O,"_CACHE",{get:function(){return f}}),Object.defineProperty(O,"_FIND_UP_CACHE",{get:function(){return g}}),O.getRealFilePath=function(e){return p(f.REAL_FILE_PATH,e)},O.getRealDirectoryPath=function(e){return d(f.REAL_DIRECTORY_PATH,e)},e.exports=O},57:function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};let n=i(147),s=i(17),o=i(863),a=r(i(586)),l=/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/,h=i(873)(process);function u(e,t){if(e.has(t))return e.get(t);let i=null;try{let e=n.statSync(t);(e.isFile()||e.isFIFO())&&(i=h?t:n.realpathSync(t))}catch(e){(0,a.default)(e,"ENOENT")}return e.set(t,i),i}function c(e,t){if(e.has(t))return e.get(t);let i=null;try{n.statSync(t).isDirectory()&&(i=h?t:n.realpathSync(t))}catch(e){(0,a.default)(e,"ENOENT","ENOTDIR")}return e.set(t,i),i}function p(e,t,i){let r=o(i),n=i;for(;n!==r;){let i="node_modules"===s.basename(n).toLowerCase(),r=u(e,s.join(n,i?"":"node_modules",t));if(r)return r;i&&(n=s.dirname(n)),n=s.dirname(n)}return null}function d(e,t,i){if("string"!=typeof t||0===t.length)throw TypeError("resolvePackagePath: 'name' must be a non-zero-length string.");let r=i||__dirname,n=s.resolve(r);for(;null===c(e.REAL_DIRECTORY_PATH,n);)n=s.dirname(n);if(!n){let e=TypeError("resolvePackagePath: 'dir' or one of the parent directories in its path must refer to a valid directory.");throw e.code="MODULE_NOT_FOUND",e}if(!l.test(t))return p(e.REAL_FILE_PATH,s.join(t,"package.json"),n);{let i=s.resolve(n,t);return u(e.REAL_FILE_PATH,s.join(i,"package.json"))}}d._findPackagePath=p,d._findUpPackagePath=function(e,t){let i,r;let o=t,a=null;do{if(e.has(o)){a=e.get(o);break}if(r=s.join(o,"package.json"),n.existsSync(r)){a=r;break}i=o,o=s.dirname(o)}while(o!==i);return e.set(t,a),a},d._getRealFilePath=u,d._getRealDirectoryPath=c,e.exports=d},586:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e,...t){if(null!==e&&"object"==typeof e){let i=e.code;for(let e of t)if(i===e)return}throw e}},873:function(e){"use strict";e.exports=function(e){return!!e.env.NODE_PRESERVE_SYMLINKS||function(e,t){for(let i=0;i<e.length;i++)if(e[i]===t)return!0;return!1}(e.execArgv,"--preserve-symlinks")}},907:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getESMPackages",{enumerable:!0,get:function(){return o}});let r=i(292),n=function(e){return e&&e.__esModule?e:{default:e}}(i(554)),s=i(17);async function o(e){let t={};async function i(i,o){let a=function(e,t,i){let{optionalDepsFromParent:r,isPatch:o,isRoot:a}=i,l=(0,n.default)(t,e);if(!l&&!r?.[t]&&!o){if(a)return(0,s.join)(e,"package.json");throw Error(`Non-optional dependency could not be found: ${t} when looking from ${e}`)}return l}(o?.parentPkgPath??e.pkgDir,i.value.name,{optionalDepsFromParent:o?.optionalDependencies,isPatch:i.value.isPatch,isRoot:i.value.isRoot});if(!a)return[{},!0];let l=t[i.value.name];if(l){if(l.some(e=>e.packageJsonPath===a))return[{},!1]}else l=[],t[i.value.name]=l;let h=JSON.parse((await (0,r.readFile)(a)).toString());return l.push({packageJsonPath:a,isModule:"module"===h.type}),[{optionalDependencies:h.optionalDependencies,parentPkgPath:a},!1]}return await e.topDownVisitAsync(i),Array.from(Object.keys(t).reduce((e,i)=>(t[i].forEach(t=>{t.isModule&&e.add(i)}),e),new Set))}},749:function(e,t,i){"use strict";function r(e,t){return Object.keys(e).forEach(function(i){"default"!==i&&!Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),e}Object.defineProperty(t,"__esModule",{value:!0}),r(i(907),t),r(i(834),t)},834:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e,t){for(var i in t)Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}(t,{createNodeModulesTransformIgnore:function(){return s},getJestNodeModulesTransformIgnore:function(){return n}});let r=i(147);function n(e){let{file:t,extraExceptions:i=[]}=e;return s(Array.from(new Set([...function(e){try{let t=JSON.parse((0,r.readFileSync)(e).toString());if(!t.packages||!Array.isArray(t.packages))throw Error("Esm packages file object is missing the expected packages field!");return t.packages}catch(t){throw console.error(`Malformed esm modules file: ${e}`),t}}(t),...i])))}function s(e){return`node_modules/(?!${e.map(e=>`${e}/`).join("|")})`}},600:function(e,t){"use strict";function i(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Graph",{enumerable:!0,get:function(){return r}});let r=class{getNodeKeyStr(e){return this.keySerializer?this.keySerializer(e):e}addDownstreamNode(e){let t=this.getNodeKeyStr(e.self);if(this.map.has(t)){let i=this.map.get(t);if(void 0!==i.value)throw Error(`Already added a downstream node of same key: ${t} - Can't add ${JSON.stringify(e)}`);i.to.push(...e.to),i.value=e.value}else this.map.set(t,{from:[],...e}),this.noFrom.add(t);e.to.forEach(t=>{let i=this.getNodeKeyStr(t);if(this.map.has(i)){let t=this.map.get(i);t.from.push(e.self),1===t.from.length&&this.noFrom.delete(i)}else this.map.set(i,{self:t,from:[e.self],to:[],value:void 0})})}validate(){let e=[];for(let[t,i]of this.map.entries())!i.value&&e.push(`Unregistered node: ${t}! Node was pointed to by: ${JSON.stringify(i.from)}`);if(e.length>0)throw Error(e.join("\n"))}async topDownVisitAsync(e,t){let i=t?new Set:void 0;for(let t of this.noFrom){let r=this.map.get(t);await this.visitDownNodeAsync(r,e,i)}}async visitDownNodeAsync(e,t,i,r){if(i?.has(this.getNodeKeyStr(e.self)))return;let[n,s]=await t(e,r);if(!s)await Promise.all(e.to.map(e=>this.visitDownNodeAsync(this.map.get(this.getNodeKeyStr(e)),t,i,n)))}constructor(e){i(this,"map",new Map),i(this,"noFrom",new Set),i(this,"keySerializer",void 0),this.keySerializer=e}}},278:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PackageGraph",{enumerable:!0,get:function(){return s}});let r=i(17),n=i(600),s=class extends n.Graph{constructor(e){var t,i,n;if(super(e=>`${e.name}@${e.version}`),t=this,n=void 0,(i="pkgDir")in t?Object.defineProperty(t,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[i]=n,!e)throw Error("Must supply a pkgDir!");this.pkgDir=(0,r.resolve)(e)}}},914:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getYarnInfoPackageGraph",{enumerable:!0,get:function(){return a}});let r=i(81),n=i(278),s=i(147),o=i(17);async function a(e,t){let i=(0,r.execSync)(`yarn info ${t?"-R":""} --json`,{cwd:e,stdio:"pipe"}),a=function e(t,i){let r=i??t,n=(0,o.join)(r,"package.json");if((0,s.existsSync)(n))return n;let a=(0,o.dirname)(r);if(!a)throw Error(`Could not find package.json traveling up from start dir at ${t}`);return e(t,a)}(e),h="";try{h=JSON.parse((0,s.readFileSync)(a).toString()).name}catch(e){throw console.error("Error retrieving root package name!"),e}let u=new n.PackageGraph(e),c=new Set;return i.toString().split("\n").reduce((e,i)=>{if(i.trim()){let e=JSON.parse(i),{name:r,version:n,isPatch:s}=l(e.value),o=u.keySerializer({name:r,version:n});if(!c.has(o)){let i;c.add(o),i=t?e.children?.Dependencies?.map(e=>{let t=l(e.locator);return{name:t.name,version:t.version}})??[]:[],u.addDownstreamNode({self:{name:r,version:n},value:{name:r,version:n,isPatch:s,isRoot:r===h},to:i??[]})}}return e},u)}function l(e){let t=e.indexOf("@",1);if(t<0)throw Error(`could not find version from name: ${e}`);let i=e.substring(t+1);if(i.startsWith("virtual:")){let e=i.lastIndexOf("#");if(e<1)throw Error("could not find the expected # for virtual locator information");i=i.substring(e+1)}return{name:e.substring(0,t),version:i,isPatch:i.includes("patch")}}},421:function(e,t,i){"use strict";function r(e,t){return Object.keys(e).forEach(function(i){"default"!==i&&!Object.prototype.hasOwnProperty.call(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),e}Object.defineProperty(t,"__esModule",{value:!0}),r(i(845),t),r(i(600),t),r(i(278),t),r(i(914),t)},845:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},81:function(e){"use strict";e.exports=require("child_process")},147:function(e){"use strict";e.exports=require("fs")},292:function(e){"use strict";e.exports=require("fs/promises")},718:function(e){"use strict";e.exports=require("node:child_process")},254:function(e){"use strict";e.exports=require("node:events")},561:function(e){"use strict";e.exports=require("node:fs")},411:function(e){"use strict";e.exports=require("node:path")},742:function(e){"use strict";e.exports=require("node:process")},17:function(e){"use strict";e.exports=require("path")},125:function(e){"use strict";e.exports=require("pnpapi")},673:function(e,t,i){let{Argument:r}=i(626),{Command:n}=i(306),{CommanderError:s,InvalidArgumentError:o}=i(649),{Help:a}=i(721),{Option:l}=i(533);t.program=new n,t.createCommand=e=>new n(e),t.createOption=(e,t)=>new l(e,t),t.createArgument=(e,t)=>new r(e,t),t.Command=n,t.Option=l,t.Argument=r,t.Help=a,t.CommanderError=s,t.InvalidArgumentError=o,t.InvalidOptionArgumentError=o},626:function(e,t,i){let{InvalidArgumentError:r}=i(649);t.Argument=class e{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new r(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},t.humanReadableArgName=function(e){let t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}},306:function(e,t,i){let r=i(254).EventEmitter,n=i(718),s=i(411),o=i(561),a=i(742),{Argument:l,humanReadableArgName:h}=i(626),{CommanderError:u}=i(649),{Help:c}=i(721),{Option:p,DualOptions:d}=i(533),{suggestSimilar:m}=i(109);class f extends r{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let r=t,n=i;"object"==typeof r&&null!==r&&(n=r,r=null),n=n||{};let[,s,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(s);return(r&&(a.description(r),a._executableHandler=!0),n.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(n.noHelp||n.hidden),a._executableFile=n.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),r)?this:a}createCommand(e){return new f(e)}createHelp(){return Object.assign(new c,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
3
|
-
- specify the name in Command constructor or using .name()`);return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new l(e,t)}argument(e,t,i,r){let n=this.createArgument(e,t);return"function"==typeof i?n.default(r).argParser(i):n.default(i),this.addArgument(n),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;let[,i,r]=(e=e??"help [command]").match(/([^ ]+) *(.*)/),n=t??"display help for command",s=this.createCommand(i);return s.helpOption(!1),r&&s.arguments(r),n&&s.description(n),this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
4
|
-
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if("commander.executeSubCommandAsync"!==e.code)throw e},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new u(e,t,i)),a.exit(e)}action(e){return this._actionHandler=t=>{let i=this.registeredArguments.length,r=t.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)},this}createOption(e,t){return new p(e,t)}_callParseArg(e,t,i,r){try{return e.parseArg(t,i)}catch(e){if("commander.invalidArgument"===e.code){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
|
|
5
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),i=t(e).find(e=>this._findCommand(e));if(i){let r=t(this._findCommand(i)).join("|"),n=t(e).join("|");throw Error(`cannot add command '${n}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,"--");!this._findOption(t)&&this.setOptionValueWithSource(i,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(i,e.defaultValue,"default");let r=(t,r,n)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);let s=this.getOptionValue(i);null!==t&&e.parseArg?t=this._callParseArg(e,t,s,r):null!==t&&e.variadic&&(t=e._concatValue(t,s)),null==t&&(t=!e.negate&&(!!e.isBoolean()||!!e.optional||"")),this.setOptionValueWithSource(i,t,n)};return this.on("option:"+t,t=>{let i=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,i,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{let i=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,i,"env")}),this}_optionEx(e,t,i,r,n){if("object"==typeof t&&t instanceof p)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,i);if(s.makeOptionMandatory(!!e.mandatory),"function"==typeof r)s.default(n).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,i)=>{let r=e.exec(t);return r?r[0]:i},s.default(n).argParser(r)}else s.default(r);return this.addOption(s)}option(e,t,i,r){return this._optionEx({},e,t,i,r)}requiredOption(e,t,i,r){return this._optionEx({mandatory:!0},e,t,i,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{void 0!==i.getOptionValueSource(e)&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){let i;if(void 0!==e&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){a.versions?.electron&&(t.from="electron");let e=a.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}switch(void 0===e&&(e=a.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){let i;t=t.slice();let r=!1,l=[".js",".ts",".tsx",".mjs",".cjs"];function h(e,t){let i=s.resolve(e,t);if(o.existsSync(i))return i;if(l.includes(s.extname(t)))return;let r=l.find(e=>o.existsSync(`${i}${e}`));if(r)return`${i}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let c=e._executableFile||`${this._name}-${e._name}`,p=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}p=s.resolve(s.dirname(e),p)}if(p){let t=h(p,c);if(!t&&!e._executableFile&&this._scriptPath){let i=s.basename(this._scriptPath,s.extname(this._scriptPath));i!==this._name&&(t=h(p,`${i}-${e._name}`))}c=t||c}r=l.includes(s.extname(c)),"win32"!==a.platform?r?(t.unshift(c),t=g(a.execArgv).concat(t),i=n.spawn(a.argv[0],t,{stdio:"inherit"})):i=n.spawn(c,t,{stdio:"inherit"}):(t.unshift(c),t=g(a.execArgv).concat(t),i=n.spawn(a.execPath,t,{stdio:"inherit"})),!i.killed&&["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{a.on(e,()=>{!1===i.killed&&null===i.exitCode&&i.kill(e)})});let d=this._exitCallback;i.on("close",e=>{e=e??1,d?d(new u(e,"commander.executeSubCommandAsync","(close)")):a.exit(e)}),i.on("error",t=>{if("ENOENT"===t.code){let t=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";throw Error(`'${c}' does not exist
|
|
6
|
-
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
7
|
-
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
8
|
-
- ${t}`)}if("EACCES"===t.code)throw Error(`'${c}' not executable`);if(d){let e=new u(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,d(e)}else a.exit(1)}),this.runningCommand=i}_dispatchSubcommand(e,t,i){let r;let n=this._findCommand(e);return!n&&this.help({error:!0}),r=this._chainOrCallSubCommandHook(r,n,"preSubcommand"),r=this._chainOrCall(r,()=>{if(!n._executableHandler)return n._parseCommand(t,i);this._executeSubCommand(n,t.concat(i))})}_dispatchHelpCommand(e){!e&&this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0)||!this.registeredArguments[this.registeredArguments.length-1].variadic)this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,i)=>{let r=t;if(null!==t&&e.parseArg){let n=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,i,n)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,r)=>{let n=i.defaultValue;i.variadic?r<this.args.length?(n=this.args.slice(r),i.parseArg&&(n=n.reduce((t,r)=>e(i,r,t),i.defaultValue))):void 0===n&&(n=[]):r<this.args.length&&(n=this.args[r],i.parseArg&&(n=e(i,n,i.defaultValue))),t[r]=n}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),"postAction"===t&&r.reverse(),r.forEach(e=>{i=this._chainOrCall(i,()=>e.callback(e.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let r=e;return void 0!==this._lifeCycleHooks[i]&&this._lifeCycleHooks[i].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&0===this.args.length&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){let i;return r(),this._processArguments(),i=this._chainOrCallHooks(i,"preAction"),i=this._chainOrCall(i,()=>this._actionHandler(this.processedArgs)),this.parent&&(i=this._chainOrCall(i,()=>{this.parent.emit(n,e,t)})),i=this._chainOrCallHooks(i,"postAction")}if(this.parent&&this.parent.listenerCount(n))r(),this._processArguments(),this.parent.emit(n,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let i=e.find(e=>t.conflictsWith.includes(e.attributeName()));i&&this._conflictingOption(t,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],r=t,n=e.slice();function s(e){return e.length>1&&"-"===e[0]}let o=null;for(;n.length;){let e=n.shift();if("--"===e){r===i&&r.push(e),r.push(...n);break}if(o&&!s(e)){this.emit(`option:${o.name()}`,e);continue}if(o=null,s(e)){let t=this._findOption(e);if(t){if(t.required){let e=n.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;n.length>0&&!s(n[0])&&(e=n.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){let t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),n.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){let t=e.indexOf("="),i=this._findOption(e.slice(0,t));if(i&&(i.required||i.optional)){this.emit(`option:${i.name()}`,e.slice(t+1));continue}}if(s(e)&&(r=i),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===i.length){if(this._findCommand(e)){t.push(e),n.length>0&&i.push(...n);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),n.length>0&&t.push(...n);break}else if(this._defaultCommandName){i.push(e),n.length>0&&i.push(...n);break}}if(this._passThroughOptions){r.push(e),n.length>0&&r.push(...n);break}r.push(e)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let t=this.options[i].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
9
|
-
`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
10
|
-
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));let i=t||{},r=i.exitCode||1,n=i.code||"commander.error";this._exit(r,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new d(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(i=>void 0!==i.implied&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=e=>{let t=e.attributeName(),i=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),n=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(void 0===r.presetArg&&!1===i||void 0!==r.presetArg&&i===r.presetArg)?r:n||e},r=e=>{let t=i(e),r=t.attributeName();return"env"===this.getOptionValueSource(r)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},n=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);i=i.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,i)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=this.parent?` for '${this.name()}'`:"",r=`error: too many arguments${i}. Expected ${t} argument${1===t?"":"s"} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(e=>{i.push(e.name()),e.alias()&&i.push(e.alias())}),t=m(e,i)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let r=this.createOption(t,i);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
11
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let t=[i.name()].concat(i.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>h(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=s.basename(e,s.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){let t;let i={error:!!(e=e||{}).error};return t=i.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),i.write=e.write||t,i.command=this,i}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let r=this.helpInformation(i);if(t&&"string"!=typeof(r=t(r))&&!Buffer.isBuffer(r))throw Error("outputHelp callback must return a string or a Buffer");i.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",i))}helpOption(e,t){return"boolean"==typeof e?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
12
|
-
Expecting one of '${i.join("', '")}'`);let r=`${e}Help`;return this.on(r,e=>{let i;(i="function"==typeof t?t({error:e.error,command:e.command}):t)&&e.write(`${i}
|
|
13
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function g(e){return e.map(e=>{let t,i;if(!e.startsWith("--inspect"))return e;let r="127.0.0.1",n="9229";return(null!==(i=e.match(/^(--inspect(-brk)?)$/))?t=i[1]:null!==(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=i[1],/^\d+$/.test(i[3])?n=i[3]:r=i[3]):null!==(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=i[1],r=i[3],n=i[4]),t&&"0"!==n)?`${t}=${r}:${parseInt(n)+1}`:e})}t.Command=f},649:function(e,t){class i extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}t.CommanderError=i,t.InvalidArgumentError=class e extends i{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},721:function(e,t,i){let{humanReadableArgName:r}=i(626);t.Help=class e{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let i=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),i=e._getHelpOption();if(i&&!i.hidden){let r=i.short&&e._findOption(i.short),n=i.long&&e._findOption(i.long);r||n?i.long&&!n?t.push(e.createOption(i.long,i.description)):i.short&&!r&&t.push(e.createOption(i.short,i.description)):t.push(i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let e=i.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return(e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(e=>e.description))?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(e=>r(e)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,i)=>Math.max(e,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,i)=>Math.max(e,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,i)=>Math.max(e,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,i)=>Math.max(e,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let t=e.parent;t;t=t.parent)i=t.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0)?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),r=t.helpWidth||80;function n(e,n){if(n){let s=`${e.padEnd(i+2)}${n}`;return t.wrap(s,r-2,i+2)}return e}function s(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let o=[`Usage: ${t.commandUsage(e)}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.wrap(a,r,0),""]));let l=t.visibleArguments(e).map(e=>n(t.argumentTerm(e),t.argumentDescription(e)));l.length>0&&(o=o.concat(["Arguments:",s(l),""]));let h=t.visibleOptions(e).map(e=>n(t.optionTerm(e),t.optionDescription(e)));if(h.length>0&&(o=o.concat(["Options:",s(h),""])),this.showGlobalOptions){let i=t.visibleGlobalOptions(e).map(e=>n(t.optionTerm(e),t.optionDescription(e)));i.length>0&&(o=o.concat(["Global Options:",s(i),""]))}let u=t.visibleCommands(e).map(e=>n(t.subcommandTerm(e),t.subcommandDescription(e)));return u.length>0&&(o=o.concat(["Commands:",s(u),""])),o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,r=40){let n=RegExp(`[\\n][ \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]+`);if(e.match(n))return e;let s=t-i;if(s<r)return e;let o=e.slice(0,i),a=e.slice(i).replace("\r\n","\n"),l=" ".repeat(i),h=`\\s\u200B`,u=RegExp(`
|
|
14
|
-
|.{1,${s-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g");return o+(a.match(u)||[]).map((e,t)=>"\n"===e?"":(t>0?l:"")+e.trimEnd()).join("\n")}}},533:function(e,t,i){let{InvalidArgumentError:r}=i(649);t.Option=class e{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=function(e){let t,i;let r=e.split(/[ |,]+/);return r.length>1&&!/^[[<]/.test(r[1])&&(t=r.shift()),i=r.shift(),!t&&/^-[^-]$/.test(i)&&(t=i,i=void 0),{shortFlag:t,longFlag:i}}(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return"string"==typeof e&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new r(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return function(e){return e.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},t.DualOptions=class e{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let r=this.negativeOptions.get(i).presetArg;return t.negate===((void 0!==r&&r)===e)}}},109:function(e,t){t.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));let i=e.startsWith("--");i&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let r=[],n=3;return(t.forEach(t=>{if(t.length<=1)return;let i=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let i=[];for(let t=0;t<=e.length;t++)i[t]=[t];for(let e=0;e<=t.length;e++)i[0][e]=e;for(let r=1;r<=t.length;r++)for(let n=1;n<=e.length;n++){let s=1;s=e[n-1]===t[r-1]?0:1,i[n][r]=Math.min(i[n-1][r]+1,i[n][r-1]+1,i[n-1][r-1]+s),n>1&&r>1&&e[n-1]===t[r-2]&&e[n-2]===t[r-1]&&(i[n][r]=Math.min(i[n][r],i[n-2][r-2]+1))}return i[e.length][t.length]}(e,t),s=Math.max(e.length,t.length);(s-i)/s>.4&&(i<n?(n=i,r=[t]):i===n&&r.push(t))}),r.sort((e,t)=>e.localeCompare(t)),i&&(r=r.map(e=>`--${e}`)),r.length>1)?`
|
|
15
|
-
(Did you mean one of ${r.join(", ")}?)`:1===r.length?`
|
|
16
|
-
(Did you mean ${r[0]}?)`:""}}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,i),s.exports}i.rv=function(){return"1.1.6"},i.ruid="bundler=rspack@1.1.6";var r={};(()=>{"use strict";var e;let t=i(673),r=i(749),n=i(421),s=i(147);function o(e,t){(0,s.writeFileSync)(t,JSON.stringify({description:`This is a programmatically created file via ${process.argv.join(" ")}`,packages:e},null,4))}t.program.addOption(new t.Option("-p, --pkgManager <pkgManager>","The package manager that you are running under - will be used to resolve modules").choices(["yarnv2+"]).makeOptionMandatory()).addOption(new t.Option("-o, --output <output>","How to output the package info").choices(["json","console","none"]).default("console","writes each package to the a line")).option("--cwd <cwd>").option("-r, --recurse","get all dependencies and not just direct ones",!1).option("-f, --file <file>","the file to output json to").option("-q, --quiet","if we should not output any values",!1),(async function e(e){let t;let{pkgManager:i,cwd:s=process.cwd(),recurse:a,output:l,file:h,quiet:u}=e;if("yarnv2+"===i)t=await (0,n.getYarnInfoPackageGraph)(s,a);else throw Error("Unimplemented package manager GetPackagesGraphFn mapping!");t.validate();let c=(await (0,r.getESMPackages)(t)).sort();if(!u)switch(l){case"json":console.log(JSON.stringify(c));break;case"console":console.log(c.join("\n"))}h&&o(c,h)})(t.program.parse(process.argv).opts()).then(()=>{process.exit()}).catch(e=>{console.error(e),process.exit(5)})})()})();
|
|
17
|
-
//# sourceMappingURL=get-esm-packages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-esm-packages.js","sources":["webpack:///../node_modules/path-root-regex/index.js","webpack:///../node_modules/path-root/index.js","webpack:///../node_modules/resolve-package-path/lib/cache-group.js","webpack:///../node_modules/resolve-package-path/lib/cache.js","webpack:///../node_modules/resolve-package-path/lib/index.js","webpack:///../node_modules/resolve-package-path/lib/resolve-package-path.js","webpack:///../node_modules/resolve-package-path/lib/rethrow-unless-code.js","webpack:///../node_modules/resolve-package-path/lib/should-preserve-symlinks.js","webpack:///./operations/getESMPackages.ts","webpack:///./operations/index.ts","webpack:///./operations/jest.ts","webpack:///./packageGraphs/Graph.ts","webpack:///./packageGraphs/PackageGraph.ts","webpack:///./packageGraphs/getYarnInfoPackageGraph.ts","webpack:///./packageGraphs/index.ts","webpack:///../node_modules/commander/index.js","webpack:///../node_modules/commander/lib/argument.js","webpack:///../node_modules/commander/lib/command.js","webpack:///../node_modules/commander/lib/error.js","webpack:///../node_modules/commander/lib/help.js","webpack:///../node_modules/commander/lib/option.js","webpack:///../node_modules/commander/lib/suggestSimilar.js","webpack:///./bin/get-esm-packages.ts"],"sourcesContent":["/*!\n * path-root-regex <https://github.com/jonschlinkert/path-root-regex>\n *\n * Copyright (c) 2016, Jon Schlinkert.\n * Licensed under the MIT License.\n */\n\n'use strict';\n\nmodule.exports = function() {\n // Regex is modified from the split device regex in the node.js path module.\n return /^([a-zA-Z]:|[\\\\\\/]{2}[^\\\\\\/]+[\\\\\\/]+[^\\\\\\/]+)?([\\\\\\/])?/;\n};\n","/*!\n * path-root <https://github.com/jonschlinkert/path-root>\n *\n * Copyright (c) 2016, Jon Schlinkert.\n * Licensed under the MIT License.\n */\n\n'use strict';\n\nvar pathRootRegex = require('path-root-regex');\n\nmodule.exports = function(filepath) {\n if (typeof filepath !== 'string') {\n throw new TypeError('expected a string');\n }\n\n var match = pathRootRegex().exec(filepath);\n if (match) {\n return match[0];\n }\n};\n","'use strict';\nconst Cache = require(\"./cache\");\nmodule.exports = class CacheGroup {\n constructor() {\n this.MODULE_ENTRY = new Cache();\n this.PATH = new Cache();\n this.REAL_FILE_PATH = new Cache();\n this.REAL_DIRECTORY_PATH = new Cache();\n Object.freeze(this);\n }\n};\n//# sourceMappingURL=cache-group.js.map","'use strict';\nfunction makeCache() {\n // object with no prototype\n const cache = Object.create(null);\n // force the jit to immediately realize this object is a dictionary. This\n // should prevent the JIT from going wastefully one direction (fast mode)\n // then going another (dict mode) after\n cache['_cache'] = 1;\n delete cache['_cache'];\n return cache;\n}\nmodule.exports = class Cache {\n constructor() {\n this._store = makeCache();\n }\n set(key, value) {\n return (this._store[key] = value);\n }\n get(key) {\n return this._store[key];\n }\n has(key) {\n return key in this._store;\n }\n delete(key) {\n delete this._store[key];\n }\n get size() {\n return Object.keys(this._store).length;\n }\n};\n//# sourceMappingURL=cache.js.map","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst path_1 = __importDefault(require(\"path\"));\nconst resolve_package_path_1 = __importDefault(require(\"./resolve-package-path\"));\nconst rethrow_unless_code_1 = __importDefault(require(\"./rethrow-unless-code\"));\nconst ALLOWED_ERROR_CODES = [\n // resolve package error codes\n 'MODULE_NOT_FOUND',\n // Yarn PnP Error Codes\n 'UNDECLARED_DEPENDENCY',\n 'MISSING_PEER_DEPENDENCY',\n 'MISSING_DEPENDENCY'\n];\nconst CacheGroup = require(\"./cache-group\");\nconst Cache = require(\"./cache\");\nconst getRealFilePath = resolve_package_path_1.default._getRealFilePath;\nconst getRealDirectoryPath = resolve_package_path_1.default._getRealDirectoryPath;\nconst __findUpPackagePath = resolve_package_path_1.default._findUpPackagePath;\nlet CACHE = new CacheGroup();\nlet FIND_UP_CACHE = new Cache();\nlet pnp;\ntry {\n // eslint-disable-next-line node/no-missing-require\n pnp = require('pnpapi');\n}\ncatch (error) {\n // not in Yarn PnP; not a problem\n}\n/**\n * Search each directory in the absolute path `baseDir`, from leaf to root, for\n * a `package.json`, and return the first match, or `null` if no `package.json`\n * was found.\n *\n * @public\n * @param {string} baseDir - an absolute path in which to search for a `package.json`\n * @param {CacheGroup|boolean} [_cache] (optional)\n * * if true: will choose the default global cache\n * * if false: will not cache\n * * if undefined or omitted, will choose the default global cache\n * * otherwise we assume the argument is an external cache of the form provided by resolve-package-path/lib/cache-group.js\n *\n * @return {string|null} a full path to the resolved package.json if found or null if not\n */\nfunction _findUpPackagePath(baseDir, _cache) {\n let cache;\n if (_cache === undefined || _cache === null || _cache === true) {\n // if no cache specified, or if cache is true then use the global cache\n cache = FIND_UP_CACHE;\n }\n else if (_cache === false) {\n // if cache is explicity false, create a throw-away cache;\n cache = new Cache();\n }\n else {\n // otherwise, assume the user has provided an alternative cache for the following form:\n // provided by resolve-package-path/lib/cache-group.js\n cache = _cache;\n }\n let absoluteStart = path_1.default.resolve(baseDir);\n return __findUpPackagePath(cache, absoluteStart);\n}\nfunction resolvePackagePath(target, baseDir, _cache) {\n let cache;\n if (_cache === undefined || _cache === null || _cache === true) {\n // if no cache specified, or if cache is true then use the global cache\n cache = CACHE;\n }\n else if (_cache === false) {\n // if cache is explicity false, create a throw-away cache;\n cache = new CacheGroup();\n }\n else {\n // otherwise, assume the user has provided an alternative cache for the following form:\n // provided by resolve-package-path/lib/cache-group.js\n cache = _cache;\n }\n if (baseDir.charAt(baseDir.length - 1) !== path_1.default.sep) {\n baseDir = `${baseDir}${path_1.default.sep}`;\n }\n const key = target + '\\x00' + baseDir;\n let pkgPath;\n if (cache.PATH.has(key)) {\n pkgPath = cache.PATH.get(key);\n }\n else {\n try {\n // the custom `pnp` code here can be removed when yarn 1.13 is the\n // current release. This is due to Yarn 1.13 and resolve interoperating\n // together seamlessly.\n pkgPath = pnp\n ? pnp.resolveToUnqualified(target + '/package.json', baseDir)\n : (0, resolve_package_path_1.default)(cache, target, baseDir);\n }\n catch (e) {\n (0, rethrow_unless_code_1.default)(e, ...ALLOWED_ERROR_CODES);\n pkgPath = null;\n }\n cache.PATH.set(key, pkgPath);\n }\n return pkgPath;\n}\nresolvePackagePath._resetCache = function () {\n CACHE = new CacheGroup();\n FIND_UP_CACHE = new Cache();\n};\n// eslint-disable-next-line no-redeclare\n(function (resolvePackagePath) {\n resolvePackagePath._FIND_UP_CACHE = FIND_UP_CACHE;\n resolvePackagePath.findUpPackagePath = _findUpPackagePath;\n})(resolvePackagePath || (resolvePackagePath = {}));\nObject.defineProperty(resolvePackagePath, '_CACHE', {\n get: function () {\n return CACHE;\n },\n});\nObject.defineProperty(resolvePackagePath, '_FIND_UP_CACHE', {\n get: function () {\n return FIND_UP_CACHE;\n },\n});\nresolvePackagePath.getRealFilePath = function (filePath) {\n return getRealFilePath(CACHE.REAL_FILE_PATH, filePath);\n};\nresolvePackagePath.getRealDirectoryPath = function (directoryPath) {\n return getRealDirectoryPath(CACHE.REAL_DIRECTORY_PATH, directoryPath);\n};\nmodule.exports = resolvePackagePath;\n//# sourceMappingURL=index.js.map","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\n// credit goes to https://github.com/davecombs\n// extracted in part from: https://github.com/stefanpenner/hash-for-dep/blob/15b2ebcf22024ceb2eb7907f8c412ae40f87b15e/lib/resolve-package-path.js#L1\n//\nconst fs = require(\"fs\");\nconst path = require(\"path\");\nconst pathRoot = require(\"path-root\");\nconst rethrow_unless_code_1 = __importDefault(require(\"./rethrow-unless-code\"));\n/*\n * Define a regex that will match against the 'name' value passed into\n * resolvePackagePath. The regex corresponds to the following test:\n * Match any of the following 3 alternatives:\n *\n * 1) dot, then optional second dot, then / or nothing i.e. . ./ .. ../ OR\n * 2) / i.e. / OR\n * 3) (A-Za-z colon - [optional]), then / or \\ i.e. optional drive letter + colon, then / or \\\n *\n * Basically, the three choices mean \"explicitly relative or absolute path, on either\n * Unix/Linux or Windows\"\n */\nconst ABSOLUTE_OR_RELATIVE_PATH_REGEX = /^(?:\\.\\.?(?:\\/|$)|\\/|([A-Za-z]:)?[/\\\\])/;\nconst shouldPreserveSymlinks = require(\"./should-preserve-symlinks\");\nconst PRESERVE_SYMLINKS = shouldPreserveSymlinks(process);\n/*\n * Resolve the real path for a file. Return null if does not\n * exist or is not a file or FIFO, return the real path otherwise.\n *\n * Cache the result in the passed-in cache for performance,\n * keyed on the filePath passed in.\n *\n * NOTE: Because this is a private method, it does not attempt to normalize\n * the path passed in - it assumes the caller has done that.\n *\n * @private\n * @method _getRealFilePath\n * @param {Cache} realFilePathCache the Cache object to cache the real (resolved)\n * path in, keyed by filePath. See lib/cache.js and lib/cache-group.js\n * @param {String} filePath the path to the file of interest (which must have\n * been normalized, but not necessarily resolved to a real path).\n * @return {String} real path or null\n */\nfunction _getRealFilePath(realFilePathCache, filePath) {\n if (realFilePathCache.has(filePath)) {\n return realFilePathCache.get(filePath); // could be null\n }\n let realPath = null; // null = 'FILE NOT FOUND'\n try {\n const stat = fs.statSync(filePath);\n // I don't know if Node would handle having the filePath actually\n // be a FIFO, but as the following is also part of the node-resolution\n // algorithm in resolve.sync(), we'll do the same check here.\n if (stat.isFile() || stat.isFIFO()) {\n if (PRESERVE_SYMLINKS) {\n realPath = filePath;\n }\n else {\n realPath = fs.realpathSync(filePath);\n }\n }\n }\n catch (e) {\n (0, rethrow_unless_code_1.default)(e, 'ENOENT');\n }\n realFilePathCache.set(filePath, realPath);\n return realPath;\n}\n/*\n * Resolve the real path for a directory, return null if does not\n * exist or is not a directory, return the real path otherwise.\n *\n * @param {Cache} realDirectoryPathCache the Cache object to cache the real (resolved)\n * path in, keyed by directoryPath. See lib/cache.js and lib/cache-group.js\n * @param {String} directoryPath the path to the directory of interest (which must have\n * been normalized, but not necessarily resolved to a real path).\n * @return {String} real path or null\n */\nfunction _getRealDirectoryPath(realDirectoryPathCache, directoryPath) {\n if (realDirectoryPathCache.has(directoryPath)) {\n return realDirectoryPathCache.get(directoryPath); // could be null\n }\n let realPath = null;\n try {\n const stat = fs.statSync(directoryPath);\n if (stat.isDirectory()) {\n if (PRESERVE_SYMLINKS) {\n realPath = directoryPath;\n }\n else {\n realPath = fs.realpathSync(directoryPath);\n }\n }\n }\n catch (e) {\n (0, rethrow_unless_code_1.default)(e, 'ENOENT', 'ENOTDIR');\n }\n realDirectoryPathCache.set(directoryPath, realPath);\n return realPath;\n}\n/*\n * Given a package 'name' and starting directory, resolve to a real (existing) file path.\n *\n * Do it similar to how it is done in resolve.sync() - travel up the directory hierarchy,\n * attaching 'node-modules' to each directory and seeing if the directory exists and\n * has the relevant 'package.json' file we're searching for. It is *much* faster than\n * resolve.sync(), because we don't test that the requested name is a directory.\n * This routine assumes that it is only called when we don't already have\n * the cached entry.\n *\n * NOTE: it is valid for 'name' to be an absolute or relative path.\n * Because this is an internal routine, we'll require that 'dir' be non-empty\n * if this is called, to make things simpler (see resolvePackagePath).\n *\n * @param realFilePathCache the cache containing the real paths corresponding to\n * various file and directory paths (which may or may not be already resolved).\n *\n * @param name the 'name' of the module, i.e. x in require(x), but with\n * '/package.json' on the end. It is NOT referring to a directory (so we don't\n * have to do the directory checks that resolve.sync does).\n * NOTE: because this is an internal routine, for speed it does not check\n * that '/package.json' is actually the end of the name.\n *\n * @param dir the directory (MUST BE non-empty, and valid) to start from, appending the name to the\n * directory and checking that the file exists. Go up the directory hierarchy from there.\n * if name is itself an absolute path,\n *\n * @result the path to the actual package.json file that's found, or null if not.\n */\nfunction _findPackagePath(realFilePathCache, name, dir) {\n const fsRoot = pathRoot(dir);\n let currPath = dir;\n while (currPath !== fsRoot) {\n // when testing for 'node_modules', need to allow names like NODE_MODULES,\n // which can occur with case-insensitive OSes.\n let endsWithNodeModules = path.basename(currPath).toLowerCase() === 'node_modules';\n let filePath = path.join(currPath, endsWithNodeModules ? '' : 'node_modules', name);\n let realPath = _getRealFilePath(realFilePathCache, filePath);\n if (realPath) {\n return realPath;\n }\n if (endsWithNodeModules) {\n // go up past the ending node_modules directory so the next dirname\n // goes up past that (if ending in node_modules, going up just one\n // directory below will then add 'node_modules' on the next loop and\n // re-process this same node_modules directory.\n currPath = path.dirname(currPath);\n }\n currPath = path.dirname(currPath);\n }\n return null;\n}\n/*\n * Resolve the path to the nearest `package.json` from the given initial search\n * directory.\n *\n * @param {Cache} findUpCache - a cache of memoized results that is\n * prioritized to avoid I/O.\n *\n * @param {string} initialSearchDir - the normalized path to start searching\n * from.\n *\n * @return {string | null} - the deepest directory on the path to root from\n * `initialSearchDir` that contains a {{package.json}}, or `null` if no such\n * directory exists.\n */\nfunction _findUpPackagePath(findUpCache, initialSearchDir) {\n let previous;\n let dir = initialSearchDir;\n let maybePackageJsonPath;\n let result = null;\n do {\n if (findUpCache.has(dir)) {\n result = findUpCache.get(dir);\n break;\n }\n maybePackageJsonPath = path.join(dir, 'package.json');\n if (fs.existsSync(maybePackageJsonPath)) {\n result = maybePackageJsonPath;\n break;\n }\n previous = dir;\n dir = path.dirname(dir);\n } while (dir !== previous);\n findUpCache.set(initialSearchDir, result);\n return result;\n}\n/*\n * Resolve the path to a module's package.json file, if it exists. The\n * name and dir are as in hashForDep and ModuleEntry.locate.\n *\n * @param caches an instance of CacheGroup where information will be cached\n * during processing.\n *\n * @param name the 'name' of the module. The name may also be a path,\n * either relative or absolute. The path must be to a module DIRECTORY, NOT to the\n * package.json file in the directory, as we attach 'package.json' here.\n *\n * @param dir (optional) the root directory to run the path resolution from.\n * if dir is not provided, __dirname for this module is used instead.\n *\n * @return the realPath corresponding to the module's package.json file, or null\n * if that file is not found or is not a file.\n *\n * Note: 'name' is expected in the format expected for require(x), i.e., it is\n * resolved using the Node path-normalization rules.\n */\nfunction resolvePackagePath(caches, name, dir) {\n if (typeof name !== 'string' || name.length === 0) {\n throw new TypeError(\"resolvePackagePath: 'name' must be a non-zero-length string.\");\n }\n // Perform tests similar to those in resolve.sync().\n let basedir = dir || __dirname;\n // Ensure that basedir is an absolute path at this point. If it does not refer to\n // a real directory, go up the path until a real directory is found, or return an error.\n // BUG!: this will never throw an exception, at least on Unix/Linux. If the path is\n // relative, path.resolve() will make it absolute by putting the current directory\n // before it, so it won't fail. If the path is already absolute, / will always be\n // valid, so again it won't fail.\n let absoluteStart = path.resolve(basedir);\n while (_getRealDirectoryPath(caches.REAL_DIRECTORY_PATH, absoluteStart) === null) {\n absoluteStart = path.dirname(absoluteStart);\n }\n if (!absoluteStart) {\n let error = new TypeError(\"resolvePackagePath: 'dir' or one of the parent directories in its path must refer to a valid directory.\");\n error.code = 'MODULE_NOT_FOUND';\n throw error;\n }\n if (ABSOLUTE_OR_RELATIVE_PATH_REGEX.test(name)) {\n let res = path.resolve(absoluteStart, name);\n return _getRealFilePath(caches.REAL_FILE_PATH, path.join(res, 'package.json'));\n // XXX Do we need to handle the core(x) case too? Not sure.\n }\n else {\n return _findPackagePath(caches.REAL_FILE_PATH, path.join(name, 'package.json'), absoluteStart);\n }\n}\nresolvePackagePath._findPackagePath = _findPackagePath;\nresolvePackagePath._findUpPackagePath = _findUpPackagePath;\nresolvePackagePath._getRealFilePath = _getRealFilePath;\nresolvePackagePath._getRealDirectoryPath = _getRealDirectoryPath;\nmodule.exports = resolvePackagePath;\n//# sourceMappingURL=resolve-package-path.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction rethrowUnlessCode(maybeError, ...codes) {\n if (maybeError !== null && typeof maybeError === 'object') {\n const code = maybeError.code;\n for (const allowed of codes) {\n if (code === allowed) {\n return;\n }\n }\n }\n throw maybeError;\n}\nexports.default = rethrowUnlessCode;\n//# sourceMappingURL=rethrow-unless-code.js.map","'use strict';\nfunction includes(array, entry) {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === entry) {\n return true;\n }\n }\n return false;\n}\nmodule.exports = function (process) {\n return !!process.env.NODE_PRESERVE_SYMLINKS || includes(process.execArgv, '--preserve-symlinks');\n};\n//# sourceMappingURL=should-preserve-symlinks.js.map","import { readFile } from \"fs/promises\";\nimport resolvePackagePath from \"resolve-package-path\";\nimport {\n\tPackageGraph,\n\tPackageInfo,\n\tNode,\n\tPackageInfoKey,\n} from \"../packageGraphs\";\nimport { join } from \"path\";\n\nfunction resolvePkgPath(\n\tpkgDir: string,\n\tpkgName: string,\n\toptions: {\n\t\toptionalDepsFromParent?: {\n\t\t\t[dep: string]: string;\n\t\t};\n\t\t// If this was a patch, we probably can't find a package.json (or at least, I didn't solve this)\n\t\tisPatch: boolean;\n\t\tisRoot: boolean;\n\t},\n) {\n\tconst { optionalDepsFromParent, isPatch, isRoot } = options;\n\tconst path = resolvePackagePath(pkgName, pkgDir);\n\tif (!path && !optionalDepsFromParent?.[pkgName] && !isPatch) {\n\t\tif (isRoot) {\n\t\t\t// Accounts for an unresolvable root project since we're in it\n\t\t\treturn join(pkgDir, \"package.json\");\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Non-optional dependency could not be found: ${pkgName} when looking from ${pkgDir}`,\n\t\t);\n\t}\n\treturn path;\n}\n// options: {\n// /**\n// * Depending on the integrity of your packages, you may get failures due to some packages saying\n// */\n// ignorePackages: string[]\n// }\ninterface VisitReturn {\n\t/**\n\t * The resolved path of the package.json that's requesting this. This is specifically for multi-version resolutions\n\t */\n\tparentPkgPath?: string;\n\toptionalDependencies?: {\n\t\t[dep: string]: string;\n\t};\n}\n\ninterface PkgInfo {\n\tpackageJsonPath: string;\n\tisModule: boolean;\n}\n\n/**\n * Returns the esm packages from a PackageGraph - Assumes we can read package.json (may not work with yarn plug'n'play)\n * @param pkgGraph\n * @returns\n */\nexport async function getESMPackages(pkgGraph: PackageGraph) {\n\tconst packagePathsMap: {\n\t\t// Since packages can be multiply referenced via nested modules, we can have multiple of these\n\t\t[pkgName: string]: PkgInfo[];\n\t} = {};\n\t// We need to resolve the packageJsons and are fine with optional dependencies missing since we can't tell if we need them\n\tasync function resolvePackageJsons(\n\t\tcurrentNode: Node<PackageInfo, PackageInfoKey>,\n\t\tpreviousOptions?: VisitReturn,\n\t): Promise<[VisitReturn, boolean]> {\n\t\t// Look up the package.json\n\t\tconst jsonPath = resolvePkgPath(\n\t\t\tpreviousOptions?.parentPkgPath ?? pkgGraph.pkgDir,\n\t\t\tcurrentNode.value.name,\n\t\t\t{\n\t\t\t\toptionalDepsFromParent: previousOptions?.optionalDependencies,\n\t\t\t\tisPatch: currentNode.value.isPatch,\n\t\t\t\tisRoot: currentNode.value.isRoot,\n\t\t\t},\n\t\t);\n\t\t// If we didn't throw any resolution errors, then we can assume this was optional - we shouldn't resolve down that path\n\t\tif (!jsonPath) {\n\t\t\treturn [{}, true];\n\t\t}\n\t\tlet pkgInfos: PkgInfo[] | undefined =\n\t\t\tpackagePathsMap[currentNode.value.name];\n\t\tif (pkgInfos) {\n\t\t\tif (pkgInfos.some((info) => info.packageJsonPath === jsonPath)) {\n\t\t\t\treturn [{}, false];\n\t\t\t}\n\t\t} else {\n\t\t\tpkgInfos = [] as PkgInfo[];\n\t\t\tpackagePathsMap[currentNode.value.name] = pkgInfos;\n\t\t}\n\n\t\tconst contents = await readFile(jsonPath);\n\t\tconst json = JSON.parse(contents.toString());\n\t\tpkgInfos.push({\n\t\t\tpackageJsonPath: jsonPath,\n\t\t\tisModule: json.type === \"module\",\n\t\t});\n\t\treturn [\n\t\t\t{\n\t\t\t\toptionalDependencies: json.optionalDependencies,\n\t\t\t\tparentPkgPath: jsonPath,\n\t\t\t},\n\t\t\tfalse,\n\t\t];\n\t}\n\n\t// Iterate the packages and resolve all non-optional packages and existing optionals\n\tawait pkgGraph.topDownVisitAsync(resolvePackageJsons);\n\n\treturn Array.from(\n\t\tObject.keys(packagePathsMap).reduce((mods, p) => {\n\t\t\tconst infos = packagePathsMap[p];\n\t\t\tinfos.forEach((info) => {\n\t\t\t\tif (info.isModule) {\n\t\t\t\t\tmods.add(p);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn mods;\n\t\t}, new Set<string>()),\n\t);\n}\n","export * from \"./getESMPackages\";\nexport * from \"./jest\";\n","import { readFileSync } from \"fs\";\n\nexport interface EsmPackagesFile {\n\tdescription: string;\n\t/**\n\t * Package names that are esm modules\n\t */\n\tpackages: string[];\n}\n\n/**\n * You can use this function to get get a transformIgnore pattern for jest that excludes node_modules\n * from a file where we have written all esm files that were detected.\n *\n * This is specifically designed for a \"post-install\" script that scans on install and overwrites the file\n * if there are new esm module types - thereby reducing the cost of tests to just a file read instead of a\n * tree scan.\n *\n * @param options\n * @returns\n */\nexport function getJestNodeModulesTransformIgnore(options: {\n\t/**\n\t * The file location where we have written the esm module info to\n\t *\n\t * default (esm-modules.json)\n\t */\n\tfile: string;\n\t/**\n\t * Extra packages for an exception for node modules\n\t */\n\textraExceptions?: string[];\n}) {\n\tconst { file, extraExceptions = [] } = options;\n\tconst modules = getModulesFromFile(file);\n\t// Dedup\n\tconst modSet = new Set<string>([...modules, ...extraExceptions]);\n\treturn createNodeModulesTransformIgnore(Array.from(modSet));\n}\n\nfunction getModulesFromFile(file: string) {\n\ttry {\n\t\tconst esmModules = JSON.parse(\n\t\t\treadFileSync(file).toString(),\n\t\t) as EsmPackagesFile;\n\t\tif (!esmModules.packages || !Array.isArray(esmModules.packages)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Esm packages file object is missing the expected packages field!\",\n\t\t\t);\n\t\t}\n\t\treturn esmModules.packages;\n\t} catch (err) {\n\t\tconsole.error(`Malformed esm modules file: ${file}`);\n\t\tthrow err;\n\t}\n}\n\n/**\n * Given a set of package names, this constructs a node_modules ignore string that exempts the\n * targeted modules from jest transform.\n *\n * It should be used with the transformIgnore configuration.\n * @param packageExceptions\n * @returns\n */\nexport function createNodeModulesTransformIgnore(packageExceptions: string[]) {\n\treturn `node_modules/(?!${packageExceptions.map((p) => `${p}/`).join(\"|\")})`;\n}\n","// TODO: it would be nice to split this into a package for reuse\n\n/**\n * Describes a node in a graph that has a value of a specific type\n * and then points to values of others nodes\n */\nexport interface Node<T, NodeKey> {\n\tself: NodeKey;\n\tfrom: NodeKey[];\n\tto: NodeKey[];\n\tvalue: T;\n}\n\n/**\n * A node that we only know where it goes to at the moment\n */\nexport interface DownstreamNode<T, NodeKey> {\n\tself: NodeKey;\n\tvalue: T;\n\tto: NodeKey[];\n}\n\n/**\n * If using a compound node key, then we require a node key serializer to get a base string out of it\n */\ntype NodeKeySerializer<T> = T extends string ? undefined : (t: T) => string;\n\n/**\n * Mnimal \"graph\" class that takes in a bunch of nodes and then allows you to visit them in a particular order.\n *\n * The value of the node <T> is used as the unique node key for referencing other nodes.\n */\nexport class Graph<\n\tT,\n\tNodeKey,\n\tNKSerializer extends NodeKeySerializer<NodeKey> = NodeKeySerializer<NodeKey>,\n> {\n\t// This map is partially filled so we allow undefined values internally\n\treadonly map = new Map<string, Node<T | undefined, NodeKey>>();\n\tprivate readonly noFrom = new Set<string>();\n\treadonly keySerializer: NKSerializer;\n\n\t/**\n\t *\n\t * @param keySerializer - if the graph has a compound key, then you must supply a function that converts a compound key to a string\n\t */\n\tconstructor(keySerializer: NKSerializer) {\n\t\tthis.keySerializer = keySerializer;\n\t}\n\n\tprivate getNodeKeyStr(nodeKey: NodeKey): string {\n\t\treturn this.keySerializer\n\t\t\t? this.keySerializer(nodeKey)\n\t\t\t: (nodeKey as string);\n\t}\n\n\taddDownstreamNode(node: DownstreamNode<T, NodeKey>) {\n\t\tconst nodeKeyStr = this.getNodeKeyStr(node.self);\n\n\t\t// If a previous node prestubbed in the next node, we add it here\n\t\tif (this.map.has(nodeKeyStr)) {\n\t\t\tconst preStubbedNode = this.map.get(nodeKeyStr)!;\n\t\t\tif (preStubbedNode.value !== undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Already added a downstream node of same key: ${nodeKeyStr} - Can't add ${JSON.stringify(node)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tpreStubbedNode.to.push(...node.to);\n\t\t\tpreStubbedNode.value = node.value;\n\t\t} else {\n\t\t\tthis.map.set(nodeKeyStr, {\n\t\t\t\tfrom: [],\n\t\t\t\t...node,\n\t\t\t});\n\t\t\tthis.noFrom.add(nodeKeyStr);\n\t\t}\n\n\t\t// Add to or pre-stub some nodes\n\t\tnode.to.forEach((n) => {\n\t\t\tconst nkStr = this.getNodeKeyStr(n);\n\t\t\tif (this.map.has(nkStr)) {\n\t\t\t\tconst existingNode = this.map.get(nkStr)!;\n\t\t\t\texistingNode.from.push(node.self);\n\t\t\t\tif (existingNode.from.length === 1) {\n\t\t\t\t\t// We were wrong about this package\n\t\t\t\t\tthis.noFrom.delete(nkStr);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.map.set(nkStr, {\n\t\t\t\t\tself: n,\n\t\t\t\t\tfrom: [node.self],\n\t\t\t\t\tto: [],\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t} as Node<T | undefined, NodeKey>);\n\t\t\t}\n\t\t});\n\t}\n\n\tvalidate() {\n\t\tconst errors = [];\n\t\tfor (let [k, node] of this.map.entries()) {\n\t\t\tif (!node.value) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`Unregistered node: ${k}! Node was pointed to by: ${JSON.stringify(node.from)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (errors.length > 0) {\n\t\t\tthrow new Error(errors.join(\"\\n\"));\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param visit\n\t * @param firstArrivalOnly - if set to true, we are saying that we do not care about from where we get to the node, just the first arrival matters\n\t * This will depend on your visit function, since the visit function can pass parent -> child info that may change based on the node\n\t * it is coming from\n\t */\n\tasync topDownVisitAsync<R>(\n\t\tvisit: VisitFunction<Node<T, NodeKey>, R>,\n\t\tfirstArrivalOnly?: boolean,\n\t) {\n\t\tconst guestBook = firstArrivalOnly ? new Set<string>() : undefined;\n\t\tfor (const noFrom of this.noFrom) {\n\t\t\tconst node = this.map.get(noFrom)!;\n\t\t\tawait this.visitDownNodeAsync(node as Node<T, NodeKey>, visit, guestBook);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param nodeKey - the key that we used to retrieve this node\n\t * @param node - the node itself\n\t * @param visit - the visit function\n\t * @param guestBook - This is used to track if we have already visited the node - note this means we don't expect the visit function to change results\n\t * regardless of the node that we come from\n\t * @param prevResult - the result of the last node that got here\n\t * @returns\n\t */\n\tasync visitDownNodeAsync<R>(\n\t\tnode: Node<T, NodeKey>,\n\t\tvisit: VisitFunction<Node<T, NodeKey>, R>,\n\t\tguestBook?: Set<string>,\n\t\tprevResult?: R,\n\t) {\n\t\tif (guestBook?.has(this.getNodeKeyStr(node.self))) {\n\t\t\t// We already visited this node\n\t\t\treturn;\n\t\t}\n\t\tconst [result, stop] = await visit(node, prevResult);\n\t\tif (stop) {\n\t\t\t// We let the visitor control travel\n\t\t\treturn;\n\t\t}\n\t\tawait Promise.all(\n\t\t\tnode.to.map((n) => {\n\t\t\t\treturn this.visitDownNodeAsync(\n\t\t\t\t\tthis.map.get(this.getNodeKeyStr(n))! as Node<T, NodeKey>,\n\t\t\t\t\tvisit,\n\t\t\t\t\tguestBook,\n\t\t\t\t\tresult,\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t}\n}\n\ntype StopVisiting = boolean;\n\n/**\n * This function will be called for each visit while traversing along the \"to\" nodes. You can return\n * a result from the visit function that will be provided to any of the \"to\" visitors as the previous result.\n *\n * Additionally, if you return a boolean value in the second tuple, it can stop any further downstream visits from this\n * particular visitor function. (Keep in mind that a visitor can only stop further travel from itself, so if there are\n * multiple visits from multiple nodes each visitor will need to stop further travel. If you do use a guestbook, in a\n * visiting function, that would stop travel fromm the visitor function that first calls stop.)\n */\ntype VisitFunction<Node, R> = (\n\tcurrentNode: Node,\n\tpreviousResult?: R,\n) => Promise<[R, StopVisiting]>;\n","import { resolve } from \"path\";\nimport { Graph } from \"./Graph\";\n\nexport interface PackageInfo {\n\tname: string;\n\tversion: string;\n\t// We need this because some patches will register as dependencies but won't be able to resolve things\n\tisPatch: boolean;\n\t// We need this because some trees will contain the base package which won't self-resolve\n\tisRoot: boolean;\n}\n\nexport interface PackageInfoKey {\n\tname: string;\n\tversion: string;\n}\n\n/**\n * A graph of package names and their dependencies\n */\nexport class PackageGraph extends Graph<PackageInfo, PackageInfoKey> {\n\treadonly pkgDir: string;\n\tconstructor(pkgDir: string) {\n\t\tsuper((node: PackageInfoKey) => `${node.name}@${node.version}`);\n\n\t\tif (!pkgDir) {\n\t\t\tthrow new Error(\"Must supply a pkgDir!\");\n\t\t}\n\t\tthis.pkgDir = resolve(pkgDir);\n\t}\n}\n","import { execSync } from \"child_process\";\nimport { PackageGraph, PackageInfoKey } from \"./PackageGraph\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\n\n/**\n * Gets the first package.json that can be found\n */\nfunction getRootPackageJson(start: string, curDir?: string) {\n\tconst dir = curDir ?? start;\n\tconst testPath = join(dir, \"package.json\");\n\tif (existsSync(testPath)) {\n\t\treturn testPath;\n\t}\n\tconst oneUp = dirname(dir);\n\n\tif (!oneUp) {\n\t\tthrow new Error(\n\t\t\t`Could not find package.json traveling up from start dir at ${start}`,\n\t\t);\n\t}\n\treturn getRootPackageJson(start, oneUp);\n}\n\n/**\n * Retrieves the dependencies for a package in a PackageGraph\n * @param pkgDir - the directory where the top-level package is\n * @param recurse - get all the packages through all immediate dependencies\n * @returns\n */\nexport async function getYarnInfoPackageGraph(\n\tpkgDir: string,\n\trecurse: boolean,\n): Promise<PackageGraph> {\n\tconst query = execSync(`yarn info ${recurse ? \"-R\" : \"\"} --json`, {\n\t\tcwd: pkgDir,\n\t\tstdio: \"pipe\",\n\t});\n\n\t// Get the current package name so we can determine the root\n\tconst rootPkgJsonPath = getRootPackageJson(pkgDir);\n\tlet rootPkgName = \"\";\n\ttry {\n\t\trootPkgName = JSON.parse(readFileSync(rootPkgJsonPath).toString()).name;\n\t} catch (e) {\n\t\tconsole.error(\"Error retrieving root package name!\");\n\t\tthrow e;\n\t}\n\n\tconst packageGraph = new PackageGraph(pkgDir);\n\t// Since the info shows multiple versions we keep a dedup set of the serialized key to avoid longer times\n\tconst dedupSet = new Set<string>();\n\n\treturn query\n\t\t.toString()\n\t\t.split(\"\\n\")\n\t\t.reduce((pkgGraph, q) => {\n\t\t\t// Make sure we have an actual value\n\t\t\tif (q.trim()) {\n\t\t\t\tconst pkgInfo = JSON.parse(q) as YamlInfoDeps;\n\t\t\t\tconst { name, version, isPatch } = parsePackage(pkgInfo.value);\n\t\t\t\tconst nameKey = packageGraph.keySerializer({\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t});\n\t\t\t\tif (!dedupSet.has(nameKey)) {\n\t\t\t\t\tdedupSet.add(nameKey);\n\t\t\t\t\t// List of package names as dependencies\n\t\t\t\t\tlet deps: PackageInfoKey[];\n\t\t\t\t\tif (recurse) {\n\t\t\t\t\t\tdeps =\n\t\t\t\t\t\t\tpkgInfo.children?.Dependencies?.map((deps) => {\n\t\t\t\t\t\t\t\tconst info = parsePackage(deps.locator);\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tname: info.name,\n\t\t\t\t\t\t\t\t\tversion: info.version,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}) ?? [];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We don't actually set up the dependencies because that would make the graph incomplete\n\t\t\t\t\t\tdeps = [];\n\t\t\t\t\t}\n\t\t\t\t\tpackageGraph.addDownstreamNode({\n\t\t\t\t\t\tself: {\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\tisPatch,\n\t\t\t\t\t\t\tisRoot: name === rootPkgName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tto: deps ?? [],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn pkgGraph;\n\t\t}, packageGraph);\n}\n\nfunction parsePackage(pkgAndVersion: string): {\n\tname: string;\n\tversion: string;\n\tisPatch: boolean;\n} {\n\tconst versionIdx = pkgAndVersion.indexOf(\"@\", 1);\n\tif (versionIdx < 0) {\n\t\tthrow new Error(`could not find version from name: ${pkgAndVersion}`);\n\t}\n\tlet version = pkgAndVersion.substring(versionIdx + 1);\n\t// Parse out virtual versions since those are just file directors used by yarn\n\tif (version.startsWith(\"virtual:\")) {\n\t\tconst hashIdx = version.lastIndexOf(\"#\");\n\t\tif (hashIdx < 1) {\n\t\t\tthrow new Error(\n\t\t\t\t`could not find the expected # for virtual locator information`,\n\t\t\t);\n\t\t}\n\t\tversion = version.substring(hashIdx + 1);\n\t}\n\treturn {\n\t\tname: pkgAndVersion.substring(0, versionIdx),\n\t\tversion,\n\t\tisPatch: version.includes(\"patch\"),\n\t};\n}\n\ninterface YamlInfoDeps {\n\tvalue: string;\n\tchildren?: {\n\t\tInstances: number;\n\t\tVersion: string;\n\t\tDependencies?: {\n\t\t\tdescriptor: string;\n\t\t\tlocator: string;\n\t\t}[];\n\t};\n}\n","export * from \"./types\";\nexport * from \"./Graph\";\nexport * from \"./PackageGraph\";\nexport * from \"./getYarnInfoPackageGraph\";\n","const { Argument } = require('./lib/argument.js');\nconst { Command } = require('./lib/command.js');\nconst { CommanderError, InvalidArgumentError } = require('./lib/error.js');\nconst { Help } = require('./lib/help.js');\nconst { Option } = require('./lib/option.js');\n\nexports.program = new Command();\n\nexports.createCommand = (name) => new Command(name);\nexports.createOption = (flags, description) => new Option(flags, description);\nexports.createArgument = (name, description) => new Argument(name, description);\n\n/**\n * Expose classes\n */\n\nexports.Command = Command;\nexports.Option = Option;\nexports.Argument = Argument;\nexports.Help = Help;\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\nexports.InvalidOptionArgumentError = InvalidArgumentError; // Deprecated\n","const { InvalidArgumentError } = require('./error.js');\n\nclass Argument {\n /**\n * Initialize a new command argument with the given name and description.\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @param {string} name\n * @param {string} [description]\n */\n\n constructor(name, description) {\n this.description = description || '';\n this.variadic = false;\n this.parseArg = undefined;\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.argChoices = undefined;\n\n switch (name[0]) {\n case '<': // e.g. <required>\n this.required = true;\n this._name = name.slice(1, -1);\n break;\n case '[': // e.g. [optional]\n this.required = false;\n this._name = name.slice(1, -1);\n break;\n default:\n this.required = true;\n this._name = name;\n break;\n }\n\n if (this._name.length > 3 && this._name.slice(-3) === '...') {\n this.variadic = true;\n this._name = this._name.slice(0, -3);\n }\n }\n\n /**\n * Return argument name.\n *\n * @return {string}\n */\n\n name() {\n return this._name;\n }\n\n /**\n * @package\n */\n\n _concatValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n return previous.concat(value);\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Argument}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI command arguments into argument values.\n *\n * @param {Function} [fn]\n * @return {Argument}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Only allow argument value to be one of choices.\n *\n * @param {string[]} values\n * @return {Argument}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._concatValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Make argument required.\n *\n * @returns {Argument}\n */\n argRequired() {\n this.required = true;\n return this;\n }\n\n /**\n * Make argument optional.\n *\n * @returns {Argument}\n */\n argOptional() {\n this.required = false;\n return this;\n }\n}\n\n/**\n * Takes an argument and returns its human readable equivalent for help usage.\n *\n * @param {Argument} arg\n * @return {string}\n * @private\n */\n\nfunction humanReadableArgName(arg) {\n const nameOutput = arg.name() + (arg.variadic === true ? '...' : '');\n\n return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';\n}\n\nexports.Argument = Argument;\nexports.humanReadableArgName = humanReadableArgName;\n","const EventEmitter = require('node:events').EventEmitter;\nconst childProcess = require('node:child_process');\nconst path = require('node:path');\nconst fs = require('node:fs');\nconst process = require('node:process');\n\nconst { Argument, humanReadableArgName } = require('./argument.js');\nconst { CommanderError } = require('./error.js');\nconst { Help } = require('./help.js');\nconst { Option, DualOptions } = require('./option.js');\nconst { suggestSimilar } = require('./suggestSimilar');\n\nclass Command extends EventEmitter {\n /**\n * Initialize a new `Command`.\n *\n * @param {string} [name]\n */\n\n constructor(name) {\n super();\n /** @type {Command[]} */\n this.commands = [];\n /** @type {Option[]} */\n this.options = [];\n this.parent = null;\n this._allowUnknownOption = false;\n this._allowExcessArguments = true;\n /** @type {Argument[]} */\n this.registeredArguments = [];\n this._args = this.registeredArguments; // deprecated old name\n /** @type {string[]} */\n this.args = []; // cli args with options removed\n this.rawArgs = [];\n this.processedArgs = []; // like .args but after custom processing and collecting variadic\n this._scriptPath = null;\n this._name = name || '';\n this._optionValues = {};\n this._optionValueSources = {}; // default, env, cli etc\n this._storeOptionsAsProperties = false;\n this._actionHandler = null;\n this._executableHandler = false;\n this._executableFile = null; // custom name for executable\n this._executableDir = null; // custom search directory for subcommands\n this._defaultCommandName = null;\n this._exitCallback = null;\n this._aliases = [];\n this._combineFlagAndOptionalValue = true;\n this._description = '';\n this._summary = '';\n this._argsDescription = undefined; // legacy\n this._enablePositionalOptions = false;\n this._passThroughOptions = false;\n this._lifeCycleHooks = {}; // a hash of arrays\n /** @type {(boolean | string)} */\n this._showHelpAfterError = false;\n this._showSuggestionAfterError = true;\n\n // see .configureOutput() for docs\n this._outputConfiguration = {\n writeOut: (str) => process.stdout.write(str),\n writeErr: (str) => process.stderr.write(str),\n getOutHelpWidth: () =>\n process.stdout.isTTY ? process.stdout.columns : undefined,\n getErrHelpWidth: () =>\n process.stderr.isTTY ? process.stderr.columns : undefined,\n outputError: (str, write) => write(str),\n };\n\n this._hidden = false;\n /** @type {(Option | null | undefined)} */\n this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled.\n this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited\n /** @type {Command} */\n this._helpCommand = undefined; // lazy initialised, inherited\n this._helpConfiguration = {};\n }\n\n /**\n * Copy settings that are useful to have in common across root command and subcommands.\n *\n * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)\n *\n * @param {Command} sourceCommand\n * @return {Command} `this` command for chaining\n */\n copyInheritedSettings(sourceCommand) {\n this._outputConfiguration = sourceCommand._outputConfiguration;\n this._helpOption = sourceCommand._helpOption;\n this._helpCommand = sourceCommand._helpCommand;\n this._helpConfiguration = sourceCommand._helpConfiguration;\n this._exitCallback = sourceCommand._exitCallback;\n this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;\n this._combineFlagAndOptionalValue =\n sourceCommand._combineFlagAndOptionalValue;\n this._allowExcessArguments = sourceCommand._allowExcessArguments;\n this._enablePositionalOptions = sourceCommand._enablePositionalOptions;\n this._showHelpAfterError = sourceCommand._showHelpAfterError;\n this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;\n\n return this;\n }\n\n /**\n * @returns {Command[]}\n * @private\n */\n\n _getCommandAndAncestors() {\n const result = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n for (let command = this; command; command = command.parent) {\n result.push(command);\n }\n return result;\n }\n\n /**\n * Define a command.\n *\n * There are two styles of command: pay attention to where to put the description.\n *\n * @example\n * // Command implemented using action handler (description is supplied separately to `.command`)\n * program\n * .command('clone <source> [destination]')\n * .description('clone a repository into a newly created directory')\n * .action((source, destination) => {\n * console.log('clone command called');\n * });\n *\n * // Command implemented using separate executable file (description is second parameter to `.command`)\n * program\n * .command('start <service>', 'start named service')\n * .command('stop [service]', 'stop named service, or all if no name supplied');\n *\n * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`\n * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)\n * @param {object} [execOpts] - configuration options (for executable)\n * @return {Command} returns new command for action handler, or `this` for executable command\n */\n\n command(nameAndArgs, actionOptsOrExecDesc, execOpts) {\n let desc = actionOptsOrExecDesc;\n let opts = execOpts;\n if (typeof desc === 'object' && desc !== null) {\n opts = desc;\n desc = null;\n }\n opts = opts || {};\n const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);\n\n const cmd = this.createCommand(name);\n if (desc) {\n cmd.description(desc);\n cmd._executableHandler = true;\n }\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden\n cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor\n if (args) cmd.arguments(args);\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd.copyInheritedSettings(this);\n\n if (desc) return this;\n return cmd;\n }\n\n /**\n * Factory routine to create a new unattached command.\n *\n * See .command() for creating an attached subcommand, which uses this routine to\n * create the command. You can override createCommand to customise subcommands.\n *\n * @param {string} [name]\n * @return {Command} new command\n */\n\n createCommand(name) {\n return new Command(name);\n }\n\n /**\n * You can customise the help with a subclass of Help by overriding createHelp,\n * or by overriding Help properties using configureHelp().\n *\n * @return {Help}\n */\n\n createHelp() {\n return Object.assign(new Help(), this.configureHelp());\n }\n\n /**\n * You can customise the help by overriding Help properties using configureHelp(),\n * or with a subclass of Help by overriding createHelp().\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureHelp(configuration) {\n if (configuration === undefined) return this._helpConfiguration;\n\n this._helpConfiguration = configuration;\n return this;\n }\n\n /**\n * The default output goes to stdout and stderr. You can customise this for special\n * applications. You can also customise the display of errors by overriding outputError.\n *\n * The configuration properties are all functions:\n *\n * // functions to change where being written, stdout and stderr\n * writeOut(str)\n * writeErr(str)\n * // matching functions to specify width for wrapping help\n * getOutHelpWidth()\n * getErrHelpWidth()\n * // functions based on what is being written out\n * outputError(str, write) // used for displaying errors, and not used for displaying help\n *\n * @param {object} [configuration] - configuration options\n * @return {(Command | object)} `this` command for chaining, or stored configuration\n */\n\n configureOutput(configuration) {\n if (configuration === undefined) return this._outputConfiguration;\n\n Object.assign(this._outputConfiguration, configuration);\n return this;\n }\n\n /**\n * Display the help or a custom message after an error occurs.\n *\n * @param {(boolean|string)} [displayHelp]\n * @return {Command} `this` command for chaining\n */\n showHelpAfterError(displayHelp = true) {\n if (typeof displayHelp !== 'string') displayHelp = !!displayHelp;\n this._showHelpAfterError = displayHelp;\n return this;\n }\n\n /**\n * Display suggestion of similar commands for unknown commands, or options for unknown options.\n *\n * @param {boolean} [displaySuggestion]\n * @return {Command} `this` command for chaining\n */\n showSuggestionAfterError(displaySuggestion = true) {\n this._showSuggestionAfterError = !!displaySuggestion;\n return this;\n }\n\n /**\n * Add a prepared subcommand.\n *\n * See .command() for creating an attached subcommand which inherits settings from its parent.\n *\n * @param {Command} cmd - new subcommand\n * @param {object} [opts] - configuration options\n * @return {Command} `this` command for chaining\n */\n\n addCommand(cmd, opts) {\n if (!cmd._name) {\n throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`);\n }\n\n opts = opts || {};\n if (opts.isDefault) this._defaultCommandName = cmd._name;\n if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation\n\n this._registerCommand(cmd);\n cmd.parent = this;\n cmd._checkForBrokenPassThrough();\n\n return this;\n }\n\n /**\n * Factory routine to create a new unattached argument.\n *\n * See .argument() for creating an attached argument, which uses this routine to\n * create the argument. You can override createArgument to return a custom argument.\n *\n * @param {string} name\n * @param {string} [description]\n * @return {Argument} new argument\n */\n\n createArgument(name, description) {\n return new Argument(name, description);\n }\n\n /**\n * Define argument syntax for command.\n *\n * The default is that the argument is required, and you can explicitly\n * indicate this with <> around the name. Put [] around the name for an optional argument.\n *\n * @example\n * program.argument('<input-file>');\n * program.argument('[output-file]');\n *\n * @param {string} name\n * @param {string} [description]\n * @param {(Function|*)} [fn] - custom argument processing function\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n argument(name, description, fn, defaultValue) {\n const argument = this.createArgument(name, description);\n if (typeof fn === 'function') {\n argument.default(defaultValue).argParser(fn);\n } else {\n argument.default(fn);\n }\n this.addArgument(argument);\n return this;\n }\n\n /**\n * Define argument syntax for command, adding multiple at once (without descriptions).\n *\n * See also .argument().\n *\n * @example\n * program.arguments('<cmd> [env]');\n *\n * @param {string} names\n * @return {Command} `this` command for chaining\n */\n\n arguments(names) {\n names\n .trim()\n .split(/ +/)\n .forEach((detail) => {\n this.argument(detail);\n });\n return this;\n }\n\n /**\n * Define argument syntax for command, adding a prepared argument.\n *\n * @param {Argument} argument\n * @return {Command} `this` command for chaining\n */\n addArgument(argument) {\n const previousArgument = this.registeredArguments.slice(-1)[0];\n if (previousArgument && previousArgument.variadic) {\n throw new Error(\n `only the last argument can be variadic '${previousArgument.name()}'`,\n );\n }\n if (\n argument.required &&\n argument.defaultValue !== undefined &&\n argument.parseArg === undefined\n ) {\n throw new Error(\n `a default value for a required argument is never used: '${argument.name()}'`,\n );\n }\n this.registeredArguments.push(argument);\n return this;\n }\n\n /**\n * Customise or override default help command. By default a help command is automatically added if your command has subcommands.\n *\n * @example\n * program.helpCommand('help [cmd]');\n * program.helpCommand('help [cmd]', 'show help');\n * program.helpCommand(false); // suppress default help command\n * program.helpCommand(true); // add help command even if no subcommands\n *\n * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added\n * @param {string} [description] - custom description\n * @return {Command} `this` command for chaining\n */\n\n helpCommand(enableOrNameAndArgs, description) {\n if (typeof enableOrNameAndArgs === 'boolean') {\n this._addImplicitHelpCommand = enableOrNameAndArgs;\n return this;\n }\n\n enableOrNameAndArgs = enableOrNameAndArgs ?? 'help [command]';\n const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/);\n const helpDescription = description ?? 'display help for command';\n\n const helpCommand = this.createCommand(helpName);\n helpCommand.helpOption(false);\n if (helpArgs) helpCommand.arguments(helpArgs);\n if (helpDescription) helpCommand.description(helpDescription);\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n\n return this;\n }\n\n /**\n * Add prepared custom help command.\n *\n * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()`\n * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only\n * @return {Command} `this` command for chaining\n */\n addHelpCommand(helpCommand, deprecatedDescription) {\n // If not passed an object, call through to helpCommand for backwards compatibility,\n // as addHelpCommand was originally used like helpCommand is now.\n if (typeof helpCommand !== 'object') {\n this.helpCommand(helpCommand, deprecatedDescription);\n return this;\n }\n\n this._addImplicitHelpCommand = true;\n this._helpCommand = helpCommand;\n return this;\n }\n\n /**\n * Lazy create help command.\n *\n * @return {(Command|null)}\n * @package\n */\n _getHelpCommand() {\n const hasImplicitHelpCommand =\n this._addImplicitHelpCommand ??\n (this.commands.length &&\n !this._actionHandler &&\n !this._findCommand('help'));\n\n if (hasImplicitHelpCommand) {\n if (this._helpCommand === undefined) {\n this.helpCommand(undefined, undefined); // use default name and description\n }\n return this._helpCommand;\n }\n return null;\n }\n\n /**\n * Add hook for life cycle event.\n *\n * @param {string} event\n * @param {Function} listener\n * @return {Command} `this` command for chaining\n */\n\n hook(event, listener) {\n const allowedValues = ['preSubcommand', 'preAction', 'postAction'];\n if (!allowedValues.includes(event)) {\n throw new Error(`Unexpected value for event passed to hook : '${event}'.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n if (this._lifeCycleHooks[event]) {\n this._lifeCycleHooks[event].push(listener);\n } else {\n this._lifeCycleHooks[event] = [listener];\n }\n return this;\n }\n\n /**\n * Register callback to use as replacement for calling process.exit.\n *\n * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing\n * @return {Command} `this` command for chaining\n */\n\n exitOverride(fn) {\n if (fn) {\n this._exitCallback = fn;\n } else {\n this._exitCallback = (err) => {\n if (err.code !== 'commander.executeSubCommandAsync') {\n throw err;\n } else {\n // Async callback from spawn events, not useful to throw.\n }\n };\n }\n return this;\n }\n\n /**\n * Call process.exit, and _exitCallback if defined.\n *\n * @param {number} exitCode exit code for using with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n * @return never\n * @private\n */\n\n _exit(exitCode, code, message) {\n if (this._exitCallback) {\n this._exitCallback(new CommanderError(exitCode, code, message));\n // Expecting this line is not reached.\n }\n process.exit(exitCode);\n }\n\n /**\n * Register callback `fn` for the command.\n *\n * @example\n * program\n * .command('serve')\n * .description('start service')\n * .action(function() {\n * // do work here\n * });\n *\n * @param {Function} fn\n * @return {Command} `this` command for chaining\n */\n\n action(fn) {\n const listener = (args) => {\n // The .action callback takes an extra parameter which is the command or options.\n const expectedArgsCount = this.registeredArguments.length;\n const actionArgs = args.slice(0, expectedArgsCount);\n if (this._storeOptionsAsProperties) {\n actionArgs[expectedArgsCount] = this; // backwards compatible \"options\"\n } else {\n actionArgs[expectedArgsCount] = this.opts();\n }\n actionArgs.push(this);\n\n return fn.apply(this, actionArgs);\n };\n this._actionHandler = listener;\n return this;\n }\n\n /**\n * Factory routine to create a new unattached option.\n *\n * See .option() for creating an attached option, which uses this routine to\n * create the option. You can override createOption to return a custom option.\n *\n * @param {string} flags\n * @param {string} [description]\n * @return {Option} new option\n */\n\n createOption(flags, description) {\n return new Option(flags, description);\n }\n\n /**\n * Wrap parseArgs to catch 'commander.invalidArgument'.\n *\n * @param {(Option | Argument)} target\n * @param {string} value\n * @param {*} previous\n * @param {string} invalidArgumentMessage\n * @private\n */\n\n _callParseArg(target, value, previous, invalidArgumentMessage) {\n try {\n return target.parseArg(value, previous);\n } catch (err) {\n if (err.code === 'commander.invalidArgument') {\n const message = `${invalidArgumentMessage} ${err.message}`;\n this.error(message, { exitCode: err.exitCode, code: err.code });\n }\n throw err;\n }\n }\n\n /**\n * Check for option flag conflicts.\n * Register option if no conflicts found, or throw on conflict.\n *\n * @param {Option} option\n * @private\n */\n\n _registerOption(option) {\n const matchingOption =\n (option.short && this._findOption(option.short)) ||\n (option.long && this._findOption(option.long));\n if (matchingOption) {\n const matchingFlag =\n option.long && this._findOption(option.long)\n ? option.long\n : option.short;\n throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'\n- already used by option '${matchingOption.flags}'`);\n }\n\n this.options.push(option);\n }\n\n /**\n * Check for command name and alias conflicts with existing commands.\n * Register command if no conflicts found, or throw on conflict.\n *\n * @param {Command} command\n * @private\n */\n\n _registerCommand(command) {\n const knownBy = (cmd) => {\n return [cmd.name()].concat(cmd.aliases());\n };\n\n const alreadyUsed = knownBy(command).find((name) =>\n this._findCommand(name),\n );\n if (alreadyUsed) {\n const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|');\n const newCmd = knownBy(command).join('|');\n throw new Error(\n `cannot add command '${newCmd}' as already have command '${existingCmd}'`,\n );\n }\n\n this.commands.push(command);\n }\n\n /**\n * Add an option.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addOption(option) {\n this._registerOption(option);\n\n const oname = option.name();\n const name = option.attributeName();\n\n // store default value\n if (option.negate) {\n // --no-foo is special and defaults foo to true, unless a --foo option is already defined\n const positiveLongFlag = option.long.replace(/^--no-/, '--');\n if (!this._findOption(positiveLongFlag)) {\n this.setOptionValueWithSource(\n name,\n option.defaultValue === undefined ? true : option.defaultValue,\n 'default',\n );\n }\n } else if (option.defaultValue !== undefined) {\n this.setOptionValueWithSource(name, option.defaultValue, 'default');\n }\n\n // handler for cli and env supplied values\n const handleOptionValue = (val, invalidValueMessage, valueSource) => {\n // val is null for optional option used without an optional-argument.\n // val is undefined for boolean and negated option.\n if (val == null && option.presetArg !== undefined) {\n val = option.presetArg;\n }\n\n // custom processing\n const oldValue = this.getOptionValue(name);\n if (val !== null && option.parseArg) {\n val = this._callParseArg(option, val, oldValue, invalidValueMessage);\n } else if (val !== null && option.variadic) {\n val = option._concatValue(val, oldValue);\n }\n\n // Fill-in appropriate missing values. Long winded but easy to follow.\n if (val == null) {\n if (option.negate) {\n val = false;\n } else if (option.isBoolean() || option.optional) {\n val = true;\n } else {\n val = ''; // not normal, parseArg might have failed or be a mock function for testing\n }\n }\n this.setOptionValueWithSource(name, val, valueSource);\n };\n\n this.on('option:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'cli');\n });\n\n if (option.envVar) {\n this.on('optionEnv:' + oname, (val) => {\n const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;\n handleOptionValue(val, invalidValueMessage, 'env');\n });\n }\n\n return this;\n }\n\n /**\n * Internal implementation shared by .option() and .requiredOption()\n *\n * @return {Command} `this` command for chaining\n * @private\n */\n _optionEx(config, flags, description, fn, defaultValue) {\n if (typeof flags === 'object' && flags instanceof Option) {\n throw new Error(\n 'To add an Option object use addOption() instead of option() or requiredOption()',\n );\n }\n const option = this.createOption(flags, description);\n option.makeOptionMandatory(!!config.mandatory);\n if (typeof fn === 'function') {\n option.default(defaultValue).argParser(fn);\n } else if (fn instanceof RegExp) {\n // deprecated\n const regex = fn;\n fn = (val, def) => {\n const m = regex.exec(val);\n return m ? m[0] : def;\n };\n option.default(defaultValue).argParser(fn);\n } else {\n option.default(fn);\n }\n\n return this.addOption(option);\n }\n\n /**\n * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. A required\n * option-argument is indicated by `<>` and an optional option-argument by `[]`.\n *\n * See the README for more details, and see also addOption() and requiredOption().\n *\n * @example\n * program\n * .option('-p, --pepper', 'add pepper')\n * .option('-p, --pizza-type <TYPE>', 'type of pizza') // required option-argument\n * .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default\n * .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n option(flags, description, parseArg, defaultValue) {\n return this._optionEx({}, flags, description, parseArg, defaultValue);\n }\n\n /**\n * Add a required option which must have a value after parsing. This usually means\n * the option must be specified on the command line. (Otherwise the same as .option().)\n *\n * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.\n *\n * @param {string} flags\n * @param {string} [description]\n * @param {(Function|*)} [parseArg] - custom option processing function or default value\n * @param {*} [defaultValue]\n * @return {Command} `this` command for chaining\n */\n\n requiredOption(flags, description, parseArg, defaultValue) {\n return this._optionEx(\n { mandatory: true },\n flags,\n description,\n parseArg,\n defaultValue,\n );\n }\n\n /**\n * Alter parsing of short flags with optional values.\n *\n * @example\n * // for `.option('-f,--flag [value]'):\n * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour\n * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`\n *\n * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.\n * @return {Command} `this` command for chaining\n */\n combineFlagAndOptionalValue(combine = true) {\n this._combineFlagAndOptionalValue = !!combine;\n return this;\n }\n\n /**\n * Allow unknown options on the command line.\n *\n * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options.\n * @return {Command} `this` command for chaining\n */\n allowUnknownOption(allowUnknown = true) {\n this._allowUnknownOption = !!allowUnknown;\n return this;\n }\n\n /**\n * Allow excess command-arguments on the command line. Pass false to make excess arguments an error.\n *\n * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments.\n * @return {Command} `this` command for chaining\n */\n allowExcessArguments(allowExcess = true) {\n this._allowExcessArguments = !!allowExcess;\n return this;\n }\n\n /**\n * Enable positional options. Positional means global options are specified before subcommands which lets\n * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.\n * The default behaviour is non-positional and global options may appear anywhere on the command line.\n *\n * @param {boolean} [positional]\n * @return {Command} `this` command for chaining\n */\n enablePositionalOptions(positional = true) {\n this._enablePositionalOptions = !!positional;\n return this;\n }\n\n /**\n * Pass through options that come after command-arguments rather than treat them as command-options,\n * so actual command-options come before command-arguments. Turning this on for a subcommand requires\n * positional options to have been enabled on the program (parent commands).\n * The default behaviour is non-positional and options may appear before or after command-arguments.\n *\n * @param {boolean} [passThrough] for unknown options.\n * @return {Command} `this` command for chaining\n */\n passThroughOptions(passThrough = true) {\n this._passThroughOptions = !!passThrough;\n this._checkForBrokenPassThrough();\n return this;\n }\n\n /**\n * @private\n */\n\n _checkForBrokenPassThrough() {\n if (\n this.parent &&\n this._passThroughOptions &&\n !this.parent._enablePositionalOptions\n ) {\n throw new Error(\n `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`,\n );\n }\n }\n\n /**\n * Whether to store option values as properties on command object,\n * or store separately (specify false). In both cases the option values can be accessed using .opts().\n *\n * @param {boolean} [storeAsProperties=true]\n * @return {Command} `this` command for chaining\n */\n\n storeOptionsAsProperties(storeAsProperties = true) {\n if (this.options.length) {\n throw new Error('call .storeOptionsAsProperties() before adding options');\n }\n if (Object.keys(this._optionValues).length) {\n throw new Error(\n 'call .storeOptionsAsProperties() before setting option values',\n );\n }\n this._storeOptionsAsProperties = !!storeAsProperties;\n return this;\n }\n\n /**\n * Retrieve option value.\n *\n * @param {string} key\n * @return {object} value\n */\n\n getOptionValue(key) {\n if (this._storeOptionsAsProperties) {\n return this[key];\n }\n return this._optionValues[key];\n }\n\n /**\n * Store option value.\n *\n * @param {string} key\n * @param {object} value\n * @return {Command} `this` command for chaining\n */\n\n setOptionValue(key, value) {\n return this.setOptionValueWithSource(key, value, undefined);\n }\n\n /**\n * Store option value and where the value came from.\n *\n * @param {string} key\n * @param {object} value\n * @param {string} source - expected values are default/config/env/cli/implied\n * @return {Command} `this` command for chaining\n */\n\n setOptionValueWithSource(key, value, source) {\n if (this._storeOptionsAsProperties) {\n this[key] = value;\n } else {\n this._optionValues[key] = value;\n }\n this._optionValueSources[key] = source;\n return this;\n }\n\n /**\n * Get source of option value.\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSource(key) {\n return this._optionValueSources[key];\n }\n\n /**\n * Get source of option value. See also .optsWithGlobals().\n * Expected values are default | config | env | cli | implied\n *\n * @param {string} key\n * @return {string}\n */\n\n getOptionValueSourceWithGlobals(key) {\n // global overwrites local, like optsWithGlobals\n let source;\n this._getCommandAndAncestors().forEach((cmd) => {\n if (cmd.getOptionValueSource(key) !== undefined) {\n source = cmd.getOptionValueSource(key);\n }\n });\n return source;\n }\n\n /**\n * Get user arguments from implied or explicit arguments.\n * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches.\n *\n * @private\n */\n\n _prepareUserArgs(argv, parseOptions) {\n if (argv !== undefined && !Array.isArray(argv)) {\n throw new Error('first parameter to parse must be array or undefined');\n }\n parseOptions = parseOptions || {};\n\n // auto-detect argument conventions if nothing supplied\n if (argv === undefined && parseOptions.from === undefined) {\n if (process.versions?.electron) {\n parseOptions.from = 'electron';\n }\n // check node specific options for scenarios where user CLI args follow executable without scriptname\n const execArgv = process.execArgv ?? [];\n if (\n execArgv.includes('-e') ||\n execArgv.includes('--eval') ||\n execArgv.includes('-p') ||\n execArgv.includes('--print')\n ) {\n parseOptions.from = 'eval'; // internal usage, not documented\n }\n }\n\n // default to using process.argv\n if (argv === undefined) {\n argv = process.argv;\n }\n this.rawArgs = argv.slice();\n\n // extract the user args and scriptPath\n let userArgs;\n switch (parseOptions.from) {\n case undefined:\n case 'node':\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n break;\n case 'electron':\n // @ts-ignore: because defaultApp is an unknown property\n if (process.defaultApp) {\n this._scriptPath = argv[1];\n userArgs = argv.slice(2);\n } else {\n userArgs = argv.slice(1);\n }\n break;\n case 'user':\n userArgs = argv.slice(0);\n break;\n case 'eval':\n userArgs = argv.slice(1);\n break;\n default:\n throw new Error(\n `unexpected parse option { from: '${parseOptions.from}' }`,\n );\n }\n\n // Find default name for program from arguments.\n if (!this._name && this._scriptPath)\n this.nameFromFilename(this._scriptPath);\n this._name = this._name || 'program';\n\n return userArgs;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Use parseAsync instead of parse if any of your action handlers are async.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * program.parse(); // parse process.argv and auto-detect electron and special node flags\n * program.parse(process.argv); // assume argv[0] is app and argv[1] is script\n * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv] - optional, defaults to process.argv\n * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron\n * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'\n * @return {Command} `this` command for chaining\n */\n\n parse(argv, parseOptions) {\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n this._parseCommand([], userArgs);\n\n return this;\n }\n\n /**\n * Parse `argv`, setting options and invoking commands when defined.\n *\n * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!\n *\n * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:\n * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that\n * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged\n * - `'user'`: just user arguments\n *\n * @example\n * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags\n * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script\n * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]\n *\n * @param {string[]} [argv]\n * @param {object} [parseOptions]\n * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'\n * @return {Promise}\n */\n\n async parseAsync(argv, parseOptions) {\n const userArgs = this._prepareUserArgs(argv, parseOptions);\n await this._parseCommand([], userArgs);\n\n return this;\n }\n\n /**\n * Execute a sub-command executable.\n *\n * @private\n */\n\n _executeSubCommand(subcommand, args) {\n args = args.slice();\n let launchWithNode = false; // Use node for source targets so do not need to get permissions correct, and on Windows.\n const sourceExt = ['.js', '.ts', '.tsx', '.mjs', '.cjs'];\n\n function findFile(baseDir, baseName) {\n // Look for specified file\n const localBin = path.resolve(baseDir, baseName);\n if (fs.existsSync(localBin)) return localBin;\n\n // Stop looking if candidate already has an expected extension.\n if (sourceExt.includes(path.extname(baseName))) return undefined;\n\n // Try all the extensions.\n const foundExt = sourceExt.find((ext) =>\n fs.existsSync(`${localBin}${ext}`),\n );\n if (foundExt) return `${localBin}${foundExt}`;\n\n return undefined;\n }\n\n // Not checking for help first. Unlikely to have mandatory and executable, and can't robustly test for help flags in external command.\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // executableFile and executableDir might be full path, or just a name\n let executableFile =\n subcommand._executableFile || `${this._name}-${subcommand._name}`;\n let executableDir = this._executableDir || '';\n if (this._scriptPath) {\n let resolvedScriptPath; // resolve possible symlink for installed npm binary\n try {\n resolvedScriptPath = fs.realpathSync(this._scriptPath);\n } catch (err) {\n resolvedScriptPath = this._scriptPath;\n }\n executableDir = path.resolve(\n path.dirname(resolvedScriptPath),\n executableDir,\n );\n }\n\n // Look for a local file in preference to a command in PATH.\n if (executableDir) {\n let localFile = findFile(executableDir, executableFile);\n\n // Legacy search using prefix of script name instead of command name\n if (!localFile && !subcommand._executableFile && this._scriptPath) {\n const legacyName = path.basename(\n this._scriptPath,\n path.extname(this._scriptPath),\n );\n if (legacyName !== this._name) {\n localFile = findFile(\n executableDir,\n `${legacyName}-${subcommand._name}`,\n );\n }\n }\n executableFile = localFile || executableFile;\n }\n\n launchWithNode = sourceExt.includes(path.extname(executableFile));\n\n let proc;\n if (process.platform !== 'win32') {\n if (launchWithNode) {\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n\n proc = childProcess.spawn(process.argv[0], args, { stdio: 'inherit' });\n } else {\n proc = childProcess.spawn(executableFile, args, { stdio: 'inherit' });\n }\n } else {\n args.unshift(executableFile);\n // add executable arguments to spawn\n args = incrementNodeInspectorPort(process.execArgv).concat(args);\n proc = childProcess.spawn(process.execPath, args, { stdio: 'inherit' });\n }\n\n if (!proc.killed) {\n // testing mainly to avoid leak warnings during unit tests with mocked spawn\n const signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];\n signals.forEach((signal) => {\n process.on(signal, () => {\n if (proc.killed === false && proc.exitCode === null) {\n // @ts-ignore because signals not typed to known strings\n proc.kill(signal);\n }\n });\n });\n }\n\n // By default terminate process when spawned process terminates.\n const exitCallback = this._exitCallback;\n proc.on('close', (code) => {\n code = code ?? 1; // code is null if spawned process terminated due to a signal\n if (!exitCallback) {\n process.exit(code);\n } else {\n exitCallback(\n new CommanderError(\n code,\n 'commander.executeSubCommandAsync',\n '(close)',\n ),\n );\n }\n });\n proc.on('error', (err) => {\n // @ts-ignore: because err.code is an unknown property\n if (err.code === 'ENOENT') {\n const executableDirMessage = executableDir\n ? `searched for local subcommand relative to directory '${executableDir}'`\n : 'no directory for search for local subcommand, use .executableDir() to supply a custom directory';\n const executableMissing = `'${executableFile}' does not exist\n - if '${subcommand._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${executableDirMessage}`;\n throw new Error(executableMissing);\n // @ts-ignore: because err.code is an unknown property\n } else if (err.code === 'EACCES') {\n throw new Error(`'${executableFile}' not executable`);\n }\n if (!exitCallback) {\n process.exit(1);\n } else {\n const wrappedError = new CommanderError(\n 1,\n 'commander.executeSubCommandAsync',\n '(error)',\n );\n wrappedError.nestedError = err;\n exitCallback(wrappedError);\n }\n });\n\n // Store the reference to the child process\n this.runningCommand = proc;\n }\n\n /**\n * @private\n */\n\n _dispatchSubcommand(commandName, operands, unknown) {\n const subCommand = this._findCommand(commandName);\n if (!subCommand) this.help({ error: true });\n\n let promiseChain;\n promiseChain = this._chainOrCallSubCommandHook(\n promiseChain,\n subCommand,\n 'preSubcommand',\n );\n promiseChain = this._chainOrCall(promiseChain, () => {\n if (subCommand._executableHandler) {\n this._executeSubCommand(subCommand, operands.concat(unknown));\n } else {\n return subCommand._parseCommand(operands, unknown);\n }\n });\n return promiseChain;\n }\n\n /**\n * Invoke help directly if possible, or dispatch if necessary.\n * e.g. help foo\n *\n * @private\n */\n\n _dispatchHelpCommand(subcommandName) {\n if (!subcommandName) {\n this.help();\n }\n const subCommand = this._findCommand(subcommandName);\n if (subCommand && !subCommand._executableHandler) {\n subCommand.help();\n }\n\n // Fallback to parsing the help flag to invoke the help.\n return this._dispatchSubcommand(\n subcommandName,\n [],\n [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help'],\n );\n }\n\n /**\n * Check this.args against expected this.registeredArguments.\n *\n * @private\n */\n\n _checkNumberOfArguments() {\n // too few\n this.registeredArguments.forEach((arg, i) => {\n if (arg.required && this.args[i] == null) {\n this.missingArgument(arg.name());\n }\n });\n // too many\n if (\n this.registeredArguments.length > 0 &&\n this.registeredArguments[this.registeredArguments.length - 1].variadic\n ) {\n return;\n }\n if (this.args.length > this.registeredArguments.length) {\n this._excessArguments(this.args);\n }\n }\n\n /**\n * Process this.args using this.registeredArguments and save as this.processedArgs!\n *\n * @private\n */\n\n _processArguments() {\n const myParseArg = (argument, value, previous) => {\n // Extra processing for nice error message on parsing failure.\n let parsedValue = value;\n if (value !== null && argument.parseArg) {\n const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;\n parsedValue = this._callParseArg(\n argument,\n value,\n previous,\n invalidValueMessage,\n );\n }\n return parsedValue;\n };\n\n this._checkNumberOfArguments();\n\n const processedArgs = [];\n this.registeredArguments.forEach((declaredArg, index) => {\n let value = declaredArg.defaultValue;\n if (declaredArg.variadic) {\n // Collect together remaining arguments for passing together as an array.\n if (index < this.args.length) {\n value = this.args.slice(index);\n if (declaredArg.parseArg) {\n value = value.reduce((processed, v) => {\n return myParseArg(declaredArg, v, processed);\n }, declaredArg.defaultValue);\n }\n } else if (value === undefined) {\n value = [];\n }\n } else if (index < this.args.length) {\n value = this.args[index];\n if (declaredArg.parseArg) {\n value = myParseArg(declaredArg, value, declaredArg.defaultValue);\n }\n }\n processedArgs[index] = value;\n });\n this.processedArgs = processedArgs;\n }\n\n /**\n * Once we have a promise we chain, but call synchronously until then.\n *\n * @param {(Promise|undefined)} promise\n * @param {Function} fn\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCall(promise, fn) {\n // thenable\n if (promise && promise.then && typeof promise.then === 'function') {\n // already have a promise, chain callback\n return promise.then(() => fn());\n }\n // callback might return a promise\n return fn();\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallHooks(promise, event) {\n let result = promise;\n const hooks = [];\n this._getCommandAndAncestors()\n .reverse()\n .filter((cmd) => cmd._lifeCycleHooks[event] !== undefined)\n .forEach((hookedCommand) => {\n hookedCommand._lifeCycleHooks[event].forEach((callback) => {\n hooks.push({ hookedCommand, callback });\n });\n });\n if (event === 'postAction') {\n hooks.reverse();\n }\n\n hooks.forEach((hookDetail) => {\n result = this._chainOrCall(result, () => {\n return hookDetail.callback(hookDetail.hookedCommand, this);\n });\n });\n return result;\n }\n\n /**\n *\n * @param {(Promise|undefined)} promise\n * @param {Command} subCommand\n * @param {string} event\n * @return {(Promise|undefined)}\n * @private\n */\n\n _chainOrCallSubCommandHook(promise, subCommand, event) {\n let result = promise;\n if (this._lifeCycleHooks[event] !== undefined) {\n this._lifeCycleHooks[event].forEach((hook) => {\n result = this._chainOrCall(result, () => {\n return hook(this, subCommand);\n });\n });\n }\n return result;\n }\n\n /**\n * Process arguments in context of this command.\n * Returns action result, in case it is a promise.\n *\n * @private\n */\n\n _parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n this._parseOptionsEnv(); // after cli, so parseArg not called on both cli and env\n this._parseOptionsImplied();\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n }\n if (\n this._getHelpCommand() &&\n operands[0] === this._getHelpCommand().name()\n ) {\n return this._dispatchHelpCommand(operands[1]);\n }\n if (this._defaultCommandName) {\n this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command\n return this._dispatchSubcommand(\n this._defaultCommandName,\n operands,\n unknown,\n );\n }\n if (\n this.commands.length &&\n this.args.length === 0 &&\n !this._actionHandler &&\n !this._defaultCommandName\n ) {\n // probably missing subcommand and no handler, user needs help (and exit)\n this.help({ error: true });\n }\n\n this._outputHelpIfRequested(parsed.unknown);\n this._checkForMissingMandatoryOptions();\n this._checkForConflictingOptions();\n\n // We do not always call this check to avoid masking a \"better\" error, like unknown command.\n const checkForUnknownOptions = () => {\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n };\n\n const commandEvent = `command:${this.name()}`;\n if (this._actionHandler) {\n checkForUnknownOptions();\n this._processArguments();\n\n let promiseChain;\n promiseChain = this._chainOrCallHooks(promiseChain, 'preAction');\n promiseChain = this._chainOrCall(promiseChain, () =>\n this._actionHandler(this.processedArgs),\n );\n if (this.parent) {\n promiseChain = this._chainOrCall(promiseChain, () => {\n this.parent.emit(commandEvent, operands, unknown); // legacy\n });\n }\n promiseChain = this._chainOrCallHooks(promiseChain, 'postAction');\n return promiseChain;\n }\n if (this.parent && this.parent.listenerCount(commandEvent)) {\n checkForUnknownOptions();\n this._processArguments();\n this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (operands.length) {\n if (this._findCommand('*')) {\n // legacy default command\n return this._dispatchSubcommand('*', operands, unknown);\n }\n if (this.listenerCount('command:*')) {\n // skip option check, emit event for possible misspelling suggestion\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n } else {\n checkForUnknownOptions();\n this._processArguments();\n }\n } else if (this.commands.length) {\n checkForUnknownOptions();\n // This command has subcommands and nothing hooked up at this level, so display help (and exit).\n this.help({ error: true });\n } else {\n checkForUnknownOptions();\n this._processArguments();\n // fall through for caller to handle after calling .parse()\n }\n }\n\n /**\n * Find matching command.\n *\n * @private\n * @return {Command | undefined}\n */\n _findCommand(name) {\n if (!name) return undefined;\n return this.commands.find(\n (cmd) => cmd._name === name || cmd._aliases.includes(name),\n );\n }\n\n /**\n * Return an option matching `arg` if any.\n *\n * @param {string} arg\n * @return {Option}\n * @package\n */\n\n _findOption(arg) {\n return this.options.find((option) => option.is(arg));\n }\n\n /**\n * Display an error message if a mandatory option does not have a value.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n\n _checkForMissingMandatoryOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd.options.forEach((anOption) => {\n if (\n anOption.mandatory &&\n cmd.getOptionValue(anOption.attributeName()) === undefined\n ) {\n cmd.missingMandatoryOptionValue(anOption);\n }\n });\n });\n }\n\n /**\n * Display an error message if conflicting options are used together in this.\n *\n * @private\n */\n _checkForConflictingLocalOptions() {\n const definedNonDefaultOptions = this.options.filter((option) => {\n const optionKey = option.attributeName();\n if (this.getOptionValue(optionKey) === undefined) {\n return false;\n }\n return this.getOptionValueSource(optionKey) !== 'default';\n });\n\n const optionsWithConflicting = definedNonDefaultOptions.filter(\n (option) => option.conflictsWith.length > 0,\n );\n\n optionsWithConflicting.forEach((option) => {\n const conflictingAndDefined = definedNonDefaultOptions.find((defined) =>\n option.conflictsWith.includes(defined.attributeName()),\n );\n if (conflictingAndDefined) {\n this._conflictingOption(option, conflictingAndDefined);\n }\n });\n }\n\n /**\n * Display an error message if conflicting options are used together.\n * Called after checking for help flags in leaf subcommand.\n *\n * @private\n */\n _checkForConflictingOptions() {\n // Walk up hierarchy so can call in subcommand after checking for displaying help.\n this._getCommandAndAncestors().forEach((cmd) => {\n cmd._checkForConflictingLocalOptions();\n });\n }\n\n /**\n * Parse options from `argv` removing known options,\n * and return argv split into operands and unknown arguments.\n *\n * Examples:\n *\n * argv => operands, unknown\n * --known kkk op => [op], []\n * op --known kkk => [op], []\n * sub --unknown uuu op => [sub], [--unknown uuu op]\n * sub -- --unknown uuu op => [sub --unknown uuu op], []\n *\n * @param {string[]} argv\n * @return {{operands: string[], unknown: string[]}}\n */\n\n parseOptions(argv) {\n const operands = []; // operands, not options or values\n const unknown = []; // first unknown option and remaining unknown args\n let dest = operands;\n const args = argv.slice();\n\n function maybeOption(arg) {\n return arg.length > 1 && arg[0] === '-';\n }\n\n // parse options\n let activeVariadicOption = null;\n while (args.length) {\n const arg = args.shift();\n\n // literal\n if (arg === '--') {\n if (dest === unknown) dest.push(arg);\n dest.push(...args);\n break;\n }\n\n if (activeVariadicOption && !maybeOption(arg)) {\n this.emit(`option:${activeVariadicOption.name()}`, arg);\n continue;\n }\n activeVariadicOption = null;\n\n if (maybeOption(arg)) {\n const option = this._findOption(arg);\n // recognised option, call listener to assign value with possible custom processing\n if (option) {\n if (option.required) {\n const value = args.shift();\n if (value === undefined) this.optionMissingArgument(option);\n this.emit(`option:${option.name()}`, value);\n } else if (option.optional) {\n let value = null;\n // historical behaviour is optional value is following arg unless an option\n if (args.length > 0 && !maybeOption(args[0])) {\n value = args.shift();\n }\n this.emit(`option:${option.name()}`, value);\n } else {\n // boolean flag\n this.emit(`option:${option.name()}`);\n }\n activeVariadicOption = option.variadic ? option : null;\n continue;\n }\n }\n\n // Look for combo options following single dash, eat first one if known.\n if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {\n const option = this._findOption(`-${arg[1]}`);\n if (option) {\n if (\n option.required ||\n (option.optional && this._combineFlagAndOptionalValue)\n ) {\n // option with value following in same argument\n this.emit(`option:${option.name()}`, arg.slice(2));\n } else {\n // boolean option, emit and put back remainder of arg for further processing\n this.emit(`option:${option.name()}`);\n args.unshift(`-${arg.slice(2)}`);\n }\n continue;\n }\n }\n\n // Look for known long flag with value, like --foo=bar\n if (/^--[^=]+=/.test(arg)) {\n const index = arg.indexOf('=');\n const option = this._findOption(arg.slice(0, index));\n if (option && (option.required || option.optional)) {\n this.emit(`option:${option.name()}`, arg.slice(index + 1));\n continue;\n }\n }\n\n // Not a recognised option by this command.\n // Might be a command-argument, or subcommand option, or unknown option, or help command or option.\n\n // An unknown option means further arguments also classified as unknown so can be reprocessed by subcommands.\n if (maybeOption(arg)) {\n dest = unknown;\n }\n\n // If using positionalOptions, stop processing our options at subcommand.\n if (\n (this._enablePositionalOptions || this._passThroughOptions) &&\n operands.length === 0 &&\n unknown.length === 0\n ) {\n if (this._findCommand(arg)) {\n operands.push(arg);\n if (args.length > 0) unknown.push(...args);\n break;\n } else if (\n this._getHelpCommand() &&\n arg === this._getHelpCommand().name()\n ) {\n operands.push(arg);\n if (args.length > 0) operands.push(...args);\n break;\n } else if (this._defaultCommandName) {\n unknown.push(arg);\n if (args.length > 0) unknown.push(...args);\n break;\n }\n }\n\n // If using passThroughOptions, stop processing options at first command-argument.\n if (this._passThroughOptions) {\n dest.push(arg);\n if (args.length > 0) dest.push(...args);\n break;\n }\n\n // add arg\n dest.push(arg);\n }\n\n return { operands, unknown };\n }\n\n /**\n * Return an object containing local option values as key-value pairs.\n *\n * @return {object}\n */\n opts() {\n if (this._storeOptionsAsProperties) {\n // Preserve original behaviour so backwards compatible when still using properties\n const result = {};\n const len = this.options.length;\n\n for (let i = 0; i < len; i++) {\n const key = this.options[i].attributeName();\n result[key] =\n key === this._versionOptionName ? this._version : this[key];\n }\n return result;\n }\n\n return this._optionValues;\n }\n\n /**\n * Return an object containing merged local and global option values as key-value pairs.\n *\n * @return {object}\n */\n optsWithGlobals() {\n // globals overwrite locals\n return this._getCommandAndAncestors().reduce(\n (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),\n {},\n );\n }\n\n /**\n * Display error message and exit (or call exitOverride).\n *\n * @param {string} message\n * @param {object} [errorOptions]\n * @param {string} [errorOptions.code] - an id string representing the error\n * @param {number} [errorOptions.exitCode] - used with process.exit\n */\n error(message, errorOptions) {\n // output handling\n this._outputConfiguration.outputError(\n `${message}\\n`,\n this._outputConfiguration.writeErr,\n );\n if (typeof this._showHelpAfterError === 'string') {\n this._outputConfiguration.writeErr(`${this._showHelpAfterError}\\n`);\n } else if (this._showHelpAfterError) {\n this._outputConfiguration.writeErr('\\n');\n this.outputHelp({ error: true });\n }\n\n // exit handling\n const config = errorOptions || {};\n const exitCode = config.exitCode || 1;\n const code = config.code || 'commander.error';\n this._exit(exitCode, code, message);\n }\n\n /**\n * Apply any option related environment variables, if option does\n * not have a value from cli or client code.\n *\n * @private\n */\n _parseOptionsEnv() {\n this.options.forEach((option) => {\n if (option.envVar && option.envVar in process.env) {\n const optionKey = option.attributeName();\n // Priority check. Do not overwrite cli or options from unknown source (client-code).\n if (\n this.getOptionValue(optionKey) === undefined ||\n ['default', 'config', 'env'].includes(\n this.getOptionValueSource(optionKey),\n )\n ) {\n if (option.required || option.optional) {\n // option can take a value\n // keep very simple, optional always takes value\n this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);\n } else {\n // boolean\n // keep very simple, only care that envVar defined and not the value\n this.emit(`optionEnv:${option.name()}`);\n }\n }\n }\n });\n }\n\n /**\n * Apply any implied option values, if option is undefined or default value.\n *\n * @private\n */\n _parseOptionsImplied() {\n const dualHelper = new DualOptions(this.options);\n const hasCustomOptionValue = (optionKey) => {\n return (\n this.getOptionValue(optionKey) !== undefined &&\n !['default', 'implied'].includes(this.getOptionValueSource(optionKey))\n );\n };\n this.options\n .filter(\n (option) =>\n option.implied !== undefined &&\n hasCustomOptionValue(option.attributeName()) &&\n dualHelper.valueFromOption(\n this.getOptionValue(option.attributeName()),\n option,\n ),\n )\n .forEach((option) => {\n Object.keys(option.implied)\n .filter((impliedKey) => !hasCustomOptionValue(impliedKey))\n .forEach((impliedKey) => {\n this.setOptionValueWithSource(\n impliedKey,\n option.implied[impliedKey],\n 'implied',\n );\n });\n });\n }\n\n /**\n * Argument `name` is missing.\n *\n * @param {string} name\n * @private\n */\n\n missingArgument(name) {\n const message = `error: missing required argument '${name}'`;\n this.error(message, { code: 'commander.missingArgument' });\n }\n\n /**\n * `Option` is missing an argument.\n *\n * @param {Option} option\n * @private\n */\n\n optionMissingArgument(option) {\n const message = `error: option '${option.flags}' argument missing`;\n this.error(message, { code: 'commander.optionMissingArgument' });\n }\n\n /**\n * `Option` does not have a value, and is a mandatory option.\n *\n * @param {Option} option\n * @private\n */\n\n missingMandatoryOptionValue(option) {\n const message = `error: required option '${option.flags}' not specified`;\n this.error(message, { code: 'commander.missingMandatoryOptionValue' });\n }\n\n /**\n * `Option` conflicts with another option.\n *\n * @param {Option} option\n * @param {Option} conflictingOption\n * @private\n */\n _conflictingOption(option, conflictingOption) {\n // The calling code does not know whether a negated option is the source of the\n // value, so do some work to take an educated guess.\n const findBestOptionFromValue = (option) => {\n const optionKey = option.attributeName();\n const optionValue = this.getOptionValue(optionKey);\n const negativeOption = this.options.find(\n (target) => target.negate && optionKey === target.attributeName(),\n );\n const positiveOption = this.options.find(\n (target) => !target.negate && optionKey === target.attributeName(),\n );\n if (\n negativeOption &&\n ((negativeOption.presetArg === undefined && optionValue === false) ||\n (negativeOption.presetArg !== undefined &&\n optionValue === negativeOption.presetArg))\n ) {\n return negativeOption;\n }\n return positiveOption || option;\n };\n\n const getErrorMessage = (option) => {\n const bestOption = findBestOptionFromValue(option);\n const optionKey = bestOption.attributeName();\n const source = this.getOptionValueSource(optionKey);\n if (source === 'env') {\n return `environment variable '${bestOption.envVar}'`;\n }\n return `option '${bestOption.flags}'`;\n };\n\n const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;\n this.error(message, { code: 'commander.conflictingOption' });\n }\n\n /**\n * Unknown option `flag`.\n *\n * @param {string} flag\n * @private\n */\n\n unknownOption(flag) {\n if (this._allowUnknownOption) return;\n let suggestion = '';\n\n if (flag.startsWith('--') && this._showSuggestionAfterError) {\n // Looping to pick up the global options too\n let candidateFlags = [];\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n do {\n const moreFlags = command\n .createHelp()\n .visibleOptions(command)\n .filter((option) => option.long)\n .map((option) => option.long);\n candidateFlags = candidateFlags.concat(moreFlags);\n command = command.parent;\n } while (command && !command._enablePositionalOptions);\n suggestion = suggestSimilar(flag, candidateFlags);\n }\n\n const message = `error: unknown option '${flag}'${suggestion}`;\n this.error(message, { code: 'commander.unknownOption' });\n }\n\n /**\n * Excess arguments, more than expected.\n *\n * @param {string[]} receivedArgs\n * @private\n */\n\n _excessArguments(receivedArgs) {\n if (this._allowExcessArguments) return;\n\n const expected = this.registeredArguments.length;\n const s = expected === 1 ? '' : 's';\n const forSubcommand = this.parent ? ` for '${this.name()}'` : '';\n const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;\n this.error(message, { code: 'commander.excessArguments' });\n }\n\n /**\n * Unknown command.\n *\n * @private\n */\n\n unknownCommand() {\n const unknownName = this.args[0];\n let suggestion = '';\n\n if (this._showSuggestionAfterError) {\n const candidateNames = [];\n this.createHelp()\n .visibleCommands(this)\n .forEach((command) => {\n candidateNames.push(command.name());\n // just visible alias\n if (command.alias()) candidateNames.push(command.alias());\n });\n suggestion = suggestSimilar(unknownName, candidateNames);\n }\n\n const message = `error: unknown command '${unknownName}'${suggestion}`;\n this.error(message, { code: 'commander.unknownCommand' });\n }\n\n /**\n * Get or set the program version.\n *\n * This method auto-registers the \"-V, --version\" option which will print the version number.\n *\n * You can optionally supply the flags and description to override the defaults.\n *\n * @param {string} [str]\n * @param {string} [flags]\n * @param {string} [description]\n * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments\n */\n\n version(str, flags, description) {\n if (str === undefined) return this._version;\n this._version = str;\n flags = flags || '-V, --version';\n description = description || 'output the version number';\n const versionOption = this.createOption(flags, description);\n this._versionOptionName = versionOption.attributeName();\n this._registerOption(versionOption);\n\n this.on('option:' + versionOption.name(), () => {\n this._outputConfiguration.writeOut(`${str}\\n`);\n this._exit(0, 'commander.version', str);\n });\n return this;\n }\n\n /**\n * Set the description.\n *\n * @param {string} [str]\n * @param {object} [argsDescription]\n * @return {(string|Command)}\n */\n description(str, argsDescription) {\n if (str === undefined && argsDescription === undefined)\n return this._description;\n this._description = str;\n if (argsDescription) {\n this._argsDescription = argsDescription;\n }\n return this;\n }\n\n /**\n * Set the summary. Used when listed as subcommand of parent.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n summary(str) {\n if (str === undefined) return this._summary;\n this._summary = str;\n return this;\n }\n\n /**\n * Set an alias for the command.\n *\n * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.\n *\n * @param {string} [alias]\n * @return {(string|Command)}\n */\n\n alias(alias) {\n if (alias === undefined) return this._aliases[0]; // just return first, for backwards compatibility\n\n /** @type {Command} */\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let command = this;\n if (\n this.commands.length !== 0 &&\n this.commands[this.commands.length - 1]._executableHandler\n ) {\n // assume adding alias for last added executable subcommand, rather than this\n command = this.commands[this.commands.length - 1];\n }\n\n if (alias === command._name)\n throw new Error(\"Command alias can't be the same as its name\");\n const matchingCommand = this.parent?._findCommand(alias);\n if (matchingCommand) {\n // c.f. _registerCommand\n const existingCmd = [matchingCommand.name()]\n .concat(matchingCommand.aliases())\n .join('|');\n throw new Error(\n `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`,\n );\n }\n\n command._aliases.push(alias);\n return this;\n }\n\n /**\n * Set aliases for the command.\n *\n * Only the first alias is shown in the auto-generated help.\n *\n * @param {string[]} [aliases]\n * @return {(string[]|Command)}\n */\n\n aliases(aliases) {\n // Getter for the array of aliases is the main reason for having aliases() in addition to alias().\n if (aliases === undefined) return this._aliases;\n\n aliases.forEach((alias) => this.alias(alias));\n return this;\n }\n\n /**\n * Set / get the command usage `str`.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n usage(str) {\n if (str === undefined) {\n if (this._usage) return this._usage;\n\n const args = this.registeredArguments.map((arg) => {\n return humanReadableArgName(arg);\n });\n return []\n .concat(\n this.options.length || this._helpOption !== null ? '[options]' : [],\n this.commands.length ? '[command]' : [],\n this.registeredArguments.length ? args : [],\n )\n .join(' ');\n }\n\n this._usage = str;\n return this;\n }\n\n /**\n * Get or set the name of the command.\n *\n * @param {string} [str]\n * @return {(string|Command)}\n */\n\n name(str) {\n if (str === undefined) return this._name;\n this._name = str;\n return this;\n }\n\n /**\n * Set the name of the command from script filename, such as process.argv[1],\n * or require.main.filename, or __filename.\n *\n * (Used internally and public although not documented in README.)\n *\n * @example\n * program.nameFromFilename(require.main.filename);\n *\n * @param {string} filename\n * @return {Command}\n */\n\n nameFromFilename(filename) {\n this._name = path.basename(filename, path.extname(filename));\n\n return this;\n }\n\n /**\n * Get or set the directory for searching for executable subcommands of this command.\n *\n * @example\n * program.executableDir(__dirname);\n * // or\n * program.executableDir('subcommands');\n *\n * @param {string} [path]\n * @return {(string|null|Command)}\n */\n\n executableDir(path) {\n if (path === undefined) return this._executableDir;\n this._executableDir = path;\n return this;\n }\n\n /**\n * Return program help documentation.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout\n * @return {string}\n */\n\n helpInformation(contextOptions) {\n const helper = this.createHelp();\n if (helper.helpWidth === undefined) {\n helper.helpWidth =\n contextOptions && contextOptions.error\n ? this._outputConfiguration.getErrHelpWidth()\n : this._outputConfiguration.getOutHelpWidth();\n }\n return helper.formatHelp(this, helper);\n }\n\n /**\n * @private\n */\n\n _getHelpContext(contextOptions) {\n contextOptions = contextOptions || {};\n const context = { error: !!contextOptions.error };\n let write;\n if (context.error) {\n write = (arg) => this._outputConfiguration.writeErr(arg);\n } else {\n write = (arg) => this._outputConfiguration.writeOut(arg);\n }\n context.write = contextOptions.write || write;\n context.command = this;\n return context;\n }\n\n /**\n * Output help information for this command.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n outputHelp(contextOptions) {\n let deprecatedCallback;\n if (typeof contextOptions === 'function') {\n deprecatedCallback = contextOptions;\n contextOptions = undefined;\n }\n const context = this._getHelpContext(contextOptions);\n\n this._getCommandAndAncestors()\n .reverse()\n .forEach((command) => command.emit('beforeAllHelp', context));\n this.emit('beforeHelp', context);\n\n let helpInformation = this.helpInformation(context);\n if (deprecatedCallback) {\n helpInformation = deprecatedCallback(helpInformation);\n if (\n typeof helpInformation !== 'string' &&\n !Buffer.isBuffer(helpInformation)\n ) {\n throw new Error('outputHelp callback must return a string or a Buffer');\n }\n }\n context.write(helpInformation);\n\n if (this._getHelpOption()?.long) {\n this.emit(this._getHelpOption().long); // deprecated\n }\n this.emit('afterHelp', context);\n this._getCommandAndAncestors().forEach((command) =>\n command.emit('afterAllHelp', context),\n );\n }\n\n /**\n * You can pass in flags and a description to customise the built-in help option.\n * Pass in false to disable the built-in help option.\n *\n * @example\n * program.helpOption('-?, --help' 'show help'); // customise\n * program.helpOption(false); // disable\n *\n * @param {(string | boolean)} flags\n * @param {string} [description]\n * @return {Command} `this` command for chaining\n */\n\n helpOption(flags, description) {\n // Support disabling built-in help option.\n if (typeof flags === 'boolean') {\n if (flags) {\n this._helpOption = this._helpOption ?? undefined; // preserve existing option\n } else {\n this._helpOption = null; // disable\n }\n return this;\n }\n\n // Customise flags and description.\n flags = flags ?? '-h, --help';\n description = description ?? 'display help for command';\n this._helpOption = this.createOption(flags, description);\n\n return this;\n }\n\n /**\n * Lazy create help option.\n * Returns null if has been disabled with .helpOption(false).\n *\n * @returns {(Option | null)} the help option\n * @package\n */\n _getHelpOption() {\n // Lazy create help option on demand.\n if (this._helpOption === undefined) {\n this.helpOption(undefined, undefined);\n }\n return this._helpOption;\n }\n\n /**\n * Supply your own option to use for the built-in help option.\n * This is an alternative to using helpOption() to customise the flags and description etc.\n *\n * @param {Option} option\n * @return {Command} `this` command for chaining\n */\n addHelpOption(option) {\n this._helpOption = option;\n return this;\n }\n\n /**\n * Output help information and exit.\n *\n * Outputs built-in help, and custom text added using `.addHelpText()`.\n *\n * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout\n */\n\n help(contextOptions) {\n this.outputHelp(contextOptions);\n let exitCode = process.exitCode || 0;\n if (\n exitCode === 0 &&\n contextOptions &&\n typeof contextOptions !== 'function' &&\n contextOptions.error\n ) {\n exitCode = 1;\n }\n // message: do not have all displayed text available so only passing placeholder.\n this._exit(exitCode, 'commander.help', '(outputHelp)');\n }\n\n /**\n * Add additional text to be displayed with the built-in help.\n *\n * Position is 'before' or 'after' to affect just this command,\n * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.\n *\n * @param {string} position - before or after built-in help\n * @param {(string | Function)} text - string to add, or a function returning a string\n * @return {Command} `this` command for chaining\n */\n addHelpText(position, text) {\n const allowedValues = ['beforeAll', 'before', 'after', 'afterAll'];\n if (!allowedValues.includes(position)) {\n throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${allowedValues.join(\"', '\")}'`);\n }\n const helpEvent = `${position}Help`;\n this.on(helpEvent, (context) => {\n let helpStr;\n if (typeof text === 'function') {\n helpStr = text({ error: context.error, command: context.command });\n } else {\n helpStr = text;\n }\n // Ignore falsy value when nothing to output.\n if (helpStr) {\n context.write(`${helpStr}\\n`);\n }\n });\n return this;\n }\n\n /**\n * Output help information if help flags specified\n *\n * @param {Array} args - array of options to search for help flags\n * @private\n */\n\n _outputHelpIfRequested(args) {\n const helpOption = this._getHelpOption();\n const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));\n if (helpRequested) {\n this.outputHelp();\n // (Do not have all displayed text available so only passing placeholder.)\n this._exit(0, 'commander.helpDisplayed', '(outputHelp)');\n }\n }\n}\n\n/**\n * Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command).\n *\n * @param {string[]} args - array of arguments from node.execArgv\n * @returns {string[]}\n * @private\n */\n\nfunction incrementNodeInspectorPort(args) {\n // Testing for these options:\n // --inspect[=[host:]port]\n // --inspect-brk[=[host:]port]\n // --inspect-port=[host:]port\n return args.map((arg) => {\n if (!arg.startsWith('--inspect')) {\n return arg;\n }\n let debugOption;\n let debugHost = '127.0.0.1';\n let debugPort = '9229';\n let match;\n if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {\n // e.g. --inspect\n debugOption = match[1];\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null\n ) {\n debugOption = match[1];\n if (/^\\d+$/.test(match[3])) {\n // e.g. --inspect=1234\n debugPort = match[3];\n } else {\n // e.g. --inspect=localhost\n debugHost = match[3];\n }\n } else if (\n (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\\d+)$/)) !== null\n ) {\n // e.g. --inspect=localhost:1234\n debugOption = match[1];\n debugHost = match[3];\n debugPort = match[4];\n }\n\n if (debugOption && debugPort !== '0') {\n return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;\n }\n return arg;\n });\n}\n\nexports.Command = Command;\n","/**\n * CommanderError class\n */\nclass CommanderError extends Error {\n /**\n * Constructs the CommanderError class\n * @param {number} exitCode suggested exit code which could be used with process.exit\n * @param {string} code an id string representing the error\n * @param {string} message human-readable description of the error\n */\n constructor(exitCode, code, message) {\n super(message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n this.code = code;\n this.exitCode = exitCode;\n this.nestedError = undefined;\n }\n}\n\n/**\n * InvalidArgumentError class\n */\nclass InvalidArgumentError extends CommanderError {\n /**\n * Constructs the InvalidArgumentError class\n * @param {string} [message] explanation of why argument is invalid\n */\n constructor(message) {\n super(1, 'commander.invalidArgument', message);\n // properly capture stack trace in Node.js\n Error.captureStackTrace(this, this.constructor);\n this.name = this.constructor.name;\n }\n}\n\nexports.CommanderError = CommanderError;\nexports.InvalidArgumentError = InvalidArgumentError;\n","const { humanReadableArgName } = require('./argument.js');\n\n/**\n * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`\n * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types\n * @typedef { import(\"./argument.js\").Argument } Argument\n * @typedef { import(\"./command.js\").Command } Command\n * @typedef { import(\"./option.js\").Option } Option\n */\n\n// Although this is a class, methods are static in style to allow override using subclass or just functions.\nclass Help {\n constructor() {\n this.helpWidth = undefined;\n this.sortSubcommands = false;\n this.sortOptions = false;\n this.showGlobalOptions = false;\n }\n\n /**\n * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.\n *\n * @param {Command} cmd\n * @returns {Command[]}\n */\n\n visibleCommands(cmd) {\n const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);\n const helpCommand = cmd._getHelpCommand();\n if (helpCommand && !helpCommand._hidden) {\n visibleCommands.push(helpCommand);\n }\n if (this.sortSubcommands) {\n visibleCommands.sort((a, b) => {\n // @ts-ignore: because overloaded return type\n return a.name().localeCompare(b.name());\n });\n }\n return visibleCommands;\n }\n\n /**\n * Compare options for sort.\n *\n * @param {Option} a\n * @param {Option} b\n * @returns {number}\n */\n compareOptions(a, b) {\n const getSortKey = (option) => {\n // WYSIWYG for order displayed in help. Short used for comparison if present. No special handling for negated.\n return option.short\n ? option.short.replace(/^-/, '')\n : option.long.replace(/^--/, '');\n };\n return getSortKey(a).localeCompare(getSortKey(b));\n }\n\n /**\n * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleOptions(cmd) {\n const visibleOptions = cmd.options.filter((option) => !option.hidden);\n // Built-in help option.\n const helpOption = cmd._getHelpOption();\n if (helpOption && !helpOption.hidden) {\n // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs.\n const removeShort = helpOption.short && cmd._findOption(helpOption.short);\n const removeLong = helpOption.long && cmd._findOption(helpOption.long);\n if (!removeShort && !removeLong) {\n visibleOptions.push(helpOption); // no changes needed\n } else if (helpOption.long && !removeLong) {\n visibleOptions.push(\n cmd.createOption(helpOption.long, helpOption.description),\n );\n } else if (helpOption.short && !removeShort) {\n visibleOptions.push(\n cmd.createOption(helpOption.short, helpOption.description),\n );\n }\n }\n if (this.sortOptions) {\n visibleOptions.sort(this.compareOptions);\n }\n return visibleOptions;\n }\n\n /**\n * Get an array of the visible global options. (Not including help.)\n *\n * @param {Command} cmd\n * @returns {Option[]}\n */\n\n visibleGlobalOptions(cmd) {\n if (!this.showGlobalOptions) return [];\n\n const globalOptions = [];\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n const visibleOptions = ancestorCmd.options.filter(\n (option) => !option.hidden,\n );\n globalOptions.push(...visibleOptions);\n }\n if (this.sortOptions) {\n globalOptions.sort(this.compareOptions);\n }\n return globalOptions;\n }\n\n /**\n * Get an array of the arguments if any have a description.\n *\n * @param {Command} cmd\n * @returns {Argument[]}\n */\n\n visibleArguments(cmd) {\n // Side effect! Apply the legacy descriptions before the arguments are displayed.\n if (cmd._argsDescription) {\n cmd.registeredArguments.forEach((argument) => {\n argument.description =\n argument.description || cmd._argsDescription[argument.name()] || '';\n });\n }\n\n // If there are any arguments with a description then return all the arguments.\n if (cmd.registeredArguments.find((argument) => argument.description)) {\n return cmd.registeredArguments;\n }\n return [];\n }\n\n /**\n * Get the command term to show in the list of subcommands.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandTerm(cmd) {\n // Legacy. Ignores custom usage string, and nested commands.\n const args = cmd.registeredArguments\n .map((arg) => humanReadableArgName(arg))\n .join(' ');\n return (\n cmd._name +\n (cmd._aliases[0] ? '|' + cmd._aliases[0] : '') +\n (cmd.options.length ? ' [options]' : '') + // simplistic check for non-help option\n (args ? ' ' + args : '')\n );\n }\n\n /**\n * Get the option term to show in the list of options.\n *\n * @param {Option} option\n * @returns {string}\n */\n\n optionTerm(option) {\n return option.flags;\n }\n\n /**\n * Get the argument term to show in the list of arguments.\n *\n * @param {Argument} argument\n * @returns {string}\n */\n\n argumentTerm(argument) {\n return argument.name();\n }\n\n /**\n * Get the longest command term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestSubcommandTermLength(cmd, helper) {\n return helper.visibleCommands(cmd).reduce((max, command) => {\n return Math.max(max, helper.subcommandTerm(command).length);\n }, 0);\n }\n\n /**\n * Get the longest option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestOptionTermLength(cmd, helper) {\n return helper.visibleOptions(cmd).reduce((max, option) => {\n return Math.max(max, helper.optionTerm(option).length);\n }, 0);\n }\n\n /**\n * Get the longest global option term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestGlobalOptionTermLength(cmd, helper) {\n return helper.visibleGlobalOptions(cmd).reduce((max, option) => {\n return Math.max(max, helper.optionTerm(option).length);\n }, 0);\n }\n\n /**\n * Get the longest argument term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n longestArgumentTermLength(cmd, helper) {\n return helper.visibleArguments(cmd).reduce((max, argument) => {\n return Math.max(max, helper.argumentTerm(argument).length);\n }, 0);\n }\n\n /**\n * Get the command usage to be displayed at the top of the built-in help.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandUsage(cmd) {\n // Usage\n let cmdName = cmd._name;\n if (cmd._aliases[0]) {\n cmdName = cmdName + '|' + cmd._aliases[0];\n }\n let ancestorCmdNames = '';\n for (\n let ancestorCmd = cmd.parent;\n ancestorCmd;\n ancestorCmd = ancestorCmd.parent\n ) {\n ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames;\n }\n return ancestorCmdNames + cmdName + ' ' + cmd.usage();\n }\n\n /**\n * Get the description for the command.\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n commandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.description();\n }\n\n /**\n * Get the subcommand summary to show in the list of subcommands.\n * (Fallback to description for backwards compatibility.)\n *\n * @param {Command} cmd\n * @returns {string}\n */\n\n subcommandDescription(cmd) {\n // @ts-ignore: because overloaded return type\n return cmd.summary() || cmd.description();\n }\n\n /**\n * Get the option description to show in the list of options.\n *\n * @param {Option} option\n * @return {string}\n */\n\n optionDescription(option) {\n const extraInfo = [];\n\n if (option.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (option.defaultValue !== undefined) {\n // default for boolean and negated more for programmer than end user,\n // but show true/false for boolean option as may be for hand-rolled env or config processing.\n const showDefault =\n option.required ||\n option.optional ||\n (option.isBoolean() && typeof option.defaultValue === 'boolean');\n if (showDefault) {\n extraInfo.push(\n `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`,\n );\n }\n }\n // preset for boolean and negated are more for programmer than end user\n if (option.presetArg !== undefined && option.optional) {\n extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);\n }\n if (option.envVar !== undefined) {\n extraInfo.push(`env: ${option.envVar}`);\n }\n if (extraInfo.length > 0) {\n return `${option.description} (${extraInfo.join(', ')})`;\n }\n\n return option.description;\n }\n\n /**\n * Get the argument description to show in the list of arguments.\n *\n * @param {Argument} argument\n * @return {string}\n */\n\n argumentDescription(argument) {\n const extraInfo = [];\n if (argument.argChoices) {\n extraInfo.push(\n // use stringify to match the display of the default value\n `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`,\n );\n }\n if (argument.defaultValue !== undefined) {\n extraInfo.push(\n `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`,\n );\n }\n if (extraInfo.length > 0) {\n const extraDescripton = `(${extraInfo.join(', ')})`;\n if (argument.description) {\n return `${argument.description} ${extraDescripton}`;\n }\n return extraDescripton;\n }\n return argument.description;\n }\n\n /**\n * Generate the built-in help text.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {string}\n */\n\n formatHelp(cmd, helper) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term, description) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.wrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`Usage: ${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.wrap(commandDescription, helpWidth, 0),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat(['Arguments:', formatList(argumentList), '']);\n }\n\n // Options\n const optionList = helper.visibleOptions(cmd).map((option) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat(['Options:', formatList(optionList), '']);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = helper\n .visibleGlobalOptions(cmd)\n .map((option) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n 'Global Options:',\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat(['Commands:', formatList(commandList), '']);\n }\n\n return output.join('\\n');\n }\n\n /**\n * Calculate the pad width from the maximum term length.\n *\n * @param {Command} cmd\n * @param {Help} helper\n * @returns {number}\n */\n\n padWidth(cmd, helper) {\n return Math.max(\n helper.longestOptionTermLength(cmd, helper),\n helper.longestGlobalOptionTermLength(cmd, helper),\n helper.longestSubcommandTermLength(cmd, helper),\n helper.longestArgumentTermLength(cmd, helper),\n );\n }\n\n /**\n * Wrap the given string to width characters per line, with lines after the first indented.\n * Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted.\n *\n * @param {string} str\n * @param {number} width\n * @param {number} indent\n * @param {number} [minColumnWidth=40]\n * @return {string}\n *\n */\n\n wrap(str, width, indent, minColumnWidth = 40) {\n // Full \\s characters, minus the linefeeds.\n const indents =\n ' \\\\f\\\\t\\\\v\\u00a0\\u1680\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff';\n // Detect manually wrapped and indented strings by searching for line break followed by spaces.\n const manualIndent = new RegExp(`[\\\\n][${indents}]+`);\n if (str.match(manualIndent)) return str;\n // Do not wrap if not enough room for a wrapped column of text (as could end up with a word per line).\n const columnWidth = width - indent;\n if (columnWidth < minColumnWidth) return str;\n\n const leadingStr = str.slice(0, indent);\n const columnText = str.slice(indent).replace('\\r\\n', '\\n');\n const indentString = ' '.repeat(indent);\n const zeroWidthSpace = '\\u200B';\n const breaks = `\\\\s${zeroWidthSpace}`;\n // Match line end (so empty lines don't collapse),\n // or as much text as will fit in column, or excess text up to first break.\n const regex = new RegExp(\n `\\n|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`,\n 'g',\n );\n const lines = columnText.match(regex) || [];\n return (\n leadingStr +\n lines\n .map((line, i) => {\n if (line === '\\n') return ''; // preserve empty lines\n return (i > 0 ? indentString : '') + line.trimEnd();\n })\n .join('\\n')\n );\n }\n}\n\nexports.Help = Help;\n","const { InvalidArgumentError } = require('./error.js');\n\nclass Option {\n /**\n * Initialize a new `Option` with the given `flags` and `description`.\n *\n * @param {string} flags\n * @param {string} [description]\n */\n\n constructor(flags, description) {\n this.flags = flags;\n this.description = description || '';\n\n this.required = flags.includes('<'); // A value must be supplied when the option is specified.\n this.optional = flags.includes('['); // A value is optional when the option is specified.\n // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument\n this.variadic = /\\w\\.\\.\\.[>\\]]$/.test(flags); // The option can take multiple values.\n this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.\n const optionFlags = splitOptionFlags(flags);\n this.short = optionFlags.shortFlag;\n this.long = optionFlags.longFlag;\n this.negate = false;\n if (this.long) {\n this.negate = this.long.startsWith('--no-');\n }\n this.defaultValue = undefined;\n this.defaultValueDescription = undefined;\n this.presetArg = undefined;\n this.envVar = undefined;\n this.parseArg = undefined;\n this.hidden = false;\n this.argChoices = undefined;\n this.conflictsWith = [];\n this.implied = undefined;\n }\n\n /**\n * Set the default value, and optionally supply the description to be displayed in the help.\n *\n * @param {*} value\n * @param {string} [description]\n * @return {Option}\n */\n\n default(value, description) {\n this.defaultValue = value;\n this.defaultValueDescription = description;\n return this;\n }\n\n /**\n * Preset to use when option used without option-argument, especially optional but also boolean and negated.\n * The custom processing (parseArg) is called.\n *\n * @example\n * new Option('--color').default('GREYSCALE').preset('RGB');\n * new Option('--donate [amount]').preset('20').argParser(parseFloat);\n *\n * @param {*} arg\n * @return {Option}\n */\n\n preset(arg) {\n this.presetArg = arg;\n return this;\n }\n\n /**\n * Add option name(s) that conflict with this option.\n * An error will be displayed if conflicting options are found during parsing.\n *\n * @example\n * new Option('--rgb').conflicts('cmyk');\n * new Option('--js').conflicts(['ts', 'jsx']);\n *\n * @param {(string | string[])} names\n * @return {Option}\n */\n\n conflicts(names) {\n this.conflictsWith = this.conflictsWith.concat(names);\n return this;\n }\n\n /**\n * Specify implied option values for when this option is set and the implied options are not.\n *\n * The custom processing (parseArg) is not called on the implied values.\n *\n * @example\n * program\n * .addOption(new Option('--log', 'write logging information to file'))\n * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));\n *\n * @param {object} impliedOptionValues\n * @return {Option}\n */\n implies(impliedOptionValues) {\n let newImplied = impliedOptionValues;\n if (typeof impliedOptionValues === 'string') {\n // string is not documented, but easy mistake and we can do what user probably intended.\n newImplied = { [impliedOptionValues]: true };\n }\n this.implied = Object.assign(this.implied || {}, newImplied);\n return this;\n }\n\n /**\n * Set environment variable to check for option value.\n *\n * An environment variable is only used if when processed the current option value is\n * undefined, or the source of the current value is 'default' or 'config' or 'env'.\n *\n * @param {string} name\n * @return {Option}\n */\n\n env(name) {\n this.envVar = name;\n return this;\n }\n\n /**\n * Set the custom handler for processing CLI option arguments into option values.\n *\n * @param {Function} [fn]\n * @return {Option}\n */\n\n argParser(fn) {\n this.parseArg = fn;\n return this;\n }\n\n /**\n * Whether the option is mandatory and must have a value after parsing.\n *\n * @param {boolean} [mandatory=true]\n * @return {Option}\n */\n\n makeOptionMandatory(mandatory = true) {\n this.mandatory = !!mandatory;\n return this;\n }\n\n /**\n * Hide option in help.\n *\n * @param {boolean} [hide=true]\n * @return {Option}\n */\n\n hideHelp(hide = true) {\n this.hidden = !!hide;\n return this;\n }\n\n /**\n * @package\n */\n\n _concatValue(value, previous) {\n if (previous === this.defaultValue || !Array.isArray(previous)) {\n return [value];\n }\n\n return previous.concat(value);\n }\n\n /**\n * Only allow option value to be one of choices.\n *\n * @param {string[]} values\n * @return {Option}\n */\n\n choices(values) {\n this.argChoices = values.slice();\n this.parseArg = (arg, previous) => {\n if (!this.argChoices.includes(arg)) {\n throw new InvalidArgumentError(\n `Allowed choices are ${this.argChoices.join(', ')}.`,\n );\n }\n if (this.variadic) {\n return this._concatValue(arg, previous);\n }\n return arg;\n };\n return this;\n }\n\n /**\n * Return option name.\n *\n * @return {string}\n */\n\n name() {\n if (this.long) {\n return this.long.replace(/^--/, '');\n }\n return this.short.replace(/^-/, '');\n }\n\n /**\n * Return option name, in a camelcase format that can be used\n * as a object attribute key.\n *\n * @return {string}\n */\n\n attributeName() {\n return camelcase(this.name().replace(/^no-/, ''));\n }\n\n /**\n * Check if `arg` matches the short or long flag.\n *\n * @param {string} arg\n * @return {boolean}\n * @package\n */\n\n is(arg) {\n return this.short === arg || this.long === arg;\n }\n\n /**\n * Return whether a boolean option.\n *\n * Options are one of boolean, negated, required argument, or optional argument.\n *\n * @return {boolean}\n * @package\n */\n\n isBoolean() {\n return !this.required && !this.optional && !this.negate;\n }\n}\n\n/**\n * This class is to make it easier to work with dual options, without changing the existing\n * implementation. We support separate dual options for separate positive and negative options,\n * like `--build` and `--no-build`, which share a single option value. This works nicely for some\n * use cases, but is tricky for others where we want separate behaviours despite\n * the single shared option value.\n */\nclass DualOptions {\n /**\n * @param {Option[]} options\n */\n constructor(options) {\n this.positiveOptions = new Map();\n this.negativeOptions = new Map();\n this.dualOptions = new Set();\n options.forEach((option) => {\n if (option.negate) {\n this.negativeOptions.set(option.attributeName(), option);\n } else {\n this.positiveOptions.set(option.attributeName(), option);\n }\n });\n this.negativeOptions.forEach((value, key) => {\n if (this.positiveOptions.has(key)) {\n this.dualOptions.add(key);\n }\n });\n }\n\n /**\n * Did the value come from the option, and not from possible matching dual option?\n *\n * @param {*} value\n * @param {Option} option\n * @returns {boolean}\n */\n valueFromOption(value, option) {\n const optionKey = option.attributeName();\n if (!this.dualOptions.has(optionKey)) return true;\n\n // Use the value to deduce if (probably) came from the option.\n const preset = this.negativeOptions.get(optionKey).presetArg;\n const negativeValue = preset !== undefined ? preset : false;\n return option.negate === (negativeValue === value);\n }\n}\n\n/**\n * Convert string from kebab-case to camelCase.\n *\n * @param {string} str\n * @return {string}\n * @private\n */\n\nfunction camelcase(str) {\n return str.split('-').reduce((str, word) => {\n return str + word[0].toUpperCase() + word.slice(1);\n });\n}\n\n/**\n * Split the short and long flag out of something like '-m,--mixed <value>'\n *\n * @private\n */\n\nfunction splitOptionFlags(flags) {\n let shortFlag;\n let longFlag;\n // Use original very loose parsing to maintain backwards compatibility for now,\n // which allowed for example unintended `-sw, --short-word` [sic].\n const flagParts = flags.split(/[ |,]+/);\n if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))\n shortFlag = flagParts.shift();\n longFlag = flagParts.shift();\n // Add support for lone short flag without significantly changing parsing!\n if (!shortFlag && /^-[^-]$/.test(longFlag)) {\n shortFlag = longFlag;\n longFlag = undefined;\n }\n return { shortFlag, longFlag };\n}\n\nexports.Option = Option;\nexports.DualOptions = DualOptions;\n","const maxDistance = 3;\n\nfunction editDistance(a, b) {\n // https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance\n // Calculating optimal string alignment distance, no substring is edited more than once.\n // (Simple implementation.)\n\n // Quick early exit, return worst case.\n if (Math.abs(a.length - b.length) > maxDistance)\n return Math.max(a.length, b.length);\n\n // distance between prefix substrings of a and b\n const d = [];\n\n // pure deletions turn a into empty string\n for (let i = 0; i <= a.length; i++) {\n d[i] = [i];\n }\n // pure insertions turn empty string into b\n for (let j = 0; j <= b.length; j++) {\n d[0][j] = j;\n }\n\n // fill matrix\n for (let j = 1; j <= b.length; j++) {\n for (let i = 1; i <= a.length; i++) {\n let cost = 1;\n if (a[i - 1] === b[j - 1]) {\n cost = 0;\n } else {\n cost = 1;\n }\n d[i][j] = Math.min(\n d[i - 1][j] + 1, // deletion\n d[i][j - 1] + 1, // insertion\n d[i - 1][j - 1] + cost, // substitution\n );\n // transposition\n if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {\n d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);\n }\n }\n }\n\n return d[a.length][b.length];\n}\n\n/**\n * Find close matches, restricted to same number of edits.\n *\n * @param {string} word\n * @param {string[]} candidates\n * @returns {string}\n */\n\nfunction suggestSimilar(word, candidates) {\n if (!candidates || candidates.length === 0) return '';\n // remove possible duplicates\n candidates = Array.from(new Set(candidates));\n\n const searchingOptions = word.startsWith('--');\n if (searchingOptions) {\n word = word.slice(2);\n candidates = candidates.map((candidate) => candidate.slice(2));\n }\n\n let similar = [];\n let bestDistance = maxDistance;\n const minSimilarity = 0.4;\n candidates.forEach((candidate) => {\n if (candidate.length <= 1) return; // no one character guesses\n\n const distance = editDistance(word, candidate);\n const length = Math.max(word.length, candidate.length);\n const similarity = (length - distance) / length;\n if (similarity > minSimilarity) {\n if (distance < bestDistance) {\n // better edit distance, throw away previous worse matches\n bestDistance = distance;\n similar = [candidate];\n } else if (distance === bestDistance) {\n similar.push(candidate);\n }\n }\n });\n\n similar.sort((a, b) => a.localeCompare(b));\n if (searchingOptions) {\n similar = similar.map((candidate) => `--${candidate}`);\n }\n\n if (similar.length > 1) {\n return `\\n(Did you mean one of ${similar.join(', ')}?)`;\n }\n if (similar.length === 1) {\n return `\\n(Did you mean ${similar[0]}?)`;\n }\n return '';\n}\n\nexports.suggestSimilar = suggestSimilar;\n","import { program, Option } from \"commander\";\nimport { EsmPackagesFile, getESMPackages } from \"../operations\";\nimport { getYarnInfoPackageGraph, PackageGraph } from \"../packageGraphs\";\nimport { writeFileSync } from \"fs\";\n\nprogram\n\t.addOption(\n\t\tnew Option(\n\t\t\t\"-p, --pkgManager <pkgManager>\",\n\t\t\t\"The package manager that you are running under - will be used to resolve modules\",\n\t\t)\n\t\t\t.choices([\"yarnv2+\"])\n\t\t\t.makeOptionMandatory(),\n\t)\n\t.addOption(\n\t\tnew Option(\"-o, --output <output>\", \"How to output the package info\")\n\t\t\t.choices([\"json\", \"console\", \"none\"])\n\t\t\t.default(\"console\", \"writes each package to the a line\"),\n\t)\n\t.option(\"--cwd <cwd>\")\n\t.option(\n\t\t\"-r, --recurse\",\n\t\t\"get all dependencies and not just direct ones\",\n\t\tfalse,\n\t)\n\t.option(\"-f, --file <file>\", \"the file to output json to\")\n\t.option(\"-q, --quiet\", \"if we should not output any values\", false);\n\nconst options = program.parse(process.argv).opts<CliOpts>();\n\ninterface CliOpts {\n\tpkgManager: \"yarnv2+\" | \"npm\";\n\tcwd?: string;\n\trecurse: boolean;\n\toutput: \"console\" | \"json\";\n\tfile?: string;\n\tquiet: boolean;\n}\n\nasync function main(options: CliOpts) {\n\tconst {\n\t\tpkgManager,\n\t\tcwd = process.cwd(),\n\t\trecurse,\n\t\toutput,\n\t\tfile,\n\t\tquiet,\n\t} = options;\n\tlet packageGraph: PackageGraph;\n\tswitch (pkgManager) {\n\t\tcase \"yarnv2+\":\n\t\t\tpackageGraph = await getYarnInfoPackageGraph(cwd, recurse);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t\"Unimplemented package manager GetPackagesGraphFn mapping!\",\n\t\t\t);\n\t}\n\tpackageGraph.validate();\n\n\tconst packages = (await getESMPackages(packageGraph)).sort();\n\n\tif (!quiet) {\n\t\tswitch (output) {\n\t\t\tcase \"json\":\n\t\t\t\tconsole.log(JSON.stringify(packages));\n\t\t\t\tbreak;\n\t\t\tcase \"console\":\n\t\t\t\tconsole.log(packages.join(\"\\n\"));\n\t\t}\n\t}\n\n\tif (file) {\n\t\twriteESMModuleOutput(packages, file);\n\t}\n}\n\nexport function writeESMModuleOutput(packages: string[], file: string) {\n\twriteFileSync(\n\t\tfile,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\tdescription: `This is a programmatically created file via ${process.argv.join(\" \")}`,\n\t\t\t\tpackages: packages,\n\t\t\t} as EsmPackagesFile,\n\t\t\tnull,\n\t\t\t4,\n\t\t),\n\t);\n}\n\nvoid main(options)\n\t.then(() => {\n\t\tprocess.exit();\n\t})\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(5);\n\t});\n"],"names":["module","pathRootRegex","filepath","TypeError","match","Cache","Object","makeCache","cache","key","value","pnp","resolvePackagePath","__importDefault","mod","path_1","resolve_package_path_1","rethrow_unless_code_1","ALLOWED_ERROR_CODES","CacheGroup","getRealFilePath","getRealDirectoryPath","__findUpPackagePath","CACHE","FIND_UP_CACHE","error","_findUpPackagePath","baseDir","_cache","target","pkgPath","e","filePath","directoryPath","fs","path","pathRoot","ABSOLUTE_OR_RELATIVE_PATH_REGEX","PRESERVE_SYMLINKS","shouldPreserveSymlinks","process","_getRealFilePath","realFilePathCache","realPath","stat","_getRealDirectoryPath","realDirectoryPathCache","_findPackagePath","name","dir","fsRoot","currPath","endsWithNodeModules","caches","basedir","__dirname","absoluteStart","res","findUpCache","initialSearchDir","previous","maybePackageJsonPath","result","exports","maybeError","codes","code","allowed","includes","array","entry","i","getESMPackages","pkgGraph","packagePathsMap","resolvePackageJsons","currentNode","previousOptions","jsonPath","resolvePkgPath","pkgDir","pkgName","options","optionalDepsFromParent","isPatch","isRoot","_resolvepackagepath","_path","Error","pkgInfos","info","json","JSON","contents","_promises","Array","mods","p","infos","Set","createNodeModulesTransformIgnore","getJestNodeModulesTransformIgnore","file","extraExceptions","getModulesFromFile","esmModules","_fs","err","console","packageExceptions","Graph","nodeKey","node","nodeKeyStr","preStubbedNode","undefined","n","nkStr","existingNode","errors","k","visit","firstArrivalOnly","guestBook","noFrom","prevResult","stop","Promise","keySerializer","Map","PackageGraph","_Graph","getYarnInfoPackageGraph","recurse","query","_child_process","rootPkgJsonPath","getRootPackageJson","start","curDir","testPath","oneUp","rootPkgName","packageGraph","_PackageGraph","dedupSet","q","pkgInfo","version","parsePackage","nameKey","deps","pkgAndVersion","versionIdx","hashIdx","Argument","Command","CommanderError","InvalidArgumentError","Help","Option","flags","description","fn","values","arg","nameOutput","EventEmitter","childProcess","humanReadableArgName","DualOptions","suggestSimilar","str","write","sourceCommand","command","nameAndArgs","actionOptsOrExecDesc","execOpts","desc","opts","args","cmd","configuration","displayHelp","displaySuggestion","defaultValue","argument","names","detail","previousArgument","enableOrNameAndArgs","helpName","helpArgs","helpDescription","helpCommand","deprecatedDescription","event","listener","allowedValues","exitCode","message","expectedArgsCount","actionArgs","invalidArgumentMessage","option","matchingOption","matchingFlag","knownBy","alreadyUsed","existingCmd","newCmd","oname","positiveLongFlag","handleOptionValue","val","invalidValueMessage","valueSource","oldValue","config","RegExp","regex","def","m","parseArg","combine","allowUnknown","allowExcess","positional","passThrough","storeAsProperties","source","argv","parseOptions","userArgs","execArgv","subcommand","proc","launchWithNode","sourceExt","findFile","baseName","localBin","foundExt","ext","executableFile","executableDir","resolvedScriptPath","localFile","legacyName","incrementNodeInspectorPort","signals","signal","exitCallback","executableDirMessage","wrappedError","commandName","operands","unknown","promiseChain","subCommand","subcommandName","myParseArg","parsedValue","processedArgs","declaredArg","index","processed","v","promise","hooks","hookedCommand","callback","hookDetail","hook","parsed","checkForUnknownOptions","commandEvent","anOption","definedNonDefaultOptions","optionKey","optionsWithConflicting","conflictingAndDefined","defined","dest","maybeOption","activeVariadicOption","len","combinedOptions","errorOptions","dualHelper","hasCustomOptionValue","impliedKey","conflictingOption","findBestOptionFromValue","optionValue","negativeOption","positiveOption","getErrorMessage","bestOption","flag","suggestion","candidateFlags","moreFlags","receivedArgs","expected","forSubcommand","unknownName","candidateNames","versionOption","argsDescription","alias","matchingCommand","aliases","filename","contextOptions","helper","context","deprecatedCallback","helpInformation","Buffer","position","text","helpEvent","helpStr","helpOption","debugOption","debugHost","debugPort","parseInt","visibleCommands","a","b","getSortKey","visibleOptions","removeShort","removeLong","globalOptions","ancestorCmd","max","Math","cmdName","ancestorCmdNames","extraInfo","choice","extraDescripton","termWidth","helpWidth","formatItem","term","fullText","formatList","textArray","output","commandDescription","argumentList","optionList","globalOptionList","commandList","width","indent","minColumnWidth","manualIndent","columnWidth","leadingStr","columnText","indentString","breaks","lines","line","optionFlags","splitOptionFlags","shortFlag","longFlag","flagParts","impliedOptionValues","newImplied","mandatory","hide","camelcase","word","preset","negativeValue","candidates","searchingOptions","candidate","similar","bestDistance","distance","editDistance","d","j","cost","length","writeESMModuleOutput","packages","_commander","main","pkgManager","cwd","quiet","_packageGraphs","_operations"],"mappings":";yCASAA,CAAAA,EAAO,OAAO,CAAG,WAEf,MAAO,yDACT,C,mCCHA,IAAIC,EAAgB,EAAQ,IAE5BD,CAAAA,EAAO,OAAO,CAAG,SAASE,CAAQ,EAChC,GAAI,AAAoB,UAApB,OAAOA,EACT,MAAM,AAAIC,UAAU,qBAGtB,IAAIC,EAAQH,IAAgB,IAAI,CAACC,GACjC,GAAIE,EACF,OAAOA,CAAK,CAAC,EAAE,AAEnB,C,mCCnB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