No description
Find a file
Yash Singh f59710e907
feat: support for numeric separators in revalidate config (#51438)
### Fixing a bug

- [x] Related issues linked using `fixes #number`
- [x] 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

### What?

Currently, when the check on validating the type of `revalidate` is run,
we use the `Number` function to parse the value of `revalidate`, however
the `Number` function takes a
[`StringNumericLiteral`](https://tc39.es/ecma262/2023/#prod-StringNumericLiteral)
which doesn't allow the usage of the `_` separator to format your
numbers. This PR allows you to add numeric separators in the
`revalidate` export.

### Why?

When configuring the actual code, we should be allowed to use numeric
separators as it is a syntax that is supported by most runtimes.

### How?

A simple `replaceAll` call that removes all `_`s between digits.

Closes NEXT-1122
Fixes #49485

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-21 17:22:29 -07:00
.cargo Revert "Next Build Turbo POC (#49942)" (#51538) 2023-06-19 21:54:04 -07:00
.config Update Next.js code owners (#51319) 2023-06-14 20:07:32 -07:00
.devcontainer re-enable next-dev-tests (#47087) 2023-03-14 16:05:19 +01:00
.github [Docs] Update broken link validator (#51586) 2023-06-21 15:31:20 +00:00
.husky Replace pre-commit with husky (#38350) 2022-07-06 11:14:16 -05:00
.vscode [Next Docs] Update Git Workflow (#50579) 2023-06-08 12:01:55 +02:00
bench Replace var with const (#49379) 2023-05-09 10:25:39 +02:00
contributing Update codeowners (#51250) 2023-06-13 17:47:12 +00:00
docs docs: Add Panda CSS to CSS-in-JS docs. (#51484) 2023-06-21 16:12:28 -07:00
errors Remove extra word in env key error (#51512) 2023-06-20 15:23:44 +00:00
examples examples: improve with-supabase example (#51442) 2023-06-21 15:37:03 -07:00
packages feat: support for numeric separators in revalidate config (#51438) 2023-06-21 17:22:29 -07:00
scripts Update codeowners (#51250) 2023-06-13 17:47:12 +00:00
test feat: support for numeric separators in revalidate config (#51438) 2023-06-21 17:22:29 -07:00
.alexignore Integrate next-* crates from Turbopack (#47019) 2023-03-13 14:33:17 +01:00
.alexrc docs: Add "special" to the Alex allowlist (#48021) 2023-04-06 16:32:06 +02:00
.eslintignore Migrate validate links script from next-site and setup GitHub action (#51365) 2023-06-20 13:19:06 +00:00
.eslintrc.json Update MetadataRoute to namespace (#47674) 2023-03-30 15:27:44 -07:00
.gitattributes the way towards webpack 5 typings (#29105) 2021-09-21 19:17:16 +02:00
.gitignore Remove unused code from test-pack turbo task (#48487) 2023-04-18 12:12:00 +00:00
.npmrc fix: npm publish provenance permissions (#48757) 2023-04-24 14:08:55 +00:00
.prettierignore Migrate validate links script from next-site and setup GitHub action (#51365) 2023-06-20 13:19:06 +00:00
.prettierignore_staged Migrate validate links script from next-site and setup GitHub action (#51365) 2023-06-20 13:19:06 +00:00
.prettierrc.json Prettier trailingComma default value to es5 since 2.0 (#14391) 2020-06-22 13:25:24 +02:00
.rustfmt.toml build(cargo): move workspaces manifest to top level (#48198) 2023-04-19 18:38:36 +02:00
.vercel.approvers Update .vercel.approvers (#51417) 2023-06-20 14:41:53 +00:00
azure-pipelines.yml Revert "Fix pnpm ERR_INVALID_THIS on Node 20" (#51539) 2023-06-19 23:38:15 -07:00
Cargo.lock Revert "Next Build Turbo POC (#49942)" (#51538) 2023-06-19 21:54:04 -07:00
Cargo.toml Update turbopack (#51336) 2023-06-15 09:39:17 +00:00
CODE_OF_CONDUCT.md updated code of conduct to v2.1 (#34208) 2022-02-10 18:11:42 -06:00
contributing.md chore: improve repo templates (#46629) 2023-03-01 09:25:51 -08:00
jest.config.js use env var to switch next.js to turbopack mode (#51353) 2023-06-21 13:52:14 +00:00
jest.replay.config.js Add Replay integration for dev e2e tests (#40955) 2022-09-29 14:45:10 -07:00
lerna.json v13.4.7 2023-06-21 21:12:57 +00:00
license.md Update license year (#44403) 2023-01-01 11:12:49 +01:00
lint-staged.config.js Run dev tests against default CNA templates (#45211) 2023-01-24 11:01:03 -08:00
package.json refactor tests for readability (#51051) 2023-06-21 19:47:21 +00:00
plopfile.js Opt-in to dynamic rendering when reading searchParams (#46205) 2023-03-16 21:46:35 +01:00
pnpm-lock.yaml v13.4.7 2023-06-21 21:12:57 +00:00
pnpm-workspace.yaml Integrate next-* crates from Turbopack (#47019) 2023-03-13 14:33:17 +01:00
readme.md Monorepo (#5341) 2018-10-01 01:02:10 +02:00
release.js Fix labels for release sections 2021-11-21 13:11:54 +01:00
run-tests.js ci(workflow): enable test trace upload (#51107) 2023-06-12 17:14:13 +00:00
rust-toolchain build(cargo): move workspaces manifest to top level (#48198) 2023-04-19 18:38:36 +02:00
test-file.txt Add additional file serving tests (#12479) 2020-05-04 11:58:19 -05:00
tsconfig-tsec.json Integrate tsec into the linting process (#33746) 2022-02-24 16:59:18 -08:00
tsconfig.json refactor tests for readability (#51051) 2023-06-21 19:47:21 +00:00
tsec-exemptions.json Move core files to src folder and move JS files to TypeScript (#44405) 2023-01-03 10:05:50 +01:00
turbo.json Revert "Next Build Turbo POC (#49942)" (#51538) 2023-06-19 21:54:04 -07:00
UPGRADING.md Move upgrading guide to /docs (#10727) 2020-02-28 23:46:18 +01:00
vercel.json Silence GH Comments for Preview URLs (#18766) 2020-11-03 21:59:47 +00:00

Next.js

Getting Started

Visit https://nextjs.org/learn to get started with Next.js.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Who is using Next.js?

Next.js is used by the world's leading companies. Check out the Next.js Showcase to learn more.

Community

The Next.js community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects.

To chat with other community members you can join the Next.js Discord.

Our Code of Conduct applies to all Next.js community channels.

Contributing

Please see our contributing.md.

Good First Issues

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Authors

Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and not open a public issue. We will investigate all legitimate reports. Email security@vercel.com to disclose any security vulnerabilities.

https://vercel.com/security