Skip to content

Commit bc851e3

Browse files
authoredJan 23, 2025··
fix: change ResolvedConfig type to interface to allow extending it (#19210)
1 parent d0c3523 commit bc851e3

File tree

2 files changed

+83
-82
lines changed

2 files changed

+83
-82
lines changed
 

‎packages/vite/rollup.dts.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ const identifierReplacements: Record<string, Record<string, string>> = {
5151
PluginContext$1: 'rollup.PluginContext',
5252
MinimalPluginContext$1: 'rollup.MinimalPluginContext',
5353
TransformPluginContext$1: 'rollup.TransformPluginContext',
54-
TransformResult$2: 'rollup.TransformResult',
54+
TransformResult$1: 'rollup.TransformResult',
5555
},
5656
esbuild: {
57-
TransformResult$1: 'esbuild_TransformResult',
57+
TransformResult$2: 'esbuild_TransformResult',
5858
TransformOptions$1: 'esbuild_TransformOptions',
5959
BuildOptions$1: 'esbuild_BuildOptions',
6060
},

‎packages/vite/src/node/config.ts

+81-80
Original file line numberDiff line numberDiff line change
@@ -549,86 +549,87 @@ export interface InlineConfig extends UserConfig {
549549
envFile?: false
550550
}
551551

552-
export type ResolvedConfig = Readonly<
553-
Omit<
554-
UserConfig,
555-
| 'plugins'
556-
| 'css'
557-
| 'json'
558-
| 'assetsInclude'
559-
| 'optimizeDeps'
560-
| 'worker'
561-
| 'build'
562-
| 'dev'
563-
| 'environments'
564-
| 'server'
565-
| 'preview'
566-
> & {
567-
configFile: string | undefined
568-
configFileDependencies: string[]
569-
inlineConfig: InlineConfig
570-
root: string
571-
base: string
572-
/** @internal */
573-
decodedBase: string
574-
/** @internal */
575-
rawBase: string
576-
publicDir: string
577-
cacheDir: string
578-
command: 'build' | 'serve'
579-
mode: string
580-
isWorker: boolean
581-
// in nested worker bundle to find the main config
582-
/** @internal */
583-
mainConfig: ResolvedConfig | null
584-
/** @internal list of bundle entry id. used to detect recursive worker bundle. */
585-
bundleChain: string[]
586-
isProduction: boolean
587-
envDir: string
588-
env: Record<string, any>
589-
resolve: Required<ResolveOptions> & {
590-
alias: Alias[]
591-
}
592-
plugins: readonly Plugin[]
593-
css: ResolvedCSSOptions
594-
json: Required<JsonOptions>
595-
esbuild: ESBuildOptions | false
596-
server: ResolvedServerOptions
597-
dev: ResolvedDevEnvironmentOptions
598-
/** @experimental */
599-
builder: ResolvedBuilderOptions | undefined
600-
build: ResolvedBuildOptions
601-
preview: ResolvedPreviewOptions
602-
ssr: ResolvedSSROptions
603-
assetsInclude: (file: string) => boolean
604-
logger: Logger
605-
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn
606-
optimizeDeps: DepOptimizationOptions
607-
/** @internal */
608-
packageCache: PackageCache
609-
worker: ResolvedWorkerOptions
610-
appType: AppType
611-
experimental: ExperimentalOptions
612-
environments: Record<string, ResolvedEnvironmentOptions>
613-
/**
614-
* The token to connect to the WebSocket server from browsers.
615-
*
616-
* We recommend using `import.meta.hot` rather than connecting
617-
* to the WebSocket server directly.
618-
* If you have a usecase that requires connecting to the WebSocket
619-
* server, please create an issue so that we can discuss.
620-
*
621-
* @deprecated
622-
*/
623-
webSocketToken: string
624-
/** @internal */
625-
fsDenyGlob: AnymatchFn
626-
/** @internal */
627-
safeModulePaths: Set<string>
628-
/** @internal */
629-
additionalAllowedHosts: string[]
630-
} & PluginHookUtils
631-
>
552+
export interface ResolvedConfig
553+
extends Readonly<
554+
Omit<
555+
UserConfig,
556+
| 'plugins'
557+
| 'css'
558+
| 'json'
559+
| 'assetsInclude'
560+
| 'optimizeDeps'
561+
| 'worker'
562+
| 'build'
563+
| 'dev'
564+
| 'environments'
565+
| 'server'
566+
| 'preview'
567+
> & {
568+
configFile: string | undefined
569+
configFileDependencies: string[]
570+
inlineConfig: InlineConfig
571+
root: string
572+
base: string
573+
/** @internal */
574+
decodedBase: string
575+
/** @internal */
576+
rawBase: string
577+
publicDir: string
578+
cacheDir: string
579+
command: 'build' | 'serve'
580+
mode: string
581+
isWorker: boolean
582+
// in nested worker bundle to find the main config
583+
/** @internal */
584+
mainConfig: ResolvedConfig | null
585+
/** @internal list of bundle entry id. used to detect recursive worker bundle. */
586+
bundleChain: string[]
587+
isProduction: boolean
588+
envDir: string
589+
env: Record<string, any>
590+
resolve: Required<ResolveOptions> & {
591+
alias: Alias[]
592+
}
593+
plugins: readonly Plugin[]
594+
css: ResolvedCSSOptions
595+
json: Required<JsonOptions>
596+
esbuild: ESBuildOptions | false
597+
server: ResolvedServerOptions
598+
dev: ResolvedDevEnvironmentOptions
599+
/** @experimental */
600+
builder: ResolvedBuilderOptions | undefined
601+
build: ResolvedBuildOptions
602+
preview: ResolvedPreviewOptions
603+
ssr: ResolvedSSROptions
604+
assetsInclude: (file: string) => boolean
605+
logger: Logger
606+
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn
607+
optimizeDeps: DepOptimizationOptions
608+
/** @internal */
609+
packageCache: PackageCache
610+
worker: ResolvedWorkerOptions
611+
appType: AppType
612+
experimental: ExperimentalOptions
613+
environments: Record<string, ResolvedEnvironmentOptions>
614+
/**
615+
* The token to connect to the WebSocket server from browsers.
616+
*
617+
* We recommend using `import.meta.hot` rather than connecting
618+
* to the WebSocket server directly.
619+
* If you have a usecase that requires connecting to the WebSocket
620+
* server, please create an issue so that we can discuss.
621+
*
622+
* @deprecated
623+
*/
624+
webSocketToken: string
625+
/** @internal */
626+
fsDenyGlob: AnymatchFn
627+
/** @internal */
628+
safeModulePaths: Set<string>
629+
/** @internal */
630+
additionalAllowedHosts: string[]
631+
} & PluginHookUtils
632+
> {}
632633

633634
// inferred ones are omitted
634635
export const configDefaults = Object.freeze({

0 commit comments

Comments
 (0)
Please sign in to comment.