",
10 | "location": {
11 | "start": {
12 | "offset": 5,
13 | "line": 1,
14 | "column": 6
15 | },
16 | "end": {
17 | "offset": 7,
18 | "line": 1,
19 | "column": 8
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/cspell.json:
--------------------------------------------------------------------------------
1 | {
2 | "words": [
3 | "Constify",
4 | "ctxt",
5 | "hasher",
6 | "lightningcss",
7 | "quasis",
8 | "rustc",
9 | "swcrc",
10 | "prefresh"
11 | ]
12 | }
--------------------------------------------------------------------------------
/packages/emotion/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/emotion/__tests__/fixtures/input.js:
--------------------------------------------------------------------------------
1 | const myStyles = css`
2 | font-size: 20px;
3 | @media (min-width: 420px) {
4 | color: blue;
5 | ${css`
6 | width: 96px;
7 | height: 96px;
8 | `};
9 | line-height: 26px;
10 | }
11 | background: green;
12 | ${{ backgroundColor: "hotpink" }};
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/comments/input.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export default styled.div`
4 | color: red;
5 | .foo {
6 | color: blue;
7 | /**
8 | multi line comments
9 | */
10 | }
11 | /* /* */
12 | width: 10px;
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/global-needs-css/input.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import { SomeGlobalFromCore } from "package-two";
3 |
4 | const getBgColor = () => ({ backgroundColor: "#fff" });
5 |
6 | export default () => (
7 |
8 | );
9 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/global/input.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import { SomeGlobalFromCore } from "package-two";
3 |
4 | export default () => ;
5 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/non-default-styled-aliased/input.tsx:
--------------------------------------------------------------------------------
1 | import { nonDefaultStyled as someAlias } from "package-one";
2 |
3 | let SomeComp = someAlias.div({ color: "hotpink" });
4 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/non-default-styled/input.tsx:
--------------------------------------------------------------------------------
1 | import { nonDefaultStyled } from "package-one";
2 |
3 | let SomeComp = nonDefaultStyled.div({ color: "hotpink" });
4 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/styled-with-base-specified/input.tsx:
--------------------------------------------------------------------------------
1 | import { nonDefaultStyled } from "package-four";
2 |
3 | let SomeComp = nonDefaultStyled.div({ color: "hotpink" });
4 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/vanilla/input.tsx:
--------------------------------------------------------------------------------
1 | import { something } from "package-three";
2 |
3 | something({ color: "green" });
4 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/import-map/vanilla/output.ts:
--------------------------------------------------------------------------------
1 | import { something } from "package-three";
2 | /*#__PURE__*/ something({
3 | color: "green"
4 | }, "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHNvbWV0aGluZyB9IGZyb20gXCJwYWNrYWdlLXRocmVlXCI7XG5cbnNvbWV0aGluZyh7IGNvbG9yOiBcImdyZWVuXCIgfSk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEifQ== */");
5 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/issue-258/input.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | styled.div`
4 | background-image: url("//domain.com/image.png");
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/issues/201/input.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | function makeOptions() {
4 | return {
5 | shouldForwardProp: (propertyName: string) => !propertyName.startsWith("$"),
6 | };
7 | }
8 | const ContainerWithOptions = styled("div", makeOptions())`
9 | color: hotpink;
10 | `;
11 |
12 | const ContainerWithOptions2 = styled(
13 | "div",
14 | makeOptions(),
15 | )({
16 | color: "hotpink",
17 | });
18 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/fixture/issues/39672/input.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | const SelectedComponent = styled.p`
4 | color: red;
5 |
6 | &:after {
7 | content: " | ";
8 | }
9 | `;
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.tsx:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/actual-expected-usage.js
2 |
3 | import { jsx, css } from "@emotion/react";
4 |
5 | const SomeComponent = () => (
6 |
11 | );
12 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/basic.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/basic.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | function doThing() {
6 | return css`
7 | display: flex;
8 | `;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/call-expression.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/call-expression.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | function doThing() {
6 | return css({ color: "hotpink" });
7 | }
8 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/call-inside-call.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const thing = css`
6 | display: flex;
7 | &:hover {
8 | ${css`
9 | color: hotpink;
10 | `};
11 | }
12 | `;
13 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/comment-with-interpolation.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | css`
6 | // color: ${"green"};
7 | /*
8 |
9 | something: ${"something"};
10 |
11 | */
12 | color: hotpink;
13 | `;
14 |
15 | css`
16 | // color: ${"green"};
17 | /*
18 |
19 | something: ${"something"};
20 |
21 | */
22 | color: ${"hotpink"};
23 | `;
24 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/css-inside-function.ts:
--------------------------------------------------------------------------------
1 | import { css } from "@emotion/css";
2 |
3 | const wrapFunction = (cb) => {
4 | return cb();
5 | }
6 |
7 | export const classes = wrapFunction(() => {
8 | const class1 = css({color: "red"});
9 |
10 | return {
11 | class1,
12 | }
13 | });
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/impure.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/impure.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | function thing() {}
6 |
7 | function doThing() {
8 | return css`
9 | display: ${thing()};
10 | `;
11 | }
12 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-anonymous-arrow-function.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | export default () => {
6 | css`
7 | color: hotpink;
8 | `;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-anonymous-function.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | export default () => {
6 | css`
7 | color: hotpink;
8 | `;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-1.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-1.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const thing = css`
6 | color: hotpink;
7 | `;
8 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-arrow-as-obj-property.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | export const styles = {
6 | colorFn1: () => css`
7 | color: hotpink;
8 | `,
9 | };
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-as-obj-property.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | export const styles = {
6 | colorFn1: function () {
7 | return css`
8 | color: hotpink;
9 | `;
10 | },
11 | };
12 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-named.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const thing = function someName() {
6 | return css`
7 | color: hotpink;
8 | `;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const thing = function () {
6 | return css`
7 | color: hotpink;
8 | `;
9 | };
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-no-final-semi.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | // prettier-ignore
6 | const thing = css`
7 | color: hotpink
8 | `
9 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.tsx:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-obj-method.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const obj = {
6 | FooBar() {
7 | return (
8 |
13 | );
14 | },
15 | };
16 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.tsx:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-obj-property-literal.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const obj = {
6 | "red component": (
7 |
12 | ),
13 | };
14 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/label-object.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-object.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const thing = {
6 | thisShouldBeTheLabel: css`
7 | color: hotpink;
8 | `,
9 | // prettier-ignore
10 | 'shouldBeAnotherLabel':css`
11 | color:green;
12 | `,
13 | };
14 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/multiple-calls.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const thing = css`
6 | color: hotpink;
7 | `;
8 |
9 | const otherThing = css`
10 | color: green;
11 | `;
12 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.js:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-actual-import.js
2 | import "@emotion/react";
3 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-actual-import.js
2 |
3 | import "@emotion/react";
4 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-array-pattern.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const [weirdo] = [
6 | css`
7 | color: hotpink;
8 | `,
9 | ];
10 |
11 | export default weirdo;
12 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-obj-pattern-computed-property.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | const computed = "weirdo";
6 |
7 | const { weirdo } = {
8 | [computed]: css`
9 | color: hotpink;
10 | `,
11 | };
12 |
13 | export default weirdo;
14 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/object-dynamic-property.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | function doThing() {
6 | return {
7 | [css({ color: "hotpink" })]: "coldblue",
8 | };
9 | }
10 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/other-imports.js:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/other-imports.js
2 | import { nonExistantImport } from "@emotion/react";
3 | nonExistantImport();
4 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/other-imports.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/other-imports.js
2 |
3 | import { nonExistantImport } from "@emotion/react";
4 |
5 | nonExistantImport();
6 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/remove-block-comments.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | css`
6 | /* color:green;
7 | ddjfwjkng
8 | */
9 | color: hotpink;
10 | `;
11 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/remove-line-comments.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | css`
6 | // color: green;
7 | color: hotpink;
8 | `;
9 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/tagged-template-args-forwarded.js
2 |
3 | import { css } from "@emotion/react";
4 |
5 | function media(...args) {
6 | return css`
7 | @media (min-width: 100px) {
8 | ${css(...args)};
9 | }
10 | `;
11 | }
12 |
13 | const test = css`
14 | ${media`color: red;`};
15 | `;
16 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/options/input.tsx:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export const StyledDiv = styled.div`
4 | background-color: black;
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/sanitisation/bad.const.name.ts:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export const Dollar$Div = styled.div`
4 | background-color: black;
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.ts:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export const StyledDiv = styled.div`
4 | background-color: black;
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/emotion/transform/tests/labels/sanitisation/input.styles.ts:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export const StyledDiv = styled.div`
4 | background-color: black;
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/formatjs/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/formatjs/README.tmpl.md:
--------------------------------------------------------------------------------
1 | # @swc/plugin-formatjs
2 |
3 | FormatJS SWC plugin, maintained by SWC team.
4 |
5 | ${CHANGELOG}
6 |
--------------------------------------------------------------------------------
/packages/jest/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | Cargo.lock
3 |
--------------------------------------------------------------------------------
/packages/jest/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/jest/README.tmpl.md:
--------------------------------------------------------------------------------
1 | # @swc/plugin-jest
2 |
3 | ${CHANGELOG}
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/loadable-components/src/util.rs:
--------------------------------------------------------------------------------
1 | use swc_core::ecma::ast::*;
2 |
3 | pub(crate) fn get_import_arg(call: &CallExpr) -> &Expr {
4 | &call.args[0].expr
5 | }
6 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/aggressive import/should work with destructuration/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(({ foo }) => import(/* webpackChunkName: "Pages" */ `./${foo}`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should keep it/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(
3 | (props) =>
4 | import(/* webpackChunkName: "pages/[request]" */ `./pages/${props.path}`),
5 | );
6 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/aggressive import/with webpackChunkName/should replace it/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable((props) => import(/* webpackChunkName: "Pages" */ `./${props.foo}`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support complex request/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable((props) => import(`./dir/${props.foo}/test`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support destructuring/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(({ foo }) => import(`./dir/${foo}/test`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/aggressive import/without webpackChunkName/should support simple request/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable((props) => import(`./${props.foo}`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/lazy/should be transpiled too/input.js:
--------------------------------------------------------------------------------
1 | import { lazy } from "@loadable/component";
2 |
3 | lazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/lazy/should not work without imported/input.js:
--------------------------------------------------------------------------------
1 | import { lazy } from "react";
2 |
3 | lazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/lazy/should not work without imported/output.js:
--------------------------------------------------------------------------------
1 | import { lazy } from "react";
2 |
3 | lazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/lazy/should work with renamed specifier/input.js:
--------------------------------------------------------------------------------
1 | import { lazy as renamedLazy } from "@loadable/component";
2 |
3 | renamedLazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/loadable.lib/should be transpiled too/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable.lib(() => import("moment"));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/magic comments/should remove only needed comments/input.js:
--------------------------------------------------------------------------------
1 | const load = /* #__LOADABLE__ */ /* IMPORTANT! */ () => import("moment");
2 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/magic comments/should transpile arrow functions/input.js:
--------------------------------------------------------------------------------
1 | const load = /* #__LOADABLE__ */ () => import("moment");
2 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/magic comments/should transpile function expression/input.js:
--------------------------------------------------------------------------------
1 | const load = /* #__LOADABLE__ */ function () {
2 | return import("moment");
3 | };
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/magic comments/should transpile shortand properties/input.js:
--------------------------------------------------------------------------------
1 | const obj = {
2 | /* #__LOADABLE__ */
3 | load() {
4 | return import("moment");
5 | },
6 | };
7 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/signatures/should not transpile unconfigured/input.js:
--------------------------------------------------------------------------------
1 | import { lazy } from "other-package";
2 |
3 | lazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/signatures/should not transpile unconfigured/output.js:
--------------------------------------------------------------------------------
1 | import { lazy } from "other-package";
2 |
3 | lazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/signatures/should transpile configured custom default/input.js:
--------------------------------------------------------------------------------
1 | import custom from "my-custom-package";
2 |
3 | custom(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/signatures/should transpile configured custom/input.js:
--------------------------------------------------------------------------------
1 | import { custom } from "my-custom-package";
2 |
3 | custom(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/signatures/should transpile configured/input.js:
--------------------------------------------------------------------------------
1 | import { lazy } from "my-custom-package";
2 |
3 | lazy(() => import("./ModA"));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/in a complex promise/should work/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => timeout(import("./ModA"), 2000));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/should transform path into chunk-friendly name/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => import("../foo/bar"));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/should work with mul in name/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => import(`./foo*`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/should work with plus concatenation/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => import("./Mod" + "A"));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/should work with template literal/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => import(`./ModA`));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should add it/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => import("./ModA"));
3 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if comment is separated by ,/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(
3 | () =>
4 | import(/* webpackPrefetch: true, webpackChunkName: "ChunkA" */ "./ModA"),
5 | );
6 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it even if quote is single/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 |
3 | loadable(() => import(/* webpackChunkName: 'ChunkA' */ ""));
4 |
--------------------------------------------------------------------------------
/packages/loadable-components/tests/fixture/simple import/with webpackChunkName comment/should use it/input.js:
--------------------------------------------------------------------------------
1 | import loadable from "@loadable/component";
2 | loadable(() => import(/* webpackChunkName: "ChunkA" */ "./ModA"));
3 |
--------------------------------------------------------------------------------
/packages/noop/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | Cargo.lock
3 |
--------------------------------------------------------------------------------
/packages/noop/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/noop/README.tmpl.md:
--------------------------------------------------------------------------------
1 | # @swc/plugin-noop
2 |
3 | ${CHANGELOG}
4 |
--------------------------------------------------------------------------------
/packages/noop/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![allow(clippy::not_unsafe_ptr_arg_deref)]
2 |
3 | use swc_core::plugin::proxies::TransformPluginProgramMetadata;
4 | use swc_ecma_ast::Program;
5 | use swc_plugin_macro::plugin_transform;
6 |
7 | #[plugin_transform]
8 | fn plugin(program: Program, _: TransformPluginProgramMetadata) -> Program {
9 | program
10 | }
11 |
--------------------------------------------------------------------------------
/packages/prefresh/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | Cargo.lock
3 |
--------------------------------------------------------------------------------
/packages/prefresh/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/basic/input.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'preact';
2 |
3 | export function aaa() {
4 | const context = createContext();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/basic/output.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'preact';
2 | export function aaa() {
3 | const context = createContext[`__file_hash__$context1`] || (createContext[`__file_hash__$context1`] = createContext());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_custom_preact/input.js:
--------------------------------------------------------------------------------
1 | import { createContext } from '@custom/preact';
2 |
3 | export function aaa() {
4 | const context = createContext();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_custom_preact/output.js:
--------------------------------------------------------------------------------
1 | import { createContext } from '@custom/preact';
2 | export function aaa() {
3 | const context = createContext[`__file_hash__$context1`] || (createContext[`__file_hash__$context1`] = createContext());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_default/input.js:
--------------------------------------------------------------------------------
1 | import pp from 'preact';
2 |
3 | export function aaa(a, b) {
4 | const context = pp.createContext();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_default/output.js:
--------------------------------------------------------------------------------
1 | import pp from 'preact';
2 | export function aaa(a, b) {
3 | const context = pp.createContext[`__file_hash__$context1_${a}${b}`] || (pp.createContext[`__file_hash__$context1_${a}${b}`] = pp.createContext());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_lib_computed/input.js:
--------------------------------------------------------------------------------
1 | import pp from 'preact';
2 |
3 | export function aaa(a, b) {
4 | const context = pp["createContext"]();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_lib_computed/output.js:
--------------------------------------------------------------------------------
1 | import pp from 'preact';
2 | export function aaa(a, b) {
3 | const context = pp["createContext"][`__file_hash__$context1_${a}${b}`] || (pp["createContext"][`__file_hash__$context1_${a}${b}`] = pp["createContext"]());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_named/input.js:
--------------------------------------------------------------------------------
1 | import { createContext as cc } from 'preact';
2 |
3 | export function aaa() {
4 | const context = cc();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_named/output.js:
--------------------------------------------------------------------------------
1 | import { createContext as cc } from 'preact';
2 | export function aaa() {
3 | const context = cc[`__file_hash__$context1`] || (cc[`__file_hash__$context1`] = cc());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_namespace/input.js:
--------------------------------------------------------------------------------
1 | import * as pp from 'preact';
2 |
3 | export function aaa() {
4 | const context = pp.createContext();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/import_namespace/output.js:
--------------------------------------------------------------------------------
1 | import * as pp from 'preact';
2 | export function aaa() {
3 | const context = pp.createContext[`__file_hash__$context1`] || (pp.createContext[`__file_hash__$context1`] = pp.createContext());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/local/input.js:
--------------------------------------------------------------------------------
1 | import { createContext } from "preact";
2 | export function aaa() {
3 | function createContext() { }
4 | const context = createContext();
5 | }
6 |
7 | export function bbb() {
8 | const context = createContext();
9 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/local/output.js:
--------------------------------------------------------------------------------
1 | import { createContext } from "preact";
2 | export function aaa() {
3 | function createContext() { }
4 | const context = createContext();
5 | }
6 | export function bbb() {
7 | const context = createContext[`__file_hash__$context1`] || (createContext[`__file_hash__$context1`] = createContext());
8 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/multiple/input.js:
--------------------------------------------------------------------------------
1 | import { createContext as cc } from 'preact';
2 | import * as ns from 'preact';
3 | import df from 'preact';
4 |
5 | export function aaa(a, b) {
6 | cc({});
7 | ns.createContext();
8 | df.createContext(b);
9 | return function bbb(a, b, c) {
10 | cc({});
11 | ns.createContext();
12 | df.createContext(b);
13 | }
14 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/param/input.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'preact';
2 |
3 | export function aaa(a, b) {
4 | const context = createContext();
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/param/output.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'preact';
2 | export function aaa(a, b) {
3 | const context = createContext[`__file_hash__$context1_${a}${b}`] || (createContext[`__file_hash__$context1_${a}${b}`] = createContext());
4 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/value/input.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'preact';
2 |
3 | export function aaa(a, b) {
4 | const context = createContext({});
5 | }
--------------------------------------------------------------------------------
/packages/prefresh/transform/tests/fixture/value/output.js:
--------------------------------------------------------------------------------
1 | import { createContext } from 'preact';
2 | export function aaa(a, b) {
3 | const context = Object.assign(createContext[`__file_hash__$context1_${a}${b}`] || (createContext[`__file_hash__$context1_${a}${b}`] = createContext({})), {
4 | __: {}
5 | });
6 | }
--------------------------------------------------------------------------------
/packages/react-remove-properties/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/react-remove-properties/__tests__/__snapshots__/wasm.test.ts.snap:
--------------------------------------------------------------------------------
1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2 |
3 | exports[`Should load react-remove-properties wasm plugin correctly 1`] = `
4 | "export default function Home() {
5 | return /*#__PURE__*/ React.createElement("div", {
6 | "data-custom": "1a"
7 | }, /*#__PURE__*/ React.createElement("div", {
8 | "data-custom": "2"
9 | }, /*#__PURE__*/ React.createElement("h1", null, "Hello World!")));
10 | }
11 | "
12 | `;
13 |
--------------------------------------------------------------------------------
/packages/react-remove-properties/transform/tests/fixture/custom/simple/input.js:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return (
3 |
4 |
5 |
Hello World!
6 |
7 |
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/packages/react-remove-properties/transform/tests/fixture/custom/simple/output.js:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return
3 |
4 |
Hello World!
5 |
6 |
;
7 | }
8 |
--------------------------------------------------------------------------------
/packages/react-remove-properties/transform/tests/fixture/default/simple/input.js:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return (
3 |
4 |
5 |
nested
}>
6 | Hello World!
7 |
8 |
9 |
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/packages/react-remove-properties/transform/tests/fixture/default/simple/output.js:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return
3 |
4 |
nested
}>
5 | Hello World!
6 |
7 |
8 |
;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/relay/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/relay/__tests__/__snapshots__/wasm.test.ts.snap:
--------------------------------------------------------------------------------
1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2 |
3 | exports[`Should load relay wasm plugin correctly 1`] = `
4 | "const myFragment = require("./__generated__/FooFragment.graphql.js");
5 | useQuery(require("./__generated__/FooQuery.graphql.js"));
6 | "
7 | `;
8 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/eager-es-modules/simple/input.js:
--------------------------------------------------------------------------------
1 | const myFragment = graphql`
2 | fragment FooFragment on Bar {
3 | id
4 | }
5 | `;
6 | useQuery(graphql`
7 | query FooQuery {
8 | id
9 | }
10 | `);
11 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/eager-es-modules/simple/output.js:
--------------------------------------------------------------------------------
1 | import __FooFragment from "./__generated__/FooFragment.graphql.ts";
2 | import __FooQuery from "./__generated__/FooQuery.graphql.ts";
3 | const myFragment = __FooFragment;
4 | useQuery(__FooQuery);
5 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/multi-projects/project1/should work/input.js:
--------------------------------------------------------------------------------
1 | graphql`
2 | fragment Foo on Bar {
3 | id
4 | }
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/multi-projects/project1/should work/output.js:
--------------------------------------------------------------------------------
1 | import __Foo from "$DIR/tests/projects1/__generated__/Foo.graphql.ts";
2 | __Foo;
3 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/multi-projects/project2/should work/input.js:
--------------------------------------------------------------------------------
1 | graphql`
2 | fragment Foo on Bar {
3 | id
4 | }
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/multi-projects/project2/should work/output.js:
--------------------------------------------------------------------------------
1 | import __Foo from "__generated__/Foo.graphql.ts";
2 | __Foo;
3 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/output-file-extension/javascript/input.js:
--------------------------------------------------------------------------------
1 | const myFragment = graphql`
2 | fragment FooFragment on Bar {
3 | id
4 | }
5 | `;
6 | useQuery(graphql`
7 | query FooQuery {
8 | id
9 | }
10 | `);
11 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/output-file-extension/javascript/output.js:
--------------------------------------------------------------------------------
1 | import __FooFragment from "./__generated__/FooFragment.graphql.js";
2 | import __FooQuery from "./__generated__/FooQuery.graphql.js";
3 | const myFragment = __FooFragment;
4 | useQuery(__FooQuery);
5 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/output-file-extension/typescript/input.js:
--------------------------------------------------------------------------------
1 | const myFragment = graphql`
2 | fragment FooFragment on Bar {
3 | id
4 | }
5 | `;
6 | useQuery(graphql`
7 | query FooQuery {
8 | id
9 | }
10 | `);
11 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/output-file-extension/typescript/output.js:
--------------------------------------------------------------------------------
1 | import __FooFragment from "./__generated__/FooFragment.graphql.ts";
2 | import __FooQuery from "./__generated__/FooQuery.graphql.ts";
3 | const myFragment = __FooFragment;
4 | useQuery(__FooQuery);
5 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/simple/issue-148/input.js:
--------------------------------------------------------------------------------
1 | import { graphql } from "relay-runtime";
2 |
3 | export const query = graphql`
4 | query SampleQuery {
5 | foo
6 | }
7 | `;
8 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/simple/issue-148/output.js:
--------------------------------------------------------------------------------
1 | import { graphql } from "relay-runtime";
2 | export const query = require("./__generated__/SampleQuery.graphql.ts");
3 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/simple/next-67614/input.js:
--------------------------------------------------------------------------------
1 | graphql`
2 | # Pagination query to be fetched upon calling 'loadMore'.
3 | # Notice that we re-use our fragment, and the shape of this query matches our fragment spec.
4 | query UserListPaginationQuery {
5 | ...UserList_query
6 | }
7 | `
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/simple/next-67614/output.js:
--------------------------------------------------------------------------------
1 | require("./__generated__/UserListPaginationQuery.graphql.ts");
2 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/simple/should work/input.js:
--------------------------------------------------------------------------------
1 | graphql`
2 | fragment Foo on Bar {
3 | id
4 | }
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/relay/transform/tests/fixture/simple/should work/output.js:
--------------------------------------------------------------------------------
1 | require("./__generated__/Foo.graphql.ts");
2 |
--------------------------------------------------------------------------------
/packages/relay/types.d.ts:
--------------------------------------------------------------------------------
1 | declare module "@swc/plugin-relay" {
2 | export interface Config {
3 | rootDir: string;
4 | artifactDirectory?: string;
5 | language: "typescript" | "javascrip" | "flow";
6 | eagerEsModules?: boolean;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/remove-console/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/remove-console/README.tmpl.md:
--------------------------------------------------------------------------------
1 | # remove-console
2 |
3 | See https://nextjs.org/docs/architecture/nextjs-compiler#remove-console for more information.
4 |
5 | ## Config
6 |
7 | ```json
8 | ["remove-console"]
9 | ```
10 |
11 | or
12 |
13 | ```json
14 | [
15 | "remove-console",
16 | {
17 | "exclude": ["error"]
18 | }
19 | ]
20 | ```
21 |
22 | ${CHANGELOG}
23 |
--------------------------------------------------------------------------------
/packages/remove-console/transform/tests/fixture/all/toplevel-override/input.js:
--------------------------------------------------------------------------------
1 | let console = {
2 | log: (msg) => {},
3 | };
4 |
5 | function func1() {
6 | console.log("remove console test in function");
7 | }
8 |
9 | console.log("remove console test at top level");
10 |
--------------------------------------------------------------------------------
/packages/remove-console/transform/tests/fixture/all/toplevel-override/output.js:
--------------------------------------------------------------------------------
1 | let console = {
2 | log: (msg) => {},
3 | };
4 | function func1() {
5 | console.log("remove console test in function");
6 | }
7 | console.log("remove console test at top level");
8 |
--------------------------------------------------------------------------------
/packages/styled-components/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/styled-components/transform/src/css.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/src/visitors/minify/mod.rs:
--------------------------------------------------------------------------------
1 | mod css;
2 | mod css_placeholder;
3 | mod regex_util;
4 | pub mod visitor;
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/src/visitors/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod display_name_and_id;
2 | pub mod minify;
3 | pub mod pure_annotation;
4 | pub mod template_literals;
5 | pub mod transpile_css_prop;
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/src/visitors/transpile_css_prop/mod.rs:
--------------------------------------------------------------------------------
1 | mod top_level_binding_collector;
2 | pub mod transpile;
3 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/.transformed-imports-with-jsx-member-expressions/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": [["@babel/plugin-transform-modules-commonjs"], ["../../../src"]]
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/.transformed-imports-with-jsx-member-expressions/code.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { css } from "styled-components";
3 | import Icons from "./icons";
4 |
5 | const someCss = css`
6 | background: purple;
7 | `;
8 |
9 | const App1 = () => {
10 | return ;
11 | };
12 |
13 | const App2 = () => {
14 | return ;
15 | };
16 |
17 | const App3 = () => {
18 | return ;
19 | };
20 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-display-names-with-member-expressions/code.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | const App = {};
4 |
5 | App.Foo = styled.div``;
6 |
7 | App.Foo.Bar = styled.div``
8 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-display-names-with-member-expressions/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileName": true,
3 | "displayName": true
4 | }
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-display-names-with-member-expressions/output.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | const App = {};
3 | App.Foo = styled.div.withConfig({
4 | displayName: "code__Foo",
5 | componentId: "sc-11752c5e-0"
6 | })([
7 | ``
8 | ]);
9 | App.Foo.Bar = styled.div.withConfig({
10 | displayName: "code__Bar",
11 | componentId: "sc-11752c5e-1"
12 | })([
13 | ``
14 | ]);
15 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-display-names/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const Test = styled.div`
4 | width: 100%;
5 | `;
6 | const Test2 = styled("div")``;
7 | const Test3 = true ? styled.div`` : styled.div``;
8 | const styles = { One: styled.div`` };
9 | let Component;
10 | Component = styled.div``;
11 | const WrappedComponent = styled(Inner)``;
12 | class ClassComponent {
13 | static Child = styled.div``;
14 | }
15 | var GoodName = (BadName = styled.div``);
16 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-display-names/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "fileName": false,
4 | "transpileTemplateLiterals": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier-and-display-name/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileName": false,
3 | "transpileTemplateLiterals": false
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier-with-top-level-import-paths-and-named-import/code.js:
--------------------------------------------------------------------------------
1 | import { styled } from "@example/example";
2 |
3 | const Test = styled.div`
4 | width: 100%;
5 | `;
6 | const Test2 = true ? styled.div`` : styled.div``;
7 | const styles = { One: styled.div`` };
8 | let Component;
9 | Component = styled.div``;
10 | const WrappedComponent = styled(Inner)``;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier-with-top-level-import-paths-and-named-import/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileName": false,
3 | "topLevelImportPaths": ["@example/example"],
4 | "transpileTemplateLiterals": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier-with-top-level-import-paths/code.js:
--------------------------------------------------------------------------------
1 | import styled from "@xstyled/styled-components";
2 |
3 | const Test = styled.div`
4 | width: 100%;
5 | `;
6 | const Test2 = true ? styled.div`` : styled.div``;
7 | const styles = { One: styled.div`` };
8 | let Component;
9 | Component = styled.div``;
10 | const WrappedComponent = styled(Inner)``;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier-with-top-level-import-paths/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "displayName": false,
3 | "fileName": false,
4 | "topLevelImportPaths": [
5 | "@xstyled/styled-components",
6 | "@xstyled/styled-components/no-tags",
7 | "@xstyled/styled-components/native",
8 | "@xstyled/styled-components/primitives"
9 | ],
10 | "transpileTemplateLiterals": false
11 | }
12 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const Test = styled.div`
4 | width: 100%;
5 | `;
6 | const Test2 = true ? styled.div`` : styled.div``;
7 | const styles = { One: styled.div`` };
8 | let Component;
9 | Component = styled.div``;
10 | const WrappedComponent = styled(Inner)``;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/add-identifier/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "displayName": false,
3 | "fileName": false,
4 | "transpileTemplateLiterals": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/allow-chains-of-member-calls/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const WithAttrs = styled.div.attrs({ some: "value" })``;
4 | const WithAttrsWrapped = styled(Inner).attrs({ some: "value" })``;
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/allow-chains-of-member-calls/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "fileName": false,
4 | "transpileTemplateLiterals": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/allow-chains-of-member-calls/output.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 | const WithAttrs = styled.div
3 | .attrs({
4 | some: "value",
5 | })
6 | .withConfig({
7 | displayName: "WithAttrs",
8 | })``;
9 | const WithAttrsWrapped = styled(Inner)
10 | .attrs({
11 | some: "value",
12 | })
13 | .withConfig({
14 | displayName: "WithAttrsWrapped",
15 | })``;
16 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-create-global-style-with-pure-comments/code.js:
--------------------------------------------------------------------------------
1 | import { createGlobalStyle } from "styled-components";
2 |
3 | const GlobalStyle = createGlobalStyle`
4 | body {
5 | color: red;
6 | }
7 | `;
8 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-create-global-style-with-pure-comments/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "pure": true
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-create-global-style-with-pure-comments/output.js:
--------------------------------------------------------------------------------
1 | import { createGlobalStyle } from "styled-components";
2 | const GlobalStyle = /*#__PURE__*/ createGlobalStyle([
3 | `body{color:red;}`
4 | ]);
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-css-with-pure-comments/code.js:
--------------------------------------------------------------------------------
1 | import styled, { css } from "styled-components";
2 |
3 | const partial = css`
4 | color: red;
5 | `;
6 |
7 | const Component = styled.div`
8 | ${partial};
9 | background: blue;
10 | `;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-css-with-pure-comments/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "pure": true
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-css-with-pure-comments/output.js:
--------------------------------------------------------------------------------
1 | import styled, { css } from "styled-components";
2 | const partial = /*#__PURE__*/ css([
3 | `color:red;`
4 | ]);
5 | const Component = /*#__PURE__*/ styled.div.withConfig({
6 | displayName: "code__Component",
7 | componentId: "sc-1919be4f-0"
8 | })([
9 | ``,
10 | `;background:blue;`
11 | ], partial);
12 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-keyframes-with-pure-comments/code.js:
--------------------------------------------------------------------------------
1 | import { keyframes } from "styled-components";
2 |
3 | const Animation = keyframes`
4 | 0% {
5 | opacity: 0;
6 | }
7 |
8 | 100% {
9 | opacity: 1;
10 | }
11 | `;
12 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-keyframes-with-pure-comments/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "pure": true
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-keyframes-with-pure-comments/output.js:
--------------------------------------------------------------------------------
1 | import { keyframes } from "styled-components";
2 | const Animation = /*#__PURE__*/ keyframes([
3 | `0%{opacity:0;}100%{opacity:1;}`
4 | ]);
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-styled-calls-with-pure-comments/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "pure": true
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-withtheme-with-pure-comments/code.js:
--------------------------------------------------------------------------------
1 | import { withTheme } from "styled-components";
2 |
3 | const ThemedComponent = withTheme(() => null);
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-withtheme-with-pure-comments/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "pure": true
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/annotate-withtheme-with-pure-comments/output.js:
--------------------------------------------------------------------------------
1 | import { withTheme } from "styled-components";
2 | const ThemedComponent = /*#__PURE__*/ withTheme(() => null);
3 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/css-declared-after-component/code.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { css } from "styled-components";
3 |
4 | export default function Example() {
5 | return oops
;
6 | }
7 |
8 | const someCss = css`
9 | color: red;
10 | `;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/css-declared-after-component/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/css-declared-after-component/output.js:
--------------------------------------------------------------------------------
1 | import _styled from "styled-components";
2 | import React from "react";
3 | import { css } from "styled-components";
4 | export default function Example() {
5 | return <_StyledDiv>oops;
6 | }
7 | const someCss = css([
8 | `color:red;`
9 | ]);
10 | var _StyledDiv = _styled("div").withConfig({
11 | displayName: "code___StyledDiv",
12 | componentId: "sc-ba25a50c-0"
13 | })([
14 | ``,
15 | ``
16 | ], someCss);
17 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/does-not-desugar-styled-assignment/code.js:
--------------------------------------------------------------------------------
1 | const domElements = ["div"];
2 |
3 | const styled = () => {};
4 |
5 | domElements.forEach((domElement) => {
6 | styled[domElement] = styled(domElement);
7 | });
8 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/does-not-desugar-styled-assignment/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/does-not-desugar-styled-assignment/output.js:
--------------------------------------------------------------------------------
1 | const domElements = ["div"];
2 |
3 | const styled = () => {};
4 |
5 | domElements.forEach((domElement) => {
6 | styled[domElement] = styled(domElement);
7 | });
8 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/does-not-replace-native-with-no-tags/code.js:
--------------------------------------------------------------------------------
1 | const styled_default = require("styled-components/native");
2 |
3 | const TestNormal = styled.div`
4 | width: 100%;
5 | `;
6 |
7 | const Test = styled_default.default.div`
8 | width: 100%;
9 | `;
10 |
11 | const TestCallExpression = styled_default.default(Test)`
12 | height: 20px;
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/does-not-replace-native-with-no-tags/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/ignore-external-styled-import/code.js:
--------------------------------------------------------------------------------
1 | import { styled } from "@material/ui";
2 | import s from "styled-components";
3 |
4 | const Paragraph = s.p`
5 | color: green;
6 | `;
7 |
8 | const Foo = (p) => ;
9 | const TestNormal = styled(Foo)({ color: red });
10 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/ignore-external-styled-import/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/ignore-external-styled-import/output.js:
--------------------------------------------------------------------------------
1 | import { styled } from "@material/ui";
2 | import s from "styled-components";
3 | const Paragraph = s.p.withConfig({
4 | displayName: "code__Paragraph",
5 | componentId: "sc-ea5187b3-0"
6 | })([
7 | `color:green;`
8 | ]);
9 | const Foo = (p)=>;
10 | const TestNormal = styled(Foo)({
11 | color: red
12 | });
13 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/issue-224/code.js:
--------------------------------------------------------------------------------
1 | import { styled } from "styled-components";
2 |
3 | const Test = styled.div`
4 | width: 100%;
5 | `;
6 | const Test2 = true ? styled.div`` : styled.div``;
7 | const styles = { One: styled.div`` };
8 | let Component;
9 | Component = styled.div``;
10 | const WrappedComponent = styled(Inner)``;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/issue-224/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/issue-289/code.js:
--------------------------------------------------------------------------------
1 | import { styled } from "styled-components";
2 |
3 | const Div = styled.div`
4 | &::after {
5 | content: "Hello\u0020World!\u{1f64f}";
6 | }
7 | `;
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/issue-289/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "transpileTemplateLiterals": true
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/issue-289/output.js:
--------------------------------------------------------------------------------
1 | import { styled } from "styled-components";
2 | const Div = styled.div.withConfig({
3 | displayName: "code__Div",
4 | componentId: "sc-155d9cad-0"
5 | })([
6 | `&::after{content:"Hello\u0020World!\u{1f64f}";}`
7 | ]);
8 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/minify-css-in-helpers/code.js:
--------------------------------------------------------------------------------
1 | import { createGlobalStyle, css, keyframes } from "styled-components";
2 |
3 | const key = keyframes`
4 | to {
5 | transform: rotate(360deg);
6 | }
7 | `;
8 |
9 | const color = css`
10 | color: ${theColor};
11 | `;
12 |
13 | const GlobalStyles = createGlobalStyle`
14 | html {
15 | color: red;
16 | }
17 | `;
18 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/minify-css-in-helpers/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false,
4 | "transpileTemplateLiterals": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/minify-css-in-helpers/output.js:
--------------------------------------------------------------------------------
1 | import { createGlobalStyle, css, keyframes } from "styled-components";
2 | const key = keyframes`to{transform:rotate(360deg);}`;
3 | const color = css`color:${theColor};`;
4 | const GlobalStyles = createGlobalStyle`html{color:red;}`;
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/minify-css-to-use-with-transpilation/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/minify-css-to-use-without-transpilation/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/minify-single-line-comments-with-interpolations/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/next-59805/code.js:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import styled from "styled-components";
4 |
5 | const ReproElement = styled.p`
6 | &::before {
7 | content: "\\a9";
8 | }
9 | `;
10 |
11 | export function ReproComponent(props) {
12 | return (
13 |
14 | This should be preceded by a copyright symbol and not backslash,
15 | letter A, digit nine
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/next-59805/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/next-59805/output.js:
--------------------------------------------------------------------------------
1 | "use client";
2 | import styled from "styled-components";
3 | const ReproElement = styled.p.withConfig({
4 | displayName: "code__ReproElement",
5 | componentId: "sc-d5fbeba3-0"
6 | })([
7 | `&::before{content:"\\a9";}`
8 | ]);
9 | export function ReproComponent(props) {
10 | return
11 | This should be preceded by a copyright symbol and not backslash,
12 | letter A, digit nine
13 | ;
14 | }
15 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/not-use-private-api-if-not-required/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const Test = styled.div`
4 | width: 100%;
5 | `;
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/not-use-private-api-if-not-required/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false,
4 | "transpileTemplateLiterals": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/not-use-private-api-if-not-required/output.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 | const Test = styled.div`width:100%;`;
3 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/track-the-imported-variable/code.js:
--------------------------------------------------------------------------------
1 | import s from "styled-components";
2 |
3 | const Test = s.div`width: 100%;`;
4 | const Test2 = true ? s.div`` : s.div``;
5 | const styles = { One: s.div`` };
6 | let Component;
7 | Component = s.div``;
8 | const WrappedComponent = s(Inner)``;
9 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/track-the-imported-variable/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "fileName": false,
3 | "transpileTemplateLiterals": false
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-css-prop-add-import/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false,
4 | "transpileTemplateLiterals": false,
5 | "minify": false
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-css-prop-add-require/code.js:
--------------------------------------------------------------------------------
1 | // @flow
2 | import React from "react";
3 |
4 | export default () => (
5 |
10 | );
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-css-prop-add-require/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false,
4 | "transpileTemplateLiterals": false,
5 | "minify": false
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-css-prop-add-require/output.js:
--------------------------------------------------------------------------------
1 | // @flow
2 | import _styled from "styled-components";
3 | import React from "react";
4 | export default (()=><_StyledDiv/>);
5 | var _StyledDiv = _styled("div")`
6 | width: 35em;
7 | `;
8 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-css-prop-all-options-on/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-css-prop/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false,
4 | "transpileTemplateLiterals": false,
5 | "minify": false
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-require-default/code.js:
--------------------------------------------------------------------------------
1 | const styled_default = require("styled-components");
2 |
3 | const TestNormal = styled.div`
4 | width: 100%;
5 | `;
6 |
7 | const Test = styled_default.default.div`
8 | width: 100%;
9 | `;
10 |
11 | const TestCallExpression = styled_default.default(Test)`
12 | height: 20px;
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-require-default/config.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-template-literals-with-config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "minify": false
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-template-literals-without-config/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const Named = styled.div`
4 | width: 100%;
5 | `;
6 |
7 | const NamedWithInterpolation = styled.div`
8 | color: ${(color) => props.color};
9 | `;
10 |
11 | const Wrapped = styled(Inner)`
12 | color: red;
13 | `;
14 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-template-literals-without-config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ssr": false,
3 | "displayName": false,
4 | "minify": false
5 | }
6 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/transpile-template-literals-without-config/output.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 | const Named = styled.div([
3 | `
4 | width: 100%;
5 | `
6 | ]);
7 | const NamedWithInterpolation = styled.div([
8 | `
9 | color: `,
10 | `;
11 | `
12 | ], (color)=>props.color);
13 | const Wrapped = styled(Inner)([
14 | `
15 | color: red;
16 | `
17 | ]);
18 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/use-directory-name/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const Test = styled.div`
4 | color: red;
5 | `;
6 | const before = styled.div`
7 | color: blue;
8 | `;
9 | styled.div``;
10 | export default styled.button``;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/use-directory-name/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "meaninglessFileNames": ["code"],
3 | "transpileTemplateLiterals": false
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/use-file-name/code.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 |
3 | const Test = styled.div`
4 | color: red;
5 | `;
6 | const before = styled.div`
7 | color: blue;
8 | `;
9 | styled.div``;
10 | export default styled.button``;
11 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/use-file-name/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "transpileTemplateLiterals": false
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/use-namespace/code.js:
--------------------------------------------------------------------------------
1 | import * as styled from "styled-components";
2 |
3 | const css = styled.css`
4 | background: black;
5 | `;
6 |
7 | const GlobalStyle = styled.createGlobalStyle`
8 | html {
9 | background: black;
10 | }
11 | `;
12 |
13 | const Test = styled.default.div`
14 | color: red;
15 | `;
16 |
17 | const before = styled.default.div`
18 | color: blue;
19 | `;
20 |
21 | styled.default.div``;
22 |
23 | export default styled.default.button``;
24 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/use-namespace/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "namespace": "test-namespace"
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/work-with-hoisted-default-as-import/code.js:
--------------------------------------------------------------------------------
1 | const Test = s.div`width: 100%;`;
2 | import { default as s, css } from "styled-components";
3 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/work-with-hoisted-default-as-import/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "transpileTemplateLiterals": false
3 | }
4 |
--------------------------------------------------------------------------------
/packages/styled-components/transform/tests/fixtures/work-with-hoisted-default-as-import/output.js:
--------------------------------------------------------------------------------
1 | const Test = s.div.withConfig({
2 | displayName: "code__Test",
3 | componentId: "sc-b4de691d-0",
4 | })`width:100%;`;
5 | import { default as s, css } from "styled-components";
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/.npmignore:
--------------------------------------------------------------------------------
1 | __tests__/
2 | transform/
3 | Cargo.toml
--------------------------------------------------------------------------------
/packages/styled-jsx/README.tmpl.md:
--------------------------------------------------------------------------------
1 | # @swc/plugin-styled-jsx
2 |
3 | ${CHANGELOG}
4 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![feature(box_patterns)]
2 | pub mod style;
3 | mod transform_css_lightningcss;
4 | mod transform_css_swc;
5 | mod utils;
6 | pub mod visitor;
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/no-child/input.js:
--------------------------------------------------------------------------------
1 | export default () => (
2 |
3 |
4 |
5 | );
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/no-child/output-lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
4 |
);
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/no-child/output-lightningcss.stderr:
--------------------------------------------------------------------------------
1 | x Expected one child under JSX style tag, but got 0.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 |
6 | : ^^^^^^^^^^^^^^^^^^^
7 | 4 |
8 | `----
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/no-child/output-swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
4 |
);
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/no-child/output-swc.stderr:
--------------------------------------------------------------------------------
1 | x Expected one child under JSX style tag, but got 0.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 |
6 | : ^^^^^^^^^^^^^^^^^^^
7 | 4 |
8 | `----
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/no-child/output.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default () => (
3 |
4 |
5 |
6 | );
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/ts-with-css-resolve/input.js:
--------------------------------------------------------------------------------
1 | import css from "styled-jsx/css";
2 |
3 | export default css.resolve`
4 | .container {
5 | background: #000;
6 | color: white;
7 | font-weight: 700;
8 | height: 100px;
9 | }
10 | `;
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/ts-with-css-resolve/output-lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default {
3 | styles: <_JSXStyle id={"71f03d42ea0ec6"}>{".container.jsx-71f03d42ea0ec6{color:#fff;background:#000;height:100px;font-weight:700}"},
4 | className: "jsx-71f03d42ea0ec6"
5 | };
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/ts-with-css-resolve/output-lightningcss.stderr:
--------------------------------------------------------------------------------
1 | x /some-project/src/some-file.ts uses `css.resolve`, but ends with `.ts`. The file extension needs to be `.tsx` so that the jsx injected by `css.resolve` will be transformed.
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/ts-with-css-resolve/output-swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default {
3 | styles: <_JSXStyle id={"71f03d42ea0ec6"}>{".container.jsx-71f03d42ea0ec6{background:#000;color:white;font-weight:700;height:100px}"},
4 | className: "jsx-71f03d42ea0ec6"
5 | };
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/ts-with-css-resolve/output-swc.stderr:
--------------------------------------------------------------------------------
1 | x /some-project/src/some-file.ts uses `css.resolve`, but ends with `.ts`. The file extension needs to be `.tsx` so that the jsx injected by `css.resolve` will be transformed.
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/ts-with-css-resolve/output.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default {
3 | styles: (
4 | <_JSXStyle id={"71f03d42ea0ec6"}>
5 | {
6 | ".container.jsx-71f03d42ea0ec6{background:#000;color:white;font-weight:700;height:100px}"
7 | }
8 |
9 | ),
10 | className: "jsx-71f03d42ea0ec6",
11 | };
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/two-children/input.js:
--------------------------------------------------------------------------------
1 | export default () => (
2 |
3 |
13 |
14 | );
15 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/two-children/output-lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
13 |
);
14 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/two-children/output-lightningcss.stderr:
--------------------------------------------------------------------------------
1 | x Expected one child under JSX style tag, but got 2.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 | ,->
15 | 13 |
16 | `----
17 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/two-children/output-swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
13 |
);
14 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/two-children/output-swc.stderr:
--------------------------------------------------------------------------------
1 | x Expected one child under JSX style tag, but got 2.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 | ,->
15 | 13 |
16 | `----
17 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/two-children/output.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default () => (
3 |
4 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-child-type/input.js:
--------------------------------------------------------------------------------
1 | export default () => (
2 |
3 |
4 |
5 | );
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-child-type/output-lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
4 |
);
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-child-type/output-lightningcss.stderr:
--------------------------------------------------------------------------------
1 | x Expected a single child of type JSXExpressionContainer under JSX Style tag.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 |
6 | : ^^^^^^^^^^^^^^^^^^^^^
7 | 4 |
8 | `----
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-child-type/output-swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
4 |
);
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-child-type/output-swc.stderr:
--------------------------------------------------------------------------------
1 | x Expected a single child of type JSXExpressionContainer under JSX Style tag.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 |
6 | : ^^^^^^^^^^^^^^^^^^^^^
7 | 4 |
8 | `----
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-child-type/output.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default () => (
3 |
4 |
5 |
6 | );
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-jsx-expression-type/input.js:
--------------------------------------------------------------------------------
1 | export default () => (
2 |
3 |
4 |
5 | );
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-jsx-expression-type/output-lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
4 |
);
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-jsx-expression-type/output-lightningcss.stderr:
--------------------------------------------------------------------------------
1 | x Expected a template literal, string or identifier inside the JSXExpressionContainer.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 |
6 | : ^^^^^^^^^^^^^^^^^^^^^^^
7 | 4 |
8 | `----
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-jsx-expression-type/output-swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
4 |
);
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-jsx-expression-type/output-swc.stderr:
--------------------------------------------------------------------------------
1 | x Expected a template literal, string or identifier inside the JSXExpressionContainer.
2 | | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children
3 | ,-[input.js:3:1]
4 | 2 |
5 | 3 |
6 | : ^^^^^^^^^^^^^^^^^^^^^^^
7 | 4 |
8 | `----
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/errors/wrong-jsx-expression-type/output.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default () => (
3 |
4 |
5 |
6 | );
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/absent/input.js:
--------------------------------------------------------------------------------
1 | const a = () => (
2 |
6 | );
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/absent/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | const a = ()=>;
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/absent/output.swc.js:
--------------------------------------------------------------------------------
1 | const a = ()=>;
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/basic-variables-in-css/input.js:
--------------------------------------------------------------------------------
1 | export default function Component() {
2 | const width = 100;
3 | const height = 200;
4 | const color = '#FF0000';
5 |
6 | return (
7 |
8 |
Basic Variables Test
9 |
16 |
17 | );
18 | }
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/class/input.js:
--------------------------------------------------------------------------------
1 | export default class {
2 | render() {
3 | return (
4 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/class/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default class {
3 | render() {
4 | return
5 |
test
6 | <_JSXStyle id={"b2b86d63f35d25ee"}>{"p.jsx-b2b86d63f35d25ee{color:red}"}
7 |
;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/class/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default class {
3 | render() {
4 | return
5 |
test
6 | <_JSXStyle id={"b2b86d63f35d25ee"}>{"p.jsx-b2b86d63f35d25ee{color:red}"}
7 |
;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/1/input.js:
--------------------------------------------------------------------------------
1 | export default class {
2 | render() {
3 | return (
4 |
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/1/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default class {
3 | render() {
4 | return
5 |
test
6 | <_JSXStyle id={"1952086b0a5ae64c"}>{"p.jsx-1952086b0a5ae64c{color:red}"}
7 |
;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/1/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default class {
3 | render() {
4 | return
5 |
test
6 | <_JSXStyle id={"1952086b0a5ae64c"}>{"p.jsx-1952086b0a5ae64c{color:red}"}
7 |
;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/3/input.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */
2 | export default function ReactCropStyle() {
3 | return (
4 |
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/3/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */ import _JSXStyle from "styled-jsx/style";
2 | export default function ReactCropStyle() {
3 | return <_JSXStyle id={"d89743bebc326687"}>{".ReactCrop__crop-selection{border-image-source:url(https://example.com/image.png)}"};
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/3/output.swc.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */ import _JSXStyle from "styled-jsx/style";
2 | export default function ReactCropStyle() {
3 | return <_JSXStyle id={"d89743bebc326687"}>{".ReactCrop__crop-selection{border-image-source:url(https://example.com/image.png)}"};
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/5/input.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */
2 | export default function ReactCropStyle() {
3 | return (
4 |
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/5/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */ import _JSXStyle from "styled-jsx/style";
2 | export default function ReactCropStyle() {
3 | return <_JSXStyle id={"30442c7d82bfaf7f"}>{".ReactCrop__crop-selection{background:red}"};
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/5/output.swc.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */ import _JSXStyle from "styled-jsx/style";
2 | export default function ReactCropStyle() {
3 | return <_JSXStyle id={"30442c7d82bfaf7f"}>{".ReactCrop__crop-selection{background:red}"};
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/6/input.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */
2 | export default function ReactCropStyle() {
3 | return (
4 |
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/6/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */ import _JSXStyle from "styled-jsx/style";
2 | export default function ReactCropStyle() {
3 | return <_JSXStyle id={"aafe371d005b29c3"}>{".ReactCrop__crop-selection{background:red}"};
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/comments/6/output.swc.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable-next-line import/no-default-export -- TODO: Fix ESLint Error (#13355) */ import _JSXStyle from "styled-jsx/style";
2 | export default function ReactCropStyle() {
3 | return <_JSXStyle id={"aafe371d005b29c3"}>{".ReactCrop__crop-selection{background:red}"};
4 | }
5 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/component-attribute/input.js:
--------------------------------------------------------------------------------
1 | const Test = () => (
2 |
3 | test
4 |
5 |
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/component-attribute/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=>
3 | test
4 |
5 | <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}
6 |
;
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/component-attribute/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=>
3 | test
4 |
5 | <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}
6 |
;
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/conflicts/input.js:
--------------------------------------------------------------------------------
1 | // TODO
2 |
3 | // export const _JSXStyle = '_JSXStyle-literal'
4 | // export default function() {
5 | // return (
6 | //
7 | //
test
8 | //
13 | //
14 | // )
15 | // }
16 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/conflicts/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | // TODO
2 | // export const _JSXStyle = '_JSXStyle-literal'
3 | // export default function() {
4 | // return (
5 | //
6 | //
test
7 | //
12 | //
13 | // )
14 | // }
15 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/conflicts/output.swc.js:
--------------------------------------------------------------------------------
1 | // TODO
2 | // export const _JSXStyle = '_JSXStyle-literal'
3 | // export default function() {
4 | // return (
5 | //
6 | //
test
7 | //
12 | //
13 | // )
14 | // }
15 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/css-selector-after-pseudo/input.js:
--------------------------------------------------------------------------------
1 | function NavigationItem({ active, className }) {
2 | return (
3 |
4 |
10 |
11 | );
12 | }
13 |
14 | export default NavigationItem;
15 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/css-selector-after-pseudo/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | function NavigationItem({ active, className }) {
3 | return
6 | <_JSXStyle id={"e73bf96b356a8634"}>{'.navigation-item.jsx-e73bf96b356a8634 a:after{content:attr(data-text);content:attr(data-text)/""}'}
7 | ;
8 | }
9 | export default NavigationItem;
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/css-selector-after-pseudo/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | function NavigationItem({ active, className }) {
3 | return
6 | <_JSXStyle id={"e73bf96b356a8634"}>{'.navigation-item.jsx-e73bf96b356a8634 a:after{content:attr(data-text);content:attr(data-text)/""}'}
7 | ;
8 | }
9 | export default NavigationItem;
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/css-tag-same-file/input.js:
--------------------------------------------------------------------------------
1 | import css from "styled-jsx/css";
2 |
3 | export default ({ children }) => (
4 |
8 | );
9 |
10 | const styles = css`
11 | p {
12 | color: red;
13 | }
14 | `;
15 |
16 | class Test extends React.Component {
17 | render() {
18 | return (
19 |
20 |
{this.props.children}
21 |
22 |
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/dynamic-element-external/input.js:
--------------------------------------------------------------------------------
1 | import styles from "./styles2";
2 |
3 | export default ({ level = 1 }) => {
4 | const Element = `h${level}`;
5 |
6 | return (
7 |
8 | dynamic element
9 |
10 |
11 | );
12 | };
13 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/dynamic-element-external/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import styles from "./styles2";
3 | export default (({ level = 1 })=>{
4 | const Element = `h${level}`;
5 | return
6 | dynamic element
7 | <_JSXStyle id={styles.__hash}>{styles}
8 | ;
9 | });
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/dynamic-element-external/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import styles from "./styles2";
3 | export default (({ level = 1 })=>{
4 | const Element = `h${level}`;
5 | return
6 | dynamic element
7 | <_JSXStyle id={styles.__hash}>{styles}
8 | ;
9 | });
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/exported-jsx-style/input.js:
--------------------------------------------------------------------------------
1 | // module.exports = () =>
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/exported-jsx-style/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | // module.exports = () =>
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/exported-jsx-style/output.swc.js:
--------------------------------------------------------------------------------
1 | // module.exports = () =>
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/exported-non-jsx-style/input.js:
--------------------------------------------------------------------------------
1 | // module.exports = () =>
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/exported-non-jsx-style/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | // module.exports = () =>
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/exported-non-jsx-style/output.swc.js:
--------------------------------------------------------------------------------
1 | // module.exports = () =>
2 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-nested-scope/input.js:
--------------------------------------------------------------------------------
1 | import css from "styled-jsx/css";
2 |
3 | function test() {
4 | css.resolve`
5 | div {
6 | color: red;
7 | }
8 | `;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-nested-scope/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | function test() {
3 | ({
4 | styles: <_JSXStyle id={"7b844396f2efe2ef"}>{"div.jsx-7b844396f2efe2ef{color:red}"},
5 | className: "jsx-7b844396f2efe2ef"
6 | });
7 | }
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-nested-scope/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | function test() {
3 | ({
4 | styles: <_JSXStyle id={"7b844396f2efe2ef"}>{"div.jsx-7b844396f2efe2ef{color:red}"},
5 | className: "jsx-7b844396f2efe2ef"
6 | });
7 | }
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-stylesheet-global/input.js:
--------------------------------------------------------------------------------
1 | import styles, { foo as styles3 } from "./styles";
2 |
3 | const styles2 = require("./styles2");
4 |
5 | export default () => (
6 |
7 |
test
8 |
woot
9 |
woot
10 |
13 |
16 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-stylesheet-global/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import styles, { foo as styles3 } from "./styles";
3 | const styles2 = require("./styles2");
4 | export default (()=>
5 |
test
6 |
woot
7 |
woot
8 | <_JSXStyle id={styles2.__hash}>{styles2}
9 | <_JSXStyle id={styles3.__hash}>{styles3}
10 | <_JSXStyle id={styles.__hash}>{styles}
11 |
);
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-stylesheet-global/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import styles, { foo as styles3 } from "./styles";
3 | const styles2 = require("./styles2");
4 | export default (()=>
5 |
test
6 |
woot
7 |
woot
8 | <_JSXStyle id={styles2.__hash}>{styles2}
9 | <_JSXStyle id={styles3.__hash}>{styles3}
10 | <_JSXStyle id={styles.__hash}>{styles}
11 |
);
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-stylesheet-multi-line/input.js:
--------------------------------------------------------------------------------
1 | import styles from "./styles";
2 |
3 | export default () => (
4 |
8 | );
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-stylesheet-multi-line/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import styles from "./styles";
3 | export default (()=>
4 |
test
5 | <_JSXStyle id={styles.__hash}>{styles}
6 |
);
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/external-stylesheet-multi-line/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import styles from "./styles";
3 | export default (()=>
4 |
test
5 | <_JSXStyle id={styles.__hash}>{styles}
6 |
);
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global-child-selector/input.js:
--------------------------------------------------------------------------------
1 | const Test = () => (
2 |
3 | test
4 |
9 |
10 | );
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global-child-selector/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=>
3 | test
4 | <_JSXStyle id={"5a206f122d1cb32e"}>{"div.jsx-5a206f122d1cb32e>span{color:red}"}
5 |
;
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global-child-selector/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=>
3 | test
4 | <_JSXStyle id={"5a206f122d1cb32e"}>{"div.jsx-5a206f122d1cb32e>span{color:red}"}
5 |
;
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global-redundant/input.js:
--------------------------------------------------------------------------------
1 | export default function IndexPage() {
2 | return (
3 |
4 | should be blue.
5 |
10 |
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global-redundant/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function IndexPage() {
3 | return
4 | should be blue.
5 | <_JSXStyle id={"b6abd0684ba81871"}>{"div{color:#00f}"}
6 |
;
7 | }
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global-redundant/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function IndexPage() {
3 | return
4 | should be blue.
5 | <_JSXStyle id={"b6abd0684ba81871"}>{"div{color:#00f}"}
6 |
;
7 | }
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/global/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=>
3 | <_JSXStyle id={"f84dd0db2f59ea88"}>{"body{color:red}:hover{color:red;animation:1s ease-out foo;display:flex}div a{display:none}[data-test]>div{color:red}"}
4 |
;
5 | const Test2 = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"};
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-30480/input.js:
--------------------------------------------------------------------------------
1 | export default ({ breakPoint }) => (
2 |
3 |
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-30480/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (({ breakPoint })=>
10 | <_JSXStyle id={"a6590ac0780d51e0"} dynamic={[
11 | breakPoint
12 | ]}>{`@media (${breakPoint}){.test.__jsx-style-dynamic-selector{margin-bottom:1em}}`}
13 |
);
14 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-30480/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (({ breakPoint })=>
10 | <_JSXStyle id={"a6590ac0780d51e0"} dynamic={[
11 | breakPoint
12 | ]}>{`@media (${breakPoint}){.test.__jsx-style-dynamic-selector{margin-bottom:1em}}`}
13 |
);
14 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-30570/input.js:
--------------------------------------------------------------------------------
1 | export default function IndexPage() {
2 | return (
3 |
4 |
Hello World.
5 |
6 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-30570/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function IndexPage() {
3 | return
4 |
Hello World.
5 |
6 | <_JSXStyle id={"6226396a225d1c8b"}>{"@supports (display:flex){h1{color:#ff69b4}}"}
7 | ;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-30570/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function IndexPage() {
3 | return
4 |
Hello World.
5 |
6 | <_JSXStyle id={"6226396a225d1c8b"}>{"@supports (display:flex) or (display:-webkit-box) or (display:-webkit-flex) or (display:-moz-box) or (display:-ms-flexbox){h1{color:#ff69b4}}"}
7 | ;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-456/input.js:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return (
3 | <>
4 |
11 | >
12 | );
13 | }
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-456/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function Home() {
3 | return <>
4 | <_JSXStyle id={"c717b7da8095da63"}>{".theme-root .parent.jsx-c717b7da8095da63{color:green}"}
5 | >;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-456/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function Home() {
3 | return <>
4 | <_JSXStyle id={"c717b7da8095da63"}>{".theme-root{}.theme-root .parent.jsx-c717b7da8095da63{color:green}"}
5 | >;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-460/input.js:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return (
3 | <>
4 |
12 | >
13 | );
14 | }
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-460/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function Home() {
3 | return <>
4 | <_JSXStyle id={"44c2e59534385f9"}>{"div.jsx-44c2e59534385f9{-webkit-mask-image:-webkit-radial-gradient(#fff,#000)}"}
5 | >;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/issue-460/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function Home() {
3 | return <>
4 | <_JSXStyle id={"44c2e59534385f9"}>{"div.jsx-44c2e59534385f9{-webkit-mask-image:-webkit-radial-gradient(#fff,#000);mask-image:-webkit-radial-gradient(#fff,#000)}"}
5 | >;
6 | }
7 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/legacy-nesting/input.js:
--------------------------------------------------------------------------------
1 | export default () => (
2 |
3 |
test
4 |
woot
5 |
woot
6 |
16 |
17 | );
18 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/legacy-nesting/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
test
4 |
woot
5 |
woot
6 | <_JSXStyle id={"3b0234e9651851cb"}>{".container.jsx-3b0234e9651851cb{color:#00f;padding:3rem}.container.jsx-3b0234e9651851cb .inner.jsx-3b0234e9651851cb{color:#ff0}"}
7 |
);
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/legacy-nesting/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default (()=>
3 |
test
4 |
woot
5 |
woot
6 | <_JSXStyle id={"3b0234e9651851cb"}>{".container.jsx-3b0234e9651851cb{color:#00f;padding:3rem}.container.jsx-3b0234e9651851cb .inner.jsx-3b0234e9651851cb{color:#ff0}"}
7 |
);
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/lightningcss-1/input.js:
--------------------------------------------------------------------------------
1 | export default function IndexPage() {
2 | return (
3 |
4 |
Hello World.
5 |
6 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/lightningcss-1/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function IndexPage() {
3 | return
4 |
Hello World.
5 |
6 | <_JSXStyle id={"490e0a92136d9307"}>{".container>div{color:green}"}
7 | ;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/lightningcss-1/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | export default function IndexPage() {
3 | return
4 |
Hello World.
5 |
6 | <_JSXStyle id={"490e0a92136d9307"}>{".container{}.container>div{color:green}"}
7 | ;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/mixed-global-scoped/input.js:
--------------------------------------------------------------------------------
1 | const Test = () => (
2 |
5 | );
6 |
7 | export default () => (
8 |
17 | );
18 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/mixed-global-scoped/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"};
3 | export default (()=>
4 |
test
5 | <_JSXStyle id={"80dff25115d29c0e"}>{"body{background:red}"}
6 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-8de09a4a01c37bbf{color:red}"}
7 |
);
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/mixed-global-scoped/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | const Test = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"};
3 | export default (()=>
4 |
test
5 | <_JSXStyle id={"80dff25115d29c0e"}>{"body{background:red}"}
6 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-8de09a4a01c37bbf{color:red}"}
7 |
);
8 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/nested-style-tags/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/swc-project/plugins/8dd3e22e9dbf56035f100f1ecb2a4d276c063c28/packages/styled-jsx/transform/tests/fixture/nested-style-tags/index.js
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-54653/input.js:
--------------------------------------------------------------------------------
1 | import css from "styled-jsx/css";
2 |
3 | export default css`
4 | @media (max-width: 870px) {
5 | :global(th.expiration-date-cell),
6 | :global(td.expiration-date-cell) {
7 | display: none;
8 | }
9 | }
10 | `;
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-54653/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | const _defaultExport = new String("@media (max-width:870px){th.expiration-date-cell{display:none}td.expiration-date-cell{display:none}}");
2 | _defaultExport.__hash = "fd71bf06ba8860bb";
3 | export default _defaultExport;
4 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-54653/output.swc.js:
--------------------------------------------------------------------------------
1 | const _defaultExport = new String(
2 | "@media (width<=870px){th.expiration-date-cell,td.expiration-date-cell{display:none}}",
3 | );
4 | _defaultExport.__hash = "fd71bf06ba8860bb";
5 | export default _defaultExport;
6 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-55679/input.js:
--------------------------------------------------------------------------------
1 | import { AppProps } from "next/app";
2 |
3 | const someVar = "--var-1";
4 |
5 | export default function App({ Component, pageProps }) {
6 | return (
7 | <>
8 |
14 |
15 | >
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-55679/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import { AppProps } from "next/app";
3 | const someVar = "--var-1";
4 | export default function App({ Component, pageProps }) {
5 | return <>
6 | <_JSXStyle id={"decfccc0ebccf98f"}>{`:root{${someVar}:red;background-color:var(${someVar})}`}
7 |
8 | >;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-55679/output.swc.js:
--------------------------------------------------------------------------------
1 | import _JSXStyle from "styled-jsx/style";
2 | import { AppProps } from "next/app";
3 | const someVar = "--var-1";
4 | export default function App({ Component, pageProps }) {
5 | return <>
6 | <_JSXStyle id={"decfccc0ebccf98f"}>{`:root{${someVar}:red;background-color:var(${someVar})}`}
7 |
8 | >;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-61788/input.js:
--------------------------------------------------------------------------------
1 | const MOBILE_MAX = 767;
2 |
3 | export default function Home() {
4 | return (
5 |
6 |
Hello
7 |
18 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-64389/input.js:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | const color = "color: red;";
4 |
5 | export default function RootLayout({ children }) {
6 | return (
7 |
8 |
9 | {children}
10 |
20 |
21 | );
22 | }
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-64389/output.lightningcss.js:
--------------------------------------------------------------------------------
1 | "use client";
2 | import _JSXStyle from "styled-jsx/style";
3 | const color = "color: red;";
4 | export default function RootLayout({ children }) {
5 | return
6 |
7 | {children}
8 | <_JSXStyle id={"553b47c4cdb2abc9"}>{`body{${color}}body p{font-size:72px}`}
9 | ;
10 | }
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-64389/output.swc.js:
--------------------------------------------------------------------------------
1 | "use client";
2 | import _JSXStyle from "styled-jsx/style";
3 | const color = "color: red;";
4 | export default function RootLayout({ children }) {
5 | return
6 |
7 | {children}
8 | <_JSXStyle id={"553b47c4cdb2abc9"}>{`body{${color}}body p{font-size:72px}`}
9 | ;
10 | }
11 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-65066/output.lightningcss.stderr:
--------------------------------------------------------------------------------
1 | x Detected nested styled-jsx tag.
2 | | Read more: https://nextjs.org/docs/messages/nested-styled-jsx-tags
3 | ,-[input.js:22:1]
4 | 21 |
5 | 22 | ,->
10 | 27 |
11 | `----
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/next-65066/output.swc.stderr:
--------------------------------------------------------------------------------
1 | x Detected nested styled-jsx tag.
2 | | Read more: https://nextjs.org/docs/messages/nested-styled-jsx-tags
3 | ,-[input.js:22:1]
4 | 21 |
5 | 22 | ,->
10 | 27 |
11 | `----
12 |
--------------------------------------------------------------------------------
/packages/styled-jsx/transform/tests/fixture/non-styled-jsx-style/input.js:
--------------------------------------------------------------------------------
1 | export default () => (
2 |