Skip to content

Commit

Permalink
Merge branch 'canary' into jrl-cancel-tests-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jul 26, 2023
2 parents 00c6c4c + 39fd917 commit 8f0d65e
Show file tree
Hide file tree
Showing 87 changed files with 966 additions and 618 deletions.
122 changes: 86 additions & 36 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ swc_core = { version = "0.79.22" }
testing = { version = "0.33.21" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230723.1" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230726.2" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230723.1" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230726.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230723.1" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230726.2" }

# General Deps

Expand Down Expand Up @@ -121,6 +121,7 @@ serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
serde_qs = "0.11.0"
serde_yaml = "0.9.17"
shadow-rs = { version = "0.23.0", default-features = false, features = ["tzdb"] }
syn = "1.0.107"
tempfile = "3.3.0"
thiserror = "1.0.38"
Expand Down
2 changes: 1 addition & 1 deletion docs/01-getting-started/01-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default function App({ Component, pageProps }) {

Finally, add a `_document.tsx` file inside `pages/` to control the initial response from the server. Learn more about the [custom Document file](/docs/pages/building-your-application/routing/custom-document).

```tsx filename="pages/_document.tsx"
```tsx filename="pages/_document.tsx" switcher
import { Html, Head, Main, NextScript } from 'next/document'

export default function Document() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ description: Learn about how to configure options for Next.js route segments.

The Route Segment options allows you configure the behavior of a [Page](/docs/app/building-your-application/routing/pages-and-layouts), [Layout](/docs/app/building-your-application/routing/pages-and-layouts), or [Route Handler](/docs/app/building-your-application/routing/router-handlers) by directly exporting the following variables:

| Option | Type | Default |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ---------- |
| [`dynamic`](#dynamic) | `'auto' \| 'force-dynamic' \| 'error' \| 'force-static'` | `'auto'` |
| [`dynamicParams`](#dynamicparams) | `boolean` | `true` |
| [`revalidate`](#revalidate) | `false \| 'force-cache' \| 0 \| number` | `false` |
| [`fetchCache`](#fetchcache) | `'auto' \| 'default-cache' \| 'only-cache' \| 'force-cache' \| 'force-no-store' \| 'default-no-store' \| 'only-no-store'` | `'auto'` |
| [`runtime`](#runtime) | `'nodejs' \| 'edge'` | `'nodejs'` |
| [`preferredRegion`](#preferredregion) | `'auto' \| 'global' \| 'home' \| string \| string[]` | `'auto'` |
| Option | Type | Default |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| [`dynamic`](#dynamic) | `'auto' \| 'force-dynamic' \| 'error' \| 'force-static'` | `'auto'` |
| [`dynamicParams`](#dynamicparams) | `boolean` | `true` |
| [`revalidate`](#revalidate) | `false \| 'force-cache' \| 0 \| number` | `false` |
| [`fetchCache`](#fetchcache) | `'auto' \| 'default-cache' \| 'only-cache' \| 'force-cache' \| 'force-no-store' \| 'default-no-store' \| 'only-no-store'` | `'auto'` |
| [`runtime`](#runtime) | `'nodejs' \| 'edge'` | `'nodejs'` |
| [`preferredRegion`](#preferredregion) | `'auto' \| 'global' \| 'home' \| string \| string[]` | `'auto'` |
| [`maxDuration`](#maxduration) | `number` | Set by deployment platform |

```tsx filename="layout.tsx / page.tsx / route.ts" switcher
export const dynamic = 'auto'
Expand All @@ -21,6 +22,7 @@ export const revalidate = false
export const fetchCache = 'auto'
export const runtime = 'nodejs'
export const preferredRegion = 'auto'
export const maxDuration = 5

export default function MyComponent() {}
```
Expand All @@ -32,6 +34,7 @@ export const revalidate = false
export const fetchCache = 'auto'
export const runtime = 'nodejs'
export const preferredRegion = 'auto'
export const maxDuration = 5

export default function MyComponent() {}
```
Expand Down Expand Up @@ -197,6 +200,24 @@ Support for `preferredRegion`, and regions supported, is dependent on your deplo
> - If a `preferredRegion` is not specified, it will inherit the option of the nearest parent layout.
> - The root layout defaults to `all` regions.
### `maxDuration`

Based on your deployment platform, you may be able to use a higher default execution time for your function.
This setting allows you to opt into a higher execution time within your plans limit.
**Note**: This settings requires Next.js `13.4.10` or higher.

```tsx filename="layout.tsx / page.tsx / route.ts" switcher
export const maxDuration = 5
```

```js filename="layout.js / page.js / route.js" switcher
export const maxDuration = 5
```

> **Good to know**:
>
> - If a `maxDuration` is not specified, the default value is dependent on your deployment platform and plan.
### `generateStaticParams`

The `generateStaticParams` function can be used in combination with [dynamic route segments](/docs/app/building-your-application/routing/dynamic-routes) to define the list of route segment parameters that will be statically generated at build time instead of on-demand at request time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Control page initialization and add a layout that persists for all

Next.js uses the `App` component to initialize pages. You can override it and control the page initialization and:

- Created a shared layout between page changes
- Create a shared layout between page changes
- Inject additional data into pages
- [Add global CSS](/docs/pages/building-your-application/styling)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import { useState, useEffect } from 'react'

function Profile() {
const [data, setData] = useState(null)
const [isLoading, setLoading] = useState(false)
const [isLoading, setLoading] = useState(true)

useEffect(() => {
setLoading(true)
fetch('/api/profile-data')
.then((res) => res.json())
.then((data) => {
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": "13.4.13-canary.0"
"version": "13.4.13-canary.3"
}
32 changes: 15 additions & 17 deletions packages/create-next-app/create-app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable import/no-extraneous-dependencies */
import retry from 'async-retry'
import chalk from 'chalk'
import { red, green, cyan } from 'picocolors'
import fs from 'fs'
import path from 'path'
import {
Expand Down Expand Up @@ -76,7 +76,7 @@ export async function createApp({
if (repoUrl) {
if (repoUrl.origin !== 'https://github.com') {
console.error(
`Invalid URL: ${chalk.red(
`Invalid URL: ${red(
`"${example}"`
)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`
)
Expand All @@ -87,7 +87,7 @@ export async function createApp({

if (!repoInfo) {
console.error(
`Found invalid GitHub URL: ${chalk.red(
`Found invalid GitHub URL: ${red(
`"${example}"`
)}. Please fix the URL and try again.`
)
Expand All @@ -98,7 +98,7 @@ export async function createApp({

if (!found) {
console.error(
`Could not locate the repository for ${chalk.red(
`Could not locate the repository for ${red(
`"${example}"`
)}. Please check that the repository exists and try again.`
)
Expand All @@ -109,10 +109,10 @@ export async function createApp({

if (!found) {
console.error(
`Could not locate an example named ${chalk.red(
`Could not locate an example named ${red(
`"${example}"`
)}. It could be due to the following:\n`,
`1. Your spelling of example ${chalk.red(
`1. Your spelling of example ${red(
`"${example}"`
)} might be incorrect.\n`,
`2. You might not be connected to the internet or you are behind a proxy.`
Expand Down Expand Up @@ -145,7 +145,7 @@ export async function createApp({
const isOnline = !useYarn || (await getOnline())
const originalDirectory = process.cwd()

console.log(`Creating a new Next.js app in ${chalk.green(root)}.`)
console.log(`Creating a new Next.js app in ${green(root)}.`)
console.log()

process.chdir(root)
Expand All @@ -161,7 +161,7 @@ export async function createApp({
if (repoInfo) {
const repoInfo2 = repoInfo
console.log(
`Downloading files from repo ${chalk.cyan(
`Downloading files from repo ${cyan(
example
)}. This might take a moment.`
)
Expand All @@ -171,7 +171,7 @@ export async function createApp({
})
} else {
console.log(
`Downloading files for example ${chalk.cyan(
`Downloading files for example ${cyan(
example
)}. This might take a moment.`
)
Expand Down Expand Up @@ -249,26 +249,24 @@ export async function createApp({
cdpath = appPath
}

console.log(`${chalk.green('Success!')} Created ${appName} at ${appPath}`)
console.log(`${green('Success!')} Created ${appName} at ${appPath}`)

if (hasPackageJson) {
console.log('Inside that directory, you can run several commands:')
console.log()
console.log(chalk.cyan(` ${packageManager} ${useYarn ? '' : 'run '}dev`))
console.log(cyan(` ${packageManager} ${useYarn ? '' : 'run '}dev`))
console.log(' Starts the development server.')
console.log()
console.log(chalk.cyan(` ${packageManager} ${useYarn ? '' : 'run '}build`))
console.log(cyan(` ${packageManager} ${useYarn ? '' : 'run '}build`))
console.log(' Builds the app for production.')
console.log()
console.log(chalk.cyan(` ${packageManager} start`))
console.log(cyan(` ${packageManager} start`))
console.log(' Runs the built app in production mode.')
console.log()
console.log('We suggest that you begin by typing:')
console.log()
console.log(chalk.cyan(' cd'), cdpath)
console.log(
` ${chalk.cyan(`${packageManager} ${useYarn ? '' : 'run '}dev`)}`
)
console.log(cyan(' cd'), cdpath)
console.log(` ${cyan(`${packageManager} ${useYarn ? '' : 'run '}dev`)}`)
}
console.log()
}
6 changes: 3 additions & 3 deletions packages/create-next-app/helpers/install.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import chalk from 'chalk'
import { yellow } from 'picocolors'
import spawn from 'cross-spawn'
import type { PackageManager } from './get-pkg-manager'

Expand Down Expand Up @@ -72,9 +72,9 @@ export function install(
*/
args = ['install']
if (!isOnline) {
console.log(chalk.yellow('You appear to be offline.'))
console.log(yellow('You appear to be offline.'))
if (useYarn) {
console.log(chalk.yellow('Falling back to the local Yarn cache.'))
console.log(yellow('Falling back to the local Yarn cache.'))
console.log()
args.push('--offline')
} else {
Expand Down
6 changes: 3 additions & 3 deletions packages/create-next-app/helpers/is-folder-empty.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import chalk from 'chalk'
import { green, blue } from 'picocolors'
import fs from 'fs'
import path from 'path'

Expand Down Expand Up @@ -35,14 +35,14 @@ export function isFolderEmpty(root: string, name: string): boolean {

if (conflicts.length > 0) {
console.log(
`The directory ${chalk.green(name)} contains files that could conflict:`
`The directory ${green(name)} contains files that could conflict:`
)
console.log()
for (const file of conflicts) {
try {
const stats = fs.lstatSync(path.join(root, file))
if (stats.isDirectory()) {
console.log(` ${chalk.blue(file)}/`)
console.log(` ${blue(file)}/`)
} else {
console.log(` ${file}`)
}
Expand Down
Loading

0 comments on commit 8f0d65e

Please sign in to comment.