@rolldown/browser 1.0.0-rc.7 → 1.0.0-rc.8
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 +613 -180
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +2 -2
- package/dist/filter-index.d.mts +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/parallel-plugin-worker.mjs +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{rolldown-build-D97C-VhN.js → rolldown-build-Clh1p2eh.js} +9 -3
- package/dist/shared/{bindingify-input-options-kCVufQp0.mjs → bindingify-input-options-CxjTlvCV.mjs} +4 -1
- package/dist/shared/{define-config-Cci3IvO_.d.mts → define-config-TEoV5q6D.d.mts} +18 -0
- package/dist/shared/{load-config-DNGVjxdv.mjs → load-config-Cs9h9aXF.mjs} +1 -1
- package/dist/shared/{rolldown-C9kn7lTZ.mjs → rolldown-D2p2QuF1.mjs} +1 -1
- package/dist/shared/{rolldown-build-8_xyZuDH.mjs → rolldown-build-D_FXM8pA.mjs} +6 -3
- package/dist/shared/{watch-dCFQWE8a.mjs → watch-BMFUc4Au.mjs} +2 -2
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,16 +1,495 @@
|
|
|
1
|
-
import { n as onExit, t as watch } from "./shared/watch-
|
|
1
|
+
import { n as onExit, t as watch } from "./shared/watch-BMFUc4Au.mjs";
|
|
2
2
|
import "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
3
|
-
import { S as version, x as description } from "./shared/bindingify-input-options-
|
|
3
|
+
import { S as version, x as description } from "./shared/bindingify-input-options-CxjTlvCV.mjs";
|
|
4
4
|
import { h as arraify } from "./shared/composable-filters-B2ByPP8y.mjs";
|
|
5
|
-
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText
|
|
5
|
+
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-D_FXM8pA.mjs";
|
|
6
6
|
import "./shared/error-CQ6njWsV.mjs";
|
|
7
7
|
import "./shared/parse-DDUnGYGU.mjs";
|
|
8
|
-
import { t as rolldown } from "./shared/rolldown-
|
|
9
|
-
import { t as loadConfig } from "./shared/load-config-
|
|
8
|
+
import { t as rolldown } from "./shared/rolldown-D2p2QuF1.mjs";
|
|
9
|
+
import { t as loadConfig } from "./shared/load-config-Cs9h9aXF.mjs";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import { parseArgs } from "node:util";
|
|
12
11
|
import process$1 from "node:process";
|
|
12
|
+
import { EventEmitter } from "events";
|
|
13
13
|
import { performance } from "node:perf_hooks";
|
|
14
|
+
//#region ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
15
|
+
function toArr(any) {
|
|
16
|
+
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
17
|
+
}
|
|
18
|
+
function toVal(out, key, val, opts) {
|
|
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;
|
|
20
|
+
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
21
|
+
}
|
|
22
|
+
function mri2(args, opts) {
|
|
23
|
+
args = args || [];
|
|
24
|
+
opts = opts || {};
|
|
25
|
+
var k, arr, arg, name, val, out = { _: [] };
|
|
26
|
+
var i = 0, j = 0, idx = 0, len = args.length;
|
|
27
|
+
const alibi = opts.alias !== void 0;
|
|
28
|
+
const strict = opts.unknown !== void 0;
|
|
29
|
+
const defaults = opts.default !== void 0;
|
|
30
|
+
opts.alias = opts.alias || {};
|
|
31
|
+
opts.string = toArr(opts.string);
|
|
32
|
+
opts.boolean = toArr(opts.boolean);
|
|
33
|
+
if (alibi) for (k in opts.alias) {
|
|
34
|
+
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
35
|
+
for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
36
|
+
}
|
|
37
|
+
for (i = opts.boolean.length; i-- > 0;) {
|
|
38
|
+
arr = opts.alias[opts.boolean[i]] || [];
|
|
39
|
+
for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
|
|
40
|
+
}
|
|
41
|
+
for (i = opts.string.length; i-- > 0;) {
|
|
42
|
+
arr = opts.alias[opts.string[i]] || [];
|
|
43
|
+
for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
|
|
44
|
+
}
|
|
45
|
+
if (defaults) for (k in opts.default) {
|
|
46
|
+
name = typeof opts.default[k];
|
|
47
|
+
arr = opts.alias[k] = opts.alias[k] || [];
|
|
48
|
+
if (opts[name] !== void 0) {
|
|
49
|
+
opts[name].push(k);
|
|
50
|
+
for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const keys = strict ? Object.keys(opts.alias) : [];
|
|
54
|
+
for (i = 0; i < len; i++) {
|
|
55
|
+
arg = args[i];
|
|
56
|
+
if (arg === "--") {
|
|
57
|
+
out._ = out._.concat(args.slice(++i));
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
|
|
61
|
+
if (j === 0) out._.push(arg);
|
|
62
|
+
else if (arg.substring(j, j + 3) === "no-") {
|
|
63
|
+
name = arg.substring(j + 3);
|
|
64
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
65
|
+
out[name] = false;
|
|
66
|
+
} else {
|
|
67
|
+
for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
|
|
68
|
+
name = arg.substring(j, idx);
|
|
69
|
+
val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
|
|
70
|
+
arr = j === 2 ? [name] : name;
|
|
71
|
+
for (idx = 0; idx < arr.length; idx++) {
|
|
72
|
+
name = arr[idx];
|
|
73
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
74
|
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (defaults) {
|
|
79
|
+
for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
|
|
80
|
+
}
|
|
81
|
+
if (alibi) for (k in out) {
|
|
82
|
+
arr = opts.alias[k] || [];
|
|
83
|
+
while (arr.length > 0) out[arr.shift()] = out[k];
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
|
|
88
|
+
const findAllBrackets = (v) => {
|
|
89
|
+
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
90
|
+
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
91
|
+
const res = [];
|
|
92
|
+
const parse = (match) => {
|
|
93
|
+
let variadic = false;
|
|
94
|
+
let value = match[1];
|
|
95
|
+
if (value.startsWith("...")) {
|
|
96
|
+
value = value.slice(3);
|
|
97
|
+
variadic = true;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
required: match[0].startsWith("<"),
|
|
101
|
+
value,
|
|
102
|
+
variadic
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
let angledMatch;
|
|
106
|
+
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
|
|
107
|
+
let squareMatch;
|
|
108
|
+
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
|
|
109
|
+
return res;
|
|
110
|
+
};
|
|
111
|
+
const getMriOptions = (options) => {
|
|
112
|
+
const result = {
|
|
113
|
+
alias: {},
|
|
114
|
+
boolean: []
|
|
115
|
+
};
|
|
116
|
+
for (const [index, option] of options.entries()) {
|
|
117
|
+
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
|
118
|
+
if (option.isBoolean) if (option.negated) {
|
|
119
|
+
if (!options.some((o, i) => {
|
|
120
|
+
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
|
|
121
|
+
})) result.boolean.push(option.names[0]);
|
|
122
|
+
} else result.boolean.push(option.names[0]);
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
};
|
|
126
|
+
const findLongest = (arr) => {
|
|
127
|
+
return arr.sort((a, b) => {
|
|
128
|
+
return a.length > b.length ? -1 : 1;
|
|
129
|
+
})[0];
|
|
130
|
+
};
|
|
131
|
+
const padRight = (str, length) => {
|
|
132
|
+
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
133
|
+
};
|
|
134
|
+
const camelcase = (input) => {
|
|
135
|
+
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
|
136
|
+
return p1 + p2.toUpperCase();
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const setDotProp = (obj, keys, val) => {
|
|
140
|
+
let i = 0;
|
|
141
|
+
let length = keys.length;
|
|
142
|
+
let t = obj;
|
|
143
|
+
let x;
|
|
144
|
+
for (; i < length; ++i) {
|
|
145
|
+
x = t[keys[i]];
|
|
146
|
+
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const setByType = (obj, transforms) => {
|
|
150
|
+
for (const key of Object.keys(transforms)) {
|
|
151
|
+
const transform = transforms[key];
|
|
152
|
+
if (transform.shouldTransform) {
|
|
153
|
+
obj[key] = Array.prototype.concat.call([], obj[key]);
|
|
154
|
+
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const getFileName = (input) => {
|
|
159
|
+
const m = /([^\\\/]+)$/.exec(input);
|
|
160
|
+
return m ? m[1] : "";
|
|
161
|
+
};
|
|
162
|
+
const camelcaseOptionName = (name) => {
|
|
163
|
+
return name.split(".").map((v, i) => {
|
|
164
|
+
return i === 0 ? camelcase(v) : v;
|
|
165
|
+
}).join(".");
|
|
166
|
+
};
|
|
167
|
+
var CACError = class extends Error {
|
|
168
|
+
constructor(message) {
|
|
169
|
+
super(message);
|
|
170
|
+
this.name = this.constructor.name;
|
|
171
|
+
if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, this.constructor);
|
|
172
|
+
else this.stack = new Error(message).stack;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var Option = class {
|
|
176
|
+
constructor(rawName, description, config) {
|
|
177
|
+
this.rawName = rawName;
|
|
178
|
+
this.description = description;
|
|
179
|
+
this.config = Object.assign({}, config);
|
|
180
|
+
rawName = rawName.replace(/\.\*/g, "");
|
|
181
|
+
this.negated = false;
|
|
182
|
+
this.names = removeBrackets(rawName).split(",").map((v) => {
|
|
183
|
+
let name = v.trim().replace(/^-{1,2}/, "");
|
|
184
|
+
if (name.startsWith("no-")) {
|
|
185
|
+
this.negated = true;
|
|
186
|
+
name = name.replace(/^no-/, "");
|
|
187
|
+
}
|
|
188
|
+
return camelcaseOptionName(name);
|
|
189
|
+
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
|
190
|
+
this.name = this.names[this.names.length - 1];
|
|
191
|
+
if (this.negated && this.config.default == null) this.config.default = true;
|
|
192
|
+
if (rawName.includes("<")) this.required = true;
|
|
193
|
+
else if (rawName.includes("[")) this.required = false;
|
|
194
|
+
else this.isBoolean = true;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const processArgs = process.argv;
|
|
198
|
+
const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
|
199
|
+
var Command = class {
|
|
200
|
+
constructor(rawName, description, config = {}, cli) {
|
|
201
|
+
this.rawName = rawName;
|
|
202
|
+
this.description = description;
|
|
203
|
+
this.config = config;
|
|
204
|
+
this.cli = cli;
|
|
205
|
+
this.options = [];
|
|
206
|
+
this.aliasNames = [];
|
|
207
|
+
this.name = removeBrackets(rawName);
|
|
208
|
+
this.args = findAllBrackets(rawName);
|
|
209
|
+
this.examples = [];
|
|
210
|
+
}
|
|
211
|
+
usage(text) {
|
|
212
|
+
this.usageText = text;
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
allowUnknownOptions() {
|
|
216
|
+
this.config.allowUnknownOptions = true;
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
ignoreOptionDefaultValue() {
|
|
220
|
+
this.config.ignoreOptionDefaultValue = true;
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
version(version, customFlags = "-v, --version") {
|
|
224
|
+
this.versionNumber = version;
|
|
225
|
+
this.option(customFlags, "Display version number");
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
example(example) {
|
|
229
|
+
this.examples.push(example);
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
option(rawName, description, config) {
|
|
233
|
+
const option = new Option(rawName, description, config);
|
|
234
|
+
this.options.push(option);
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
alias(name) {
|
|
238
|
+
this.aliasNames.push(name);
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
action(callback) {
|
|
242
|
+
this.commandAction = callback;
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
isMatched(name) {
|
|
246
|
+
return this.name === name || this.aliasNames.includes(name);
|
|
247
|
+
}
|
|
248
|
+
get isDefaultCommand() {
|
|
249
|
+
return this.name === "" || this.aliasNames.includes("!");
|
|
250
|
+
}
|
|
251
|
+
get isGlobalCommand() {
|
|
252
|
+
return this instanceof GlobalCommand;
|
|
253
|
+
}
|
|
254
|
+
hasOption(name) {
|
|
255
|
+
name = name.split(".")[0];
|
|
256
|
+
return this.options.find((option) => {
|
|
257
|
+
return option.names.includes(name);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
outputHelp() {
|
|
261
|
+
const { name, commands } = this.cli;
|
|
262
|
+
const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
|
|
263
|
+
let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
|
|
264
|
+
sections.push({
|
|
265
|
+
title: "Usage",
|
|
266
|
+
body: ` $ ${name} ${this.usageText || this.rawName}`
|
|
267
|
+
});
|
|
268
|
+
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
|
|
269
|
+
const longestCommandName = findLongest(commands.map((command) => command.rawName));
|
|
270
|
+
sections.push({
|
|
271
|
+
title: "Commands",
|
|
272
|
+
body: commands.map((command) => {
|
|
273
|
+
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
274
|
+
}).join("\n")
|
|
275
|
+
});
|
|
276
|
+
sections.push({
|
|
277
|
+
title: `For more info, run any command with the \`--help\` flag`,
|
|
278
|
+
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
|
282
|
+
if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
|
|
283
|
+
if (options.length > 0) {
|
|
284
|
+
const longestOptionName = findLongest(options.map((option) => option.rawName));
|
|
285
|
+
sections.push({
|
|
286
|
+
title: "Options",
|
|
287
|
+
body: options.map((option) => {
|
|
288
|
+
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
|
|
289
|
+
}).join("\n")
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
if (this.examples.length > 0) sections.push({
|
|
293
|
+
title: "Examples",
|
|
294
|
+
body: this.examples.map((example) => {
|
|
295
|
+
if (typeof example === "function") return example(name);
|
|
296
|
+
return example;
|
|
297
|
+
}).join("\n")
|
|
298
|
+
});
|
|
299
|
+
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
300
|
+
console.log(sections.map((section) => {
|
|
301
|
+
return section.title ? `${section.title}:
|
|
302
|
+
${section.body}` : section.body;
|
|
303
|
+
}).join("\n\n"));
|
|
304
|
+
}
|
|
305
|
+
outputVersion() {
|
|
306
|
+
const { name } = this.cli;
|
|
307
|
+
const { versionNumber } = this.cli.globalCommand;
|
|
308
|
+
if (versionNumber) console.log(`${name}/${versionNumber} ${platformInfo}`);
|
|
309
|
+
}
|
|
310
|
+
checkRequiredArgs() {
|
|
311
|
+
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
|
312
|
+
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
313
|
+
}
|
|
314
|
+
checkUnknownOptions() {
|
|
315
|
+
const { options, globalCommand } = this.cli;
|
|
316
|
+
if (!this.config.allowUnknownOptions) {
|
|
317
|
+
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}`}\``);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
checkOptionValue() {
|
|
321
|
+
const { options: parsedOptions, globalCommand } = this.cli;
|
|
322
|
+
const options = [...globalCommand.options, ...this.options];
|
|
323
|
+
for (const option of options) {
|
|
324
|
+
const value = parsedOptions[option.name.split(".")[0]];
|
|
325
|
+
if (option.required) {
|
|
326
|
+
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
|
|
327
|
+
if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var GlobalCommand = class extends Command {
|
|
333
|
+
constructor(cli) {
|
|
334
|
+
super("@@global@@", "", {}, cli);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
var __assign = Object.assign;
|
|
338
|
+
var CAC = class extends EventEmitter {
|
|
339
|
+
constructor(name = "") {
|
|
340
|
+
super();
|
|
341
|
+
this.name = name;
|
|
342
|
+
this.commands = [];
|
|
343
|
+
this.rawArgs = [];
|
|
344
|
+
this.args = [];
|
|
345
|
+
this.options = {};
|
|
346
|
+
this.globalCommand = new GlobalCommand(this);
|
|
347
|
+
this.globalCommand.usage("<command> [options]");
|
|
348
|
+
}
|
|
349
|
+
usage(text) {
|
|
350
|
+
this.globalCommand.usage(text);
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
command(rawName, description, config) {
|
|
354
|
+
const command = new Command(rawName, description || "", config, this);
|
|
355
|
+
command.globalCommand = this.globalCommand;
|
|
356
|
+
this.commands.push(command);
|
|
357
|
+
return command;
|
|
358
|
+
}
|
|
359
|
+
option(rawName, description, config) {
|
|
360
|
+
this.globalCommand.option(rawName, description, config);
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
363
|
+
help(callback) {
|
|
364
|
+
this.globalCommand.option("-h, --help", "Display this message");
|
|
365
|
+
this.globalCommand.helpCallback = callback;
|
|
366
|
+
this.showHelpOnExit = true;
|
|
367
|
+
return this;
|
|
368
|
+
}
|
|
369
|
+
version(version, customFlags = "-v, --version") {
|
|
370
|
+
this.globalCommand.version(version, customFlags);
|
|
371
|
+
this.showVersionOnExit = true;
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
example(example) {
|
|
375
|
+
this.globalCommand.example(example);
|
|
376
|
+
return this;
|
|
377
|
+
}
|
|
378
|
+
outputHelp() {
|
|
379
|
+
if (this.matchedCommand) this.matchedCommand.outputHelp();
|
|
380
|
+
else this.globalCommand.outputHelp();
|
|
381
|
+
}
|
|
382
|
+
outputVersion() {
|
|
383
|
+
this.globalCommand.outputVersion();
|
|
384
|
+
}
|
|
385
|
+
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
|
|
386
|
+
this.args = args;
|
|
387
|
+
this.options = options;
|
|
388
|
+
if (matchedCommand) this.matchedCommand = matchedCommand;
|
|
389
|
+
if (matchedCommandName) this.matchedCommandName = matchedCommandName;
|
|
390
|
+
return this;
|
|
391
|
+
}
|
|
392
|
+
unsetMatchedCommand() {
|
|
393
|
+
this.matchedCommand = void 0;
|
|
394
|
+
this.matchedCommandName = void 0;
|
|
395
|
+
}
|
|
396
|
+
parse(argv = processArgs, { run = true } = {}) {
|
|
397
|
+
this.rawArgs = argv;
|
|
398
|
+
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
399
|
+
let shouldParse = true;
|
|
400
|
+
for (const command of this.commands) {
|
|
401
|
+
const parsed = this.mri(argv.slice(2), command);
|
|
402
|
+
const commandName = parsed.args[0];
|
|
403
|
+
if (command.isMatched(commandName)) {
|
|
404
|
+
shouldParse = false;
|
|
405
|
+
const parsedInfo = __assign(__assign({}, parsed), { args: parsed.args.slice(1) });
|
|
406
|
+
this.setParsedInfo(parsedInfo, command, commandName);
|
|
407
|
+
this.emit(`command:${commandName}`, command);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (shouldParse) {
|
|
411
|
+
for (const command of this.commands) if (command.name === "") {
|
|
412
|
+
shouldParse = false;
|
|
413
|
+
const parsed = this.mri(argv.slice(2), command);
|
|
414
|
+
this.setParsedInfo(parsed, command);
|
|
415
|
+
this.emit(`command:!`, command);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (shouldParse) {
|
|
419
|
+
const parsed = this.mri(argv.slice(2));
|
|
420
|
+
this.setParsedInfo(parsed);
|
|
421
|
+
}
|
|
422
|
+
if (this.options.help && this.showHelpOnExit) {
|
|
423
|
+
this.outputHelp();
|
|
424
|
+
run = false;
|
|
425
|
+
this.unsetMatchedCommand();
|
|
426
|
+
}
|
|
427
|
+
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
|
|
428
|
+
this.outputVersion();
|
|
429
|
+
run = false;
|
|
430
|
+
this.unsetMatchedCommand();
|
|
431
|
+
}
|
|
432
|
+
const parsedArgv = {
|
|
433
|
+
args: this.args,
|
|
434
|
+
options: this.options
|
|
435
|
+
};
|
|
436
|
+
if (run) this.runMatchedCommand();
|
|
437
|
+
if (!this.matchedCommand && this.args[0]) this.emit("command:*");
|
|
438
|
+
return parsedArgv;
|
|
439
|
+
}
|
|
440
|
+
mri(argv, command) {
|
|
441
|
+
const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
|
|
442
|
+
const mriOptions = getMriOptions(cliOptions);
|
|
443
|
+
let argsAfterDoubleDashes = [];
|
|
444
|
+
const doubleDashesIndex = argv.indexOf("--");
|
|
445
|
+
if (doubleDashesIndex > -1) {
|
|
446
|
+
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
447
|
+
argv = argv.slice(0, doubleDashesIndex);
|
|
448
|
+
}
|
|
449
|
+
let parsed = mri2(argv, mriOptions);
|
|
450
|
+
parsed = Object.keys(parsed).reduce((res, name) => {
|
|
451
|
+
return __assign(__assign({}, res), { [camelcaseOptionName(name)]: parsed[name] });
|
|
452
|
+
}, { _: [] });
|
|
453
|
+
const args = parsed._;
|
|
454
|
+
const options = { "--": argsAfterDoubleDashes };
|
|
455
|
+
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
456
|
+
let transforms = Object.create(null);
|
|
457
|
+
for (const cliOption of cliOptions) {
|
|
458
|
+
if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
|
|
459
|
+
if (Array.isArray(cliOption.config.type)) {
|
|
460
|
+
if (transforms[cliOption.name] === void 0) {
|
|
461
|
+
transforms[cliOption.name] = Object.create(null);
|
|
462
|
+
transforms[cliOption.name]["shouldTransform"] = true;
|
|
463
|
+
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
for (const key of Object.keys(parsed)) if (key !== "_") {
|
|
468
|
+
setDotProp(options, key.split("."), parsed[key]);
|
|
469
|
+
setByType(options, transforms);
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
args,
|
|
473
|
+
options
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
runMatchedCommand() {
|
|
477
|
+
const { args, options, matchedCommand: command } = this;
|
|
478
|
+
if (!command || !command.commandAction) return;
|
|
479
|
+
command.checkUnknownOptions();
|
|
480
|
+
command.checkOptionValue();
|
|
481
|
+
command.checkRequiredArgs();
|
|
482
|
+
const actionArgs = [];
|
|
483
|
+
command.args.forEach((arg, index) => {
|
|
484
|
+
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
485
|
+
else actionArgs.push(args[index]);
|
|
486
|
+
});
|
|
487
|
+
actionArgs.push(options);
|
|
488
|
+
return command.commandAction.apply(this, actionArgs);
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
const cac = (name = "") => new CAC(name);
|
|
492
|
+
//#endregion
|
|
14
493
|
//#region src/cli/arguments/alias.ts
|
|
15
494
|
const alias = {
|
|
16
495
|
config: {
|
|
@@ -32,27 +511,15 @@ const alias = {
|
|
|
32
511
|
format: { abbreviation: "f" },
|
|
33
512
|
name: { abbreviation: "n" },
|
|
34
513
|
globals: { abbreviation: "g" },
|
|
35
|
-
sourcemap: {
|
|
36
|
-
abbreviation: "s",
|
|
37
|
-
default: true
|
|
38
|
-
},
|
|
514
|
+
sourcemap: { abbreviation: "s" },
|
|
39
515
|
minify: { abbreviation: "m" },
|
|
40
516
|
platform: { abbreviation: "p" },
|
|
41
517
|
assetFileNames: { hint: "name" },
|
|
42
518
|
chunkFileNames: { hint: "name" },
|
|
43
519
|
entryFileNames: { hint: "name" },
|
|
44
|
-
externalLiveBindings: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
treeshake: {
|
|
49
|
-
default: true,
|
|
50
|
-
reverse: true
|
|
51
|
-
},
|
|
52
|
-
preserveEntrySignatures: {
|
|
53
|
-
default: "strict",
|
|
54
|
-
reverse: true
|
|
55
|
-
},
|
|
520
|
+
externalLiveBindings: { reverse: true },
|
|
521
|
+
treeshake: { reverse: true },
|
|
522
|
+
preserveEntrySignatures: { reverse: true },
|
|
56
523
|
moduleTypes: { hint: "types" }
|
|
57
524
|
};
|
|
58
525
|
//#endregion
|
|
@@ -75,24 +542,17 @@ function setNestedProperty(obj, path, value) {
|
|
|
75
542
|
function camelCaseToKebabCase(str) {
|
|
76
543
|
return str.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
77
544
|
}
|
|
78
|
-
function kebabCaseToCamelCase(str) {
|
|
79
|
-
return str.replace(/-./g, (match) => match[1].toUpperCase());
|
|
80
|
-
}
|
|
81
545
|
//#endregion
|
|
82
546
|
//#region src/cli/arguments/normalize.ts
|
|
547
|
+
const reservedKeys = new Set([
|
|
548
|
+
"help",
|
|
549
|
+
"version",
|
|
550
|
+
"config",
|
|
551
|
+
"watch",
|
|
552
|
+
"environment"
|
|
553
|
+
]);
|
|
83
554
|
function normalizeCliOptions(cliOptions, positionals) {
|
|
84
|
-
const
|
|
85
|
-
"__proto__",
|
|
86
|
-
"constructor",
|
|
87
|
-
"prototype"
|
|
88
|
-
];
|
|
89
|
-
const unflattenedCliOptions = {};
|
|
90
|
-
for (let [key, value] of Object.entries(cliOptions)) if (prototypePollutionKeys.includes(key)) {} else if (key.includes(".")) {
|
|
91
|
-
const [parentKey] = key.split(".");
|
|
92
|
-
unflattenedCliOptions[parentKey] ??= {};
|
|
93
|
-
setNestedProperty(unflattenedCliOptions, key, value);
|
|
94
|
-
} else unflattenedCliOptions[key] = value;
|
|
95
|
-
const [data, errors] = validateCliOptions(unflattenedCliOptions);
|
|
555
|
+
const [data, errors] = validateCliOptions(cliOptions);
|
|
96
556
|
if (errors?.length) {
|
|
97
557
|
errors.forEach((error) => {
|
|
98
558
|
logger.error(`${error}. You can use \`rolldown -h\` to see the help.`);
|
|
@@ -108,21 +568,15 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
108
568
|
watch: options.watch ?? false
|
|
109
569
|
};
|
|
110
570
|
if (typeof options.config === "string") result.config = options.config;
|
|
571
|
+
else if (options.config === true) result.config = "";
|
|
111
572
|
if (options.environment !== void 0) result.environment = options.environment;
|
|
112
|
-
const keysOfInput = getInputCliKeys();
|
|
113
|
-
const keysOfOutput = getOutputCliKeys();
|
|
114
|
-
const reservedKeys = [
|
|
115
|
-
"help",
|
|
116
|
-
"version",
|
|
117
|
-
"config",
|
|
118
|
-
"watch",
|
|
119
|
-
"environment"
|
|
120
|
-
];
|
|
573
|
+
const keysOfInput = new Set(getInputCliKeys());
|
|
574
|
+
const keysOfOutput = new Set(getOutputCliKeys());
|
|
121
575
|
for (let [key, value] of Object.entries(options)) {
|
|
122
576
|
const [primary] = key.split(".");
|
|
123
|
-
if (keysOfInput.
|
|
124
|
-
else if (keysOfOutput.
|
|
125
|
-
else if (!reservedKeys.
|
|
577
|
+
if (keysOfInput.has(primary)) setNestedProperty(result.input, key, value);
|
|
578
|
+
else if (keysOfOutput.has(primary)) setNestedProperty(result.output, key, value);
|
|
579
|
+
else if (!reservedKeys.has(key)) {
|
|
126
580
|
logger.error(`Unknown option: ${key}`);
|
|
127
581
|
process.exit(1);
|
|
128
582
|
}
|
|
@@ -135,119 +589,99 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
135
589
|
//#region src/cli/arguments/index.ts
|
|
136
590
|
const schemaInfo = getCliSchemaInfo();
|
|
137
591
|
const options = Object.fromEntries(Object.entries(schemaInfo).filter(([_key, info]) => info.type !== "never").map(([key, info]) => {
|
|
138
|
-
const config =
|
|
592
|
+
const config = alias[key];
|
|
593
|
+
let description = info?.description ?? config?.description ?? "";
|
|
594
|
+
if (config?.reverse) {
|
|
595
|
+
if (description.startsWith("enable")) description = description.replace("enable", "disable");
|
|
596
|
+
else if (!description.startsWith("Avoid")) description = `disable ${description}`;
|
|
597
|
+
}
|
|
139
598
|
const result = {
|
|
140
599
|
type: info.type === "boolean" ? "boolean" : "string",
|
|
141
|
-
description
|
|
142
|
-
hint: config?.hint
|
|
600
|
+
description
|
|
143
601
|
};
|
|
144
|
-
if (config
|
|
145
|
-
if (config
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
key = camelCaseToKebabCase(key);
|
|
150
|
-
return [config?.reverse ? `no-${key}` : key, result];
|
|
602
|
+
if (config?.abbreviation) result.short = config.abbreviation;
|
|
603
|
+
if (config?.hint) result.hint = config.hint;
|
|
604
|
+
const kebabKey = camelCaseToKebabCase(key);
|
|
605
|
+
return [config?.reverse ? `no-${kebabKey}` : kebabKey, result];
|
|
151
606
|
}));
|
|
607
|
+
const knownKeys = new Set(Object.keys(schemaInfo));
|
|
608
|
+
for (const key of Object.keys(schemaInfo)) {
|
|
609
|
+
const dotIdx = key.indexOf(".");
|
|
610
|
+
if (dotIdx > 0) knownKeys.add(key.substring(0, dotIdx));
|
|
611
|
+
}
|
|
612
|
+
const shortAliases = /* @__PURE__ */ new Set();
|
|
613
|
+
for (const config of Object.values(alias)) if (config?.abbreviation) shortAliases.add(config.abbreviation);
|
|
152
614
|
function parseCliArguments() {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
615
|
+
const cli = cac("rolldown");
|
|
616
|
+
for (const [key, info] of Object.entries(schemaInfo)) {
|
|
617
|
+
if (info.type === "never") continue;
|
|
618
|
+
const config = alias[key];
|
|
619
|
+
let rawName = "";
|
|
620
|
+
if (config?.abbreviation) rawName += `-${config.abbreviation}, `;
|
|
621
|
+
if (config?.reverse) rawName += `--no-${key}`;
|
|
622
|
+
else rawName += `--${key}`;
|
|
623
|
+
if (info.type !== "boolean" && !config?.reverse) if (config?.requireValue) rawName += ` <${config?.hint ?? key}>`;
|
|
624
|
+
else rawName += ` [${config?.hint ?? key}]`;
|
|
625
|
+
cli.option(rawName, info.description ?? config?.description ?? "");
|
|
626
|
+
}
|
|
627
|
+
let parsedInput = [];
|
|
628
|
+
let parsedOptions = {};
|
|
629
|
+
const cmd = cli.command("[...input]", "");
|
|
630
|
+
cmd.allowUnknownOptions();
|
|
631
|
+
cmd.ignoreOptionDefaultValue();
|
|
632
|
+
cmd.action((input, opts) => {
|
|
633
|
+
parsedInput = input;
|
|
634
|
+
parsedOptions = opts;
|
|
158
635
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
636
|
+
try {
|
|
637
|
+
cli.parse(process.argv, { run: true });
|
|
638
|
+
} catch (err) {
|
|
639
|
+
if (err?.name === "CACError") {
|
|
640
|
+
const match = err.message.match(/option `(.+?)` value is missing/);
|
|
641
|
+
if (match) {
|
|
642
|
+
const optName = match[1].replace(/ [<[].*/, "").replace(/^-\w, /, "");
|
|
643
|
+
logger.error(`Option \`${optName}\` requires a value but none was provided.`);
|
|
644
|
+
} else logger.error(err.message);
|
|
645
|
+
process.exit(1);
|
|
168
646
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (!values[option.name]) Object.defineProperty(values, option.name, {
|
|
206
|
-
value: [],
|
|
207
|
-
enumerable: true,
|
|
208
|
-
configurable: true,
|
|
209
|
-
writable: true
|
|
210
|
-
});
|
|
211
|
-
values[option.name].push(option.value);
|
|
212
|
-
} else if (type === "boolean") Object.defineProperty(values, option.name, {
|
|
213
|
-
value: !negative,
|
|
214
|
-
enumerable: true,
|
|
215
|
-
configurable: true,
|
|
216
|
-
writable: true
|
|
217
|
-
});
|
|
218
|
-
else if (type === "union") {
|
|
219
|
-
let defaultValue = Object.getOwnPropertyDescriptor(alias, option.name)?.value;
|
|
220
|
-
Object.defineProperty(values, option.name, {
|
|
221
|
-
value: option.value ?? defaultValue?.default ?? "",
|
|
222
|
-
enumerable: true,
|
|
223
|
-
configurable: true,
|
|
224
|
-
writable: true
|
|
225
|
-
});
|
|
226
|
-
} else Object.defineProperty(values, option.name, {
|
|
227
|
-
value: option.value ?? "",
|
|
228
|
-
enumerable: true,
|
|
229
|
-
configurable: true,
|
|
230
|
-
writable: true
|
|
231
|
-
});
|
|
232
|
-
}).filter((item) => {
|
|
233
|
-
return item !== void 0;
|
|
234
|
-
});
|
|
235
|
-
invalid_options.sort((a, b) => {
|
|
236
|
-
return a.name.localeCompare(b.name);
|
|
237
|
-
});
|
|
238
|
-
if (invalid_options.length !== 0) {
|
|
239
|
-
let single = invalid_options.length === 1;
|
|
240
|
-
logger.warn(`Option \`${invalid_options.map((item) => item.name).join(",")}\` ${single ? "is" : "are"} unrecognized. We will ignore ${single ? "this" : "those"} option${single ? "" : "s"}.`);
|
|
241
|
-
}
|
|
242
|
-
let rawArgs = {
|
|
243
|
-
...values,
|
|
244
|
-
...invalid_options.reduce((acc, cur) => {
|
|
245
|
-
acc[cur.name] = cur.value;
|
|
246
|
-
return acc;
|
|
247
|
-
}, Object.create(null))
|
|
248
|
-
};
|
|
647
|
+
throw err;
|
|
648
|
+
}
|
|
649
|
+
delete parsedOptions["--"];
|
|
650
|
+
for (const short of shortAliases) delete parsedOptions[short];
|
|
651
|
+
for (const key of Object.keys(parsedOptions)) if (key === "__proto__" || key === "constructor" || key === "prototype" || key.startsWith("__proto__.") || key.startsWith("constructor.") || key.startsWith("prototype.")) delete parsedOptions[key];
|
|
652
|
+
const unknownKeys = Object.keys(parsedOptions).filter((k) => !knownKeys.has(k));
|
|
653
|
+
if (unknownKeys.length > 0) {
|
|
654
|
+
unknownKeys.sort();
|
|
655
|
+
const single = unknownKeys.length === 1;
|
|
656
|
+
logger.warn(`Option \`${unknownKeys.join(",")}\` ${single ? "is" : "are"} unrecognized. We will ignore ${single ? "this" : "those"} option${single ? "" : "s"}.`);
|
|
657
|
+
}
|
|
658
|
+
const rawArgs = { ...parsedOptions };
|
|
659
|
+
for (const key of unknownKeys) delete parsedOptions[key];
|
|
660
|
+
for (const [key, value] of Object.entries(parsedOptions)) {
|
|
661
|
+
const type = schemaInfo[key]?.type;
|
|
662
|
+
if (Array.isArray(value)) {
|
|
663
|
+
if (type !== "array" && type !== "object") parsedOptions[key] = value[value.length - 1];
|
|
664
|
+
} else if (type === "array" && typeof value === "string") parsedOptions[key] = [value];
|
|
665
|
+
}
|
|
666
|
+
for (const [schemaKey, info] of Object.entries(schemaInfo)) {
|
|
667
|
+
if (info.type !== "object") continue;
|
|
668
|
+
const parts = schemaKey.split(".");
|
|
669
|
+
let parent = parsedOptions;
|
|
670
|
+
for (let i = 0; i < parts.length - 1; i++) parent = parent?.[parts[i]];
|
|
671
|
+
const leafKey = parts[parts.length - 1];
|
|
672
|
+
const value = parent?.[leafKey];
|
|
673
|
+
if (value === void 0) continue;
|
|
674
|
+
const values = Array.isArray(value) ? value : [value];
|
|
675
|
+
if (typeof values[0] !== "string") continue;
|
|
676
|
+
const result = {};
|
|
677
|
+
for (const v of values) for (const pair of String(v).split(",")) {
|
|
678
|
+
const [k, ...rest] = pair.split("=");
|
|
679
|
+
if (k && rest.length > 0) result[k] = rest.join("=");
|
|
680
|
+
}
|
|
681
|
+
parent[leafKey] = result;
|
|
682
|
+
}
|
|
249
683
|
return {
|
|
250
|
-
...normalizeCliOptions(
|
|
684
|
+
...normalizeCliOptions(parsedOptions, parsedInput),
|
|
251
685
|
rawArgs
|
|
252
686
|
};
|
|
253
687
|
}
|
|
@@ -350,7 +784,7 @@ async function bundleWithCliOptions(cliOptions) {
|
|
|
350
784
|
process.exit(1);
|
|
351
785
|
}
|
|
352
786
|
for (const file of outputs) {
|
|
353
|
-
if (outputs.length > 1) logger.log(`\n${styleText
|
|
787
|
+
if (outputs.length > 1) logger.log(`\n${styleText(["cyan", "bold"], `|→ ${file.fileName}:`)}\n`);
|
|
354
788
|
console.log(file.type === "asset" ? file.source : file.code);
|
|
355
789
|
}
|
|
356
790
|
} catch (_) {
|
|
@@ -390,12 +824,12 @@ async function watchInner(config, cliOptions) {
|
|
|
390
824
|
clearScreen?.();
|
|
391
825
|
break;
|
|
392
826
|
case "BUNDLE_START":
|
|
393
|
-
if (changedFile.length > 0) logger.log(`Found ${styleText
|
|
827
|
+
if (changedFile.length > 0) logger.log(`Found ${styleText("bold", changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
|
|
394
828
|
changedFile.length = 0;
|
|
395
829
|
break;
|
|
396
830
|
case "BUNDLE_END":
|
|
397
831
|
await event.result.close();
|
|
398
|
-
logger.success(`Rebuilt ${styleText
|
|
832
|
+
logger.success(`Rebuilt ${styleText("bold", relativeId(event.output[0]))} in ${styleText("green", ms(event.duration))}.`);
|
|
399
833
|
break;
|
|
400
834
|
case "ERROR":
|
|
401
835
|
await event.result.close();
|
|
@@ -428,7 +862,7 @@ async function bundleInner(config, cliOptions) {
|
|
|
428
862
|
result.forEach(printBundleOutputPretty);
|
|
429
863
|
logger.log(``);
|
|
430
864
|
const duration = performance.now() - startTime;
|
|
431
|
-
logger.success(`rolldown v${version} Finished in ${styleText
|
|
865
|
+
logger.success(`rolldown v${version} Finished in ${styleText("green", ms(duration))}`);
|
|
432
866
|
}
|
|
433
867
|
function printBundleOutputPretty(output) {
|
|
434
868
|
const outputEntries = collectOutputEntries(output.output);
|
|
@@ -474,10 +908,10 @@ function printOutputEntries(entries, sizeAdjustment, distPath) {
|
|
|
474
908
|
const filtered = entries.filter((e) => e.type === group.type);
|
|
475
909
|
if (!filtered.length) continue;
|
|
476
910
|
for (const entry of filtered.sort((a, z) => a.size - z.size)) {
|
|
477
|
-
let log = styleText
|
|
478
|
-
log += styleText
|
|
479
|
-
log += styleText
|
|
480
|
-
log += styleText
|
|
911
|
+
let log = styleText("dim", withTrailingSlash(distPath));
|
|
912
|
+
log += styleText(group.color, entry.fileName.padEnd(sizeAdjustment.longest + 2));
|
|
913
|
+
log += styleText("dim", entry.type);
|
|
914
|
+
log += styleText("dim", ` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
|
|
481
915
|
logger.log(log);
|
|
482
916
|
}
|
|
483
917
|
}
|
|
@@ -517,22 +951,17 @@ const examples = [
|
|
|
517
951
|
command: "rolldown src/main.ts -d dist -n bundle -f iife -e jQuery,window._ -g jQuery=$"
|
|
518
952
|
}
|
|
519
953
|
];
|
|
520
|
-
const notes = [
|
|
521
|
-
"Due to the API limitation, you need to pass `-s` for `.map` sourcemap file as the last argument.",
|
|
522
|
-
"If you are using the configuration, please pass the `-c` as the last argument if you ignore the default configuration file.",
|
|
523
|
-
"CLI options will override the configuration file.",
|
|
524
|
-
"For more information, please visit https://rolldown.rs/."
|
|
525
|
-
];
|
|
954
|
+
const notes = ["CLI options will override the configuration file.", "For more information, please visit https://rolldown.rs/."];
|
|
526
955
|
/**
|
|
527
956
|
* Generates the CLI help text as a string.
|
|
528
957
|
*/
|
|
529
958
|
function generateHelpText() {
|
|
530
959
|
const lines = [];
|
|
531
|
-
lines.push(`${styleText
|
|
960
|
+
lines.push(`${styleText("gray", `${description} (rolldown v${version})`)}`);
|
|
532
961
|
lines.push("");
|
|
533
|
-
lines.push(`${styleText
|
|
962
|
+
lines.push(`${styleText(["bold", "underline"], "USAGE")} ${styleText("cyan", "rolldown -c <config>")} or ${styleText("cyan", "rolldown <input> <options>")}`);
|
|
534
963
|
lines.push("");
|
|
535
|
-
lines.push(`${styleText
|
|
964
|
+
lines.push(`${styleText(["bold", "underline"], "OPTIONS")}`);
|
|
536
965
|
lines.push("");
|
|
537
966
|
lines.push(Object.entries(options).sort(([a], [b]) => {
|
|
538
967
|
if (options[a].short && !options[b].short) return -1;
|
|
@@ -545,20 +974,20 @@ function generateHelpText() {
|
|
|
545
974
|
if (short) optionStr += `-${short}, `;
|
|
546
975
|
if (type === "string") optionStr += `<${hint ?? option}>`;
|
|
547
976
|
if (description && description.length > 0) description = description[0].toUpperCase() + description.slice(1);
|
|
548
|
-
return styleText
|
|
977
|
+
return styleText("cyan", optionStr.padEnd(30)) + description + (description && description?.endsWith(".") ? "" : ".");
|
|
549
978
|
}).join("\n"));
|
|
550
979
|
lines.push("");
|
|
551
|
-
lines.push(`${styleText
|
|
980
|
+
lines.push(`${styleText(["bold", "underline"], "EXAMPLES")}`);
|
|
552
981
|
lines.push("");
|
|
553
982
|
examples.forEach(({ title, command }, ord) => {
|
|
554
983
|
lines.push(` ${ord + 1}. ${title}:`);
|
|
555
|
-
lines.push(` ${styleText
|
|
984
|
+
lines.push(` ${styleText("cyan", command)}`);
|
|
556
985
|
lines.push("");
|
|
557
986
|
});
|
|
558
|
-
lines.push(`${styleText
|
|
987
|
+
lines.push(`${styleText(["bold", "underline"], "NOTES")}`);
|
|
559
988
|
lines.push("");
|
|
560
989
|
notes.forEach((note) => {
|
|
561
|
-
lines.push(` * ${styleText
|
|
990
|
+
lines.push(` * ${styleText("gray", note)}`);
|
|
562
991
|
});
|
|
563
992
|
return lines.join("\n");
|
|
564
993
|
}
|
|
@@ -585,6 +1014,14 @@ async function main() {
|
|
|
585
1014
|
process$1.env[key] = value.length === 0 ? String(true) : value.join(":");
|
|
586
1015
|
}
|
|
587
1016
|
}
|
|
1017
|
+
if (cliOptions.help) {
|
|
1018
|
+
showHelp();
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
if (cliOptions.version) {
|
|
1022
|
+
logger.log(`rolldown v${version}`);
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
588
1025
|
if (cliOptions.config || cliOptions.config === "") {
|
|
589
1026
|
await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
|
|
590
1027
|
return;
|
|
@@ -593,10 +1030,6 @@ async function main() {
|
|
|
593
1030
|
await bundleWithCliOptions(cliOptions);
|
|
594
1031
|
return;
|
|
595
1032
|
}
|
|
596
|
-
if (cliOptions.version) {
|
|
597
|
-
logger.log(`rolldown v${version}`);
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
1033
|
showHelp();
|
|
601
1034
|
}
|
|
602
1035
|
main().catch((err) => {
|
package/dist/config.d.mts
CHANGED
package/dist/config.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
2
|
-
import { b as VERSION } from "./shared/bindingify-input-options-
|
|
3
|
-
import "./shared/rolldown-build-
|
|
2
|
+
import { b as VERSION } from "./shared/bindingify-input-options-CxjTlvCV.mjs";
|
|
3
|
+
import "./shared/rolldown-build-D_FXM8pA.mjs";
|
|
4
4
|
import "./shared/error-CQ6njWsV.mjs";
|
|
5
5
|
import "./shared/parse-DDUnGYGU.mjs";
|
|
6
|
-
import "./shared/rolldown-
|
|
6
|
+
import "./shared/rolldown-D2p2QuF1.mjs";
|
|
7
7
|
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
|
|
8
|
-
import { t as loadConfig } from "./shared/load-config-
|
|
8
|
+
import { t as loadConfig } from "./shared/load-config-Cs9h9aXF.mjs";
|
|
9
9
|
export { VERSION, defineConfig, loadConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-TtAGUp42.js";
|
|
2
|
-
import { a as PluginDriver, i as validateOption, n as createBundlerOptions, r as transformToRollupOutput, t as RolldownBuild } from "./rolldown-build-
|
|
2
|
+
import { a as PluginDriver, i as validateOption, n as createBundlerOptions, r as transformToRollupOutput, t as RolldownBuild } from "./rolldown-build-Clh1p2eh.js";
|
|
3
3
|
import { a as parse$2, i as unwrapBindingResult, o as parseSync$2, r as normalizeBindingResult } from "./error-DkAP_6fk.js";
|
|
4
4
|
import { a as viteImportGlobPlugin, c as viteModulePreloadPolyfillPlugin, d as viteResolvePlugin, f as viteWasmFallbackPlugin, i as viteDynamicImportVarsPlugin, l as viteReactRefreshWrapperPlugin, n as isolatedDeclarationPlugin, o as viteJsonPlugin, p as viteWebWorkerPostPlugin, r as viteBuildImportAnalysisPlugin, s as viteLoadFallbackPlugin, u as viteReporterPlugin } from "./constructors-BgL_dmUe.js";
|
|
5
5
|
import { a as minifySync$2, i as minify$2, n as transform$1, r as transformSync$1, t as TsconfigCache$1 } from "./transform-UkHb5h4g.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as NormalizedOutputOptions, c as InputOptions, ht as defineParallelPlugin, ln as freeExternalMemory, sn as RolldownOutput, tn as OutputOptions } from "./shared/define-config-
|
|
1
|
+
import { Et as NormalizedOutputOptions, c as InputOptions, ht as defineParallelPlugin, ln as freeExternalMemory, sn as RolldownOutput, tn as OutputOptions } from "./shared/define-config-TEoV5q6D.mjs";
|
|
2
2
|
import { t as BuiltinPlugin } from "./shared/utils-6wxe_LMG.mjs";
|
|
3
3
|
import { a as viteImportGlobPlugin, c as viteModulePreloadPolyfillPlugin, d as viteResolvePlugin, f as viteWasmFallbackPlugin, i as viteDynamicImportVarsPlugin, l as viteReactRefreshWrapperPlugin, n as isolatedDeclarationPlugin, o as viteJsonPlugin, p as viteWebWorkerPostPlugin, r as viteBuildImportAnalysisPlugin, s as viteLoadFallbackPlugin, u as viteReporterPlugin } from "./shared/constructors-C1tQjDsj.mjs";
|
|
4
4
|
import { a as TsconfigRawOptions$1, c as MinifyOptions$2, d as minifySync$1, f as ParseResult$3, h as parseSync$1, i as TsconfigCompilerOptions$1, l as MinifyResult$2, m as parse$1, n as TransformResult$1, o as transform$1, p as ParserOptions$3, r as TsconfigCache$1, s as transformSync$1, t as TransformOptions$2, u as minify$1 } from "./shared/transform-BSAGL1b_.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
2
|
-
import { a as transformToRollupOutput } from "./shared/bindingify-input-options-
|
|
3
|
-
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-
|
|
2
|
+
import { a as transformToRollupOutput } from "./shared/bindingify-input-options-CxjTlvCV.mjs";
|
|
3
|
+
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-D_FXM8pA.mjs";
|
|
4
4
|
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-CQ6njWsV.mjs";
|
|
5
5
|
import { n as parseSync$2, t as parse$2 } from "./shared/parse-DDUnGYGU.mjs";
|
|
6
6
|
import { a as viteImportGlobPlugin, c as viteModulePreloadPolyfillPlugin, d as viteResolvePlugin, f as viteWasmFallbackPlugin, i as viteDynamicImportVarsPlugin, l as viteReactRefreshWrapperPlugin, n as isolatedDeclarationPlugin, o as viteJsonPlugin, p as viteWebWorkerPostPlugin, r as viteBuildImportAnalysisPlugin, s as viteLoadFallbackPlugin, u as viteReporterPlugin } from "./shared/constructors-C7Kkidxk.mjs";
|
package/dist/filter-index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as exprInterpreter, F as QueryFilterObject, G as interpreterImpl, H as importerId, I as TopLevelFilterExpression, J as or, K as moduleType, L as and, M as withFilter, N as FilterExpression, P as FilterExpressionKind, R as code, U as include, V as id, W as interpreter, X as query, Y as queries, q as not, z as exclude } from "./shared/define-config-
|
|
1
|
+
import { B as exprInterpreter, F as QueryFilterObject, G as interpreterImpl, H as importerId, I as TopLevelFilterExpression, J as or, K as moduleType, L as and, M as withFilter, N as FilterExpression, P as FilterExpressionKind, R as code, U as include, V as id, W as interpreter, X as query, Y as queries, q as not, z as exclude } from "./shared/define-config-TEoV5q6D.mjs";
|
|
2
2
|
|
|
3
3
|
//#region ../pluginutils/dist/filter/filter-vite-plugins.d.ts
|
|
4
4
|
/**
|
package/dist/index.browser.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as logMultipleWatcherOption } from "./normalize-string-or-regex-TtAGUp42.js";
|
|
2
|
-
import { a as PluginDriver, c as RUNTIME_MODULE_ID, i as validateOption, l as VERSION, n as createBundlerOptions, o as LOG_LEVEL_WARN, s as arraify, t as RolldownBuild } from "./rolldown-build-
|
|
2
|
+
import { a as PluginDriver, c as RUNTIME_MODULE_ID, i as validateOption, l as VERSION, n as createBundlerOptions, o as LOG_LEVEL_WARN, s as arraify, t as RolldownBuild } from "./rolldown-build-Clh1p2eh.js";
|
|
3
3
|
import { t as aggregateBindingErrorsIntoJsError } from "./error-DkAP_6fk.js";
|
|
4
4
|
import { BindingMagicString, BindingWatcher, shutdownAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
5
5
|
//#region src/api/rolldown/index.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-C6h4g8dA.mjs";
|
|
2
|
-
import { $ as RUNTIME_MODULE_ID, $t as MinifyOptions, A as SourceDescription, At as LoggingFunction, Bt as build, C as PartialResolvedId, Ct as RolldownFileStats, D as ResolvedId, Dt as NormalizedInputOptions, E as ResolveIdResult, Et as NormalizedOutputOptions, Ft as RolldownWatcherWatcherEventMap, Gt as ChunkingContext, Ht as AdvancedChunksGroup, It as WatchOptions, Jt as CodeSplittingOptions, Kt as CodeSplittingGroup, Lt as rolldown, Mt as watch, Nt as RolldownWatcher, O as RolldownPlugin, Ot as TransformOptions, Pt as RolldownWatcherEvent, Q as PreRenderedChunk, Qt as GlobalsFunction, Rt as RolldownBuild, S as ParallelPluginHooks, St as RolldownDirectoryEntry, T as ResolveIdExtraOptions, Tt as InternalModuleFormat, Ut as AdvancedChunksOptions, Vt as AddonFunction, Wt as ChunkFileNamesFunction, Xt as GeneratedCodeOptions, Yt as CommentsOptions, Z as BindingMagicString, Zt as GeneratedCodePreset, _ as ImportKind, _t as PluginContextMeta, a as ExternalOption, an as RenderedChunk, at as TreeshakingOptions, b as ModuleType, bt as ModuleTypeFilter, c as InputOptions, cn as SourceMap, ct as EmittedChunk, d as WatcherFileWatcherOptions, dn as SourcemapIgnoreListOption, dt as GetModuleInfo, en as ModuleFormat, et as VERSION, f as WatcherOptions, ft as PluginContext, g as HookFilterExtension, gt as MinimalPluginContext, h as FunctionPluginHooks, i as RolldownOptions, in as OutputChunk, it as OutputBundle, j as TransformResult, jt as WarningHandlerWithDefault, k as RolldownPluginOption, kt as ChecksOptions, l as ModuleTypes, lt as EmittedFile, m as CustomPluginOptions, mt as DefineParallelPluginResult, n as RolldownOptionsFunction, nn as PreRenderedAsset, nt as ExistingRawSourceMap, o as ExternalOptionFunction, on as RenderedModule, ot as TransformPluginContext, p as AsyncPluginHooks, pt as PluginContextResolveOptions, qt as CodeSplittingNameFunction, r as defineConfig, rn as OutputAsset, rt as SourceMapInput, s as InputOption, sn as RolldownOutput, st as EmittedAsset, t as ConfigExport, tn as OutputOptions, tt as BundleError, u as OptimizationOptions, un as ModuleInfo, ut as EmittedPrebuiltChunk, v as LoadResult, vt as GeneralHookFilter, w as Plugin, wt as RolldownFsModule, x as ObjectHook, xt as BufferEncoding, y as ModuleOptions, yt as HookFilter, zt as BuildOptions } from "./shared/define-config-
|
|
2
|
+
import { $ as RUNTIME_MODULE_ID, $t as MinifyOptions, A as SourceDescription, At as LoggingFunction, Bt as build, C as PartialResolvedId, Ct as RolldownFileStats, D as ResolvedId, Dt as NormalizedInputOptions, E as ResolveIdResult, Et as NormalizedOutputOptions, Ft as RolldownWatcherWatcherEventMap, Gt as ChunkingContext, Ht as AdvancedChunksGroup, It as WatchOptions, Jt as CodeSplittingOptions, Kt as CodeSplittingGroup, Lt as rolldown, Mt as watch, Nt as RolldownWatcher, O as RolldownPlugin, Ot as TransformOptions, Pt as RolldownWatcherEvent, Q as PreRenderedChunk, Qt as GlobalsFunction, Rt as RolldownBuild, S as ParallelPluginHooks, St as RolldownDirectoryEntry, T as ResolveIdExtraOptions, Tt as InternalModuleFormat, Ut as AdvancedChunksOptions, Vt as AddonFunction, Wt as ChunkFileNamesFunction, Xt as GeneratedCodeOptions, Yt as CommentsOptions, Z as BindingMagicString, Zt as GeneratedCodePreset, _ as ImportKind, _t as PluginContextMeta, a as ExternalOption, an as RenderedChunk, at as TreeshakingOptions, b as ModuleType, bt as ModuleTypeFilter, c as InputOptions, cn as SourceMap, ct as EmittedChunk, d as WatcherFileWatcherOptions, dn as SourcemapIgnoreListOption, dt as GetModuleInfo, en as ModuleFormat, et as VERSION, f as WatcherOptions, ft as PluginContext, g as HookFilterExtension, gt as MinimalPluginContext, h as FunctionPluginHooks, i as RolldownOptions, in as OutputChunk, it as OutputBundle, j as TransformResult, jt as WarningHandlerWithDefault, k as RolldownPluginOption, kt as ChecksOptions, l as ModuleTypes, lt as EmittedFile, m as CustomPluginOptions, mt as DefineParallelPluginResult, n as RolldownOptionsFunction, nn as PreRenderedAsset, nt as ExistingRawSourceMap, o as ExternalOptionFunction, on as RenderedModule, ot as TransformPluginContext, p as AsyncPluginHooks, pt as PluginContextResolveOptions, qt as CodeSplittingNameFunction, r as defineConfig, rn as OutputAsset, rt as SourceMapInput, s as InputOption, sn as RolldownOutput, st as EmittedAsset, t as ConfigExport, tn as OutputOptions, tt as BundleError, u as OptimizationOptions, un as ModuleInfo, ut as EmittedPrebuiltChunk, v as LoadResult, vt as GeneralHookFilter, w as Plugin, wt as RolldownFsModule, x as ObjectHook, xt as BufferEncoding, y as ModuleOptions, yt as HookFilter, zt as BuildOptions } from "./shared/define-config-TEoV5q6D.mjs";
|
|
3
3
|
import { o as PartialNull } from "./shared/utils-6wxe_LMG.mjs";
|
|
4
4
|
export { AddonFunction, AdvancedChunksGroup, AdvancedChunksOptions, AsyncPluginHooks, BindingMagicString, BufferEncoding, BuildOptions, BundleError, ChecksOptions, ChunkFileNamesFunction, ChunkingContext, CodeSplittingGroup, CodeSplittingNameFunction, CodeSplittingOptions, CommentsOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedChunk, EmittedFile, EmittedPrebuiltChunk, ExistingRawSourceMap, ExternalOption, ExternalOptionFunction, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PluginContextResolveOptions, PreRenderedAsset, PreRenderedChunk, RUNTIME_MODULE_ID, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownError, RolldownError as RollupError, RolldownFileStats, RolldownFsModule, RolldownLog, RolldownLog as RollupLog, RolldownLogWithString, RolldownLogWithString as RollupLogWithString, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RolldownWatcherWatcherEventMap, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformOptions, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherFileWatcherOptions, WatcherOptions, build, defineConfig, rolldown, watch };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as onExit, t as watch } from "./shared/watch-
|
|
1
|
+
import { n as onExit, t as watch } from "./shared/watch-BMFUc4Au.mjs";
|
|
2
2
|
import "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
3
|
-
import { b as VERSION, y as RUNTIME_MODULE_ID } from "./shared/bindingify-input-options-
|
|
4
|
-
import "./shared/rolldown-build-
|
|
3
|
+
import { b as VERSION, y as RUNTIME_MODULE_ID } from "./shared/bindingify-input-options-CxjTlvCV.mjs";
|
|
4
|
+
import "./shared/rolldown-build-D_FXM8pA.mjs";
|
|
5
5
|
import "./shared/error-CQ6njWsV.mjs";
|
|
6
6
|
import "./shared/parse-DDUnGYGU.mjs";
|
|
7
|
-
import { t as rolldown } from "./shared/rolldown-
|
|
7
|
+
import { t as rolldown } from "./shared/rolldown-D2p2QuF1.mjs";
|
|
8
8
|
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
|
|
9
9
|
import { isMainThread } from "node:worker_threads";
|
|
10
10
|
import { BindingMagicString, initTraceSubscriber } from "./rolldown-binding.wasi.cjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
2
|
-
import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-
|
|
2
|
+
import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-CxjTlvCV.mjs";
|
|
3
3
|
import "./shared/error-CQ6njWsV.mjs";
|
|
4
4
|
import "./shared/parse-DDUnGYGU.mjs";
|
|
5
5
|
import { parentPort, workerData } from "node:worker_threads";
|
|
Binary file
|
|
@@ -454,7 +454,7 @@ const win32 = /* @__PURE__ */ mix(";");
|
|
|
454
454
|
*
|
|
455
455
|
* @category Plugin APIs
|
|
456
456
|
*/
|
|
457
|
-
const VERSION = "1.0.0-rc.
|
|
457
|
+
const VERSION = "1.0.0-rc.8";
|
|
458
458
|
//#endregion
|
|
459
459
|
//#region src/constants/index.ts
|
|
460
460
|
/**
|
|
@@ -1964,7 +1964,10 @@ isTypeTrue();
|
|
|
1964
1964
|
const WatcherFileWatcherOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1965
1965
|
usePolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use polling-based file watching instead of native OS events")),
|
|
1966
1966
|
pollInterval: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Poll interval in milliseconds (only used when usePolling is true)")),
|
|
1967
|
-
compareContentsForPolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Compare file contents for poll-based watchers (only used when usePolling is true)"))
|
|
1967
|
+
compareContentsForPolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Compare file contents for poll-based watchers (only used when usePolling is true)")),
|
|
1968
|
+
useDebounce: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use debounced event delivery at the filesystem level")),
|
|
1969
|
+
debounceDelay: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Debounce delay in milliseconds (only used when useDebounce is true)")),
|
|
1970
|
+
debounceTickRate: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Tick rate in milliseconds for debouncer (only used when useDebounce is true)"))
|
|
1968
1971
|
});
|
|
1969
1972
|
const WatcherOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1970
1973
|
chokidar: /* @__PURE__ */ optional(/* @__PURE__ */ never(`The "watch.chokidar" option is deprecated, please use "watch.watcher" instead of it`)),
|
|
@@ -2255,7 +2258,7 @@ const OutputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
2255
2258
|
/* @__PURE__ */ boolean(),
|
|
2256
2259
|
/* @__PURE__ */ literal("inline"),
|
|
2257
2260
|
/* @__PURE__ */ literal("hidden")
|
|
2258
|
-
])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or
|
|
2261
|
+
])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
|
|
2259
2262
|
sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
|
|
2260
2263
|
sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
|
|
2261
2264
|
sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
@@ -4524,6 +4527,9 @@ function bindingifyWatch(watch) {
|
|
|
4524
4527
|
usePolling: watcher.usePolling,
|
|
4525
4528
|
pollInterval: watcher.pollInterval,
|
|
4526
4529
|
compareContentsForPolling: watcher.compareContentsForPolling,
|
|
4530
|
+
useDebounce: watcher.useDebounce,
|
|
4531
|
+
debounceDelay: watcher.debounceDelay,
|
|
4532
|
+
debounceTickRate: watcher.debounceTickRate,
|
|
4527
4533
|
include: normalizedStringOrRegex(watch.include),
|
|
4528
4534
|
exclude: normalizedStringOrRegex(watch.exclude),
|
|
4529
4535
|
onInvalidate: (...args) => watch.onInvalidate?.(...args)
|
package/dist/shared/{bindingify-input-options-kCVufQp0.mjs → bindingify-input-options-CxjTlvCV.mjs}
RENAMED
|
@@ -7,7 +7,7 @@ import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, Bin
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import fsp from "node:fs/promises";
|
|
9
9
|
//#region package.json
|
|
10
|
-
var version = "1.0.0-rc.
|
|
10
|
+
var version = "1.0.0-rc.8";
|
|
11
11
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/constants/version.ts
|
|
@@ -2084,6 +2084,9 @@ function bindingifyWatch(watch) {
|
|
|
2084
2084
|
usePolling: watcher.usePolling,
|
|
2085
2085
|
pollInterval: watcher.pollInterval,
|
|
2086
2086
|
compareContentsForPolling: watcher.compareContentsForPolling,
|
|
2087
|
+
useDebounce: watcher.useDebounce,
|
|
2088
|
+
debounceDelay: watcher.debounceDelay,
|
|
2089
|
+
debounceTickRate: watcher.debounceTickRate,
|
|
2087
2090
|
include: normalizedStringOrRegex(watch.include),
|
|
2088
2091
|
exclude: normalizedStringOrRegex(watch.exclude),
|
|
2089
2092
|
onInvalidate: (...args) => watch.onInvalidate?.(...args)
|
|
@@ -3119,6 +3119,24 @@ interface WatcherFileWatcherOptions {
|
|
|
3119
3119
|
* @default false
|
|
3120
3120
|
*/
|
|
3121
3121
|
compareContentsForPolling?: boolean;
|
|
3122
|
+
/**
|
|
3123
|
+
* Whether to use debounced event delivery at the filesystem level.
|
|
3124
|
+
* This coalesces rapid filesystem events before they reach the build coordinator.
|
|
3125
|
+
* @default false
|
|
3126
|
+
*/
|
|
3127
|
+
useDebounce?: boolean;
|
|
3128
|
+
/**
|
|
3129
|
+
* Debounce delay in milliseconds for fs-level debounced watchers.
|
|
3130
|
+
* Only used when {@linkcode useDebounce} is `true`.
|
|
3131
|
+
* @default 10
|
|
3132
|
+
*/
|
|
3133
|
+
debounceDelay?: number;
|
|
3134
|
+
/**
|
|
3135
|
+
* Tick rate in milliseconds for the debouncer's internal polling.
|
|
3136
|
+
* Only used when {@linkcode useDebounce} is `true`.
|
|
3137
|
+
* When undefined, auto-selects 1/4 of debounceDelay.
|
|
3138
|
+
*/
|
|
3139
|
+
debounceTickRate?: number;
|
|
3122
3140
|
}
|
|
3123
3141
|
interface WatcherOptions {
|
|
3124
3142
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-
|
|
1
|
+
import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-D_FXM8pA.mjs";
|
|
2
2
|
//#region src/api/rolldown/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* The API compatible with Rollup's `rollup` function.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as logInputHookInOutputPlugin, n as error } from "./logs-D80CXhvg.mjs";
|
|
2
2
|
import { n as BuiltinPlugin } from "./normalize-string-or-regex-CF3Uz6aU.mjs";
|
|
3
|
-
import { _ as LOG_LEVEL_WARN, a as transformToRollupOutput, b as VERSION, c as transformAssetSource, d as MinimalPluginContextImpl, f as normalizeHook, i as transformModuleInfo, l as lazyProp, m as LOG_LEVEL_DEBUG, o as transformRenderedChunk, p as normalizeLog, s as __decorate, t as bindingifyInputOptions, u as PlainObjectLike, v as logLevelPriority } from "./bindingify-input-options-
|
|
3
|
+
import { _ as LOG_LEVEL_WARN, a as transformToRollupOutput, b as VERSION, c as transformAssetSource, d as MinimalPluginContextImpl, f as normalizeHook, i as transformModuleInfo, l as lazyProp, m as LOG_LEVEL_DEBUG, o as transformRenderedChunk, p as normalizeLog, s as __decorate, t as bindingifyInputOptions, u as PlainObjectLike, v as logLevelPriority } from "./bindingify-input-options-CxjTlvCV.mjs";
|
|
4
4
|
import { v as unimplemented } from "./composable-filters-B2ByPP8y.mjs";
|
|
5
5
|
import { i as unwrapBindingResult } from "./error-CQ6njWsV.mjs";
|
|
6
6
|
import { Worker } from "node:worker_threads";
|
|
@@ -1521,7 +1521,10 @@ isTypeTrue();
|
|
|
1521
1521
|
const WatcherFileWatcherOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1522
1522
|
usePolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use polling-based file watching instead of native OS events")),
|
|
1523
1523
|
pollInterval: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Poll interval in milliseconds (only used when usePolling is true)")),
|
|
1524
|
-
compareContentsForPolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Compare file contents for poll-based watchers (only used when usePolling is true)"))
|
|
1524
|
+
compareContentsForPolling: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Compare file contents for poll-based watchers (only used when usePolling is true)")),
|
|
1525
|
+
useDebounce: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use debounced event delivery at the filesystem level")),
|
|
1526
|
+
debounceDelay: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Debounce delay in milliseconds (only used when useDebounce is true)")),
|
|
1527
|
+
debounceTickRate: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Tick rate in milliseconds for debouncer (only used when useDebounce is true)"))
|
|
1525
1528
|
});
|
|
1526
1529
|
const WatcherOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1527
1530
|
chokidar: /* @__PURE__ */ optional(/* @__PURE__ */ never(`The "watch.chokidar" option is deprecated, please use "watch.watcher" instead of it`)),
|
|
@@ -1812,7 +1815,7 @@ const OutputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
1812
1815
|
/* @__PURE__ */ boolean(),
|
|
1813
1816
|
/* @__PURE__ */ literal("inline"),
|
|
1814
1817
|
/* @__PURE__ */ literal("hidden")
|
|
1815
|
-
])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or
|
|
1818
|
+
])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
|
|
1816
1819
|
sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
|
|
1817
1820
|
sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
|
|
1818
1821
|
sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as logMultipleWatcherOption } from "./logs-D80CXhvg.mjs";
|
|
2
|
-
import { _ as LOG_LEVEL_WARN } from "./bindingify-input-options-
|
|
2
|
+
import { _ as LOG_LEVEL_WARN } from "./bindingify-input-options-CxjTlvCV.mjs";
|
|
3
3
|
import { h as arraify } from "./composable-filters-B2ByPP8y.mjs";
|
|
4
|
-
import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-
|
|
4
|
+
import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-D_FXM8pA.mjs";
|
|
5
5
|
import { t as aggregateBindingErrorsIntoJsError } from "./error-CQ6njWsV.mjs";
|
|
6
6
|
import { BindingWatcher, shutdownAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
7
7
|
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|