Skip to content

Commit

Permalink
Merge branch 'canary' into fix/72152-updating-fetching-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelAndeloci authored Nov 4, 2024
2 parents 87c1428 + bc5443d commit 62ff14f
Show file tree
Hide file tree
Showing 180 changed files with 3,726 additions and 1,875 deletions.
46 changes: 20 additions & 26 deletions crates/next-core/src/next_font/google/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::cmp::Ordering;
use std::{cmp::Ordering, collections::BTreeSet};

use anyhow::{anyhow, bail, Context, Result};
use turbo_tasks::{FxIndexSet, RcStr};
Expand All @@ -15,12 +15,13 @@ pub(super) struct FontAxes {
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) enum FontAxesWeights {
Variable(Option<RcStr>),
Fixed(Vec<u16>),
// A list of fixed weights. Sorted in ascending order as a BTreeSet.
Fixed(BTreeSet<u16>),
}

impl Default for FontAxesWeights {
fn default() -> Self {
FontAxesWeights::Fixed(vec![])
FontAxesWeights::Fixed(Default::default())
}
}

Expand Down Expand Up @@ -104,7 +105,7 @@ pub(super) fn get_font_axes(
}

FontWeights::Fixed(weights) => Ok(FontAxes {
wght: FontAxesWeights::Fixed(weights.to_owned()),
wght: FontAxesWeights::Fixed(weights.iter().copied().collect()),
ital,
variable_axes: None,
}),
Expand Down Expand Up @@ -156,16 +157,12 @@ pub(super) fn get_stylesheet_url(

let weights = match &axes.wght {
FontAxesWeights::Variable(Some(wght)) => {
vec![VariantValue::String(wght.to_owned())]
vec![VariantValue::String(wght.clone())]
}
FontAxesWeights::Variable(None) => {
vec![]
}
FontAxesWeights::Fixed(wghts) => {
let mut wghts = wghts.clone();
wghts.sort();
wghts.iter().map(|w| VariantValue::U16(*w)).collect()
}
FontAxesWeights::Fixed(wghts) => wghts.iter().map(|w| VariantValue::U16(*w)).collect(),
};

if weights.is_empty() {
Expand Down Expand Up @@ -258,13 +255,8 @@ pub(super) fn get_stylesheet_url(

let mut variant_values = variants
.iter()
.map(|variant| {
variant
.iter()
.map(|pair| pair.1.clone())
.collect::<Vec<VariantValue>>()
})
.collect::<Vec<Vec<VariantValue>>>();
.map(|variant| variant.iter().map(|pair| &pair.1).collect::<Vec<_>>())
.collect::<Vec<Vec<_>>>();
variant_values.sort();

// An encoding of the series of sorted variant values, with variants delimited
Expand All @@ -274,11 +266,11 @@ pub(super) fn get_stylesheet_url(
.iter()
.map(|v| {
v.iter()
.map(|vv| std::convert::Into::<RcStr>::into(vv.clone()))
.collect::<Vec<RcStr>>()
.map(|vv| RcStr::from((*vv).clone()))
.collect::<Vec<_>>()
.join(",")
})
.collect::<Vec<String>>()
.collect::<Vec<_>>()
.join(";");

Ok(format!(
Expand All @@ -295,6 +287,8 @@ pub(super) fn get_stylesheet_url(

#[cfg(test)]
mod tests {
use std::collections::BTreeSet;

use anyhow::Result;
use turbo_tasks::fxindexset;
use turbo_tasks_fs::json::parse_json_with_source_context;
Expand Down Expand Up @@ -462,7 +456,7 @@ mod tests {
assert_eq!(
get_font_axes(&data, "Hind", &FontWeights::Fixed(vec![500]), &[], &None)?,
FontAxes {
wght: FontAxesWeights::Fixed(vec![500]),
wght: FontAxesWeights::Fixed(BTreeSet::from([500])),
..Default::default()
}
);
Expand All @@ -476,7 +470,7 @@ mod tests {
GOOGLE_FONTS_STYLESHEET_URL,
"Roboto Mono",
&FontAxes {
wght: FontAxesWeights::Fixed(vec![500]),
wght: FontAxesWeights::Fixed(BTreeSet::from([500])),
ital: fxindexset! {FontStyle::Normal},
variable_axes: None
},
Expand All @@ -495,7 +489,7 @@ mod tests {
GOOGLE_FONTS_STYLESHEET_URL,
"Roboto Serif",
&FontAxes {
wght: FontAxesWeights::Fixed(vec![500]),
wght: FontAxesWeights::Fixed(BTreeSet::from([500])),
ital: fxindexset! {FontStyle::Normal},
variable_axes: Some(vec![
("GRAD".into(), "-50..100".into()),
Expand All @@ -518,7 +512,7 @@ mod tests {
GOOGLE_FONTS_STYLESHEET_URL,
"Roboto Serif",
&FontAxes {
wght: FontAxesWeights::Fixed(vec![1000, 500, 200]),
wght: FontAxesWeights::Fixed(BTreeSet::from([1000, 500, 200])),
ital: fxindexset! {FontStyle::Normal},
variable_axes: None
},
Expand All @@ -537,7 +531,7 @@ mod tests {
GOOGLE_FONTS_STYLESHEET_URL,
"Roboto Serif",
&FontAxes {
wght: FontAxesWeights::Fixed(vec![500, 300]),
wght: FontAxesWeights::Fixed(BTreeSet::from([500, 300])),
ital: fxindexset! {FontStyle::Normal, FontStyle::Italic},
variable_axes: Some(vec![
("GRAD".into(), "-50..100".into()),
Expand Down Expand Up @@ -615,7 +609,7 @@ mod tests {
GOOGLE_FONTS_STYLESHEET_URL,
"Hind",
&FontAxes {
wght: FontAxesWeights::Fixed(vec![500]),
wght: FontAxesWeights::Fixed(BTreeSet::from([500])),
..Default::default()
},
"optional"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ export function UserProfile({ userId }) {

The Server Action will receive the `userId` argument, in addition to the form data:

```js filename="app/actions.js"
```ts filename="app/actions.ts" switcher
'use server'

export async function updateUser(userId: string, formData: FormData) {}
```

```js filename="app/actions.js" switcher
'use server'

export async function updateUser(userId, formData) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default function Page() {

## Importing Styles

Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/pages/building-your-application/styling/css-modules#global-styles) in your application, for example:
Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/pages/building-your-application/styling/css#global-styles) in your application, for example:

```css filename="styles/globals.css"
@tailwind base;
Expand Down
2 changes: 1 addition & 1 deletion docs/02-app/02-api-reference/01-directives/use-cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default Page() {
}
```

> This is recommended for applications that previously used the [`export const dynamic = "force-cache"`](/docs/app/building-your-application/caching#opting-out-1) option, and will ensure the entire route is prerendered.
> This is recommended for applications that previously used the [`export const dynamic = "force-static"`](/docs/app/api-reference/file-conventions/route-segment-config#dynamic) option, and will ensure the entire route is prerendered.
### Caching component output with `use cache`

Expand Down
6 changes: 3 additions & 3 deletions docs/02-app/02-api-reference/04-functions/cacheLife.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ module.exports = nextConfig

The example above caches for 14 days, checks for updates daily, and expires the cache after 14 days. You can then reference this profile throughout your application by its name:

```tsx filename="app/page.tsx" highlight={4}
```tsx filename="app/page.tsx" highlight={5}
'use cache'
import { unstable_cacheLife as cacheLife } from 'next/cache'

Expand Down Expand Up @@ -181,7 +181,7 @@ module.exports = nextConfig

For specific use cases, you can set a custom cache profile by passing an object to the `cacheLife` function:

```tsx filename="app/page.tsx" highlight={5-9}
```tsx filename="app/page.tsx" highlight={5-9} switcher
'use cache'
import { unstable_cacheLife as cacheLife } from 'next/cache'

Expand All @@ -196,7 +196,7 @@ export default async function Page() {
}
```

```jsx filename="app/page.js" highlight={5-9}
```jsx filename="app/page.js" highlight={5-9} switcher
'use cache'
import { unstable_cacheLife as cacheLife } from 'next/cache'

Expand Down
9 changes: 3 additions & 6 deletions docs/02-app/02-api-reference/04-functions/cacheTag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,8 @@ export async function Bookings({ type = 'haircut' }) {

You can use the data returned from an async function to tag the cache entry.

```tsx filename="app/components/bookings.tsx"
import {
unstable_cacheTag as cacheTag,
unstable_cacheLife as cacheLife,
} from 'next/cache'
```tsx filename="app/components/bookings.tsx" switcher
import { unstable_cacheTag as cacheTag } from 'next/cache'

interface BookingsProps {
type: string
Expand Down Expand Up @@ -182,7 +179,7 @@ export async function Bookings({ type = 'haircut' }) {

Using [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag), you can invalidate the cache for a specific tag when needed:

```tsx filename="app/actions.ts"
```tsx filename="app/actions.ts" switcher
'use server'

import { revalidateTag } from 'next/cache'
Expand Down
8 changes: 4 additions & 4 deletions docs/02-app/02-api-reference/04-functions/draft-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ related:

`draftMode` is an **async** function allows you to enable and disable [Draft Mode](/docs/app/building-your-application/configuring/draft-mode), as well as check if Draft Mode is enabled in a [Server Component](/docs/app/building-your-application/rendering/server-components).

```tsx filename="app/page.ts"
```tsx filename="app/page.ts" switcher
import { draftMode } from 'next/headers'

export default async function Page() {
const { isEnabled } = await draftMode()
}
```

```jsx filename="app/page.js"
```jsx filename="app/page.js" switcher
import { draftMode } from 'next/headers'

export default async function Page() {
Expand Down Expand Up @@ -101,7 +101,7 @@ Then, send a request to invoke the Route Handler. If calling the route using the

You can check if Draft Mode is enabled in a Server Component with the `isEnabled` property:

```tsx filename="app/page.ts"
```tsx filename="app/page.ts" switcher
import { draftMode } from 'next/headers'

export default async function Page() {
Expand All @@ -115,7 +115,7 @@ export default async function Page() {
}
```

```jsx filename="app/page.js"
```jsx filename="app/page.js" switcher
import { draftMode } from 'next/headers'

export default async function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/02-app/02-api-reference/05-next-config-js/webpack.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Before continuing to add custom webpack configuration to your application make s
<PagesOnly>

- [CSS imports](/docs/pages/building-your-application/styling)
- [CSS modules](/docs/pages/building-your-application/styling/css-modules)
- [CSS modules](/docs/pages/building-your-application/styling/css)
- [Sass/SCSS imports](/docs/pages/building-your-application/styling/sass)
- [Sass/SCSS modules](/docs/pages/building-your-application/styling/sass)
- [Customizing babel configuration](/docs/pages/building-your-application/configuring/babel)
Expand Down
2 changes: 1 addition & 1 deletion docs/02-app/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You can use [`redirect`](/docs/app/api-reference/functions/redirect) to redirect

Here are some common authentication solutions that support the App Router:

- [NextAuth.js](https://next-auth.js.org/configuration/nextjs#in-app-router)
- [NextAuth.js](https://authjs.dev/getting-started/installation?framework=next.js)
- [Clerk](https://clerk.com/docs/quickstarts/nextjs)
- [Stack Auth](https://docs.stack-auth.com/getting-started/setup)
- [Auth0](https://github.com/auth0/nextjs-auth0#app-router)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: CSS Modules
description: Style your Next.js Application using CSS Modules.
title: CSS
description: Style your Next.js Application using CSS.
source: app/building-your-application/styling/css
---

Expand Down
4 changes: 2 additions & 2 deletions errors/css-global.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Global CSS cannot be used in files other than your [custom `_app.js` file](/docs
There are two possible ways to fix this error:

- Move all global CSS imports to your [`pages/_app.js` file](/docs/pages/building-your-application/routing/custom-app).
- If you do not wish your stylesheet to be global, update it to use [CSS Modules](/docs/pages/building-your-application/styling/css-modules). This will allow you to import the stylesheet and scope the styles to a specific component.
- If you do not wish your stylesheet to be global, update it to use [CSS Modules](/docs/pages/building-your-application/styling/css). This will allow you to import the stylesheet and scope the styles to a specific component.

#### Example

Consider the stylesheet named [`styles.css`](/docs/pages/building-your-application/styling/css-modules)
Consider the stylesheet named [`styles.css`](/docs/pages/building-your-application/styling/css)

```css filename="styles.css"
body {
Expand Down
4 changes: 2 additions & 2 deletions examples/reproduction-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"dependencies": {
"next": "canary",
"react": "19.0.0-rc-603e6108-20241029",
"react-dom": "19.0.0-rc-603e6108-20241029"
"react": "19.0.0-rc-7c8e5e7a-20241101",
"react-dom": "19.0.0-rc-7c8e5e7a-20241101"
},
"devDependencies": {
"@types/node": "20.12.12",
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": "15.0.3-canary.3"
"version": "15.0.3-canary.5"
}
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@
"pretty-bytes": "5.3.0",
"pretty-ms": "7.0.0",
"random-seed": "0.3.0",
"react": "19.0.0-rc-603e6108-20241029",
"react": "19.0.0-rc-7c8e5e7a-20241101",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@19.0.0-rc-603e6108-20241029",
"react-dom": "19.0.0-rc-603e6108-20241029",
"react-builtin": "npm:react@19.0.0-rc-7c8e5e7a-20241101",
"react-dom": "19.0.0-rc-7c8e5e7a-20241101",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@19.0.0-rc-603e6108-20241029",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-603e6108-20241029",
"react-experimental-builtin": "npm:react@0.0.0-experimental-603e6108-20241029",
"react-is-builtin": "npm:react-is@19.0.0-rc-603e6108-20241029",
"react-server-dom-turbopack": "19.0.0-rc-603e6108-20241029",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-603e6108-20241029",
"react-server-dom-webpack": "19.0.0-rc-603e6108-20241029",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-603e6108-20241029",
"react-dom-builtin": "npm:react-dom@19.0.0-rc-7c8e5e7a-20241101",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-7c8e5e7a-20241101",
"react-experimental-builtin": "npm:react@0.0.0-experimental-7c8e5e7a-20241101",
"react-is-builtin": "npm:react-is@19.0.0-rc-7c8e5e7a-20241101",
"react-server-dom-turbopack": "19.0.0-rc-7c8e5e7a-20241101",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-7c8e5e7a-20241101",
"react-server-dom-webpack": "19.0.0-rc-7c8e5e7a-20241101",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-7c8e5e7a-20241101",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -231,8 +231,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.9",
"scheduler-builtin": "npm:scheduler@0.25.0-rc-603e6108-20241029",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-603e6108-20241029",
"scheduler-builtin": "npm:scheduler@0.25.0-rc-7c8e5e7a-20241101",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-7c8e5e7a-20241101",
"seedrandom": "3.0.5",
"semver": "7.3.7",
"shell-quote": "1.7.3",
Expand Down Expand Up @@ -272,10 +272,10 @@
"@babel/traverse": "7.22.5",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
"react": "19.0.0-rc-603e6108-20241029",
"react-dom": "19.0.0-rc-603e6108-20241029",
"react-is": "19.0.0-rc-603e6108-20241029",
"scheduler": "0.25.0-rc-603e6108-20241029"
"react": "19.0.0-rc-7c8e5e7a-20241101",
"react-dom": "19.0.0-rc-7c8e5e7a-20241101",
"react-is": "19.0.0-rc-7c8e5e7a-20241101",
"scheduler": "0.25.0-rc-7c8e5e7a-20241101"
},
"patchedDependencies": {
"webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch"
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": "15.0.3-canary.3",
"version": "15.0.3-canary.5",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { GetTemplateFileArgs, InstallTemplateArgs } from "./types";

// Do not rename or format. sync-react script relies on this line.
// prettier-ignore
const nextjsReactPeerVersion = "19.0.0-rc-603e6108-20241029";
const nextjsReactPeerVersion = "19.0.0-rc-7c8e5e7a-20241101";

/**
* Get the file path for a given file in a template, e.g. "next.config.js".
Expand Down
Loading

0 comments on commit 62ff14f

Please sign in to comment.