Commit graph

10219 commits

Author SHA1 Message Date
JJ Kasper
69a56759ee
v12.0.8-canary.16 2022-01-03 18:58:27 -06:00
Steven
6f10d94d90
Revert "Reduce install size for linux glibc/musl (#32850)" (#32973)
This reverts commit a5fab84840.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-01-03 18:47:48 -06:00
JJ Kasper
e01ef297e7
Ensure middleware is output in standalone mode (#32967) 2022-01-03 18:47:18 -06:00
JJ Kasper
5378db8f80
v12.0.8-canary.15 2022-01-03 15:46:09 -06:00
Steven
a5fab84840
Reduce install size for linux glibc/musl (#32850)
In Next.js [12.0.1](
https://packagephobia.com/result?p=next@12.0.1), musl support was added which caused linux to install both glibc and musl binaries.

This PR adds the `install` script to prevent installing unused binaries, reducing the install size by 47MB.

We originally thought this could be added to Node.js core and thus npm but [it was rejected](https://github.com/nodejs/node/pull/41338).

Note getReport() works on Node.js [`>=11.8.0`](https://nodejs.org/api/process.html#processreportgetreporterr) which is safe to use since Next.js requires [`"node": ">=12.22.0"`](265f71e225/packages/next/package.json (L280)).
2022-01-03 21:17:46 +00:00
Devin Wall
d0e72fd9fa
Fixes issue with makeStylesheetInert (#32027)
Fixes https://github.com/vercel/next.js/issues/32024

Fixing makeStylesheetInert.
Fixes log import.



## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Devin Wall <87490815+DevinWallKcl@users.noreply.github.com>
2022-01-03 20:35:57 +00:00
JJ Kasper
52cf7fe51e
Ensure setImmediate and punycode are polyfilled (#32768)
* Ensure setimmediate and punycode are polyfilled

* update compiled
2022-01-03 13:31:23 -06:00
Javi Velasco
82adaee0cd
Allow to opt-out from preflight cache (#32767)
Fixes #32727

With this PR we introduce a new header that can be used to respond from Middleware `x-middleware-cache`. When the value of this header is set to `no-cache`, the client will **not** store the effects read from a preflight response to be used in an upcoming check.

Instead of using `Cache-Control` we are using a custom header to not mess with browser specific caching. Accepting a specific value to opt out (`no-cache`) opens the future opportunity of having other caching strategies.

This feature solves the issue of having a preflight request whose parameters can change from the client affecting the effects. For example, having a cookie that would make a middleware rewrite to one pathname or another and allowing to change that cookie from the client. In that case we'd always need to revalidate the effects on navigation synchronously.

Of course when using this feature it is possible that we add some latency on navigation so the preferred mechanism will be caching by default since it covers the most common use cases.
2022-01-03 18:13:28 +00:00
JJ Kasper
4d307716f7
Fix issue with escape-string-regexp in IE11 (#32708)
* Fix issue with escape-string-regexp in IE11

* remove escape-string-regexp dep

* Update compiled

* Link to original repo
2022-01-03 11:41:50 -06:00
JJ Kasper
c9c3183292
Remove un-needed test dependency (#32616)
* Remove un-needed test dependency

* update test

* update compiled
2022-01-03 10:08:30 -06:00
Balázs Orbán
09456cb43e
chore: decrease stale time before closing issues with no reproduction (#32955)
#32214 intended to only allow 30 days of stale time and then close the issue.

After studying the docs:

- https://github.com/actions/stale#days-before-issue-stale
- https://github.com/actions/stale#days-before-issue-close

and the cron job action: https://github.com/vercel/next.js/actions/runs/1647416426

I realized that we currently mark an inactive issue without reproduction as stale after 60 days and wait another 30 days before actually closing it.

With this PR, we mark issues with no reproduction as stale after 30 days and close them the day after.

This should result in a lower count of issues that are unactionable and the author seems to have moved on.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-03 03:52:28 +00:00
Balázs Orbán
be1d308417
fix(router): scroll to top when href="/" and hash already present (#32954)
When the URL already contains a hash (like `/#section`) and a `Link` with `href="/"` is clicked, the page should scroll to the top on the first click. Currently, it only happens with the second click (after `#section` has been removed from the URL).

Fixes #32931

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-03 02:57:02 +00:00
JJ Kasper
381ca374e5
v12.0.8-canary.14 2022-01-02 16:36:23 -06:00
Tim Neutkens
88a5f263f1
Move resolve-url-loader into Next.js (#32932)
* Move resolve-url-loader into Next.js

Fixes #32157

Moves resolve-url-loader into Next.js and strips out all features that are not used like `rework` support. Will reduce install size as well as allow for optimizing the approach in the near future.

* Update precompiled

* Use loader-utils 2

* Update trace test

* Revert "Update trace test"

This reverts commit 7c09a07871cc0ab72d5fcd4151a2d8efbc1aad8f.

* Add es5-ext as it's used in trace tests

* Update join-function.js

* Update bundle5.js
2022-01-02 16:16:17 -06:00
Tim Neutkens
a5bfc1eecc
Simplify trace span id generation (#32946)
Uses a simple counter for span ids, previously these required to be randomly generated but I've changed the importer script to ensure it gets prepended `0`s to make sure it gets to 16 characters which Jaeger requires.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-02 21:22:01 +00:00
ryuurock
0bbbfa4818
Fix next/image noscript tag to only render when lazy (#32918)
Noscript is not required for Image that are loaded immediately

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-01-01 22:46:49 +00:00
JJ Kasper
c320249be1
Remove un-necessary second yarn install from example Dockerfile (#32934)
Update to remove the second `yarn install` step from the docker example as it is no longer needed since we only include necessary files from the output file traces now. 

Closes: https://github.com/vercel/next.js/pull/29360

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-01 20:49:43 +00:00
Doug
92c5aa8001
Update scrolling example using query param instead of hash (#31473)
The example cited doesn't make sense, unless I'm truly missing something. The example is talking about hashes... i.e. #about. Not a query param, like ?=count=10. So in the example, the scroll={false} doesn't make any sense, since the href is not using a hash/anchor tag. I could be wrong, so be gentle.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-01 18:11:09 +00:00
minervabot
a17807246f
Update lint-staged example to use node.js path (#30510)
The current example attempts to remove resolve the relative pathname of the absolute pathnames given by `lint-staged` using string manipulation and `process.cwd()`. This is a risky solution because pathnames have many platform dependent edge cases. The example also returns pathnames that are technically wrong in linux. `/home/project/file => /file`,

I propose to use the utilities provided by node.js to resolve the relative pathnames, and to format the sample `.lintstagedrc.js` file in a manner easier for novice programmers to understand and modify.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-01 17:35:28 +00:00
Thibaut SABOT
9d1fbbca7b
ignore .d.ts files inside pages folder (#30728)
Fixes https://github.com/vercel/next.js/issues/30698 and https://github.com/vercel/next.js/discussions/30618

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
2022-01-01 17:16:03 +00:00
Houssein Djirdeh
d72f5bd69d
[ESLint] Adds lint rule to flag usage of <head> (#32897)
## Bug

- [X] Related issues linked using `fixes #number`
- [X] Tests added
- [X] Errors have helpful link attached, see `contributing.md`

Fixes #30142
2021-12-31 05:09:44 +00:00
Jiachi Liu
636d3aeda7
doc: add quotes to api (#32898)
x-ref: #32896
2021-12-29 18:15:23 +00:00
Shu Ding
ec2e107f7f
Update the React 18 documentation (#32896)
Currently you don't need to enable `concurrentFeatures` to start using React 18, this PR makes the docs more clear on that.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-29 17:25:55 +00:00
Sebastian Gallese
3ca8ce07a6
Add id to inline Segment script (#32878)
When I don't include an `id`, I see the console error "VM1624:1 Segment snippet included twice."
According to https://nextjs.org/docs/basic-features/script#inline-scripts, an id should be added for inline scripts.



## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-28 19:34:03 +00:00
Joost De Cock
34dcede690
fix(eslint-plugin-next): Broken links in eslint output (#32837)
This fixes broken links in the eslint output by removing the trailing full stop.
It also makes the formatting of (the output of) the various rules consistent.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

> I don't think this is a bug, nor a feature, nor is it really documentation. 
> It's just a small nuisance that I bumped into and felt compelled to fix.
> I went with documentation as that seems the closest match

## What does this pull request do?

The elslint output of `eslint-plugin-next` contains useful links to the documentation about the various rules.
Unfortunately, on most (but not all) rules, those links are immediately followed by a full stop (`.`).

The terminal (or any parser) has no way of knowing that the full stop is not part of the URL. 
So it includes it and clicking the link leads to a 404 on the nextjs.org website.
 
![eslint](https://user-images.githubusercontent.com/1708494/147452577-43ad4ce7-df75-4d48-ab78-70b9b8212b7e.png)

This PR fixes that by removing the full stop. 

## But a final full stop is better grammar

I considered alternatives (such as [a zero-width space character](https://en.wikipedia.org/wiki/Zero-width_space#Prohibited_in_URLs)) in case the final full stop was part of the style guide or something.

However, as I went through the eslint rules, I notices that the messages for various rules were formatted inconsistently. 
Some with final full stop, some without.

As such, I made the all consistent with this structure:

> [message]. See: [url]

I feel this is a better solution than using the zero-width space as these sort of invisible characters 
in code can be a red flag that something fishy is going on.

I submit this pull request in the hope it will be useful, and a positive contribution to a project I have a great deal of appreciation for.
That being said, I fully understand if people would consider this a non-issue.
2021-12-28 02:18:39 +00:00
Colin Diesh
a989469228
Update readme.md of next-mdx to allow typescript file extensions for pages (#32830) 2021-12-26 17:43:47 -06:00
Chai
b562b902cb
fix: typo (#32820) 2021-12-26 13:08:19 +01:00
Balázs Orbán
4e345f6677
feat(eslint): allow a for internal url when target="blank" present (#32780)
When an `a` tag is used to link to an internal page, but the `target="_blank"` attribute is present, ESLint should not report it as an error and should not enforce using `next/link`.

Fixes #28547

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-25 00:55:43 +00:00
Balázs Orbán
b769d1be49
fix(examples): update link URL in cms-kontent example (#32806)
* fix(examples): update cover image link URL in

* chore(examples): remove warning in  about  import
2021-12-25 00:30:42 +01:00
Balázs Orbán
22655a1aab
fix(examples): bring with-semantic-ui example up-to-date (#32805) 2021-12-25 00:07:30 +01:00
Balázs Orbán
6b866533cd
chore(examples): remove duplicate examples (#32779)
`with-webpack-bundle-analyzer` and `with-webpack-bundle-size-analyzer` are a duplicate/outdated versions of the `analyze-bundles` example and thus should be removed to avoid confusion.

Related: #26715
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-23 22:05:20 +00:00
Gustavo Levano
2c709bb587
Fixed syntax error in the example of React Hydration Error (#32773)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-23 19:25:11 +00:00
JJ Kasper
723caedaac
Update note about .next/static in standalone mode (#32771) 2021-12-23 12:24:38 -06:00
Tim Neutkens
e3776989bf
Remove anonymous default export rule from Babel (#32763)
We didn't port this plugin to next-swc given that the eslint setup warns for this automatically. Given that we still get issues opened for this particular warning coming from the plugin it'd be good to remove it.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-23 17:31:38 +00:00
Jan Piotrowski
3eea290d82
fix(examples): Update nextjs-graphql-with-prisma-simple example API endpoint (#32759)
Updates the API endpoint to one that exists, to be merged if we can not recover the original hostname.

Internal discussion: https://prisma-company.slack.com/archives/CBP68USAX/p1640215250109600
2021-12-23 15:32:07 +00:00
MikevPeeren
dbe7f968b0
Update Sentry example readme to mention Next.js 12 support (#32724)
@sentry/nextjs support has changed as it now supports version from 10.0.8 also meaning they support Next.Js 12

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-22 20:08:05 +00:00
Chris
ff573632af
Add authentication example using Stytch (#32194)
## Documentation / Examples

This PR adds an example Next.js app that uses [Stytch](https://stytch.com/) for authentication, deployed on Vercel.
2021-12-22 19:30:44 +00:00
JJ Kasper
265f71e225
v12.0.8-canary.13 2021-12-22 13:03:32 -06:00
Steven
54f0cef9c0
Bump nft to version 0.17.1 (#32737)
https://github.com/vercel/nft/releases/tag/0.17.1

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-22 18:44:33 +00:00
Jiachi Liu
ec3ca398cb
Reduce styled-jsx size in client bundle (#32730)
We introduced the `StyleRegistry` on server side to make it concurrent safe for requests. For client we can have only 1 registry since there's only 1 instance per browser window. Keep consistence with previous usage

Closes vercel/next.js#32417
Closes vercel/next.js#30377

Revert change in #31357, it's not required anymore
2021-12-22 13:38:27 +00:00
JJ Kasper
b6fb52bbb0
Update web runtime externals (#32717)
As mentioned in https://github.com/vercel/next.js/pull/32679#discussion_r773357113 it looks like these externals need to be updated to the compiled path not that they are ncc'd. Also updated the test readme a bit to reduce confusion in https://github.com/vercel/next.js/issues/32367#issuecomment-997969759
2021-12-22 02:34:36 +00:00
Balázs Orbán
9b2c079680 fix: run prettier on with-jest and with-jest-babel examples 2021-12-22 02:35:21 +01:00
Balázs Orbán
48dba6457d
chore: convert Jest examples to TypeScript (#32705)
* chore: convert Jest examples to TypeScript

* test: use absolute imports in test files

* chore: address review comments

* fix: add pages to tsconfig.json paths

* fix: add styles to tsconfig.json paths

* chore: upgrade dependencies/snapshots

* docs: match Testing docs with example code

* docs: link to docs from mock test files

Co-authored-by: Lee Robinson <me@leerob.io>
2021-12-22 01:12:07 +01:00
Jiachi Liu
6581ba9dae
Bust cache for RSC in each render (#32710)
* flight response should not be cached since it's could be changed per fetching
* delete cache after readRoot has constructed react tree
2021-12-21 23:37:23 +00:00
JJ Kasper
d85e5ab48e
v12.0.8-canary.12 2021-12-21 14:46:52 -06:00
JJ Kasper
e963209b9d
Ensure device IP is used for safari browserstack test (#32712) 2021-12-21 14:42:54 -06:00
Dan Weaver
13bac7c739
fix popstate detection for safari when basepath is present (#32687)
* fix popstate detection for safari when basepath is present

* Add test case

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-21 14:11:10 -06:00
Jiachi Liu
c5291406aa
Escape from next head in rsc _error page (#32624)
* Don't render `next/head` in _error for RSC
* Save an error in `__next_s` for client to be aware RSC rendering is errored
* Fix `req.url` when errored
* Refactor some changes in middleware ssr loader
2021-12-21 19:24:57 +00:00
David Ramos
36a6e436b3
Don't swallow test failures caused by POSIX signals (#32688)
* Don't swallow test failures caused by POSIX signals

* Update tests to not import() inside jest

* Update tests

* apply suggestion

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-21 12:52:07 -06:00
Kiko Beats
0eba5b2558
web runtime: add AbortController & AbortSignal (#32089)
It adds AbortController and AbortSignal Web runtimes APIs to be used by the user at Edge Functions.

For doing that it delegates into `abort-controller` dependency that has been frozen to prevent any modification.

Co-authored-by: Zhang Zhi <20026577+fytriht@users.noreply.github.com>
2021-12-21 17:12:53 +00:00