diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index ffe31aef3ac5ec..dc60e00c5296fa 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -11,12 +11,12 @@ import type { OutputChunk, OutputOptions, RenderedChunk, + RolldownBuild, + RolldownOptions, + RolldownOutput, RolldownPlugin, - RollupBuild, RollupError, RollupLog, - RollupOptions, - RollupOutput, // RollupWatcher, // WatcherOptions, } from 'rolldown' @@ -187,7 +187,7 @@ export interface BuildEnvironmentOptions { * Will be merged with internal rollup options. * https://rollupjs.org/configuration-options/ */ - rollupOptions?: RollupOptions + rollupOptions?: RolldownOptions /** * Options to pass on to `@rollup/plugin-commonjs` */ @@ -544,7 +544,7 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{ */ export async function build( inlineConfig: InlineConfig = {}, -): Promise { +): Promise { const builder = await createBuilder(inlineConfig, true) const environment = Object.values(builder.environments)[0] if (!environment) throw new Error('No environment found') @@ -572,7 +572,7 @@ function resolveConfigToBuild( **/ async function buildEnvironment( environment: BuildEnvironment, -): Promise { +): Promise { const { root, packageCache } = environment.config const options = environment.config.build const libOptions = options.lib @@ -632,7 +632,7 @@ async function buildEnvironment( injectEnvironmentToHooks(environment, chunkMetadataMap, p), ) - const rollupOptions: RollupOptions = { + const rollupOptions: RolldownOptions = { // preserveEntrySignatures: ssr // ? 'allow-extension' // : libOptions @@ -714,7 +714,7 @@ async function buildEnvironment( // logger.error(e.message, { error: e }) // } - let bundle: RollupBuild | undefined + let bundle: RolldownBuild | undefined let startTime: number | undefined try { const buildOutputOptions = (output: OutputOptions = {}): OutputOptions => { @@ -862,7 +862,7 @@ async function buildEnvironment( prepareOutDir(resolvedOutDirs, emptyOutDir, environment) } - const res: RollupOutput[] = [] + const res: RolldownOutput[] = [] for (const output of normalizedOutputs) { res.push(await bundle[options.write ? 'write' : 'generate'](output)) } @@ -1553,7 +1553,7 @@ export interface ViteBuilder { buildApp(): Promise build( environment: BuildEnvironment, - ): Promise + ): Promise } export interface BuilderOptions { diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index 5ecc0f18db3bb9..acff363a43d5d8 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -8,7 +8,7 @@ import { builtinModules, createRequire } from 'node:module' import colors from 'picocolors' import type { Alias, AliasOptions } from 'dep-types/alias' import { rolldown } from 'rolldown' -import type { OutputChunk, RollupOptions } from 'rolldown' +import type { OutputChunk, RolldownOptions } from 'rolldown' import picomatch from 'picomatch' import type { AnymatchFn } from '../types/anymatch' import { withTrailingSlash } from '../shared/utils' @@ -434,7 +434,7 @@ export interface UserConfig extends DefaultEnvironmentOptions { * Rollup options to build worker bundle */ rollupOptions?: Omit< - RollupOptions, + RolldownOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures' > } @@ -537,7 +537,7 @@ export interface LegacyOptions { export interface ResolvedWorkerOptions { format: 'es' | 'iife' plugins: (bundleChain: string[]) => Promise - rollupOptions: RollupOptions + rollupOptions: RolldownOptions } export interface InlineConfig extends UserConfig { @@ -975,10 +975,10 @@ function resolveDepOptimizationOptions( optimizeDeps.rollupOptions.output ??= {} const setResolveOptions = < - T extends keyof Exclude, + T extends keyof Exclude, >( key: T, - value: Exclude[T], + value: Exclude[T], ) => { if ( value !== undefined && diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index 92fb57d5a9a9e6..7561fb9f35bb3b 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -7,9 +7,9 @@ import colors from 'picocolors' import { init, parse } from 'es-module-lexer' import { isDynamicPattern } from 'tinyglobby' import { - type RollupOptions, - type RollupOutput, - type OutputOptions as RollupOutputOptions, + type RolldownOptions, + type RolldownOutput, + type OutputOptions as RolldownOutputOptions, rolldown, } from 'rolldown' import type { DepsOptimizerEsbuildOptions } from 'types/internal/esbuildOptions' @@ -97,9 +97,9 @@ export interface DepOptimizationConfig { * https://esbuild.github.io/api */ esbuildOptions?: DepsOptimizerEsbuildOptions - rollupOptions?: Omit & { + rollupOptions?: Omit & { output?: Omit< - RollupOutputOptions, + RolldownOutputOptions, 'format' | 'sourcemap' | 'dir' | 'banner' > } @@ -702,7 +702,7 @@ async function prepareRolldownOptimizerRun( processingCacheDir: string, optimizerContext: { cancelled: boolean }, ): Promise<{ - context?: { build: () => Promise; cancel: () => void } + context?: { build: () => Promise; cancel: () => void } idToExports: Record }> { // esbuild generates nested directory output with lowest common ancestor base diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts index c85cad1378ad1a..f8892191a1bcbd 100644 --- a/packages/vite/src/node/plugins/resolve.ts +++ b/packages/vite/src/node/plugins/resolve.ts @@ -328,7 +328,7 @@ function optimizerResolvePlugin( name: 'vite:resolve-dev', ...({ apply: 'serve', - } satisfies Plugin), + } satisfies Partial), resolveId: { filter: { id: {