fix(turbopack): Update app-renderer (vercel/turbo#4102)

### Description

This PR mirrors some related manifest changes in Next.js:
https://github.com/vercel/next.js/pull/46881.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->

---------

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
This commit is contained in:
Shu Ding 2023-03-08 06:47:50 +01:00 committed by GitHub
parent db5e2ea401
commit 2dea520ae2
8 changed files with 71 additions and 63 deletions

View file

@ -12,7 +12,7 @@
"@vercel/turbopack-runtime": "latest",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "13.1.7-canary.30",
"next": "13.2.4-canary.6",
"platform": "1.3.6",
"react-dom": "^18.2.0",
"react": "^18.2.0",

View file

@ -137,32 +137,40 @@ async function runOperation(renderData: RenderData) {
tree = [info.segment, { children: tree }, components];
}
const proxyMethodsForModule = (
id: string,
css: boolean
): ProxyHandler<FlightManifest[""]> => ({
get(target, name, receiver) {
return {
id,
chunks: JSON.parse(id)[1],
name,
};
},
});
const proxyMethods = (css: boolean): ProxyHandler<FlightManifest> => {
const proxyMethods = (): ProxyHandler<FlightManifest> => {
return {
get(target, name, receiver) {
if (name === "__ssr_module_mapping__") {
get(_target, key: string) {
if (key === "__ssr_module_mapping__") {
return manifest;
}
if (name === "__entry_css_files__") {
if (key === "__entry_css_files__") {
return __entry_css_files__;
}
return new Proxy({}, proxyMethodsForModule(name as string, css));
// The key is a `${file}#${name}`, but `file` can contain `#` itself.
// There are 3 possibilities:
// "file" => id = "file", name = "*"
// "file#" => id = "file", name = ""
// "file#foo" => id = "file", name = "foo"
const pos = key.lastIndexOf("#");
let id = key;
let name = "";
if (pos === -1) {
name = "*";
} else {
id = key.slice(0, pos);
name = key.slice(pos + 1);
}
return {
id,
name,
chunks: JSON.parse(id)[1],
};
},
};
};
const manifest: FlightManifest = new Proxy({} as any, proxyMethods(false));
const manifest: FlightManifest = new Proxy({} as any, proxyMethods());
const serverCSSManifest: FlightCSSManifest = {};
const __entry_css_files__: FlightManifest["__entry_css_files__"] = {};
for (const [key, chunks] of Object.entries(layoutInfoChunks)) {

View file

@ -0,0 +1,21 @@
PlainIssue {
severity: Error,
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at <unknown> (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at <unknown> (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at <unknown> (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at <anonymous>\n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},
],
),
}

View file

@ -1,21 +0,0 @@
PlainIssue {
severity: Warning,
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at <anonymous>\n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},
],
),
}

View file

@ -1,21 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at <anonymous>\n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},
],
),
}

View file

@ -0,0 +1,21 @@
PlainIssue {
severity: Warning,
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at <unknown> (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at <unknown> (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at <unknown> (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.2.4-canary.6_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at <anonymous>\n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},
],
),
}

View file

@ -9,7 +9,7 @@
"autoprefixer": "^10.4.13",
"babel-loader": "^9.1.2",
"loader-runner": "^4.3.0",
"next": "13.1.7-canary.28",
"next": "13.2.4-canary.6",
"postcss": "^8.4.20",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View file

@ -49,7 +49,7 @@ impl Bundler for Turbopack {
npm::install(
install_dir,
&[
NpmPackage::new("next", "13.1.7-canary.28"),
NpmPackage::new("next", "13.2.4-canary.6"),
// Dependency on this is inserted by swc's preset_env
NpmPackage::new("@swc/helpers", "^0.4.11"),
],