From 0502dc132b86e06dc428a9c8eba6341b7d3a73c1 Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Thu, 15 Feb 2024 13:32:14 -0800 Subject: [PATCH 1/3] Update to `turbopack-240215.5` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes: - https://github.com/vercel/turbo/pull/7401 This makes “conversion to class component” Turbopack tests pass. --- Cargo.toml | 6 +++--- packages/next/package.json | 2 +- pnpm-lock.yaml | 10 +++++----- .../acceptance-app/ReactRefreshLogBox.test.ts | 2 +- .../__snapshots__/ReactRefreshLogBox.test.ts.snap | 11 +++++++++++ .../__snapshots__/ReactRefreshLogBox.test.ts.snap | 2 ++ test/turbopack-tests-manifest.json | 9 ++++----- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1558d7641ce92..60413ec1cd36a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,11 +37,11 @@ swc_core = { version = "0.90.8", features = [ testing = { version = "0.35.18" } # Turbo crates -turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240215.4" } +turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240215.5" } # [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-240215.4" } +turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240215.5" } # [TODO]: need to refactor embed_directory! macro usage in next-core -turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240215.4" } +turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240215.5" } # General Deps diff --git a/packages/next/package.json b/packages/next/package.json index 304ef36021049..5bbf5e8d4d345 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -192,7 +192,7 @@ "@types/ws": "8.2.0", "@vercel/ncc": "0.34.0", "@vercel/nft": "0.26.4", - "@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.4", + "@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.5", "acorn": "8.5.0", "amphtml-validator": "1.0.35", "anser": "1.4.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f123401422ea4..c679bdb6d9bbc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1074,8 +1074,8 @@ importers: specifier: 0.26.4 version: 0.26.4 '@vercel/turbopack-ecmascript-runtime': - specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.4 - version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.4(react-refresh@0.12.0)(webpack@5.90.0)' + specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.5 + version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.5(react-refresh@0.12.0)(webpack@5.90.0)' acorn: specifier: 8.5.0 version: 8.5.0 @@ -25639,9 +25639,9 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} - '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.4(react-refresh@0.12.0)(webpack@5.90.0)': - resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.4} - id: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.4' + '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.5(react-refresh@0.12.0)(webpack@5.90.0)': + resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.5} + id: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240215.5' name: '@vercel/turbopack-ecmascript-runtime' version: 0.0.0 dependencies: diff --git a/test/development/acceptance-app/ReactRefreshLogBox.test.ts b/test/development/acceptance-app/ReactRefreshLogBox.test.ts index cc351acb6797f..d77586ab31834 100644 --- a/test/development/acceptance-app/ReactRefreshLogBox.test.ts +++ b/test/development/acceptance-app/ReactRefreshLogBox.test.ts @@ -269,7 +269,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { }) // Module trace is only available with webpack 5 - test('conversion to class component (1)', async () => { + test.only('conversion to class component (1)', async () => { const { session, cleanup } = await sandbox(next) await session.write( diff --git a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap index 4a148704a8ab0..0de6151394bf7 100644 --- a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -137,6 +137,17 @@ exports[`ReactRefreshLogBox app turbo boundaries 1`] = ` | ^" `; +exports[`ReactRefreshLogBox app turbo conversion to class component (1) 1`] = ` +"Child.js (4:11) @ ClickCount.render + + 2 | export default class ClickCount extends Component { + 3 | render() { +> 4 | throw new Error() + | ^ + 5 | } + 6 | }" +`; + exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 1`] = `"Error: end http://nextjs.org"`; exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 2`] = `"http://nextjs.org/"`; diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap index bd329bdd37d5a..39a28182a0df0 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -72,6 +72,8 @@ exports[`ReactRefreshLogBox default should strip whitespace correctly with newli exports[`ReactRefreshLogBox turbo boundaries 1`] = `null`; +exports[`ReactRefreshLogBox turbo conversion to class component (1) 1`] = `null`; + exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 1`] = `"Error: end http://nextjs.org"`; exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 2`] = `"http://nextjs.org/"`; diff --git a/test/turbopack-tests-manifest.json b/test/turbopack-tests-manifest.json index 315a715b486fa..2573b27a11d57 100644 --- a/test/turbopack-tests-manifest.json +++ b/test/turbopack-tests-manifest.json @@ -927,16 +927,14 @@ "ReactRefreshLogBox app turbo Should not show __webpack_exports__ when exporting anonymous arrow function", "ReactRefreshLogBox app turbo Unhandled errors and rejections opens up in the minimized state", "ReactRefreshLogBox app turbo boundaries", + "ReactRefreshLogBox app turbo conversion to class component (1)", "ReactRefreshLogBox app turbo logbox: anchors links in error messages", "ReactRefreshLogBox app turbo module init error not shown", "ReactRefreshLogBox app turbo server component can recover from error thrown in the module", "ReactRefreshLogBox app turbo should strip whitespace correctly with newline", "ReactRefreshLogBox app turbo unterminated JSX" ], - "failed": [ - "ReactRefreshLogBox app turbo conversion to class component (1)", - "ReactRefreshLogBox app turbo css syntax errors" - ], + "failed": ["ReactRefreshLogBox app turbo css syntax errors"], "pending": [ "ReactRefreshLogBox app default Call stack count is correct for client error", "ReactRefreshLogBox app default Call stack count is correct for server error", @@ -1279,6 +1277,7 @@ "test/development/acceptance/ReactRefreshLogBox.test.ts": { "passed": [ "ReactRefreshLogBox turbo boundaries", + "ReactRefreshLogBox turbo conversion to class component (1)", "ReactRefreshLogBox turbo logbox: anchors links in error messages", "ReactRefreshLogBox turbo module init error not shown", "ReactRefreshLogBox turbo non-Error errors are handled properly", @@ -1298,7 +1297,7 @@ "ReactRefreshLogBox default unterminated JSX", "ReactRefreshLogBox turbo internal package errors" ], - "flakey": ["ReactRefreshLogBox turbo conversion to class component (1)"], + "flakey": [], "runtimeError": false }, "test/development/acceptance/ReactRefreshLogBoxMisc.test.ts": { From e4301b7f742f313cd0164c6de1d9e5219fb31183 Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Thu, 15 Feb 2024 13:33:20 -0800 Subject: [PATCH 2/3] fixup! Update to `turbopack-240215.5` --- test/development/acceptance-app/ReactRefreshLogBox.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/development/acceptance-app/ReactRefreshLogBox.test.ts b/test/development/acceptance-app/ReactRefreshLogBox.test.ts index d77586ab31834..cc351acb6797f 100644 --- a/test/development/acceptance-app/ReactRefreshLogBox.test.ts +++ b/test/development/acceptance-app/ReactRefreshLogBox.test.ts @@ -269,7 +269,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { }) // Module trace is only available with webpack 5 - test.only('conversion to class component (1)', async () => { + test('conversion to class component (1)', async () => { const { session, cleanup } = await sandbox(next) await session.write( From bea1f9b389d273bc23a7f2531bb6802322792b9f Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Thu, 15 Feb 2024 15:48:00 -0800 Subject: [PATCH 3/3] fixup! Update to `turbopack-240215.5` --- .../acceptance-app/rsc-build-errors.test.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test/development/acceptance-app/rsc-build-errors.test.ts b/test/development/acceptance-app/rsc-build-errors.test.ts index 904634c942ce6..235703ac19afd 100644 --- a/test/development/acceptance-app/rsc-build-errors.test.ts +++ b/test/development/acceptance-app/rsc-build-errors.test.ts @@ -5,7 +5,7 @@ import { sandbox } from 'development-sandbox' import { outdent } from 'outdent' describe('Error overlay - RSC build errors', () => { - const { next } = nextTestSetup({ + const { next, isTurbopack } = nextTestSetup({ files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-build-errors')), dependencies: { react: 'latest', @@ -223,9 +223,23 @@ describe('Error overlay - RSC build errors', () => { await next.patchFile(file, uncomment) expect(await session.hasRedbox()).toBe(true) - expect(await session.getRedboxSource()).toInclude( - `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.` - ) + if (isTurbopack) { + expect(await session.getRedboxSource()).toMatchInlineSnapshot(` + "./app/server-with-errors/client-only-in-server/client-only-lib.js:1:1 + Parsing ecmascript source code failed + > 1 | import 'client-only' + | ^^^^^^^^^^^^^^^^^^^^ + 2 | + 3 | export default function ClientOnlyLib() { + 4 | return 'client-only-lib' + + 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" + `) + } else { + expect(await session.getRedboxSource()).toInclude( + `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.` + ) + } await cleanup() })