Skip to content

Commit e8da9b7

Browse files
authored
Merge pull request #45 from Igorbek/bugfix/issue44
Fix #44
2 parents 8a68540 + b513bc0 commit e8da9b7

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue44.tsx 1`] = `
4+
5+
File: issue44.tsx
6+
Source code:
7+
8+
declare const styled: any;
9+
styled.div\` transition: width \${100}ms ease-in;\`;
10+
styled.div\` transition: width \${'100ms'} ease-in;\`;
11+
12+
13+
TypeScript before transform:
14+
15+
declare const styled: any;
16+
styled.div \` transition: width \${100}ms ease-in;\`;
17+
styled.div \` transition: width \${"100ms"} ease-in;\`;
18+
19+
20+
TypeScript after transform:
21+
22+
declare const styled: any;
23+
styled.div \`transition:width \${100}ms ease-in;\`;
24+
styled.div \`transition:width \${'100ms'} ease-in;\`;
25+
26+
27+
28+
`;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue44.tsx 1`] = `
4+
5+
File: issue44.tsx
6+
Source code:
7+
8+
declare const styled: any;
9+
styled.div\` transition: width \${100}ms ease-in;\`;
10+
styled.div\` transition: width \${'100ms'} ease-in;\`;
11+
12+
13+
TypeScript before transform:
14+
15+
declare const styled: any;
16+
styled.div \` transition: width \${100}ms ease-in;\`;
17+
styled.div \` transition: width \${"100ms"} ease-in;\`;
18+
19+
20+
TypeScript after transform:
21+
22+
declare const styled: any;
23+
styled.div \`transition:width \${100}ms ease-in;\`;
24+
styled.div \`transition:width \${'100ms'} ease-in;\`;
25+
26+
27+
28+
`;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare const styled: any;
2+
styled.div` transition: width ${100}ms ease-in;`;
3+
styled.div` transition: width ${'100ms'} ease-in;`;

src/minify.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const stateMachine: StateMachine = {
5353
return { state: 'x', emit: ' ' + ch };
5454
},
5555
flush(last) {
56-
if (!last) return { emit: ' ' };
56+
if (!last) return { emit: ' ', state: ';$' };
5757
}
5858
},
5959
'\n': { // may need new line
@@ -201,14 +201,14 @@ export function createMinifier(): (next: string, last?: boolean) => string {
201201
const prevState = state;
202202
const reducerResult = reducer.next && reducer.next(ch);
203203
apply(reducerResult, ch)
204-
//console.log('next(', { ch, state: prevState }, '): ', reducerResult, ' -> ', { state, minified });
204+
// console.log('next(', { ch, state: prevState }, '): ', reducerResult, ' -> ', { state, minified });
205205
}
206206

207207
const reducer = stateMachine[state];
208208
const prevState = state;
209209
const reducerResult = reducer.flush && reducer.flush(last);
210210
apply(reducerResult);
211-
//console.log('flush', { state: prevState }, '): ', reducerResult, ' -> ', { state, minified });
211+
// console.log('flush', { state: prevState }, '): ', reducerResult, ' -> ', { state, minified });
212212

213213
return minified;
214214
}

0 commit comments

Comments
 (0)