├── .browserslistrc ├── .cargo └── config.toml ├── .changeset └── config.json ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── CI.yml │ └── npm-publish.yml ├── .gitignore ├── .gitmodules ├── .husky └── pre-commit ├── .rustfmt.toml ├── .taplo.toml ├── .vscode └── settings.json ├── .yarnrc.yml ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── clippy.toml ├── crates ├── swc_experimental_babel │ ├── Cargo.toml │ ├── src │ │ ├── lib.rs │ │ └── qjs.rs │ └── tests │ │ ├── basic-transform.js │ │ ├── basic │ │ └── basic │ │ │ ├── input.js │ │ │ └── output.js │ │ └── fixture.rs └── swc_icu_messageformat_parser │ ├── Cargo.toml │ ├── src │ ├── ast.rs │ ├── intl │ │ ├── date_time_format_options.rs │ │ ├── mod.rs │ │ ├── number_format_options.rs │ │ └── options.rs │ ├── lib.rs │ ├── parser.rs │ └── pattern_syntax.rs │ └── tests │ ├── fixtures │ ├── basic_argument_1 │ ├── basic_argument_2 │ ├── date_arg_skeleton_1 │ ├── date_arg_skeleton_2 │ ├── date_arg_skeleton_3 │ ├── date_arg_skeleton_with_capital_J │ ├── date_arg_skeleton_with_capital_JJ │ ├── date_arg_skeleton_with_j │ ├── date_arg_skeleton_with_jj │ ├── date_arg_skeleton_with_jjj │ ├── date_arg_skeleton_with_jjjj │ ├── date_arg_skeleton_with_jjjjj │ ├── date_arg_skeleton_with_jjjjjj │ ├── double_apostrophes_1 │ ├── duplicate_plural_selectors │ ├── duplicate_select_selectors │ ├── empty_argument_1 │ ├── empty_argument_2 │ ├── escaped_multiple_tags_1 │ ├── escaped_pound_1 │ ├── expect_arg_format_1 │ ├── expect_number_arg_skeleton_token_1 │ ├── expect_number_arg_skeleton_token_option_1 │ ├── expect_number_arg_style_1 │ ├── ignore_tag_number_arg_1 │ ├── ignore_tags_1 │ ├── incomplete_nested_message_in_tag │ ├── invalid_arg_format_1 │ ├── invalid_close_tag_1 │ ├── invalid_closing_tag_1 │ ├── invalid_closing_tag_2 │ ├── invalid_tag_1 │ ├── invalid_tag_2 │ ├── invalid_tag_3 │ ├── left_angle_bracket_1 │ ├── less_than_sign_1 │ ├── malformed_argument_1 │ ├── negative_offset_1 │ ├── nested_1 │ ├── nested_tags_1 │ ├── not_escaped_pound_1 │ ├── not_quoted_string_1 │ ├── not_quoted_string_2 │ ├── not_self_closing_tag_1 │ ├── number_arg_skeleton_2 │ ├── number_arg_skeleton_3 │ ├── number_arg_style_1 │ ├── number_skeleton_1 │ ├── number_skeleton_10 │ ├── number_skeleton_11 │ ├── number_skeleton_12 │ ├── number_skeleton_2 │ ├── number_skeleton_3 │ ├── number_skeleton_4 │ ├── number_skeleton_5 │ ├── number_skeleton_6 │ ├── number_skeleton_7 │ ├── number_skeleton_8 │ ├── number_skeleton_9 │ ├── numeric_tag_1 │ ├── open_close_tag_1 │ ├── open_close_tag_2 │ ├── open_close_tag_3 │ ├── open_close_tag_with_args │ ├── open_close_tag_with_nested_arg │ ├── plural_arg_1 │ ├── plural_arg_2 │ ├── plural_arg_with_escaped_nested_message │ ├── plural_arg_with_offset_1 │ ├── quoted_pound_sign_1 │ ├── quoted_pound_sign_2 │ ├── quoted_string_1 │ ├── quoted_string_2 │ ├── quoted_string_3 │ ├── quoted_string_4 │ ├── quoted_string_5 │ ├── quoted_tag_1 │ ├── select_arg_1 │ ├── select_arg_with_nested_arguments │ ├── selectordinal_1 │ ├── self_closing_tag_1 │ ├── self_closing_tag_2 │ ├── simple_argument_1 │ ├── simple_argument_2 │ ├── simple_date_and_time_arg_1 │ ├── simple_number_arg_1 │ ├── treat_unicode_nbsp_as_whitespace │ ├── trivial_1 │ ├── trivial_2 │ ├── unclosed_argument_1 │ ├── unclosed_argument_2 │ ├── unclosed_number_arg_1 │ ├── unclosed_number_arg_2 │ ├── unclosed_number_arg_3 │ ├── unclosed_quoted_string_1 │ ├── unclosed_quoted_string_2 │ ├── unclosed_quoted_string_3 │ ├── unclosed_quoted_string_4 │ ├── unclosed_quoted_string_5 │ ├── unclosed_quoted_string_6 │ ├── unescaped_string_literal_1 │ ├── unicode_1 │ ├── unmatched_open_close_tag_1 │ ├── unmatched_open_close_tag_2 │ └── uppercase_tag_1 │ └── run_parser_e2e.rs ├── cspell.json ├── package.json ├── packages ├── emotion │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ ├── fixtures │ │ │ └── input.js │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ ├── import_map.rs │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ ├── fixture │ │ ├── comments │ │ │ ├── input.tsx │ │ │ └── output.ts │ │ ├── compress │ │ │ ├── input.tsx │ │ │ └── output.ts │ │ ├── css-in-callback │ │ │ ├── input.tsx │ │ │ └── output.ts │ │ ├── import-map │ │ │ ├── global-needs-css │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ ├── global │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ ├── non-default-styled-aliased │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ ├── non-default-styled │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ ├── styled-with-base-specified │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ └── vanilla │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ ├── issue-258 │ │ │ ├── input.tsx │ │ │ └── output.ts │ │ ├── issues │ │ │ ├── 180 │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ ├── 201 │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ │ └── 39672 │ │ │ │ ├── input.tsx │ │ │ │ └── output.ts │ │ ├── namespace-import │ │ │ ├── input.tsx │ │ │ └── output.ts │ │ └── next │ │ │ └── 40385 │ │ │ └── 1 │ │ │ ├── input.tsx │ │ │ └── output.ts │ │ ├── labels │ │ ├── emotion-js │ │ │ ├── actual-expected-usage.js │ │ │ ├── actual-expected-usage.tsx │ │ │ ├── basic.js │ │ │ ├── basic.ts │ │ │ ├── call-expression.js │ │ │ ├── call-expression.ts │ │ │ ├── call-inside-call.js │ │ │ ├── call-inside-call.ts │ │ │ ├── comment-with-interpolation.js │ │ │ ├── comment-with-interpolation.ts │ │ │ ├── css-inside-function.js │ │ │ ├── css-inside-function.ts │ │ │ ├── impure.js │ │ │ ├── impure.ts │ │ │ ├── inside-anonymous-arrow-function.js │ │ │ ├── inside-anonymous-arrow-function.ts │ │ │ ├── inside-anonymous-function.js │ │ │ ├── inside-anonymous-function.ts │ │ │ ├── inside-class.js │ │ │ ├── inside-class.tsx │ │ │ ├── label-1.js │ │ │ ├── label-1.ts │ │ │ ├── label-arrow-as-obj-property.js │ │ │ ├── label-arrow-as-obj-property.ts │ │ │ ├── label-function-expression-as-obj-property.js │ │ │ ├── label-function-expression-as-obj-property.ts │ │ │ ├── label-function-expression-named.js │ │ │ ├── label-function-expression-named.ts │ │ │ ├── label-function-expression.js │ │ │ ├── label-function-expression.ts │ │ │ ├── label-no-final-semi.js │ │ │ ├── label-no-final-semi.ts │ │ │ ├── label-obj-method.js │ │ │ ├── label-obj-method.tsx │ │ │ ├── label-obj-property-literal.js │ │ │ ├── label-obj-property-literal.tsx │ │ │ ├── label-object.js │ │ │ ├── label-object.ts │ │ │ ├── multiple-calls.js │ │ │ ├── multiple-calls.ts │ │ │ ├── no-actual-import.js │ │ │ ├── no-actual-import.ts │ │ │ ├── no-label-array-pattern.js │ │ │ ├── no-label-array-pattern.ts │ │ │ ├── no-label-obj-pattern-computed-property.js │ │ │ ├── no-label-obj-pattern-computed-property.ts │ │ │ ├── object-dynamic-property.js │ │ │ ├── object-dynamic-property.ts │ │ │ ├── object-pattern-variable-declarator.js │ │ │ ├── object-pattern-variable-declarator.tsx │ │ │ ├── other-imports.js │ │ │ ├── other-imports.ts │ │ │ ├── remove-block-comments.js │ │ │ ├── remove-block-comments.ts │ │ │ ├── remove-line-comments.js │ │ │ ├── remove-line-comments.ts │ │ │ ├── tagged-template-args-forwarded.js │ │ │ └── tagged-template-args-forwarded.ts │ │ ├── options │ │ │ ├── dirname-filename-local │ │ │ │ └── output.js │ │ │ ├── dirname │ │ │ │ └── output.js │ │ │ ├── filename-local │ │ │ │ └── output.js │ │ │ ├── filename │ │ │ │ └── output.js │ │ │ ├── input.tsx │ │ │ └── local │ │ │ │ └── output.js │ │ └── sanitisation │ │ │ ├── bad.const.name.js │ │ │ ├── bad.const.name.ts │ │ │ ├── bad.name.!#$%&()+,.;=@[]^`}~{.js │ │ │ ├── bad.name.!#$%&()+,.;=@[]^`}~{.ts │ │ │ ├── input.styles.js │ │ │ └── input.styles.ts │ │ └── testImportMap.json ├── formatjs │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── jest │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ └── wasm.test.ts │ ├── package.json │ └── src │ │ └── lib.rs ├── loadable-components │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ ├── lib.rs │ │ └── util.rs │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ ├── aggressive import │ │ ├── should work with destructuration │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── with webpackChunkName │ │ │ ├── should keep it │ │ │ │ ├── input.js │ │ │ │ └── output.js │ │ │ └── should replace it │ │ │ │ ├── input.js │ │ │ │ └── output.js │ │ └── without webpackChunkName │ │ │ ├── should support complex request │ │ │ ├── input.js │ │ │ └── output.js │ │ │ ├── should support destructuring │ │ │ ├── input.js │ │ │ └── output.js │ │ │ └── should support simple request │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── lazy │ │ ├── should be transpiled too │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── should not work without imported │ │ │ ├── input.js │ │ │ └── output.js │ │ └── should work with renamed specifier │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── loadable.lib │ │ └── should be transpiled too │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── magic comments │ │ ├── should remove only needed comments │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── should transpile arrow functions │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── should transpile function expression │ │ │ ├── input.js │ │ │ └── output.js │ │ └── should transpile shortand properties │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── signatures │ │ ├── should not transpile unconfigured │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── should transpile configured custom default │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── should transpile configured custom │ │ │ ├── input.js │ │ │ └── output.js │ │ └── should transpile configured │ │ │ ├── input.js │ │ │ └── output.js │ │ └── simple import │ │ ├── in a complex promise │ │ └── should work │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── should transform path into chunk-friendly name │ │ ├── input.js │ │ └── output.js │ │ ├── should work with mul in name │ │ ├── input.js │ │ └── output.js │ │ ├── should work with plus concatenation │ │ ├── input.js │ │ └── output.js │ │ ├── should work with template literal │ │ ├── input.js │ │ └── output.js │ │ └── with webpackChunkName comment │ │ ├── should add it │ │ ├── input.js │ │ └── output.js │ │ ├── should use it even if comment is separated by , │ │ ├── input.js │ │ └── output.js │ │ ├── should use it even if quote is single │ │ ├── input.js │ │ └── output.js │ │ └── should use it │ │ ├── input.js │ │ └── output.js ├── noop │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── package.json │ └── src │ │ └── lib.rs ├── prefresh │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ ├── basic │ │ ├── input.js │ │ └── output.js │ │ ├── import_custom_preact │ │ ├── input.js │ │ └── output.js │ │ ├── import_default │ │ ├── input.js │ │ └── output.js │ │ ├── import_lib_computed │ │ ├── input.js │ │ └── output.js │ │ ├── import_named │ │ ├── input.js │ │ └── output.js │ │ ├── import_namespace │ │ ├── input.js │ │ └── output.js │ │ ├── local │ │ ├── input.js │ │ └── output.js │ │ ├── multiple │ │ ├── input.js │ │ └── output.js │ │ ├── param │ │ ├── input.js │ │ └── output.js │ │ └── value │ │ ├── input.js │ │ └── output.js ├── react-remove-properties │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ ├── custom │ │ └── simple │ │ │ ├── input.js │ │ │ └── output.js │ │ └── default │ │ └── simple │ │ ├── input.js │ │ └── output.js ├── relay │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ ├── transform │ │ ├── Cargo.toml │ │ ├── src │ │ │ └── lib.rs │ │ └── tests │ │ │ ├── fixture.rs │ │ │ └── fixture │ │ │ ├── eager-es-modules │ │ │ ├── next-15763 │ │ │ │ ├── 1 │ │ │ │ │ ├── input.js │ │ │ │ │ └── output.js │ │ │ │ └── 2 │ │ │ │ │ ├── input.js │ │ │ │ │ └── output.js │ │ │ └── simple │ │ │ │ ├── input.js │ │ │ │ └── output.js │ │ │ ├── multi-projects │ │ │ ├── project1 │ │ │ │ └── should work │ │ │ │ │ ├── input.js │ │ │ │ │ └── output.js │ │ │ └── project2 │ │ │ │ └── should work │ │ │ │ ├── input.js │ │ │ │ └── output.js │ │ │ ├── output-file-extension │ │ │ ├── javascript │ │ │ │ ├── input.js │ │ │ │ └── output.js │ │ │ └── typescript │ │ │ │ ├── input.js │ │ │ │ └── output.js │ │ │ └── simple │ │ │ ├── issue-148 │ │ │ ├── input.js │ │ │ └── output.js │ │ │ ├── next-67614 │ │ │ ├── input.js │ │ │ └── output.js │ │ │ └── should work │ │ │ ├── input.js │ │ │ └── output.js │ └── types.d.ts ├── remove-console │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __test__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ ├── fixtures │ │ │ └── input.js │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ └── all │ │ ├── simple │ │ ├── input.js │ │ └── output.js │ │ └── toplevel-override │ │ ├── input.js │ │ └── output.js ├── styled-components │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ ├── css.rs │ │ ├── lib.rs │ │ ├── utils │ │ │ ├── analyzer.rs │ │ │ └── mod.rs │ │ └── visitors │ │ │ ├── display_name_and_id.rs │ │ │ ├── minify │ │ │ ├── css.rs │ │ │ ├── css_placeholder.rs │ │ │ ├── mod.rs │ │ │ ├── regex_util.rs │ │ │ └── visitor.rs │ │ │ ├── mod.rs │ │ │ ├── pure_annotation.rs │ │ │ ├── template_literals.rs │ │ │ └── transpile_css_prop │ │ │ ├── mod.rs │ │ │ ├── top_level_binding_collector.rs │ │ │ └── transpile.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixtures │ │ ├── .transformed-imports-with-jsx-member-expressions │ │ ├── .babelrc │ │ ├── code.js │ │ └── output.js │ │ ├── add-display-names-with-member-expressions │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── add-display-names │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── add-identifier-and-display-name │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── add-identifier-with-top-level-import-paths-and-named-import │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── add-identifier-with-top-level-import-paths │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── add-identifier │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── allow-chains-of-member-calls │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── annotate-create-global-style-with-pure-comments │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── annotate-css-with-pure-comments │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── annotate-keyframes-with-pure-comments │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── annotate-styled-calls-with-pure-comments │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── annotate-withtheme-with-pure-comments │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── css-declared-after-component │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── does-not-desugar-styled-assignment │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── does-not-replace-native-with-no-tags │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── ignore-external-styled-import │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── issue-224 │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── issue-289 │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── minify-css-in-helpers │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── minify-css-to-use-with-transpilation │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── minify-css-to-use-without-transpilation │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── minify-single-line-comments-with-interpolations │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── next-59805 │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── not-use-private-api-if-not-required │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── track-the-imported-variable │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-css-prop-add-import │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-css-prop-add-require │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-css-prop-all-options-on │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-css-prop │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-require-default │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-template-literals-with-config │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── transpile-template-literals-without-config │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── use-directory-name │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── use-file-name │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ ├── use-namespace │ │ ├── code.js │ │ ├── config.json │ │ └── output.js │ │ └── work-with-hoisted-default-as-import │ │ ├── code.js │ │ ├── config.json │ │ └── output.js ├── styled-jsx │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ ├── lib.rs │ │ ├── style.rs │ │ ├── transform_css_lightningcss.rs │ │ ├── transform_css_swc.rs │ │ ├── utils.rs │ │ └── visitor.rs │ │ └── tests │ │ ├── errors │ │ ├── nested-style-tags │ │ │ ├── input.js │ │ │ ├── output-lightningcss.js │ │ │ ├── output-lightningcss.stderr │ │ │ ├── output-swc.js │ │ │ ├── output-swc.stderr │ │ │ └── output.js │ │ ├── no-child │ │ │ ├── input.js │ │ │ ├── output-lightningcss.js │ │ │ ├── output-lightningcss.stderr │ │ │ ├── output-swc.js │ │ │ ├── output-swc.stderr │ │ │ └── output.js │ │ ├── ts-with-css-resolve │ │ │ ├── input.js │ │ │ ├── output-lightningcss.js │ │ │ ├── output-lightningcss.stderr │ │ │ ├── output-swc.js │ │ │ ├── output-swc.stderr │ │ │ └── output.js │ │ ├── two-children │ │ │ ├── input.js │ │ │ ├── output-lightningcss.js │ │ │ ├── output-lightningcss.stderr │ │ │ ├── output-swc.js │ │ │ ├── output-swc.stderr │ │ │ └── output.js │ │ ├── wrong-child-type │ │ │ ├── input.js │ │ │ ├── output-lightningcss.js │ │ │ ├── output-lightningcss.stderr │ │ │ ├── output-swc.js │ │ │ ├── output-swc.stderr │ │ │ └── output.js │ │ └── wrong-jsx-expression-type │ │ │ ├── input.js │ │ │ ├── output-lightningcss.js │ │ │ ├── output-lightningcss.stderr │ │ │ ├── output-swc.js │ │ │ ├── output-swc.stderr │ │ │ └── output.js │ │ ├── fixture.rs │ │ └── fixture │ │ ├── .expressions │ │ └── input.js │ │ ├── absent │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── attribute-generation-classname-rewriting │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── attribute-generation-modes │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── basic-variables-in-css │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── class │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── comments │ │ ├── 1 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── 2 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── 3 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── 4 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── 5 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ └── 6 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── complex-animation-keyframes │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── component-attribute │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── conflicts │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── css-selector-after-pseudo │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── css-tag-same-file │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── css-variables-and-functions │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── different-jsx-ids │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── dynamic-element-class │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── dynamic-element-external │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── dynamic-element │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── dynamic-this-in-arrow │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── exported-jsx-style │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── exported-non-jsx-style │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── external-nested-scope │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── external-stylesheet-global │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── external-stylesheet-multi-line │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── external-stylesheet │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── fragment │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── global-child-selector │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── global-redundant │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── global-styles-with-dynamic-values │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── global │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── interpolation │ │ ├── 1 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ └── 2 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── issue-30480 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── issue-30570 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── issue-31562-interpolation-in-mdea │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── issue-317 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── issue-452 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── issue-456 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── issue-460 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── legacy-nesting │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── lightningcss-1 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── media-queries-with-variables │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── mixed-global-scoped │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── multiple-jsx │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── nested-selectors │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── nested-style-tags │ │ └── index.js │ │ ├── next-54653 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── next-55679 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── next-61788 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── next-64389 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── next-65064 │ │ ├── 1 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ └── 2 │ │ │ ├── input.js │ │ │ ├── output.lightningcss.js │ │ │ └── output.swc.js │ │ ├── next-65066 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ ├── output.lightningcss.stderr │ │ ├── output.swc.js │ │ └── output.swc.stderr │ │ ├── non-styled-jsx-style │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── not-styled-jsx-tagged-templates │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── number-after-placeholder │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── one-off-global-selectors │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── pack-2714 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── pack-2819 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── source-maps │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── specifity │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── stateless │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── styles-external-invalid │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── styles-external-invalid2 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── styles │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── styles2 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── too-many │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-escape-1 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-escape-2 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-placeholder-1-as-property │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-placeholder-2-as-part-of-value │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-placeholder-3-as-value │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-placeholder-4-as-part-of-value-in-multiple │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── tpl-placeholder-5-values-of-multiple-properties │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css-complex-selector-2 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css-complex-selector │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css-global │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css-media-query │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css-normal │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css-nth-1 │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ ├── transform-css │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js │ │ └── whitespace │ │ ├── input.js │ │ ├── output.lightningcss.js │ │ └── output.swc.js ├── swc-confidential │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ └── wasm.test.ts.snap │ │ └── wasm.test.ts │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ └── simple │ │ ├── input.js │ │ └── output.js ├── swc-magic │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ ├── import_analyzer.rs │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ ├── no-name-clash │ │ ├── input.js │ │ └── output.js │ │ └── simple │ │ ├── input.js │ │ └── output.js ├── swc-sdk │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── package.json │ ├── src │ │ └── lib.rs │ └── transform │ │ ├── Cargo.toml │ │ ├── src │ │ ├── config.rs │ │ ├── flag.rs │ │ ├── import_analyzer.rs │ │ └── lib.rs │ │ └── tests │ │ ├── fixture.rs │ │ └── fixture │ │ └── flag │ │ ├── arg-1 │ │ ├── input.js │ │ └── output.js │ │ ├── custom-adapter │ │ ├── input.js │ │ └── output.js │ │ ├── duplicate │ │ ├── input.js │ │ └── output.js │ │ └── no-arg │ │ ├── input.js │ │ └── output.js └── transform-imports │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── README.md │ ├── README.tmpl.md │ ├── __tests__ │ ├── __snapshots__ │ │ └── wasm.test.ts.snap │ └── wasm.test.ts │ ├── package.json │ ├── src │ └── lib.rs │ └── transform │ ├── Cargo.toml │ ├── src │ └── lib.rs │ └── tests │ ├── fixture.rs │ └── fixture │ ├── default │ ├── input.js │ └── output.js │ ├── dynamic-imports │ ├── input.js │ └── output.js │ ├── mapping-export │ ├── input.js │ └── output.js │ ├── mapping │ ├── input.js │ └── output.js │ ├── mixed-default │ ├── input.js │ └── output.js │ ├── namespace-export │ ├── input.js │ └── output.js │ ├── namespace │ ├── input.js │ └── output.js │ ├── regex-export │ ├── input.js │ └── output.js │ ├── regex │ ├── input.js │ └── output.js │ ├── side-effect-imports │ ├── input.js │ └── output.js │ ├── simple-export │ ├── input.js │ └── output.js │ └── simple │ ├── input.js │ └── output.js ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── renovate.json ├── rust-toolchain ├── scripts ├── bump-crates.sh ├── bump.sh └── dev │ ├── cleanup_test_log.js │ └── cleanup_test_log.sh └── xtask ├── Cargo.toml └── src ├── main.rs └── update.rs /.browserslistrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swc-project/plugins/8dd3e22e9dbf56035f100f1ecb2a4d276c063c28/.browserslistrc -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": true, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "restricted", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: swc-project 4 | open_collective: swc 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | *.node 3 | .DS_Store 4 | *.html 5 | 6 | node_modules 7 | *.wasm 8 | .yarn/ 9 | .swc -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swc-project/plugins/8dd3e22e9dbf56035f100f1ecb2a4d276c063c28/.gitmodules -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm lint-staged -------------------------------------------------------------------------------- /.rustfmt.toml: -------------------------------------------------------------------------------- 1 | edition = "2018" 2 | format_strings = true 3 | group_imports = "StdExternalCrate" 4 | hex_literal_case = "Lower" 5 | imports_granularity = "Crate" 6 | reorder_impl_items = true 7 | use_field_init_shorthand = true 8 | wrap_comments = true 9 | -------------------------------------------------------------------------------- /.taplo.toml: -------------------------------------------------------------------------------- 1 | # https://taplo.tamasfe.dev/configuration/formatter-options.html 2 | [formatting] 3 | align_entries = true 4 | reorder_keys = true 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "rust-analyzer.check.command": "clippy" 4 | } 5 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | 3 | plugins: 4 | - path: .yarn/plugins/@yarnpkg/plugin-version.cjs 5 | spec: "@yarnpkg/plugin-version" 6 | -------------------------------------------------------------------------------- /clippy.toml: -------------------------------------------------------------------------------- 1 | cognitive-complexity-threshold = 50 2 | disallowed-names = [ 3 | "bool", 4 | "char", 5 | "str", 6 | "f32", 7 | "f64", 8 | "i8", 9 | "i16", 10 | "i32", 11 | "i64", 12 | "u8", 13 | "u16", 14 | "u32", 15 | "u64", 16 | "isize", 17 | "usize", 18 | ] 19 | ignore-interior-mutability = [ 20 | "bytes::Bytes", 21 | "swc_atoms::Atom", 22 | "swc_ecma_ast::Id", 23 | ] 24 | msrv = "1.70" 25 | type-complexity-threshold = 25000 26 | -------------------------------------------------------------------------------- /crates/swc_experimental_babel/tests/basic-transform.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | export function transform({ code, map }) { 4 | 5 | 6 | return { 7 | code: code + ';\nconsole.log("hello")', 8 | map, 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /crates/swc_experimental_babel/tests/basic/basic/input.js: -------------------------------------------------------------------------------- 1 | import { createContext } from 'preact'; 2 | 3 | export function aaa() { 4 | const context = createContext(); 5 | } -------------------------------------------------------------------------------- /crates/swc_experimental_babel/tests/basic/basic/output.js: -------------------------------------------------------------------------------- 1 | import { createContext } from 'preact'; 2 | export function aaa() { 3 | const context = createContext(); 4 | } 5 | ; 6 | console.log("hello"); 7 | -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/src/intl/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod date_time_format_options; 2 | pub mod number_format_options; 3 | pub mod options; 4 | -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod ast; 2 | mod intl; 3 | mod parser; 4 | mod pattern_syntax; 5 | 6 | pub use ast::{Ast, AstElement, Error, Position, Span}; 7 | pub use parser::{Parser, ParserOptions}; 8 | -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/basic_argument_1: -------------------------------------------------------------------------------- 1 | {a} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 1, 9 | "value": "a", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 3, 18 | "line": 1, 19 | "column": 4 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/double_apostrophes_1: -------------------------------------------------------------------------------- 1 | a''b 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "a'b", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 4, 18 | "line": 1, 19 | "column": 5 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/empty_argument_1: -------------------------------------------------------------------------------- 1 | My name is { } 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 2, 9 | "message": "My name is { }", 10 | "location": { 11 | "start": { 12 | "offset": 11, 13 | "line": 1, 14 | "column": 12 15 | }, 16 | "end": { 17 | "offset": 14, 18 | "line": 1, 19 | "column": 15 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/empty_argument_2: -------------------------------------------------------------------------------- 1 | My name is { 2 | } 3 | --- 4 | {} 5 | --- 6 | { 7 | "val": null, 8 | "err": { 9 | "kind": 2, 10 | "message": "My name is {\n}", 11 | "location": { 12 | "start": { 13 | "offset": 11, 14 | "line": 1, 15 | "column": 12 16 | }, 17 | "end": { 18 | "offset": 14, 19 | "line": 2, 20 | "column": 2 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/expect_arg_format_1: -------------------------------------------------------------------------------- 1 | My name is {0, } 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 4, 9 | "message": "My name is {0, }", 10 | "location": { 11 | "start": { 12 | "offset": 15, 13 | "line": 1, 14 | "column": 16 15 | }, 16 | "end": { 17 | "offset": 15, 18 | "line": 1, 19 | "column": 16 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/expect_number_arg_skeleton_token_1: -------------------------------------------------------------------------------- 1 | {0, number, ::} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 7, 9 | "message": "{0, number, ::}", 10 | "location": { 11 | "start": { 12 | "offset": 12, 13 | "line": 1, 14 | "column": 13 15 | }, 16 | "end": { 17 | "offset": 14, 18 | "line": 1, 19 | "column": 15 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/expect_number_arg_skeleton_token_option_1: -------------------------------------------------------------------------------- 1 | {0, number, ::currency/} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 7, 9 | "message": "{0, number, ::currency/}", 10 | "location": { 11 | "start": { 12 | "offset": 12, 13 | "line": 1, 14 | "column": 13 15 | }, 16 | "end": { 17 | "offset": 23, 18 | "line": 1, 19 | "column": 24 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/expect_number_arg_style_1: -------------------------------------------------------------------------------- 1 | {0, number, } 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 6, 9 | "message": "{0, number, }", 10 | "location": { 11 | "start": { 12 | "offset": 12, 13 | "line": 1, 14 | "column": 13 15 | }, 16 | "end": { 17 | "offset": 12, 18 | "line": 1, 19 | "column": 13 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/ignore_tags_1: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | { 4 | "ignoreTag": true 5 | } 6 | --- 7 | { 8 | "val": [ 9 | { 10 | "type": 0, 11 | "value": "", 12 | "location": { 13 | "start": { 14 | "offset": 0, 15 | "line": 1, 16 | "column": 1 17 | }, 18 | "end": { 19 | "offset": 21, 20 | "line": 1, 21 | "column": 22 22 | } 23 | } 24 | } 25 | ], 26 | "err": null 27 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/incomplete_nested_message_in_tag: -------------------------------------------------------------------------------- 1 | {a, plural, other {}} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 1, 9 | "message": "{a, plural, other {}}", 10 | "location": { 11 | "start": { 12 | "offset": 21, 13 | "line": 1, 14 | "column": 22 15 | }, 16 | "end": { 17 | "offset": 22, 18 | "line": 1, 19 | "column": 23 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/invalid_arg_format_1: -------------------------------------------------------------------------------- 1 | My name is {0, foo} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 5, 9 | "message": "My name is {0, foo}", 10 | "location": { 11 | "start": { 12 | "offset": 15, 13 | "line": 1, 14 | "column": 16 15 | }, 16 | "end": { 17 | "offset": 18, 18 | "line": 1, 19 | "column": 19 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/invalid_close_tag_1: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 23, 9 | "message": "", 10 | "location": { 11 | "start": { 12 | "offset": 3, 13 | "line": 1, 14 | "column": 4 15 | }, 16 | "end": { 17 | "offset": 5, 18 | "line": 1, 19 | "column": 6 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/invalid_closing_tag_1: -------------------------------------------------------------------------------- 1 | a 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 23, 9 | "message": "a", 10 | "location": { 11 | "start": { 12 | "offset": 7, 13 | "line": 1, 14 | "column": 8 15 | }, 16 | "end": { 17 | "offset": 9, 18 | "line": 1, 19 | "column": 10 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/invalid_closing_tag_2: -------------------------------------------------------------------------------- 1 | aa 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 23, 9 | "message": "", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 5, 18 | "line": 1, 19 | "column": 6 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/invalid_tag_2: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 23, 9 | "message": "", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 6, 18 | "line": 1, 19 | "column": 7 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/invalid_tag_3: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 23, 9 | "message": "", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 6, 18 | "line": 1, 19 | "column": 7 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/left_angle_bracket_1: -------------------------------------------------------------------------------- 1 | I <3 cats. 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "I <3 cats.", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 10, 18 | "line": 1, 19 | "column": 11 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/malformed_argument_1: -------------------------------------------------------------------------------- 1 | My name is {0!} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 3, 9 | "message": "My name is {0!}", 10 | "location": { 11 | "start": { 12 | "offset": 11, 13 | "line": 1, 14 | "column": 12 15 | }, 16 | "end": { 17 | "offset": 13, 18 | "line": 1, 19 | "column": 14 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/not_escaped_pound_1: -------------------------------------------------------------------------------- 1 | '#' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "'#'", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 3, 18 | "line": 1, 19 | "column": 4 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/not_quoted_string_1: -------------------------------------------------------------------------------- 1 | 'aa''b' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "'aa'b'", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 7, 18 | "line": 1, 19 | "column": 8 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/not_quoted_string_2: -------------------------------------------------------------------------------- 1 | I don't know 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "I don't know", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 12, 18 | "line": 1, 19 | "column": 13 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/not_self_closing_tag_1: -------------------------------------------------------------------------------- 1 | < test-tag /> 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "< test-tag />", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 13, 18 | "line": 1, 19 | "column": 14 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/number_arg_style_1: -------------------------------------------------------------------------------- 1 | {0, number, percent} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 2, 9 | "value": "0", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 20, 18 | "line": 1, 19 | "column": 21 20 | } 21 | }, 22 | "style": "percent" 23 | } 24 | ], 25 | "err": null 26 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/open_close_tag_1: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 8, 9 | "value": "test-tag", 10 | "children": [], 11 | "location": { 12 | "start": { 13 | "offset": 0, 14 | "line": 1, 15 | "column": 1 16 | }, 17 | "end": { 18 | "offset": 21, 19 | "line": 1, 20 | "column": 22 21 | } 22 | } 23 | } 24 | ], 25 | "err": null 26 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/quoted_string_1: -------------------------------------------------------------------------------- 1 | '{a''b}' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "{a'b}", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 8, 18 | "line": 1, 19 | "column": 9 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/quoted_string_2: -------------------------------------------------------------------------------- 1 | '}a''b{' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "}a'b{", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 8, 18 | "line": 1, 19 | "column": 9 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/quoted_string_3: -------------------------------------------------------------------------------- 1 | aaa'{' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "aaa{", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 6, 18 | "line": 1, 19 | "column": 7 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/quoted_string_4: -------------------------------------------------------------------------------- 1 | aaa'}' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "aaa}", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 6, 18 | "line": 1, 19 | "column": 7 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/quoted_string_5: -------------------------------------------------------------------------------- 1 | This '{isn''t}' obvious 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "This {isn't} obvious", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 23, 18 | "line": 1, 19 | "column": 24 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/quoted_tag_1: -------------------------------------------------------------------------------- 1 | ' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 4, 18 | "line": 1, 19 | "column": 5 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/self_closing_tag_1: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 12, 18 | "line": 1, 19 | "column": 13 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/self_closing_tag_2: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 11, 18 | "line": 1, 19 | "column": 12 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/trivial_1: -------------------------------------------------------------------------------- 1 | a 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "a", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 1, 18 | "line": 1, 19 | "column": 2 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/trivial_2: -------------------------------------------------------------------------------- 1 | 中文 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "中文", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 2, 18 | "line": 1, 19 | "column": 3 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_argument_1: -------------------------------------------------------------------------------- 1 | My name is { 0 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 1, 9 | "message": "My name is { 0", 10 | "location": { 11 | "start": { 12 | "offset": 11, 13 | "line": 1, 14 | "column": 12 15 | }, 16 | "end": { 17 | "offset": 14, 18 | "line": 1, 19 | "column": 15 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_argument_2: -------------------------------------------------------------------------------- 1 | My name is { 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 1, 9 | "message": "My name is { ", 10 | "location": { 11 | "start": { 12 | "offset": 11, 13 | "line": 1, 14 | "column": 12 15 | }, 16 | "end": { 17 | "offset": 13, 18 | "line": 1, 19 | "column": 14 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_number_arg_1: -------------------------------------------------------------------------------- 1 | {0, number 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 1, 9 | "message": "{0, number", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 10, 18 | "line": 1, 19 | "column": 11 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_number_arg_2: -------------------------------------------------------------------------------- 1 | {0, number, percent 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 1, 9 | "message": "{0, number, percent", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 19, 18 | "line": 1, 19 | "column": 20 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_number_arg_3: -------------------------------------------------------------------------------- 1 | {0, number, ::percent 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 1, 9 | "message": "{0, number, ::percent", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 21, 18 | "line": 1, 19 | "column": 22 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_quoted_string_1: -------------------------------------------------------------------------------- 1 | a '{a{ {}{}{} ''bb 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "a {a{ {}{}{} 'bb", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 18, 18 | "line": 1, 19 | "column": 19 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_quoted_string_2: -------------------------------------------------------------------------------- 1 | a 'a {}{} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 2, 9 | "message": "a 'a {}{}", 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 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_quoted_string_3: -------------------------------------------------------------------------------- 1 | a '{a{ {}{}{}}}''' 2 | {} 3 | --- 4 | {} 5 | --- 6 | { 7 | "val": null, 8 | "err": { 9 | "kind": 2, 10 | "message": "a '{a{ {}{}{}}}''' \n {}", 11 | "location": { 12 | "start": { 13 | "offset": 21, 14 | "line": 2, 15 | "column": 2 16 | }, 17 | "end": { 18 | "offset": 23, 19 | "line": 2, 20 | "column": 4 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_quoted_string_4: -------------------------------------------------------------------------------- 1 | You have '{count' 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "You have {count", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 17, 18 | "line": 1, 19 | "column": 18 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_quoted_string_5: -------------------------------------------------------------------------------- 1 | You have '{count 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "You have {count", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 16, 18 | "line": 1, 19 | "column": 17 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unclosed_quoted_string_6: -------------------------------------------------------------------------------- 1 | You have '{count} 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "You have {count}", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 17, 18 | "line": 1, 19 | "column": 18 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unescaped_string_literal_1: -------------------------------------------------------------------------------- 1 | } 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": [ 7 | { 8 | "type": 0, 9 | "value": "}", 10 | "location": { 11 | "start": { 12 | "offset": 0, 13 | "line": 1, 14 | "column": 1 15 | }, 16 | "end": { 17 | "offset": 1, 18 | "line": 1, 19 | "column": 2 20 | } 21 | } 22 | } 23 | ], 24 | "err": null 25 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unmatched_open_close_tag_1: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 26, 9 | "message": "", 10 | "location": { 11 | "start": { 12 | "offset": 5, 13 | "line": 1, 14 | "column": 6 15 | }, 16 | "end": { 17 | "offset": 6, 18 | "line": 1, 19 | "column": 7 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /crates/swc_icu_messageformat_parser/tests/fixtures/unmatched_open_close_tag_2: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | {} 4 | --- 5 | { 6 | "val": null, 7 | "err": { 8 | "kind": 26, 9 | "message": "", 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 |
3 |

hi

4 | 5 |
6 | ); 7 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/absent/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | const a = ()=>
2 |

hi

3 | 4 |
; 5 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/absent/output.swc.js: -------------------------------------------------------------------------------- 1 | const a = ()=>
2 |

hi

3 | 4 |
; 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 |
5 |

test

6 | 11 |
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 |
5 |

test

6 | 15 |
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 |
5 |

{children}

6 | 7 |
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 |
5 |

test

6 | 7 |
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 |
9 |

test

10 | 15 | 16 |
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 |
3 |

woot

4 | 5 | 6 |
7 | ); 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/non-styled-jsx-style/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

woot

4 | 7 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"} 8 |
); 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/non-styled-jsx-style/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

woot

4 | 7 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"} 8 |
); 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/number-after-placeholder/input.js: -------------------------------------------------------------------------------- 1 | import Link from "next/link"; 2 | 3 | export default function IndexPage() { 4 | return ( 5 |
6 | Hello World.{" "} 7 | 8 | Abound 9 | 10 | 15 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/number-after-placeholder/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | import Link from "next/link"; 3 | export default function IndexPage() { 4 | return
5 | Hello World.{" "} 6 | 7 | Abound 8 | 9 | <_JSXStyle id={"65e3bd6512b8681f"}>{`a.jsx-65e3bd6512b8681f{color:${"#abcdef"}12}`} 10 |
; 11 | } 12 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/number-after-placeholder/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | import Link from "next/link"; 3 | export default function IndexPage() { 4 | return
5 | Hello World.{" "} 6 | 7 | Abound 8 | 9 | <_JSXStyle id={"65e3bd6512b8681f"}>{`a.jsx-65e3bd6512b8681f{color:${"#abcdef"}12}`} 10 |
; 11 | } 12 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/one-off-global-selectors/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 | 9 |
10 | ); 11 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/one-off-global-selectors/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"c7c3a8e231c9215a"}>{".container.jsx-c7c3a8e231c9215a>*{color:red}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/one-off-global-selectors/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"c7c3a8e231c9215a"}>{".container.jsx-c7c3a8e231c9215a>*{color:red}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/pack-2714/input.js: -------------------------------------------------------------------------------- 1 | import css from "styled-jsx/css"; 2 | 3 | const { className: cardClassName, styles } = css.resolve` 4 | :hover { 5 | z-index: ${hoverAnimation ? "1" : "auto"}; 6 | } 7 | `; 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/pack-2714/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | const { className: cardClassName, styles } = { 3 | styles: <_JSXStyle id={"5a197bb654b20ab4"}>{`.jsx-5a197bb654b20ab4:hover{z-index:${hoverAnimation ? "1" : "auto"}}`}, 4 | className: "jsx-5a197bb654b20ab4" 5 | }; 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/pack-2714/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | const { className: cardClassName, styles } = { 3 | styles: <_JSXStyle id={"5a197bb654b20ab4"}>{`.jsx-5a197bb654b20ab4:hover{z-index:${hoverAnimation ? "1" : "auto"}}`}, 4 | className: "jsx-5a197bb654b20ab4" 5 | }; 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/pack-2819/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 |

woot

5 |

woot

6 | 16 |
17 | ); 18 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/pack-2819/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 |

woot

5 |

woot

6 | <_JSXStyle id={"d3bc3634b8d1b3fb"}>{".container.jsx-d3bc3634b8d1b3fb{color:#00f;padding:3rem}.container.inner.jsx-d3bc3634b8d1b3fb{color:#ff0}"} 7 |
); 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/pack-2819/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 |

woot

5 |

woot

6 | <_JSXStyle id={"d3bc3634b8d1b3fb"}>{".container.jsx-d3bc3634b8d1b3fb{color:#00f;padding:3rem}.container.jsx-d3bc3634b8d1b3fb.inner.jsx-d3bc3634b8d1b3fb{color:#ff0}"} 7 |
); 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/source-maps/input.js: -------------------------------------------------------------------------------- 1 | // TODO: needs sourcemaps 2 | // export default () => ( 3 | //
4 | //

test

5 | //

woot

6 | // 7 | //
8 | // ) 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/source-maps/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | // TODO: needs sourcemaps 2 | // export default () => ( 3 | //
4 | //

test

5 | //

woot

6 | // 7 | //
8 | // ) 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/source-maps/output.swc.js: -------------------------------------------------------------------------------- 1 | // TODO: needs sourcemaps 2 | // export default () => ( 3 | //
4 | //

test

5 | //

woot

6 | // 7 | //
8 | // ) 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/specifity/input.js: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return ( 3 | <> 4 | 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/specifity/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default function Home() { 3 | return <> 4 | <_JSXStyle id={"86b7ac1a67e57b1"}>{"div.parent.jsx-86b7ac1a67e57b1{color:green}"} 5 | ; 6 | } 7 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/specifity/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default function Home() { 3 | return <> 4 | <_JSXStyle id={"86b7ac1a67e57b1"}>{"div.jsx-86b7ac1a67e57b1{}div.jsx-86b7ac1a67e57b1.parent.jsx-86b7ac1a67e57b1{color:green}"} 5 | ; 6 | } 7 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/stateless/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 |

woot

5 |

woot

6 | 7 |
8 | ); 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/stateless/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 |

woot

5 |

woot

6 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"} 7 |
); 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/stateless/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 |

woot

5 |

woot

6 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"} 7 |
); 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles-external-invalid/input.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // import css from 'styled-jsx/css' 3 | 4 | // const color = 'red' 5 | 6 | // export const foo = css`div { color: ${color}}` 7 | 8 | // const props = { color: 'red ' } 9 | 10 | // export default css` 11 | // div { font-size: 3em; color: ${props.color} } 12 | // p { color: ${this.props.color};} 13 | // ` 14 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles-external-invalid/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // import css from 'styled-jsx/css' 3 | // const color = 'red' 4 | // export const foo = css`div { color: ${color}}` 5 | // const props = { color: 'red ' } 6 | // export default css` 7 | // div { font-size: 3em; color: ${props.color} } 8 | // p { color: ${this.props.color};} 9 | // ` 10 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles-external-invalid/output.swc.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // import css from 'styled-jsx/css' 3 | // const color = 'red' 4 | // export const foo = css`div { color: ${color}}` 5 | // const props = { color: 'red ' } 6 | // export default css` 7 | // div { font-size: 3em; color: ${props.color} } 8 | // p { color: ${this.props.color};} 9 | // ` 10 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles-external-invalid2/input.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // import css from 'styled-jsx/css' 3 | 4 | // const color = 'red' 5 | 6 | // export const foo = css`div { color: ${color}}` 7 | 8 | // export default css` 9 | // div { font-size: 3em } 10 | // p { color: ${props.color};} 11 | // ` 12 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles-external-invalid2/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // import css from 'styled-jsx/css' 3 | // const color = 'red' 4 | // export const foo = css`div { color: ${color}}` 5 | // export default css` 6 | // div { font-size: 3em } 7 | // p { color: ${props.color};} 8 | // ` 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles-external-invalid2/output.swc.js: -------------------------------------------------------------------------------- 1 | // TODO 2 | // import css from 'styled-jsx/css' 3 | // const color = 'red' 4 | // export const foo = css`div { color: ${color}}` 5 | // export default css` 6 | // div { font-size: 3em } 7 | // p { color: ${props.color};} 8 | // ` 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles2/input.js: -------------------------------------------------------------------------------- 1 | // TODO: support common js 2 | // import css from 'styled-jsx/css' 3 | 4 | // module.exports = css` 5 | // div { font-size: 3em } 6 | // ` 7 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles2/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | // TODO: support common js 2 | // import css from 'styled-jsx/css' 3 | // module.exports = css` 4 | // div { font-size: 3em } 5 | // ` 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/styles2/output.swc.js: -------------------------------------------------------------------------------- 1 | // TODO: support common js 2 | // import css from 'styled-jsx/css' 3 | // module.exports = css` 4 | // div { font-size: 3em } 5 | // ` 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-escape-1/input.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | render() { 3 | return ( 4 |
5 |

test

6 | 11 |
12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-escape-1/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default class { 3 | render() { 4 | return
5 |

test

6 | <_JSXStyle id={"71816f8e3c42a736"}>{'p.jsx-71816f8e3c42a736{content:"`"}'} 7 |
; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-escape-1/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default class { 3 | render() { 4 | return
5 |

test

6 | <_JSXStyle id={"71816f8e3c42a736"}>{'p.jsx-71816f8e3c42a736{content:"`"}'} 7 |
; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-escape-2/input.js: -------------------------------------------------------------------------------- 1 | export default function Home({ fontFamily }) { 2 | return ( 3 |
4 | 15 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-placeholder-1-as-property/input.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | render() { 3 | return ( 4 |
5 |

test

6 | 13 |
14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-placeholder-2-as-part-of-value/input.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | render() { 3 | return ( 4 |
5 |

test

6 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-placeholder-3-as-value/input.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | render() { 3 | return ( 4 |
5 |

test

6 | 13 |
14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | render() { 3 | return ( 4 |
5 |

test

6 | 13 |
14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | render() { 3 | return ( 4 |
5 |

test

6 | 12 |
13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-complex-selector-2/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 | 10 |
11 | ); 12 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-complex-selector-2/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"f12d8626937fd2c6"}>{".a-selector.jsx-f12d8626937fd2c6:hover,.a-selector.jsx-f12d8626937fd2c6:focus{outline:none}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-complex-selector-2/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"f12d8626937fd2c6"}>{".a-selector.jsx-f12d8626937fd2c6:hover,.a-selector.jsx-f12d8626937fd2c6:focus{outline:none}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-normal/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 | 21 |
22 | ); 23 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-normal/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"292192d0348369b"}>{"p.jsx-292192d0348369b{color:red}.jsx-292192d0348369b{color:#00f}[href=woot].jsx-292192d0348369b{color:red}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-normal/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"292192d0348369b"}>{"p.jsx-292192d0348369b{color:red}p.jsx-292192d0348369b{color:red}.jsx-292192d0348369b{color:#00f}[href=woot].jsx-292192d0348369b{color:red}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-nth-1/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 | 9 |
10 | ); 11 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-nth-1/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"d8153edfc80ef241"}>{"li.jsx-d8153edfc80ef241:nth-child(2){color:#0f0}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/transform-css-nth-1/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 | <_JSXStyle id={"d8153edfc80ef241"}>{"li.jsx-d8153edfc80ef241:nth-child(2){color:#0f0}"} 5 |
); 6 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/whitespace/input.js: -------------------------------------------------------------------------------- 1 | export default () => ( 2 |
3 |

test

4 |

woot

5 |

woot

6 | 7 |
8 | ); 9 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/whitespace/output.lightningcss.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 |

woot

5 |

woot

6 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"} 7 |
); 8 | -------------------------------------------------------------------------------- /packages/styled-jsx/transform/tests/fixture/whitespace/output.swc.js: -------------------------------------------------------------------------------- 1 | import _JSXStyle from "styled-jsx/style"; 2 | export default (()=>
3 |

test

4 |

woot

5 |

woot

6 | <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"} 7 |
); 8 | -------------------------------------------------------------------------------- /packages/swc-confidential/.npmignore: -------------------------------------------------------------------------------- 1 | __tests__/ 2 | transform/ 3 | Cargo.toml -------------------------------------------------------------------------------- /packages/swc-confidential/__tests__/__snapshots__/wasm.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Should load swc-confidential wasm plugin correctly > Should transform simple correctly 1`] = ` 4 | "console.log("secure:de454774988d624b8f317bbe9dadfe1f"); 5 | " 6 | `; 7 | -------------------------------------------------------------------------------- /packages/swc-confidential/transform/tests/fixture/simple/input.js: -------------------------------------------------------------------------------- 1 | console.log(/*#__CONFIDENTIAL__*/ "newDashboard") -------------------------------------------------------------------------------- /packages/swc-confidential/transform/tests/fixture/simple/output.js: -------------------------------------------------------------------------------- 1 | console.log("secure:de454774988d624b8f317bbe9dadfe1f"); 2 | -------------------------------------------------------------------------------- /packages/swc-magic/.npmignore: -------------------------------------------------------------------------------- 1 | __tests__/ 2 | transform/ 3 | Cargo.toml -------------------------------------------------------------------------------- /packages/swc-magic/README.tmpl.md: -------------------------------------------------------------------------------- 1 | # @swc/plugin-swc-magic 2 | 3 | ## Usage 4 | 5 | .swcrc: 6 | 7 | ```json 8 | { 9 | "jsc": { 10 | "experimental": { 11 | "plugins": ["@swc/plugin-swc-magic"] 12 | } 13 | } 14 | } 15 | ``` 16 | 17 | ### `markAsPure` 18 | 19 | ```js 20 | import { markAsPure } from "@swc/magic"; 21 | 22 | markAsPure(() => console.log("This will be removed by the SWC minifier")); 23 | ``` 24 | 25 | ${CHANGELOG} 26 | -------------------------------------------------------------------------------- /packages/swc-magic/transform/tests/fixture/no-name-clash/input.js: -------------------------------------------------------------------------------- 1 | import { markAsPure } from "not-swc-magic"; 2 | 3 | markAsPure(console.log("test!")); 4 | -------------------------------------------------------------------------------- /packages/swc-magic/transform/tests/fixture/no-name-clash/output.js: -------------------------------------------------------------------------------- 1 | import { markAsPure } from "not-swc-magic"; 2 | markAsPure(console.log("test!")); 3 | -------------------------------------------------------------------------------- /packages/swc-magic/transform/tests/fixture/simple/input.js: -------------------------------------------------------------------------------- 1 | import { markAsPure } from "@swc/magic"; 2 | 3 | markAsPure(console.log("test!")); 4 | -------------------------------------------------------------------------------- /packages/swc-magic/transform/tests/fixture/simple/output.js: -------------------------------------------------------------------------------- 1 | /*#__PURE__*/ console.log("test!"); 2 | -------------------------------------------------------------------------------- /packages/swc-sdk/.npmignore: -------------------------------------------------------------------------------- 1 | __tests__/ 2 | transform/ 3 | Cargo.toml -------------------------------------------------------------------------------- /packages/swc-sdk/README.tmpl.md: -------------------------------------------------------------------------------- 1 | # @swc/plugin-swc-sdk 2 | 3 | ## Usage 4 | 5 | .swcrc: 6 | 7 | ```json 8 | { 9 | "jsc": { 10 | "experimental": { 11 | "plugins": ["@swc/plugin-swc-sdk"] 12 | } 13 | } 14 | } 15 | ``` 16 | 17 | ### `markAsPure` 18 | 19 | ```js 20 | import { markAsPure } from "@swc/sdk"; 21 | 22 | markAsPure(() => console.log("This will be removed by the SWC minifier")); 23 | ``` 24 | 25 | ${CHANGELOG} 26 | -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/arg-1/input.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | 3 | const foo = flag({ 4 | decide: () => false, 5 | }); 6 | 7 | console.log(foo); -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/arg-1/output.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | const foo = flag({ 3 | decide: ()=>false, 4 | key: "foo" 5 | }); 6 | console.log(foo); 7 | -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/custom-adapter/input.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | 3 | const foo = flag({ 4 | decide: () => false, 5 | }); 6 | 7 | console.log(foo); -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/custom-adapter/output.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | const foo = flag({ 3 | decide: ()=>false, 4 | key: "foo" 5 | }); 6 | console.log(foo); 7 | -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/duplicate/input.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | 3 | const foo = flag({ 4 | decide: () => false, 5 | key: 'custom' 6 | }); 7 | 8 | console.log(foo); -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/duplicate/output.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | const foo = flag({ 3 | decide: ()=>false, 4 | key: 'custom' 5 | }); 6 | console.log(foo); 7 | -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/no-arg/input.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | 3 | const foo = flag({ 4 | decide: () => false, 5 | }); 6 | 7 | console.log(foo); -------------------------------------------------------------------------------- /packages/swc-sdk/transform/tests/fixture/flag/no-arg/output.js: -------------------------------------------------------------------------------- 1 | import { flag } from "@swc/sdk/flag"; 2 | const foo = flag({ 3 | decide: ()=>false, 4 | key: "foo" 5 | }); 6 | console.log(foo); 7 | -------------------------------------------------------------------------------- /packages/transform-imports/.npmignore: -------------------------------------------------------------------------------- 1 | __tests__/ 2 | transform/ 3 | Cargo.toml -------------------------------------------------------------------------------- /packages/transform-imports/README.tmpl.md: -------------------------------------------------------------------------------- 1 | # transform-imports 2 | 3 | ## Config 4 | 5 | ```json 6 | [ 7 | "transform-imports", 8 | { 9 | "react-bootstrap": { 10 | "transform": "react-bootstrap/lib/{{member}}" 11 | }, 12 | "lodash": { 13 | "transform": "lodash/{{member}}" 14 | } 15 | } 16 | ] 17 | ``` 18 | 19 | ${CHANGELOG} 20 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/default/input.js: -------------------------------------------------------------------------------- 1 | import defaultExport from "my-default"; 2 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/default/output.js: -------------------------------------------------------------------------------- 1 | import defaultExport from "transformed-default"; 2 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/dynamic-imports/input.js: -------------------------------------------------------------------------------- 1 | await import('./stringLiteral.tsx'); 2 | await import(`./templateLiteral.ts`); -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/dynamic-imports/output.js: -------------------------------------------------------------------------------- 1 | await import("./stringLiteral.js"); 2 | await import("./templateLiteral.js"); 3 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/mapping-export/input.js: -------------------------------------------------------------------------------- 1 | export { foo, bar } from "my-library-4"; 2 | export { otherImport } from "my-library-4"; 3 | export { useSomeAPI } from "my-library-4"; 4 | export { ArrowUpIcon } from "my-library-4"; 5 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/mapping-export/output.js: -------------------------------------------------------------------------------- 1 | export { foo } from "my-library-4/this_is_foo"; 2 | export { bar } from "my-library-4/bar"; 3 | export { otherImport } from "my-library-4/OTHERIMPORT"; 4 | export { useSomeAPI } from "my-library-4/use-some-api/some-api"; 5 | export { ArrowUpIcon } from "my-library-4/arrow-up"; 6 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/mapping/input.js: -------------------------------------------------------------------------------- 1 | import { foo, bar } from "my-library-4"; 2 | import { otherImport } from "my-library-4"; 3 | import { useSomeAPI } from "my-library-4"; 4 | import { ArrowUpIcon } from "my-library-4"; 5 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/mapping/output.js: -------------------------------------------------------------------------------- 1 | import { foo } from "my-library-4/this_is_foo"; 2 | import { bar } from "my-library-4/bar"; 3 | import { otherImport } from "my-library-4/OTHERIMPORT"; 4 | import { useSomeAPI } from "my-library-4/use-some-api/some-api"; 5 | import { ArrowUpIcon } from "my-library-4/arrow-up"; 6 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/mixed-default/input.js: -------------------------------------------------------------------------------- 1 | import defaultExport, { someNamedExport } from "my-mixed-named"; 2 | import otherDefaultExport, * as starExport from "my-mixed-star"; 3 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/mixed-default/output.js: -------------------------------------------------------------------------------- 1 | import defaultExport from "transformed-mixed-named"; 2 | import { someNamedExport } from "transformed-mixed-named"; 3 | import otherDefaultExport from "transformed-mixed-star"; 4 | import * as starExport from "transformed-mixed-star"; 5 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/namespace-export/input.js: -------------------------------------------------------------------------------- 1 | export * as someModule from "my-module-namespace"; 2 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/namespace-export/output.js: -------------------------------------------------------------------------------- 1 | export * as someModule from "transformed-module-namespace"; 2 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/namespace/input.js: -------------------------------------------------------------------------------- 1 | import * as someModule from "my-module-namespace"; 2 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/namespace/output.js: -------------------------------------------------------------------------------- 1 | import * as someModule from "transformed-module-namespace"; 2 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/regex-export/input.js: -------------------------------------------------------------------------------- 1 | export { MyModule } from "my-library"; 2 | export { App } from "my-library/components"; 3 | export { Header, Footer } from "my-library/components/App"; 4 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/regex-export/output.js: -------------------------------------------------------------------------------- 1 | export { default as MyModule } from "my-library/MyModule"; 2 | export { default as App } from "my-library/components/App"; 3 | export { default as Header } from "my-library/components/App/Header"; 4 | export { default as Footer } from "my-library/components/App/Footer"; 5 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/regex/input.js: -------------------------------------------------------------------------------- 1 | import { MyModule } from "my-library"; 2 | import { App } from "my-library/components"; 3 | import { Header, Footer } from "my-library/components/App"; 4 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/regex/output.js: -------------------------------------------------------------------------------- 1 | import MyModule from "my-library/MyModule"; 2 | import App from "my-library/components/App"; 3 | import Header from "my-library/components/App/Header"; 4 | import Footer from "my-library/components/App/Footer"; 5 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/side-effect-imports/input.js: -------------------------------------------------------------------------------- 1 | import './upload/upload.ts'; 2 | import './scripts/scripts.model.js'; -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/side-effect-imports/output.js: -------------------------------------------------------------------------------- 1 | import './upload/upload.ts'; 2 | import './scripts/scripts.model.js'; 3 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/simple-export/input.js: -------------------------------------------------------------------------------- 1 | export { Grid, Row, Col as Col1 } from "react-bootstrap"; 2 | export { MyModule, Widget } from "my-library-2"; 3 | export { MyModule } from "my-library-3"; 4 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/simple-export/output.js: -------------------------------------------------------------------------------- 1 | export { default as Grid } from "react-bootstrap/lib/Grid"; 2 | export { default as Row } from "react-bootstrap/lib/Row"; 3 | export { default as Col1 } from "react-bootstrap/lib/Col1"; 4 | export { MyModule } from "my-library-2/myModule"; 5 | export { Widget } from "my-library-2/widget"; 6 | export { MyModule } from "my-library-3/my-module"; 7 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/simple/input.js: -------------------------------------------------------------------------------- 1 | import { Grid, Row, Col as Col1 } from "react-bootstrap"; 2 | import { MyModule, Widget } from "my-library-2"; 3 | import { MyModule } from "my-library-3"; 4 | -------------------------------------------------------------------------------- /packages/transform-imports/transform/tests/fixture/simple/output.js: -------------------------------------------------------------------------------- 1 | import Grid from "react-bootstrap/lib/Grid"; 2 | import Row from "react-bootstrap/lib/Row"; 3 | import Col1 from "react-bootstrap/lib/Col"; 4 | import { MyModule } from "my-library-2/myModule"; 5 | import { Widget } from "my-library-2/widget"; 6 | import { MyModule } from "my-library-3/my-module"; 7 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - packages/* 3 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base", ":dependencyDashboard"], 4 | 5 | "packageRules": [ 6 | { 7 | "packagePatterns": ["*"], 8 | "enabled": false 9 | }, 10 | { 11 | "groupName": "swc_core", 12 | "matchPackageNames": ["swc_core", "testing"], 13 | "rangeStrategy": "bump", 14 | "matchUpdateTypes": "major", 15 | "enabled": true 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /rust-toolchain: -------------------------------------------------------------------------------- 1 | nightly-2025-05-06 -------------------------------------------------------------------------------- /scripts/bump-crates.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | cargo mono bump $@ 5 | git commit -a -m "Bump crates" || true 6 | -------------------------------------------------------------------------------- /scripts/bump.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | pnpm changeset || true 5 | pnpm changeset version 6 | 7 | for pkg in $(ls -d packages/*); do 8 | CHANGELOG=$(cat ./$pkg/CHANGELOG.md) envsubst < ./$pkg/README.tmpl.md > ./$pkg/README.md 9 | git add ./$pkg/README.md 10 | done 11 | 12 | git commit -am "Merge CHANGELOG into README" 13 | 14 | cargo mono bump -i $@ 15 | git commit -a -m "Bump crates" || true 16 | -------------------------------------------------------------------------------- /scripts/dev/cleanup_test_log.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | export NODE_PATH=$(npm root --quiet -g) 6 | node ./scripts/dev/cleanup_test_log.js "$1" "$2" 7 | diff -u ./clean-actual.js ./clean-expected.js > clean.diff 8 | -------------------------------------------------------------------------------- /xtask/src/main.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Result; 2 | use clap::{Parser, Subcommand}; 3 | 4 | use crate::update::Update; 5 | 6 | mod update; 7 | #[derive(Debug, Parser)] 8 | 9 | struct CliArgs { 10 | #[clap(subcommand)] 11 | cmd: Cmd, 12 | } 13 | 14 | #[derive(Debug, Subcommand)] 15 | enum Cmd { 16 | Update(Update), 17 | } 18 | 19 | fn main() -> Result<()> { 20 | let args = CliArgs::parse(); 21 | 22 | match args.cmd { 23 | Cmd::Update(update) => update.run(), 24 | } 25 | } 26 | --------------------------------------------------------------------------------