Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b4d6e535
Unverified
Commit
b4d6e535
authored
Sep 28, 2021
by
Donny/강동윤
Committed by
GitHub
Sep 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update swc (#29460)
parent
7bbaff74
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
342 additions
and
158 deletions
+342
-158
Cargo.lock
packages/next/build/swc/Cargo.lock
+274
-141
Cargo.toml
packages/next/build/swc/Cargo.toml
+11
-10
next_ssg.rs
packages/next/build/swc/src/next_ssg.rs
+7
-7
transform_css.rs
packages/next/build/swc/src/styled_jsx/transform_css.rs
+5
-0
input.js
...d/swc/tests/fixture/styled-jsx/tpl-placeholder-1/input.js
+17
-0
output.js
.../swc/tests/fixture/styled-jsx/tpl-placeholder-1/output.js
+28
-0
No files found.
packages/next/build/swc/Cargo.lock
View file @
b4d6e535
This diff is collapsed.
Click to expand it.
packages/next/build/swc/Cargo.toml
View file @
b4d6e535
...
...
@@ -16,27 +16,28 @@ path-clean = "0.1"
regex
=
"1.5"
serde
=
"1"
serde_json
=
"1"
swc
=
"0.5
1
"
swc
=
"0.5
8.0
"
swc_atoms
=
"0.2"
swc_common
=
{
version
=
"0.1
2"
,
features
=
[
"tty-emitter
"
,
"sourcemap"
]
}
swc_css
=
"0.
6
"
swc_css_codegen
=
"0.
4
"
swc_ecmascript
=
{
version
=
"0.6
3
"
,
features
=
[
"codegen"
,
"minifier"
,
"optimization"
,
"parser"
,
"react"
,
"transforms"
,
"typescript"
,
"utils"
,
"visit"
]
}
swc_ecma_preset_env
=
"0.4
2
"
swc_common
=
{
version
=
"0.1
3.0"
,
features
=
[
"concurrent
"
,
"sourcemap"
]
}
swc_css
=
"0.
8.0
"
swc_css_codegen
=
"0.
6.0
"
swc_ecmascript
=
{
version
=
"0.6
6.0
"
,
features
=
[
"codegen"
,
"minifier"
,
"optimization"
,
"parser"
,
"react"
,
"transforms"
,
"typescript"
,
"utils"
,
"visit"
]
}
swc_ecma_preset_env
=
"0.4
5.0
"
swc_node_base
=
"0.3"
swc_stylis
=
"0.
3
"
swc_stylis
=
"0.
5.0
"
fxhash
=
"0.2.1"
retain_mut
=
"0.1.3"
log
=
{version=
"0.4.14"
,
features
=
["release_max_level_off"]
}
pathdiff
=
"0.2.0"
rustc-hash
=
"1.1.0"
tracing
=
{
version
=
"0.1.28"
,
features
=
["release_max_level_off"]
}
[build-dependencies]
napi-build
=
"1"
[dev-dependencies]
swc_ecma_transforms_testing
=
"0.3
2
"
testing
=
"0.1
3
"
swc_ecma_transforms_testing
=
"0.3
4.0
"
testing
=
"0.1
4.0
"
[profile.release]
lto
=
true
packages/next/build/swc/src/next_ssg.rs
View file @
b4d6e535
...
...
@@ -90,7 +90,7 @@ struct Analyzer<'a> {
impl
Analyzer
<
'_
>
{
fn
add_ref
(
&
mut
self
,
id
:
Id
)
{
lo
g
::
trace!
(
"add_ref({}{:?}, data = {})"
,
id
.
0
,
id
.
1
,
self
.in_data_fn
);
tracin
g
::
trace!
(
"add_ref({}{:?}, data = {})"
,
id
.
0
,
id
.
1
,
self
.in_data_fn
);
if
self
.in_data_fn
{
self
.state.refs_from_data_fn
.insert
(
id
);
}
else
{
...
...
@@ -140,7 +140,7 @@ impl Fold for Analyzer<'_> {
self
.state.cur_declaring
.insert
(
f
.ident
.to_id
());
self
.in_data_fn
|
=
self
.state
.is_data_identifier
(
&
f
.ident
);
lo
g
::
trace!
(
tracin
g
::
trace!
(
"ssg: Handling `{}{:?}`; in_data_fn = {:?}"
,
f
.ident.sym
,
f
.ident.span.ctxt
,
...
...
@@ -282,7 +282,7 @@ impl NextSsg {
where
N
:
for
<
'aa
>
FoldWith
<
Analyzer
<
'aa
>>
,
{
lo
g
::
debug!
(
"mark_as_candidate"
);
tracin
g
::
debug!
(
"mark_as_candidate"
);
// Analyzer never change `in_data_fn` to false, so all identifiers in `n` will
// be marked as referenced from a data function.
...
...
@@ -329,7 +329,7 @@ impl Fold for NextSsg {
|
ImportSpecifier
::
Default
(
ImportDefaultSpecifier
{
local
,
..
})
|
ImportSpecifier
::
Namespace
(
ImportStarAsSpecifier
{
local
,
..
})
=>
{
if
self
.should_remove
(
local
.to_id
())
{
lo
g
::
trace!
(
tracin
g
::
trace!
(
"Dropping import `{}{:?}` because it should be removed"
,
local
.sym
,
local
.span.ctxt
...
...
@@ -347,7 +347,7 @@ impl Fold for NextSsg {
}
fn
fold_module
(
&
mut
self
,
mut
m
:
Module
)
->
Module
{
lo
g
::
info!
(
"ssg: Start"
);
tracin
g
::
info!
(
"ssg: Start"
);
{
// Fill the state.
let
mut
v
=
Analyzer
{
...
...
@@ -481,7 +481,7 @@ impl Fold for NextSsg {
};
if
!
preserve
{
lo
g
::
trace!
(
"Dropping a export specifier because it's a data identifier"
);
tracin
g
::
trace!
(
"Dropping a export specifier because it's a data identifier"
);
match
s
{
ExportSpecifier
::
Named
(
ExportNamedSpecifier
{
orig
,
..
})
=>
{
...
...
@@ -507,7 +507,7 @@ impl Fold for NextSsg {
Pat
::
Ident
(
name
)
=>
{
if
self
.should_remove
(
name
.id
.to_id
())
{
self
.state.should_run_again
=
true
;
lo
g
::
trace!
(
tracin
g
::
trace!
(
"Dropping var `{}{:?}` because it should be removed"
,
name
.id.sym
,
name
.id.span.ctxt
...
...
packages/next/build/swc/src/styled_jsx/transform_css.rs
View file @
b4d6e535
...
...
@@ -26,6 +26,9 @@ pub fn transform_css(
ParserConfig
{
parse_values
:
false
,
},
// We ignore errors because we inject placeholders for expressions which is
// not a valid css.
&
mut
vec!
[],
);
let
mut
ss
=
match
result
{
Ok
(
ss
)
=>
ss
,
...
...
@@ -148,6 +151,8 @@ impl Namespacer {
ParserConfig
{
parse_values
:
false
,
},
// TODO(kdy1): We might be able to report syntax errors.
&
mut
vec!
[],
)
.unwrap
();
return
x
;
...
...
packages/next/build/swc/tests/fixture/styled-jsx/tpl-placeholder-1/input.js
0 → 100644
View file @
b4d6e535
export
default
class
{
render
()
{
return
(
<
div
>
<
p
>
test
<
/p
>
<
style
jsx
>
{
`
@media only screen {
a {
${
inputSize
?
'height: calc(2 * var(--a)) !important;'
:
''
}
}
}
`
}
<
/style
>
<
/div
>
)
}
}
\ No newline at end of file
packages/next/build/swc/tests/fixture/styled-jsx/tpl-placeholder-1/output.js
0 → 100644
View file @
b4d6e535
import
_JSXStyle
from
"styled-jsx/style"
;
export
default
class
{
render
()
{
return
<
div
className
=
{
_JSXStyle
.
dynamic
([
[
"8b268cf2c0a3f89b"
,
[
inputSize
?
"height: calc(2 * var(--a)) !important;"
:
""
]
]
])}
>
<
p
className
=
{
_JSXStyle
.
dynamic
([
[
"8b268cf2c0a3f89b"
,
[
inputSize
?
"height: calc(2 * var(--a)) !important;"
:
""
]
]
])}
>
test
<
/p
>
<
_JSXStyle
id
=
{
"8b268cf2c0a3f89b"
}
dynamic
=
{[
inputSize
?
"height: calc(2 * var(--a)) !important;"
:
""
]}
>
{
`@media only screen {a.__jsx-style-dynamic-selector {
${
inputSize
?
"height: calc(2 * var(--a)) !important;"
:
""
}
}}`
}
<
/_JSXStyle
>
<
/div>
;
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment