@rolldown/browser 1.0.0-beta.16 → 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 (45) hide show
  1. package/dist/cli.cjs +3 -3
  2. package/dist/cli.mjs +1040 -1081
  3. package/dist/config.cjs +2 -2
  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.browser.mjs +3 -3
  8. package/dist/experimental-index.cjs +2 -2
  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/filter-index.d.cts +2 -2
  13. package/dist/filter-index.d.mts +2 -2
  14. package/dist/filter-index.mjs +1 -6
  15. package/dist/index.browser.mjs +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.mts +2 -2
  19. package/dist/index.mjs +3 -4
  20. package/dist/parallel-plugin-worker.cjs +1 -1
  21. package/dist/parallel-plugin-worker.mjs +27 -33
  22. package/dist/parallel-plugin.d.cts +2 -2
  23. package/dist/parallel-plugin.d.mts +2 -2
  24. package/dist/parse-ast-index.d.cts +1 -1
  25. package/dist/parse-ast-index.d.mts +1 -1
  26. package/dist/parse-ast-index.mjs +1 -2
  27. package/dist/rolldown-binding.wasi-browser.js +3 -2
  28. package/dist/rolldown-binding.wasi.cjs +2 -1
  29. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  30. package/dist/shared/{binding--Y47JZSL.d.cts → binding-CWvDTpOw.d.mts} +14 -14
  31. package/dist/shared/{binding-C_9au5Eg.d.mts → binding-um3VI33z.d.cts} +14 -14
  32. package/dist/shared/{define-config-CFPAmfEQ.d.mts → define-config-DETTMcOl.d.mts} +69 -9
  33. package/dist/shared/{define-config-CAyC9-af.d.cts → define-config-POPyhxOq.d.cts} +69 -9
  34. package/dist/shared/dist-BoWaIc-K.mjs +147 -0
  35. package/dist/shared/{load-config-CHic6lPj.mjs → load-config-C0FU-xTD.mjs} +14 -19
  36. package/dist/shared/{load-config-CKPqlbjH.cjs → load-config-Cp5Lu-qW.cjs} +1 -1
  37. package/dist/shared/{parse-ast-index-BjSB6ZTb.mjs → parse-ast-index-B5AmHtd5.mjs} +9 -27
  38. package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
  39. package/dist/shared/{src-C_ps7iS5.mjs → src-CsIMaM6C.mjs} +1143 -1367
  40. package/dist/shared/{src-Cw7MpyXh.cjs → src-D8KQ1KMN.cjs} +19 -17
  41. package/dist/{src-UXJBOke0.js → src-Bv_xHi2_.js} +19 -17
  42. package/package.json +3 -2
  43. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  44. package/dist/shared/dist-DeDsdiza.mjs +0 -153
  45. package/dist/shared/prompt-C14hEutp.mjs +0 -854
@@ -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.16";
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
@@ -4503,12 +4503,12 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4503
4503
  //#endregion
4504
4504
  //#region src/utils/create-bundler.ts
4505
4505
  let asyncRuntimeShutdown = false;
4506
- async function createBundler(inputOptions, outputOptions, isClose) {
4506
+ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
4507
4507
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4508
4508
  if (asyncRuntimeShutdown) (0, src_rolldown_binding_wasi_cjs.startAsyncRuntime)();
4509
4509
  try {
4510
4510
  return {
4511
- bundler: new src_rolldown_binding_wasi_cjs.Bundler(option.bundlerOptions),
4511
+ impl: bundler.createImpl(option.bundlerOptions),
4512
4512
  stopWorkers: option.stopWorkers,
4513
4513
  shutdown: () => {
4514
4514
  (0, src_rolldown_binding_wasi_cjs.shutdownAsyncRuntime)();
@@ -4539,47 +4539,49 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4539
4539
  var RolldownBuild = class {
4540
4540
  #inputOptions;
4541
4541
  #bundler;
4542
+ #bundlerImpl;
4542
4543
  constructor(inputOptions) {
4543
4544
  this.#inputOptions = inputOptions;
4545
+ this.#bundler = new src_rolldown_binding_wasi_cjs.BindingBundler();
4544
4546
  }
4545
4547
  get closed() {
4546
- return this.#bundler?.bundler.closed ?? false;
4548
+ return this.#bundlerImpl?.impl.closed ?? false;
4547
4549
  }
4548
4550
  async #getBundlerWithStopWorker(outputOptions, isClose) {
4549
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4550
- 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);
4551
4553
  }
4552
4554
  async generate(outputOptions = {}) {
4553
4555
  validateOption("output", outputOptions);
4554
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4555
- const output = await bundler.generate();
4556
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4557
+ const output = await impl.generate();
4556
4558
  return transformToRollupOutput(output);
4557
4559
  }
4558
4560
  async write(outputOptions = {}) {
4559
4561
  validateOption("output", outputOptions);
4560
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4561
- const output = await bundler.write();
4562
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4563
+ const output = await impl.write();
4562
4564
  return transformToRollupOutput(output);
4563
4565
  }
4564
4566
  async close() {
4565
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4567
+ const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4566
4568
  await stopWorkers?.();
4567
- await bundler.close();
4569
+ await impl.close();
4568
4570
  shutdown();
4569
4571
  }
4570
4572
  async [Symbol.asyncDispose]() {
4571
4573
  await this.close();
4572
4574
  }
4573
4575
  async generateHmrPatch(changedFiles) {
4574
- const output = await this.#bundler.bundler.generateHmrPatch(changedFiles);
4576
+ const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4575
4577
  return transformHmrPatchOutput(output);
4576
4578
  }
4577
4579
  async hmrInvalidate(file, firstInvalidatedBy) {
4578
- const output = await this.#bundler.bundler.hmrInvalidate(file, firstInvalidatedBy);
4580
+ const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4579
4581
  return transformHmrPatchOutput(output);
4580
4582
  }
4581
4583
  get watchFiles() {
4582
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4584
+ return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4583
4585
  }
4584
4586
  };
4585
4587
 
@@ -4807,10 +4809,10 @@ Object.defineProperty(exports, 'composeJsPlugins', {
4807
4809
  return composeJsPlugins;
4808
4810
  }
4809
4811
  });
4810
- Object.defineProperty(exports, 'createBundler', {
4812
+ Object.defineProperty(exports, 'createBundlerImpl', {
4811
4813
  enumerable: true,
4812
4814
  get: function () {
4813
- return createBundler;
4815
+ return createBundlerImpl;
4814
4816
  }
4815
4817
  });
4816
4818
  Object.defineProperty(exports, 'defineConfig', {
@@ -1,4 +1,4 @@
1
- import { BindingAttachDebugInfo, 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.16";
30
+ var version = "1.0.0-beta.17";
31
31
 
32
32
  //#endregion
33
33
  //#region src/builtin-plugin/utils.ts
@@ -4791,12 +4791,12 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4791
4791
  //#endregion
4792
4792
  //#region src/utils/create-bundler.ts
4793
4793
  let asyncRuntimeShutdown = false;
4794
- async function createBundler(inputOptions, outputOptions, isClose) {
4794
+ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
4795
4795
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4796
4796
  if (asyncRuntimeShutdown) startAsyncRuntime();
4797
4797
  try {
4798
4798
  return {
4799
- bundler: new Bundler(option.bundlerOptions),
4799
+ impl: bundler.createImpl(option.bundlerOptions),
4800
4800
  stopWorkers: option.stopWorkers,
4801
4801
  shutdown: () => {
4802
4802
  shutdownAsyncRuntime();
@@ -4827,47 +4827,49 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4827
4827
  var RolldownBuild = class {
4828
4828
  #inputOptions;
4829
4829
  #bundler;
4830
+ #bundlerImpl;
4830
4831
  constructor(inputOptions) {
4831
4832
  this.#inputOptions = inputOptions;
4833
+ this.#bundler = new BindingBundler();
4832
4834
  }
4833
4835
  get closed() {
4834
- return this.#bundler?.bundler.closed ?? false;
4836
+ return this.#bundlerImpl?.impl.closed ?? false;
4835
4837
  }
4836
4838
  async #getBundlerWithStopWorker(outputOptions, isClose) {
4837
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4838
- 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);
4839
4841
  }
4840
4842
  async generate(outputOptions = {}) {
4841
4843
  validateOption("output", outputOptions);
4842
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4843
- const output = await bundler.generate();
4844
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4845
+ const output = await impl.generate();
4844
4846
  return transformToRollupOutput(output);
4845
4847
  }
4846
4848
  async write(outputOptions = {}) {
4847
4849
  validateOption("output", outputOptions);
4848
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4849
- const output = await bundler.write();
4850
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4851
+ const output = await impl.write();
4850
4852
  return transformToRollupOutput(output);
4851
4853
  }
4852
4854
  async close() {
4853
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4855
+ const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4854
4856
  await stopWorkers?.();
4855
- await bundler.close();
4857
+ await impl.close();
4856
4858
  shutdown();
4857
4859
  }
4858
4860
  async [Symbol.asyncDispose]() {
4859
4861
  await this.close();
4860
4862
  }
4861
4863
  async generateHmrPatch(changedFiles) {
4862
- const output = await this.#bundler.bundler.generateHmrPatch(changedFiles);
4864
+ const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4863
4865
  return transformHmrPatchOutput(output);
4864
4866
  }
4865
4867
  async hmrInvalidate(file, firstInvalidatedBy) {
4866
- const output = await this.#bundler.bundler.hmrInvalidate(file, firstInvalidatedBy);
4868
+ const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4867
4869
  return transformHmrPatchOutput(output);
4868
4870
  }
4869
4871
  get watchFiles() {
4870
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4872
+ return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4871
4873
  }
4872
4874
  };
4873
4875
 
@@ -5035,4 +5037,4 @@ function defineConfig(config) {
5035
5037
  const VERSION = version;
5036
5038
 
5037
5039
  //#endregion
5038
- 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.16",
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 };