check-node-types 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +192 -0
- package/dist/cli.mjs +2 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jan Paepke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# check-node-types 🔬
|
|
2
|
+
|
|
3
|
+
**Keep `@types/node` in sync with your actual Node.js target.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/check-node-types)
|
|
6
|
+
[](https://www.npmjs.com/package/check-node-types)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
[](https://github.com/janpaepke/check-node-types/blob/main/LICENSE)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## The Problem
|
|
14
|
+
|
|
15
|
+
`@types/node` major versions map directly to Node.js releases: `@types/node@22` provides types for Node.js 22.
|
|
16
|
+
If your project targets Node 20 but `@types/node` is `^22`, TypeScript will happily let you use Node 22 APIs that don't exist at runtime.
|
|
17
|
+
|
|
18
|
+
No existing linter, ESLint plugin, or package manager catches this drift. We searched. Extensively.
|
|
19
|
+
|
|
20
|
+
## Why Not Just…?
|
|
21
|
+
|
|
22
|
+
We evaluated every existing tool. None solve this.
|
|
23
|
+
|
|
24
|
+
| Tool | What it does | Why it's not enough |
|
|
25
|
+
| ----------------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
26
|
+
| **Dependabot** | Bumps `@types/node` to latest | [Cannot update `engines.node`](https://github.com/dependabot/dependabot-core/issues/1655). Will bump `@types/node` past your target. |
|
|
27
|
+
| **Renovate** | Can group `engines.node` + `@types/node` PRs | Groups updates but doesn't _verify_ the majors match. Drift still possible from manual edits. |
|
|
28
|
+
| **syncpack** | Enforces consistent versions across monorepos | Cannot cross-reference `engines` with `devDependencies`. |
|
|
29
|
+
| **npm-package-json-lint** | Validates package.json fields | Has `valid-values-engines` but no cross-field comparison with dependency versions. |
|
|
30
|
+
| **eslint-plugin-package-json** | Lints package.json | Has `require-engines` but nothing for dependency-to-engine consistency. |
|
|
31
|
+
| **ls-engines** | Checks dependency tree engine compatibility | Checks engine _requirements_, not `@types/node` alignment. |
|
|
32
|
+
| **check-engine** / **check-node-version** | Validates the running Node.js version | Checks the _runtime_, not the _type definitions_. |
|
|
33
|
+
| **@tsconfig/node** bases | Sets `target`/`module` for a Node version | Doesn't set or validate `@types/node`. Using `@tsconfig/node20` with `@types/node@24` produces no error. |
|
|
34
|
+
| **Shell one-liners** | Custom CI scripts | Work, but no standard solution — every team reinvents the wheel. |
|
|
35
|
+
|
|
36
|
+
The gap is well-documented: [DefinitelyTyped Discussion #69418](https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/69418) is the canonical thread where maintainers and users discuss the lack of tooling for this.
|
|
37
|
+
|
|
38
|
+
## The Recommended Workflow
|
|
39
|
+
|
|
40
|
+
`check-node-types` is designed as a **companion to [`check-node-version`](https://www.npmjs.com/package/check-node-version)**. Together they cover both sides of the Node.js version problem:
|
|
41
|
+
|
|
42
|
+
| Tool | What it checks |
|
|
43
|
+
| -------------------- | ------------------------------------------- |
|
|
44
|
+
| `check-node-version` | Is the **running** Node.js version correct? |
|
|
45
|
+
| `check-node-types` | Is the **`@types/node` version** correct? |
|
|
46
|
+
|
|
47
|
+
The recommended approach:
|
|
48
|
+
|
|
49
|
+
1. **Exclude `@types/node` from automated dependency updates** — tools like `npm-check-updates` or `npm-check` will always flag a new `@types/node` major as available, even when upgrading would be wrong for your project.
|
|
50
|
+
2. **Use `check-node-types` in CI or as a lint step** to verify that your `@types/node` stays in sync with your actual Node.js target.
|
|
51
|
+
3. **When you intentionally upgrade Node.js**, bump `@types/node` in the same commit.
|
|
52
|
+
|
|
53
|
+
This way you avoid the constant noise from update checkers, while still catching accidental drift.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install -D check-node-types
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or run directly:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx check-node-types
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Check using engines.node (default)
|
|
73
|
+
check-node-types
|
|
74
|
+
|
|
75
|
+
# Read Node.js version from different sources
|
|
76
|
+
check-node-types --source engines # reads engines.node from package.json (default)
|
|
77
|
+
check-node-types --source volta # reads volta.node from package.json
|
|
78
|
+
check-node-types --source nvmrc # reads .nvmrc file
|
|
79
|
+
check-node-types --source node-version # reads .node-version file
|
|
80
|
+
|
|
81
|
+
# Point to a specific package.json
|
|
82
|
+
check-node-types --package ./packages/my-lib/package.json
|
|
83
|
+
|
|
84
|
+
# Print detected versions and exit
|
|
85
|
+
check-node-types --print
|
|
86
|
+
|
|
87
|
+
# Quiet mode — only output on error
|
|
88
|
+
check-node-types -q
|
|
89
|
+
|
|
90
|
+
# JSON output (for CI parsing)
|
|
91
|
+
check-node-types --json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### As an npm script
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"scripts": {
|
|
99
|
+
"check-types": "check-node-types"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### In CI (GitHub Actions)
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
- name: Verify @types/node matches target Node.js version
|
|
108
|
+
run: npx check-node-types
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### In a Dockerfile
|
|
112
|
+
|
|
113
|
+
```dockerfile
|
|
114
|
+
# Validate before installing dependencies
|
|
115
|
+
COPY package.json ./
|
|
116
|
+
RUN npx -y check-node-types
|
|
117
|
+
RUN npm ci
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### With lint-staged / Husky
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"lint-staged": {
|
|
125
|
+
"package.json": ["check-node-types"]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Options
|
|
131
|
+
|
|
132
|
+
| Flag | Short | Description | Default |
|
|
133
|
+
| ------------------- | ----- | --------------------------------------------- | ---------------- |
|
|
134
|
+
| `--source <source>` | | Where to read the Node.js version (see below) | `engines` |
|
|
135
|
+
| `--package <path>` | | Path to package.json | `./package.json` |
|
|
136
|
+
| `--print` | | Print detected versions and exit | |
|
|
137
|
+
| `--quiet` | `-q` | Only output on error | |
|
|
138
|
+
| `--json` | | Output as JSON | |
|
|
139
|
+
| `--no-color` | | Disable colored output | auto-detect |
|
|
140
|
+
|
|
141
|
+
### Version Sources
|
|
142
|
+
|
|
143
|
+
| Source | Reads from |
|
|
144
|
+
| -------------- | ------------------------------------------------------ |
|
|
145
|
+
| `engines` | `engines.node` in package.json |
|
|
146
|
+
| `volta` | `volta.node` in package.json |
|
|
147
|
+
| `nvmrc` | `.nvmrc` file in same directory as package.json |
|
|
148
|
+
| `node-version` | `.node-version` file in same directory as package.json |
|
|
149
|
+
|
|
150
|
+
## Exit Codes
|
|
151
|
+
|
|
152
|
+
| Code | Meaning |
|
|
153
|
+
| ---- | -------------------------------------------------------------------------------- |
|
|
154
|
+
| `0` | Pass — versions match |
|
|
155
|
+
| `1` | Fail — major version mismatch |
|
|
156
|
+
| `2` | Warning — missing version source, missing `@types/node`, or unparseable versions |
|
|
157
|
+
|
|
158
|
+
## Example Output
|
|
159
|
+
|
|
160
|
+
**Pass:**
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
check-node-types: PASS
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Fail:**
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
check-node-types: FAIL
|
|
170
|
+
engines.node major: 20
|
|
171
|
+
@types/node major: 22
|
|
172
|
+
|
|
173
|
+
Fix: npm install -D @types/node@^20
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Print:**
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
engines.node: >=20 (major: 20)
|
|
180
|
+
@types/node: ^20.11.0 (major: 20)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## How It Works
|
|
184
|
+
|
|
185
|
+
1. Reads the target Node.js version from the configured source (default: `engines.node`)
|
|
186
|
+
2. Reads the `@types/node` version from `devDependencies` or `dependencies`
|
|
187
|
+
3. Compares the major versions
|
|
188
|
+
4. Reports the result with an actionable fix command on mismatch
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{readFileSync as e}from"node:fs";import{fileURLToPath as t}from"node:url";import{dirname as r,resolve as n}from"node:path";import{createRequire as s}from"node:module";function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o,a,l={},h={},u={};function c(){if(o)return u;o=1;class e extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}return u.CommanderError=e,u.InvalidArgumentError=class extends e{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}},u}function p(){if(a)return h;a=1;const{InvalidArgumentError:e}=c();return h.Argument=class{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(t){return this.argChoices=t.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},h.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"},h}var m={};const d=s(import.meta.url);const f=s(import.meta.url);const g=s(import.meta.url);const E=s(import.meta.url);const v=s(import.meta.url);var O,_={};function $(){if(O)return _;O=1;const{humanReadableArgName:e}=p();function t(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,"")}return _.Help=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){const t=e.commands.filter(e=>!e._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){const r=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){const t=e.options.filter(e=>!e.hidden),r=e._getHelpOption();if(r&&!r.hidden){const n=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);n||s?r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!n&&t.push(e.createOption(r.short,r.description)):t.push(r)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let r=e.parent;r;r=r.parent){const e=r.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(t){const r=t.registeredArguments.map(t=>e(t)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,r)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(r)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,r)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(r)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,r)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(r)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,r)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(r)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let t=e.parent;t;t=t.parent)r=t.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(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)}`)}return 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){const 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){const r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){const r=t.padWidth(e,t),n=t.helpWidth??80;function s(e,n){return t.formatItem(e,r,n,t)}let i=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""];const o=t.commandDescription(e);o.length>0&&(i=i.concat([t.boxWrap(t.styleCommandDescription(o),n),""]));const a=t.visibleArguments(e).map(e=>s(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));a.length>0&&(i=i.concat([t.styleTitle("Arguments:"),...a,""]));const l=t.visibleOptions(e).map(e=>s(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));if(l.length>0&&(i=i.concat([t.styleTitle("Options:"),...l,""])),t.showGlobalOptions){const r=t.visibleGlobalOptions(e).map(e=>s(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));r.length>0&&(i=i.concat([t.styleTitle("Global Options:"),...r,""]))}const h=t.visibleCommands(e).map(e=>s(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));return h.length>0&&(i=i.concat([t.styleTitle("Commands:"),...h,""])),i.join("\n")}displayWidth(e){return t(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(e=>"[options]"===e?this.styleOptionText(e):"[command]"===e?this.styleSubcommandText(e):"["===e[0]||"<"===e[0]?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(e=>"[options]"===e?this.styleOptionText(e):"["===e[0]||"<"===e[0]?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,n){const s=" ".repeat(2);if(!r)return s+e;const i=e.padEnd(t+e.length-n.displayWidth(e)),o=(this.helpWidth??80)-t-2-2;let a;if(o<this.minWidthToWrap||n.preformatted(r))a=r;else{a=n.boxWrap(r,o).replace(/\n/g,"\n"+" ".repeat(t+2))}return s+i+" ".repeat(2)+a.replace(/\n/g,`\n${s}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;const r=e.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return r.forEach(e=>{const r=e.match(n);if(null===r)return void s.push("");let i=[r.shift()],o=this.displayWidth(i[0]);r.forEach(e=>{const r=this.displayWidth(e);if(o+r<=t)return i.push(e),void(o+=r);s.push(i.join(""));const n=e.trimStart();i=[n],o=this.displayWidth(n)}),s.push(i.join(""))}),s.join("\n")}},_.stripColor=t,_}var A,b={};function C(){if(A)return b;A=1;const{InvalidArgumentError:e}=c();function t(e){return e.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}return b.Option=class{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;const r=function(e){let t,r;const n=/^-[^-]$/,s=/^--[^-]/,i=e.split(/[ |,]+/).concat("guard");n.test(i[0])&&(t=i.shift());s.test(i[0])&&(r=i.shift());!t&&n.test(i[0])&&(t=i.shift());!t&&s.test(i[0])&&(t=r,r=i.shift());if(i[0].startsWith("-")){const t=i[0],r=`option creation failed due to '${t}' in option flags '${e}'`;if(/^-[^-][^-]/.test(t))throw new Error(`${r}\n- a short flag is a single dash and a single character\n - either use a single dash and a single character (for a short flag)\n - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(n.test(t))throw new Error(`${r}\n- too many short flags`);if(s.test(t))throw new Error(`${r}\n- too many long flags`);throw new Error(`${r}\n- unrecognised flag format`)}if(void 0===t&&void 0===r)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}(e);this.short=r.shortFlag,this.long=r.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(t){return this.argChoices=t.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,r):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?t(this.name().replace(/^no-/,"")):t(this.name())}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},b.DualOptions=class{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){const r=t.attributeName();if(!this.dualOptions.has(r))return!0;const n=this.negativeOptions.get(r).presetArg,s=void 0!==n&&n;return t.negate===(s===e)}},b}var w,y,I,R={};function T(){if(w)return R;w=1;return R.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));const r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let n=[],s=3;return t.forEach(t=>{if(t.length<=1)return;const r=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);const r=[];for(let t=0;t<=e.length;t++)r[t]=[t];for(let e=0;e<=t.length;e++)r[0][e]=e;for(let n=1;n<=t.length;n++)for(let s=1;s<=e.length;s++){let i=1;i=e[s-1]===t[n-1]?0:1,r[s][n]=Math.min(r[s-1][n]+1,r[s][n-1]+1,r[s-1][n-1]+i),s>1&&n>1&&e[s-1]===t[n-2]&&e[s-2]===t[n-1]&&(r[s][n]=Math.min(r[s][n],r[s-2][n-2]+1))}return r[e.length][t.length]}(e,t),i=Math.max(e.length,t.length);(i-r)/i>.4&&(r<s?(s=r,n=[t]):r===s&&n.push(t))}),n.sort((e,t)=>e.localeCompare(t)),r&&(n=n.map(e=>`--${e}`)),n.length>1?`\n(Did you mean one of ${n.join(", ")}?)`:1===n.length?`\n(Did you mean ${n[0]}?)`:""},R}function N(){if(y)return m;y=1;const e=d("node:events").EventEmitter,t=f("node:child_process"),r=g("node:path"),n=E("node:fs"),s=v("node:process"),{Argument:i,humanReadableArgName:o}=p(),{CommanderError:a}=c(),{Help:l,stripColor:h}=$(),{Option:u,DualOptions:O}=C(),{suggestSimilar:_}=T();class A extends e{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:e=>s.stdout.write(e),writeErr:e=>s.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>s.stdout.isTTY?s.stdout.columns:void 0,getErrHelpWidth:()=>s.stderr.isTTY?s.stderr.columns:void 0,getOutHasColors:()=>w()??(s.stdout.isTTY&&s.stdout.hasColors?.()),getErrHasColors:()=>w()??(s.stderr.isTTY&&s.stderr.hasColors?.()),stripColor:e=>h(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(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let n=t,s=r;"object"==typeof n&&null!==n&&(s=n,n=null),s=s||{};const[,i,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(i);return n&&(a.description(n),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!s.noHelp&&!s.hidden),a._executableFile=s.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new A(e)}createHelp(){return Object.assign(new l,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 new Error("Command passed to .addCommand() must have a name\n- 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 i(e,t)}argument(e,t,r,n){const s=this.createArgument(e,t);return"function"==typeof r?s.default(n).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new 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;e=e??"help [command]";const[,r,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",i=this.createCommand(r);return i.helpOption(!1),n&&i.arguments(n),s&&i.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=i,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){const r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new a(e,t,r)),s.exit(e)}action(e){return this._actionHandler=t=>{const r=this.registeredArguments.length,n=t.slice(0,r);return this._storeOptionsAsProperties?n[r]=this:n[r]=this.opts(),n.push(this),e.apply(this,n)},this}createOption(e,t){return new u(e,t)}_callParseArg(e,t,r,n){try{return e.parseArg(t,r)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),r=t(e).find(e=>this._findCommand(e));if(r){const n=t(this._findCommand(r)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),r=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(r,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(r,e.defaultValue,"default");const n=(t,n,s)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const i=this.getOptionValue(r);null!==t&&e.parseArg?t=this._callParseArg(e,t,i,n):null!==t&&e.variadic&&(t=e._concatValue(t,i)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(r,t,s)};return this.on("option:"+t,t=>{const r=`error: option '${e.flags}' argument '${t}' is invalid.`;n(t,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;n(t,r,"env")}),this}_optionEx(e,t,r,n,s){if("object"==typeof t&&t instanceof u)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(t,r);if(i.makeOptionMandatory(!!e.mandatory),"function"==typeof n)i.default(s).argParser(n);else if(n instanceof RegExp){const e=n;n=(t,r)=>{const n=e.exec(t);return n?n[0]:r},i.default(s).argParser(n)}else i.default(n);return this.addOption(i)}option(e,t,r,n){return this._optionEx({},e,t,r,n)}requiredOption(e,t,r,n){return this._optionEx({mandatory:!0},e,t,r,n)}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 new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new 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,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(r=>{void 0!==r.getOptionValueSource(e)&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){s.versions?.electron&&(t.from="electron");const e=s.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let r;switch(void 0===e&&(e=s.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":s.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){this._prepareForParse();const r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){this._prepareForParse();const r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_prepareForParse(){null===this._savedState?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error("Can not call parse again when storeOptionsAsProperties is true.\n- either make a new Command for each call to parse, or stop storing options as properties");this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,r){if(n.existsSync(e))return;throw new Error(`'${e}' does not exist\n - if '${r}' 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 - ${t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory"}`)}_executeSubCommand(e,i){i=i.slice();let o=!1;const l=[".js",".ts",".tsx",".mjs",".cjs"];function h(e,t){const s=r.resolve(e,t);if(n.existsSync(s))return s;if(l.includes(r.extname(t)))return;const i=l.find(e=>n.existsSync(`${s}${e}`));return i?`${s}${i}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u,c=e._executableFile||`${this._name}-${e._name}`,p=this._executableDir||"";if(this._scriptPath){let e;try{e=n.realpathSync(this._scriptPath)}catch{e=this._scriptPath}p=r.resolve(r.dirname(e),p)}if(p){let t=h(p,c);if(!t&&!e._executableFile&&this._scriptPath){const n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=h(p,`${n}-${e._name}`))}c=t||c}if(o=l.includes(r.extname(c)),"win32"!==s.platform?o?(i.unshift(c),i=b(s.execArgv).concat(i),u=t.spawn(s.argv[0],i,{stdio:"inherit"})):u=t.spawn(c,i,{stdio:"inherit"}):(this._checkForMissingExecutable(c,p,e._name),i.unshift(c),i=b(s.execArgv).concat(i),u=t.spawn(s.execPath,i,{stdio:"inherit"})),!u.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{s.on(e,()=>{!1===u.killed&&null===u.exitCode&&u.kill(e)})})}const m=this._exitCallback;u.on("close",e=>{e=e??1,m?m(new a(e,"commander.executeSubCommandAsync","(close)")):s.exit(e)}),u.on("error",t=>{if("ENOENT"===t.code)this._checkForMissingExecutable(c,p,e._name);else if("EACCES"===t.code)throw new Error(`'${c}' not executable`);if(m){const e=new a(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,m(e)}else s.exit(1)}),this.runningCommand=u}_dispatchSubcommand(e,t,r){const n=this._findCommand(e);let s;return n||this.help({error:!0}),n._prepareForParse(),s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(!n._executableHandler)return n._parseCommand(t,r);this._executeSubCommand(n,t.concat(r))}),s}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){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(){const e=(e,t,r)=>{let n=t;if(null!==t&&e.parseArg){const s=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;n=this._callParseArg(e,t,r,s)}return n};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((r,n)=>{let s=r.defaultValue;r.variadic?n<this.args.length?(s=this.args.slice(n),r.parseArg&&(s=s.reduce((t,n)=>e(r,n,t),r.defaultValue))):void 0===s&&(s=[]):n<this.args.length&&(s=this.args[n],r.parseArg&&(s=e(r,s,r.defaultValue))),t[n]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e;const n=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{n.push({hookedCommand:e,callback:t})})}),"postAction"===t&&n.reverse(),n.forEach(e=>{r=this._chainOrCall(r,()=>e.callback(e.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let n=e;return void 0!==this._lifeCycleHooks[r]&&this._lifeCycleHooks[r].forEach(e=>{n=this._chainOrCall(n,()=>e(this,t))}),n}_parseCommand(e,t){const r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.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(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const n=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){let r;return n(),this._processArguments(),r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,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():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),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(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)}),t=e.filter(e=>e.conflictsWith.length>0);t.forEach(t=>{const r=e.find(e=>t.conflictsWith.includes(e.attributeName()));r&&this._conflictingOption(t,r)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],r=[];let n=t;const s=e.slice();function i(e){return e.length>1&&"-"===e[0]}let o=null;for(;s.length;){const e=s.shift();if("--"===e){n===r&&n.push(e),n.push(...s);break}if(!o||i(e)){if(o=null,i(e)){const t=this._findOption(e);if(t){if(t.required){const e=s.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;s.length>0&&!i(s[0])&&(e=s.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]){const 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()}`),s.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(i(e)&&(n=r),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===r.length){if(this._findCommand(e)){t.push(e),s.length>0&&r.push(...s);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),s.length>0&&t.push(...s);break}if(this._defaultCommandName){r.push(e),s.length>0&&r.push(...s);break}}if(this._passThroughOptions){n.push(e),s.length>0&&n.push(...s);break}n.push(e)}else this.emit(`option:${o.name()}`,e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let r=0;r<t;r++){const t=this.options[r].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}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const r=t||{},n=r.exitCode||1,s=r.code||"commander.error";this._exit(n,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in s.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,s.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new O(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(r=>void 0!==r.implied&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const r=e=>{const t=e.attributeName(),r=this.getOptionValue(t),n=this.options.find(e=>e.negate&&t===e.attributeName()),s=this.options.find(e=>!e.negate&&t===e.attributeName());return n&&(void 0===n.presetArg&&!1===r||void 0!==n.presetArg&&r===n.presetArg)?n:s||e},n=e=>{const t=r(e),n=t.attributeName();return"env"===this.getOptionValueSource(n)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],n=this;do{const e=n.createHelp().visibleOptions(n).filter(e=>e.long).map(e=>e.long);r=r.concat(e),n=n.parent}while(n&&!n._enablePositionalOptions);t=_(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,r=1===t?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const r=[];this.createHelp().visibleCommands(this).forEach(e=>{r.push(e.name()),e.alias()&&r.push(e.alias())}),t=_(e,r)}const r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";const n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),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 new Error("Command alias can't be the same as its name");const r=this.parent?._findCommand(e);if(r){const t=[r.name()].concat(r.aliases()).join("|");throw new 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;const e=this.registeredArguments.map(e=>o(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=r.basename(e,r.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});const n=t.formatHelp(this,t);return r.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(e){const t=!!(e=e||{}).error;let r,n,s;t?(r=e=>this._outputConfiguration.writeErr(e),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=e=>this._outputConfiguration.writeOut(e),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth());return{error:t,write:e=>(n||(e=this._outputConfiguration.stripColor(e)),r(e)),hasColors:n,helpWidth:s}}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const r=this._getOutputContext(e),n={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:r.error});if(t&&(s=t(s),"string"!=typeof s&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",n))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0: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=Number(s.exitCode??0);0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${r.join("', '")}'`);const n=`${e}Help`;return this.on(n,e=>{let r;r="function"==typeof t?t({error:e.error,command:e.command}):t,r&&e.write(`${r}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function b(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r,n="127.0.0.1",s="9229";return null!==(r=e.match(/^(--inspect(-brk)?)$/))?t=r[1]:null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=r[1],/^\d+$/.test(r[3])?s=r[3]:n=r[3]):null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=r[1],n=r[3],s=r[4]),t&&"0"!==s?`${t}=${n}:${parseInt(s)+1}`:e})}function w(){return!s.env.NO_COLOR&&"0"!==s.env.FORCE_COLOR&&"false"!==s.env.FORCE_COLOR&&(!(!s.env.FORCE_COLOR&&void 0===s.env.CLICOLOR_FORCE)||void 0)}return m.Command=A,m.useColor=w,m}var S=function(){if(I)return l;I=1;const{Argument:e}=p(),{Command:t}=N(),{CommanderError:r,InvalidArgumentError:n}=c(),{Help:s}=$(),{Option:i}=C();return l.program=new t,l.createCommand=e=>new t(e),l.createOption=(e,t)=>new i(e,t),l.createArgument=(t,r)=>new e(t,r),l.Command=t,l.Option=i,l.Argument=e,l.Help=s,l.CommanderError=r,l.InvalidArgumentError=n,l.InvalidOptionArgumentError=n,l}(),L=i(S);const{program:x,createCommand:P,createArgument:j,createOption:k,CommanderError:V,InvalidArgumentError:D,InvalidOptionArgumentError:H,Command:M,Argument:F,Option:G,Help:W}=L;var U,B,X,q,Y,J,z,Z,K,Q,ee,te,re,ne,se,ie,oe,ae,le,he,ue,ce,pe,me,de,fe,ge,Ee,ve,Oe,_e,$e,Ae,be,Ce,we,ye,Ie,Re,Te,Ne,Se,Le,xe,Pe,je,ke,Ve,De,He,Me,Fe,Ge,We,Ue,Be,Xe,qe,Ye,Je,ze,Ze,Ke,Qe,et,tt,rt,nt,st,it,ot,at,lt,ht,ut,ct,pt,mt,dt,ft,gt,Et,vt,Ot,_t,$t,At,bt,Ct,wt={exports:{}};function yt(){if(B)return U;B=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return U={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}function It(){if(q)return X;q=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return X=e}function Rt(){return Y||(Y=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=yt(),i=It(),o=(t=e.exports={}).re=[],a=t.safeRe=[],l=t.src=[],h=t.safeSrc=[],u=t.t={};let c=0;const p="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",s],[p,n]],d=(e,t,r)=>{const n=(e=>{for(const[t,r]of m)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=c++;i(e,s,t),u[e]=s,l[s]=t,h[s]=n,o[s]=new RegExp(t,r?"g":void 0),a[s]=new RegExp(n,r?"g":void 0)};d("NUMERICIDENTIFIER","0|[1-9]\\d*"),d("NUMERICIDENTIFIERLOOSE","\\d+"),d("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),d("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),d("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),d("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`),d("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`),d("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),d("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),d("BUILDIDENTIFIER",`${p}+`),d("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),d("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),d("FULL",`^${l[u.FULLPLAIN]}$`),d("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),d("LOOSE",`^${l[u.LOOSEPLAIN]}$`),d("GTLT","((?:<|>)?=?)"),d("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),d("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),d("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),d("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),d("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),d("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),d("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),d("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`),d("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?`+`(?:${l[u.BUILD]})?(?:$|[^\\d])`),d("COERCERTL",l[u.COERCE],!0),d("COERCERTLFULL",l[u.COERCEFULL],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",d("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),d("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),d("LONECARET","(?:\\^)"),d("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",d("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),d("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),d("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),d("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),d("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),d("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(wt,wt.exports)),wt.exports}function Tt(){if(z)return J;z=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return J=r=>r?"object"!=typeof r?e:r:t}function Nt(){if(K)return Z;K=1;const e=/^[0-9]+$/,t=(t,r)=>{if("number"==typeof t&&"number"==typeof r)return t===r?0:t<r?-1:1;const n=e.test(t),s=e.test(r);return n&&s&&(t=+t,r=+r),t===r?0:n&&!s?-1:s&&!n?1:t<r?-1:1};return Z={compareIdentifiers:t,rcompareIdentifiers:(e,r)=>t(r,e)}}function St(){if(ee)return Q;ee=1;const e=It(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=yt(),{safeRe:n,t:s}=Rt(),i=Tt(),{compareIdentifiers:o}=Nt();class a{constructor(o,l){if(l=i(l),o instanceof a){if(o.loose===!!l.loose&&o.includePrerelease===!!l.includePrerelease)return o;o=o.version}else if("string"!=typeof o)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",o,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const h=o.trim().match(l.loose?n[s.LOOSE]:n[s.FULL]);if(!h)throw new TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+h[1],this.minor=+h[2],this.patch=+h[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");h[4]?this.prerelease=h[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<r)return t}return e}):this.prerelease=[],this.build=h[5]?h[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],s=t.prerelease[r];if(e("prerelease compare",r,n,s),void 0===n&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===n)return-1;if(n!==s)return o(n,s)}while(++r)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let r=0;do{const n=this.build[r],s=t.build[r];if(e("build compare",r,n,s),void 0===n&&void 0===s)return 0;if(void 0===s)return 1;if(void 0===n)return-1;if(n!==s)return o(n,s)}while(++r)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?n[s.PRERELEASELOOSE]:n[s.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===o(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Q=a}function Lt(){if(re)return te;re=1;const e=St();return te=(t,r,n=!1)=>{if(t instanceof e)return t;try{return new e(t,r)}catch(e){if(!n)return null;throw e}}}function xt(){if(_e)return Oe;_e=1;const e=St();return Oe=(t,r,n)=>new e(t,n).compare(new e(r,n))}function Pt(){if(ye)return we;ye=1;const e=St();return we=(t,r,n)=>{const s=new e(t,n),i=new e(r,n);return s.compare(i)||s.compareBuild(i)}}function jt(){if(Le)return Se;Le=1;const e=xt();return Se=(t,r,n)=>e(t,r,n)>0}function kt(){if(Pe)return xe;Pe=1;const e=xt();return xe=(t,r,n)=>e(t,r,n)<0}function Vt(){if(ke)return je;ke=1;const e=xt();return je=(t,r,n)=>0===e(t,r,n)}function Dt(){if(De)return Ve;De=1;const e=xt();return Ve=(t,r,n)=>0!==e(t,r,n)}function Ht(){if(Me)return He;Me=1;const e=xt();return He=(t,r,n)=>e(t,r,n)>=0}function Mt(){if(Ge)return Fe;Ge=1;const e=xt();return Fe=(t,r,n)=>e(t,r,n)<=0}function Ft(){if(Ue)return We;Ue=1;const e=Vt(),t=Dt(),r=jt(),n=Ht(),s=kt(),i=Mt();return We=(o,a,l,h)=>{switch(a){case"===":return"object"==typeof o&&(o=o.version),"object"==typeof l&&(l=l.version),o===l;case"!==":return"object"==typeof o&&(o=o.version),"object"==typeof l&&(l=l.version),o!==l;case"":case"=":case"==":return e(o,l,h);case"!=":return t(o,l,h);case">":return r(o,l,h);case">=":return n(o,l,h);case"<":return s(o,l,h);case"<=":return i(o,l,h);default:throw new TypeError(`Invalid operator: ${a}`)}}}function Gt(){if(ze)return Je;ze=1;const e=/\s+/g;class t{constructor(r,i){if(i=n(i),r instanceof t)return r.loose===!!i.loose&&r.includePrerelease===!!i.includePrerelease?r:new t(r.raw,i);if(r instanceof s)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=r.trim().replace(e," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!d(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&f(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+":"+e,n=r.get(t);if(n)return n;const o=this.options.loose,f=o?a[l.HYPHENRANGELOOSE]:a[l.HYPHENRANGE];e=e.replace(f,I(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(a[l.COMPARATORTRIM],h),i("comparator trim",e),e=e.replace(a[l.TILDETRIM],u),i("tilde trim",e),e=e.replace(a[l.CARETTRIM],c),i("caret trim",e);let g=e.split(" ").map(e=>E(e,this.options)).join(" ").split(/\s+/).map(e=>y(e,this.options));o&&(g=g.filter(e=>(i("loose invalid filter",e,this.options),!!e.match(a[l.COMPARATORLOOSE])))),i("range list",g);const v=new Map,O=g.map(e=>new s(e,this.options));for(const e of O){if(d(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const _=[...v.values()];return r.set(t,_),_}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(t=>g(t,r)&&e.set.some(e=>g(e,r)&&t.every(t=>e.every(e=>t.intersects(e,r)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new o(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(R(this.set[t],e,this.options))return!0;return!1}}Je=t;const r=new(Ye?qe:(Ye=1,qe=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}})),n=Tt(),s=Wt(),i=It(),o=St(),{safeRe:a,t:l,comparatorTrimReplace:h,tildeTrimReplace:u,caretTrimReplace:c}=Rt(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=yt(),d=e=>"<0.0.0-0"===e.value,f=e=>""===e.value,g=(e,t)=>{let r=!0;const n=e.slice();let s=n.pop();for(;r&&n.length;)r=n.every(e=>s.intersects(e,t)),s=n.pop();return r},E=(e,t)=>(e=e.replace(a[l.BUILD],""),i("comp",e,t),e=$(e,t),i("caret",e),e=O(e,t),i("tildes",e),e=b(e,t),i("xrange",e),e=w(e,t),i("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,O=(e,t)=>e.trim().split(/\s+/).map(e=>_(e,t)).join(" "),_=(e,t)=>{const r=t.loose?a[l.TILDELOOSE]:a[l.TILDE];return e.replace(r,(t,r,n,s,o)=>{let a;return i("tilde",e,t,r,n,s,o),v(r)?a="":v(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:v(s)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(i("replaceTilde pr",o),a=`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${s} <${r}.${+n+1}.0-0`,i("tilde return",a),a})},$=(e,t)=>e.trim().split(/\s+/).map(e=>A(e,t)).join(" "),A=(e,t)=>{i("caret",e,t);const r=t.loose?a[l.CARETLOOSE]:a[l.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,s,o,a)=>{let l;return i("caret",e,t,r,s,o,a),v(r)?l="":v(s)?l=`>=${r}.0.0${n} <${+r+1}.0.0-0`:v(o)?l="0"===r?`>=${r}.${s}.0${n} <${r}.${+s+1}.0-0`:`>=${r}.${s}.0${n} <${+r+1}.0.0-0`:a?(i("replaceCaret pr",a),l="0"===r?"0"===s?`>=${r}.${s}.${o}-${a} <${r}.${s}.${+o+1}-0`:`>=${r}.${s}.${o}-${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${o}-${a} <${+r+1}.0.0-0`):(i("no pr"),l="0"===r?"0"===s?`>=${r}.${s}.${o}${n} <${r}.${s}.${+o+1}-0`:`>=${r}.${s}.${o}${n} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${o} <${+r+1}.0.0-0`),i("caret return",l),l})},b=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map(e=>C(e,t)).join(" ")),C=(e,t)=>{e=e.trim();const r=t.loose?a[l.XRANGELOOSE]:a[l.XRANGE];return e.replace(r,(r,n,s,o,a,l)=>{i("xRange",e,r,n,s,o,a,l);const h=v(s),u=h||v(o),c=u||v(a),p=c;return"="===n&&p&&(n=""),l=t.includePrerelease?"-0":"",h?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&p?(u&&(o=0),a=0,">"===n?(n=">=",u?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",u?s=+s+1:o=+o+1),"<"===n&&(l="-0"),r=`${n+s}.${o}.${a}${l}`):u?r=`>=${s}.0.0${l} <${+s+1}.0.0-0`:c&&(r=`>=${s}.${o}.0${l} <${s}.${+o+1}.0-0`),i("xRange return",r),r})},w=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[l.STAR],"")),y=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),I=e=>(t,r,n,s,i,o,a,l,h,u,c,p)=>`${r=v(n)?"":v(s)?`>=${n}.0.0${e?"-0":""}`:v(i)?`>=${n}.${s}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${l=v(h)?"":v(u)?`<${+h+1}.0.0-0`:v(c)?`<${h}.${+u+1}.0-0`:p?`<=${h}.${u}.${c}-${p}`:e?`<${h}.${u}.${+c+1}-0`:`<=${l}`}`.trim(),R=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(i(e[r].semver),e[r].semver!==s.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return Je}function Wt(){if(Ke)return Ze;Ke=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,s){if(s=r(s),n instanceof t){if(n.loose===!!s.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),o("comparator",n,s),this.options=s,this.loose=!!s.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(t){const r=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new a(i[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new a(t,this.options)}catch(e){return!1}return i(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,n).test(this.value):""===e.operator?""===e.value||new l(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(i(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(i(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Ze=t;const r=Tt(),{safeRe:n,t:s}=Rt(),i=Ft(),o=It(),a=St(),l=Gt();return Ze}function Ut(){if(et)return Qe;et=1;const e=Gt();return Qe=(t,r,n)=>{try{r=new e(r,n)}catch(e){return!1}return r.test(t)},Qe}function Bt(){if(ut)return ht;ut=1;const e=Gt();return ht=(t,r)=>{try{return new e(t,r).range||"*"}catch(e){return null}},ht}function Xt(){if(pt)return ct;pt=1;const e=St(),t=Wt(),{ANY:r}=t,n=Gt(),s=Ut(),i=jt(),o=kt(),a=Mt(),l=Ht();return ct=(h,u,c,p)=>{let m,d,f,g,E;switch(h=new e(h,p),u=new n(u,p),c){case">":m=i,d=a,f=o,g=">",E=">=";break;case"<":m=o,d=l,f=i,g="<",E="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(h,u,p))return!1;for(let e=0;e<u.set.length;++e){const n=u.set[e];let s=null,i=null;if(n.forEach(e=>{e.semver===r&&(e=new t(">=0.0.0")),s=s||e,i=i||e,m(e.semver,s.semver,p)?s=e:f(e.semver,i.semver,p)&&(i=e)}),s.operator===g||s.operator===E)return!1;if((!i.operator||i.operator===g)&&d(h,i.semver))return!1;if(i.operator===E&&f(h,i.semver))return!1}return!0},ct}var qt=function(){if(Ct)return bt;Ct=1;const e=Rt(),t=yt(),r=St(),n=Nt(),s=Lt(),i=function(){if(se)return ne;se=1;const e=Lt();return ne=(t,r)=>{const n=e(t,r);return n?n.version:null}}(),o=function(){if(oe)return ie;oe=1;const e=Lt();return ie=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null}}(),a=function(){if(le)return ae;le=1;const e=St();return ae=(t,r,n,s,i)=>{"string"==typeof n&&(i=s,s=n,n=void 0);try{return new e(t instanceof e?t.version:t,n).inc(r,s,i).version}catch(e){return null}}}(),l=function(){if(ue)return he;ue=1;const e=Lt();return he=(t,r)=>{const n=e(t,null,!0),s=e(r,null,!0),i=n.compare(s);if(0===i)return null;const o=i>0,a=o?n:s,l=o?s:n,h=!!a.prerelease.length;if(l.prerelease.length&&!h){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(a))return l.minor&&!l.patch?"minor":"patch"}const u=h?"pre":"";return n.major!==s.major?u+"major":n.minor!==s.minor?u+"minor":n.patch!==s.patch?u+"patch":"prerelease"}}(),h=function(){if(pe)return ce;pe=1;const e=St();return ce=(t,r)=>new e(t,r).major}(),u=function(){if(de)return me;de=1;const e=St();return me=(t,r)=>new e(t,r).minor}(),c=function(){if(ge)return fe;ge=1;const e=St();return fe=(t,r)=>new e(t,r).patch}(),p=function(){if(ve)return Ee;ve=1;const e=Lt();return Ee=(t,r)=>{const n=e(t,r);return n&&n.prerelease.length?n.prerelease:null}}(),m=xt(),d=function(){if(Ae)return $e;Ae=1;const e=xt();return $e=(t,r,n)=>e(r,t,n)}(),f=function(){if(Ce)return be;Ce=1;const e=xt();return be=(t,r)=>e(t,r,!0)}(),g=Pt(),E=function(){if(Re)return Ie;Re=1;const e=Pt();return Ie=(t,r)=>t.sort((t,n)=>e(t,n,r))}(),v=function(){if(Ne)return Te;Ne=1;const e=Pt();return Te=(t,r)=>t.sort((t,n)=>e(n,t,r))}(),O=jt(),_=kt(),$=Vt(),A=Dt(),b=Ht(),C=Mt(),w=Ft(),y=function(){if(Xe)return Be;Xe=1;const e=St(),t=Lt(),{safeRe:r,t:n}=Rt();return Be=(s,i)=>{if(s instanceof e)return s;if("number"==typeof s&&(s=String(s)),"string"!=typeof s)return null;let o=null;if((i=i||{}).rtl){const e=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let t;for(;(t=e.exec(s))&&(!o||o.index+o[0].length!==s.length);)o&&t.index+t[0].length===o.index+o[0].length||(o=t),e.lastIndex=t.index+t[1].length+t[2].length;e.lastIndex=-1}else o=s.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);if(null===o)return null;const a=o[2],l=o[3]||"0",h=o[4]||"0",u=i.includePrerelease&&o[5]?`-${o[5]}`:"",c=i.includePrerelease&&o[6]?`+${o[6]}`:"";return t(`${a}.${l}.${h}${u}${c}`,i)}}(),I=Wt(),R=Gt(),T=Ut(),N=function(){if(rt)return tt;rt=1;const e=Gt();return tt=(t,r)=>new e(t,r).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" ")),tt}(),S=function(){if(st)return nt;st=1;const e=St(),t=Gt();return nt=(r,n,s)=>{let i=null,o=null,a=null;try{a=new t(n,s)}catch(e){return null}return r.forEach(t=>{a.test(t)&&(i&&-1!==o.compare(t)||(i=t,o=new e(i,s)))}),i},nt}(),L=function(){if(ot)return it;ot=1;const e=St(),t=Gt();return it=(r,n,s)=>{let i=null,o=null,a=null;try{a=new t(n,s)}catch(e){return null}return r.forEach(t=>{a.test(t)&&(i&&1!==o.compare(t)||(i=t,o=new e(i,s)))}),i},it}(),x=function(){if(lt)return at;lt=1;const e=St(),t=Gt(),r=jt();return at=(n,s)=>{n=new t(n,s);let i=new e("0.0.0");if(n.test(i))return i;if(i=new e("0.0.0-0"),n.test(i))return i;i=null;for(let t=0;t<n.set.length;++t){const s=n.set[t];let o=null;s.forEach(t=>{const n=new e(t.semver.version);switch(t.operator){case">":0===n.prerelease.length?n.patch++:n.prerelease.push(0),n.raw=n.format();case"":case">=":o&&!r(n,o)||(o=n);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${t.operator}`)}}),!o||i&&!r(i,o)||(i=o)}return i&&n.test(i)?i:null},at}(),P=Bt(),j=Xt(),k=function(){if(dt)return mt;dt=1;const e=Xt();return mt=(t,r,n)=>e(t,r,">",n),mt}(),V=function(){if(gt)return ft;gt=1;const e=Xt();return ft=(t,r,n)=>e(t,r,"<",n),ft}(),D=function(){if(vt)return Et;vt=1;const e=Gt();return Et=(t,r,n)=>(t=new e(t,n),r=new e(r,n),t.intersects(r,n))}(),H=function(){if(_t)return Ot;_t=1;const e=Ut(),t=xt();return Ot=(r,n,s)=>{const i=[];let o=null,a=null;const l=r.sort((e,r)=>t(e,r,s));for(const t of l)e(t,n,s)?(a=t,o||(o=t)):(a&&i.push([o,a]),a=null,o=null);o&&i.push([o,null]);const h=[];for(const[e,t]of i)e===t?h.push(e):t||e!==l[0]?t?e===l[0]?h.push(`<=${t}`):h.push(`${e} - ${t}`):h.push(`>=${e}`):h.push("*");const u=h.join(" || "),c="string"==typeof n.raw?n.raw:String(n);return u.length<c.length?u:n},Ot}(),M=function(){if(At)return $t;At=1;const e=Gt(),t=Wt(),{ANY:r}=t,n=Ut(),s=xt(),i=[new t(">=0.0.0-0")],o=[new t(">=0.0.0")],a=(e,t,a)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===r){if(1===t.length&&t[0].semver===r)return!0;e=a.includePrerelease?i:o}if(1===t.length&&t[0].semver===r){if(a.includePrerelease)return!0;t=o}const u=new Set;let c,p,m,d,f,g,E;for(const t of e)">"===t.operator||">="===t.operator?c=l(c,t,a):"<"===t.operator||"<="===t.operator?p=h(p,t,a):u.add(t.semver);if(u.size>1)return null;if(c&&p){if(m=s(c.semver,p.semver,a),m>0)return null;if(0===m&&(">="!==c.operator||"<="!==p.operator))return null}for(const e of u){if(c&&!n(e,String(c),a))return null;if(p&&!n(e,String(p),a))return null;for(const r of t)if(!n(e,String(r),a))return!1;return!0}let v=!(!p||a.includePrerelease||!p.semver.prerelease.length)&&p.semver,O=!(!c||a.includePrerelease||!c.semver.prerelease.length)&&c.semver;v&&1===v.prerelease.length&&"<"===p.operator&&0===v.prerelease[0]&&(v=!1);for(const e of t){if(E=E||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,c)if(O&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===O.major&&e.semver.minor===O.minor&&e.semver.patch===O.patch&&(O=!1),">"===e.operator||">="===e.operator){if(d=l(c,e,a),d===e&&d!==c)return!1}else if(">="===c.operator&&!n(c.semver,String(e),a))return!1;if(p)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if(f=h(p,e,a),f===e&&f!==p)return!1}else if("<="===p.operator&&!n(p.semver,String(e),a))return!1;if(!e.operator&&(p||c)&&0!==m)return!1}return!(c&&g&&!p&&0!==m||p&&E&&!c&&0!==m||O||v)},l=(e,t,r)=>{if(!e)return t;const n=s(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},h=(e,t,r)=>{if(!e)return t;const n=s(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};return $t=(t,r,n={})=>{if(t===r)return!0;t=new e(t,n),r=new e(r,n);let s=!1;e:for(const e of t.set){for(const t of r.set){const r=a(e,t,n);if(s=s||null!==r,r)continue e}if(s)return!1}return!0}}();return bt={parse:s,valid:i,clean:o,inc:a,diff:l,major:h,minor:u,patch:c,prerelease:p,compare:m,rcompare:d,compareLoose:f,compareBuild:g,sort:E,rsort:v,gt:O,lt:_,eq:$,neq:A,gte:b,lte:C,cmp:w,coerce:y,Comparator:I,Range:R,satisfies:T,toComparators:N,maxSatisfying:S,minSatisfying:L,minVersion:x,validRange:P,outside:j,gtr:k,ltr:V,intersects:D,simplifyRange:H,subset:M,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}}(),Yt=i(qt);function Jt(e){try{const t=Yt.minVersion(e);if(t)return t.major}catch{}const t=Yt.coerce(e);return t?t.major:null}function zt(e){if("*"===e||"latest"===e)return null;const t=Yt.coerce(e);return t?t.major:null}const Zt={engines:"engines.node",volta:"volta.node",nvmrc:".nvmrc","node-version":".node-version"};function Kt(e){return Zt[e]}function Qt({packagePath:t,source:s}){const i=function(t,s){const i=r(t);switch(s){case"engines":case"volta":{let r;try{r=JSON.parse(e(t,"utf-8"))}catch{return{raw:null,major:null}}if("engines"===s){const e=r.engines,t=e?.node??null;return{raw:t,major:t?Jt(t):null}}{const e=r.volta,t=e?.node??null;return{raw:t,major:t?zt(t):null}}}case"nvmrc":case"node-version":{const t="nvmrc"===s?".nvmrc":".node-version";try{const r=e(n(i,t),"utf-8").trim();if(!r)return{raw:null,major:null};const s=r.startsWith("v")?r.slice(1):r;return{raw:r,major:zt(s)}}catch{return{raw:null,major:null}}}}}(t,s),o=Kt(s);let a=null,l=null;try{const r=JSON.parse(e(t,"utf-8")),n=r.devDependencies,s=r.dependencies;n?.["@types/node"]?(a=n["@types/node"],l="devDependencies"):s?.["@types/node"]&&(a=s["@types/node"],l="dependencies")}catch{return{status:"warn",source:s,nodeVersion:{raw:null,major:null},typesNode:{raw:null,major:null,location:null},message:`Could not read or parse ${t}`,fix:null}}const h=a?zt(a):null;return i.raw||a?i.raw?a?null===i.major?{status:"warn",source:s,nodeVersion:i,typesNode:{raw:a,major:h,location:l},message:`Could not parse version from ${o}: "${i.raw}"`,fix:null}:null===h?{status:"warn",source:s,nodeVersion:i,typesNode:{raw:a,major:null,location:l},message:`Could not parse major version from @types/node: "${a}"`,fix:null}:i.major===h?{status:"pass",source:s,nodeVersion:i,typesNode:{raw:a,major:h,location:l},message:`@types/node major (${h}) matches ${o} major (${i.major}).`,fix:null}:{status:"fail",source:s,nodeVersion:i,typesNode:{raw:a,major:h,location:l},message:`@types/node major (${h}) does not match ${o} major (${i.major}).`,fix:`npm install -D @types/node@^${i.major}`}:{status:"warn",source:s,nodeVersion:i,typesNode:{raw:null,major:null,location:null},message:"@types/node is not installed. Cannot verify compatibility.",fix:i.major?`npm install -D @types/node@^${i.major}`:null}:{status:"warn",source:s,nodeVersion:i,typesNode:{raw:a,major:h,location:l},message:`No ${o} found. Cannot verify @types/node compatibility.`,fix:"engines"===s?'Add "engines": { "node": ">=XX" } to your package.json.':null}:{status:"warn",source:s,nodeVersion:i,typesNode:{raw:null,major:null,location:null},message:`Neither ${o} nor @types/node found.`,fix:null}}const er=(e=0)=>t=>`[${t+e}m`,tr=(e=0)=>t=>`[${38+e};5;${t}m`,rr=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,nr={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(nr.modifier);Object.keys(nr.color),Object.keys(nr.bgColor);const sr=function(){const e=new Map;for(const[t,r]of Object.entries(nr)){for(const[t,n]of Object.entries(r))nr[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=nr[t],e.set(n[0],n[1]);Object.defineProperty(nr,t,{value:r,enumerable:!1})}return Object.defineProperty(nr,"codes",{value:e,enumerable:!1}),nr.color.close="[39m",nr.bgColor.close="[49m",nr.color.ansi=er(),nr.color.ansi256=tr(),nr.color.ansi16m=rr(),nr.bgColor.ansi=er(10),nr.bgColor.ansi256=tr(10),nr.bgColor.ansi16m=rr(10),Object.defineProperties(nr,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>nr.rgbToAnsi256(...nr.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const s=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(s/6)/5,n=s%6/5}const s=2*Math.max(t,r,n);if(0===s)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===s&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>nr.ansi256ToAnsi(nr.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>nr.ansi256ToAnsi(nr.hexToAnsi256(e)),enumerable:!1}}),nr}(),ir=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),or=0!==ir&&{level:ir},ar={stdout:or,stderr:or};function lr(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const s=t.length;let i=0,o="";do{o+=e.slice(i,n)+t+r,i=n+s,n=e.indexOf(t,i)}while(-1!==n);return o+=e.slice(i),o}const{stdout:hr,stderr:ur}=ar,cr=Symbol("GENERATOR"),pr=Symbol("STYLER"),mr=Symbol("IS_EMPTY"),dr=["ansi","ansi","ansi256","ansi16m"],fr=Object.create(null);class gr{constructor(e){return Er(e)}}const Er=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=hr?hr.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,vr.prototype),t};function vr(e){return Er(e)}Object.setPrototypeOf(vr.prototype,Function.prototype);for(const[e,t]of Object.entries(sr))fr[e]={get(){const r=br(this,Ar(t.open,t.close,this[pr]),this[mr]);return Object.defineProperty(this,e,{value:r}),r}};fr.visible={get(){const e=br(this,this[pr],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Or=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?sr[r].ansi16m(...n):"ansi256"===t?sr[r].ansi256(sr.rgbToAnsi256(...n)):sr[r].ansi(sr.rgbToAnsi(...n)):"hex"===e?Or("rgb",t,r,...sr.hexToRgb(...n)):sr[r][e](...n),_r=["rgb","hex","ansi256"];for(const e of _r){fr[e]={get(){const{level:t}=this;return function(...r){const n=Ar(Or(e,dr[t],"color",...r),sr.color.close,this[pr]);return br(this,n,this[mr])}}};fr["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=Ar(Or(e,dr[t],"bgColor",...r),sr.bgColor.close,this[pr]);return br(this,n,this[mr])}}}}const $r=Object.defineProperties(()=>{},{...fr,level:{enumerable:!0,get(){return this[cr].level},set(e){this[cr].level=e}}}),Ar=(e,t,r)=>{let n,s;return void 0===r?(n=e,s=t):(n=r.openAll+e,s=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:s,parent:r}},br=(e,t,r)=>{const n=(...e)=>Cr(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,$r),n[cr]=e,n[pr]=t,n[mr]=r,n},Cr=(e,t)=>{if(e.level<=0||!t)return e[mr]?"":t;let r=e[pr];if(void 0===r)return t;const{openAll:n,closeAll:s}=r;if(t.includes(""))for(;void 0!==r;)t=lr(t,r.close,r.open),r=r.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,r,n){let s=0,i="";do{const o="\r"===e[n-1];i+=e.slice(s,o?n-1:n)+t+(o?"\r\n":"\n")+r,s=n+1,n=e.indexOf("\n",s)}while(-1!==n);return i+=e.slice(s),i}(t,s,n,i)),n+t+s};Object.defineProperties(vr.prototype,fr);const wr=vr();vr({level:ur?ur.level:0});const yr=r(t(import.meta.url)),Ir=JSON.parse(e(n(yr,"../package.json"),"utf-8")),Rr=new M;Rr.name("check-node-types").description("Verify @types/node major version matches your target Node.js version").version(Ir.version).option("--source <source>","where to read Node.js version from (engines, volta, nvmrc, node-version)","engines").option("--package <path>","path to package.json",n(process.cwd(),"package.json")).option("--print","print detected versions and exit",!1).option("-q, --quiet","only output on error",!1).option("--json","output results as JSON",!1).option("--no-color","disable colored output").action(e=>{const t=["engines","volta","nvmrc","node-version"];t.includes(e.source)||(console.error(`Invalid source: "${e.source}". Must be one of: ${t.join(", ")}`),process.exit(2));const r=Qt({packagePath:n(e.package),source:e.source}),s=!1!==e.color&&!process.env.NO_COLOR,i={...e,color:s};if(e.json)console.log(function(e){return JSON.stringify(e,null,2)}(r));else{const e=function(e,t){const r=t.color?new gr({level:Math.max(1,wr.level)}):new gr({level:0}),n=Kt(e.source);if(t.print){const t=[];return t.push(`${n}: ${e.nodeVersion.raw??"not found"} ${null!==e.nodeVersion.major?r.dim(`(major: ${e.nodeVersion.major})`):""}`),t.push(`@types/node: ${e.typesNode.raw??"not found"} ${null!==e.typesNode.major?r.dim(`(major: ${e.typesNode.major})`):""}`),t.join("\n")}if(t.quiet&&"pass"===e.status)return"";const s=[],i="pass"===e.status?r.green("PASS"):"fail"===e.status?r.red("FAIL"):r.yellow("WARN");if(s.push(`${r.bold("check-node-types")}: ${i}`),"pass"===e.status)return s.join("\n");if("fail"===e.status){const t=`${n} major:`,i="@types/node major:",o=Math.max(t.length,i.length);s.push(` ${t.padEnd(o)} ${r.bold(String(e.nodeVersion.major))}`),s.push(` ${i.padEnd(o)} ${r.bold(String(e.typesNode.major))}`)}else"warn"===e.status&&s.push(` ${e.message}`);return e.fix&&(s.push(""),s.push(` Fix: ${r.bold(e.fix)}`)),s.join("\n")}(r,i);e&&console.log(e)}e.print&&!e.json&&process.exit(0);const o="pass"===r.status?0:"fail"===r.status?1:2;process.exit(o)}),Rr.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "check-node-types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Verify @types/node major version matches your engines.node minimum",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"check-node-types": "dist/cli.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rm -rf dist && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript && chmod +x dist/cli.mjs",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"check-types": "node dist/cli.mjs",
|
|
20
|
+
"prepublishOnly": "npm run build && npm run test && npm run check-types"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"typescript",
|
|
24
|
+
"node",
|
|
25
|
+
"types",
|
|
26
|
+
"check",
|
|
27
|
+
"engines",
|
|
28
|
+
"lint",
|
|
29
|
+
"cli"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"homepage": "https://github.com/janpaepke/check-node-types#readme",
|
|
33
|
+
"bugs": "https://github.com/janpaepke/check-node-types/issues",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/janpaepke/check-node-types.git"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
41
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
42
|
+
"@rollup/plugin-typescript": "^12.1.0",
|
|
43
|
+
"@types/node": "^20.0.0",
|
|
44
|
+
"@types/semver": "^7.5.0",
|
|
45
|
+
"chalk": "^5.6.2",
|
|
46
|
+
"commander": "^13.0.0",
|
|
47
|
+
"rollup": "^4.28.0",
|
|
48
|
+
"semver": "^7.6.0",
|
|
49
|
+
"tslib": "^2.8.0",
|
|
50
|
+
"typescript": "^5.7.0",
|
|
51
|
+
"vitest": "^3.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|