Skip to content

Commit 32dee3c

Browse files
authoredJan 4, 2023
fix(metadata): expose viteMetadata type (#11511)
1 parent 8972868 commit 32dee3c

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed
 

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

+1-8
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,12 @@ export type {
7373
CSSModulesOptions,
7474
PreprocessCSSResult,
7575
} from './plugins/css'
76-
export type { ChunkMetadata } from './plugins/metadata'
7776
export type { JsonOptions } from './plugins/json'
7877
export type { TransformOptions as EsbuildTransformOptions } from 'esbuild'
7978
export type { ESBuildOptions, ESBuildTransformResult } from './plugins/esbuild'
8079
export type { Manifest, ManifestChunk } from './plugins/manifest'
8180
export type { ResolveOptions, InternalResolveOptions } from './plugins/resolve'
8281
export type { SplitVendorChunkCache } from './plugins/splitVendorChunk'
83-
import type { ChunkMetadata } from './plugins/metadata'
8482

8583
export type {
8684
WebSocketServer,
@@ -119,6 +117,7 @@ export type {
119117
GeneralImportGlobOptions,
120118
KnownAsTypeMap,
121119
} from 'types/importGlob'
120+
export type { ChunkMetadata } from 'types/metadata'
122121

123122
// dep types
124123
export type {
@@ -140,9 +139,3 @@ export type { Terser } from 'dep-types/terser'
140139
export type { RollupCommonJSOptions } from 'dep-types/commonjs'
141140
export type { RollupDynamicImportVarsOptions } from 'dep-types/dynamicImportVars'
142141
export type { Matcher, AnymatchPattern, AnymatchFn } from 'dep-types/anymatch'
143-
144-
declare module 'rollup' {
145-
export interface RenderedChunk {
146-
viteMetadata: ChunkMetadata
147-
}
148-
}

‎packages/vite/src/node/plugins/metadata.ts

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import type { Plugin } from '../plugin'
22

3-
export interface ChunkMetadata {
4-
importedAssets: Set<string>
5-
importedCss: Set<string>
6-
}
7-
83
/**
94
* Prepares the rendered chunks to contain additional metadata during build.
105
*/

‎packages/vite/types/metadata.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface ChunkMetadata {
2+
importedAssets: Set<string>
3+
importedCss: Set<string>
4+
}
5+
6+
declare module 'rollup' {
7+
export interface RenderedChunk {
8+
viteMetadata: ChunkMetadata
9+
}
10+
}

0 commit comments

Comments
 (0)
Please sign in to comment.