@swc/plugin-styled-jsx 1.5.7 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +10 -9
- package/package.json +1 -1
- package/src/lib.rs +4 -10
- package/swc_plugin_styled_jsx.wasm +0 -0
- package/transform/Cargo.toml +34 -0
- package/transform/src/lib.rs +5 -0
- package/{src → transform/src}/style.rs +0 -0
- package/{src → transform/src}/transform_css.rs +0 -0
- package/{src → transform/src}/utils.rs +0 -0
- package/{src → transform/src}/visitor.rs +0 -0
- package/{tests → transform/tests}/errors/nested-style-tags/input.js +0 -0
- package/{tests → transform/tests}/errors/nested-style-tags/output.js +0 -0
- package/{tests → transform/tests}/errors/nested-style-tags/output.stderr +0 -0
- package/{tests → transform/tests}/errors/no-child/input.js +0 -0
- package/{tests → transform/tests}/errors/no-child/output.js +0 -0
- package/{tests → transform/tests}/errors/no-child/output.stderr +0 -0
- package/{tests → transform/tests}/errors/ts-with-css-resolve/input.js +0 -0
- package/{tests → transform/tests}/errors/ts-with-css-resolve/output.js +0 -0
- package/{tests → transform/tests}/errors/ts-with-css-resolve/output.stderr +0 -0
- package/{tests → transform/tests}/errors/two-children/input.js +0 -0
- package/{tests → transform/tests}/errors/two-children/output.js +0 -0
- package/{tests → transform/tests}/errors/two-children/output.stderr +0 -0
- package/{tests → transform/tests}/errors/wrong-child-type/input.js +0 -0
- package/{tests → transform/tests}/errors/wrong-child-type/output.js +0 -0
- package/{tests → transform/tests}/errors/wrong-child-type/output.stderr +0 -0
- package/{tests → transform/tests}/errors/wrong-jsx-expression-type/input.js +0 -0
- package/{tests → transform/tests}/errors/wrong-jsx-expression-type/output.js +0 -0
- package/{tests → transform/tests}/errors/wrong-jsx-expression-type/output.stderr +0 -0
- package/{tests → transform/tests}/fixture/absent/input.js +0 -0
- package/{tests → transform/tests}/fixture/absent/output.js +0 -0
- package/{tests → transform/tests}/fixture/attribute-generation-classname-rewriting/input.js +0 -0
- package/{tests → transform/tests}/fixture/attribute-generation-classname-rewriting/output.js +0 -0
- package/{tests → transform/tests}/fixture/attribute-generation-modes/input.js +0 -0
- package/{tests → transform/tests}/fixture/attribute-generation-modes/output.js +0 -0
- package/{tests → transform/tests}/fixture/class/input.js +0 -0
- package/{tests → transform/tests}/fixture/class/output.js +0 -0
- package/{tests → transform/tests}/fixture/comments/input.js +0 -0
- package/{tests → transform/tests}/fixture/comments/output.js +0 -0
- package/{tests → transform/tests}/fixture/component-attribute/input.js +0 -0
- package/{tests → transform/tests}/fixture/component-attribute/output.js +0 -0
- package/{tests → transform/tests}/fixture/conflicts/input.js +0 -0
- package/{tests → transform/tests}/fixture/conflicts/output.js +0 -0
- package/{tests → transform/tests}/fixture/css-selector-after-pseudo/input.js +0 -0
- package/{tests → transform/tests}/fixture/css-selector-after-pseudo/output.js +0 -0
- package/{tests → transform/tests}/fixture/css-tag-same-file/input.js +0 -0
- package/{tests → transform/tests}/fixture/css-tag-same-file/output.js +0 -0
- package/{tests → transform/tests}/fixture/different-jsx-ids/input.js +0 -0
- package/{tests → transform/tests}/fixture/different-jsx-ids/output.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-element/input.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-element/output.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-element-class/input.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-element-class/output.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-element-external/input.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-element-external/output.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-this-in-arrow/input.js +0 -0
- package/{tests → transform/tests}/fixture/dynamic-this-in-arrow/output.js +0 -0
- package/{tests → transform/tests}/fixture/exported-jsx-style/input.js +0 -0
- package/{tests → transform/tests}/fixture/exported-jsx-style/output.js +0 -0
- package/{tests → transform/tests}/fixture/exported-non-jsx-style/input.js +0 -0
- package/{tests → transform/tests}/fixture/exported-non-jsx-style/output.js +0 -0
- package/{tests → transform/tests}/fixture/expressions/input.js +0 -0
- package/{tests → transform/tests}/fixture/expressions/output.js +0 -0
- package/{tests → transform/tests}/fixture/external-nested-scope/input.js +0 -0
- package/{tests → transform/tests}/fixture/external-nested-scope/output.js +0 -0
- package/{tests → transform/tests}/fixture/external-stylesheet/input.js +0 -0
- package/{tests → transform/tests}/fixture/external-stylesheet/output.js +0 -0
- package/{tests → transform/tests}/fixture/external-stylesheet-global/input.js +0 -0
- package/{tests → transform/tests}/fixture/external-stylesheet-global/output.js +0 -0
- package/{tests → transform/tests}/fixture/external-stylesheet-multi-line/input.js +0 -0
- package/{tests → transform/tests}/fixture/external-stylesheet-multi-line/output.js +0 -0
- package/{tests → transform/tests}/fixture/fragment/input.js +0 -0
- package/{tests → transform/tests}/fixture/fragment/output.js +0 -0
- package/{tests → transform/tests}/fixture/global/input.js +0 -0
- package/{tests → transform/tests}/fixture/global/output.js +0 -0
- package/{tests → transform/tests}/fixture/global-child-selector/input.js +0 -0
- package/{tests → transform/tests}/fixture/global-child-selector/output.js +0 -0
- package/{tests → transform/tests}/fixture/global-redundant/input.js +0 -0
- package/{tests → transform/tests}/fixture/global-redundant/output.js +0 -0
- package/{tests → transform/tests}/fixture/issue-30480/input.js +0 -0
- package/{tests → transform/tests}/fixture/issue-30480/output.js +0 -0
- package/{tests → transform/tests}/fixture/issue-30570/input.js +0 -0
- package/{tests → transform/tests}/fixture/issue-30570/output.js +0 -0
- package/{tests → transform/tests}/fixture/issue-31562-interpolation-in-mdea/input.js +0 -0
- package/{tests → transform/tests}/fixture/issue-31562-interpolation-in-mdea/output.js +0 -0
- package/{tests → transform/tests}/fixture/mixed-global-scoped/input.js +0 -0
- package/{tests → transform/tests}/fixture/mixed-global-scoped/output.js +0 -0
- package/{tests → transform/tests}/fixture/multiple-jsx/input.js +0 -0
- package/{tests → transform/tests}/fixture/multiple-jsx/output.js +0 -0
- package/{tests → transform/tests}/fixture/nested-style-tags/index.js +0 -0
- package/{tests → transform/tests}/fixture/nested-style-tags/output.js +0 -0
- package/{tests → transform/tests}/fixture/non-styled-jsx-style/input.js +0 -0
- package/{tests → transform/tests}/fixture/non-styled-jsx-style/output.js +0 -0
- package/{tests → transform/tests}/fixture/not-styled-jsx-tagged-templates/input.js +0 -0
- package/{tests → transform/tests}/fixture/not-styled-jsx-tagged-templates/output.js +0 -0
- package/{tests → transform/tests}/fixture/number-after-placeholder/input.js +0 -0
- package/{tests → transform/tests}/fixture/number-after-placeholder/output.js +0 -0
- package/{tests → transform/tests}/fixture/one-off-global-selectors/input.js +0 -0
- package/{tests → transform/tests}/fixture/one-off-global-selectors/output.js +0 -0
- package/{tests → transform/tests}/fixture/source-maps/input.js +0 -0
- package/{tests → transform/tests}/fixture/source-maps/output.js +0 -0
- package/{tests → transform/tests}/fixture/stateless/input.js +0 -0
- package/{tests → transform/tests}/fixture/stateless/output.js +0 -0
- package/{tests → transform/tests}/fixture/styles/input.js +0 -0
- package/{tests → transform/tests}/fixture/styles/output.js +0 -0
- package/{tests → transform/tests}/fixture/styles-external-invalid/input.js +0 -0
- package/{tests → transform/tests}/fixture/styles-external-invalid/output.js +0 -0
- package/{tests → transform/tests}/fixture/styles-external-invalid2/input.js +0 -0
- package/{tests → transform/tests}/fixture/styles-external-invalid2/output.js +0 -0
- package/{tests → transform/tests}/fixture/styles2/input.js +0 -0
- package/{tests → transform/tests}/fixture/styles2/output.js +0 -0
- package/{tests → transform/tests}/fixture/too-many/input.js +0 -0
- package/{tests → transform/tests}/fixture/too-many/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-escape-1/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-escape-1/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-escape-2/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-escape-2/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-1-as-property/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-1-as-property/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-2-as-part-of-value/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-2-as-part-of-value/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-3-as-value/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-3-as-value/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js +0 -0
- package/{tests → transform/tests}/fixture/tpl-placeholder-5-values-of-multiple-properties/output.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css/input.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css/output.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-complex-selector/input.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-complex-selector/output.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-global/input.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-global/output.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-media-query/input.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-media-query/output.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-normal/input.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-normal/output.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-nth-1/input.js +0 -0
- package/{tests → transform/tests}/fixture/transform-css-nth-1/output.js +0 -0
- package/{tests → transform/tests}/fixture/whitespace/input.js +0 -0
- package/{tests → transform/tests}/fixture/whitespace/output.js +0 -0
- package/{tests → transform/tests}/fixture.rs +1 -1
package/Cargo.toml
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
|
|
3
|
-
description = "SWC
|
|
3
|
+
description = "SWC Plugin for styled-jsx"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
name = "swc_plugin_styled_jsx"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.8.0"
|
|
8
8
|
|
|
9
9
|
[lib]
|
|
10
10
|
crate-type = ["cdylib", "rlib"]
|
|
11
11
|
|
|
12
12
|
[features]
|
|
13
|
-
plugin = ["swc_core/plugin_transform"]
|
|
14
13
|
custom_transform = ["swc_core/common_concurrent"]
|
|
15
14
|
|
|
16
15
|
[dependencies]
|
|
17
16
|
easy-error = "1.0.0"
|
|
18
17
|
tracing = "0.1.32"
|
|
19
18
|
|
|
20
|
-
swc_core = {
|
|
19
|
+
swc_core = {version = "0.38.1", features = [
|
|
21
20
|
"common",
|
|
22
21
|
"ecma_ast",
|
|
23
22
|
"css_ast",
|
|
@@ -28,11 +27,13 @@ swc_core = { version = "0.38.1", features = [
|
|
|
28
27
|
"ecma_parser",
|
|
29
28
|
"ecma_minifier",
|
|
30
29
|
"ecma_utils",
|
|
31
|
-
"ecma_visit"
|
|
32
|
-
]
|
|
30
|
+
"ecma_visit",
|
|
31
|
+
]}
|
|
32
|
+
|
|
33
|
+
styled_jsx = {version = "0.23.0", path = "./transform"}
|
|
33
34
|
|
|
34
35
|
[dev-dependencies]
|
|
36
|
+
swc_core = {features = [
|
|
37
|
+
"testing_transform",
|
|
38
|
+
], version = "0.38.1"}
|
|
35
39
|
testing = "0.31.8"
|
|
36
|
-
swc_core = { features = [
|
|
37
|
-
"testing_transform"
|
|
38
|
-
], version = "0.38.1" }
|
package/package.json
CHANGED
package/src/lib.rs
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
+
#![allow(clippy::not_unsafe_ptr_arg_deref)]
|
|
1
2
|
#![feature(box_patterns)]
|
|
2
|
-
|
|
3
|
+
|
|
4
|
+
use styled_jsx::visitor;
|
|
3
5
|
use swc_core::{
|
|
4
6
|
common::{sync::Lrc, FileName, SourceMap},
|
|
5
7
|
ecma::{ast::Program, visit::FoldWith},
|
|
6
8
|
plugin::{plugin_transform, proxies::TransformPluginProgramMetadata},
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
pub mod style;
|
|
10
|
-
mod transform_css;
|
|
11
|
-
mod utils;
|
|
12
|
-
pub mod visitor;
|
|
13
|
-
|
|
14
|
-
#[cfg(feature = "plugin")]
|
|
15
11
|
#[plugin_transform]
|
|
16
12
|
fn styled_jsx_plugin(program: Program, _: TransformPluginProgramMetadata) -> Program {
|
|
17
13
|
// TODO(kdy1): This is wrong, but it does not use cm
|
|
18
14
|
let cm = Lrc::new(SourceMap::default());
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
program
|
|
16
|
+
program.fold_with(&mut visitor::styled_jsx(cm, FileName::Anon))
|
|
23
17
|
}
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
|
|
3
|
+
description = "AST transforms visitor for styled-jsx"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
license = "Apache-2.0"
|
|
6
|
+
name = "styled_jsx"
|
|
7
|
+
version = "0.23.0"
|
|
8
|
+
|
|
9
|
+
[features]
|
|
10
|
+
custom_transform = ["swc_core/common_concurrent"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
easy-error = "1.0.0"
|
|
14
|
+
tracing = "0.1.32"
|
|
15
|
+
|
|
16
|
+
swc_core = { version = "0.38.1", features = [
|
|
17
|
+
"common",
|
|
18
|
+
"ecma_ast",
|
|
19
|
+
"css_ast",
|
|
20
|
+
"css_codegen",
|
|
21
|
+
"css_parser",
|
|
22
|
+
"css_prefixer",
|
|
23
|
+
"css_visit",
|
|
24
|
+
"ecma_parser",
|
|
25
|
+
"ecma_minifier",
|
|
26
|
+
"ecma_utils",
|
|
27
|
+
"ecma_visit"
|
|
28
|
+
] }
|
|
29
|
+
|
|
30
|
+
[dev-dependencies]
|
|
31
|
+
testing = "0.31.8"
|
|
32
|
+
swc_core = { features = [
|
|
33
|
+
"testing_transform"
|
|
34
|
+
], version = "0.38.1" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/{tests → transform/tests}/fixture/attribute-generation-classname-rewriting/output.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/{tests → transform/tests}/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js
RENAMED
|
File without changes
|
package/{tests → transform/tests}/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js
RENAMED
|
File without changes
|
package/{tests → transform/tests}/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js
RENAMED
|
File without changes
|
package/{tests → transform/tests}/fixture/tpl-placeholder-5-values-of-multiple-properties/output.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
use std::path::PathBuf;
|
|
2
2
|
|
|
3
|
+
use styled_jsx::visitor::styled_jsx;
|
|
3
4
|
use swc_core::{
|
|
4
5
|
common::{chain, FileName, Mark, Span, DUMMY_SP},
|
|
5
6
|
ecma::{
|
|
@@ -10,7 +11,6 @@ use swc_core::{
|
|
|
10
11
|
},
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
|
-
use swc_plugin_styled_jsx::visitor::styled_jsx;
|
|
14
14
|
use testing::fixture;
|
|
15
15
|
|
|
16
16
|
fn syntax() -> Syntax {
|