Skip to content

Commit 8d0eb77

Browse files
committed
chore: tweak types
1 parent 332845c commit 8d0eb77

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

packages/vite/src/node/build.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import type {
1111
OutputChunk,
1212
OutputOptions,
1313
RenderedChunk,
14+
RolldownBuild,
15+
RolldownOptions,
16+
RolldownOutput,
1417
RolldownPlugin,
15-
RollupBuild,
1618
RollupError,
1719
RollupLog,
18-
RollupOptions,
19-
RollupOutput,
2020
// RollupWatcher,
2121
// WatcherOptions,
2222
} from 'rolldown'
@@ -186,7 +186,7 @@ export interface BuildEnvironmentOptions {
186186
* Will be merged with internal rollup options.
187187
* https://rollupjs.org/configuration-options/
188188
*/
189-
rollupOptions?: RollupOptions
189+
rollupOptions?: RolldownOptions
190190
/**
191191
* Options to pass on to `@rollup/plugin-commonjs`
192192
*/
@@ -526,7 +526,7 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{
526526
*/
527527
export async function build(
528528
inlineConfig: InlineConfig = {},
529-
): Promise<RollupOutput | RollupOutput[] /* | RollupWatcher */> {
529+
): Promise<RolldownOutput | RolldownOutput[] /* | RollupWatcher */> {
530530
const builder = await createBuilder(inlineConfig, true)
531531
const environment = Object.values(builder.environments)[0]
532532
if (!environment) throw new Error('No environment found')
@@ -554,7 +554,7 @@ function resolveConfigToBuild(
554554
**/
555555
async function buildEnvironment(
556556
environment: BuildEnvironment,
557-
): Promise<RollupOutput | RollupOutput[] /* | RollupWatcher */> {
557+
): Promise<RolldownOutput | RolldownOutput[] /* | RollupWatcher */> {
558558
const { root, packageCache } = environment.config
559559
const options = environment.config.build
560560
const libOptions = options.lib
@@ -614,7 +614,7 @@ async function buildEnvironment(
614614
injectEnvironmentToHooks(environment, chunkMetadataMap, p),
615615
)
616616

617-
const rollupOptions: RollupOptions = {
617+
const rollupOptions: RolldownOptions = {
618618
// preserveEntrySignatures: ssr
619619
// ? 'allow-extension'
620620
// : libOptions
@@ -700,7 +700,7 @@ async function buildEnvironment(
700700
environment.name === 'ssr' &&
701701
environment.getTopLevelConfig().ssr?.target === 'webworker'
702702

703-
let bundle: RollupBuild | undefined
703+
let bundle: RolldownBuild | undefined
704704
let startTime: number | undefined
705705
try {
706706
const buildOutputOptions = (output: OutputOptions = {}): OutputOptions => {
@@ -851,7 +851,7 @@ async function buildEnvironment(
851851
prepareOutDir(resolvedOutDirs, emptyOutDir, environment)
852852
}
853853

854-
const res: RollupOutput[] = []
854+
const res: RolldownOutput[] = []
855855
for (const output of normalizedOutputs) {
856856
res.push(await bundle[options.write ? 'write' : 'generate'](output))
857857
}
@@ -1542,7 +1542,7 @@ export interface ViteBuilder {
15421542
buildApp(): Promise<void>
15431543
build(
15441544
environment: BuildEnvironment,
1545-
): Promise<RollupOutput | RollupOutput[] /* | RollupWatcher */>
1545+
): Promise<RolldownOutput | RolldownOutput[] /* | RollupWatcher */>
15461546
}
15471547

15481548
export interface BuilderOptions {

packages/vite/src/node/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createRequire } from 'node:module'
88
import colors from 'picocolors'
99
import type { Alias, AliasOptions } from 'dep-types/alias'
1010
import { rolldown } from 'rolldown'
11-
import type { OutputChunk, RollupOptions } from 'rolldown'
11+
import type { OutputChunk, RolldownOptions } from 'rolldown'
1212
import picomatch from 'picomatch'
1313
import type { AnymatchFn } from '../types/anymatch'
1414
import { withTrailingSlash } from '../shared/utils'
@@ -435,7 +435,7 @@ export interface UserConfig extends DefaultEnvironmentOptions {
435435
* Rollup options to build worker bundle
436436
*/
437437
rollupOptions?: Omit<
438-
RollupOptions,
438+
RolldownOptions,
439439
'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'
440440
>
441441
}
@@ -538,7 +538,7 @@ export interface LegacyOptions {
538538
export interface ResolvedWorkerOptions {
539539
format: 'es' | 'iife'
540540
plugins: (bundleChain: string[]) => Promise<ResolvedConfig>
541-
rollupOptions: RollupOptions
541+
rollupOptions: RolldownOptions
542542
}
543543

544544
export interface InlineConfig extends UserConfig {
@@ -972,10 +972,10 @@ function resolveDepOptimizationOptions(
972972
optimizeDeps.rollupOptions.output ??= {}
973973

974974
const setResolveOptions = <
975-
T extends keyof Exclude<RollupOptions['resolve'], undefined>,
975+
T extends keyof Exclude<RolldownOptions['resolve'], undefined>,
976976
>(
977977
key: T,
978-
value: Exclude<RollupOptions['resolve'], undefined>[T],
978+
value: Exclude<RolldownOptions['resolve'], undefined>[T],
979979
) => {
980980
if (
981981
value !== undefined &&

packages/vite/src/node/optimizer/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import colors from 'picocolors'
77
import { init, parse } from 'es-module-lexer'
88
import { isDynamicPattern } from 'tinyglobby'
99
import {
10-
type RollupOptions,
11-
type RollupOutput,
12-
type OutputOptions as RollupOutputOptions,
10+
type RolldownOptions,
11+
type RolldownOutput,
12+
type OutputOptions as RolldownOutputOptions,
1313
rolldown,
1414
} from 'rolldown'
1515
import type { DepsOptimizerEsbuildOptions } from 'types/internal/esbuildOptions'
@@ -97,9 +97,9 @@ export interface DepOptimizationConfig {
9797
* https://esbuild.github.io/api
9898
*/
9999
esbuildOptions?: DepsOptimizerEsbuildOptions
100-
rollupOptions?: Omit<RollupOptions, 'input' | 'logLevel' | 'output'> & {
100+
rollupOptions?: Omit<RolldownOptions, 'input' | 'logLevel' | 'output'> & {
101101
output?: Omit<
102-
RollupOutputOptions,
102+
RolldownOutputOptions,
103103
'format' | 'sourcemap' | 'dir' | 'banner'
104104
>
105105
}
@@ -702,7 +702,7 @@ async function prepareRolldownOptimizerRun(
702702
processingCacheDir: string,
703703
optimizerContext: { cancelled: boolean },
704704
): Promise<{
705-
context?: { build: () => Promise<RollupOutput>; cancel: () => void }
705+
context?: { build: () => Promise<RolldownOutput>; cancel: () => void }
706706
idToExports: Record<string, ExportsData>
707707
}> {
708708
// esbuild generates nested directory output with lowest common ancestor base

packages/vite/src/node/plugins/resolve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function optimizerResolvePlugin(
335335
name: 'vite:resolve-dev',
336336
...({
337337
apply: 'serve',
338-
} satisfies Plugin),
338+
} satisfies Partial<Plugin>),
339339
resolveId: {
340340
filter: {
341341
id: {

0 commit comments

Comments
 (0)