@rolldown/browser 1.0.0-beta.45 → 1.0.0-beta.46

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.
@@ -1,6 +1,7 @@
1
- import { createTokioRuntime } from "./rolldown-binding.wasi.cjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-BeWSOIj5.mjs";
2
2
 
3
3
  //#region src/cli/setup-index.ts
4
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4
5
  let isWatchMode = false;
5
6
  for (let i = 0; i < process.argv.length; i++) {
6
7
  const arg = process.argv[i];
@@ -9,8 +10,8 @@ for (let i = 0; i < process.argv.length; i++) {
9
10
  break;
10
11
  }
11
12
  }
12
- if (isWatchMode) createTokioRuntime(32);
13
- else createTokioRuntime(4);
13
+ if (isWatchMode) (0, import_binding.createTokioRuntime)(32);
14
+ else (0, import_binding.createTokioRuntime)(4);
14
15
 
15
16
  //#endregion
16
17
  export { };
package/dist/cli.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { C as version, S as description, _ as getOutputCliKeys, g as getInputCliKeys, h as getCliSchemaInfo, i as watch, o as rolldown, v as validateCliOptions, w as onExit } from "./shared/src-B4ZmdjD5.mjs";
2
- import { h as styleText$1 } from "./shared/parse-ast-index-Ck5SwMSC.mjs";
3
- import { d as arraify } from "./shared/composable-filters-D_PY7Qa7.mjs";
4
- import { t as loadConfig } from "./shared/load-config-Z2MWPLZO.mjs";
1
+ import "./shared/binding-BeWSOIj5.mjs";
2
+ import { C as version, S as description, _ as getOutputCliKeys, g as getInputCliKeys, h as getCliSchemaInfo, i as watch, o as rolldown, v as validateCliOptions, w as onExit } from "./shared/src-B8saaB3b.mjs";
3
+ import { h as styleText$1 } from "./shared/parse-ast-index-DMI5m8Lk.mjs";
4
+ import { d as arraify } from "./shared/composable-filters-CgRsnfr3.mjs";
5
+ import { t as loadConfig } from "./shared/load-config-DnUAKl9P.mjs";
5
6
  import { formatWithOptions, parseArgs } from "node:util";
6
7
  import path, { sep } from "node:path";
7
8
  import process$1 from "node:process";
@@ -946,7 +947,7 @@ function createConsola(options$1 = {}) {
946
947
  defaults: { level },
947
948
  stdout: process.stdout,
948
949
  stderr: process.stderr,
949
- prompt: (...args) => import("./shared/prompt-BDwA3jSr.mjs").then((m) => m.prompt(...args)),
950
+ prompt: (...args) => import("./shared/prompt-YGfbLmz5.mjs").then((m) => m.prompt(...args)),
950
951
  reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
951
952
  ...options$1
952
953
  });
@@ -1222,7 +1223,7 @@ function getClearScreenFunction(options$1) {
1222
1223
  }
1223
1224
 
1224
1225
  //#endregion
1225
- //#region \0@oxc-project+runtime@0.95.0/helpers/usingCtx.js
1226
+ //#region \0@oxc-project+runtime@0.96.0/helpers/usingCtx.js
1226
1227
  function _usingCtx() {
1227
1228
  var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
1228
1229
  var n$2 = Error();
package/dist/config.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as ConfigExport, t as defineConfig } from "./shared/define-config-C6-goOPh.mjs";
2
- import "./shared/binding-DRegrFdE.mjs";
1
+ import { n as ConfigExport, t as defineConfig } from "./shared/define-config-Bj-neIhz.mjs";
2
+ import "./shared/binding-CCMrV5an.mjs";
3
3
 
4
4
  //#region src/utils/load-config.d.ts
5
5
  declare function loadConfig(configPath: string): Promise<ConfigExport>;
package/dist/config.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { C as version, r as defineConfig } from "./shared/src-B4ZmdjD5.mjs";
2
- import "./shared/parse-ast-index-Ck5SwMSC.mjs";
3
- import "./shared/composable-filters-D_PY7Qa7.mjs";
4
- import { t as loadConfig } from "./shared/load-config-Z2MWPLZO.mjs";
1
+ import "./shared/binding-BeWSOIj5.mjs";
2
+ import { C as version, r as defineConfig } from "./shared/src-B8saaB3b.mjs";
3
+ import "./shared/parse-ast-index-DMI5m8Lk.mjs";
4
+ import "./shared/composable-filters-CgRsnfr3.mjs";
5
+ import { t as loadConfig } from "./shared/load-config-DnUAKl9P.mjs";
5
6
 
6
7
  //#region src/config.ts
7
8
  const VERSION = version;
@@ -1,7 +1,7 @@
1
- import { c as createBundlerOptions, d as transformToRollupOutput, f as bindingifySourcemap, h as makeBuiltinPluginCallable, l as normalizedStringOrRegex, m as BuiltinPlugin, p as PluginDriver, s as RolldownBuild, u as normalizeBindingResult } from "./src-CLWy1Uip.js";
2
- import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
1
+ import { _ as __toESM, c as createBundlerOptions, d as transformToRollupOutput, f as bindingifySourcemap, g as require_binding, h as makeBuiltinPluginCallable, l as normalizedStringOrRegex, m as BuiltinPlugin, p as PluginDriver, s as RolldownBuild, u as normalizeBindingResult } from "./src-B-7Hrt6w.js";
3
2
 
4
3
  //#region src/api/dev/dev-engine.ts
4
+ var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
5
5
  var DevEngine = class DevEngine {
6
6
  #inner;
7
7
  #cachedBuildFinishPromise = null;
@@ -32,7 +32,7 @@ var DevEngine = class DevEngine {
32
32
  }
33
33
  userOnOutput(transformToRollupOutput(result));
34
34
  } : void 0,
35
- rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
35
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding$1.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding$1.BindingRebuildStrategy.Auto : import_binding$1.BindingRebuildStrategy.Never : void 0,
36
36
  watch: devOptions.watch && {
37
37
  skipWrite: devOptions.watch.skipWrite,
38
38
  usePolling: devOptions.watch.usePolling,
@@ -43,7 +43,7 @@ var DevEngine = class DevEngine {
43
43
  debounceTickRate: devOptions.watch.debounceTickRate
44
44
  }
45
45
  };
46
- return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
46
+ return new DevEngine(new import_binding$1.BindingDevEngine(options.bundlerOptions, bindingDevOptions));
47
47
  }
48
48
  constructor(inner) {
49
49
  this.#inner = inner;
@@ -83,6 +83,47 @@ var DevEngine = class DevEngine {
83
83
  //#region src/api/dev/index.ts
84
84
  const dev = (...args) => DevEngine.create(...args);
85
85
 
86
+ //#endregion
87
+ //#region src/types/external-memory-handle.ts
88
+ const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
89
+ /**
90
+ * Frees the external memory held by the given handle.
91
+ *
92
+ * This is useful when you want to manually release memory held by Rust objects
93
+ * (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
94
+ *
95
+ * @param handle - The object with external memory to free
96
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
97
+ * This will take time to copy data from Rust to JavaScript, but prevents errors
98
+ * when accessing properties after the memory is freed.
99
+ * @returns Status object with `freed` boolean and optional `reason` string.
100
+ * - `{ freed: true }` if memory was successfully freed
101
+ * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * import { freeExternalMemory } from 'rolldown/experimental';
106
+ *
107
+ * const output = await bundle.generate();
108
+ * const chunk = output.output[0];
109
+ *
110
+ * // Use the chunk...
111
+ *
112
+ * // Manually free the memory (fast, but accessing properties after will throw)
113
+ * const status = freeExternalMemory(chunk); // { freed: true }
114
+ * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
115
+ *
116
+ * // Keep data alive before freeing (slower, but data remains accessible)
117
+ * freeExternalMemory(chunk, true); // Evaluates all lazy fields first
118
+ * console.log(chunk.code); // OK - data was copied to JavaScript before freeing
119
+ *
120
+ * // Without keepDataAlive, accessing chunk properties after freeing will throw an error
121
+ * ```
122
+ */
123
+ function freeExternalMemory(handle, keepDataAlive = false) {
124
+ return handle[symbolForExternalMemoryHandle](keepDataAlive);
125
+ }
126
+
86
127
  //#endregion
87
128
  //#region src/api/experimental.ts
88
129
  /**
@@ -208,10 +249,10 @@ function replacePlugin(values = {}, options = {}) {
208
249
  const value = values[key];
209
250
  if (typeof value !== "string") values[key] = String(value);
210
251
  });
211
- return new BuiltinPlugin("builtin:replace", {
252
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:replace", {
212
253
  ...options,
213
254
  values
214
- });
255
+ }));
215
256
  }
216
257
 
217
258
  //#endregion
@@ -243,4 +284,13 @@ function viteCSSPlugin(config) {
243
284
  }
244
285
 
245
286
  //#endregion
246
- export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
287
+ //#region src/experimental-index.ts
288
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
289
+
290
+ //#endregion
291
+ var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
292
+ var ResolverFactory = import_binding.ResolverFactory;
293
+ var isolatedDeclaration = import_binding.isolatedDeclaration;
294
+ var moduleRunnerTransform = import_binding.moduleRunnerTransform;
295
+ var transform = import_binding.transform;
296
+ export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, freeExternalMemory, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,5 +1,5 @@
1
- import { A as BuiltinPlugin, N as SourceMapInput, U as defineParallelPlugin, bt as OutputOptions, kt as RolldownOutput, o as InputOptions, wt as StringOrRegExp } from "./shared/define-config-C6-goOPh.mjs";
2
- import { A as IsolatedDeclarationsResult, B as TransformResult, C as BindingViteCssPluginConfig, D as BindingWasmHelperPluginConfig, E as BindingViteResolvePluginConfig, H as moduleRunnerTransform, L as ResolveResult, N as NapiResolveOptions, R as ResolverFactory, S as BindingUrlResolver, T as BindingViteHtmlPluginConfig, U as transform, V as isolatedDeclaration, a as BindingClientHmrUpdate, d as BindingJsonPluginConfig, g as BindingRebuildStrategy, h as BindingReactRefreshWrapperPluginConfig, k as IsolatedDeclarationsOptions, l as BindingImportGlobPluginConfig, m as BindingModulePreloadPolyfillPluginConfig, n as BindingBuildImportAnalysisPluginConfig, o as BindingDynamicImportVarsPluginConfig, p as BindingManifestPluginConfig, s as BindingEsmExternalRequirePluginConfig, t as BindingAssetPluginConfig, u as BindingIsolatedDeclarationPluginConfig, v as BindingReplacePluginConfig, w as BindingViteCssPostPluginConfig, x as BindingTransformPluginConfig, y as BindingReporterPluginConfig, z as TransformOptions } from "./shared/binding-DRegrFdE.mjs";
1
+ import { A as BuiltinPlugin, N as SourceMapInput, U as defineParallelPlugin, bt as OutputOptions, jt as freeExternalMemory, kt as RolldownOutput, o as InputOptions, wt as StringOrRegExp } from "./shared/define-config-Bj-neIhz.mjs";
2
+ import { A as IsolatedDeclarationsOptions, B as TransformOptions, C as BindingViteCssPluginConfig, D as BindingWasmHelperPluginConfig, E as BindingViteResolvePluginConfig, H as isolatedDeclaration, P as NapiResolveOptions, R as ResolveResult, S as BindingUrlResolver, T as BindingViteHtmlPluginConfig, U as moduleRunnerTransform, V as TransformResult, W as transform, a as BindingClientHmrUpdate, d as BindingJsonPluginConfig, g as BindingRebuildStrategy, h as BindingReactRefreshWrapperPluginConfig, j as IsolatedDeclarationsResult, l as BindingImportGlobPluginConfig, m as BindingModulePreloadPolyfillPluginConfig, n as BindingBuildImportAnalysisPluginConfig, o as BindingDynamicImportVarsPluginConfig, p as BindingManifestPluginConfig, s as BindingEsmExternalRequirePluginConfig, t as BindingAssetPluginConfig, u as BindingIsolatedDeclarationPluginConfig, v as BindingReplacePluginConfig, w as BindingViteCssPostPluginConfig, x as BindingTransformPluginConfig, y as BindingReporterPluginConfig, z as ResolverFactory } from "./shared/binding-CCMrV5an.mjs";
3
3
 
4
4
  //#region src/api/dev/dev-options.d.ts
5
5
  type DevOnHmrUpdates = (result: Error | {
@@ -173,4 +173,4 @@ type ViteCssPluginConfig = Omit<BindingViteCssPluginConfig, "compileCSS"> & {
173
173
  };
174
174
  declare function viteCSSPlugin(config?: ViteCssPluginConfig): BuiltinPlugin;
175
175
  //#endregion
176
- export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
176
+ export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, freeExternalMemory, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,10 +1,11 @@
1
- import { b as BuiltinPlugin, c as createBundlerOptions, f as normalizeBindingResult, l as normalizedStringOrRegex, m as bindingifySourcemap, p as transformToRollupOutput, s as RolldownBuild, x as makeBuiltinPluginCallable, y as PluginDriver } from "./shared/src-B4ZmdjD5.mjs";
2
- import "./shared/parse-ast-index-Ck5SwMSC.mjs";
3
- import "./shared/composable-filters-D_PY7Qa7.mjs";
4
- import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-BeWSOIj5.mjs";
2
+ import { b as BuiltinPlugin, c as createBundlerOptions, f as normalizeBindingResult, l as normalizedStringOrRegex, m as bindingifySourcemap, p as transformToRollupOutput, s as RolldownBuild, x as makeBuiltinPluginCallable, y as PluginDriver } from "./shared/src-B8saaB3b.mjs";
3
+ import "./shared/parse-ast-index-DMI5m8Lk.mjs";
4
+ import "./shared/composable-filters-CgRsnfr3.mjs";
5
5
  import { pathToFileURL } from "node:url";
6
6
 
7
7
  //#region src/api/dev/dev-engine.ts
8
+ var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
8
9
  var DevEngine = class DevEngine {
9
10
  #inner;
10
11
  #cachedBuildFinishPromise = null;
@@ -35,7 +36,7 @@ var DevEngine = class DevEngine {
35
36
  }
36
37
  userOnOutput(transformToRollupOutput(result));
37
38
  } : void 0,
38
- rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
39
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding$1.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding$1.BindingRebuildStrategy.Auto : import_binding$1.BindingRebuildStrategy.Never : void 0,
39
40
  watch: devOptions.watch && {
40
41
  skipWrite: devOptions.watch.skipWrite,
41
42
  usePolling: devOptions.watch.usePolling,
@@ -46,7 +47,7 @@ var DevEngine = class DevEngine {
46
47
  debounceTickRate: devOptions.watch.debounceTickRate
47
48
  }
48
49
  };
49
- return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
50
+ return new DevEngine(new import_binding$1.BindingDevEngine(options.bundlerOptions, bindingDevOptions));
50
51
  }
51
52
  constructor(inner) {
52
53
  this.#inner = inner;
@@ -86,6 +87,47 @@ var DevEngine = class DevEngine {
86
87
  //#region src/api/dev/index.ts
87
88
  const dev = (...args) => DevEngine.create(...args);
88
89
 
90
+ //#endregion
91
+ //#region src/types/external-memory-handle.ts
92
+ const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
93
+ /**
94
+ * Frees the external memory held by the given handle.
95
+ *
96
+ * This is useful when you want to manually release memory held by Rust objects
97
+ * (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
98
+ *
99
+ * @param handle - The object with external memory to free
100
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
101
+ * This will take time to copy data from Rust to JavaScript, but prevents errors
102
+ * when accessing properties after the memory is freed.
103
+ * @returns Status object with `freed` boolean and optional `reason` string.
104
+ * - `{ freed: true }` if memory was successfully freed
105
+ * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * import { freeExternalMemory } from 'rolldown/experimental';
110
+ *
111
+ * const output = await bundle.generate();
112
+ * const chunk = output.output[0];
113
+ *
114
+ * // Use the chunk...
115
+ *
116
+ * // Manually free the memory (fast, but accessing properties after will throw)
117
+ * const status = freeExternalMemory(chunk); // { freed: true }
118
+ * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
119
+ *
120
+ * // Keep data alive before freeing (slower, but data remains accessible)
121
+ * freeExternalMemory(chunk, true); // Evaluates all lazy fields first
122
+ * console.log(chunk.code); // OK - data was copied to JavaScript before freeing
123
+ *
124
+ * // Without keepDataAlive, accessing chunk properties after freeing will throw an error
125
+ * ```
126
+ */
127
+ function freeExternalMemory(handle, keepDataAlive = false) {
128
+ return handle[symbolForExternalMemoryHandle](keepDataAlive);
129
+ }
130
+
89
131
  //#endregion
90
132
  //#region src/api/experimental.ts
91
133
  /**
@@ -216,10 +258,10 @@ function replacePlugin(values = {}, options = {}) {
216
258
  const value = values[key];
217
259
  if (typeof value !== "string") values[key] = String(value);
218
260
  });
219
- return new BuiltinPlugin("builtin:replace", {
261
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:replace", {
220
262
  ...options,
221
263
  values
222
- });
264
+ }));
223
265
  }
224
266
 
225
267
  //#endregion
@@ -251,4 +293,13 @@ function viteCSSPlugin(config) {
251
293
  }
252
294
 
253
295
  //#endregion
254
- export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
296
+ //#region src/experimental-index.ts
297
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
298
+
299
+ //#endregion
300
+ var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
301
+ var ResolverFactory = import_binding.ResolverFactory;
302
+ var isolatedDeclaration = import_binding.isolatedDeclaration;
303
+ var moduleRunnerTransform = import_binding.moduleRunnerTransform;
304
+ var transform = import_binding.transform;
305
+ export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, freeExternalMemory, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,9 +1,13 @@
1
+ /**
2
+ * @typedef {{ type: 'hmr:module-registered', modules: string[] }} DevRuntimeMessage
3
+ * @typedef {{ send(message: DevRuntimeMessage): void }} Messenger
4
+ */
1
5
  export class DevRuntime {
2
6
  /**
3
- * @param {WebSocket} socket
7
+ * @param {Messenger} messenger
4
8
  */
5
- constructor(socket: WebSocket);
6
- socket: WebSocket;
9
+ constructor(messenger: Messenger);
10
+ messenger: Messenger;
7
11
  /**
8
12
  * @type {Record<string, Module>}
9
13
  */
@@ -13,9 +17,9 @@ export class DevRuntime {
13
17
  */
14
18
  createModuleHotContext(_moduleId: string): void;
15
19
  /**
16
- * @param {string[]} _boundaries
20
+ * @param {[string, string][]} _boundaries
17
21
  */
18
- applyUpdates(_boundaries: string[]): void;
22
+ applyUpdates(_boundaries: [string, string][]): void;
19
23
  /**
20
24
  * @param {string} id
21
25
  * @param {{ exports: any }} exportsHolder
@@ -57,6 +61,13 @@ export class DevRuntime {
57
61
  __reExport: any;
58
62
  sendModuleRegisteredMessage: (module: string) => void;
59
63
  }
64
+ export type DevRuntimeMessage = {
65
+ type: "hmr:module-registered";
66
+ modules: string[];
67
+ };
68
+ export type Messenger = {
69
+ send(message: DevRuntimeMessage): void;
70
+ };
60
71
  declare class Module {
61
72
  /**
62
73
  * @param {string} id
@@ -1,4 +1,4 @@
1
- import { k as withFilter } from "./shared/define-config-C6-goOPh.mjs";
2
- import "./shared/binding-DRegrFdE.mjs";
1
+ import { k as withFilter } from "./shared/define-config-Bj-neIhz.mjs";
2
+ import "./shared/binding-CCMrV5an.mjs";
3
3
  import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
4
4
  export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
@@ -1,4 +1,4 @@
1
- import { a as include, c as or, d as arraify, f as isPromiseLike, i as id, l as queries, n as code, o as moduleType, r as exclude, s as not, t as and, u as query } from "./shared/composable-filters-D_PY7Qa7.mjs";
1
+ import { a as include, c as or, d as arraify, f as isPromiseLike, i as id, l as queries, n as code, o as moduleType, r as exclude, s as not, t as and, u as query } from "./shared/composable-filters-CgRsnfr3.mjs";
2
2
 
3
3
  //#region src/plugin/with-filter.ts
4
4
  function withFilterImpl(pluginOption, filterObjectList) {
@@ -1,3 +1,4 @@
1
- import { a as build, i as watch, n as VERSION, o as rolldown, r as defineConfig, t as BindingMagicString } from "./src-CLWy1Uip.js";
1
+ import { a as build, i as watch, n as import_binding, o as rolldown, r as defineConfig, t as VERSION } from "./src-B-7Hrt6w.js";
2
2
 
3
+ var BindingMagicString = import_binding.BindingMagicString;
3
4
  export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as InternalModuleFormat, At as SourceMap, B as GetModuleInfo, C as ResolveIdResult, Ct as PartialNull, D as SourceDescription, Dt as RenderedChunk, E as RolldownPluginOption, Et as OutputChunk, F as OutputBundle, Ft as LogOrStringHandler, G as PluginContextMeta, H as DefineParallelPluginResult, I as TreeshakingOptions, It as RollupError, J as ModuleTypeFilter, K as GeneralHookFilter, L as TransformPluginContext, Lt as RollupLog, M as ExistingRawSourceMap, Mt as SourcemapIgnoreListOption, N as SourceMapInput, Nt as LogLevel, O as TransformResult, Ot as RenderedModule, P as RolldownOptionsFunction, Pt as LogLevelOption, Q as RolldownFsModule, R as EmittedAsset, Rt as RollupLogWithString, S as ResolveIdExtraOptions, T as RolldownPlugin, Tt as OutputAsset, V as PluginContext, W as MinimalPluginContext, X as RolldownDirectoryEntry, Y as BufferEncoding, Z as RolldownFileStats, _ as ModuleType, _t as GlobalsFunction, a as InputOption, at as RolldownWatcher, b as PartialResolvedId, bt as OutputOptions, c as OptimizationOptions, ct as rolldown, d as CustomPluginOptions, dt as build, et as NormalizedOutputOptions, f as FunctionPluginHooks, ft as AddonFunction, g as ModuleOptions, gt as GeneratedCodePreset, h as LoadResult, ht as GeneratedCodeOptions, i as ExternalOption, it as watch, j as VERSION, jt as ModuleInfo, kt as RolldownOutput, l as WatcherOptions, lt as RolldownBuild, m as ImportKind, mt as ChunkingContext, n as ConfigExport, nt as LoggingFunction, o as InputOptions, ot as RolldownWatcherEvent, p as HookFilterExtension, pt as ChunkFileNamesFunction, q as HookFilter, r as RolldownOptions, rt as WarningHandlerWithDefault, s as ModuleTypes, st as WatchOptions, t as defineConfig, tt as NormalizedInputOptions, u as AsyncPluginHooks, ut as BuildOptions, v as ObjectHook, vt as MinifyOptions, w as ResolvedId, x as Plugin, xt as PreRenderedAsset, y as ParallelPluginHooks, yt as ModuleFormat, z as EmittedFile } from "./shared/define-config-C6-goOPh.mjs";
2
- import { I as PreRenderedChunk, f as BindingMagicString } from "./shared/binding-DRegrFdE.mjs";
1
+ import { $ as InternalModuleFormat, At as SourceMap, B as GetModuleInfo, C as ResolveIdResult, Ct as PartialNull, D as SourceDescription, Dt as RenderedChunk, E as RolldownPluginOption, Et as OutputChunk, F as OutputBundle, Ft as LogLevelOption, G as PluginContextMeta, H as DefineParallelPluginResult, I as TreeshakingOptions, It as LogOrStringHandler, J as ModuleTypeFilter, K as GeneralHookFilter, L as TransformPluginContext, Lt as RollupError, M as ExistingRawSourceMap, Mt as ModuleInfo, N as SourceMapInput, Nt as SourcemapIgnoreListOption, O as TransformResult, Ot as RenderedModule, P as RolldownOptionsFunction, Pt as LogLevel, Q as RolldownFsModule, R as EmittedAsset, Rt as RollupLog, S as ResolveIdExtraOptions, T as RolldownPlugin, Tt as OutputAsset, V as PluginContext, W as MinimalPluginContext, X as RolldownDirectoryEntry, Y as BufferEncoding, Z as RolldownFileStats, _ as ModuleType, _t as GlobalsFunction, a as InputOption, at as RolldownWatcher, b as PartialResolvedId, bt as OutputOptions, c as OptimizationOptions, ct as rolldown, d as CustomPluginOptions, dt as build, et as NormalizedOutputOptions, f as FunctionPluginHooks, ft as AddonFunction, g as ModuleOptions, gt as GeneratedCodePreset, h as LoadResult, ht as GeneratedCodeOptions, i as ExternalOption, it as watch, j as VERSION, kt as RolldownOutput, l as WatcherOptions, lt as RolldownBuild, m as ImportKind, mt as ChunkingContext, n as ConfigExport, nt as LoggingFunction, o as InputOptions, ot as RolldownWatcherEvent, p as HookFilterExtension, pt as ChunkFileNamesFunction, q as HookFilter, r as RolldownOptions, rt as WarningHandlerWithDefault, s as ModuleTypes, st as WatchOptions, t as defineConfig, tt as NormalizedInputOptions, u as AsyncPluginHooks, ut as BuildOptions, v as ObjectHook, vt as MinifyOptions, w as ResolvedId, x as Plugin, xt as PreRenderedAsset, y as ParallelPluginHooks, yt as ModuleFormat, z as EmittedFile, zt as RollupLogWithString } from "./shared/define-config-Bj-neIhz.mjs";
2
+ import { L as PreRenderedChunk, f as BindingMagicString } from "./shared/binding-CCMrV5an.mjs";
3
3
  export { AddonFunction, AsyncPluginHooks, BindingMagicString, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
package/dist/index.mjs CHANGED
@@ -1,5 +1,7 @@
1
- import { a as build, i as watch, n as VERSION, o as rolldown, r as defineConfig, t as BindingMagicString } from "./shared/src-B4ZmdjD5.mjs";
2
- import "./shared/parse-ast-index-Ck5SwMSC.mjs";
3
- import "./shared/composable-filters-D_PY7Qa7.mjs";
1
+ import "./shared/binding-BeWSOIj5.mjs";
2
+ import { a as build, i as watch, n as import_binding, o as rolldown, r as defineConfig, t as VERSION } from "./shared/src-B8saaB3b.mjs";
3
+ import "./shared/parse-ast-index-DMI5m8Lk.mjs";
4
+ import "./shared/composable-filters-CgRsnfr3.mjs";
4
5
 
6
+ var BindingMagicString = import_binding.BindingMagicString;
5
7
  export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
@@ -1,14 +1,15 @@
1
- import { d as bindingifyPlugin, u as PluginContextData } from "./shared/src-B4ZmdjD5.mjs";
2
- import "./shared/parse-ast-index-Ck5SwMSC.mjs";
3
- import "./shared/composable-filters-D_PY7Qa7.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-BeWSOIj5.mjs";
2
+ import { d as bindingifyPlugin, u as PluginContextData } from "./shared/src-B8saaB3b.mjs";
3
+ import "./shared/parse-ast-index-DMI5m8Lk.mjs";
4
+ import "./shared/composable-filters-CgRsnfr3.mjs";
4
5
  import { parentPort, workerData } from "node:worker_threads";
5
- import { registerPlugins } from "./rolldown-binding.wasi.cjs";
6
6
 
7
7
  //#region src/parallel-plugin-worker.ts
8
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
8
9
  const { registryId, pluginInfos, threadNumber } = workerData;
9
10
  (async () => {
10
11
  try {
11
- registerPlugins(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
12
+ (0, import_binding.registerPlugins)(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
12
13
  const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
13
14
  const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
14
15
  return {
@@ -1,5 +1,5 @@
1
- import { St as MaybePromise, x as Plugin } from "./shared/define-config-C6-goOPh.mjs";
2
- import "./shared/binding-DRegrFdE.mjs";
1
+ import { St as MaybePromise, x as Plugin } from "./shared/define-config-Bj-neIhz.mjs";
2
+ import "./shared/binding-CCMrV5an.mjs";
3
3
 
4
4
  //#region src/plugin/parallel-plugin-implementation.d.ts
5
5
  type ParallelPluginImplementation = Plugin;
@@ -1,4 +1,4 @@
1
- import { F as ParserOptions, P as ParseResult } from "./shared/binding-DRegrFdE.mjs";
1
+ import { F as ParseResult, I as ParserOptions } from "./shared/binding-CCMrV5an.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
 
4
4
  //#region src/parse-ast-index.d.ts
@@ -1,3 +1,4 @@
1
- import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-Ck5SwMSC.mjs";
1
+ import "./shared/binding-BeWSOIj5.mjs";
2
+ import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-DMI5m8Lk.mjs";
2
3
 
3
4
  export { parseAst, parseAstAsync };