experimental-index.d.mts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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-DUEnSb0A.mjs";
  2. import { Jt as freeExternalMemory, Kt as RolldownOutput, Lt as OutputOptions, N as BuiltinPlugin, X as defineParallelPlugin, c as InputOptions, st as NormalizedOutputOptions } from "./shared/define-config-DhJZwTRw.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-Kz3D2LbX.mjs";
  4. import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-DYemMpPL.mjs";
  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 '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/builtin-plugin/alias-plugin.d.ts
  114. type ViteAliasPluginConfig = {
  115. entries: {
  116. find: string | RegExp;
  117. replacement: string;
  118. }[];
  119. };
  120. declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
  121. //#endregion
  122. //#region src/builtin-plugin/bundle-analyzer-plugin.d.ts
  123. /**
  124. * A plugin that analyzes bundle composition and generates detailed reports.
  125. *
  126. * The plugin outputs a file containing detailed information about:
  127. * - All chunks and their relationships
  128. * - Modules bundled in each chunk
  129. * - Import dependencies between chunks
  130. * - Reachable modules from each entry point
  131. *
  132. * @example
  133. * ```js
  134. * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
  135. *
  136. * export default {
  137. * plugins: [
  138. * bundleAnalyzerPlugin()
  139. * ]
  140. * }
  141. * ```
  142. *
  143. * @example
  144. * **Custom filename**
  145. * ```js
  146. * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
  147. *
  148. * export default {
  149. * plugins: [
  150. * bundleAnalyzerPlugin({
  151. * fileName: 'bundle-analysis.json'
  152. * })
  153. * ]
  154. * }
  155. * ```
  156. *
  157. * @example
  158. * **LLM-friendly markdown output**
  159. * ```js
  160. * import { bundleAnalyzerPlugin } from 'rolldown/experimental';
  161. *
  162. * export default {
  163. * plugins: [
  164. * bundleAnalyzerPlugin({
  165. * format: 'md'
  166. * })
  167. * ]
  168. * }
  169. * ```
  170. */
  171. declare function bundleAnalyzerPlugin(config?: BindingBundleAnalyzerPluginConfig): BuiltinPlugin;
  172. //#endregion
  173. //#region src/builtin-plugin/transform-plugin.d.ts
  174. type TransformPattern = string | RegExp | readonly (RegExp | string)[];
  175. type TransformPluginConfig = Omit<BindingViteTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude" | "yarnPnp"> & {
  176. include?: TransformPattern;
  177. exclude?: TransformPattern;
  178. jsxRefreshInclude?: TransformPattern;
  179. jsxRefreshExclude?: TransformPattern;
  180. };
  181. declare function viteTransformPlugin(config: TransformPluginConfig): BuiltinPlugin;
  182. //#endregion
  183. //#region src/builtin-plugin/vite-manifest-plugin.d.ts
  184. type ViteManifestPluginConfig = Omit<BindingViteManifestPluginConfig, "isLegacy"> & {
  185. isOutputOptionsForLegacyChunks?: (outputOptions: NormalizedOutputOptions) => boolean;
  186. };
  187. declare function viteManifestPlugin(config: ViteManifestPluginConfig): BuiltinPlugin;
  188. //#endregion
  189. //#region src/experimental-index.d.ts
  190. /**
  191. * In-memory file system for browser builds.
  192. *
  193. * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
  194. * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
  195. *
  196. * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
  197. * - `volume`: The underlying `Volume` instance that stores the filesystem state
  198. *
  199. * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
  200. *
  201. * @example
  202. * ```typescript
  203. * import { memfs } from 'rolldown/experimental';
  204. *
  205. * // Write files to virtual filesystem before bundling
  206. * memfs?.volume.fromJSON({
  207. * '/src/index.js': 'export const foo = 42;',
  208. * '/package.json': '{"name": "my-app"}'
  209. * });
  210. *
  211. * // Read files from the virtual filesystem
  212. * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
  213. * ```
  214. *
  215. * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
  216. */
  217. declare const memfs: {
  218. fs: any;
  219. volume: any;
  220. } | undefined;
  221. /** @deprecated Use from `rolldown/utils` instead. */
  222. declare const parse: typeof parse$1;
  223. /** @deprecated Use from `rolldown/utils` instead. */
  224. declare const parseSync: typeof parseSync$1;
  225. /** @deprecated Use from `rolldown/utils` instead. */
  226. type ParseResult = ParseResult$1;
  227. /** @deprecated Use from `rolldown/utils` instead. */
  228. type ParserOptions = ParserOptions$1;
  229. /** @deprecated Use from `rolldown/utils` instead. */
  230. declare const minify: typeof minify$1;
  231. /** @deprecated Use from `rolldown/utils` instead. */
  232. declare const minifySync: typeof minifySync$1;
  233. /** @deprecated Use from `rolldown/utils` instead. */
  234. type MinifyOptions = MinifyOptions$1;
  235. /** @deprecated Use from `rolldown/utils` instead. */
  236. type MinifyResult = MinifyResult$1;
  237. /** @deprecated Use from `rolldown/utils` instead. */
  238. declare const transform: typeof transform$1;
  239. /** @deprecated Use from `rolldown/utils` instead. */
  240. declare const transformSync: typeof transformSync$1;
  241. /** @deprecated Use from `rolldown/utils` instead. */
  242. type TransformOptions = TransformOptions$1;
  243. /** @deprecated Use from `rolldown/utils` instead. */
  244. type TransformResult = TransformResult$1;
  245. /** @deprecated Use from `rolldown/utils` instead. */
  246. declare const TsconfigCache: typeof TsconfigCache$1;
  247. /** @deprecated Use from `rolldown/utils` instead. */
  248. type TsconfigRawOptions = BindingTsconfigRawOptions;
  249. /** @deprecated Use from `rolldown/utils` instead. */
  250. type TsconfigCompilerOptions = BindingTsconfigCompilerOptions;
  251. //#endregion
  252. export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, TransformOptions, TransformResult, TsconfigCache, TsconfigCompilerOptions, TsconfigRawOptions, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };