Commit graph

227 commits

Author SHA1 Message Date
JJ Kasper
d670c5c860
Update publish-native script for wasm change (#57472)
x-ref:
https://github.com/vercel/next.js/actions/runs/6649134570/job/18067246584
x-ref: https://github.com/vercel/next.js/pull/57437
2023-10-25 21:41:43 -07:00
Sukka
ebcc855af6
chore: revert back to moving files w/ fs-extra (#57030)
Follows #56917, revert back to moving files using `fs-extra`. This should help with the flaky `fs.rename` operation on Windows.

cc @styfle
2023-10-19 13:29:19 +00:00
Sukka
17553c5e25
chore: reduce fs-extra usage in scripts/ (#56917)
The PR follows #56536 and #56491, replacing `fs-extra` usages inside the `scripts/` folder.

Note that the `copy` and `move` haven't been replaced yet. Currently, there is no better recursive copy (lightweight, promise-based, Node.js built-in `copyFile` API-based, support the `filter` option) library alternative available on npm, and Node.js built-in `fs.rename` doesn't support `overwrite`.

The PR also replaces many async fs API usage with their sync versions.

cc @wbinnssmith
2023-10-17 19:31:19 +00:00
Zack Tanner
e7fc6f3708
ensure kodiak is re-added to apps list after code-freeze action (#56907)
ensures that after the code-freeze action, Kodiak is re-added to the restrictions list

[slack x-ref](https://vercel.slack.com/archives/C04DUD7EB1B/p1697491473466249)
2023-10-16 22:00:02 +00:00
Ryan LaBarre
b436589ff8
Maintenance: minor example dep bumps to fix moderate vulns (#56375)
### What?
Merged a bunch of dependabot alerts in my own canary branch, mainly
postcss patch updates, and one graphql minor update, to fix moderate
security vulnerabilities in examples. Spot checked most and look good
still. EDIT: also one in scripts/send-trace-to-jaeger

### Why?
Because safety

### How?
Dependabot

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Steven <steven@ceriously.com>
2023-10-04 11:18:54 -04:00
JJ Kasper
aa3377edec
Fix code freeze disable handling (#56340)
Fixes: https://github.com/vercel/next.js/actions/runs/6388368482
2023-10-03 13:54:46 +00:00
JJ Kasper
a970f28439
Add code freeze GitHub actions for releasing (#56325)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-10-02 23:10:40 +02:00
Steven
12c800e35c
chore: remove chalk in favor of picocolors (#55992)
Similar to PR https://github.com/vercel/next.js/pull/53115, this PR removes `chalk` in favor of `picocolors`
2023-09-27 21:00:52 +00:00
Jimmy Lai
76c9b2c469
misc: improve profiling script (#55732)
This PR improves the minimal server script by adding a slightly better look require profiler + some misc utility changes. This is eventually gonna be the basis for a `next profile` command.

This is what the output look like + its usage.
https://app.warp.dev/block/4AtutJ2PpVcM5BFDqlk7zk

```
next-cold-start: 56.024ms
next-request: 58.462ms
next-wall-time: 128.757ms
└─ ../../../packages/next/dist/compiled/next-server/server.runtime.prod.js 39.31ms / 49.27ms
  ├─ ../../../server/lib/trace/tracer.js 9.92ms / 20.97ms
  │  ├─ ../constants.js 0.19ms / 0.19ms
  │  └─ ../../../../../../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/src/index.js 10.86ms / 18.94ms
  │     ├─ ../baggage/utils.js 4.35ms / 7.41ms
  │     │  ├─ ../../api/diag.js 2.98ms / 5.70ms
  │     │  │  ├─ ../../diag/ComponentLogger.js 2.02ms / 3.66ms
  │     │  │  │  └─ ../../internal/global-utils.js 1.65ms / 2.71ms
  │     │  │  │     ├─ ../../platform/index.js 0.90ms / 1.22ms
  │     │  │  │     │  └─ ../node/index.js 0.32ms / 0.35ms
  │     │  │  │     │     └─ ../globalThis.js 0.03ms / 0.03ms
  │     │  │  │     ├─ ../../version.js 0.02ms / 0.02ms
  │     │  │  │     └─ ../semver.js 0.14ms / 0.14ms
  │     │  │  └─ ../../diag/internal/logLevelLogger.js 0.70ms / 0.76ms
  │     │  │     └─ ../../types.js 0.06ms / 0.06ms
  │     │  ├─ ../internal/baggage-impl.js 0.06ms / 0.06ms
  │     │  └─ ../internal/symbol.js 0.03ms / 0.03ms
  │     ├─ ../context/context.js 0.06ms / 0.06ms
  │     ├─ ../diag/consoleLogger.js 0.04ms / 0.04ms
  │     ├─ ../metrics/NoopMeter.js 0.12ms / 0.12ms
  │     ├─ ../metrics/Metric.js 0.03ms / 0.03ms
  │     ├─ ../propagation/TextMapPropagator.js 0.03ms / 0.03ms
  │     ├─ ../trace/ProxyTracer.js 1.69ms / 3.11ms
  │     │  └─ ../NoopTracer.js 1.42ms / 2.82ms
  │     │     ├─ ../../api/context.js 0.66ms / 0.73ms
  │     │     │  └─ ../../context/NoopContextManager.js 0.07ms / 0.07ms
  │     │     ├─ ../context-utils.js 0.70ms / 0.90ms
  │     │     │  └─ ../NonRecordingSpan.js 0.21ms / 0.55ms
  │     │     │     └─ ../invalid-span-constants.js 0.34ms / 0.37ms
  │     │     │        └─ ../trace_flags.js 0.03ms / 0.03ms
  │     │     └─ ../spancontext-utils.js 0.04ms / 0.04ms
  │     ├─ ../trace/ProxyTracerProvider.js 0.30ms / 0.33ms
  │     │  └─ ../NoopTracerProvider.js 0.03ms / 0.03ms
  │     ├─ ../trace/SamplingResult.js 0.03ms / 0.03ms
  │     ├─ ../trace/span_kind.js 0.03ms / 0.03ms
  │     ├─ ../trace/status.js 0.03ms / 0.03ms
  │     ├─ ../trace/internal/utils.js 0.44ms / 0.64ms
  │     │  └─ ../tracestate-impl.js 0.20ms / 0.25ms
  │     │     └─ ../tracestate-validators.js 0.04ms / 0.04ms
  │     ├─ ../context-api.js 0.06ms / 0.06ms
  │     ├─ ../diag-api.js 0.04ms / 0.04ms
  │     ├─ ../metrics-api.js 0.22ms / 0.48ms
  │     │  └─ ../api/metrics.js 0.26ms / 0.32ms
  │     │     └─ ../../metrics/NoopMeterProvider.js 0.06ms / 0.06ms
  │     ├─ ../propagation-api.js 0.30ms / 0.92ms
  │     │  └─ ../api/propagation.js 0.62ms / 0.74ms
  │     │     ├─ ../../propagation/NoopTextMapPropagator.js 0.03ms / 0.03ms
  │     │     └─ ../../baggage/context-helpers.js 0.09ms / 0.09ms
  │     └─ ../trace-api.js 0.31ms / 0.45ms
  │        └─ ../api/trace.js 0.15ms / 0.15ms
  ├─ ../../../shared/lib/runtime-config.external.js 0.05ms / 0.05ms
  ├─ ../../../../../../bench/basic-app/.next/server/app/page.js 4.07ms / 18.76ms
  │  ├─ ../../webpack-runtime.js 0.10ms / 0.10ms
  │  ├─ ../../chunks/388.js 0.06ms / 0.06ms
  │  ├─ ../../chunks/269.js 1.10ms / 1.10ms
  │  ├─ ../../../../../../packages/next/dist/compiled/next-server/app-page.runtime.prod.js 13.22ms / 13.63ms
  │  │  └─ ../../../client/components/request-async-storage.external.js 0.41ms / 0.47ms
  │  │     └─ ../async-local-storage.js 0.06ms / 0.06ms
  │  ├─ ../../../../../../packages/next/dist/client/components/static-generation-async-storage.external.js 0.16ms / 0.16ms
  │  └─ ../../../../../../packages/next/dist/client/components/action-async-storage.external.js 0.05ms / 0.05ms
  └─ ../../../../../../bench/basic-app/.next/server/app/page_client-reference-manifest.js 0.11ms / 0.11ms

```
2023-09-21 16:13:03 +00:00
Tobias Koppers
44eba020c6
improve publish-release (#55597)
Closes WEB-1608
2023-09-19 18:23:51 +02:00
Zack Tanner
33c561b21d
Consolidate experimental React opt-in & add ppr flag (#55560)
This consolidates how we're evaluating when to opt into `react@experimental` since it's sprinkled in a lot of spots. Also adds a new flag to opt into the experimental channel

Closes NEXT-1632
2023-09-19 10:45:25 +00:00
Jimmy Lai
5217e7eb06
server: re-land bundled runtimes (#55139)
see https://github.com/vercel/next.js/pull/52997

also added a fix by @jridgewell to fix turbopack





Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-09-08 16:05:29 +00:00
JJ Kasper
7267538e00
Revert "perf: add bundled rendering runtimes (#52997)" (#55117)
This reverts commit a5b7c77c1f.

Our E2E tests are failing with this change this reverts to allow investigating async 

x-ref: https://github.com/vercel/next.js/actions/runs/6112149126/job/16589769954
2023-09-07 21:07:53 +00:00
Jimmy Lai
a5b7c77c1f
perf: add bundled rendering runtimes (#52997)
## What?

In Next, rendering a route involves 3 layers:
- the routing layer, which will direct the request to the correct route to render
- the rendering layer, which will take a route and render it appropriately
- the user layer, which contains the user code 

In #51831, in order to optimise the boot time of Next.js, I introduced a change that allowed the routing layer to be bundled. In this PR, I'm doing the same for the rendering layer. This is building up on @wyattjoh's work that initially split the routing and the rendering layer into separate entry-points.

The benefits of having this approach is that this allows us to compartmentalise the different part of Next, optimise them individually and making sure that serving a request is as efficient as possible, e.g. rendering a `pages` route should not need code from the `app router` to be used.

There are now 4 different rendering runtimes, depending on the route type:
- app pages: for App Router pages
- app routes: for App Router route handlers
- pages: for legacy pages
- pages api: for legacy API routes

This change should be transparent to the end user, beside faster cold boots.

## Notable changes

Doing this change required a lot of changes for Next.js under the hood in order to make the different layers play well together.

### New conventions for externals/shared modules

The big issue of bundling the rendering runtimes is that the user code needs to be able to reference an instance of a module/value created in Next during the render. This is the case when the user wants to access the router context during SSR via `next/link` for example; when you call `useContext(value)` the value needs to be the exact same reference to one as the one created by `createContext` earlier.

Previously, we were handling this case by making all files from Next that were affected by this `externals`, meaning that we were marking them not to be bundled.

**Why not keep it this way?**

The goal of this PR as stated previously was to make the rendering process as efficient as possible, so I really wanted to avoid extraneous fs reads to unoptimised code. 

In order to "fix" it, I introduced two new conventions to the codebase:
- all files that explicitly need to be shared between a rendering runtime and the user code must be suffixed by `.shared-runtime` and exposed via adding a reference in the relevant `externals` file. At compilation time, a reference to a file ending with this will get re-written to the appropriate runtime.
- all files that need to be truly externals need to be suffixed by `.external`. At compilation time, a reference to it will stay as-is. This special case is needed mostly only for the async local storages that need to be shared with all three layers of Next.

As a side effect, we should be bundling more of the Next code in the user bundles, so it should be slightly more efficient.

### App route handlers are compiled on their own layer

App route handlers should be compiled in their own layer, this allows us to separate more cleanly the compilation logic here (we don't need to run the RSC logic for example).

### New rendering bundles

We now generate a prod and a dev bundle for:
- the routing server
- the app/pages SSR rendering process
- the API routes process

The development bundle is needed because:
- there is code in Next that relies on NODE_ENV
- because we opt out of the logic referencing the correct rendering runtime in dev for a `shared-runtime` file. This is because we don't need to and that Turbopack does not support rewriting an external to something that looks like this `require('foo').bar.baz` yet. We will need to fix that when Turbopack build ships.

### New development pipeline

Bundling Next is now required when developing on the repo so I extended the taskfile setup to account for that. The webpack config for Next itself lives in `webpack.config.js` and contains the logic for all the new bundles generated.

### Misc changes

There are some misc reshuffling in the code to better use the tree shaking abilities that we can now use.

fixes NEXT-1573

Co-authored-by: Alex Kirszenberg <1621758+alexkirsz@users.noreply.github.com>
2023-09-07 15:51:49 +00:00
Tobias Koppers
15980a66d4
remove --turbo, use --experimental-turbo as --turbo (#55063)
### What?

Switch the default for `--turbo` to the new `--experimental-turbo`, remove the old code in next.js

### Why?

The new approach will be used in future


Closes WEB-1506
2023-09-06 17:46:54 +00:00
Zack Tanner
f0fa7c5406
use pnpm for next-with-deps (#54847)
This fixes the "Usage Error: This project is configured to use pnpm" error when running `next-with-deps` since we [enforce a package manager](https://github.com/vercel/next.js/blob/canary/package.json#L252)
2023-08-31 16:12:38 +00:00
JJ Kasper
8997ab0812
Implement granular rust caching (#54582)
This fixes our caching for the docker builds as they were missing inputs
the other jobs had also enables caching the rust target cache which
improves build times when only changing our package and the lockfile
isn't invalidated.

Tested here https://github.com/vercel/next.js/actions/runs/5987764387
2023-08-26 18:54:14 -07:00
JJ Kasper
7a6b6c8ad8
Update install-native script to avoid pnpm cache (#54462)
Seems this sometimes pulls from pnpm cache instead of checking for newer canary version so this updates to use `pnpm add` instead which should help here.
2023-08-23 20:30:46 +00:00
Will Binns-Smith
662dcedd21
install-native.mjs: include packageManager field (#54132)
This ensures that corepack uses the correct package manager and version for the tmpdir install as it does for the rest of the repo. It reads the value from the root `package.json`.


Closes WEB-1401
2023-08-16 17:09:06 +00:00
Steven
210053b151
fix(ci): deploy examples (#54024)
Deploy all examples for each release (canary or stable, but not PRs).

Right now we only have one example that we deploy so we don't need to determine which ones changed.
2023-08-15 03:23:57 +00:00
JJ Kasper
bdc3a8e181
Move turbo outside of build for docker swc builds (#54035)
removes usage of turbo and uses the default node version inside the
image.
2023-08-14 17:37:45 -07:00
Jiachi Liu
5b16f8546c
release: add release log generation script (#54006)
Add script of generating release log. To access the changelog just run the below script (copy content with `pbcopy` on MacOS)

```js
node ./scripts/generate-release-log.mjs | pbcopy
```
2023-08-14 17:41:44 +00:00
JJ Kasper
1283270a5b
Update env variable for fonts data workflow (#53701)
Removes temporary token in favor of permanent one also updates diffing logic.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-07 22:07:50 +00:00
JJ Kasper
6483903372
Add update fonts workflow (#53645)
This adds a workflow to auto update our fonts data so we can stay up to date easier. 

Closes: https://github.com/vercel/next.js/pull/53246
Closes: https://github.com/vercel/next.js/pull/53510
2023-08-07 00:11:03 +00:00
JJ Kasper
7bf3d77b5e
Revert "Implement new forking technique for vendored packages. (#51083)" (#53640)
This reverts commit e06880ea4c.

reverts: https://github.com/vercel/next.js/pull/51083

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1691349686136519)
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1691349579712979?thread_ts=1691217652.833079&cid=C03S8ED1DKM)
2023-08-06 13:00:12 -07:00
Josh Story
e06880ea4c
Implement new forking technique for vendored packages. (#51083)
## Vendoring

Updates all module resolvers (node, webpack, nft for entrypoints, and nft for next-server) to consider whether vendored packages are suitable for a given resolve request and resolves them in an import semantics preserving way.

### Problem

Prior to the proposed change, vendoring has been accomplished but aliasing module requests from one specifier to a different specifier. For instance if we are using the built-in react packages for a build/runtime we might replace `require('react')` with `require('next/dist/compiled/react')`.

However this aliasing introduces a subtle bug. The React package has an export map that considers the condition `react-server` and when you require/import `'react'` the conditions should be considered and the underlying implementation of react may differ from one environment to another. In particular if you are resolving with the `react-server` condition you will be resolving the `react.shared-subset.js` implementation of React. This aliasing however breaks these semantics because it turns a bare specifier resolution of `react` with path `'.'` into a resolution with bare specifier `next` with path `'/dist/compiled/react'`. Module resolvers consider export maps of the package being imported from but in the case of `next` there is no consideration for the condition `react-server` and this resolution ends up pulling in the `index.js` implementation inside the React package by doing a simple path resolution to that package folder.

To work around this bug there is a prevalence of encoding the "right" resolution into the import itself. We for instance directly alias `react` to `next/dist/compiled/react/react.shared-subset.js` in certain cases. Other times we directly specify the runtime variant for instance `react-server-dom-webpack/server.edge` rather than `react-server-dom-wegbpack/server`, bypassing the export map altogether by selecting the runtime specific variant. However some code is meant to run in more than one runtime, for instance anything that is part of the client bundle which executes on the server during SSR and in the browser. There are workaround like using `require` conditionally or `import(...)` dynamically but these all have consequences for bundling and treeshaking and they still require careful consideration of the environment you are running in and which variant needs to load.

The result is that there is a large amount of manual pinning of aliases and additional complexity in the code and an inability to trust the package to specify the right resolution potentially causing conflicts in future versions as packages are updated.

It should be noted that aliasing is not in and of itself problematic when we are trying to implement a sort of lightweight forking based on build or runtime conditions. We have good examples of this for instance with the `next/head` package which within App Router should export a noop function. The problem is when we are trying to vendor an entire package and have the package behave semantically the same as if you had installed it yourself via node_modules

### Solution

The fix is seemingly straight forward. We need to stop aliasing these module specifiers and instead customize the resolution process to resolve from a location that will contain the desired vendored packages. We can then start simplifying our imports to use top level package resources and generally and let import conditions control the process of providing the right variant in the right context.

It should be said that vendoring is conditional. Currently we only vendor react pacakges for App Router runtimes. The implementation needs to be able to conditionally determine where a package resolves based on whether we're in an App Router context vs a Page Router one.

Additionally the implementation needs to support alternate packages such as supporting the experimental channel for React when using features that require this version.

### Implementation

The first step is to put the vendored packages inside a node_modules folder. This is essential to the correct resolving of packages by most tools that implement module resolution. For packages that are meant to be vendored, meaning whole package substitution we move the from `next/(src|dist)/compiled/...` to `next/(src|dist)/vendored/node_modules`. The purpose of this move is to clarify that vendored packages operate with a different implementation. This initial PR moves the react dependencies for App Router and `client-only` and `server-only` packages into this folder. In the future we can decide which other precompiled dependencies are best implemented as vendored packages and move them over.

It should be noted that because of our use of `JestWorker` we can get warnings for duplicate package names so we modify the vendored pacakges for react adding either `-vendored` or `-experimental-vendored` depending on which release channel the package came from. While this will require us to alter the request string for a module specifier it will still be treating the react package as the bare specifier and thus use the export map as required.

#### module resolvers
The next thing we need to do is have all systems that do module resolution implement an custom module resolution step. There are five different resolvers that need to be considered

##### node runtime
Updated the require-hook to resolve from the vendored directory without rewriting the request string to alter which package is identified in the bare specifier. For react packages we only do this vendoring if the `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT` envvar is set indicating the runtime is server App Router builds. If we need a single node runtime to be able to conditionally resolve to both vendored and non vendored versions we will need to combine this with aliasing and encode whether the request is for the vendored version in the request string. Our current architecture does not require this though so we will just rely on the envvar for now

##### webpack runtime
Removed all aliases configured for react packages. Rely on the node-runtime to properly alias external react dependencies. Add a resolver plugin `NextAppResolverPlugin` to preempt perform resolution from the context of the vendored directory when encountering a vendored eligible package.

##### turbopack runtime
updated the aliasing rules for react packages to resolve from the vendored directory when in an App Router context. This implementation is all essentially config b/c the capability of doing the resolve from any position (i.e. the vendored directory) already exists

##### nft entrypoints runtime
track chunks to trace for App Router separate from Pages Router. For the trace for App Router chunks use a custom resolve hook in nft which performs the resolution from the vendored directory when appropriate.

##### nft next-server runtime
The current implementation for next-server traces both node_modules and vendored version of packages so all versions are included. This is necessary because the next server can run in either context (App vs Page router) and may depend on any possible variants. We could in theory make two traces rather than a combined one but this will require additional downstream changes so for now it is the most conservative thing to do and is correct

Once we have the correct resolution semantics for all resolvers we can start to remove instances targeting our precompiled instances for instance making `import ... from "next/dist/compiled/react-server-dom-webpack/client"` and replacing with `import ... from "react-server-dom-webpack/client"`

We can also stop requiring runtime specific variants like `import ... from "react-server-dom-webpack/client.edge"` replacing it with the generic export `"react-server-dom-webpack/client"`

There are still two special case aliases related to react
1. In profiling mode (browser only) we rewrite `react-dom` to `react-dom/profiling` and `scheduler/tracing` to `scheduler/tracing-profiling`. This can be moved to using export maps and conditions once react publishses updates that implement this on the package side.
2. When resolving `react-dom` on the server we rewrite this to `react-dom/server-rendering-stub`. This is to avoid loading the entire react-dom client bundle on the server when most of it goes unused. In the next major react will update this top level export to only contain the parts that are usable in any runtime and this alias can be dropped entirely

There are two non-react packages currently be vendored that I have maintained but think we ought to discuss the validity of vendoring. The `client-only` and `server-only` packages are vendored so you can use them without having to remember to install them into your project. This is convenient but does perhaps become surprising if you don't realize what is happening. We should consider not doing this but we can make that decision in another discussion/PR.

#### Webpack Layers
One of the things our webpack config implements for App Router is layers which allow us to have separate instances of packages for the server components graph and the client (ssr) graph. The way we were managing layer selection was a but arbitrary so in addition to the other webpack changes the way you cause a file to always end up in a specific layer is to end it with `.serverlayer`, `.clientlayer` or `.sharedlayer`. These act as layer portals so something in the server layer can import `foo.clientlayer` and that module will in fact be bundled in the client layer.

#### Packaging Changes
Most package managers are fine with this resolution redirect however yarn berry (yarn 2+ with PnP) will not resolve packages that are not defined in a package.json as a dependency. This was not a problem with the prior strategy because it was never resolving these vendored packages it was always resolving the next package and then just pointing to a file within it that happened to be from react or a related package.

To get around this issue vendored packages are both committed in src and packed as a tgz file. Then in the next package.json we define these vendored packages as `optionalDependency` pointing to these tarballs. For yarn PnP these packed versions will get used and resolved rather than the locally commited src files. For other package managers the optional dependencies may or may not get installed but the resolution will still resolve to the checked in src files. This isn't a particularly satisfying implemenation and if pnpm were to be updated to have consistent behavior installing from tarballs we could actually move the vendoring entirely to dependencies and simplify our resolvers a fair bit. But this will require an upstream chagne in pnpm and would take time to propogate in the community since many use older versions

#### Upstream Changes

As part of this work I landed some other changes upstream that were necessary. One was to make our packing use `npm` to match our publishing step. This also allows us to pack `node_modules` folders which is normally not supported but is possible if you define the folder in the package.json's files property.

See: #52563

Additionally nft did not provide a way to use the internal resolver if you were going to use the resolve hook so that is now exposed

See: https://github.com/vercel/nft/pull/354

#### additional PR trivia
* When we prepare to make an isolated next install for integration tests we exclude node_modules by default so we have a special case to allow `/vendored/node_modules`

* The webpack module rules were refactored to be a little easier to reason about and while they do work as is it would be better for some of them to be wrapped in a `oneOf` rule however there is a bug in our css loader implementation that causes these oneOf rules to get deleted. We should fix this up in a followup to make the rules a little more robuts.


## Edits
* I removed `.sharedlayer` since this concept is leaky (not really related to the client/server boundary split) and it is getting refactored anyway soon into a precompiled runtime.
2023-08-04 23:47:10 +00:00
Zack Tanner
50f963f704
remove --force from install-native postinstall (#53320)
This was leftover from when we were using yarn but `--force` has different behavior in pnpm (it will install all optionalDependencies regardless of the current environment), which was causing tests to slowdown
2023-07-28 23:54:48 +00:00
Zack Tanner
5f161761a9
update install-native postinstall to use pnpm (#53080)
Relands #52971 but with `node-linker=hoisted` to mimic the behavior of yarn classic (ie, doesn't create a symlink)

- Original: https://github.com/vercel/next.js/pull/52971
- Revert https://github.com/vercel/next.js/pull/53032
2023-07-24 16:08:36 +00:00
Zack Tanner
83d0f1e9cf
Revert "Changed package manager for install-native.mjs to pnpm (#52971)" (#53032)
This was causing issues with installing swc binaries (appears to be creating corrupt aliases in `node_modules/@next` rather than the actual resolved swc package)

Since pnpm creates hard links on disk, the files being moved aren't the actual binaries, they're just aliases. And when tmpdir gets removed, the aliases point to nothing
2023-07-22 01:28:37 +00:00
Syed Taqi Haider
bb5fced30a
Changed package manager for install-native.mjs to pnpm (#52971)
fixes #52970

Yarn 3 has removed the "--force" flag. This can cause issues with building the Next.js repository if Yarn 3 is activated on a development machine (specifically the postinstall script "install-native.mjs"). Using pnpm as the package manager fixes this issue.
2023-07-21 16:55:20 +00:00
Jimmy Lai
810f0e8710
perf: create an experimental bundled version of the next server (#52206)
This PR:
- adds a minified bundled server for Next with some optimisations applied
- a test server in minimal-server.js
- misc changes:
   - makes some polyfills lazy
   - adds a cached version of node-html-parser
   -
2023-07-10 15:40:06 +00:00
Steven
23890fb2c9
chore(script): fix typo in sync-react.js pull request url (#52057)
Follow up to:

- https://github.com/vercel/next.js/pull/52052
2023-06-30 21:49:40 +00:00
Steven
148fb086c5
chore(script): improve markdown changelog output in sync-react.js (#52052)
This makes it really easy to copy/paste the changelog into the PR description after running `sync-react.js`.

Previously, the output would link to incorrect PRs because it didn't know the PR number was from a different repo.

We know `facebook/react` uses squash so there should always be a PR number at the end of the commit title.

Example of the new format: https://github.com/vercel/next.js/pull/52005
2023-06-30 20:21:53 +00:00
Delba de Oliveira
3d41ccb916
Update codeowners (#51250)
Tweak code owners after some testing and feedback. 

- Move the Next.js team up to be optional global code owners (so that everyone can review but are not tagged for review). Global individuals should still be tagged if there are no specific `.vercel.approvers` files in subdirectories.
- Adds @vercel/devex to image files so there's coverage on those files for the docs
- Target specific folder and files for Styfle to get notified
- Deletes some rules in the old GitHub codeowners
2023-06-13 17:47:12 +00:00
JJ Kasper
efaddcda60
Fix race condition with publish (#51105)
We publish multiple packages in parallel which can cause issues with the
prepublish only script running as turbo clearing/restoring dist caches
can causing files to be missing if a publish is in progress. We also
don't need to run these as all packages are already built prior to
publishing. This also includes fixes for release stats.
2023-06-10 14:05:27 -07:00
Delba de Oliveira
8c2e5bd072
Update codeowners to use Vercel Spaces (#50841)
Move as much of codeowners as possible to use Vercel Spaces. 

1. Makes `@timneutkens @ijjk @shuding @huozhi @feedthejim` global owners
2. Make the `@vercel/next-js` team _optional_ owners of **/docs**,
**/errors**, and **/contributing**, makes team owners of a few packages
as per old config.
3. Make `@vercel/devex` (docs and devrel) owners of **/docs**,
**/errors**, and **/contributing**
4. Make `@vercel/devrel` (devrel only) owners of **/examples**
5. Make `@vercel/web-tooling` owners of specific files and folders (as
per old config)

Leaves @styfle as owner of **image** files on the old config since this
pattern `/**/*image*/** ` can't be used with Vercel Spaces.

Note: We cannot add * or / at the end of files.
[Docs](https://spaces-docs.vercel.sh/docs/code-owners#:~:text=Code%20Owners%20files%20are%20meant%20to%20encourage%20distributed%20ownership%20definitions%20across%20a%20codebase.)
2023-06-08 12:02:18 +02:00
Delba de Oliveira
f6ff2ef98e
[Next Docs] Update Git Workflow (#50579)
Update our git workflow in preparation for open-sourcing the content of
the docs ([linear
task](https://linear.app/vercel/issue/DX-1579/set-up-github-workflow)).

**Templates:**
- [x] Update docs issue template to encourage contributions
- [x] Update PR template to include link to new contribution guide 

**Code Owners / Reviewers:** 
- https://github.com/vercel/next.js/pull/50841

**Labels:** 
- [x] Add DevEx team to labeler.json so PRs get the "created by: DevEx
team"

**Other:** 
- [x] Remove docs manifest from CI checks as we no longer have one (keep
the manifest for errors as they live under `/pages`)
- [x] Add `unifiedjs.vscode-mdx` to the vscode extension list
2023-06-08 12:01:55 +02:00
Max Leiter
0a6a6abcd3
packages/font: run update-google-fonts script (#50608) 2023-05-31 22:31:26 +02:00
JJ Kasper
105ac170b8
Update workflow cancel handling (#50442)
The built-in cancel handling doesn't have our desired behavior so this
disables it
2023-05-27 22:57:45 -07:00
JJ Kasper
a3ab542630
Add new build and test workflow (#50436)
This adds new `build and test` and `build and deploy` workflows in favor
of the existing massive `build, test, and deploy` workflow. Since the
new workflows will use `pull_request_target` this waits to remove the
existing workflow until the new one is tested.

While testing this new workflow flakey behavior in tests have also been
addressed. Along with the new workflow we will also be leveraging new
runners which allow us to run tests against the production binary of
`next-swc` so this avoids slight differences in tests we've seen due to
running against the dev binary.

Furthermore we will have a new flow for allowing workflow runs on PRs
from external forks which will either require a comment be checking a
box approving the run after each change or a label added by the team.

The new flow also no longer relies on `actions/cache` or similar which
have proven to be pretty unreliable.

Tests runs with the new workflow can be seen here
https://github.com/vercel/next.js/actions/runs/5100673508/jobs/9169416949
2023-05-27 21:02:31 -07:00
Jiachi Liu
ad79fed1a2
ci: update github token (#50216)
[slack-thread](https://vercel.slack.com/archives/C01LN7C5QR5/p1684849596794369?thread_ts=1684428058.764599&cid=C01LN7C5QR5)
2023-05-23 07:29:58 -07:00
OJ Kwon
16150a3e33
refactor(scripts): fix clippy errors (#49719)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change



### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?
Another fix, with adding scripts under next-swc check.
2023-05-12 19:14:30 +00:00
OJ Kwon
4bc1bc3ea0
refactor(scripts): apply fmt (#49716)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Minot fix to unblock ci.
2023-05-12 11:05:04 -07:00
Steven
11a7117d40
chore: cross-platform rm -rf script (#49529)
- Closes https://github.com/vercel/next.js/issues/42433
- Closes https://github.com/vercel/next.js/pull/43105
- Closes https://github.com/vercel/next.js/pull/49522
2023-05-10 01:14:37 +00:00
Andrew Clark
e659653e48
Upgrade React to 18.3.0-canary-b7972822b-20230503 (#49158)
Includes the following upstream changes:

- [b7972822b](https://github.com/facebook/react/commits/b7972822b)
useOptimisticState -> useOptimistic
([#26772](https://github.com/facebook/react/pull/26772)) (Andrew Clark)
- [388686f29](https://github.com/facebook/react/commits/388686f29) Add
"canary" to list of allowed npm dist tags
([#26767](https://github.com/facebook/react/pull/26767)) (Andrew Clark)
- [8a25302c6](https://github.com/facebook/react/commits/8a25302c6)
fix[dynamic-scripts-injection]: unregister content scripts before
registration ([#26765](https://github.com/facebook/react/pull/26765))
(Ruslan Lesiutin)
- [2c2476834](https://github.com/facebook/react/commits/2c2476834)
Rename "next" prerelease channel to "canary"
([#26761](https://github.com/facebook/react/pull/26761)) (Andrew Clark)
- [fa4314841](https://github.com/facebook/react/commits/fa4314841)
Remove deprecated workflow key from Circle config
([#26762](https://github.com/facebook/react/pull/26762)) (Andrew Clark)
- [5dd90c562](https://github.com/facebook/react/commits/5dd90c562) Use
content hash for react-native builds
([#26734](https://github.com/facebook/react/pull/26734)) (Samuel Susla)
- [559e83aeb](https://github.com/facebook/react/commits/559e83aeb)
[Fizz] Allow an action provide a custom set of props to use for
progressive enhancement
([#26749](https://github.com/facebook/react/pull/26749)) (Sebastian
Markbåge)
- [67f4fb021](https://github.com/facebook/react/commits/67f4fb021) Allow
forms to skip hydration of hidden inputs
([#26735](https://github.com/facebook/react/pull/26735)) (Sebastian
Markbåge)
- [8ea96ef84](https://github.com/facebook/react/commits/8ea96ef84)
[Fizz] Encode external fizz runtime into chunks eagerly
([#26752](https://github.com/facebook/react/pull/26752)) (Josh Story)
- [491aec5d6](https://github.com/facebook/react/commits/491aec5d6)
Implement experimental_useOptimisticState
([#26740](https://github.com/facebook/react/pull/26740)) (Andrew Clark)
- [9545e4810](https://github.com/facebook/react/commits/9545e4810) Add
nonce support to bootstrap scripts and external runtime
([#26738](https://github.com/facebook/react/pull/26738)) (Dan Ott)
- [86b0e9199](https://github.com/facebook/react/commits/86b0e9199) Gate
DevTools test to fix CI
([#26742](https://github.com/facebook/react/pull/26742)) (Andrew Clark)
- [b12bea62d](https://github.com/facebook/react/commits/b12bea62d)
Preinits should support a nonce option
([#26744](https://github.com/facebook/react/pull/26744)) (Josh Story)
- [efbd68511](https://github.com/facebook/react/commits/efbd68511)
Remove unused `initialStatus` parameter from `useHostTransitionStatus`
([#26743](https://github.com/facebook/react/pull/26743)) (Sebastian
Silbermann)
- [18282f881](https://github.com/facebook/react/commits/18282f881) Fix:
Update while suspended fails to interrupt
([#26739](https://github.com/facebook/react/pull/26739)) (Andrew Clark)
- [540bab085](https://github.com/facebook/react/commits/540bab085)
Implement experimental_useFormStatus
([#26722](https://github.com/facebook/react/pull/26722)) (Andrew Clark)

---------
2023-05-03 14:03:19 -07:00
Shu Ding
287e379b92
Vendor react@experimental (#48697)
Part of #47759 (which had been reverted twice so here we only land a part of the change), relates to NEXT-926. Thanks to #48506 we can soon switch between these two channels during runtime.

Also fixes a problem of `renderKind` (only revealed after upgrading React), it should be also based on the `match` kind.
2023-04-25 14:29:02 +00:00
Steven
ce2e2265e6
Add missing repository prop to package.json in swc-wasm (#48805)
- Follow up to https://github.com/vercel/next.js/pull/48803

Fixes
https://github.com/vercel/next.js/actions/runs/4791615248/jobs/8523283909#step:10:258
2023-04-24 20:24:55 -05:00
Jiachi Liu
9314fb6597
Wait for versioning prompt to show up for stable release (#48692)
Wait for the prompt to show up then enter the cursor change or "y" for
prompt to avoid write to child process too early

Example
```
Running pnpm release-stable...
Releasing patch: cursor stay
Enter newline
Enter y
Await child process...
> nextjs-project@0.0.0 release-stable /home/runner/work/next.js/next.js
> lerna version --force-publish
lerna notice cli v4.0.0
lerna info ci enabled
lerna info current version 13.3.1-canary.19
lerna WARN force-publish all packages
lerna info Assuming all packages changed
? Select a new version (currently 13.3.1-canary.19) (Use arrow keys)
❯ Patch (13.3.1) 
  Minor (13.4.0) 
  Major (14.0.0) 
  Prepatch (13.3.2-canary.0) 
  Preminor (13.4.0-canary.0) 
  Premajor (14.0.0-canary.0) 
  Custom Prerelease 
  Custom Version ? Select a new version (currently 13.3.1-canary.19) Patch (13.3.1)
Changes:
```
2023-04-21 17:58:24 -04:00
Jiachi Liu
4f1b0f737a
Add logs to release job (#48690)
Adding more logs for GA release job

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-04-21 22:54:12 +02:00
JJ Kasper
3a83c6b313
Update start release flow (#48634)
x-ref: [slack
thread](https://vercel.slack.com/archives/C01LN7C5QR5/p1681914697254659)
2023-04-20 15:58:36 +00:00
Jan Kaifer
902bb40454
Remove unused code from test-pack turbo task (#48487)
We decided in https://github.com/vercel/next.js/pull/48308 that we won't
use `turbo` when packing packages for tests.

This PR removes all code associated with that effort. The whole thing
fas behind a flag, so it shouldn't affect anything.
fix NEXT-1025
2023-04-18 12:12:00 +00:00
Shu Ding
f6604d4afe
Revert "Re-land "Vendor react@experimental under an experimentalReact flag"" (#48478)
Reverts vercel/next.js#48041
fix NEXT-926
2023-04-17 15:00:02 +02:00
Shu Ding
9c0e520896
Re-land "Vendor react@experimental under an experimentalReact flag" (#48041)
Reverts vercel/next.js#48038

fix NEXT-926

---

The root cause was that when copying the package.json, I removed all
fields except for a few (such as `exports`) but missed the `browser`
field. That caused the client bundle to resolve to the Node.js version
of React DOM, and then we had the `async_hooks` error. Added it back in
99c9b9e51f8b0d4e4503ece9d07bce09161f3341.

I reproduced the error with next-site earlier and confirmed that this
fix is good.
2023-04-08 17:16:24 +02:00
JJ Kasper
2a68ecf509
Fix stable release start (#48044)
x-ref:
https://github.com/vercel/next.js/actions/runs/4632849191/jobs/8197395820
2023-04-06 14:52:56 -07:00
JJ Kasper
9448913149
Revert "Vendor react@experimental under an experimentalReact flag" (#48038)
x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1680804950611789?thread_ts=1680791613.468109&cid=C04DUD7EB1B)

Reverts vercel/next.js#47759
fix NEXT-926
2023-04-06 11:48:09 -07:00
Shu Ding
89b4605f1a
Vendor react@experimental under an experimentalReact flag (#47759)
Next.js includes various feature sets that depend on specific release
channels of React. However, our current setup only includes the `next`
channel of React, which restricts our ability to integrate with features
available on the `experimental` channel.

To address this limitation, this pull request introduces the following
changes:
- Vendors the `react@experimental` version, along with the corresponding
`react-dom` and `scheduler` packages.
- Modifies the `sync-react` script to also update the `experimental`
channel and removes `--version` as they're always synced to the latest
now.
- Retains the default behavior of using the `next` channel in the
`appDir` directory.
- Adds an option to switch to the `experimental` channel by setting
`experimental.experimentalReact: true` in the configuration.

fix NEXT-926 ([link](https://linear.app/vercel/issue/NEXT-926))
2023-04-05 14:05:47 +00:00
JJ Kasper
320ebe2d34
Update flakey tests and add Node.js setup retrying (#47871)
x-ref:
https://github.com/vercel/next.js/actions/runs/4599615812/jobs/8125278036
x-ref:
https://github.com/vercel/next.js/actions/runs/4598323624/jobs/8124618075?pr=47365
x-ref:
https://github.com/vercel/next.js/actions/runs/4598323624/jobs/8124612692?pr=47365
2023-04-03 13:37:14 -07:00
JJ Kasper
400ccf7b1c
Update to retry undrafting canary (#47826)
x-ref:
https://github.com/vercel/next.js/actions/runs/4588934126/jobs/8103482375#step:10:658
2023-04-02 11:37:08 -07:00
JJ Kasper
083dd2a59f
Tweak canary undrafting (#47777)
Fixes:
https://github.com/vercel/next.js/actions/runs/4581084068/jobs/8090349455#step:10:661
2023-03-31 21:06:51 -07:00
JJ Kasper
6e5eb2c4d2
Update publish canary to undraft automatically (#47775)
x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1680313038895799?thread_ts=1680303743.811339&cid=C04DUD7EB1B)
2023-03-31 19:00:12 -07:00
Karl Horky
3ad55721d1
Remove incorrect entries for pnpm debug log (#47241)
**Reasons for making this change:**

- it is contained within `node_modules/`, which is already ignored
- the previous versions, which were not in `node_modules/`, did not have
a period at the beginning of the filename

Links to documentation supporting these rule changes:

**Changelog with proof here:**


ba4b2db1f2/pnpm/CHANGELOG.md (L3330)

History:

- my PR to remove this from `github/gitignore` here:
https://github.com/github/gitignore/pull/4250
- First introduced in `github/gitignore` in
https://github.com/github/gitignore/pull/3732 by `@sakurayang` (merged
by `@martinwoodward`)

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-26 22:26:05 -07:00
JJ Kasper
bd8ba61bca
Update release package.json scripts (#47529)
We should no longer be starting releases from local and instead use the
GH action so this updates the scripts to point to there.
2023-03-25 12:59:51 -07:00
JJ Kasper
cbb6dda6a3
Tweak trigger release cloning 2023-03-23 23:07:52 -07:00
JJ Kasper
af89adbd61
Update fetch cache memory handling (#47465)
This ensures we only honor cache entries from the in memory cache for up
to 2 seconds so that revalidates can correctly propagate and also
increases max fetch cache entry size to 2 MB. The `fetchCache` export is
also being detected in this PR but not yet honored which will be done in
a follow-up.
2023-03-23 22:30:08 -07:00
JJ Kasper
d0bdd8f230
Add workflow to trigger release (#47461)
As discussed this adds a publish workflow that can be triggered for
canary or stable releases which ensures we are publishing from a
consistent environment and local config doesn't affect a release.
2023-03-23 16:28:49 -07:00
JJ Kasper
fed3ffa865
Skip extra swc builds (#47378)
This removes some extra swc builds which are rarely if ever used and are
also prone to breaking fairly often due to the extra configuration
required to build them.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1679434160981059)
2023-03-21 16:09:52 -07:00
JJ Kasper
6a603464e4
Fix deploy example (#47228)
x-ref:
https://github.com/vercel/next.js/actions/runs/4443450845/jobs/7800761746
2023-03-16 20:02:28 -07:00
JJ Kasper
c7534092c7
Fix failing CI checks (#47223)
x-ref:
https://github.com/vercel/next.js/actions/runs/4441543036/jobs/7796929887
x-ref:
https://github.com/vercel/next.js/actions/runs/4441543036/jobs/7796930146
2023-03-16 18:59:52 -07:00
Steven
0e91549397
chore(ci): automatically deploy selected examples (#47130)
fix NEXT-822 ([link](https://linear.app/vercel/issue/NEXT-822))
([NEXT-822](https://linear.app/vercel/issue/NEXT-822))

---------
2023-03-15 17:01:26 -07:00
Shu Ding
7e933a094c
Revert "Revert "Update vendored React"" (#46881)
Reverts vercel/next.js#46861. This requires
https://github.com/vercel/turbo/pull/4102 to be released and bindings to
be updated first.

~Also depends on #46896 to be merged first, and conflicts to be
resolved.~
2023-03-07 13:04:08 -08:00
JJ Kasper
0f621cb133
Revert "Update vendored React" (#46861)
Reverting temporarily as this breaks turbopack support for app dir 

x-ref:
https://github.com/vercel/next.js/actions/runs/4349458918/jobs/7600147372
x-ref:
https://github.com/vercel/next.js/actions/runs/4349607013/jobs/7600148420

Reverts vercel/next.js#46826
2023-03-06 21:17:15 -08:00
Shu Ding
003b3af700
Update vendored React (#46826)
This PR updates vendored React to the latest `@next` version, as well as
corresponding changes to the manifest and module reference generation
code.

The new React version includes the following upstream changes:

- 49f741046 Fix: Infinite act loop caused by wrong shouldYield (#26317)
(Andrew Clark)
-  106ea1c58 Support Iterables in Flight (#26313) (Sebastian Markbåge)
- f905da227 [Flight] Send server reference error chunks to the client
(#26293) (Hendrik Liebau)
- e0241b660 Simplify Webpack References by encoding file path + export
name as single id (#26300) (Sebastian Markbåge)
- 25685d8a9 Codemod tests to waitFor pattern (9/?) (#26309) (Andrew
Clark)
- 64dde7082 Codemod tests to waitFor pattern (8/?) (#26308) (Andrew
Clark)
- 3cb5afb82 Codemod tests to waitFor pattern (7/?) (#26307) (Andrew
Clark)
- e98695db9 Codemod tests to waitFor pattern (6/?) (#26305) (Andrew
Clark)
- 9a52cc8bc Convert ReactLazy-test to waitFor pattern (#26304) (Andrew
Clark)
- 03462cfc7 [Fizz] External runtime: fix bug in processing existing
elements (#26303) (mofeiZ)
- faacefb4d Codemod tests to waitFor pattern (4/?) (#26302) (Andrew
Clark)
- 06460b6fb Remove unnecessary (and incorrect) code for compatibility
with Paper in the Fabric version of GlobalResponderHandler (#26290)
(Rubén Norte)
- e64a8f403 Codemod tests to waitFor pattern (3/?) (#26299) (Andrew
Clark)
- ce8a72fd4 Codemod tests to waitFor pattern (2/?) (#26296) (Andrew
Clark)
- 1f1f8eb55 [Float][Fizz][Fiber]: Refactor <style> Resource
implementation to group on flush (#26280) (Josh Story)
- 5c633a48f Add back accidentally deleted test comments (#26294) (Andrew
Clark)
- b073104c2 [DevTools] improve troubleshooting in README (#26235)
(Mengdi Chen)
- fcf218791 [DevTools] Remove renderer.js from extension build (#26234)
(Mengdi Chen)
- b72ed698f Fixed incorrect value returned as public instance from
reconciler (#26283) (Rubén Norte)
- 25a8b9735 Codemod tests to waitFor pattern (1/?) (#26288) (Andrew
Clark)
- e52446733 New internal testing helpers: waitFor, waitForAll,
waitForPaint (#26285) (Andrew Clark)
- d49e0e0be Removed unused imperative events implementation from React
Native renderer (#26282) (Rubén Norte)

---------
2023-03-06 16:51:10 -08:00
Andrew Clark
2e23cd7535
Add script to automate updating vendored React version (#46663)
Since we intend to update our vendored copy of React frequently, I wrote
a script to automate the steps.

Basic usage (defaults to most recent React canary version):

```sh
pnpm run sync-react
```

Specify a canary version:

```sh
pnpm run sync-react --version 18.3.0-next-41110021f-20230301
```

Update package.json but skip installing the dependencies automatically:

```sh
pnpm run sync-react --no-install
```

At the end it will print out a changelog so you can copy/paste it into
the PR description.

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 02:15:02 +00:00
Steven
2513965f1a
chore(ci): add job to test codemods (#46068)
This PR ensures the tests for codemods will automatically run in CI when the source code changes.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-02-20 04:42:02 +00:00
Jan Kaifer
22e28ff9c6
Make shebangs portable used in the repo portable (#46028)
Not all systems have `/bin/bash` (for example NixOS).

`/usr/bin/env bash` reads the location of bash from `PATH`

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-17 09:45:42 +00:00
JJ Kasper
81a4063db7
Update CNA tests (#45768
These had incorrect import alias flags since the `"` characters were
being included incorrectly.

x-ref:
https://github.com/vercel/next.js/actions/runs/4137310428/jobs/7152385081
2023-02-09 14:59:28 -08:00
Rinku Chaudhari
dff39acc30
fix typo in comment and unused variable remove (#45307)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-02 14:55:23 -08:00
JJ Kasper
7c6e1e6834
Enable JS CNA tests for turbopack (#45323)
Enables the JS CNA template tests for turbopack as well now that we
landed `jsconfig` paths support.

x-ref: https://github.com/vercel/turbo/pull/3409
2023-01-26 14:53:29 -08:00
JJ Kasper
f9c10469a2
Run dev tests against default CNA templates (#45211) 2023-01-24 11:01:03 -08:00
Jan Kaifer
d356458202
Switch from yarn pack to pnpm pack in tests (#45167)
We couldn't swithc before because `pnpm` was not bundling files in `native` but that was caused by differences between `yarn` and `pnpm` implementation.
2023-01-23 15:07:35 +00:00
Jan Kaifer
d7307cffb7
Fix turbo usage in tests (#44715) 2023-01-18 20:35:28 +01:00
JJ Kasper
a54e43a02b
Optimize to skip upload for non-publish swc builds (#44987) 2023-01-17 16:56:04 -08:00
JJ Kasper
8613297cd4
Fix prepublish compiled handling (#44914) 2023-01-15 20:21:39 -08:00
JJ Kasper
93f4a1ce9a
Ensure yarn is used for next-with-deps (#44666)
We aren't able to use `pnpm` for this script as it will no-op inside of
the Next.js repo so we need to use a different package manager instead.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1673040998334369?thread_ts=1673034003.245089&cid=C04DUD7EB1B)
2023-01-06 13:43:12 -08:00
JJ Kasper
beb37f0c5d
Fix paths for check-examples script (#44661)
These paths needed updating from the new template paths. 

Fixes:
https://github.com/vercel/next.js/actions/runs/3855317263/jobs/6570244567
2023-01-06 11:23:12 -08:00
JJ Kasper
08c9530241
Fix docs only change for canary (#44617)
Corrects the docs only change on the canary branch 

x-ref:
https://github.com/vercel/next.js/actions/runs/3851804915/jobs/6563359142
2023-01-05 17:55:25 -08:00
Hannes Bornö
5f2c9d0b30
Update subset validation in @next/font/google and fix CJK bug (#44594)
Currently there's a bug when selecting Chinese, Japanese or Korean (CJK)
as subsets.
```js
const notoSans = Noto_Sans_JP({
  subsets: ['japanese'],
})
```
It actually doesn't work, nothing preloads. This PR solves this by
removing CJK languages as candidates for preloading. The reason is that
they contain so many glyphs that each font-family is split up in 100+
font files. It doesn't make sense to preload all of them.

So CJK users will have to disable preloading.
```js
const notoSansJapanese = Noto_Sans_JP({
  weight: '400',
  preload: false,
})
```
In case you do manually disable preloading like above, the default
`font-display` is changed to `swap`.

This PR also improves the validation errors of subsets.
1. Providing unknown subset
```
`@next/font` error:
Unknown subset `japanese` for font `Inter`.
Available subsets: `cyrillic`, `cyrillic-ext`, `greek`, `greek-ext`, `latin`, `latin-ext`, `vietnamese`
```
2. Missing specified subset. The error has a link with further
instructions.
```
`@next/font` error:
Missing selected subsets for font `Inter`. Please specify subsets in the function call or in your `next.config.js`. Read more: https://nextjs.org/docs/messages/google-fonts-missing-subsets
```

fixes NEXT-336

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/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`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-05 15:51:38 -08:00
JJ Kasper
c0faca2db1
Update CNA tests running (#44577)
Updates to only run the create-next-app tests for PRs when the related
package files change, continues to always run on canary though.
2023-01-04 15:10:46 -08:00
Tim Neutkens
efcec4c1e3
Move core files to src folder and move JS files to TypeScript (#44405) 2023-01-03 10:05:50 +01:00
Jan Kaifer
ab328c6c39
Add tracing for testing tools (#44046) 2022-12-16 09:58:04 +01:00
JJ Kasper
318bdf90ab
Update docs change files list (#43984)
Adds additional files that can be considered docs changes and don't require running the entire test suite. 

x-ref: https://github.com/vercel/next.js/pull/43979
2022-12-12 22:16:11 +00:00
JJ Kasper
6b863fe294
Apply publish step optimizations (#43620)
Follow-up to https://github.com/vercel/next.js/pull/32337 this removes
the un-necessary step where we fetch all of the tags which requires
pulling a lot of un-necessary git history inflating cache size and
publish times.

The only reason these tags were needing to be fetched is due to an issue
in how the `actions/checkout` step works
(https://github.com/actions/checkout/issues/882).

This reduces the publish times by at least 4 minutes by removing the
tags fetching step
https://github.com/vercel/next.js/actions/runs/3598569786/jobs/6061449995#step:16:14

As a further optimization this adds concurrency to the `npm publish`
calls themselves to hopefully reduce time spent there as well.
2022-12-01 21:48:51 -08:00
JJ Kasper
ec7609e288
Avoid turbo cache miss on root package change (#43309)
Since the `next-swc` package doesn't rely on any of the root
dependencies this normalizes the `package.json` to avoid cache misses
when the file changes.

x-ref:
https://github.com/vercel/next.js/actions/runs/3535337836/jobs/5933336967
x-ref:
https://github.com/vercel/next.js/actions/runs/3535337836/jobs/5933338363
x-ref: [slack
thread](https://vercel.slack.com/archives/C02HEJASXGD/p1669236151437999)
2022-11-23 15:32:35 -08:00
JJ Kasper
f4b4c09f94
Eagerly build swc binaries on change (#43142)
This is a follow-up to leveraging the turbo remote cache and this now
eagerly updates the cache on merge to canary when swc files changed so
that it doesn't have to wait for a publish to update.
2022-11-19 18:09:47 -08:00
JJ Kasper
ea9c5aac5f
Update caching for swc turbo builds (#42929)
Updates to leverage turbo remote caching for the swc builds and
normalize the package versions to prevent repo version bumps from
un-necessarily invalidating the cache.

Full cache hits can be seen in this test run
https://github.com/vercel/next.js/actions/runs/3469932131/jobs/5797559609
2022-11-15 08:24:04 -08:00
Hannes Bornö
6ab52ed41b
@next/font return types (#42753)
Currently the return type is the same when you declare a variable and
when you don't.
```tsx
const inter1 = Inter()
const inter2 = Inter({ variable: "--inter-font" })

inter1.variable // string | undefined
inter2.variable // string | undefined
```

With this change you get a type error if you try to access `.variable`
without providing a variable name.
```tsx
const inter1 = Inter()
const inter2 = Inter({ variable: "--inter-font" })

inter1.variable // Property 'variable' does not exist on type 'NextFont'.ts(2339)
inter2.variable // string
```

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a 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 a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-10 08:56:27 -08:00
Hannes Bornö
4b004957fe
Google fonts multiple weights & styles (#42008)
Enable using multiple weights and styles in the same google font loader
call.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a 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 a 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/examples/adding-examples.md)
2022-10-27 15:25:57 -07:00
JJ Kasper
47e5ebe0b2
update publish 2022-10-25 09:14:29 -07:00
Hannes Bornö
ef7de2a93f
Font subsets in function call (#41694)
Enable setting font specific subsets in the call.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a 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 a 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/examples/adding-examples.md)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-24 05:21:38 +00:00
Hannes Bornö
77ba4a867a
Font loader types (#41591)
Make local and google font loaders more similar. Both should define `weight: string` and `style: string`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a 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 a 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/examples/adding-examples.md)
2022-10-20 17:42:19 +00:00