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

Using lightningcss results in a breaking change to Next.js, so let's revert swc for now.


Closes WEB-1526
This commit is contained in:
Will Binns-Smith 2023-09-08 13:02:51 -07:00 committed by GitHub
parent 6e5b935fd7
commit 8f30255922
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 185 additions and 357 deletions

487
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -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

View file

@ -255,7 +255,7 @@ impl Fold for OptimizeBarrel {
.into(),
raw: None,
}),
with: None,
asserts: None,
type_only: false,
})));
}

View file

@ -915,7 +915,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
raw: None,
}),
type_only: false,
with: None,
asserts: None,
})));
}
@ -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,
@ -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);

View file

@ -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);
}

View file

@ -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;

View file

@ -75,7 +75,7 @@ impl<'a> FontImportsGenerator<'a> {
}),
specifiers: vec![],
type_only: false,
with: None,
asserts: None,
span: DUMMY_SP,
});
}
@ -172,7 +172,7 @@ impl<'a> Visit for FontImportsGenerator<'a> {
})],
src: None,
type_only: false,
with: None,
asserts: None,
}),
));
}

View file

@ -480,7 +480,7 @@ impl NextDynamicPatcher {
],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: None,
})));
}
TurbopackImport::DevelopmentId {
@ -506,7 +506,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: None,
})));
}
TurbopackImport::BuildTransition {
@ -535,7 +535,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: None,
})));
}
TurbopackImport::BuildId {
@ -561,7 +561,7 @@ impl NextDynamicPatcher {
})],
src: Box::new(specifier.into()),
type_only: false,
with: None,
asserts: None,
})));
}
}

View file

@ -75,7 +75,7 @@ impl<'a> FontImportsGenerator<'a> {
}),
specifiers: vec![],
type_only: false,
with: None,
asserts: None,
span: DUMMY_SP,
});
}
@ -172,7 +172,7 @@ impl<'a> Visit for FontImportsGenerator<'a> {
})],
src: None,
type_only: false,
with: None,
asserts: None,
}),
));
}

View file

@ -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;?}/)
@ -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;?}/)

View file

@ -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 () => {

View file

@ -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}/
)
})

View file

@ -228,7 +228,7 @@ 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 () => {
@ -236,7 +236,7 @@ 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 properties populated asynchronously', async () => {

View file

@ -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(),