Skip to content

Commit

Permalink
update to latest next.js (#3112)
Browse files Browse the repository at this point in the history
* add GlobalError export to layout entry (see
vercel/next.js#44066)
* update app manifest for CSS (see
vercel/next.js#44168)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
sokra and kodiakhq[bot] committed Dec 21, 2022
1 parent d546e73 commit 7a96b5c
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 121 deletions.
2 changes: 1 addition & 1 deletion crates/next-core/js/package.json
Expand Up @@ -12,7 +12,7 @@
"@vercel/turbopack-runtime": "latest",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "^13.0.6",
"next": "^13.0.8-canary.2",
"platform": "1.3.6",
"react-dom": "^18.2.0",
"react": "^18.2.0",
Expand Down
15 changes: 8 additions & 7 deletions crates/next-core/js/src/entry/app-renderer.tsx
Expand Up @@ -112,7 +112,7 @@ async function runOperation(renderData: RenderData) {
const pageModule = pageItem.page!.module;
const Page = pageModule.default;
let tree: LoaderTree = ["", {}, { page: [() => Page, "page.js"] }];
layoutInfoChunks["page.js"] = pageItem.page!.chunks;
layoutInfoChunks["page"] = pageItem.page!.chunks;
for (let i = LAYOUT_INFO.length - 2; i >= 0; i--) {
const info = LAYOUT_INFO[i];
const components: ComponentsType = {};
Expand All @@ -122,7 +122,7 @@ async function runOperation(renderData: RenderData) {
}
const k = key as FileType;
components[k] = [() => info[k]!.module.default, `${k}${i}.js`];
layoutInfoChunks[`${k}${i}.js`] = info[k]!.chunks;
layoutInfoChunks[`${k}${i}`] = info[k]!.chunks;
}
tree = [info.segment, { children: tree }, components];
}
Expand All @@ -145,23 +145,24 @@ async function runOperation(renderData: RenderData) {
if (name === "__ssr_module_mapping__") {
return manifest;
}
if (name === "__client_css_manifest__") {
return {};
if (name === "__entry_css_files__") {
return __entry_css_files__;
}
return new Proxy({}, proxyMethodsForModule(name as string, css));
},
};
};
const manifest: FlightManifest = new Proxy({} as any, proxyMethods(false));
const serverCSSManifest: FlightCSSManifest = {};
serverCSSManifest.__entry_css__ = {};
const __entry_css_files__: FlightManifest["__entry_css_files__"] = {};
for (const [key, chunks] of Object.entries(layoutInfoChunks)) {
const cssChunks = chunks.filter((path) => path.endsWith(".css"));
serverCSSManifest[key] = cssChunks.map((chunk) =>
serverCSSManifest[`${key}.js`] = cssChunks.map((chunk) =>
JSON.stringify([chunk, [chunk]])
);
__entry_css_files__[key] = cssChunks;
}
serverCSSManifest.__entry_css__ = {
serverCSSManifest.__entry_css_mods__ = {
page: serverCSSManifest["page.js"],
};
const req: IncomingMessage = {
Expand Down
1 change: 1 addition & 0 deletions crates/next-core/js/src/entry/app/layout-entry.tsx
@@ -1,6 +1,7 @@
export { default as AppRouter } from "next/dist/client/components/app-router.js";
export { default as LayoutRouter } from "next/dist/client/components/layout-router.js";
export { default as RenderFromTemplateContext } from "next/dist/client/components/render-from-template-context.js";
export { default as GlobalError } from "next/dist/client/components/error-boundary.js";
export { staticGenerationAsyncStorage } from "next/dist/esm/client/components/static-generation-async-storage.js";
export { requestAsyncStorage } from "next/dist/esm/client/components/request-async-storage.js";
import * as serverHooks from "next/dist/esm/client/components/hooks-server-context.js";
Expand Down
2 changes: 1 addition & 1 deletion crates/next-dev/benches/bundlers/turbopack/mod.rs
Expand Up @@ -49,7 +49,7 @@ impl Bundler for Turbopack {
npm::install(
install_dir,
&[
NpmPackage::new("next", "13.0.3"),
NpmPackage::new("next", "13.0.8-canary.2"),
// Dependency on this is inserted by swc's preset_env
NpmPackage::new("@swc/helpers", "^0.4.11"),
],
Expand Down
2 changes: 1 addition & 1 deletion crates/next-dev/tests/package.json
Expand Up @@ -3,7 +3,7 @@
"devDependencies": {
"@turbo/pack-test-harness": "*",
"autoprefixer": "^10.4.13",
"next": "13.0.1",
"next": "13.0.8-canary.2",
"postcss": "^8.4.20",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down

1 comment on commit 7a96b5c

@vercel
Copy link

@vercel vercel bot commented on 7a96b5c Dec 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.