Unverified Commit 4eac75bb authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

feat(next-swc): Update swc (#39055)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
parent 377fddfa
This diff is collapsed.
......@@ -26,18 +26,18 @@ swc_emotion = {path="../emotion"}
styled_components = {path="../styled_components"}
styled_jsx = {path="../styled_jsx"}
modularize_imports = {path="../modularize_imports"}
swc = "0.205.0"
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.35.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", optional = true, default-features = false }
swc_cached = "0.1.1"
swc = "0.212.1"
swc_atoms = "0.3.1"
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap", "plugin_transform_schema_v1"] }
swc_ecma_loader = { version = "0.38.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.70.0", optional = true, default-features = false, features = ["plugin_transform_schema_v1"] }
swc_cached = "0.2.0"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
wasmer = { version = "2.3.0", optional = true, default-features = false }
wasmer-wasi = { version = "2.3.0", optional = true, default-features = false }
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"
walkdir = "2.3.2"
......@@ -5,7 +5,7 @@ description = "AST Transforms for emotion"
license = "Apache-2.0"
name = "swc_emotion"
repository = "https://github.com/vercel/next.js.git"
version = "0.12.0"
version = "0.16.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......@@ -18,12 +18,13 @@ radix_fmt = "1"
regex = "1.5"
serde = "1"
sourcemap = "6.0.1"
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "utils", "visit"] }
swc_atoms = "0.3.1"
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "utils", "visit"] }
swc_trace_macro = "0.1.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"
serde_json = "1"
use serde::{Deserialize, Serialize};
use swc_atoms::JsWord;
use swc_common::collections::AHashMap;
use crate::{EmotionModuleConfig, ExportItem};
/// key: `importSource`
pub type ImportMap = AHashMap<JsWord, ImportMapValue>;
/// key: `localExportName`
pub type ImportMapValue = AHashMap<JsWord, Config>;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Config {
canonical_import: ImportItem,
}
/// `(packageName, exportName)`
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ImportItem(JsWord, JsWord);
pub(crate) fn expand_import_map(
map: Option<&ImportMap>,
mut imports: Vec<EmotionModuleConfig>,
) -> Vec<EmotionModuleConfig> {
if let Some(map) = map {
map.iter().for_each(|(import_source, value)| {
value
.iter()
.for_each(|(local_export_name, Config { canonical_import })| {
let ImportItem(package_name, export_name) = canonical_import;
if &*package_name == "@emotion/react" && &*export_name == "jsx" {
return;
}
let package_transformers = imports
.iter()
.find(|v| v.module_name == *package_name)
.unwrap_or_else(|| {
panic!(
"There is no transformer for the export '{}' in '{}'",
export_name, package_name
)
})
.clone();
let kind = package_transformers
.exported_names
.iter()
.find(|v| v.name == **export_name)
.map(|v| v.kind)
.or_else(|| {
if export_name == "default" {
package_transformers.default_export
} else {
None
}
})
.unwrap_or_else(|| {
panic!(
"failed to find export '{}' from package '{}'",
export_name, package_name
)
});
imports.push(EmotionModuleConfig {
module_name: import_source.clone(),
exported_names: vec![ExportItem {
name: local_export_name.to_string(),
kind,
}],
default_export: package_transformers.default_export,
});
})
});
}
imports
}
......@@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use fxhash::FxHashMap;
use import_map::ImportMap;
use once_cell::sync::Lazy;
use regex::Regex;
use serde::{Deserialize, Serialize};
......@@ -10,10 +11,10 @@ use sourcemap::{RawToken, SourceMap as RawSourcemap};
use swc_atoms::JsWord;
use swc_common::comments::Comments;
use swc_common::util::take::Take;
use swc_common::{BytePos, SourceMap, DUMMY_SP};
use swc_common::{BytePos, SourceMapperDyn, DUMMY_SP};
use swc_ecmascript::ast::{
ArrayLit, CallExpr, JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXElementName,
JSXExpr, JSXExprContainer, JSXObject, SourceMapperExt,
JSXExpr, JSXExprContainer, JSXObject, ModuleExportName, SourceMapperExt,
};
use swc_ecmascript::utils::ExprFactory;
use swc_ecmascript::{
......@@ -26,9 +27,18 @@ use swc_ecmascript::{
use swc_trace_macro::swc_trace;
mod hash;
mod import_map;
static EMOTION_OFFICIAL_LIBRARIES: Lazy<Vec<EmotionModuleConfig>> = Lazy::new(|| {
vec![
EmotionModuleConfig {
module_name: "@emotion/css".into(),
exported_names: vec![ExportItem {
name: "css".to_owned(),
kind: ExprKind::Css,
}],
default_export: Some(ExprKind::Css),
},
EmotionModuleConfig {
module_name: "@emotion/styled".into(),
exported_names: vec![],
......@@ -81,6 +91,7 @@ pub struct EmotionOptions {
pub sourcemap: Option<bool>,
pub auto_label: Option<bool>,
pub label_format: Option<String>,
pub import_map: Option<ImportMap>,
}
impl Default for EmotionOptions {
......@@ -90,6 +101,7 @@ impl Default for EmotionOptions {
sourcemap: Some(true),
auto_label: Some(true),
label_format: Some("[local]".to_owned()),
import_map: None,
}
}
}
......@@ -142,7 +154,7 @@ enum PackageMeta {
pub fn emotion<C: Comments>(
emotion_options: EmotionOptions,
path: &Path,
cm: Arc<SourceMap>,
cm: Arc<SourceMapperDyn>,
comments: C,
) -> impl Fold {
EmotionTransformer::new(emotion_options, path, cm, comments)
......@@ -154,18 +166,30 @@ pub struct EmotionTransformer<C: Comments> {
filepath: PathBuf,
dir: Option<String>,
filename: Option<String>,
cm: Arc<SourceMap>,
cm: Arc<SourceMapperDyn>,
comments: C,
import_packages: FxHashMap<Id, PackageMeta>,
emotion_target_class_name_count: usize,
current_context: Option<String>,
// skip `css` transformation if it in JSX Element/Attribute
in_jsx_element: bool,
registered_imports: Vec<EmotionModuleConfig>,
}
#[swc_trace]
impl<C: Comments> EmotionTransformer<C> {
pub fn new(options: EmotionOptions, path: &Path, cm: Arc<SourceMap>, comments: C) -> Self {
pub fn new(
options: EmotionOptions,
path: &Path,
cm: Arc<SourceMapperDyn>,
comments: C,
) -> Self {
let registered_imports = self::import_map::expand_import_map(
options.import_map.as_ref(),
EMOTION_OFFICIAL_LIBRARIES.to_vec(),
);
EmotionTransformer {
options,
filepath_hash: None,
......@@ -181,6 +205,7 @@ impl<C: Comments> EmotionTransformer<C> {
emotion_target_class_name_count: 0,
current_context: None,
in_jsx_element: false,
registered_imports,
}
}
......@@ -255,13 +280,20 @@ impl<C: Comments> EmotionTransformer<C> {
// import { css } from '@emotion/react'
// import * as emotionCss from '@emotion/react'
fn generate_import_info(&mut self, expr: &ImportDecl) {
for c in EMOTION_OFFICIAL_LIBRARIES.iter() {
for c in self.registered_imports.iter() {
if expr.src.value == c.module_name {
for specifier in expr.specifiers.iter() {
match specifier {
ImportSpecifier::Named(named) => {
for exported in c.exported_names.iter() {
if named.local.as_ref() == exported.name {
let matched = match &named.imported {
Some(imported) => match imported {
ModuleExportName::Ident(v) => v.sym == exported.name,
ModuleExportName::Str(v) => v.value == exported.name,
},
_ => named.local.as_ref() == exported.name,
};
if matched {
self.import_packages.insert(
named.local.to_id(),
PackageMeta::Named(exported.kind),
......
......@@ -16,7 +16,7 @@ fn ts_syntax() -> Syntax {
})
}
#[fixture("tests/fixture/*/input.tsx")]
#[fixture("tests/fixture/**/input.tsx")]
fn next_emotion_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.ts");
test_fixture(
......@@ -37,12 +37,17 @@ fn next_emotion_fixture(input: PathBuf) {
},
top_level_mark,
);
let test_import_map =
serde_json::from_str(include_str!("./testImportMap.json")).unwrap();
chain!(
swc_emotion::emotion(
EmotionOptions {
enabled: Some(true),
sourcemap: Some(true),
auto_label: Some(true),
import_map: Some(test_import_map),
..Default::default()
},
&PathBuf::from("input.ts"),
......
import * as React from 'react'
import { SomeGlobalFromCore } from 'package-two'
const getBgColor = () => ({ backgroundColor: '#fff' })
export default () => (
<SomeGlobalFromCore styles={{ color: 'hotpink', ...getBgColor() }} />
)
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { SomeGlobalFromCore } from 'package-two';
const getBgColor = ()=>({
backgroundColor: '#fff'
});
export default (()=>/*#__PURE__*/ _jsx(SomeGlobalFromCore, {
styles: [
{
color: 'hotpink',
...getBgColor()
},
"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsgU29tZUdsb2JhbEZyb21Db3JlIH0gZnJvbSAncGFja2FnZS10d28nXG5cbmNvbnN0IGdldEJnQ29sb3IgPSAoKSA9PiAoeyBiYWNrZ3JvdW5kQ29sb3I6ICcjZmZmJyB9KVxuXG5leHBvcnQgZGVmYXVsdCAoKSA9PiAoXG4gIDxTb21lR2xvYmFsRnJvbUNvcmUgc3R5bGVzPXt7IGNvbG9yOiAnaG90cGluaycsIC4uLmdldEJnQ29sb3IoKSB9fSAvPlxuKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1HIn0= */"
]
}));
import * as React from 'react'
import { SomeGlobalFromCore } from 'package-two'
export default () => <SomeGlobalFromCore styles={{ color: 'hotpink' }} />
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { SomeGlobalFromCore } from 'package-two';
export default (()=>/*#__PURE__*/ _jsx(SomeGlobalFromCore, {
styles: [
{
color: 'hotpink'
},
"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsgU29tZUdsb2JhbEZyb21Db3JlIH0gZnJvbSAncGFja2FnZS10d28nXG5cbmV4cG9ydCBkZWZhdWx0ICgpID0+IDxTb21lR2xvYmFsRnJvbUNvcmUgc3R5bGVzPXt7IGNvbG9yOiAnaG90cGluaycgfX0gLz5cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHc0IifQ== */"
]
}));
import { nonDefaultStyled as someAlias } from 'package-one'
let SomeComp = someAlias.div({ color: 'hotpink' })
import { nonDefaultStyled as someAlias } from 'package-one';
let SomeComp = /*#__PURE__*/ someAlias("div", {
target: "ekie5mj0",
label: "SomeComp"
})({
color: 'hotpink'
}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG5vbkRlZmF1bHRTdHlsZWQgYXMgc29tZUFsaWFzIH0gZnJvbSAncGFja2FnZS1vbmUnXG5cbmxldCBTb21lQ29tcCA9IHNvbWVBbGlhcy5kaXYoeyBjb2xvcjogJ2hvdHBpbmsnIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRWUifQ== */");
import { nonDefaultStyled } from 'package-one'
let SomeComp = nonDefaultStyled.div({ color: 'hotpink' })
import { nonDefaultStyled } from 'package-one';
let SomeComp = /*#__PURE__*/ nonDefaultStyled("div", {
target: "ekie5mj0",
label: "SomeComp"
})({
color: 'hotpink'
}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG5vbkRlZmF1bHRTdHlsZWQgfSBmcm9tICdwYWNrYWdlLW9uZSdcblxubGV0IFNvbWVDb21wID0gbm9uRGVmYXVsdFN0eWxlZC5kaXYoeyBjb2xvcjogJ2hvdHBpbmsnIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRWUifQ== */");
import { nonDefaultStyled } from 'package-four'
let SomeComp = nonDefaultStyled.div({ color: 'hotpink' })
import { nonDefaultStyled } from 'package-four';
let SomeComp = /*#__PURE__*/ nonDefaultStyled("div", {
target: "ekie5mj0",
label: "SomeComp"
})({
color: 'hotpink'
}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG5vbkRlZmF1bHRTdHlsZWQgfSBmcm9tICdwYWNrYWdlLWZvdXInXG5cbmxldCBTb21lQ29tcCA9IG5vbkRlZmF1bHRTdHlsZWQuZGl2KHsgY29sb3I6ICdob3RwaW5rJyB9KVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVlIn0= */");
import { something } from 'package-three'
something({ color: 'green' })
import { something } from 'package-three';
/*#__PURE__*/ something({
color: 'green'
}, "label:[local]", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHNvbWV0aGluZyB9IGZyb20gJ3BhY2thZ2UtdGhyZWUnXG5cbnNvbWV0aGluZyh7IGNvbG9yOiAnZ3JlZW4nIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEifQ== */");
{
"package-one": {
"nonDefaultStyled": { "canonicalImport": ["@emotion/styled", "default"] }
},
"package-two": {
"someJsx": { "canonicalImport": ["@emotion/react", "jsx"] },
"someCssFromCore": { "canonicalImport": ["@emotion/react", "css"] },
"SomeGlobalFromCore": { "canonicalImport": ["@emotion/react", "Global"] }
},
"package-three": {
"something": { "canonicalImport": ["@emotion/css", "css"] }
},
"package-four": {
"nonDefaultStyled": {
"canonicalImport": ["@emotion/styled", "default"],
"styledBaseImport": ["package-four/base", "something"]
}
}
}
......@@ -5,7 +5,7 @@ edition = "2018"
license = "Apache-2.0"
name = "modularize_imports"
repository = "https://github.com/vercel/next.js.git"
version = "0.11.0"
version = "0.14.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......@@ -14,9 +14,9 @@ handlebars = "4.2.1"
once_cell = "1.13.0"
regex = "1.5"
serde = "1"
swc_cached = "0.1.1"
swc_ecmascript = { version = "0.180.0", features = ["visit"] }
swc_cached = "0.2.0"
swc_ecmascript = { version = "0.186.0", features = ["visit"] }
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"
......@@ -33,13 +33,13 @@ next-swc = {version = "0.0.0", path = "../core"}
once_cell = "1.13.0"
serde = "1"
serde_json = "1"
swc = "0.205.0"
swc_atoms = "0.2.13"
swc_bundler = { version = "0.169.0", features = ["concurrent"] }
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.35.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", optional = true }
swc = "0.212.1"
swc_atoms = "0.3.1"
swc_bundler = { version = "0.175.0", features = ["concurrent"] }
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.38.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.70.0", optional = true }
swc_node_base = "0.5.5"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
tracing-futures = "0.2.5"
......
......@@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0"
name = "styled_components"
repository = "https://github.com/vercel/next.js.git"
version = "0.36.0"
version = "0.39.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......@@ -15,13 +15,13 @@ Inflector = "0.11.4"
once_cell = "1.13.0"
regex = {version = "1.5.4", features = ["std", "perf"], default-features = false}
serde = {version = "1.0.130", features = ["derive"]}
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent"] }
swc_ecmascript = { version = "0.180.0", features = ["utils", "visit"] }
swc_atoms = "0.3.1"
swc_common = { version = "0.26.0", features = ["concurrent"] }
swc_ecmascript = { version = "0.186.0", features = ["utils", "visit"] }
tracing = "0.1.32"
[dev-dependencies]
serde_json = "1"
swc_ecma_transforms_testing = "0.99.0"
swc_ecmascript = { version = "0.180.0", features = ["parser", "transforms"] }
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
swc_ecmascript = { version = "0.186.0", features = ["parser", "transforms"] }
testing = "0.28.0"
......@@ -148,7 +148,7 @@ impl VisitMut for TranspileCssProp {
span: DUMMY_SP,
tail: true,
cooked: None,
raw: v.value.clone(),
raw: (&*v.value).into(),
}],
}),
JSXAttrValue::JSXExprContainer(JSXExprContainer {
......
import _styled from "styled-components";
// @flow
import _styled from "styled-components";
import React from 'react';
import Card from '../../shared/components/Card';
import config from '../../../config';
......
import _styled from "styled-components";
// @flow
import _styled from "styled-components";
import React from 'react';
export default (()=><_StyledDiv />
);
export default (()=><_StyledDiv />);
var _StyledDiv = _styled("div")`
width: 35em;
`;
import _styled from "styled-components";
/*
* Basic fixtures
*/ const StaticString = (p)=><_StyledP >A</_StyledP>;
*/ import _styled from "styled-components";
const StaticString = (p)=><_StyledP >A</_StyledP>;
const StaticTemplate = (p)=><_StyledP2 >
A
......
......@@ -5,18 +5,18 @@ edition = "2018"
license = "Apache-2.0"
name = "styled_jsx"
repository = "https://github.com/vercel/next.js.git"
version = "0.11.0"
version = "0.14.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
easy-error = "1.0.0"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_css = "0.111.0"
swc_css_prefixer = "0.107.0"
swc_ecmascript = { version = "0.180.0", features = ["parser", "minifier", "utils", "visit"] }
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_css = "0.116.0"
swc_css_prefixer = "0.113.3"
swc_ecmascript = { version = "0.186.0", features = ["parser", "minifier", "utils", "visit"] }
tracing = "0.1.32"
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"
......@@ -59,7 +59,7 @@ pub fn transform_css(
}
};
// ? Do we need to support optionally prefixing?
ss.visit_mut_with(&mut prefixer());
ss.visit_mut_with(&mut prefixer(Default::default()));
ss.visit_mut_with(&mut Namespacer {
class_name: match class_name {
Some(s) => s.clone(),
......@@ -343,7 +343,7 @@ impl Namespacer {
SubclassSelector::Class(ClassSelector {
span: DUMMY_SP,
text: Ident {
raw: subclass_selector.into(),
raw: Some(subclass_selector.into()),
value: subclass_selector.into(),
span: DUMMY_SP,
},
......
......@@ -24,7 +24,7 @@ export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles
// external and dynamic
export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
......@@ -33,14 +33,14 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
<p className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
]
])}>external and dynamic</p>
<_JSXStyle id={"accb2339a5faf0f2"} dynamic={[
<_JSXStyle id={"e7486f61219e66af"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
......@@ -50,7 +50,7 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
// external, static and dynamic
export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
......@@ -59,7 +59,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
<p className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
......@@ -68,7 +68,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"8e6465b81c401982"} dynamic={[
<_JSXStyle id={"9ef7fdf2e339f135"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
......@@ -88,7 +88,7 @@ export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
// static and dynamic
export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
......@@ -97,7 +97,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
<p className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
......@@ -106,7 +106,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"8e6465b81c401982"} dynamic={[
<_JSXStyle id={"9ef7fdf2e339f135"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
......@@ -114,7 +114,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
// dynamic only
export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
......@@ -123,14 +123,14 @@ export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
<p className={_JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
]
])}>dynamic only</p>
<_JSXStyle id={"accb2339a5faf0f2"} dynamic={[
<_JSXStyle id={"e7486f61219e66af"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
......@@ -143,7 +143,7 @@ export const Test8 = ({ color })=>{
};
return <div className={_JSXStyle.dynamic([
[
"3b89706ab84e735b",
"1f1fbf7e754ca7cb",
[
innerProps.color
]
......@@ -152,14 +152,14 @@ export const Test8 = ({ color })=>{
<p className={_JSXStyle.dynamic([
[
"3b89706ab84e735b",
"1f1fbf7e754ca7cb",
[
innerProps.color
]
]
])}>dynamic with scoped compound variable</p>
<_JSXStyle id={"3b89706ab84e735b"} dynamic={[
<_JSXStyle id={"1f1fbf7e754ca7cb"} dynamic={[
innerProps.color
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
......@@ -173,7 +173,7 @@ export const Test9 = ({ color })=>{
};
return <div className={_JSXStyle.dynamic([
[
"65329f5bf03a1958",
"460abeb3d95fb60d",
[
innerProps.color
]
......@@ -182,14 +182,14 @@ export const Test9 = ({ color })=>{
<p className={_JSXStyle.dynamic([
[
"65329f5bf03a1958",
"460abeb3d95fb60d",
[
innerProps.color
]
]
])}>dynamic with compound variable</p>
<_JSXStyle id={"65329f5bf03a1958"} dynamic={[
<_JSXStyle id={"460abeb3d95fb60d"} dynamic={[
innerProps.color
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
......@@ -197,11 +197,11 @@ export const Test9 = ({ color })=>{
};
const foo = 'red';
// dynamic with constant variable
export const Test10 = ()=><div className={"jsx-cbdf2f44af4108bd"}>
export const Test10 = ()=><div className={"jsx-f849b7a02be96503"}>
<p className={"jsx-cbdf2f44af4108bd"}>dynamic with constant variable</p>
<p className={"jsx-f849b7a02be96503"}>dynamic with constant variable</p>
<_JSXStyle id={"cbdf2f44af4108bd"}>{`p.jsx-cbdf2f44af4108bd{color:${foo}}`}</_JSXStyle>
<_JSXStyle id={"f849b7a02be96503"}>{`p.jsx-f849b7a02be96503{color:${foo}}`}</_JSXStyle>
</div>;
// dynamic with complex scope
......@@ -210,14 +210,14 @@ export const Test11 = ({ color })=>{
length: 5
}).map((item, i)=><li key={i} className={_JSXStyle.dynamic([
[
"79c618068313f86e",
"307a31332e39b502",
[
color
]
]
]) + " " + "item"}>
<_JSXStyle id={"79c618068313f86e"} dynamic={[
<_JSXStyle id={"307a31332e39b502"} dynamic={[
color
]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
......
// TODO
// export const _JSXStyle = '_JSXStyle-literal'
// export default function() {
// return (
// <div>
// <p>test</p>
// <style jsx>{`
// p {
// color: red;
// }
// `}</style>
// </div>
// )
// }
import _JSXStyle from "next/dist/shared/lib/styled-jsx";
const color = 'red';
const otherColor = 'green';
const A = ()=><div className={"jsx-498d4e86e548e679"}>
const A = ()=><div className={"jsx-551210e97e875d0e"}>
<p className={"jsx-498d4e86e548e679"}>test</p>
<p className={"jsx-551210e97e875d0e"}>test</p>
<_JSXStyle id={"498d4e86e548e679"}>{`p.jsx-498d4e86e548e679{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"551210e97e875d0e"}>{`p.jsx-551210e97e875d0e{color:${color}}`}</_JSXStyle>
</div>;
const B = ()=><div className={"jsx-d051a1c8140076ed"}>
const B = ()=><div className={"jsx-d1ed441bb35f699d"}>
<p className={"jsx-d051a1c8140076ed"}>test</p>
<p className={"jsx-d1ed441bb35f699d"}>test</p>
<_JSXStyle id={"d051a1c8140076ed"}>{`p.jsx-d051a1c8140076ed{color:${otherColor}}`}</_JSXStyle>
<_JSXStyle id={"d1ed441bb35f699d"}>{`p.jsx-d1ed441bb35f699d{color:${otherColor}}`}</_JSXStyle>
</div>;
export default (()=><div >
......
// TODO
// import React, { Component } from 'react'
// export default class Index extends Component {
// static getInitialProps() {
// return { color: 'aquamarine' }
// }
// render() {
// return (
// <div>
// {[1, 2].map(idx => (
// <div key={idx}>
// {[3, 4].map(idx2 => (
// <div key={idx2}>{this.props.color}</div>
// ))}
// </div>
// ))}
// {[1, 2].map(idx => (
// <div key={idx}>
// <div>
// {this.props.color}
// <div className="something">
// <React.Fragment>
// <div>
// <div>{this.props.color} hello there</div>
// </div>
// </React.Fragment>
// </div>
// </div>
// </div>
// ))}
// <style jsx>{`
// div {
// background: ${this.props.color};
// }
// `}</style>
// </div>
// )
// }
// }
// module.exports = () => <p><style jsx>{`p { color:red; }`}</style></p>
......@@ -8,79 +8,79 @@ const animationName = 'my-cool-animation';
const obj = {
display: 'block'
};
export default (({ display })=><div className={"jsx-ee922fe7eac00c5e " + _JSXStyle.dynamic([
export default (({ display })=><div className={"jsx-9f11e5fc71d05085 " + _JSXStyle.dynamic([
[
"374046f7d83960f0",
"e4db21be651d572a",
[
display ? 'block' : 'none'
]
],
[
"f297f0e8b24d55b4",
"1f060869c7312fe5",
[
darken(color) + 2
]
],
[
"f03bb8922a3e69b1",
"e0c373c6551675e4",
[
darken(color)
]
]
])}>
<p className={"jsx-ee922fe7eac00c5e " + _JSXStyle.dynamic([
<p className={"jsx-9f11e5fc71d05085 " + _JSXStyle.dynamic([
[
"374046f7d83960f0",
"e4db21be651d572a",
[
display ? 'block' : 'none'
]
],
[
"f297f0e8b24d55b4",
"1f060869c7312fe5",
[
darken(color) + 2
]
],
[
"f03bb8922a3e69b1",
"e0c373c6551675e4",
[
darken(color)
]
]
])}>test</p>
<_JSXStyle id={"a8107430c6c528d0"}>{`p.${color}.jsx-ee922fe7eac00c5e{color:${otherColor};display:${obj.display}}`}</_JSXStyle>
<_JSXStyle id={"13bce568d963e978"}>{`p.${color}.jsx-9f11e5fc71d05085{color:${otherColor};display:${obj.display}}`}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-ee922fe7eac00c5e{color:red}"}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-9f11e5fc71d05085{color:red}"}</_JSXStyle>
<_JSXStyle id={"f0a3b803e45f3568"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"ecd8dfc6d11e2c5e"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"f0a3b803e45f3568"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"ecd8dfc6d11e2c5e"}>{`body{background:${color}}`}</_JSXStyle>
// TODO: the next two should have the same hash
<_JSXStyle id={"accb2339a5faf0f2"}>{`p.jsx-ee922fe7eac00c5e{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"e7486f61219e66af"}>{`p.jsx-9f11e5fc71d05085{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"accb2339a5faf0f2"}>{`p.jsx-ee922fe7eac00c5e{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"e7486f61219e66af"}>{`p.jsx-9f11e5fc71d05085{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"f03bb8922a3e69b1"} dynamic={[
<_JSXStyle id={"e0c373c6551675e4"} dynamic={[
darken(color)
]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`}</_JSXStyle>
<_JSXStyle id={"f297f0e8b24d55b4"} dynamic={[
<_JSXStyle id={"1f060869c7312fe5"} dynamic={[
darken(color) + 2
]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`}</_JSXStyle>
<_JSXStyle id={"d7df5b0be4ac2e3b"}>{`@media(min-width:${mediumScreen}){p.jsx-ee922fe7eac00c5e{color:green}p.jsx-ee922fe7eac00c5e{color:${`red`}}}p.jsx-ee922fe7eac00c5e{color:red}`}</_JSXStyle>
<_JSXStyle id={"7c5c5bde49d6c65d"}>{`@media(min-width:${mediumScreen}){p.jsx-9f11e5fc71d05085{color:green}p.jsx-9f11e5fc71d05085{color:${`red`}}}p.jsx-9f11e5fc71d05085{color:red}`}</_JSXStyle>
<_JSXStyle id={"ff76c479bb5bf1a9"}>{`p.jsx-ee922fe7eac00c5e{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"c5506be0b4762e0b"}>{`p.jsx-9f11e5fc71d05085{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"f4ba3ad133457656"}>{`p.jsx-ee922fe7eac00c5e{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-ee922fe7eac00c5e{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"82f0f2f07692d2e2"}>{`p.jsx-9f11e5fc71d05085{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-9f11e5fc71d05085{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"374046f7d83960f0"} dynamic={[
<_JSXStyle id={"e4db21be651d572a"} dynamic={[
display ? 'block' : 'none'
]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`}</_JSXStyle>
......
import _JSXStyle from "next/dist/shared/lib/styled-jsx";
export default (({ breakPoint })=><div className={_JSXStyle.dynamic([
[
"1568e0a11702cf40",
"5d2a0e645566ce9c",
[
breakPoint
]
]
])}>
<_JSXStyle id={"1568e0a11702cf40"} dynamic={[
<_JSXStyle id={"5d2a0e645566ce9c"} dynamic={[
breakPoint
]}>{`@media(${breakPoint}){}`}</_JSXStyle>
......
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"ac0c5daa02b1aeac",
"23846d0356326bee",
[
Typography.base.size.default,
Typography.base.lineHeight,
......@@ -17,7 +17,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"ac0c5daa02b1aeac",
"23846d0356326bee",
[
Typography.base.size.default,
Typography.base.lineHeight,
......@@ -29,7 +29,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"ac0c5daa02b1aeac"} dynamic={[
<_JSXStyle id={"23846d0356326bee"} dynamic={[
Typography.base.size.default,
Typography.base.lineHeight,
Target.mediumPlus,
......
import _JSXStyle from "next/dist/shared/lib/styled-jsx";
import Link from "next/link";
export default function IndexPage() {
return <div className={"jsx-2339e3d61ab4470c"}>
return <div className={"jsx-9a4b3442d519aae9"}>
Hello World.{" "}
<Link href="/about">
<a className={"jsx-2339e3d61ab4470c"}>Abound</a>
<a className={"jsx-9a4b3442d519aae9"}>Abound</a>
</Link>
<_JSXStyle id={"2339e3d61ab4470c"}>{`a.jsx-2339e3d61ab4470c{color:${"#abcdef"}12}`}</_JSXStyle>
<_JSXStyle id={"9a4b3442d519aae9"}>{`a.jsx-9a4b3442d519aae9{color:${"#abcdef"}12}`}</_JSXStyle>
</div>;
};
// TODO: needs sourcemaps
// export default () => (
// <div>
// <p>test</p>
// <p>woot</p>
// <style jsx>{'p { color: red }'}</style>
// </div>
// )
// TODO
// import css from 'styled-jsx/css'
// const color = 'red'
// export const foo = css`div { color: ${color}}`
// const props = { color: 'red ' }
// export default css`
// div { font-size: 3em; color: ${props.color} }
// p { color: ${this.props.color};}
// `
// TODO
// import css from 'styled-jsx/css'
// const color = 'red'
// export const foo = css`div { color: ${color}}`
// export default css`
// div { font-size: 3em }
// p { color: ${props.color};}
// `
......@@ -6,26 +6,26 @@ bar.__hash = "aaed0341accea8f";
const baz = new String("div{font-size:3em}");
baz.__hash = "aaed0341accea8f";
const a = new String(`div{font-size:${size}em}`);
a.__hash = "3066b487d298d78f";
a.__hash = "b6966e11ccb637f2";
export const uh = bar;
export const foo = new String(`div.jsx-67354fc16554bdab{color:${color}}`);
foo.__hash = "67354fc16554bdab";
export const foo = new String(`div.jsx-dbfc29cedbb5f49b{color:${color}}`);
foo.__hash = "dbfc29cedbb5f49b";
({
styles: <_JSXStyle id={"ef44b0e76b4e59a2"}>{`div.jsx-ef44b0e76b4e59a2{color:${colors.green.light}}a.jsx-ef44b0e76b4e59a2{color:red}`}</_JSXStyle>,
className: "jsx-ef44b0e76b4e59a2"
styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
className: "jsx-38ae14c4ec5e0907"
});
const b = {
styles: <_JSXStyle id={"ef44b0e76b4e59a2"}>{`div.jsx-ef44b0e76b4e59a2{color:${colors.green.light}}a.jsx-ef44b0e76b4e59a2{color:red}`}</_JSXStyle>,
className: "jsx-ef44b0e76b4e59a2"
styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
className: "jsx-38ae14c4ec5e0907"
};
const dynamic = (colors)=>{
const b = {
styles: <_JSXStyle id={"d1249fb76dde6727"} dynamic={[
styles: <_JSXStyle id={"b68d3b38146e2a7d"} dynamic={[
colors.green.light
]}>{`div.__jsx-style-dynamic-selector{color:${colors.green.light}}a.__jsx-style-dynamic-selector{color:red}`}</_JSXStyle>,
className: _JSXStyle.dynamic([
[
"d1249fb76dde6727",
"b68d3b38146e2a7d",
[
colors.green.light
]
......@@ -34,6 +34,6 @@ const dynamic = (colors)=>{
};
};
export default {
styles: <_JSXStyle id={"d85f88350ca31aae"}>{`div.jsx-d85f88350ca31aae{font-size:3em}p.jsx-d85f88350ca31aae{color:${color}}`}</_JSXStyle>,
className: "jsx-d85f88350ca31aae"
styles: <_JSXStyle id={"a300397bb1f6c7cd"}>{`div.jsx-a300397bb1f6c7cd{font-size:3em}p.jsx-a300397bb1f6c7cd{color:${color}}`}</_JSXStyle>,
className: "jsx-a300397bb1f6c7cd"
};
// TODO: support common js
// import css from 'styled-jsx/css'
// module.exports = css`
// div { font-size: 3em }
// `
......@@ -2,7 +2,7 @@ import _JSXStyle from "next/dist/shared/lib/styled-jsx";
export const Red = ({ Component ='button' , })=>{
return <Component className={_JSXStyle.dynamic([
[
"6c7c8cee856673a7",
"1a9f9e2fa701f7ec",
[
e1,
e2,
......@@ -27,7 +27,7 @@ export const Red = ({ Component ='button' , })=>{
{}
<_JSXStyle id={"6c7c8cee856673a7"} dynamic={[
<_JSXStyle id={"1a9f9e2fa701f7ec"} dynamic={[
e1,
e2,
e3,
......
......@@ -2,14 +2,14 @@ import _JSXStyle from "next/dist/shared/lib/styled-jsx";
export default function Home({ fontFamily }) {
return <div className={_JSXStyle.dynamic([
[
"ae6b96ca586fe51a",
"3892513b52a23034",
[
fontFamily
]
]
])}>
<_JSXStyle id={"ae6b96ca586fe51a"} dynamic={[
<_JSXStyle id={"3892513b52a23034"} dynamic={[
fontFamily
]}>{`body{font-family:${fontFamily}}code:before,code:after{content:"\`"}`}</_JSXStyle>
......
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"e1b0d3df4c8dcbf0",
"fc144a5ba38f1ea7",
[
inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
]
......@@ -12,14 +12,14 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"e1b0d3df4c8dcbf0",
"fc144a5ba38f1ea7",
[
inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
]
]
])}>test</p>
<_JSXStyle id={"e1b0d3df4c8dcbf0"} dynamic={[
<_JSXStyle id={"fc144a5ba38f1ea7"} dynamic={[
inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
]}>{`@media only screen{a.__jsx-style-dynamic-selector{${inputSize ? 'height: calc(2 * var(--a)) !important;' : ''}
}}`}</_JSXStyle>
......
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"5fd7f2008eca3a62",
"3316de46318b70d2",
[
a[b],
-1 * (c || 0),
......@@ -14,7 +14,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"5fd7f2008eca3a62",
"3316de46318b70d2",
[
a[b],
-1 * (c || 0),
......@@ -23,7 +23,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"5fd7f2008eca3a62"} dynamic={[
<_JSXStyle id={"3316de46318b70d2"} dynamic={[
a[b],
-1 * (c || 0),
d
......
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"b249ec2f79615bbf",
"10afbaef094d6ad4",
[
a
]
......@@ -12,14 +12,14 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"b249ec2f79615bbf",
"10afbaef094d6ad4",
[
a
]
]
])}>test</p>
<_JSXStyle id={"b249ec2f79615bbf"} dynamic={[
<_JSXStyle id={"10afbaef094d6ad4"} dynamic={[
a
]}>{`@media only screen{a.__jsx-style-dynamic-selector{color:${a}}}`}</_JSXStyle>
......
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"6021be0687550489",
"30707b6ee2bc231f",
[
a || 'var(--c)',
b || 'inherit'
......@@ -13,7 +13,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"6021be0687550489",
"30707b6ee2bc231f",
[
a || 'var(--c)',
b || 'inherit'
......@@ -21,7 +21,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"6021be0687550489"} dynamic={[
<_JSXStyle id={"30707b6ee2bc231f"} dynamic={[
a || 'var(--c)',
b || 'inherit'
]}>{`.a:hover .b.__jsx-style-dynamic-selector{display:inline-block;padding:0 ${a || 'var(--c)'};color:${b || 'inherit'}}`}</_JSXStyle>
......
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"e2cf1d088389269b",
"3f66f111bff09281",
[
a ? '100%' : '200px',
b ? '0' : '8px 20px'
......@@ -13,7 +13,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"e2cf1d088389269b",
"3f66f111bff09281",
[
a ? '100%' : '200px',
b ? '0' : '8px 20px'
......@@ -21,7 +21,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"e2cf1d088389269b"} dynamic={[
<_JSXStyle id={"3f66f111bff09281"} dynamic={[
a ? '100%' : '200px',
b ? '0' : '8px 20px'
]}>{`.item.__jsx-style-dynamic-selector{max-width:${a ? '100%' : '200px'};padding:${b ? '0' : '8px 20px'}}`}</_JSXStyle>
......
......@@ -25,10 +25,10 @@ parking_lot_core = "=0.8.0"
path-clean = "0.1"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
swc = "0.205.0"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", default-features = false, optional = true }
swc = "0.212.1"
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.70.0", default-features = false, optional = true }
tracing = { version = "0.1.32", features = ["release_max_level_off"] }
wasm-bindgen = {version = "0.2", features = ["serde-serialize"]}
wasm-bindgen-futures = "0.4.8"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment