Skip to content

Commit d24cdad

Browse files
committed
Merge master
2 parents 0e5c3dd + 91d391a commit d24cdad

File tree

12 files changed

+2828
-1752
lines changed

12 files changed

+2828
-1752
lines changed

jest.config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"automock": false,
33
"globals": {
4-
"window": {},
5-
"__TS_CONFIG__": "./tsconfig.json"
4+
"ts-jest": {
5+
"tsConfig": "./tsconfig.json"
6+
}
67
},
7-
"mapCoverage": true,
88
"moduleFileExtensions": [
99
"ts",
1010
"tsx",
@@ -14,7 +14,7 @@
1414
"rootDir": "./",
1515
"testRegex": "\\.test\\.(ts|tsx)$",
1616
"transform": {
17-
"\\.(ts|tsx)$": "ts-jest/preprocessor.js"
17+
"\\.(ts|tsx)$": "ts-jest"
1818
},
1919
"verbose": true
2020
}

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-plugin-styled-components",
3-
"version": "1.1.0-rc",
3+
"version": "1.3.0",
44
"description": "TypeScript transformer for improving the debugging experience of styled-components",
55
"main": "dist/index.js",
66
"homepage": "https://github.com/Igorbek/typescript-plugin-styled-components",
@@ -13,6 +13,7 @@
1313
"scripts": {
1414
"build": "tsc",
1515
"build:prod": "tsc --sourceMap false",
16+
"typecheck": "tsc --noEmit",
1617
"test:baselines": "jest --config ./jest.config.json",
1718
"test:watch": "yarn test:baselines -- --watch",
1819
"test": "yarn test:baselines",
@@ -23,16 +24,16 @@
2324
"typescript": "^2.5.2 || ^3.0"
2425
},
2526
"devDependencies": {
26-
"@types/jest": "^19.2.4",
27-
"@types/jest-specific-snapshot": "^0.5.1",
27+
"@types/jest": "^24.0.9",
28+
"@types/jest-specific-snapshot": "^0.5.3",
2829
"@types/node": "^7.0.31",
29-
"@types/react": "^16.3.13",
30-
"jest": "20",
31-
"jest-specific-snapshot": "^1.0.0",
32-
"styled-components": "^2.1.2",
33-
"ts-jest": "20",
34-
"ts-node": "^3.3.0",
35-
"typescript": "^2.8.3"
30+
"@types/react": "^16.7.22",
31+
"@types/styled-components": "^4.1.6",
32+
"jest": "^24.1.0",
33+
"jest-specific-snapshot": "^2.0.0",
34+
"ts-jest": "24.0.0",
35+
"ts-node": "^8.0.2",
36+
"typescript": "^3.3.1"
3637
},
3738
"files": [
3839
"dist"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue33.ts 1`] = `
4+
5+
File: issue33.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
declare const $: any;
10+
declare const jQuery: any;
11+
declare const _: any;
12+
13+
declare const Button: any;
14+
15+
const Button1 = Button.extend\` color: red \`;
16+
17+
const Button2 = $.extend\` color: red \`;
18+
const Button3 = jQuery.extend\` color: red \`;
19+
const Button4 = _.extend\` color: red \`;
20+
21+
22+
TypeScript before transform:
23+
24+
declare const styled: any;
25+
declare const $: any;
26+
declare const jQuery: any;
27+
declare const _: any;
28+
declare const Button: any;
29+
const Button1 = Button.extend \` color: red \`;
30+
const Button2 = $.extend \` color: red \`;
31+
const Button3 = jQuery.extend \` color: red \`;
32+
const Button4 = _.extend \` color: red \`;
33+
34+
35+
TypeScript after transform:
36+
37+
declare const styled: any;
38+
declare const $: any;
39+
declare const jQuery: any;
40+
declare const _: any;
41+
declare const Button: any;
42+
const Button1 = Button.extend.withConfig({ displayName: "Button1" }) \` color: red \`;
43+
const Button2 = $.extend \` color: red \`;
44+
const Button3 = jQuery.extend \` color: red \`;
45+
const Button4 = _.extend \` color: red \`;
46+
47+
48+
49+
`;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`style-objects.ts 1`] = `
4+
5+
File: style-objects.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
10+
const Button = styled.button({
11+
color: 'red'
12+
});
13+
14+
declare const nonStyled: any;
15+
16+
const NonButton = nonStyled.button({
17+
color: 'red'
18+
});
19+
20+
const OtherButton = styled(Button)({
21+
color: 'blue'
22+
});
23+
24+
const SuperButton = Button.extend({
25+
color: 'super'
26+
});
27+
28+
export default styled.link({
29+
color: 'black'
30+
});
31+
32+
export const SmallButton = Button.extend({
33+
fontSize: '.7em'
34+
});
35+
36+
const MiniButton = styled(SmallButton).attrs({ size: 'mini' })({
37+
fontSize: '.1em'
38+
});
39+
40+
41+
TypeScript before transform:
42+
43+
declare const styled: any;
44+
const Button = styled.button({
45+
color: "red"
46+
});
47+
declare const nonStyled: any;
48+
const NonButton = nonStyled.button({
49+
color: "red"
50+
});
51+
const OtherButton = styled(Button)({
52+
color: "blue"
53+
});
54+
const SuperButton = Button.extend({
55+
color: "super"
56+
});
57+
export default styled.link({
58+
color: "black"
59+
});
60+
export const SmallButton = Button.extend({
61+
fontSize: ".7em"
62+
});
63+
const MiniButton = styled(SmallButton).attrs({ size: "mini" })({
64+
fontSize: ".1em"
65+
});
66+
67+
68+
TypeScript after transform:
69+
70+
declare const styled: any;
71+
const Button = styled.button.withConfig({ displayName: "Button" })({
72+
color: 'red'
73+
});
74+
declare const nonStyled: any;
75+
const NonButton = nonStyled.button({
76+
color: 'red'
77+
});
78+
const OtherButton = styled(Button).withConfig({ displayName: "OtherButton" })({
79+
color: 'blue'
80+
});
81+
const SuperButton = Button.extend.withConfig({ displayName: "SuperButton" })({
82+
color: 'super'
83+
});
84+
export default styled.link({
85+
color: 'black'
86+
});
87+
export const SmallButton = Button.extend.withConfig({ displayName: "SmallButton" })({
88+
fontSize: '.7em'
89+
});
90+
const MiniButton = styled(SmallButton).attrs({ size: "mini" }).withConfig({ displayName: "MiniButton" })({
91+
fontSize: '.1em'
92+
});
93+
94+
95+
96+
`;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue33.ts 1`] = `
4+
5+
File: issue33.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
declare const $: any;
10+
declare const jQuery: any;
11+
declare const _: any;
12+
13+
declare const Button: any;
14+
15+
const Button1 = Button.extend\` color: red \`;
16+
17+
const Button2 = $.extend\` color: red \`;
18+
const Button3 = jQuery.extend\` color: red \`;
19+
const Button4 = _.extend\` color: red \`;
20+
21+
22+
TypeScript before transform:
23+
24+
declare const styled: any;
25+
declare const $: any;
26+
declare const jQuery: any;
27+
declare const _: any;
28+
declare const Button: any;
29+
const Button1 = Button.extend \` color: red \`;
30+
const Button2 = $.extend \` color: red \`;
31+
const Button3 = jQuery.extend \` color: red \`;
32+
const Button4 = _.extend \` color: red \`;
33+
34+
35+
TypeScript after transform:
36+
37+
declare const styled: any;
38+
declare const $: any;
39+
declare const jQuery: any;
40+
declare const _: any;
41+
declare const Button: any;
42+
const Button1 = Button.extend.withConfig({ displayName: "Button1", componentId: "sc-1iinolv" }) \` color: red \`;
43+
const Button2 = $.extend \` color: red \`;
44+
const Button3 = jQuery.extend \` color: red \`;
45+
const Button4 = _.extend \` color: red \`;
46+
47+
48+
49+
`;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`style-objects.ts 1`] = `
4+
5+
File: style-objects.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
10+
const Button = styled.button({
11+
color: 'red'
12+
});
13+
14+
declare const nonStyled: any;
15+
16+
const NonButton = nonStyled.button({
17+
color: 'red'
18+
});
19+
20+
const OtherButton = styled(Button)({
21+
color: 'blue'
22+
});
23+
24+
const SuperButton = Button.extend({
25+
color: 'super'
26+
});
27+
28+
export default styled.link({
29+
color: 'black'
30+
});
31+
32+
export const SmallButton = Button.extend({
33+
fontSize: '.7em'
34+
});
35+
36+
const MiniButton = styled(SmallButton).attrs({ size: 'mini' })({
37+
fontSize: '.1em'
38+
});
39+
40+
41+
TypeScript before transform:
42+
43+
declare const styled: any;
44+
const Button = styled.button({
45+
color: "red"
46+
});
47+
declare const nonStyled: any;
48+
const NonButton = nonStyled.button({
49+
color: "red"
50+
});
51+
const OtherButton = styled(Button)({
52+
color: "blue"
53+
});
54+
const SuperButton = Button.extend({
55+
color: "super"
56+
});
57+
export default styled.link({
58+
color: "black"
59+
});
60+
export const SmallButton = Button.extend({
61+
fontSize: ".7em"
62+
});
63+
const MiniButton = styled(SmallButton).attrs({ size: "mini" })({
64+
fontSize: ".1em"
65+
});
66+
67+
68+
TypeScript after transform:
69+
70+
declare const styled: any;
71+
const Button = styled.button.withConfig({ displayName: "Button", componentId: "sc-7b7p9e" })({
72+
color: 'red'
73+
});
74+
declare const nonStyled: any;
75+
const NonButton = nonStyled.button({
76+
color: 'red'
77+
});
78+
const OtherButton = styled(Button).withConfig({ displayName: "OtherButton", componentId: "sc-14ah7t" })({
79+
color: 'blue'
80+
});
81+
const SuperButton = Button.extend.withConfig({ displayName: "SuperButton", componentId: "sc-1t5v351" })({
82+
color: 'super'
83+
});
84+
export default styled.link({
85+
color: 'black'
86+
});
87+
export const SmallButton = Button.extend.withConfig({ displayName: "SmallButton", componentId: "sc-ftk9hu" })({
88+
fontSize: '.7em'
89+
});
90+
const MiniButton = styled(SmallButton).attrs({ size: "mini" }).withConfig({ displayName: "MiniButton", componentId: "sc-15rszef" })({
91+
fontSize: '.1em'
92+
});
93+
94+
95+
96+
`;

src/__tests__/expectTransform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface TransformBaseline {
1414
}
1515

1616
const serializer = {
17-
test: obj => obj && obj.type === 'transform-baseline',
17+
test: (obj: any): obj is TransformBaseline => obj && obj.type === 'transform-baseline',
1818
print: (obj: TransformBaseline, print: (object: any) => string, indent: (str: string) => string) => `
1919
File: ${obj.filename}
2020
Source code:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
declare const styled: any;
2+
declare const $: any;
3+
declare const jQuery: any;
4+
declare const _: any;
5+
6+
declare const Button: any;
7+
8+
const Button1 = Button.extend` color: red `;
9+
10+
const Button2 = $.extend` color: red `;
11+
const Button3 = jQuery.extend` color: red `;
12+
const Button4 = _.extend` color: red `;

0 commit comments

Comments
 (0)