From 2e56e67e681f595e119cfef74afaa95298f55c96 Mon Sep 17 00:00:00 2001 From: Morris Allison III Date: Thu, 20 May 2021 16:56:39 -0700 Subject: [PATCH 1/2] fix: reassign default import from `addDefault` `addDefault` only accepts a `nameHint` and doesn't guarantee the name of the resulting default import. The identifier returned by `addDefault` should be referenced. This change renames the default import hint to `_JSXStyleImport`, and adds a variable declaration after the import to assign the default import to `_JSXStyle`. As a result, instead of this being output in some cases: ```js import _JSXStyle2 from 'styled-jsx/style'; ``` This will be output: ```js import _JSXStyleImport2 from 'styled-jsx/style'; var _JSXStyle = _JSXStyleImport2; ``` --- src/_constants.js | 1 + src/_utils.js | 31 ++++++++++++-- test/babel6/snapshots/attribute.js.md | 6 ++- test/babel6/snapshots/attribute.js.snap | Bin 1530 -> 1540 bytes test/babel6/snapshots/external.js.md | 25 ++++++++---- test/babel6/snapshots/external.js.snap | Bin 1503 -> 1517 bytes test/babel6/snapshots/index.js.md | 42 ++++++++++++------- test/babel6/snapshots/index.js.snap | Bin 2522 -> 2543 bytes test/babel6/snapshots/macro.js.md | 9 ++-- test/babel6/snapshots/macro.js.snap | Bin 540 -> 554 bytes test/babel6/snapshots/plugins.js.md | 6 ++- test/babel6/snapshots/plugins.js.snap | Bin 601 -> 614 bytes test/snapshots/attribute.js.md | 6 ++- test/snapshots/attribute.js.snap | Bin 1528 -> 1536 bytes test/snapshots/external.js.md | 32 ++++++++++----- test/snapshots/external.js.snap | Bin 1819 -> 1824 bytes test/snapshots/index.js.md | 52 ++++++++++++++++-------- test/snapshots/index.js.snap | Bin 3216 -> 3248 bytes test/snapshots/macro.js.md | 9 ++-- test/snapshots/macro.js.snap | Bin 547 -> 560 bytes test/snapshots/plugins.js.md | 6 ++- test/snapshots/plugins.js.snap | Bin 601 -> 614 bytes 22 files changed, 156 insertions(+), 69 deletions(-) diff --git a/src/_constants.js b/src/_constants.js index 0fe969ab..ad034c25 100644 --- a/src/_constants.js +++ b/src/_constants.js @@ -1,5 +1,6 @@ export const GLOBAL_ATTRIBUTE = 'global' export const STYLE_ATTRIBUTE = 'jsx' export const STYLE_COMPONENT = '_JSXStyle' +export const STYLE_COMPONENT_IMPORT = '_JSXStyleImport' export const STYLE_COMPONENT_DYNAMIC = 'dynamic' export const STYLE_COMPONENT_ID = 'id' diff --git a/src/_utils.js b/src/_utils.js index 007f1dc0..f5f0ed37 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' @@ -11,7 +11,8 @@ import { GLOBAL_ATTRIBUTE, STYLE_COMPONENT_ID, STYLE_COMPONENT, - STYLE_COMPONENT_DYNAMIC + STYLE_COMPONENT_DYNAMIC, + STYLE_COMPONENT_IMPORT } from './_constants' const concat = (a, b) => t.binaryExpression('+', a, b) @@ -621,14 +622,36 @@ export const booleanOption = opts => { return ret } +/** + * Adds an import declaration for the `JSXStyle` component + * + * ``` + * import _JSXStyleImport from 'styled-jsx/style'; + * var _JSXStyle = _JSXStyleImport; + * ``` + */ export const createReactComponentImportDeclaration = state => { - addDefault( + // The import identifier name can be `_JSXStyleImport`, `_JSXStyleImport2`, etc. + const importIdentifier = addDefault( state.file.path, typeof state.opts.styleModule === 'string' ? state.opts.styleModule : 'styled-jsx/style', - { nameHint: STYLE_COMPONENT} + { nameHint: STYLE_COMPONENT_IMPORT } ) + // var _JSXStyle = _JSXStyleImport; + const variableDeclaration = t.variableDeclaration('var', [ + t.variableDeclarator(t.identifier(STYLE_COMPONENT), importIdentifier) + ]) + const fileBody = state.file.path.node.body + // The index of the import declaration that was added + const componentImportIndex = fileBody.findIndex( + type => + t.isImportDeclaration(type) && type.source.value === importIdentifier.name + ) + + // Insert the variable declaration after the import declaration + fileBody.splice(componentImportIndex + 1, 0, variableDeclaration) } export const setStateOptions = state => { diff --git a/test/babel6/snapshots/attribute.js.md b/test/babel6/snapshots/attribute.js.md index 341808cf..4e7529ce 100644 --- a/test/babel6/snapshots/attribute.js.md +++ b/test/babel6/snapshots/attribute.js.md @@ -8,7 +8,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ ␊ const styles2 = require('./styles2');␊ @@ -106,10 +107,11 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ ␊ var _this = this;␊ ␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() => {␊ const Element = 'div';␊ return
␊ diff --git a/test/babel6/snapshots/attribute.js.snap b/test/babel6/snapshots/attribute.js.snap index f885e861e495e6d2f6600c20659932bfe0975cf9..cb831da99705ab35d992e2b090c7090938b7833d 100644 GIT binary patch literal 1540 zcmV+f2K)IzRzV-8VcfB)!qT)Te#^`&i10q5Wmt$yv?G{{$OSgpQNZE)sZ=?)kH{IMKb z0-)gp*suz32&e`x)w$sUL8yVz7J*MV4#iTJdObyMb`+_}`D0{@U&PQ8MbU+hOWyn}Kkx)_0KW^7JvclB(S;cK zf=@=koEt{k?b}asx zz#uap622^p2~dl8^4OCv;(3le&kK7Vc&b+R{yd2YjszELkf`o&dcJ5-BZATYxkmd08&Dl9Vm0r~KO1dqtpW zIo9VU>espnwK5>2?o0Szs)hqo0HVH7qE_z|gP}idfx-=WW?M6du?-VjEIRo@Z@I}^ zh|DlMGG@nLZT9WJ4s*{=ZTyKlD2RKD{XUr^-4~$to9H9B`R*#F9EHEjh_*Gk9mhs? zth=ReYmMitvO9(=RJ6OTzHCX}+@6&kH`zZfE$jaUluJMl=o;$8C=ed_nIRN<*2lQ? zX(M;G*_nTMwwtYQb=;+NNp%%QP0tGseLEYot~SIR^)g$sT`>xjFCxIPvW4N_DP$us$d) zN6*6p#^YIWfLNTzjai5omo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T_7K>?~@;k~*Fn>V(B=gRqL1JrWCe{K)mF%*=aUgHSqwBDEjg7ahX4Nv*NR69jnk11$W56c;E(bnB>zb4u?cXW2*!f z6&vYjKpSos0)Tx+Tlm%q1te)2MfA-HuYPwG-HHG+Iskkz2Xc%{^Qa zH?g8GM_eh((yNzYNL}%dWM(?8Lh$uKb{{Md7T<8FWC|LN5)pJ` zxD?v1`?6PFB2!mvqZ&?vuJu~-6GF39S87U~^zqmSgjJj5@ngH)Dg+@d0vob~ zXPc^%5lwY;?bj<~?)Ai^cF=_6^Ha-G=MvdNz@|DfzHu&kpkQ-pqE1UCVs-$U&!Dcs z3p5|NnzubaaWiNsjZUi_SslW6B#{7%UTg}6?lH@QMEr9 Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ import colors, { size } from './constants';␊ const color = 'red';␊ @@ -19,9 +20,9 @@ Generated by [AVA](https://ava.li). const baz = ['div{font-size:3em;}'];␊ ␊ baz.__hash = '2141779268';␊ + a.__hash = '262929833';␊ const a = [`div{font-size:${size}em;}`];␊ ␊ - a.__hash = '262929833';␊ export const uh = bar;␊ ␊ export const foo = [`div.jsx-2299908427{color:${color};}`];␊ @@ -98,7 +99,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ ␊ function test() {␊ @@ -112,7 +114,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ import colors, { size } from './constants';␊ const color = 'red';␊ @@ -123,9 +126,9 @@ Generated by [AVA](https://ava.li). const baz = new String('div{font-size:3em;}');␊ ␊ baz.__hash = '2141779268';␊ + a.__hash = '262929833';␊ const a = new String(`div{font-size:${size}em;}`);␊ ␊ - a.__hash = '262929833';␊ export const uh = bar;␊ ␊ export const foo = new String(`div.jsx-2299908427{color:${color};}`);␊ @@ -168,7 +171,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles2';␊ ␊ export default (({ level = 1 }) => {␊ @@ -184,7 +188,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ const styles2 = require('./styles2');␊ import { foo as styles3 } from './styles';␊ @@ -211,7 +216,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ import styles, { foo as styles3 } from './styles';␊ ␊ const styles2 = require('./styles2');␊ @@ -229,7 +235,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ ␊ export default (() =>
␊ diff --git a/test/babel6/snapshots/external.js.snap b/test/babel6/snapshots/external.js.snap index 484799805d446a45e3d915a0b6b0696fd2fc90b3..a0ffc778ead9d43babf3ad55b6fa02be5ae25e47 100644 GIT binary patch literal 1517 zcmV9#bI>7{5OUY#NfSx#vb#&y_BcdE zY(d4zd;y1k*whaSLk8*xMWmbPw3GQk{3a-ZY$^!)!LGhM&vTc%+~uX$wOwaRa>@UB z{=fh0^Lw5r3{6oC^-J!fj zDC%_hwzaR%4y|1LIDPQV)Y>Xdq!-calgP@_)t&gAtaUtJD7{r(dZ zQ+?;N51*xp^zXeC_0>Ip`Z9M!FP-{)|9$6Qz5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50Ww!>!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 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

test

woot

␊ @@ -28,7 +29,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

test

woot

␊ @@ -40,7 +42,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ const Test = () => <_JSXStyle id={"2743241663"}>{"p{color:red;}"};␊ ␊ export default (() =>
␊ @@ -53,7 +56,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ const color = 'red';␊ const otherColor = 'green';␊ ␊ @@ -76,7 +80,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ const Test = () =>
test␊ @@ -87,7 +92,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default class {␊ ␊ render() {␊ @@ -103,7 +109,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ ␊ export default (({ children }) =>
␊ @@ -127,7 +134,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (({ level = 1 }) => {␊ const Element = `h${level}`;␊ ␊ @@ -158,7 +166,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ export default class {␊ render() {␊ const Element = 'div';␊ @@ -184,7 +193,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ const darken = c => c;␊ const color = 'red';␊ const otherColor = 'green';␊ @@ -215,7 +225,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ const Test = () =>
␊ <_JSXStyle id={"2209073070"}>{"body{color:red;}:hover{color:red;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-animation:foo 1s ease-out;animation:foo 1s ease-out;}div a{display:none;}[data-test]>div{color:red;}"}
;␊ @@ -226,7 +237,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ const attrs = {␊ id: 'test'␊ };␊ @@ -257,7 +269,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

woot

␊ @@ -268,7 +281,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

test

woot

␊ diff --git a/test/babel6/snapshots/index.js.snap b/test/babel6/snapshots/index.js.snap index 4e102f8b3bcb876f586f29fde5182a5efdcdab92..91d972ec3427ba7d8c4c6574ae53639aa7e3c3dd 100644 GIT binary patch literal 2543 zcmV%sN}!^YGXnJ9e|Xp;>R8ZIVs*nP_)BbJw2Dc*e|( z*Y-L?so)2SDm92!eL*Rz2p~!;Ayq<^stUD8{ZpwT75%|O0treVKSGeAK%#^@*Y|-7b`yBT6`@*fKw>;0E4}R^yvGUnpKqCAp!;k(i zK5`-Wrx%|81uA09+Kw*|v4-Sy^EucklT^XD_tPj^%v^?49Ab_<5B{QcC< zQ}?Go^Ai5dCzoC~4tWsu+wk|wCrAJGI_R2TUeI3M}E8Y4iBPU_!5Q@e*ylFc8!!jNMAJkLs!mu5cRct zAr6%njtmZdwz@Q0`uGg~NYI0*;%*Gvirt2A_iV%N+#-3Td_mO=e12?Vdcvs4AXWRm zsHu6J&@GDSU((A#^hm_}mU*qoj3-u4jQ4>uT0jJgd{H*=fdL<$NaA}%X&Dz}Uf0L@ zJV;c%a7{lQ2{Ckt3Wpi5ne4;i&)!0JCIjfk-e93O=8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f~^tfmLZDxzF8!g3r%yAUPqxvstN zbuHd$hDoo6VaV-t`U)Q$r^9A8T9JJ Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ ␊ ({␊ @@ -20,7 +21,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ ␊ function test() {␊ @@ -34,7 +36,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ ␊ const { className, styles } = {␊ diff --git a/test/babel6/snapshots/macro.js.snap b/test/babel6/snapshots/macro.js.snap index 532e5ab0a1fda95b521655e4fdf40c5bf1aa9362..43c9baf31efc764084ec1bc2c707f931c238f4d4 100644 GIT binary patch delta 412 zcmV;N0b~B01gZogK~_N^Q*L2!b7*gLAa*he0ss?*8T!^t%A(1{Tsm}c2KJ!EBDkb7C)E?ePbsM zC%?$5C^f~pR;kuTAFkg{2W)V1PGWJfUt(^mm4Z5|PIazYO=}bnzM_Q((@OJ_OEUBG z6iQNyOEfeUK>i&_Pb(+@z0FmN;_)BMH1K$GeqM2jLN&rMI#3TQ)B-htLK*<4{|!uy zj4VwIEe%oq4;RMoe+=Kl^#P;YlTiT|403Qf&CH3Gm~@yMH#$do&}}7K^N#o z!#&hpD-v@Ha#Ef1fq5d6(g7zUTnH#AWaO8pR6^O+5R+@cTpN9$UOQkZU=0A{w|o;d G1^@u!CACxl delta 398 zcmV;90dfAS1e^pSK~_N^Q*L2!b7*gLAa*he0suY|Zo%QFdban+)I-szIBAh0C4aks z_)Yu{sbZ~5X|E^p%|7BMXu=2JOm_v_*0#fOjgGlE5PSV88ogY`4A zG6*uQX2{Gf$S*2Ui1!MP2rjA2NmWQI%Fk6$F9xwwbhC;p^ubJZYc4J>jcP6hAOH&# zTPfHeG-amPRx24mr1!lk;=(i>!)LQ><&1YHjr4 z`t5YU1}Env78m;^=B8RHsH5ss=c?7TMsfLJl3bovnwMOXnV+Xnl3HA%p{W4!$Uyo= zK>_F=u38iyU1TQ3N6Gnl#U%>W2wQZZK2fMuum$@Mr^gITjf^Z!3@r^&Jq!jH#_ur< zZ^88eBgvCr0T&F^aXQV?z|hjf0u}rU~wP3D|K2Wb6Fne1A0HF#oGr$D^0A?JrZvX%Q diff --git a/test/babel6/snapshots/plugins.js.md b/test/babel6/snapshots/plugins.js.md index b702a03a..2f77ecf6 100644 --- a/test/babel6/snapshots/plugins.js.md +++ b/test/babel6/snapshots/plugins.js.md @@ -8,7 +8,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ const color = 'red';␊ ␊ @@ -39,7 +40,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from 'styled-jsx/style';␊ + `import _JSXStyleImport from 'styled-jsx/style';␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ const color = 'red';␊ ␊ diff --git a/test/babel6/snapshots/plugins.js.snap b/test/babel6/snapshots/plugins.js.snap index d19eae955c538f95f4b403986eca0139881c9fe0..da3fe1f61741f75fb715e88f93e52367c125fa7c 100644 GIT binary patch literal 614 zcmV-s0-60mRzVtTahtg(@u^)>F00000000B+ zQ%`FXK@^{)s1Q$n0U4ISCNzJHkcMV=BT}sYXc6i`OhPi*oscb)oj5azDa(MzUi=6i zdng`q_aj&kFM>BeLXXm$v$Na$qv)jwg0qL6_ulXKdvD&%dkFy80G}V8pY9CK3SaMD zynTOC`IG|DdYuMf=6t+;QTuYTH<eRV!O&0XB8s0;FPq*-o@? zx7&Hy$UwF1(O=0WFc)@tl;m8r()XOuSST10Cdy8Dg_LZBT|PoVDI4mbR3%0g>w1d` zv&b>QuAnT&)U)A2L0Yma?eaYTmG!KizLD7LG`p`BG|5$IQihXteC~`C~$Rh+Mj)Y#Ej`u6fpf0atQ^t(pb^0H+cu Aod5s; 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/attribute.js.md b/test/snapshots/attribute.js.md index 594ec1a8..0f30bf17 100644 --- a/test/snapshots/attribute.js.md +++ b/test/snapshots/attribute.js.md @@ -8,7 +8,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ ␊ const styles2 = require('./styles2'); // external only␊ @@ -112,7 +113,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() => {␊ const Element = 'div';␊ return
␊ diff --git a/test/snapshots/attribute.js.snap b/test/snapshots/attribute.js.snap index 6130091626d9dc65a2fdf35bea7a13d4cdbf3a43..e4c6e51b98f50b088584a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VNcFvk0x!eD=V_1 zv{kwpl}1Q9ce}W!gqp=4w}K?eJrk4TY)kDTYGjeBFDz}E%4!R)9$w0YLhzxCj|ZU^t8sFy+!fUCZ4HL3?*0^5B(4h(LA1^aBy@a zwt8q$ccBR~$5X*~#I*)l%E&C99?M zEj?TwJ(;qvMvRr_>ZGq5?#$E{eZw*h3)as~d-9B>O5H-z^ilG=tkmkr zs@iL|qaU|YdTGKaHr#GI~{NW;14!Pa!$+FUGZB>^+ zTL!RvE@GN)tWFX3-3l5#H4nmvTf9R$1Uy;?`80KriDr3u>PpT0+lIC(DNRMftvz!A zi`(P}klFs?5SX(BY(x^8?JlhiD{8`PTC{0%mwUFPwg;y;s~ zi2Y07x&rVCf&m}+1`0_E!elg!Q7vBMb2GkgN9f~5KKVqDbCYE5e?z37Jt!ss0H7b> Ak^lez diff --git a/test/snapshots/external.js.md b/test/snapshots/external.js.md index dbf9cc9f..8bca4de8 100644 --- a/test/snapshots/external.js.md +++ b/test/snapshots/external.js.md @@ -8,15 +8,16 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import colors, { size } from './constants';␊ const color = 'red';␊ const bar = ["div.jsx-2141779268{font-size:3em;}"];␊ bar.__hash = "2141779268";␊ const baz = ["div{font-size:3em;}"];␊ baz.__hash = "2141779268";␊ - const a = [`div{font-size:${size}em;}`];␊ a.__hash = "262929833";␊ + const a = [`div{font-size:${size}em;}`];␊ export const uh = bar;␊ export const foo = [`div.jsx-2299908427{color:${color};}`];␊ foo.__hash = "2299908427";␊ @@ -54,7 +55,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 `import { jsx as _jsx } from "react/jsx-runtime";␊ - import _JSXStyle from "styled-jsx/style";␊ + import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ const A = {␊ styles: /*#__PURE__*/_jsx(_JSXStyle, {␊ id: "2723508961",␊ @@ -78,9 +80,11 @@ Generated by [AVA](https://ava.li). ␊ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }␊ ␊ + var _JSXStyle = _style.default;␊ + ␊ function Test() {␊ return
␊ - <_style.default id={_App.default.__hash}>{_App.default}␊ + <_JSXStyle id={_App.default.__hash}>{_App.default}
;␊ }` @@ -116,7 +120,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ function test() {␊ ({␊ @@ -129,15 +134,16 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import colors, { size } from './constants';␊ const color = 'red';␊ const bar = new String("div.jsx-2141779268{font-size:3em;}");␊ bar.__hash = "2141779268";␊ const baz = new String("div{font-size:3em;}");␊ baz.__hash = "2141779268";␊ - const a = new String(`div{font-size:${size}em;}`);␊ a.__hash = "262929833";␊ + const a = new String(`div{font-size:${size}em;}`);␊ export const uh = bar;␊ export const foo = new String(`div.jsx-2299908427{color:${color};}`);␊ foo.__hash = "2299908427";␊ @@ -175,7 +181,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles2';␊ export default (({␊ level = 1␊ @@ -191,7 +198,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ ␊ const styles2 = require('./styles2');␊ @@ -218,7 +226,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import styles, { foo as styles3 } from './styles';␊ ␊ const styles2 = require('./styles2');␊ @@ -236,7 +245,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import styles from './styles';␊ export default (() =>

test

␊ diff --git a/test/snapshots/external.js.snap b/test/snapshots/external.js.snap index fa632efa0e4e5549d643c4d8ed201803b71ce8d4..e59824b96672ca77dd32822e46aaf5ced5a627d3 100644 GIT binary patch literal 1824 zcmV+*2jBQXRzV@LeDrSzZk zf9LXXe7sFTN)+-(P(!&l2mF zI~nG1=$@F<@leA-$7{D>b;v`9_&7G za@)n^F9%N#{deTr2NNu@et}+}hR^Q1vS8KeNUiV6yTZP|SYmy45yLF`Y4N=Qwd3#4 z55Jx`dye~^CDv<880MAV-ne|ixA&u`hPHK_%4|5s66^8%80N&nC-*(QvH1Gs;WN+d ze_`SPORSfcGR)Tx|HGx1M$R4ja^>n%uRi)RORRezV3^yOI|x(k0%p;?^Nd)o$chHC zYlpWEYvU!jhJGGVwY zR1X2pmjqQ^FO*?F;GCWudaidRJh~(A36`s>5XGa2c@1Sn(^AcxL`j2+T-gM7Rz(G_ zh9g3?qm%4~m(7?ii3*Y;JmWuC@o>r}42q^G zs6|x6daI*e229eAG2LY;vPL`B03sI%D#+q@-DpPz3VF?s>#I~HO)TSnobmq6%aW>r zLG%bSV0Ns(ds#NSam%KmY_{8vgYsIAJ%Bd1SU}Ck_wk`fAQq1XIioX+VyU1&2|csg z+8SfD^{4`&gc_T)Dt2pVXB*X{Cp>VB?ftjevC3UF+rFbbXJTRXgAy$`p#G%Aja zdj}gmgjnzhEN$bV<{UKOJG@|^FpV5oRowLVsHt?QC;O0nsS|JJb52AdWkHuqs=#*=FZ#s*m)suOyBZH8i!*d^FMUT!V(YTfS~`57uv^ zY_4T_>xPUJ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_^_ 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..70038fd5 100644 --- a/test/snapshots/index.js.md +++ b/test/snapshots/index.js.md @@ -8,7 +8,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

test

woot

␊ @@ -19,7 +20,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import React, { Component } from 'react';␊ export default class Index extends Component {␊ static getInitialProps() {␊ @@ -72,7 +74,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

test

woot

␊ @@ -84,7 +87,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ const Test = () => <_JSXStyle id={"2743241663"}>{"p{color:red;}"};␊ ␊ @@ -98,7 +102,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ const color = 'red';␊ const otherColor = 'green';␊ ␊ @@ -121,7 +126,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ const Test = () =>
test␊ @@ -135,7 +141,9 @@ Generated by [AVA](https://ava.li). `'use strict';␊ ␊ - var _JSXStyle = _interopRequireDefault(require("styled-jsx/style")).default;␊ + var _JSXStyleImport = _interopRequireDefault(require("styled-jsx/style")).default;␊ + ␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }␊ ␊ @@ -147,7 +155,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default class {␊ render() {␊ return
␊ @@ -162,7 +171,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (({␊ children␊ }) =>
␊ @@ -186,7 +196,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (({␊ level = 1␊ }) => {␊ @@ -217,7 +228,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default class {␊ render() {␊ const Element = 'div';␊ @@ -243,7 +255,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ const darken = c => c;␊ ␊ @@ -279,7 +292,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ import React from 'react';␊ export default (() => <>␊

Testing!!!

␊ @@ -314,7 +328,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ ␊ const Test = () =>
␊ <_JSXStyle id={"2209073070"}>{"body{color:red;}:hover{color:red;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-animation:foo 1s ease-out;animation:foo 1s ease-out;}div a{display:none;}[data-test]>div{color:red;}"}␊ @@ -326,7 +341,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ const attrs = {␊ id: 'test'␊ };␊ @@ -358,7 +374,8 @@ Generated by [AVA](https://ava.li). > Snapshot 1 - `import _JSXStyle from "styled-jsx/style";␊ + `import _JSXStyleImport from "styled-jsx/style";␊ + var _JSXStyle = _JSXStyleImport;␊ export default (() =>

woot