@rolldown/browser 1.0.0-beta.9-commit.0ec9e7d → 1.0.0-rc.10

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 (82) hide show
  1. package/dist/cli.mjs +961 -1551
  2. package/dist/config.d.mts +9 -6
  3. package/dist/config.mjs +9 -11
  4. package/dist/constructors-DsfxKD6A.js +68 -0
  5. package/dist/error-BeZaDkS8.js +157 -0
  6. package/dist/experimental-index.browser.mjs +278 -44
  7. package/dist/experimental-index.d.mts +228 -68
  8. package/dist/experimental-index.mjs +274 -55
  9. package/dist/experimental-runtime-types.d.ts +98 -0
  10. package/dist/filter-index.d.mts +104 -2
  11. package/dist/filter-index.mjs +144 -5
  12. package/dist/get-log-filter.d.mts +3 -0
  13. package/dist/get-log-filter.mjs +68 -0
  14. package/dist/index.browser.mjs +238 -3
  15. package/dist/index.d.mts +4 -3
  16. package/dist/index.mjs +53 -6
  17. package/dist/{shared/parse-ast-index-BHaE0ECV.cjs → normalize-string-or-regex-TtAGUp42.js} +74 -147
  18. package/dist/parallel-plugin-worker.mjs +27 -35
  19. package/dist/parallel-plugin.d.mts +7 -7
  20. package/dist/parallel-plugin.mjs +1 -2
  21. package/dist/parse-ast-index.d.mts +28 -5
  22. package/dist/parse-ast-index.mjs +60 -4
  23. package/dist/plugins-index.browser.mjs +40 -0
  24. package/dist/plugins-index.d.mts +33 -0
  25. package/dist/plugins-index.mjs +40 -0
  26. package/dist/resolve-tsconfig-DThkUPSZ.js +112 -0
  27. package/dist/rolldown-binding.wasi-browser.js +46 -24
  28. package/dist/rolldown-binding.wasi.cjs +67 -24
  29. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  30. package/dist/rolldown-build-Chx5S-TB.js +5349 -0
  31. package/dist/shared/bindingify-input-options-Czbczr8Z.mjs +2168 -0
  32. package/dist/shared/composable-filters-B2ByPP8y.mjs +224 -0
  33. package/dist/shared/constructors-BVnf_fH1.d.mts +37 -0
  34. package/dist/shared/constructors-CemeNi29.mjs +68 -0
  35. package/dist/shared/define-config-DJOr6Iwt.mjs +6 -0
  36. package/dist/shared/define-config-i6TWE2hm.d.mts +3855 -0
  37. package/dist/shared/error-CQ6njWsV.mjs +86 -0
  38. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  39. package/dist/shared/{load-config-D7UduHRZ.mjs → load-config-CxvL5JxT.mjs} +32 -36
  40. package/dist/shared/logging-C6h4g8dA.d.mts +50 -0
  41. package/dist/shared/{parse-ast-index-vu376yZ1.mjs → logs-D80CXhvg.mjs} +25 -123
  42. package/dist/shared/normalize-string-or-regex-CF3Uz6aU.mjs +57 -0
  43. package/dist/shared/parse-CRhjbrcT.mjs +73 -0
  44. package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-BYQIwEjg.mjs} +301 -310
  45. package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
  46. package/dist/shared/rolldown-C3wFxOwq.mjs +40 -0
  47. package/dist/shared/rolldown-build-ChZOz6BP.mjs +3318 -0
  48. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  49. package/dist/shared/types-Cx3HYorz.d.mts +1302 -0
  50. package/dist/shared/utils-6wxe_LMG.d.mts +22 -0
  51. package/dist/shared/watch-C1jC1oFT.mjs +373 -0
  52. package/dist/utils-index.browser.mjs +2414 -0
  53. package/dist/utils-index.d.mts +374 -0
  54. package/dist/utils-index.mjs +2415 -0
  55. package/package.json +33 -38
  56. package/dist/cli.cjs +0 -1748
  57. package/dist/cli.d.cts +0 -1
  58. package/dist/config.cjs +0 -12
  59. package/dist/config.d.cts +0 -11
  60. package/dist/experimental-index.cjs +0 -129
  61. package/dist/experimental-index.d.cts +0 -96
  62. package/dist/filter-index.cjs +0 -53
  63. package/dist/filter-index.d.cts +0 -3
  64. package/dist/index.cjs +0 -9
  65. package/dist/index.d.cts +0 -3
  66. package/dist/parallel-plugin-worker.cjs +0 -33
  67. package/dist/parallel-plugin-worker.d.cts +0 -1
  68. package/dist/parallel-plugin.cjs +0 -8
  69. package/dist/parallel-plugin.d.cts +0 -14
  70. package/dist/parse-ast-index.cjs +0 -4
  71. package/dist/parse-ast-index.d.cts +0 -9
  72. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  73. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  74. package/dist/shared/define-config.d-D4lKXE9V.d.cts +0 -1165
  75. package/dist/shared/define-config.d-Dm9iNdt9.d.mts +0 -1165
  76. package/dist/shared/dist-BMVjvV-v.cjs +0 -249
  77. package/dist/shared/dist-CAn6dxW6.mjs +0 -153
  78. package/dist/shared/load-config-CtKjQ8Mn.cjs +0 -125
  79. package/dist/shared/prompt-GFYxfPw7.mjs +0 -854
  80. package/dist/shared/src-D0nc44MQ.mjs +0 -4691
  81. package/dist/shared/src-s89s870G.cjs +0 -4647
  82. package/dist/src-CeWghjQt.js +0 -4329
@@ -1,24 +1,186 @@
1
- import { BuiltinPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_transform_to_rollup_output, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin } from "./shared/src-D0nc44MQ.mjs";
2
- import "./shared/dist-CAn6dxW6.mjs";
3
- import "./shared/parse-ast-index-vu376yZ1.mjs";
4
- import { ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
1
+ import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-CF3Uz6aU.mjs";
2
+ import { o as transformToRollupOutput } from "./shared/bindingify-input-options-Czbczr8Z.mjs";
3
+ import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-ChZOz6BP.mjs";
4
+ import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-CQ6njWsV.mjs";
5
+ import { n as parseSync$2, t as parse$2 } from "./shared/parse-CRhjbrcT.mjs";
6
+ import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CemeNi29.mjs";
7
+ import { a as minify$2, i as transformSync$1, n as resolveTsconfig, o as minifySync$2, r as transform$1, t as TsconfigCache$2 } from "./shared/resolve-tsconfig-Cwoo4h_o.mjs";
8
+ import { BindingBundler, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, isolatedDeclarationSync, moduleRunnerTransform, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi.cjs";
5
9
  import { pathToFileURL } from "node:url";
6
-
10
+ //#region src/api/dev/dev-engine.ts
11
+ var DevEngine = class DevEngine {
12
+ #inner;
13
+ #cachedBuildFinishPromise = null;
14
+ static async create(inputOptions, outputOptions = {}, devOptions = {}) {
15
+ inputOptions = await PluginDriver.callOptionsHook(inputOptions);
16
+ const options = await createBundlerOptions(inputOptions, outputOptions, false);
17
+ const userOnHmrUpdates = devOptions.onHmrUpdates;
18
+ const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
19
+ const result = normalizeBindingResult(rawResult);
20
+ if (result instanceof Error) {
21
+ userOnHmrUpdates(result);
22
+ return;
23
+ }
24
+ const [updates, changedFiles] = result;
25
+ userOnHmrUpdates({
26
+ updates,
27
+ changedFiles
28
+ });
29
+ } : void 0;
30
+ const userOnOutput = devOptions.onOutput;
31
+ const bindingDevOptions = {
32
+ onHmrUpdates: bindingOnHmrUpdates,
33
+ onOutput: userOnOutput ? function(rawResult) {
34
+ const result = normalizeBindingResult(rawResult);
35
+ if (result instanceof Error) {
36
+ userOnOutput(result);
37
+ return;
38
+ }
39
+ userOnOutput(transformToRollupOutput(result));
40
+ } : void 0,
41
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
42
+ watch: devOptions.watch && {
43
+ skipWrite: devOptions.watch.skipWrite,
44
+ usePolling: devOptions.watch.usePolling,
45
+ pollInterval: devOptions.watch.pollInterval,
46
+ useDebounce: devOptions.watch.useDebounce,
47
+ debounceDuration: devOptions.watch.debounceDuration,
48
+ compareContentsForPolling: devOptions.watch.compareContentsForPolling,
49
+ debounceTickRate: devOptions.watch.debounceTickRate
50
+ }
51
+ };
52
+ return new DevEngine(new BindingDevEngine(options.bundlerOptions, bindingDevOptions));
53
+ }
54
+ constructor(inner) {
55
+ this.#inner = inner;
56
+ }
57
+ async run() {
58
+ await this.#inner.run();
59
+ }
60
+ async ensureCurrentBuildFinish() {
61
+ if (this.#cachedBuildFinishPromise) return this.#cachedBuildFinishPromise;
62
+ const promise = this.#inner.ensureCurrentBuildFinish().then(() => {
63
+ this.#cachedBuildFinishPromise = null;
64
+ });
65
+ this.#cachedBuildFinishPromise = promise;
66
+ return promise;
67
+ }
68
+ async getBundleState() {
69
+ return this.#inner.getBundleState();
70
+ }
71
+ async ensureLatestBuildOutput() {
72
+ await this.#inner.ensureLatestBuildOutput();
73
+ }
74
+ async invalidate(file, firstInvalidatedBy) {
75
+ return this.#inner.invalidate(file, firstInvalidatedBy);
76
+ }
77
+ async registerModules(clientId, modules) {
78
+ await this.#inner.registerModules(clientId, modules);
79
+ }
80
+ async removeClient(clientId) {
81
+ await this.#inner.removeClient(clientId);
82
+ }
83
+ async close() {
84
+ await this.#inner.close();
85
+ }
86
+ /**
87
+ * Compile a lazy entry module and return HMR-style patch code.
88
+ *
89
+ * This is called when a dynamically imported module is first requested at runtime.
90
+ * The module was previously stubbed with a proxy, and now we need to compile the
91
+ * actual module and its dependencies.
92
+ *
93
+ * @param moduleId - The absolute file path of the module to compile
94
+ * @param clientId - The client ID requesting this compilation
95
+ * @returns The compiled JavaScript code as a string (HMR patch format)
96
+ */
97
+ async compileEntry(moduleId, clientId) {
98
+ return this.#inner.compileEntry(moduleId, clientId);
99
+ }
100
+ };
101
+ //#endregion
102
+ //#region src/api/dev/index.ts
103
+ const dev = (...args) => DevEngine.create(...args);
104
+ //#endregion
105
+ //#region src/types/external-memory-handle.ts
106
+ const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
107
+ /**
108
+ * Frees the external memory held by the given handle.
109
+ *
110
+ * This is useful when you want to manually release memory held by Rust objects
111
+ * (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
112
+ *
113
+ * @param handle - The object with external memory to free
114
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
115
+ * This will take time to copy data from Rust to JavaScript, but prevents errors
116
+ * when accessing properties after the memory is freed.
117
+ * @returns Status object with `freed` boolean and optional `reason` string.
118
+ * - `{ freed: true }` if memory was successfully freed
119
+ * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * import { freeExternalMemory } from 'rolldown/experimental';
124
+ *
125
+ * const output = await bundle.generate();
126
+ * const chunk = output.output[0];
127
+ *
128
+ * // Use the chunk...
129
+ *
130
+ * // Manually free the memory (fast, but accessing properties after will throw)
131
+ * const status = freeExternalMemory(chunk); // { freed: true }
132
+ * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
133
+ *
134
+ * // Keep data alive before freeing (slower, but data remains accessible)
135
+ * freeExternalMemory(chunk, true); // Evaluates all lazy fields first
136
+ * console.log(chunk.code); // OK - data was copied to JavaScript before freeing
137
+ *
138
+ * // Without keepDataAlive, accessing chunk properties after freeing will throw an error
139
+ * ```
140
+ */
141
+ function freeExternalMemory(handle, keepDataAlive = false) {
142
+ return handle[symbolForExternalMemoryHandle](keepDataAlive);
143
+ }
144
+ //#endregion
7
145
  //#region src/api/experimental.ts
8
- init_create_bundler();
9
- init_transform_to_rollup_output();
10
146
  /**
11
- * This is an experimental API. It's behavior may change in the future.
147
+ * This is an experimental API. Its behavior may change in the future.
148
+ *
149
+ * - Calling this API will only execute the `scan/build` stage of rolldown.
150
+ * - `scan` will clean up all resources automatically, but if you want to ensure timely cleanup, you need to wait for the returned promise to resolve.
12
151
  *
13
- * Calling this API will only execute the scan stage of rolldown.
152
+ * @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
153
+ * ```ts
154
+ * import { scan } from 'rolldown/api/experimental';
155
+ *
156
+ * const cleanupPromise = await scan(...);
157
+ * await cleanupPromise;
158
+ * // Now all resources have been cleaned up.
159
+ * ```
14
160
  */
15
- const experimental_scan = async (input) => {
16
- const { bundler, stopWorkers } = await createBundler(input, {});
17
- const output = await bundler.scan();
18
- handleOutputErrors(output);
19
- await stopWorkers?.();
161
+ const scan = async (rawInputOptions, rawOutputOptions = {}) => {
162
+ validateOption("input", rawInputOptions);
163
+ validateOption("output", rawOutputOptions);
164
+ const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false);
165
+ const bundler = new BindingBundler();
166
+ if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
167
+ async function cleanup() {
168
+ await bundler.close();
169
+ await ret.stopWorkers?.();
170
+ shutdownAsyncRuntime();
171
+ RolldownBuild.asyncRuntimeShutdown = true;
172
+ }
173
+ let cleanupPromise = Promise.resolve();
174
+ try {
175
+ unwrapBindingResult(await bundler.scan(ret.bundlerOptions));
176
+ } catch (err) {
177
+ await cleanup();
178
+ throw err;
179
+ } finally {
180
+ cleanupPromise = cleanup();
181
+ }
182
+ return cleanupPromise;
20
183
  };
21
-
22
184
  //#endregion
23
185
  //#region src/plugin/parallel-plugin.ts
24
186
  function defineParallelPlugin(pluginPath) {
@@ -29,67 +191,124 @@ function defineParallelPlugin(pluginPath) {
29
191
  } };
30
192
  };
31
193
  }
32
-
33
194
  //#endregion
34
195
  //#region src/builtin-plugin/alias-plugin.ts
35
- init_constructors();
36
- function aliasPlugin(config) {
37
- return new BuiltinPlugin("builtin:alias", config);
196
+ function viteAliasPlugin(config) {
197
+ return new BuiltinPlugin("builtin:vite-alias", config);
38
198
  }
39
-
40
199
  //#endregion
41
- //#region src/builtin-plugin/replace-plugin.ts
42
- init_constructors();
200
+ //#region src/builtin-plugin/bundle-analyzer-plugin.ts
43
201
  /**
44
- * Replaces targeted strings in files while bundling.
202
+ * A plugin that analyzes bundle composition and generates detailed reports.
203
+ *
204
+ * The plugin outputs a file containing detailed information about:
205
+ * - All chunks and their relationships
206
+ * - Modules bundled in each chunk
207
+ * - Import dependencies between chunks
208
+ * - Reachable modules from each entry point
45
209
  *
46
210
  * @example
47
- * // Basic usage
48
211
  * ```js
49
- * replacePlugin({
50
- * 'process.env.NODE_ENV': JSON.stringify('production'),
51
- * __buildDate__: () => JSON.stringify(new Date()),
52
- * __buildVersion: 15
53
- * })
212
+ * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
213
+ *
214
+ * export default {
215
+ * plugins: [
216
+ * bundleAnalyzerPlugin()
217
+ * ]
218
+ * }
54
219
  * ```
220
+ *
55
221
  * @example
56
- * // With options
222
+ * **Custom filename**
57
223
  * ```js
58
- * replacePlugin({
59
- * 'process.env.NODE_ENV': JSON.stringify('production'),
60
- * __buildDate__: () => JSON.stringify(new Date()),
61
- * __buildVersion: 15
62
- * }, {
63
- * preventAssignment: false,
64
- * })
224
+ * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
225
+ *
226
+ * export default {
227
+ * plugins: [
228
+ * bundleAnalyzerPlugin({
229
+ * fileName: 'bundle-analysis.json'
230
+ * })
231
+ * ]
232
+ * }
233
+ * ```
234
+ *
235
+ * @example
236
+ * **LLM-friendly markdown output**
237
+ * ```js
238
+ * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
239
+ *
240
+ * export default {
241
+ * plugins: [
242
+ * bundleAnalyzerPlugin({
243
+ * format: 'md'
244
+ * })
245
+ * ]
246
+ * }
65
247
  * ```
66
248
  */
67
- function replacePlugin(values = {}, options = {}) {
68
- return new BuiltinPlugin("builtin:replace", {
69
- ...options,
70
- values
71
- });
249
+ function bundleAnalyzerPlugin(config) {
250
+ return new BuiltinPlugin("builtin:bundle-analyzer", config);
72
251
  }
73
-
74
252
  //#endregion
75
253
  //#region src/builtin-plugin/transform-plugin.ts
76
- init_constructors();
77
- init_normalize_string_or_regex();
78
- function transformPlugin(config) {
79
- if (config) config = {
254
+ function viteTransformPlugin(config) {
255
+ return new BuiltinPlugin("builtin:vite-transform", {
80
256
  ...config,
81
257
  include: normalizedStringOrRegex(config.include),
82
258
  exclude: normalizedStringOrRegex(config.exclude),
83
259
  jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
84
- jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude)
85
- };
86
- return new BuiltinPlugin("builtin:transform", config);
260
+ jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude),
261
+ yarnPnp: typeof process === "object" && !!process.versions?.pnp
262
+ });
263
+ }
264
+ //#endregion
265
+ //#region src/builtin-plugin/vite-manifest-plugin.ts
266
+ function viteManifestPlugin(config) {
267
+ return new BuiltinPlugin("builtin:vite-manifest", config);
87
268
  }
88
-
89
269
  //#endregion
90
270
  //#region src/experimental-index.ts
91
- init_compose_js_plugins();
92
- init_constructors();
93
-
271
+ /**
272
+ * In-memory file system for browser builds.
273
+ *
274
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
275
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
276
+ *
277
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
278
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
279
+ *
280
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * import { memfs } from 'rolldown/experimental';
285
+ *
286
+ * // Write files to virtual filesystem before bundling
287
+ * memfs?.volume.fromJSON({
288
+ * '/src/index.js': 'export const foo = 42;',
289
+ * '/package.json': '{"name": "my-app"}'
290
+ * });
291
+ *
292
+ * // Read files from the virtual filesystem
293
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
294
+ * ```
295
+ *
296
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
297
+ */
298
+ const memfs = void 0;
299
+ /** @deprecated Use from `rolldown/utils` instead. */
300
+ const parse = parse$2;
301
+ /** @deprecated Use from `rolldown/utils` instead. */
302
+ const parseSync = parseSync$2;
303
+ /** @deprecated Use from `rolldown/utils` instead. */
304
+ const minify = minify$2;
305
+ /** @deprecated Use from `rolldown/utils` instead. */
306
+ const minifySync = minifySync$2;
307
+ /** @deprecated Use from `rolldown/utils` instead. */
308
+ const transform = transform$1;
309
+ /** @deprecated Use from `rolldown/utils` instead. */
310
+ const transformSync = transformSync$1;
311
+ /** @deprecated Use from `rolldown/utils` instead. */
312
+ const TsconfigCache = TsconfigCache$2;
94
313
  //#endregion
95
- export { ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
314
+ export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @typedef {{ type: 'hmr:module-registered', modules: string[] }} DevRuntimeMessage
3
+ * @typedef {{ send(message: DevRuntimeMessage): void }} Messenger
4
+ */
5
+ export class DevRuntime {
6
+ /**
7
+ * @param {Messenger} messenger
8
+ * @param {string} clientId
9
+ */
10
+ constructor(messenger: Messenger, clientId: string);
11
+ /**
12
+ * Client ID generated at runtime initialization, used for lazy compilation requests.
13
+ * @type {string}
14
+ */
15
+ clientId: string;
16
+ messenger: Messenger;
17
+ /**
18
+ * @type {Record<string, Module>}
19
+ */
20
+ modules: Record<string, Module>;
21
+ /**
22
+ * @param {string} _moduleId
23
+ */
24
+ createModuleHotContext(_moduleId: string): void;
25
+ /**
26
+ * @param {[string, string][]} _boundaries
27
+ */
28
+ applyUpdates(_boundaries: [string, string][]): void;
29
+ /**
30
+ * @param {string} id
31
+ * @param {{ exports: any }} exportsHolder
32
+ */
33
+ registerModule(id: string, exportsHolder: {
34
+ exports: any;
35
+ }): void;
36
+ /**
37
+ * @param {string} id
38
+ */
39
+ loadExports(id: string): any;
40
+ /**
41
+ * __esmMin
42
+ *
43
+ * @type {<T>(fn: any, res: T) => () => T}
44
+ * @internal
45
+ */
46
+ createEsmInitializer: <T>(fn: any, res: T) => () => T;
47
+ /**
48
+ * __commonJSMin
49
+ *
50
+ * @type {<T extends { exports: any }>(cb: any, mod: { exports: any }) => () => T}
51
+ * @internal
52
+ */
53
+ createCjsInitializer: <T extends {
54
+ exports: any;
55
+ }>(cb: any, mod: {
56
+ exports: any;
57
+ }) => () => T;
58
+ /** @internal */
59
+ __toESM: any;
60
+ /** @internal */
61
+ __toCommonJS: any;
62
+ /** @internal */
63
+ __exportAll: any;
64
+ /**
65
+ * @param {boolean} [isNodeMode]
66
+ * @returns {(mod: any) => any}
67
+ * @internal
68
+ */
69
+ __toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
70
+ /** @internal */
71
+ __reExport: any;
72
+ sendModuleRegisteredMessage: (module: string) => void;
73
+ }
74
+ export type DevRuntimeMessage = {
75
+ type: "hmr:module-registered";
76
+ modules: string[];
77
+ };
78
+ export type Messenger = {
79
+ send(message: DevRuntimeMessage): void;
80
+ };
81
+ declare class Module {
82
+ /**
83
+ * @param {string} id
84
+ */
85
+ constructor(id: string);
86
+ /**
87
+ * @type {{ exports: any }}
88
+ */
89
+ exportsHolder: {
90
+ exports: any;
91
+ };
92
+ /**
93
+ * @type {string}
94
+ */
95
+ id: string;
96
+ get exports(): any;
97
+ }
98
+ export {};
@@ -1,3 +1,105 @@
1
- import { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter } from "./shared/define-config.d-Dm9iNdt9.mjs";
1
+ import { B as exprInterpreter, F as QueryFilterObject, G as interpreterImpl, H as importerId, I as TopLevelFilterExpression, J as or, K as moduleType, L as and, M as withFilter, N as FilterExpression, P as FilterExpressionKind, R as code, U as include, V as id, W as interpreter, X as query, Y as queries, q as not, z as exclude } from "./shared/define-config-i6TWE2hm.mjs";
2
2
 
3
- export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
3
+ //#region ../pluginutils/dist/filter/filter-vite-plugins.d.ts
4
+ /**
5
+ * Filters out Vite plugins that have `apply: 'serve'` set.
6
+ *
7
+ * Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
8
+ * are intended only for Vite's dev server and should be excluded from the build process.
9
+ *
10
+ * @param plugins - Array of plugins (can include nested arrays)
11
+ * @returns Filtered array with serve-only plugins removed
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { defineConfig } from 'rolldown';
16
+ * import { filterVitePlugins } from '@rolldown/pluginutils';
17
+ * import viteReact from '@vitejs/plugin-react';
18
+ *
19
+ * export default defineConfig({
20
+ * plugins: filterVitePlugins([
21
+ * viteReact(),
22
+ * {
23
+ * name: 'dev-only',
24
+ * apply: 'serve', // This will be filtered out
25
+ * // ...
26
+ * }
27
+ * ])
28
+ * });
29
+ * ```
30
+ */
31
+ declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[];
32
+ //#endregion
33
+ //#region ../pluginutils/dist/filter/simple-filters.d.ts
34
+ /**
35
+ * Constructs a RegExp that matches the exact string specified.
36
+ *
37
+ * This is useful for plugin hook filters.
38
+ *
39
+ * @param str the string to match.
40
+ * @param flags flags for the RegExp.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * import { exactRegex } from '@rolldown/pluginutils';
45
+ * const plugin = {
46
+ * name: 'plugin',
47
+ * resolveId: {
48
+ * filter: { id: exactRegex('foo') },
49
+ * handler(id) {} // will only be called for `foo`
50
+ * }
51
+ * }
52
+ * ```
53
+ */
54
+ declare function exactRegex(str: string, flags?: string): RegExp;
55
+ /**
56
+ * Constructs a RegExp that matches a value that has the specified prefix.
57
+ *
58
+ * This is useful for plugin hook filters.
59
+ *
60
+ * @param str the string to match.
61
+ * @param flags flags for the RegExp.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * import { prefixRegex } from '@rolldown/pluginutils';
66
+ * const plugin = {
67
+ * name: 'plugin',
68
+ * resolveId: {
69
+ * filter: { id: prefixRegex('foo') },
70
+ * handler(id) {} // will only be called for IDs starting with `foo`
71
+ * }
72
+ * }
73
+ * ```
74
+ */
75
+ declare function prefixRegex(str: string, flags?: string): RegExp;
76
+ type WidenString<T> = T extends string ? string : T;
77
+ /**
78
+ * Converts a id filter to match with an id with a query.
79
+ *
80
+ * @param input the id filters to convert.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
85
+ * const plugin = {
86
+ * name: 'plugin',
87
+ * transform: {
88
+ * filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
89
+ * // The handler will be called for IDs like:
90
+ * // - foo.js
91
+ * // - foo.js?foo
92
+ * // - foo.txt?foo.js
93
+ * // - foo.ts
94
+ * // - foo.ts?foo
95
+ * // - foo.txt?foo.ts
96
+ * handler(code, id) {}
97
+ * }
98
+ * }
99
+ * ```
100
+ */
101
+ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
102
+ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
103
+ declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
104
+ //#endregion
105
+ export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };