File tree 7 files changed +196
-175
lines changed
7 files changed +196
-175
lines changed Original file line number Diff line number Diff line change 68
68
"playwright-chromium" : " ^1.50.1" ,
69
69
"premove" : " ^4.0.0" ,
70
70
"prettier" : " 3.5.3" ,
71
- "rollup" : " ^4.30.1 " ,
71
+ "rollup" : " ^4.34.9 " ,
72
72
"rollup-plugin-esbuild" : " ^6.2.1" ,
73
73
"simple-git-hooks" : " ^2.11.1" ,
74
74
"tslib" : " ^2.8.1" ,
Original file line number Diff line number Diff line change 88
88
"esbuild" : " ^0.25.0" ,
89
89
"picomatch" : " ^4.0.2" ,
90
90
"postcss" : " ^8.5.3" ,
91
- "rollup" : " ^4.30.1 " ,
91
+ "rollup" : " ^4.34.9 " ,
92
92
"tinyglobby" : " ^0.2.12"
93
93
},
94
94
"optionalDependencies" : {
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ export type {
211
211
GeneralImportGlobOptions ,
212
212
KnownAsTypeMap ,
213
213
} from 'types/importGlob'
214
- export type { ChunkMetadata } from 'types/metadata'
214
+ export type { ChunkMetadata , CustomPluginOptionsVite } from 'types/metadata'
215
215
216
216
// dep types
217
217
export type {
Original file line number Diff line number Diff line change @@ -327,24 +327,6 @@ export interface Plugin<A = any> extends RollupPlugin<A> {
327
327
>
328
328
}
329
329
330
- export interface CustomPluginOptionsVite {
331
- /**
332
- * If this is a CSS Rollup module, you can scope to its importer's exports
333
- * so that if those exports are treeshaken away, the CSS module will also
334
- * be treeshaken.
335
- *
336
- * The "importerId" must import the CSS Rollup module statically.
337
- *
338
- * Example config if the CSS id is `/src/App.vue?vue&type=style&lang.css`:
339
- * ```js
340
- * cssScopeTo: ['/src/App.vue', 'default']
341
- * ```
342
- *
343
- * @experimental
344
- */
345
- cssScopeTo ?: [ importerId : string , exportName : string | undefined ]
346
- }
347
-
348
330
export type HookHandler < T > = T extends ObjectHook < infer H > ? H : T
349
331
350
332
export type PluginWithRequiredHook < K extends keyof Plugin > = Plugin & {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import type {
38
38
TransformAttributeResult as LightningCssTransformAttributeResult ,
39
39
TransformResult as LightningCssTransformResult ,
40
40
} from 'lightningcss'
41
+ import type { CustomPluginOptionsVite } from 'types/metadata'
41
42
import { getCodeWithSourcemap , injectSourcesContent } from '../server/sourcemap'
42
43
import type { EnvironmentModuleNode } from '../server/moduleGraph'
43
44
import {
@@ -55,7 +56,7 @@ import {
55
56
SPECIAL_QUERY_RE ,
56
57
} from '../constants'
57
58
import type { ResolvedConfig } from '../config'
58
- import type { CustomPluginOptionsVite , Plugin } from '../plugin'
59
+ import type { Plugin } from '../plugin'
59
60
import { checkPublicFile } from '../publicDir'
60
61
import {
61
62
arraify ,
@@ -656,11 +657,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
656
657
657
658
// If this CSS is scoped to its importers exports, check if those importers exports
658
659
// are rendered in the chunks. If they are not, we can skip bundling this CSS.
659
- const cssScopeTo = (
660
- this . getModuleInfo ( id ) ?. meta ?. vite as
661
- | CustomPluginOptionsVite
662
- | undefined
663
- ) ?. cssScopeTo
660
+ const cssScopeTo = this . getModuleInfo ( id ) ?. meta ?. vite ?. cssScopeTo
664
661
if (
665
662
cssScopeTo &&
666
663
! isCssScopeToRendered ( cssScopeTo , renderedModules )
Original file line number Diff line number Diff line change @@ -3,8 +3,30 @@ export interface ChunkMetadata {
3
3
importedCss : Set < string >
4
4
}
5
5
6
+ export interface CustomPluginOptionsVite {
7
+ /**
8
+ * If this is a CSS Rollup module, you can scope to its importer's exports
9
+ * so that if those exports are treeshaken away, the CSS module will also
10
+ * be treeshaken.
11
+ *
12
+ * The "importerId" must import the CSS Rollup module statically.
13
+ *
14
+ * Example config if the CSS id is `/src/App.vue?vue&type=style&lang.css`:
15
+ * ```js
16
+ * cssScopeTo: ['/src/App.vue', 'default']
17
+ * ```
18
+ *
19
+ * @experimental
20
+ */
21
+ cssScopeTo ?: [ importerId : string , exportName : string | undefined ]
22
+ }
23
+
6
24
declare module 'rollup' {
7
25
export interface RenderedChunk {
8
26
viteMetadata ?: ChunkMetadata
9
27
}
28
+
29
+ export interface CustomPluginOptions {
30
+ vite ?: CustomPluginOptionsVite
31
+ }
10
32
}
You can’t perform that action at this time.
0 commit comments