rolldown 1.0.0-beta.16 → 1.0.0-beta.18

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 (42) hide show
  1. package/dist/cli.cjs +6 -6
  2. package/dist/cli.mjs +1042 -1081
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +4 -6
  7. package/dist/experimental-index.cjs +7 -31
  8. package/dist/experimental-index.d.cts +2 -2
  9. package/dist/experimental-index.d.mts +2 -2
  10. package/dist/experimental-index.mjs +4 -22
  11. package/dist/filter-index.d.cts +2 -2
  12. package/dist/filter-index.d.mts +2 -2
  13. package/dist/filter-index.mjs +1 -2
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.mts +2 -2
  17. package/dist/index.mjs +3 -4
  18. package/dist/parallel-plugin-worker.cjs +3 -4
  19. package/dist/parallel-plugin-worker.mjs +27 -34
  20. package/dist/parallel-plugin.d.cts +2 -2
  21. package/dist/parallel-plugin.d.mts +2 -2
  22. package/dist/parse-ast-index.cjs +1 -1
  23. package/dist/parse-ast-index.d.cts +1 -1
  24. package/dist/parse-ast-index.d.mts +1 -1
  25. package/dist/parse-ast-index.mjs +1 -2
  26. package/dist/shared/{binding--Y47JZSL.d.cts → binding-D__94uwg.d.cts} +13 -462
  27. package/dist/shared/{binding-C_9au5Eg.d.mts → binding-DwMf_OTa.d.mts} +13 -462
  28. package/dist/shared/{define-config-DMWHsgSt.d.mts → define-config-CXjwrGWr.d.cts} +70 -10
  29. package/dist/shared/{define-config-CAyC9-af.d.cts → define-config-pMM2R7Js.d.mts} +70 -10
  30. package/dist/shared/{load-config-BniS-jT_.cjs → load-config-BeHXwv7L.cjs} +1 -1
  31. package/dist/shared/{load-config-BT5Ts430.mjs → load-config-D2fi4c8T.mjs} +14 -19
  32. package/dist/shared/{misc-DGAe2XOW.mjs → misc-BN0nse6C.mjs} +1 -4
  33. package/dist/shared/parse-ast-index-BbUPYP6B.cjs +738 -0
  34. package/dist/shared/parse-ast-index-QIuIuIzO.mjs +616 -0
  35. package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
  36. package/dist/shared/{src-1lPDqeuR.cjs → src-BHe-J6xJ.cjs} +44 -48
  37. package/dist/shared/{src-Cv4_zurW.mjs → src-Bob3e8Hh.mjs} +1136 -1394
  38. package/package.json +21 -21
  39. package/dist/shared/chunk--iN_1bjD.mjs +0 -33
  40. package/dist/shared/parse-ast-index-BHkdbivO.mjs +0 -659
  41. package/dist/shared/parse-ast-index-hgMnddyI.cjs +0 -701
  42. package/dist/shared/prompt-CodO769G.mjs +0 -854
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
- const require_parse_ast_index = require('./parse-ast-index-hgMnddyI.cjs');
2
+ const require_parse_ast_index = require('./parse-ast-index-BbUPYP6B.cjs');
3
3
  const require_misc = require('./misc-BKp5iIef.cjs');
4
4
  const node_path = require_chunk.__toESM(require("node:path"));
5
5
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -9,14 +9,13 @@ const node_os = require_chunk.__toESM(require("node:os"));
9
9
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
10
10
 
11
11
  //#region package.json
12
- var version = "1.0.0-beta.16";
12
+ var version = "1.0.0-beta.18";
13
13
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
14
14
 
15
15
  //#endregion
16
16
  //#region src/builtin-plugin/utils.ts
17
- var import_binding$6 = require_chunk.__toESM(require_parse_ast_index.require_binding());
18
17
  function makeBuiltinPluginCallable(plugin) {
19
- let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
18
+ let callablePlugin = new require_parse_ast_index.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
20
19
  const wrappedPlugin = plugin;
21
20
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
22
21
  return callablePlugin[key](...args$1);
@@ -2024,6 +2023,7 @@ const InputOptionsSchema = strictObject({
2024
2023
  experimental: optional(strictObject({
2025
2024
  disableLiveBindings: optional(boolean()),
2026
2025
  enableComposingJsPlugins: optional(boolean()),
2026
+ viteMode: optional(boolean()),
2027
2027
  resolveNewUrlToAsset: optional(boolean()),
2028
2028
  strictExecutionOrder: optional(boolean()),
2029
2029
  hmr: optional(HmrSchema),
@@ -2375,12 +2375,11 @@ function transformModuleInfo(info, option) {
2375
2375
 
2376
2376
  //#endregion
2377
2377
  //#region src/utils/transform-side-effects.ts
2378
- var import_binding$5 = require_chunk.__toESM(require_parse_ast_index.require_binding());
2379
2378
  function bindingifySideEffects(sideEffects) {
2380
2379
  switch (sideEffects) {
2381
- case true: return import_binding$5.BindingHookSideEffects.True;
2382
- case false: return import_binding$5.BindingHookSideEffects.False;
2383
- case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
2380
+ case true: return require_parse_ast_index.BindingHookSideEffects.True;
2381
+ case false: return require_parse_ast_index.BindingHookSideEffects.False;
2382
+ case "no-treeshake": return require_parse_ast_index.BindingHookSideEffects.NoTreeshake;
2384
2383
  case null:
2385
2384
  case void 0: return void 0;
2386
2385
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -2581,14 +2580,13 @@ function bindingifyRenderChunkFilter(filterOption) {
2581
2580
 
2582
2581
  //#endregion
2583
2582
  //#region src/plugin/bindingify-plugin-hook-meta.ts
2584
- var import_binding$4 = require_chunk.__toESM(require_parse_ast_index.require_binding());
2585
2583
  function bindingifyPluginHookMeta(options) {
2586
2584
  return { order: bindingPluginOrder(options.order) };
2587
2585
  }
2588
2586
  function bindingPluginOrder(order) {
2589
2587
  switch (order) {
2590
- case "post": return import_binding$4.BindingPluginOrder.Post;
2591
- case "pre": return import_binding$4.BindingPluginOrder.Pre;
2588
+ case "post": return require_parse_ast_index.BindingPluginOrder.Post;
2589
+ case "pre": return require_parse_ast_index.BindingPluginOrder.Pre;
2592
2590
  case null:
2593
2591
  case void 0: return void 0;
2594
2592
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -3771,7 +3769,6 @@ function isReadonlyArray(input) {
3771
3769
 
3772
3770
  //#endregion
3773
3771
  //#region src/utils/bindingify-input-options.ts
3774
- var import_binding$3 = require_chunk.__toESM(require_parse_ast_index.require_binding());
3775
3772
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3776
3773
  const pluginContextData = new PluginContextData();
3777
3774
  const plugins = rawPlugins.map((plugin) => {
@@ -3836,9 +3833,9 @@ function bindingifyHmr(hmr) {
3836
3833
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3837
3834
  switch (attachDebugInfo) {
3838
3835
  case void 0: return void 0;
3839
- case "full": return import_binding$3.BindingAttachDebugInfo.Full;
3840
- case "simple": return import_binding$3.BindingAttachDebugInfo.Simple;
3841
- case "none": return import_binding$3.BindingAttachDebugInfo.None;
3836
+ case "full": return require_parse_ast_index.BindingAttachDebugInfo.Full;
3837
+ case "simple": return require_parse_ast_index.BindingAttachDebugInfo.Simple;
3838
+ case "none": return require_parse_ast_index.BindingAttachDebugInfo.None;
3842
3839
  }
3843
3840
  }
3844
3841
  function bindingifyExternal(external) {
@@ -3896,10 +3893,10 @@ function bindingifyInject(inject) {
3896
3893
  }
3897
3894
  function bindingifyLogLevel(logLevel) {
3898
3895
  switch (logLevel) {
3899
- case "silent": return import_binding$3.BindingLogLevel.Silent;
3900
- case "debug": return import_binding$3.BindingLogLevel.Debug;
3901
- case "warn": return import_binding$3.BindingLogLevel.Warn;
3902
- case "info": return import_binding$3.BindingLogLevel.Info;
3896
+ case "silent": return require_parse_ast_index.BindingLogLevel.Silent;
3897
+ case "debug": return require_parse_ast_index.BindingLogLevel.Debug;
3898
+ case "warn": return require_parse_ast_index.BindingLogLevel.Warn;
3899
+ case "info": return require_parse_ast_index.BindingLogLevel.Info;
3903
3900
  default: throw new Error(`Unexpected log level: ${logLevel}`);
3904
3901
  }
3905
3902
  }
@@ -3916,7 +3913,7 @@ function bindingifyInput(input) {
3916
3913
  }
3917
3914
  function bindingifyJsx(input) {
3918
3915
  if (typeof input === "object") {
3919
- if (input.mode === "preserve") return { jsx: import_binding$3.BindingJsx.Preserve };
3916
+ if (input.mode === "preserve") return { jsx: require_parse_ast_index.BindingJsx.Preserve };
3920
3917
  const mode = input.mode ?? "automatic";
3921
3918
  return { jsxTransform: { jsx: {
3922
3919
  runtime: mode,
@@ -3926,10 +3923,10 @@ function bindingifyJsx(input) {
3926
3923
  } } };
3927
3924
  }
3928
3925
  switch (input) {
3929
- case false: return { jsx: import_binding$3.BindingJsx.Disable };
3930
- case "react": return { jsx: import_binding$3.BindingJsx.React };
3931
- case "react-jsx": return { jsx: import_binding$3.BindingJsx.ReactJsx };
3932
- case "preserve": return { jsx: import_binding$3.BindingJsx.Preserve };
3926
+ case false: return { jsx: require_parse_ast_index.BindingJsx.Disable };
3927
+ case "react": return { jsx: require_parse_ast_index.BindingJsx.React };
3928
+ case "react-jsx": return { jsx: require_parse_ast_index.BindingJsx.ReactJsx };
3929
+ case "preserve": return { jsx: require_parse_ast_index.BindingJsx.Preserve };
3933
3930
  default: return { jsx: void 0 };
3934
3931
  }
3935
3932
  }
@@ -4299,7 +4296,6 @@ function composeJsPlugins(plugins) {
4299
4296
 
4300
4297
  //#endregion
4301
4298
  //#region src/utils/initialize-parallel-plugins.ts
4302
- var import_binding$2 = require_chunk.__toESM(require_parse_ast_index.require_binding());
4303
4299
  async function initializeParallelPlugins(plugins) {
4304
4300
  const pluginInfos = [];
4305
4301
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -4312,7 +4308,7 @@ async function initializeParallelPlugins(plugins) {
4312
4308
  }
4313
4309
  if (pluginInfos.length <= 0) return void 0;
4314
4310
  const count = availableParallelism();
4315
- const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
4311
+ const parallelJsPluginRegistry = new require_parse_ast_index.ParallelJsPluginRegistry(count);
4316
4312
  const registryId = parallelJsPluginRegistry.id;
4317
4313
  const workers = await initializeWorkers(registryId, count, pluginInfos);
4318
4314
  const stopWorkers = async () => {
@@ -4397,17 +4393,16 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4397
4393
 
4398
4394
  //#endregion
4399
4395
  //#region src/utils/create-bundler.ts
4400
- var import_binding$1 = require_chunk.__toESM(require_parse_ast_index.require_binding());
4401
4396
  let asyncRuntimeShutdown = false;
4402
- async function createBundler(inputOptions, outputOptions, isClose) {
4397
+ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
4403
4398
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4404
- if (asyncRuntimeShutdown) (0, import_binding$1.startAsyncRuntime)();
4399
+ if (asyncRuntimeShutdown) require_parse_ast_index.startAsyncRuntime();
4405
4400
  try {
4406
4401
  return {
4407
- bundler: new import_binding$1.Bundler(option.bundlerOptions),
4402
+ impl: bundler.createImpl(option.bundlerOptions),
4408
4403
  stopWorkers: option.stopWorkers,
4409
4404
  shutdown: () => {
4410
- (0, import_binding$1.shutdownAsyncRuntime)();
4405
+ require_parse_ast_index.shutdownAsyncRuntime();
4411
4406
  asyncRuntimeShutdown = true;
4412
4407
  }
4413
4408
  };
@@ -4435,47 +4430,49 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4435
4430
  var RolldownBuild = class {
4436
4431
  #inputOptions;
4437
4432
  #bundler;
4433
+ #bundlerImpl;
4438
4434
  constructor(inputOptions) {
4439
4435
  this.#inputOptions = inputOptions;
4436
+ this.#bundler = new require_parse_ast_index.BindingBundler();
4440
4437
  }
4441
4438
  get closed() {
4442
- return this.#bundler?.bundler.closed ?? false;
4439
+ return this.#bundlerImpl?.impl.closed ?? false;
4443
4440
  }
4444
4441
  async #getBundlerWithStopWorker(outputOptions, isClose) {
4445
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4446
- return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
4442
+ if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4443
+ return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
4447
4444
  }
4448
4445
  async generate(outputOptions = {}) {
4449
4446
  validateOption("output", outputOptions);
4450
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4451
- const output = await bundler.generate();
4447
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4448
+ const output = await impl.generate();
4452
4449
  return transformToRollupOutput(output);
4453
4450
  }
4454
4451
  async write(outputOptions = {}) {
4455
4452
  validateOption("output", outputOptions);
4456
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4457
- const output = await bundler.write();
4453
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4454
+ const output = await impl.write();
4458
4455
  return transformToRollupOutput(output);
4459
4456
  }
4460
4457
  async close() {
4461
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4458
+ const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4462
4459
  await stopWorkers?.();
4463
- await bundler.close();
4460
+ await impl.close();
4464
4461
  shutdown();
4465
4462
  }
4466
4463
  async [Symbol.asyncDispose]() {
4467
4464
  await this.close();
4468
4465
  }
4469
4466
  async generateHmrPatch(changedFiles) {
4470
- const output = await this.#bundler.bundler.generateHmrPatch(changedFiles);
4467
+ const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4471
4468
  return transformHmrPatchOutput(output);
4472
4469
  }
4473
4470
  async hmrInvalidate(file, firstInvalidatedBy) {
4474
- const output = await this.#bundler.bundler.hmrInvalidate(file, firstInvalidatedBy);
4471
+ const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4475
4472
  return transformHmrPatchOutput(output);
4476
4473
  }
4477
4474
  get watchFiles() {
4478
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4475
+ return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4479
4476
  }
4480
4477
  };
4481
4478
 
@@ -4575,7 +4572,6 @@ var WatcherEmitter = class {
4575
4572
 
4576
4573
  //#endregion
4577
4574
  //#region src/api/watch/watcher.ts
4578
- var import_binding = require_chunk.__toESM(require_parse_ast_index.require_binding());
4579
4575
  var Watcher = class {
4580
4576
  closed;
4581
4577
  inner;
@@ -4597,7 +4593,7 @@ var Watcher = class {
4597
4593
  this.closed = true;
4598
4594
  for (const stop of this.stopWorkers) await stop?.();
4599
4595
  await this.inner.close();
4600
- (0, import_binding.shutdownAsyncRuntime)();
4596
+ require_parse_ast_index.shutdownAsyncRuntime();
4601
4597
  }
4602
4598
  start() {
4603
4599
  process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
@@ -4610,7 +4606,7 @@ async function createWatcher(emitter, input) {
4610
4606
  return createBundlerOptions(inputOptions, output, true);
4611
4607
  })).flat());
4612
4608
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4613
- const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4609
+ const bindingWatcher = new require_parse_ast_index.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4614
4610
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
4615
4611
  watcher.start();
4616
4612
  }
@@ -4698,10 +4694,10 @@ Object.defineProperty(exports, 'composeJsPlugins', {
4698
4694
  return composeJsPlugins;
4699
4695
  }
4700
4696
  });
4701
- Object.defineProperty(exports, 'createBundler', {
4697
+ Object.defineProperty(exports, 'createBundlerImpl', {
4702
4698
  enumerable: true,
4703
4699
  get: function () {
4704
- return createBundler;
4700
+ return createBundlerImpl;
4705
4701
  }
4706
4702
  });
4707
4703
  Object.defineProperty(exports, 'defineConfig', {