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 turbopack & swc_core #65450

Merged
merged 16 commits into from
May 17, 2024
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
493 changes: 258 additions & 235 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ next-core = { path = "packages/next-swc/crates/next-core" }
next-custom-transforms = { path = "packages/next-swc/crates/next-custom-transforms" }

# SWC crates
swc_core = { version = "0.90.33", features = [
swc_core = { version = "0.92.5", features = [
"ecma_loader_lru",
"ecma_loader_parking_lot",
] }
testing = { version = "0.35.22" }
testing = { version = "0.35.24" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240516.1" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240517.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-240516.1" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240517.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240516.1" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240517.2" }

# General Deps

Expand Down Expand Up @@ -90,7 +90,7 @@ indoc = "2.0.0"
itertools = "0.10.5"
lazy_static = "1.4.0"
log = "0.4.17"
lightningcss = { version = "=1.0.0-alpha.54", features = [
lightningcss = { version = "1.0.0-alpha.54", features = [
"serde",
"visitor",
"into_owned",
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-custom-transforms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ turbopack-binding = { workspace = true, features = [
] }
# To allow quote! macro works
swc_core = { workspace = true, features = ["ecma_quote"] }
react_remove_properties = "0.24.7"
remove_console = "0.25.7"
react_remove_properties = "0.24.12"
remove_console = "0.25.12"
preset_env_base = "0.4.12"

[dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "@swc/helpers/_/_class_call_check";
import { _ as e } from "@swc/helpers/_/_sliced_to_array";
import r from "other";
import r from 'other';
e(r, 1)[0];
export var __N_SSG = !0;
export default function t() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default 1;
Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, '__esModule', {
value: true
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default 1;
console.log("__esModule");
Object.defineProperty({}, "__esModule", {
console.log('__esModule');
Object.defineProperty({}, '__esModule', {
value: true
});
Object.defineProperty();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function(module) {
module.exports = {};
};
export var value = "mixed-syntax-esm";
export var value = 'mixed-syntax-esm';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function foo(module) {
module.exports = "this is just normal assignment of scope variable";
module.exports = 'this is just normal assignment of scope variable';
}
export var value = "mixed-syntax-esm";
export var value = 'mixed-syntax-esm';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
import other from "other";
import other from 'other';
var _other = _sliced_to_array(other, 1), foo = _other[0];
var Foo = function Foo() {
"use strict";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { useEffect } from "react";
import { select, selectAll } from "d3-selection";
import { useEffect } from 'react';
import { select, selectAll } from 'd3-selection';
export default function Home() {
useEffect(function() {
new MyClass();
Expand All @@ -14,7 +14,7 @@ export default function Home() {
var MyClass = function MyClass() {
"use strict";
_class_call_check(this, MyClass);
selectAll(".group").each(function() {
select(this).selectAll("path");
selectAll('.group').each(function() {
select(this).selectAll('path');
});
};
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/*#__PURE__*/ React.createElement("div", null, "children");
"<>hello</>";
'<>hello</>';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from "styled-components";
import styled from 'styled-components';
export var foo = styled.input.withConfig({
displayName: "input__foo",
componentId: "sc-21a13c03-0"
Expand Down
4 changes: 3 additions & 1 deletion packages/next-swc/crates/wasm/src/mdx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ pub fn mdx_compile_sync(value: JsString, opts: JsValue) -> Result<JsValue, JsVal

compile(value.as_str(), &option)
.map(|v| serde_wasm_bindgen::to_value(&v).expect("Should able to convert to JsValue"))
.map_err(|v| serde_wasm_bindgen::to_value(&v).expect("Should able to convert to JsValue"))
.map_err(|v| {
serde_wasm_bindgen::to_value(&v.to_string()).expect("Should able to convert to JsValue")
})
}

#[wasm_bindgen(js_name = "mdxCompile")]
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"@types/ws": "8.2.0",
"@vercel/ncc": "0.34.0",
"@vercel/nft": "0.27.1",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240516.1",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240517.2",
"acorn": "8.11.3",
"amphtml-validator": "1.0.35",
"anser": "1.4.9",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions test/unit/next-swc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('next/swc', () => {
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
import { useState } from "react";
import { useState } from 'react';
var _useState = _sliced_to_array(useState(0), 2), count = _useState[0], setCount = _useState[1];
"
`)
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('next/swc', () => {
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
import { useState } from "react";
import { useState } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this single quote stuff coming from?
Everything else in the output has double quotes (as one would expect)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The windows tests are failing because of this as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new swc version used the original style as written in source code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the single quote in the input.

import { useState } from 'react';

var _useState = _to_array(useState(0)), copy = _useState.slice(0);
"
`)
Expand Down
Loading