Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/canary' into wbinnssmith/styled-…
Browse files Browse the repository at this point in the history
…string
  • Loading branch information
wbinnssmith committed Nov 14, 2023
2 parents cd5df91 + 82821c7 commit 3c0d456
Show file tree
Hide file tree
Showing 212 changed files with 1,668 additions and 838 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ jobs:
with:
fetch-depth: 25
- name: Install Vercel CLI
run: npm i -g vercel@28.16.15
run: npm i -g vercel@latest
- name: Deploy preview examples
if: ${{ needs.build.outputs.isRelease != 'true' }}
run: ./scripts/deploy-examples.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ On reload, Next.js will first try to render the unmatched slot's `default.js` fi
## `useSelectedLayoutSegment(s)`

Both [`useSelectedLayoutSegment`](/docs/app/api-reference/functions/use-selected-layout-segment) and [`useSelectedLayoutSegments`](/docs/app/api-reference/functions/use-selected-layout-segments) accept a `parallelRoutesKey`, which allows you read the active route segment within that slot.
Both [`useSelectedLayoutSegment`](/docs/app/api-reference/functions/use-selected-layout-segment) and [`useSelectedLayoutSegments`](/docs/app/api-reference/functions/use-selected-layout-segments) accept a `parallelRoutesKey`, which allows you to read the active route segment within that slot.

```tsx filename="app/layout.tsx" switcher
'use client'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ On the server, there are two runtimes where parts of your application code can b

There are many considerations to make when choosing a runtime. This table shows the major differences at a glance. If you want a more in-depth analysis of the differences, check out the sections below.

| | Node | Serverless | Edge |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | ---------------- |
| [Cold Boot](https://vercel.com/docs/concepts/get-started/compute#cold-and-hot-boots?utm_source=next-site&utm_medium=docs&utm_campaign=next-website) | / | ~250ms | Instant |
| [HTTP Streaming](/docs/app/building-your-application/routing/loading-ui-and-streaming) | Yes | Yes | Yes |
| IO | All | All | `fetch` |
| Scalability | / | High | Highest |
| Security | Normal | High | High |
| Latency | Normal | Low | Lowest |
| npm Packages | All | All | A smaller subset |
| [Static Rendering](/docs/app/building-your-application/rendering/server-components#static-rendering-default) | Yes | Yes | No |
| [Dynamic Rendering](/docs/app/building-your-application/rendering/server-components#dynamic-rendering) | Yes | Yes | Yes |
| [Data Revalidation w/ `fetch`](/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#revalidating-data) | Yes | Yes | Yes |
| | Node | Serverless | Edge |
| ------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | ---------------- |
| Cold Boot | / | Normal | Low |
| [HTTP Streaming](/docs/app/building-your-application/routing/loading-ui-and-streaming) | Yes | Yes | Yes |
| IO | All | All | `fetch` |
| Scalability | / | High | Highest |
| Security | Normal | High | High |
| Latency | Normal | Low | Lowest |
| npm Packages | All | All | A smaller subset |
| [Static Rendering](/docs/app/building-your-application/rendering/server-components#static-rendering-default) | Yes | Yes | No |
| [Dynamic Rendering](/docs/app/building-your-application/rendering/server-components#dynamic-rendering) | Yes | Yes | Yes |
| [Data Revalidation w/ `fetch`](/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#revalidating-data) | Yes | Yes | Yes |

### Edge Runtime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default function Component() {

**Good to know:**

- You can run code on server startup using the `[register` function](/docs/app/building-your-application/optimizing/instrumentation).
- You can run code on server startup using the [`register` function](/docs/app/building-your-application/optimizing/instrumentation).
- We do not recommend using the [runtimeConfig](/docs/pages/api-reference/next-config-js/runtime-configuration) option, as this does not work with the standalone output mode. Instead, we recommend [incrementally adopting](/docs/app/building-your-application/upgrading/app-router-migration) the App Router.

## Default Environment Variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,31 @@ export function middleware(request: NextRequest) {
block-all-mixed-content;
upgrade-insecure-requests;
`
// Replace newline characters and spaces
const contentSecurityPolicyHeaderValue = cspHeader
.replace(/\s{2,}/g, ' ')
.trim()

const requestHeaders = new Headers(request.headers)
requestHeaders.set('x-nonce', nonce)

requestHeaders.set(
'Content-Security-Policy',
// Replace newline characters and spaces
cspHeader.replace(/\s{2,}/g, ' ').trim()
contentSecurityPolicyHeaderValue
)

return NextResponse.next({
const response = NextResponse.next({
headers: requestHeaders,
request: {
headers: requestHeaders,
},
})
response.headers.set(
'Content-Security-Policy',
contentSecurityPolicyHeaderValue
)

return response
}
```

Expand All @@ -90,21 +100,30 @@ export function middleware(request) {
block-all-mixed-content;
upgrade-insecure-requests;
`
// Replace newline characters and spaces
const contentSecurityPolicyHeaderValue = cspHeader
.replace(/\s{2,}/g, ' ')
.trim()

const requestHeaders = new Headers(request.headers)
requestHeaders.set('x-nonce', nonce)
requestHeaders.set(
'Content-Security-Policy',
// Replace newline characters and spaces
cspHeader.replace(/\s{2,}/g, ' ').trim()
contentSecurityPolicyHeaderValue
)

return NextResponse.next({
const response = NextResponse.next({
headers: requestHeaders,
request: {
headers: requestHeaders,
},
})
response.headers.set(
'Content-Security-Policy',
contentSecurityPolicyHeaderValue
)

return response
}
```

Expand Down
7 changes: 0 additions & 7 deletions docs/03-pages/02-api-reference/02-functions/use-router.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,6 @@ export default function Page() {

### router.events

<details>
<summary>Examples</summary>

- [With a page loading indicator](https://github.com/vercel/next.js/tree/canary/examples/with-loading)

</details>

You can listen to different events happening inside the Next.js Router. Here's a list of supported events:

- `routeChangeStart(url, { shallow })` - Fires when a route starts to change
Expand Down
18 changes: 12 additions & 6 deletions examples/with-strict-csp/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,29 @@ export function middleware(request) {
block-all-mixed-content;
upgrade-insecure-requests;
`
// Replace newline characters and spaces
const contentSecurityPolicyHeaderValue = cspHeader
.replace(/\s{2,}/g, ' ')
.trim()

const requestHeaders = new Headers(request.headers)

// Setting request headers
requestHeaders.set('x-nonce', nonce)
requestHeaders.set(
'Content-Security-Policy',
// Replace newline characters and spaces
cspHeader.replace(/\s{2,}/g, ' ').trim()
contentSecurityPolicyHeaderValue
)

return NextResponse.next({
headers: requestHeaders,
const response = NextResponse.next({
request: {
headers: requestHeaders,
},
})
response.headers.set(
'Content-Security-Policy',
contentSecurityPolicyHeaderValue
)

return response
}

export const config = {
Expand Down
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.0.2"
"version": "14.0.3-canary.6"
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-canary-746890329-20231108",
"react-builtin": "npm:react@18.3.0-canary-0e352ea01-20231109",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-canary-746890329-20231108",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-746890329-20231108",
"react-experimental-builtin": "npm:react@0.0.0-experimental-746890329-20231108",
"react-server-dom-turbopack": "18.3.0-canary-746890329-20231108",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-746890329-20231108",
"react-server-dom-webpack": "18.3.0-canary-746890329-20231108",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-746890329-20231108",
"react-dom-builtin": "npm:react-dom@18.3.0-canary-0e352ea01-20231109",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-0e352ea01-20231109",
"react-experimental-builtin": "npm:react@0.0.0-experimental-0e352ea01-20231109",
"react-server-dom-turbopack": "18.3.0-canary-0e352ea01-20231109",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-0e352ea01-20231109",
"react-server-dom-webpack": "18.3.0-canary-0e352ea01-20231109",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-0e352ea01-20231109",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -212,8 +212,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.6",
"scheduler-builtin": "npm:scheduler@0.24.0-canary-746890329-20231108",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-746890329-20231108",
"scheduler-builtin": "npm:scheduler@0.24.0-canary-0e352ea01-20231109",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-0e352ea01-20231109",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
Expand Down
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.0.2",
"version": "14.0.3-canary.6",
"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.0.2",
"version": "14.0.3-canary.6",
"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.0.2",
"@next/eslint-plugin-next": "14.0.3-canary.6",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.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.0.2",
"version": "14.0.3-canary.6",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import * as path from 'path'
const url =
'https://nextjs.org/docs/messages/no-before-interactive-script-outside-document'

const startsWithUsingCorrectSeparators = (str: string, start: string) =>
[path.sep, path.posix.sep].some((sep) =>
str.startsWith(start.replace(/\//g, sep))
)
const convertToCorrectSeparator = (str: string) =>
str.replace(/[\\/]/g, path.sep)

export = defineRule({
meta: {
Expand All @@ -25,24 +23,17 @@ export = defineRule({

return {
'ImportDeclaration[source.value="next/script"] > ImportDefaultSpecifier'(
node
node: any
) {
scriptImportName = node.local.name
},
JSXOpeningElement(node) {
let pathname = context.getFilename()
const pathname = convertToCorrectSeparator(context.getFilename())

if (startsWithUsingCorrectSeparators(pathname, 'src/')) {
pathname = pathname.slice(4)
} else if (startsWithUsingCorrectSeparators(pathname, '/src/')) {
pathname = pathname.slice(5)
}
const isInAppDir = pathname.includes(`${path.sep}app${path.sep}`)

// This rule shouldn't fire in `app/`
if (
startsWithUsingCorrectSeparators(pathname, 'app/') ||
startsWithUsingCorrectSeparators(pathname, '/app/')
) {
if (isInAppDir) {
return
}

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.0.2",
"version": "14.0.3-canary.6",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
21 changes: 17 additions & 4 deletions packages/font/src/google/font-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@
"Borel": {
"weights": ["400"],
"styles": ["normal"],
"subsets": ["latin", "latin-ext"]
"subsets": ["latin", "latin-ext", "math", "symbols", "vietnamese"]
},
"Bowlby One": {
"weights": ["400"],
Expand Down Expand Up @@ -7638,7 +7638,7 @@
"Noto Sans Cypriot": {
"weights": ["400"],
"styles": ["normal"],
"subsets": ["cypriot"]
"subsets": ["cypriot", "latin", "latin-ext"]
},
"Noto Sans Cypro Minoan": {
"weights": ["400"],
Expand Down Expand Up @@ -8363,7 +8363,13 @@
"Noto Sans Meroitic": {
"weights": ["400"],
"styles": ["normal"],
"subsets": ["latin", "latin-ext", "meroitic"]
"subsets": [
"latin",
"latin-ext",
"meroitic",
"meroitic-cursive",
"meroitic-hieroglyphs"
]
},
"Noto Sans Miao": {
"weights": ["400"],
Expand Down Expand Up @@ -8787,7 +8793,14 @@
"Noto Sans Symbols 2": {
"weights": ["400"],
"styles": ["normal"],
"subsets": ["braille", "latin", "latin-ext", "mayan-numerals", "symbols"]
"subsets": [
"braille",
"latin",
"latin-ext",
"math",
"mayan-numerals",
"symbols"
]
},
"Noto Sans Syriac": {
"weights": [
Expand Down
14 changes: 10 additions & 4 deletions packages/font/src/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3226,7 +3226,7 @@ export declare function Borel<
preload?: boolean
fallback?: string[]
adjustFontFallback?: boolean
subsets?: Array<'latin' | 'latin-ext'>
subsets?: Array<'latin' | 'latin-ext' | 'math' | 'symbols' | 'vietnamese'>
}): T extends undefined ? NextFont : NextFontWithVariable
export declare function Bowlby_One<
T extends CssVariable | undefined = undefined
Expand Down Expand Up @@ -13785,7 +13785,7 @@ export declare function Noto_Sans_Cypriot<
preload?: boolean
fallback?: string[]
adjustFontFallback?: boolean
subsets?: Array<'cypriot'>
subsets?: Array<'cypriot' | 'latin' | 'latin-ext'>
}): T extends undefined ? NextFont : NextFontWithVariable
export declare function Noto_Sans_Cypro_Minoan<
T extends CssVariable | undefined = undefined
Expand Down Expand Up @@ -14739,7 +14739,13 @@ export declare function Noto_Sans_Meroitic<
preload?: boolean
fallback?: string[]
adjustFontFallback?: boolean
subsets?: Array<'latin' | 'latin-ext' | 'meroitic'>
subsets?: Array<
| 'latin'
| 'latin-ext'
| 'meroitic'
| 'meroitic-cursive'
| 'meroitic-hieroglyphs'
>
}): T extends undefined ? NextFont : NextFontWithVariable
export declare function Noto_Sans_Miao<
T extends CssVariable | undefined = undefined
Expand Down Expand Up @@ -15476,7 +15482,7 @@ export declare function Noto_Sans_Symbols_2<
fallback?: string[]
adjustFontFallback?: boolean
subsets?: Array<
'braille' | 'latin' | 'latin-ext' | 'mayan-numerals' | 'symbols'
'braille' | 'latin' | 'latin-ext' | 'math' | 'mayan-numerals' | 'symbols'
>
}): T extends undefined ? NextFont : NextFontWithVariable
export declare function Noto_Sans_Syriac<
Expand Down
Loading

0 comments on commit 3c0d456

Please sign in to comment.