Skip to content

Commit

Permalink
Update turbopack and swc_core to v0.78.24 (#51943)
Browse files Browse the repository at this point in the history
Reverts #51940

### What?

Update SWC crates and turbopack

### Turbopack Updates

* vercel/turborepo#5366 <!-- Justin Ridgewell - Fix
bug with `imports` field from a nested directory -->
* vercel/turborepo#5361 <!-- Tobias Koppers - update
for next.js changes to env vars -->
* vercel/turborepo#5311 <!-- OJ Kwon -
test(filetrace): skip failing tests -->
* vercel/turborepo#5402 <!-- Leah - reduce indent in
`analyze_ecmascript_module` by splitting the function up -->
* vercel/turborepo#5412 <!-- Leah - Update
`swc_core` to `v0.78.24` -->

Closes WEB-1174

Turbopack counterpart: vercel/turborepo#5412

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 29, 2023
1 parent 3773c5b commit 484bdeb
Show file tree
Hide file tree
Showing 12 changed files with 468 additions and 338 deletions.
700 changes: 412 additions & 288 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ next-transform-strip-page-exports = { path = "packages/next-swc/crates/next-tran

# SWC crates
# Keep consistent with preset_env_base through swc_core
swc_core = { version = "0.76.46" }
testing = { version = "0.33.13" }
swc_core = { version = "0.78.24" }
testing = { version = "0.33.19" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230622.2" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230628.2" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230622.2" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230628.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230622.2" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230628.2" }

# General Deps

Expand Down
34 changes: 27 additions & 7 deletions packages/next-swc/crates/core/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,14 @@ impl VisitMut for ClosureReplacer<'_> {
}

#[derive(Debug, Clone, PartialEq, Eq)]
struct Name(Id, Vec<(JsWord, bool)>);
struct NamePart {
prop: JsWord,
is_member: bool,
optional: bool,
}

#[derive(Debug, Clone, PartialEq, Eq)]
struct Name(Id, Vec<NamePart>);

impl From<&'_ Ident> for Name {
fn from(value: &Ident) -> Self {
Expand Down Expand Up @@ -1539,7 +1546,11 @@ impl TryFrom<&'_ MemberExpr> for Name {
match &value.prop {
MemberProp::Ident(prop) => {
let mut obj: Name = value.obj.as_ref().try_into()?;
obj.1.push((prop.sym.clone(), true));
obj.1.push(NamePart {
prop: prop.sym.clone(),
is_member: true,
optional: false,
});
Ok(obj)
}
_ => Err(()),
Expand All @@ -1552,10 +1563,14 @@ impl TryFrom<&'_ OptChainExpr> for Name {

fn try_from(value: &OptChainExpr) -> Result<Self, Self::Error> {
match &*value.base {
OptChainBase::Member(value) => match &value.prop {
OptChainBase::Member(m) => match &m.prop {
MemberProp::Ident(prop) => {
let mut obj: Name = value.obj.as_ref().try_into()?;
obj.1.push((prop.sym.clone(), false));
let mut obj: Name = m.obj.as_ref().try_into()?;
obj.1.push(NamePart {
prop: prop.sym.clone(),
is_member: false,
optional: value.optional,
});
Ok(obj)
}
_ => Err(()),
Expand All @@ -1569,7 +1584,12 @@ impl From<Name> for Expr {
fn from(value: Name) -> Self {
let mut expr = Expr::Ident(value.0.into());

for (prop, is_member) in value.1.into_iter() {
for NamePart {
prop,
is_member,
optional,
} in value.1.into_iter()
{
if is_member {
expr = Expr::Member(MemberExpr {
span: DUMMY_SP,
Expand All @@ -1579,12 +1599,12 @@ impl From<Name> for Expr {
} else {
expr = Expr::OptChain(OptChainExpr {
span: DUMMY_SP,
question_dot_token: DUMMY_SP,
base: Box::new(OptChainBase::Member(MemberExpr {
span: DUMMY_SP,
obj: expr.into(),
prop: MemberProp::Ident(Ident::new(prop, DUMMY_SP)),
})),
optional,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
var _my_array;
var _my_array_;
var test = (_my_array_ = my_array === null || my_array === void 0 ? void 0 : my_array[0]) !== null && _my_array_ !== void 0 ? _my_array_ : [];
var test = (_my_array_ = (_my_array = my_array) === null || _my_array === void 0 ? void 0 : _my_array[0]) !== null && _my_array_ !== void 0 ? _my_array_ : [];
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230622.2",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230622.2",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230628.2",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230628.2",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
12 changes: 5 additions & 7 deletions packages/next-swc/crates/next-core/src/app_segment_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,11 @@ fn parse_config_value(
JsValue::Constant(ConstantValue::Str(str)) if str.as_str() == "force-cache" => {
config.revalidate = Some(NextRevalidate::ForceCache);
}
_ => {
return invalid_config(
"`revalidate` needs to be static false, static 'force-cache' or a static \
positive integer",
&value,
)
}
_ => invalid_config(
"`revalidate` needs to be static false, static 'force-cache' or a static \
positive integer",
&value,
),
}
}
"fetchCache" => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PlainIssue {
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:67)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
description: "Error: Warning!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
detail: "",
documentation_link: "",
source: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PlainIssue {
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:67)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
description: "Error: Error!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
detail: "",
documentation_link: "",
source: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PlainIssue {
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:67)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
description: "Error: Error!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
detail: "",
documentation_link: "",
source: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PlainIssue {
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:67)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
description: "Error: Warning!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:161:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:112:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:104:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
detail: "",
documentation_link: "",
source: None,
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 @@ -25,7 +25,7 @@ serde_json = "1"
tracing = { version = "0.1.37" }
wasm-bindgen = { version = "0.2", features = ["enable-interning"] }
wasm-bindgen-futures = "0.4.8"
getrandom = { version = "0.2.5", optional = true, default-features = false }
getrandom = { version = "0.2.9", default-features = false, features = ["js"] }
js-sys = "0.3.59"
serde-wasm-bindgen = "0.4.3"
turbopack-binding = { workspace = true, features = [
Expand Down
33 changes: 10 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 484bdeb

Please sign in to comment.