Commit Graph

487 Commits

Author SHA1 Message Date
Vercel Release Bot
6f3ae1a0ed Version Packages (#10836)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-15 23:19:35 -06:00
Vercel Release Bot
7bc8b65d13 Version Packages (#10832)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.


# Releases
## @vercel/build-utils@7.2.4

### Patch Changes

-   Select Node.js version based on what's available in build-container ([#10822](https://github.com/vercel/vercel/pull/10822))

## vercel@32.5.4

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4
    -   @vercel/node@3.0.10
    -   @vercel/static-build@2.0.11

## @vercel/client@13.0.8

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4

## @vercel/gatsby-plugin-vercel-builder@2.0.10

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4

## @vercel/node@3.0.10

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4

## @vercel/static-build@2.0.11

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.10

## @vercel-internals/types@1.0.15

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4
2023-11-15 00:45:19 +00:00
Wyatt Johnson
9472c22bf7 [next] Added more PPR tests (#10823)
This adds additional regression tests for PPR support for Next.js.
2023-11-09 23:45:35 +00:00
Vercel Release Bot
493185709a Version Packages (#10809)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.5.3

### Patch Changes

- Handle `TooManyProjects` error in places where projects are created
([#10807](https://github.com/vercel/vercel/pull/10807))

- Updated dependencies
\[[`89c1e0323`](89c1e03233),
[`fd29b966d`](fd29b966d3)]:
    -   @vercel/node@3.0.9
    -   @vercel/next@4.0.14

## @vercel/next@4.0.14

### Patch Changes

- Fixed headers for static routes when PPR is enabled
([#10808](https://github.com/vercel/vercel/pull/10808))

## @vercel/node@3.0.9

### Patch Changes

- Replace usage of `fetch` with `undici.request`
([#10767](https://github.com/vercel/vercel/pull/10767))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-08 10:36:37 -07:00
Wyatt Johnson
fd29b966d3 tests: added tests for PPR (#10808)
This adds some tests to the PPR implementation for Next.js. This also
fixes a bug where the static pages were incorrectly generating a header
that falsly indicated that it postponed.
2023-11-08 09:21:51 -07:00
Vercel Release Bot
2bd9216403 Version Packages (#10805)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.5.2

### Patch Changes

- Updated dependencies
\[[`c94a082f6`](c94a082f6b)]:
    -   @vercel/next@4.0.13

## @vercel/next@4.0.13

### Patch Changes

- Added `getRequestHandlerWithMetadata` export
([#10753](https://github.com/vercel/vercel/pull/10753))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-07 12:20:58 -07:00
Wyatt Johnson
c94a082f6b Added getRequestHandlerWithMetadata export (#10753)
This adds a new `getRequestHandlerWithMetadata` export if enabled and
available to the exported method.

---------

Co-authored-by: Joe Haddad <timer@vercel.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-11-07 10:32:03 -08:00
Vercel Release Bot
66cd626d1c Version Packages (#10765)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @vercel/build-utils@7.2.3

### Patch Changes

- Add experimental flag to allow Node.js v20
([#10802](https://github.com/vercel/vercel/pull/10802))

## vercel@32.5.1

### Patch Changes

- Debug log load user exceptions
([#10773](https://github.com/vercel/vercel/pull/10773))

- bump: edge-runtime
([#10712](https://github.com/vercel/vercel/pull/10712))

- Updated dependencies
\[[`fc90a3dc0`](fc90a3dc0b),
[`644b8a52c`](644b8a52cb),
[`0861dc8fb`](0861dc8fbc),
[`33cc8e0ac`](33cc8e0acf),
[`f5296c3c0`](f5296c3c06),
[`d9065c210`](d9065c2102)]:
    -   @vercel/next@4.0.12
    -   @vercel/node@3.0.8
    -   @vercel/build-utils@7.2.3
    -   @vercel/remix-builder@2.0.11
    -   @vercel/static-build@2.0.10

## @vercel/client@13.0.7

### Patch Changes

- Updated dependencies
\[[`0861dc8fb`](0861dc8fbc)]:
    -   @vercel/build-utils@7.2.3

## @vercel/edge@1.1.1

### Patch Changes

- bump: edge-runtime
([#10712](https://github.com/vercel/vercel/pull/10712))

## @vercel/error-utils@2.0.2

### Patch Changes

- use Node.js `util.types.isNativeError` for `isError` method
([#10764](https://github.com/vercel/vercel/pull/10764))

## @vercel/frameworks@2.0.3

### Patch Changes

- update Angular output path discovery
([#10678](https://github.com/vercel/vercel/pull/10678))

- Updated dependencies
\[[`34dd9c091`](34dd9c0918)]:
    -   @vercel/error-utils@2.0.2

## @vercel/fs-detectors@5.1.3

### Patch Changes

- Updated dependencies
\[[`306f653da`](306f653da9),
[`34dd9c091`](34dd9c0918)]:
    -   @vercel/frameworks@2.0.3
    -   @vercel/error-utils@2.0.2

## @vercel/gatsby-plugin-vercel-builder@2.0.9

### Patch Changes

- Fix nested SSR routes
([#10751](https://github.com/vercel/vercel/pull/10751))

- Updated dependencies
\[[`0861dc8fb`](0861dc8fbc)]:
    -   @vercel/build-utils@7.2.3

## @vercel/next@4.0.12

### Patch Changes

- fix re-mapping logic for index prefetches
([#10750](https://github.com/vercel/vercel/pull/10750))

- Fixes a case where using `basePath` along with static generation would
output a lambda that conflicts with the root route.
([#10738](https://github.com/vercel/vercel/pull/10738))

- Rework prefetch route handling
([#10779](https://github.com/vercel/vercel/pull/10779))

## @vercel/node@3.0.8

### Patch Changes

- bump: edge-runtime
([#10712](https://github.com/vercel/vercel/pull/10712))

- Updated dependencies
\[[`0861dc8fb`](0861dc8fbc),
[`34dd9c091`](34dd9c0918)]:
    -   @vercel/build-utils@7.2.3
    -   @vercel/error-utils@2.0.2

## @vercel/remix-builder@2.0.11

### Patch Changes

- Update `@remix-run/dev` fork to v2.2.0
([#10788](https://github.com/vercel/vercel/pull/10788))

## @vercel/static-build@2.0.10

### Patch Changes

- Updated dependencies
\[[`efd3cc05d`](efd3cc05dc)]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.9

## @vercel-internals/types@1.0.14

### Patch Changes

- Updated dependencies
\[[`0861dc8fb`](0861dc8fbc)]:
    -   @vercel/build-utils@7.2.3

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-07 10:51:39 -07:00
Bryce Kalow
33cc8e0acf fix(next): do not generate conflicting lambdas when using basePath with app router (#10738)
When using `basePath` with statically generated routes, the builder
currently generates lambdas for the root route that conflict with the
prerender functions generated.

E.g. if we have `basePath: "test"` and a root route at: `app/page.js`,
this is currently the output:

```
test
test.rsc
test/index
test/index.rsc
```

The result is that visiting the deployed app at `/test` renders an
incomplete page. On the other hand visiting `/test/index` outputs the
expected markup.

It seems like the intent is that we want to delete the lambdas that
conflict with the prerender functions. I've updated the lambda name
generation logic when doing the deleting to line up with how the lambda
names are generated initially.
2023-11-03 13:25:56 -07:00
JJ Kasper
f5296c3c06 Rework prefetch route handling (#10779)
Follow-up to https://github.com/vercel/vercel/pull/10750 this removes the underscore prefetching from all prefetch outputs and instead only applies it to the index route itself as this causes issues with PPR making these outputs prerenders and being able to interpolate the route param values. 

There is the edge case of a user returning the literal value `index` from `generateStaticParams` but we can tolerate that more than ppr not working as expected.
2023-10-31 18:15:13 +00:00
Zack Tanner
fc90a3dc0b [next] fix re-mapping logic for index prefetches (#10750)
Follow-up to https://github.com/vercel/vercel/pull/10734 -- but considers that the static prefetch associated with `/` might be inside of a dir such as `index/index.prefetch.rsc`. 

To avoid any future matching conflicts, this PR updates to prefix all static prefetches
2023-10-24 20:51:55 +00:00
Zack Tanner
f8320417a8 [next] replace next export with output: export in tests (#10756)
`next export` has been deprecated on the latest Next.js canary so these
tests will no longer pass.

This changes it to use `output: export` from `next.config.js` instead.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-10-24 09:41:54 -07:00
Vercel Release Bot
7504bfbe26 Version Packages (#10668)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.


# Releases
## vercel@32.5.0

### Minor Changes

-   Indicates whether @vercel/speed-insights or @vercel/analytics are used ([#10623](https://github.com/vercel/vercel/pull/10623))

-   [cli] update env var validation rule to allow name start with underscore ([#10697](https://github.com/vercel/vercel/pull/10697))

### Patch Changes

-   Updated dependencies \[[`da300030c`](da300030c9), [`de84743e1`](de84743e10), [`913608de4`](913608de4d), [`7fa08088e`](7fa08088ea)]:
    -   @vercel/next@4.0.11
    -   @vercel/python@4.1.0
    -   @vercel/remix-builder@2.0.10
    -   @vercel/redwood@2.0.5
    -   @vercel/static-build@2.0.9

## @vercel/python@4.1.0

### Minor Changes

-   Add support for pip3.10 and pip3.11 ([#10648](https://github.com/vercel/vercel/pull/10648))

## @vercel/routing-utils@3.1.0

### Minor Changes

-   Adds support for statusCode property on rewrites ([#10495](https://github.com/vercel/vercel/pull/10495))

## @vercel/client@13.0.6

### Patch Changes

-   Updated dependencies \[[`9e9fac019`](9e9fac0191)]:
    -   @vercel/routing-utils@3.1.0

## @vercel/fs-detectors@5.1.2

### Patch Changes

-   Updated dependencies \[[`9e9fac019`](9e9fac0191)]:
    -   @vercel/routing-utils@3.1.0

## @vercel/gatsby-plugin-vercel-builder@2.0.8

### Patch Changes

-   Updated dependencies \[[`9e9fac019`](9e9fac0191)]:
    -   @vercel/routing-utils@3.1.0

## @vercel/next@4.0.11

### Patch Changes

-   fix `build` in appDir on Windows ([#10708](https://github.com/vercel/vercel/pull/10708))

-   Fix RSC prefetch for index route with catch-all ([#10734](https://github.com/vercel/vercel/pull/10734))

## @vercel/redwood@2.0.5

### Patch Changes

-   Updated dependencies \[[`9e9fac019`](9e9fac0191)]:
    -   @vercel/routing-utils@3.1.0

## @vercel/remix-builder@2.0.10

### Patch Changes

-   Update `@remix-run/dev` fork to v2.1.0 ([#10732](https://github.com/vercel/vercel/pull/10732))

## @vercel/static-build@2.0.9

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.8

## @vercel-internals/types@1.0.13

### Patch Changes

-   Updated dependencies \[[`9e9fac019`](9e9fac0191)]:
    -   @vercel/routing-utils@3.1.0
2023-10-20 18:51:02 +00:00
JJ Kasper
de84743e10 Fix RSC prefetch for index route with catch-all (#10734)
When matching outputs and we have an `index.{ext}` file it will take priority over dynamic routes which we don't want to match prefetch RSC index outputs unless it's specifically a prefetch request so this remaps this specific file to avoid the overlap. 

x-ref: [slack thread](https://vercel.slack.com/archives/C061DMGDXQW/p1697664158904469?thread_ts=1697647520.783419&cid=C061DMGDXQW)
2023-10-20 15:05:30 +00:00
JJ Kasper
39ce9166ba Update to run Next.js integration with Node.js v18 (#10740)
Co-authored-by: Chris Barber <chris.barber@vercel.com>
Co-authored-by: Steven <steven@ceriously.com>
2023-10-20 09:36:50 -05:00
Chris Barber
5e6ef3d569 Enable source maps in tests (#10725)
The `tsconfig` files were unified with a common configuration in https://github.com/vercel/vercel/pull/10667 including disabling source maps. The source maps greatly increase the distribution size, but they are invaluable when the tests run, so this PR enables source maps for tests including adding a `tsconfig.json` where absent.

Linear: https://linear.app/vercel/issue/ZERO-364/enable-sourcemaps-in-all-testtsconfigjson-files
2023-10-17 15:15:29 +00:00
Zack Tanner
da300030c9 [next] fix build in appDir on windows (#10708)
On Windows, `globPath` is a non-POSIX path (ie `'favicon.ico\\route.js'`) which won't match the paths generated by the `glob` util, since it normalizes Windows separators to Unix separators ([ref](https://github.com/vercel/vercel/blob/main/packages/build-utils/src/fs/normalize-path.ts#L6-L8))
2023-10-16 14:57:38 +00:00
Chris Barber
222710f612 Add type-check and unify tsconfig (#10667)
This adds a new `pnpm type-check` that leverages `turbo` to validate the TypeScript code. This can be run at the top-level or for an individual package.

The `test-lint` workflow will run it after linting and doing the prettier check.

As apart of this effort, each package's `tsconfig.json` has been simplified. There's a new top-level `tsconfig.base.json` file that extends the Vercel Style Guide for TypeScript. Each package's `tsconfig.json` has been audited and previously suppressed rules that no longer apply have been removed. The result is each package's `tsconfig.json` is greatly simplified and we can control common settings in the base config while keeping the flexibility of package-level overrides.

Lastly, in `package/cli`, `pnpm build` calls `scripts/build.mjs` which calls `scripts/compile-templates.mjs`. The `compile-templates.mjs` file was generating invalid TypeScript code. I've fixed it and now it's happier than ever.

Note: In order to run `pnpm type-check`, you must first `pnpm build` because we need the `.d.ts` definition files.
2023-10-09 11:58:23 +00:00
Vercel Release Bot
0f5ec80cc6 Version Packages (#10647)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-03 17:13:03 -05:00
Steven
c523a755f8 Revert "[next] Correct output file tracing and limit calculation (#10631)" (#10651)
This reverts commit e9026c7a69.

This was causing some builds using Turbo + Next.js to fail with:

```
...writing to cache...
--
17:02:42.820 | Traced Next.js server files in: 169.874ms
17:02:42.871 | Error: Config file was not found at "/vercel/output/config.json"
17:02:42.871 | at f3 (/var/task/sandbox.js:239:2647)
17:02:42.872 | at async TCe (/var/task/sandbox.js:245:4681)
17:02:42.872 | at async WBt (/var/task/sandbox.js:261:1990)
17:02:42.872 | at async zBt (/var/task/sandbox.js:261:1791)
```

INC-442
2023-10-03 22:07:56 +00:00
Steven
fa8e313222 [next] fix test missing yarn.lock file (#10642)
- Follow up to https://github.com/vercel/vercel/pull/10630

Was passing in the PR
https://github.com/vercel/vercel/actions/runs/6386018083/job/17332012211#step:9:269

But is failing on main
https://github.com/vercel/vercel/actions/runs/6386371621/job/17332970210

Looks like the `yarn.lock` was removed right before merging so this PR
adds it back.

INC-442
2023-10-03 17:22:30 -04:00
Jimmy Lai
58215906f9 next: bump minimal version for bundled server usage (#10646)
There was a bug that we caught in the bundled server when using the instrumentation hook that we fixed in https://github.com/vercel/next.js/pull/56318 . This PR bumps the version that we check so that we don't use it if the Next version is not up to date.
2023-10-03 14:46:00 +00:00
Vercel Release Bot
45ae16e371 Version Packages (#10576)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.4.0

### Minor Changes

- Restore unsetting teamId for non-team accounts
([#10612](https://github.com/vercel/vercel/pull/10612))

### Patch Changes

- remove unused source map pkg
([#10577](https://github.com/vercel/vercel/pull/10577))

- disable source map for prod build
([#10575](https://github.com/vercel/vercel/pull/10575))

- Better rendering upon authentication error in `vc cert ls`
([#10551](https://github.com/vercel/vercel/pull/10551))

- Updated dependencies
\[[`e9026c7a6`](e9026c7a69),
[`ea5bc8806`](ea5bc88062),
[`a4996e1c5`](a4996e1c5a),
[`a18ed98f2`](a18ed98f2d),
[`2f5b0aeeb`](2f5b0aeeb1),
[`09f1bbfa4`](09f1bbfa41),
[`ce7e82fa7`](ce7e82fa7a)]:
    -   @vercel/next@4.0.9
    -   @vercel/go@3.0.3
    -   @vercel/build-utils@7.2.2
    -   @vercel/node@3.0.7
    -   @vercel/redwood@2.0.4
    -   @vercel/remix-builder@2.0.9
    -   @vercel/static-build@2.0.8

## @vercel/build-utils@7.2.2

### Patch Changes

- [cli] Update bun detection and add tests for projects with both
bunlock binary and yarn.lock text files
([#10583](https://github.com/vercel/vercel/pull/10583))

## @vercel/client@13.0.5

### Patch Changes

- Updated dependencies
\[[`2f5b0aeeb`](2f5b0aeeb1)]:
    -   @vercel/build-utils@7.2.2

## @vercel/fs-detectors@5.1.1

### Patch Changes

- [cli] Update bun detection and add tests for projects with both
bunlock binary and yarn.lock text files
([#10583](https://github.com/vercel/vercel/pull/10583))

## @vercel/gatsby-plugin-vercel-builder@2.0.7

### Patch Changes

- Updated dependencies
\[[`2f5b0aeeb`](2f5b0aeeb1)]:
    -   @vercel/build-utils@7.2.2

## @vercel/go@3.0.3

### Patch Changes

- Update broken documentation link
([#10579](https://github.com/vercel/vercel/pull/10579))

## @vercel/next@4.0.9

### Patch Changes

- Correct output file tracing and limit calculation
([#10631](https://github.com/vercel/vercel/pull/10631))

- Fix the instrumentation hook on Next.js Edge Functions
([#10608](https://github.com/vercel/vercel/pull/10608))

- [next] fix lambda creation for i18n edge pages
([#10630](https://github.com/vercel/vercel/pull/10630))

- Revert "[next][node][redwood][remix] Update @vercel/nft (#10540)"
([#10633](https://github.com/vercel/vercel/pull/10633))

- Update `@vercel/nft` to 0.24.2
([#10644](https://github.com/vercel/vercel/pull/10644))

## @vercel/node@3.0.7

### Patch Changes

- Revert "[next][node][redwood][remix] Update @vercel/nft (#10540)"
([#10633](https://github.com/vercel/vercel/pull/10633))

- Update `@vercel/nft` to 0.24.2
([#10644](https://github.com/vercel/vercel/pull/10644))

- Updated dependencies
\[[`2f5b0aeeb`](2f5b0aeeb1)]:
    -   @vercel/build-utils@7.2.2

## @vercel/redwood@2.0.4

### Patch Changes

- Revert "[next][node][redwood][remix] Update @vercel/nft (#10540)"
([#10633](https://github.com/vercel/vercel/pull/10633))

- Update `@vercel/nft` to 0.24.2
([#10644](https://github.com/vercel/vercel/pull/10644))

## @vercel/remix-builder@2.0.9

### Patch Changes

- Revert "[next][node][redwood][remix] Update @vercel/nft (#10540)"
([#10633](https://github.com/vercel/vercel/pull/10633))

- Update `@vercel/nft` to 0.24.2
([#10644](https://github.com/vercel/vercel/pull/10644))

## @vercel/static-build@2.0.8

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.7

## @vercel-internals/types@1.0.12

### Patch Changes

- Updated dependencies
\[[`2f5b0aeeb`](2f5b0aeeb1)]:
    -   @vercel/build-utils@7.2.2

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-03 05:38:27 -06:00
Ethan Arrowood
ce7e82fa7a [next][node][redwood][remix] Update @vercel/nft 0.24.2 (#10644)
Updates nft to 0.24.2 fixing a broken feature
2023-10-03 05:15:00 -06:00
JJ Kasper
e9026c7a69 [next] Correct output file tracing and limit calculation (#10631)
While investigating build times noticed that our lambda creation times were increasing linearly with the number of pages which is unexpected since there are mostly shared dependencies. After further investigation it seems we were falling back to our legacy manual `nodeFileTrace` calls in the builder when we shouldn't have been.

Also noticed we were still doing the un-necessary reading/calculating for uncompressed lambda sizes which is as discussed previously isn't required and the only limit we need to keep enforcing is the uncompressed size which is a lot less expensive to compute. 

As a further optimization this adds proper usage of our lstat cache/sema where it wasn't previously and proper parallelizing where applicable. 

These changes reduce tracing/lambda creation times by 3-5x in larger applications and can fix edge cases where we weren't leveraging our more accurate traces from the build. 

Before: 

```sh
Traced Next.js server files in: 444.05ms
Created all serverless functions in: 1:36.311 (m:ss.mmm)
Collected static files (public/, static/, .next/static): 241.47ms
```

After: 

```sh
Traced Next.js server files in: 10.4ms
Created all serverless functions in: 43.684s
Collected static files (public/, static/, .next/static): 250.828ms
```
2023-10-03 00:00:20 +00:00
Csaba Palfi
a18ed98f2d [next] fix lambda creation for i18n edge pages (#10630)
An issue similar to https://github.com/vercel/next.js/issues/44381
exists whereby vercel creates lambda functions for edge pages when i18n
is configured.

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

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-10-02 18:57:50 -04:00
Sean Massa
09f1bbfa41 Revert "[next][node][redwood][remix] Update @vercel/nft" (#10633)
This reverts commit ab329f0fe8.

@TooTallNate confirmed with a user that this revert fixed their issue: https://github.com/orgs/vercel/discussions/4231#discussioncomment-7102952
2023-10-02 21:14:29 +00:00
Andrew Gadzik
ea5bc88062 [next] fix next.js edge functions that use the instrumentation hook (#10608)
Fixes a issue when a Next.js app uses app router + edge runtime + instrumentation hook deployed out on Vercel.  The issue is that the code to register the instrumentation hook in Next.js expects `_ENTRIES` to be defined on `globalThis`.

```ts
async function registerInstrumentation() {
  console.log("'_ENTRIES' in globalThis:", '_ENTRIES' in globalThis)
  console.log(
    '_ENTRIES.middleware_instrumentation:',
    Boolean(_ENTRIES.middleware_instrumentation)
  )
  console.log(
    '_ENTRIES.middleware_instrumentation.register:',
    Boolean(_ENTRIES.middleware_instrumentation.register)
  )

  if (
    '_ENTRIES' in globalThis &&
    _ENTRIES.middleware_instrumentation &&
    _ENTRIES.middleware_instrumentation.register
  ) {
    try {
      console.log('registering middleware instrumentation...')
      await _ENTRIES.middleware_instrumentation.register()
      console.log('registered middleware instrumentation!')
    } catch (err: any) {
      err.message = `An error occurred while loading instrumentation hook: ${err.message}`
      console.error(err)
      throw err
    }
  }
}
```

produced the following output,

![image](https://github.com/vercel/vercel/assets/1278714/d0a3a536-5579-4a63-a726-2e34a575e713)

This PR fixes this by changing `let _ENTRIES = {}'` to `globalThis._ENTRIES = {};`

![image](https://github.com/vercel/vercel/assets/1278714/7ba558ac-7364-4d91-869e-920662161022)
2023-09-27 18:25:27 +00:00
Vercel Release Bot
f6e863d4bb Version Packages (#10565)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.3.1

### Patch Changes

- Use "esbuild" to build CLI
([#10555](https://github.com/vercel/vercel/pull/10555))

- Updated dependencies
\[[`9f63ca60a`](9f63ca60ad),
[`e3f9faf51`](e3f9faf513)]:
    -   @vercel/next@4.0.8
    -   @vercel/remix-builder@2.0.8

## @vercel/next@4.0.8

### Patch Changes

- Fix edge case for setting `__NEXT_PRIVATE_PREBUNDLED_REACT`
([#10568](https://github.com/vercel/vercel/pull/10568))

## @vercel/remix-builder@2.0.8

### Patch Changes

- Update `@remix-run/dev` fork to v2.0.1
([#10566](https://github.com/vercel/vercel/pull/10566))
2023-09-22 12:54:57 -03:00
Nathan Rajlich
9f63ca60ad [next] Fix a couple issues with server-build template injecting (#10568)
(Includes e2e thanks to @feedthejim)
2023-09-22 15:40:54 +00:00
Vercel Release Bot
6d312d85b2 Version Packages (#10542)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.3.0

### Minor Changes

- [cli] Support northstar users
([#10535](https://github.com/vercel/vercel/pull/10535))

### Patch Changes

- Internal variants
([#10549](https://github.com/vercel/vercel/pull/10549))

- [speed insights] Prepare for migration to new speed insights package
([#10500](https://github.com/vercel/vercel/pull/10500))

- Updated dependencies
\[[`b0898a665`](b0898a6659),
[`10d4e51ac`](10d4e51ac5),
[`decdf27fb`](decdf27fb5),
[`f5ca497b7`](f5ca497b75),
[`ab329f0fe`](ab329f0fe8),
[`d0d052011`](d0d0520111),
[`9bb3067de`](9bb3067de2)]:
    -   @vercel/static-build@2.0.7
    -   @vercel/node@3.0.6
    -   @vercel/build-utils@7.2.1
    -   @vercel/next@4.0.7
    -   @vercel/python@4.0.2
    -   @vercel/redwood@2.0.3
    -   @vercel/remix-builder@2.0.7
    -   @vercel/go@3.0.2

## @vercel/edge@1.1.0

### Minor Changes

- Add flag to geolocation
([#10443](https://github.com/vercel/vercel/pull/10443))

    Usage

        const { flag } = geolocation(req)

## @vercel/build-utils@7.2.1

### Patch Changes

- Internal variants
([#10549](https://github.com/vercel/vercel/pull/10549))

## @vercel/client@13.0.4

### Patch Changes

- Updated dependencies
\[[`decdf27fb`](decdf27fb5)]:
    -   @vercel/build-utils@7.2.1

## @vercel/gatsby-plugin-vercel-analytics@1.0.11

### Patch Changes

- Remove "babel" compilation
([#10546](https://github.com/vercel/vercel/pull/10546))

## @vercel/gatsby-plugin-vercel-builder@2.0.6

### Patch Changes

- Use "esbuild" to build package
([#10508](https://github.com/vercel/vercel/pull/10508))

- Updated dependencies
\[[`decdf27fb`](decdf27fb5)]:
    -   @vercel/build-utils@7.2.1

## @vercel/go@3.0.2

### Patch Changes

- Add support for Go v1.21.0
([#10552](https://github.com/vercel/vercel/pull/10552))

## @vercel/next@4.0.7

### Patch Changes

- Internal variants
([#10549](https://github.com/vercel/vercel/pull/10549))

- Update `@vercel/nft` to v0.24.1.
([#10540](https://github.com/vercel/vercel/pull/10540))

- Build package using "esbuild"
([#10482](https://github.com/vercel/vercel/pull/10482))

## @vercel/node@3.0.6

### Patch Changes

- Use "esbuild" to build package
([#10553](https://github.com/vercel/vercel/pull/10553))

- Update `@vercel/nft` to v0.24.1.
([#10540](https://github.com/vercel/vercel/pull/10540))

- Updated dependencies
\[[`decdf27fb`](decdf27fb5)]:
    -   @vercel/build-utils@7.2.1

## @vercel/python@4.0.2

### Patch Changes

- Fix docs URL in error message
([#10544](https://github.com/vercel/vercel/pull/10544))

## @vercel/redwood@2.0.3

### Patch Changes

- Update `@vercel/nft` to v0.24.1.
([#10540](https://github.com/vercel/vercel/pull/10540))

## @vercel/remix-builder@2.0.7

### Patch Changes

- Update `@vercel/nft` to v0.24.1.
([#10540](https://github.com/vercel/vercel/pull/10540))

## @vercel/static-build@2.0.7

### Patch Changes

- Mark `@vercel/static-config` and `ts-morph` as externals
([#10543](https://github.com/vercel/vercel/pull/10543))

- Updated dependencies
\[[`4b376a564`](4b376a564a),
[`b8bc682d3`](b8bc682d3e)]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.6
    -   @vercel/gatsby-plugin-vercel-analytics@1.0.11

## @vercel-internals/types@1.0.11

### Patch Changes

- Updated dependencies
\[[`decdf27fb`](decdf27fb5)]:
    -   @vercel/build-utils@7.2.1

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-21 11:59:12 -06:00
Nathan Rajlich
d0d0520111 [next] Use "esbuild" to build package (#10482)
### Before

```
$ time pnpm run build

> @vercel/next@4.0.6 build /Users/nrajlich/Code/vercel/vercel/packages/next
> node build.js

ncc: Version 0.24.0
ncc: Compiling file index.js
ncc: Using typescript@4.9.5 (local user-provided)
1506kB  dist/main/index.js
1506kB  [3345ms] - ncc 0.24.0

real    0m5.210s
user    0m9.083s
sys     0m0.506s

$ ls -l dist/
total 1700
-rw-r--r-- 1 nrajlich staff    2176 Sep 20 15:18 ___get-nextjs-edge-function.js
-rw-r--r-- 1 nrajlich staff    3283 Sep 20 15:18 create-serverless-config.js
drwxr-xr-x 6 nrajlich staff     192 Sep 20 15:18 edge-function-source/
-rw-r--r-- 1 nrajlich staff 1542314 Sep 20 15:18 index.js
-rw-r--r-- 1 nrajlich staff     728 Sep 20 15:18 legacy-launcher.js
-rw-r--r-- 1 nrajlich staff    6807 Sep 20 15:18 legacy-versions.js
-rw-r--r-- 1 nrajlich staff   66662 Sep 20 15:18 server-build.js
-rw-r--r-- 1 nrajlich staff    1583 Sep 20 15:18 server-launcher.js
-rw-r--r-- 1 nrajlich staff    5167 Sep 20 15:18 sourcemapped.js
-rw-r--r-- 1 nrajlich staff    1003 Sep 20 15:18 templated-launcher-shared.js
-rw-r--r-- 1 nrajlich staff     799 Sep 20 15:18 templated-launcher.js
-rw-r--r-- 1 nrajlich staff   83876 Sep 20 15:18 utils.js

$ pnpm pack && ls -lh vercel-next-4.0.6.tgz 
-rw-r--r-- 1 nrajlich staff 373K Sep 20 15:19 vercel-next-4.0.6.tgz
```

### After

```
$ time pnpm run build

> @vercel/next@4.0.6 build /Users/nrajlich/Code/vercel/vercel/packages/next
> node build.mjs

real    0m1.144s
user    0m0.550s
sys     0m0.171s

$ ls -l dist/
total 540
-rw-r--r-- 1 nrajlich staff   2176 Sep 20 15:15 ___get-nextjs-edge-function.js
-rw-r--r-- 1 nrajlich staff 528575 Sep 20 15:15 index.js
-rw-r--r-- 1 nrajlich staff   1680 Sep 20 15:15 legacy-launcher.js
-rw-r--r-- 1 nrajlich staff    901 Sep 20 15:15 server-launcher.js
-rw-r--r-- 1 nrajlich staff    532 Sep 20 15:15 templated-launcher-shared.js
-rw-r--r-- 1 nrajlich staff    316 Sep 20 15:15 templated-launcher.js

$ pnpm pack && ls -lh vercel-next-4.0.6.tgz 
-rw-r--r-- 1 nrajlich staff 104K Sep 20 15:15 vercel-next-4.0.6.tgz
```
2023-09-20 20:01:03 +00:00
Andy
decdf27fb5 [cli][next][build-utils] Variants (#10549)
Co-authored-by: Ethan Arrowood <ethan.arrowood@vercel.com>
2023-09-20 19:42:20 +02:00
Chris Barber
ab329f0fe8 [next][node][redwood][remix] Update @vercel/nft (#10540)
Updating `nft` to fix a bug. We're a couple version behind. Here's all cumulative changes:

- 0.24.1
  - resolve cjs deps as cjs instead of esm
- 0.24.0
  - drop node@14 
- 0.23.1
  - use builtinModules from module
- 0.23.0
  - resolve: export resolve() function
- 0.22.6
  - Make caching work correctly in async context
2023-09-19 14:27:54 +00:00
Vercel Release Bot
a92467719b Version Packages (#10528)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.2.5

### Patch Changes

- Updated dependencies
\[[`849eedf0f`](849eedf0f2),
[`f6f16b034`](f6f16b0347),
[`3035e18fb`](3035e18fb6),
[`cb784aeb9`](cb784aeb9c)]:
    -   @vercel/next@4.0.6
    -   @vercel/remix-builder@2.0.6

## @vercel/next@4.0.6

### Patch Changes

- Fix feature flag detection
([#10531](https://github.com/vercel/vercel/pull/10531))

## @vercel/remix-builder@2.0.6

### Patch Changes

- Fix ESM mode for Edge runtime
([#10530](https://github.com/vercel/vercel/pull/10530))

- Update `@remix-run/dev` fork to v2.0.0
([#10526](https://github.com/vercel/vercel/pull/10526))

- Fixes for Remix v2
([#10525](https://github.com/vercel/vercel/pull/10525))
2023-09-18 15:44:07 -03:00
Steven
849eedf0f2 [next] fix feature flag detection (#10531)
For feature flags, we use the string `1` for enabled and the string `0` for disabled.

So we need to check the value of the env var, not the presence of the env var.
2023-09-18 16:17:55 +00:00
Vercel Release Bot
fa3f701e05 Version Packages (#10505)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-14 16:06:33 -05:00
Zack Tanner
083aad448e [next] missed a prerender for experimentalBypassFor (#10504)
Missed this in https://github.com/vercel/vercel/pull/10497
2023-09-14 01:19:13 +00:00
Vercel Release Bot
314a105ba1 Version Packages (#10493)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-13 17:15:29 -05:00
Zack Tanner
7a0fed970c [next] provide experimentalBypassFor to prerender from manifest (#10497) 2023-09-12 17:40:49 -05:00
Jimmy Lai
2f461a8b0b next.js: add option to use bundled runtime (#10485)
This PR adds an environment variable that should allow us to test the bundled version for Next.js on Vercel, see https://github.com/vercel/next.js/pull/52997 for reference.

The changes include:
- a new environment variable `VERCEL_NEXT_BUNDLED_SERVER`
- some logic changes that will put app route handlers into their own lambda groups
- extra logic to require early the rendering runtimes (see PR above for details)
2023-09-12 19:45:23 +00:00
Vercel Release Bot
bcebab7517 Version Packages (#10478)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @vercel/build-utils@7.2.0

### Minor Changes

- Add new optional prerender field: experimentalStreamingLambdaPath
([#10476](https://github.com/vercel/vercel/pull/10476))

- [build-utils] Add zero config detection for bun package manager
([#10486](https://github.com/vercel/vercel/pull/10486))

### Patch Changes

- add `experimentalBypassFor` field to Prerender
([#10481](https://github.com/vercel/vercel/pull/10481))

## vercel@32.2.1

### Patch Changes

- Update @vercel/fun@1.1.0
([#10477](https://github.com/vercel/vercel/pull/10477))

- [node] upgrade edge-runtime
([#10451](https://github.com/vercel/vercel/pull/10451))

- Updated dependencies
\[[`6784e7751`](6784e77516),
[`a8ad17626`](a8ad176262),
[`0ee089a50`](0ee089a501),
[`f15cba614`](f15cba6148),
[`b265e13d4`](b265e13d40),
[`50e04dd85`](50e04dd858),
[`45b73c7e8`](45b73c7e86),
[`a732d30c8`](a732d30c84),
[`9d64312aa`](9d64312aaa),
[`6baefc825`](6baefc825a),
[`989f0d813`](989f0d8139),
[`d8bc570f6`](d8bc570f60)]:
    -   @vercel/go@3.0.1
    -   @vercel/redwood@2.0.2
    -   @vercel/remix-builder@2.0.4
    -   @vercel/hydrogen@1.0.1
    -   @vercel/static-build@2.0.5
    -   @vercel/build-utils@7.2.0
    -   @vercel/next@4.0.3
    -   @vercel/node@3.0.5
    -   @vercel/python@4.0.1
    -   @vercel/ruby@2.0.2

## @vercel/client@13.0.3

### Patch Changes

- Updated dependencies
\[[`50e04dd85`](50e04dd858),
[`45b73c7e8`](45b73c7e86),
[`d8bc570f6`](d8bc570f60)]:
    -   @vercel/build-utils@7.2.0

## @vercel/edge@1.0.2

### Patch Changes

- [node] upgrade edge-runtime
([#10451](https://github.com/vercel/vercel/pull/10451))

## @vercel/gatsby-plugin-vercel-builder@2.0.5

### Patch Changes

- Updated dependencies
\[[`50e04dd85`](50e04dd858),
[`45b73c7e8`](45b73c7e86),
[`9d64312aa`](9d64312aaa),
[`d8bc570f6`](d8bc570f60)]:
    -   @vercel/build-utils@7.2.0
    -   @vercel/node@3.0.5

## @vercel/go@3.0.1

### Patch Changes

- Update to esbuild script
([#10468](https://github.com/vercel/vercel/pull/10468))

## @vercel/hydrogen@1.0.1

### Patch Changes

- Use `build-builder.mjs` script to bundle, and remove types and source
maps ([#10480](https://github.com/vercel/vercel/pull/10480))

## @vercel/next@4.0.3

### Patch Changes

- fix content-type for RSC prefetches
([#10487](https://github.com/vercel/vercel/pull/10487))

## @vercel/node@3.0.5

### Patch Changes

- [node] upgrade edge-runtime
([#10451](https://github.com/vercel/vercel/pull/10451))

- Updated dependencies
\[[`50e04dd85`](50e04dd858),
[`45b73c7e8`](45b73c7e86),
[`d8bc570f6`](d8bc570f60)]:
    -   @vercel/build-utils@7.2.0

## @vercel/python@4.0.1

### Patch Changes

- Update to esbuild script
([#10470](https://github.com/vercel/vercel/pull/10470))

## @vercel/redwood@2.0.2

### Patch Changes

- Update to esbuild script
([#10471](https://github.com/vercel/vercel/pull/10471))

## @vercel/remix-builder@2.0.4

### Patch Changes

- Use `build-builder.mjs` script to bundle, and remove types and source
maps ([#10479](https://github.com/vercel/vercel/pull/10479))

## @vercel/ruby@2.0.2

### Patch Changes

- Update to esbuild script
([#10472](https://github.com/vercel/vercel/pull/10472))

## @vercel/static-build@2.0.5

### Patch Changes

- Build package using "esbuild"
([#10462](https://github.com/vercel/vercel/pull/10462))

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.5

## @vercel-internals/types@1.0.10

### Patch Changes

- Updated dependencies
\[[`50e04dd85`](50e04dd858),
[`45b73c7e8`](45b73c7e86),
[`d8bc570f6`](d8bc570f60)]:
    -   @vercel/build-utils@7.2.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-11 17:30:02 -04:00
Zack Tanner
a732d30c84 [next] fix content-type for RSC prefetches (#10487)
This ensures that the `.prefetch.rsc` requests respond with the correct `content-type` since this is used by Next.js to determine if a request is valid or not (and in the case it's invalid, an mpa navigation will occur)

Fixes: https://github.com/vercel/next.js/issues/54934
2023-09-11 19:04:16 +00:00
Vercel Release Bot
82231058da Version Packages (#10400)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-08 11:41:32 -05:00
Zack Tanner
6aa0aa4e65 [next] fix ENOENT on /404.html when fallback: false w/ basePath (#10473)
The following error occurs during build when `basePath` is present in conjunction with `fallback: false` in `getStaticPaths`:

> Error: ENOENT: no such file or directory, open '/vercel/path0/.next/server/pages/404.html'

`localePrefixed404` was incorrectly being set to `false` because it was looking for `/<basePath>/<locale>/404.html` (when it's actually `/<locale>/404.html`)

This meant that inside `onPrerenderRoute`, `htmlFsRef` was pointing to `/404.html` rather than `/en/404.html`.
2023-09-08 00:17:08 +00:00
JJ Kasper
caaba0d685 [next] fix app dir edge functions with basePath (#10465)
x-ref: https://github.com/vercel/vercel/pull/10394
2023-09-07 22:03:12 +00:00
Zack Tanner
c3c54d6e69 [next]: Fix RSC rewrite behavior (#10415)
- Removes some of the hacks from #10388 that were attempting to resolve an issue with RSC prefetches to `pages` routes in favor of adding rsc rewrites for all dynamic paths, and letting it fall through to a 404 if there's no match
- Fixes an issue where RSC requests were matching the wrong path (filesystem rather than RSC variant) introduced in above mentioned change
  - Closes https://github.com/vercel/next.js/issues/54698
2023-09-07 14:03:14 +00:00
Espen Hovlandsdal
1b4de4a986 chore(deps): upgrade semver dependency (#10411)
Addresses ReDoS vulnerability: https://security.snyk.io/vuln/SNYK-JS-SEMVER-3247795
Uses the latest unaffected versions in the respective major versions, to prevent having to deal with any other breaking changes.
2023-09-06 13:37:37 +00:00
JJ Kasper
c9ad4084ee [next] Update page config test (#10456)
Updates failing test in https://github.com/vercel/vercel/actions/runs/6090040294/job/16525842631?pr=10430 per changes in https://github.com/vercel/next.js/pull/54786
2023-09-06 00:46:37 +00:00
Steven
e43191b186 [next] fix 404 enoent for i18n (#10416)
This PR fixes the following error:

```
Error: ENOENT: no such file or directory, open '/vercel/path0/.next/server/pages/en/404.html'
```


https://github.com/vercel/vercel/actions/runs/6030773334/job/16364078054?pr=10415#step:9:1352
2023-09-01 10:39:52 -04:00