| import { n as __toESM, t as require_binding } from "./shared/binding-TuFFIE_J.mjs"; |
| import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-dnh67V_w.mjs"; |
| import { o as transformToRollupOutput } from "./shared/bindingify-input-options-XPJLJOD0.mjs"; |
| import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-CtPvmZgJ.mjs"; |
| import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BHRSI0R7.mjs"; |
| import { n as parseSync$1, t as parse$1 } from "./shared/parse-D4dtlfWy.mjs"; |
| 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-D_3i7dpX.mjs"; |
| 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-DxqIJB3x.mjs"; |
| import { pathToFileURL } from "node:url"; |
| |
| var import_binding = __toESM(require_binding(), 1); |
| var DevEngine = class DevEngine { |
| #inner; |
| #cachedBuildFinishPromise = null; |
| static async create(inputOptions, outputOptions = {}, devOptions = {}) { |
| inputOptions = await PluginDriver.callOptionsHook(inputOptions); |
| const options = await createBundlerOptions(inputOptions, outputOptions, false); |
| const userOnHmrUpdates = devOptions.onHmrUpdates; |
| const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) { |
| const result = normalizeBindingResult(rawResult); |
| if (result instanceof Error) { |
| userOnHmrUpdates(result); |
| return; |
| } |
| const [updates, changedFiles] = result; |
| userOnHmrUpdates({ |
| updates, |
| changedFiles |
| }); |
| } : void 0; |
| const userOnOutput = devOptions.onOutput; |
| const bindingOnOutput = userOnOutput ? function(rawResult) { |
| const result = normalizeBindingResult(rawResult); |
| if (result instanceof Error) { |
| userOnOutput(result); |
| return; |
| } |
| userOnOutput(transformToRollupOutput(result)); |
| } : void 0; |
| const userOnAdditionalAssets = devOptions.onAdditionalAssets; |
| const bindingDevOptions = { |
| onHmrUpdates: bindingOnHmrUpdates, |
| onOutput: bindingOnOutput, |
| onAdditionalAssets: userOnAdditionalAssets ? function(output) { |
| userOnAdditionalAssets(transformToRollupOutput(output)); |
| } : void 0, |
| rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding.BindingRebuildStrategy.Auto : import_binding.BindingRebuildStrategy.Never : void 0, |
| watch: devOptions.watch && { |
| skipWrite: devOptions.watch.skipWrite, |
| usePolling: devOptions.watch.usePolling, |
| pollInterval: devOptions.watch.pollInterval, |
| useDebounce: devOptions.watch.useDebounce, |
| debounceDuration: devOptions.watch.debounceDuration, |
| compareContentsForPolling: devOptions.watch.compareContentsForPolling, |
| debounceTickRate: devOptions.watch.debounceTickRate, |
| include: normalizedStringOrRegex(devOptions.watch.include), |
| exclude: normalizedStringOrRegex(devOptions.watch.exclude) |
| } |
| }; |
| const inner = new import_binding.BindingDevEngine(options.bundlerOptions, bindingDevOptions); |
| return new DevEngine(inner); |
| } |
| constructor(inner) { |
| this.#inner = inner; |
| } |
| async run() { |
| await this.#inner.run(); |
| } |
| async ensureCurrentBuildFinish() { |
| if (this.#cachedBuildFinishPromise) return this.#cachedBuildFinishPromise; |
| const promise = this.#inner.ensureCurrentBuildFinish().then(() => { |
| this.#cachedBuildFinishPromise = null; |
| }); |
| this.#cachedBuildFinishPromise = promise; |
| return promise; |
| } |
| async getBundleState() { |
| return this.#inner.getBundleState(); |
| } |
| async ensureLatestBuildOutput() { |
| unwrapBindingResult(await this.#inner.ensureLatestBuildOutput()); |
| } |
| triggerFullBuild() { |
| this.#inner.triggerFullBuild(); |
| } |
| async invalidate(file, firstInvalidatedBy) { |
| return unwrapBindingResult(await this.#inner.invalidate(file, firstInvalidatedBy)); |
| } |
| async registerModules(clientId, modules) { |
| await this.#inner.registerModules(clientId, modules); |
| } |
| async removeClient(clientId) { |
| await this.#inner.removeClient(clientId); |
| } |
| async close() { |
| await this.#inner.close(); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async compileEntry(moduleId, clientId) { |
| return this.#inner.compileEntry(moduleId, clientId); |
| } |
| }; |
| |
| |
| const dev = (...args) => DevEngine.create(...args); |
| |
| |
| const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__"; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function freeExternalMemory(handle, keepDataAlive = false) { |
| return handle[symbolForExternalMemoryHandle](keepDataAlive); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| const scan = async (rawInputOptions, rawOutputOptions = {}) => { |
| validateOption("input", rawInputOptions); |
| validateOption("output", rawOutputOptions); |
| const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false); |
| const bundler = new import_binding.BindingBundler(); |
| if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)(); |
| async function cleanup() { |
| await bundler.close(); |
| await ret.stopWorkers?.(); |
| (0, import_binding.shutdownAsyncRuntime)(); |
| RolldownBuild.asyncRuntimeShutdown = true; |
| } |
| let cleanupPromise = Promise.resolve(); |
| try { |
| unwrapBindingResult(await bundler.scan(ret.bundlerOptions)); |
| } catch (err) { |
| await cleanup(); |
| throw err; |
| } finally { |
| cleanupPromise = cleanup(); |
| } |
| return cleanupPromise; |
| }; |
| |
| |
| function defineParallelPlugin(pluginPath) { |
| return (options) => { |
| return { _parallel: { |
| fileUrl: pathToFileURL(pluginPath).href, |
| options |
| } }; |
| }; |
| } |
| |
| |
| function viteAliasPlugin(config) { |
| return new BuiltinPlugin("builtin:vite-alias", config); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function bundleAnalyzerPlugin(config) { |
| return new BuiltinPlugin("builtin:bundle-analyzer", config); |
| } |
| |
| |
| function viteTransformPlugin(config) { |
| return new BuiltinPlugin("builtin:vite-transform", { |
| ...config, |
| include: normalizedStringOrRegex(config.include), |
| exclude: normalizedStringOrRegex(config.exclude), |
| jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude), |
| jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude), |
| yarnPnp: typeof process === "object" && !!process.versions?.pnp |
| }); |
| } |
| |
| |
| function viteManifestPlugin(config) { |
| return new BuiltinPlugin("builtin:vite-manifest", config); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| const memfs = void 0; |
| |
| const parse = parse$1; |
| |
| const parseSync = parseSync$1; |
| |
| const minify = minify$1; |
| |
| const minifySync = minifySync$1; |
| |
| const transform = transform$1; |
| |
| const transformSync = transformSync$1; |
| |
| const TsconfigCache = TsconfigCache$1; |
| |
| var BindingRebuildStrategy = import_binding.BindingRebuildStrategy; |
| var ResolverFactory = import_binding.ResolverFactory; |
| var isolatedDeclaration = import_binding.isolatedDeclaration; |
| var isolatedDeclarationSync = import_binding.isolatedDeclarationSync; |
| var moduleRunnerTransform = import_binding.moduleRunnerTransform; |
| export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWebWorkerPostPlugin }; |
|
|