@voidzero-dev/vite-plus-core 0.1.3 → 0.1.5-alpha.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.
Files changed (50) hide show
  1. package/dist/rolldown/cli.mjs +617 -184
  2. package/dist/rolldown/config.d.mts +1 -1
  3. package/dist/rolldown/config.mjs +8 -8
  4. package/dist/rolldown/experimental-index.d.mts +2 -2
  5. package/dist/rolldown/experimental-index.mjs +8 -8
  6. package/dist/rolldown/filter-index.d.mts +1 -1
  7. package/dist/rolldown/index.d.mts +1 -1
  8. package/dist/rolldown/index.mjs +8 -8
  9. package/dist/rolldown/parallel-plugin-worker.mjs +5 -5
  10. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  11. package/dist/rolldown/parse-ast-index.mjs +2 -2
  12. package/dist/rolldown/plugins-index.d.mts +2 -2
  13. package/dist/rolldown/plugins-index.mjs +3 -3
  14. package/dist/rolldown/shared/{bindingify-input-options-DdW_FOGG.mjs → bindingify-input-options-DkwIzK4F.mjs} +6 -3
  15. package/dist/rolldown/shared/{constructors-ColrbLxz.d.mts → constructors-Bnr_ApVf.d.mts} +1 -1
  16. package/dist/rolldown/shared/{constructors-CQlws1EK.mjs → constructors-D91FHkmz.mjs} +1 -1
  17. package/dist/rolldown/shared/{define-config-BqZZMLjO.d.mts → define-config-B1jccsL9.d.mts} +18 -0
  18. package/dist/rolldown/shared/{error-FTNambir.mjs → error-tpgdcGrK.mjs} +1 -1
  19. package/dist/rolldown/shared/{load-config-DBRCgd9m.mjs → load-config-Dapgaecf.mjs} +1 -1
  20. package/dist/rolldown/shared/{normalize-string-or-regex-CJTjKt5t.mjs → normalize-string-or-regex-BCllTl21.mjs} +1 -1
  21. package/dist/rolldown/shared/{parse-q7gzDQmi.mjs → parse-DFYpKkKl.mjs} +1 -1
  22. package/dist/rolldown/shared/{rolldown-BJMdRJb1.mjs → rolldown-DK6iIJl8.mjs} +1 -1
  23. package/dist/rolldown/shared/{rolldown-build-DKv2K096.mjs → rolldown-build-rw0HCMhn.mjs} +9 -6
  24. package/dist/rolldown/shared/{transform-CQppMqL8.mjs → transform-BSCulZAO.mjs} +2 -2
  25. package/dist/rolldown/shared/{watch-BeMWbIuq.mjs → watch-D8uEZyLj.mjs} +4 -4
  26. package/dist/rolldown/utils-index.mjs +4 -4
  27. package/dist/tsdown/{build-TmLngPCw-CBoVPzkZ.js → build-BG-XbM6V-hoyhQqI3.js} +41 -153
  28. package/dist/tsdown/build-DHPfiKA--CvTonTfC.js +5 -0
  29. package/dist/tsdown/{debug-tOJ_PtrM-C-Do1Twv.js → debug-C4FmgzkJ-B6m_gRpz.js} +2 -2
  30. package/dist/tsdown/{detect-DK-FDZQ9-CHuRhyUG.js → detect-J1_Vd1yf-BWDiPZkP.js} +1 -1
  31. package/dist/tsdown/{dist-DCol2bGA.js → dist-C9Oecl0H.js} +2 -2
  32. package/dist/tsdown/{dist-Ba2DZx1w.js → dist-Dx-jtFHM.js} +2 -4
  33. package/dist/tsdown/{index-node-Djp92Gzb-B-AUHI4t.js → index-node-Bpsmc0eX-jMz9gD3P.js} +1 -1
  34. package/dist/tsdown/index-types.d.ts +8556 -176
  35. package/dist/tsdown/index.js +5 -5
  36. package/dist/tsdown/{main-DYgM-9Cb.js → main-DN-_H9u2.js} +3 -3
  37. package/dist/tsdown/run.js +3 -3
  38. package/dist/tsdown/{tsc-CberiTDq.js → tsc-OwK9UHsV.js} +1 -1
  39. package/dist/vite/client/client.mjs +112 -0
  40. package/dist/vite/node/chunks/logger.js +1 -1
  41. package/dist/vite/node/chunks/node.js +823 -494
  42. package/dist/vite/node/cli.js +201 -63
  43. package/dist/vite/node/index.d.ts +15 -12
  44. package/dist/vite/node/index.js +1 -1
  45. package/dist/vite/node/module-runner.d.ts +5 -1
  46. package/dist/vite/types/customEvent.d.ts +27 -0
  47. package/package.json +9 -9
  48. package/dist/tsdown/build-gOkJM1H9-D9ngUBpk.js +0 -5
  49. /package/dist/rolldown/shared/{binding-COZdHtee.mjs → binding-BSVL02lq.mjs} +0 -0
  50. /package/dist/tsdown/{filename-BDcjeHGl.js → filename-tIvGuRvQ.js} +0 -0
@@ -4,8 +4,7 @@ import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { inspect } from "node:util";
6
6
  import { performance } from "node:perf_hooks";
7
- import { EventEmitter } from "events";
8
- //#region ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
7
+ //#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
9
8
  function toArr(any) {
10
9
  return any == null ? [] : Array.isArray(any) ? any : [any];
11
10
  }
@@ -13,7 +12,7 @@ function toVal(out, key, val, opts) {
13
12
  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;
14
13
  out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
15
14
  }
16
- function mri2(args, opts) {
15
+ function lib_default(args, opts) {
17
16
  args = args || [];
18
17
  opts = opts || {};
19
18
  var k, arr, arg, name, val, out = { _: [] };
@@ -78,8 +77,10 @@ function mri2(args, opts) {
78
77
  }
79
78
  return out;
80
79
  }
81
- const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
82
- const findAllBrackets = (v) => {
80
+ function removeBrackets(v) {
81
+ return v.replace(/[<[].+/, "").trim();
82
+ }
83
+ function findAllBrackets(v) {
83
84
  const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
84
85
  const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
85
86
  const res = [];
@@ -101,8 +102,8 @@ const findAllBrackets = (v) => {
101
102
  let squareMatch;
102
103
  while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
103
104
  return res;
104
- };
105
- const getMriOptions = (options) => {
105
+ }
106
+ function getMriOptions(options) {
106
107
  const result = {
107
108
  alias: {},
108
109
  boolean: []
@@ -116,62 +117,76 @@ const getMriOptions = (options) => {
116
117
  } else result.boolean.push(option.names[0]);
117
118
  }
118
119
  return result;
119
- };
120
- const findLongest = (arr) => {
120
+ }
121
+ function findLongest(arr) {
121
122
  return arr.sort((a, b) => {
122
123
  return a.length > b.length ? -1 : 1;
123
124
  })[0];
124
- };
125
- const padRight = (str, length) => {
125
+ }
126
+ function padRight(str, length) {
126
127
  return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
127
- };
128
- const camelcase = (input) => {
129
- return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
128
+ }
129
+ function camelcase(input) {
130
+ return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
130
131
  return p1 + p2.toUpperCase();
131
132
  });
132
- };
133
- const setDotProp = (obj, keys, val) => {
134
- let i = 0;
135
- let length = keys.length;
136
- let t = obj;
137
- let x;
138
- for (; i < length; ++i) {
139
- x = t[keys[i]];
140
- t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
133
+ }
134
+ function setDotProp(obj, keys, val) {
135
+ let current = obj;
136
+ for (let i = 0; i < keys.length; i++) {
137
+ const key = keys[i];
138
+ if (i === keys.length - 1) {
139
+ current[key] = val;
140
+ return;
141
+ }
142
+ if (current[key] == null) {
143
+ const nextKeyIsArrayIndex = +keys[i + 1] > -1;
144
+ current[key] = nextKeyIsArrayIndex ? [] : {};
145
+ }
146
+ current = current[key];
141
147
  }
142
- };
143
- const setByType = (obj, transforms) => {
148
+ }
149
+ function setByType(obj, transforms) {
144
150
  for (const key of Object.keys(transforms)) {
145
151
  const transform = transforms[key];
146
152
  if (transform.shouldTransform) {
147
- obj[key] = Array.prototype.concat.call([], obj[key]);
153
+ obj[key] = [obj[key]].flat();
148
154
  if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
149
155
  }
150
156
  }
151
- };
152
- const getFileName = (input) => {
153
- const m = /([^\\\/]+)$/.exec(input);
157
+ }
158
+ function getFileName(input) {
159
+ const m = /([^\\/]+)$/.exec(input);
154
160
  return m ? m[1] : "";
155
- };
156
- const camelcaseOptionName = (name) => {
161
+ }
162
+ function camelcaseOptionName(name) {
157
163
  return name.split(".").map((v, i) => {
158
164
  return i === 0 ? camelcase(v) : v;
159
165
  }).join(".");
160
- };
166
+ }
161
167
  var CACError = class extends Error {
162
168
  constructor(message) {
163
169
  super(message);
164
- this.name = this.constructor.name;
165
- if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, this.constructor);
166
- else this.stack = new Error(message).stack;
170
+ this.name = "CACError";
171
+ if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
167
172
  }
168
173
  };
169
174
  var Option = class {
175
+ rawName;
176
+ description;
177
+ /** Option name */
178
+ name;
179
+ /** Option name and aliases */
180
+ names;
181
+ isBoolean;
182
+ required;
183
+ config;
184
+ negated;
170
185
  constructor(rawName, description, config) {
171
186
  this.rawName = rawName;
172
187
  this.description = description;
173
188
  this.config = Object.assign({}, config);
174
- rawName = rawName.replace(/\.\*/g, "");
189
+ rawName = rawName.replaceAll(".*", "");
175
190
  this.negated = false;
176
191
  this.names = removeBrackets(rawName).split(",").map((v) => {
177
192
  let name = v.trim().replace(/^-{1,2}/, "");
@@ -181,16 +196,39 @@ var Option = class {
181
196
  }
182
197
  return camelcaseOptionName(name);
183
198
  }).sort((a, b) => a.length > b.length ? 1 : -1);
184
- this.name = this.names[this.names.length - 1];
199
+ this.name = this.names.at(-1);
185
200
  if (this.negated && this.config.default == null) this.config.default = true;
186
201
  if (rawName.includes("<")) this.required = true;
187
202
  else if (rawName.includes("[")) this.required = false;
188
203
  else this.isBoolean = true;
189
204
  }
190
205
  };
191
- const processArgs = process.argv;
192
- const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
206
+ let runtimeProcessArgs;
207
+ let runtimeInfo;
208
+ if (typeof process !== "undefined") {
209
+ let runtimeName;
210
+ if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
211
+ else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
212
+ else runtimeName = "node";
213
+ runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
214
+ runtimeProcessArgs = process.argv;
215
+ } else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
216
+ else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
193
217
  var Command = class {
218
+ rawName;
219
+ description;
220
+ config;
221
+ cli;
222
+ options;
223
+ aliasNames;
224
+ name;
225
+ args;
226
+ commandAction;
227
+ usageText;
228
+ versionNumber;
229
+ examples;
230
+ helpCallback;
231
+ globalCommand;
194
232
  constructor(rawName, description, config = {}, cli) {
195
233
  this.rawName = rawName;
196
234
  this.description = description;
@@ -223,6 +261,12 @@ var Command = class {
223
261
  this.examples.push(example);
224
262
  return this;
225
263
  }
264
+ /**
265
+ * Add a option for this command
266
+ * @param rawName Raw option name(s)
267
+ * @param description Option description
268
+ * @param config Option config
269
+ */
226
270
  option(rawName, description, config) {
227
271
  const option = new Option(rawName, description, config);
228
272
  this.options.push(option);
@@ -236,6 +280,10 @@ var Command = class {
236
280
  this.commandAction = callback;
237
281
  return this;
238
282
  }
283
+ /**
284
+ * Check if a command name is matched by this command
285
+ * @param name Command name
286
+ */
239
287
  isMatched(name) {
240
288
  return this.name === name || this.aliasNames.includes(name);
241
289
  }
@@ -245,6 +293,10 @@ var Command = class {
245
293
  get isGlobalCommand() {
246
294
  return this instanceof GlobalCommand;
247
295
  }
296
+ /**
297
+ * Check if an option is registered in this command
298
+ * @param name Option name
299
+ */
248
300
  hasOption(name) {
249
301
  name = name.split(".")[0];
250
302
  return this.options.find((option) => {
@@ -266,8 +318,7 @@ var Command = class {
266
318
  body: commands.map((command) => {
267
319
  return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
268
320
  }).join("\n")
269
- });
270
- sections.push({
321
+ }, {
271
322
  title: `For more info, run any command with the \`--help\` flag`,
272
323
  body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
273
324
  });
@@ -291,26 +342,33 @@ var Command = class {
291
342
  }).join("\n")
292
343
  });
293
344
  if (helpCallback) sections = helpCallback(sections) || sections;
294
- console.log(sections.map((section) => {
295
- return section.title ? `${section.title}:
296
- ${section.body}` : section.body;
345
+ console.info(sections.map((section) => {
346
+ return section.title ? `${section.title}:\n${section.body}` : section.body;
297
347
  }).join("\n\n"));
298
348
  }
299
349
  outputVersion() {
300
350
  const { name } = this.cli;
301
351
  const { versionNumber } = this.cli.globalCommand;
302
- if (versionNumber) console.log(`${name}/${versionNumber} ${platformInfo}`);
352
+ if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
303
353
  }
304
354
  checkRequiredArgs() {
305
355
  const minimalArgsCount = this.args.filter((arg) => arg.required).length;
306
356
  if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
307
357
  }
358
+ /**
359
+ * Check if the parsed options contain any unknown options
360
+ *
361
+ * Exit and output error when true
362
+ */
308
363
  checkUnknownOptions() {
309
364
  const { options, globalCommand } = this.cli;
310
365
  if (!this.config.allowUnknownOptions) {
311
366
  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}`}\``);
312
367
  }
313
368
  }
369
+ /**
370
+ * Check if the required string-type options exist
371
+ */
314
372
  checkOptionValue() {
315
373
  const { options: parsedOptions, globalCommand } = this.cli;
316
374
  const options = [...globalCommand.options, ...this.options];
@@ -322,14 +380,43 @@ ${section.body}` : section.body;
322
380
  }
323
381
  }
324
382
  }
383
+ /**
384
+ * Check if the number of args is more than expected
385
+ */
386
+ checkUnusedArgs() {
387
+ const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
388
+ if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
389
+ }
325
390
  };
326
391
  var GlobalCommand = class extends Command {
327
392
  constructor(cli) {
328
393
  super("@@global@@", "", {}, cli);
329
394
  }
330
395
  };
331
- var __assign = Object.assign;
332
- var CAC = class extends EventEmitter {
396
+ var CAC = class extends EventTarget {
397
+ /** The program name to display in help and version message */
398
+ name;
399
+ commands;
400
+ globalCommand;
401
+ matchedCommand;
402
+ matchedCommandName;
403
+ /**
404
+ * Raw CLI arguments
405
+ */
406
+ rawArgs;
407
+ /**
408
+ * Parsed CLI arguments
409
+ */
410
+ args;
411
+ /**
412
+ * Parsed CLI options, camelCased
413
+ */
414
+ options;
415
+ showHelpOnExit;
416
+ showVersionOnExit;
417
+ /**
418
+ * @param name The program name to display in help and version message
419
+ */
333
420
  constructor(name = "") {
334
421
  super();
335
422
  this.name = name;
@@ -340,39 +427,75 @@ var CAC = class extends EventEmitter {
340
427
  this.globalCommand = new GlobalCommand(this);
341
428
  this.globalCommand.usage("<command> [options]");
342
429
  }
430
+ /**
431
+ * Add a global usage text.
432
+ *
433
+ * This is not used by sub-commands.
434
+ */
343
435
  usage(text) {
344
436
  this.globalCommand.usage(text);
345
437
  return this;
346
438
  }
439
+ /**
440
+ * Add a sub-command
441
+ */
347
442
  command(rawName, description, config) {
348
443
  const command = new Command(rawName, description || "", config, this);
349
444
  command.globalCommand = this.globalCommand;
350
445
  this.commands.push(command);
351
446
  return command;
352
447
  }
448
+ /**
449
+ * Add a global CLI option.
450
+ *
451
+ * Which is also applied to sub-commands.
452
+ */
353
453
  option(rawName, description, config) {
354
454
  this.globalCommand.option(rawName, description, config);
355
455
  return this;
356
456
  }
457
+ /**
458
+ * Show help message when `-h, --help` flags appear.
459
+ *
460
+ */
357
461
  help(callback) {
358
462
  this.globalCommand.option("-h, --help", "Display this message");
359
463
  this.globalCommand.helpCallback = callback;
360
464
  this.showHelpOnExit = true;
361
465
  return this;
362
466
  }
467
+ /**
468
+ * Show version number when `-v, --version` flags appear.
469
+ *
470
+ */
363
471
  version(version, customFlags = "-v, --version") {
364
472
  this.globalCommand.version(version, customFlags);
365
473
  this.showVersionOnExit = true;
366
474
  return this;
367
475
  }
476
+ /**
477
+ * Add a global example.
478
+ *
479
+ * This example added here will not be used by sub-commands.
480
+ */
368
481
  example(example) {
369
482
  this.globalCommand.example(example);
370
483
  return this;
371
484
  }
485
+ /**
486
+ * Output the corresponding help message
487
+ * When a sub-command is matched, output the help message for the command
488
+ * Otherwise output the global one.
489
+ *
490
+ */
372
491
  outputHelp() {
373
492
  if (this.matchedCommand) this.matchedCommand.outputHelp();
374
493
  else this.globalCommand.outputHelp();
375
494
  }
495
+ /**
496
+ * Output the version number.
497
+ *
498
+ */
376
499
  outputVersion() {
377
500
  this.globalCommand.outputVersion();
378
501
  }
@@ -387,7 +510,14 @@ var CAC = class extends EventEmitter {
387
510
  this.matchedCommand = void 0;
388
511
  this.matchedCommandName = void 0;
389
512
  }
390
- parse(argv = processArgs, { run = true } = {}) {
513
+ /**
514
+ * Parse argv
515
+ */
516
+ parse(argv, { run = true } = {}) {
517
+ if (!argv) {
518
+ if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
519
+ argv = runtimeProcessArgs;
520
+ }
391
521
  this.rawArgs = argv;
392
522
  if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
393
523
  let shouldParse = true;
@@ -396,17 +526,20 @@ var CAC = class extends EventEmitter {
396
526
  const commandName = parsed.args[0];
397
527
  if (command.isMatched(commandName)) {
398
528
  shouldParse = false;
399
- const parsedInfo = __assign(__assign({}, parsed), { args: parsed.args.slice(1) });
529
+ const parsedInfo = {
530
+ ...parsed,
531
+ args: parsed.args.slice(1)
532
+ };
400
533
  this.setParsedInfo(parsedInfo, command, commandName);
401
- this.emit(`command:${commandName}`, command);
534
+ this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
402
535
  }
403
536
  }
404
537
  if (shouldParse) {
405
- for (const command of this.commands) if (command.name === "") {
538
+ for (const command of this.commands) if (command.isDefaultCommand) {
406
539
  shouldParse = false;
407
540
  const parsed = this.mri(argv.slice(2), command);
408
541
  this.setParsedInfo(parsed, command);
409
- this.emit(`command:!`, command);
542
+ this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
410
543
  }
411
544
  }
412
545
  if (shouldParse) {
@@ -428,7 +561,7 @@ var CAC = class extends EventEmitter {
428
561
  options: this.options
429
562
  };
430
563
  if (run) this.runMatchedCommand();
431
- if (!this.matchedCommand && this.args[0]) this.emit("command:*");
564
+ if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
432
565
  return parsedArgv;
433
566
  }
434
567
  mri(argv, command) {
@@ -436,26 +569,27 @@ var CAC = class extends EventEmitter {
436
569
  const mriOptions = getMriOptions(cliOptions);
437
570
  let argsAfterDoubleDashes = [];
438
571
  const doubleDashesIndex = argv.indexOf("--");
439
- if (doubleDashesIndex > -1) {
572
+ if (doubleDashesIndex !== -1) {
440
573
  argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
441
574
  argv = argv.slice(0, doubleDashesIndex);
442
575
  }
443
- let parsed = mri2(argv, mriOptions);
576
+ let parsed = lib_default(argv, mriOptions);
444
577
  parsed = Object.keys(parsed).reduce((res, name) => {
445
- return __assign(__assign({}, res), { [camelcaseOptionName(name)]: parsed[name] });
578
+ return {
579
+ ...res,
580
+ [camelcaseOptionName(name)]: parsed[name]
581
+ };
446
582
  }, { _: [] });
447
583
  const args = parsed._;
448
584
  const options = { "--": argsAfterDoubleDashes };
449
585
  const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
450
- let transforms = Object.create(null);
586
+ const transforms = Object.create(null);
451
587
  for (const cliOption of cliOptions) {
452
588
  if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
453
- if (Array.isArray(cliOption.config.type)) {
454
- if (transforms[cliOption.name] === void 0) {
455
- transforms[cliOption.name] = Object.create(null);
456
- transforms[cliOption.name]["shouldTransform"] = true;
457
- transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
458
- }
589
+ if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
590
+ transforms[cliOption.name] = Object.create(null);
591
+ transforms[cliOption.name].shouldTransform = true;
592
+ transforms[cliOption.name].transformFunction = cliOption.config.type[0];
459
593
  }
460
594
  }
461
595
  for (const key of Object.keys(parsed)) if (key !== "_") {
@@ -473,6 +607,7 @@ var CAC = class extends EventEmitter {
473
607
  command.checkUnknownOptions();
474
608
  command.checkOptionValue();
475
609
  command.checkRequiredArgs();
610
+ command.checkUnusedArgs();
476
611
  const actionArgs = [];
477
612
  command.args.forEach((arg, index) => {
478
613
  if (arg.variadic) actionArgs.push(args.slice(index));
@@ -482,6 +617,9 @@ var CAC = class extends EventEmitter {
482
617
  return command.commandAction.apply(this, actionArgs);
483
618
  }
484
619
  };
620
+ /**
621
+ * @param name The program name to display in help and version message
622
+ */
485
623
  const cac = (name = "") => new CAC(name);
486
624
  //#endregion
487
625
  //#region ../../rolldown-vite/packages/vite/src/node/cli.ts
@@ -684,6 +684,18 @@ interface CorsOptions {
684
684
  }
685
685
  type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
686
686
  //#endregion
687
+ //#region src/shared/forwardConsole.d.ts
688
+ type ForwardConsoleLogLevel = "error" | "warn" | "info" | "log" | "debug" | (string & {});
689
+ interface ForwardConsoleOptions {
690
+ unhandledErrors?: boolean;
691
+ logLevels?: ForwardConsoleLogLevel[];
692
+ }
693
+ interface ResolvedForwardConsoleOptions {
694
+ enabled: boolean;
695
+ unhandledErrors: boolean;
696
+ logLevels: ForwardConsoleLogLevel[];
697
+ }
698
+ //#endregion
687
699
  //#region src/node/typeUtils.d.ts
688
700
  type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
689
701
  //#endregion
@@ -2485,11 +2497,13 @@ interface ServerOptions$1 extends CommonServerOptions {
2485
2497
  * @experimental
2486
2498
  */
2487
2499
  hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
2500
+ forwardConsole?: boolean | ForwardConsoleOptions;
2488
2501
  }
2489
- interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList"> {
2502
+ interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList" | "forwardConsole"> {
2490
2503
  fs: Required<FileSystemServeOptions>;
2491
2504
  middlewareMode: NonNullable<ServerOptions$1["middlewareMode"]>;
2492
2505
  sourcemapIgnoreList: Exclude<ServerOptions$1["sourcemapIgnoreList"], false | undefined>;
2506
+ forwardConsole: ResolvedForwardConsoleOptions;
2493
2507
  }
2494
2508
  interface FileSystemServeOptions {
2495
2509
  /**
@@ -3497,17 +3511,6 @@ interface ExperimentalOptions {
3497
3511
  */
3498
3512
  hmrPartialAccept?: boolean;
3499
3513
  /**
3500
- * Enable builtin plugin that written by rust, which is faster than js plugin.
3501
- *
3502
- * - 'v1' (will be deprecated, will be removed in v8 stable): Enable the first stable set of native plugins.
3503
- * - 'v2' (will be deprecated, will be removed in v8 stable): Enable the improved dynamicImportVarsPlugin and importGlobPlugin.
3504
- * - true: Enable all native plugins (currently an alias of 'v2', it will map to a newer one in the future versions).
3505
- *
3506
- * @experimental
3507
- * @default 'v2'
3508
- */
3509
- enableNativePlugin?: boolean | "v1" | "v2";
3510
- /**
3511
3514
  * Enable full bundle mode.
3512
3515
  *
3513
3516
  * This is highly experimental.
@@ -1,3 +1,3 @@
1
1
  import { I as defaultAllowedOrigins, N as VERSION, _ as DEFAULT_SERVER_CONDITIONS, d as DEFAULT_CLIENT_MAIN_FIELDS, h as DEFAULT_EXTERNAL_CONDITIONS, n as createLogger, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS } from "./chunks/logger.js";
2
- import { At as createIdResolver, Bt as perEnvironmentPlugin, Ct as DevEnvironment, Dt as formatPostcssSourceMap, E as BuildEnvironment, Et as fetchModule, Ft as loadEnv, Gt as normalizePath, Ht as isCSSRequest, It as resolveEnvPrefix, Jt as withFilter, Kt as rolldownVersion, Lt as transformWithOxc, M as createBuilder, Mt as createServerModuleRunner, Nt as createServerModuleRunnerTransport, O as build, Ot as preprocessCSS, Pt as buildErrorMessage, Rt as transformWithEsbuild, S as preview, St as send, T as isRunnableDevEnvironment, Tt as isFileServingAllowed, Ut as mergeAlias, Vt as createFilter, Wt as mergeConfig, _ as resolveConfig, _t as createServer, a as minifySync, b as sortUserPlugins, c as parseAstAsync, ct as optimizeDeps, d as isFetchableDevEnvironment, f as defineConfig, h as loadConfigFromFile, ht as createServerHotChannel, i as minify, jt as ssrTransform, kt as searchForWorkspaceRoot, l as parseSync, n as esbuildVersion, o as parse, qt as rollupVersion, r as esmExternalRequirePlugin, s as parseAst, t as Visitor, u as createFetchableDevEnvironment, w as createRunnableDevEnvironment, wt as isFileLoadingAllowed, x as runnerImport, zt as perEnvironmentState } from "./chunks/node.js";
2
+ import { At as searchForWorkspaceRoot, Bt as transformWithEsbuild, Ct as send, Dt as fetchModule, E as BuildEnvironment, Et as isFileServingAllowed, Ft as createServerModuleRunnerTransport, Gt as mergeConfig, Ht as createFilter, It as buildErrorMessage, Jt as rollupVersion, Kt as normalizePath, Lt as loadEnv, M as createBuilder, Mt as perEnvironmentState, Nt as ssrTransform, O as build, Ot as formatPostcssSourceMap, Pt as createServerModuleRunner, Rt as resolveEnvPrefix, S as preview, T as isRunnableDevEnvironment, Tt as isFileLoadingAllowed, Ut as isCSSRequest, Vt as perEnvironmentPlugin, Wt as mergeAlias, Yt as withFilter, _ as resolveConfig, _t as createServer, a as minifySync, b as sortUserPlugins, c as parseAstAsync, ct as optimizeDeps, d as isFetchableDevEnvironment, f as defineConfig, h as loadConfigFromFile, ht as createServerHotChannel, i as minify, jt as createIdResolver, kt as preprocessCSS, l as parseSync, n as esbuildVersion, o as parse, qt as rolldownVersion, r as esmExternalRequirePlugin, s as parseAst, t as Visitor, u as createFetchableDevEnvironment, w as createRunnableDevEnvironment, wt as DevEnvironment, x as runnerImport, zt as transformWithOxc } from "./chunks/node.js";
3
3
  export { BuildEnvironment, DevEnvironment, Visitor, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
@@ -156,10 +156,14 @@ interface InterceptorOptions {
156
156
  }
157
157
  //#endregion
158
158
  //#region src/module-runner/types.d.ts
159
- interface ModuleRunnerImportMeta extends ImportMeta {
159
+ interface ModuleRunnerImportMeta {
160
160
  url: string;
161
161
  env: ImportMetaEnv;
162
162
  hot?: ViteHotContext;
163
+ dirname: string;
164
+ filename: string;
165
+ glob: (...args: any[]) => any;
166
+ resolve(specifier: string, parent?: string): string;
163
167
  [key: string]: any;
164
168
  }
165
169
  interface ModuleRunnerContext {
@@ -16,6 +16,8 @@ export interface CustomEventMap {
16
16
  'vite:ws:connect': WebSocketConnectionPayload
17
17
  'vite:ws:disconnect': WebSocketConnectionPayload
18
18
  /** @internal */
19
+ 'vite:forward-console': ForwardConsolePayload
20
+ /** @internal */
19
21
  'vite:module-loaded': { modules: string[] }
20
22
 
21
23
  // server events
@@ -40,6 +42,31 @@ export interface InvalidatePayload {
40
42
  firstInvalidatedBy: string
41
43
  }
42
44
 
45
+ export type ForwardConsolePayload =
46
+ | {
47
+ type: 'error'
48
+ data: {
49
+ name: string
50
+ message: string
51
+ stack?: string
52
+ }
53
+ }
54
+ | {
55
+ type: 'unhandled-rejection'
56
+ data: {
57
+ name: string
58
+ message: string
59
+ stack?: string
60
+ }
61
+ }
62
+ | {
63
+ type: 'log'
64
+ data: {
65
+ level: string
66
+ message: string
67
+ }
68
+ }
69
+
43
70
  /**
44
71
  * provides types for payloads of built-in Vite events
45
72
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidzero-dev/vite-plus-core",
3
- "version": "0.1.3",
3
+ "version": "0.1.5-alpha.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -116,14 +116,14 @@
116
116
  "semver": "^7.7.3",
117
117
  "tinyglobby": "^0.2.15",
118
118
  "tree-kill": "^1.2.2",
119
- "tsdown": "^0.21.0",
120
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.3",
121
- "rolldown": "1.0.0-rc.7"
119
+ "tsdown": "^0.21.1",
120
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.5-alpha.0",
121
+ "rolldown": "1.0.0-rc.8"
122
122
  },
123
123
  "peerDependencies": {
124
124
  "@arethetypeswrong/core": "^0.18.1",
125
- "@tsdown/css": "0.21.0",
126
- "@tsdown/exe": "0.21.0",
125
+ "@tsdown/css": "0.21.1",
126
+ "@tsdown/exe": "0.21.1",
127
127
  "@types/node": "^20.19.0 || >=22.12.0",
128
128
  "@vitejs/devtools": "^0.0.0-alpha.31",
129
129
  "esbuild": "^0.27.0",
@@ -203,9 +203,9 @@
203
203
  "node": "^20.19.0 || >=22.12.0"
204
204
  },
205
205
  "bundledVersions": {
206
- "vite": "8.0.0-beta.16",
207
- "rolldown": "1.0.0-rc.7",
208
- "tsdown": "0.21.0"
206
+ "vite": "8.0.0-beta.18",
207
+ "rolldown": "1.0.0-rc.8",
208
+ "tsdown": "0.21.1"
209
209
  },
210
210
  "scripts": {
211
211
  "build": "oxnode -C dev ./build.ts"
@@ -1,5 +0,0 @@
1
- import "./main-DYgM-9Cb.js";
2
- import "./node-B3Gdtau1.js";
3
- import "./filename-BDcjeHGl.js";
4
- import { t as build$1 } from "./build-TmLngPCw-CBoVPzkZ.js";
5
- export { build$1 as build };