@rolldown/browser 1.0.0-beta.15 → 1.0.0-beta.17

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 (49) hide show
  1. package/dist/cli.cjs +8 -8
  2. package/dist/cli.mjs +1042 -1083
  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 -5
  7. package/dist/experimental-index.browser.mjs +3 -3
  8. package/dist/experimental-index.cjs +3 -3
  9. package/dist/experimental-index.d.cts +2 -2
  10. package/dist/experimental-index.d.mts +2 -2
  11. package/dist/experimental-index.mjs +5 -17
  12. package/dist/experimental-runtime-types.d.ts +52 -0
  13. package/dist/filter-index.d.cts +2 -2
  14. package/dist/filter-index.d.mts +2 -2
  15. package/dist/filter-index.mjs +1 -2
  16. package/dist/index.browser.mjs +1 -1
  17. package/dist/index.cjs +2 -2
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.mts +2 -2
  20. package/dist/index.mjs +3 -4
  21. package/dist/parallel-plugin-worker.cjs +2 -2
  22. package/dist/parallel-plugin-worker.mjs +27 -33
  23. package/dist/parallel-plugin.d.cts +2 -2
  24. package/dist/parallel-plugin.d.mts +2 -2
  25. package/dist/parse-ast-index.cjs +1 -1
  26. package/dist/parse-ast-index.d.cts +1 -1
  27. package/dist/parse-ast-index.d.mts +1 -1
  28. package/dist/parse-ast-index.mjs +1 -2
  29. package/dist/rolldown-binding.wasi-browser.js +4 -2
  30. package/dist/rolldown-binding.wasi.cjs +3 -1
  31. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  32. package/dist/shared/{binding-CZdobbZA.d.cts → binding-CWvDTpOw.d.mts} +23 -15
  33. package/dist/shared/{binding-Dze8QVpf.d.mts → binding-um3VI33z.d.cts} +23 -15
  34. package/dist/shared/{define-config-CnVvtpOm.d.mts → define-config-DETTMcOl.d.mts} +73 -12
  35. package/dist/shared/{define-config-BE-fkZNW.d.cts → define-config-POPyhxOq.d.cts} +73 -12
  36. package/dist/shared/dist-BoWaIc-K.mjs +147 -0
  37. package/dist/shared/{load-config-CmZwBnZf.mjs → load-config-C0FU-xTD.mjs} +14 -19
  38. package/dist/shared/{load-config-DlY_Bz-0.cjs → load-config-Cp5Lu-qW.cjs} +1 -1
  39. package/dist/shared/{parse-ast-index-IepkD-LB.mjs → parse-ast-index-B5AmHtd5.mjs} +10 -28
  40. package/dist/shared/{parse-ast-index-5MuKtufe.cjs → parse-ast-index-X4pECV1E.cjs} +1 -1
  41. package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
  42. package/dist/shared/{prompt-8EeOGx1_.cjs → prompt-QNI93ne7.cjs} +2 -2
  43. package/dist/shared/{src-Do34b1Pc.mjs → src-CsIMaM6C.mjs} +1157 -1367
  44. package/dist/shared/{src-CYvvndv2.cjs → src-D8KQ1KMN.cjs} +43 -28
  45. package/dist/{src-B1yRSHcw.js → src-Bv_xHi2_.js} +43 -28
  46. package/package.json +3 -2
  47. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  48. package/dist/shared/dist-DeDsdiza.mjs +0 -153
  49. package/dist/shared/prompt-jPdbaKAj.mjs +0 -854
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
2
  const require_dist = require('./dist-BMVjvV-v.cjs');
3
- const require_parse_ast_index = require('./parse-ast-index-5MuKtufe.cjs');
3
+ const require_parse_ast_index = require('./parse-ast-index-X4pECV1E.cjs');
4
4
  const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
5
5
  const node_path = require_chunk.__toESM(require("node:path"));
6
6
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -8,7 +8,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
8
8
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
9
9
 
10
10
  //#region package.json
11
- var version = "1.0.0-beta.15";
11
+ var version = "1.0.0-beta.17";
12
12
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
13
 
14
14
  //#endregion
@@ -2136,7 +2136,11 @@ const InputOptionsSchema = strictObject({
2136
2136
  resolveNewUrlToAsset: optional(boolean()),
2137
2137
  strictExecutionOrder: optional(boolean()),
2138
2138
  hmr: optional(HmrSchema),
2139
- attachDebugInfo: optional(boolean())
2139
+ attachDebugInfo: optional(union([
2140
+ literal("none"),
2141
+ literal("simple"),
2142
+ literal("full")
2143
+ ]))
2140
2144
  })),
2141
2145
  define: pipe(optional(record(string(), string())), description("Define global variables")),
2142
2146
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
@@ -2410,7 +2414,7 @@ function bindingifySourcemap(map) {
2410
2414
  //#endregion
2411
2415
  //#region src/utils/error.ts
2412
2416
  function normalizeErrors(rawErrors) {
2413
- const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(new Error(), {
2417
+ const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(/* @__PURE__ */ new Error(), {
2414
2418
  kind: e$1.kind,
2415
2419
  message: e$1.message,
2416
2420
  stack: void 0
@@ -2507,7 +2511,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2507
2511
  }
2508
2512
 
2509
2513
  //#endregion
2510
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
2514
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2511
2515
  function u$1(o$1, n$1, a$2) {
2512
2516
  let t$2 = (r$1) => o$1(r$1, ...n$1);
2513
2517
  return a$2 === void 0 ? t$2 : Object.assign(t$2, {
@@ -2517,7 +2521,7 @@ function u$1(o$1, n$1, a$2) {
2517
2521
  }
2518
2522
 
2519
2523
  //#endregion
2520
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
2524
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2521
2525
  function u(r$1, n$1, o$1) {
2522
2526
  let a$2 = r$1.length - n$1.length;
2523
2527
  if (a$2 === 0) return r$1(...n$1);
@@ -2526,7 +2530,7 @@ function u(r$1, n$1, o$1) {
2526
2530
  }
2527
2531
 
2528
2532
  //#endregion
2529
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
2533
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2530
2534
  function d(...r$1) {
2531
2535
  return u(i, r$1);
2532
2536
  }
@@ -2537,7 +2541,7 @@ var i = (r$1, t$2) => {
2537
2541
  };
2538
2542
 
2539
2543
  //#endregion
2540
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
2544
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
2541
2545
  function t(...n$1) {
2542
2546
  return u(Object.keys, n$1);
2543
2547
  }
@@ -3242,13 +3246,13 @@ var NormalizedOutputOptionsImpl = class {
3242
3246
  return this.normalizedOutputPlugins;
3243
3247
  }
3244
3248
  get preserveModules() {
3245
- return this.outputOptions.preserveModules || false;
3249
+ return this.inner.preserveModules;
3246
3250
  }
3247
3251
  get preserveModulesRoot() {
3248
- return this.outputOptions.preserveModulesRoot;
3252
+ return this.inner.preserveModulesRoot;
3249
3253
  }
3250
3254
  get virtualDirname() {
3251
- return this.outputOptions.virtualDirname || "_virtual";
3255
+ return this.inner.virtualDirname;
3252
3256
  }
3253
3257
  };
3254
3258
  function normalizeAddon(value) {
@@ -3903,7 +3907,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3903
3907
  viteMode: inputOptions.experimental?.viteMode,
3904
3908
  resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
3905
3909
  hmr: bindingifyHmr(inputOptions.experimental?.hmr),
3906
- attachDebugInfo: inputOptions.experimental?.attachDebugInfo
3910
+ attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
3907
3911
  },
3908
3912
  profilerNames: inputOptions?.profilerNames,
3909
3913
  jsx,
@@ -3935,6 +3939,14 @@ function bindingifyHmr(hmr) {
3935
3939
  return hmr;
3936
3940
  }
3937
3941
  }
3942
+ function bindingifyAttachDebugInfo(attachDebugInfo) {
3943
+ switch (attachDebugInfo) {
3944
+ case void 0: return void 0;
3945
+ case "full": return src_rolldown_binding_wasi_cjs.BindingAttachDebugInfo.Full;
3946
+ case "simple": return src_rolldown_binding_wasi_cjs.BindingAttachDebugInfo.Simple;
3947
+ case "none": return src_rolldown_binding_wasi_cjs.BindingAttachDebugInfo.None;
3948
+ }
3949
+ }
3938
3950
  function bindingifyExternal(external) {
3939
3951
  if (external) {
3940
3952
  if (typeof external === "function") return (id$1, importer, isResolved) => {
@@ -4491,12 +4503,12 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4491
4503
  //#endregion
4492
4504
  //#region src/utils/create-bundler.ts
4493
4505
  let asyncRuntimeShutdown = false;
4494
- async function createBundler(inputOptions, outputOptions, isClose) {
4506
+ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
4495
4507
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4496
4508
  if (asyncRuntimeShutdown) (0, src_rolldown_binding_wasi_cjs.startAsyncRuntime)();
4497
4509
  try {
4498
4510
  return {
4499
- bundler: new src_rolldown_binding_wasi_cjs.Bundler(option.bundlerOptions),
4511
+ impl: bundler.createImpl(option.bundlerOptions),
4500
4512
  stopWorkers: option.stopWorkers,
4501
4513
  shutdown: () => {
4502
4514
  (0, src_rolldown_binding_wasi_cjs.shutdownAsyncRuntime)();
@@ -4527,46 +4539,49 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4527
4539
  var RolldownBuild = class {
4528
4540
  #inputOptions;
4529
4541
  #bundler;
4542
+ #bundlerImpl;
4530
4543
  constructor(inputOptions) {
4531
4544
  this.#inputOptions = inputOptions;
4545
+ this.#bundler = new src_rolldown_binding_wasi_cjs.BindingBundler();
4532
4546
  }
4533
4547
  get closed() {
4534
- return this.#bundler?.bundler.closed ?? false;
4548
+ return this.#bundlerImpl?.impl.closed ?? false;
4535
4549
  }
4536
4550
  async #getBundlerWithStopWorker(outputOptions, isClose) {
4537
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4538
- return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
4551
+ if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4552
+ return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
4539
4553
  }
4540
4554
  async generate(outputOptions = {}) {
4541
4555
  validateOption("output", outputOptions);
4542
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4543
- const output = await bundler.generate();
4556
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4557
+ const output = await impl.generate();
4544
4558
  return transformToRollupOutput(output);
4545
4559
  }
4546
4560
  async write(outputOptions = {}) {
4547
4561
  validateOption("output", outputOptions);
4548
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4549
- const output = await bundler.write();
4562
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4563
+ const output = await impl.write();
4550
4564
  return transformToRollupOutput(output);
4551
4565
  }
4552
4566
  async close() {
4553
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4567
+ const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4554
4568
  await stopWorkers?.();
4555
- await bundler.close();
4569
+ await impl.close();
4556
4570
  shutdown();
4557
4571
  }
4558
4572
  async [Symbol.asyncDispose]() {
4559
4573
  await this.close();
4560
4574
  }
4561
4575
  async generateHmrPatch(changedFiles) {
4562
- const output = await this.#bundler.bundler.generateHmrPatch(changedFiles);
4576
+ const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4563
4577
  return transformHmrPatchOutput(output);
4564
4578
  }
4565
4579
  async hmrInvalidate(file, firstInvalidatedBy) {
4566
- return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4580
+ const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4581
+ return transformHmrPatchOutput(output);
4567
4582
  }
4568
4583
  get watchFiles() {
4569
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4584
+ return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4570
4585
  }
4571
4586
  };
4572
4587
 
@@ -4794,10 +4809,10 @@ Object.defineProperty(exports, 'composeJsPlugins', {
4794
4809
  return composeJsPlugins;
4795
4810
  }
4796
4811
  });
4797
- Object.defineProperty(exports, 'createBundler', {
4812
+ Object.defineProperty(exports, 'createBundlerImpl', {
4798
4813
  enumerable: true,
4799
4814
  get: function () {
4800
- return createBundler;
4815
+ return createBundlerImpl;
4801
4816
  }
4802
4817
  });
4803
4818
  Object.defineProperty(exports, 'defineConfig', {
@@ -1,4 +1,4 @@
1
- import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
1
+ import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
2
2
 
3
3
  //#region rolldown:runtime
4
4
  var __create = Object.create;
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
 
28
28
  //#endregion
29
29
  //#region package.json
30
- var version = "1.0.0-beta.15";
30
+ var version = "1.0.0-beta.17";
31
31
 
32
32
  //#endregion
33
33
  //#region src/builtin-plugin/utils.ts
@@ -2347,7 +2347,11 @@ const InputOptionsSchema = strictObject({
2347
2347
  resolveNewUrlToAsset: optional(boolean()),
2348
2348
  strictExecutionOrder: optional(boolean()),
2349
2349
  hmr: optional(HmrSchema),
2350
- attachDebugInfo: optional(boolean())
2350
+ attachDebugInfo: optional(union([
2351
+ literal("none"),
2352
+ literal("simple"),
2353
+ literal("full")
2354
+ ]))
2351
2355
  })),
2352
2356
  define: pipe(optional(record(string(), string())), description("Define global variables")),
2353
2357
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
@@ -2605,7 +2609,7 @@ function bindingifySourcemap(map) {
2605
2609
  //#endregion
2606
2610
  //#region src/utils/error.ts
2607
2611
  function normalizeErrors(rawErrors) {
2608
- const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(new Error(), {
2612
+ const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(/* @__PURE__ */ new Error(), {
2609
2613
  kind: e$1.kind,
2610
2614
  message: e$1.message,
2611
2615
  stack: void 0
@@ -2786,7 +2790,7 @@ function exclude(expr) {
2786
2790
  }
2787
2791
 
2788
2792
  //#endregion
2789
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
2793
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2790
2794
  function u$1(o$1, n$1, a$2) {
2791
2795
  let t$2 = (r$1) => o$1(r$1, ...n$1);
2792
2796
  return a$2 === void 0 ? t$2 : Object.assign(t$2, {
@@ -2796,7 +2800,7 @@ function u$1(o$1, n$1, a$2) {
2796
2800
  }
2797
2801
 
2798
2802
  //#endregion
2799
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
2803
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2800
2804
  function u(r$1, n$1, o$1) {
2801
2805
  let a$2 = r$1.length - n$1.length;
2802
2806
  if (a$2 === 0) return r$1(...n$1);
@@ -2805,7 +2809,7 @@ function u(r$1, n$1, o$1) {
2805
2809
  }
2806
2810
 
2807
2811
  //#endregion
2808
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
2812
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2809
2813
  function d(...r$1) {
2810
2814
  return u(i, r$1);
2811
2815
  }
@@ -2816,7 +2820,7 @@ var i = (r$1, t$2) => {
2816
2820
  };
2817
2821
 
2818
2822
  //#endregion
2819
- //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
2823
+ //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
2820
2824
  function t(...n$1) {
2821
2825
  return u(Object.keys, n$1);
2822
2826
  }
@@ -2978,7 +2982,7 @@ function bindingPluginOrder(order) {
2978
2982
  }
2979
2983
 
2980
2984
  //#endregion
2981
- //#region ../../node_modules/.pnpm/oxc-parser@0.72.3/node_modules/oxc-parser/wrap.mjs
2985
+ //#region ../../node_modules/.pnpm/oxc-parser@0.73.0/node_modules/oxc-parser/wrap.mjs
2982
2986
  function wrap$1(result) {
2983
2987
  let program, module$1, comments, errors;
2984
2988
  return {
@@ -3592,13 +3596,13 @@ var NormalizedOutputOptionsImpl = class {
3592
3596
  return this.normalizedOutputPlugins;
3593
3597
  }
3594
3598
  get preserveModules() {
3595
- return this.outputOptions.preserveModules || false;
3599
+ return this.inner.preserveModules;
3596
3600
  }
3597
3601
  get preserveModulesRoot() {
3598
- return this.outputOptions.preserveModulesRoot;
3602
+ return this.inner.preserveModulesRoot;
3599
3603
  }
3600
3604
  get virtualDirname() {
3601
- return this.outputOptions.virtualDirname || "_virtual";
3605
+ return this.inner.virtualDirname;
3602
3606
  }
3603
3607
  };
3604
3608
  function normalizeAddon(value) {
@@ -4253,7 +4257,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
4253
4257
  viteMode: inputOptions.experimental?.viteMode,
4254
4258
  resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
4255
4259
  hmr: bindingifyHmr(inputOptions.experimental?.hmr),
4256
- attachDebugInfo: inputOptions.experimental?.attachDebugInfo
4260
+ attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
4257
4261
  },
4258
4262
  profilerNames: inputOptions?.profilerNames,
4259
4263
  jsx,
@@ -4285,6 +4289,14 @@ function bindingifyHmr(hmr) {
4285
4289
  return hmr;
4286
4290
  }
4287
4291
  }
4292
+ function bindingifyAttachDebugInfo(attachDebugInfo) {
4293
+ switch (attachDebugInfo) {
4294
+ case void 0: return void 0;
4295
+ case "full": return BindingAttachDebugInfo.Full;
4296
+ case "simple": return BindingAttachDebugInfo.Simple;
4297
+ case "none": return BindingAttachDebugInfo.None;
4298
+ }
4299
+ }
4288
4300
  function bindingifyExternal(external) {
4289
4301
  if (external) {
4290
4302
  if (typeof external === "function") return (id$1, importer, isResolved) => {
@@ -4779,12 +4791,12 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4779
4791
  //#endregion
4780
4792
  //#region src/utils/create-bundler.ts
4781
4793
  let asyncRuntimeShutdown = false;
4782
- async function createBundler(inputOptions, outputOptions, isClose) {
4794
+ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
4783
4795
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4784
4796
  if (asyncRuntimeShutdown) startAsyncRuntime();
4785
4797
  try {
4786
4798
  return {
4787
- bundler: new Bundler(option.bundlerOptions),
4799
+ impl: bundler.createImpl(option.bundlerOptions),
4788
4800
  stopWorkers: option.stopWorkers,
4789
4801
  shutdown: () => {
4790
4802
  shutdownAsyncRuntime();
@@ -4815,46 +4827,49 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4815
4827
  var RolldownBuild = class {
4816
4828
  #inputOptions;
4817
4829
  #bundler;
4830
+ #bundlerImpl;
4818
4831
  constructor(inputOptions) {
4819
4832
  this.#inputOptions = inputOptions;
4833
+ this.#bundler = new BindingBundler();
4820
4834
  }
4821
4835
  get closed() {
4822
- return this.#bundler?.bundler.closed ?? false;
4836
+ return this.#bundlerImpl?.impl.closed ?? false;
4823
4837
  }
4824
4838
  async #getBundlerWithStopWorker(outputOptions, isClose) {
4825
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4826
- return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
4839
+ if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4840
+ return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
4827
4841
  }
4828
4842
  async generate(outputOptions = {}) {
4829
4843
  validateOption("output", outputOptions);
4830
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4831
- const output = await bundler.generate();
4844
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4845
+ const output = await impl.generate();
4832
4846
  return transformToRollupOutput(output);
4833
4847
  }
4834
4848
  async write(outputOptions = {}) {
4835
4849
  validateOption("output", outputOptions);
4836
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4837
- const output = await bundler.write();
4850
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4851
+ const output = await impl.write();
4838
4852
  return transformToRollupOutput(output);
4839
4853
  }
4840
4854
  async close() {
4841
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4855
+ const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4842
4856
  await stopWorkers?.();
4843
- await bundler.close();
4857
+ await impl.close();
4844
4858
  shutdown();
4845
4859
  }
4846
4860
  async [Symbol.asyncDispose]() {
4847
4861
  await this.close();
4848
4862
  }
4849
4863
  async generateHmrPatch(changedFiles) {
4850
- const output = await this.#bundler.bundler.generateHmrPatch(changedFiles);
4864
+ const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4851
4865
  return transformHmrPatchOutput(output);
4852
4866
  }
4853
4867
  async hmrInvalidate(file, firstInvalidatedBy) {
4854
- return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4868
+ const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4869
+ return transformHmrPatchOutput(output);
4855
4870
  }
4856
4871
  get watchFiles() {
4857
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4872
+ return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4858
4873
  }
4859
4874
  };
4860
4875
 
@@ -5022,4 +5037,4 @@ function defineConfig(config) {
5022
5037
  const VERSION = version;
5023
5038
 
5024
5039
  //#endregion
5025
- export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
5040
+ export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundlerImpl, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",
@@ -55,7 +55,8 @@
55
55
  "access": "public"
56
56
  },
57
57
  "dependencies": {
58
- "@napi-rs/wasm-runtime": "^0.2.10"
58
+ "@napi-rs/wasm-runtime": "^0.2.10",
59
+ "@oxc-project/runtime": "=0.73.0"
59
60
  },
60
61
  "scripts": {
61
62
  "build": "pnpm run build:debug",
@@ -1,30 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __commonJS = (cb, mod) => function() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
- key = keys[i];
17
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: ((k) => from[k]).bind(null, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
- value: mod,
26
- enumerable: true
27
- }) : target, mod));
28
-
29
- //#endregion
30
- export { __commonJS, __esm, __toESM };
@@ -1,153 +0,0 @@
1
- import { __esm } from "./chunk-DSsiIF1Z.mjs";
2
-
3
- //#region src/utils/misc.ts
4
- function arraify(value) {
5
- return Array.isArray(value) ? value : [value];
6
- }
7
- function isNullish(value) {
8
- return value === null || value === void 0;
9
- }
10
- function isPromiseLike(value) {
11
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
12
- }
13
- function unimplemented(info) {
14
- if (info) throw new Error(`unimplemented: ${info}`);
15
- throw new Error("unimplemented");
16
- }
17
- function unreachable(info) {
18
- if (info) throw new Error(`unreachable: ${info}`);
19
- throw new Error("unreachable");
20
- }
21
- function unsupported(info) {
22
- throw new Error(`UNSUPPORTED: ${info}`);
23
- }
24
- function noop(..._args) {}
25
- var init_misc = __esm({ "src/utils/misc.ts"() {} });
26
-
27
- //#endregion
28
- //#region ../pluginutils/dist/index.js
29
- function and(...args) {
30
- return new And(...args);
31
- }
32
- function or(...args) {
33
- return new Or(...args);
34
- }
35
- function not(expr) {
36
- return new Not(expr);
37
- }
38
- function id(pattern, params) {
39
- return new Id(pattern, params);
40
- }
41
- function moduleType(pattern) {
42
- return new ModuleType(pattern);
43
- }
44
- function code(pattern) {
45
- return new Code(pattern);
46
- }
47
- function query(key, pattern) {
48
- return new Query(key, pattern);
49
- }
50
- function include(expr) {
51
- return new Include(expr);
52
- }
53
- function exclude(expr) {
54
- return new Exclude(expr);
55
- }
56
- /**
57
- * convert a queryObject to FilterExpression like
58
- * ```js
59
- * and(query(k1, v1), query(k2, v2))
60
- * ```
61
- * @param queryFilterObject The query filter object needs to be matched.
62
- * @returns a `And` FilterExpression
63
- */
64
- function queries(queryFilter) {
65
- let arr = Object.entries(queryFilter).map(([key, value]) => {
66
- return new Query(key, value);
67
- });
68
- return and(...arr);
69
- }
70
- var And, Or, Not, Id, ModuleType, Code, Query, Include, Exclude;
71
- var init_dist = __esm({ "../pluginutils/dist/index.js"() {
72
- And = class {
73
- kind;
74
- args;
75
- constructor(...args) {
76
- if (args.length === 0) throw new Error("`And` expects at least one operand");
77
- this.args = args;
78
- this.kind = "and";
79
- }
80
- };
81
- Or = class {
82
- kind;
83
- args;
84
- constructor(...args) {
85
- if (args.length === 0) throw new Error("`Or` expects at least one operand");
86
- this.args = args;
87
- this.kind = "or";
88
- }
89
- };
90
- Not = class {
91
- kind;
92
- expr;
93
- constructor(expr) {
94
- this.expr = expr;
95
- this.kind = "not";
96
- }
97
- };
98
- Id = class {
99
- kind;
100
- pattern;
101
- params;
102
- constructor(pattern, params) {
103
- this.pattern = pattern;
104
- this.kind = "id";
105
- this.params = params ?? { cleanUrl: false };
106
- }
107
- };
108
- ModuleType = class {
109
- kind;
110
- pattern;
111
- constructor(pattern) {
112
- this.pattern = pattern;
113
- this.kind = "moduleType";
114
- }
115
- };
116
- Code = class {
117
- kind;
118
- pattern;
119
- constructor(expr) {
120
- this.pattern = expr;
121
- this.kind = "code";
122
- }
123
- };
124
- Query = class {
125
- kind;
126
- key;
127
- pattern;
128
- constructor(key, pattern) {
129
- this.pattern = pattern;
130
- this.key = key;
131
- this.kind = "query";
132
- }
133
- };
134
- Include = class {
135
- kind;
136
- expr;
137
- constructor(expr) {
138
- this.expr = expr;
139
- this.kind = "include";
140
- }
141
- };
142
- Exclude = class {
143
- kind;
144
- expr;
145
- constructor(expr) {
146
- this.expr = expr;
147
- this.kind = "exclude";
148
- }
149
- };
150
- } });
151
-
152
- //#endregion
153
- export { and, arraify, code, exclude, id, include, init_dist, init_misc, isNullish, isPromiseLike, moduleType, noop, not, or, queries, query, unimplemented, unreachable, unsupported };