Skip to content

Commit 52d7830

Browse files
authored
Merge branch 'master' into chore/update-codeowners-gwong
2 parents 166ae8f + 33b0e55 commit 52d7830

File tree

22 files changed

+1445
-641
lines changed

22 files changed

+1445
-641
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
"flow-bin": "^0.183.0",
9292
"flowgen": "^1.20.1",
9393
"husky": "^4.3.8",
94-
"jest": "^26.6.3",
94+
"jest": "^29.3.1",
95+
"jest-environment-jsdom": "^29.3.1",
9596
"jest-extended": "^0.11.5",
9697
"jest-watch-typeahead": "^0.6.5",
9798
"loki": "^0.31.0",

packages/babel-plugin/src/__tests__/css-builder.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ describe('css builder', () => {
2828
expect(actual).toIncludeMultiple(['{color:var(--_1ylxx6h)}', '"--_1ylxx6h": ix(color)']);
2929

3030
expect(actual).toMatchInlineSnapshot(`
31-
"import * as React from \\"react\\";
32-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
33-
const _2 = \\"._syaz1aj3{color:var(--_1ylxx6h)}\\";
34-
const _ = \\"._bfhk8ruw{background-color:var(--_agotg1)}\\";
31+
"import * as React from "react";
32+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
33+
const _2 = "._syaz1aj3{color:var(--_1ylxx6h)}";
34+
const _ = "._bfhk8ruw{background-color:var(--_agotg1)}";
3535
const getBackgroundColor = (color) => color;
3636
const color = baseColor;
3737
<CC>
3838
<CS>{[_, _2]}</CS>
3939
{
4040
<div
41-
className={ax([\\"_bfhk8ruw _syaz1aj3\\"])}
41+
className={ax(["_bfhk8ruw _syaz1aj3"])}
4242
style={{
43-
\\"--_agotg1\\": ix(getBackgroundColor(customBackgroundColor)),
44-
\\"--_1ylxx6h\\": ix(color),
43+
"--_agotg1": ix(getBackgroundColor(customBackgroundColor)),
44+
"--_1ylxx6h": ix(color),
4545
}}
4646
/>
4747
}

packages/babel-plugin/src/__tests__/index.test.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('babel plugin', () => {
1717
`);
1818

1919
expect(actual).toMatchInlineSnapshot(`
20-
"import { ClassNames } from \\"@compiled/react/runtime\\";
20+
"import { ClassNames } from "@compiled/react/runtime";
2121
"
2222
`);
2323
});
@@ -59,27 +59,27 @@ describe('babel plugin', () => {
5959

6060
expect(actual).toMatchInlineSnapshot(`
6161
"/* File generated by @compiled/babel-plugin v0.0.0 */
62-
import { forwardRef } from \\"react\\";
63-
import * as React from \\"react\\";
64-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
65-
const _ = \\"._1wyb1fwx{font-size:12px}\\";
62+
import { forwardRef } from "react";
63+
import * as React from "react";
64+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
65+
const _ = "._1wyb1fwx{font-size:12px}";
6666
const MyDiv = forwardRef(
67-
({ as: C = \\"div\\", style: __cmpls, ...__cmplp }, __cmplr) => {
67+
({ as: C = "div", style: __cmpls, ...__cmplp }, __cmplr) => {
6868
return (
6969
<CC>
7070
<CS>{[_]}</CS>
7171
<C
7272
{...__cmplp}
7373
style={__cmpls}
7474
ref={__cmplr}
75-
className={ax([\\"_1wyb1fwx\\", __cmplp.className])}
75+
className={ax(["_1wyb1fwx", __cmplp.className])}
7676
/>
7777
</CC>
7878
);
7979
}
8080
);
81-
if (process.env.NODE_ENV !== \\"production\\") {
82-
MyDiv.displayName = \\"MyDiv\\";
81+
if (process.env.NODE_ENV !== "production") {
82+
MyDiv.displayName = "MyDiv";
8383
}
8484
"
8585
`);
@@ -96,14 +96,14 @@ describe('babel plugin', () => {
9696

9797
expect(actual).toMatchInlineSnapshot(`
9898
"/* File generated by @compiled/babel-plugin v0.0.0 */
99-
import * as React from \\"react\\";
100-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
101-
const _ = \\"._1wyb1fwx{font-size:12px}\\";
99+
import * as React from "react";
100+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
101+
const _ = "._1wyb1fwx{font-size:12px}";
102102
const MyDiv = () => {
103103
return (
104104
<CC>
105105
<CS>{[_]}</CS>
106-
{<div className={ax([\\"_1wyb1fwx\\"])}>hello</div>}
106+
{<div className={ax(["_1wyb1fwx"])}>hello</div>}
107107
</CC>
108108
);
109109
};
@@ -126,14 +126,14 @@ describe('babel plugin', () => {
126126
expect(actual).toMatchInlineSnapshot(`
127127
"/* File generated by @compiled/babel-plugin v0.0.0 */
128128
// @flow strict-local
129-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
130-
import React from \\"react\\";
131-
const _ = \\"._1wyb1fwx{font-size:12px}\\";
129+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
130+
import React from "react";
131+
const _ = "._1wyb1fwx{font-size:12px}";
132132
const MyDiv = () => {
133133
return (
134134
<CC>
135135
<CS>{[_]}</CS>
136-
{<div className={ax([\\"_1wyb1fwx\\"])}>hello</div>}
136+
{<div className={ax(["_1wyb1fwx"])}>hello</div>}
137137
</CC>
138138
);
139139
};
@@ -151,7 +151,7 @@ describe('babel plugin', () => {
151151
`);
152152

153153
expect(actual).toMatchInlineSnapshot(`
154-
"import { CC } from \\"@compiled/react/runtime\\";
154+
"import { CC } from "@compiled/react/runtime";
155155
<CC>
156156
<div />
157157
</CC>;
@@ -173,14 +173,14 @@ describe('babel plugin', () => {
173173

174174
expect(actual).toMatchInlineSnapshot(`
175175
"/* File generated by @compiled/babel-plugin v0.0.0 */
176-
import * as React from \\"react\\";
177-
import { CC as CompiledRoot, ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
178-
const _ = \\"._1e0c1ule{display:block}\\";
179-
const classes = ax([\\"1\\", \\"2\\"]);
176+
import * as React from "react";
177+
import { CC as CompiledRoot, ax, ix, CC, CS } from "@compiled/react/runtime";
178+
const _ = "._1e0c1ule{display:block}";
179+
const classes = ax(["1", "2"]);
180180
<CompiledRoot>
181181
<CC>
182182
<CS>{[_]}</CS>
183-
{<div className={ax([\\"_1e0c1ule\\"])} />}
183+
{<div className={ax(["_1e0c1ule"])} />}
184184
</CC>
185185
</CompiledRoot>;
186186
"

packages/babel-plugin/src/__tests__/jsx-automatic.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ describe('jsx automatic', () => {
1111
`);
1212

1313
expect(actual).toMatchInlineSnapshot(`
14-
"import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
15-
import { jsxs as _jsxs } from \\"react/jsx-runtime\\";
16-
import { jsx as _jsx } from \\"react/jsx-runtime\\";
17-
const _ = \\"._syaz13q2{color:blue}\\";
14+
"import { ax, ix, CC, CS } from "@compiled/react/runtime";
15+
import { jsxs as _jsxs } from "react/jsx-runtime";
16+
import { jsx as _jsx } from "react/jsx-runtime";
17+
const _ = "._syaz13q2{color:blue}";
1818
_jsxs(CC, {
1919
children: [
2020
_jsx(CS, {
2121
children: [_],
2222
}),
23-
_jsx(\\"div\\", {
24-
className: ax([\\"_syaz13q2\\"]),
23+
_jsx("div", {
24+
className: ax(["_syaz13q2"]),
2525
}),
2626
],
2727
});
@@ -39,17 +39,17 @@ describe('jsx automatic', () => {
3939
`);
4040

4141
expect(actual).toMatchInlineSnapshot(`
42-
"import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
43-
import { jsx as _jsx } from \\"react/jsx-runtime\\";
44-
import { jsxs as _jsxs } from \\"react/jsx-runtime\\";
45-
const _ = \\"._syaz13q2{color:blue}\\";
42+
"import { ax, ix, CC, CS } from "@compiled/react/runtime";
43+
import { jsx as _jsx } from "react/jsx-runtime";
44+
import { jsxs as _jsxs } from "react/jsx-runtime";
45+
const _ = "._syaz13q2{color:blue}";
4646
_jsxs(CC, {
4747
children: [
4848
_jsx(CS, {
4949
children: [_],
5050
}),
51-
_jsx(\\"div\\", {
52-
className: \\"_syaz13q2\\",
51+
_jsx("div", {
52+
className: "_syaz13q2",
5353
}),
5454
],
5555
});
@@ -67,12 +67,12 @@ describe('jsx automatic', () => {
6767
`);
6868

6969
expect(actual).toMatchInlineSnapshot(`
70-
"import { forwardRef } from \\"react\\";
71-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
72-
import { jsx as _jsx } from \\"react/jsx-runtime\\";
73-
import { jsxs as _jsxs } from \\"react/jsx-runtime\\";
74-
const _ = \\"._syaz13q2{color:blue}\\";
75-
forwardRef(({ as: C = \\"div\\", style: __cmpls, ...__cmplp }, __cmplr) => {
70+
"import { forwardRef } from "react";
71+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
72+
import { jsx as _jsx } from "react/jsx-runtime";
73+
import { jsxs as _jsxs } from "react/jsx-runtime";
74+
const _ = "._syaz13q2{color:blue}";
75+
forwardRef(({ as: C = "div", style: __cmpls, ...__cmplp }, __cmplr) => {
7676
return _jsxs(CC, {
7777
children: [
7878
_jsx(CS, {
@@ -82,7 +82,7 @@ describe('jsx automatic', () => {
8282
...__cmplp,
8383
style: __cmpls,
8484
ref: __cmplr,
85-
className: ax([\\"_syaz13q2\\", __cmplp.className]),
85+
className: ax(["_syaz13q2", __cmplp.className]),
8686
}),
8787
],
8888
});

packages/babel-plugin/src/__tests__/module-imports.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,27 @@ describe('import specifiers', () => {
7272
`);
7373

7474
expect(actual).toMatchInlineSnapshot(`
75-
"import { forwardRef } from \\"react\\";
76-
import * as React from \\"react\\";
77-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
78-
const _ = \\"._1wybgktf{font-size:20px}\\";
75+
"import { forwardRef } from "react";
76+
import * as React from "react";
77+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
78+
const _ = "._1wybgktf{font-size:20px}";
7979
const ListItem = forwardRef(
80-
({ as: C = \\"div\\", style: __cmpls, ...__cmplp }, __cmplr) => {
80+
({ as: C = "div", style: __cmpls, ...__cmplp }, __cmplr) => {
8181
return (
8282
<CC>
8383
<CS>{[_]}</CS>
8484
<C
8585
{...__cmplp}
8686
style={__cmpls}
8787
ref={__cmplr}
88-
className={ax([\\"_1wybgktf\\", __cmplp.className])}
88+
className={ax(["_1wybgktf", __cmplp.className])}
8989
/>
9090
</CC>
9191
);
9292
}
9393
);
94-
if (process.env.NODE_ENV !== \\"production\\") {
95-
ListItem.displayName = \\"ListItem\\";
94+
if (process.env.NODE_ENV !== "production") {
95+
ListItem.displayName = "ListItem";
9696
}
9797
"
9898
`);

packages/babel-plugin/src/__tests__/rule-hoisting.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ describe('rule hoisting', () => {
1414
`);
1515

1616
expect(actual).toMatchInlineSnapshot(`
17-
"import * as React from \\"react\\";
18-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
19-
const _2 = \\"._1wyb1tcg{font-size:24px}\\";
20-
const _ = \\"._1wyb1fwx{font-size:12px}\\";
17+
"import * as React from "react";
18+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
19+
const _2 = "._1wyb1tcg{font-size:24px}";
20+
const _ = "._1wyb1fwx{font-size:12px}";
2121
const Component = () => (
2222
<>
2323
<CC>
2424
<CS>{[_]}</CS>
25-
{<div className={ax([\\"_1wyb1fwx\\"])}>hello world</div>}
25+
{<div className={ax(["_1wyb1fwx"])}>hello world</div>}
2626
</CC>
2727
<CC>
2828
<CS>{[_2]}</CS>
29-
{<div className={ax([\\"_1wyb1tcg\\"])}>hello world</div>}
29+
{<div className={ax(["_1wyb1tcg"])}>hello world</div>}
3030
</CC>
3131
</>
3232
);
@@ -47,18 +47,18 @@ describe('rule hoisting', () => {
4747
`);
4848

4949
expect(actual).toMatchInlineSnapshot(`
50-
"import * as React from \\"react\\";
51-
import { ax, ix, CC, CS } from \\"@compiled/react/runtime\\";
52-
const _ = \\"._1wyb1fwx{font-size:12px}\\";
50+
"import * as React from "react";
51+
import { ax, ix, CC, CS } from "@compiled/react/runtime";
52+
const _ = "._1wyb1fwx{font-size:12px}";
5353
const Component = () => (
5454
<>
5555
<CC>
5656
<CS>{[_]}</CS>
57-
{<div className={ax([\\"_1wyb1fwx\\"])}>hello world</div>}
57+
{<div className={ax(["_1wyb1fwx"])}>hello world</div>}
5858
</CC>
5959
<CC>
6060
<CS>{[_]}</CS>
61-
{<div className={ax([\\"_1wyb1fwx\\"])}>hello world</div>}
61+
{<div className={ax(["_1wyb1fwx"])}>hello world</div>}
6262
</CC>
6363
</>
6464
);

0 commit comments

Comments
 (0)