File tree Expand file tree Collapse file tree 4 files changed +26
-24
lines changed
__tests__/baselines/minification-only Expand file tree Collapse file tree 4 files changed +26
-24
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,11 @@ TypeScript before transform:
4747TypeScript after transform:
4848
4949 declare const styled: any;
50- const Simple = styled.div.withConfig({}) \`width:100%;\`;
51- const Interpolation = styled.div.withConfig({}) \`content:" \${props => props.text} ";\`;
52- const SpecialCharacters = styled.div.withConfig({}) \`content:" \${props => props.text} ";color:red;\`;
53- const Comment = styled.div.withConfig({}) \`color:red;\`;
54- const Parens = styled.div.withConfig({}) \`&:hover{color:blue;}\`;
50+ const Simple = styled.div \`width:100%;\`;
51+ const Interpolation = styled.div \`content:" \${props => props.text} ";\`;
52+ const SpecialCharacters = styled.div \`content:" \${props => props.text} ";color:red;\`;
53+ const Comment = styled.div \`color:red;\`;
54+ const Parens = styled.div \`&:hover{color:blue;}\`;
5555 export {};
5656
5757
Original file line number Diff line number Diff line change @@ -60,12 +60,12 @@ TypeScript before transform:
6060TypeScript after transform:
6161
6262 declare const styled: any;
63- const Simple = styled.div.withConfig({}) \`width:100%;\`;
64- const Interpolation = styled.div.withConfig({}) \`content:"https://test.com/\${props => props.endpoint}";\`;
65- const SpecialCharacters = styled.div.withConfig({}) \`content:" \${props => props.text} ";color:red;\`;
66- const Comment = styled.div.withConfig({}) \`width:100%;color:red;\`;
67- const Parens = styled.div.withConfig({}) \`&:hover{color:blue;}color:red;\`;
68- const UrlComments = styled.div.withConfig({}) \`color:red; background:red;border:1px solid green;\`;
63+ const Simple = styled.div \`width:100%;\`;
64+ const Interpolation = styled.div \`content:"https://test.com/\${props => props.endpoint}";\`;
65+ const SpecialCharacters = styled.div \`content:" \${props => props.text} ";color:red;\`;
66+ const Comment = styled.div \`width:100%;color:red;\`;
67+ const Parens = styled.div \`&:hover{color:blue;}color:red;\`;
68+ const UrlComments = styled.div \`color:red; background:red;border:1px solid green;\`;
6969 export {};
7070
7171
Original file line number Diff line number Diff line change @@ -75,15 +75,15 @@ TypeScript before transform:
7575TypeScript after transform:
7676
7777 declare const styled: any;
78- const Test1 = styled.div.withConfig({}) \`width:100%;//\${'red'}\`;
79- const Test2 = styled.div.withConfig({}) \`width:100%;//\${'red'}\`;
80- const Test3 = styled.div.withConfig({}) \`width:100%;\${'red'};\`;
81- const Test4 = styled.div.withConfig({}) \`width:100%;//\${'red'}\`;
82- const Test5 = styled.div.withConfig({}) \`width:100%;//\${'red'}\${'blue'}\`;
83- const Test6 = styled.div.withConfig({}) \`background:url("https://google.com");width:100%;\${'green'}//\${'red'}\${'blue'}\`;
84- const Test7 = styled.div.withConfig({}) \`background:url("https://google.com");width:\${p => p.props.width};\${'green'}//\${'red'}\${'blue'}\\nheight:\${p => p.props.height};\`;
85- const Test8 = styled.dev.withConfig({}) \`color:/*\${'red'}*/blue;\`;
86- const Test9 = styled.dev.withConfig({}) \`color://\${'red'}\\nblue\`;
78+ const Test1 = styled.div \`width:100%;//\${'red'}\`;
79+ const Test2 = styled.div \`width:100%;//\${'red'}\`;
80+ const Test3 = styled.div \`width:100%;\${'red'};\`;
81+ const Test4 = styled.div \`width:100%;//\${'red'}\`;
82+ const Test5 = styled.div \`width:100%;//\${'red'}\${'blue'}\`;
83+ const Test6 = styled.div \`background:url("https://google.com");width:100%;\${'green'}//\${'red'}\${'blue'}\`;
84+ const Test7 = styled.div \`background:url("https://google.com");width:\${p => p.props.width};\${'green'}//\${'red'}\${'blue'}\\nheight:\${p => p.props.height};\`;
85+ const Test8 = styled.dev \`color:/*\${'red'}*/blue;\`;
86+ const Test9 = styled.dev \`color://\${'red'}\\nblue\`;
8787 export {};
8888
8989
Original file line number Diff line number Diff line change @@ -197,10 +197,12 @@ export function createTransformer({
197197 }
198198 }
199199
200- return ts . createCall (
201- ts . createPropertyAccess ( node as ts . Expression , 'withConfig' ) ,
202- undefined ,
203- [ ts . createObjectLiteral ( styledConfig ) ] ) ;
200+ if ( styledConfig . length > 0 ) {
201+ return ts . createCall (
202+ ts . createPropertyAccess ( node as ts . Expression , 'withConfig' ) ,
203+ undefined ,
204+ [ ts . createObjectLiteral ( styledConfig ) ] ) ;
205+ }
204206 }
205207
206208 ts . forEachChild ( node , n => {
You can’t perform that action at this time.
0 commit comments