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

Add support for app global and segment 404 pages #49085

Merged
merged 18 commits into from
May 3, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 34 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ swc_relay = { version = "0.2.7" }
testing = { version = "0.33.6" }

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

# General Deps

Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-dev": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230502.4",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230502.4",
"@vercel/turbopack-dev": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230503.2",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230503.2",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare global {
}

import type { Ipc } from '@vercel/turbopack-node/ipc/index'
import type { IncomingMessage, ServerResponse } from 'node:http'
import type { IncomingMessage } from 'node:http'
import type {
ClientCSSReferenceManifest,
ClientReferenceManifest,
Expand All @@ -25,13 +25,13 @@ import type { RenderOpts } from 'next/dist/server/app-render/types'

import { renderToHTMLOrFlight } from 'next/dist/server/app-render/app-render'
import { RSC_VARY_HEADER } from 'next/dist/client/components/app-router-headers'
import { ServerResponseShim } from '../internal/http'
import { headersFromEntries } from '../internal/headers'
import { parse, ParsedUrlQuery } from 'node:querystring'
import { PassThrough } from 'node:stream'
;('TURBOPACK { transition: next-layout-entry; chunking-type: isolatedParallel }')
// @ts-ignore
import layoutEntry from './app/layout-entry'
import { createServerResponse } from '../internal/http'

globalThis.__next_require__ = (data) => {
const [, , ssr_id] = JSON.parse(data)
Expand Down Expand Up @@ -91,7 +91,7 @@ const MIME_TEXT_HTML_UTF8 = 'text/html; charset=utf-8'
ipc.send({
type: 'headers',
data: {
status: 200,
status: result.statusCode,
headers: result.headers,
},
})
Expand Down Expand Up @@ -124,8 +124,6 @@ type LoaderTree = [
]

async function runOperation(renderData: RenderData) {
let tree: LoaderTree = LOADER_TREE

const proxyMethodsForModule = (
id: string
): ProxyHandler<ClientReferenceManifest['ssrModuleMapping']> => {
Expand Down Expand Up @@ -251,7 +249,9 @@ async function runOperation(renderData: RenderData) {
method: renderData.method,
headers: headersFromEntries(renderData.rawHeaders),
} as any
const res: ServerResponse = new ServerResponseShim(req) as any

const res = createServerResponse(req, renderData.path)

const query = parse(renderData.rawQuery)
const renderOpt: Omit<
RenderOpts,
Expand Down Expand Up @@ -304,6 +304,7 @@ async function runOperation(renderData: RenderData) {
body.write(result.toUnchunkedString())
}
return {
statusCode: res.statusCode,
headers: [
['Content-Type', result.contentType() ?? MIME_TEXT_HTML_UTF8],
['Vary', RSC_VARY_HEADER],
Expand Down