jiek 1.1.6 → 1.1.7-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.cjs +60 -17
- package/dist/cli.js +61 -18
- package/dist/cli.min.cjs +2 -2
- package/dist/cli.min.js +4 -4
- package/package.json +7 -4
- package/src/commands/build.ts +12 -8
- package/src/commands/publish.ts +6 -2
- package/src/utils/filterSupport.ts +15 -9
package/dist/cli.cjs
CHANGED
@@ -95,15 +95,27 @@ function filterPackagesGraph(filters) {
|
|
95
95
|
return Promise.all(filters.map(async (filter) => getSelectedProjectsGraph(filter)));
|
96
96
|
}
|
97
97
|
async function getSelectedProjectsGraph(filter = commander.program.getOptionValue("filter")) {
|
98
|
-
|
98
|
+
let root = getRoot();
|
99
99
|
const { wd, notWorkspace } = getWD();
|
100
|
-
if (
|
100
|
+
if (notWorkspace) {
|
101
|
+
return {
|
102
|
+
wd,
|
103
|
+
root,
|
104
|
+
value: {
|
105
|
+
[wd]: JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(wd, "package.json"), "utf-8"))
|
106
|
+
}
|
107
|
+
};
|
108
|
+
}
|
109
|
+
if (type$1 === "pnpm") {
|
101
110
|
const pnpmWorkspaceFilePath = path__default.default.resolve(wd, "pnpm-workspace.yaml");
|
102
111
|
const pnpmWorkspaceFileContent = fs__default.default.readFileSync(pnpmWorkspaceFilePath, "utf-8");
|
103
112
|
const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
|
104
113
|
if (root === wd && !filter) {
|
105
114
|
throw new Error("root path is workspace root, please provide a filter");
|
106
115
|
}
|
116
|
+
if (root === void 0) {
|
117
|
+
root = process.cwd();
|
118
|
+
}
|
107
119
|
if (root !== wd && !filter) {
|
108
120
|
const packageJSONIsExist = fs__default.default.existsSync(path__default.default.resolve(root, "package.json"));
|
109
121
|
if (!packageJSONIsExist) {
|
@@ -132,18 +144,12 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
|
|
132
144
|
}, {})
|
133
145
|
};
|
134
146
|
}
|
135
|
-
|
136
|
-
wd,
|
137
|
-
root,
|
138
|
-
value: {
|
139
|
-
[wd]: JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(wd, "package.json"), "utf-8"))
|
140
|
-
}
|
141
|
-
};
|
147
|
+
throw new Error(`not supported package manager ${type$1}`);
|
142
148
|
}
|
143
149
|
|
144
150
|
var name = "jiek";
|
145
151
|
var type = "module";
|
146
|
-
var version = "1.1.
|
152
|
+
var version = "1.1.7-alpha.1";
|
147
153
|
var description$1 = "YiJie's personal kits.";
|
148
154
|
var bin = {
|
149
155
|
jiek: "bin/jiek.js",
|
@@ -165,6 +171,9 @@ var typesVersions = {
|
|
165
171
|
]
|
166
172
|
}
|
167
173
|
};
|
174
|
+
var scripts = {
|
175
|
+
prepublish: "jk build"
|
176
|
+
};
|
168
177
|
var exports$1 = {
|
169
178
|
"./package.json": "./package.json",
|
170
179
|
".": "./src/index.ts",
|
@@ -190,7 +199,7 @@ var dependencies = {
|
|
190
199
|
inquirer: "^8.2.6",
|
191
200
|
"js-yaml": "^4.1.0",
|
192
201
|
"jsonc-parser": "^3.2.1",
|
193
|
-
rollup: "
|
202
|
+
rollup: "4.13.2",
|
194
203
|
"rollup-plugin-esbuild": "^6.1.0",
|
195
204
|
typescript: "^5.0.0"
|
196
205
|
};
|
@@ -214,6 +223,28 @@ var devDependencies = {
|
|
214
223
|
postcss: "^8.4.47",
|
215
224
|
"rollup-plugin-postcss": "^4.0.2"
|
216
225
|
};
|
226
|
+
var publishConfig = {
|
227
|
+
exports: {
|
228
|
+
"./package.json": "./package.json",
|
229
|
+
".": {
|
230
|
+
source: "./src/index.ts",
|
231
|
+
require: "./dist/index.cjs",
|
232
|
+
"default": "./dist/index.js"
|
233
|
+
},
|
234
|
+
"./cli": {
|
235
|
+
source: "./src/cli.ts",
|
236
|
+
require: "./dist/cli.cjs",
|
237
|
+
"default": "./dist/cli.js"
|
238
|
+
},
|
239
|
+
"./rollup": {
|
240
|
+
source: "./src/rollup/index.ts",
|
241
|
+
require: "./dist/rollup/index.cjs",
|
242
|
+
"default": "./dist/rollup/index.js"
|
243
|
+
}
|
244
|
+
},
|
245
|
+
main: "./dist/index.cjs",
|
246
|
+
module: "./dist/index.js"
|
247
|
+
};
|
217
248
|
var pkg = {
|
218
249
|
name: name,
|
219
250
|
type: type,
|
@@ -222,11 +253,13 @@ var pkg = {
|
|
222
253
|
bin: bin,
|
223
254
|
files: files,
|
224
255
|
typesVersions: typesVersions,
|
256
|
+
scripts: scripts,
|
225
257
|
exports: exports$1,
|
226
258
|
imports: imports,
|
227
259
|
dependencies: dependencies,
|
228
260
|
optionalDependencies: optionalDependencies,
|
229
|
-
devDependencies: devDependencies
|
261
|
+
devDependencies: devDependencies,
|
262
|
+
publishConfig: publishConfig
|
230
263
|
};
|
231
264
|
|
232
265
|
commander.program.version(pkg.version).description(pkg.description).option("--root <root>", "root path").option("-c, --config-path <configPath>", "config path");
|
@@ -478,11 +511,17 @@ ${errorStr}`)));
|
|
478
511
|
})
|
479
512
|
);
|
480
513
|
};
|
481
|
-
const filters = commander.program.getOptionValue("filter")
|
482
|
-
|
483
|
-
|
514
|
+
const filters = commander.program.getOptionValue("filter")?.split(",");
|
515
|
+
try {
|
516
|
+
if (filters) {
|
517
|
+
const packages = await filterPackagesGraph(filters);
|
518
|
+
await Promise.all(packages.map(buildPackage));
|
519
|
+
} else {
|
520
|
+
await buildPackage(await getSelectedProjectsGraph());
|
521
|
+
}
|
522
|
+
} finally {
|
484
523
|
multiBars.stop();
|
485
|
-
}
|
524
|
+
}
|
486
525
|
actionDone();
|
487
526
|
});
|
488
527
|
|
@@ -5048,7 +5087,11 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
|
|
5048
5087
|
console.warn("preview mode");
|
5049
5088
|
continue;
|
5050
5089
|
}
|
5051
|
-
|
5090
|
+
const args = ["pnpm", "publish", "--access", "public", "--no-git-checks", ...passArgs];
|
5091
|
+
if (bumper$1 && bumper.TAGS.includes(bumper$1)) {
|
5092
|
+
args.push("--tag", bumper$1);
|
5093
|
+
}
|
5094
|
+
childProcess__namespace.execSync(args.join(" "), {
|
5052
5095
|
cwd: dir,
|
5053
5096
|
stdio: "inherit"
|
5054
5097
|
});
|
package/dist/cli.js
CHANGED
@@ -13,7 +13,7 @@ import { applyEdits, modify } from 'jsonc-parser';
|
|
13
13
|
import require$$0 from 'util';
|
14
14
|
import require$$0$1 from 'path';
|
15
15
|
import * as childProcess from 'node:child_process';
|
16
|
-
import { bump } from '@jiek/utils/bumper';
|
16
|
+
import { bump, TAGS } from '@jiek/utils/bumper';
|
17
17
|
import { resolveEntrypoints, filterLeafs, DEFAULT_SKIP_VALUES, entrypoints2Exports } from '@jiek/pkger/entrypoints';
|
18
18
|
|
19
19
|
let root;
|
@@ -64,15 +64,27 @@ function filterPackagesGraph(filters) {
|
|
64
64
|
return Promise.all(filters.map(async (filter) => getSelectedProjectsGraph(filter)));
|
65
65
|
}
|
66
66
|
async function getSelectedProjectsGraph(filter = program.getOptionValue("filter")) {
|
67
|
-
|
67
|
+
let root = getRoot();
|
68
68
|
const { wd, notWorkspace } = getWD();
|
69
|
-
if (
|
69
|
+
if (notWorkspace) {
|
70
|
+
return {
|
71
|
+
wd,
|
72
|
+
root,
|
73
|
+
value: {
|
74
|
+
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, "package.json"), "utf-8"))
|
75
|
+
}
|
76
|
+
};
|
77
|
+
}
|
78
|
+
if (type$1 === "pnpm") {
|
70
79
|
const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
|
71
80
|
const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
|
72
81
|
const pnpmWorkspace = load(pnpmWorkspaceFileContent);
|
73
82
|
if (root === wd && !filter) {
|
74
83
|
throw new Error("root path is workspace root, please provide a filter");
|
75
84
|
}
|
85
|
+
if (root === void 0) {
|
86
|
+
root = process.cwd();
|
87
|
+
}
|
76
88
|
if (root !== wd && !filter) {
|
77
89
|
const packageJSONIsExist = fs.existsSync(path.resolve(root, "package.json"));
|
78
90
|
if (!packageJSONIsExist) {
|
@@ -101,18 +113,12 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
|
|
101
113
|
}, {})
|
102
114
|
};
|
103
115
|
}
|
104
|
-
|
105
|
-
wd,
|
106
|
-
root,
|
107
|
-
value: {
|
108
|
-
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, "package.json"), "utf-8"))
|
109
|
-
}
|
110
|
-
};
|
116
|
+
throw new Error(`not supported package manager ${type$1}`);
|
111
117
|
}
|
112
118
|
|
113
119
|
var name = "jiek";
|
114
120
|
var type = "module";
|
115
|
-
var version = "1.1.
|
121
|
+
var version = "1.1.7-alpha.1";
|
116
122
|
var description$1 = "YiJie's personal kits.";
|
117
123
|
var bin = {
|
118
124
|
jiek: "bin/jiek.js",
|
@@ -134,6 +140,9 @@ var typesVersions = {
|
|
134
140
|
]
|
135
141
|
}
|
136
142
|
};
|
143
|
+
var scripts = {
|
144
|
+
prepublish: "jk build"
|
145
|
+
};
|
137
146
|
var exports = {
|
138
147
|
"./package.json": "./package.json",
|
139
148
|
".": "./src/index.ts",
|
@@ -159,7 +168,7 @@ var dependencies = {
|
|
159
168
|
inquirer: "^8.2.6",
|
160
169
|
"js-yaml": "^4.1.0",
|
161
170
|
"jsonc-parser": "^3.2.1",
|
162
|
-
rollup: "
|
171
|
+
rollup: "4.13.2",
|
163
172
|
"rollup-plugin-esbuild": "^6.1.0",
|
164
173
|
typescript: "^5.0.0"
|
165
174
|
};
|
@@ -183,6 +192,28 @@ var devDependencies = {
|
|
183
192
|
postcss: "^8.4.47",
|
184
193
|
"rollup-plugin-postcss": "^4.0.2"
|
185
194
|
};
|
195
|
+
var publishConfig = {
|
196
|
+
exports: {
|
197
|
+
"./package.json": "./package.json",
|
198
|
+
".": {
|
199
|
+
source: "./src/index.ts",
|
200
|
+
require: "./dist/index.cjs",
|
201
|
+
"default": "./dist/index.js"
|
202
|
+
},
|
203
|
+
"./cli": {
|
204
|
+
source: "./src/cli.ts",
|
205
|
+
require: "./dist/cli.cjs",
|
206
|
+
"default": "./dist/cli.js"
|
207
|
+
},
|
208
|
+
"./rollup": {
|
209
|
+
source: "./src/rollup/index.ts",
|
210
|
+
require: "./dist/rollup/index.cjs",
|
211
|
+
"default": "./dist/rollup/index.js"
|
212
|
+
}
|
213
|
+
},
|
214
|
+
main: "./dist/index.cjs",
|
215
|
+
module: "./dist/index.js"
|
216
|
+
};
|
186
217
|
var pkg = {
|
187
218
|
name: name,
|
188
219
|
type: type,
|
@@ -191,11 +222,13 @@ var pkg = {
|
|
191
222
|
bin: bin,
|
192
223
|
files: files,
|
193
224
|
typesVersions: typesVersions,
|
225
|
+
scripts: scripts,
|
194
226
|
exports: exports,
|
195
227
|
imports: imports,
|
196
228
|
dependencies: dependencies,
|
197
229
|
optionalDependencies: optionalDependencies,
|
198
|
-
devDependencies: devDependencies
|
230
|
+
devDependencies: devDependencies,
|
231
|
+
publishConfig: publishConfig
|
199
232
|
};
|
200
233
|
|
201
234
|
program.version(pkg.version).description(pkg.description).option("--root <root>", "root path").option("-c, --config-path <configPath>", "config path");
|
@@ -447,11 +480,17 @@ ${errorStr}`)));
|
|
447
480
|
})
|
448
481
|
);
|
449
482
|
};
|
450
|
-
const filters = program.getOptionValue("filter")
|
451
|
-
|
452
|
-
|
483
|
+
const filters = program.getOptionValue("filter")?.split(",");
|
484
|
+
try {
|
485
|
+
if (filters) {
|
486
|
+
const packages = await filterPackagesGraph(filters);
|
487
|
+
await Promise.all(packages.map(buildPackage));
|
488
|
+
} else {
|
489
|
+
await buildPackage(await getSelectedProjectsGraph());
|
490
|
+
}
|
491
|
+
} finally {
|
453
492
|
multiBars.stop();
|
454
|
-
}
|
493
|
+
}
|
455
494
|
actionDone();
|
456
495
|
});
|
457
496
|
|
@@ -5017,7 +5056,11 @@ program.command("publish").aliases(["pub", "p"]).option("-b, --bumper <bumper>",
|
|
5017
5056
|
console.warn("preview mode");
|
5018
5057
|
continue;
|
5019
5058
|
}
|
5020
|
-
|
5059
|
+
const args = ["pnpm", "publish", "--access", "public", "--no-git-checks", ...passArgs];
|
5060
|
+
if (bumper && TAGS.includes(bumper)) {
|
5061
|
+
args.push("--tag", bumper);
|
5062
|
+
}
|
5063
|
+
childProcess.execSync(args.join(" "), {
|
5021
5064
|
cwd: dir,
|
5022
5065
|
stdio: "inherit"
|
5023
5066
|
});
|
package/dist/cli.min.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";var e=require("node:fs"),t=require("node:module"),n=require("node:path"),r=require("@pnpm/filter-workspace-packages"),o=require("commander"),a=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),l=require("detect-indent"),p=require("inquirer"),c=require("jsonc-parser"),f=require("util"),d=require("path"),g=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(e){return e&&e.__esModule?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var _=R(e),E=R(n),b=R(l),S=R(p),C=R(f),v=R(d),$=m(g);let x,w;function H(){if(x)return x;const e=o.program.getOptionValue("root");return x=e?E.default.isAbsolute(e)?e:E.default.resolve(process.cwd(),e):void 0,x}let k=!1;function O(){if(w)return{wd:w,notWorkspace:k};const e=H();if(void 0!==e){const t=s.isWorkspaceDir(e,T);return k=!t,w=e,{wd:w,notWorkspace:k}}try{w=s.getWorkspaceDir(T)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;w=e,k=!0}return{wd:w,notWorkspace:k}}let T="";try{t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),T="pnpm"}catch{}async function L(e=o.program.getOptionValue("filter")){
|
1
|
+
"use strict";var e=require("node:fs"),t=require("node:module"),n=require("node:path"),r=require("@pnpm/filter-workspace-packages"),o=require("commander"),a=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),l=require("detect-indent"),p=require("inquirer"),c=require("jsonc-parser"),f=require("util"),d=require("path"),g=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(e){return e&&e.__esModule?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var _=R(e),E=R(n),b=R(l),S=R(p),C=R(f),v=R(d),$=m(g);let x,w;function H(){if(x)return x;const e=o.program.getOptionValue("root");return x=e?E.default.isAbsolute(e)?e:E.default.resolve(process.cwd(),e):void 0,x}let k=!1;function O(){if(w)return{wd:w,notWorkspace:k};const e=H();if(void 0!==e){const t=s.isWorkspaceDir(e,T);return k=!t,w=e,{wd:w,notWorkspace:k}}try{w=s.getWorkspaceDir(T)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;w=e,k=!0}return{wd:w,notWorkspace:k}}let T="";try{t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),T="pnpm"}catch{}async function L(e=o.program.getOptionValue("filter")){let t=H();const{wd:n,notWorkspace:s}=O();if(s)return{wd:n,root:t,value:{[n]:JSON.parse(_.default.readFileSync(E.default.resolve(n,"package.json"),"utf-8"))}};if("pnpm"===T){const o=E.default.resolve(n,"pnpm-workspace.yaml"),s=_.default.readFileSync(o,"utf-8"),i=a.load(s);if(t===n&&!e)throw new Error("root path is workspace root, please provide a filter");if(void 0===t&&(t=process.cwd()),t!==n&&!e){if(!_.default.existsSync(E.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(_.default.readFileSync(E.default.resolve(t,"package.json"),"utf-8"));if(!n.name)throw new Error("root path is not workspace root, please provide a filter");e=n.name}const{selectedProjectsGraph:u}=await r.filterPackagesFromDir(n,[{filter:e??"",followProdDepsOnly:!0}],{prefix:t,workspaceDir:n,patterns:i.packages});return{wd:n,root:t,value:Object.entries(u).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}throw new Error(`not supported package manager ${T}`)}""!==T&&o.program.option("-f, --filter <filter>","filter packages, support fuzzy match and array. e.g. -f core,utils");var N="1.1.7-alpha.1",I="YiJie's personal kits.";let j;function M(){j()}function P(){new Promise((e=>j=e))}o.program.version(N).description(I).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const B=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);function D(e){try{return B.resolve(e),!0}catch(e){return!1}}let U;const G=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of G)if(D(e)){U=e;break}const F=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);let K="jiek.config";function q(e){let t,n;"object"==typeof e?(t=e.dir,n=e.root??O().wd):(t=e,n=O().wd);let r=o.program.getOptionValue("configPath");if(r){if(!_.default.existsSync(r))throw new Error(`config file not found: ${r}`);E.default.isAbsolute(r)||(r=E.default.resolve(n,r))}else r=function(e,t){const n=!!U;function r(n){const r=[E.default.resolve(process.cwd(),`${K}.${n}`),E.default.resolve(process.cwd(),`.${K}.${n}`),E.default.resolve(e,`${K}.${n}`),E.default.resolve(e,`.${K}.${n}`)];t&&r.unshift(E.default.resolve(t,`${K}.${n}`),E.default.resolve(t,`.${K}.${n}`));for(const e of r)if(_.default.existsSync(e)&&_.default.lstatSync(e).isFile())return e}return K=r("js")??K,K=r("json")??K,K=r("yaml")??K,n&&(K=r("ts")??K),E.default.resolve(e,K)}(n,t);const s=E.default.extname(r);let i;switch(s){case".js":i=F(r);break;case".json":return F(r);case".yaml":return a.load(_.default.readFileSync(r,"utf-8"));case".ts":if(U){F(U),i=F(r);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}const W=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href),Q="\nBuild the package according to the 'exports' field in the package.json.\n".trim();o.program.command("build").description(Q).option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("--without-js","Do not output js files.").option("--without-dts","Do not output dts files.").option("-v, --verbose","Display debug logs.").action((async({silent:e,entries:t,verbose:n,withoutJs:r,withoutDts:a})=>{P();const{build:s}=q();e=e??s?.silent??!1;const l=new i.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {pkgName} | {input} | {message}"},i.Presets.shades_classic),p=async({wd:o,value:s={}})=>{if(0===Object.keys(s).length)throw new Error("no package found");const i=E.default.resolve(o,"node_modules");_.default.existsSync(i)||_.default.mkdirSync(i);const p=(...e)=>E.default.resolve(i,".jiek",...e);_.default.existsSync(p())||_.default.mkdirSync(p());const c=W.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup");let f=0;await Promise.all(Object.entries(s).map((async([s,i])=>{const d=i.name?.replace(/^@/g,"").replace(/\//g,"+"),g=p(`${d??"anonymous-"+f++}.rollup.config.js`);_.default.writeFileSync(g,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(i));let h="";U&&(h=`node -r ${U} `);const y=`${h}${c} --silent -c ${g}`,A=u.execaCommand(y,{ipc:!0,cwd:s,env:{...process.env,JIEK_ROOT:o,JIEK_ENTRIES:t,JIEK_WITHOUT_JS:String(r),JIEK_WITHOUT_DTS:String(a)}}),R={};let m=10;A.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!e&&A.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${i.name}' has ${n} targets to build`),r.forEach((({input:e})=>{m=Math.max(m,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;R[n]||(R[n]=l.create(50,0,{pkgName:i.name,input:e.padEnd(m),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:a}=e.data,s=R[`${r}:${t}`];if(!s)return;s.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(m),status:o?.padEnd(10),message:`${n?.join(", ")}: ${a}`})}})),await new Promise(((e,t)=>{let r="";A.stderr?.on("data",(e=>{r+=e})),A.once("exit",(n=>0===n?e():t(new Error(`rollup build failed:\n${r}`)))),n&&A.stdout?.pipe(process.stdout)}))})))},c=o.program.getOptionValue("filter")?.split(",");try{if(c){const e=await function(e){return Promise.all(e.map((async e=>L(e))))}(c);await Promise.all(e.map(p))}else await p(await L())}finally{l.stop()}M()}));var X,J,Z,z,V,Y,ee,te,ne,re,oe,ae,se,ie,ue,le,pe,ce,fe,de={};function ge(){return X||(X=1,(e=de).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),de;var e}function he(){if(Z)return J;Z=1;const e=ge();return J=(t,n={})=>{let r=(t,o={})=>{let a=n.escapeInvalid&&e.isInvalidBrace(o),s=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(a||s)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
|
2
2
|
/*!
|
3
3
|
* is-number <https://github.com/jonschlinkert/is-number>
|
4
4
|
*
|
@@ -16,4 +16,4 @@
|
|
16
16
|
*
|
17
17
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
18
|
* Licensed under the MIT License.
|
19
|
-
*/function Re(){if(ne)return te;ne=1;const e=C.default,t=Ae(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),a=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},s=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let a=String.fromCharCode(e);return e===n?a:`[${a}-${String.fromCharCode(n)}]`},l=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw p([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw p([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=a(d)||a(g)||a(h),A=y?Math.max(d.length,g.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let _={negatives:[],positives:[]},E=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?_[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):E.push(s(m(o,b),A,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",a="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(a=`-(${r}${e.negatives.join("|")})`),n=o&&a?`${o}|${a}`:o||a,t.wrap?`(${r}${n})`:n})(_,r):l(E,null,{wrap:!1,...r}):E},d=(e,t,a,s={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,s);if("function"==typeof a)return d(e,t,1,{transform:a});if(n(a))return d(e,t,0,a);let i={...s};return!0===i.capture&&(i.wrap=!0),a=a||i.step||1,o(a)?o(e)&&o(t)?f(e,t,a,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let a=r.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),p=s>i,f=Math.min(s,i),d=Math.max(s,i);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;p?s>=i:s<=i;)g.push(a(s,h)),s=p?s-n:s+n,h++;return!0===r.toRegex?l(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(a),1),i):null==a||n(a)?d(e,t,1,a):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(a,i)};return te=d}function me(){if(pe)return le;pe=1;const e=he(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=ue?ie:(ue=1,ie={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return le=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},m="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>m)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${m})`);let _,E={type:"root",input:y,nodes:[]},b=[E],S=E,C=E,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],_=H(),_!==h&&_!==g)if(_!==n)if(_!==c)if(_!==p)if(_!==s)if(_!==i)if(_!==f&&_!==d&&_!==r)if(_!==u)if(_!==l)if(_===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:_}),S.commas++}else if(_===a&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:_});continue}if("dot"===C.type){if(S.range=[],C.value+=_,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+_,C=t,S.ranges--;continue}k({type:"dot",value:_})}else k({type:"text",value:_});else{if("brace"!==S.type){k({type:"text",value:_});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:_}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:_})}else{let e,t=_;for(!0!==A.keepQuotes&&(_="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(_+=e);break}_+=e}else _+=e+H();k({type:"text",value:_})}else{if("paren"!==S.type){k({type:"text",value:_});continue}S=b.pop(),k({type:"text",value:_}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:_});else{let e;for(v++;x<$&&(e=H());)if(_+=e,e!==p)if(e!==n){if(e===c&&(v--,0===v))break}else _+=H();else v++;k({type:"text",value:_})}else k({type:"text",value:"\\"+_});else k({type:"text",value:(A.keepEscaping?_:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),E},le}function _e(){if(fe)return ce;fe=1;const e=he(),t=function(){if(oe)return re;oe=1;const e=Re(),t=ge();return re=(n,r={})=>{let o=(n,a={})=>{let s=t.isInvalidBrace(a),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===s||!0===i,l=!0===r.escapeInvalid?"\\":"",p="";if(!0===n.isOpen)return l+n.value;if(!0===n.isClose)return l+n.value;if("open"===n.type)return u?l+n.value:"(";if("close"===n.type)return u?l+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),a=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==a.length)return o.length>1&&a.length>1?`(${a})`:a}if(n.nodes)for(let e of n.nodes)p+=o(e,n);return p};return o(n)}}(),n=function(){if(se)return ae;se=1;const e=Re(),t=he(),n=ge(),r=(e="",t="",o=!1)=>{let a=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)a.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),a.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(a)};return ae=(o,a={})=>{let s=void 0===a.rangeLimit?1e3:a.rangeLimit,i=(o,u={})=>{o.queue=[];let l=u,p=u.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,p=l.queue;if(o.invalid||o.dollar)return void p.push(r(p.pop(),t(o,a)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(r(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,a.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,a);return 0===u.length&&(u=t(o,a)),p.push(r(p.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):p.push(r(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=me(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),ce=o}var Ee,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te,Le,Ne={};function Ie(){if(be)return Ee;be=1;const e=v.default,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",a="[^/]",s=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${s}`,l={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:a,END_ANCHOR:s,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${s})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${a}*?`,START_ANCHOR:i},p={...l,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return Ee={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:l}}function je(){return Se||(Se=1,function(e){const t=v.default,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=Ie();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>a.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(s,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Ne)),Ne}function Me(){if(He)return we;He=1;const e=v.default,t=function(){if(ve)return Ce;ve=1;const e=je(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=Ie(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Ce=(R,m)=>{const _=m||{},E=R.length-1,b=!0===_.parts||!0===_.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,j=!1,M=!1,P=!1,B=!1,D=!1,U=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>H>=E,q=()=>($=x,w.charCodeAt(++H));for(;H<E;){let e;if(x=q(),x!==r){if(!0===M||x===u){for(G++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==M&&x===a&&(x=q())===a){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(!0!==M&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===d&&(G--,0===G)){M=!1,T=F.isBrace=!0,U=!0;break}}else G++;else P=F.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==_.noext&&!0==(x===c||x===n||x===t||x===f||x===s)&&w.charCodeAt(H+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===s&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===g){N=F.isGlob=!0,U=!0;break}}else P=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(j=F.isGlobstar=!0),N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===p){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,U=!0;break}}else P=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===_.nonegate||x!==s||H!==k){if(!0!==_.noparen&&x===l){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==l){if(x===g){U=!0;break}}else P=F.backslashes=!0,x=q();continue}break}if(!0===N){if(U=!0,!0===b)continue;break}}else B=F.negated=!0,k++}else{if(S.push(H),C.push(F),F={value:"",depth:0,isGlob:!1},!0===U)continue;if($===a&&H===k+1){k+=2;continue}O=H+1}}else P=F.backslashes=!0,x=q(),x===u&&(M=!0)}!0===_.noext&&(I=!1,N=!1);let W=w,Q="",X="";k>0&&(Q=w.slice(0,k),w=w.slice(k),O-=k),W&&!0===N&&O>0?(W=w.slice(0,O),X=w.slice(O)):!0===N?(W="",X=w):W=w,W&&""!==W&&"/"!==W&&W!==w&&y(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===_.unescape&&(X&&(X=e.removeBackslashes(X)),W&&!0===P&&(W=e.removeBackslashes(W)));const J={prefix:Q,input:R,start:k,base:W,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:j,negated:B,negatedExtglob:D};if(!0===_.tokens&&(J.maxDepth=0,y(x)||C.push(F),J.tokens=C),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);_.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=Q):C[t].value=o,A(C[t]),J.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),_.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),J.maxDepth+=C[C.length-1].depth)}J.slashes=S,J.parts=v}return J}}(),n=function(){if(xe)return $e;xe=1;const e=Ie(),t=je(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=s[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let g=p.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),m=e.globChars(R),_=e.extglobChars(m),{DOT_LITERAL:E,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${A}(?:(?!${T}${e.dot?v:E}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let j=!0===f.bash?L(f):O;f.capture&&(j=`(${j})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const M={input:p,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};p=t.removePrefix(p,M),g=p.length;const P=[],B=[],D=[];let U,G=h;const F=()=>M.index===g-1,K=M.peek=(e=1)=>p[M.index+e],q=M.advance=()=>p[++M.index]||"",W=()=>p.slice(M.index+1),Q=(e="",t=0)=>{M.consumed+=e,M.index+=t},X=e=>{M.output+=null!=e.output?e.output:e.value,Q(e.value)},J=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),M.start++,e++;return e%2!=0&&(M.negated=!0,M.start++,!0)},Z=e=>{M[e]++,D.push(e)},z=e=>{M[e]--,D.pop()},V=e=>{if("globstar"===G.type){const t=M.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||P.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(M.output=M.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=j,M.output+=G.output)}if(P.length&&"paren"!==e.type&&(P[P.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,y.push(e),G=e},Y=(e,t)=>{const n={..._[t],conditions:1,inner:""};n.prev=G,n.parens=M.parens,n.output=M.output;const r=(f.capture?"(":"")+n.open;Z("parens"),V({type:e,value:t,output:M.output?"":C}),V({type:"paren",extglob:!0,value:q(),output:r}),P.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=j;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==j||F()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(M.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:U,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,n=p.replace(a,((t,n,r,o,a,s)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(a?H.repeat(a.length):""):0===s?I+(a?H.repeat(a.length):""):H.repeat(r.length):"."===o?E.repeat(r.length):"*"===o?n?n+o+(a?j:""):j:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===p&&!0===f.contains?(M.output=p,M):(M.output=t.wrapOutput(n,M,c),M)}for(;!F();){if(U=q(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",V({type:"text",value:U});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,M.index+=n,n%2!=0&&(U+="\\")),!0===f.unescape?U=q():U+=q(),0===M.brackets){V({type:"text",value:U});continue}}if(M.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===U){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),n=G.value.slice(e+2),o=r[n];if(o){G.value=t+o,M.backtrack=!0,q(),h.output||1!==y.indexOf(G)||(h.output=C);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U=`\\${U}`),"]"!==U||"["!==G.value&&"[^"!==G.value||(U=`\\${U}`),!0===f.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===M.quotes&&'"'!==U){U=t.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){M.quotes=1===M.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:U});continue}if("("===U){Z("parens"),V({type:"paren",value:U});continue}if(")"===U){if(0===M.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=P[P.length-1];if(e&&M.parens===e.parens+1){ee(P.pop());continue}V({type:"paren",value:U,output:M.parens?")":"\\)"}),z("parens");continue}if("["===U){if(!0!==f.nobracket&&W().includes("]"))Z("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));U=`\\${U}`}V({type:"bracket",value:U});continue}if("]"===U){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){V({type:"text",value:U,output:`\\${U}`});continue}if(0===M.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));V({type:"text",value:U,output:`\\${U}`});continue}z("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U=`/${U}`),G.value+=U,X({value:U}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(G.value);if(M.output=M.output.slice(0,-G.value.length),!0===f.literalBrackets){M.output+=n,G.value=n;continue}G.value=`(${A}${n}|${G.value})`,M.output+=G.value;continue}if("{"===U&&!0!==f.nobrace){Z("braces");const e={type:"brace",value:U,output:"(",outputIndex:M.output.length,tokensIndex:M.tokens.length};B.push(e),V(e);continue}if("}"===U){const e=B[B.length-1];if(!0===f.nobrace||!e){V({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),M.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=M.output.slice(0,e.outputIndex),r=M.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",M.output=n;for(const e of r)M.output+=e.output||e.value}V({type:"brace",value:U,output:t}),z("braces"),B.pop();continue}if("|"===U){P.length>0&&P[P.length-1].conditions++,V({type:"text",value:U});continue}if(","===U){let e=U;const t=B[B.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),V({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&M.index===M.start+1){M.start=M.index+1,M.consumed="",M.output="",y.pop(),G=h;continue}V({type:"slash",value:U,output:S});continue}if("."===U){if(M.braces>0&&"dot"===G.type){"."===G.value&&(G.output=E);const e=B[B.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(M.braces+M.parens===0&&"bos"!==G.type&&"slash"!==G.type){V({type:"text",value:U,output:E});continue}V({type:"dot",value:U,output:E});continue}if("?"===U){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let n=U;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${U}`),V({type:"text",value:U,output:n});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){V({type:"qmark",value:U,output:k});continue}V({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){Y("negate",U);continue}if(!0!==f.nonegate&&0===M.index){J();continue}}if("+"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y("plus",U);continue}if(G&&"("===G.value||!1===f.regex){V({type:"plus",value:U,output:b});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||M.parens>0){V({type:"plus",value:U});continue}V({type:"plus",value:b});continue}if("@"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V({type:"at",extglob:!0,value:U,output:""});continue}V({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U=`\\${U}`);const e=o.exec(W());e&&(U+=e[0],M.index+=e[0].length),V({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=j,M.backtrack=!0,M.globstar=!0,Q(U);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){Y("star",U);continue}if("star"===G.type){if(!0===f.noglobstar){Q(U);continue}const t=G.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){V({type:"star",value:U,output:""});continue}const a=M.braces>0&&("comma"===t.type||"brace"===t.type),s=P.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!a&&!s){V({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[M.index+4];if(t&&"/"!==t)break;e=e.slice(3),Q("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=U,G.output=L(f),M.output=G.output,M.globstar=!0,Q(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=L(f)+(f.strictSlashes?")":"|$)"),G.value+=U,M.globstar=!0,M.output+=t.output+G.output,Q(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${L(f)}${S}|${S}${n})`,G.value+=U,M.output+=t.output+G.output,M.globstar=!0,Q(U+q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${S}|${L(f)}${S})`,M.output=G.output,M.globstar=!0,Q(U+q()),V({type:"slash",value:"/",output:""});continue}M.output=M.output.slice(0,-G.output.length),G.type="globstar",G.output=L(f),G.value+=U,M.output+=G.output,M.globstar=!0,Q(U);continue}const n={type:"star",value:U,output:j};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(M.index!==M.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(M.output+=x,G.output+=x):!0===f.dot?(M.output+=w,G.output+=w):(M.output+=N,G.output+=N),"*"!==K()&&(M.output+=C,G.output+=C)),V(n)):(n.output=U,V(n)):(n.output=".*?","bos"!==G.type&&"slash"!==G.type||(n.output=N+n.output),V(n))}for(;M.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));M.output=t.escapeLast(M.output,"["),z("brackets")}for(;M.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));M.output=t.escapeLast(M.output,"("),z("parens")}for(;M.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));M.output=t.escapeLast(M.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===M.backtrack){M.output="";for(const e of M.tokens)M.output+=null!=e.output?e.output:e.value,e.suffix&&(M.output+=e.suffix)}return M};return l.fastpaths=(r,o)=>{const a={...o},i="number"==typeof a.maxLength?Math.min(n,a.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=s[r]||r;const l=t.isWindows(o),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(l),m=a.dot?h:g,_=a.dot?y:g,E=a.capture?"":"?:";let b=!0===a.bash?".*?":A;a.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${E}(?:(?!${R}${e.dot?d:p}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${p}${f}${b}`;case"*.*":return`${m}${b}${p}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${_}${b}`;case"**":return m+S(a);case"**/*":return`(?:${m}${S(a)}${c})?${_}${f}${b}`;case"**/*.*":return`(?:${m}${S(a)}${c})?${_}${b}${p}${f}${b}`;case"**/.*":return`(?:${m}${S(a)}${c})?${p}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+p+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==a.strictSlashes&&($+=`${c}?`),$},$e=l}(),r=je(),o=Ie(),a=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>a(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(s=e)&&"object"==typeof s&&!Array.isArray(s)&&e.tokens&&e.input;var s;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),l=o?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=a(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:s,output:f}=a.test(n,l,t,{glob:e,posix:u}),d={glob:e,state:p,regex:l,posix:u,input:n,output:f,match:s,isMatch:o};return"function"==typeof i.onResult&&i.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof i.onMatch&&i.onMatch(d),!r||d)};return n&&(f.state=p),f};return a.test=(e,t,n,{glob:o,posix:s}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(s?r.toPosixSlashes:null);let l=e===o,p=l&&u?u(e):e;return!1===l&&(p=u?u(e):e,l=p===o),!1!==l&&!0!==i.capture||(l=!0===i.matchBase||!0===i.basename?a.matchBase(e,t,n,s):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},a.matchBase=(t,n,o,s=r.isWindows(o))=>(n instanceof RegExp?n:a.makeRe(n,o)).test(e.basename(t)),a.isMatch=(e,t,n)=>a(t,n)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,n)=>t(e,n),a.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},s=o.contains?"":"^",i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const l=a.toRegex(u,t);return!0===r&&(l.state=e),l},a.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(s.output=n.fastpaths(e,t)),s.output||(s=n(e,t)),a.compileRe(s,t,r,o)},a.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},a.constants=o,we=a}function Pe(){return Oe?ke:(Oe=1,ke=Me())}var Be=function(){if(Le)return Te;Le=1;const e=C.default,t=_e(),n=Pe(),r=je(),o=e=>""===e||"./"===e,a=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,a=new Set,s=new Set,i=0,u=e=>{s.add(e.output),r&&r.onResult&&r.onResult(e)};for(let s=0;s<t.length;s++){let l=n(String(t[s]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;p&&i++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),a.add(e.output)))}}let l=(i===t.length?[...s]:[...a]).filter((e=>!o.has(e)));if(r&&0===l.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return l};return a.match=a,a.matcher=(e,t)=>n(e,t),a.any=a.isMatch=(e,t,r)=>n(t,r)(e),a.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=new Set(a(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)s.has(e)||r.add(e);return[...r]},a.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>a.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return a.isMatch(t,n,{...r,contains:!0})},a.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(e),t,n),s={};for(let t of o)s[t]=e[t];return s},a.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},a.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},a.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},a.capture=(e,t,o)=>{let a=r.isWindows(o),s=n.makeRe(String(e),{...o,capture:!0}).exec(a?r.toPosixSlashes(t):t);if(s)return s.slice(1).map((e=>void 0===e?"":e))},a.makeRe=(...e)=>n.makeRe(...e),a.scan=(...e)=>n.scan(...e),a.parse=(e,r)=>{let o=[];for(let a of[].concat(e||[]))for(let e of t(String(a),r))o.push(n.parse(e,r));return o},a.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},a.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return a.braces(e,{...t,expand:!0})},Te=a}();const De='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Ue="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const Ge=new Map;function Fe(e,t){if(Ge.has(e))return Ge.get(e)[t];const n=E.default.resolve(e,"package.json"),r=JSON.parse(_.default.readFileSync(n,"utf-8"));return Ge.set(e,r),r[t]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=o.program.args,t=process.cwd(),{init:n={}}=q()??{},{wd:r}=O(),a=E.default.basename(r),{named:s,template:i,bug:u={},readme:l=Ue,readmeTemplate:p}=n,f={template:"bug_report.yml",labels:["bug"],...u};let d=l;if(p){const e=E.default.resolve(r,p);d=_.default.readFileSync(e,"utf-8")}const g=function(e,t){let n=t??De,r=!1;try{t&&JSON.parse(t)}catch(e){r=!0}if(r){const r=E.default.resolve(e,t);n=_.default.readFileSync(r,"utf-8")}return n}(r,i),{indent:h=" "}=b.default(g),y={tabSize:h.length,insertSpaces:!0},A=["license","author"];let R=g;for(const e of A)R=c.applyEdits(R,c.modify(R,[e],Fe(r,e),{formattingOptions:y}));let[m,C]=await async function(e,t,{wd:n,cwd:r,workspaceName:o}){const a=r.replace(`${n}/`,"");let s=E.default.basename(r);if("function"==typeof e)return e(t,{full:n,relative:r});let i,u,l=!1;if("object"==typeof e)if(r===n){const{rule:t}=await S.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,u=e[t])}else for(const[t,n]of Object.entries(e)){if(Be.isMatch(a,t)){i=t,u=n;break}if(Be.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,i=t,u=n;break}}if(u||(i="packages/*",u=`@${o}/$basename`),!u)throw new Error("no matched rule");if(!t&&l&&(s=await S.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(u)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof u)return u(t,{full:n,relative:r,basename:s});if("string"==typeof u){const e=t??s;return[u.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:r,cwd:t,workspaceName:a});if(!C){const{dir:t}=await S.default.prompt({type:"input",name:"dir",message:"package directory",default:e});C=t}if(!m){const{name:t}=await S.default.prompt({type:"input",name:"name",message:"package name",default:e});m=t}R=c.applyEdits(R,c.modify(R,["name"],m,{formattingOptions:y}));let v=Fe(r,"repository");"string"==typeof v&&(v={type:"git",url:v,directory:C}),R=c.applyEdits(R,c.modify(R,["repository"],v,{formattingOptions:y}));const $=`${v?.url}/blob/master/${C}/README.md`;R=c.applyEdits(R,c.modify(R,["homepage"],$,{formattingOptions:y}));let x=f.labels;"function"==typeof x&&(x=x({name:m,dir:C})),x.push(`scope:${m}`);const w=`${v?.url}/issues/new?template=${f.template}&labels=${x.join(",")}`;function H(e){if(!C)throw new Error("pkgDir is not defined");return E.default.resolve(C,e)}R=c.applyEdits(R,c.modify(R,["bugs"],w,{formattingOptions:y})),_.default.existsSync(C)||_.default.mkdirSync(C);const k=H("package.json");if(_.default.existsSync(k))throw new Error("package.json already exists");_.default.writeFileSync(k,R),console.log(R,"written to",k);const T=Fe(r,"license"),L=H("README.md");"function"==typeof d&&(d=d({dir:C,packageJson:JSON.parse(R)}));const N=d.replace(/\$name/g,m).replace(/\$license/g,T);_.default.writeFileSync(L,N)}));const Ke=(e,t)=>new Set([...e].filter((e=>t.has(e))));function qe({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:a,noFilter:s,isPublish:i}){const{build:u={},publish:{withSuffix:l=!1,withSource:p=!0}={}}=o??{},{crossModuleConvertor:c=!0}=u,f=`./${d=((...e)=>n.resolve(a??process.cwd(),...e))(("object"==typeof u?.output?.dir?u.output.dir.js:u?.output?.dir)??"dist"),n.relative(a??process.cwd(),d)}`;var d;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>Be.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const h=s?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),A=c?{import:e=>!t&&0===Ke(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ke(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[h,y.entrypoints2Exports(h,{outdir:f,withSuffix:i?l:void 0,withSource:i?p:void 0,withConditional:{...A}})]}o.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-no-b, --no-bumper","no bump version").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...n})=>{P();const{value:r={}}=await L()??{},o=Object.entries(r);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,a={...t},[s,i]=qe({entrypoints:r,pkgIsModule:o,config:q(e),dir:e,noFilter:!0,isPublish:!0});return a.exports={...s,...i},[e,a]})),s=Object.entries(n).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of a){const o=_.default.readFileSync(E.default.join(n,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=t?h.bump(a.version,t):a.version,{indent:u=" "}=b.default(o),l={tabSize:u.length,insertSpaces:!0};let p=o;p=c.applyEdits(p,c.modify(p,["version"],i,{formattingOptions:l}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l}));else{const e=t;for(const[t,n]of Object.entries(e))p=c.applyEdits(p,c.modify(p,["publishConfig","exports",t],n,{formattingOptions:l}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l})))}}try{if(_.default.renameSync(E.default.join(n,"package.json"),E.default.join(n,"package.json.bak")),_.default.writeFileSync(E.default.join(n,"package.json"),p),console.log(p),e){console.warn("preview mode");continue}$.execSync(["pnpm","publish","--access","public","--no-git-checks",...s].join(" "),{cwd:n,stdio:"inherit"});const t=c.applyEdits(o,c.modify(o,["version"],i,{}));_.default.writeFileSync(E.default.join(n,"package.json.bak"),t)}finally{_.default.unlinkSync(E.default.join(n,"package.json")),_.default.renameSync(E.default.join(n,"package.json.bak"),E.default.join(n,"package.json"))}}M()})),o.program.parse(process.argv);
|
19
|
+
*/function Re(){if(ne)return te;ne=1;const e=C.default,t=Ae(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),a=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},s=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let a=String.fromCharCode(e);return e===n?a:`[${a}-${String.fromCharCode(n)}]`},l=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw p([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw p([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=a(d)||a(g)||a(h),A=y?Math.max(d.length,g.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let _={negatives:[],positives:[]},E=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?_[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):E.push(s(m(o,b),A,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",a="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(a=`-(${r}${e.negatives.join("|")})`),n=o&&a?`${o}|${a}`:o||a,t.wrap?`(${r}${n})`:n})(_,r):l(E,null,{wrap:!1,...r}):E},d=(e,t,a,s={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,s);if("function"==typeof a)return d(e,t,1,{transform:a});if(n(a))return d(e,t,0,a);let i={...s};return!0===i.capture&&(i.wrap=!0),a=a||i.step||1,o(a)?o(e)&&o(t)?f(e,t,a,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let a=r.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),p=s>i,f=Math.min(s,i),d=Math.max(s,i);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;p?s>=i:s<=i;)g.push(a(s,h)),s=p?s-n:s+n,h++;return!0===r.toRegex?l(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(a),1),i):null==a||n(a)?d(e,t,1,a):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(a,i)};return te=d}function me(){if(pe)return le;pe=1;const e=he(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=ue?ie:(ue=1,ie={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return le=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},m="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>m)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${m})`);let _,E={type:"root",input:y,nodes:[]},b=[E],S=E,C=E,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],_=H(),_!==h&&_!==g)if(_!==n)if(_!==c)if(_!==p)if(_!==s)if(_!==i)if(_!==f&&_!==d&&_!==r)if(_!==u)if(_!==l)if(_===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:_}),S.commas++}else if(_===a&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:_});continue}if("dot"===C.type){if(S.range=[],C.value+=_,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+_,C=t,S.ranges--;continue}k({type:"dot",value:_})}else k({type:"text",value:_});else{if("brace"!==S.type){k({type:"text",value:_});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:_}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:_})}else{let e,t=_;for(!0!==A.keepQuotes&&(_="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(_+=e);break}_+=e}else _+=e+H();k({type:"text",value:_})}else{if("paren"!==S.type){k({type:"text",value:_});continue}S=b.pop(),k({type:"text",value:_}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:_});else{let e;for(v++;x<$&&(e=H());)if(_+=e,e!==p)if(e!==n){if(e===c&&(v--,0===v))break}else _+=H();else v++;k({type:"text",value:_})}else k({type:"text",value:"\\"+_});else k({type:"text",value:(A.keepEscaping?_:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),E},le}function _e(){if(fe)return ce;fe=1;const e=he(),t=function(){if(oe)return re;oe=1;const e=Re(),t=ge();return re=(n,r={})=>{let o=(n,a={})=>{let s=t.isInvalidBrace(a),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===s||!0===i,l=!0===r.escapeInvalid?"\\":"",p="";if(!0===n.isOpen)return l+n.value;if(!0===n.isClose)return l+n.value;if("open"===n.type)return u?l+n.value:"(";if("close"===n.type)return u?l+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),a=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==a.length)return o.length>1&&a.length>1?`(${a})`:a}if(n.nodes)for(let e of n.nodes)p+=o(e,n);return p};return o(n)}}(),n=function(){if(se)return ae;se=1;const e=Re(),t=he(),n=ge(),r=(e="",t="",o=!1)=>{let a=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)a.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),a.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(a)};return ae=(o,a={})=>{let s=void 0===a.rangeLimit?1e3:a.rangeLimit,i=(o,u={})=>{o.queue=[];let l=u,p=u.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,p=l.queue;if(o.invalid||o.dollar)return void p.push(r(p.pop(),t(o,a)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(r(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,a.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,a);return 0===u.length&&(u=t(o,a)),p.push(r(p.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):p.push(r(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=me(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),ce=o}var Ee,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te,Le,Ne={};function Ie(){if(be)return Ee;be=1;const e=v.default,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",a="[^/]",s=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${s}`,l={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:a,END_ANCHOR:s,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${s})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${a}*?`,START_ANCHOR:i},p={...l,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return Ee={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:l}}function je(){return Se||(Se=1,function(e){const t=v.default,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=Ie();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>a.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(s,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Ne)),Ne}function Me(){if(He)return we;He=1;const e=v.default,t=function(){if(ve)return Ce;ve=1;const e=je(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=Ie(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Ce=(R,m)=>{const _=m||{},E=R.length-1,b=!0===_.parts||!0===_.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,j=!1,M=!1,P=!1,B=!1,D=!1,U=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>H>=E,q=()=>($=x,w.charCodeAt(++H));for(;H<E;){let e;if(x=q(),x!==r){if(!0===M||x===u){for(G++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==M&&x===a&&(x=q())===a){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(!0!==M&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===d&&(G--,0===G)){M=!1,T=F.isBrace=!0,U=!0;break}}else G++;else P=F.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==_.noext&&!0==(x===c||x===n||x===t||x===f||x===s)&&w.charCodeAt(H+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===s&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===g){N=F.isGlob=!0,U=!0;break}}else P=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(j=F.isGlobstar=!0),N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===p){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,U=!0;break}}else P=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===_.nonegate||x!==s||H!==k){if(!0!==_.noparen&&x===l){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==l){if(x===g){U=!0;break}}else P=F.backslashes=!0,x=q();continue}break}if(!0===N){if(U=!0,!0===b)continue;break}}else B=F.negated=!0,k++}else{if(S.push(H),C.push(F),F={value:"",depth:0,isGlob:!1},!0===U)continue;if($===a&&H===k+1){k+=2;continue}O=H+1}}else P=F.backslashes=!0,x=q(),x===u&&(M=!0)}!0===_.noext&&(I=!1,N=!1);let W=w,Q="",X="";k>0&&(Q=w.slice(0,k),w=w.slice(k),O-=k),W&&!0===N&&O>0?(W=w.slice(0,O),X=w.slice(O)):!0===N?(W="",X=w):W=w,W&&""!==W&&"/"!==W&&W!==w&&y(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===_.unescape&&(X&&(X=e.removeBackslashes(X)),W&&!0===P&&(W=e.removeBackslashes(W)));const J={prefix:Q,input:R,start:k,base:W,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:j,negated:B,negatedExtglob:D};if(!0===_.tokens&&(J.maxDepth=0,y(x)||C.push(F),J.tokens=C),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);_.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=Q):C[t].value=o,A(C[t]),J.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),_.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),J.maxDepth+=C[C.length-1].depth)}J.slashes=S,J.parts=v}return J}}(),n=function(){if(xe)return $e;xe=1;const e=Ie(),t=je(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=s[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let g=p.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),m=e.globChars(R),_=e.extglobChars(m),{DOT_LITERAL:E,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${A}(?:(?!${T}${e.dot?v:E}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let j=!0===f.bash?L(f):O;f.capture&&(j=`(${j})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const M={input:p,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};p=t.removePrefix(p,M),g=p.length;const P=[],B=[],D=[];let U,G=h;const F=()=>M.index===g-1,K=M.peek=(e=1)=>p[M.index+e],q=M.advance=()=>p[++M.index]||"",W=()=>p.slice(M.index+1),Q=(e="",t=0)=>{M.consumed+=e,M.index+=t},X=e=>{M.output+=null!=e.output?e.output:e.value,Q(e.value)},J=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),M.start++,e++;return e%2!=0&&(M.negated=!0,M.start++,!0)},Z=e=>{M[e]++,D.push(e)},z=e=>{M[e]--,D.pop()},V=e=>{if("globstar"===G.type){const t=M.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||P.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(M.output=M.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=j,M.output+=G.output)}if(P.length&&"paren"!==e.type&&(P[P.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,y.push(e),G=e},Y=(e,t)=>{const n={..._[t],conditions:1,inner:""};n.prev=G,n.parens=M.parens,n.output=M.output;const r=(f.capture?"(":"")+n.open;Z("parens"),V({type:e,value:t,output:M.output?"":C}),V({type:"paren",extglob:!0,value:q(),output:r}),P.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=j;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==j||F()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(M.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:U,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,n=p.replace(a,((t,n,r,o,a,s)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(a?H.repeat(a.length):""):0===s?I+(a?H.repeat(a.length):""):H.repeat(r.length):"."===o?E.repeat(r.length):"*"===o?n?n+o+(a?j:""):j:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===p&&!0===f.contains?(M.output=p,M):(M.output=t.wrapOutput(n,M,c),M)}for(;!F();){if(U=q(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",V({type:"text",value:U});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,M.index+=n,n%2!=0&&(U+="\\")),!0===f.unescape?U=q():U+=q(),0===M.brackets){V({type:"text",value:U});continue}}if(M.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===U){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),n=G.value.slice(e+2),o=r[n];if(o){G.value=t+o,M.backtrack=!0,q(),h.output||1!==y.indexOf(G)||(h.output=C);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U=`\\${U}`),"]"!==U||"["!==G.value&&"[^"!==G.value||(U=`\\${U}`),!0===f.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===M.quotes&&'"'!==U){U=t.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){M.quotes=1===M.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:U});continue}if("("===U){Z("parens"),V({type:"paren",value:U});continue}if(")"===U){if(0===M.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=P[P.length-1];if(e&&M.parens===e.parens+1){ee(P.pop());continue}V({type:"paren",value:U,output:M.parens?")":"\\)"}),z("parens");continue}if("["===U){if(!0!==f.nobracket&&W().includes("]"))Z("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));U=`\\${U}`}V({type:"bracket",value:U});continue}if("]"===U){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){V({type:"text",value:U,output:`\\${U}`});continue}if(0===M.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));V({type:"text",value:U,output:`\\${U}`});continue}z("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U=`/${U}`),G.value+=U,X({value:U}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(G.value);if(M.output=M.output.slice(0,-G.value.length),!0===f.literalBrackets){M.output+=n,G.value=n;continue}G.value=`(${A}${n}|${G.value})`,M.output+=G.value;continue}if("{"===U&&!0!==f.nobrace){Z("braces");const e={type:"brace",value:U,output:"(",outputIndex:M.output.length,tokensIndex:M.tokens.length};B.push(e),V(e);continue}if("}"===U){const e=B[B.length-1];if(!0===f.nobrace||!e){V({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),M.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=M.output.slice(0,e.outputIndex),r=M.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",M.output=n;for(const e of r)M.output+=e.output||e.value}V({type:"brace",value:U,output:t}),z("braces"),B.pop();continue}if("|"===U){P.length>0&&P[P.length-1].conditions++,V({type:"text",value:U});continue}if(","===U){let e=U;const t=B[B.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),V({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&M.index===M.start+1){M.start=M.index+1,M.consumed="",M.output="",y.pop(),G=h;continue}V({type:"slash",value:U,output:S});continue}if("."===U){if(M.braces>0&&"dot"===G.type){"."===G.value&&(G.output=E);const e=B[B.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(M.braces+M.parens===0&&"bos"!==G.type&&"slash"!==G.type){V({type:"text",value:U,output:E});continue}V({type:"dot",value:U,output:E});continue}if("?"===U){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let n=U;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${U}`),V({type:"text",value:U,output:n});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){V({type:"qmark",value:U,output:k});continue}V({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){Y("negate",U);continue}if(!0!==f.nonegate&&0===M.index){J();continue}}if("+"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y("plus",U);continue}if(G&&"("===G.value||!1===f.regex){V({type:"plus",value:U,output:b});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||M.parens>0){V({type:"plus",value:U});continue}V({type:"plus",value:b});continue}if("@"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V({type:"at",extglob:!0,value:U,output:""});continue}V({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U=`\\${U}`);const e=o.exec(W());e&&(U+=e[0],M.index+=e[0].length),V({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=j,M.backtrack=!0,M.globstar=!0,Q(U);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){Y("star",U);continue}if("star"===G.type){if(!0===f.noglobstar){Q(U);continue}const t=G.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){V({type:"star",value:U,output:""});continue}const a=M.braces>0&&("comma"===t.type||"brace"===t.type),s=P.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!a&&!s){V({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[M.index+4];if(t&&"/"!==t)break;e=e.slice(3),Q("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=U,G.output=L(f),M.output=G.output,M.globstar=!0,Q(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=L(f)+(f.strictSlashes?")":"|$)"),G.value+=U,M.globstar=!0,M.output+=t.output+G.output,Q(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${L(f)}${S}|${S}${n})`,G.value+=U,M.output+=t.output+G.output,M.globstar=!0,Q(U+q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${S}|${L(f)}${S})`,M.output=G.output,M.globstar=!0,Q(U+q()),V({type:"slash",value:"/",output:""});continue}M.output=M.output.slice(0,-G.output.length),G.type="globstar",G.output=L(f),G.value+=U,M.output+=G.output,M.globstar=!0,Q(U);continue}const n={type:"star",value:U,output:j};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(M.index!==M.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(M.output+=x,G.output+=x):!0===f.dot?(M.output+=w,G.output+=w):(M.output+=N,G.output+=N),"*"!==K()&&(M.output+=C,G.output+=C)),V(n)):(n.output=U,V(n)):(n.output=".*?","bos"!==G.type&&"slash"!==G.type||(n.output=N+n.output),V(n))}for(;M.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));M.output=t.escapeLast(M.output,"["),z("brackets")}for(;M.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));M.output=t.escapeLast(M.output,"("),z("parens")}for(;M.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));M.output=t.escapeLast(M.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===M.backtrack){M.output="";for(const e of M.tokens)M.output+=null!=e.output?e.output:e.value,e.suffix&&(M.output+=e.suffix)}return M};return l.fastpaths=(r,o)=>{const a={...o},i="number"==typeof a.maxLength?Math.min(n,a.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=s[r]||r;const l=t.isWindows(o),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(l),m=a.dot?h:g,_=a.dot?y:g,E=a.capture?"":"?:";let b=!0===a.bash?".*?":A;a.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${E}(?:(?!${R}${e.dot?d:p}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${p}${f}${b}`;case"*.*":return`${m}${b}${p}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${_}${b}`;case"**":return m+S(a);case"**/*":return`(?:${m}${S(a)}${c})?${_}${f}${b}`;case"**/*.*":return`(?:${m}${S(a)}${c})?${_}${b}${p}${f}${b}`;case"**/.*":return`(?:${m}${S(a)}${c})?${p}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+p+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==a.strictSlashes&&($+=`${c}?`),$},$e=l}(),r=je(),o=Ie(),a=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>a(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(s=e)&&"object"==typeof s&&!Array.isArray(s)&&e.tokens&&e.input;var s;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),l=o?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=a(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:s,output:f}=a.test(n,l,t,{glob:e,posix:u}),d={glob:e,state:p,regex:l,posix:u,input:n,output:f,match:s,isMatch:o};return"function"==typeof i.onResult&&i.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof i.onMatch&&i.onMatch(d),!r||d)};return n&&(f.state=p),f};return a.test=(e,t,n,{glob:o,posix:s}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(s?r.toPosixSlashes:null);let l=e===o,p=l&&u?u(e):e;return!1===l&&(p=u?u(e):e,l=p===o),!1!==l&&!0!==i.capture||(l=!0===i.matchBase||!0===i.basename?a.matchBase(e,t,n,s):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},a.matchBase=(t,n,o,s=r.isWindows(o))=>(n instanceof RegExp?n:a.makeRe(n,o)).test(e.basename(t)),a.isMatch=(e,t,n)=>a(t,n)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,n)=>t(e,n),a.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},s=o.contains?"":"^",i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const l=a.toRegex(u,t);return!0===r&&(l.state=e),l},a.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(s.output=n.fastpaths(e,t)),s.output||(s=n(e,t)),a.compileRe(s,t,r,o)},a.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},a.constants=o,we=a}function Pe(){return Oe?ke:(Oe=1,ke=Me())}var Be=function(){if(Le)return Te;Le=1;const e=C.default,t=_e(),n=Pe(),r=je(),o=e=>""===e||"./"===e,a=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,a=new Set,s=new Set,i=0,u=e=>{s.add(e.output),r&&r.onResult&&r.onResult(e)};for(let s=0;s<t.length;s++){let l=n(String(t[s]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;p&&i++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),a.add(e.output)))}}let l=(i===t.length?[...s]:[...a]).filter((e=>!o.has(e)));if(r&&0===l.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return l};return a.match=a,a.matcher=(e,t)=>n(e,t),a.any=a.isMatch=(e,t,r)=>n(t,r)(e),a.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=new Set(a(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)s.has(e)||r.add(e);return[...r]},a.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>a.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return a.isMatch(t,n,{...r,contains:!0})},a.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(e),t,n),s={};for(let t of o)s[t]=e[t];return s},a.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},a.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},a.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},a.capture=(e,t,o)=>{let a=r.isWindows(o),s=n.makeRe(String(e),{...o,capture:!0}).exec(a?r.toPosixSlashes(t):t);if(s)return s.slice(1).map((e=>void 0===e?"":e))},a.makeRe=(...e)=>n.makeRe(...e),a.scan=(...e)=>n.scan(...e),a.parse=(e,r)=>{let o=[];for(let a of[].concat(e||[]))for(let e of t(String(a),r))o.push(n.parse(e,r));return o},a.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},a.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return a.braces(e,{...t,expand:!0})},Te=a}();const De='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Ue="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const Ge=new Map;function Fe(e,t){if(Ge.has(e))return Ge.get(e)[t];const n=E.default.resolve(e,"package.json"),r=JSON.parse(_.default.readFileSync(n,"utf-8"));return Ge.set(e,r),r[t]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=o.program.args,t=process.cwd(),{init:n={}}=q()??{},{wd:r}=O(),a=E.default.basename(r),{named:s,template:i,bug:u={},readme:l=Ue,readmeTemplate:p}=n,f={template:"bug_report.yml",labels:["bug"],...u};let d=l;if(p){const e=E.default.resolve(r,p);d=_.default.readFileSync(e,"utf-8")}const g=function(e,t){let n=t??De,r=!1;try{t&&JSON.parse(t)}catch(e){r=!0}if(r){const r=E.default.resolve(e,t);n=_.default.readFileSync(r,"utf-8")}return n}(r,i),{indent:h=" "}=b.default(g),y={tabSize:h.length,insertSpaces:!0},A=["license","author"];let R=g;for(const e of A)R=c.applyEdits(R,c.modify(R,[e],Fe(r,e),{formattingOptions:y}));let[m,C]=await async function(e,t,{wd:n,cwd:r,workspaceName:o}){const a=r.replace(`${n}/`,"");let s=E.default.basename(r);if("function"==typeof e)return e(t,{full:n,relative:r});let i,u,l=!1;if("object"==typeof e)if(r===n){const{rule:t}=await S.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,u=e[t])}else for(const[t,n]of Object.entries(e)){if(Be.isMatch(a,t)){i=t,u=n;break}if(Be.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,i=t,u=n;break}}if(u||(i="packages/*",u=`@${o}/$basename`),!u)throw new Error("no matched rule");if(!t&&l&&(s=await S.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(u)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof u)return u(t,{full:n,relative:r,basename:s});if("string"==typeof u){const e=t??s;return[u.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:r,cwd:t,workspaceName:a});if(!C){const{dir:t}=await S.default.prompt({type:"input",name:"dir",message:"package directory",default:e});C=t}if(!m){const{name:t}=await S.default.prompt({type:"input",name:"name",message:"package name",default:e});m=t}R=c.applyEdits(R,c.modify(R,["name"],m,{formattingOptions:y}));let v=Fe(r,"repository");"string"==typeof v&&(v={type:"git",url:v,directory:C}),R=c.applyEdits(R,c.modify(R,["repository"],v,{formattingOptions:y}));const $=`${v?.url}/blob/master/${C}/README.md`;R=c.applyEdits(R,c.modify(R,["homepage"],$,{formattingOptions:y}));let x=f.labels;"function"==typeof x&&(x=x({name:m,dir:C})),x.push(`scope:${m}`);const w=`${v?.url}/issues/new?template=${f.template}&labels=${x.join(",")}`;function H(e){if(!C)throw new Error("pkgDir is not defined");return E.default.resolve(C,e)}R=c.applyEdits(R,c.modify(R,["bugs"],w,{formattingOptions:y})),_.default.existsSync(C)||_.default.mkdirSync(C);const k=H("package.json");if(_.default.existsSync(k))throw new Error("package.json already exists");_.default.writeFileSync(k,R),console.log(R,"written to",k);const T=Fe(r,"license"),L=H("README.md");"function"==typeof d&&(d=d({dir:C,packageJson:JSON.parse(R)}));const N=d.replace(/\$name/g,m).replace(/\$license/g,T);_.default.writeFileSync(L,N)}));const Ke=(e,t)=>new Set([...e].filter((e=>t.has(e))));function qe({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:a,noFilter:s,isPublish:i}){const{build:u={},publish:{withSuffix:l=!1,withSource:p=!0}={}}=o??{},{crossModuleConvertor:c=!0}=u,f=`./${d=((...e)=>n.resolve(a??process.cwd(),...e))(("object"==typeof u?.output?.dir?u.output.dir.js:u?.output?.dir)??"dist"),n.relative(a??process.cwd(),d)}`;var d;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>Be.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const h=s?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),A=c?{import:e=>!t&&0===Ke(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ke(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[h,y.entrypoints2Exports(h,{outdir:f,withSuffix:i?l:void 0,withSource:i?p:void 0,withConditional:{...A}})]}o.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-no-b, --no-bumper","no bump version").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...n})=>{P();const{value:r={}}=await L()??{},o=Object.entries(r);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,a={...t},[s,i]=qe({entrypoints:r,pkgIsModule:o,config:q(e),dir:e,noFilter:!0,isPublish:!0});return a.exports={...s,...i},[e,a]})),s=Object.entries(n).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of a){const o=_.default.readFileSync(E.default.join(n,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=t?h.bump(a.version,t):a.version,{indent:u=" "}=b.default(o),l={tabSize:u.length,insertSpaces:!0};let p=o;p=c.applyEdits(p,c.modify(p,["version"],i,{formattingOptions:l}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l}));else{const e=t;for(const[t,n]of Object.entries(e))p=c.applyEdits(p,c.modify(p,["publishConfig","exports",t],n,{formattingOptions:l}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l})))}}try{if(_.default.renameSync(E.default.join(n,"package.json"),E.default.join(n,"package.json.bak")),_.default.writeFileSync(E.default.join(n,"package.json"),p),console.log(p),e){console.warn("preview mode");continue}const r=["pnpm","publish","--access","public","--no-git-checks",...s];t&&h.TAGS.includes(t)&&r.push("--tag",t),$.execSync(r.join(" "),{cwd:n,stdio:"inherit"});const a=c.applyEdits(o,c.modify(o,["version"],i,{}));_.default.writeFileSync(E.default.join(n,"package.json.bak"),a)}finally{_.default.unlinkSync(E.default.join(n,"package.json")),_.default.renameSync(E.default.join(n,"package.json.bak"),E.default.join(n,"package.json"))}}M()})),o.program.parse(process.argv);
|
package/dist/cli.min.js
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
import e from"node:fs";import{createRequire as t}from"node:module";import n,{resolve as r,relative as o}from"node:path";import{filterPackagesFromDir as s}from"@pnpm/filter-workspace-packages";import{program as a}from"commander";import{load as i}from"js-yaml";import{isWorkspaceDir as u,getWorkspaceDir as p}from"@jiek/utils/getWorkspaceDir";import{MultiBar as l,Presets as c}from"cli-progress";import{execaCommand as f}from"execa";import g from"detect-indent";import d from"inquirer";import{applyEdits as h,modify as A}from"jsonc-parser";import m from"util";import R from"path";import*as y from"node:child_process";import{bump as _}from"@jiek/utils/bumper";import{resolveEntrypoints as
|
1
|
+
import e from"node:fs";import{createRequire as t}from"node:module";import n,{resolve as r,relative as o}from"node:path";import{filterPackagesFromDir as s}from"@pnpm/filter-workspace-packages";import{program as a}from"commander";import{load as i}from"js-yaml";import{isWorkspaceDir as u,getWorkspaceDir as p}from"@jiek/utils/getWorkspaceDir";import{MultiBar as l,Presets as c}from"cli-progress";import{execaCommand as f}from"execa";import g from"detect-indent";import d from"inquirer";import{applyEdits as h,modify as A}from"jsonc-parser";import m from"util";import R from"path";import*as y from"node:child_process";import{bump as _,TAGS as E}from"@jiek/utils/bumper";import{resolveEntrypoints as b,filterLeafs as S,DEFAULT_SKIP_VALUES as C,entrypoints2Exports as v}from"@jiek/pkger/entrypoints";let $,x;function w(){if($)return $;const e=a.getOptionValue("root");return $=e?n.isAbsolute(e)?e:n.resolve(process.cwd(),e):void 0,$}let H=!1;function k(){if(x)return{wd:x,notWorkspace:H};const e=w();if(void 0!==e){const t=u(e,O);return H=!t,x=e,{wd:x,notWorkspace:H}}try{x=p(O)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;x=e,H=!0}return{wd:x,notWorkspace:H}}let O="";try{t(import.meta.url).resolve("@pnpm/filter-workspace-packages"),O="pnpm"}catch{}async function T(t=a.getOptionValue("filter")){let r=w();const{wd:o,notWorkspace:u}=k();if(u)return{wd:o,root:r,value:{[o]:JSON.parse(e.readFileSync(n.resolve(o,"package.json"),"utf-8"))}};if("pnpm"===O){const a=n.resolve(o,"pnpm-workspace.yaml"),u=e.readFileSync(a,"utf-8"),p=i(u);if(r===o&&!t)throw new Error("root path is workspace root, please provide a filter");if(void 0===r&&(r=process.cwd()),r!==o&&!t){if(!e.existsSync(n.resolve(r,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const o=JSON.parse(e.readFileSync(n.resolve(r,"package.json"),"utf-8"));if(!o.name)throw new Error("root path is not workspace root, please provide a filter");t=o.name}const{selectedProjectsGraph:l}=await s(o,[{filter:t??"",followProdDepsOnly:!0}],{prefix:r,workspaceDir:o,patterns:p.packages});return{wd:o,root:r,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}throw new Error(`not supported package manager ${O}`)}""!==O&&a.option("-f, --filter <filter>","filter packages, support fuzzy match and array. e.g. -f core,utils");var L="1.1.7-alpha.1",N="YiJie's personal kits.";let I;function M(){I()}function j(){new Promise((e=>I=e))}a.version(L).description(N).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const B=t(import.meta.url);function P(e){try{return B.resolve(e),!0}catch(e){return!1}}let D;const G=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of G)if(P(e)){D=e;break}const K=t(import.meta.url);let U="jiek.config";function F(t){let r,o;"object"==typeof t?(r=t.dir,o=t.root??k().wd):(r=t,o=k().wd);let s=a.getOptionValue("configPath");if(s){if(!e.existsSync(s))throw new Error(`config file not found: ${s}`);n.isAbsolute(s)||(s=n.resolve(o,s))}else s=function(t,r){const o=!!D;function s(o){const s=[n.resolve(process.cwd(),`${U}.${o}`),n.resolve(process.cwd(),`.${U}.${o}`),n.resolve(t,`${U}.${o}`),n.resolve(t,`.${U}.${o}`)];r&&s.unshift(n.resolve(r,`${U}.${o}`),n.resolve(r,`.${U}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return U=s("js")??U,U=s("json")??U,U=s("yaml")??U,o&&(U=s("ts")??U),n.resolve(t,U)}(o,r);const u=n.extname(s);let p;switch(u){case".js":p=K(s);break;case".json":return K(s);case".yaml":return i(e.readFileSync(s,"utf-8"));case".ts":if(D){K(D),p=K(s);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":p={};break;default:throw new Error(`unsupported config file type: ${u}`)}if(!p)throw new Error("config file is empty");return p.default??p}const Q=t(import.meta.url),W="\nBuild the package according to the 'exports' field in the package.json.\n".trim();a.command("build").description(W).option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("--without-js","Do not output js files.").option("--without-dts","Do not output dts files.").option("-v, --verbose","Display debug logs.").action((async({silent:t,entries:r,verbose:o,withoutJs:s,withoutDts:i})=>{j();const{build:u}=F();t=t??u?.silent??!1;const p=new l({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {pkgName} | {input} | {message}"},c.shades_classic),g=async({wd:a,value:u={}})=>{if(0===Object.keys(u).length)throw new Error("no package found");const l=n.resolve(a,"node_modules");e.existsSync(l)||e.mkdirSync(l);const c=(...e)=>n.resolve(l,".jiek",...e);e.existsSync(c())||e.mkdirSync(c());const g=Q.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup");let d=0;await Promise.all(Object.entries(u).map((async([n,u])=>{const l=u.name?.replace(/^@/g,"").replace(/\//g,"+"),h=c(`${l??"anonymous-"+d++}.rollup.config.js`);e.writeFileSync(h,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(u));let A="";D&&(A=`node -r ${D} `);const m=f(`${A}${g} --silent -c ${h}`,{ipc:!0,cwd:n,env:{...process.env,JIEK_ROOT:a,JIEK_ENTRIES:r,JIEK_WITHOUT_JS:String(s),JIEK_WITHOUT_DTS:String(i)}}),R={};let y=10;m.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!t&&m.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${u.name}' has ${n} targets to build`),r.forEach((({input:e})=>{y=Math.max(y,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;R[n]||(R[n]=p.create(50,0,{pkgName:u.name,input:e.padEnd(y),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:s}=e.data,a=R[`${r}:${t}`];if(!a)return;a.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(y),status:o?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";m.stderr?.on("data",(e=>{n+=e})),m.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`)))),o&&m.stdout?.pipe(process.stdout)}))})))},d=a.getOptionValue("filter")?.split(",");try{if(d){const e=await function(e){return Promise.all(e.map((async e=>T(e))))}(d);await Promise.all(e.map(g))}else await g(await T())}finally{p.stop()}M()}));var X,q,J,Z,z,Y,V,ee,te,ne,re,oe,se,ae,ie,ue,pe,le,ce,fe={};function ge(){return X||(X=1,function(e){e.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&(!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o),e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>"brace"===e.type&&(!(e.commas>>0+e.ranges)&&(e.invalid=!0,!0)),e.isInvalidBrace=e=>"brace"===e.type&&(!(!0!==e.invalid&&!e.dollar)||(e.commas>>0+e.ranges?(!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0):(e.invalid=!0,!0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||(!0===e.open||!0===e.close),e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}}(fe)),fe}function de(){if(J)return q;J=1;const e=ge();return q=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
|
2
2
|
/*!
|
3
3
|
* is-number <https://github.com/jonschlinkert/is-number>
|
4
4
|
*
|
5
5
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
6
6
|
* Released under the MIT License.
|
7
|
-
*/function
|
7
|
+
*/function he(){return z?Z:(z=1,Z=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
|
8
8
|
/*!
|
9
9
|
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
10
10
|
*
|
11
11
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
12
12
|
* Released under the MIT License.
|
13
|
-
*/function
|
13
|
+
*/function Ae(){if(V)return Y;V=1;const e=he(),t=(n,s,a)=>{if(!1===e(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let i={relaxZeros:!0,...a};"boolean"==typeof i.strictZeros&&(i.relaxZeros=!1===i.strictZeros);let u=n+":"+s+"="+String(i.relaxZeros)+String(i.shorthand)+String(i.capture)+String(i.wrap);if(t.cache.hasOwnProperty(u))return t.cache[u].result;let p=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(p-l)){let e=n+"|"+s;return i.capture?`(${e})`:!1===i.wrap?e:`(?:${e})`}let f=c(n)||c(s),g={min:n,max:s,a:p,b:l},d=[],h=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){h=r(l<0?Math.abs(l):1,Math.abs(p),g,i),p=g.a=0}return l>=0&&(d=r(p,l,g,i)),g.negatives=h,g.positives=d,g.result=function(e,t,n){let r=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],a=o(e,t,"-?",!0)||[];return r.concat(a).concat(s).join("|")}(h,d),!0===i.capture?g.result=`(${g.result})`:!1!==i.wrap&&d.length+h.length>1&&(g.result=`(?:${g.result})`),t.cache[u]=g,g.result};function n(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}(e,t),o=r.length,s="",a=0;for(let e=0;e<o;e++){let[t,n]=r[e];t===n?s+=t:"0"!==t||"9"!==n?s+=l(t,n):a++}return a&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function r(e,t,r,o){let a,l=function(e,t){let n=1,r=1,o=i(e,n),a=new Set([t]);for(;e<=o&&o<=t;)a.add(o),n+=1,o=i(e,n);for(o=u(t+1,r)-1;e<o&&o<=t;)a.add(o),r+=1,o=u(t+1,r)-1;return a=[...a],a.sort(s),a}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=n(String(g),String(t),o),i="";r.isPadded||!a||a.pattern!==s.pattern?(r.isPadded&&(i=f(t,r,o)),s.string=i+s.pattern+p(s.count),c.push(s),g=t+1,a=s):(a.count.length>1&&a.count.pop(),a.count.push(s.count[0]),a.string=a.pattern+p(a.count),g=t+1)}return c}function o(e,t,n,r,o){let s=[];for(let o of e){let{string:e}=o;r||a(t,"string",e)||s.push(n+e),r&&a(t,"string",e)&&s.push(n+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function a(e,t,n){return e.some((e=>e[t]===n))}function i(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function u(e,t){return e-e%Math.pow(10,t)}function p(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function l(e,t,n){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return t.cache={},t.clearCache=()=>t.cache={},Y=t}
|
14
14
|
/*!
|
15
15
|
* fill-range <https://github.com/jonschlinkert/fill-range>
|
16
16
|
*
|
17
17
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
18
|
* Licensed under the MIT License.
|
19
|
-
*/function Ae(){if(ee)return V;ee=1;const e=m,t=he(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},a=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),h=String(n);n=Math.max(Math.abs(n),1);let A=s(g)||s(d)||s(h),m=A?Math.max(g.length,d.length,h.length):0,R=!1===A&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),y=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,m),i(t,m),!0,r);let _={negatives:[],positives:[]},E=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?_[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):E.push(a(y(o,b),m,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(_,r):p(E,null,{wrap:!1,...r}):E},g=(e,t,s,a={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,a);if("function"==typeof s)return g(e,t,1,{transform:s});if(n(s))return g(e,t,0,s);let i={...a};return!0===i.capture&&(i.wrap=!0),s=s||i.step||1,o(s)?o(e)&&o(t)?f(e,t,s,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),l=a>i,f=Math.min(a,i),g=Math.max(a,i);if(r.toRegex&&1===n)return u(f,g,!1,r);let d=[],h=0;for(;l?a>=i:a<=i;)d.push(s(a,h)),a=l?a-n:a+n,h++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),i):null==s||n(s)?g(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,i)};return V=g}function me(){if(ue)return ie;ue=1;const e=ge(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=ae?se:(ae=1,se={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return ie=(A,m={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let R=m||{},y="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(A.length>y)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${y})`);let _,E={type:"root",input:A,nodes:[]},b=[E],S=E,C=E,v=0,$=A.length,x=0,w=0;const H=()=>A[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],_=H(),_!==h&&_!==d)if(_!==n)if(_!==c)if(_!==l)if(_!==a)if(_!==i)if(_!==f&&_!==g&&_!==r)if(_!==u)if(_!==p)if(_===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:_}),S.commas++}else if(_===s&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:_});continue}if("dot"===C.type){if(S.range=[],C.value+=_,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+_,C=t,S.ranges--;continue}k({type:"dot",value:_})}else k({type:"text",value:_});else{if("brace"!==S.type){k({type:"text",value:_});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:_}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:_})}else{let e,t=_;for(!0!==m.keepQuotes&&(_="");x<$&&(e=H());)if(e!==n){if(e===t){!0===m.keepQuotes&&(_+=e);break}_+=e}else _+=e+H();k({type:"text",value:_})}else{if("paren"!==S.type){k({type:"text",value:_});continue}S=b.pop(),k({type:"text",value:_}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:_});else{let e;for(v++;x<$&&(e=H());)if(_+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else _+=H();else v++;k({type:"text",value:_})}else k({type:"text",value:"\\"+_});else k({type:"text",value:(m.keepEscaping?_:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),E},ie}function Re(){if(le)return pe;le=1;const e=ge(),t=function(){if(ne)return te;ne=1;const e=Ae(),t=fe();return te=(n,r={})=>{let o=(n,s={})=>{let a=t.isInvalidBrace(s),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===a||!0===i,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(oe)return re;oe=1;const e=Ae(),t=ge(),n=fe(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return re=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,i=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=me(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),pe=o}var ye,_e,Ee,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te={};function Le(){if(_e)return ye;_e=1;const e=R,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${a}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${a})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:i},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return ye={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function Ne(){return Ee||(Ee=1,function(e){const t=R,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=Le();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Te)),Te}function Ie(){if(xe)return $e;xe=1;const e=R,t=function(){if(Se)return be;Se=1;const e=Ne(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:h}=Le(),A=e=>e===i||e===r,m=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return be=(R,y)=>{const _=y||{},E=R.length-1,b=!0===_.parts||!0===_.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,D=!1,G=!1,K=0,U={value:"",depth:0,isGlob:!1};const F=()=>H>=E,Q=()=>($=x,w.charCodeAt(++H));for(;H<E;){let e;if(x=Q(),x!==r){if(!0===j||x===u){for(K++;!0!==F()&&(x=Q());)if(x!==r)if(x!==u){if(!0!==j&&x===s&&(x=Q())===s){if(T=U.isBrace=!0,N=U.isGlob=!0,G=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=U.isBrace=!0,N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===g&&(K--,0===K)){j=!1,T=U.isBrace=!0,G=!0;break}}else K++;else B=U.backslashes=!0,Q();if(!0===b)continue;break}if(x!==i){if(!0!==_.noext&&!0==(x===c||x===n||x===t||x===f||x===a)&&w.charCodeAt(H+1)===p){if(N=U.isGlob=!0,I=U.isExtglob=!0,G=!0,x===a&&H===k&&(D=!0),!0===b){for(;!0!==F()&&(x=Q());)if(x!==r){if(x===d){N=U.isGlob=!0,G=!0;break}}else B=U.backslashes=!0,x=Q();continue}break}if(x===t){if($===t&&(M=U.isGlobstar=!0),N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===f){if(N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===l){for(;!0!==F()&&(e=Q());)if(e!==r){if(e===h){L=U.isBracket=!0,N=U.isGlob=!0,G=!0;break}}else B=U.backslashes=!0,Q();if(!0===b)continue;break}if(!0===_.nonegate||x!==a||H!==k){if(!0!==_.noparen&&x===p){if(N=U.isGlob=!0,!0===b){for(;!0!==F()&&(x=Q());)if(x!==p){if(x===d){G=!0;break}}else B=U.backslashes=!0,x=Q();continue}break}if(!0===N){if(G=!0,!0===b)continue;break}}else P=U.negated=!0,k++}else{if(S.push(H),C.push(U),U={value:"",depth:0,isGlob:!1},!0===G)continue;if($===s&&H===k+1){k+=2;continue}O=H+1}}else B=U.backslashes=!0,x=Q(),x===u&&(j=!0)}!0===_.noext&&(I=!1,N=!1);let W=w,X="",q="";k>0&&(X=w.slice(0,k),w=w.slice(k),O-=k),W&&!0===N&&O>0?(W=w.slice(0,O),q=w.slice(O)):!0===N?(W="",q=w):W=w,W&&""!==W&&"/"!==W&&W!==w&&A(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===_.unescape&&(q&&(q=e.removeBackslashes(q)),W&&!0===B&&(W=e.removeBackslashes(W)));const J={prefix:X,input:R,start:k,base:W,glob:q,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:D};if(!0===_.tokens&&(J.maxDepth=0,A(x)||C.push(U),J.tokens=C),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);_.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=X):C[t].value=o,m(C[t]),J.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),_.tokens&&(C[C.length-1].value=t,m(C[C.length-1]),J.maxDepth+=C[C.length-1].depth)}J.slashes=S,J.parts=v}return J}}(),n=function(){if(ve)return Ce;ve=1;const e=Le(),t=Ne(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=a[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],m=f.capture?"":"?:",R=t.isWindows(c),y=e.globChars(R),_=e.extglobChars(y),{DOT_LITERAL:E,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=y,L=e=>`(${m}(?:(?!${T}${e.dot?v:E}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let M=!0===f.bash?L(f):O;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};l=t.removePrefix(l,j),d=l.length;const B=[],P=[],D=[];let G,K=h;const U=()=>j.index===d-1,F=j.peek=(e=1)=>l[j.index+e],Q=j.advance=()=>l[++j.index]||"",W=()=>l.slice(j.index+1),X=(e="",t=0)=>{j.consumed+=e,j.index+=t},q=e=>{j.output+=null!=e.output?e.output:e.value,X(e.value)},J=()=>{let e=1;for(;"!"===F()&&("("!==F(2)||"?"===F(3));)Q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},Z=e=>{j[e]++,D.push(e)},z=e=>{j[e]--,D.pop()},Y=e=>{if("globstar"===K.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,j.output+=K.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&q(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,A.push(e),K=e},V=(e,t)=>{const n={..._[t],conditions:1,inner:""};n.prev=K,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;Z("parens"),Y({type:e,value:t,output:j.output?"":C}),Y({type:"paren",extglob:!0,value:Q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==M||U()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:G,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?H.repeat(s.length):""):0===a?I+(s?H.repeat(s.length):""):H.repeat(r.length):"."===o?E.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!U();){if(G=Q(),"\0"===G)continue;if("\\"===G){const e=F();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",Y({type:"text",value:G});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(G+="\\")),!0===f.unescape?G=Q():G+=Q(),0===j.brackets){Y({type:"text",value:G});continue}}if(j.brackets>0&&("]"!==G||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===G){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,j.backtrack=!0,Q(),h.output||1!==A.indexOf(K)||(h.output=C);continue}}}("["===G&&":"!==F()||"-"===G&&"]"===F())&&(G=`\\${G}`),"]"!==G||"["!==K.value&&"[^"!==K.value||(G=`\\${G}`),!0===f.posix&&"!"===G&&"["===K.value&&(G="^"),K.value+=G,q({value:G});continue}if(1===j.quotes&&'"'!==G){G=t.escapeRegex(G),K.value+=G,q({value:G});continue}if('"'===G){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:G});continue}if("("===G){Z("parens"),Y({type:"paren",value:G});continue}if(")"===G){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}Y({type:"paren",value:G,output:j.parens?")":"\\)"}),z("parens");continue}if("["===G){if(!0!==f.nobracket&&W().includes("]"))Z("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));G=`\\${G}`}Y({type:"bracket",value:G});continue}if("]"===G){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){Y({type:"text",value:G,output:`\\${G}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:G,output:`\\${G}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),K.value+=G,q({value:G}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(j.output=j.output.slice(0,-K.value.length),!0===f.literalBrackets){j.output+=n,K.value=n;continue}K.value=`(${m}${n}|${K.value})`,j.output+=K.value;continue}if("{"===G&&!0!==f.nobrace){Z("braces");const e={type:"brace",value:G,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),Y(e);continue}if("}"===G){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:G,output:G});continue}let t=")";if(!0===e.dots){const e=A.slice(),n=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",G=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}Y({type:"brace",value:G,output:t}),z("braces"),P.pop();continue}if("|"===G){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:G});continue}if(","===G){let e=G;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===K.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),K=h;continue}Y({type:"slash",value:G,output:S});continue}if("."===G){if(j.braces>0&&"dot"===K.type){"."===K.value&&(K.output=E);const e=P[P.length-1];K.type="dots",K.output+=G,K.value+=G,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==K.type&&"slash"!==K.type){Y({type:"text",value:G,output:E});continue}Y({type:"dot",value:G,output:E});continue}if("?"===G){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V("qmark",G);continue}if(K&&"paren"===K.type){const e=F();let n=G;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${G}`),Y({type:"text",value:G,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){Y({type:"qmark",value:G,output:k});continue}Y({type:"qmark",value:G,output:H});continue}if("!"===G){if(!0!==f.noextglob&&"("===F()&&("?"!==F(2)||!/[!=<:]/.test(F(3)))){V("negate",G);continue}if(!0!==f.nonegate&&0===j.index){J();continue}}if("+"===G){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V("plus",G);continue}if(K&&"("===K.value||!1===f.regex){Y({type:"plus",value:G,output:b});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||j.parens>0){Y({type:"plus",value:G});continue}Y({type:"plus",value:b});continue}if("@"===G){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){Y({type:"at",extglob:!0,value:G,output:""});continue}Y({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=o.exec(W());e&&(G+=e[0],j.index+=e[0].length),Y({type:"text",value:G});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=G,K.output=M,j.backtrack=!0,j.globstar=!0,X(G);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",G);continue}if("star"===K.type){if(!0===f.noglobstar){X(G);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){Y({type:"star",value:G,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!a){Y({type:"star",value:G,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),X("/**",3)}if("bos"===t.type&&U()){K.type="globstar",K.value+=G,K.output=L(f),j.output=K.output,j.globstar=!0,X(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&U()){j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=L(f)+(f.strictSlashes?")":"|$)"),K.value+=G,j.globstar=!0,j.output+=t.output+K.output,X(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${L(f)}${S}|${S}${n})`,K.value+=G,j.output+=t.output+K.output,j.globstar=!0,X(G+Q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=G,K.output=`(?:^|${S}|${L(f)}${S})`,j.output=K.output,j.globstar=!0,X(G+Q()),Y({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-K.output.length),K.type="globstar",K.output=L(f),K.value+=G,j.output+=K.output,j.globstar=!0,X(G);continue}const n={type:"star",value:G,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(j.index!==j.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(j.output+=x,K.output+=x):!0===f.dot?(j.output+=w,K.output+=w):(j.output+=N,K.output+=N),"*"!==F()&&(j.output+=C,K.output+=C)),Y(n)):(n.output=G,Y(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),Y(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return p.fastpaths=(r,o)=>{const s={...o},i="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=a[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:m,START_ANCHOR:R}=e.globChars(p),y=s.dot?h:d,_=s.dot?A:d,E=s.capture?"":"?:";let b=!0===s.bash?".*?":m;s.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${E}(?:(?!${R}${e.dot?g:l}).)*?)`,C=e=>{switch(e){case"*":return`${y}${f}${b}`;case".*":return`${l}${f}${b}`;case"*.*":return`${y}${b}${l}${f}${b}`;case"*/*":return`${y}${b}${c}${f}${_}${b}`;case"**":return y+S(s);case"**/*":return`(?:${y}${S(s)}${c})?${_}${f}${b}`;case"**/*.*":return`(?:${y}${S(s)}${c})?${_}${b}${l}${f}${b}`;case"**/.*":return`(?:${y}${S(s)}${c})?${l}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==s.strictSlashes&&($+=`${c}?`),$},Ce=p}(),r=Ne(),o=Le(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:a,output:f}=s.test(n,p,t,{glob:e,posix:u}),g={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:a,isMatch:o};return"function"==typeof i.onResult&&i.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof i.onMatch&&i.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:a}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(a?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==i.capture||(p=!0===i.matchBase||!0===i.basename?s.matchBase(e,t,n,a):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,a=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},a=o.contains?"":"^",i=o.contains?"":"$";let u=`${a}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=n.fastpaths(e,t)),a.output||(a=n(e,t)),s.compileRe(a,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,$e=s}function Me(){return He?we:(He=1,we=Ie())}var je=function(){if(Oe)return ke;Oe=1;const e=m,t=Re(),n=Me(),r=Ne(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,i=0,u=e=>{a.add(e.output),r&&r.onResult&&r.onResult(e)};for(let a=0;a<t.length;a++){let p=n(String(t[a]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&i++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(i===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],a=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),a={};for(let t of o)a[t]=e[t];return a},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),a=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},ke=s}();const Be='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Pe="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const De=new Map;function Ge(t,r){if(De.has(t))return De.get(t)[r];const o=n.resolve(t,"package.json"),s=JSON.parse(e.readFileSync(o,"utf-8"));return De.set(t,s),s[r]}a.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,t]=a.args,r=process.cwd(),{init:o={}}=U()??{},{wd:s}=H(),i=n.basename(s),{named:u,template:p,bug:l={},readme:c=Pe,readmeTemplate:f}=o,m={template:"bug_report.yml",labels:["bug"],...l};let R=c;if(f){const t=n.resolve(s,f);R=e.readFileSync(t,"utf-8")}const y=function(t,r){let o=r??Be,s=!1;try{r&&JSON.parse(r)}catch(e){s=!0}if(s){const s=n.resolve(t,r);o=e.readFileSync(s,"utf-8")}return o}(s,p),{indent:_=" "}=g(y),E={tabSize:_.length,insertSpaces:!0},b=["license","author"];let S=y;for(const e of b)S=h(S,A(S,[e],Ge(s,e),{formattingOptions:E}));let[C,v]=await async function(e,t,{wd:r,cwd:o,workspaceName:s}){const a=o.replace(`${r}/`,"");let i=n.basename(o);if("function"==typeof e)return e(t,{full:r,relative:o});let u,p,l=!1;if("object"==typeof e)if(o===r){const{rule:t}=await d.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(u=t,p=e[t])}else for(const[t,n]of Object.entries(e)){if(je.isMatch(a,t)){u=t,p=n;break}if(je.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,u=t,p=n;break}}if(p||(u="packages/*",p=`@${s}/$basename`),!p)throw new Error("no matched rule");if(!t&&l&&(i=await d.prompt({type:"input",name:"name",message:`the matched rule is \`${String(p)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof p)return p(t,{full:r,relative:o,basename:i});if("string"==typeof p){const e=t??i;return[p.replace(/\$basename/g,e),u?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(u,t,{wd:s,cwd:r,workspaceName:i});if(!v){const{dir:e}=await d.prompt({type:"input",name:"dir",message:"package directory",default:t});v=e}if(!C){const{name:e}=await d.prompt({type:"input",name:"name",message:"package name",default:t});C=e}S=h(S,A(S,["name"],C,{formattingOptions:E}));let $=Ge(s,"repository");"string"==typeof $&&($={type:"git",url:$,directory:v}),S=h(S,A(S,["repository"],$,{formattingOptions:E}));S=h(S,A(S,["homepage"],`${$?.url}/blob/master/${v}/README.md`,{formattingOptions:E}));let x=m.labels;"function"==typeof x&&(x=x({name:C,dir:v})),x.push(`scope:${C}`);const w=`${$?.url}/issues/new?template=${m.template}&labels=${x.join(",")}`;function k(e){if(!v)throw new Error("pkgDir is not defined");return n.resolve(v,e)}S=h(S,A(S,["bugs"],w,{formattingOptions:E})),e.existsSync(v)||e.mkdirSync(v);const O=k("package.json");if(e.existsSync(O))throw new Error("package.json already exists");e.writeFileSync(O,S),console.log(S,"written to",O);const T=Ge(s,"license"),L=k("README.md");"function"==typeof R&&(R=R({dir:v,packageJson:JSON.parse(S)}));const N=R.replace(/\$name/g,C).replace(/\$license/g,T);e.writeFileSync(L,N)}));const Ke=(e,t)=>new Set([...e].filter((e=>t.has(e))));a.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-no-b, --no-bumper","no bump version").option("-p, --preview","preview publish").action((async({preview:t,bumper:s,...a})=>{M();const{value:i={}}=await O()??{},u=Object.entries(i);if(0===u.length)throw new Error("no packages selected");const p=u.map((([e,t])=>{const{type:n,exports:s={}}=t,a="module"===n,i={...t},[u,p]=function({entrypoints:e,pkgIsModule:t,entries:n,config:s,dir:a,noFilter:i,isPublish:u}){const{build:p={},publish:{withSuffix:l=!1,withSource:c=!0}={}}=s??{},{crossModuleConvertor:f=!0}=p,g=`./${(e=>o(a??process.cwd(),e))(((...e)=>r(a??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"))}`,[,d]=E(e);n&&Object.entries(d).forEach((([e])=>{n.some((t=>je.isMatch(e,t,{matchBase:!0})))||delete d[e]}));const h=i?d:b(d,{skipValue:[/(^|\/)\.jk-noentry/,...S]});return[h,C(h,{outdir:g,withSuffix:u?l:void 0,withSource:u?c:void 0,withConditional:{...f?{import:e=>!t&&0===Ke(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ke(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:s,pkgIsModule:a,config:U(e),dir:e,noFilter:!0,isPublish:!0});return i.exports={...u,...p},[e,i]})),l=Object.entries(a).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[r,o]of p){const a=e.readFileSync(n.join(r,"package.json"),"utf-8"),i=JSON.parse(a)??"0.0.0",u=s?_(i.version,s):i.version,{indent:p=" "}=g(a),c={tabSize:p.length,insertSpaces:!0};let f=a;f=h(f,A(f,["version"],u,{formattingOptions:c}));for(const[e,t]of Object.entries(o))if(JSON.stringify(t)!==JSON.stringify(i[e]))if("exports"!==e)f=h(f,A(f,["publishConfig",e],t,{formattingOptions:c}));else{const e=t;for(const[t,n]of Object.entries(e))f=h(f,A(f,["publishConfig","exports",t],n,{formattingOptions:c}));const n=e?.["."],r={};if(n){switch(typeof n){case"string":r["module"===o?.type?"module":"main"]=n;break;case"object":{const e=n;r.main=e.require??e.default,r.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(r))void 0!==t&&(f=h(f,A(f,["publishConfig",e],t,{formattingOptions:c})))}}try{if(e.renameSync(n.join(r,"package.json"),n.join(r,"package.json.bak")),e.writeFileSync(n.join(r,"package.json"),f),console.log(f),t){console.warn("preview mode");continue}y.execSync(["pnpm","publish","--access","public","--no-git-checks",...l].join(" "),{cwd:r,stdio:"inherit"});const o=h(a,A(a,["version"],u,{}));e.writeFileSync(n.join(r,"package.json.bak"),o)}finally{e.unlinkSync(n.join(r,"package.json")),e.renameSync(n.join(r,"package.json.bak"),n.join(r,"package.json"))}}I()})),a.parse(process.argv);
|
19
|
+
*/function me(){if(te)return ee;te=1;const e=m,t=Ae(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},a=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),h=String(n);n=Math.max(Math.abs(n),1);let A=s(g)||s(d)||s(h),m=A?Math.max(g.length,d.length,h.length):0,R=!1===A&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),y=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,m),i(t,m),!0,r);let _={negatives:[],positives:[]},E=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?_[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):E.push(a(y(o,b),m,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(_,r):p(E,null,{wrap:!1,...r}):E},g=(e,t,s,a={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,a);if("function"==typeof s)return g(e,t,1,{transform:s});if(n(s))return g(e,t,0,s);let i={...a};return!0===i.capture&&(i.wrap=!0),s=s||i.step||1,o(s)?o(e)&&o(t)?f(e,t,s,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),l=a>i,f=Math.min(a,i),g=Math.max(a,i);if(r.toRegex&&1===n)return u(f,g,!1,r);let d=[],h=0;for(;l?a>=i:a<=i;)d.push(s(a,h)),a=l?a-n:a+n,h++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),i):null==s||n(s)?g(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,i)};return ee=g}function Re(){if(pe)return ue;pe=1;const e=de(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=ie?ae:(ie=1,ae={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return ue=(A,m={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let R=m||{},y="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(A.length>y)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${y})`);let _,E={type:"root",input:A,nodes:[]},b=[E],S=E,C=E,v=0,$=A.length,x=0,w=0;const H=()=>A[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],_=H(),_!==h&&_!==d)if(_!==n)if(_!==c)if(_!==l)if(_!==a)if(_!==i)if(_!==f&&_!==g&&_!==r)if(_!==u)if(_!==p)if(_===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:_}),S.commas++}else if(_===s&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:_});continue}if("dot"===C.type){if(S.range=[],C.value+=_,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+_,C=t,S.ranges--;continue}k({type:"dot",value:_})}else k({type:"text",value:_});else{if("brace"!==S.type){k({type:"text",value:_});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:_}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:_})}else{let e,t=_;for(!0!==m.keepQuotes&&(_="");x<$&&(e=H());)if(e!==n){if(e===t){!0===m.keepQuotes&&(_+=e);break}_+=e}else _+=e+H();k({type:"text",value:_})}else{if("paren"!==S.type){k({type:"text",value:_});continue}S=b.pop(),k({type:"text",value:_}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:_});else{let e;for(v++;x<$&&(e=H());)if(_+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else _+=H();else v++;k({type:"text",value:_})}else k({type:"text",value:"\\"+_});else k({type:"text",value:(m.keepEscaping?_:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),E},ue}function ye(){if(ce)return le;ce=1;const e=de(),t=function(){if(re)return ne;re=1;const e=me(),t=ge();return ne=(n,r={})=>{let o=(n,s={})=>{let a=t.isInvalidBrace(s),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===a||!0===i,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(se)return oe;se=1;const e=me(),t=de(),n=ge(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return oe=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,i=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=Re(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),le=o}var _e,Ee,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te,Le={};function Ne(){if(Ee)return _e;Ee=1;const e=R,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${a}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${a})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:i},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return _e={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function Ie(){return be||(be=1,function(e){const t=R,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=Ne();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Le)),Le}function Me(){if(we)return xe;we=1;const e=R,t=function(){if(Ce)return Se;Ce=1;const e=Ie(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:h}=Ne(),A=e=>e===i||e===r,m=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Se=(R,y)=>{const _=y||{},E=R.length-1,b=!0===_.parts||!0===_.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,D=!1,G=!1,K=0,U={value:"",depth:0,isGlob:!1};const F=()=>H>=E,Q=()=>($=x,w.charCodeAt(++H));for(;H<E;){let e;if(x=Q(),x!==r){if(!0===j||x===u){for(K++;!0!==F()&&(x=Q());)if(x!==r)if(x!==u){if(!0!==j&&x===s&&(x=Q())===s){if(T=U.isBrace=!0,N=U.isGlob=!0,G=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=U.isBrace=!0,N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===g&&(K--,0===K)){j=!1,T=U.isBrace=!0,G=!0;break}}else K++;else B=U.backslashes=!0,Q();if(!0===b)continue;break}if(x!==i){if(!0!==_.noext&&!0==(x===c||x===n||x===t||x===f||x===a)&&w.charCodeAt(H+1)===p){if(N=U.isGlob=!0,I=U.isExtglob=!0,G=!0,x===a&&H===k&&(D=!0),!0===b){for(;!0!==F()&&(x=Q());)if(x!==r){if(x===d){N=U.isGlob=!0,G=!0;break}}else B=U.backslashes=!0,x=Q();continue}break}if(x===t){if($===t&&(M=U.isGlobstar=!0),N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===f){if(N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===l){for(;!0!==F()&&(e=Q());)if(e!==r){if(e===h){L=U.isBracket=!0,N=U.isGlob=!0,G=!0;break}}else B=U.backslashes=!0,Q();if(!0===b)continue;break}if(!0===_.nonegate||x!==a||H!==k){if(!0!==_.noparen&&x===p){if(N=U.isGlob=!0,!0===b){for(;!0!==F()&&(x=Q());)if(x!==p){if(x===d){G=!0;break}}else B=U.backslashes=!0,x=Q();continue}break}if(!0===N){if(G=!0,!0===b)continue;break}}else P=U.negated=!0,k++}else{if(S.push(H),C.push(U),U={value:"",depth:0,isGlob:!1},!0===G)continue;if($===s&&H===k+1){k+=2;continue}O=H+1}}else B=U.backslashes=!0,x=Q(),x===u&&(j=!0)}!0===_.noext&&(I=!1,N=!1);let W=w,X="",q="";k>0&&(X=w.slice(0,k),w=w.slice(k),O-=k),W&&!0===N&&O>0?(W=w.slice(0,O),q=w.slice(O)):!0===N?(W="",q=w):W=w,W&&""!==W&&"/"!==W&&W!==w&&A(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===_.unescape&&(q&&(q=e.removeBackslashes(q)),W&&!0===B&&(W=e.removeBackslashes(W)));const J={prefix:X,input:R,start:k,base:W,glob:q,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:D};if(!0===_.tokens&&(J.maxDepth=0,A(x)||C.push(U),J.tokens=C),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);_.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=X):C[t].value=o,m(C[t]),J.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),_.tokens&&(C[C.length-1].value=t,m(C[C.length-1]),J.maxDepth+=C[C.length-1].depth)}J.slashes=S,J.parts=v}return J}}(),n=function(){if($e)return ve;$e=1;const e=Ne(),t=Ie(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=a[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],m=f.capture?"":"?:",R=t.isWindows(c),y=e.globChars(R),_=e.extglobChars(y),{DOT_LITERAL:E,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=y,L=e=>`(${m}(?:(?!${T}${e.dot?v:E}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let M=!0===f.bash?L(f):O;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};l=t.removePrefix(l,j),d=l.length;const B=[],P=[],D=[];let G,K=h;const U=()=>j.index===d-1,F=j.peek=(e=1)=>l[j.index+e],Q=j.advance=()=>l[++j.index]||"",W=()=>l.slice(j.index+1),X=(e="",t=0)=>{j.consumed+=e,j.index+=t},q=e=>{j.output+=null!=e.output?e.output:e.value,X(e.value)},J=()=>{let e=1;for(;"!"===F()&&("("!==F(2)||"?"===F(3));)Q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},Z=e=>{j[e]++,D.push(e)},z=e=>{j[e]--,D.pop()},Y=e=>{if("globstar"===K.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,j.output+=K.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&q(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,A.push(e),K=e},V=(e,t)=>{const n={..._[t],conditions:1,inner:""};n.prev=K,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;Z("parens"),Y({type:e,value:t,output:j.output?"":C}),Y({type:"paren",extglob:!0,value:Q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==M||U()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:G,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?H.repeat(s.length):""):0===a?I+(s?H.repeat(s.length):""):H.repeat(r.length):"."===o?E.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!U();){if(G=Q(),"\0"===G)continue;if("\\"===G){const e=F();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",Y({type:"text",value:G});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(G+="\\")),!0===f.unescape?G=Q():G+=Q(),0===j.brackets){Y({type:"text",value:G});continue}}if(j.brackets>0&&("]"!==G||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===G){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,j.backtrack=!0,Q(),h.output||1!==A.indexOf(K)||(h.output=C);continue}}}("["===G&&":"!==F()||"-"===G&&"]"===F())&&(G=`\\${G}`),"]"!==G||"["!==K.value&&"[^"!==K.value||(G=`\\${G}`),!0===f.posix&&"!"===G&&"["===K.value&&(G="^"),K.value+=G,q({value:G});continue}if(1===j.quotes&&'"'!==G){G=t.escapeRegex(G),K.value+=G,q({value:G});continue}if('"'===G){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:G});continue}if("("===G){Z("parens"),Y({type:"paren",value:G});continue}if(")"===G){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}Y({type:"paren",value:G,output:j.parens?")":"\\)"}),z("parens");continue}if("["===G){if(!0!==f.nobracket&&W().includes("]"))Z("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));G=`\\${G}`}Y({type:"bracket",value:G});continue}if("]"===G){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){Y({type:"text",value:G,output:`\\${G}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:G,output:`\\${G}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),K.value+=G,q({value:G}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(j.output=j.output.slice(0,-K.value.length),!0===f.literalBrackets){j.output+=n,K.value=n;continue}K.value=`(${m}${n}|${K.value})`,j.output+=K.value;continue}if("{"===G&&!0!==f.nobrace){Z("braces");const e={type:"brace",value:G,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),Y(e);continue}if("}"===G){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:G,output:G});continue}let t=")";if(!0===e.dots){const e=A.slice(),n=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",G=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}Y({type:"brace",value:G,output:t}),z("braces"),P.pop();continue}if("|"===G){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:G});continue}if(","===G){let e=G;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===K.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),K=h;continue}Y({type:"slash",value:G,output:S});continue}if("."===G){if(j.braces>0&&"dot"===K.type){"."===K.value&&(K.output=E);const e=P[P.length-1];K.type="dots",K.output+=G,K.value+=G,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==K.type&&"slash"!==K.type){Y({type:"text",value:G,output:E});continue}Y({type:"dot",value:G,output:E});continue}if("?"===G){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V("qmark",G);continue}if(K&&"paren"===K.type){const e=F();let n=G;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${G}`),Y({type:"text",value:G,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){Y({type:"qmark",value:G,output:k});continue}Y({type:"qmark",value:G,output:H});continue}if("!"===G){if(!0!==f.noextglob&&"("===F()&&("?"!==F(2)||!/[!=<:]/.test(F(3)))){V("negate",G);continue}if(!0!==f.nonegate&&0===j.index){J();continue}}if("+"===G){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V("plus",G);continue}if(K&&"("===K.value||!1===f.regex){Y({type:"plus",value:G,output:b});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||j.parens>0){Y({type:"plus",value:G});continue}Y({type:"plus",value:b});continue}if("@"===G){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){Y({type:"at",extglob:!0,value:G,output:""});continue}Y({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=o.exec(W());e&&(G+=e[0],j.index+=e[0].length),Y({type:"text",value:G});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=G,K.output=M,j.backtrack=!0,j.globstar=!0,X(G);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",G);continue}if("star"===K.type){if(!0===f.noglobstar){X(G);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){Y({type:"star",value:G,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!a){Y({type:"star",value:G,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),X("/**",3)}if("bos"===t.type&&U()){K.type="globstar",K.value+=G,K.output=L(f),j.output=K.output,j.globstar=!0,X(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&U()){j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=L(f)+(f.strictSlashes?")":"|$)"),K.value+=G,j.globstar=!0,j.output+=t.output+K.output,X(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${L(f)}${S}|${S}${n})`,K.value+=G,j.output+=t.output+K.output,j.globstar=!0,X(G+Q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=G,K.output=`(?:^|${S}|${L(f)}${S})`,j.output=K.output,j.globstar=!0,X(G+Q()),Y({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-K.output.length),K.type="globstar",K.output=L(f),K.value+=G,j.output+=K.output,j.globstar=!0,X(G);continue}const n={type:"star",value:G,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(j.index!==j.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(j.output+=x,K.output+=x):!0===f.dot?(j.output+=w,K.output+=w):(j.output+=N,K.output+=N),"*"!==F()&&(j.output+=C,K.output+=C)),Y(n)):(n.output=G,Y(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),Y(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return p.fastpaths=(r,o)=>{const s={...o},i="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=a[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:m,START_ANCHOR:R}=e.globChars(p),y=s.dot?h:d,_=s.dot?A:d,E=s.capture?"":"?:";let b=!0===s.bash?".*?":m;s.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${E}(?:(?!${R}${e.dot?g:l}).)*?)`,C=e=>{switch(e){case"*":return`${y}${f}${b}`;case".*":return`${l}${f}${b}`;case"*.*":return`${y}${b}${l}${f}${b}`;case"*/*":return`${y}${b}${c}${f}${_}${b}`;case"**":return y+S(s);case"**/*":return`(?:${y}${S(s)}${c})?${_}${f}${b}`;case"**/*.*":return`(?:${y}${S(s)}${c})?${_}${b}${l}${f}${b}`;case"**/.*":return`(?:${y}${S(s)}${c})?${l}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==s.strictSlashes&&($+=`${c}?`),$},ve=p}(),r=Ie(),o=Ne(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:a,output:f}=s.test(n,p,t,{glob:e,posix:u}),g={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:a,isMatch:o};return"function"==typeof i.onResult&&i.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof i.onMatch&&i.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:a}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(a?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==i.capture||(p=!0===i.matchBase||!0===i.basename?s.matchBase(e,t,n,a):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,a=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},a=o.contains?"":"^",i=o.contains?"":"$";let u=`${a}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=n.fastpaths(e,t)),a.output||(a=n(e,t)),s.compileRe(a,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,xe=s}function je(){return ke?He:(ke=1,He=Me())}var Be=function(){if(Te)return Oe;Te=1;const e=m,t=ye(),n=je(),r=Ie(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,i=0,u=e=>{a.add(e.output),r&&r.onResult&&r.onResult(e)};for(let a=0;a<t.length;a++){let p=n(String(t[a]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&i++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(i===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],a=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),a={};for(let t of o)a[t]=e[t];return a},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),a=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},Oe=s}();const Pe='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),De="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const Ge=new Map;function Ke(t,r){if(Ge.has(t))return Ge.get(t)[r];const o=n.resolve(t,"package.json"),s=JSON.parse(e.readFileSync(o,"utf-8"));return Ge.set(t,s),s[r]}a.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,t]=a.args,r=process.cwd(),{init:o={}}=F()??{},{wd:s}=k(),i=n.basename(s),{named:u,template:p,bug:l={},readme:c=De,readmeTemplate:f}=o,m={template:"bug_report.yml",labels:["bug"],...l};let R=c;if(f){const t=n.resolve(s,f);R=e.readFileSync(t,"utf-8")}const y=function(t,r){let o=r??Pe,s=!1;try{r&&JSON.parse(r)}catch(e){s=!0}if(s){const s=n.resolve(t,r);o=e.readFileSync(s,"utf-8")}return o}(s,p),{indent:_=" "}=g(y),E={tabSize:_.length,insertSpaces:!0},b=["license","author"];let S=y;for(const e of b)S=h(S,A(S,[e],Ke(s,e),{formattingOptions:E}));let[C,v]=await async function(e,t,{wd:r,cwd:o,workspaceName:s}){const a=o.replace(`${r}/`,"");let i=n.basename(o);if("function"==typeof e)return e(t,{full:r,relative:o});let u,p,l=!1;if("object"==typeof e)if(o===r){const{rule:t}=await d.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(u=t,p=e[t])}else for(const[t,n]of Object.entries(e)){if(Be.isMatch(a,t)){u=t,p=n;break}if(Be.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,u=t,p=n;break}}if(p||(u="packages/*",p=`@${s}/$basename`),!p)throw new Error("no matched rule");if(!t&&l&&(i=await d.prompt({type:"input",name:"name",message:`the matched rule is \`${String(p)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof p)return p(t,{full:r,relative:o,basename:i});if("string"==typeof p){const e=t??i;return[p.replace(/\$basename/g,e),u?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(u,t,{wd:s,cwd:r,workspaceName:i});if(!v){const{dir:e}=await d.prompt({type:"input",name:"dir",message:"package directory",default:t});v=e}if(!C){const{name:e}=await d.prompt({type:"input",name:"name",message:"package name",default:t});C=e}S=h(S,A(S,["name"],C,{formattingOptions:E}));let $=Ke(s,"repository");"string"==typeof $&&($={type:"git",url:$,directory:v}),S=h(S,A(S,["repository"],$,{formattingOptions:E}));S=h(S,A(S,["homepage"],`${$?.url}/blob/master/${v}/README.md`,{formattingOptions:E}));let x=m.labels;"function"==typeof x&&(x=x({name:C,dir:v})),x.push(`scope:${C}`);const w=`${$?.url}/issues/new?template=${m.template}&labels=${x.join(",")}`;function H(e){if(!v)throw new Error("pkgDir is not defined");return n.resolve(v,e)}S=h(S,A(S,["bugs"],w,{formattingOptions:E})),e.existsSync(v)||e.mkdirSync(v);const O=H("package.json");if(e.existsSync(O))throw new Error("package.json already exists");e.writeFileSync(O,S),console.log(S,"written to",O);const T=Ke(s,"license"),L=H("README.md");"function"==typeof R&&(R=R({dir:v,packageJson:JSON.parse(S)}));const N=R.replace(/\$name/g,C).replace(/\$license/g,T);e.writeFileSync(L,N)}));const Ue=(e,t)=>new Set([...e].filter((e=>t.has(e))));a.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-no-b, --no-bumper","no bump version").option("-p, --preview","preview publish").action((async({preview:t,bumper:s,...a})=>{j();const{value:i={}}=await T()??{},u=Object.entries(i);if(0===u.length)throw new Error("no packages selected");const p=u.map((([e,t])=>{const{type:n,exports:s={}}=t,a="module"===n,i={...t},[u,p]=function({entrypoints:e,pkgIsModule:t,entries:n,config:s,dir:a,noFilter:i,isPublish:u}){const{build:p={},publish:{withSuffix:l=!1,withSource:c=!0}={}}=s??{},{crossModuleConvertor:f=!0}=p,g=`./${(e=>o(a??process.cwd(),e))(((...e)=>r(a??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"))}`,[,d]=b(e);n&&Object.entries(d).forEach((([e])=>{n.some((t=>Be.isMatch(e,t,{matchBase:!0})))||delete d[e]}));const h=i?d:S(d,{skipValue:[/(^|\/)\.jk-noentry/,...C]});return[h,v(h,{outdir:g,withSuffix:u?l:void 0,withSource:u?c:void 0,withConditional:{...f?{import:e=>!t&&0===Ue(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ue(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:s,pkgIsModule:a,config:F(e),dir:e,noFilter:!0,isPublish:!0});return i.exports={...u,...p},[e,i]})),l=Object.entries(a).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[r,o]of p){const a=e.readFileSync(n.join(r,"package.json"),"utf-8"),i=JSON.parse(a)??"0.0.0",u=s?_(i.version,s):i.version,{indent:p=" "}=g(a),c={tabSize:p.length,insertSpaces:!0};let f=a;f=h(f,A(f,["version"],u,{formattingOptions:c}));for(const[e,t]of Object.entries(o))if(JSON.stringify(t)!==JSON.stringify(i[e]))if("exports"!==e)f=h(f,A(f,["publishConfig",e],t,{formattingOptions:c}));else{const e=t;for(const[t,n]of Object.entries(e))f=h(f,A(f,["publishConfig","exports",t],n,{formattingOptions:c}));const n=e?.["."],r={};if(n){switch(typeof n){case"string":r["module"===o?.type?"module":"main"]=n;break;case"object":{const e=n;r.main=e.require??e.default,r.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(r))void 0!==t&&(f=h(f,A(f,["publishConfig",e],t,{formattingOptions:c})))}}try{if(e.renameSync(n.join(r,"package.json"),n.join(r,"package.json.bak")),e.writeFileSync(n.join(r,"package.json"),f),console.log(f),t){console.warn("preview mode");continue}const o=["pnpm","publish","--access","public","--no-git-checks",...l];s&&E.includes(s)&&o.push("--tag",s),y.execSync(o.join(" "),{cwd:r,stdio:"inherit"});const i=h(a,A(a,["version"],u,{}));e.writeFileSync(n.join(r,"package.json.bak"),i)}finally{e.unlinkSync(n.join(r,"package.json")),e.renameSync(n.join(r,"package.json.bak"),n.join(r,"package.json"))}}M()})),a.parse(process.argv);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "jiek",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.7-alpha.1",
|
5
5
|
"description": "YiJie's personal kits.",
|
6
6
|
"bin": {
|
7
7
|
"jiek": "bin/jiek.js",
|
@@ -58,11 +58,11 @@
|
|
58
58
|
"inquirer": "^8.2.6",
|
59
59
|
"js-yaml": "^4.1.0",
|
60
60
|
"jsonc-parser": "^3.2.1",
|
61
|
-
"rollup": "
|
61
|
+
"rollup": "4.13.2",
|
62
62
|
"rollup-plugin-esbuild": "^6.1.0",
|
63
63
|
"typescript": "^5.0.0",
|
64
|
-
"@jiek/
|
65
|
-
"@jiek/
|
64
|
+
"@jiek/pkger": "^0.2.0",
|
65
|
+
"@jiek/utils": "^0.2.2"
|
66
66
|
},
|
67
67
|
"optionalDependencies": {
|
68
68
|
"@pnpm/filter-workspace-packages": "^7.2.13",
|
@@ -84,6 +84,9 @@
|
|
84
84
|
"postcss": "^8.4.47",
|
85
85
|
"rollup-plugin-postcss": "^4.0.2"
|
86
86
|
},
|
87
|
+
"scripts": {
|
88
|
+
"prepublish": "jk build"
|
89
|
+
},
|
87
90
|
"main": "./dist/index.cjs",
|
88
91
|
"module": "./dist/index.js"
|
89
92
|
}
|
package/src/commands/build.ts
CHANGED
@@ -8,7 +8,7 @@ import { execaCommand } from 'execa'
|
|
8
8
|
|
9
9
|
import { actionDone, actionRestore } from '../inner'
|
10
10
|
import type { RollupProgressEvent, TemplateOptions } from '../rollup/base'
|
11
|
-
import
|
11
|
+
import { getSelectedProjectsGraph, ProjectsGraph } from '../utils/filterSupport'
|
12
12
|
import { filterPackagesGraph } from '../utils/filterSupport'
|
13
13
|
import { loadConfig } from '../utils/loadConfig'
|
14
14
|
import { tsRegisterName } from '../utils/tsRegister'
|
@@ -182,13 +182,17 @@ program
|
|
182
182
|
})
|
183
183
|
)
|
184
184
|
}
|
185
|
-
const filters
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
185
|
+
const filters = (program.getOptionValue('filter') as string | undefined)?.split(',')
|
186
|
+
try {
|
187
|
+
if (filters) {
|
188
|
+
const packages = await filterPackagesGraph(filters)
|
189
|
+
await Promise.all(packages.map(buildPackage))
|
190
|
+
} else {
|
191
|
+
await buildPackage(await getSelectedProjectsGraph())
|
192
|
+
}
|
193
|
+
} finally {
|
194
|
+
multiBars.stop()
|
195
|
+
}
|
192
196
|
|
193
197
|
actionDone()
|
194
198
|
})
|
package/src/commands/publish.ts
CHANGED
@@ -2,7 +2,7 @@ import * as childProcess from 'node:child_process'
|
|
2
2
|
import fs from 'node:fs'
|
3
3
|
import path from 'node:path'
|
4
4
|
|
5
|
-
import { bump, type BumperType } from '@jiek/utils/bumper'
|
5
|
+
import { bump, type BumperType, TAGS } from '@jiek/utils/bumper'
|
6
6
|
import { program } from 'commander'
|
7
7
|
import detectIndent from 'detect-indent'
|
8
8
|
import { applyEdits, modify } from 'jsonc-parser'
|
@@ -156,7 +156,11 @@ program
|
|
156
156
|
console.warn('preview mode')
|
157
157
|
continue
|
158
158
|
}
|
159
|
-
|
159
|
+
const args = ['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs]
|
160
|
+
if (bumper && TAGS.includes(bumper)) {
|
161
|
+
args.push('--tag', bumper)
|
162
|
+
}
|
163
|
+
childProcess.execSync(args.join(' '), {
|
160
164
|
cwd: dir,
|
161
165
|
stdio: 'inherit'
|
162
166
|
})
|
@@ -38,9 +38,18 @@ export function filterPackagesGraph(filters: string[]): Promise<ProjectsGraph[]>
|
|
38
38
|
export async function getSelectedProjectsGraph(
|
39
39
|
filter = program.getOptionValue('filter')
|
40
40
|
): Promise<ProjectsGraph> {
|
41
|
-
|
41
|
+
let root = getRoot()
|
42
42
|
const { wd, notWorkspace } = getWD()
|
43
|
-
if (
|
43
|
+
if (notWorkspace) {
|
44
|
+
return {
|
45
|
+
wd,
|
46
|
+
root,
|
47
|
+
value: {
|
48
|
+
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
if (type === 'pnpm') {
|
44
53
|
const pnpmWorkspaceFilePath = path.resolve(wd, 'pnpm-workspace.yaml')
|
45
54
|
const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, 'utf-8')
|
46
55
|
const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {
|
@@ -50,6 +59,9 @@ export async function getSelectedProjectsGraph(
|
|
50
59
|
throw new Error('root path is workspace root, please provide a filter')
|
51
60
|
// TODO inquirer prompt support user select packages
|
52
61
|
}
|
62
|
+
if (root === undefined) {
|
63
|
+
root = process.cwd()
|
64
|
+
}
|
53
65
|
if (root !== wd && !filter) {
|
54
66
|
const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))
|
55
67
|
if (!packageJSONIsExist) {
|
@@ -79,11 +91,5 @@ export async function getSelectedProjectsGraph(
|
|
79
91
|
}, {} as NonNullable<ProjectsGraph['value']>)
|
80
92
|
}
|
81
93
|
}
|
82
|
-
|
83
|
-
wd,
|
84
|
-
root,
|
85
|
-
value: {
|
86
|
-
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))
|
87
|
-
}
|
88
|
-
}
|
94
|
+
throw new Error(`not supported package manager ${type}`)
|
89
95
|
}
|