rolldown 1.0.0-rc.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +225 -75
- package/dist/config.d.mts +1 -2
- package/dist/config.mjs +2 -8
- package/dist/experimental-index.d.mts +7 -7
- package/dist/experimental-index.mjs +12 -13
- package/dist/experimental-runtime-types.d.ts +14 -5
- package/dist/filter-index.d.mts +1 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +5 -10
- package/dist/parallel-plugin-worker.mjs +2 -5
- package/dist/parallel-plugin.d.mts +1 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +2 -3
- package/dist/shared/{binding-BSVL02lq.mjs → binding-ESkOU1xr.mjs} +27 -27
- package/dist/shared/{binding-BohGL_65.d.mts → binding-zH1vcmbM.d.mts} +66 -21
- package/dist/shared/{bindingify-input-options-CTSYNRiE.mjs → bindingify-input-options-zrVFGksD.mjs} +135 -59
- package/dist/shared/{constructors-Bnr_ApVf.d.mts → constructors-D0W3rNfA.d.mts} +7 -3
- package/dist/shared/{constructors-D91FHkmz.mjs → constructors-D6i2Tbyl.mjs} +8 -2
- package/dist/shared/{define-config-B1jccsL9.d.mts → define-config-5HJ1b9vG.d.mts} +78 -13
- package/dist/shared/{error-tpgdcGrK.mjs → error-BrnLyQ-g.mjs} +1 -1
- package/dist/shared/{load-config-C6jg24OV.mjs → load-config-xUNmcCRn.mjs} +1 -1
- package/dist/shared/{normalize-string-or-regex-BCllTl21.mjs → normalize-string-or-regex-dAjLOSbp.mjs} +22 -12
- package/dist/shared/{parse-DzEQ_MRx.mjs → parse-_9Vwp6y3.mjs} +3 -3
- package/dist/shared/{prompt-BYQIwEjg.mjs → prompt-U5ajztzG.mjs} +4 -2
- package/dist/shared/{transform-BSCulZAO.mjs → resolve-tsconfig-DCdBlPeK.mjs} +28 -5
- package/dist/shared/{rolldown-build-r9VyalQ4.mjs → rolldown-build-D_ShytiL.mjs} +95 -149
- package/dist/shared/{rolldown-0xn8TJmm.mjs → rolldown-hwU2j9UL.mjs} +1 -1
- package/dist/shared/{transform-BoJxrM-e.d.mts → transform-DgZ3paSD.d.mts} +19 -2
- package/dist/shared/{watch-OIlVE34Q.mjs → watch-Bak_bDNe.mjs} +4 -4
- package/dist/utils-index.d.mts +3 -3
- package/dist/utils-index.mjs +5 -8
- package/package.json +30 -29
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import "./shared/
|
|
2
|
-
import {
|
|
3
|
-
import "./shared/normalize-string-or-regex-BCllTl21.mjs";
|
|
4
|
-
import { S as version, x as description } from "./shared/bindingify-input-options-CTSYNRiE.mjs";
|
|
1
|
+
import { n as onExit, t as watch } from "./shared/watch-Bak_bDNe.mjs";
|
|
2
|
+
import { C as version, S as description } from "./shared/bindingify-input-options-zrVFGksD.mjs";
|
|
5
3
|
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/
|
|
8
|
-
import "./shared/
|
|
9
|
-
import { t as rolldown } from "./shared/rolldown-0xn8TJmm.mjs";
|
|
10
|
-
import { t as loadConfig } from "./shared/load-config-C6jg24OV.mjs";
|
|
4
|
+
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-D_ShytiL.mjs";
|
|
5
|
+
import { t as rolldown } from "./shared/rolldown-hwU2j9UL.mjs";
|
|
6
|
+
import { t as loadConfig } from "./shared/load-config-xUNmcCRn.mjs";
|
|
11
7
|
import path from "node:path";
|
|
12
8
|
import process$1 from "node:process";
|
|
13
|
-
import { EventEmitter } from "events";
|
|
14
9
|
import { performance } from "node:perf_hooks";
|
|
15
|
-
//#region ../../node_modules/.pnpm/cac@
|
|
10
|
+
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
16
11
|
function toArr(any) {
|
|
17
12
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
18
13
|
}
|
|
@@ -20,7 +15,7 @@ function toVal(out, key, val, opts) {
|
|
|
20
15
|
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
16
|
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
22
17
|
}
|
|
23
|
-
function
|
|
18
|
+
function lib_default(args, opts) {
|
|
24
19
|
args = args || [];
|
|
25
20
|
opts = opts || {};
|
|
26
21
|
var k, arr, arg, name, val, out = { _: [] };
|
|
@@ -85,8 +80,10 @@ function mri2(args, opts) {
|
|
|
85
80
|
}
|
|
86
81
|
return out;
|
|
87
82
|
}
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
function removeBrackets(v) {
|
|
84
|
+
return v.replace(/[<[].+/, "").trim();
|
|
85
|
+
}
|
|
86
|
+
function findAllBrackets(v) {
|
|
90
87
|
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
91
88
|
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
92
89
|
const res = [];
|
|
@@ -108,8 +105,8 @@ const findAllBrackets = (v) => {
|
|
|
108
105
|
let squareMatch;
|
|
109
106
|
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
|
|
110
107
|
return res;
|
|
111
|
-
}
|
|
112
|
-
|
|
108
|
+
}
|
|
109
|
+
function getMriOptions(options) {
|
|
113
110
|
const result = {
|
|
114
111
|
alias: {},
|
|
115
112
|
boolean: []
|
|
@@ -123,62 +120,76 @@ const getMriOptions = (options) => {
|
|
|
123
120
|
} else result.boolean.push(option.names[0]);
|
|
124
121
|
}
|
|
125
122
|
return result;
|
|
126
|
-
}
|
|
127
|
-
|
|
123
|
+
}
|
|
124
|
+
function findLongest(arr) {
|
|
128
125
|
return arr.sort((a, b) => {
|
|
129
126
|
return a.length > b.length ? -1 : 1;
|
|
130
127
|
})[0];
|
|
131
|
-
}
|
|
132
|
-
|
|
128
|
+
}
|
|
129
|
+
function padRight(str, length) {
|
|
133
130
|
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return input.
|
|
131
|
+
}
|
|
132
|
+
function camelcase(input) {
|
|
133
|
+
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
|
137
134
|
return p1 + p2.toUpperCase();
|
|
138
135
|
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
let
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
}
|
|
137
|
+
function setDotProp(obj, keys, val) {
|
|
138
|
+
let current = obj;
|
|
139
|
+
for (let i = 0; i < keys.length; i++) {
|
|
140
|
+
const key = keys[i];
|
|
141
|
+
if (i === keys.length - 1) {
|
|
142
|
+
current[key] = val;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (current[key] == null) {
|
|
146
|
+
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
|
147
|
+
current[key] = nextKeyIsArrayIndex ? [] : {};
|
|
148
|
+
}
|
|
149
|
+
current = current[key];
|
|
148
150
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
+
}
|
|
152
|
+
function setByType(obj, transforms) {
|
|
151
153
|
for (const key of Object.keys(transforms)) {
|
|
152
154
|
const transform = transforms[key];
|
|
153
155
|
if (transform.shouldTransform) {
|
|
154
|
-
obj[key] =
|
|
156
|
+
obj[key] = [obj[key]].flat();
|
|
155
157
|
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const m = /([
|
|
160
|
+
}
|
|
161
|
+
function getFileName(input) {
|
|
162
|
+
const m = /([^\\/]+)$/.exec(input);
|
|
161
163
|
return m ? m[1] : "";
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
+
}
|
|
165
|
+
function camelcaseOptionName(name) {
|
|
164
166
|
return name.split(".").map((v, i) => {
|
|
165
167
|
return i === 0 ? camelcase(v) : v;
|
|
166
168
|
}).join(".");
|
|
167
|
-
}
|
|
169
|
+
}
|
|
168
170
|
var CACError = class extends Error {
|
|
169
171
|
constructor(message) {
|
|
170
172
|
super(message);
|
|
171
|
-
this.name =
|
|
172
|
-
if (typeof Error.captureStackTrace
|
|
173
|
-
else this.stack = new Error(message).stack;
|
|
173
|
+
this.name = "CACError";
|
|
174
|
+
if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
|
|
174
175
|
}
|
|
175
176
|
};
|
|
176
177
|
var Option = class {
|
|
178
|
+
rawName;
|
|
179
|
+
description;
|
|
180
|
+
/** Option name */
|
|
181
|
+
name;
|
|
182
|
+
/** Option name and aliases */
|
|
183
|
+
names;
|
|
184
|
+
isBoolean;
|
|
185
|
+
required;
|
|
186
|
+
config;
|
|
187
|
+
negated;
|
|
177
188
|
constructor(rawName, description, config) {
|
|
178
189
|
this.rawName = rawName;
|
|
179
190
|
this.description = description;
|
|
180
191
|
this.config = Object.assign({}, config);
|
|
181
|
-
rawName = rawName.
|
|
192
|
+
rawName = rawName.replaceAll(".*", "");
|
|
182
193
|
this.negated = false;
|
|
183
194
|
this.names = removeBrackets(rawName).split(",").map((v) => {
|
|
184
195
|
let name = v.trim().replace(/^-{1,2}/, "");
|
|
@@ -188,16 +199,39 @@ var Option = class {
|
|
|
188
199
|
}
|
|
189
200
|
return camelcaseOptionName(name);
|
|
190
201
|
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
|
191
|
-
this.name = this.names
|
|
202
|
+
this.name = this.names.at(-1);
|
|
192
203
|
if (this.negated && this.config.default == null) this.config.default = true;
|
|
193
204
|
if (rawName.includes("<")) this.required = true;
|
|
194
205
|
else if (rawName.includes("[")) this.required = false;
|
|
195
206
|
else this.isBoolean = true;
|
|
196
207
|
}
|
|
197
208
|
};
|
|
198
|
-
|
|
199
|
-
|
|
209
|
+
let runtimeProcessArgs;
|
|
210
|
+
let runtimeInfo;
|
|
211
|
+
if (typeof process !== "undefined") {
|
|
212
|
+
let runtimeName;
|
|
213
|
+
if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
|
|
214
|
+
else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
|
|
215
|
+
else runtimeName = "node";
|
|
216
|
+
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
|
|
217
|
+
runtimeProcessArgs = process.argv;
|
|
218
|
+
} else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
|
|
219
|
+
else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
|
|
200
220
|
var Command = class {
|
|
221
|
+
rawName;
|
|
222
|
+
description;
|
|
223
|
+
config;
|
|
224
|
+
cli;
|
|
225
|
+
options;
|
|
226
|
+
aliasNames;
|
|
227
|
+
name;
|
|
228
|
+
args;
|
|
229
|
+
commandAction;
|
|
230
|
+
usageText;
|
|
231
|
+
versionNumber;
|
|
232
|
+
examples;
|
|
233
|
+
helpCallback;
|
|
234
|
+
globalCommand;
|
|
201
235
|
constructor(rawName, description, config = {}, cli) {
|
|
202
236
|
this.rawName = rawName;
|
|
203
237
|
this.description = description;
|
|
@@ -230,6 +264,12 @@ var Command = class {
|
|
|
230
264
|
this.examples.push(example);
|
|
231
265
|
return this;
|
|
232
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Add a option for this command
|
|
269
|
+
* @param rawName Raw option name(s)
|
|
270
|
+
* @param description Option description
|
|
271
|
+
* @param config Option config
|
|
272
|
+
*/
|
|
233
273
|
option(rawName, description, config) {
|
|
234
274
|
const option = new Option(rawName, description, config);
|
|
235
275
|
this.options.push(option);
|
|
@@ -243,6 +283,10 @@ var Command = class {
|
|
|
243
283
|
this.commandAction = callback;
|
|
244
284
|
return this;
|
|
245
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Check if a command name is matched by this command
|
|
288
|
+
* @param name Command name
|
|
289
|
+
*/
|
|
246
290
|
isMatched(name) {
|
|
247
291
|
return this.name === name || this.aliasNames.includes(name);
|
|
248
292
|
}
|
|
@@ -252,6 +296,10 @@ var Command = class {
|
|
|
252
296
|
get isGlobalCommand() {
|
|
253
297
|
return this instanceof GlobalCommand;
|
|
254
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Check if an option is registered in this command
|
|
301
|
+
* @param name Option name
|
|
302
|
+
*/
|
|
255
303
|
hasOption(name) {
|
|
256
304
|
name = name.split(".")[0];
|
|
257
305
|
return this.options.find((option) => {
|
|
@@ -273,8 +321,7 @@ var Command = class {
|
|
|
273
321
|
body: commands.map((command) => {
|
|
274
322
|
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
275
323
|
}).join("\n")
|
|
276
|
-
}
|
|
277
|
-
sections.push({
|
|
324
|
+
}, {
|
|
278
325
|
title: `For more info, run any command with the \`--help\` flag`,
|
|
279
326
|
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
|
280
327
|
});
|
|
@@ -298,26 +345,33 @@ var Command = class {
|
|
|
298
345
|
}).join("\n")
|
|
299
346
|
});
|
|
300
347
|
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
301
|
-
console.
|
|
302
|
-
return section.title ? `${section.title}:
|
|
303
|
-
${section.body}` : section.body;
|
|
348
|
+
console.info(sections.map((section) => {
|
|
349
|
+
return section.title ? `${section.title}:\n${section.body}` : section.body;
|
|
304
350
|
}).join("\n\n"));
|
|
305
351
|
}
|
|
306
352
|
outputVersion() {
|
|
307
353
|
const { name } = this.cli;
|
|
308
354
|
const { versionNumber } = this.cli.globalCommand;
|
|
309
|
-
if (versionNumber) console.
|
|
355
|
+
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
|
|
310
356
|
}
|
|
311
357
|
checkRequiredArgs() {
|
|
312
358
|
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
|
313
359
|
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
314
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Check if the parsed options contain any unknown options
|
|
363
|
+
*
|
|
364
|
+
* Exit and output error when true
|
|
365
|
+
*/
|
|
315
366
|
checkUnknownOptions() {
|
|
316
367
|
const { options, globalCommand } = this.cli;
|
|
317
368
|
if (!this.config.allowUnknownOptions) {
|
|
318
369
|
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
370
|
}
|
|
320
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Check if the required string-type options exist
|
|
374
|
+
*/
|
|
321
375
|
checkOptionValue() {
|
|
322
376
|
const { options: parsedOptions, globalCommand } = this.cli;
|
|
323
377
|
const options = [...globalCommand.options, ...this.options];
|
|
@@ -329,14 +383,43 @@ ${section.body}` : section.body;
|
|
|
329
383
|
}
|
|
330
384
|
}
|
|
331
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Check if the number of args is more than expected
|
|
388
|
+
*/
|
|
389
|
+
checkUnusedArgs() {
|
|
390
|
+
const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
|
|
391
|
+
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
|
|
392
|
+
}
|
|
332
393
|
};
|
|
333
394
|
var GlobalCommand = class extends Command {
|
|
334
395
|
constructor(cli) {
|
|
335
396
|
super("@@global@@", "", {}, cli);
|
|
336
397
|
}
|
|
337
398
|
};
|
|
338
|
-
var
|
|
339
|
-
|
|
399
|
+
var CAC = class extends EventTarget {
|
|
400
|
+
/** The program name to display in help and version message */
|
|
401
|
+
name;
|
|
402
|
+
commands;
|
|
403
|
+
globalCommand;
|
|
404
|
+
matchedCommand;
|
|
405
|
+
matchedCommandName;
|
|
406
|
+
/**
|
|
407
|
+
* Raw CLI arguments
|
|
408
|
+
*/
|
|
409
|
+
rawArgs;
|
|
410
|
+
/**
|
|
411
|
+
* Parsed CLI arguments
|
|
412
|
+
*/
|
|
413
|
+
args;
|
|
414
|
+
/**
|
|
415
|
+
* Parsed CLI options, camelCased
|
|
416
|
+
*/
|
|
417
|
+
options;
|
|
418
|
+
showHelpOnExit;
|
|
419
|
+
showVersionOnExit;
|
|
420
|
+
/**
|
|
421
|
+
* @param name The program name to display in help and version message
|
|
422
|
+
*/
|
|
340
423
|
constructor(name = "") {
|
|
341
424
|
super();
|
|
342
425
|
this.name = name;
|
|
@@ -347,39 +430,75 @@ var CAC = class extends EventEmitter {
|
|
|
347
430
|
this.globalCommand = new GlobalCommand(this);
|
|
348
431
|
this.globalCommand.usage("<command> [options]");
|
|
349
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Add a global usage text.
|
|
435
|
+
*
|
|
436
|
+
* This is not used by sub-commands.
|
|
437
|
+
*/
|
|
350
438
|
usage(text) {
|
|
351
439
|
this.globalCommand.usage(text);
|
|
352
440
|
return this;
|
|
353
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Add a sub-command
|
|
444
|
+
*/
|
|
354
445
|
command(rawName, description, config) {
|
|
355
446
|
const command = new Command(rawName, description || "", config, this);
|
|
356
447
|
command.globalCommand = this.globalCommand;
|
|
357
448
|
this.commands.push(command);
|
|
358
449
|
return command;
|
|
359
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Add a global CLI option.
|
|
453
|
+
*
|
|
454
|
+
* Which is also applied to sub-commands.
|
|
455
|
+
*/
|
|
360
456
|
option(rawName, description, config) {
|
|
361
457
|
this.globalCommand.option(rawName, description, config);
|
|
362
458
|
return this;
|
|
363
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* Show help message when `-h, --help` flags appear.
|
|
462
|
+
*
|
|
463
|
+
*/
|
|
364
464
|
help(callback) {
|
|
365
465
|
this.globalCommand.option("-h, --help", "Display this message");
|
|
366
466
|
this.globalCommand.helpCallback = callback;
|
|
367
467
|
this.showHelpOnExit = true;
|
|
368
468
|
return this;
|
|
369
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Show version number when `-v, --version` flags appear.
|
|
472
|
+
*
|
|
473
|
+
*/
|
|
370
474
|
version(version, customFlags = "-v, --version") {
|
|
371
475
|
this.globalCommand.version(version, customFlags);
|
|
372
476
|
this.showVersionOnExit = true;
|
|
373
477
|
return this;
|
|
374
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Add a global example.
|
|
481
|
+
*
|
|
482
|
+
* This example added here will not be used by sub-commands.
|
|
483
|
+
*/
|
|
375
484
|
example(example) {
|
|
376
485
|
this.globalCommand.example(example);
|
|
377
486
|
return this;
|
|
378
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Output the corresponding help message
|
|
490
|
+
* When a sub-command is matched, output the help message for the command
|
|
491
|
+
* Otherwise output the global one.
|
|
492
|
+
*
|
|
493
|
+
*/
|
|
379
494
|
outputHelp() {
|
|
380
495
|
if (this.matchedCommand) this.matchedCommand.outputHelp();
|
|
381
496
|
else this.globalCommand.outputHelp();
|
|
382
497
|
}
|
|
498
|
+
/**
|
|
499
|
+
* Output the version number.
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
383
502
|
outputVersion() {
|
|
384
503
|
this.globalCommand.outputVersion();
|
|
385
504
|
}
|
|
@@ -394,7 +513,14 @@ var CAC = class extends EventEmitter {
|
|
|
394
513
|
this.matchedCommand = void 0;
|
|
395
514
|
this.matchedCommandName = void 0;
|
|
396
515
|
}
|
|
397
|
-
|
|
516
|
+
/**
|
|
517
|
+
* Parse argv
|
|
518
|
+
*/
|
|
519
|
+
parse(argv, { run = true } = {}) {
|
|
520
|
+
if (!argv) {
|
|
521
|
+
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
|
|
522
|
+
argv = runtimeProcessArgs;
|
|
523
|
+
}
|
|
398
524
|
this.rawArgs = argv;
|
|
399
525
|
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
400
526
|
let shouldParse = true;
|
|
@@ -403,17 +529,20 @@ var CAC = class extends EventEmitter {
|
|
|
403
529
|
const commandName = parsed.args[0];
|
|
404
530
|
if (command.isMatched(commandName)) {
|
|
405
531
|
shouldParse = false;
|
|
406
|
-
const parsedInfo =
|
|
532
|
+
const parsedInfo = {
|
|
533
|
+
...parsed,
|
|
534
|
+
args: parsed.args.slice(1)
|
|
535
|
+
};
|
|
407
536
|
this.setParsedInfo(parsedInfo, command, commandName);
|
|
408
|
-
this.
|
|
537
|
+
this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
|
|
409
538
|
}
|
|
410
539
|
}
|
|
411
540
|
if (shouldParse) {
|
|
412
|
-
for (const command of this.commands) if (command.
|
|
541
|
+
for (const command of this.commands) if (command.isDefaultCommand) {
|
|
413
542
|
shouldParse = false;
|
|
414
543
|
const parsed = this.mri(argv.slice(2), command);
|
|
415
544
|
this.setParsedInfo(parsed, command);
|
|
416
|
-
this.
|
|
545
|
+
this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
|
|
417
546
|
}
|
|
418
547
|
}
|
|
419
548
|
if (shouldParse) {
|
|
@@ -435,7 +564,7 @@ var CAC = class extends EventEmitter {
|
|
|
435
564
|
options: this.options
|
|
436
565
|
};
|
|
437
566
|
if (run) this.runMatchedCommand();
|
|
438
|
-
if (!this.matchedCommand && this.args[0]) this.
|
|
567
|
+
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
|
|
439
568
|
return parsedArgv;
|
|
440
569
|
}
|
|
441
570
|
mri(argv, command) {
|
|
@@ -443,26 +572,27 @@ var CAC = class extends EventEmitter {
|
|
|
443
572
|
const mriOptions = getMriOptions(cliOptions);
|
|
444
573
|
let argsAfterDoubleDashes = [];
|
|
445
574
|
const doubleDashesIndex = argv.indexOf("--");
|
|
446
|
-
if (doubleDashesIndex
|
|
575
|
+
if (doubleDashesIndex !== -1) {
|
|
447
576
|
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
448
577
|
argv = argv.slice(0, doubleDashesIndex);
|
|
449
578
|
}
|
|
450
|
-
let parsed =
|
|
579
|
+
let parsed = lib_default(argv, mriOptions);
|
|
451
580
|
parsed = Object.keys(parsed).reduce((res, name) => {
|
|
452
|
-
return
|
|
581
|
+
return {
|
|
582
|
+
...res,
|
|
583
|
+
[camelcaseOptionName(name)]: parsed[name]
|
|
584
|
+
};
|
|
453
585
|
}, { _: [] });
|
|
454
586
|
const args = parsed._;
|
|
455
587
|
const options = { "--": argsAfterDoubleDashes };
|
|
456
588
|
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
457
|
-
|
|
589
|
+
const transforms = Object.create(null);
|
|
458
590
|
for (const cliOption of cliOptions) {
|
|
459
591
|
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
|
-
}
|
|
592
|
+
if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
|
|
593
|
+
transforms[cliOption.name] = Object.create(null);
|
|
594
|
+
transforms[cliOption.name].shouldTransform = true;
|
|
595
|
+
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
|
466
596
|
}
|
|
467
597
|
}
|
|
468
598
|
for (const key of Object.keys(parsed)) if (key !== "_") {
|
|
@@ -480,6 +610,7 @@ var CAC = class extends EventEmitter {
|
|
|
480
610
|
command.checkUnknownOptions();
|
|
481
611
|
command.checkOptionValue();
|
|
482
612
|
command.checkRequiredArgs();
|
|
613
|
+
command.checkUnusedArgs();
|
|
483
614
|
const actionArgs = [];
|
|
484
615
|
command.args.forEach((arg, index) => {
|
|
485
616
|
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
@@ -489,6 +620,9 @@ var CAC = class extends EventEmitter {
|
|
|
489
620
|
return command.commandAction.apply(this, actionArgs);
|
|
490
621
|
}
|
|
491
622
|
};
|
|
623
|
+
/**
|
|
624
|
+
* @param name The program name to display in help and version message
|
|
625
|
+
*/
|
|
492
626
|
const cac = (name = "") => new CAC(name);
|
|
493
627
|
//#endregion
|
|
494
628
|
//#region src/cli/arguments/alias.ts
|
|
@@ -674,10 +808,26 @@ function parseCliArguments() {
|
|
|
674
808
|
if (value === void 0) continue;
|
|
675
809
|
const values = Array.isArray(value) ? value : [value];
|
|
676
810
|
if (typeof values[0] !== "string") continue;
|
|
811
|
+
let usedDeprecatedSyntax = false;
|
|
677
812
|
const result = {};
|
|
678
813
|
for (const v of values) for (const pair of String(v).split(",")) {
|
|
679
|
-
const
|
|
680
|
-
|
|
814
|
+
const colonIdx = pair.indexOf(":");
|
|
815
|
+
const eqIdx = pair.indexOf("=");
|
|
816
|
+
let k;
|
|
817
|
+
let val;
|
|
818
|
+
if (colonIdx > 0 && (eqIdx === -1 || colonIdx < eqIdx)) {
|
|
819
|
+
k = pair.slice(0, colonIdx);
|
|
820
|
+
val = pair.slice(colonIdx + 1);
|
|
821
|
+
} else if (eqIdx > 0) {
|
|
822
|
+
k = pair.slice(0, eqIdx);
|
|
823
|
+
val = pair.slice(eqIdx + 1);
|
|
824
|
+
usedDeprecatedSyntax = true;
|
|
825
|
+
} else continue;
|
|
826
|
+
result[k] = val;
|
|
827
|
+
}
|
|
828
|
+
if (usedDeprecatedSyntax) {
|
|
829
|
+
const optionName = camelCaseToKebabCase(schemaKey);
|
|
830
|
+
logger.warn(`Using \`key=value\` syntax for \`--${optionName}\` is deprecated. Use \`key:value\` instead.`);
|
|
681
831
|
}
|
|
682
832
|
parent[leafKey] = result;
|
|
683
833
|
}
|
|
@@ -697,7 +847,7 @@ function getClearScreenFunction(options) {
|
|
|
697
847
|
};
|
|
698
848
|
}
|
|
699
849
|
//#endregion
|
|
700
|
-
//#region \0@oxc-project+runtime@0.
|
|
850
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/usingCtx.js
|
|
701
851
|
function _usingCtx() {
|
|
702
852
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
703
853
|
var n = Error();
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import "./shared/
|
|
2
|
-
import { F as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-B1jccsL9.mjs";
|
|
1
|
+
import { F as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-5HJ1b9vG.mjs";
|
|
3
2
|
|
|
4
3
|
//#region src/utils/load-config.d.ts
|
|
5
4
|
/**
|
package/dist/config.mjs
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import "./shared/
|
|
2
|
-
import "./shared/normalize-string-or-regex-BCllTl21.mjs";
|
|
3
|
-
import { b as VERSION } from "./shared/bindingify-input-options-CTSYNRiE.mjs";
|
|
4
|
-
import "./shared/rolldown-build-r9VyalQ4.mjs";
|
|
5
|
-
import "./shared/error-tpgdcGrK.mjs";
|
|
6
|
-
import "./shared/parse-DzEQ_MRx.mjs";
|
|
7
|
-
import "./shared/rolldown-0xn8TJmm.mjs";
|
|
1
|
+
import { x as VERSION } from "./shared/bindingify-input-options-zrVFGksD.mjs";
|
|
8
2
|
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
|
|
9
|
-
import { t as loadConfig } from "./shared/load-config-
|
|
3
|
+
import { t as loadConfig } from "./shared/load-config-xUNmcCRn.mjs";
|
|
10
4
|
export { VERSION, defineConfig, loadConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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-zH1vcmbM.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-5HJ1b9vG.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-DgZ3paSD.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-D0W3rNfA.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 {
|
|
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-ESkOU1xr.mjs";
|
|
2
|
+
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-dAjLOSbp.mjs";
|
|
3
|
+
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-zrVFGksD.mjs";
|
|
4
|
+
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-D_ShytiL.mjs";
|
|
5
|
+
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BrnLyQ-g.mjs";
|
|
6
|
+
import { n as parseSync$1, t as parse$1 } from "./shared/parse-_9Vwp6y3.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-D6i2Tbyl.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-DCdBlPeK.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 };
|