rolldown 1.1.5 → 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 (39) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/config.d.mts +16 -17
  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 +3 -3
  10. package/dist/index.mjs +4 -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 +1 -1
  15. package/dist/plugins-index.d.mts +27 -28
  16. package/dist/plugins-index.mjs +2 -2
  17. package/dist/shared/{binding-D26QphWG.d.mts → binding-Dbbi0RbO.d.mts} +37 -25
  18. package/dist/shared/{binding-TuFFIE_J.mjs → binding-Dby9rwGk.mjs} +26 -26
  19. package/dist/shared/{bindingify-input-options-XPJLJOD0.mjs → bindingify-input-options-_ppP73I9.mjs} +5 -5
  20. package/dist/shared/{constructors-BbWPse2X.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
  21. package/dist/shared/{constructors-D_3i7dpX.mjs → constructors-CuGa75s-.mjs} +1 -1
  22. package/dist/shared/define-config-B-IDOhDz.d.mts +4003 -0
  23. package/dist/shared/{error-BHRSI0R7.mjs → error-DFGNOCle.mjs} +1 -1
  24. package/dist/shared/get-log-filter-AjBknEEO.d.mts +34 -0
  25. package/dist/shared/{load-config-BL_FI6dc.mjs → load-config-C6UyiS41.mjs} +1 -1
  26. package/dist/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
  27. package/dist/shared/{normalize-string-or-regex-dnh67V_w.mjs → normalize-string-or-regex-SiXbePVH.mjs} +1 -1
  28. package/dist/shared/{parse-D4dtlfWy.mjs → parse-BFj5G_7i.mjs} +2 -2
  29. package/dist/shared/{resolve-tsconfig-DxqIJB3x.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
  30. package/dist/shared/{rolldown-ChpIlMRm.mjs → rolldown-951h_1lf.mjs} +1 -1
  31. package/dist/shared/{rolldown-build-CtPvmZgJ.mjs → rolldown-build-CdF8HAHX.mjs} +4 -4
  32. package/dist/shared/transform-Cs2bUDRH.d.mts +148 -0
  33. package/dist/shared/{watch-B1b0gmVh.mjs → watch-WnrlHRS0.mjs} +4 -4
  34. package/dist/utils-index.d.mts +29 -30
  35. package/dist/utils-index.mjs +5 -5
  36. package/package.json +21 -21
  37. package/dist/shared/define-config-BhJ90aEv.d.mts +0 -3978
  38. package/dist/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
  39. package/dist/shared/transform-BPrUvqEZ.d.mts +0 -149
@@ -1,31 +1,87 @@
1
1
  /**
2
- * @typedef {{ type: 'hmr:module-registered', modules: string[] }} DevRuntimeMessage
3
- * @typedef {{ send(message: DevRuntimeMessage): void }} Messenger
2
+ * Compiler-emitted module-graph delta pure topology (static + dynamic edges).
3
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
4
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
5
+ * @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
6
+ * @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
4
7
  */
8
+ export class MissingFactoryError {
9
+ /**
10
+ * @param {string} id
11
+ */
12
+ constructor(id: string);
13
+ id: string;
14
+ }
5
15
  export class DevRuntime {
6
16
  /**
7
- * @param {Messenger} messenger
8
17
  * @param {string} clientId
9
18
  */
10
- constructor(messenger: Messenger, clientId: string);
19
+ constructor(clientId: string);
11
20
  /**
12
21
  * Client ID generated at runtime initialization, used for lazy compilation requests.
13
22
  * @type {string}
14
23
  */
15
24
  clientId: string;
16
- messenger: Messenger;
17
25
  /**
18
- * @type {Record<string, Module>}
26
+ * Static import edges from `registerGraph` — entries persist across `removeModuleCache`
27
+ * and change only by replacement from a newer payload (last write wins).
28
+ * @type {Map<string, { edges: string[] }>}
19
29
  */
20
- modules: Record<string, Module>;
30
+ staticImports: Map<string, {
31
+ edges: string[];
32
+ }>;
21
33
  /**
22
- * @param {string} _moduleId
34
+ * Reverse index over the static imports.
35
+ * @type {Map<string, Set<string>>}
23
36
  */
24
- createModuleHotContext(_moduleId: string): void;
37
+ importers: Map<string, Set<string>>;
25
38
  /**
26
- * @param {[string, string][]} _boundaries
39
+ * Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
40
+ * `staticImports` for the dynamic reverse index.
41
+ * @type {Map<string, { edges: string[] }>}
27
42
  */
28
- applyUpdates(_boundaries: [string, string][]): void;
43
+ dynamicImports: Map<string, {
44
+ edges: string[];
45
+ }>;
46
+ /**
47
+ * Reverse index over the dynamic imports.
48
+ * @type {Map<string, Set<string>>}
49
+ */
50
+ dynamicImporters: Map<string, Set<string>>;
51
+ /**
52
+ * The module cache. Membership means "this module's side effects ran in this tab" —
53
+ * registration is emitted ahead of every module body, and nothing un-registers on
54
+ * unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
55
+ * plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
56
+ * into dictionary mode, taxing every later lookup on the hottest read path.
57
+ * @type {Map<string, Module>}
58
+ */
59
+ moduleCache: Map<string, Module>;
60
+ /**
61
+ * Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
62
+ * scope-hoisted and contributes none.
63
+ * @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
64
+ */
65
+ factories: Map<string, {
66
+ kind: "esm" | "cjs";
67
+ fn: (id: string) => void;
68
+ }>;
69
+ /**
70
+ * Installed by the dev client at boot. The runtime is a store + executor and makes
71
+ * no HMR decisions; accepting, disposing, and reloading live behind these hooks.
72
+ * @type {DevRuntimeHooks | null}
73
+ */
74
+ hooks: DevRuntimeHooks | null;
75
+ /**
76
+ * @param {ModuleGraphDelta} delta
77
+ */
78
+ registerGraph(delta: ModuleGraphDelta): void;
79
+ /**
80
+ * @param {string} id
81
+ * @param {'esm' | 'cjs'} kind
82
+ * @param {(id: string) => void} fn
83
+ */
84
+ registerFactory(id: string, kind: "esm" | "cjs", fn: (id: string) => void): void;
29
85
  /**
30
86
  * @param {string} id
31
87
  * @param {{ exports: any }} exportsHolder
@@ -35,35 +91,37 @@ export class DevRuntime {
35
91
  }): void;
36
92
  /**
37
93
  * @param {string} id
94
+ * @returns {string[]}
38
95
  */
39
- loadExports(id: string): any;
96
+ getImporters(id: string): string[];
40
97
  /**
41
- * __esmMin
42
- *
43
- * When `dedup` is truthy and `id` is already registered on the runtime,
44
- * skip the factory: another lazy blob got there first. HMR patches pass
45
- * no `dedup` so they always re-run the factory and replace the registered
46
- * exports.
47
- *
48
- * @type {<T>(id: string, fn: any, dedup: any, res: T) => () => T}
49
- * @internal
98
+ * @param {string} id
50
99
  */
51
- createEsmInitializer: <T>(id: string, fn: any, dedup: any, res: T) => () => T;
100
+ isExecuted(id: string): any;
52
101
  /**
53
- * __commonJSMin
54
- *
55
- * Same dedup gate as createEsmInitializer. With `dedup` truthy and `id`
56
- * registered, reuse the registered exports object; otherwise run the
57
- * factory.
58
- *
59
- * @type {<T extends { exports: any }>(id: string, cb: any, dedup: any, mod: { exports: any }, registered: any) => () => T}
60
- * @internal
102
+ * @param {string} id
61
103
  */
62
- createCjsInitializer: <T extends {
63
- exports: any;
64
- }>(id: string, cb: any, dedup: any, mod: {
65
- exports: any;
66
- }, registered: any) => () => T;
104
+ hasFactory(id: string): any;
105
+ /**
106
+ * Module-cache delete only static imports and factories persist. Removal is what
107
+ * re-arms a cache-gated factory for `initModule`.
108
+ * @param {string} id
109
+ */
110
+ removeModuleCache(id: string): void;
111
+ /**
112
+ * The one re-execution gate: registered → return the live exports; otherwise run the
113
+ * mapped factory (which registers itself first, then runs the body).
114
+ * @param {string} id
115
+ */
116
+ initModule(id: string): any;
117
+ /**
118
+ * @param {string} id
119
+ */
120
+ loadExports(id: string): any;
121
+ /**
122
+ * @param {string} moduleId
123
+ */
124
+ createModuleHotContext(moduleId: string): any;
67
125
  /** @internal */
68
126
  __toESM: any;
69
127
  /** @internal */
@@ -78,14 +136,26 @@ export class DevRuntime {
78
136
  __toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
79
137
  /** @internal */
80
138
  __reExport: any;
81
- sendModuleRegisteredMessage: (module: string) => void;
82
139
  }
83
- export type DevRuntimeMessage = {
84
- type: "hmr:module-registered";
85
- modules: string[];
140
+ /**
141
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
142
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
143
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
144
+ */
145
+ export type ModuleGraphDelta = {
146
+ ids: string[];
147
+ localCount: number;
148
+ edges: number[][];
149
+ dynamicEdges?: number[][];
86
150
  };
87
- export type Messenger = {
88
- send(message: DevRuntimeMessage): void;
151
+ /**
152
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
153
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
154
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
155
+ */
156
+ export type DevRuntimeHooks = {
157
+ createModuleHotContext(moduleId: string): any;
158
+ onModuleCacheRemoval(moduleId: string): void;
89
159
  };
90
160
  declare class Module {
91
161
  /**
@@ -1,5 +1,4 @@
1
- import { P as withFilter } from "./shared/define-config-BhJ90aEv.mjs";
2
-
1
+ import { P as withFilter } from "./shared/define-config-B-IDOhDz.mjs";
3
2
  //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter/index.d.mts
4
3
  //#region src/filter/composable-filters.d.ts
5
4
  type StringOrRegExp = string | RegExp;
@@ -90,7 +89,8 @@ interface InterpreterCtx {
90
89
  urlSearchParamsCache?: URLSearchParams;
91
90
  }
92
91
  declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
93
- declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean; //#endregion
92
+ declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
93
+ //#endregion
94
94
  //#region src/filter/filter-vite-plugins.d.ts
95
95
  /**
96
96
  * Filters out Vite plugins that have `apply: 'serve'` set.
@@ -119,7 +119,8 @@ declare function exprInterpreter(expr: FilterExpression, code?: string, id?: str
119
119
  * });
120
120
  * ```
121
121
  */
122
- declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[]; //#endregion
122
+ declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[];
123
+ //#endregion
123
124
  //#region src/filter/simple-filters.d.ts
124
125
  /**
125
126
  * Constructs a RegExp that matches the exact string specified.
@@ -190,6 +191,6 @@ type WidenString<T> = T extends string ? string : T;
190
191
  */
191
192
  declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
192
193
  declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
193
- declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[]; //#endregion
194
+ declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
194
195
  //#endregion
195
196
  export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };
@@ -1,3 +1,3 @@
1
- import { a as RolldownLog } from "./shared/logging-BSNejiLS.mjs";
2
- import { n as getLogFilter, t as GetLogFilter } from "./shared/get-log-filter-BpNVNJ5-.mjs";
1
+ import { a as RolldownLog } from "./shared/logging-xuHO4mAy.mjs";
2
+ import { n as getLogFilter, t as GetLogFilter } from "./shared/get-log-filter-AjBknEEO.mjs";
3
3
  export { GetLogFilter, type RolldownLog, type RolldownLog as RollupLog, getLogFilter as default };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-BSNejiLS.mjs";
2
- import { z as PreRenderedChunk } from "./shared/binding-D26QphWG.mjs";
3
- import { $ as MinimalPluginContext, $t as SourcemapIgnoreListOption, A as RolldownPlugin, At as ChunkingContext, B as SourceMapInput, Bt as OutputOptions, C as ParallelPluginHooks, Ct as BuildOptions, D as ResolveIdExtraOptions, Dt as AdvancedChunksOptions, E as PluginMeta, Et as AdvancedChunksGroup, Ft as GeneratedCodeOptions, G as EmittedChunk, Gt as OutputAsset, H as TreeshakingOptions, I as RUNTIME_MODULE_ID, It as GeneratedCodePreset, J as GetModuleInfo, Jt as RenderedModule, K as EmittedFile, Kt as OutputChunk, L as VERSION, Lt as GlobalsFunction, M as SourceDescription, Mt as CodeSplittingNameFunction, N as TransformResult, Nt as CodeSplittingOptions, O as ResolveIdResult, Ot as BuiltinModuleTag, Pt as CommentsOptions, Qt as ModuleInfo, R as BundleError, Rt as MinifyOptions, S as ObjectHook, St as RolldownBuild, T as Plugin, Tt as AddonFunction, U as TransformPluginContext, Ut as PartialNull, V as OutputBundle, Vt as PreRenderedAsset, W as EmittedAsset, X as PluginContextResolveOptions, Xt as SourceMap, Y as PluginContext, Yt as RolldownOutput, Z as DefineParallelPluginResult, _ as HookFilterExtension, _t as RolldownWatcher, a as ChunkOptimizationOptions, at as RolldownDirectoryEntry, b as ModuleOptions, bt as WatchOptions, c as InputOption, ct as InternalModuleFormat, d as OptimizationOptions, dt as TransformOptions, et as PluginContextMeta, f as WatcherFileWatcherOptions, ft as ChecksOptions, g as FunctionPluginHooks, gt as watch, h as CustomPluginOptions, ht as RolldownMagicString, i as RolldownOptions, it as BufferEncoding, j as RolldownPluginOption, jt as CodeSplittingGroup, k as ResolvedId, kt as ChunkFileNamesFunction, l as InputOptions, lt as NormalizedOutputOptions, m as AsyncPluginHooks, mt as WarningHandlerWithDefault, n as RolldownOptionsFunction, nt as HookFilter, o as ExternalOption, ot as RolldownFileStats, p as WatcherOptions, pt as LoggingFunction, q as EmittedPrebuiltChunk, qt as RenderedChunk, r as defineConfig, rt as ModuleTypeFilter, s as ExternalOptionFunction, st as RolldownFsModule, t as ConfigExport, tt as GeneralHookFilter, u as ModuleTypes, ut as NormalizedInputOptions, v as ImportKind, vt as RolldownWatcherEvent, w as PartialResolvedId, wt as build, x as ModuleType, xt as rolldown, y as LoadResult, yt as RolldownWatcherWatcherEventMap, z as ExistingRawSourceMap, zt as ModuleFormat } from "./shared/define-config-BhJ90aEv.mjs";
1
+ import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-xuHO4mAy.mjs";
2
+ import { B as PreRenderedChunk } from "./shared/binding-Dbbi0RbO.mjs";
3
+ import { $ as MinimalPluginContext, $t as SourcemapIgnoreListOption, A as RolldownPlugin, At as ChunkingContext, B as SourceMapInput, Bt as OutputOptions, C as ParallelPluginHooks, Ct as BuildOptions, D as ResolveIdExtraOptions, Dt as AdvancedChunksOptions, E as PluginMeta, Et as AdvancedChunksGroup, Ft as GeneratedCodeOptions, G as EmittedChunk, Gt as OutputAsset, H as TreeshakingOptions, I as RUNTIME_MODULE_ID, It as GeneratedCodePreset, J as GetModuleInfo, Jt as RenderedModule, K as EmittedFile, Kt as OutputChunk, L as VERSION, Lt as GlobalsFunction, M as SourceDescription, Mt as CodeSplittingNameFunction, N as TransformResult, Nt as CodeSplittingOptions, O as ResolveIdResult, Ot as BuiltinModuleTag, Pt as CommentsOptions, Qt as ModuleInfo, R as BundleError, Rt as MinifyOptions, S as ObjectHook, St as RolldownBuild, T as Plugin, Tt as AddonFunction, U as TransformPluginContext, Ut as PartialNull, V as OutputBundle, Vt as PreRenderedAsset, W as EmittedAsset, X as PluginContextResolveOptions, Xt as SourceMap, Y as PluginContext, Yt as RolldownOutput, Z as DefineParallelPluginResult, _ as HookFilterExtension, _t as RolldownWatcher, a as ChunkOptimizationOptions, at as RolldownDirectoryEntry, b as ModuleOptions, bt as WatchOptions, c as InputOption, ct as InternalModuleFormat, d as OptimizationOptions, dt as TransformOptions, et as PluginContextMeta, f as WatcherFileWatcherOptions, ft as ChecksOptions, g as FunctionPluginHooks, gt as watch, h as CustomPluginOptions, ht as RolldownMagicString, i as RolldownOptions, it as BufferEncoding, j as RolldownPluginOption, jt as CodeSplittingGroup, k as ResolvedId, kt as ChunkFileNamesFunction, l as InputOptions, lt as NormalizedOutputOptions, m as AsyncPluginHooks, mt as WarningHandlerWithDefault, n as RolldownOptionsFunction, nt as HookFilter, o as ExternalOption, ot as RolldownFileStats, p as WatcherOptions, pt as LoggingFunction, q as EmittedPrebuiltChunk, qt as RenderedChunk, r as defineConfig, rt as ModuleTypeFilter, s as ExternalOptionFunction, st as RolldownFsModule, t as ConfigExport, tt as GeneralHookFilter, u as ModuleTypes, ut as NormalizedInputOptions, v as ImportKind, vt as RolldownWatcherEvent, w as PartialResolvedId, wt as build, x as ModuleType, xt as rolldown, y as LoadResult, yt as RolldownWatcherWatcherEventMap, z as ExistingRawSourceMap, zt as ModuleFormat } from "./shared/define-config-B-IDOhDz.mjs";
4
4
  export { type AddonFunction, type AdvancedChunksGroup, type AdvancedChunksOptions, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, type BuiltinModuleTag, type BundleError, type ChecksOptions, type ChunkFileNamesFunction, type ChunkOptimizationOptions, type ChunkingContext, type CodeSplittingGroup, type CodeSplittingNameFunction, type CodeSplittingOptions, type CommentsOptions, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedChunk, type EmittedFile, type EmittedPrebuiltChunk, type ExistingRawSourceMap, type ExternalOption, type ExternalOptionFunction, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PluginContextResolveOptions, type PluginMeta, type PreRenderedAsset, type PreRenderedChunk, RUNTIME_MODULE_ID, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownError, type RolldownError as RollupError, type RolldownFileStats, type RolldownFsModule, type RolldownLog, type RolldownLog as RollupLog, type RolldownLogWithString, type RolldownLogWithString as RollupLogWithString, RolldownMagicString, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RolldownWatcherWatcherEventMap, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, type TransformOptions, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherFileWatcherOptions, type WatcherOptions, build, defineConfig, rolldown, watch };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { n as __toESM, t as require_binding } from "./shared/binding-TuFFIE_J.mjs";
2
- import { n as onExit, t as watch } from "./shared/watch-B1b0gmVh.mjs";
3
- import { b as VERSION, r as RolldownMagicString } from "./shared/bindingify-input-options-XPJLJOD0.mjs";
4
- import { t as rolldown } from "./shared/rolldown-ChpIlMRm.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
2
+ import { n as onExit, t as watch } from "./shared/watch-WnrlHRS0.mjs";
3
+ import { b as VERSION, r as RolldownMagicString } from "./shared/bindingify-input-options-_ppP73I9.mjs";
4
+ import { t as rolldown } from "./shared/rolldown-951h_1lf.mjs";
5
5
  import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
6
6
  import { isMainThread } from "node:worker_threads";
7
7
  //#region src/setup.ts
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./shared/binding-TuFFIE_J.mjs";
2
- import { i as PluginContextData, n as bindingifyPlugin } from "./shared/bindingify-input-options-XPJLJOD0.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
2
+ import { i as PluginContextData, n as bindingifyPlugin } from "./shared/bindingify-input-options-_ppP73I9.mjs";
3
3
  import { parentPort, workerData } from "node:worker_threads";
4
4
  //#region src/parallel-plugin-worker.ts
5
5
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
@@ -1,11 +1,10 @@
1
- import { Ht as MaybePromise, T as Plugin } from "./shared/define-config-BhJ90aEv.mjs";
2
-
1
+ import { Ht as MaybePromise, T as Plugin } from "./shared/define-config-B-IDOhDz.mjs";
3
2
  //#region src/plugin/parallel-plugin-implementation.d.ts
4
3
  type ParallelPluginImplementation = Plugin;
5
4
  type Context = {
6
5
  /**
7
- * Thread number
8
- */
6
+ * Thread number
7
+ */
9
8
  threadNumber: number;
10
9
  };
11
10
  declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
@@ -1,32 +1,31 @@
1
- import { L as ParseResult$1, R as ParserOptions$1 } from "./shared/binding-D26QphWG.mjs";
1
+ import { R as ParseResult$1, z as ParserOptions$1 } from "./shared/binding-Dbbi0RbO.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
-
4
3
  //#region src/parse-ast-index.d.ts
5
4
  /**
6
- * @hidden
7
- */
5
+ * @hidden
6
+ */
8
7
  type ParseResult = ParseResult$1;
9
8
  /**
10
- * @hidden
11
- */
9
+ * @hidden
10
+ */
12
11
  type ParserOptions = ParserOptions$1;
13
12
  /**
14
- * Parse code synchronously and return the AST.
15
- *
16
- * This function is similar to Rollup's `parseAst` function.
17
- * Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
18
- *
19
- * @category Utilities
20
- */
13
+ * Parse code synchronously and return the AST.
14
+ *
15
+ * This function is similar to Rollup's `parseAst` function.
16
+ * Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
17
+ *
18
+ * @category Utilities
19
+ */
21
20
  declare function parseAst(sourceText: string, options?: ParserOptions | null, filename?: string): Program;
22
21
  /**
23
- * Parse code asynchronously and return the AST.
24
- *
25
- * This function is similar to Rollup's `parseAstAsync` function.
26
- * Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
27
- *
28
- * @category Utilities
29
- */
22
+ * Parse code asynchronously and return the AST.
23
+ *
24
+ * This function is similar to Rollup's `parseAstAsync` function.
25
+ * Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
26
+ *
27
+ * @category Utilities
28
+ */
30
29
  declare function parseAstAsync(sourceText: string, options?: ParserOptions | null, filename?: string): Promise<Program>;
31
30
  //#endregion
32
31
  export { ParseResult, ParserOptions, parseAst, parseAstAsync };
@@ -1,5 +1,5 @@
1
1
  import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-ZGEh6uhb.mjs";
2
- import { n as parseSync, t as parse } from "./shared/parse-D4dtlfWy.mjs";
2
+ import { n as parseSync, t as parse } from "./shared/parse-BFj5G_7i.mjs";
3
3
  //#region src/parse-ast-index.ts
4
4
  function wrap(result, filename, sourceText) {
5
5
  if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
@@ -1,33 +1,32 @@
1
- import { m as BindingReplacePluginConfig } from "./shared/binding-D26QphWG.mjs";
2
- import { F as BuiltinPlugin } from "./shared/define-config-BhJ90aEv.mjs";
3
- import { t as esmExternalRequirePlugin } from "./shared/constructors-BbWPse2X.mjs";
4
-
1
+ import { h as BindingReplacePluginConfig } from "./shared/binding-Dbbi0RbO.mjs";
2
+ import { F as BuiltinPlugin } from "./shared/define-config-B-IDOhDz.mjs";
3
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-CSWbNgBZ.mjs";
5
4
  //#region src/builtin-plugin/replace-plugin.d.ts
6
5
  /**
7
- * Replaces targeted strings in files while bundling.
8
- *
9
- * @example
10
- * **Basic usage**
11
- * ```js
12
- * replacePlugin({
13
- * 'process.env.NODE_ENV': JSON.stringify('production'),
14
- * __buildVersion: 15
15
- * })
16
- * ```
17
- * @example
18
- * **With options**
19
- * ```js
20
- * replacePlugin({
21
- * 'process.env.NODE_ENV': JSON.stringify('production'),
22
- * __buildVersion: 15
23
- * }, {
24
- * preventAssignment: false,
25
- * })
26
- * ```
27
- *
28
- * @see https://rolldown.rs/builtin-plugins/replace
29
- * @category Builtin Plugins
30
- */
6
+ * Replaces targeted strings in files while bundling.
7
+ *
8
+ * @example
9
+ * **Basic usage**
10
+ * ```js
11
+ * replacePlugin({
12
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
13
+ * __buildVersion: 15
14
+ * })
15
+ * ```
16
+ * @example
17
+ * **With options**
18
+ * ```js
19
+ * replacePlugin({
20
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
21
+ * __buildVersion: 15
22
+ * }, {
23
+ * preventAssignment: false,
24
+ * })
25
+ * ```
26
+ *
27
+ * @see https://rolldown.rs/builtin-plugins/replace
28
+ * @category Builtin Plugins
29
+ */
31
30
  declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
32
31
  //#endregion
33
32
  export { esmExternalRequirePlugin, replacePlugin };
@@ -1,5 +1,5 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-dnh67V_w.mjs";
2
- import { t as esmExternalRequirePlugin } from "./shared/constructors-D_3i7dpX.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-SiXbePVH.mjs";
2
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-CuGa75s-.mjs";
3
3
  //#region src/builtin-plugin/replace-plugin.ts
4
4
  /**
5
5
  * Replaces targeted strings in files while bundling.
@@ -270,21 +270,33 @@ interface ExportExportName {
270
270
  start: number | null;
271
271
  end: number | null;
272
272
  }
273
- type ExportExportNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' | /** `export * from "mod" */'None';
273
+ type ExportExportNameKind = 'Name' |
274
+ /** `export default expression` */
275
+ 'Default' |
276
+ /** `export * from "mod" */
277
+ 'None';
274
278
  interface ExportImportName {
275
279
  kind: ExportImportNameKind;
276
280
  name: string | null;
277
281
  start: number | null;
278
282
  end: number | null;
279
283
  }
280
- type ExportImportNameKind = /** `export { name } */'Name' | /** `export * as ns from "mod"` */'All' | /** `export * from "mod"` */'AllButDefault' | /** Does not have a specifier. */'None';
284
+ type ExportImportNameKind = 'Name' |
285
+ /** `export * as ns from "mod"` */
286
+ 'All' |
287
+ /** `export * from "mod"` */
288
+ 'AllButDefault' |
289
+ /** Does not have a specifier. */
290
+ 'None';
281
291
  interface ExportLocalName {
282
292
  kind: ExportLocalNameKind;
283
293
  name: string | null;
284
294
  start: number | null;
285
295
  end: number | null;
286
296
  }
287
- type ExportLocalNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' |
297
+ type ExportLocalNameKind = 'Name' |
298
+ /** `export default expression` */
299
+ 'Default' |
288
300
  /**
289
301
  * If the exported value is not locally accessible from within the module.
290
302
  * `export default function () {}`
@@ -296,7 +308,11 @@ interface ImportName {
296
308
  start: number | null;
297
309
  end: number | null;
298
310
  }
299
- type ImportNameKind = /** `import { x } from "mod"` */'Name' | /** `import * as ns from "mod"` */'NamespaceObject' | /** `import defaultExport from "mod"` */'Default';
311
+ type ImportNameKind = 'Name' |
312
+ /** `import * as ns from "mod"` */
313
+ 'NamespaceObject' |
314
+ /** `import defaultExport from "mod"` */
315
+ 'Default';
300
316
  interface ParserOptions {
301
317
  /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
302
318
  lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
@@ -816,18 +832,7 @@ interface DecoratorOptions {
816
832
  */
817
833
  strictNullChecks?: boolean;
818
834
  }
819
- type HelperMode =
820
- /**
821
- * Runtime mode (default): Helper functions are imported from a runtime package.
822
- *
823
- * Example:
824
- *
825
- * ```js
826
- * import helperName from "@oxc-project/runtime/helpers/helperName";
827
- * helperName(...arguments);
828
- * ```
829
- */
830
- 'Runtime' |
835
+ type HelperMode = 'Runtime' |
831
836
  /**
832
837
  * External mode: Helper functions are accessed from a global `babelHelpers` object.
833
838
  *
@@ -1663,17 +1668,17 @@ interface BindingEsmExternalRequirePluginConfig {
1663
1668
  external: Array<BindingStringOrRegex>;
1664
1669
  skipDuplicateCheck?: boolean;
1665
1670
  }
1666
- interface BindingHmrBoundaryOutput {
1667
- boundary: string;
1668
- acceptedVia: string;
1669
- }
1670
1671
  type BindingHmrUpdate = {
1671
1672
  type: 'Patch';
1672
1673
  code: string;
1673
1674
  filename: string;
1674
1675
  sourcemap?: string;
1675
- sourcemapFilename?: string;
1676
- hmrBoundaries: Array<BindingHmrBoundaryOutput>;
1676
+ sourcemapFilename?: string; /**
1677
+ * Stable ids of the changed modules — the `changedIds` of the push envelope.
1678
+ * The client walks from these on its own graph.
1679
+ */
1680
+ changedIds: Array<string>; /** Per-client envelope sequence number. */
1681
+ seq: number;
1677
1682
  } | {
1678
1683
  type: 'FullReload';
1679
1684
  reason?: string;
@@ -1700,6 +1705,14 @@ interface BindingIndentOptions {
1700
1705
  interface BindingIsolatedDeclarationPluginConfig {
1701
1706
  stripInternal?: boolean;
1702
1707
  }
1708
+ /**
1709
+ * The client-facing slice of a lazy-compile result. The carried modules and
1710
+ * stamps stay server-side as the engine's pending-payload entry.
1711
+ */
1712
+ interface BindingLazyChunkOutput {
1713
+ code: string;
1714
+ filename: string;
1715
+ }
1703
1716
  interface BindingLogLocation {
1704
1717
  /** 1-based */
1705
1718
  line: number;
@@ -1738,8 +1751,7 @@ interface BindingPluginContextResolveOptions {
1738
1751
  }
1739
1752
  declare enum BindingRebuildStrategy {
1740
1753
  Always = 0,
1741
- Auto = 1,
1742
- Never = 2
1754
+ Never = 1
1743
1755
  }
1744
1756
  interface BindingReplacePluginConfig {
1745
1757
  values: Record<string, string>;
@@ -1956,4 +1968,4 @@ interface ViteImportGlobMeta {
1956
1968
  isSubImportsPattern?: boolean;
1957
1969
  }
1958
1970
  //#endregion
1959
- export { ExternalMemoryStatus as A, ResolveResult as B, BindingViteManifestPluginConfig as C, BindingViteResolvePluginConfig as D, BindingViteReporterPluginConfig as E, MinifyResult as F, isolatedDeclaration as G, SourceMap as H, NapiResolveOptions as I, isolatedDeclarationSync as K, ParseResult as L, IsolatedDeclarationsResult as M, JsxOptions as N, BindingViteTransformPluginConfig as O, MinifyOptions as P, ParserOptions as R, BindingViteJsonPluginConfig as S, BindingViteReactRefreshWrapperPluginConfig as T, TransformOptions as U, ResolverFactory as V, TsconfigCache as W, BindingTsconfigRawOptions as _, BindingEnhancedTransformOptions as a, BindingViteDynamicImportVarsPluginConfig as b, BindingHookResolveIdExtraArgs as c, BindingPluginContextResolveOptions as d, BindingRebuildStrategy as f, BindingTsconfigCompilerOptions as g, BindingTransformHookExtraArgs as h, BindingClientHmrUpdate as i, IsolatedDeclarationsOptions as j, BindingWatcherBundler as k, BindingIsolatedDeclarationPluginConfig as l, BindingReplacePluginConfig as m, BindingBundleAnalyzerPluginConfig as n, BindingEnhancedTransformResult as o, BindingRenderedChunk as p, moduleRunnerTransform as q, BindingBundleState as r, BindingEsmExternalRequirePluginConfig as s, BindingBuiltinPluginName as t, BindingMagicString as u, BindingTsconfigResult as v, BindingViteModulePreloadPolyfillPluginConfig as w, BindingViteImportGlobPluginConfig as x, BindingViteBuildImportAnalysisPluginConfig as y, PreRenderedChunk as z };
1971
+ export { BindingWatcherBundler as A, PreRenderedChunk as B, BindingViteJsonPluginConfig as C, BindingViteReporterPluginConfig as D, BindingViteReactRefreshWrapperPluginConfig as E, MinifyOptions as F, TsconfigCache as G, ResolverFactory as H, MinifyResult as I, moduleRunnerTransform as J, isolatedDeclaration as K, NapiResolveOptions as L, IsolatedDeclarationsOptions as M, IsolatedDeclarationsResult as N, BindingViteResolvePluginConfig as O, JsxOptions as P, ParseResult as R, BindingViteImportGlobPluginConfig as S, BindingViteModulePreloadPolyfillPluginConfig as T, SourceMap as U, ResolveResult as V, TransformOptions as W, BindingTsconfigCompilerOptions as _, BindingEnhancedTransformOptions as a, BindingViteBuildImportAnalysisPluginConfig as b, BindingHookResolveIdExtraArgs as c, BindingMagicString as d, BindingPluginContextResolveOptions as f, BindingTransformHookExtraArgs as g, BindingReplacePluginConfig as h, BindingClientHmrUpdate as i, ExternalMemoryStatus as j, BindingViteTransformPluginConfig as k, BindingIsolatedDeclarationPluginConfig as l, BindingRenderedChunk as m, BindingBundleAnalyzerPluginConfig as n, BindingEnhancedTransformResult as o, BindingRebuildStrategy as p, isolatedDeclarationSync as q, BindingBundleState as r, BindingEsmExternalRequirePluginConfig as s, BindingBuiltinPluginName as t, BindingLazyChunkOutput as u, BindingTsconfigRawOptions as v, BindingViteManifestPluginConfig as w, BindingViteDynamicImportVarsPluginConfig as x, BindingTsconfigResult as y, ParserOptions as z };