Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
78db3475
Unverified
Commit
78db3475
authored
Dec 01, 2023
by
Tobias Koppers
Committed by
GitHub
Dec 01, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'canary' into 11-30-mark_flaky_turbopack_test
parents
81f9e3e5
cc42e437
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
547 additions
and
172 deletions
+547
-172
next.config.js
examples/reproduction-template-pages/next.config.js
+3
-1
next.config.js
examples/reproduction-template/next.config.js
+3
-1
lerna.json
lerna.json
+1
-1
package.json
packages/create-next-app/package.json
+1
-1
package.json
packages/eslint-config-next/package.json
+2
-2
package.json
packages/eslint-plugin-next/package.json
+1
-1
package.json
packages/font/package.json
+1
-1
package.json
packages/next-bundle-analyzer/package.json
+1
-1
package.json
packages/next-codemod/package.json
+1
-1
package.json
packages/next-env/package.json
+1
-1
package.json
packages/next-mdx/package.json
+1
-1
package.json
packages/next-plugin-storybook/package.json
+1
-1
package.json
packages/next-polyfill-module/package.json
+1
-1
package.json
packages/next-polyfill-nomodule/package.json
+1
-1
package.json
packages/next-swc/package.json
+1
-1
package.json
packages/next/package.json
+7
-7
index.ts
...next/src/build/webpack/plugins/next-types-plugin/index.ts
+27
-25
app-render.tsx
packages/next/src/server/app-render/app-render.tsx
+3
-1
config-shared.ts
packages/next/src/server/config-shared.ts
+1
-0
start-server.ts
packages/next/src/server/lib/start-server.ts
+5
-3
index.d.ts
packages/next/types/index.d.ts
+6
-1
package.json
packages/react-dev-overlay/package.json
+1
-1
package.json
packages/react-refresh-utils/package.json
+1
-1
package.json
packages/third-parties/package.json
+2
-2
pnpm-lock.yaml
pnpm-lock.yaml
+8
-8
build-turbopack-tests-manifest.js
test/build-turbopack-tests-manifest.js
+46
-7
subresource-integrity.test.ts
...p-dir/subresource-integrity/subresource-integrity.test.ts
+40
-4
route.ts
...tes-with-webpack-worker/bad-routes/app/api/hello/route.ts
+7
-0
layout.tsx
...yped-routes-with-webpack-worker/bad-routes/app/layout.tsx
+11
-0
page.tsx
.../typed-routes-with-webpack-worker/bad-routes/app/page.tsx
+9
-0
next.config.js
...yped-routes-with-webpack-worker/bad-routes/next.config.js
+7
-0
route.ts
...es-with-webpack-worker/good-routes/app/api/hello/route.ts
+7
-0
layout.tsx
...ped-routes-with-webpack-worker/good-routes/app/layout.tsx
+11
-0
page.tsx
...typed-routes-with-webpack-worker/good-routes/app/page.tsx
+9
-0
next.config.js
...ped-routes-with-webpack-worker/good-routes/next.config.js
+7
-0
typed-routes-with-webpack-worker.test.ts
...h-webpack-worker/typed-routes-with-webpack-worker.test.ts
+40
-0
turbopack-tests-manifest.json
test/turbopack-tests-manifest.json
+272
-96
No files found.
examples/reproduction-template-pages/next.config.js
View file @
78db3475
/** @type {import("next").NextConfig} */
module
.
exports
=
{
const
nextConfig
=
{
reactStrictMode
:
true
,
}
module
.
exports
=
nextConfig
examples/reproduction-template/next.config.js
View file @
78db3475
/** @type {import("next").NextConfig} */
module
.
exports
=
{
const
nextConfig
=
{
reactStrictMode
:
true
,
}
module
.
exports
=
nextConfig
lerna.json
View file @
78db3475
...
...
@@ -16,5 +16,5 @@
"registry"
:
"https://registry.npmjs.org/"
}
},
"version"
:
"14.0.4-canary.3
1
"
"version"
:
"14.0.4-canary.3
2
"
}
packages/create-next-app/package.json
View file @
78db3475
{
"name"
:
"create-next-app"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"keywords"
:
[
"react"
,
"next"
,
...
...
packages/eslint-config-next/package.json
View file @
78db3475
{
"name"
:
"eslint-config-next"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"description"
:
"ESLint configuration used by Next.js."
,
"main"
:
"index.js"
,
"license"
:
"MIT"
,
...
...
@@ -10,7 +10,7 @@
},
"homepage"
:
"https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config"
,
"dependencies"
:
{
"@next/eslint-plugin-next"
:
"14.0.4-canary.3
1
"
,
"@next/eslint-plugin-next"
:
"14.0.4-canary.3
2
"
,
"@rushstack/eslint-patch"
:
"^1.3.3"
,
"@typescript-eslint/parser"
:
"^5.4.2 || ^6.0.0"
,
"eslint-import-resolver-node"
:
"^0.3.6"
,
...
...
packages/eslint-plugin-next/package.json
View file @
78db3475
{
"name"
:
"@next/eslint-plugin-next"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"description"
:
"ESLint plugin for Next.js."
,
"main"
:
"dist/index.js"
,
"license"
:
"MIT"
,
...
...
packages/font/package.json
View file @
78db3475
{
"name"
:
"@next/font"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"repository"
:
{
"url"
:
"vercel/next.js"
,
"directory"
:
"packages/font"
...
...
packages/next-bundle-analyzer/package.json
View file @
78db3475
{
"name"
:
"@next/bundle-analyzer"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"main"
:
"index.js"
,
"types"
:
"index.d.ts"
,
"license"
:
"MIT"
,
...
...
packages/next-codemod/package.json
View file @
78db3475
{
"name"
:
"@next/codemod"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"license"
:
"MIT"
,
"repository"
:
{
"type"
:
"git"
,
...
...
packages/next-env/package.json
View file @
78db3475
{
"name"
:
"@next/env"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"keywords"
:
[
"react"
,
"next"
,
...
...
packages/next-mdx/package.json
View file @
78db3475
{
"name"
:
"@next/mdx"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"main"
:
"index.js"
,
"license"
:
"MIT"
,
"repository"
:
{
...
...
packages/next-plugin-storybook/package.json
View file @
78db3475
{
"name"
:
"@next/plugin-storybook"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"repository"
:
{
"url"
:
"vercel/next.js"
,
"directory"
:
"packages/next-plugin-storybook"
...
...
packages/next-polyfill-module/package.json
View file @
78db3475
{
"name"
:
"@next/polyfill-module"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"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"
,
...
...
packages/next-polyfill-nomodule/package.json
View file @
78db3475
{
"name"
:
"@next/polyfill-nomodule"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"description"
:
"A polyfill for non-dead, nomodule browsers."
,
"main"
:
"dist/polyfill-nomodule.js"
,
"license"
:
"MIT"
,
...
...
packages/next-swc/package.json
View file @
78db3475
{
"name"
:
"@next/swc"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"private"
:
true
,
"scripts"
:
{
"clean"
:
"node ../../scripts/rm.mjs native"
,
...
...
packages/next/package.json
View file @
78db3475
{
"name"
:
"next"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"description"
:
"The React Framework"
,
"main"
:
"./dist/server/next.js"
,
"license"
:
"MIT"
,
...
...
@@ -92,7 +92,7 @@
]
},
"dependencies"
:
{
"@next/env"
:
"14.0.4-canary.3
1
"
,
"@next/env"
:
"14.0.4-canary.3
2
"
,
"@swc/helpers"
:
"0.5.2"
,
"busboy"
:
"1.6.0"
,
"caniuse-lite"
:
"^1.0.30001406"
,
...
...
@@ -147,11 +147,11 @@
"@mswjs/interceptors"
:
"0.23.0"
,
"@napi-rs/cli"
:
"2.16.2"
,
"@napi-rs/triples"
:
"1.1.0"
,
"@next/polyfill-module"
:
"14.0.4-canary.3
1
"
,
"@next/polyfill-nomodule"
:
"14.0.4-canary.3
1
"
,
"@next/react-dev-overlay"
:
"14.0.4-canary.3
1
"
,
"@next/react-refresh-utils"
:
"14.0.4-canary.3
1
"
,
"@next/swc"
:
"14.0.4-canary.3
1
"
,
"@next/polyfill-module"
:
"14.0.4-canary.3
2
"
,
"@next/polyfill-nomodule"
:
"14.0.4-canary.3
2
"
,
"@next/react-dev-overlay"
:
"14.0.4-canary.3
2
"
,
"@next/react-refresh-utils"
:
"14.0.4-canary.3
2
"
,
"@next/swc"
:
"14.0.4-canary.3
2
"
,
"@opentelemetry/api"
:
"1.6.0"
,
"@playwright/test"
:
"^1.35.1"
,
"@taskr/clear"
:
"1.1.0"
,
...
...
packages/next/src/build/webpack/plugins/next-types-plugin/index.ts
View file @
78db3475
...
...
@@ -15,6 +15,7 @@ import { isDynamicRoute } from '../../../../shared/lib/router/utils'
import
{
normalizeAppPath
}
from
'../../../../shared/lib/router/utils/app-paths'
import
{
getPageFromPath
}
from
'../../../entries'
import
{
devPageFiles
}
from
'./shared'
import
{
getProxiedPluginState
}
from
'../../../build-context'
const
PLUGIN_NAME
=
'NextTypesPlugin'
...
...
@@ -221,23 +222,23 @@ async function collectNamedSlots(layoutPath: string) {
// By exposing the static route types separately as string literals,
// editors can provide autocompletion for them. However it's currently not
// possible to provide the same experience for dynamic routes.
const
routeTypes
:
Record
<
'edge'
|
'node'
|
'extra'
,
Record
<
'static'
|
'dynamic'
,
string
>
>
=
{
edge
:
{
stat
ic
:
''
,
dynamic
:
''
,
},
node
:
{
stat
ic
:
''
,
dynamic
:
''
,
},
extra
:
{
stat
ic
:
''
,
dynamic
:
''
,
},
}
const
pluginState
=
getProxiedPluginState
({
routeTypes
:
{
edge
:
{
static
:
''
,
dynam
ic
:
''
,
}
,
node
:
{
static
:
''
,
dynam
ic
:
''
,
}
,
extra
:
{
static
:
''
,
dynam
ic
:
''
,
}
,
}
as
Record
<
'edge'
|
'node'
|
'extra'
,
Record
<
'static'
|
'dynamic'
,
string
>>
,
}
)
function
formatRouteToRouteType
(
route
:
string
)
{
const
isDynamic
=
isDynamicRoute
(
route
)
...
...
@@ -341,7 +342,8 @@ function addRedirectsRewritesRouteTypes(
for
(
const
normalizedRoute
of
possibleNormalizedRoutes
)
{
const
{
isDynamic
,
routeType
}
=
formatRouteToRouteType
(
normalizedRoute
)
routeTypes
.
extra
[
isDynamic
?
'dynamic'
:
'static'
]
+=
routeType
pluginState
.
routeTypes
.
extra
[
isDynamic
?
'dynamic'
:
'static'
]
+=
routeType
}
}
}
...
...
@@ -374,8 +376,8 @@ function createRouteDefinitions() {
let
dynamicRouteTypes
=
''
for
(
const
type
of
[
'edge'
,
'node'
,
'extra'
]
as
const
)
{
staticRouteTypes
+=
routeTypes
[
type
].
static
dynamicRouteTypes
+=
routeTypes
[
type
].
dynamic
staticRouteTypes
+=
pluginState
.
routeTypes
[
type
].
static
dynamicRouteTypes
+=
pluginState
.
routeTypes
[
type
].
dynamic
}
// If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string'.
...
...
@@ -578,7 +580,7 @@ export class NextTypesPlugin {
const
{
isDynamic
,
routeType
}
=
formatRouteToRouteType
(
route
)
routeTypes
[
this
.
isEdgeServer
?
'edge'
:
'node'
][
pluginState
.
routeTypes
[
this
.
isEdgeServer
?
'edge'
:
'node'
][
isDynamic
?
'dynamic'
:
'static'
]
+=
routeType
}
...
...
@@ -667,11 +669,11 @@ export class NextTypesPlugin {
// Clear routes
if
(
this
.
isEdgeServer
)
{
routeTypes
.
edge
.
dynamic
=
''
routeTypes
.
edge
.
static
=
''
pluginState
.
routeTypes
.
edge
.
dynamic
=
''
pluginState
.
routeTypes
.
edge
.
static
=
''
}
else
{
routeTypes
.
node
.
dynamic
=
''
routeTypes
.
node
.
static
=
''
pluginState
.
routeTypes
.
node
.
dynamic
=
''
pluginState
.
routeTypes
.
node
.
static
=
''
}
compilation
.
chunkGroups
.
forEach
((
chunkGroup
)
=>
{
...
...
packages/next/src/server/app-render/app-render.tsx
View file @
78db3475
...
...
@@ -658,7 +658,9 @@ async function renderToHTMLOrFlightImpl(
:
null
// Get the nonce from the incoming request if it has one.
const
csp
=
req
.
headers
[
'content-security-policy'
]
const
csp
=
req
.
headers
[
'content-security-policy'
]
||
req
.
headers
[
'content-security-policy-report-only'
]
let
nonce
:
string
|
undefined
if
(
csp
&&
typeof
csp
===
'string'
)
{
nonce
=
getScriptNonceFromHeader
(
csp
)
...
...
packages/next/src/server/config-shared.ts
View file @
78db3475
...
...
@@ -806,6 +806,7 @@ export const defaultConfig: NextConfig = {
process
.
env
.
__NEXT_EXPERIMENTAL_PPR
===
'true'
?
true
:
false
,
webpackBuildWorker
:
false
,
},
}
...
...
packages/next/src/server/lib/start-server.ts
View file @
78db3475
...
...
@@ -280,9 +280,11 @@ export async function startServer(
console
.
error
(
err
)
}
process
.
on
(
'exit'
,
(
code
)
=>
cleanup
(
code
))
// callback value is signal string, exit with 0
process
.
on
(
'SIGINT'
,
()
=>
cleanup
(
0
))
process
.
on
(
'SIGTERM'
,
()
=>
cleanup
(
0
))
if
(
!
process
.
env
.
NEXT_MANUAL_SIG_HANDLE
)
{
// callback value is signal string, exit with 0
process
.
on
(
'SIGINT'
,
()
=>
cleanup
(
0
))
process
.
on
(
'SIGTERM'
,
()
=>
cleanup
(
0
))
}
process
.
on
(
'rejectionHandled'
,
()
=>
{
// It is ok to await a Promise late in Next.js as it allows for better
// prefetching patterns to avoid waterfalls. We ignore loggining these.
...
...
packages/next/types/index.d.ts
View file @
78db3475
...
...
@@ -87,7 +87,7 @@ export type Redirect =
}
/**
* `Page` type, use it as a guide to create `pages`.
* `
Next
Page` type, use it as a guide to create `pages`.
*/
export
type
NextPage
<
Props
=
{},
InitialProps
=
Props
>
=
NextComponentType
<
NextPageContext
,
...
...
@@ -140,6 +140,11 @@ export type PageConfig = {
externalResolver
?:
true
}
env
?:
Array
<
string
>
/**
* Configures the longest time in seconds a serverless function can process an HTTP
* request before responding.
*/
maxDuration
?:
number
runtime
?:
ServerRuntime
unstable_runtimeJS
?:
false
unstable_JsPreload
?:
false
...
...
packages/react-dev-overlay/package.json
View file @
78db3475
{
"name"
:
"@next/react-dev-overlay"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"description"
:
"A development-only overlay for developing React applications."
,
"repository"
:
{
"url"
:
"vercel/next.js"
,
...
...
packages/react-refresh-utils/package.json
View file @
78db3475
{
"name"
:
"@next/react-refresh-utils"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"description"
:
"An experimental package providing utilities for React Refresh."
,
"repository"
:
{
"url"
:
"vercel/next.js"
,
...
...
packages/third-parties/package.json
View file @
78db3475
{
"name"
:
"@next/third-parties"
,
"version"
:
"14.0.4-canary.3
1
"
,
"version"
:
"14.0.4-canary.3
2
"
,
"repository"
:
{
"url"
:
"vercel/next.js"
,
"directory"
:
"packages/third-parties"
...
...
@@ -23,7 +23,7 @@
"third-party-capital"
:
"1.0.20"
},
"devDependencies"
:
{
"next"
:
"14.0.4-canary.3
1
"
,
"next"
:
"14.0.4-canary.3
2
"
,
"outdent"
:
"0.8.0"
,
"prettier"
:
"2.5.1"
},
...
...
pnpm-lock.yaml
View file @
78db3475
...
...
@@ -741,7 +741,7 @@ importers:
packages/eslint-config-next
:
dependencies
:
'
@next/eslint-plugin-next'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../eslint-plugin-next
'
@rushstack/eslint-patch'
:
specifier
:
^1.3.3
...
...
@@ -806,7 +806,7 @@ importers:
packages/next
:
dependencies
:
'
@next/env'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../next-env
'
@swc/helpers'
:
specifier
:
0.5.2
...
...
@@ -933,19 +933,19 @@ importers:
specifier
:
1.1.0
version
:
1.1.0
'
@next/polyfill-module'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../next-polyfill-module
'
@next/polyfill-nomodule'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../next-polyfill-nomodule
'
@next/react-dev-overlay'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../react-dev-overlay
'
@next/react-refresh-utils'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../react-refresh-utils
'
@next/swc'
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../next-swc
'
@opentelemetry/api'
:
specifier
:
1.6.0
...
...
@@ -1599,7 +1599,7 @@ importers:
version
:
1.0.20
devDependencies
:
next
:
specifier
:
14.0.4-canary.3
1
specifier
:
14.0.4-canary.3
2
version
:
link:../next
outdent
:
specifier
:
0.8.0
...
...
test/build-turbopack-tests-manifest.js
View file @
78db3475
...
...
@@ -24,21 +24,21 @@ const INITIALIZING_TEST_CASES = [
// please make sure this is sorted alphabetically when making changes.
const
SKIPPED_TEST_SUITES
=
{
'test/development/acceptance-app/ReactRefreshRegression.test.ts'
:
[
'ReactRefreshRegression app can fast refresh a page with dynamic rendering'
,
'ReactRefreshRegression app can fast refresh a page with config'
,
'ReactRefreshRegression app can fast refresh a page with dynamic rendering'
,
],
'test/development/acceptance-app/ReactRefreshRequire.test.ts'
:
[
'ReactRefreshRequire app re-runs accepted modules'
,
'ReactRefreshRequire app propagates a hot update to closest accepted module'
,
'ReactRefreshRequire app propagates hot update to all inverse dependencies'
,
'ReactRefreshRequire app re-runs accepted modules'
,
],
'test/development/acceptance/ReactRefreshLogBox.test.ts'
:
[
'ReactRefreshLogBox turbo conversion to class component (1)'
,
],
'test/development/acceptance/ReactRefreshRequire.test.ts'
:
[
'ReactRefreshRequire re-runs accepted modules'
,
'ReactRefreshRequire propagates a hot update to closest accepted module'
,
'ReactRefreshRequire propagates hot update to all inverse dependencies'
,
'ReactRefreshRequire re-runs accepted modules'
,
],
'test/development/basic/hmr.test.ts'
:
[
'basic HMR, basePath: "/docs" Error Recovery should show the error on all pages'
,
...
...
@@ -47,8 +47,16 @@ const SKIPPED_TEST_SUITES = {
/should automatically fast refresh content when path is added without error/
,
/should recover from module not found when paths is updated/
,
],
'test/development/middleware-errors/index.test.ts'
:
[
'middleware - development errors when there is a compilation error after boot logs the error correctly'
,
'middleware - development errors when there is a compilation error from boot logs the error correctly'
,
],
'test/development/tsconfig-path-reloading/index.test.ts'
:
[
/should automatically fast refresh content when path is added without error/
,
'tsconfig-path-reloading tsconfig added after starting dev should load with initial paths config correctly'
,
],
'test/e2e/app-dir/app-compilation/index.test.ts'
:
[
'app dir HMR should not cause error when removing loading.js'
,
],
'test/e2e/app-dir/app-css/index.test.ts'
:
[
'app dir - css css support server layouts should support external css imports'
,
...
...
@@ -68,6 +76,9 @@ const SKIPPED_TEST_SUITES = {
'basePath should 404 when manually adding basePath with router.push'
,
'basePath should 404 when manually adding basePath with router.replace'
,
],
'test/e2e/conflicting-app-page-error/index.test.ts'
:
[
'Conflict between app file and pages file should not show error overlay for non conflict pages under app or pages dir'
,
],
'test/e2e/middleware-rewrites/test/index.test.ts'
:
[
'Middleware Rewrite should have props for afterFiles rewrite to SSG page'
,
],
...
...
@@ -82,8 +93,8 @@ const SKIPPED_TEST_SUITES = {
'Document and App Client side should detect the changes to pages/_document.js and display it'
,
],
'test/integration/css/test/css-modules.test.js'
:
[
'CSS Modules Composes Ordering Development Mode should have correct color on index page (on nav from other)'
,
'CSS Modules Composes Ordering Development Mode should have correct color on index page (on nav from index)'
,
'CSS Modules Composes Ordering Development Mode should have correct color on index page (on nav from other)'
,
],
'test/integration/custom-error/test/index.test.js'
:
[
/Custom _error/
],
'test/integration/dynamic-routing/test/index.test.js'
:
[
...
...
@@ -96,13 +107,41 @@ const SKIPPED_TEST_SUITES = {
'Dynamic Routing production mode should output a routes-manifest correctly'
,
],
'test/integration/env-config/test/index.test.js'
:
[
'Env Config dev mode with hot reload should provide env for SSG'
,
'Env Config dev mode with hot reload should provide env correctly for SSR'
,
'Env Config dev mode with hot reload should provide env correctly for API routes'
,
'Env Config dev mode with hot reload should provide env correctly for SSR'
,
'Env Config dev mode with hot reload should provide env for SSG'
,
],
'test/integration/import-assertion/test/index.test.js'
:
[
/should handle json assertions/
,
],
'test/integration/next-image-legacy/unicode/test/index.test.ts'
:
[
/Image Component Unicode Image URL/
,
],
'test/integration/next-image-new/unicode/test/index.test.ts'
:
[
/Image Component Unicode Image URL/
,
],
}
function
checkSorted
(
arr
,
name
)
{
const
sorted
=
[...
arr
].
sort
()
if
(
JSON
.
stringify
(
arr
)
!==
JSON
.
stringify
(
sorted
))
{
console
.
log
(
`Expected order of
${
name
}
:`
)
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
===
sorted
[
i
])
{
console
.
log
(
`
${
arr
[
i
]}
`
)
}
else
{
console
.
log
(
bold
().
red
(
`-
${
arr
[
i
]}
`
))
console
.
log
(
bold
().
green
(
`+
${
sorted
[
i
]}
`
))
}
}
throw
new
Error
(
`
${
name
}
is not sorted`
)
}
}
checkSorted
(
Object
.
keys
(
SKIPPED_TEST_SUITES
),
'SKIPPED_TEST_SUITES'
)
for
(
const
[
key
,
value
]
of
Object
.
entries
(
SKIPPED_TEST_SUITES
))
{
checkSorted
(
value
,
`SKIPPED_TEST_SUITES['
${
key
}
']`
)
}
/**
...
...
@@ -234,7 +273,7 @@ async function updatePassingTests() {
if
(
skippedPassingNames
.
length
>
0
)
{
console
.
log
(
`
${
bold
().
red
(
filepath
)}
has
${
`
${
bold
().
yellow
(
filepath
)}
has
${
skippedPassingNames
.
length
}
passing tests that are marked as skipped:\n
${
skippedPassingNames
.
map
((
name
)
=>
` -
${
name
}
`
)
...
...
test/production/app-dir/subresource-integrity/subresource-integrity.test.ts
View file @
78db3475
...
...
@@ -9,18 +9,24 @@ createNextDescribe(
files
:
path
.
join
(
__dirname
,
'fixture'
),
},
({
next
})
=>
{
function
fetchWithPolicy
(
policy
:
string
|
null
)
{
function
fetchWithPolicy
(
policy
:
string
|
null
,
reportOnly
?:
boolean
)
{
const
cspKey
=
reportOnly
?
'Content-Security-Policy-Report-Only'
:
'Content-Security-Policy'
return
next
.
fetch
(
'/dashboard'
,
{
headers
:
policy
?
{
'Content-Security-Policy'
:
policy
,
[
cspKey
]
:
policy
,
}
:
{},
})
}
async
function
renderWithPolicy
(
policy
:
string
|
null
)
{
const
res
=
await
fetchWithPolicy
(
policy
)
async
function
renderWithPolicy
(
policy
:
string
|
null
,
reportOnly
?:
boolean
)
{
const
res
=
await
fetchWithPolicy
(
policy
,
reportOnly
)
expect
(
res
.
ok
).
toBe
(
true
)
...
...
@@ -78,6 +84,36 @@ createNextDescribe(
}
})
it
(
'includes a nonce value with inline scripts when Content-Security-Policy-Report-Only header is defined'
,
async
()
=>
{
// A random nonce value, base64 encoded.
const
nonce
=
'cmFuZG9tCg=='
// Validate all the cases where we could parse the nonce.
const
policies
=
[
`script-src 'nonce-
${
nonce
}
'`
,
// base case
` script-src 'nonce-
${
nonce
}
' `
,
// extra space added around sources and directive
`style-src 'self'; script-src 'nonce-
${
nonce
}
'`
,
// extra directives
`script-src 'self' 'nonce-
${
nonce
}
' 'nonce-othernonce'`
,
// extra nonces
`default-src 'nonce-othernonce'; script-src 'nonce-
${
nonce
}
';`
,
// script and then fallback case
`default-src 'nonce-
${
nonce
}
'`
,
// fallback case
]
for
(
const
policy
of
policies
)
{
const
$
=
await
renderWithPolicy
(
policy
,
true
)
// Find all the script tags without src attributes.
const
elements
=
$
(
'script:not([src])'
)
// Expect there to be at least 1 script tag without a src attribute.
expect
(
elements
.
length
).
toBeGreaterThan
(
0
)
// Expect all inline scripts to have the nonce value.
elements
.
each
((
i
,
el
)
=>
{
expect
(
el
.
attribs
[
'nonce'
]).
toBe
(
nonce
)
})
}
})
it
(
'includes a nonce value with bootstrap scripts when Content-Security-Policy header is defined'
,
async
()
=>
{
// A random nonce value, base64 encoded.
const
nonce
=
'cmFuZG9tCg=='
...
...
test/production/app-dir/typed-routes-with-webpack-worker/bad-routes/app/api/hello/route.ts
0 → 100755
View file @
78db3475
import
{
NextRequest
,
NextResponse
}
from
'next/server'
export
const
runtime
=
'edge'
export
async
function
GET
(
request
:
NextRequest
)
{
return
NextResponse
.
json
({
hello
:
'world'
})
}
test/production/app-dir/typed-routes-with-webpack-worker/bad-routes/app/layout.tsx
0 → 100644
View file @
78db3475
import
React
from
'react'
export
const
dynamic
=
'force-dynamic'
export
default
function
Root
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/production/app-dir/typed-routes-with-webpack-worker/bad-routes/app/page.tsx
0 → 100644
View file @
78db3475
import
Link
from
'next/link'
export
default
function
Home
()
{
return
(
<
main
>
<
Link
href=
"/asdfasdfasdf"
>
Hello, world!
</
Link
>
</
main
>
)
}
test/production/app-dir/typed-routes-with-webpack-worker/bad-routes/next.config.js
0 → 100644
View file @
78db3475
/** @type {import('next').NextConfig} */
module
.
exports
=
{
experimental
:
{
typedRoutes
:
true
,
webpackBuildWorker
:
true
,
},
}
test/production/app-dir/typed-routes-with-webpack-worker/good-routes/app/api/hello/route.ts
0 → 100755
View file @
78db3475
import
{
NextRequest
,
NextResponse
}
from
'next/server'
export
const
runtime
=
'edge'
export
async
function
GET
(
request
:
NextRequest
)
{
return
NextResponse
.
json
({
hello
:
'world'
})
}
test/production/app-dir/typed-routes-with-webpack-worker/good-routes/app/layout.tsx
0 → 100644
View file @
78db3475
import
React
from
'react'
export
const
dynamic
=
'force-dynamic'
export
default
function
Root
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/production/app-dir/typed-routes-with-webpack-worker/good-routes/app/page.tsx
0 → 100644
View file @
78db3475
import
Link
from
'next/link'
export
default
function
Home
()
{
return
(
<
main
>
<
Link
href=
"/"
>
Hello, world!
</
Link
>
</
main
>
)
}
test/production/app-dir/typed-routes-with-webpack-worker/good-routes/next.config.js
0 → 100644
View file @
78db3475
/** @type {import('next').NextConfig} */
module
.
exports
=
{
experimental
:
{
typedRoutes
:
true
,
webpackBuildWorker
:
true
,
},
}
test/production/app-dir/typed-routes-with-webpack-worker/typed-routes-with-webpack-worker.test.ts
0 → 100644
View file @
78db3475
import
{
nextBuild
}
from
'next-test-utils'
import
path
from
'path'
describe
(
'app dir - typed-routes-with-webpack-worker'
,
()
=>
{
it
(
'builds successfully without errors'
,
async
()
=>
{
const
output
=
await
nextBuild
(
path
.
join
(
__dirname
,
'good-routes'
),
undefined
,
{
stdout
:
true
,
stderr
:
true
,
}
)
// check for the experimental flag warning
expect
(
output
.
stdout
).
toContain
(
'webpackBuildWorker'
)
// should have a successful build
expect
(
output
.
code
).
toBe
(
0
)
// with no errors
expect
(
output
.
stderr
).
not
.
toContain
(
`"/" is not an existing route.`
)
})
it
(
'builds with valid errors'
,
async
()
=>
{
const
output
=
await
nextBuild
(
path
.
join
(
__dirname
,
'bad-routes'
),
undefined
,
{
stdout
:
true
,
stderr
:
true
,
}
)
// check for the experimental flag warning
expect
(
output
.
stdout
).
toContain
(
'webpackBuildWorker'
)
// should have a failed build
expect
(
output
.
code
).
toBe
(
1
)
// with correct error
expect
(
output
.
stderr
).
toContain
(
`"/asdfasdfasdf" is not an existing route.`
)
})
})
test/turbopack-tests-manifest.json
View file @
78db3475
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment