Commit graph

11710 commits

Author SHA1 Message Date
Cupid Valentine
9f162cc812
Update analysis scripts (#38201) 2022-07-05 15:04:54 -05:00
Cupid Valentine
09fdf9ada1
Update get-static-props.md (#38287)
## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-05 19:50:49 +00:00
JJ Kasper
bcf4802b1f
Update some flaking tests for edge compiler and rsc (#38344) 2022-07-05 14:37:42 -05:00
JJ Kasper
764f7d42d4
v12.2.1-canary.3 2022-07-05 12:09:24 -05:00
Shu Ding
2dc1359149
Fix CSS modules imported from client components in app dir with next build (#38329)
Continue the work in #38310, this PR includes CSS files as chunks in the manifest for each client component, and then make sure the flight client loads the CSS files correctly.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-05 16:37:50 +00:00
Lee Robinson
a5e11612c7
Update next/future/image docs to specify supported browser versions. (#38307)
This adds more specificity to what browsers are supported for the underlying web-native features.
2022-07-05 13:49:04 +00:00
Riccardo Giorato
49129e7860
fix(examples): fix link on middleware example (#38323)
## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-05 13:16:34 +00:00
Gal Schlezinger
42ee877e71
[edge] favor browser exports for edge compiler (#38319)
this is a regression from the previous implementation where Next.js compiled Middleware using
the client compiler. We used to favor the browser exports over the `module` and `main`,
which allowed packages like `debug` to work without any changes on Edge Functions. This is
no longer the case, and this commit fixes that.

Side note: I believe that in the future we will also have a different key to symbolize edge
deployments. Maybe it will be `winter` to refer to WinterCG, but only time will tell!

Another side note: we need to add support for import maps for advanced use cases.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-07-05 09:16:14 +00:00
Shu Ding
7ced791d1e
Fix CSS modules imported from client components in app dir (#38310)
* css modules support

* add test case

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-05 00:35:29 +02:00
JJ Kasper
9d22da476b
Ensure trailing slash is handled correctly with middleware (#38282)
* Ensure trailing slash is handled correctly with middleware

* update source modifying

* undo extra change
2022-07-04 09:31:07 -05:00
Gal Schlezinger
672736c408
[edge] Make runtime addressable in compile time (#38288)
this commit allows to use EdgeRuntime as a dead code eliminator identifier:

```ts
if (typeof EdgeRuntime !== "undefined") {
  console.log("will be stripped away");
} else {
  console.log("will be kept in the bundle");
}
```

which means we're replacing `EdgeRuntime` with a literal

## Related

- Fixes #30739

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-04 12:54:07 +00:00
Balázs Orbán
e6bad25b5e chore: fix issue validator paths 2022-07-04 13:54:20 +02:00
Balázs Orbán
ef1ebb4a82
chore: point to /dist for local action 2022-07-04 13:49:10 +02:00
Eduardo Sigrist Ciciliato
7664a40064
feat(examples): adds middleware example (#38240)
## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-07-04 03:45:56 +00:00
Carsten Lebek
beaa4df9fc
Typo in NextResponse docs (#38259)
## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-07-03 22:18:41 +00:00
Emerson Laurentino
6b8e499c7b
fix: middleware-upgrade-guide.md (#38246)
* Update middleware-upgrade-guide.md

* Update middleware-upgrade-guide.md
2022-07-01 22:24:34 -05:00
Jiachi Liu
d6090178fe
Fix: convert head instances to array (#38252)
* fix: convert head instances to array

* fix test
2022-07-01 20:59:04 -05:00
JJ Kasper
274980f057
v12.2.1-canary.2 2022-07-01 19:49:58 -05:00
Jiachi Liu
bfaffbdd3f
Alias react and react-dom by default (#38245)
Previously we use custom webpack alias for specific react versions for non server side node runtime aliases. This PR alias the entire folders of `react/` and `react-dom/` so that no more alias in next.config is required but only the nodejs require hook.

* Alias `react` and `react-dom` by default
* Use `react@experimental` to run server components integration test
* Drop with-react-17 test util, add `__NEXT_REACT_CHANNEL` as an env var for testing and development to specify the react channel is 17 or new experimental version
2022-07-01 23:57:45 +00:00
JJ Kasper
a1504f4cf4
Ensure page.server.js matches correctly (#38236)
* Ensure app/page.server.js matches correctly

* update check
2022-07-01 12:15:27 -05:00
Max Proske
8a76a8f049
Replace placeholder.com images with *.vercel.app in image-component tests (#38090)
Adds to https://github.com/vercel/next.js/pull/38081 by fixing all remaining flaky renderViaHTTP tests when placeholder.com is down.

Fixes https://github.com/vercel/next.js/pull/38080#issuecomment-1168036939

## Bug

- [X] Related issues linked using `fixes #number`

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
2022-06-30 21:10:16 +00:00
Richard B
157655700a
fix: declare NextBundleAnalyzer as a type (#38168)
* fix: declare NextBundleAnalyzer as a type

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-30 15:48:00 -05:00
OJ Kwon
2150d1aee6
feat(next/build): send next-swc plugins telemetry (#38116)
* Requires prerequisite PR https://github.com/vercel/next-telemetry/pull/84

This PR adds telemetry to send list of the experimental swc plugins from next.config.js. Implementation largely mimics existing plugins telemetry for next_package (https://github.com/vercel/next.js/blob/canary/packages/next/telemetry/events/plugins.ts), with small modification to read swc plugin package instead.

One notable difference is swc plugin telemetry can be sent without version. This is due to swc plugins can be specified with absolute path without any npm pkg resolutions.

## Bug

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

## Feature

- [x] 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-30 19:05:35 +00:00
Jiachi Liu
f21a9dd5cb
Fix pageProps is missing when route changes (#38178)
## Bug

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-06-30 18:13:07 +00:00
Balázs Orbán
50fa170520
chore: don't use type: "module" when building the Issue validator action (#38197)
https://github.com/vercel/next.js/runs/7130177863?check_suite_focus=true

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-30 17:26:57 +00:00
Thomas Knickman
6aabef70b7
feat(examples): link to turbo next.js examples (#38173) 2022-06-30 11:43:20 -05:00
Michael Novotny
edd395a7d3
Adds tests to ensure eslint-plugin-next's available rules are properly exported and recommended rules are correctly defined. (#38183)
* Adds tests to ensure `eslint-plugin-next`'s available rules are properly exported and recommended rules are defined correctly.

* Condenses imports.

* Sets default recommended value.

* replace Object.hasOwn for node 14

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-30 11:31:33 -05:00
Long Zheng
ab314605af
Check for performance.getEntriesByName before calling (#38186)
* Check for performance. getEntriesByName

* Refactor check

Co-Authored-By: Sukka <github@skk.moe>

Co-authored-by: Sukka <github@skk.moe>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-30 11:06:53 -05:00
Balázs Orbán
f3659a5f93
docs: remove eslint config link (#38206)
[Slack thread](https://vercel.slack.com/archives/C02UJ0QH45Q/p1656580818197009)

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-30 14:56:05 +00:00
Max Proske
5044cd601a
Convert catch-all-routes example to TypeScript (#38188)
Converted Catch All Routes example over to TypeScript to match the Contribution guidelines.

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-30 11:46:27 +00:00
Thomas Ballinger
8f707d4d74
Add Convex example (#38129)
Adds an example using [Convex](https://convex.dev/).

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2022-06-30 10:26:46 +00:00
Jiachi Liu
5e2ad29309
Migrate rsc tests to app dir tests (#38158)
### Tests 
* keep node & edge for streaming
* separate rsc tests from streaming tests
* move rsc tests to app-dir, disable the broken ones for now
2022-06-29 23:12:57 +00:00
JJ Kasper
8a5c59b7f1
Ensure @swc/helpers do not rely on hoisting (#38174)
This ensures we properly alias and internalize `@swc/helpers` so that we don't rely on package managers hoisting this dependency for the build to work properly. This also disables the external helpers with `jest` as this can also require hoisting to work and doesn't provide as much of an optimization. 

## Bug

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

Fixes: [slack thread](https://vercel.slack.com/archives/C0289CGVAR2/p1656437059151439)
2022-06-29 22:47:44 +00:00
OJ Kwon
66b83f4506
fix(next/swc): set cache dir explicitly (#38175)
This PR amends behavior of swc's cache by setting it explicitly under `distDir` from next.js config.

## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-29 21:59:52 +00:00
Wyatt Johnson
23b8b982df
Fix missing trace script devDependencies (#38172)
Adds missing devDependencies required by the `trace-to-tree.mjs` script used here to the workspace root.

c64af8aa34/scripts/trace-to-tree.mjs (L2-L3)
2022-06-29 20:57:51 +00:00
JJ Kasper
c64af8aa34
v12.2.1-canary.1 2022-06-29 15:06:44 -05:00
JJ Kasper
0b762433f5
Revert "feat(next/swc): setup native next-swc crash reporter" (#38170)
Revert "feat(next/swc): setup native next-swc crash reporter (#38076)"

This reverts commit 42e3365575.
2022-06-29 14:51:12 -05:00
Shu Ding
da84abc588
Fix chunk path resolution (#38162)
The `chunkFilenameMap` should take priority over the webpack built-in one here.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-29 19:28:48 +00:00
JJ Kasper
70c0b20885
v12.2.1-canary.0 2022-06-29 13:57:24 -05:00
Alan Pledger
90deca9509
Add a Makeswift example (#38018) 2022-06-29 13:25:51 -05:00
Sukka
55769e2cac
fix(#38106): use swc client config to pre-compile shared lib (#38137)
## Bug

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

Fixes #38106.

Currently, the `shared/lib` directory (**which will also be shipped to legacy browsers**) is precompiled under `swcServerOptions`, which targets Node.js 12 and is way too modern:

- The public class field syntax is only supported since Chrome 72, Firefox 69, Edge 79, and Safari 14.1.
- Webpack currently doesn't support the public class field syntax as well (which causes the issue #38106)
- `async/await` syntax is also supported in Node.js 12 but not in the legacy browsers.

The PR fixes the issue by pre-compiling the `shared/lib` directory using `swcClientOptions` (which targets the ES5).

Note:

- The only way to validate the fix is to run an integration test case on a legacy browser.
- The output size is increased by a little. But the size impact can be minimized by enabling `@swc/helpers` (which I will bring up in the next PR)
2022-06-29 16:34:03 +00:00
JJ Kasper
6d8a234f82
Fix create-next-app tests from changed example (#38154) 2022-06-29 10:53:30 -05:00
Pakapon Kaewmark
9aa282b4a8
Remove lazyRoot example from next/future/image doc (#38140)
According to the 12.2 release note and the source code, the `next/future/image` does not use `IntersectionObserver` anymore so the `lazyRoot` prop is also not used.
The example probably got left behind unintentionally.



## 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
- [X] 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-29 12:50:17 +00:00
Jesse Jafa
89c57cd867
Clarify router.query initial value during prerendering (#38093)
AFAIK router.query will still be an empty object during prerendering if you have `getStaticProps`. It will be its "correct" value during prerendering if  you're using `getServerSideProps` so this change seems to more accurately describe `router.query`
2022-06-29 11:40:12 +00:00
Dom Sip
82e63e3d74
docs(readme.md): remove broken 404 links (#38104) 2022-06-29 13:17:58 +02:00
Max Proske
3d482cffbb
Convert basic-css example to TypeScript (#38091)
Converted basic CSS example over to TypeScript to match the Contribution guidelines.



## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-29 11:11:53 +00:00
Max Proske
5f5b266407
Convert basic-export example to TypeScript (#38092)
Converted basic Export example over to TypeScript to match the Contribution guidelines.


## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-29 11:05:51 +00:00
Max Proske
55560e0c58
Convert auth0 example to TypeScript (#38087)
Converted auth0 example over to TypeScript to match the Contribution guidelines, and got rid of the `tslib` dependency.

Note: You must copy `.env.local.example` to `.env.local`, or you will encounter "TypeError: "secret" is required" at build time.

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2022-06-29 11:00:13 +00:00
Jo Franchetti
bbffaea755
Adding with-ably example for realtime messaging in next apps (#37319)
* update from latest canary

* lint-fix
2022-06-29 12:52:04 +02:00
Steven
4df0778ce8
Fix error when next/future/image is missing width or height (#38132)
This PR fixes the case when `next/future/image` is missing the width or height props.

It also fixes a case when `100%` or `100vh` were incorrectly parsed as `100` pixels.
2022-06-29 10:43:59 +00:00