- 13 Oct, 2024 21 commits
-
-
vercel-release-bot authored
-
Sebastian Markbåge authored
Stacked on top of #71221 Originally I had intended for CacheHandlers to be able to pick their ideal encoding for performance and size. When binary cache keys are involved. However, we sometimes have to add our own caching on top of the handler anyway. Since there's no built-in binary hash map implementation in JS itself, it's easier to use strings for this. It's also a simpler protocol if it's always a string type. It's possible to use UCS-2 encoding in JS which allows for arbitrary bytes. So that's what I'm doing in this PR. In the common case, it just looks the same as ~UTF-8~ ASCII strings so it's more compact than Base64. As long as this doesn't pass a UTF-8 encoded boundary which would then error. That's easy to mess up because they often default to serializing invalid characters with the same character - which would lead to potential cache poisoning because different arguments would look the same. However, it is possible to get UCS-2 sequences into JS in other ways, so maybe this issue already exists anyway? With this PR a CacheHandler just have to handle strings - it just have to be aware that they might not be valid Unicode strings.
-
Sebastian Markbåge authored
Implements deduping of "use cache" entries using CacheScopeStore. This is required for dynamic I/O. We also have the option to use this for dynamic runtime deduping too, rather than going to the underlying store and ensuring consistency within the request. There are some negative tradeoffs with this approach though that it might not be worth it for dynamic requests. For now, it's up to the Cache Handler to do deduping if it wants to. I implemented this in the default cache handler. I tested this with a blank cache implementation since the existing cache is microtasky. Since a working cache is required for other tests and should be the default, I reverted the blank cache. So this doesn't have the full test coverage yet in practice. Once we land configurable caches we can use a blank cache in the newly added tests to get better coverage. I had to make the cache scope external since it's now shared with RSC layer.
-
vercel-release-bot authored
-
Vercel Release Bot authored
-
Hendrik Liebau authored
Follow-up fix from #70897
-
루밀LuMir authored
##
📚 Fixed some typos Hello, while reviewing the source code in `packages` directory, I noticed some unnecessary blank spaces in **comments**, so I fixed them. Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
Jiman Jeong authored
<!-- 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 # --> `Module parse failed` error occurs when importing `newrelic` in instrumentation.ts in next.js version ^14.2.0 ## reproduce - newrelic: `^12.5.1` - next.js: `^14.2.0` **instrumentation.ts** ```ts export async function register() { if (process.env.NEXT_RUNTIME === 'nodejs') { await import('newrelic'); } } ``` ### in 14.1.4 build successfully ### in 14.2.0 ``` Failed to compile. ./node_modules/newrelic/LICENSE Module parse failed: Unexpected token (1:40) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > Apache License | Version 2.0, January 2004 | http://www.apache.org/licenses/ Import trace for requested module: ./node_modules/newrelic/LICENSE ./node_modules/newrelic/ sync ^\.\/.*$ ./node_modules/newrelic/index.js ./node_modules/newrelic/NEWS.md Module parse failed: Unexpected character '#' (1:1) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > ### v12.5.1 (2024-09-23) | | #### Bug fixes Import trace for requested module: ./node_modules/newrelic/NEWS.md ./node_modules/newrelic/ sync ^\.\/.*$ ./node_modules/newrelic/index.js ./node_modules/newrelic/README.md Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > <a href="https://opensource.newrelic.com/oss-category/#community-plus"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Plus.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"><img alt="New Relic Open Source community plus project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"></picture></a> | | # New Relic's Node.js agent Import trace for requested module: ./node_modules/newrelic/README.md ./node_modules/newrelic/ sync ^\.\/.*$ ./node_modules/newrelic/index.js ./node_modules/newrelic/THIRD_PARTY_NOTICES.md Module parse failed: Unexpected character ' ' (1:1) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > # Third Party Notices | | The New Relic Node Agent uses source code from third party libraries which carry Import trace for requested module: ./node_modules/newrelic/THIRD_PARTY_NOTICES.md ./node_modules/newrelic/ sync ^\.\/.*$ ./node_modules/newrelic/index.js ./node_modules/newrelic/bin/tracetractor:23:0 Module not found: Can't resolve 'split' https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./node_modules/newrelic/ sync ^\.\/.*$ ./node_modules/newrelic/index.js ./instrumentation.ts > Build failed because of webpack errors ``` ### Related PR In https://github.com/vercel/next.js/pull/60984 , the instrumentation hook file was treated as a server component and bundled. If newrelic is imported in the server component, the build fails. ## How Add `newrelic` package to `server-external-packages.json` Although adding the New Relic package directly to serverExternalPackages in next.config.js is an option, I think it's better to include it in this list as New Relic is commonly used as a monitoring tool. --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Jam Balaya authored
Just get rid of unwrapped `"`. Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've added some punctuations and fixed cases. Additionally, I wrapped staleTime in inline code blocks and added an `s`. I think this is a more appropriate way. Other version changes have punctuation at the end of the sentence.  --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
hiro authored
Fix typo on "fowards" to "forwards" <!-- 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:
JJ Kasper <jj@jjsweb.site>
-
actopas authored
Hi, This PR aims to improve the consistency of the documentation, especially regarding the use of the "Route Handler" terminology. Changes: 1. Change all instances of "route handler" and `route handler` to `Route Handler`. 2. Ensure consistent use of "Route Handler" throughout the documentation. Reasons: - Improve the professionalism and consistency of the documentation - Reduce potential confusion for readers Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've fixed the typo `URL`. It should be capitalized. `url` -> `URL` In other documents, URL is written in uppercase.  Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've removed some unnecessary spaces in documents. It works well without the spaces. Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
Jim Johnston authored
Fixing typos for the `cms-sanity` example [README.md](https://github.com/vercel/next.js/blob/canary/examples/cms-sanity/README.md): `envionment` > `environment` `alredy` > `already` Thanks! Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Mo Beigi authored
### What? When consuming the `@next/third-parties` in a Next 15 / React 19 RC project you currently get warnings from various package managers about incorrect peer dependencies. ### Why? To supress the unnecessary warnings. ### How? By adding the supported Next and React RC versions as peer dependencies. ### Questions - [ ] Does a script need to be updated so that the listed React RC peer dependency version is automatically updated between canary builds? Fixes #71185 Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
adcichowski authored
Hello, I opened a PR because the authentication library Lucia will be deprecated. It would be better to update the information in the documentation and remove it from the suggested authentication libraries. You can get information here: https://github.com/lucia-auth/lucia/discussions/1707Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
vercel-release-bot authored
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
-
Hendrik Liebau authored
During `next dev` for route handlers, `loadComponents` is called to load the route module. This also has the (for now still expected) side-effect that the reference manifests singleton is set, which we need, to make `'use cache'` work in route handlers. Until now, `loadComponents` was not called during `next build` for route handlers, and the module was loaded separately with `RouteModuleLoader.load`. With this PR, we are aligning both modes, so that it's always ensured that the reference manifests singleton is set. The end goal is to avoid the global singleton completely, but it's still unclear how to achive this because of the requirements and constrains that are documented in #62437.
-
- 12 Oct, 2024 19 commits
-
-
Hendrik Liebau authored
When compiling a route handler entry, we are now also generating client reference and server reference manifests. This enables `"use cache"` usage in route handlers. As a follow-up we should try to get rid of the `SERVER_ACTION_MANIFESTS_SINGLETON` and move the manifests to the `WorkStore`.
-
vercel-release-bot authored
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've corrected an incorrect terminal command and added missing hash(`#`) symbols in the `next.mdx` file. ### 1. Terminal Command The `npm run` command is for running scripts, so using it in this context doesn't work properly. Additionally, [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app) also uses `npx` instead of `npm run`.  ### 2. Missing Hashes of Links Some links were missing the `#` symbol, preventing users from navigating the document properly. Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
Nima authored
Fix grammar in sentence about database interactions in documentation <!-- 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:
JJ Kasper <jj@jjsweb.site>
-
actopas authored
Fix typo in 01-contribution-guide.mdx(#71200) `item worths` -> `items worth` Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
Follow-up to https://github.com/vercel/next.js/pull/71159 this tweaks the docs to explain the new behavior a bit more and re-word some parts.
-
루밀LuMir authored
# 🧰Fixed a file name Hello. In #71159 Next.js changed `swrDelta` to `expireTime`. However, the `swrDelta.mdx` file name wasn't updated. So I renamed it to `expireTime.mdx`. Additionally, I fixed a typo. `stale-while-revalidate` is in an inline code block in the paragraph below, but not in the one above. (Please see this [link](https://nextjs.org/docs/canary/app/api-reference/next-config-js/swrDelta).) 
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've fixed the typo `JavaScript`. The `s` should be capitalized. `Javascript` -> `JavaScript` Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've fixed some typos in `turbo.mdx`. 1. `css` -> `CSS` 2. Delete `d`. I think it is a typo. 3. Delete `s`. It's a typo too. -
Donny/강동윤 authored
### What? Enable minification of CSS when building for production. ### Why? It's generally required.
-
Jiachi Liu authored
-
Josh Story authored
When rendering in dev we track environment name to pass along server logs to the browser. Today the environment name is the default "Server" however when `dynamicIO` is enabled we want to have logs in the first Task where rendering starts be tagged with the environment "Prerender". This will help us understand what work is happening in the "Prerender" phase and what is happening in the dynamic "Server" phase while developing in dev mode.v
-
Zack Tanner authored
The shared shadow spread is a bit too large... this adds the shadow from the original indicator & adds a border. Also updates the copy to clarify the close behavior. ### Before <details> <summary>Dark Mode</summary>  </details> <details> <summary>Light Mode</summary>  </details> ### After <details> <summary>Dark Mode</summary>  </details> <details> <summary>Light Mode</summary>  </details>
-
JJ Kasper authored
As discussed this updates the `swrDelta` config to `expireTime` as it's more clear what the config is doing since it's how long the cache is allowed to be kept before it's fully expired.
-
루밀LuMir authored
#
🐛 Fixed a bug (#60532) Hello, I've fixed a bug mentioned in #60532. ## What? I've resolved the issue where `getStaticProps` appears instead of `generateStaticParams` during app router build. In App Router, `getStaticProps` is no longer used. Instead, The App Router uses `generateStaticParmas`. (This change is also mentioned in Next.js [App Router Migration Guide](https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#static-site-generation-getstaticprops)) However, during the build process for the App Router, `getStaticProps` appears in the console instead of `generateStaticParams`.  This is my current development environment. ```text Operating System: Platform: win32 Arch: x64 Version: Windows 11 Home Available memory (MB): 16058 Available CPU cores: 8 Binaries: Node: 20.12.2 npm: N/A Yarn: N/A pnpm: 9.12.1 Relevant Packages: next: 14.2.15 // Latest available version is detected (14.2.15). eslint-config-next: 14.2.14 react: 18.3.1 react-dom: 18.3.1 typescript: 5.5.4 Next.js Config: output: N/A ``` ## Steps to reproduce 1. Create two simple projects using `npx create-next-app@latest` - Name One project `nextjs-60532-bug-fixes-app` using **App Router**. - Name the other project `nextjs-60532-bug-fixes-pages` using **Pages Router**. 2. Create a page - In `nextjs-60532-bug-fixes-app`, create a page using `generateStaticParams` with **App Router**. - In `nextjs-60532-bug-fixes-pages`, create a page using `getStaticProps` with **Pages Router**. 3. Run `npx next build` 4. In both the App Router and Pages Router, `getStaticProps` is displayed in the console as a result of build process. (Please refer to the screenshot mentioned above.) ## How? I made a variable `staticFunctionInfo` which stores the appropriate function name based on whether it's an App Router or Pages Router. ```javascript const staticFunctionInfo = lists.app && stats.router.app ? 'generateStaticParams' : 'getStaticProps' ``` I got the code idea `lists.app && stats.router.app` from the same module. This code determines whether it's an App Router or Pages Router. You can find it in the [Next.js repository](https://github.com/vercel/next.js/blob/9497f176574f4e39de957c53799344e8f35f3d22/packages/next/src/build/utils.ts#L700-L705 ). https://github.com/vercel/next.js/blob/9497f176574f4e39de957c53799344e8f35f3d22/packages/next/src/build/utils.ts#L700-L705 Additionally, I assigned the `staticFunctionInfo` variable in place of the existing `'getStaticProps'` string. ## Result It now works properly in both the App Router and Pages Router. - App Router  - Pages Router  --- - fixes: #60532 --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
루밀LuMir authored
##
📚 Improving Documentation Hello, I've fixed some incorrect javascript code and a typo in [`link.mdx`](https://nextjs.org/docs/app/api-reference/components/link). I made a few changes: ~~### 1. Changed `app/blog/page` to `app/blog/[slug]/page`~~ ~~I believe it is accurate to include `[slug]` in the path.~~ ### 2. Added `export default` The code block was missing `export default`, so I added it. ### 3. Corrected missing punctuation ### 4. Added `'use client`' I think it is appropriate to add `'use client'` because the component uses a client-side hook (`useIsAuthed`) that relies on client state, which requires the component to be rendered on the client side. --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
vercel-release-bot authored
-
Hendrik Liebau authored
Since Turbopack is generating actual source map files, and not inlined source maps as Webpack does, React might request a source map for a client chunk using the chunk's URL pathname, e.g. `/_next/static/chunks/[project]__edc466._.js`. In the source map dev middleware, we need to convert those URL pathnames to filenames before requesting the source map for the file from Turbopack. ## Test Plan - start `pnpm next dev --turbo test/development/app-dir/source-mapping` - go to `http://localhost:3000/client` - open React DevTools
-
Hendrik Liebau authored
As we've learned in #70467, compilation times can be quite high in CI, when testing HMR behaviour. The fetch logging HMR tests are frequently failing. Increasing the `retry` timeout should mitigate the flakiness.
-