From 642fee28f929e8292c8404d6b5190d8f3232da3e Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Sat, 31 Jul 2021 18:20:11 +0800 Subject: [PATCH 1/4] fix: _JSXStyle import is not found create imports on program enter --- src/_utils.js | 20 +++++++++++++------- src/babel-external.js | 18 +++++++++++------- src/babel.js | 14 ++++++++------ src/macro.js | 6 +++--- test/babel6/snapshots/external.js.md | 10 +++++++--- test/babel6/snapshots/external.js.snap | Bin 1503 -> 1517 bytes test/babel6/snapshots/index.js.md | 8 ++++---- test/babel6/snapshots/index.js.snap | Bin 2522 -> 2529 bytes test/fixtures/class.js | 5 ++--- test/snapshots/external.js.md | 10 +++++++--- test/snapshots/external.js.snap | Bin 1819 -> 1822 bytes test/snapshots/index.js.md | 5 ++++- test/snapshots/index.js.snap | Bin 3216 -> 3245 bytes test/snapshots/plugins.js.snap | Bin 601 -> 603 bytes 14 files changed, 59 insertions(+), 37 deletions(-) diff --git a/src/_utils.js b/src/_utils.js index 007f1dc0..0c91d609 100644 --- a/src/_utils.js +++ b/src/_utils.js @@ -1,5 +1,5 @@ import path from 'path' -import { addDefault } from '@babel/helper-module-imports'; +import { addDefault } from '@babel/helper-module-imports' import * as t from '@babel/types' import _hashString from 'string-hash' import { SourceMapGenerator } from 'source-map' @@ -258,7 +258,7 @@ export const getJSXStyleInfo = (expr, scope) => { } } -export const computeClassNames = (styles, externalJsxId) => { +export const computeClassNames = (styles, externalJsxId, styleComponent) => { if (styles.length === 0) { return { className: externalJsxId @@ -297,7 +297,7 @@ export const computeClassNames = (styles, externalJsxId) => { // _JSXStyle.dynamic([ ['1234', [props.foo, bar, fn(props)]], ... ]) const dynamic = t.callExpression( // Callee: _JSXStyle.dynamic - t.memberExpression(t.identifier(STYLE_COMPONENT), t.identifier('dynamic')), + t.memberExpression(t.identifier(styleComponent), t.identifier('dynamic')), // Arguments [ t.arrayExpression( @@ -380,7 +380,12 @@ export const cssToBabelType = css => { return t.cloneDeep(css) } -export const makeStyledJsxTag = (id, transformedCss, expressions = []) => { +export const makeStyledJsxTag = ( + id, + transformedCss, + expressions = [], + styleComponent +) => { const css = cssToBabelType(transformedCss) const attributes = [ @@ -402,8 +407,8 @@ export const makeStyledJsxTag = (id, transformedCss, expressions = []) => { } return t.jSXElement( - t.jSXOpeningElement(t.jSXIdentifier(STYLE_COMPONENT), attributes), - t.jSXClosingElement(t.jSXIdentifier(STYLE_COMPONENT)), + t.jSXOpeningElement(t.jSXIdentifier(styleComponent), attributes), + t.jSXClosingElement(t.jSXIdentifier(styleComponent)), [t.jSXExpressionContainer(css)] ) } @@ -627,7 +632,7 @@ export const createReactComponentImportDeclaration = state => { typeof state.opts.styleModule === 'string' ? state.opts.styleModule : 'styled-jsx/style', - { nameHint: STYLE_COMPONENT} + { nameHint: state.styleComponent } ) } @@ -650,6 +655,7 @@ export const setStateOptions = state => { vendorPrefixes: state.opts.vendorPrefixes }) } + state.styleComponent = STYLE_COMPONENT } export function log(message) { diff --git a/src/babel-external.js b/src/babel-external.js index 71d68d14..3a15b4e5 100644 --- a/src/babel-external.js +++ b/src/babel-external.js @@ -1,7 +1,5 @@ import * as t from '@babel/types' -import { STYLE_COMPONENT } from './_constants' - import { getJSXStyleInfo, processCss, @@ -23,7 +21,8 @@ export function processTaggedTemplateExpression({ splitRules, plugins, vendorPrefixes, - sourceMaps + sourceMaps, + styleComponent }) { const templateLiteral = path.get('quasi') let scope @@ -39,7 +38,11 @@ export function processTaggedTemplateExpression({ const stylesInfo = getJSXStyleInfo(templateLiteral, scope) - const { staticClassName, className } = computeClassNames([stylesInfo]) + const { staticClassName, className } = computeClassNames( + [stylesInfo], + undefined, + styleComponent + ) const styles = processCss( { @@ -64,7 +67,7 @@ export function processTaggedTemplateExpression({ t.objectExpression([ t.objectProperty( t.identifier('styles'), - makeStyledJsxTag(hash, css, expressions) + makeStyledJsxTag(hash, css, expressions, styleComponent) ), t.objectProperty(t.identifier('className'), className) ]) @@ -212,7 +215,8 @@ export const visitor = { : process.env.NODE_ENV === 'production', plugins: state.plugins, vendorPrefixes, - sourceMaps + sourceMaps, + styleComponent: state.styleComponent }) }) ) @@ -223,7 +227,7 @@ export const visitor = { hasJSXStyle && taggedTemplateExpressions.resolve.length > 0 && !state.hasInjectedJSXStyle && - !path.scope.hasBinding(STYLE_COMPONENT) + !path.scope.hasBinding(state.styleComponent) ) { state.hasInjectedJSXStyle = true createReactComponentImportDeclaration(state) diff --git a/src/babel.js b/src/babel.js index 6f32f170..4911c1e7 100644 --- a/src/babel.js +++ b/src/babel.js @@ -172,7 +172,8 @@ export default function({ types: t }) { if (state.styles.length > 0 || externalJsxId) { const { staticClassName, className } = computeClassNames( state.styles, - externalJsxId + externalJsxId, + state.styleComponent ) state.className = className state.staticClassName = staticClassName @@ -224,7 +225,7 @@ export default function({ types: t }) { ) { const [id, css] = state.externalStyles.shift() - path.replaceWith(makeStyledJsxTag(id, css)) + path.replaceWith(makeStyledJsxTag(id, css, [], state.styleComponent)) return } @@ -247,7 +248,9 @@ export default function({ types: t }) { splitRules }) - path.replaceWith(makeStyledJsxTag(hash, css, expressions)) + path.replaceWith( + makeStyledJsxTag(hash, css, expressions, state.styleComponent) + ) } } } @@ -285,6 +288,7 @@ export default function({ types: t }) { state.file.hasJSXStyle = false setStateOptions(state) + createReactComponentImportDeclaration(state) // we need to beat the arrow function transform and // possibly others so we traverse from here or else @@ -299,14 +303,12 @@ export default function({ types: t }) { !( state.file.hasJSXStyle && !state.hasInjectedJSXStyle && - !scope.hasBinding(STYLE_COMPONENT) + !scope.hasBinding(state.styleComponent) ) ) { return } - state.hasInjectedJSXStyle = true - createReactComponentImportDeclaration(state) } } } diff --git a/src/macro.js b/src/macro.js index daf2aa8e..40c035b9 100644 --- a/src/macro.js +++ b/src/macro.js @@ -4,7 +4,6 @@ import { setStateOptions, createReactComponentImportDeclaration } from './_utils' -import { STYLE_COMPONENT } from './_constants' export default createMacro(styledJsxMacro) @@ -94,12 +93,13 @@ function styledJsxMacro({ references, state }) { : process.env.NODE_ENV === 'production', plugins: state.plugins, vendorPrefixes: state.opts.vendorPrefixes, - sourceMaps: state.opts.sourceMaps + sourceMaps: state.opts.sourceMaps, + styleComponent: state.styleComponent }) if ( !state.hasInjectedJSXStyle && - !path.scope.hasBinding(STYLE_COMPONENT) + !path.scope.hasBinding(state.styleComponent) ) { state.hasInjectedJSXStyle = true createReactComponentImportDeclaration(state) diff --git a/test/babel6/snapshots/external.js.md b/test/babel6/snapshots/external.js.md index 7e7ce819..4fc5da3a 100644 --- a/test/babel6/snapshots/external.js.md +++ b/test/babel6/snapshots/external.js.md @@ -53,7 +53,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `const _defaultExport = ['div.jsx-2292456818{font-size:3em;}'];␊ + `import _JSXStyle from 'styled-jsx/style';␊ + const _defaultExport = ['div.jsx-2292456818{font-size:3em;}'];␊ _defaultExport.__hash = '2292456818';␊ ␊ ␊ @@ -63,7 +64,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import css from 'hell';␊ + `import _JSXStyle from 'styled-jsx/style';␊ + import css from 'hell';␊ ␊ const color = 'red';␊ ␊ @@ -157,7 +159,9 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `const _defaultExport = new String('div.jsx-2292456818{font-size:3em;}');␊ + `import _JSXStyle from 'styled-jsx/style';␊ + ␊ + const _defaultExport = new String('div.jsx-2292456818{font-size:3em;}');␊ ␊ _defaultExport.__hash = '2292456818';␊ ␊ diff --git a/test/babel6/snapshots/external.js.snap b/test/babel6/snapshots/external.js.snap index 484799805d446a45e3d915a0b6b0696fd2fc90b3..25b6ac9e73e49d373b7c7c64b6e53029aac157ff 100644 GIT binary patch literal 1517 zcmVZP@R8NalQ+}fzkYT6@Av*% zS)_?{87U0>`od=?b3c7|=52}kYU7DKO{CXur>G0zgBxF799p|}Df93f>5X-oNYCu2 zsPpPO^4A|{4ovndAO6z+CQTFRyLV93N0GIqTRrz(jn?9~-V&C6qlt96m!iHn_J=Qf zZ}j^4Pmex$<<*B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M3etOg~~_^8XGS?tbLE!-=^qlA>M( zx5U_`CjS{`wAi6HHKG8x!Spz|@qPI5c}nkd!N_1*&!@*}53xcd8cT$_pZ4q+_VsPp zk#lxkEHzQh_0pkvb2zsL_*Aa|b8f;yT(culy+^n93RyO`hYGCKtSzA5#(-=%)Fl+Y zv9zqH0S+5amxtRF^I}MXr#qekt@+Tn&LMT>AAp8&*MVq;XXJFWs-Owa=wn|BR6?A` zw85*;W5bUI8w;s6>pKNesX(a(LawL>3KUA50Ww!>!W8Gs`z{eRK!5@s1@x?jNGsir zmA!uvH28U#p0r8rT|B&r!-1ixFK+Whpno;@S^X=ELXzOIW>tbdQ-{S%!~juA*Lc~` z54RmLOh9MTd`6PEYv%gSs5-I7BC%L9&aw%>fJ1=8GPJ$x;Ksyjpk3M$a$1)3INjJz zP^8WfBL?NkXj%L`ot|v$gext3LKNG;?VM|rzNMXQ32cnn+c4}j40kcy_J-&QA=s{w zc`a=6lY_oLSi<)G&pcx|?~?7z`GZ97IylSVG}EIUcP`PRsO{G3yyiM>bw+n)99>P` z&JNJ-&Wi5VPN;uw;`g=zgzA$2IQOj9OVvIOTbX}bEtctPtcBm*{@`xM=~Kp5jT{BQ zcbsF@*maiOwzlv++TwM##oK>G*{(CHf*L#yYp5L|ppDxfrKW4JuAf)9%9u*@$mtBA z)+tR%0O^*-z@bHy;6?xFT|#~F8sqME;9F08P Snapshot 1 - `const a = () =>
␊ + `import _JSXStyle from 'styled-jsx/style';␊ + const a = () =>

hi

;` @@ -87,16 +88,15 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyle from 'styled-jsx/style';␊ + export const _StyleImport = '123';␊ export default class {␊ - ␊ render() {␊ return

test

␊ <_JSXStyle id={"2101845350"}>{"p.jsx-2101845350{color:red;}"}
;␊ }␊ - ␊ }` ## works with css tagged template literals in the same file diff --git a/test/babel6/snapshots/index.js.snap b/test/babel6/snapshots/index.js.snap index 4e102f8b3b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> zNP|o+K6Y#PcI0b1|NC^>Hg(#KR;IbDw5vp~e%3{mc1^VW0a>{VjnCcEYYvbE{Ww$+ z9-<&5tT%HJG`2if%;f&B&|cJI%8QV$@%QGXcO(xaFogwol&Q9+@II+x6Q&( zRMu!_!Lb7kXG?xj)0BEWT9+fWYR5@XD>ng|QZ(^639MGB$l(K4OO=y0<}A;J=?EQW zX+WZQ=fD?`N~(~R#eu~|lA%LvD8$mC2zftPtN=HFf$|+YhA1S%M(J>b3-L@716q@* zFtJgVLTQGMgfUZ9vQepXx-nbMJqS@#tAXk-D`qWkv2bYGuG=ysOfekK@Enc^%NvWC z+L5{v>>4gbGf|F<@H}6Iwhf~H)fMaJ>qRwA#jNAy4R&1FY-!2f4u?U1mD6uP1&XGo zJ6pRZb}546AnirKp0ZUj?8)7U!cu&cV;DMu@!e+!X8{akWz}DhB{PE-Zj9HKuiQoj zIL61UwhCHChP{kLYR7@?z8mPGOo$6b5Pq!b3DJ~XtXQ{v-N+WABRof= zh}NZOEq4MdnqCle$p8(bc7$$_wbzMu(`BPH-MDybi*W+C+j!f@WE%}!vvf4%dT4FG zRF^TsNfy^s!l4vI5W_A7MFoh7O1dHP=rY+t>Xui*+k0p`^;~^b2S++rv|I$mrVt6mC6_-fuzBW)hHH{8rdJ4=nC7?0vYIK*_2+r`vTau=uL$qun)WzgXW?Ry^8 z?MIx#f3)({(mJBo%NrASpAm0~ZU<@_qHtm;rDYg%O{oU^TH7}}gAy-mi0Zf~^tfmLZDxzF8!g3r%yAUPqxvstN zbuHd$hDoo6VaV-t`U)Q$r^9A8T9JJ

test

@@ -12,5 +12,4 @@ export default class {
) } - } diff --git a/test/snapshots/external.js.md b/test/snapshots/external.js.md index dbf9cc9f..4ea28fb3 100644 --- a/test/snapshots/external.js.md +++ b/test/snapshots/external.js.md @@ -45,7 +45,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `const _defaultExport = ["div.jsx-2292456818{font-size:3em;}"];␊ + `import _JSXStyle from "styled-jsx/style";␊ + const _defaultExport = ["div.jsx-2292456818{font-size:3em;}"];␊ _defaultExport.__hash = "2292456818";␊ module.exports = _defaultExport;` @@ -88,7 +89,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import css from 'hell';␊ + `import _JSXStyle from "styled-jsx/style";␊ + import css from 'hell';␊ const color = 'red';␊ const bar = css`␊ div {␊ @@ -166,7 +168,9 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `const _defaultExport = new String("div.jsx-2292456818{font-size:3em;}");␊ + `import _JSXStyle from "styled-jsx/style";␊ + ␊ + const _defaultExport = new String("div.jsx-2292456818{font-size:3em;}");␊ ␊ _defaultExport.__hash = "2292456818";␊ module.exports = _defaultExport;` diff --git a/test/snapshots/external.js.snap b/test/snapshots/external.js.snap index fa632efa0e4e5549d643c4d8ed201803b71ce8d4..d4963fdd89f85b5c38e460ad59b073b7d124abd1 100644 GIT binary patch literal 1822 zcmV+(2jTcZRzVmI=6R*gfCa`Qh)p|v>%HI00000000Bc zS#N9;Wf;E`iBilW1~BmH^;}pxwsyV#S-W;6LuLXAe`H`F%hDe0yS3QfmAfl!G^bHx zGK?DepfQn%1k?{2(V#}7#wcJEM1voU^2J0kF`yix}p(@`m*Nr>Uj8m&+ghzWh~m2U|b5 zoncOd?wb1MRM&;CKTd6YB{_ACCDsE=7^eM?r@q`ba^`> zIgC8_vFP|8p#{zPp-X7BROGrr5>IvRgi53Z=3n zt028;XxETBQG{SrmP&wA@aJ6jUS&K$K5_|vn8~T>7k@epmCaJF zf+oI>*!$419QEoW1}y=!ngBbjs_1A*#CM9&h<}ol2EUF$3WU=#3@Bn=Q1YlwwN_jc zo1X!g3}AF8{{yVvP*s3f1cCz6_^Rn`B|{;r25=$eil`P!xUbxIU{(?p6%3#{;3SQn z3v}L_PH)?}eK4Kw4B%*96RHc)_AKO3`|!PdDAE&)M}wT+TlqpUCqoh4GaJ(!qc`T5 z455fxlQbK4t7}LL)uSamaGWG#aBLQ5qnLx^+k`P_uh6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-$wb}eK5wqkDG&Zov@fJ+{nG&tR~Y&#vYL9THu#h5is*W02urW;)~-i_^_ z`E3>b*32fT6U;0HwcC{)x5}d#jJ6RLRvVJ$!OY{10>0 J=YVt@0049>c-H^` diff --git a/test/snapshots/index.js.md b/test/snapshots/index.js.md index 1184d75a..505964d7 100644 --- a/test/snapshots/index.js.md +++ b/test/snapshots/index.js.md @@ -63,7 +63,9 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `const a = () =>
␊ + `import _JSXStyle from "styled-jsx/style";␊ + ␊ + const a = () =>

hi

;` @@ -148,6 +150,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 `import _JSXStyle from "styled-jsx/style";␊ + export const _StyleImport = '123';␊ export default class {␊ render() {␊ return
␊ diff --git a/test/snapshots/index.js.snap b/test/snapshots/index.js.snap index 06ee7c453cfbedce68d9a6efe7b677649d7beb1f..1947d6f6bd46c2c12391c284240431afa7caefa7 100644 GIT binary patch literal 3245 zcmV;e3{vw!RzVKZCU?90ec$)q_xt(&c;D}vITav?i-~7mR+YvZhPgIzw3D6{s5-N&LxP>Pu%!s><{2uFs8Nk$sKSmI5^nH%sd0F`Q z=mWnf-ujtGqXA6)*<}PF20BmYZ-4vJ{B6|sTfa3)1Tgj2mqSgz`~BMZeSiJOsY~wO zafn}jDS)Y&D+yxf$qVlK=7Xocckd6M?SFIREBygXy(LHxzY6`dGqjpv^__lnWL zQ~*;yzndUJe*%%eTsByFdE_lU(*Mru0ZiS!hakRGy?1=?-V17rLo2U7K;9S&VCqBr z2;#S2Klh31yBA*Z`*&ZMJ^kWOAl8WbW`rQ*w~xQ|(8Kg|kGvyHkN@VJj|4DvG)@rb z5a(el2DTFyZ5s%P#gd}xc&s=*bxacm`;|iz z{h1?TzcO_&v5?zeS>mRq_u}t^{R>Bi`uD>5tHS=3Wqv=)=f!?RPs8s_p3cON3}#l2 zNR=|;g>zShAxWE=7`TCF7WRUwu#y|n7N+TpmS=Lw+|aNzGdPeLX5#4)W;70<4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ZdE+V6@`BmG}O)LpsSF#rHE CiYOrf diff --git a/test/snapshots/plugins.js.snap b/test/snapshots/plugins.js.snap index 0ecb63e064a6da88bf9d2052c81c445b32955a9c..5379cce32725f95b560ad8a7518ffdf3950b74ec 100644 GIT binary patch literal 603 zcmV-h0;K&xRzV56CbU+OqvHLbtR@Dzc~`>>{iOp()KYnbOEK)6GoRE@8mqUi=9j z_po^A-Kz(|1@R(y@*jvNk-a&YWVZ*X`9;8dVBMt{poaX zvix=bWdBh?i`RGgnnUAodGhefS?A5ULtcF?DDV4CP5b!Z$Jy@Wy!QF_#mm>H`n!Vi z{@jZ3Zm9agmUe67o90hvG~|HsV}cnNhja?cjb>t&jiO5f#(_%-4S@y9A@-ybFI0_( z$7oJCs8p)J>H*X9k9tKQmpSWk%(&T{rM80WMUJunkco{_q(B9TQYT2dbU`Vie1gMW z6*khSP+v!w3AH?K!ZsT-n=zTHk=yKtjdZiaCkM|D;?!inP?dT07i^IrK%;oQV*xHf zjP0W-wjxKish3jDjp1;D*hDyB8$kJNuede5;{Z*4x6<#!d+koA-MZV-cVG?lRofa^ zO=&O~RK?}!|4Og?@vi3SdsdW15FkaiqBT&W7r{mhC8@N7m(x%RCEz&V zT^mL=98+q;?idk0YY8GeHtVd<0#~5zz?weYs+*=VLpvB^c^8h9C*1D zUC-vUM4WRZlW6!f#AAPfS*A6k^U%e6XqI*Q>@lGuL@r%I*w7GAO7m()YiE`}p^Tz) pWouP^=fA4|IaNDshJvdr?oaBDZ@v7bC!A|m%x~Nb@fk@5006-JEy(}? literal 601 zcmV-f0;c^zRzVBs3qUkcMP;BT`flT7-HKl8~M3PRPn+C+I5V=pfl zIfwaNK!;HlKnoTE;wmGV>ll}e@QeyrES8|vfu`#nLWg3`_wj^Sp{>$X@?lI>9Sp{p zkEIQ_AX4Afsv}6mWQ7w-9KnJZ)6R!0 z25CrJnzd#AE9+VBzLV&e!_1nxr%uUOdoka@^}d6PJGwMKO{Zp|H3$`OIT08pMi^&l z!}b0Xuhjo&7CbeFgm>96|827${;$VBw;re(QT=Hxd_jEC?xC=UMvV1PdxR+`4izk9x^1l<`w=0gFvE&Nd^D_A2Jej From 0a517edad5758360bc36208f07d043274c208a66 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Sun, 1 Aug 2021 17:39:58 +0800 Subject: [PATCH 2/4] leverage generated uid from addDefault --- src/_utils.js | 34 +++++++++++++++---------- src/babel-external.js | 13 ++++------ src/babel.js | 26 ++++++++++++------- src/macro.js | 9 +++---- test/babel6/snapshots/external.js.snap | Bin 1517 -> 1526 bytes test/babel6/snapshots/index.js.md | 3 +-- test/babel6/snapshots/index.js.snap | Bin 2529 -> 2513 bytes test/babel6/snapshots/plugins.js.snap | Bin 601 -> 601 bytes test/fixtures/class.js | 1 - test/fixtures/conflicts.js | 13 ++++++++++ test/index.js | 5 ++++ test/snapshots/external.js.snap | Bin 1822 -> 1828 bytes test/snapshots/index.js.md | 14 +++++++++- test/snapshots/index.js.snap | Bin 3245 -> 3310 bytes test/snapshots/plugins.js.snap | Bin 603 -> 601 bytes 15 files changed, 77 insertions(+), 41 deletions(-) create mode 100644 test/fixtures/conflicts.js diff --git a/src/_utils.js b/src/_utils.js index 0c91d609..c0807f99 100644 --- a/src/_utils.js +++ b/src/_utils.js @@ -9,8 +9,8 @@ import transform from './lib/style-transform' import { STYLE_ATTRIBUTE, GLOBAL_ATTRIBUTE, - STYLE_COMPONENT_ID, STYLE_COMPONENT, + STYLE_COMPONENT_ID, STYLE_COMPONENT_DYNAMIC } from './_constants' @@ -258,7 +258,11 @@ export const getJSXStyleInfo = (expr, scope) => { } } -export const computeClassNames = (styles, externalJsxId, styleComponent) => { +export const computeClassNames = ( + styles, + externalJsxId, + styleComponentImportName +) => { if (styles.length === 0) { return { className: externalJsxId @@ -297,7 +301,10 @@ export const computeClassNames = (styles, externalJsxId, styleComponent) => { // _JSXStyle.dynamic([ ['1234', [props.foo, bar, fn(props)]], ... ]) const dynamic = t.callExpression( // Callee: _JSXStyle.dynamic - t.memberExpression(t.identifier(styleComponent), t.identifier('dynamic')), + t.memberExpression( + t.identifier(styleComponentImportName), + t.identifier(STYLE_COMPONENT_DYNAMIC) + ), // Arguments [ t.arrayExpression( @@ -384,7 +391,7 @@ export const makeStyledJsxTag = ( id, transformedCss, expressions = [], - styleComponent + styleComponentImportName ) => { const css = cssToBabelType(transformedCss) @@ -407,8 +414,8 @@ export const makeStyledJsxTag = ( } return t.jSXElement( - t.jSXOpeningElement(t.jSXIdentifier(styleComponent), attributes), - t.jSXClosingElement(t.jSXIdentifier(styleComponent)), + t.jSXOpeningElement(t.jSXIdentifier(styleComponentImportName), attributes), + t.jSXClosingElement(t.jSXIdentifier(styleComponentImportName)), [t.jSXExpressionContainer(css)] ) } @@ -627,13 +634,9 @@ export const booleanOption = opts => { } export const createReactComponentImportDeclaration = state => { - addDefault( - state.file.path, - typeof state.opts.styleModule === 'string' - ? state.opts.styleModule - : 'styled-jsx/style', - { nameHint: state.styleComponent } - ) + return addDefault(state.file.path, state.styleModule, { + nameHint: STYLE_COMPONENT + }).name } export const setStateOptions = state => { @@ -655,7 +658,10 @@ export const setStateOptions = state => { vendorPrefixes: state.opts.vendorPrefixes }) } - state.styleComponent = STYLE_COMPONENT + state.styleModule = + typeof state.opts.styleModule === 'string' + ? state.opts.styleModule + : 'styled-jsx/style' } export function log(message) { diff --git a/src/babel-external.js b/src/babel-external.js index 3a15b4e5..9896a9dd 100644 --- a/src/babel-external.js +++ b/src/babel-external.js @@ -8,7 +8,6 @@ import { getScope, computeClassNames, makeStyledJsxTag, - createReactComponentImportDeclaration, setStateOptions } from './_utils' @@ -22,7 +21,7 @@ export function processTaggedTemplateExpression({ plugins, vendorPrefixes, sourceMaps, - styleComponent + styleComponentImportName }) { const templateLiteral = path.get('quasi') let scope @@ -41,7 +40,7 @@ export function processTaggedTemplateExpression({ const { staticClassName, className } = computeClassNames( [stylesInfo], undefined, - styleComponent + styleComponentImportName ) const styles = processCss( @@ -67,7 +66,7 @@ export function processTaggedTemplateExpression({ t.objectExpression([ t.objectProperty( t.identifier('styles'), - makeStyledJsxTag(hash, css, expressions, styleComponent) + makeStyledJsxTag(hash, css, expressions, styleComponentImportName) ), t.objectProperty(t.identifier('className'), className) ]) @@ -216,7 +215,7 @@ export const visitor = { plugins: state.plugins, vendorPrefixes, sourceMaps, - styleComponent: state.styleComponent + styleComponentImportName: state.styleComponentImportName }) }) ) @@ -226,11 +225,9 @@ export const visitor = { if ( hasJSXStyle && taggedTemplateExpressions.resolve.length > 0 && - !state.hasInjectedJSXStyle && - !path.scope.hasBinding(state.styleComponent) + !state.hasInjectedJSXStyle ) { state.hasInjectedJSXStyle = true - createReactComponentImportDeclaration(state) } }) diff --git a/src/babel.js b/src/babel.js index 4911c1e7..66b74030 100644 --- a/src/babel.js +++ b/src/babel.js @@ -17,8 +17,6 @@ import { setStateOptions } from './_utils' -import { STYLE_COMPONENT } from './_constants' - export default function({ types: t }) { const jsxVisitors = { JSXOpeningElement(path, state) { @@ -43,7 +41,7 @@ export default function({ types: t }) { if ( name && name !== 'style' && - name !== STYLE_COMPONENT && + name !== state.styleComponentImportName && (name.charAt(0) !== name.charAt(0).toUpperCase() || Object.values(path.scope.bindings).some(binding => binding.referencePaths.some(r => r === tag) @@ -173,7 +171,7 @@ export default function({ types: t }) { const { staticClassName, className } = computeClassNames( state.styles, externalJsxId, - state.styleComponent + state.styleComponentImportName ) state.className = className state.staticClassName = staticClassName @@ -225,7 +223,9 @@ export default function({ types: t }) { ) { const [id, css] = state.externalStyles.shift() - path.replaceWith(makeStyledJsxTag(id, css, [], state.styleComponent)) + path.replaceWith( + makeStyledJsxTag(id, css, [], state.styleComponentImportName) + ) return } @@ -249,7 +249,12 @@ export default function({ types: t }) { }) path.replaceWith( - makeStyledJsxTag(hash, css, expressions, state.styleComponent) + makeStyledJsxTag( + hash, + css, + expressions, + state.styleComponentImportName + ) ) } } @@ -286,9 +291,12 @@ export default function({ types: t }) { state.hasJSXStyle = null state.ignoreClosing = null state.file.hasJSXStyle = false - setStateOptions(state) - createReactComponentImportDeclaration(state) + + // `addDefault` will generate unique id for the scope + state.styleComponentImportName = createReactComponentImportDeclaration( + state + ) // we need to beat the arrow function transform and // possibly others so we traverse from here or else @@ -303,7 +311,7 @@ export default function({ types: t }) { !( state.file.hasJSXStyle && !state.hasInjectedJSXStyle && - !scope.hasBinding(state.styleComponent) + !scope.hasBinding(state.styleComponentImportName) ) ) { return diff --git a/src/macro.js b/src/macro.js index 40c035b9..c3580ae1 100644 --- a/src/macro.js +++ b/src/macro.js @@ -9,6 +9,7 @@ export default createMacro(styledJsxMacro) function styledJsxMacro({ references, state }) { setStateOptions(state) + state.styleComponentImportName = createReactComponentImportDeclaration(state) // Holds a reference to all the lines where strings are tagged using the `css` tag name. // We print a warning at the end of the macro in case there is any reference to css, @@ -94,15 +95,11 @@ function styledJsxMacro({ references, state }) { plugins: state.plugins, vendorPrefixes: state.opts.vendorPrefixes, sourceMaps: state.opts.sourceMaps, - styleComponent: state.styleComponent + styleComponentImportName: state.styleComponentImportName }) - if ( - !state.hasInjectedJSXStyle && - !path.scope.hasBinding(state.styleComponent) - ) { + if (!state.hasInjectedJSXStyle) { state.hasInjectedJSXStyle = true - createReactComponentImportDeclaration(state) } }) }) diff --git a/test/babel6/snapshots/external.js.snap b/test/babel6/snapshots/external.js.snap index 25b6ac9e73e49d373b7c7c64b6e53029aac157ff..08a52249d4dcfd1345e221d7e1433f1464fa5d3e 100644 GIT binary patch literal 1526 zcmV3*T*ZH9l((d>K1}bM9+cnvdGK|H zq0-;_061`P`Qr4o8Dr6P%xiI>eGB-v)vI&pJQ>=@5wJeEHMT$D?gAEUa!{h}*s-#T7 zqy7K?<(LlJJ=tEC&>LixBKV~$$lMqa8&@`Q{E3C*h|$4vY52nEhp1VuR_ zRM7-v?UpQluK5xk&F0ZSUk@G`s&os=2y8&5ynvu)Sop{ClBlSHs47^Qe%4iC3bJ^^ z1VNY12t<})P4@z!Kr|ZXBC$qM64g-xI}t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0%#BdBq@HCjvl#(>-XRV02Bo~Rs z5}`zGMwYZ;wX^_7!?2vvSrh}~^bwevDhg^5xngZQ0%2J$R7DtoL`_8sPQ#QVm%}|> zE2@gx^(4FNK2%-d47 z_L~+KnmxC1wb0p>;B>@09Szj*i;ms#*qzYmEQSh_OoYS8mr(^^xUAx3lmpUt$Y*4^ zd9!*;B$FeF2p2b-c))no&25pTvk^>fv@@BSb~6(SbIBOWHy*_^V{K=Po!hB_Sp`BV zAeLr}8roZEtxYD3Z<;XoeA#v^gQu%rJCwrzBW5e)!n`DuOL-Kyu_YMGkQAH=wNEJ= z=Azhd1f^7WHdf0v$DgZbJT--*A^wIO?; z(Pq6)T!?IV6c|d`>?S)?fK$bQGJIELgIyAT#>S(d4vEe;*TvKR094FXmq#l+Gp7?J z4dFCqRJsr-hIq!Z!Hvf_{6|MBbEyXF`z2W`LZ$A6yrR=ggHnMvolJ{WnBv`eKOmz5 zNKnFuD*CF3<}}^tEA!|)s0gz#9dt;Y^%mOH+vl#g&#Jf4&(kp2D|5aB5( zqWD7Sd!&;|#zj~*V&{tkHKIo<1rTIfRgpltu3@$BSdGW+i%u%Cr+H%NJU9w`=z*RU zS=P`rk)i>Ru550rXX=CpjqTFGie>MdSf^#i{Op)EVwet^k!Mo)L~!8!XBYRUPI$M3 z+vow@)E?4iyd#8vi?CqX5-8~)iYnv6VzGO!F}&le7#?~-H3i{@OPP(2(Pw6VqCQjL z$!bY~{)VO<>g3bG@JCq diff --git a/test/babel6/snapshots/index.js.md b/test/babel6/snapshots/index.js.md index a2d09d16..a7a153f2 100644 --- a/test/babel6/snapshots/index.js.md +++ b/test/babel6/snapshots/index.js.md @@ -88,8 +88,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ - export const _StyleImport = '123';␊ + `import _JSXStyle from "styled-jsx/style";␊ export default class {␊ render() {␊ return
␊ diff --git a/test/babel6/snapshots/index.js.snap b/test/babel6/snapshots/index.js.snap index bb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k?!X^5g1c%ggq3I1L7Cnn439P&75&ncCH{O9)PYbcTQ97Pi$H%RX3$%h9dj&!2q=Egu8|pYZ!bW0< zzxEE%avBdxwT%RUXxUt>c(;1pV2e;Oo~2Mm>k?YqnZT;17X@81KvS!op_{Pw+R?sd z*o>x|5O41>PU3buZ|9tBvw=^7o{ro|t(}MJGG{oO#Wh7ZoQ8;E*dJvu} zrV^D3SYFPWIb|5&Vig_la)O?b)nP!!fwclGYozHF#hdUBE7?P$YJ2Pyv$7%~N9%Cz zT(JT6SMU%9+M=?8kwpR4j@nMDmHHG`r!aSS8L9p5WPd#qRkctUsjvuUOkGwp1A!W& zEEi)~mZV&a2JF7Bx$pts(Y4byjy=4y!4ld-QAKkY3ZfZmY(m`!rYCnj@MmUaBb3** zyb)@pa?5mjho`yq`{0iGtGa9-S76TO5mApOx81Ut!g}lG%K?fbNh(H1xR`x65WqJC z0Uf^+^h|e+ekkB-RTY5MNjx*3t7F9sc$<4?VoF zN*c{Fe2j~ceB+&7m21Zf+fm)<|b r(DWn@UX?ibjv@{=h>Q0awF3@yU5DvgkbtHDwc`H)f$0w&872S#6e#E) diff --git a/test/babel6/snapshots/plugins.js.snap b/test/babel6/snapshots/plugins.js.snap index d19eae955c538f95f4b403986eca0139881c9fe0..721c5abf9f1d8c9075c17e81d5fcbd8d87fffc22 100644 GIT binary patch literal 601 zcmV-f0;c^zRzV@Ml00000000B+ zQp<`HK@_b-f)H2!fLxkDCrlnj$b=-_5gAkvW)Q}Okc6btT_G)%uC}W(W@rjr&c;u0 zIg7zX_I`mlAZ|o=eu7J#oz<0|yclq!;=<}h-^aP<-a2)kAcU?VtKWJ)Ke_+utnvDM zKwo}Iq4<1GBlP~>x3j(RdGX_|ix;m>t8Y^}n#~|Ix8K~jsDC)!AJ4zvJvn%g($OE8 znD4r-Pi4@}^t-e-30Nqg|LE}Pp*W@lMj@Mk$z$6sJ>#>AHqBNxL28#Lu<|0yRoY=b z7vM0;La@OMiK~KHGSfva8R01vkk1#uZiD4|N8nJ*`2n5~I~u4yrChY&D);+i%*S#7 zJ7B7BXEj{eJ@)a$bMl>zd8giJ)N8kE)m^g)9o@GGOpHmm7u&sFuOQo5P{#`XN-sgU zuqr{)b0w(f+L5thFeD_*c60@mY)3{prc$HDlj=E3NkxehN*uw$NU1G|FPdE=>KY@) zx<+$^DJR9QF~mbcm9G+%IaqkiUwB;LP$UV@C(5cTxEf(Pi4oOZsa)c_8<1*s9aEDr z=1759_&6jZZ$|i9YtE*jL-uj79`yJ_%7&O;hNSEoEon%rvef8G%{E`Co%q{jRz>Yn zyU^NL>)ijf{`b~;zys`;bCFKUU#+*oG;`64LAK=JPp-^Y^qUvq@{zU#)O<<|?Exs@ nQWA)gAS~K6VN-x4EA>AXgRcpZ@Gfu6w{QCsJ(95COa=e|_{Arm literal 601 zcmV-f0;c^zRzVgjYv^JXc6i`NJ28%osgBuPP#LxDa(MzUi=9j zdng`q_ZNr-@gjKhCwSD}oSkg*QHoxQcyRWx@5l2#@5jvh93ixUK0f?@x-&d0e7=4D z>di^zeG0|rej1^f^X}$(?bFHbaQ5TD@!sQt2NIYfCkf{#x$N*2MfLtyQP7`d;KLnRz&iC+$I8jgKDQ2TNSE<__Vm_2T z*aB01Tg&1~-cf)@zME^c%zL$Zy;i+jt!$eGXz9EKU}8wZomlR4I(ga5fI9a0ujCSh z3%fi{axMqzdro9584L*tvlCrGC7V%?k8x1SM%pP=iE+ic-eMA2sjxw|r-q?500mr(1fs+U^E3@u zA3)-j`X3L2uM8sLU3AQU+wF({3-a$Rh*65E{2pHSAv^ui=%+pwf@%}e|X&oGsKOa=e|bPOqT diff --git a/test/fixtures/class.js b/test/fixtures/class.js index ed209483..7488d661 100644 --- a/test/fixtures/class.js +++ b/test/fixtures/class.js @@ -1,4 +1,3 @@ -export const _StyleImport = '123' export default class { render() { return ( diff --git a/test/fixtures/conflicts.js b/test/fixtures/conflicts.js new file mode 100644 index 00000000..61d2ef52 --- /dev/null +++ b/test/fixtures/conflicts.js @@ -0,0 +1,13 @@ +export const _JSXStyle = '_JSXStyle-literal' +export default function() { + return ( +
+

test

+ +
+ ) +} diff --git a/test/index.js b/test/index.js index 5ec8e90d..046c3b77 100644 --- a/test/index.js +++ b/test/index.js @@ -112,6 +112,11 @@ test('works with dynamic element in class', async t => { t.snapshot(code) }) +test('works with existing identifier for _JSXStyle', async t => { + const { code } = await transform('./fixtures/conflicts.js') + t.snapshot(code) +}) + test('does not transpile nested style tags', async t => { const { message } = await t.throwsAsync(() => transform('./fixtures/nested-style-tags.js') diff --git a/test/snapshots/external.js.snap b/test/snapshots/external.js.snap index d4963fdd89f85b5c38e460ad59b073b7d124abd1..5cc432753824077a82522ac1e841fcdb631bad6d 100644 GIT binary patch literal 1828 zcmV+<2iy2TRzV>rB=00000000Bc zSY2!sRTQ29iL#hR2x`iMxsDCpmUg#0`_tX-c1e+%Kte$Z2C~`g4!gJA!QGiVrl!s4-Dv6fgp!!3Se_G4Urcpe82z0*!j_oxh#g-FB81OOtjw z=iYP9J>NO^e0Oe=rl?z~-!dPrlDoehyL_jy);dvM;235#~)9f*^|EX<1=px)OXVl`?st1?E?pNZ-DbqP|-9H{lYg1G$1_$DatbdBK!LL2?E+N~0ABnD05V4& z013+upC7C;Y&04P_k|*CAEPF#OrGECLneDIaWy9vMQK2S`MAoc3BReI>>-A8MNXDS zxDp%yj9rsK<7!vjquK)6Lo*c_qV-68PQi=b%Sj+ZmInqwh8GkliRGD2Fjbn zd<89hEs+nPX?aa+fC$t$P-`4)v$CRFOCY?H1V;Rm&|vWCHb{bSScU+3EO2rG<*8PR zb7Ipo3?}^8x)c8)S}&+7KqvxE1{wTR^|F#6ms9*Wky1ra_!6!w_Z65E1z7<@C=WPD zqvrhG_hd3#wr?HIWV-#>o7Xhe1GMtw^Qe5-el{5Hi^d`WMz5^`U(8ETKx1ZMnsfBR z9G4&zP-&84!)kQ}X<7BCaSxmz!5A2u$=M*};lvhh9NIIqadh*D4;QO2&W}xchwAFN zeTjQ`^qFM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'123';␊ export default class {␊ render() {␊ return
␊ @@ -242,6 +241,19 @@ Generated by [AVA](https://ava.li). ␊ };` +## works with existing identifier for \_JSXStyle + +> Snapshot 1 + + `import _JSXStyle2 from "styled-jsx/style";␊ + export const _JSXStyle = '_JSXStyle-literal';␊ + export default function () {␊ + return
␊ +

test

␊ + <_JSXStyle2 id={"319553417"}>{"p.jsx-319553417{color:red;}"}␊ +
;␊ + }` + ## works with expressions in template literals > Snapshot 1 diff --git a/test/snapshots/index.js.snap b/test/snapshots/index.js.snap index 1947d6f6bd46c2c12391c284240431afa7caefa7..de06f282a855b6cbee8c0917769fabefdabbb8a3 100644 GIT binary patch literal 3310 zcmVo&`0VDqqQHU5&6HE{hjEIWpk;C`iOy@`2X}ilF z0@`G^?e~4(d*AQpec$(ezHj<>ABLTeJ@G8N&=5t z|M9#VuH5;=@%x|jA?ZIqgkhij+ykF}{eswop-0*5t>O>g_95xQSs3=xEqiV|vc5X{ z%Gdhh+i!pDO&^l}d8xdNc!SM7$&_n_vW|nBcHneBsVkh z{AuUwO(Kc=Z;VD`~u{^+pQqDX+=$W|eI}1rBJtG%Nl>*xkLt%A&0FC_IJ3Nh zjR4pCf@v3^Ki~HL2XyloT_Z*IT!yQ1QDOOmOrao1OIJ^fWjID-dcapvU>Qx2rO2`> zOKCR8C@QaIirQi*na(mQACK+j%Om9M^vF6hl`0M|%j;uo0%S1AIlfkhsCHmoTqcyDMM#^a!tri?O$ULh{ajzpm3EiGBAF%D2)px z@P24{Z2wX4eoz2o=b5RJ2<8!3GDWcYL*m#Jkz9h55$&+_mx(d>6vcyd9Z)!@KAp@=)cbG zTU%xK(QH=ehw>!&Ol8Sb^zdM6?XXxXLS4{zof{I>*~x)xS!$`9FLP_dL+a8DnNqXV zaC~@ZM4TNQNR3d@G=30qS67N!4%$&){~jRad<)C)mr1dh}HS zaIpixAl1D{?lpRR18ZcOa0CG6vZ5YeGMb7esA$4kh&oK28Wn$5=E_bSdvfwBuQ()} zpcX`?+!I>kv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?!inP?dT07i^IrK%;oQV*xHf zjP0W-wjxKish3jDjp1;D*hDyB8$kJNuede5;{Z*4x6<#!d+koA-MZV-cVG?lRofa^ zO=&O~RK?}!|4Og?@vi3SdsdW15FkaiqBT&W7r{mhC8@N7m(x%RCEz&V zT^mL=98+q;?idk0YY8GeHtVd<0#~5zz?weYs+*=VLpvB^c^8h9C*1D zUC-vUM4WRZlW6!f#AAPfS*A6k^U%e6XqI*Q>@lGuL@r%I*w7GAO7m()YiE`}p^Tz) pWouP^=fA4|IaNDshJvdr?oaBDZ@v7bC!A|m%x~Nb@fk@5006-JEy(}? From d27184ec5d39eff8b1d364b328ed45fdc9f5e1fb Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Sun, 1 Aug 2021 20:21:29 +0800 Subject: [PATCH 3/4] remove unused imports --- src/babel-external.js | 2 ++ src/babel.js | 17 +++++++++++++++-- test/babel6/snapshots/external.js.md | 3 +-- test/babel6/snapshots/external.js.snap | Bin 1526 -> 1520 bytes test/babel6/snapshots/index.js.md | 3 +-- test/babel6/snapshots/index.js.snap | Bin 2513 -> 2524 bytes test/babel6/snapshots/plugins.js.snap | Bin 601 -> 601 bytes test/snapshots/external.js.md | 3 +-- test/snapshots/external.js.snap | Bin 1828 -> 1831 bytes test/snapshots/index.js.md | 4 +--- test/snapshots/index.js.snap | Bin 3310 -> 3304 bytes test/snapshots/plugins.js.snap | Bin 601 -> 602 bytes 12 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/babel-external.js b/src/babel-external.js index 9896a9dd..d7aeb0c8 100644 --- a/src/babel-external.js +++ b/src/babel-external.js @@ -154,6 +154,8 @@ export const visitor = { return } + state.file.hasCssImports = true + // Produces an object containing all the TaggedTemplateExpression paths detected. // The object contains { scoped, global, resolve } const taggedTemplateExpressions = binding.referencePaths diff --git a/src/babel.js b/src/babel.js index 66b74030..f1916263 100644 --- a/src/babel.js +++ b/src/babel.js @@ -291,6 +291,7 @@ export default function({ types: t }) { state.hasJSXStyle = null state.ignoreClosing = null state.file.hasJSXStyle = false + state.file.hasCssImports = false setStateOptions(state) // `addDefault` will generate unique id for the scope @@ -306,12 +307,24 @@ export default function({ types: t }) { // Transpile external styles path.traverse(externalStylesVisitor, state) }, - exit({ scope }, state) { + exit(path, state) { + // For source that didn't really use styled-jsx imports, + // remove the injected import at the beginning + if (!state.file.hasJSXStyle && !state.file.hasCssImports) { + path.traverse({ + ImportDeclaration(importPath) { + if (importPath.node.source.value === state.styleModule) { + importPath.remove() + } + } + }) + } + if ( !( state.file.hasJSXStyle && !state.hasInjectedJSXStyle && - !scope.hasBinding(state.styleComponentImportName) + !path.scope.hasBinding(state.styleComponentImportName) ) ) { return diff --git a/test/babel6/snapshots/external.js.md b/test/babel6/snapshots/external.js.md index 4fc5da3a..19aaed25 100644 --- a/test/babel6/snapshots/external.js.md +++ b/test/babel6/snapshots/external.js.md @@ -64,8 +64,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ - import css from 'hell';␊ + `import css from 'hell';␊ ␊ const color = 'red';␊ ␊ diff --git a/test/babel6/snapshots/external.js.snap b/test/babel6/snapshots/external.js.snap index 08a52249d4dcfd1345e221d7e1433f1464fa5d3e..ae556ec0bfaad3de95b3e30557af3735fb9cff15 100644 GIT binary patch literal 1520 zcmV_zi)eDFFBS?sTE~CFQ;oCO8Ip<&f`h4brH_{vH zG?BiD6b65N_KRb=pRPXtwnTlqaWqd8>8CeQ)M@n{`N}7m-l+lQqhAKzq-i3(+DlRU z53F36x|aU_^-B|fzxUVKC7MXzy@jGaj;tnzUw-P5 z;;Hq?FQ0zlxuugdkv?%NMeX};;Pz3q@AuEnoJy^(`F^B{bZvm5UjE^=^_9Rg?>{*) z)ps%X@Hv`Di~A_*t3!YIvUf(;PJe#zzKgHi{}N54SMH#w8>yQ~)^rcmf5Qq@DpzDh z1Je&qK02u_h!D&wav88H{=YEtm^vRM|FS8DVP>mRUMtBG(4eXf4FjD4UuqM)jW zg)$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C&>LixBKV~$$lMqa8&@`Q{E3C*h|$4vY52nEhp1VuR_ zRM7-v?UpQluK5xk&F0ZSUk@G`s&os=2y8&5ynvu)Sop{ClBlSHs47^Qe%4iC3bJ^^ z1VNY12t<})P4@z!Kr|ZXBC$qM64g-xI}t?HgvMsE5mxu-awS125hP35TxCXBXySDM zSm+KQ5OdycKGYy@8Uf)6h|mfV;o@9877StpG-m{b0M*H3ykD$ulNTkaxrFX97mvrs zV<9eTBy>oB*Nnxme(Q3kHeQc1s1ttzK`tJ_zD2`?Kh}Dd+`gXTpOq03{gv`;NhOPq zKvr1af>MsnwsFqMILnar5WY2YgdO=m?cCgWVO|ufi3QqA9yv3140|as?C2F!l?rv79zDvK znvTWozMSj9mkzFE+&F*>*pBS~8^-h7&;|XsaQGcb}wNY9+Lz+YMgA#KS&%T zs-)LT zj@1kkdx^6vr;YEn@`TNjV|Z6-pFI|fy>nkjCv6%bp`aLoU`xYh#YfMY{++`)lhLty zSw_RA5=ZM&=P)*7`e!Nuo(aB(1afO0Xyv;cJ( zW_;T-%s3X?aIEod+gQ`{Y|w2k;QyV0W;ge|JEP1NCmHusOnWr`GeZo&@eH%^{IZqt zlAG+_}whD^XS!%>$KUrtj zx2;QQyWTBrdqSKIp|f(D*z}*E`U$awt!Lk?s?MkMEIa>2y7lJIaT6ZJX}1QPO~+}g c9Nif@x?h1qA#2H2Mt<8 diff --git a/test/babel6/snapshots/index.js.md b/test/babel6/snapshots/index.js.md index a7a153f2..a8ede4b3 100644 --- a/test/babel6/snapshots/index.js.md +++ b/test/babel6/snapshots/index.js.md @@ -19,8 +19,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ - const a = () =>
␊ + `const a = () =>

hi

;` diff --git a/test/babel6/snapshots/index.js.snap b/test/babel6/snapshots/index.js.snap index 6d5ff43dbdca7b2528343dda8cedb3a2776383aa..cadcf441c64ed7fce71db35bb5f771a17fd6ee88 100644 GIT binary patch literal 2524 zc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Z7~~ZrM&S6{c-OP_SIqwb?@oZ*_9XxSClt?6 diff --git a/test/babel6/snapshots/plugins.js.snap b/test/babel6/snapshots/plugins.js.snap index 721c5abf9f1d8c9075c17e81d5fcbd8d87fffc22..d19eae955c538f95f4b403986eca0139881c9fe0 100644 GIT binary patch literal 601 zcmV-f0;c^zRzVgjYv^JXc6i`NJ28%osgBuPP#LxDa(MzUi=9j zdng`q_ZNr-@gjKhCwSD}oSkg*QHoxQcyRWx@5l2#@5jvh93ixUK0f?@x-&d0e7=4D z>di^zeG0|rej1^f^X}$(?bFHbaQ5TD@!sQt2NIYfCkf{#x$N*2MfLtyQP7`d;KLnRz&iC+$I8jgKDQ2TNSE<__Vm_2T z*aB01Tg&1~-cf)@zME^c%zL$Zy;i+jt!$eGXz9EKU}8wZomlR4I(ga5fI9a0ujCSh z3%fi{axMqzdro9584L*tvlCrGC7V%?k8x1SM%pP=iE+ic-eMA2sjxw|r-q?500mr(1fs+U^E3@u zA3)-j`X3L2uM8sLU3AQU+wF({3-a$Rh*65E{2pHSAv^ui=%+pwf@%}e|X&oGsKOa=e|bPOqT literal 601 zcmV-f0;c^zRzV@Ml00000000B+ zQp<`HK@_b-f)H2!fLxkDCrlnj$b=-_5gAkvW)Q}Okc6btT_G)%uC}W(W@rjr&c;u0 zIg7zX_I`mlAZ|o=eu7J#oz<0|yclq!;=<}h-^aP<-a2)kAcU?VtKWJ)Ke_+utnvDM zKwo}Iq4<1GBlP~>x3j(RdGX_|ix;m>t8Y^}n#~|Ix8K~jsDC)!AJ4zvJvn%g($OE8 znD4r-Pi4@}^t-e-30Nqg|LE}Pp*W@lMj@Mk$z$6sJ>#>AHqBNxL28#Lu<|0yRoY=b z7vM0;La@OMiK~KHGSfva8R01vkk1#uZiD4|N8nJ*`2n5~I~u4yrChY&D);+i%*S#7 zJ7B7BXEj{eJ@)a$bMl>zd8giJ)N8kE)m^g)9o@GGOpHmm7u&sFuOQo5P{#`XN-sgU zuqr{)b0w(f+L5thFeD_*c60@mY)3{prc$HDlj=E3NkxehN*uw$NU1G|FPdE=>KY@) zx<+$^DJR9QF~mbcm9G+%IaqkiUwB;LP$UV@C(5cTxEf(Pi4oOZsa)c_8<1*s9aEDr z=1759_&6jZZ$|i9YtE*jL-uj79`yJ_%7&O;hNSEoEon%rvef8G%{E`Co%q{jRz>Yn zyU^NL>)ijf{`b~;zys`;bCFKUU#+*oG;`64LAK=JPp-^Y^qUvq@{zU#)O<<|?Exs@ nQWA)gAS~K6VN-x4EA>AXgRcpZ@Gfu6w{QCsJ(95COa=e|_{Arm diff --git a/test/snapshots/external.js.md b/test/snapshots/external.js.md index 4ea28fb3..f43280d5 100644 --- a/test/snapshots/external.js.md +++ b/test/snapshots/external.js.md @@ -89,8 +89,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ - import css from 'hell';␊ + `import css from 'hell';␊ const color = 'red';␊ const bar = css`␊ div {␊ diff --git a/test/snapshots/external.js.snap b/test/snapshots/external.js.snap index 5cc432753824077a82522ac1e841fcdb631bad6d..cbc56f5f9778067d781f709178357c4236f946dd 100644 GIT binary patch literal 1831 zcmV+?2iW*QRzV7_P`I<@SH zgHLTMzHxo{{L?SLIB|$3(#v;I)KTSq>CzYJWxLwtPyc9t2U&onH`*!c{;pG}cU?_g zK74NI-{b#$FhLXPnH3cE&HBHY%*yD+qhGJxaOSm#UZIIJdM`zN9=UMv#*%gCqP4yo z@A3!#qKWj{eH8WTuWw#I6?o>OCx>>moyl%JNfYVwt0-zQbvua^y@Xo6=u1i{S0q^l zxlO}6ht=^C1S7Ik28@FLFZAqD#)9NuCh7ByRK>h1NFq?7qWU{Q%?E%V{{eukQTjp3 z#t{kwHHMAHW6|D7jO}H#bd4zp`vM5E#}?P}Qc05gWmrgRjFt*o`sr>0oG$hOTS{t%a(zdk=~vkfBmIPYe29MZTG0;*d-f0p>{FBnd5HK)Eg0Ner0PR@hl_JVhy%guf zp=Sc7f*9Q$|3TUyR1Kg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b$DYF@&eAO} Scq5-n=lc(-^qKMV8vp>@2YDR; diff --git a/test/snapshots/index.js.md b/test/snapshots/index.js.md index 03f12770..a2e6e6ea 100644 --- a/test/snapshots/index.js.md +++ b/test/snapshots/index.js.md @@ -63,9 +63,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ - ␊ - const a = () =>
␊ + `const a = () =>

hi

;` diff --git a/test/snapshots/index.js.snap b/test/snapshots/index.js.snap index de06f282a855b6cbee8c0917769fabefdabbb8a3..b494f353a20ff91c059e9ed7aea59b775abbb640 100644 GIT binary patch literal 3304 zcmVWi3RzV<_pZC$nc3MN-L}y7xNCd8<9a==zqqusGq2rgXJ?j~ z*><;kBM|+AoW@`Tksl(6B1VKrFc=dg1`PZm5rv4s9}yEp1QSFhz!C7hH?#9&cW1jT zcl^>#+MWHr?|bk2{k-q{{&;Wx9UzFah{vDdw_LaBHtvstuot(Ok{^M=8v z{&wcEOSV3K^xh`|nEH#462$X2?YQO8>hj(fzuA}EeCs2x1u%6cNDyLR`|;cjZ=RF8 zp4xofcP5AcrY?SrAYSRamfw1AWM=wdF^}m&`;j`mN0ej zcc*+ZfT@2vgCH*ZdF1O;U)_A?9dF)Ep7Z1rpAKN^>bV5*`)_>Y;mX^eIRB4tKRtW= znV&%n5cRS12;wW1+Yj#Cd3tqmXywJb$g8>nm^yL+LHsuS*!J*hhSj(3y+1f|-m?Kr zy>uHvY(0AVE#JQT*&p8i;1m6?j()8_fT=f!A=W>5pnC9*fBfg!vv1w9mtTG^fT?eE z5JdQ|Ao}-n2g}cozNSa}-+DQKsW)~K#5G^K?+dS-owz^xFrT|w`pMe?OeNw3@#;O} ziJ$JBcyRKwpZXR5Kxl6OQ?nF7oI;$6*Eg`4ICIlLKr9p$RVQah#wW-1iUi1cRVk1m z4Lu9dMXlV0A4Az7C}U0m%yT74Cp$VKWN#nYBZ$i+FL9c-pDTdgY6y0T(y0VPC#YnS z2^oDs5`KD$t(kP7={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-M+DFvLbTMqN3r}==FGl?;5K5sLB?a z42LZPO)pn^~j%$FNggBm+&CB>A zBoQK@7isU7Ml=gvE!x!5VmgG$N2=$Ng%8|F1~<3qaRgRMjYc7BMrp((V+0*1sCb-? zIf~-C2L=uun@if_Ru2Wu{qNrTd+UBILAJbWF{&LWsSj9RLZSe8IV0Am1N+!-jR!@f sXqt+l2Tk5JvQw+(=TN;4cZ_Pup=&))t;#%+BWs}h4|+-(qgpcn07~Rx_y7O^ diff --git a/test/snapshots/plugins.js.snap b/test/snapshots/plugins.js.snap index 0ecb63e064a6da88bf9d2052c81c445b32955a9c..dd9e66af575dbbb541d3a8167c37b91908d82df4 100644 GIT binary patch literal 602 zcmV-g0;T;yRzV3YjYv^JXc6i`NJ28%osgBuPTZN)lx4tUFa89N zJrobQ`v(LI;zjY~U+^T-o3pdqd{OYC;=$R&z8}x~yze~oJ^=u10jp;|pP$_Sbk=x% z-ls3Wq(F2&rvZ3>@7vkl=)Cmt=EaLwr`5M99lf3bU~a$JzNmjV-5WxOdcDq*HMJ3qQZA*}e5efDpyW8y+Wh)ESu_k|| zmmpkNl}XZbsi)`K;VOfK39}tuK_y!uG9oH9S~RJivz%0vIibW6EC`j@g7~7@L170C z8S9|t5K~S{9W=lLLY1!)lsQ;<%#S@Ta3GR|=M!bs6)BEO;D{p*JIZr8Q^Mz#;p1vKsXGL&^r2UWTOXAX6e~RTdgusoDAqwGw}`%&Mqe zY8B13t-kettN*#J?(+%uja;ac@>kofFwI=JWRRxp|H+N{3V!b%T)xqUewt2cp*;u{ oaG?kclOT+{G~xRFldRPLNDIEAL&CebFyFlFPY-@S-bn@k06)Pc9smFU literal 601 zcmV-f0;c^zRzVBs3qUkcMP;BT`flT7-HKl8~M3PRPn+C+I5V=pfl zIfwaNK!;HlKnoTE;wmGV>ll}e@QeyrES8|vfu`#nLWg3`_wj^Sp{>$X@?lI>9Sp{p zkEIQ_AX4Afsv}6mWQ7w-9KnJZ)6R!0 z25CrJnzd#AE9+VBzLV&e!_1nxr%uUOdoka@^}d6PJGwMKO{Zp|H3$`OIT08pMi^&l z!}b0Xuhjo&7CbeFgm>96|827${;$VBw;re(QT=Hxd_jEC?xC=UMvV1PdxR+`4izk9x^1l<`w=0gFvE&Nd^D_A2Jej From d3d0a47ced0041775609a05cd6bacb2a295d91b3 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Mon, 2 Aug 2021 02:19:25 +0800 Subject: [PATCH 4/4] remove imports for non css.resolve cases --- src/babel-external.js | 12 +++++------- src/babel.js | 6 +++--- test/babel6/snapshots/external.js.md | 7 ++----- test/babel6/snapshots/external.js.snap | Bin 1520 -> 1503 bytes test/babel6/snapshots/index.js.snap | Bin 2524 -> 2526 bytes test/babel6/snapshots/plugins.js.snap | Bin 601 -> 601 bytes test/snapshots/external.js.md | 7 ++----- test/snapshots/external.js.snap | Bin 1831 -> 1815 bytes test/snapshots/index.js.snap | Bin 3304 -> 3325 bytes test/snapshots/plugins.js.snap | Bin 602 -> 599 bytes 10 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/babel-external.js b/src/babel-external.js index d7aeb0c8..932f90b9 100644 --- a/src/babel-external.js +++ b/src/babel-external.js @@ -154,8 +154,6 @@ export const visitor = { return } - state.file.hasCssImports = true - // Produces an object containing all the TaggedTemplateExpression paths detected. // The object contains { scoped, global, resolve } const taggedTemplateExpressions = binding.referencePaths @@ -224,11 +222,11 @@ export const visitor = { // When using the `resolve` helper we need to add an import // for the _JSXStyle component `styled-jsx/style` - if ( - hasJSXStyle && - taggedTemplateExpressions.resolve.length > 0 && - !state.hasInjectedJSXStyle - ) { + const useResolve = + hasJSXStyle && taggedTemplateExpressions.resolve.length > 0 + + if (useResolve) { + state.file.hasCssResolve = true state.hasInjectedJSXStyle = true } }) diff --git a/src/babel.js b/src/babel.js index f1916263..0f9dc188 100644 --- a/src/babel.js +++ b/src/babel.js @@ -291,7 +291,7 @@ export default function({ types: t }) { state.hasJSXStyle = null state.ignoreClosing = null state.file.hasJSXStyle = false - state.file.hasCssImports = false + state.file.hasCssResolve = false setStateOptions(state) // `addDefault` will generate unique id for the scope @@ -308,9 +308,9 @@ export default function({ types: t }) { path.traverse(externalStylesVisitor, state) }, exit(path, state) { - // For source that didn't really use styled-jsx imports, + // For source that didn't really need styled-jsx/style imports, // remove the injected import at the beginning - if (!state.file.hasJSXStyle && !state.file.hasCssImports) { + if (!state.file.hasJSXStyle && !state.file.hasCssResolve) { path.traverse({ ImportDeclaration(importPath) { if (importPath.node.source.value === state.styleModule) { diff --git a/test/babel6/snapshots/external.js.md b/test/babel6/snapshots/external.js.md index 19aaed25..7e7ce819 100644 --- a/test/babel6/snapshots/external.js.md +++ b/test/babel6/snapshots/external.js.md @@ -53,8 +53,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ - const _defaultExport = ['div.jsx-2292456818{font-size:3em;}'];␊ + `const _defaultExport = ['div.jsx-2292456818{font-size:3em;}'];␊ _defaultExport.__hash = '2292456818';␊ ␊ ␊ @@ -158,9 +157,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ - ␊ - const _defaultExport = new String('div.jsx-2292456818{font-size:3em;}');␊ + `const _defaultExport = new String('div.jsx-2292456818{font-size:3em;}');␊ ␊ _defaultExport.__hash = '2292456818';␊ ␊ diff --git a/test/babel6/snapshots/external.js.snap b/test/babel6/snapshots/external.js.snap index ae556ec0bfaad3de95b3e30557af3735fb9cff15..484799805d446a45e3d915a0b6b0696fd2fc90b3 100644 GIT binary patch literal 1503 zcmV<51t9uCRzVU7hF`pM}DuTbd@9_vS^MR#0#X9byR~cTJu&k>oDByKHUGLv)BO zs5n6p9Qt8XKPZR{)DMbCH_>U8?SuGDPy}%*2>PX~FVFMb+^e_i-)Et5A}25{oCY&m&;d94ZnQ;$VdbU(cfkC8vFI>&yMAP`tI2`1?uaKhl(_j z?zx_#&d6_x-+Y|iJ3A_U@XP4yG)<)5y%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a+^Ts?+gxg^3oan;X9_R*RcYdNGxXDP{ m@E3&*1Mfx$hN>gu4#7`!Xy3ZnA8y)TVg3Wu;L#M!B>(`}PVGei diff --git a/test/babel6/snapshots/plugins.js.snap b/test/babel6/snapshots/plugins.js.snap index d19eae955c538f95f4b403986eca0139881c9fe0..1f3946f9d4430e085b7cfc4c5bfd5e86b11119eb 100644 GIT binary patch literal 601 zcmV-f0;c^zRzVfD}Vu5;i|Z$%Z5|5m{6ab`jQtkc6Z&(;*|B>2bQVW*Hhh?!`y& zxQE3 z^7U!;T?)nLZW+9Pp*W@lMj@Mk$z$0qJ?FEE7R^>RL28vJu=2vomD^!H z7vM0;La@OMiK~oRGSfjW8R01vkk1#uZiD4|N8nJ*`2n5~I~u4wrChY&D);+i%*S#7 zJ7B7BXH{I;J@)a$bMl>zd8giJ)N8kE)m^g)9i6ubOpHmm7t6g~uOQo5P{#`XN-jaT zuqr{4b9JGfYe&Y4!H|$J+tC$NvK>ib94tKMFElQ2C=!R~6D8FZT$M1L#E9yyR4Vb^4M?@Rj;YBQbEH5l zd=iq8HzRy4HD}Y%A^SL3H+uXLWkXCaO;UD^mNfq4Sbs&oc~~z8Y3q?SpW1P)0Vv>d n(;-TXut?K{&Am>%Qvc%}=W7>{@Gd*%+ui;In8#Y5Oa=e|C@~;s literal 601 zcmV-f0;c^zRzVgjYv^JXc6i`NJ28%osgBuPP#LxDa(MzUi=9j zdng`q_ZNr-@gjKhCwSD}oSkg*QHoxQcyRWx@5l2#@5jvh93ixUK0f?@x-&d0e7=4D z>di^zeG0|rej1^f^X}$(?bFHbaQ5TD@!sQt2NIYfCkf{#x$N*2MfLtyQP7`d;KLnRz&iC+$I8jgKDQ2TNSE<__Vm_2T z*aB01Tg&1~-cf)@zME^c%zL$Zy;i+jt!$eGXz9EKU}8wZomlR4I(ga5fI9a0ujCSh z3%fi{axMqzdro9584L*tvlCrGC7V%?k8x1SM%pP=iE+ic-eMA2sjxw|r-q?500mr(1fs+U^E3@u zA3)-j`X3L2uM8sLU3AQU+wF({3-a$Rh*65E{2pHSAv^ui=%+pwf@%}e|X&oGsKOa=e|bPOqT diff --git a/test/snapshots/external.js.md b/test/snapshots/external.js.md index f43280d5..dbf9cc9f 100644 --- a/test/snapshots/external.js.md +++ b/test/snapshots/external.js.md @@ -45,8 +45,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ - const _defaultExport = ["div.jsx-2292456818{font-size:3em;}"];␊ + `const _defaultExport = ["div.jsx-2292456818{font-size:3em;}"];␊ _defaultExport.__hash = "2292456818";␊ module.exports = _defaultExport;` @@ -167,9 +166,7 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ - ␊ - const _defaultExport = new String("div.jsx-2292456818{font-size:3em;}");␊ + `const _defaultExport = new String("div.jsx-2292456818{font-size:3em;}");␊ ␊ _defaultExport.__hash = "2292456818";␊ module.exports = _defaultExport;` diff --git a/test/snapshots/external.js.snap b/test/snapshots/external.js.snap index cbc56f5f9778067d781f709178357c4236f946dd..1e9fb3a76524b269e7435f7ebb488b696ea0341e 100644 GIT binary patch literal 1815 zcmV+y2k7`gRzV7pGU|TXejken00000000Bc zSZ!!qRTw^ZbLcXuPU>{~b-b1}?b@Wd`DoLm8J(-J!9H9!*$5%IOHP~24fRYrxy7IAN;%7nqK5(_0VW{=^VgTCyc<#d9)YTtfcuN4^PClAtsP)1f z06frn=IpL(@t=-e9Qya2f8L#7s5QS7fD`iD;&-1WmhEblKKi}&4U9&tPqqMXGI-DA zSEsu!fBA7@!|UkPHF-UYxXq05JEELnRoTxcINaAw&Pho0V=KYD%m(ldvj zpE$x$>-qZu_+s7PY;tAz%8Ad{tUvei!!I(_8d(LvVsJZUidh1dFZv7=N@Y<}V0z>5 z&S7P|h~S7MmLMyW|8w1Yx+bYLJ_WqRTEVynklmKKniY$p)Gwi2Ol8%$-}Fy(QQ&Nmm*vfT3H3wP z?#bf!YDdhY+7jB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re&`KcY#Lo1A%5a+ VvnvZebk3$v{ST;{X#dF@005h!fSdpT diff --git a/test/snapshots/index.js.snap b/test/snapshots/index.js.snap index b494f353a20ff91c059e9ed7aea59b775abbb640..35d8a0cfec9290d93793245c9c49e75811735099 100644 GIT binary patch literal 3325 zcmVJv!pFT|9C?AUm00000000B+ zT7PULRUMx_yd!J`BuDTNHSdGm`v_t;vFF6Ow|(>8=f8jF!%q#oG4_=KL_~kC+C>oO ze2o8g`H6oO&c5lTU;ftr?A<<0rOzRVj_*CBPu%sFe>{KT?YjBH1VE+mN0eDQ(Ly?$Zr!SG{T z_EzzccYK(7=^la*d>tpVH@|gJ_9k-Y4d0p~e3(jIOc1a4f1cZOacJ(yJ-^7`@Yx3< zK1?0Igdnc`N$6`cH}1UquD9+57d`#dM}3(3atA^D=IbALto+V-m;COXXBSRB_hU3u zgPOREAf&hE-u%ve)YJFB&Cg8y`m7K6F!f8F1QGlb48MHwQ0c|7H?{D<+pqaBwY!@j zzFfX@qO0p%ePww4m3zRoJw8l*AVLsNKF964VaFZp>ph=3cy;NSANnwrh!Vsb_f5ur zbZF|~=}&z4=iEbqLq1GRlLT=VaW-CG-%jF!9S3#^`GTxyU}1D}dQvNk5G*Nj9t2e5 znGdh1r5^kkNc*dt6OiS!ZlHr984)BXX`o^X1r?(ynD)aG=H%fLTNE|GiL9!E5s8N- z081K_c-0}S`vFijRued|47CwS&;(W-SLA})8N!VKC{QaZQuPG@P8MaQ7X;aBifo=$ z1PKOlOC^ndDt^BqfCf`+`88Gn3tCQ4K?WEuxpCh{gH6O{dh0dj-#A$*oflh%h zh3rYVhhK%|jE>qXr&tkF8M+(9nkYj#weix3Iz=k!4fIN14;rXH?NFf-syN=1mAh`7adGbJgI zPgky%diGrkRJo{d@Gx5_AYZy_Vl2b68rzFrMS)|DaMiP-%2Jxkv5E?{Oi^13C(~J0 zh4EN7ERRyN)1w>gRH`_#B5#Zhjc#P=vZiS7s+kZDx9KV=Q0T z7!jlDNS?`Mr%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CZ+d?qfn^{;y(sGj0pG&a)r@ob?N!WY%w>aZ)QvRDWK!u= zJmXt8Hp@euUag9w#?w|;H&1C~H?;L0fvaLPB2CJ|QDp_FgPewJb`9XbTEKx16>z`- zF1x-myTb;q?YjDXsK2YCt}CXe*ReURyFy)8HR}pc6kuM9Y72b%=X$q<+Stn_RanvD z@nM*#z4O!?LjN1fVb>V8C3cv?K?jN-Vs;;LTQ4b>B&k``(W7K26nXDnUh#QX3k%|s z$-~FI8!zviByImUUxVyyIEALy41?x+yHk;{{Ua)gFq`0{#`@K%FxD>R87jlFOafn2 m`MWPSR~?2uE_KX{3>U9`A6ujO0!Y_Y{r?5NDG2{BGXMaf6JVJD diff --git a/test/snapshots/plugins.js.snap b/test/snapshots/plugins.js.snap index dd9e66af575dbbb541d3a8167c37b91908d82df4..3ddf9d2242641e2460a07bb34aaca4c9f13105ee 100644 GIT binary patch literal 599 zcmV-d0;v5#RzVAJAbev}OCl3fFb-@=Xb4PD4zVMXc%gb6 z?4mj0pi-#hMO z#`ckq&B&5t>ZMe3V?3TBHWe1w22kGHD{T$uI6%Hh#MS(@dh*+6+>&cs>zEJ!9rMpQ1~y`3YjYv^JXc6i`NJ28%osgBuPTZN)lx4tUFa89N zJrobQ`v(LI;zjY~U+^T-o3pdqd{OYC;=$R&z8}x~yze~oJ^=u10jp;|pP$_Sbk=x% z-ls3Wq(F2&rvZ3>@7vkl=)Cmt=EaLwr`5M99lf3bU~a$JzNmjV-5WxOdcDq*HMJ3qQZA*}e5efDpyW8y+Wh)ESu_k|| zmmpkNl}XZbsi)`K;VOfK39}tuK_y!uG9oH9S~RJivz%0vIibW6EC`j@g7~7@L170C z8S9|t5K~S{9W=lLLY1!)lsQ;<%#S@Ta3GR|=M!bs6)BEO;D{p*JIZr8Q^Mz#;p1vKsXGL&^r2UWTOXAX6e~RTdgusoDAqwGw}`%&Mqe zY8B13t-kettN*#J?(+%uja;ac@>kofFwI=JWRRxp|H+N{3V!b%T)xqUewt2cp*;u{ oaG?kclOT+{G~xRFldRPLNDIEAL&CebFyFlFPY-@S-bn@k06)Pc9smFU