rolldown 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cli.mjs +11 -8
  2. package/dist/config.d.mts +22 -10
  3. package/dist/config.mjs +2 -2
  4. package/dist/experimental-index.d.mts +164 -155
  5. package/dist/experimental-index.mjs +23 -14
  6. package/dist/experimental-runtime-types.d.ts +111 -41
  7. package/dist/filter-index.d.mts +6 -5
  8. package/dist/get-log-filter.d.mts +2 -2
  9. package/dist/index.d.mts +4 -4
  10. package/dist/index.mjs +10 -4
  11. package/dist/parallel-plugin-worker.mjs +2 -2
  12. package/dist/parallel-plugin.d.mts +3 -4
  13. package/dist/parse-ast-index.d.mts +19 -20
  14. package/dist/parse-ast-index.mjs +2 -2
  15. package/dist/plugins-index.d.mts +27 -28
  16. package/dist/plugins-index.mjs +2 -2
  17. package/dist/shared/{binding-B1q9aYT-.d.mts → binding-Dbbi0RbO.d.mts} +49 -25
  18. package/dist/shared/{binding-BmkJW3Wy.mjs → binding-Dby9rwGk.mjs} +26 -26
  19. package/dist/shared/{bindingify-input-options-BsDhfYrS.mjs → bindingify-input-options-_ppP73I9.mjs} +11 -13
  20. package/dist/shared/{constructors-2i1T9YcF.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
  21. package/dist/shared/{constructors-CE6zZSUt.mjs → constructors-CuGa75s-.mjs} +1 -1
  22. package/dist/shared/define-config-B-IDOhDz.d.mts +4003 -0
  23. package/dist/shared/dist-DKbukT1H.mjs +154 -0
  24. package/dist/shared/{error-BlQ0-ek7.mjs → error-DFGNOCle.mjs} +1 -1
  25. package/dist/shared/get-log-filter-AjBknEEO.d.mts +34 -0
  26. package/dist/shared/{load-config-FRmAU9xl.mjs → load-config-C6UyiS41.mjs} +19 -2
  27. package/dist/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
  28. package/dist/shared/{logs-aMKUxRpj.mjs → logs-ZGEh6uhb.mjs} +6 -1
  29. package/dist/shared/{normalize-string-or-regex-BYkbbGqQ.mjs → normalize-string-or-regex-SiXbePVH.mjs} +2 -2
  30. package/dist/shared/{parse-DVMnkavl.mjs → parse-BFj5G_7i.mjs} +2 -2
  31. package/dist/shared/{prompt-B1Yc1NPt.mjs → prompt--dNycKSZ.mjs} +59 -17
  32. package/dist/shared/{resolve-tsconfig-CdIAR1Eb.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
  33. package/dist/shared/{rolldown-tbHvKzVl.mjs → rolldown-951h_1lf.mjs} +1 -1
  34. package/dist/shared/{rolldown-build-aV0QeeTW.mjs → rolldown-build-CdF8HAHX.mjs} +33 -13
  35. package/dist/shared/transform-Cs2bUDRH.d.mts +148 -0
  36. package/dist/shared/{watch-DIhJ-T1s.mjs → watch-WnrlHRS0.mjs} +5 -5
  37. package/dist/utils-index.d.mts +29 -30
  38. package/dist/utils-index.mjs +8 -6
  39. package/package.json +23 -22
  40. package/dist/shared/define-config-BBz954-q.d.mts +0 -3901
  41. package/dist/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
  42. package/dist/shared/transform-CEmFsvJW.d.mts +0 -149
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { n as onExit, t as watch } from "./shared/watch-DIhJ-T1s.mjs";
2
- import { C as version, S as description } from "./shared/bindingify-input-options-BsDhfYrS.mjs";
1
+ import { n as onExit, t as watch } from "./shared/watch-WnrlHRS0.mjs";
2
+ import { S as version, x as description } from "./shared/bindingify-input-options-_ppP73I9.mjs";
3
3
  import { t as arraify } from "./shared/misc-CoQm4NHO.mjs";
4
- import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-aV0QeeTW.mjs";
5
- import { t as rolldown } from "./shared/rolldown-tbHvKzVl.mjs";
6
- import { t as loadConfig } from "./shared/load-config-FRmAU9xl.mjs";
4
+ import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-CdF8HAHX.mjs";
5
+ import { t as rolldown } from "./shared/rolldown-951h_1lf.mjs";
6
+ import { t as loadConfig } from "./shared/load-config-C6UyiS41.mjs";
7
7
  import path from "node:path";
8
8
  import g$1 from "node:process";
9
9
  import { performance } from "node:perf_hooks";
@@ -631,6 +631,7 @@ const alias = {
631
631
  abbreviation: "c",
632
632
  hint: "filename"
633
633
  },
634
+ configLoader: { hint: "loader" },
634
635
  help: { abbreviation: "h" },
635
636
  version: { abbreviation: "v" },
636
637
  watch: { abbreviation: "w" },
@@ -684,7 +685,8 @@ const reservedKeys = /* @__PURE__ */ new Set([
684
685
  "version",
685
686
  "config",
686
687
  "watch",
687
- "environment"
688
+ "environment",
689
+ "configLoader"
688
690
  ]);
689
691
  function normalizeCliOptions(cliOptions, positionals) {
690
692
  const [data, errors] = validateCliOptions(cliOptions);
@@ -705,6 +707,7 @@ function normalizeCliOptions(cliOptions, positionals) {
705
707
  if (typeof options.config === "string") result.config = options.config;
706
708
  else if (options.config === true) result.config = "";
707
709
  if (options.environment !== void 0) result.environment = options.environment;
710
+ if (options.configLoader !== void 0) result.configLoader = options.configLoader;
708
711
  const keysOfInput = new Set(getInputCliKeys());
709
712
  const keysOfOutput = new Set(getOutputCliKeys());
710
713
  for (let [key, value] of Object.entries(options)) {
@@ -859,7 +862,7 @@ function getClearScreenFunction(options) {
859
862
  };
860
863
  }
861
864
  //#endregion
862
- //#region \0@oxc-project+runtime@0.138.0/helpers/esm/usingCtx.js
865
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/usingCtx.js
863
866
  function _usingCtx() {
864
867
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
865
868
  var n = Error();
@@ -921,7 +924,7 @@ async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
921
924
  process.env.ROLLUP_WATCH = "true";
922
925
  process.env.ROLLDOWN_WATCH = "true";
923
926
  }
924
- const config = await loadConfig(configPath);
927
+ const config = await loadConfig(configPath, { configLoader: cliOptions.configLoader });
925
928
  const resolvedConfig = typeof config === "function" ? await config(rawArgs) : config;
926
929
  if (typeof resolvedConfig !== "object" || resolvedConfig === null) {
927
930
  logger.error(`Invalid configuration from ${configPath}: expected object or array, got ${resolvedConfig}`);
package/dist/config.d.mts CHANGED
@@ -1,14 +1,26 @@
1
- import { I as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-BBz954-q.mjs";
2
-
1
+ import { L as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-B-IDOhDz.mjs";
3
2
  //#region src/utils/load-config.d.ts
3
+ type ConfigLoader = "bundle" | "native";
4
+ interface LoadConfigOptions {
5
+ /**
6
+ * How to load the config file.
7
+ * - `'bundle'` (default): bundle the config with Rolldown, then import it.
8
+ * - `'native'`: import the config directly, delegating TypeScript/loader
9
+ * handling to the runtime. Faster, but requires runtime support.
10
+ *
11
+ * @default 'bundle'
12
+ */
13
+ configLoader?: ConfigLoader;
14
+ }
4
15
  /**
5
- * Load config from a file in a way that Rolldown does.
6
- *
7
- * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
8
- * @returns The loaded config export
9
- *
10
- * @category Config
11
- */
12
- declare function loadConfig(configPath: string): Promise<ConfigExport>;
16
+ * Load config from a file in a way that Rolldown does.
17
+ *
18
+ * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
19
+ * @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
20
+ * @returns The loaded config export
21
+ *
22
+ * @category Config
23
+ */
24
+ declare function loadConfig(configPath: string, options?: LoadConfigOptions): Promise<ConfigExport>;
13
25
  //#endregion
14
26
  export { VERSION, defineConfig, loadConfig };
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { x as VERSION } from "./shared/bindingify-input-options-BsDhfYrS.mjs";
1
+ import { b as VERSION } from "./shared/bindingify-input-options-_ppP73I9.mjs";
2
2
  import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
3
- import { t as loadConfig } from "./shared/load-config-FRmAU9xl.mjs";
3
+ import { t as loadConfig } from "./shared/load-config-C6UyiS41.mjs";
4
4
  export { VERSION, defineConfig, loadConfig };
@@ -1,8 +1,7 @@
1
- import { B as ResolveResult, C as BindingViteManifestPluginConfig, G as isolatedDeclaration, I as NapiResolveOptions, K as isolatedDeclarationSync, M as IsolatedDeclarationsResult, O as BindingViteTransformPluginConfig, V as ResolverFactory, _ as BindingTsconfigRawOptions, f as BindingRebuildStrategy, g as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, j as IsolatedDeclarationsOptions, n as BindingBundleAnalyzerPluginConfig, q as moduleRunnerTransform, r as BindingBundleState } from "./shared/binding-B1q9aYT-.mjs";
2
- import { Jt as RolldownOutput, P as BuiltinPlugin, Ut as StringOrRegExp, Xt as freeExternalMemory, Z as defineParallelPlugin, ct as NormalizedOutputOptions, l as InputOptions, zt as OutputOptions } from "./shared/define-config-BBz954-q.mjs";
3
- import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-CEmFsvJW.mjs";
4
- import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-2i1T9YcF.mjs";
5
-
1
+ import { H as ResolverFactory, J as moduleRunnerTransform, K as isolatedDeclaration, L as NapiResolveOptions, M as IsolatedDeclarationsOptions, N as IsolatedDeclarationsResult, V as ResolveResult, _ as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, k as BindingViteTransformPluginConfig, n as BindingBundleAnalyzerPluginConfig, p as BindingRebuildStrategy, q as isolatedDeclarationSync, r as BindingBundleState, u as BindingLazyChunkOutput, v as BindingTsconfigRawOptions, w as BindingViteManifestPluginConfig } from "./shared/binding-Dbbi0RbO.mjs";
2
+ import { Bt as OutputOptions, F as BuiltinPlugin, Q as defineParallelPlugin, Wt as StringOrRegExp, Yt as RolldownOutput, Zt as freeExternalMemory, l as InputOptions, lt as NormalizedOutputOptions } from "./shared/define-config-B-IDOhDz.mjs";
3
+ import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-Cs2bUDRH.mjs";
4
+ import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CSWbNgBZ.mjs";
6
5
  //#region src/api/dev/dev-options.d.ts
7
6
  type DevOnHmrUpdates = (result: Error | {
8
7
  updates: BindingClientHmrUpdate[];
@@ -12,80 +11,81 @@ type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
12
11
  type DevOnAdditionalAssets = (output: RolldownOutput) => void | Promise<void>;
13
12
  interface DevWatchOptions {
14
13
  /**
15
- * If `true`, files are not written to disk.
16
- * @default false
17
- */
14
+ * If `true`, files are not written to disk.
15
+ * @default false
16
+ */
18
17
  skipWrite?: boolean;
19
18
  /**
20
- * If `true`, use polling instead of native file system events for watching.
21
- * @default false
22
- */
19
+ * If `true`, use polling instead of native file system events for watching.
20
+ * @default false
21
+ */
23
22
  usePolling?: boolean;
24
23
  /**
25
- * Poll interval in milliseconds (only used when usePolling is true).
26
- * @default 100
27
- */
24
+ * Poll interval in milliseconds (only used when usePolling is true).
25
+ * @default 100
26
+ */
28
27
  pollInterval?: number;
29
28
  /**
30
- * If `true`, use debounced watcher. If `false`, use non-debounced watcher for immediate responses.
31
- * @default true
32
- */
29
+ * If `true`, use debounced watcher. If `false`, use non-debounced watcher for immediate responses.
30
+ * @default true
31
+ */
33
32
  useDebounce?: boolean;
34
33
  /**
35
- * Debounce duration in milliseconds (only used when useDebounce is true).
36
- * @default 10
37
- */
34
+ * Debounce duration in milliseconds (only used when useDebounce is true).
35
+ * @default 10
36
+ */
38
37
  debounceDuration?: number;
39
38
  /**
40
- * Whether to compare file contents for poll-based watchers (only used when usePolling is true).
41
- * When enabled, poll watchers will check file contents to determine if they actually changed.
42
- * @default false
43
- */
39
+ * Whether to compare file contents for poll-based watchers (only used when usePolling is true).
40
+ * When enabled, poll watchers will check file contents to determine if they actually changed.
41
+ * @default false
42
+ */
44
43
  compareContentsForPolling?: boolean;
45
44
  /**
46
- * Tick rate in milliseconds for debounced watchers (only used when useDebounce is true).
47
- * Controls how frequently the debouncer checks for events to process.
48
- * When not specified, the debouncer will auto-select an appropriate tick rate (1/4 of the debounce duration).
49
- * @default undefined (auto-select)
50
- */
45
+ * Tick rate in milliseconds for debounced watchers (only used when useDebounce is true).
46
+ * Controls how frequently the debouncer checks for events to process.
47
+ * When not specified, the debouncer will auto-select an appropriate tick rate (1/4 of the debounce duration).
48
+ * @default undefined (auto-select)
49
+ */
51
50
  debounceTickRate?: number;
52
51
  /**
53
- * Filter to limit which discovered files are registered with the file watcher.
54
- *
55
- * Strings are treated as glob patterns.
56
- *
57
- * @default []
58
- */
52
+ * Filter to limit which discovered files are registered with the file watcher.
53
+ *
54
+ * Strings are treated as glob patterns.
55
+ *
56
+ * @default []
57
+ */
59
58
  include?: StringOrRegExp | StringOrRegExp[];
60
59
  /**
61
- * Filter to prevent discovered files from being registered with the file watcher.
62
- *
63
- * Strings are treated as glob patterns.
64
- *
65
- * @default []
66
- */
60
+ * Filter to prevent discovered files from being registered with the file watcher.
61
+ *
62
+ * Strings are treated as glob patterns.
63
+ *
64
+ * @default []
65
+ */
67
66
  exclude?: StringOrRegExp | StringOrRegExp[];
68
67
  }
69
68
  interface DevOptions {
70
69
  onHmrUpdates?: DevOnHmrUpdates;
71
70
  onOutput?: DevOnOutput;
72
71
  /**
73
- * Called with assets emitted while generating an HMR patch or compiling a
74
- * lazy entry (e.g. an image newly imported by the changed/lazy module).
75
- *
76
- * These never go through {@link onOutput}, so a consumer that serves built
77
- * files (e.g. Vite's bundled dev server) must register this to receive them
78
- * and write them to its in-memory file store before the client requests them.
79
- */
72
+ * Called with assets emitted while generating an HMR patch or compiling a
73
+ * lazy entry (e.g. an image newly imported by the changed/lazy module).
74
+ *
75
+ * These never go through {@link onOutput}, so a consumer that serves built
76
+ * files (e.g. Vite's bundled dev server) must register this to receive them
77
+ * and write them to its in-memory file store before the client requests them.
78
+ */
80
79
  onAdditionalAssets?: DevOnAdditionalAssets;
81
80
  /**
82
- * Strategy for triggering rebuilds after HMR updates.
83
- * - `'always'`: Always trigger a rebuild after HMR updates
84
- * - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
85
- * - `'never'`: Never trigger rebuild after HMR updates (default)
86
- * @default 'auto'
87
- */
88
- rebuildStrategy?: "always" | "auto" | "never";
81
+ * Strategy for triggering rebuilds after HMR updates.
82
+ * - `'always'`: Always trigger a rebuild after HMR updates
83
+ * - `'never'`: Never trigger rebuild after HMR updates. The server no longer
84
+ * decides full reloads, so there is no `'auto'` upgrade anymore; pull fresh
85
+ * bundle output explicitly (e.g. `ensureLatestBuildOutput`) when needed.
86
+ * @default 'never'
87
+ */
88
+ rebuildStrategy?: "always" | "never";
89
89
  watch?: DevWatchOptions;
90
90
  }
91
91
  //#endregion
@@ -99,22 +99,31 @@ declare class DevEngine {
99
99
  getBundleState(): Promise<BindingBundleState>;
100
100
  ensureLatestBuildOutput(): Promise<void>;
101
101
  triggerFullBuild(): void;
102
- invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
103
- registerModules(clientId: string, modules: string[]): Promise<void>;
102
+ /**
103
+ * Client-connect signal (the clientId hello): creates the per-client session
104
+ * with an empty ship map. Reconnects arrive as fresh clientIds.
105
+ */
106
+ registerClient(clientId: string): Promise<void>;
107
+ /**
108
+ * Delivery notification from the serving middleware: the response for
109
+ * `filename` completed, so record its modules as shipped to that client.
110
+ */
111
+ notifyPayloadDelivered(filename: string): Promise<void>;
104
112
  removeClient(clientId: string): Promise<void>;
105
113
  close(): Promise<void>;
106
114
  /**
107
- * Compile a lazy entry module and return HMR-style patch code.
108
- *
109
- * This is called when a dynamically imported module is first requested at runtime.
110
- * The module was previously stubbed with a proxy, and now we need to compile the
111
- * actual module and its dependencies.
112
- *
113
- * @param moduleId - The absolute file path of the module to compile
114
- * @param clientId - The client ID requesting this compilation
115
- * @returns The compiled JavaScript code as a string (HMR patch format)
116
- */
117
- compileEntry(moduleId: string, clientId: string): Promise<string>;
115
+ * Compile a lazy entry module and return HMR-style patch code.
116
+ *
117
+ * This is called when a dynamically imported module is first requested at runtime.
118
+ * The module was previously stubbed with a proxy, and now we need to compile the
119
+ * actual module and its dependencies.
120
+ *
121
+ * @param moduleId - The absolute file path of the module to compile
122
+ * @param clientId - The client ID requesting this compilation
123
+ * @returns The compiled chunk: its code plus the filename whose delivery the
124
+ * serving middleware reports via {@link notifyPayloadDelivered}
125
+ */
126
+ compileEntry(moduleId: string, clientId: string): Promise<BindingLazyChunkOutput>;
118
127
  }
119
128
  //#endregion
120
129
  //#region src/api/dev/index.d.ts
@@ -122,20 +131,20 @@ declare const dev: typeof DevEngine.create;
122
131
  //#endregion
123
132
  //#region src/api/experimental.d.ts
124
133
  /**
125
- * This is an experimental API. Its behavior may change in the future.
126
- *
127
- * - Calling this API will only execute the `scan/build` stage of rolldown.
128
- * - `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.
129
- *
130
- * @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
131
- * ```ts
132
- * import { scan } from 'rolldown/api/experimental';
133
- *
134
- * const cleanupPromise = await scan(...);
135
- * await cleanupPromise;
136
- * // Now all resources have been cleaned up.
137
- * ```
138
- */
134
+ * This is an experimental API. Its behavior may change in the future.
135
+ *
136
+ * - Calling this API will only execute the `scan/build` stage of rolldown.
137
+ * - `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.
138
+ *
139
+ * @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
140
+ * ```ts
141
+ * import { scan } from 'rolldown/api/experimental';
142
+ *
143
+ * const cleanupPromise = await scan(...);
144
+ * await cleanupPromise;
145
+ * // Now all resources have been cleaned up.
146
+ * ```
147
+ */
139
148
  declare const scan: (rawInputOptions: InputOptions, rawOutputOptions?: {}) => Promise<Promise<void>>;
140
149
  //#endregion
141
150
  //#region src/builtin-plugin/alias-plugin.d.ts
@@ -149,53 +158,53 @@ declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
149
158
  //#endregion
150
159
  //#region src/builtin-plugin/bundle-analyzer-plugin.d.ts
151
160
  /**
152
- * A plugin that analyzes bundle composition and generates detailed reports.
153
- *
154
- * The plugin outputs a file containing detailed information about:
155
- * - All chunks and their relationships
156
- * - Modules bundled in each chunk
157
- * - Import dependencies between chunks
158
- * - Reachable modules from each entry point
159
- *
160
- * @example
161
- * ```js
162
- * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
163
- *
164
- * export default {
165
- * plugins: [
166
- * bundleAnalyzerPlugin()
167
- * ]
168
- * }
169
- * ```
170
- *
171
- * @example
172
- * **Custom filename**
173
- * ```js
174
- * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
175
- *
176
- * export default {
177
- * plugins: [
178
- * bundleAnalyzerPlugin({
179
- * fileName: 'bundle-analysis.json'
180
- * })
181
- * ]
182
- * }
183
- * ```
184
- *
185
- * @example
186
- * **LLM-friendly markdown output**
187
- * ```js
188
- * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
189
- *
190
- * export default {
191
- * plugins: [
192
- * bundleAnalyzerPlugin({
193
- * format: 'md'
194
- * })
195
- * ]
196
- * }
197
- * ```
198
- */
161
+ * A plugin that analyzes bundle composition and generates detailed reports.
162
+ *
163
+ * The plugin outputs a file containing detailed information about:
164
+ * - All chunks and their relationships
165
+ * - Modules bundled in each chunk
166
+ * - Import dependencies between chunks
167
+ * - Reachable modules from each entry point
168
+ *
169
+ * @example
170
+ * ```js
171
+ * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
172
+ *
173
+ * export default {
174
+ * plugins: [
175
+ * bundleAnalyzerPlugin()
176
+ * ]
177
+ * }
178
+ * ```
179
+ *
180
+ * @example
181
+ * **Custom filename**
182
+ * ```js
183
+ * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
184
+ *
185
+ * export default {
186
+ * plugins: [
187
+ * bundleAnalyzerPlugin({
188
+ * fileName: 'bundle-analysis.json'
189
+ * })
190
+ * ]
191
+ * }
192
+ * ```
193
+ *
194
+ * @example
195
+ * **LLM-friendly markdown output**
196
+ * ```js
197
+ * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
198
+ *
199
+ * export default {
200
+ * plugins: [
201
+ * bundleAnalyzerPlugin({
202
+ * format: 'md'
203
+ * })
204
+ * ]
205
+ * }
206
+ * ```
207
+ */
199
208
  declare function bundleAnalyzerPlugin(config?: BindingBundleAnalyzerPluginConfig): BuiltinPlugin;
200
209
  //#endregion
201
210
  //#region src/builtin-plugin/transform-plugin.d.ts
@@ -216,32 +225,32 @@ declare function viteManifestPlugin(config: ViteManifestPluginConfig): BuiltinPl
216
225
  //#endregion
217
226
  //#region src/experimental-index.d.ts
218
227
  /**
219
- * In-memory file system for browser builds.
220
- *
221
- * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
222
- * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
223
- *
224
- * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
225
- * - `volume`: The underlying `Volume` instance that stores the filesystem state
226
- *
227
- * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
228
- *
229
- * @example
230
- * ```typescript
231
- * import { memfs } from 'rolldown/experimental';
232
- *
233
- * // Write files to virtual filesystem before bundling
234
- * memfs?.volume.fromJSON({
235
- * '/src/index.js': 'export const foo = 42;',
236
- * '/package.json': '{"name": "my-app"}'
237
- * });
238
- *
239
- * // Read files from the virtual filesystem
240
- * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
241
- * ```
242
- *
243
- * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
244
- */
228
+ * In-memory file system for browser builds.
229
+ *
230
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
231
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
232
+ *
233
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
234
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
235
+ *
236
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * import { memfs } from 'rolldown/experimental';
241
+ *
242
+ * // Write files to virtual filesystem before bundling
243
+ * memfs?.volume.fromJSON({
244
+ * '/src/index.js': 'export const foo = 42;',
245
+ * '/package.json': '{"name": "my-app"}'
246
+ * });
247
+ *
248
+ * // Read files from the virtual filesystem
249
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
250
+ * ```
251
+ *
252
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
253
+ */
245
254
  declare const memfs: {
246
255
  fs: any;
247
256
  volume: any;
@@ -1,11 +1,11 @@
1
- import { n as __toESM, t as require_binding } from "./shared/binding-BmkJW3Wy.mjs";
2
- import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-BYkbbGqQ.mjs";
3
- import { o as transformToRollupOutput } from "./shared/bindingify-input-options-BsDhfYrS.mjs";
4
- import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-aV0QeeTW.mjs";
5
- import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BlQ0-ek7.mjs";
6
- import { n as parseSync$1, t as parse$1 } from "./shared/parse-DVMnkavl.mjs";
7
- import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CE6zZSUt.mjs";
8
- import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-CdIAR1Eb.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
2
+ import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-SiXbePVH.mjs";
3
+ import { o as transformToRollupOutput } from "./shared/bindingify-input-options-_ppP73I9.mjs";
4
+ import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-CdF8HAHX.mjs";
5
+ import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-DFGNOCle.mjs";
6
+ import { n as parseSync$1, t as parse$1 } from "./shared/parse-BFj5G_7i.mjs";
7
+ import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CuGa75s-.mjs";
8
+ import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-2TXRF_zr.mjs";
9
9
  import { pathToFileURL } from "node:url";
10
10
  //#region src/api/dev/dev-engine.ts
11
11
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
@@ -44,7 +44,7 @@ var DevEngine = class DevEngine {
44
44
  onAdditionalAssets: userOnAdditionalAssets ? function(output) {
45
45
  userOnAdditionalAssets(transformToRollupOutput(output));
46
46
  } : void 0,
47
- rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding.BindingRebuildStrategy.Auto : import_binding.BindingRebuildStrategy.Never : void 0,
47
+ rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : import_binding.BindingRebuildStrategy.Never : void 0,
48
48
  watch: devOptions.watch && {
49
49
  skipWrite: devOptions.watch.skipWrite,
50
50
  usePolling: devOptions.watch.usePolling,
@@ -83,11 +83,19 @@ var DevEngine = class DevEngine {
83
83
  triggerFullBuild() {
84
84
  this.#inner.triggerFullBuild();
85
85
  }
86
- async invalidate(file, firstInvalidatedBy) {
87
- return unwrapBindingResult(await this.#inner.invalidate(file, firstInvalidatedBy));
86
+ /**
87
+ * Client-connect signal (the clientId hello): creates the per-client session
88
+ * with an empty ship map. Reconnects arrive as fresh clientIds.
89
+ */
90
+ async registerClient(clientId) {
91
+ await this.#inner.registerClient(clientId);
88
92
  }
89
- async registerModules(clientId, modules) {
90
- await this.#inner.registerModules(clientId, modules);
93
+ /**
94
+ * Delivery notification from the serving middleware: the response for
95
+ * `filename` completed, so record its modules as shipped to that client.
96
+ */
97
+ async notifyPayloadDelivered(filename) {
98
+ await this.#inner.notifyPayloadDelivered(filename);
91
99
  }
92
100
  async removeClient(clientId) {
93
101
  await this.#inner.removeClient(clientId);
@@ -104,7 +112,8 @@ var DevEngine = class DevEngine {
104
112
  *
105
113
  * @param moduleId - The absolute file path of the module to compile
106
114
  * @param clientId - The client ID requesting this compilation
107
- * @returns The compiled JavaScript code as a string (HMR patch format)
115
+ * @returns The compiled chunk: its code plus the filename whose delivery the
116
+ * serving middleware reports via {@link notifyPayloadDelivered}
108
117
  */
109
118
  async compileEntry(moduleId, clientId) {
110
119
  return this.#inner.compileEntry(moduleId, clientId);