Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update swc_core to v0.56.0 #44792

Merged
merged 19 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,042 changes: 638 additions & 404 deletions packages/next-swc/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ serde = "1"
serde_json = "1"
tracing = { version = "0.1.37", features = ["release_max_level_info"] }

next-binding = { git = "https://github.com/vercel/turbo.git", rev = "079505baf1ce03707d28b6c0afb158dca601a11a", features = [
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "37b5840ba713c8c68db357daae9cde312f73d076", features = [
"__swc_core",
"__swc_core_next_core",
"__swc_transform_styled_jsx",
Expand All @@ -29,7 +29,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", rev = "079505baf1c
] }

[dev-dependencies]
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "079505baf1ce03707d28b6c0afb158dca601a11a", features = [
kdy1 marked this conversation as resolved.
Show resolved Hide resolved
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "37b5840ba713c8c68db357daae9cde312f73d076", features = [
"__swc_core_testing_transform",
"__swc_testing",
] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default function Home() {
return <div data-test-id="1">

<div >
<div>

<h1 data-testid="3">Hello World!</h1>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default function Home() {

<div data-custom="2">

<h1 nested={()=><div >nested</div>}>Hello World!</h1>
<h1 nested={()=><div>nested</div>}>Hello World!</h1>

</div>

Expand Down
48 changes: 24 additions & 24 deletions packages/next-swc/crates/core/tests/full/example/output.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
function t(t, r) {
(null == r || r > t.length) && (r = t.length);
for(var n = 0, e = new Array(r); n < r; n++)e[n] = t[n];
function r(r, t) {
(null == t || t > r.length) && (t = r.length);
for(var n = 0, e = Array(t); n < t; n++)e[n] = r[n];
return e;
}
import r from "other";
(function(r, n) {
return function(t) {
if (Array.isArray(t)) return t;
}(r) || function(t, r) {
var n, e, o = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
import t from "other";
(function(t, n) {
return function(r) {
if (Array.isArray(r)) return r;
}(t) || function(r, t) {
var n, e, o = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != o) {
var u = [], l = !0, i = !1;
var a = [], l = !0, u = !1;
try {
for(o = o.call(t); !(l = (n = o.next()).done) && (u.push(n.value), !r || u.length !== r); l = !0);
} catch (a) {
i = !0, e = a;
for(o = o.call(r); !(l = (n = o.next()).done) && (a.push(n.value), !t || a.length !== t); l = !0);
} catch (r) {
u = !0, e = r;
} finally{
try {
l || null == o.return || o.return();
} finally{
if (i) throw e;
if (u) throw e;
}
}
return u;
return a;
}
}(r, n) || function(r, n) {
if (r) {
if ("string" == typeof r) return t(r, n);
var e = Object.prototype.toString.call(r).slice(8, -1);
if ("Object" === e && r.constructor && (e = r.constructor.name), "Map" === e || "Set" === e) return Array.from(e);
if ("Arguments" === e || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)) return t(r, n);
}(t, n) || function(t, n) {
if (t) {
if ("string" == typeof t) return r(t, n);
var e = Object.prototype.toString.call(t).slice(8, -1);
if ("Object" === e && t.constructor && (e = t.constructor.name), "Map" === e || "Set" === e) return Array.from(e);
if ("Arguments" === e || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)) return r(t, n);
}
}(r, n) || function() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}(t, n) || function() {
throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}();
})(r, 1)[0];
})(t, 1)[0];
export var __N_SSG = !0;
export default function n() {
return React.createElement("div", null);
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tracing = { version = "0.1.37", features = ["release_max_level_info"] }
tracing-futures = "0.2.5"
tracing-subscriber = "0.3.9"
tracing-chrome = "0.5.0"
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "079505baf1ce03707d28b6c0afb158dca601a11a", features = [
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "37b5840ba713c8c68db357daae9cde312f73d076", features = [
"__swc_core_binding_napi",
"__turbo_next_dev_server",
"__turbo_node_file_trace",
Expand Down
9 changes: 7 additions & 2 deletions packages/next-swc/crates/napi/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ pub struct TransformTask {
pub options: Buffer,
}

#[inline]
fn skip_filename() -> bool {
cfg!(debug_assertions)
}

impl Task for TransformTask {
type Output = (TransformOutput, FxHashSet<String>);
type JsValue = Object;
Expand All @@ -72,8 +77,8 @@ impl Task for TransformTask {
try_with_handler(
self.c.cm.clone(),
next_binding::swc::core::base::HandlerOpts {
color: ColorConfig::Never,
skip_filename: true,
color: ColorConfig::Always,
skip_filename: skip_filename(),
},
|handler| {
self.c.run(|| {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8"
getrandom = { version = "0.2.5", optional = true, default-features = false }
js-sys = "0.3.59"
serde-wasm-bindgen = "0.4.3"
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "079505baf1ce03707d28b6c0afb158dca601a11a", features = [
next-binding = { git = "https://github.com/vercel/turbo.git", rev = "37b5840ba713c8c68db357daae9cde312f73d076", features = [
"__swc_core_binding_wasm",
"__feature_mdx_rs",
] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ Error:
\`----

Caused by:
0: failed to process input file
1: Syntax Error
Syntax Error

Import trace for requested module:
./index.js
Expand Down Expand Up @@ -188,9 +187,8 @@ Error:
\`----

Caused by:
0: failed to process input file
1: error was recoverable, but proceeding would result in wrong codegen
2: Syntax Error
0: error was recoverable, but proceeding would result in wrong codegen
1: Syntax Error

Import trace for requested module:
./index.js
Expand All @@ -210,9 +208,8 @@ Error:
\`----

Caused by:
0: failed to process input file
1: error was recoverable, but proceeding would result in wrong codegen
2: Syntax Error
0: error was recoverable, but proceeding would result in wrong codegen
1: Syntax Error

Import trace for requested module:
./index.js
Expand Down Expand Up @@ -241,8 +238,7 @@ Error:
\`----

Caused by:
0: failed to process input file
1: Syntax Error
Syntax Error

Import trace for requested module:
./index.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ Error:
\`----
Caused by:
0: failed to process input file
1: Syntax Error"
Syntax Error"
`;

exports[`ReactRefreshLogBox default _document syntax error shows logbox 1`] = `
Expand All @@ -46,6 +45,5 @@ Error:
\`----
Caused by:
0: failed to process input file
1: Syntax Error"
Syntax Error"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ Error:
\`----

Caused by:
0: failed to process input file
1: Syntax Error
Syntax Error

Import trace for requested module:
./index.js"
Expand Down Expand Up @@ -154,9 +153,8 @@ Error:
\`----

Caused by:
0: failed to process input file
1: error was recoverable, but proceeding would result in wrong codegen
2: Syntax Error
0: error was recoverable, but proceeding would result in wrong codegen
1: Syntax Error

Import trace for requested module:
./index.js"
Expand All @@ -175,9 +173,8 @@ Error:
\`----

Caused by:
0: failed to process input file
1: error was recoverable, but proceeding would result in wrong codegen
2: Syntax Error
0: error was recoverable, but proceeding would result in wrong codegen
1: Syntax Error

Import trace for requested module:
./index.js"
Expand Down Expand Up @@ -205,8 +202,7 @@ Error:
\`----

Caused by:
0: failed to process input file
1: Syntax Error
Syntax Error

Import trace for requested module:
./index.js"
Expand Down
3 changes: 1 addition & 2 deletions test/development/basic/hmr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,7 @@ describe.each([[''], ['/docs']])(
\`----
Caused by:
0: failed to process input file
1: Syntax Error
Syntax Error
Import trace for requested module:
./components/parse-error.js"
Expand Down