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.96.9 #67378

Merged
merged 46 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d7b416c
Update swc_core
kdy1 Jul 2, 2024
8555530
cargo lockfile
kdy1 Jul 2, 2024
6d627ef
Update chrono
kdy1 Jul 2, 2024
a90a0e2
preset_env_base
kdy1 Jul 2, 2024
9b3b973
Fix for swc_relay
kdy1 Jul 2, 2024
d8d0d08
Update test refs
kdy1 Jul 3, 2024
323129c
lint
kdy1 Jul 3, 2024
11617bd
link next.js
kdy1 Jul 5, 2024
967a3c0
Update swc_core
kdy1 Jul 5, 2024
cc0c269
cargo lockfile
kdy1 Jul 5, 2024
b0b5e0b
Update swc_core
kdy1 Jul 5, 2024
bef841e
cargo lockfile
kdy1 Jul 5, 2024
30b8449
link next.js
kdy1 Jul 5, 2024
9e9302e
link next.js
kdy1 Jul 5, 2024
155cc8e
link next.js
kdy1 Jul 6, 2024
85f19fb
Update test res
kdy1 Jul 6, 2024
c24a0df
Update preset_env_base
kdy1 Jul 6, 2024
0251210
Update jest snapshot
kdy1 Jul 7, 2024
2b663db
Update jest snapshot
kdy1 Jul 7, 2024
02a5509
Update jest snapshot
kdy1 Jul 7, 2024
f2539e3
Update test
kdy1 Jul 7, 2024
a861b17
Update test
kdy1 Jul 7, 2024
5537446
Dep
kdy1 Jul 7, 2024
d278b1a
cargo lockfile
kdy1 Jul 7, 2024
45a0794
Fix `skip_filename`
kdy1 Jul 7, 2024
e9acc4b
Update jest snapshot
kdy1 Jul 7, 2024
f53e944
Update swc_core
kdy1 Jul 10, 2024
71909f0
cargo lockfile
kdy1 Jul 10, 2024
e576b7c
link next.js
kdy1 Jul 10, 2024
c1cd9b8
Merge branch 'canary' into kdy1/swc-core-96-1
kdy1 Jul 11, 2024
c9c2016
Update jest snapsho
kdy1 Jul 11, 2024
5dc55ba
link next.js
kdy1 Jul 11, 2024
586aa68
Fix
kdy1 Jul 11, 2024
b273114
link next.js
kdy1 Jul 11, 2024
b103fe0
fix
kdy1 Jul 11, 2024
775bc26
revert
kdy1 Jul 11, 2024
6563e06
Update jest snapshot
kdy1 Jul 12, 2024
0c15575
fix
kdy1 Jul 12, 2024
60c8f7e
Fix skip_filename
kdy1 Jul 12, 2024
24f7a09
Fix skip_filename
kdy1 Jul 12, 2024
a19f282
Update jest snapshot
kdy1 Jul 12, 2024
daaf8b6
Update jest snapshot
kdy1 Jul 12, 2024
632042f
Revert "Update jest snapshot"
kdy1 Jul 12, 2024
3b5014b
fix
kdy1 Jul 12, 2024
3661d89
flaky
kdy1 Jul 12, 2024
6d2ddd0
link next.js
kdy1 Jul 12, 2024
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
425 changes: 178 additions & 247 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,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.95.4", features = [
swc_core = { version = "0.96.9", features = [
"ecma_loader_lru",
"ecma_loader_parking_lot",
] }
testing = { version = "0.36.0" }

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

# General Deps

Expand Down
1 change: 1 addition & 0 deletions packages/next-swc/crates/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ tracing-subscriber = { workspace = true }
tracing-chrome = "0.5.0"
url = { workspace = true }
urlencoding = { workspace = true }
once_cell ={workspace= true}

# Dependencies for the native, non-wasm32 build.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
18 changes: 16 additions & 2 deletions packages/next-swc/crates/napi/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use anyhow::{anyhow, bail, Context as _};
use fxhash::FxHashSet;
use napi::bindgen_prelude::*;
use next_custom_transforms::chain_transforms::{custom_before_pass, TransformOptions};
use once_cell::sync::Lazy;
use turbopack_binding::swc::core::{
base::{try_with_handler, Compiler, TransformOutput},
common::{comments::SingleThreadedComments, errors::ColorConfig, FileName, Mark, GLOBALS},
Expand All @@ -61,9 +62,22 @@ pub struct TransformTask {
pub options: Buffer,
}

#[inline]
fn skip_filename() -> bool {
cfg!(debug_assertions)
fn check(name: &str) -> bool {
let v = std::env::var(name);
let v = match v {
Ok(v) => v,
Err(_) => return false,
};

!v.is_empty() && v != "0"
}

static SKIP_FILENAME: Lazy<bool> = Lazy::new(|| {
check("NEXT_TEST_MODE") || check("__NEXT_TEST_MODE") || check("NEXT_TEST_JOB")
});

*SKIP_FILENAME
}

impl Task for TransformTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ impl ModularizeImportsTransformer {
},
prevent_full_import: v.prevent_full_import,
skip_default_conversion: v.skip_default_conversion,
handle_default_import: false,
handle_namespace_import: false,
},
)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/next-swc/crates/next-custom-transforms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ turbopack-binding = { workspace = true, features = [
] }
# To allow quote! macro works
swc_core = { workspace = true, features = ["ecma_quote"] }
react_remove_properties = "0.24.14"
remove_console = "0.25.14"
preset_env_base = "0.4.12"
react_remove_properties = "0.24.15"
remove_console = "0.25.15"
preset_env_base = "0.5.1"

[dev-dependencies]
turbopack-binding = { workspace = true, features = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ where
let relay_plugin = {
if let Some(config) = &opts.relay {
Either::Left(turbopack_binding::swc::custom_transform::relay::relay(
config,
Arc::new(config.clone()),
file.name.clone(),
std::env::current_dir().unwrap(),
opts.pages_dir.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ mod tests {
common::{errors::ColorConfig, FilePathMapping, SourceMap, GLOBALS},
ecma::{
ast::Program,
parser::{EsConfig, Syntax, TsConfig},
parser::{EsSyntax, Syntax, TsSyntax},
},
};

Expand All @@ -247,13 +247,13 @@ mod tests {
let options = ParseOptions {
is_module: IsModule::Unknown,
syntax: if file_path.ends_with(".ts") || file_path.ends_with(".tsx") {
Syntax::Typescript(TsConfig {
Syntax::Typescript(TsSyntax {
tsx: true,
decorators: true,
..Default::default()
})
} else {
Syntax::Es(EsConfig {
Syntax::Es(EsSyntax {
jsx: true,
decorators: true,
..Default::default()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use turbopack_binding::swc::{
core::{
common::{chain, FileName, Mark},
ecma::{
parser::{EsConfig, Syntax},
parser::{EsSyntax, Syntax},
transforms::{
base::resolver,
testing::{test_fixture, FixtureTestConfig},
Expand All @@ -26,7 +26,7 @@ use turbopack_binding::swc::{
};

fn syntax() -> Syntax {
Syntax::Es(EsConfig {
Syntax::Es(EsSyntax {
jsx: true,
..Default::default()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x next/dynamic requires at least one argument
,-[input.js:2:1]
,-[input.js:3:1]
2 |
3 | const DynamicComponent = dynamic()
: ^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

x next/dynamic options must be an object literal.
| Read more: https://nextjs.org/docs/messages/invalid-dynamic-options-type
,-[input.js:3:1]
,-[input.js:4:1]
3 | const options = { loading: () => <p>...</p>, ssr: false }
4 | const DynamicComponentWithCustomLoading = dynamic(
: ^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x next/dynamic only accepts 2 arguments
,-[input.js:2:1]
,-[input.js:3:1]
2 |
3 | const DynamicComponentWithCustomLoading = dynamic(
: ^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

x Font loader calls must be assigned to a const
,-[input.js:3:1]
,-[input.js:4:1]
3 |
4 | export let firaCode = Abel()
: ^^^^^^^^^^^^^^^^^^^^^
5 | export var inter = Inter()
`----

x Font loader calls must be assigned to a const
,-[input.js:4:1]
,-[input.js:5:1]
4 | export let firaCode = Abel()
5 | export var inter = Inter()
: ^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x Font loaders can't have namespace imports
,-[input.js:1:1]
1 | import * as googleFonts from '@next/font/google'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

x Font loader calls must be assigned to a const
,-[input.js:3:1]
,-[input.js:4:1]
3 | var i = 10
4 | ,-> var inter1 = Inter({
5 | | variant: '400',
6 | `-> })
`----

x Font loader calls must be assigned to a const
,-[input.js:8:1]
,-[input.js:9:1]
8 | var i2 = 20
9 | ,-> let inter2 = Inter({
10 | | variant: '400',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

x Font loader calls must be assigned to an identifier
,-[input.js:2:1]
,-[input.js:3:1]
2 |
3 | const { a } = Inter({
: ^^^^^
4 | variant: '400',
`----

x Font loader calls must be assigned to an identifier
,-[input.js:6:1]
,-[input.js:7:1]
6 |
7 | const [b] = Inter({
: ^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@

x Unexpected object key type
,-[input.js:3:1]
,-[input.js:4:1]
3 | const a = fn({ 10: 'hello' })
4 | const a = ABeeZee({ 10: 'hello' })
: ^^
`----

x Font loader values must be explicitly written literals.
,-[input.js:6:1]
,-[input.js:7:1]
6 | const a = fn({ variant: [i1] })
7 | const a = ABeeZee({ variant: [i1] })
: ^^
`----

x Font loader values must be explicitly written literals.
,-[input.js:9:1]
,-[input.js:10:1]
9 | const a = fn({ variant: () => {} })
10 | const a = ABeeZee({ variant: () => {} })
: ^^^^^^^^
`----

x Unexpected spread
,-[input.js:12:1]
,-[input.js:13:1]
12 | const a = fn({ ...{} })
13 | const a = ABeeZee({ ...{} })
: ^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@

x Font loaders don't accept spreads
,-[input.js:3:1]
,-[input.js:4:1]
3 | const a = fn(...{}, ...[])
4 | const inter = Inter(...{}, ...[])
: ^^^
`----

x Font loaders don't accept spreads
,-[input.js:3:1]
,-[input.js:4:1]
3 | const a = fn(...{}, ...[])
4 | const inter = Inter(...{}, ...[])
: ^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@

x Font loaders must be called and assigned to a const in the module scope
,-[input.js:2:1]
,-[input.js:3:1]
2 |
3 | Aladin({})
: ^^^^^^
`----

x Font loaders must be called and assigned to a const in the module scope
,-[input.js:5:1]
,-[input.js:6:1]
5 | let b
6 | const a = (b = Aladin({ variant: '400' }))
: ^^^^^^
`----

x Font loaders must be called and assigned to a const in the module scope
,-[input.js:8:1]
,-[input.js:9:1]
8 | function Hello() {
9 | const a = Aladin({
: ^^^^^^
10 | variant: '400',
`----

x Font loaders must be called and assigned to a const in the module scope
,-[input.js:15:1]
,-[input.js:16:1]
15 | constructor() {
16 | Aladin({
: ^^^^^^
17 | variant: '400',
`----

x Font loaders must be called and assigned to a const in the module scope
,-[input.js:22:1]
,-[input.js:23:1]
22 | {
23 | Aladin({})
: ^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps
,-[input.js:1:1]
,-[input.js:2:1]
1 | export async function getStaticPaths() {}
2 | export const getServerSideProps = function getServerSideProps() {}
: ^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps
,-[input.js:1:1]
,-[input.js:2:1]
1 | const getStaticProps = async () => {}
2 | export { a as getServerSideProps }
: ^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps
,-[input.js:1:1]
,-[input.js:2:1]
1 | export { a as getServerSideProps } from './input'
2 | export { getStaticPaths } from 'a'
: ^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps
,-[input.js:1:1]
1 | export { getStaticProps, getServerSideProps }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x Using `export * from '...'` in a page is disallowed. Please use `export { default } from '...'` instead.
| Read more: https://nextjs.org/docs/messages/export-all-in-page
,-[input.js:1:1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x "getServerSideProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
|
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
|
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

x You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/getting-started/
| react-essentials#server-components
|
|
,-[input.js:8:1]
,-[input.js:9:1]
8 |
9 | import 'server-only'
: ^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.
,-[input.js:3:1]
,-[input.js:4:1]
3 | // prettier-ignore
4 | 'use client'
: ^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

x You're importing a component that imports client-only. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.\nLearn
| more: https://nextjs.org/docs/getting-started/react-essentials\n\n
,-[input.js:8:1]
,-[input.js:9:1]
8 |
9 | import 'client-only'
: ^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

x The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.
,-[input.js:5:1]
,-[input.js:6:1]
5 | // prettier-ignore
6 | 'use client'
: ^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x "getServerSideProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
|
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
|
|
Expand Down
Loading
Loading