Skip to content

Commit

Permalink
Update swc_core to v0.82.11 (#54653)
Browse files Browse the repository at this point in the history
### What?

Update swc crates to
swc-project/swc@44de87f

### Why?

To use `import with` and etc...

### How?

Closes WEB-1460
Fixes #

---

Turbopack counterpart: vercel/turbo#5820

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
  • Loading branch information
kdy1 and sokra committed Sep 1, 2023
1 parent e2584c6 commit a5c1803
Show file tree
Hide file tree
Showing 18 changed files with 402 additions and 213 deletions.
526 changes: 358 additions & 168 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 @@ -42,15 +42,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.79.70" }
testing = { version = "0.33.24" }
swc_core = { version = "0.82.11" }
testing = { version = "0.34.1" }

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

# General Deps

Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/optimize_barrel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl Fold for OptimizeBarrel {
.into(),
raw: None,
}),
asserts: None,
with: None,
type_only: false,
})));
}
Expand Down
6 changes: 3 additions & 3 deletions packages/next-swc/crates/core/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
raw: None,
}),
type_only: false,
asserts: None,
with: None,
})));
}

Expand Down Expand Up @@ -1001,7 +1001,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
raw: None,
}),
type_only: false,
asserts: None,
with: None,
})));
new.push(ModuleItem::Stmt(Stmt::Expr(ExprStmt {
span: DUMMY_SP,
Expand Down Expand Up @@ -1076,7 +1076,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
raw: None,
}),
type_only: false,
asserts: None,
with: None,
})));
// Make it the first item
new.rotate_right(1);
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/tests/full/example/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ import t from "other";
}())[0];
export var __N_SSG = !0;
export default function e() {
return React.createElement("div", null);
return /*#__PURE__*/ React.createElement("div", null);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var _defaultExport = new String("@media(max-width:870px){th.expiration-date-cell,td.expiration-date-cell{display:none}}");
var _defaultExport = new String("@media (width<=870px){th.expiration-date-cell,td.expiration-date-cell{display:none}}");
_defaultExport.__hash = "fd71bf06ba8860bb";
export default _defaultExport;
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-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230829.2",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230829.2",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230901.1",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230901.1",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<'a> FontImportsGenerator<'a> {
}),
specifiers: vec![],
type_only: false,
asserts: None,
with: None,
span: DUMMY_SP,
});
}
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<'a> Visit for FontImportsGenerator<'a> {
})],
src: None,
type_only: false,
asserts: None,
with: None,
}),
));
}
Expand Down
8 changes: 4 additions & 4 deletions packages/next-swc/crates/next-transform-dynamic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl NextDynamicPatcher {
],
src: Box::new(specifier.into()),
type_only: false,
asserts: None,
with: None,
})));
}
TurbopackImport::DevelopmentId {
Expand All @@ -506,7 +506,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
asserts: None,
with: None,
})));
}
TurbopackImport::BuildTransition {
Expand Down Expand Up @@ -535,7 +535,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
asserts: None,
with: None,
})));
}
TurbopackImport::BuildId {
Expand All @@ -561,7 +561,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
asserts: None,
with: None,
})));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<'a> FontImportsGenerator<'a> {
}),
specifiers: vec![],
type_only: false,
asserts: None,
with: None,
span: DUMMY_SP,
});
}
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<'a> Visit for FontImportsGenerator<'a> {
})],
src: None,
type_only: false,
asserts: None,
with: None,
}),
));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"@types/ws": "8.2.0",
"@vercel/ncc": "0.34.0",
"@vercel/nft": "0.22.6",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230829.2",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230901.1",
"acorn": "8.5.0",
"ajv": "8.11.0",
"amphtml-validator": "1.0.35",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/compiled/sass-loader/cjs.js

Large diffs are not rendered by default.

27 changes: 13 additions & 14 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/e2e/app-dir/rsc-basic/rsc-basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ createNextDescribe(

// from styled-jsx
expect(head).toMatch(/{color:(\s*)purple;?}/) // styled-jsx/style
expect(head).toMatch(/{color:(\s*)hotpink;?}/) // styled-jsx/css
expect(head).toMatch(/{color:(\s*)#ff69b4;?}/) // styled-jsx/css

// from styled-components
expect(head).toMatch(/{color:(\s*)blue;?}/)
Expand All @@ -339,7 +339,7 @@ createNextDescribe(

// from styled-jsx
expect(head).toMatch(/{color:(\s*)purple;?}/) // styled-jsx/style
expect(head).toMatch(/{color:(\s*)hotpink;?}/) // styled-jsx/css
expect(head).toMatch(/{color:(\s*)#ff69b4;?}/) // styled-jsx/css

// from styled-components
expect(head).toMatch(/{color:(\s*)blue;?}/)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/streaming-ssr/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('streaming SSR with custom next configs', () => {

it('should render styled-jsx styles in streaming', async () => {
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('color:blue')
expect(html).toContain('color:#00f')
})

it('should redirect paths without trailing-slash and render when slash is appended', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/amphtml/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ describe('AMP Usage', () => {
const html = await renderViaHTTP(appPort, '/styled?amp=1')
const $ = cheerio.load(html)
expect($('style[amp-custom]').first().text()).toMatch(
/div.jsx-[a-zA-Z0-9]{1,}{color:red}span.jsx-[a-zA-Z0-9]{1,}{color:blue}body{background-color:green}/
/div.jsx-[a-zA-Z0-9]{1,}{color:red}span.jsx-[a-zA-Z0-9]{1,}{color:#00f}body{background-color:green}/
)
})

Expand Down
4 changes: 2 additions & 2 deletions test/integration/client-navigation/test/rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ export default function (render, fetch, ctx) {
const styleId = $('#blue-box').attr('class')
const style = $('style')

expect(style.text().includes(`p.${styleId}{color:blue`)).toBeTruthy()
expect(style.text().includes(`p.${styleId}{color:#00f`)).toBeTruthy()
})

test('renders styled jsx external', async () => {
const $ = await get$('/styled-jsx-external')
const styleId = $('#blue-box').attr('class')
const style = $('style')

expect(style.text().includes(`p.${styleId}{color:blue`)).toBeTruthy()
expect(style.text().includes(`p.${styleId}{color:#00f`)).toBeTruthy()
})

test('renders properties populated asynchronously', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/react-18/test/concurrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export default (context, _render) => {
context.appPort,
'/use-flush-effect/styled-jsx'
)
const stylesOccurrence = html.match(/color:(\s)*blue/g) || []
const stylesOccurrence = html.match(/color:(\s)*#00f/g) || []
expect(stylesOccurrence.length).toBe(1)

await withBrowser('/use-flush-effect/styled-jsx', async (browser) => {
await check(
() => browser.waitForElementByCss('#__jsx-900f996af369fc74').text(),
/blue/
/#00f/
)
await check(
() => browser.waitForElementByCss('#__jsx-8b0811664c4e575e').text(),
Expand Down

0 comments on commit a5c1803

Please sign in to comment.