Skip to content

Commit

Permalink
refactor!: remove exporting internal APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Oct 11, 2023
1 parent 261633a commit 62ae743
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
13 changes: 3 additions & 10 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ import { resolveSSROptions } from './ssr'
const debug = createDebugger('vite:config')
const promisifiedRealpath = promisify(fs.realpath)

export type {
RenderBuiltAssetUrl,
ModulePreloadOptions,
ResolvedModulePreloadOptions,
ResolveModulePreloadDependenciesFn,
} from './build'

// NOTE: every export in this file is re-exported from ./index.ts so it will
// be part of the public API.

Expand Down Expand Up @@ -327,7 +320,7 @@ export interface LegacyOptions {
*/
}

export interface ResolveWorkerOptions extends PluginHookUtils {
export interface ResolvedWorkerOptions extends PluginHookUtils {
format: 'es' | 'iife'
plugins: Plugin[]
rollupOptions: RollupOptions
Expand Down Expand Up @@ -377,7 +370,7 @@ export type ResolvedConfig = Readonly<
optimizeDeps: DepOptimizationOptions
/** @internal */
packageCache: PackageCache
worker: ResolveWorkerOptions
worker: ResolvedWorkerOptions
appType: AppType
experimental: ExperimentalOptions
} & PluginHookUtils
Expand Down Expand Up @@ -682,7 +675,7 @@ export async function resolveConfig(
...workerPostPlugins,
]
workerConfig = await runConfigHook(workerConfig, workerUserPlugins, configEnv)
const resolvedWorkerOptions: ResolveWorkerOptions = {
const resolvedWorkerOptions: ResolvedWorkerOptions = {
format: workerConfig.worker?.format || 'iife',
plugins: [],
rollupOptions: workerConfig.worker?.rollupOptions || {},
Expand Down
31 changes: 26 additions & 5 deletions packages/vite/src/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import type * as Rollup from 'rollup'

export type { Rollup }
export * from './config'
export {
defineConfig,
loadConfigFromFile,
resolveConfig,
sortUserPlugins,
} from './config'
export { createServer } from './server'
export { preview } from './preview'
export { build } from './build'
Expand All @@ -14,6 +19,23 @@ export { buildErrorMessage } from './server/middlewares/error'
export * from './publicUtils'

// additional types
export type {
AppType,
ConfigEnv,
ExperimentalOptions,
InlineConfig,
LegacyOptions,
PluginHookUtils,
PluginOption,
ResolveFn,
ResolvedWorkerOptions,
ResolvedConfig,
UserConfig,
UserConfigExport,
UserConfigFn,
UserConfigFnObject,
UserConfigFnPromise,
} from './config'
export type { FilterPattern } from './utils'
export type { CorsOptions, CorsOrigin, CommonServerOptions } from './http'
export type {
Expand All @@ -30,6 +52,9 @@ export type {
LibraryFormats,
RenderBuiltAssetUrl,
ResolvedBuildOptions,
ModulePreloadOptions,
ResolvedModulePreloadOptions,
ResolveModulePreloadDependenciesFn,
} from './build'
export type {
PreviewOptions,
Expand All @@ -40,11 +65,7 @@ export type {
export type {
DepOptimizationMetadata,
DepOptimizationOptions,
DepOptimizationConfig,
DepOptimizationResult,
DepOptimizationProcessing,
OptimizedDepInfo,
DepsOptimizer,
ExportsData,
} from './optimizer'
export type {
Expand Down

0 comments on commit 62ae743

Please sign in to comment.