Skip to content

Commit

Permalink
Merge branch 'canary' into sokra/update-turbopack
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed May 30, 2023
2 parents 9a5a234 + e8bf785 commit ac077aa
Show file tree
Hide file tree
Showing 24 changed files with 103 additions and 41 deletions.
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": "13.4.5-canary.0"
"version": "13.4.5-canary.1"
}
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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "13.4.5-canary.0",
"@next/eslint-plugin-next": "13.4.5-canary.1",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"description": "ESLint plugin for NextJS.",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"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": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -83,7 +83,7 @@
]
},
"dependencies": {
"@next/env": "13.4.5-canary.0",
"@next/env": "13.4.5-canary.1",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
Expand Down Expand Up @@ -139,11 +139,11 @@
"@jest/types": "29.5.0",
"@napi-rs/cli": "2.14.7",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.4.5-canary.0",
"@next/polyfill-nomodule": "13.4.5-canary.0",
"@next/react-dev-overlay": "13.4.5-canary.0",
"@next/react-refresh-utils": "13.4.5-canary.0",
"@next/swc": "13.4.5-canary.0",
"@next/polyfill-module": "13.4.5-canary.1",
"@next/polyfill-nomodule": "13.4.5-canary.1",
"@next/react-dev-overlay": "13.4.5-canary.1",
"@next/react-refresh-utils": "13.4.5-canary.1",
"@next/swc": "13.4.5-canary.1",
"@opentelemetry/api": "1.4.1",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/next/src/build/analysis/get-page-static-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface PageStaticInfo {
ssr?: boolean
rsc?: RSCModuleType
middleware?: Partial<MiddlewareConfig>
amp?: boolean | 'hybrid'
}

const CLIENT_MODULE_LABEL =
Expand Down Expand Up @@ -488,6 +489,7 @@ export async function getPageStaticInfo(params: {
ssr,
ssg,
rsc,
amp: config.amp || false,
...(middlewareConfig && { middleware: middlewareConfig }),
...(resolvedRuntime && { runtime: resolvedRuntime }),
preferredRegion,
Expand All @@ -498,6 +500,7 @@ export async function getPageStaticInfo(params: {
ssr: false,
ssg: false,
rsc: RSC_MODULE_TYPES.server,
amp: false,
runtime: undefined,
}
}
7 changes: 1 addition & 6 deletions packages/next/src/build/webpack/loaders/next-app-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,7 @@ async function createTreeCodeFromPath(
const defaultPath =
(await resolver(
`${appDirPrefix}${segmentPath}/${actualSegment}/default`
)) ??
(await resolver(
`next/dist/client/components/parallel-route-default`,
false,
true
))
)) ?? 'next/dist/client/components/parallel-route-default'

props[normalizeParallelKey(adjacentParallelSegment)] = `[
'__DEFAULT__',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ export class ClientReferenceEntryPlugin {
continue
}

// TODO-APP: Enable these lines. This ensures no entrypoint is created for layout/page when there are no client components.
// Currently disabled because it causes test failures in CI.
// if (clientImports.length === 0 && actionImports.length === 0) {
// continue
// }

const relativeRequest = isAbsoluteRequest
? path.relative(compilation.options.context, entryRequest)
: entryRequest
Expand Down
39 changes: 38 additions & 1 deletion packages/next/src/server/dev/hot-reloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ function erroredPages(compilation: webpack.Compilation) {
}

export default class HotReloader {
private hasAmpEntrypoints: boolean
private hasAppRouterEntrypoints: boolean
private hasPagesRouterEntrypoints: boolean
private dir: string
private buildId: string
private interceptors: any[]
Expand Down Expand Up @@ -223,6 +226,9 @@ export default class HotReloader {
telemetry: Telemetry
}
) {
this.hasAmpEntrypoints = false
this.hasAppRouterEntrypoints = false
this.hasPagesRouterEntrypoints = false
this.buildId = buildId
this.dir = dir
this.interceptors = []
Expand Down Expand Up @@ -719,6 +725,11 @@ export default class HotReloader {
}
}

// Ensure _error is considered a `pages` page.
if (page === '/_error') {
this.hasPagesRouterEntrypoints = true
}

const hasAppDir = !!this.appDir
const isAppPath = hasAppDir && bundlePath.startsWith('app/')
const staticInfo = isEntry
Expand All @@ -732,6 +743,10 @@ export default class HotReloader {
page,
})
: {}

if (staticInfo.amp === true || staticInfo.amp === 'hybrid') {
this.hasAmpEntrypoints = true
}
const isServerComponent =
isAppPath && staticInfo.rsc !== RSC_MODULE_TYPES.client

Expand All @@ -740,6 +755,14 @@ export default class HotReloader {
: entryData.bundlePath.startsWith('app/')
? 'app'
: 'root'

if (pageType === 'pages') {
this.hasPagesRouterEntrypoints = true
}
if (pageType === 'app') {
this.hasAppRouterEntrypoints = true
}

await runDependingOnPageType({
page,
pageRuntime: staticInfo.runtime,
Expand Down Expand Up @@ -879,6 +902,21 @@ export default class HotReloader {
})
})
)

if (!this.hasAmpEntrypoints) {
delete entrypoints.amp
}
if (!this.hasPagesRouterEntrypoints) {
delete entrypoints.main
delete entrypoints['pages/_app']
delete entrypoints['pages/_error']
delete entrypoints['/_error']
delete entrypoints['pages/_document']
}
if (!this.hasAppRouterEntrypoints) {
delete entrypoints['main-app']
}

return entrypoints
}
}
Expand Down Expand Up @@ -1082,7 +1120,6 @@ export default class HotReloader {
const documentChunk = compilation.namedChunks.get('pages/_document')
// If the document chunk can't be found we do nothing
if (!documentChunk) {
console.warn('_document.js chunk not found')
return
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "13.4.5-canary.0",
"version": "13.4.5-canary.1",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down

0 comments on commit ac077aa

Please sign in to comment.