Skip to content

Commit

Permalink
fix(metadata): expose viteMetadata type (#11511)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jan 4, 2023
1 parent 8972868 commit 32dee3c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
9 changes: 1 addition & 8 deletions packages/vite/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ export type {
CSSModulesOptions,
PreprocessCSSResult,
} from './plugins/css'
export type { ChunkMetadata } from './plugins/metadata'
export type { JsonOptions } from './plugins/json'
export type { TransformOptions as EsbuildTransformOptions } from 'esbuild'
export type { ESBuildOptions, ESBuildTransformResult } from './plugins/esbuild'
export type { Manifest, ManifestChunk } from './plugins/manifest'
export type { ResolveOptions, InternalResolveOptions } from './plugins/resolve'
export type { SplitVendorChunkCache } from './plugins/splitVendorChunk'
import type { ChunkMetadata } from './plugins/metadata'

export type {
WebSocketServer,
Expand Down Expand Up @@ -119,6 +117,7 @@ export type {
GeneralImportGlobOptions,
KnownAsTypeMap,
} from 'types/importGlob'
export type { ChunkMetadata } from 'types/metadata'

// dep types
export type {
Expand All @@ -140,9 +139,3 @@ export type { Terser } from 'dep-types/terser'
export type { RollupCommonJSOptions } from 'dep-types/commonjs'
export type { RollupDynamicImportVarsOptions } from 'dep-types/dynamicImportVars'
export type { Matcher, AnymatchPattern, AnymatchFn } from 'dep-types/anymatch'

declare module 'rollup' {
export interface RenderedChunk {
viteMetadata: ChunkMetadata
}
}
5 changes: 0 additions & 5 deletions packages/vite/src/node/plugins/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import type { Plugin } from '../plugin'

export interface ChunkMetadata {
importedAssets: Set<string>
importedCss: Set<string>
}

/**
* Prepares the rendered chunks to contain additional metadata during build.
*/
Expand Down
10 changes: 10 additions & 0 deletions packages/vite/types/metadata.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface ChunkMetadata {
importedAssets: Set<string>
importedCss: Set<string>
}

declare module 'rollup' {
export interface RenderedChunk {
viteMetadata: ChunkMetadata
}
}

0 comments on commit 32dee3c

Please sign in to comment.