Skip to content

Commit

Permalink
chore: tweak types
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 20, 2024
1 parent 73aabf1 commit 485512c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import type {
OutputChunk,
OutputOptions,
RenderedChunk,
RolldownBuild,
RolldownOptions,
RolldownOutput,
RolldownPlugin,
RollupBuild,
RollupError,
RollupLog,
RollupOptions,
RollupOutput,
// RollupWatcher,
// WatcherOptions,
} from 'rolldown'
Expand Down Expand Up @@ -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`
*/
Expand Down Expand Up @@ -544,7 +544,7 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{
*/
export async function build(
inlineConfig: InlineConfig = {},
): Promise<RollupOutput | RollupOutput[] /* | RollupWatcher */> {
): Promise<RolldownOutput | RolldownOutput[] /* | RollupWatcher */> {
const builder = await createBuilder(inlineConfig, true)
const environment = Object.values(builder.environments)[0]
if (!environment) throw new Error('No environment found')
Expand Down Expand Up @@ -572,7 +572,7 @@ function resolveConfigToBuild(
**/
async function buildEnvironment(
environment: BuildEnvironment,
): Promise<RollupOutput | RollupOutput[] /* | RollupWatcher */> {
): Promise<RolldownOutput | RolldownOutput[] /* | RollupWatcher */> {
const { root, packageCache } = environment.config
const options = environment.config.build
const libOptions = options.lib
Expand Down Expand Up @@ -632,7 +632,7 @@ async function buildEnvironment(
injectEnvironmentToHooks(environment, chunkMetadataMap, p),
)

const rollupOptions: RollupOptions = {
const rollupOptions: RolldownOptions = {
// preserveEntrySignatures: ssr
// ? 'allow-extension'
// : libOptions
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -1553,7 +1553,7 @@ export interface ViteBuilder {
buildApp(): Promise<void>
build(
environment: BuildEnvironment,
): Promise<RollupOutput | RollupOutput[] /* | RollupWatcher */>
): Promise<RolldownOutput | RolldownOutput[] /* | RollupWatcher */>
}

export interface BuilderOptions {
Expand Down
10 changes: 5 additions & 5 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -434,7 +434,7 @@ export interface UserConfig extends DefaultEnvironmentOptions {
* Rollup options to build worker bundle
*/
rollupOptions?: Omit<
RollupOptions,
RolldownOptions,
'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'
>
}
Expand Down Expand Up @@ -537,7 +537,7 @@ export interface LegacyOptions {
export interface ResolvedWorkerOptions {
format: 'es' | 'iife'
plugins: (bundleChain: string[]) => Promise<ResolvedConfig>
rollupOptions: RollupOptions
rollupOptions: RolldownOptions
}

export interface InlineConfig extends UserConfig {
Expand Down Expand Up @@ -975,10 +975,10 @@ function resolveDepOptimizationOptions(
optimizeDeps.rollupOptions.output ??= {}

const setResolveOptions = <
T extends keyof Exclude<RollupOptions['resolve'], undefined>,
T extends keyof Exclude<RolldownOptions['resolve'], undefined>,
>(
key: T,
value: Exclude<RollupOptions['resolve'], undefined>[T],
value: Exclude<RolldownOptions['resolve'], undefined>[T],
) => {
if (
value !== undefined &&
Expand Down
12 changes: 6 additions & 6 deletions packages/vite/src/node/optimizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -97,9 +97,9 @@ export interface DepOptimizationConfig {
* https://esbuild.github.io/api
*/
esbuildOptions?: DepsOptimizerEsbuildOptions
rollupOptions?: Omit<RollupOptions, 'input' | 'logLevel' | 'output'> & {
rollupOptions?: Omit<RolldownOptions, 'input' | 'logLevel' | 'output'> & {
output?: Omit<
RollupOutputOptions,
RolldownOutputOptions,
'format' | 'sourcemap' | 'dir' | 'banner'
>
}
Expand Down Expand Up @@ -702,7 +702,7 @@ async function prepareRolldownOptimizerRun(
processingCacheDir: string,
optimizerContext: { cancelled: boolean },
): Promise<{
context?: { build: () => Promise<RollupOutput>; cancel: () => void }
context?: { build: () => Promise<RolldownOutput>; cancel: () => void }
idToExports: Record<string, ExportsData>
}> {
// esbuild generates nested directory output with lowest common ancestor base
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function optimizerResolvePlugin(
name: 'vite:resolve-dev',
...({
apply: 'serve',
} satisfies Plugin),
} satisfies Partial<Plugin>),
resolveId: {
filter: {
id: {
Expand Down

0 comments on commit 485512c

Please sign in to comment.