@rollipop/rolldown 0.0.0-beta.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 (44) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +11 -0
  3. package/bin/cli.mjs +3 -0
  4. package/dist/cli-setup.d.mts +1 -0
  5. package/dist/cli-setup.mjs +17 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.mjs +1581 -0
  8. package/dist/config.d.mts +10 -0
  9. package/dist/config.mjs +14 -0
  10. package/dist/experimental-index.d.mts +239 -0
  11. package/dist/experimental-index.mjs +299 -0
  12. package/dist/experimental-runtime-types.d.ts +92 -0
  13. package/dist/filter-index.d.mts +4 -0
  14. package/dist/filter-index.mjs +369 -0
  15. package/dist/get-log-filter.d.mts +7 -0
  16. package/dist/get-log-filter.mjs +48 -0
  17. package/dist/index.d.mts +4 -0
  18. package/dist/index.mjs +38 -0
  19. package/dist/parallel-plugin-worker.d.mts +1 -0
  20. package/dist/parallel-plugin-worker.mjs +32 -0
  21. package/dist/parallel-plugin.d.mts +14 -0
  22. package/dist/parallel-plugin.mjs +7 -0
  23. package/dist/parse-ast-index.d.mts +8 -0
  24. package/dist/parse-ast-index.mjs +4 -0
  25. package/dist/plugins-index.d.mts +31 -0
  26. package/dist/plugins-index.mjs +40 -0
  27. package/dist/shared/binding-DmMMxMk0.mjs +584 -0
  28. package/dist/shared/binding-kAegJ1Bj.d.mts +1775 -0
  29. package/dist/shared/bindingify-input-options-D0BAGfk2.mjs +1622 -0
  30. package/dist/shared/constructors-F44lhsH3.d.mts +30 -0
  31. package/dist/shared/constructors-Rl_oLd2F.mjs +67 -0
  32. package/dist/shared/define-config-BF4P-Pum.mjs +7 -0
  33. package/dist/shared/define-config-DJ1-iIdx.d.mts +2562 -0
  34. package/dist/shared/load-config-BEpugZky.mjs +114 -0
  35. package/dist/shared/logging-DsnCZi19.d.mts +42 -0
  36. package/dist/shared/logs-cyjC0SDv.mjs +183 -0
  37. package/dist/shared/misc-DpjTMcQQ.mjs +22 -0
  38. package/dist/shared/normalize-string-or-regex-DbTZ9prS.mjs +670 -0
  39. package/dist/shared/parse-ast-index-BuuhACPk.mjs +99 -0
  40. package/dist/shared/prompt-5sWCM0jm.mjs +847 -0
  41. package/dist/shared/rolldown-build-viDZfkdI.mjs +2292 -0
  42. package/dist/shared/rolldown-il0-nWH9.mjs +11 -0
  43. package/dist/shared/watch-BSdMzY6q.mjs +352 -0
  44. package/package.json +128 -0
@@ -0,0 +1,10 @@
1
+ import "./shared/binding-kAegJ1Bj.mjs";
2
+ import { r as defineConfig, t as ConfigExport } from "./shared/define-config-DJ1-iIdx.mjs";
3
+
4
+ //#region src/utils/load-config.d.ts
5
+ declare function loadConfig(configPath: string): Promise<ConfigExport>;
6
+ //#endregion
7
+ //#region src/config.d.ts
8
+ declare const VERSION: string;
9
+ //#endregion
10
+ export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,14 @@
1
+ import "./shared/binding-DmMMxMk0.mjs";
2
+ import { x as version } from "./shared/normalize-string-or-regex-DbTZ9prS.mjs";
3
+ import "./shared/rolldown-build-viDZfkdI.mjs";
4
+ import "./shared/bindingify-input-options-D0BAGfk2.mjs";
5
+ import "./shared/parse-ast-index-BuuhACPk.mjs";
6
+ import "./shared/rolldown-il0-nWH9.mjs";
7
+ import { t as defineConfig } from "./shared/define-config-BF4P-Pum.mjs";
8
+ import { t as loadConfig } from "./shared/load-config-BEpugZky.mjs";
9
+
10
+ //#region src/config.ts
11
+ const VERSION = version;
12
+
13
+ //#endregion
14
+ export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,239 @@
1
+ import { $ as transformSync, B as ParserOptions, C as BindingViteManifestPluginConfig, G as TransformResult, H as ResolveResult, I as MinifyOptions, J as isolatedDeclarationSync, K as createTokioRuntime, L as MinifyResult, N as IsolatedDeclarationsOptions, O as BindingViteTransformPluginConfig, P as IsolatedDeclarationsResult, Q as transform, R as NapiResolveOptions, U as ResolverFactory, W as TransformOptions, X as minifySync, Y as minify, Z as moduleRunnerTransform, _ as BindingViteCssPostPluginConfig, b as BindingViteHtmlPluginConfig, c as BindingRebuildStrategy, f as BindingUrlResolver, g as BindingViteCssPluginConfig, m as BindingViteAssetPluginConfig, n as BindingBundleState, q as isolatedDeclaration, r as BindingClientHmrUpdate, z as ParseResult } from "./shared/binding-kAegJ1Bj.mjs";
2
+ import { Et as OutputOptions, F as SourceMapInput, Ft as RolldownOutput, G as defineParallelPlugin, I as OutputBundle, K as MinimalPluginContext, Lt as freeExternalMemory, M as BuiltinPlugin, Mt as OutputChunk, c as InputOptions, nt as NormalizedOutputOptions } from "./shared/define-config-DJ1-iIdx.mjs";
3
+ import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./shared/constructors-F44lhsH3.mjs";
4
+
5
+ //#region src/api/dev/dev-options.d.ts
6
+ type DevOnHmrUpdates = (result: Error | {
7
+ updates: BindingClientHmrUpdate[];
8
+ changedFiles: string[];
9
+ }) => void | Promise<void>;
10
+ type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
11
+ interface DevWatchOptions {
12
+ /**
13
+ * If `true`, files are not written to disk.
14
+ * @default false
15
+ */
16
+ skipWrite?: boolean;
17
+ /**
18
+ * If `true`, use polling instead of native file system events for watching.
19
+ * @default false
20
+ */
21
+ usePolling?: boolean;
22
+ /**
23
+ * Poll interval in milliseconds (only used when usePolling is true).
24
+ * @default 100
25
+ */
26
+ pollInterval?: number;
27
+ /**
28
+ * If `true`, use debounced watcher. If `false`, use non-debounced watcher for immediate responses.
29
+ * @default true
30
+ */
31
+ useDebounce?: boolean;
32
+ /**
33
+ * Debounce duration in milliseconds (only used when useDebounce is true).
34
+ * @default 10
35
+ */
36
+ debounceDuration?: number;
37
+ /**
38
+ * Whether to compare file contents for poll-based watchers (only used when usePolling is true).
39
+ * When enabled, poll watchers will check file contents to determine if they actually changed.
40
+ * @default false
41
+ */
42
+ compareContentsForPolling?: boolean;
43
+ /**
44
+ * Tick rate in milliseconds for debounced watchers (only used when useDebounce is true).
45
+ * Controls how frequently the debouncer checks for events to process.
46
+ * When not specified, the debouncer will auto-select an appropriate tick rate (1/4 of the debounce duration).
47
+ * @default undefined (auto-select)
48
+ */
49
+ debounceTickRate?: number;
50
+ }
51
+ interface DevOptions {
52
+ onHmrUpdates?: DevOnHmrUpdates;
53
+ onOutput?: DevOnOutput;
54
+ /**
55
+ * Strategy for triggering rebuilds after HMR updates.
56
+ * - `'always'`: Always trigger a rebuild after HMR updates
57
+ * - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
58
+ * - `'never'`: Never trigger rebuild after HMR updates (default)
59
+ * @default 'auto'
60
+ */
61
+ rebuildStrategy?: "always" | "auto" | "never";
62
+ watch?: DevWatchOptions;
63
+ }
64
+ //#endregion
65
+ //#region src/api/dev/dev-engine.d.ts
66
+ declare class DevEngine {
67
+ #private;
68
+ static create(inputOptions: InputOptions, outputOptions?: OutputOptions, devOptions?: DevOptions): Promise<DevEngine>;
69
+ private constructor();
70
+ run(): Promise<void>;
71
+ ensureCurrentBuildFinish(): Promise<void>;
72
+ getBundleState(): Promise<BindingBundleState>;
73
+ ensureLatestBuildOutput(): Promise<void>;
74
+ invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
75
+ registerModules(clientId: string, modules: string[]): Promise<void>;
76
+ removeClient(clientId: string): Promise<void>;
77
+ close(): Promise<void>;
78
+ /**
79
+ * Compile a lazy entry module and return HMR-style patch code.
80
+ *
81
+ * This is called when a dynamically imported module is first requested at runtime.
82
+ * The module was previously stubbed with a proxy, and now we need to compile the
83
+ * actual module and its dependencies.
84
+ *
85
+ * @param moduleId - The absolute file path of the module to compile
86
+ * @param clientId - The client ID requesting this compilation
87
+ * @returns The compiled JavaScript code as a string (HMR patch format)
88
+ */
89
+ compileEntry(moduleId: string, clientId: string): Promise<string>;
90
+ }
91
+ //#endregion
92
+ //#region src/api/dev/index.d.ts
93
+ declare const dev: typeof DevEngine.create;
94
+ //#endregion
95
+ //#region src/api/experimental.d.ts
96
+ /**
97
+ * This is an experimental API. Its behavior may change in the future.
98
+ *
99
+ * - Calling this API will only execute the `scan/build` stage of rolldown.
100
+ * - `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.
101
+ *
102
+ * @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
103
+ * ```ts
104
+ * import { scan } from '@rollipop/rolldown/api/experimental';
105
+ *
106
+ * const cleanupPromise = await scan(...);
107
+ * await cleanupPromise;
108
+ * // Now all resources have been cleaned up.
109
+ * ```
110
+ */
111
+ declare const scan: (rawInputOptions: InputOptions, rawOutputOptions?: {}) => Promise<Promise<void>>;
112
+ //#endregion
113
+ //#region src/utils/parse.d.ts
114
+ /**
115
+ * Parse asynchronously.
116
+ *
117
+ * Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
118
+ */
119
+ declare function parse(filename: string, sourceText: string, options?: ParserOptions | null): Promise<ParseResult>;
120
+ /** Parse synchronously. */
121
+ declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | null): ParseResult;
122
+ //#endregion
123
+ //#region src/builtin-plugin/alias-plugin.d.ts
124
+ type ViteAliasPluginConfig = {
125
+ entries: {
126
+ find: string | RegExp;
127
+ replacement: string;
128
+ }[];
129
+ };
130
+ declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
131
+ //#endregion
132
+ //#region src/builtin-plugin/asset-plugin.d.ts
133
+ declare function viteAssetPlugin(config: BindingViteAssetPluginConfig): BuiltinPlugin;
134
+ //#endregion
135
+ //#region src/builtin-plugin/transform-plugin.d.ts
136
+ type TransformPattern = string | RegExp | readonly (RegExp | string)[];
137
+ type TransformPluginConfig = Omit<BindingViteTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude" | "yarnPnp"> & {
138
+ include?: TransformPattern;
139
+ exclude?: TransformPattern;
140
+ jsxRefreshInclude?: TransformPattern;
141
+ jsxRefreshExclude?: TransformPattern;
142
+ };
143
+ declare function viteTransformPlugin(config: TransformPluginConfig): BuiltinPlugin;
144
+ //#endregion
145
+ //#region src/builtin-plugin/vite-css-plugin.d.ts
146
+ type ViteCssPluginConfig = Omit<BindingViteCssPluginConfig, "compileCSS"> & {
147
+ compileCSS: (url: string, importer: string, resolver: BindingUrlResolver) => Promise<{
148
+ code: string;
149
+ map?: SourceMapInput;
150
+ modules?: Record<string, string>;
151
+ deps?: Set<string>;
152
+ }>;
153
+ };
154
+ declare function viteCSSPlugin(config: ViteCssPluginConfig): BuiltinPlugin;
155
+ //#endregion
156
+ //#region src/builtin-plugin/vite-css-post-plugin.d.ts
157
+ type ViteCssPostPluginConfig = Omit<BindingViteCssPostPluginConfig, "cssScopeTo" | "isLegacy"> & {
158
+ isOutputOptionsForLegacyChunks?: (outputOptions: NormalizedOutputOptions) => boolean;
159
+ };
160
+ declare function viteCSSPostPlugin(config: ViteCssPostPluginConfig): BuiltinPlugin;
161
+ //#endregion
162
+ //#region src/builtin-plugin/vite-html-plugin.d.ts
163
+ interface HtmlTagDescriptor {
164
+ tag: string;
165
+ /**
166
+ * attribute values will be escaped automatically if needed
167
+ */
168
+ attrs?: Record<string, string | boolean | undefined>;
169
+ children?: string | HtmlTagDescriptor[];
170
+ /**
171
+ * default: 'head-prepend'
172
+ */
173
+ injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
174
+ }
175
+ type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
176
+ html: string;
177
+ tags: HtmlTagDescriptor[];
178
+ };
179
+ type IndexHtmlTransformHook = (this: MinimalPluginContext, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
180
+ interface IndexHtmlTransformContext {
181
+ /**
182
+ * public path when served
183
+ */
184
+ path: string;
185
+ /**
186
+ * filename on disk
187
+ */
188
+ filename: string;
189
+ bundle?: OutputBundle;
190
+ chunk?: OutputChunk;
191
+ }
192
+ interface ViteHtmlPluginOptions extends Omit<BindingViteHtmlPluginConfig, "transformIndexHtml" | "setModuleSideEffects"> {
193
+ preHooks: IndexHtmlTransformHook[];
194
+ normalHooks: IndexHtmlTransformHook[];
195
+ postHooks: IndexHtmlTransformHook[];
196
+ applyHtmlTransforms: (html: string, hooks: IndexHtmlTransformHook[], pluginContext: MinimalPluginContext, ctx: IndexHtmlTransformContext) => Promise<string>;
197
+ }
198
+ declare function viteHtmlPlugin(config: ViteHtmlPluginOptions): BuiltinPlugin;
199
+ //#endregion
200
+ //#region src/builtin-plugin/vite-manifest-plugin.d.ts
201
+ type ViteManifestPluginConfig = Omit<BindingViteManifestPluginConfig, "isLegacy"> & {
202
+ isOutputOptionsForLegacyChunks?: (outputOptions: NormalizedOutputOptions) => boolean;
203
+ };
204
+ declare function viteManifestPlugin(config: ViteManifestPluginConfig): BuiltinPlugin;
205
+ //#endregion
206
+ //#region src/experimental-index.d.ts
207
+ /**
208
+ * In-memory file system for browser builds.
209
+ *
210
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
211
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
212
+ *
213
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
214
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
215
+ *
216
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * import { memfs } from '@rollipop/rolldown/experimental';
221
+ *
222
+ * // Write files to virtual filesystem before bundling
223
+ * memfs?.volume.fromJSON({
224
+ * '/src/index.js': 'export const foo = 42;',
225
+ * '/package.json': '{"name": "my-app"}'
226
+ * });
227
+ *
228
+ * // Read files from the virtual filesystem
229
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
230
+ * ```
231
+ *
232
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
233
+ */
234
+ declare const memfs: {
235
+ fs: any;
236
+ volume: any;
237
+ } | undefined;
238
+ //#endregion
239
+ export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type MinifyOptions, type MinifyResult, type ParseResult, type ParserOptions, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, type ViteHtmlPluginOptions, createTokioRuntime, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, parse, parseSync, scan, transform, transformSync, viteAliasPlugin, viteAssetImportMetaUrlPlugin, viteAssetPlugin, viteBuildImportAnalysisPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlInlineProxyPlugin, viteHtmlPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWasmHelperPlugin, viteWebWorkerPostPlugin };
@@ -0,0 +1,299 @@
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-DmMMxMk0.mjs";
2
+ import { d as bindingifySourcemap, n as BuiltinPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput } from "./shared/normalize-string-or-regex-DbTZ9prS.mjs";
3
+ import { l as PluginDriver, n as createBundlerOptions, s as validateOption, t as RolldownBuild } from "./shared/rolldown-build-viDZfkdI.mjs";
4
+ import { o as normalizeBindingResult, s as unwrapBindingResult } from "./shared/bindingify-input-options-D0BAGfk2.mjs";
5
+ import { i as parseSync, r as parse } from "./shared/parse-ast-index-BuuhACPk.mjs";
6
+ import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./shared/constructors-Rl_oLd2F.mjs";
7
+ import { pathToFileURL } from "node:url";
8
+
9
+ //#region src/api/dev/dev-engine.ts
10
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
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" ? import_binding.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding.BindingRebuildStrategy.Auto : import_binding.BindingRebuildStrategy.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 import_binding.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
+
102
+ //#endregion
103
+ //#region src/api/dev/index.ts
104
+ const dev = (...args) => DevEngine.create(...args);
105
+
106
+ //#endregion
107
+ //#region src/types/external-memory-handle.ts
108
+ const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
109
+ /**
110
+ * Frees the external memory held by the given handle.
111
+ *
112
+ * This is useful when you want to manually release memory held by Rust objects
113
+ * (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
114
+ *
115
+ * @param handle - The object with external memory to free
116
+ * @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
117
+ * This will take time to copy data from Rust to JavaScript, but prevents errors
118
+ * when accessing properties after the memory is freed.
119
+ * @returns Status object with `freed` boolean and optional `reason` string.
120
+ * - `{ freed: true }` if memory was successfully freed
121
+ * - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * import { freeExternalMemory } from '@rollipop/rolldown/experimental';
126
+ *
127
+ * const output = await bundle.generate();
128
+ * const chunk = output.output[0];
129
+ *
130
+ * // Use the chunk...
131
+ *
132
+ * // Manually free the memory (fast, but accessing properties after will throw)
133
+ * const status = freeExternalMemory(chunk); // { freed: true }
134
+ * const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
135
+ *
136
+ * // Keep data alive before freeing (slower, but data remains accessible)
137
+ * freeExternalMemory(chunk, true); // Evaluates all lazy fields first
138
+ * console.log(chunk.code); // OK - data was copied to JavaScript before freeing
139
+ *
140
+ * // Without keepDataAlive, accessing chunk properties after freeing will throw an error
141
+ * ```
142
+ */
143
+ function freeExternalMemory(handle, keepDataAlive = false) {
144
+ return handle[symbolForExternalMemoryHandle](keepDataAlive);
145
+ }
146
+
147
+ //#endregion
148
+ //#region src/api/experimental.ts
149
+ /**
150
+ * This is an experimental API. Its behavior may change in the future.
151
+ *
152
+ * - Calling this API will only execute the `scan/build` stage of rolldown.
153
+ * - `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.
154
+ *
155
+ * @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
156
+ * ```ts
157
+ * import { scan } from '@rollipop/rolldown/api/experimental';
158
+ *
159
+ * const cleanupPromise = await scan(...);
160
+ * await cleanupPromise;
161
+ * // Now all resources have been cleaned up.
162
+ * ```
163
+ */
164
+ const scan = async (rawInputOptions, rawOutputOptions = {}) => {
165
+ validateOption("input", rawInputOptions);
166
+ validateOption("output", rawOutputOptions);
167
+ const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false);
168
+ const bundler = new import_binding.BindingBundler();
169
+ if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
170
+ async function cleanup() {
171
+ await bundler.close();
172
+ await ret.stopWorkers?.();
173
+ (0, import_binding.shutdownAsyncRuntime)();
174
+ RolldownBuild.asyncRuntimeShutdown = true;
175
+ }
176
+ let cleanupPromise = Promise.resolve();
177
+ try {
178
+ unwrapBindingResult(await bundler.scan(ret.bundlerOptions));
179
+ } catch (err) {
180
+ await cleanup();
181
+ throw err;
182
+ } finally {
183
+ cleanupPromise = cleanup();
184
+ }
185
+ return cleanupPromise;
186
+ };
187
+
188
+ //#endregion
189
+ //#region src/plugin/parallel-plugin.ts
190
+ function defineParallelPlugin(pluginPath) {
191
+ return (options) => {
192
+ return { _parallel: {
193
+ fileUrl: pathToFileURL(pluginPath).href,
194
+ options
195
+ } };
196
+ };
197
+ }
198
+
199
+ //#endregion
200
+ //#region src/builtin-plugin/alias-plugin.ts
201
+ function viteAliasPlugin(config) {
202
+ return new BuiltinPlugin("builtin:vite-alias", config);
203
+ }
204
+
205
+ //#endregion
206
+ //#region src/builtin-plugin/asset-plugin.ts
207
+ function viteAssetPlugin(config) {
208
+ return new BuiltinPlugin("builtin:vite-asset", config);
209
+ }
210
+
211
+ //#endregion
212
+ //#region src/builtin-plugin/transform-plugin.ts
213
+ function viteTransformPlugin(config) {
214
+ return new BuiltinPlugin("builtin:vite-transform", {
215
+ ...config,
216
+ include: normalizedStringOrRegex(config.include),
217
+ exclude: normalizedStringOrRegex(config.exclude),
218
+ jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
219
+ jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude),
220
+ yarnPnp: typeof process === "object" && !!process.versions?.pnp
221
+ });
222
+ }
223
+
224
+ //#endregion
225
+ //#region src/builtin-plugin/vite-css-plugin.ts
226
+ function viteCSSPlugin(config) {
227
+ return new BuiltinPlugin("builtin:vite-css", config ? {
228
+ ...config,
229
+ async compileCSS(url, importer, resolver) {
230
+ let result = await config.compileCSS(url, importer, resolver);
231
+ return {
232
+ ...result,
233
+ map: bindingifySourcemap(result.map)
234
+ };
235
+ }
236
+ } : void 0);
237
+ }
238
+
239
+ //#endregion
240
+ //#region src/builtin-plugin/vite-css-post-plugin.ts
241
+ function viteCSSPostPlugin(config) {
242
+ return new BuiltinPlugin("builtin:vite-css-post", config);
243
+ }
244
+
245
+ //#endregion
246
+ //#region src/builtin-plugin/vite-html-plugin.ts
247
+ function viteHtmlPlugin(config) {
248
+ return new BuiltinPlugin("builtin:vite-html", config);
249
+ }
250
+
251
+ //#endregion
252
+ //#region src/builtin-plugin/vite-manifest-plugin.ts
253
+ function viteManifestPlugin(config) {
254
+ return new BuiltinPlugin("builtin:vite-manifest", config);
255
+ }
256
+
257
+ //#endregion
258
+ //#region src/experimental-index.ts
259
+ /**
260
+ * In-memory file system for browser builds.
261
+ *
262
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
263
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
264
+ *
265
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
266
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
267
+ *
268
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * import { memfs } from '@rollipop/rolldown/experimental';
273
+ *
274
+ * // Write files to virtual filesystem before bundling
275
+ * memfs?.volume.fromJSON({
276
+ * '/src/index.js': 'export const foo = 42;',
277
+ * '/package.json': '{"name": "my-app"}'
278
+ * });
279
+ *
280
+ * // Read files from the virtual filesystem
281
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
282
+ * ```
283
+ *
284
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
285
+ */
286
+ const memfs = void 0;
287
+
288
+ //#endregion
289
+ var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
290
+ var ResolverFactory = import_binding.ResolverFactory;
291
+ var createTokioRuntime = import_binding.createTokioRuntime;
292
+ var isolatedDeclaration = import_binding.isolatedDeclaration;
293
+ var isolatedDeclarationSync = import_binding.isolatedDeclarationSync;
294
+ var minify = import_binding.minify;
295
+ var minifySync = import_binding.minifySync;
296
+ var moduleRunnerTransform = import_binding.moduleRunnerTransform;
297
+ var transform = import_binding.transform;
298
+ var transformSync = import_binding.transformSync;
299
+ export { BindingRebuildStrategy, DevEngine, ResolverFactory, createTokioRuntime, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, parse, parseSync, scan, transform, transformSync, viteAliasPlugin, viteAssetImportMetaUrlPlugin, viteAssetPlugin, viteBuildImportAnalysisPlugin, viteCSSPlugin, viteCSSPostPlugin, viteHtmlInlineProxyPlugin, viteHtmlPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWasmHelperPlugin, viteWebWorkerPostPlugin };
@@ -0,0 +1,92 @@
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
+ */
9
+ constructor(messenger: Messenger);
10
+ messenger: Messenger;
11
+ /**
12
+ * @type {Record<string, Module>}
13
+ */
14
+ modules: Record<string, Module>;
15
+ /**
16
+ * @param {string} _moduleId
17
+ */
18
+ createModuleHotContext(_moduleId: string): void;
19
+ /**
20
+ * @param {[string, string][]} _boundaries
21
+ */
22
+ applyUpdates(_boundaries: [string, string][]): void;
23
+ /**
24
+ * @param {string} id
25
+ * @param {{ exports: any }} exportsHolder
26
+ */
27
+ registerModule(id: string, exportsHolder: {
28
+ exports: any;
29
+ }): void;
30
+ /**
31
+ * @param {string} id
32
+ */
33
+ loadExports(id: string): any;
34
+ /**
35
+ * __esmMin
36
+ *
37
+ * @type {<T>(fn: any, res: T) => () => T}
38
+ * @internal
39
+ */
40
+ createEsmInitializer: <T>(fn: any, res: T) => () => T;
41
+ /**
42
+ * __commonJSMin
43
+ *
44
+ * @type {<T extends { exports: any }>(cb: any, mod: { exports: any }) => () => T}
45
+ * @internal
46
+ */
47
+ createCjsInitializer: <T extends {
48
+ exports: any;
49
+ }>(cb: any, mod: {
50
+ exports: any;
51
+ }) => () => T;
52
+ /** @internal */
53
+ __toESM: any;
54
+ /** @internal */
55
+ __toCommonJS: any;
56
+ /** @internal */
57
+ __exportAll: any;
58
+ /**
59
+ * @param {boolean} [isNodeMode]
60
+ * @returns {(mod: any) => any}
61
+ * @internal
62
+ */
63
+ __toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
64
+ /** @internal */
65
+ __reExport: any;
66
+ sendModuleRegisteredMessage: (module: string) => void;
67
+ }
68
+ export type DevRuntimeMessage = {
69
+ type: "hmr:module-registered";
70
+ modules: string[];
71
+ };
72
+ export type Messenger = {
73
+ send(message: DevRuntimeMessage): void;
74
+ };
75
+ declare class Module {
76
+ /**
77
+ * @param {string} id
78
+ */
79
+ constructor(id: string);
80
+ /**
81
+ * @type {{ exports: any }}
82
+ */
83
+ exportsHolder: {
84
+ exports: any;
85
+ };
86
+ /**
87
+ * @type {string}
88
+ */
89
+ id: string;
90
+ get exports(): any;
91
+ }
92
+ export {};
@@ -0,0 +1,4 @@
1
+ import "./shared/binding-kAegJ1Bj.mjs";
2
+ import { j as withFilter } from "./shared/define-config-DJ1-iIdx.mjs";
3
+ export * from "@rollipop/rolldown-pluginutils/filter";
4
+ export { withFilter };