Commit graph

1643 commits

Author SHA1 Message Date
Delba de Oliveira
1cafeb4102
Docs: Update confusing wording in intercepting routes (#53854)
Fixes: https://github.com/vercel/next.js/issues/53787
2023-08-11 08:59:03 +00:00
Colin McDonnell
7e16538485
Include instructions for bun package manager (#53590)
## For Contributors

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### What?

Add instructions for using `bun/bunx` where relevant. I only added mentions where npm/yarn/pnpm were all already listed. 

### Why

Bun can be used as a runtime-agnostic [package manager](https://bun.sh/package-manager) and script runner in any project with a `package.json`.

(Sorry, I probably should have consolidated this with https://github.com/vercel/next.js/pull/53467)

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-10 23:44:20 +00:00
Steven
2cf5d3a8aa
chore(docs): note cache-control header for preview/draft mode (#53825)
You can technically get similar ISR behavior setting the `Cache-Control` in `getServerSideProps()`, but this won't be automatically bypassed when enabling Preview Mode or Draft Mode so this PR adds that to the documentation.

x-ref: [slack discussion](https://vercel.slack.com/archives/C03S8ED1DKM/p1691514209722429)
2023-08-10 14:05:54 +00:00
Lee Robinson
1286e145b0
docs: Opting out of scrolling with next/link and useRouter. (#53804)
Addressing comments from https://github.com/vercel/next.js/issues/49087.
Introduced with https://github.com/vercel/next.js/pull/51869.
Related https://github.com/vercel/next.js/issues/50105.

This PR adds documentation for `next/link` and useRouter` about how to disable scroll restoration.
2023-08-10 09:41:56 +00:00
Steven
89be8c4b35
chore(docs): add missing "try it out" (#53815)
Follow up to https://github.com/vercel/next.js/pull/53760

This follows the same pattern as other demo links on this page.
2023-08-10 00:30:56 +00:00
Lucas Constantino Silva
0350e00d0d
docs: document cache tagging mechanism (#53806)
This PR document the cache tagging semantics in Next.js, and how to benefit from it during cache revalidation.
2023-08-09 23:18:02 +00:00
Lee Robinson
3077a0e9ff
docs: Add more information about Server Actions (#53805)
A few helpful additions based on conversations I've had recently.
2023-08-09 15:48:24 +00:00
Steven
87301834b3
chore: add light/dark mode theme detection to image component example (#53760)
This PR adds documentation for light/dark mode detection with `next/image`.

In the future, we could also document the picture solution once https://github.com/vercel/next.js/pull/51205 goes stable (although some of the preloading would not be possible).

* x-ref: https://twitter.com/victorbayas/status/1688596439704780822
2023-08-09 14:55:42 +00:00
Delba de Oliveira
8e0d108836
Docs: Add option for fetching data using route handlers - from the client (#53793)
In the data fetching page, we discuss the different ways you can fetch data in Next.js. This PR adds a fourth option which is to call route handlers from client components. I've also added a note that you shouldn't call a route handler from a server component. 

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-08-09 13:55:44 +00:00
Emilien Kenler
64d9475f37
Fix typo in data fetching documentation (#53772)
Fix a typo in data fetching documentation.
2023-08-09 04:45:49 +00:00
MrAdib
2566d0781d
Fix a link in incrementalCacheHandlerPath.mdx (#53718)
fix the default cache handler link
2023-08-09 00:55:13 +00:00
Jude Gao
de0ff6fd59
Fix doc grammatical errors (#53672)
### Improving Documentation

- Ran `pnpm prettier-fix`
2023-08-07 16:24:42 +00:00
Shen Lu
0363cef4c0
Fix: missing equal sign (#53650)
Missing an equal sign in Image docs

1e02a92a94/docs/02-app/02-api-reference/01-components/image.mdx (L690)
2023-08-07 01:52:37 +00:00
Martín Stanicio
3e637cab8c
fix typo in image.mdx (#53638)
Fixed a typo in the api reference about the [\<Image\> component](https://nextjs.org/docs/pages/api-reference/components/image#fill).

Replaced "stetch" with "stretch" in the fourth paragraph
2023-08-06 20:56:02 +00:00
Tomoya Kashifuku
5f9d2c55ca
docs: fix the link to another document (#53599)
The link used to be "https://github.com/acdlite/rfcs/blob/first-class-promises/text/0000-first-class-support-for-promises" but actually "https://github.com/acdlite/rfcs/blob/first-class-promises/text/0000-first-class-support-for-promises.md" is correct (needs ".md" at the end)
2023-08-05 17:06:21 +00:00
vinay
081151fed1
(Docs) Remove appDir from experimental flag in mdx configuration docs. (#53610)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-08-05 10:14:00 -04:00
Lee Robinson
b7aa7d4aa4
docs: fix typo on caching page (#53597)
- reduce: `MISS`
- reduces: `HIT`
2023-08-04 23:55:20 +00:00
Steven
acf5e84556
chore(docs): update static exports documentation with missing info (#53592)
- Related to https://github.com/vercel/next.js/issues/48022
2023-08-04 22:16:59 +00:00
William Li
aac4d9c3f7
use import type to import from 'next' in ts examples (#53568)
Updates typescript examples in https://nextjs.org/docs/app/building-your-application/optimizing/metadata#static-metadata to use `import type` instead of `import`.

![CleanShot 2023-08-04 at 17 28 12](https://github.com/vercel/next.js/assets/179761/d14503a4-1453-4f8f-95de-9d40ad1917ef)
2023-08-04 20:30:09 +00:00
José Olórtegui
49d4f8af3b
docs: update webhook snippet for cache revalidation (#53585)
This PR updates cache revalidation snippets in the docs. It seems that `res` should not be there since you can't find it anywhere in the snippet so I suppose that the intent was to use `NextResponse` instead. Another thing is that now we're checking the existence of the params so typescript doesn't get mad at us. And last I changed the methods to `POST` since AFAIK webhooks normally use the `POST` method.

Please let me know if there's anything left to do on my side.

Have a great day!

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-04 20:22:02 +00:00
Michal Landsman
4b13d80744
doc: styled-components has stable version (#53539)
replace rc.1 by stable version

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-04 19:08:08 +00:00
Colin McDonnell
57ce466502
Add --use-bun to create-next-app (#53467)
This adds support for `--use-bun` to `create-next-app` to use `bun
install` when bootstrapping a new project.

```
npx create-next-app --use-bun
```

As with Yarn and pnpm, it reads from `npm_config_user_agent` to
determine if the user ran `bunx create-next-app`. If so, it defaults to
using Bun.

```sh
bunx create-next-app
```

## For Contributors

### Improving Documentation

- [x] Run `pnpm prettier-fix`
- [x] `pnpm build && pnpm lint` 
- [x] Added test to
`test/integration/create-next-app/package-manager.test.ts`

---------
2023-08-03 18:00:38 -07:00
Balázs Orbán
9477b61b51
fix(next): clarify fetch polyfill, drop node-fetch (#53548)
### What?

Fix documentation about `fetch` polyfilling, and drop `node-fetch` references.

### Why?

Since we stopped using `node-fetch` in `next` in favor of `undici` there were some inconsistencies in the docs, and unused references to the `node-fetch` package inside `packages/next`-


Noted this while answering this [Slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1691089801007129)
2023-08-03 23:12:26 +00:00
Noam Honig
bf9c65f8d9
docs: fix force-dynamic example (#53521)
fixed force dynamic example

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-08-03 18:57:43 -04:00
Robert Bradford
f08d42d533
docs: Fix typo and link in 02-app-router-migration.mdx (#53537)
Fixes a typo and a missing closing parenthesis on a link.
2023-08-03 22:50:01 +00:00
Jakub Naskręski
754a2a6ad8
docs: Remove duplicate backtick in next/font (#53520)
Fixed duplicate backtick in
[adjustFontFallback](https://nextjs.org/docs/pages/api-reference/components/font#adjustfontfallback:~:text=false%3A%20for-,%60%60next/font/google%60,-adjustFontFallback%3A%20%27Times%20New)
API docs.
2023-08-03 16:56:54 -04:00
Jacob Pargin
e30f6f4530
Fix markdown for caching doc link (#53536)
☝️  Just that!
2023-08-03 17:11:37 +00:00
OJ Kwon
630c41cd92
feat(next): next info --verbose for additional details (#53181)
### What?

First phase implementation for WEB-1313.

This PR expands existing `next info` features by adding new flag `--run-diags`. When this flag is supplied, next.js will try to collect more information. Primarily informations are related to next-swc installation to see if it's possible to diagnose why next-swc cannot be loaded on certain systems. It is not a definitive list - depends on the findings we may increase more items to collect.

These are the list of status included in the output

- Host info: CI / WSL / Docker
- Next.js installation: node, pkg mger version, next.js pkg
- Partial Node.js diagnostics report: `header, javascriptHeap, sharedObjects`
- next-swc installation: check if installed next-swc can be loaded
- (Mac os only) next-swc shared object dependencies: using `otool` or `dyld_info` to collect binary dependencies. Linux / Windows support will follow later.

Below's an example generated report, expect user to attach into issue if there are failures. 

<details>

```
### Host system information


  WSL: false
  Docker: false
  CI: false


### Next.js installation


  Binaries:
    Node: 18.11.0
    npm: 8.19.2
    Yarn: N/A
    pnpm: 7.24.3
  Relevant Packages:
    next: 13.4.13-canary.1
    eslint-config-next: 13.4.13-canary.1
    react: 18.2.0
    react-dom: 18.2.0
    typescript: 5.1.3
  Next.js Config:
    output: N/A



### Node.js diagnostic report

{
  "header": {
    "reportVersion": 2,
    "event": "JavaScript API",
    "trigger": "GetReport",
    "filename": null,
    "dumpEventTime": "2023-07-25T14:13:32Z",
    "dumpEventTimeStamp": "1690319612854",
    "processId": 33203,
    "threadId": 0,
    "nodejsVersion": "v18.11.0",
    "wordSize": 64,
    "arch": "arm64",
    "platform": "darwin",
    "componentVersions": {
      "node": "18.11.0",
      "v8": "10.2.154.15-node.12",
      "uv": "1.43.0",
      "zlib": "1.2.11",
      "brotli": "1.0.9",
      "ares": "1.18.1",
      "modules": "108",
      "nghttp2": "1.47.0",
      "napi": "8",
      "llhttp": "6.0.10",
      "openssl": "3.0.5+quic",
      "cldr": "41.0",
      "icu": "71.1",
      "tz": "2022b",
      "unicode": "14.0",
      "ngtcp2": "0.8.1",
      "nghttp3": "0.7.0"
    },
    "release": {
      "name": "node",
      "headersUrl": "https://nodejs.org/download/release/v18.11.0/node-v18.11.0-headers.tar.gz",
      "sourceUrl": "https://nodejs.org/download/release/v18.11.0/node-v18.11.0.tar.gz"
    },
    "osName": "Darwin",
    "osRelease": "22.5.0",
    "osVersion": "Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000",
    "osMachine": "arm64"
  },
  "javascriptHeap": {
    "totalMemory": 25624576,
    "executableMemory": 1048576,
    "totalCommittedMemory": 23543808,
    "availableMemory": 4324923368,
    "totalGlobalHandlesMemory": 16384,
    "usedGlobalHandlesMemory": 8384,
    "usedMemory": 20296720,
    "memoryLimit": 4345298944,
    "mallocedMemory": 1431256,
    "externalMemory": 1450294,
    "peakMallocedMemory": 6525792,
    "nativeContextCount": 1,
    "detachedContextCount": 0,
    "doesZapGarbage": 0,
    "heapSpaces": {
      "read_only_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 0,
        "used": 0,
        "available": 0
      },
      "old_space": {
        "memorySize": 8994816,
        "committedMemory": 9175040,
        "capacity": 8830992,
        "used": 8829704,
        "available": 1288
      },
      "code_space": {
        "memorySize": 966656,
        "committedMemory": 917504,
        "capacity": 765440,
        "used": 762496,
        "available": 2944
      },
      "map_space": {
        "memorySize": 802816,
        "committedMemory": 1048576,
        "capacity": 773376,
        "used": 773264,
        "available": 112
      },
      "large_object_space": {
        "memorySize": 6094848,
        "committedMemory": 6094848,
        "capacity": 6056016,
        "used": 6056016,
        "available": 0
      },
      "code_large_object_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 0,
        "used": 0,
        "available": 0
      },
      "new_large_object_space": {
        "memorySize": 376832,
        "committedMemory": 376832,
        "capacity": 4995992,
        "used": 351088,
        "available": 4644904
      },
      "new_space": {
        "memorySize": 8388608,
        "committedMemory": 5931008,
        "capacity": 4123904,
        "used": 3524152,
        "available": 599752
      }
    }
  },
  "sharedObjects": [
    "/Users/ojkwon/Library/Application Support/fnm/node-versions/v18.11.0/installation/bin/node",
    "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation",
    "/usr/lib/libobjc.A.dylib",
    "/System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal",
    "/usr/lib/liboah.dylib",
    "/usr/lib/libfakelink.dylib",
    "/usr/lib/libicucore.A.dylib",
    "/usr/lib/libSystem.B.dylib",
    "/System/Library/PrivateFrameworks/SoftLinking.framework/Versions/A/SoftLinking",
    "/usr/lib/libc++abi.dylib",
    "/usr/lib/libc++.1.dylib",
    "/usr/lib/system/libcache.dylib",
    "/usr/lib/system/libcommonCrypto.dylib",
    "/usr/lib/system/libcompiler_rt.dylib",
    "/usr/lib/system/libcopyfile.dylib",
    "/usr/lib/system/libcorecrypto.dylib",
    "/usr/lib/system/libdispatch.dylib",
    "/usr/lib/system/libdyld.dylib",
    "/usr/lib/system/libkeymgr.dylib",
    "/usr/lib/system/libmacho.dylib",
    "/usr/lib/system/libquarantine.dylib",
    "/usr/lib/system/libremovefile.dylib",
    "/usr/lib/system/libsystem_asl.dylib",
    "/usr/lib/system/libsystem_blocks.dylib",
    "/usr/lib/system/libsystem_c.dylib",
    "/usr/lib/system/libsystem_collections.dylib",
    "/usr/lib/system/libsystem_configuration.dylib",
    "/usr/lib/system/libsystem_containermanager.dylib",
    "/usr/lib/system/libsystem_coreservices.dylib",
    "/usr/lib/system/libsystem_darwin.dylib",
    "/usr/lib/system/libsystem_dnssd.dylib",
    "/usr/lib/system/libsystem_featureflags.dylib",
    "/usr/lib/system/libsystem_info.dylib",
    "/usr/lib/system/libsystem_m.dylib",
    "/usr/lib/system/libsystem_malloc.dylib",
    "/usr/lib/system/libsystem_networkextension.dylib",
    "/usr/lib/system/libsystem_notify.dylib",
    "/usr/lib/system/libsystem_sandbox.dylib",
    "/usr/lib/system/libsystem_secinit.dylib",
    "/usr/lib/system/libsystem_kernel.dylib",
    "/usr/lib/system/libsystem_platform.dylib",
    "/usr/lib/system/libsystem_pthread.dylib",
    "/usr/lib/system/libsystem_symptoms.dylib",
    "/usr/lib/system/libsystem_trace.dylib",
    "/usr/lib/system/libunwind.dylib",
    "/usr/lib/system/libxpc.dylib",
    "/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices",
    "/usr/lib/libDiagnosticMessagesClient.dylib",
    "/usr/lib/libenergytrace.dylib",
    "/usr/lib/libbsm.0.dylib",
    "/usr/lib/libz.1.dylib",
    "/usr/lib/system/libkxld.dylib",
    "/System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices",
    "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList",
    "/System/Library/Frameworks/Security.framework/Versions/A/Security",
    "/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration",
    "/usr/lib/libapple_nghttp2.dylib",
    "/usr/lib/libcompression.dylib",
    "/usr/lib/libnetwork.dylib",
    "/usr/lib/libsqlite3.dylib",
    "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation",
    "/System/Library/Frameworks/Network.framework/Versions/A/Network",
    "/usr/lib/libCoreEntitlements.dylib",
    "/System/Library/PrivateFrameworks/MessageSecurity.framework/Versions/A/MessageSecurity",
    "/System/Library/PrivateFrameworks/ProtocolBuffer.framework/Versions/A/ProtocolBuffer",
    "/usr/lib/libMobileGestalt.dylib",
    "/System/Library/PrivateFrameworks/AppleFSCompression.framework/Versions/A/AppleFSCompression",
    "/usr/lib/libcoretls.dylib",
    "/usr/lib/libcoretls_cfhelpers.dylib",
    "/usr/lib/libpam.2.dylib",
    "/usr/lib/libxar.1.dylib",
    "/System/Library/PrivateFrameworks/CoreAutoLayout.framework/Versions/A/CoreAutoLayout",
    "/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration",
    "/usr/lib/libarchive.2.dylib",
    "/usr/lib/libxml2.2.dylib",
    "/usr/lib/liblangid.dylib",
    "/System/Library/Frameworks/Combine.framework/Versions/A/Combine",
    "/usr/lib/swift/libswiftCore.dylib",
    "/usr/lib/swift/libswiftCoreFoundation.dylib",
    "/usr/lib/swift/libswiftDarwin.dylib",
    "/usr/lib/swift/libswiftDispatch.dylib",
    "/usr/lib/swift/libswiftIOKit.dylib",
    "/usr/lib/swift/libswiftObjectiveC.dylib",
    "/usr/lib/swift/libswiftXPC.dylib",
    "/usr/lib/swift/libswift_Concurrency.dylib",
    "/usr/lib/swift/libswift_StringProcessing.dylib",
    "/usr/lib/swift/libswiftos.dylib",
    "/System/Library/PrivateFrameworks/AppleSystemInfo.framework/Versions/A/AppleSystemInfo",
    "/System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/Versions/A/IOMobileFramebuffer",
    "/System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface",
    "/usr/lib/libpcap.A.dylib",
    "/usr/lib/libdns_services.dylib",
    "/usr/lib/liblzma.5.dylib",
    "/usr/lib/libbz2.1.0.dylib",
    "/usr/lib/libiconv.2.dylib",
    "/usr/lib/libcharset.1.dylib",
    "/usr/lib/swift/libswift_RegexParser.dylib",
    "/usr/lib/libheimdal-asn1.dylib",
    "/usr/lib/libCheckFix.dylib",
    "/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC",
    "/System/Library/PrivateFrameworks/CoreNLP.framework/Versions/A/CoreNLP",
    "/System/Library/PrivateFrameworks/MetadataUtilities.framework/Versions/A/MetadataUtilities",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate",
    "/usr/lib/libmecab.dylib",
    "/usr/lib/libCRFSuite.dylib",
    "/usr/lib/libgermantok.dylib",
    "/usr/lib/libThaiTokenizer.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib",
    "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib",
    "/System/Library/PrivateFrameworks/MIL.framework/Versions/A/MIL",
    "/System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory",
    "/System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory",
    "/System/Library/PrivateFrameworks/APFS.framework/Versions/A/APFS",
    "/System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation",
    "/usr/lib/libutil.dylib",
    "/System/Library/PrivateFrameworks/InstalledContentLibrary.framework/Versions/A/InstalledContentLibrary",
    "/System/Library/PrivateFrameworks/CoreServicesStore.framework/Versions/A/CoreServicesStore",
    "/usr/lib/libapp_launch_measurement.dylib",
    "/System/Library/PrivateFrameworks/AppleMobileFileIntegrity.framework/Versions/A/AppleMobileFileIntegrity",
    "/usr/lib/libmis.dylib",
    "/System/Library/PrivateFrameworks/MobileSystemServices.framework/Versions/A/MobileSystemServices",
    "/System/Library/PrivateFrameworks/ConfigProfileHelper.framework/Versions/A/ConfigProfileHelper",
    "/System/Library/PrivateFrameworks/CoreAnalytics.framework/Versions/A/CoreAnalytics",
    "/System/Library/PrivateFrameworks/AppleSauce.framework/Versions/A/AppleSauce",
    "/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling",
    "/usr/lib/libxslt.1.dylib",
    "/usr/lib/libcmph.dylib",
    "/System/Library/PrivateFrameworks/CoreEmoji.framework/Versions/A/CoreEmoji",
    "/System/Library/PrivateFrameworks/LinguisticData.framework/Versions/A/LinguisticData",
    "/System/Library/PrivateFrameworks/Lexicon.framework/Versions/A/Lexicon",
    "/System/Library/PrivateFrameworks/BackgroundTaskManagement.framework/Versions/A/BackgroundTaskManagement",
    "/usr/lib/libTLE.dylib"
  ]
}

### next-swc installation

next-swc is installed correctly for aarch64-apple-darwin

### next-swc shared object dependencies

/Users/ojkwon/github/next.js-upstream/node_modules/@next/swc-darwin-arm64/next-swc.darwin-arm64.node:
	/Users/runner/work/next.js/next.js/target/aarch64-apple-darwin/release/deps/libnext_swc_napi.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60420.60.24)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

/Users/ojkwon/github/next.js-upstream/node_modules/@next/swc-darwin-arm64/next-swc.darwin-arm64.node [arm64]:
    -platform:
        platform     minOS      sdk
           macOS     12.0      13.1   
    -segments:
        load-offset   segment section        sect-size  seg-size perm
        0x00000000    __TEXT                             94304KB r.x
        0x00001680             __text           66042588
        0x03EFD15C             __stubs            3336
        0x03EFDE64             __init_offsets      112
        0x03EFDED4             __gcc_except_tab 5771520
        0x0447F000             __const          8830192
        0x04CEACF0             __cstring           128
        0x04CEAD70             __unwind_info    2417156
        0x04F38F78             __eh_frame       13496364
        0x05C18000    __DATA_CONST                        3040KB rw.
        0x05C18000             __got              2288
        0x05C188F0             __const          3101360
        0x05F10000    __DATA                               512KB rw.
        0x05F10000             __data           422352
        0x05F771D0             __thread_vars      1656
        0x05F77848             __thread_data       104
        0x05F778B0             __thread_bss       2776
        0x05F78388             __common          62704
        0x05F87880             __bss             18424
    -dependents:
        attributes     load path
                       /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
                       /System/Library/Frameworks/Security.framework/Versions/A/Security
                       /usr/lib/libSystem.B.dylib
                       /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
                       /usr/lib/libiconv.2.dylib
```


</details>
2023-08-03 17:03:41 +00:00
John Ide
57788b56f8
Adding docs about static exports not supporting dynamic segments (#52959)
Adding docs about how Dynamic Segments aren't supported with Static Exports.

- Related to https://github.com/vercel/next.js/issues/48022

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-02 18:27:31 +00:00
Shu Ding
a58a869f48
(docs) Add example of redirection in Server Actions (#53485)
Based on the feedback from #53435, this PR adds an example of redirection inside Server Actions to the docs. Currently, we have examples of getting/setting cookies but there's nothing for `redirect()`.
2023-08-02 17:58:07 +00:00
Jarrett Meyer
c7fa524ebd
docs: add clarity for deleting cookies (#52338)
Added additional methods for deleting a cookie




Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-02 17:02:51 +00:00
SubsequentlySneeds
c3f4e5d866
Minor grammar fix in "src Directory" page (#53481)
This change removes the sentence fragment starting with "Which" and merges it into the previous sentence.
2023-08-02 16:33:31 +00:00
Delba de Oliveira
eecd8dc146
Docs: update caching docs (#53478)
This PR:
- Makes minor content and formatting improvements
- Updates caching diagrams:
  - Adds missing static/dynamic diagram (fixes #53460) 
  - Tweaks designs to explain things better
  - Increases font sizes

Relies on: https://github.com/vercel/front/pull/24321
2023-08-02 12:11:22 +00:00
Steven
1b2e361e0d
chore(docs): add section about responsive images (#53463)
We got some feedback from that there is missing information when working with responsive images.

This PR adds a new section for Responsive Images along with some recipes how to achieve that.
2023-08-02 09:29:08 +00:00
leotrt
f51978beae
fix(doc): Broken link formatting in draft-mode doc (app router) (#53446)
### What?
Link to dynamic rendering is not appearing as such in the App router's draft-mode docs.

### Why?
The formatting is wrong, it misses a parenthesis

### How?
Added the missing parenthesis
2023-08-01 15:22:49 +00:00
Delba de Oliveira
dc3936b11a
Docs: Review Getting Started Section (#53377)
I've started reviewing the docs to identify areas we need to cover / improve. This PR contains minor improvements for the **getting started**, **installation**, and **project structure** pages.


New tasks added to linear: 
- Create [middleware.ts](https://linear.app/vercel/issue/DX-1834/create-middlewarets-api-reference-in-file-conventions) page
- Create [instrumentation.ts](https://linear.app/vercel/issue/DX-1833/create-instrumentationts-api-reference-in-file-conventions) page
2023-08-01 15:12:18 +00:00
Delba de Oliveira
b4d40f454e
Docs: Fix formatting issues in the caching docs (#53436) 2023-08-01 13:34:25 +00:00
Lee Robinson
19c4eec064
docs: fix broken diagram in caching docs (#53414)
Follow up from https://github.com/vercel/next.js/pull/52514.

We're still missing the static and dynamic diagram, it was missed in the PR to `front` to add the original diagrams. We'll need to get that in as well, could be here, or in a follow up.
2023-08-01 03:21:00 +00:00
Delba de Oliveira
98c3076eb4
Docs: Document caching mechanisms (#52514)
This PR document the caching semantics in Next.js, how they interact, and what APIs affect them. We're also taking the opportunity to consolidate terminology, remove duplicate content, and update sections of the docs that relate to caching. 

### Documentation

- [x] Create a new section for caching
- [x] Explain how the different caching mechanisms work
   - [x] Request Memoization (React Cache)
   - [x] Persistent Data Cache 
   - [x] Persistent Full Route Cache 
   - [x] In-memory, client-side Router Cache 
- [x] Document how different APIs affect caching
- [x] Document cache interactions 
- [x] Clean up stale information in the other docs sections
   - [x] Routing Section
      - [x] Move advanced navigation topics from fundamentals to **How Navigation Works** section
      - [x] Rewrite the **How Navigation Works** section
   - [x] Rendering Section
      - [x] Simplify fundamentals page
      - [x] Rewrite the **Static and Dynamic Rendering** pages
      - [ ] ~Create a page to explain how **Client and Server Components** are rendered~. Moved to this PR: https://github.com/vercel/next.js/pull/51579
   - [x] Data fetching section 
      - [x] Consolidate data fetching story for fetching, caching, and revalidating
      - [x] Clarify data fetching story with 3rd party libraries and React `cache`
      - [x] Create **Data Fetching Patterns** page
- [x] Document other related behaviors: 
   - [x] Update information on scroll position for back/forward navigation 
   - [x] Remove the concepts of **soft and hard navigation**
   - [x] Remove the concepts of **static and dynamic data fetching**
   - [x] Use consistent terminology **runtime** 👉🏼  **request time**. Runtime for Edge and Node.js, request time to describe when dynamic stuff happens
   - [x] `generateStaticParams` being able to seed the Full Route Cache
- [x] Polish 💅🏼 

---
### Related PRs:

- Diagrams: https://github.com/vercel/front/pull/24142
- Redirects: https://github.com/vercel/front/pull/24179
2023-07-31 17:03:26 +00:00
Ozan Sevkin
97a0a3373f
docs: update active link code snippet for better equality check (#53327)
Update pathname and href matching check from startsWith() method to strict equality. startsWith() method causes all paths to match with root link "/"
2023-07-30 23:21:59 +00:00
JJ
d3b0c7bb42
[Docs] remove x-xss-protection-header (#53362)
The x-xss-protection header is a non-standardized http header with low browser-capability.
If it is likely to be supported in the future, it can be treated as experimental, but since it is not, it is preferable to remove it.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
https://caniuse.com/mdn-http_headers_x-xss-protection
2023-07-30 20:12:41 +00:00
Steven Tey
ed35e2a6ea
Added docs on async not-found.js server components (#51999)
While `not-found.js` components do not accept any props, you can still turn the `not-found.js` component into an async server component to fetch dynamic data:


```tsx filename="app/blog/not-found.tsx" switcher
import Link from 'next/link'
import { headers } from "next/headers";

export default async function NotFound() {
  const headersList = headers();
  const domain = headersList.get("host")
  const data = await getSiteData(domain)
  return (
    <div>
      <h2>Not Found: {data.name}</h2>
      <p>Could not find requested resource</p>
      <p>
        View <Link href="/blog">all posts</Link>
      </p>
    </div>
  )
}
```

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-29 07:33:28 +00:00
Dom Sip
b149fb7009
docs: Update Route Handlers AI example code snippet (#52127)
changing AI example model from `text-davinci-003` to `gpt-3.5-turbo`
which is in a `chat/route.ts` format.

The alternative but with "completition" style would be a bit longer code
like:

```
// app/api/completion/route.ts

import { Configuration, OpenAIApi } from 'openai-edge'
import { OpenAIStream, StreamingTextResponse } from 'ai'

export const runtime = 'edge'

const apiConfig = new Configuration({
  apiKey: process.env.OPENAI_API_KEY!,
})

const openai = new OpenAIApi(apiConfig)

function buildPrompt(prompt: string) {
  return prompt.split('\n').map((message) => ({
    role: 'user',
    content: message,
  }));
}

export async function POST(req: Request) {
  
  // Extract the `prompt` from the body of the request
  const { prompt } = await req.json();

  // Request the OpenAI API for the response based on the prompt
  const response = await openai.createChatCompletion({
    model: 'gpt-3.5-turbo',
    stream: true,
    messages: buildPrompt(prompt),
    max_tokens: 500,
    temperature: 0.7,
    top_p: 1,
    frequency_penalty: 1,
    presence_penalty: 1,
  })

  // Convert the response into a friendly text-stream
  const stream = OpenAIStream(response)

  // Respond with the stream
  return new StreamingTextResponse(stream)
}

```

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-07-29 00:25:48 -07:00
Julien Bouquillon
71f08ef873
docs: fix typo (#53100)
just a typo in next/jest docs
2023-07-29 07:12:33 +00:00
Shunya Hayashi
dffafdecd3
Update nginx.conf example in documentation for improved flexibility and clarity (#53135)
## Description

This PR updates the provided example of nginx.conf in the documentation. The changes introduce more flexibility and clarity, making the example easier to understand and more suited for general use.

## What?

Changes include ↓

- Modifying the root directory to `/var/www/out`. This aligns more closely with typical server configurations and separates the public web content from other parts of the server.

- Updating the try_files directive for the `/` location block. The directive now attempts to serve `$uri`, `$uri.html`, and `$uri/` in that order. This setup caters to the common pattern in static websites of serving files derived directly from the URL and correctly handles URLs that omit the .html extension.

- The `/blog/` location block is retained as is, with the rewrite directive still relevant and not requiring changes.

## Why?

These modifications aim to improve the applicability of the example to a wider range of use cases and make it more comprehensible for new users.

## How?

The changes were made directly to the `nginx.conf` example provided in the docs, following the standard syntax and conventions of Nginx configuration files.


Please let me know if there are any questions, or if further modifications are needed !!

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-29 07:03:14 +00:00
Andrew Garvin
ce29de25e4
Fixed simple typo in documentation (#53317)
I think this is a typo, at the very least I found the sentence a little clunky.
2023-07-28 21:22:37 +00:00
Steven Tey
7f77f427d2
docs: Add next-international to examples list (#53303) 2023-07-28 21:04:22 +00:00
Zack Tanner
604681912b
ensure colocated unit tests run in CI & fix various failing tests (#53270)
Colocated unit tests (such as ones in `packages/next` and `packages/font`) weren't running in CI since `run-tests` marks the glob cwd as `<root>/tests`. This modifies the working directory to be the root so the new expanded test pattern will pick up files outside of `test/`.

Several of these tests were failing so there are updates in here to fix them. Specifically:

- Source Sans Pro font was renamed to Source Sans 3
- `fillCacheWithDataProperty` test was hitting the `bailOptimistic` code path
- `resolve-metadata` had an invalid assertion (`rel: icon` gets added as part of `IconsMetadata`)
- `resolve-opengraph` wasn't handling undefined images
- `server-patch-reducer` now use inline snapshots as one was failing since it now has a prefetchCache
2023-07-28 13:54:15 +00:00
Oyebadejo Michael
37bb09d36a
chore(docs): remove repeated closing bracket (#53268)
### Adding or Updating Examples

- The repeated closing bracket that comes just after "Server Actions" has been removed

### Fixing a bug

- fixes #53267
2023-07-27 19:35:34 +00:00
Balázs Orbán
7721b9ba64
docs: match image example with code (#53254)
Closes NEXT-1761
Fixes #52037
2023-07-27 12:27:50 +00:00