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

Revert swc versions to one that doesn't use lightningcss #55148

Merged
merged 5 commits into from
Sep 8, 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
485 changes: 157 additions & 328 deletions Cargo.lock

Large diffs are not rendered by default.

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

# SWC crates
# Keep consistent with preset_env_base through swc_core
swc_core = { version = "0.82.11" }
testing = { version = "0.34.1" }
swc_core = { version = "=0.79.55", features = ["ecma_loader_lru", "ecma_loader_parking_lot"] }
testing = { version = "0.33.21" }

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

# 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,
}),
with: None,
asserts: 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,
with: None,
asserts: None,
})));
}

Expand Down Expand Up @@ -1001,7 +1001,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
raw: None,
}),
type_only: false,
with: None,
asserts: 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,
with: None,
asserts: 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 /*#__PURE__*/ React.createElement("div", null);
return React.createElement("div", null);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var _defaultExport = new String("@media (width<=870px){th.expiration-date-cell,td.expiration-date-cell{display:none}}");
var _defaultExport = new String("@media(max-width:870px){th.expiration-date-cell,td.expiration-date-cell{display:none}}");
_defaultExport.__hash = "fd71bf06ba8860bb";
export default _defaultExport;
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,
with: None,
asserts: None,
span: DUMMY_SP,
});
}
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<'a> Visit for FontImportsGenerator<'a> {
})],
src: None,
type_only: false,
with: None,
asserts: 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,
with: None,
asserts: None,
})));
}
TurbopackImport::DevelopmentId {
Expand All @@ -506,7 +506,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: None,
})));
}
TurbopackImport::BuildTransition {
Expand Down Expand Up @@ -535,7 +535,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: None,
})));
}
TurbopackImport::BuildId {
Expand All @@ -561,7 +561,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: 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,
with: None,
asserts: None,
span: DUMMY_SP,
});
}
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<'a> Visit for FontImportsGenerator<'a> {
})],
src: None,
type_only: false,
with: None,
asserts: None,
}),
));
}
Expand Down
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*)#ff69b4;?}/) // styled-jsx/css
expect(head).toMatch(/{color:(\s*)hotpink;?}/) // 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*)#ff69b4;?}/) // styled-jsx/css
expect(head).toMatch(/{color:(\s*)hotpink;?}/) // 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:#00f')
expect(html).toContain('color:blue')
})

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 @@ -230,7 +230,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:#00f}body{background-color:green}/
/div.jsx-[a-zA-Z0-9]{1,}{color:red}span.jsx-[a-zA-Z0-9]{1,}{color:blue}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:#00f`)).toBeTruthy()
expect(style.text().includes(`p.${styleId}{color:blue`)).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:#00f`)).toBeTruthy()
expect(style.text().includes(`p.${styleId}{color:blue`)).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)*#00f/g) || []
const stylesOccurrence = html.match(/color:(\s)*blue/g) || []
expect(stylesOccurrence.length).toBe(1)

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