Commit graph

3972 commits

Author SHA1 Message Date
Gerald Monaco
d2551bbbc7
Render as a concatenation of streams (#28082)
Return the `RenderResult` as a concatenation of streams, rather than a concatenation of strings.
2021-08-13 16:40:12 +00:00
Maia Teegarden
2a83012def
v11.1.1-canary.6 2021-08-12 21:10:04 -07:00
Gerald Monaco
08a24780b0
Clean up Document in preparation for streaming (#28032)
We generate the HTML for a document in two steps: First, we generate the body (i.e. everything under `<div id="__next">`). Then we generate the rest of the document and embed the body in it.

This doesn't work when the body is a stream, because React can't render the body for us unless we buffer it, and buffering it means not streaming. This PR takes the existing approach for AMP and uses it for all scenarios: instead of rendering HTML, we just render a placeholder that we can replace with HTML later. This will be used in a follow-up PR to let us know where to concatenate the body stream.

I also used the opportunity to split out `HtmlContext` from `DocumentProps`, as these will not be the same thing with functional document components.
2021-08-13 03:36:54 +00:00
Maia Teegarden
ea6a0f0eda
v11.1.1-canary.5 2021-08-12 19:08:44 -07:00
Steven
b11bd49239
Fix image optimization encoding url (#28045)
- Fixes #27973 
- Reverts #27671 


The problem with PR #27671 is that it was encoding too often when it really only needed to solve the bug for `next build && next start` since `next dev` was already working.

This PR uses the alternative solution mentioned here https://github.com/vercel/next.js/issues/27210#issuecomment-890305204
2021-08-13 00:31:51 +00:00
즈눅
1552b8341e
Fix generateBuildId type that can be async function (#28040)
[The current documentation ensures it can be async function](https://github.com/vercel/next.js/blob/v11.1.1-canary.1/docs/api-reference/next.config.js/configuring-the-build-id.md?plain=1#L13), so this PR fixes the TypeScript type of it.
2021-08-12 22:26:44 +00:00
Maia Teegarden
1302067c74
v11.1.1-canary.4 2021-08-12 14:01:16 -07:00
Maia Teegarden
ff5e444284
Use @next scope for native packages (#28046) 2021-08-12 13:59:53 -07:00
Oscar Busk
25df53d19f
next-env.d.ts note in templates (#27983)
Hello! I was using `npx create-next-app --ts` to quickly bootstrap a basic next.js project with Typescript. It bothered me that I got git diff just from running `npm run build` inside the project, because the new notice in the `next-env.d.ts` file.

![image](https://user-images.githubusercontent.com/13413409/129115266-80e00bf3-78aa-40be-bd0f-a18aaa448a68.png)

So I went ahead and updated the `next-env.d.ts` file in [`packages/create-next-app/templates/typescript`](fb67ce9864/packages/create-next-app/templates/typescript/next-env.d.ts) to be exactly how the file looks after running once. (7417ecc09c)

Then I realized that I could probably do the same for all the `next-env.d.ts` that are spread out in the many examples, to make running those examples after cloning them feel a bit smoother. (fb67ce9864)

> However I skipped the [`with-typescript-graphql`](40f85f6d95/examples/with-typescript-graphql) example since that [`next-env.d.ts`](40f85f6d95/examples/with-typescript-graphql/next-env.d.ts (L4-L9)) actually has changes and I couldn't even run `yarn build` in that example, so I'm not sure what will happen with the `next-env.d.ts`. Someone who _gets_ that example will have to fix it I suppose.
2021-08-12 20:36:53 +00:00
Tobias Koppers
8bbb1cd353
use a shared worker pool for collecting page data and static page generation (#27924)
this avoid loading all code twice and hopefully improving performance
2021-08-12 19:54:49 +00:00
Maia Teegarden
b6411408c0
v11.1.1-canary.3 2021-08-12 10:55:41 -07:00
Maia Teegarden
2d38efa7b5
v11.1.1-canary.2 2021-08-12 10:21:01 -07:00
stefanprobst
9bf322503b
Add missing fields to NextConfig type (#27974)
This PR adds the `poweredByHeader` and `webpack` fields to the public `NextConfig` type.

## 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-08-12 15:42:57 +00:00
Tim Neutkens
06e08accde v11.1.1-canary.1 2021-08-12 17:07:36 +02:00
Tim Neutkens
965a280bc2
Ensure config file message is only shown once (#28017)
Fixes #27982



## 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-08-12 14:33:25 +00:00
Maia Teegarden
b2c7b316cb
Next swc publish flow (redo) (#27984)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-08-12 12:22:50 +02:00
jj@jjsweb.site
988c0c7fd3
v11.1.1-canary.0 2021-08-11 12:13:30 -05:00
Tim Neutkens
ce4adfc02d v11.1.0 2021-08-11 17:52:20 +02:00
Tim Neutkens
092a476feb v11.0.2-canary.31 2021-08-11 17:49:46 +02:00
Tim Neutkens
ebb6a30370 Revert "Add warning during next build when sharp is missing (#27933)"
This reverts commit 51a2a028dd.
2021-08-11 17:47:16 +02:00
Tim Neutkens
52486ceccf v11.0.2-canary.30 2021-08-11 15:59:00 +02:00
Tim Neutkens
8ac3254d25 Revert "Next swc publish flow (#27932)"
This reverts commit 94fc6f0832.
2021-08-11 15:48:15 +02:00
Tim Neutkens
6014b6e0f8 v11.0.2-canary.29 2021-08-11 12:46:11 +02:00
Brody McKee
4cd45aabcf
Add rootDir setting to eslint-plugin-next (#27918)
## Introduction

This PR enables setting a `rootDir` for a Next.js project, and follows the same pattern used by [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsproject).

## Details

Previously, users had to pass paths to the rule itself.
```js
module.exports = {
  rules: { 
    "@next/next/no-html-link-for-pages": [
      "error",
      // This could be a string, or array of strings.
      "/packages/my-app/pages",
    ],
  },
};
```

With this PR, this has been simplified (the previous implementation still works as expected).
```js
module.exports = {
  settings: { 
    next: {
      rootDir: "/packages/my-app",
    },
  },
  rules: { 
    "@next/next/no-html-link-for-pages": "error",
  },
};
```

Further, this rule allows the use of globs, again aligning with `@typescript-eslint/parser`.
```js
module.exports = {
  settings: { 
    next: {
      // Globs
      rootDir: "/packages/*",
      rootDir: "/packages/{app-a,app-b}",

      // Arrays
      rootDir: ["/app-a", "/app-b"],
      
      // Arrays with globs
      rootDir: ["/main-app", "/other-apps/*"],
  },
};
```

This enables users to either provide per-workspace configuration with overrides, or to use globs for situations like monorepos where the apps share a domain (micro-frontends).

This doesn't solve, but improves https://github.com/vercel/next.js/issues/26330.

## Feature

- [x] 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`
- [ ] 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
2021-08-11 10:37:55 +00:00
Maia Teegarden
94fc6f0832
Next swc publish flow (#27932) 2021-08-11 11:03:16 +02:00
Steven
51a2a028dd
Add warning during next build when sharp is missing (#27933)
Follow up to #27346 

![image](https://user-images.githubusercontent.com/229881/128935917-ca6da384-91f4-43d3-8059-4e06220fbc19.png)
2021-08-11 04:03:57 +00:00
Gerald Monaco
459b391775
Add experimental concurrentFeatures config (#27768)
Allows opting in to support for new concurrent features, like server-side Suspense.

**!!! DO NOT USE !!!**
This is highly experimental. We **will** be gating additional breaking changes behind this same flag. 
**!!! DO NOT USE !!!**

Also resolves suspense for static pages (i.e. `getStaticProps` or `next build`/`next export`) since we can't currently support streaming for those cases anyway.
2021-08-11 03:06:42 +00:00
Alex Castle
12eb812243
Add data-nimg attribute to image component (#27899)
This PR adds a single data attribute to the image element generated by the image component `data-nimg`) which just serves to signal that this image element is from the component. Currently it's hard to quickly/programmatically determine with certainty whether an image is from the component or not, so this change should make it easier for us to diagnose and improve performance issues related to the image component.
2021-08-11 00:58:15 +00:00
Steven
b4be678e35
Remove duplicate type for StaticImageData (#27931)
Follow up to #27916 

This interface was defined twice so I removed the private one and kept the global/public one.

eb871d3091/packages/next/image-types/global.d.ts (L4-L9)

b881d65c12/packages/next/client/image.tsx (L60-L65)
2021-08-11 00:13:35 +00:00
Tobias Koppers
681d298bdf
update to webpack 5.50.0 (#27929)
* performance improvements for cache serialization
* disabled cache compression by default (next.js is using webpack default again)
* support hashbang
2021-08-10 19:20:50 +00:00
Janicklas Ralph
43393d53be
Fix next/script unhandled promise rejection (#27903)
## Bug

- [x] fixes #27747
- [x] Integration tests added
2021-08-10 17:41:26 +00:00
stefanprobst
eb871d3091
Replace placeholder with blurDataURL in global StaticImageData type (#27916)
I think the global `StaticImageData` type does not currently match what actually gets imported, and what the `Image` component expects (see [here](https://github.com/vercel/next.js/blob/canary/packages/next/client/image.tsx#L60-L65)). This PR changes `placeholder` to `blurDataURL`.

## 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-08-10 15:51:08 +00:00
Tim Neutkens
8cbaa409ca v11.0.2-canary.28 2021-08-10 11:01:53 +02:00
Jiachi Liu
9d3e895124
Upgrade styled-jsx to v4 (#27890)
Upgrade styled-jsx to v4 for supporting concurrent mode in react 18 


## 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-08-09 17:57:11 +00:00
stefanprobst
1969124d07
Add type annotation for NextConfig to CNA typescript template (#27872)
This adds a type annotation for the `NextConfig` type to `next.config.js` in the `create-next-app` typescript template.

## 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-08-09 17:13:30 +00:00
Nick Kelly
b60c943750
Remove extraneous fs.stat calls (#27779)
## Performance improvement

- [x] Performance improvement

Uses `fs.readdir`'s  `withFileTypes` option, added in NodeJS version 10,  to simultaneously read the target directories files and their stats, removing the need to call `fs.stat` on each of the files individually.

Similar to #27769, applies the same change to `recursiveCopy` and `recursiveDelete`.
2021-08-09 15:28:00 +00:00
Tobias Koppers
c6ba688c40
disable cache compression as it slows down the build (#27887) 2021-08-09 14:13:50 +00:00
Tim Neutkens
331fed89f3
Add Import trace for requested module when it fails to resolve (#27840)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-08-09 14:38:26 +02:00
Tim Neutkens
04bbea2cbe Add sourceFileName for SWC compiled core files
Fixes the vscode debugger breakpoints. Thanks @kdy1 for implementing the `sourceFileName` option in SWC.
2021-08-06 22:02:08 +02:00
JJ Kasper
e57b959e17
v11.0.2-canary.27 2021-08-06 13:45:57 -05:00
Maia Teegarden
7992b14a78
Add next dynamic swc transform (#27745)
Ported `packages/next/build/babel/plugins/react-loadable-plugin.ts` to swc
2021-08-06 16:53:32 +00:00
JJ Kasper
b24cd1eaba
Use @vercel/fetch for run-tests requests (#27815)
* Use @vercel/fetch for run-tests requests

* update precompileld
2021-08-06 10:20:05 -05:00
Tim Neutkens
d2f43b718f
Add experimental SWC minify and SWC loader options (#27664) 2021-08-06 16:07:36 +02:00
Tobias Koppers
e3e7e0840d
update webpack to 5.49.0 (#27813)
https://github.com/webpack/webpack/releases/tag/v5.49.0
2021-08-06 12:49:21 +00:00
Jiachi Liu
567d47b65c
Upgrade styled-jsx (#27782)
* Update styed-jsx to latest version, containing bugfixes for babel plugin and typings.
* Use `/// <reference>` instead of redeclaring types


## 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-08-05 18:04:38 +00:00
JJ Kasper
fa01a1593e
Update client error to show link in console (#27789)
* Update client error to show link in console

* Apply suggestions from code review
2021-08-05 10:38:06 -05:00
Sjors Smits
d313855978
Wrap last return statement in else to fix tree shaking (#27788)
## Bug

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

fixes #27744
2021-08-05 13:34:22 +00:00
Orta Therox
504d478351
Minor typo fix in the @next/mdx README (#27784)
N/a
2021-08-05 09:02:38 +00:00
JJ Kasper
f15d05754d
v11.0.2-canary.26 2021-08-04 22:15:26 -05:00
Houssein Djirdeh
df83ccb7cd
[ESLint] Documentation updates + bug fixes (#26331)
Documentation:

- Expands the "Migrating Existing Config" section of ESLint doc to explain in more detail
- Minor changes to the "Ignoring ESLint" doc

Bug fixes:

- Adds `browser` and `node` environments to `eslint-config-next`. Closes #26319
- Fixes `no-document-import` rule. Closes #26159
- Fixes `no-page-custom-font` rule. Closes #26160 #26894
2021-08-05 00:58:06 +00:00