@@ -10,7 +10,7 @@ import { is_global, is_unscoped_pseudo_class } from './utils.js';
10
10
* @typedef {{
11
11
* keyframes: string[];
12
12
* rule: AST.CSS.Rule | null;
13
- * has_global: { value: boolean }; // need an object since state is spread
13
+ * analysis: ComponentAnalysis;
14
14
* }} CssState
15
15
*/
16
16
@@ -57,7 +57,7 @@ const css_visitors = {
57
57
context . state . keyframes . push ( node . prelude ) ;
58
58
} else if ( node . prelude . startsWith ( '-global-' ) ) {
59
59
// we don't check if the block.children.length because the keyframe is still added even if empty
60
- context . state . has_global . value ||= is_unscoped ( context . path ) ;
60
+ context . state . analysis . css . has_global ||= is_unscoped ( context . path ) ;
61
61
}
62
62
}
63
63
@@ -276,7 +276,7 @@ const css_visitors = {
276
276
// if this rule has a ComplexSelector whose RelativeSelector children are all
277
277
// `:global(...)`, and the rule contains declarations (rather than just
278
278
// nested rules) then the component as a whole includes global CSS
279
- context . state . has_global . value ||=
279
+ context . state . analysis . css . has_global ||=
280
280
node . metadata . has_global_selectors &&
281
281
node . block . children . filter ( ( child ) => child . type === 'Declaration' ) . length > 0 &&
282
282
is_unscoped ( context . path ) ;
@@ -324,10 +324,8 @@ export function analyze_css(stylesheet, analysis) {
324
324
const css_state = {
325
325
keyframes : analysis . css . keyframes ,
326
326
rule : null ,
327
- // we need to use an object since state is spread
328
- has_global : { value : false }
327
+ analysis
329
328
} ;
330
329
331
330
walk ( stylesheet , css_state , css_visitors ) ;
332
- analysis . css . has_global = css_state . has_global . value ;
333
331
}
0 commit comments