@voidzero-dev/vite-plus-core 0.1.13-alpha.3 → 0.1.13-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm-shims.js +9 -0
- package/dist/rolldown/cli.mjs +211 -73
- package/dist/rolldown/config.d.mts +1 -1
- package/dist/rolldown/config.mjs +8 -8
- package/dist/rolldown/experimental-index.d.mts +7 -7
- package/dist/rolldown/experimental-index.mjs +12 -13
- package/dist/rolldown/filter-index.d.mts +1 -1
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +9 -9
- package/dist/rolldown/parallel-plugin-worker.mjs +5 -5
- package/dist/rolldown/parallel-plugin.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.mjs +2 -2
- package/dist/rolldown/plugins-index.d.mts +3 -3
- package/dist/rolldown/plugins-index.mjs +3 -3
- package/dist/rolldown/shared/{binding-BohGL_65.d.mts → binding-Dsq9Azhm.d.mts} +14 -17
- package/dist/rolldown/shared/{bindingify-input-options-D6u7COm1.mjs → bindingify-input-options-nddSVL89.mjs} +16 -11
- package/dist/rolldown/shared/{constructors-DNuo4d0H.d.mts → constructors-DfpIbfMG.d.mts} +7 -3
- package/dist/rolldown/shared/{constructors-Ctal_Rbv.mjs → constructors-DqC7XSXy.mjs} +8 -2
- package/dist/rolldown/shared/{define-config-cG45vHwf.d.mts → define-config-CV9D_Qea.d.mts} +19 -12
- package/dist/rolldown/shared/{error-CP8smW_P.mjs → error-BO4SlZV_.mjs} +1 -1
- package/dist/rolldown/shared/{load-config-CjCoDD5h.mjs → load-config-CDqvxxnl.mjs} +1 -1
- package/dist/rolldown/shared/{normalize-string-or-regex-C5RWbu3O.mjs → normalize-string-or-regex-D7wlw16t.mjs} +1 -1
- package/dist/rolldown/shared/{parse-BhVn_3w_.mjs → parse-WOgXxW4-.mjs} +1 -1
- package/dist/rolldown/shared/{transform-BfdLLNnY.mjs → resolve-tsconfig-C3OzszY-.mjs} +28 -5
- package/dist/rolldown/shared/{rolldown-B7hI_r7G.mjs → rolldown-DUOYLKyH.mjs} +1 -1
- package/dist/rolldown/shared/{rolldown-build-CYoDea9V.mjs → rolldown-build-C7TjtSci.mjs} +4 -4
- package/dist/rolldown/shared/{transform-BoJxrM-e.d.mts → transform-B5D1aA1B.d.mts} +19 -2
- package/dist/rolldown/shared/{watch-CAj7leYN.mjs → watch-BV1BB_LU.mjs} +4 -4
- package/dist/rolldown/utils-index.d.mts +2 -2
- package/dist/rolldown/utils-index.mjs +4 -5
- package/dist/tsdown/{build-CoLhkNXE-DtR1EaBG.js → build-CoLhkNXE-DccPqXpK.js} +7 -7
- package/dist/tsdown/{build-dhDyu66J-DxSssGzc.js → build-dhDyu66J-C3xzaksU.js} +2 -2
- package/dist/tsdown/{debug-C4FmgzkJ-Co4tnxmE.js → debug-C4FmgzkJ-BxvFHEjv.js} +2 -2
- package/dist/tsdown/{detect-DN3DXXYt-BiiMP_XL.js → detect-DN3DXXYt-CgZGWZG7.js} +1 -1
- package/dist/tsdown/index-types.d.ts +6 -6
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/{main-JovZVvCY.js → main-CU_sednE.js} +2 -2
- package/dist/tsdown/run.js +3 -3
- package/dist/vite/client/client.mjs +12 -12
- package/dist/vite/client/env.mjs +1 -1
- package/dist/vite/node/chunks/build2.js +5 -14
- package/dist/vite/node/chunks/dist.js +6 -11
- package/dist/vite/node/chunks/dist2.js +1 -4
- package/dist/vite/node/chunks/logger.js +4 -4
- package/dist/vite/node/chunks/node.js +193 -178
- package/dist/vite/node/cli.js +1 -1
- package/dist/vite/node/index.d.ts +3 -3
- package/dist/vite/node/module-runner.js +18 -18
- package/package.json +7 -7
- /package/dist/rolldown/shared/{binding-C5G6_6ql.mjs → binding-BV_UWDF3.mjs} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Shim globals in esm bundle
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
const getFilename = () => fileURLToPath(import.meta.url)
|
|
6
|
+
const getDirname = () => path.dirname(getFilename())
|
|
7
|
+
|
|
8
|
+
export const __dirname = /* @__PURE__ */ getDirname()
|
|
9
|
+
export const __filename = /* @__PURE__ */ getFilename()
|
package/dist/rolldown/cli.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { n as onExit, t as watch } from "./shared/watch-
|
|
3
|
-
import "./shared/normalize-string-or-regex-
|
|
4
|
-
import { C as version, S as description } from "./shared/bindingify-input-options-
|
|
1
|
+
import "./shared/binding-BV_UWDF3.mjs";
|
|
2
|
+
import { n as onExit, t as watch } from "./shared/watch-BV1BB_LU.mjs";
|
|
3
|
+
import "./shared/normalize-string-or-regex-D7wlw16t.mjs";
|
|
4
|
+
import { C as version, S as description } from "./shared/bindingify-input-options-nddSVL89.mjs";
|
|
5
5
|
import { t as arraify } from "./shared/misc-DJYbNKZX.mjs";
|
|
6
|
-
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-
|
|
7
|
-
import "./shared/error-
|
|
8
|
-
import "./shared/parse-
|
|
9
|
-
import { t as rolldown } from "./shared/rolldown-
|
|
10
|
-
import { t as loadConfig } from "./shared/load-config-
|
|
6
|
+
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-C7TjtSci.mjs";
|
|
7
|
+
import "./shared/error-BO4SlZV_.mjs";
|
|
8
|
+
import "./shared/parse-WOgXxW4-.mjs";
|
|
9
|
+
import { t as rolldown } from "./shared/rolldown-DUOYLKyH.mjs";
|
|
10
|
+
import { t as loadConfig } from "./shared/load-config-CDqvxxnl.mjs";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import process$1 from "node:process";
|
|
13
|
-
import { EventEmitter } from "events";
|
|
14
13
|
import { performance } from "node:perf_hooks";
|
|
15
|
-
//#region ../../../node_modules/.pnpm/cac@
|
|
14
|
+
//#region ../../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
16
15
|
function toArr(any) {
|
|
17
16
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
18
17
|
}
|
|
@@ -20,7 +19,7 @@ function toVal(out, key, val, opts) {
|
|
|
20
19
|
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
|
21
20
|
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
22
21
|
}
|
|
23
|
-
function
|
|
22
|
+
function lib_default(args, opts) {
|
|
24
23
|
args = args || [];
|
|
25
24
|
opts = opts || {};
|
|
26
25
|
var k, arr, arg, name, val, out = { _: [] };
|
|
@@ -85,8 +84,10 @@ function mri2(args, opts) {
|
|
|
85
84
|
}
|
|
86
85
|
return out;
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
function removeBrackets(v) {
|
|
88
|
+
return v.replace(/[<[].+/, "").trim();
|
|
89
|
+
}
|
|
90
|
+
function findAllBrackets(v) {
|
|
90
91
|
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
91
92
|
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
92
93
|
const res = [];
|
|
@@ -108,8 +109,8 @@ const findAllBrackets = (v) => {
|
|
|
108
109
|
let squareMatch;
|
|
109
110
|
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
|
|
110
111
|
return res;
|
|
111
|
-
}
|
|
112
|
-
|
|
112
|
+
}
|
|
113
|
+
function getMriOptions(options) {
|
|
113
114
|
const result = {
|
|
114
115
|
alias: {},
|
|
115
116
|
boolean: []
|
|
@@ -123,62 +124,76 @@ const getMriOptions = (options) => {
|
|
|
123
124
|
} else result.boolean.push(option.names[0]);
|
|
124
125
|
}
|
|
125
126
|
return result;
|
|
126
|
-
}
|
|
127
|
-
|
|
127
|
+
}
|
|
128
|
+
function findLongest(arr) {
|
|
128
129
|
return arr.sort((a, b) => {
|
|
129
130
|
return a.length > b.length ? -1 : 1;
|
|
130
131
|
})[0];
|
|
131
|
-
}
|
|
132
|
-
|
|
132
|
+
}
|
|
133
|
+
function padRight(str, length) {
|
|
133
134
|
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return input.
|
|
135
|
+
}
|
|
136
|
+
function camelcase(input) {
|
|
137
|
+
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
|
137
138
|
return p1 + p2.toUpperCase();
|
|
138
139
|
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
let
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
}
|
|
141
|
+
function setDotProp(obj, keys, val) {
|
|
142
|
+
let current = obj;
|
|
143
|
+
for (let i = 0; i < keys.length; i++) {
|
|
144
|
+
const key = keys[i];
|
|
145
|
+
if (i === keys.length - 1) {
|
|
146
|
+
current[key] = val;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (current[key] == null) {
|
|
150
|
+
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
|
151
|
+
current[key] = nextKeyIsArrayIndex ? [] : {};
|
|
152
|
+
}
|
|
153
|
+
current = current[key];
|
|
148
154
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
155
|
+
}
|
|
156
|
+
function setByType(obj, transforms) {
|
|
151
157
|
for (const key of Object.keys(transforms)) {
|
|
152
158
|
const transform = transforms[key];
|
|
153
159
|
if (transform.shouldTransform) {
|
|
154
|
-
obj[key] =
|
|
160
|
+
obj[key] = [obj[key]].flat();
|
|
155
161
|
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
|
156
162
|
}
|
|
157
163
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const m = /([
|
|
164
|
+
}
|
|
165
|
+
function getFileName(input) {
|
|
166
|
+
const m = /([^\\/]+)$/.exec(input);
|
|
161
167
|
return m ? m[1] : "";
|
|
162
|
-
}
|
|
163
|
-
|
|
168
|
+
}
|
|
169
|
+
function camelcaseOptionName(name) {
|
|
164
170
|
return name.split(".").map((v, i) => {
|
|
165
171
|
return i === 0 ? camelcase(v) : v;
|
|
166
172
|
}).join(".");
|
|
167
|
-
}
|
|
173
|
+
}
|
|
168
174
|
var CACError = class extends Error {
|
|
169
175
|
constructor(message) {
|
|
170
176
|
super(message);
|
|
171
|
-
this.name =
|
|
172
|
-
if (typeof Error.captureStackTrace
|
|
173
|
-
else this.stack = new Error(message).stack;
|
|
177
|
+
this.name = "CACError";
|
|
178
|
+
if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
|
|
174
179
|
}
|
|
175
180
|
};
|
|
176
181
|
var Option = class {
|
|
182
|
+
rawName;
|
|
183
|
+
description;
|
|
184
|
+
/** Option name */
|
|
185
|
+
name;
|
|
186
|
+
/** Option name and aliases */
|
|
187
|
+
names;
|
|
188
|
+
isBoolean;
|
|
189
|
+
required;
|
|
190
|
+
config;
|
|
191
|
+
negated;
|
|
177
192
|
constructor(rawName, description, config) {
|
|
178
193
|
this.rawName = rawName;
|
|
179
194
|
this.description = description;
|
|
180
195
|
this.config = Object.assign({}, config);
|
|
181
|
-
rawName = rawName.
|
|
196
|
+
rawName = rawName.replaceAll(".*", "");
|
|
182
197
|
this.negated = false;
|
|
183
198
|
this.names = removeBrackets(rawName).split(",").map((v) => {
|
|
184
199
|
let name = v.trim().replace(/^-{1,2}/, "");
|
|
@@ -188,16 +203,39 @@ var Option = class {
|
|
|
188
203
|
}
|
|
189
204
|
return camelcaseOptionName(name);
|
|
190
205
|
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
|
191
|
-
this.name = this.names
|
|
206
|
+
this.name = this.names.at(-1);
|
|
192
207
|
if (this.negated && this.config.default == null) this.config.default = true;
|
|
193
208
|
if (rawName.includes("<")) this.required = true;
|
|
194
209
|
else if (rawName.includes("[")) this.required = false;
|
|
195
210
|
else this.isBoolean = true;
|
|
196
211
|
}
|
|
197
212
|
};
|
|
198
|
-
|
|
199
|
-
|
|
213
|
+
let runtimeProcessArgs;
|
|
214
|
+
let runtimeInfo;
|
|
215
|
+
if (typeof process !== "undefined") {
|
|
216
|
+
let runtimeName;
|
|
217
|
+
if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
|
|
218
|
+
else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
|
|
219
|
+
else runtimeName = "node";
|
|
220
|
+
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
|
|
221
|
+
runtimeProcessArgs = process.argv;
|
|
222
|
+
} else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
|
|
223
|
+
else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
|
|
200
224
|
var Command = class {
|
|
225
|
+
rawName;
|
|
226
|
+
description;
|
|
227
|
+
config;
|
|
228
|
+
cli;
|
|
229
|
+
options;
|
|
230
|
+
aliasNames;
|
|
231
|
+
name;
|
|
232
|
+
args;
|
|
233
|
+
commandAction;
|
|
234
|
+
usageText;
|
|
235
|
+
versionNumber;
|
|
236
|
+
examples;
|
|
237
|
+
helpCallback;
|
|
238
|
+
globalCommand;
|
|
201
239
|
constructor(rawName, description, config = {}, cli) {
|
|
202
240
|
this.rawName = rawName;
|
|
203
241
|
this.description = description;
|
|
@@ -230,6 +268,12 @@ var Command = class {
|
|
|
230
268
|
this.examples.push(example);
|
|
231
269
|
return this;
|
|
232
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Add a option for this command
|
|
273
|
+
* @param rawName Raw option name(s)
|
|
274
|
+
* @param description Option description
|
|
275
|
+
* @param config Option config
|
|
276
|
+
*/
|
|
233
277
|
option(rawName, description, config) {
|
|
234
278
|
const option = new Option(rawName, description, config);
|
|
235
279
|
this.options.push(option);
|
|
@@ -243,6 +287,10 @@ var Command = class {
|
|
|
243
287
|
this.commandAction = callback;
|
|
244
288
|
return this;
|
|
245
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Check if a command name is matched by this command
|
|
292
|
+
* @param name Command name
|
|
293
|
+
*/
|
|
246
294
|
isMatched(name) {
|
|
247
295
|
return this.name === name || this.aliasNames.includes(name);
|
|
248
296
|
}
|
|
@@ -252,6 +300,10 @@ var Command = class {
|
|
|
252
300
|
get isGlobalCommand() {
|
|
253
301
|
return this instanceof GlobalCommand;
|
|
254
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Check if an option is registered in this command
|
|
305
|
+
* @param name Option name
|
|
306
|
+
*/
|
|
255
307
|
hasOption(name) {
|
|
256
308
|
name = name.split(".")[0];
|
|
257
309
|
return this.options.find((option) => {
|
|
@@ -273,8 +325,7 @@ var Command = class {
|
|
|
273
325
|
body: commands.map((command) => {
|
|
274
326
|
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
275
327
|
}).join("\n")
|
|
276
|
-
}
|
|
277
|
-
sections.push({
|
|
328
|
+
}, {
|
|
278
329
|
title: `For more info, run any command with the \`--help\` flag`,
|
|
279
330
|
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
|
280
331
|
});
|
|
@@ -298,26 +349,33 @@ var Command = class {
|
|
|
298
349
|
}).join("\n")
|
|
299
350
|
});
|
|
300
351
|
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
301
|
-
console.
|
|
302
|
-
return section.title ? `${section.title}:
|
|
303
|
-
${section.body}` : section.body;
|
|
352
|
+
console.info(sections.map((section) => {
|
|
353
|
+
return section.title ? `${section.title}:\n${section.body}` : section.body;
|
|
304
354
|
}).join("\n\n"));
|
|
305
355
|
}
|
|
306
356
|
outputVersion() {
|
|
307
357
|
const { name } = this.cli;
|
|
308
358
|
const { versionNumber } = this.cli.globalCommand;
|
|
309
|
-
if (versionNumber) console.
|
|
359
|
+
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
|
|
310
360
|
}
|
|
311
361
|
checkRequiredArgs() {
|
|
312
362
|
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
|
313
363
|
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
314
364
|
}
|
|
365
|
+
/**
|
|
366
|
+
* Check if the parsed options contain any unknown options
|
|
367
|
+
*
|
|
368
|
+
* Exit and output error when true
|
|
369
|
+
*/
|
|
315
370
|
checkUnknownOptions() {
|
|
316
371
|
const { options, globalCommand } = this.cli;
|
|
317
372
|
if (!this.config.allowUnknownOptions) {
|
|
318
373
|
for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
|
319
374
|
}
|
|
320
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Check if the required string-type options exist
|
|
378
|
+
*/
|
|
321
379
|
checkOptionValue() {
|
|
322
380
|
const { options: parsedOptions, globalCommand } = this.cli;
|
|
323
381
|
const options = [...globalCommand.options, ...this.options];
|
|
@@ -329,14 +387,43 @@ ${section.body}` : section.body;
|
|
|
329
387
|
}
|
|
330
388
|
}
|
|
331
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Check if the number of args is more than expected
|
|
392
|
+
*/
|
|
393
|
+
checkUnusedArgs() {
|
|
394
|
+
const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
|
|
395
|
+
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
|
|
396
|
+
}
|
|
332
397
|
};
|
|
333
398
|
var GlobalCommand = class extends Command {
|
|
334
399
|
constructor(cli) {
|
|
335
400
|
super("@@global@@", "", {}, cli);
|
|
336
401
|
}
|
|
337
402
|
};
|
|
338
|
-
var
|
|
339
|
-
|
|
403
|
+
var CAC = class extends EventTarget {
|
|
404
|
+
/** The program name to display in help and version message */
|
|
405
|
+
name;
|
|
406
|
+
commands;
|
|
407
|
+
globalCommand;
|
|
408
|
+
matchedCommand;
|
|
409
|
+
matchedCommandName;
|
|
410
|
+
/**
|
|
411
|
+
* Raw CLI arguments
|
|
412
|
+
*/
|
|
413
|
+
rawArgs;
|
|
414
|
+
/**
|
|
415
|
+
* Parsed CLI arguments
|
|
416
|
+
*/
|
|
417
|
+
args;
|
|
418
|
+
/**
|
|
419
|
+
* Parsed CLI options, camelCased
|
|
420
|
+
*/
|
|
421
|
+
options;
|
|
422
|
+
showHelpOnExit;
|
|
423
|
+
showVersionOnExit;
|
|
424
|
+
/**
|
|
425
|
+
* @param name The program name to display in help and version message
|
|
426
|
+
*/
|
|
340
427
|
constructor(name = "") {
|
|
341
428
|
super();
|
|
342
429
|
this.name = name;
|
|
@@ -347,39 +434,75 @@ var CAC = class extends EventEmitter {
|
|
|
347
434
|
this.globalCommand = new GlobalCommand(this);
|
|
348
435
|
this.globalCommand.usage("<command> [options]");
|
|
349
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Add a global usage text.
|
|
439
|
+
*
|
|
440
|
+
* This is not used by sub-commands.
|
|
441
|
+
*/
|
|
350
442
|
usage(text) {
|
|
351
443
|
this.globalCommand.usage(text);
|
|
352
444
|
return this;
|
|
353
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* Add a sub-command
|
|
448
|
+
*/
|
|
354
449
|
command(rawName, description, config) {
|
|
355
450
|
const command = new Command(rawName, description || "", config, this);
|
|
356
451
|
command.globalCommand = this.globalCommand;
|
|
357
452
|
this.commands.push(command);
|
|
358
453
|
return command;
|
|
359
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* Add a global CLI option.
|
|
457
|
+
*
|
|
458
|
+
* Which is also applied to sub-commands.
|
|
459
|
+
*/
|
|
360
460
|
option(rawName, description, config) {
|
|
361
461
|
this.globalCommand.option(rawName, description, config);
|
|
362
462
|
return this;
|
|
363
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Show help message when `-h, --help` flags appear.
|
|
466
|
+
*
|
|
467
|
+
*/
|
|
364
468
|
help(callback) {
|
|
365
469
|
this.globalCommand.option("-h, --help", "Display this message");
|
|
366
470
|
this.globalCommand.helpCallback = callback;
|
|
367
471
|
this.showHelpOnExit = true;
|
|
368
472
|
return this;
|
|
369
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Show version number when `-v, --version` flags appear.
|
|
476
|
+
*
|
|
477
|
+
*/
|
|
370
478
|
version(version, customFlags = "-v, --version") {
|
|
371
479
|
this.globalCommand.version(version, customFlags);
|
|
372
480
|
this.showVersionOnExit = true;
|
|
373
481
|
return this;
|
|
374
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Add a global example.
|
|
485
|
+
*
|
|
486
|
+
* This example added here will not be used by sub-commands.
|
|
487
|
+
*/
|
|
375
488
|
example(example) {
|
|
376
489
|
this.globalCommand.example(example);
|
|
377
490
|
return this;
|
|
378
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* Output the corresponding help message
|
|
494
|
+
* When a sub-command is matched, output the help message for the command
|
|
495
|
+
* Otherwise output the global one.
|
|
496
|
+
*
|
|
497
|
+
*/
|
|
379
498
|
outputHelp() {
|
|
380
499
|
if (this.matchedCommand) this.matchedCommand.outputHelp();
|
|
381
500
|
else this.globalCommand.outputHelp();
|
|
382
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Output the version number.
|
|
504
|
+
*
|
|
505
|
+
*/
|
|
383
506
|
outputVersion() {
|
|
384
507
|
this.globalCommand.outputVersion();
|
|
385
508
|
}
|
|
@@ -394,7 +517,14 @@ var CAC = class extends EventEmitter {
|
|
|
394
517
|
this.matchedCommand = void 0;
|
|
395
518
|
this.matchedCommandName = void 0;
|
|
396
519
|
}
|
|
397
|
-
|
|
520
|
+
/**
|
|
521
|
+
* Parse argv
|
|
522
|
+
*/
|
|
523
|
+
parse(argv, { run = true } = {}) {
|
|
524
|
+
if (!argv) {
|
|
525
|
+
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
|
|
526
|
+
argv = runtimeProcessArgs;
|
|
527
|
+
}
|
|
398
528
|
this.rawArgs = argv;
|
|
399
529
|
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
400
530
|
let shouldParse = true;
|
|
@@ -403,17 +533,20 @@ var CAC = class extends EventEmitter {
|
|
|
403
533
|
const commandName = parsed.args[0];
|
|
404
534
|
if (command.isMatched(commandName)) {
|
|
405
535
|
shouldParse = false;
|
|
406
|
-
const parsedInfo =
|
|
536
|
+
const parsedInfo = {
|
|
537
|
+
...parsed,
|
|
538
|
+
args: parsed.args.slice(1)
|
|
539
|
+
};
|
|
407
540
|
this.setParsedInfo(parsedInfo, command, commandName);
|
|
408
|
-
this.
|
|
541
|
+
this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
|
|
409
542
|
}
|
|
410
543
|
}
|
|
411
544
|
if (shouldParse) {
|
|
412
|
-
for (const command of this.commands) if (command.
|
|
545
|
+
for (const command of this.commands) if (command.isDefaultCommand) {
|
|
413
546
|
shouldParse = false;
|
|
414
547
|
const parsed = this.mri(argv.slice(2), command);
|
|
415
548
|
this.setParsedInfo(parsed, command);
|
|
416
|
-
this.
|
|
549
|
+
this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
|
|
417
550
|
}
|
|
418
551
|
}
|
|
419
552
|
if (shouldParse) {
|
|
@@ -435,7 +568,7 @@ var CAC = class extends EventEmitter {
|
|
|
435
568
|
options: this.options
|
|
436
569
|
};
|
|
437
570
|
if (run) this.runMatchedCommand();
|
|
438
|
-
if (!this.matchedCommand && this.args[0]) this.
|
|
571
|
+
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
|
|
439
572
|
return parsedArgv;
|
|
440
573
|
}
|
|
441
574
|
mri(argv, command) {
|
|
@@ -443,26 +576,27 @@ var CAC = class extends EventEmitter {
|
|
|
443
576
|
const mriOptions = getMriOptions(cliOptions);
|
|
444
577
|
let argsAfterDoubleDashes = [];
|
|
445
578
|
const doubleDashesIndex = argv.indexOf("--");
|
|
446
|
-
if (doubleDashesIndex
|
|
579
|
+
if (doubleDashesIndex !== -1) {
|
|
447
580
|
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
448
581
|
argv = argv.slice(0, doubleDashesIndex);
|
|
449
582
|
}
|
|
450
|
-
let parsed =
|
|
583
|
+
let parsed = lib_default(argv, mriOptions);
|
|
451
584
|
parsed = Object.keys(parsed).reduce((res, name) => {
|
|
452
|
-
return
|
|
585
|
+
return {
|
|
586
|
+
...res,
|
|
587
|
+
[camelcaseOptionName(name)]: parsed[name]
|
|
588
|
+
};
|
|
453
589
|
}, { _: [] });
|
|
454
590
|
const args = parsed._;
|
|
455
591
|
const options = { "--": argsAfterDoubleDashes };
|
|
456
592
|
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
457
|
-
|
|
593
|
+
const transforms = Object.create(null);
|
|
458
594
|
for (const cliOption of cliOptions) {
|
|
459
595
|
if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
|
|
460
|
-
if (Array.isArray(cliOption.config.type)) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
|
465
|
-
}
|
|
596
|
+
if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
|
|
597
|
+
transforms[cliOption.name] = Object.create(null);
|
|
598
|
+
transforms[cliOption.name].shouldTransform = true;
|
|
599
|
+
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
|
466
600
|
}
|
|
467
601
|
}
|
|
468
602
|
for (const key of Object.keys(parsed)) if (key !== "_") {
|
|
@@ -480,6 +614,7 @@ var CAC = class extends EventEmitter {
|
|
|
480
614
|
command.checkUnknownOptions();
|
|
481
615
|
command.checkOptionValue();
|
|
482
616
|
command.checkRequiredArgs();
|
|
617
|
+
command.checkUnusedArgs();
|
|
483
618
|
const actionArgs = [];
|
|
484
619
|
command.args.forEach((arg, index) => {
|
|
485
620
|
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
@@ -489,6 +624,9 @@ var CAC = class extends EventEmitter {
|
|
|
489
624
|
return command.commandAction.apply(this, actionArgs);
|
|
490
625
|
}
|
|
491
626
|
};
|
|
627
|
+
/**
|
|
628
|
+
* @param name The program name to display in help and version message
|
|
629
|
+
*/
|
|
492
630
|
const cac = (name = "") => new CAC(name);
|
|
493
631
|
//#endregion
|
|
494
632
|
//#region src/cli/arguments/alias.ts
|
|
@@ -713,7 +851,7 @@ function getClearScreenFunction(options) {
|
|
|
713
851
|
};
|
|
714
852
|
}
|
|
715
853
|
//#endregion
|
|
716
|
-
//#region \0@oxc-project+runtime@0.
|
|
854
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/usingCtx.js
|
|
717
855
|
function _usingCtx() {
|
|
718
856
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
719
857
|
var n = Error();
|
package/dist/rolldown/config.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import "./shared/normalize-string-or-regex-
|
|
3
|
-
import { x as VERSION } from "./shared/bindingify-input-options-
|
|
4
|
-
import "./shared/rolldown-build-
|
|
5
|
-
import "./shared/error-
|
|
6
|
-
import "./shared/parse-
|
|
7
|
-
import "./shared/rolldown-
|
|
1
|
+
import "./shared/binding-BV_UWDF3.mjs";
|
|
2
|
+
import "./shared/normalize-string-or-regex-D7wlw16t.mjs";
|
|
3
|
+
import { x as VERSION } from "./shared/bindingify-input-options-nddSVL89.mjs";
|
|
4
|
+
import "./shared/rolldown-build-C7TjtSci.mjs";
|
|
5
|
+
import "./shared/error-BO4SlZV_.mjs";
|
|
6
|
+
import "./shared/parse-WOgXxW4-.mjs";
|
|
7
|
+
import "./shared/rolldown-DUOYLKyH.mjs";
|
|
8
8
|
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
|
|
9
|
-
import { t as loadConfig } from "./shared/load-config-
|
|
9
|
+
import { t as loadConfig } from "./shared/load-config-CDqvxxnl.mjs";
|
|
10
10
|
export { VERSION, defineConfig, loadConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Jt as freeExternalMemory, Kt as RolldownOutput, Lt as OutputOptions, N as BuiltinPlugin, X as defineParallelPlugin, c as InputOptions, st as NormalizedOutputOptions } from "./shared/define-config-
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as
|
|
1
|
+
import { B as ResolveResult, C as BindingViteManifestPluginConfig, G as isolatedDeclaration, I as NapiResolveOptions, K as isolatedDeclarationSync, M as IsolatedDeclarationsResult, O as BindingViteTransformPluginConfig, V as ResolverFactory, _ as BindingTsconfigRawOptions, f as BindingRebuildStrategy, g as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, j as IsolatedDeclarationsOptions, n as BindingBundleAnalyzerPluginConfig, q as moduleRunnerTransform, r as BindingBundleState } from "./shared/binding-Dsq9Azhm.mjs";
|
|
2
|
+
import { Jt as freeExternalMemory, Kt as RolldownOutput, Lt as OutputOptions, N as BuiltinPlugin, X as defineParallelPlugin, c as InputOptions, st as NormalizedOutputOptions } from "./shared/define-config-CV9D_Qea.mjs";
|
|
3
|
+
import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-B5D1aA1B.mjs";
|
|
4
|
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-DfpIbfMG.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/api/dev/dev-options.d.ts
|
|
7
7
|
type DevOnHmrUpdates = (result: Error | {
|
|
@@ -158,11 +158,11 @@ declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
|
|
|
158
158
|
* @example
|
|
159
159
|
* **LLM-friendly markdown output**
|
|
160
160
|
* ```js
|
|
161
|
-
* import {
|
|
161
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
162
162
|
*
|
|
163
163
|
* export default {
|
|
164
164
|
* plugins: [
|
|
165
|
-
*
|
|
165
|
+
* bundleAnalyzerPlugin({
|
|
166
166
|
* format: 'md'
|
|
167
167
|
* })
|
|
168
168
|
* ]
|
|
@@ -250,4 +250,4 @@ type TsconfigRawOptions = BindingTsconfigRawOptions;
|
|
|
250
250
|
/** @deprecated Use from `rolldown/utils` instead. */
|
|
251
251
|
type TsconfigCompilerOptions = BindingTsconfigCompilerOptions;
|
|
252
252
|
//#endregion
|
|
253
|
-
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, TransformOptions, TransformResult, TsconfigCache, TsconfigCompilerOptions, TsconfigRawOptions, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|
|
253
|
+
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, TransformOptions, TransformResult, TsconfigCache, TsconfigCompilerOptions, TsconfigRawOptions, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as __toESM, t as require_binding } from "./shared/binding-
|
|
2
|
-
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-
|
|
3
|
-
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-
|
|
4
|
-
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-
|
|
5
|
-
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-
|
|
6
|
-
import { n as parseSync$1, t as parse$1 } from "./shared/parse-
|
|
7
|
-
import { a as
|
|
8
|
-
import { a as
|
|
1
|
+
import { n as __toESM, t as require_binding } from "./shared/binding-BV_UWDF3.mjs";
|
|
2
|
+
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-D7wlw16t.mjs";
|
|
3
|
+
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-nddSVL89.mjs";
|
|
4
|
+
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-C7TjtSci.mjs";
|
|
5
|
+
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BO4SlZV_.mjs";
|
|
6
|
+
import { n as parseSync$1, t as parse$1 } from "./shared/parse-WOgXxW4-.mjs";
|
|
7
|
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-DqC7XSXy.mjs";
|
|
8
|
+
import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-C3OzszY-.mjs";
|
|
9
9
|
import { pathToFileURL } from "node:url";
|
|
10
10
|
//#region src/api/dev/dev-engine.ts
|
|
11
11
|
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
@@ -236,11 +236,11 @@ function viteAliasPlugin(config) {
|
|
|
236
236
|
* @example
|
|
237
237
|
* **LLM-friendly markdown output**
|
|
238
238
|
* ```js
|
|
239
|
-
* import {
|
|
239
|
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
|
240
240
|
*
|
|
241
241
|
* export default {
|
|
242
242
|
* plugins: [
|
|
243
|
-
*
|
|
243
|
+
* bundleAnalyzerPlugin({
|
|
244
244
|
* format: 'md'
|
|
245
245
|
* })
|
|
246
246
|
* ]
|
|
@@ -310,12 +310,11 @@ const transform = transform$1;
|
|
|
310
310
|
/** @deprecated Use from `rolldown/utils` instead. */
|
|
311
311
|
const transformSync = transformSync$1;
|
|
312
312
|
/** @deprecated Use from `rolldown/utils` instead. */
|
|
313
|
-
const TsconfigCache =
|
|
313
|
+
const TsconfigCache = TsconfigCache$1;
|
|
314
314
|
//#endregion
|
|
315
315
|
var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
|
|
316
316
|
var ResolverFactory = import_binding.ResolverFactory;
|
|
317
317
|
var isolatedDeclaration = import_binding.isolatedDeclaration;
|
|
318
318
|
var isolatedDeclarationSync = import_binding.isolatedDeclarationSync;
|
|
319
319
|
var moduleRunnerTransform = import_binding.moduleRunnerTransform;
|
|
320
|
-
|
|
321
|
-
export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|
|
320
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|