Skip to content

Commit

Permalink
Merge branch 'canary' into huozhi/remove-rsc-client-ref-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored May 9, 2024
2 parents 4af3983 + 1277ff4 commit 95d2973
Show file tree
Hide file tree
Showing 32 changed files with 188 additions and 66 deletions.
5 changes: 4 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
# https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view

# chore(examples): use default prettier for examples/templates (#60530)
4466ba436b996263307171d344cca199e8087744
4466ba436b996263307171d344cca199e8087744

# chore: update prettier to 3.2.5 (#65092)
64b718c6618b6c419872abbf22163ae543ac259e
55 changes: 31 additions & 24 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "14.3.0-canary.50"
"version": "14.3.0-canary.51"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "14.3.0-canary.50",
"@next/eslint-plugin-next": "14.3.0-canary.51",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
"eslint-import-resolver-node": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "14.3.0-canary.50",
"version": "14.3.0-canary.51",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -93,7 +93,7 @@
]
},
"dependencies": {
"@next/env": "14.3.0-canary.50",
"@next/env": "14.3.0-canary.51",
"@swc/helpers": "0.5.11",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001579",
Expand Down Expand Up @@ -153,10 +153,10 @@
"@jest/types": "29.5.0",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/polyfill-module": "14.3.0-canary.50",
"@next/polyfill-nomodule": "14.3.0-canary.50",
"@next/react-refresh-utils": "14.3.0-canary.50",
"@next/swc": "14.3.0-canary.50",
"@next/polyfill-module": "14.3.0-canary.51",
"@next/polyfill-nomodule": "14.3.0-canary.51",
"@next/react-refresh-utils": "14.3.0-canary.51",
"@next/swc": "14.3.0-canary.51",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.41.2",
"@taskr/clear": "1.1.0",
Expand Down
30 changes: 22 additions & 8 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,14 @@ export default async function getBaseWebpackConfig(
},
...(hasAppDir
? [
{
layer: WEBPACK_LAYERS.appRouteHandler,
test: new RegExp(
`private-next-app-dir\\/.*\\/route\\.(${pageExtensions.join(
'|'
)})$`
),
},
{
// Make sure that AsyncLocalStorage module instance is shared between server and client
// layers.
Expand Down Expand Up @@ -1700,17 +1708,23 @@ export default async function getBaseWebpackConfig(
'.shared-runtime'
)
const layer = resource.contextInfo.issuerLayer

let runtime

if (layer === WEBPACK_LAYERS.serverSideRendering) {
runtime = 'app-page'
} else if (!layer) {
runtime = 'pages'
} else {
throw new Error(
`shared-runtime module ${moduleName} cannot be used in ${layer} layer`
)
switch (layer) {
case WEBPACK_LAYERS.appRouteHandler:
runtime = 'app-route'
break
case WEBPACK_LAYERS.serverSideRendering:
case WEBPACK_LAYERS.reactServerComponents:
case WEBPACK_LAYERS.appPagesBrowser:
case WEBPACK_LAYERS.actionBrowser:
runtime = 'app-page'
break
default:
runtime = 'pages'
}

resource.request = `next/dist/server/future/route-modules/${runtime}/vendored/contexts/${moduleName}`
}
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,11 @@ export class NextTypesPlugin {
}
return
}
if (mod.layer !== WEBPACK_LAYERS.reactServerComponents) return
if (
mod.layer !== WEBPACK_LAYERS.reactServerComponents &&
mod.layer !== WEBPACK_LAYERS.appRouteHandler
)
return

const IS_LAYOUT = /[/\\]layout\.[^./\\]+$/.test(mod.resource)
const IS_PAGE = !IS_LAYOUT && /[/\\]page\.[^.]+$/.test(mod.resource)
Expand Down
9 changes: 7 additions & 2 deletions packages/next/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ const WEBPACK_LAYERS_NAMES = {
*/
shared: 'shared',
/**
* The layer for server-only runtime and picking up `react-server` export conditions.
* Including app router RSC pages and app router custom routes.
* React Server Components layer (rsc).
*/
reactServerComponents: 'rsc',
/**
Expand Down Expand Up @@ -151,6 +150,10 @@ const WEBPACK_LAYERS_NAMES = {
* The server bundle layer for metadata routes.
*/
appMetadataRoute: 'app-metadata-route',
/**
* The layer for the server bundle for App Route handlers.
*/
appRouteHandler: 'app-route-handler',
} as const

export type WebpackLayerName =
Expand All @@ -163,6 +166,7 @@ const WEBPACK_LAYERS = {
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.appMetadataRoute,
WEBPACK_LAYERS_NAMES.appRouteHandler,
WEBPACK_LAYERS_NAMES.instrument,
],
clientOnly: [
Expand All @@ -178,6 +182,7 @@ const WEBPACK_LAYERS = {
WEBPACK_LAYERS_NAMES.reactServerComponents,
WEBPACK_LAYERS_NAMES.actionBrowser,
WEBPACK_LAYERS_NAMES.appMetadataRoute,
WEBPACK_LAYERS_NAMES.appRouteHandler,
WEBPACK_LAYERS_NAMES.serverSideRendering,
WEBPACK_LAYERS_NAMES.appPagesBrowser,
WEBPACK_LAYERS_NAMES.shared,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ export * as ServerInsertedHtml from '../../../../../../shared/lib/server-inserte
export * as AppRouterContext from '../../../../../../shared/lib/app-router-context.shared-runtime'
export * as HooksClientContext from '../../../../../../shared/lib/hooks-client-context.shared-runtime'
export * as RouterContext from '../../../../../../shared/lib/router-context.shared-runtime'
export * as HtmlContext from '../../../../../../shared/lib/html-context.shared-runtime'
export * as AmpContext from '../../../../../../shared/lib/amp-context.shared-runtime'
export * as LoadableContext from '../../../../../../shared/lib/loadable-context.shared-runtime'
export * as ImageConfigContext from '../../../../../../shared/lib/image-config-context.shared-runtime'
export * as Loadable from '../../../../../../shared/lib/loadable.shared-runtime'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored[
'contexts'
].HtmlContext
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = require('../../module.compiled').vendored[
'contexts'
].LoadableContext
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../module.compiled').vendored['contexts'].Loadable
Loading

0 comments on commit 95d2973

Please sign in to comment.