Commit graph

1550 commits

Author SHA1 Message Date
Donny/강동윤
46e1cbc95e
Update swc for jsc.paths (#31290)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-11 11:55:44 +01:00
Tim Neutkens
2800a2b1c0
Ensure next/jest is published (#31296)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-11 11:48:12 +01:00
ihmpavel
bd8003850b
Fix typo in next build log (#31295)
## 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-11-11 10:38:53 +00:00
Tim Neutkens
0196b03621
Experimental next/jest config helper (#31246)
* Experimental next/jest config helper

Co-Authored-By: Maia Teegarden <dev@padmaia.rocks>

* Ensure useTypescript is provided

* Move experimental warning to next/jest

* Remove unused code

* Remove unused imports

Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
2021-11-10 16:16:15 -08:00
Jiachi Liu
edb5060fc0
Fix process.env overriden in web runtime (#31261)
Fixes #31258

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-10 18:57:27 +00:00
Donny/강동윤
fd9593542a
Update swc minifier (#31242)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-10 17:39:34 +01:00
Tobias Koppers
9c4c7123b6
run middleware parser handler only for middleware modules (#31219)
## 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-11-10 15:31:46 +00:00
Donny/강동윤
24f7c21736
Update swc (#31233)
## 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`

This applies

 - https://github.com/swc-project/swc/pull/2699

Fixes https://github.com/vercel/next.js/issues/30839
2021-11-10 09:06:04 +00:00
Tim Neutkens
3e8b2dcb6c
Disable styled-components displayName in production (#31216)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-09 12:24:01 -06:00
JJ Kasper
eb7b40171a
Add initial standalone build handling (#31003)
* Add initial standalone handling

* apply suggestions

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
2021-11-09 11:03:20 -06:00
Tim Neutkens
b5b315ae04
Add test for styled-components SWC transform disabled (#31214)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-09 17:18:04 +01:00
Spencer Elliott
a1e76fb966
Use require.resolve to detect "framework" packages (fix pnpm) (#21048)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-09 14:42:23 +01:00
Donny/강동윤
54ca8f41ce
next-swc: Add displayNameAndId of styled-components (#31189)
## 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`




Related to: https://github.com/vercel/next.js/issues/30802
2021-11-09 10:05:31 +00:00
Javi Velasco
5fc4325aa6
Fix middleware i18n rewrites (#31174)
Fixes #30897

This PR fixes the linked issue where rewrites are not being applied for locale. It adds the corresponding test but also, as it was added in debugging process, it introduces a helper to read/write into the `request` object.

We are currently writing directly into the request by casting to `any` and then using flags like `_nextRewrote`. Instead, this PR puts all of this metadata under a symbol so it is not directly accessible. This also allows to have a single place where all of this metadata is listed so we can add comments describing the purpose of each flag.

In the same way, there is metadata written in the querystring. This is adding some types for it in order to throw some visibility on where is this metadata accessed. In an upcoming PR we can move all of it to the `request` object if possible to simplify the system.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-11-09 01:28:39 +00:00
Tim Neutkens
9fe0fda5b4
Add input/output test for 30091 (#31166)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-08 20:40:27 +01:00
Tobias Koppers
283af4e69b
use loader-utils 2 for resolve-url-loader to fix ./data: urls in sass (#31134)
upgrade to loader-utils 3.1.2 for hash fix

fixes #31016
fixes #30998
2021-11-08 18:37:25 +00:00
Maia Teegarden
bc88831619
Add next-swc jest transform (#30993)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-08 17:35:04 +01:00
Shu Ding
feed67ee36
Enable code splitting for the web runtime build (#31090)
When using the web runtime with SSR streaming, this PR significantly improves the build speed for large applications when there're large modules shared by most pages.

With another optimization, `react-dom` will now be excluded in the web runtime build if it's imported in the application. It will only take effect in the client bundle.

## 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-11-08 12:41:49 +00:00
Jiachi Liu
cfb8cc841e
Change .web extension of document page to part of path (#31116)
Fixes: #31104

This effecting users who are using expo with next (`@expo/next-adapter`) since react-native use `.web`, `.ios` and `.android` to identify platform. [Reference](https://docs.expo.dev/guides/using-electron/#%F0%9F%A7%B8-behavior)

Change `document.web.js` to `document-web.js` as fallback page in web runtime
2021-11-07 22:14:50 +00:00
Tim Neutkens
f8e66610b6
Change disabled SWC message to Log.info (#31091)
Based on feedback from @flybayer, this changes the `warn - ` to `info -` for the "Disabled SWC" message.



## 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-11-06 18:37:24 +00:00
Jiachi Liu
e029ace5ed
Fix custom 404 page when concurrentFeatures is enabled (#31059)
x-ref: https://github.com/vercel/next.js/issues/30424#issuecomment-955615781

This fix the custom 404 is not rendering properly and can’t be built in web runtime when `concurrentFeatures` is enabled. We force 404 page to be rendered outside of middleware ssr. Then it could be the real fallback 404 page in next-server when any routes is not macthed. 
Will check 500 related after #31057 is landed.

## Bug

- [x] Related to #30989
- [x] Integration tests added
2021-11-06 11:27:40 +00:00
Shu Ding
d2c1888a25
update serverless plugin to use webpack 5 apis (#31058)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-06 01:19:25 +01:00
Shu Ding
b75b2f02c9
Improve error handling in the SSR middleware (#31057)
This PR improves error handling in the SSR middleware. Previously the response was sent out synchronously, and and errors were silently swallowed. There was no `.catch` for `renderToHTML`. This changes the middleware to be asynchronous, which waits until the initial Document to be rendered correctly and then starts the streaming. 

With this change we can also send correct status code when there're immediate errors before Fizz.

## 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-11-05 22:59:46 +00:00
Shu Ding
0307ba0d1d
Optimize the SSR middleware runtime size (#30906)
By conditionally importing `react-dom/server` under the web runtime and reusing `renderToReadableStream` instead of `renderToStaticMarkup`, we can get rid of the legacy browser React DOM server from the runtime. ~Furthermore we can make the build target `es6` for the SSR middleware, and make some code paths tree-shakable (done in another PR).~

Together this makes the runtime ~32kb smaller.

## 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-11-05 21:51:10 +00:00
Javi Velasco
6e081e175f
Update middleware eval checks (#30883)
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>

With this PR we are updating the way we check the usage of `eval` and other dynamic code evaluation (like `new Function`) for middleware. Now instead of simply showing a warning it will behave differently depending on if we are building or in development.

- Development: we replace the dynamic code with a wrapper so that we print a warning only when the code is used. We don't fail in this scenario as it is possible that once the application is built the code that uses `eval` is left out.
- Build: we detect with tree shaking if the code that will be bundled into the middleware includes any dynamic code and in such scenario we make the build fail as don't want to allow it for the production environment.

Closes #30674

## 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-11-05 20:48:43 +00:00
Tobias Koppers
177e15b6ba
pass Buffer directly to Rust (#30975) 2021-11-05 15:12:06 +01:00
Shu Ding
bc19c2a564
Fix code splitting and build target for the server-web build (#30972)
- Code splitting should be disabled for the server-web build. Done via `ServerlessPlugin`.
- ~Target can't be `web`, `webworker` is better.~ Using `web` and `es6` for now, still not ideal.
- https://github.com/acornjs/acorn/issues/970

## 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 `yarn lint`
2021-11-05 03:27:02 +00:00
JJ Kasper
bf097f1d0f
Update resolving for node_modules trace pass (#30985)
* Update resolving for node_modules trace pass

* Update test
2021-11-04 20:09:37 -05:00
Tim Neutkens
ad6b9c2d4d
Fix version in trace (#30982)
Noticed the trace can't be imported because the tags are a nested as apparently the type was not restrictive of 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-11-04 20:56:30 +00:00
Jiachi Liu
0c494af97c
Use absolute document and app paths for the middleware SSR loader (#30963)
* use absolute path

* use absolute path

* update test

* rename modern -> web

Co-authored-by: Shu Ding <g@shud.in>
2021-11-04 14:10:07 -05:00
Tobias Koppers
5e99b7b51b
fix preset name for improved performance (#30954) 2021-11-04 14:17:24 +00:00
Donny/강동윤
e8e4210f9f
next-swc: Add .bundle() (#30935) 2021-11-04 13:23:25 +01:00
Maia Teegarden
ec19198227
Fix styles that should not be made dynamic (#30928) 2021-11-04 10:24:21 +01:00
JJ Kasper
5de4f668ed
Update to use project dir for file tracing base (#30857)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-04 10:23:28 +01:00
Nicolas
19a6158631
Add config support for build activity indicator position (#30109)
When you edit your code, and Next.js is compiling the application, a compilation indicator appears in the bottom right corner of the page.

In some cases this indicator can be misplaced on the page, for example, when conflicting with a chat launcher. To change its position, open `next.config.js` and set the `buildActivityPosition` in the `devIndicators` object to `bottom-right` (default), `bottom-left`, `top-right` or `top-left`.

I also added the documentation for both `devIndicators.buildActivity` & the new `devIndicators.buildActivityPosition`.

## Feature

- [x] Implements a new feature
- [x] Documentation added
2021-11-03 21:17:36 +00:00
Tim Neutkens
80f959f6b5
Move browserslist loading webpack-config.ts (#30889) 2021-11-03 19:38:04 +01:00
Donny/강동윤
9a31a4fb72
Update swc (#30890)
## 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`


This applies

 - https://github.com/swc-project/swc/pull/2637

This makes inlining not work for more cases, and fixes `@emotion/react` and `murmur2`.
2021-11-03 14:31:25 +00:00
Tim Neutkens
1ddd8de166
Add Next.js version to trace (#30881) 2021-11-03 12:51:55 +01:00
Maia Teegarden
5f72810dd6
Fix lost combinator before global (#30771) 2021-11-03 10:00:49 +01:00
Donny/강동윤
2004d49198
Update swc (#30859) 2021-11-03 09:31:31 +01:00
Shu Ding
0fa233b727
Fix client component imports are not being correctly tracked (#30853)
* ensure client components are correctly tracked in the client compilation

* fix test
2021-11-02 21:14:14 -05:00
JJ Kasper
507ac981ef
Ensure dev react bundles are not ignored in traces (#30849)
* Ensure dev react bundles are not ignored in traces

* update test

* update lock
2021-11-02 19:02:16 -05:00
Tobias Koppers
3674ccb3df
update mini-css-plugin and remove experimentalUseImportModule (#30617)
- Fixes #30366
- Closes #30367
2021-11-02 21:56:11 +00:00
Jiachi Liu
ce1a170687
Improve error message for importing unsupported native modules (#30829)
Improvement for #30696, covering more native module when failed on edge runtime
2021-11-02 21:03:29 +00:00
Steven
14841c9430
Fix incorrect _document.js error when disableStaticImages: true (#30768)
Fixes #30600
2021-11-02 20:25:12 +00:00
JJ Kasper
c8d0a1bc0b
Re-enable minifying middleware chunks (#30823)
This re-enables minifying middleware chunks as testing on nextjs.org and front shows it is working properly now. The separation of middleware chunks from other client chunks is still kept in this PR to ensure client code doesn't leak into middleware bundles. 

Closes: https://github.com/vercel/next.js/issues/30798

## 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-11-02 17:37:50 +00:00
Tim Neutkens
cbc52d1b31
Update loader-utils (#30743)
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2021-11-02 16:13:15 +01:00
Tim Neutkens
64e414160d
Add regenerator path (#30786) 2021-11-02 12:11:53 +01:00
Donny/강동윤
e79f788f74
Update swc (#30790)
## 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`



This PR applies

 - https://github.com/swc-project/swc/pull/2610

This increases the pass limit (which is required to prevent hanging) from 30 to 100.
Fixes https://github.com/vercel/next.js/issues/30636.

 - https://github.com/swc-project/swc/pull/2625

This marks assignment with operators as `usage`+ `assign`. Previously it was only `assisgn`. This is to preserve assignments to variables used like `(a += '').split('.'))`.

Fixes https://github.com/vercel/next.js/issues/30414.

---

I expect this to fix some more issues on next.js repository, but I didn't list them because it's not tested.
2021-11-02 10:57:09 +00:00
Maia Teegarden
a89e65133d
Keep attempting to load binary files after failure (#30755)
Multiple binaries may be installed when only one of them will work with
the host machine (limitation of `optionalDependencies`). Failing to
`require` a binary that exists does not necessarily mean there is a
problem with the binary. We need to keep checking if other binaries work.

Fixes #30713



## 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-11-01 20:14:28 +00:00
Shu Ding
73928c01f1
Improve error message for importing native Node APIs in the edge runtime (#30696)
This PR improves the error message for the case that `fs` is being imported under `concurrentFeatures`. This is a common error, but the current console output isn't very clear about the cause.

The new output will be:

> Native Node.js APIs are not supported in the Edge Runtime with \`concurrentFeatures\` enabled. Found \`fs\` imported.

Related to #30424.

## Bug

- [x] 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 `yarn lint`
2021-11-01 11:40:21 +00:00
Donny/강동윤
39283f1846
Update swc (#30685)
## 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`




- This fixes error message about unsupported cpu features.
- This applies https://github.com/swc-project/swc/pull/2597
  - This fix an infinite loop issue related to `@ericblade/quagga2`
2021-10-31 12:15:39 +00:00
Tim Neutkens
8a6307fc57
Remove isCommonJS check as it has been moved to next-swc (#30677)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-10-30 17:37:35 -05:00
Jiachi Liu
622a1a5549
Provide default fallback _document and _app for for concurrent mode (#30642)
* if _app is not provided, fallback to default _app page
* If _document is not provided, fallback to inline functional components version or use the default
* if Document gIP is provided, error

Closes #30654
2021-10-30 21:35:31 +00:00
Donny/강동윤
4ada314663
Add auto-commonjs and update swc (#30661)
Closes #30596



## 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`


 - This patch contains several patches from swc.

This includes https://github.com/swc-project/swc/pull/2581, which allows customizing the import path for regenerator.

 - This adds auto-detection of common js.

If `module.exports` is found and module config is not set, module config becomes common js.

 - As bonus, this includes some performance improvements

The logic for analyzing the input source file and parsing options as json is moved from the js thread to a background worker thread.
2021-10-30 13:31:58 +00:00
Leroy Witteveen
d8cb8c5fbc
Fixed "Expected jsx identifier" error on TypeScript generics & angle bracket type assertions in .ts files (#30619)
* Fixed "Expected jsx identifier" error on TypeScript generics & angle bracket type assertions

* Ignore error from node-notifier on M1

* Add tests

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-10-30 14:51:42 +02:00
Shu Ding
48874f1a44
Fix missing dev option for the middleware SSR loader (#30639)
Currently the `dev` option isn't passed to the render function inside the middleware SSR loader. This PR fixes it with a test case. 

Fixes #30547.

## Bug

- [x] 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 `yarn lint`
2021-10-30 09:20:26 +00:00
JJ Kasper
599081acdf
Update output tracing to do separate passes (#30637)
* Update output tracing to do separate passes

* fix windows backslashes
2021-10-29 17:39:51 -05:00
Maia Teegarden
b5a89160f7
Chore/rust workflow (#30577)
* Remove prebuilt binaries from repo

* Prefer locally built binary

* Add binary packages as optionalDependencies

* Remove build-native workflow for prebuilt binaries

* Remove binaries from checkCompiled job

* Change build-native command to default to dev

* Add build-native-dev and have tests depend on it

* Update contributing

* Run ls to make inspect artifact download

* Use correct artifact download path

* Try using reusable workflows

* Resort to duplication for now

* Inspect artifact download

* Ensure native is copied for PR stats

* Copy after ref checkout and log binaries for PR stats

* fix typo

* copy right before linking/packing

* Use fs.copy

* fix test for now

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-10-29 13:56:56 -05:00
Jiachi Liu
fb100ee72b
Check react 18 flags and add more tests (#30575)
* error when react 18 experimental flags aren't setup properly
* add more tests for rsc ssr
2021-10-29 15:59:27 +00:00
Shu Ding
f6b15b5943
Add buffering for streaming until the shell is completed (#30585)
This PR adds buffering to `renderToReadableStream` with `onCompleteShell`, to ensure that we don't flush too early and `<head>` is completed when the client receives the first chunk of data.

X-ref: #30547.
2021-10-29 10:17:35 +00:00
Maia Teegarden
1e2fb0bb2b
Fix redundant styled-jsx global issue (#30584)
Fixes https://github.com/vercel/styled-jsx/issues/756

## 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-10-29 01:26:48 +00:00
JJ Kasper
18fc5488f9
Fix publish native including non-packages (#30589) 2021-10-28 19:36:30 -05:00
Jiachi Liu
5b4ad4a1c1
Simplify rsc related configs and fix test (#30546)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-10-28 19:02:55 +02:00
JJ Kasper
63024d32b4
Update publish-native to not block on error (#30565) 2021-10-28 11:26:09 -05:00
Tobias Koppers
93341345db
Update swc (#30552)
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2021-10-28 17:07:48 +02:00
Tobias Koppers
c0dd481ea6
exclude musl from target (#30557) 2021-10-28 16:58:58 +02:00
Tobias Koppers
215fa85c8e
Revert "Update swc to fix minifier issue (#30540)" (#30551)
This reverts commit 387d6564ae.
2021-10-28 15:11:55 +02:00
Donny/강동윤
387d6564ae
Update swc to fix minifier issue (#30540)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-28 13:59:45 +02:00
Donny/강동윤
3a9f008c99
Update swc (#30509)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-28 12:25:54 +02:00
JJ Kasper
215cc58562
Update to copy necessary RSC files from dep (#30505)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-10-28 11:07:13 +02:00
JJ Kasper
82001f2d54
Share resolve logic for trace and externals (#30499)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-10-28 10:14:09 +02:00
Maia Teegarden
fe16ab0f22
Fix issue with placeholder followed by numbers (#30493)
* Fix issue with placeholder followed by numbers

* Build next-swc binaries
2021-10-27 17:07:45 -07:00
Tim Neutkens
aadc653665
Make sure externals is an array (#30466)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-10-27 19:48:10 +02:00
Tobias Koppers
ddc916ce74
remove console.log (#30447) 2021-10-27 17:13:57 +02:00
Donny/강동윤
ddcfab4447
Update swc (#30426)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-10-27 16:55:35 +02:00
Tobias Koppers
f7048b55ec
fix external fallback for invalid packages (#30427)
fallback to alternative external version also when it fails because of base resolve mismatch#

fix resolved .mjs modules treated as external

fixes #30330
2021-10-27 13:53:44 +00:00
Donny/강동윤
979e9bd94f
Update swc (#30404)
## 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`


This includes

 - https://github.com/swc-project/swc/pull/2530
   - Strip out `declare`-d class properties properly.

 - https://github.com/swc-project/swc/pull/2538
   - Marks method properties as a scope while renaming variables.
   - Fix regression of object-rest pattern handler.
   - Improve name mangler a bit, by marking it as a scope.

 - https://github.com/swc-project/swc/pull/2551
   - Fix a bug of the property inlining pass which can break many react apps.

There is a minor regression in the minifier due to added aliasing check.


(I manually selected crates to update)
2021-10-27 08:18:21 +00:00
Donny/강동윤
a796cedf97
Disable loading of .swcrc (#30384)
We found that `.swcrc` was unintentionally loaded breaking applications as it is not tested for that yet, customization will be added at a later point in time



## 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-10-26 23:54:55 +00:00
Jiachi Liu
8e4055433e
Fix exportRuntime and react-18 concurrent tests (#30381)
* disable concurrent test cases in short term to improve them later
* remove bad alias in next.config.js
2021-10-26 23:17:55 +00:00
Jiachi Liu
8077f4213d
lint: remove unused (#30370) 2021-10-26 23:02:51 +02:00
Tobias Koppers
3d035cea3c
fix rsc on windows (#30364) 2021-10-26 22:24:28 +02:00
Tobias Koppers
95607130a0
keep sortedMiddleware intact as it's used by the runtime (#30361)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-10-26 22:18:08 +02:00
Jiachi Liu
c2541e2fd9
Fix flight loader parsing (#30345) 2021-10-26 20:13:51 +02:00
JJ Kasper
4c83292a84
Update SWC OS and CPU fields (#30341)
* Update SWC OS and CPU fields

* co-authored-by: CanKolay5677 <80613396+CanKolay5677@users.noreply.github.com>
2021-10-26 13:11:31 -05:00
Tim Neutkens
2fa8caa999
Clear up confusion around SWC being disabled for Babel while swcMinify is on (#30337) 2021-10-26 12:59:37 -05:00
Shu Ding
5ddee4494b
Add new target for middleware (#30299)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-10-26 18:50:56 +02:00
Javi Velasco
c497b3a5ff
Improve deprecation errors for new middleware API (#30316)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2021-10-26 17:03:39 +02:00
JJ Kasper
8b85801852
Ensure null bytes in resolved path are handled (#30313)
This ensures we remove null bytes from the resolved path as it isn't valid when using `path`/`fs`. Additional tests have been added to ensure this is handled properly. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/30298
2021-10-26 13:16:48 +00:00
Maia Teegarden
0ab8c7ada6
Track usage of swc features (#30297)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-10-26 09:37:38 +02:00
JJ Kasper
9eceb95596
Move outputFileTracing config up (#30295)
* Move outputFileTracing config up

* remove old nftTracing config

* remove old config

Co-authored-by: Steven <steven@ceriously.com>
2021-10-25 23:22:45 -05:00
Maia Teegarden
20da8079f3
Chore/publish all swc (#30289)
* Publish more swc targets

* Remove prebuilt binaries

* Use correct path for caching

* Build next-swc binaries

* Remove unused job dependency
2021-10-25 19:00:36 -07:00
JJ Kasper
73fbd698bd
Fix trace case with tsconfig/jsconfig baseUrl (#30286) 2021-10-25 18:38:30 -05:00
JJ Kasper
1a10ab8c39
Update error for failing to load SWC bindings (#30269) 2021-10-25 12:23:44 -05:00
Donny/강동윤
085df63bf9
next-swc: Support more platforms (#30254)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-10-25 17:00:48 +02:00
Tim Neutkens
467bf08a8a
Add events polyfill (#30256) 2021-10-25 15:32:01 +02:00
Tim Neutkens
bc3ab3ce94
Move swcMinify out of experimental (#29810) 2021-10-25 13:49:11 +02:00
JJ Kasper
474f1e7d93
Add initial test trace outputs (#30246) 2021-10-25 08:21:57 +02:00
Tim Neutkens
deaf1678b0
Ensure isServer is true when compiling middleware (#30242)
* Ensure isServer is true when compiling middleware

* Update packages/next/build/webpack-config.ts

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>

* Update packages/next/build/webpack-config.ts

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-10-24 20:05:27 -05:00
Tobias Koppers
04e1e01f18
test, fix and document all possible import types for URL imports (#30165)
resolve absolute URLs in CSS when using urlImports
remove `[path]` from static static image output path
replace file-loader with asset module, remove file-loader
2021-10-25 01:54:16 +02:00
Steven
367a420d5c
Use Log.warn() instead of console.warn() in next-server (#30240)
* Use Log.warn() instead of console.warn() in next-server

* Update test and update build warn as well

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-10-24 17:27:00 -05:00
Tobias Koppers
df613d3909
fix some labels for middleware stuff (#30241)
* show `(client only)` for _middleware files

* show f symbol for _middleware files in summary tree

add explanation
show only used symbols
2021-10-24 17:09:47 -05:00
Tobias Koppers
3bb098f882
hide next-middleware-loader in import trace (#30243) 2021-10-24 23:04:46 +02:00
Tobias Koppers
d2f96f5f9c
partially migrate to webpack 5 types (#30189)
fix type declarations to avoid import from webpack/webpack4/webpack5 in type declarations
2021-10-24 23:04:26 +02:00
JJ Kasper
9d4e7b45dc
Add initial documentation for output file tracing (#30199)
* Add initial documentation for output file tracing

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
2021-10-24 10:39:22 -05:00
Donny/강동윤
1acc9dd5da
Update swc (#30230)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-24 15:56:33 +02:00
Tim Neutkens
7edeca13d1
Use SWC for middleware (#30209) 2021-10-24 15:26:36 +02:00
Tim Neutkens
417ad95e04
Add isDevfallback to cache name to create a separate cache for the fallback compiler (#30227) 2021-10-24 15:25:02 +02:00
Tim Neutkens
08a7f7f31a
Enable SWC by default when there is no custom Babel config (#29811)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
Co-authored-by: padmaia <padmaia@users.noreply.github.com>
2021-10-23 10:21:44 +02:00
JJ Kasper
7054096b76
Move tracing next-server to next build (#30190)
As discussed this moves tracing `next-server` into `next build` since the pre-trace at publish time isn't able to reliably give us file locations since `node_module` file locations can vary based on installation. This also adds caching the trace so that we only need to retrace `next-server` when a lockfile changes. 

A follow-up PR will add documentation for these traces explaining how they can be leveraged. 

## 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-10-22 23:49:38 +00:00
Maia Teegarden
d5aa0387b9
Add page config swc transform (#30183)
* Add page config swc transform

* Build next-swc binaries

* Disable page config transform in some scenarios

* Build next-swc binaries

* Only skip dropping bundle in dev mode

* Build next-swc binaries

* Allow for amp 'hybrid' configuration

* Build next-swc binaries
2021-10-22 16:08:09 -07:00
JJ Kasper
243175f049
Add middlewareCount info to build optimized (#30185)
This adds info on number of `_middleware` routes being used. 

## 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-10-22 20:12:12 +00:00
Tobias Koppers
ab50a4e344
make import trace consistent between runtime and build (#30175) 2021-10-22 19:32:25 +00:00
JJ Kasper
ff474b01db
Update include/exclude handling for output tracing (#30184)
* Use micromatch for excludes and add tests

* update compiled

* check glob array once per file
2021-10-22 13:55:45 -05:00
Tobias Koppers
5c35066820
make static image import output path consistent with other media (#30168)
This will ensure an image hashed consistently regardless of how its imported:

- `import file from "./file.png"` -> /_next/static/media/file.12345678.png
- `url(./file.png)` -> /_next/static/media/file.12345678.png
-  `new URL("./file.png", import.meta.url)` -> /_next/static/media/file.12345678.png
2021-10-22 13:25:54 +00:00
Tobias Koppers
8a4d1f75f2
test and fix error reporting for stack overflows and other fatal errors (#30169)
## 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-10-22 10:30:50 +00:00
JJ Kasper
67681fe097
Replace middleware flag with warning (#30160)
Follow-up to https://github.com/vercel/next.js/pull/30154 this replaces the experimental flag with a warning that is shown once on usage instead.
2021-10-22 06:40:57 +00:00
JJ Kasper
7e81d13a8e
Add experimental config for middleware (#30154)
* Add experimental config for middleware

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
2021-10-21 22:00:51 -05:00
Steven
022675404b
Use default next.config.js if not found (#30155)
Some warnings/errors will mention `next.config.js` even if it doesn't exist so we'll make sure to assign a default value of `next.config.js`.

- Follow up to #30152
2021-10-22 01:18:57 +00:00
Steven
6f3e9470a6
Ensure error message prints next.config.mjs (#30152)
This PR ensures we print the correct error message for either `next.config.js` or `next.config.mjs`, whichever was detected.
2021-10-21 23:04:40 +00:00
JJ Kasper
97f0752e47
Update middleware chunk handling (#30151)
* Update middleware chunk handling

* fix lint
2021-10-21 17:00:26 -05:00
JJ Kasper
1e2c4c4c00
Ensure we dont attempt minifying middleware-chunks (#30147)
Follow-up to https://github.com/vercel/next.js/pull/30122 this ensures we don't minify the accompanying `middleware-chunks` either.
2021-10-21 18:41:36 +00:00
Donny/강동윤
15ad98de32
Update swc (#30141)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-21 16:47:05 +02:00
Tobias Koppers
d07107f2c6
add experimental.urlImports option (#30079)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2021-10-21 13:14:57 +02:00
Tobias Koppers
8bce51d8a9
avoid showing empty Import trace for requested module (#30130)
## 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 `yarn lint`
2021-10-21 10:07:02 +00:00
Donny/강동윤
5f73633d4d
Update swc (#30127)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-21 08:31:36 +02:00
Maia Teegarden
282c1c9d7c
Fix creation of styled jsx ids (#30124)
Ids of dynamic styles now match ids in dynamic class names (`_JSXStyle.dynamic()`) when there are mixed styles (global/static).

## 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
2021-10-21 03:56:57 +00:00
JJ Kasper
0ac0b3f19f
Skip minifying middleware (#30122)
This skips minifying middleware as it can cause issues in some cases like the below error and also isn't necessary to be minified as we don't currently minify other server pages. 

```
TypeError: (intermediate value)(intermediate value)(intermediate value)(...) is not a function
```
2021-10-21 02:33:42 +00:00
Tobias Koppers
ecf2ee9c51
automatically enable managed paths for all node_modules (#30089)
This improves caching performance in monorepos where there are multiple node_modules folders
Automatically enable immutable paths for Yarn PnP
2021-10-21 01:25:45 +00:00
Tobias Koppers
b2a9918165
improve production error message printing (#30065)
* improve production error message printing

* update test cases

* add test case

* improve printing of build errors

* improve types

* fix test cases
2021-10-20 18:23:44 -05:00
Tobias Koppers
610d2b37c8
use xxhash64 by default (#30095)
Node.js 17 stopped supporting md4 as hash function

and we wanted to use a faster hash function anyway.

Fixes: https://github.com/vercel/next.js/issues/30078
2021-10-20 21:39:55 +00:00
JJ Kasper
f068319d4d
Enable shared worker pool by default (#30110) 2021-10-20 14:06:43 -05:00
Javi Velasco
a815ba9f79
Implement Middleware RFC (#30081)
This PR adds support for [Middleware as per RFC ](https://github.com/vercel/next.js/discussions/29750). 

## 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
2021-10-20 17:52:11 +00:00
Tim Neutkens
78ce76553b
Enable fast refresh transform when using SWC (#30106) 2021-10-20 16:07:35 +02:00
Donny/강동윤
981348761b
Update swc (#30086)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-20 14:14:26 +02:00
Donny/강동윤
f308b8a352
Update swc (#30066)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-19 17:50:07 +02:00
Donny/강동윤
6f5ec2bd96
Update swc (#30057)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-19 13:34:54 +02:00
Donny/강동윤
caef3373da
Update swc (#30055)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-19 09:16:59 +02:00
JJ Kasper
5e034940d1
Update manifest to include notFound revalidate info (#30046)
This ensures we include `notFound` routes in the `prerender-manifest` routes so that we have the `revalidate` information available.
2021-10-19 00:27:20 +00:00
JJ Kasper
afbb56363b
Fix trace when initial file is also child (#30048)
* Fix trace when initial file is also child

* update page count test
2021-10-18 17:39:18 -05:00
JJ Kasper
071ecb0b7b
Update tracing to collect from reasons (#29975)
This updates the `outputFileTracing` to fix a few cases we noticed where files weren't caught and also ensures we match webpack's `esm` resolving so that we don't include `cjs` files when webpack expects `esm`, it also updates to the latest `@vercel/nft` version which removes the caching in favor of ensuring the `reasons` map contains all parents allowing us to trace all entries in one `nodeFileTrace` run and the collect the separate files for each entry from the `reasons` map giving us much better performance/reliability.  

This also ensures we don't include static image imports when enabled in the traces since they can drastically increase deployment size on larger projects.
2021-10-18 17:01:02 +00:00
Donny/강동윤
b7114bce43
Update swc to fix regenerator issue (#30035)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-18 18:14:25 +02:00
Steven
777957e6b1
Compile native-url and node-libs-browser (#30032)
This prevents useless warnings about querystring.

```
warning next > native-url > querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning next > node-libs-browser > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
```
2021-10-18 15:46:39 +00:00
Donny/강동윤
a4eda09eab
Update swc (#30029)
* Update swc

* Build next-swc binaries

Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-18 15:18:40 +02:00
Donny/강동윤
486d82434b
Update swc (#30019)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-18 10:48:26 +02:00
Donny/강동윤
9885ab6282
Update swc to fix minifier (#29989)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-17 16:25:37 +02:00
Donny/강동윤
7e5391268f
Fix identifier handling ofstyled-jsx (#29986)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-17 12:17:13 +02:00
Donny/강동윤
a3fcebc3ee
Update swc (#29969)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-17 09:50:01 +02:00
Tim Neutkens
7e370134fb
Use import() to load next.config.js (#29935)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2021-10-16 14:22:42 +02:00
Steven
80e5180e05
Update webpack target to node12.22 (#29953)
Follow up to #29949
2021-10-15 22:33:44 +00:00