Compare commits

...

117 Commits

Author SHA1 Message Date
Vercel Release Bot
19a373288f Version Packages (#11079)
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@33.3.0

### Minor Changes

- Emit "filePathMap" in `vc-config.json` for `FileFsRef` instances
([#11060](https://github.com/vercel/vercel/pull/11060))

### Patch Changes

- Update `vc dev` to support `Lambda` instances without `zipBuffer`
([#11080](https://github.com/vercel/vercel/pull/11080))

- Updated dependencies
\[[`322c88536`](322c88536d),
[`62ca2efa7`](62ca2efa73)]:
    -   @vercel/ruby@2.0.5
    -   @vercel/python@4.1.1

## @vercel/client@13.1.0

### Minor Changes

- Upload files referenced by "filePathMap" during `vc deploy --prebuilt`
([#11077](https://github.com/vercel/vercel/pull/11077))

## @vercel/python@4.1.1

### Patch Changes

- Remove deprecated `createLambda()` usage
([#11080](https://github.com/vercel/vercel/pull/11080))

## @vercel/ruby@2.0.5

### Patch Changes

- add ruby3 to path during build
([#11094](https://github.com/vercel/vercel/pull/11094))

- Remove deprecated `createLambda()` usage
([#11080](https://github.com/vercel/vercel/pull/11080))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-25 14:29:57 -06:00
Sean Massa
322c88536d add ruby3 to path during build (#11094)
Add ruby to the path plus some debug code. I'll remove the debug code
after we verify this works.
2024-01-25 14:16:53 -06:00
Trek Glowacki
1f259d5eb9 [static-build] Update parcel@2 fixture to latest minor (#11087) 2024-01-24 21:51:10 +00:00
Trek Glowacki
3759da57ab [static-build] update blitzjs@2 fixture to latest minor (#11086)
update blitzjs@2 fixture to latest minor
2024-01-24 10:15:16 -06:00
Nathan Rajlich
30ba68edf9 [cli] Emit "filePathMap" in vc-config.json for FileFsRef instances (#11060)
This is a performance / bandwidth / storage space optimization for the **Build Output API**.

When a Builder returns function which contains a file that is a `FileFsRef` instance, it _won't_ be copied into the corresponding `.func` directory, but instead will be added to a `"files"` mapping in the `.vc-config.json` file. This mapping represents keys which are destination file paths within the function filesystem, and values which are relative paths from the root of the project codebase. This allows for common files (i.e. `node_modules`) to be referenced (instead of physically copied on the disk).

This introduces an additional complexity to `vc deploy --prebuilt`, in such that now it needs to build up the list of `"files"` referenced from the `.vc-config.json` files, and _also_ upload those file paths along with the `.vercel/output` directory.

Depends on:

* https://github.com/vercel/vercel/pull/11077
* https://github.com/vercel/vercel/pull/11080
2024-01-23 20:54:34 +00:00
Nathan Rajlich
62ca2efa73 [python][ruby][cli] Remove deprecated createLambda() usage (#11080)
* Use `Lambda` constructor instead of `createLambda()`
* Return `FileBlob` instance for the entrypoint files, so that they do not get written to cwd
* In `vc dev`, support `Lambda` instances which do not have `zipBuffer` property
2024-01-23 19:53:36 +00:00
Nathan Rajlich
2b71ee6b42 [client] Upload files referenced by "filePathMap" during vc deploy --prebuilt (#11077)
Ensure that files referenced by the `filePathMap` property in the `.vc-config.json` files for functions in the Build Output API `.vercel/output` directory are uploaded during the prebuilt deployment process.

Related to / precursor for https://github.com/vercel/vercel/pull/11060.
2024-01-22 22:48:12 +00:00
Vercel Release Bot
acb2acf953 Version Packages (#11034)
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@33.2.0

### Minor Changes

-   chore: deprecate next/nuxt/gastby Speed Insights injection in favor of @vercel/speed-insights ([#11048](https://github.com/vercel/vercel/pull/11048))

### Patch Changes

-   fix error when @vercel/analytics is a transitive dependency of the deployed application ([#10892](https://github.com/vercel/vercel/pull/10892))

-   [cli] Add documentation string for `skip-domain` option ([#11051](https://github.com/vercel/vercel/pull/11051))

-   Updated dependencies \[[`260125784`](2601257846), [`cdddb33ad`](cdddb33ad4), [`72d8604c9`](72d8604c9d), [`90d0455e1`](90d0455e1f), [`0716130e5`](0716130e58), [`b6b151f39`](b6b151f391), [`b185a7e20`](b185a7e207)]:
    -   @vercel/static-build@2.1.0
    -   @vercel/build-utils@7.5.1
    -   @vercel/next@4.1.0
    -   @vercel/remix-builder@2.0.18
    -   @vercel/node@3.0.17

## @vercel/next@4.1.0

### Minor Changes

-   fix error when @vercel/analytics is a transitive dependency of the deployed application ([#10892](https://github.com/vercel/vercel/pull/10892))

### Patch Changes

-   Use `worker.name` instead of edge function name to fix type error in `@vercel/next` ([#11050](https://github.com/vercel/vercel/pull/11050))

## @vercel/static-build@2.1.0

### Minor Changes

-   chore: deprecate next/nuxt/gastby Speed Insights injection in favor of @vercel/speed-insights ([#11048](https://github.com/vercel/vercel/pull/11048))

### Patch Changes

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

## @vercel/build-utils@7.5.1

### Patch Changes

-   Add experimental field to Lambda and size to FileFsRef output ([#11059](https://github.com/vercel/vercel/pull/11059))

## @vercel/client@13.0.14

### Patch Changes

-   Updated dependencies \[[`cdddb33ad`](cdddb33ad4)]:
    -   @vercel/build-utils@7.5.1

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

### Patch Changes

-   Updated dependencies \[[`cdddb33ad`](cdddb33ad4)]:
    -   @vercel/build-utils@7.5.1

## @vercel/node@3.0.17

### Patch Changes

-   Updated dependencies \[[`cdddb33ad`](cdddb33ad4)]:
    -   @vercel/build-utils@7.5.1

## @vercel/remix-builder@2.0.18

### Patch Changes

-   Fix functions without a output path edge case ([#11038](https://github.com/vercel/vercel/pull/11038))

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

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

## @vercel-internals/types@1.0.21

### Patch Changes

-   Updated dependencies \[[`cdddb33ad`](cdddb33ad4)]:
    -   @vercel/build-utils@7.5.1
2024-01-19 22:07:42 +00:00
Damien Simonin Feugas
2601257846 [cli, static-builds] deprecation notice for speed insights injection (#11048)
### 🧐 What's in there?

With the recent release of [`@vercel/speed-insights`](https://vercel.com/docs/speed-insights/package) own package (like [`@vercel/analytics`](https://vercel.com/docs/analytics/package)), it's time to encourage users to migrate.

With the availability of `@vercel/speed-insights`, users will have to opt-in explicitly by installing the package. Their benefit is a better and fine-grained control of the reporting (in particular, per-application sample rate).

###  Note to reviewers

I used `console.warn` and hope it will stands out in the build logs. I'm happy to use anything else if you have better suggestions.

There's also a deprecation warning in Next.js, which covers a related but slightly different case, when users explicitly pass analyticsId in their configuration. https://github.com/vercel/next.js/pull/60677
2024-01-19 19:10:31 +00:00
jane
30b0925218 fix support link (#11067) 2024-01-19 16:55:43 +00:00
Vercel Release Bot
eddd432e06 [examples][tests] Upgrade Next.js to version 14.1.0 (#11066)
This auto-generated PR updates 7 packages to Next.js version 14.1.0

Co-authored-by: Steven <steven@ceriously.com>
2024-01-19 11:08:14 -05:00
Vercel Release Bot
b185a7e207 [remix] Update @remix-run/dev to v2.5.1 (#11065)
This auto-generated PR updates `@remix-run/dev` to version 2.5.1.
2024-01-19 00:29:36 +00:00
Trek Glowacki
5c910bf937 [static-build] bump stencil test fixture to latest (#11058)
Bump stencil test fixture to latest
2024-01-18 23:15:45 +00:00
JJ Kasper
cdddb33ad4 Add experimental field to Lambda and size to FileFsRef output (#11059)
This adds a new experimental field for new bundling behavior. This also
adds an optional `size` field to the FileFsRef output since we already
stat to avoid having to re-stat to get this value.
2024-01-18 14:51:54 -08:00
JJ Kasper
0da7ea7b78 Add retry handling when hitting SSO (#11061)
This aims to reduce flakiness when SSO disabling for a test project is
still disabling/propagating.

x-ref:
https://github.com/vercel/vercel/actions/runs/7563953104/job/20597320056?pr=11059
x-ref:
https://github.com/vercel/vercel/actions/runs/7563953104/job/20597322078?pr=11059

---------

Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2024-01-18 13:17:49 -08:00
Trek Glowacki
7de754398e [cli] Add documentation string for skip-domain option (#11051)
Text taken directly from https://vercel.com/docs/cli/deploy#skip-domain
2024-01-18 18:10:22 +00:00
Trek Glowacki
d4cc520814 [tests] update FastAPI fixture to latest (#11053)
Bumping this test fixture for python to keep up with releases.
2024-01-17 19:57:44 +00:00
Sean Massa
03d07dd163 update codeowners (#11057)
Update codeowners for shifting responsibilities.
2024-01-17 11:22:47 -06:00
Vercel Release Bot
b6b151f391 [remix] Update @remix-run/dev to v2.5.0 (#11054)
This auto-generated PR updates `@remix-run/dev` to version 2.5.0.
2024-01-17 05:07:26 +00:00
Vercel Release Bot
8c4b732d41 [tests] Upgrade Turbo to version 1.11.3 (#11021)
This auto-generated PR updates Turbo to version 1.11.3
2024-01-17 00:07:06 +00:00
Nathan Rajlich
d4335f0b56 Remove @cb1kenobi from CODEOWNERS (#11039)
:salute:
2024-01-16 15:43:30 -08:00
Nathan Rajlich
90d0455e1f [remix] Fix functions without a output path edge case (#11038)
Fixes an edge case where a route without a path was causing the build to
fail. Reproducible with this `remix.config.js` file:

```js
export default {
    ignoredRouteFiles: ["**/.*"],
    routes(defineRoutes) {
        return defineRoutes((route) => {
            route("/", "foo.tsx", { index: true });
        });
    },
};
```
2024-01-16 14:37:05 -08:00
Ethan Arrowood
0716130e58 Use worker.name instead of edge function name to fix type error in @vercel/next (#11050)
Uses another `name` property instead of the now deprecated one.
2024-01-16 12:56:28 -08:00
Ethan Arrowood
8b7479fb6e [python] update fastapi to 0.105.0 (#10958)
Updates python fixture `fastapi` to version `0.105.1`
2024-01-16 16:53:55 +00:00
Damien Simonin Feugas
72d8604c9d [cli] fix error when @vercel/analytics is a transitive dependency of the deployed application (#10892) 2024-01-11 15:48:20 +01:00
Vercel Release Bot
5fe7b57b8d Version Packages (#11015)
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.5.0

### Minor Changes

- Deprecate `EdgeFunction#name` property
([#11010](https://github.com/vercel/vercel/pull/11010))

## vercel@33.1.0

### Minor Changes

- Serialize duplicate `EdgeFunction` references as symlinks in `vc
build` ([#11027](https://github.com/vercel/vercel/pull/11027))

### Patch Changes

- Handle rate limit response when fetching /teams
([#11013](https://github.com/vercel/vercel/pull/11013))

- Display actual deployment's 'target'
([#11025](https://github.com/vercel/vercel/pull/11025))

- Updated dependencies
\[[`98040ec24`](98040ec24e)]:
    -   @vercel/build-utils@7.5.0
    -   @vercel/static-build@2.0.17
    -   @vercel/hydrogen@1.0.2
    -   @vercel/remix-builder@2.0.17
    -   @vercel/node@3.0.16

## @vercel/client@13.0.13

### Patch Changes

- Updated dependencies
\[[`98040ec24`](98040ec24e)]:
    -   @vercel/build-utils@7.5.0

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

### Patch Changes

- Updated dependencies
\[[`98040ec24`](98040ec24e)]:
    -   @vercel/build-utils@7.5.0

## @vercel/hydrogen@1.0.2

### Patch Changes

- Deprecate `EdgeFunction#name` property
([#11010](https://github.com/vercel/vercel/pull/11010))

## @vercel/node@3.0.16

### Patch Changes

- Deprecate `EdgeFunction#name` property
([#11010](https://github.com/vercel/vercel/pull/11010))

- Updated dependencies
\[[`98040ec24`](98040ec24e)]:
    -   @vercel/build-utils@7.5.0

## @vercel/remix-builder@2.0.17

### Patch Changes

- Deprecate `EdgeFunction#name` property
([#11010](https://github.com/vercel/vercel/pull/11010))

## @vercel/static-build@2.0.17

### Patch Changes

- Deprecate `EdgeFunction#name` property
([#11010](https://github.com/vercel/vercel/pull/11010))

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

## @vercel-internals/types@1.0.20

### Patch Changes

- Updated dependencies
\[[`98040ec24`](98040ec24e)]:
    -   @vercel/build-utils@7.5.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-10 15:51:08 -06:00
Nathan Rajlich
ab826eb83d [cli] Serialize duplicate EdgeFunction references as symlinks in vc build (#11027)
Enables the symlink optimization that currently exists for `Lambda`
instances, but now for `EdgeFunction` instances as well. This will be
particularly beneficial for Remix applications which use edge functions
for many routes, since they will now all be represented by the same
underling function in production.

---------

Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2024-01-10 13:17:59 -08:00
Nathan Rajlich
98040ec24e [build-utils] Deprecate EdgeFunction#name property (#11010)
The `name` property of the `EdgeFunction` class is no longer necessary
on the infra side. Instead, its value is inferred based on the URL path
that the function is representing. So deprecate the property on the
class, and remove its usage throughout the codebase.
2024-01-10 12:32:38 -08:00
Chris Barber
21c700aa93 [cli] Display actual deployment's 'target' (#11025)
The CLI renders the deploy URL with the "Preview" label on first deploy because the CLI treats deploys as previews unless `--prod` is set. However the first deploy for a new project is always production, so the CLI needs to render the deploy URL based on the actual deployment's `target`.
2024-01-10 14:05:52 +00:00
Juan Pinilla
50ed13b6ed [docs] fix edge IP_HEADER_NAME header typedoc typo (#11028)
Fix small typo in the `IP_HEADER_NAME` description.

<img width="362" alt="Screenshot 2024-01-08 at 7 25 34 PM"
src="https://github.com/vercel/vercel/assets/762112/db4d684a-5a12-45d0-8428-981bf2489999">
2024-01-08 19:26:57 -08:00
Trek Glowacki
597508ffa6 [cli] handle rate limit respones when fetching /teams endpoint (#11013)
Not the biggest fan of handling this here but of all the various location we do response handling, this seems to be the appropriate location.
2024-01-04 15:04:54 +00:00
Vercel Release Bot
57ee3e1fd5 [tests] Update Gatsby fixture versions (#10995)
Automatically generated PR to update Gatsby fixture versions in `@vercel/static-build`
2024-01-04 07:08:17 +00:00
Vercel Release Bot
83952e45c2 Version Packages (#10982)
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@33.0.2

### Patch Changes

-   Log extension execution failures ([#10937](https://github.com/vercel/vercel/pull/10937))

-   Updated dependencies \[[`fbe08fe57`](fbe08fe57e), [`77585013d`](77585013de), [`c536a74bc`](c536a74bc9), [`91f8763ed`](91f8763edc), [`7f8f5f865`](7f8f5f8651)]:
    -   @vercel/next@4.0.17
    -   @vercel/go@3.0.5
    -   @vercel/node@3.0.15
    -   @vercel/redwood@2.0.6
    -   @vercel/remix-builder@2.0.16

## @vercel/go@3.0.5

### Patch Changes

-   Remove `VERCEL_USE_GO_PROVIDED_RUNTIME` env var check ([#10968](https://github.com/vercel/vercel/pull/10968))

## @vercel/next@4.0.17

### Patch Changes

-   Ensure rewrites handle RSC requests ([#11005](https://github.com/vercel/vercel/pull/11005))

-   [next][node][redwood][remix] Bump `@vercel/nft@0.26.1` ([#11009](https://github.com/vercel/vercel/pull/11009))

## @vercel/node@3.0.15

### Patch Changes

-   Await waitUntil promises to resolve before exiting ([#10915](https://github.com/vercel/vercel/pull/10915))

-   [next][node][redwood][remix] Bump `@vercel/nft@0.26.1` ([#11009](https://github.com/vercel/vercel/pull/11009))

## @vercel/redwood@2.0.6

### Patch Changes

-   [next][node][redwood][remix] Bump `@vercel/nft@0.26.1` ([#11009](https://github.com/vercel/vercel/pull/11009))

## @vercel/remix-builder@2.0.16

### Patch Changes

-   [next][node][redwood][remix] Bump `@vercel/nft@0.26.1` ([#11009](https://github.com/vercel/vercel/pull/11009))

-   Update `@remix-run/dev` fork to v2.4.1 ([#10992](https://github.com/vercel/vercel/pull/10992))
2024-01-03 22:20:58 +00:00
Trek Glowacki
8e8f44a21d [static-build] Update stencil fixture to latest 4.x (#10990)
Update stencil framework fixture to latest minor in the major.
2024-01-03 21:13:45 +00:00
Steven
91f8763edc [next][node][redwood][remix] Bump @vercel/nft@0.26.2 (#11009)
https://github.com/vercel/nft/releases/tag/0.26.2
https://github.com/vercel/nft/releases/tag/0.26.1
https://github.com/vercel/nft/releases/tag/0.25.0
2024-01-03 15:18:30 -05:00
Brody McKee
b1e0523e71 [cli] log extension execution failures (#10937)
Co-authored-by: Nathan Rajlich <n@n8.io>
2024-01-03 16:05:18 +11:00
Vercel Release Bot
7f8f5f8651 [remix] Update @remix-run/dev to v2.4.1 (#10992)
This auto-generated PR updates `@remix-run/dev` to version 2.4.1.
2024-01-03 00:05:52 +00:00
JJ Kasper
fbe08fe57e [next] Ensure rewrites handle RSC requests (#11005)
This ensures we add handling for our internal `.rsc` suffixes for rewrites since this currently fail to match by default unless the user manually adds handling for this. Updated our test fixture to ensure this is tested properly.
2024-01-02 18:46:31 +00:00
Luc Leray
9903f11cc3 [examples] Fix ERR_PNPM_OUTDATED_LOCKFILE when deploying SvelteKit example (#10984)
Currently, [the SvelteKit (v1)](https://vercel.com/new/clone?b=main&s=https%3A%2F%2Fgithub.com%2Fvercel%2Fvercel%2Ftree%2Fmain%2Fexamples%2Fsveltekit-1&showOptionalTeamCreation=false&template=sveltekit-1&teamCreateStatus=hidden) example fails with:
```
ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json
```

This fixes the lockfile, and therefore fixes the example.

---

As a side-quest, I also fixed the "unmet peer" warnings:
```
└─┬ @vercel/style-guide 4.0.2
  ├── ✕ unmet peer eslint@^8.24.0: found 8.14.0
  ├── ✕ unmet peer prettier@^2.7.0: found 2.6.2
  └─┬ eslint-plugin-unicorn 43.0.2
    └── ✕ unmet peer eslint@>=8.18.0: found 8.14.0
```
2023-12-21 19:21:53 +00:00
Luc Leray
04f5f3f3d2 [examples] Fix TypeScript error in ionic react example (#10985)
The ionic react build currently fails with:
```
$ react-scripts build
09:06:23.084 | Creating an optimized production build...
09:06:45.231 | Failed to compile.
09:06:45.231 |  
09:06:45.232 | /vercel/path0/node_modules/@types/babel__traverse/index.d.ts
09:06:45.232 | TypeScript error in /vercel/path0/node_modules/@types/babel__traverse/index.d.ts(314,13):
09:06:45.232 | Type expected.  TS1110
09:06:45.232 |  
09:06:45.232 | 312 \|         // too complex for TS. So we type it as a general visitor only if the key contains `\|`
09:06:45.232 | 313 \|         // this is good enough for non-visitor traverse options e.g. `noScope`
09:06:45.232 | > 314 \|         [k: `${string}\|${string}`]: VisitNode<S, Node>;
09:06:45.232 | \|             ^
09:06:45.232 | 315 \|     };
09:06:45.232 | 316 \|
09:06:45.232 | 317 \| export type VisitNode<S, P extends Node> = VisitNodeFunction<S, P> \| VisitNodeObject<S, P>;
09:06:45.232
```

Upgrading to TypeScript 4 fixes the issue.

---------

Co-authored-by: Trek Glowacki <trek.glowacki@vercel.com>
2023-12-21 13:04:26 -06:00
Trek Glowacki
5e3c077b6b [static-build] update ionic/angular to latest v7 (#10986)
update ionic/angular to latest v7. Needed to add and `overrides` entry.
Some packages just specify angular >= 14 and this bumps us to angular
17, which we're not ready for yet.
2023-12-21 11:01:52 -06:00
Trek Glowacki
2cc2fac819 Revert #10980 (#10989)
Undoes #10980 (mostly). This appears to be some kind of caching issue. Works locally until you run `eslint` without `--cache` and then it will reproduce. Hopefully this is the last time and we're not playing whack-a-mole with these pragmas every day?
2023-12-21 16:17:38 +00:00
Seiya Nuta
c536a74bc9 [node] Await waitUntil promises to resolve before exiting (#10915)
Say you have a middleware (`middleware.js`) that looks like this:

```js
export async default function middleware(req, ctx) {
  ctx.waitUntil(tooLongFunction())
}

async function tooLongFunction() {
  console.log('tooLongFunction started')
  await new Promise((resolve) => setTimeout(resolve, 10000))
  console.log('tooLongFunction finished')
}
```

When you run this middleware locally with `vercel dev`, you won't see the `tooLongFunction finished` message because the server process is killed right after finishing the response. While Edge Runtime's `server.close()`, which awaits all `waitUntil` promises, is called, but `exit-hook`'s callback in CLI doesn't wait for the `close` promise to resolve.

This PR fixes this by allowing an optional graceful shutdown callback instead of killing the process immediately.
2023-12-21 10:11:34 +00:00
Trek Glowacki
838d56c31c [static-build] Add Angular 17 fixture (#10969)
Add Angular 17 fixture
2023-12-20 21:25:04 +00:00
Nathan Rajlich
77585013de [go] Remove VERCEL_USE_GO_PROVIDED_RUNTIME env var check (#10968)
Feature flag has been rolled out for long enough now. Remove this check.
2023-12-20 11:35:12 -08:00
Trek Glowacki
44569e6929 Remove unneeded global directives (#10980)
An update to latest `turbo` somehow made these no longer required? 🤷

---------

Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-12-20 12:14:10 -06:00
Vercel Release Bot
6194e8ca8d Version Packages (#10971)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-20 08:34:34 -06:00
Wyatt Johnson
7b0adf371b [next] App Pages Prerender Manifest Update (#10978)
Previously routes that did not have a `dataRoute` key in the `prerender-manifest.json` would be treated as an App Route. The logic has been updated (for partial prerendering support) to also consider the new `prefetchDataRoute`. Entries with either of these keys are treated as an App Page instead of an App Route.

This also addressed the scenerio where a app route (`route.ts`) with a dynamic segment (`/api/[slug]/route.ts`) which doesn't emit a `.body` during build doesn't cause the build to fail by checking for the file first.
2023-12-19 21:03:18 +00:00
S3Prototype
471bdd5b45 Update nuxt logo (#10977)
We're using an out of date Nuxt logo, and the team has requested an update. This PR updates it
2023-12-19 20:29:59 +00:00
Nathan Rajlich
67fa2f3dd6 [build-utils] Extend Node v16 discontinue date to 2024-06-15 (#10967)
AWS has extended the discontinue date for `nodejs16.x` Lambda runtime, so we will follow suit.
2023-12-18 23:45:45 +00:00
Vercel Release Bot
b67b97023b Version Packages (#10944)
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@33.0.0

### Major Changes

- [cli] replace `--deprecated` with `--update-required` in `vc project
ls` ([#10965](https://github.com/vercel/vercel/pull/10965))

### Patch Changes

- Fix `vercel bisect` selecting too many deployments
([#10956](https://github.com/vercel/vercel/pull/10956))

- Updated dependencies
\[[`6a9002f22`](6a9002f229),
[`4d63d9e95`](4d63d9e954)]:
    -   @vercel/remix-builder@2.0.15
    -   @vercel/build-utils@7.4.0
    -   @vercel/static-build@2.0.15
    -   @vercel/node@3.0.13

## @vercel/build-utils@7.4.0

### Minor Changes

- Adds new helper `getPathForPackageManager()`
([#10918](https://github.com/vercel/vercel/pull/10918))

## @vercel/client@13.0.11

### Patch Changes

- Updated dependencies
\[[`4d63d9e95`](4d63d9e954)]:
    -   @vercel/build-utils@7.4.0

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

### Patch Changes

- Add support for "rewrites"
([#10954](https://github.com/vercel/vercel/pull/10954))

- Updated dependencies
\[[`4d63d9e95`](4d63d9e954)]:
    -   @vercel/build-utils@7.4.0

## @vercel/node@3.0.13

### Patch Changes

- Updated dependencies
\[[`4d63d9e95`](4d63d9e954)]:
    -   @vercel/build-utils@7.4.0

## @vercel/remix-builder@2.0.15

### Patch Changes

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

## @vercel/static-build@2.0.15

### Patch Changes

- Updated dependencies
\[[`652a31275`](652a312753)]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.13

## @vercel-internals/types@1.0.18

### Patch Changes

- Updated dependencies
\[[`4d63d9e95`](4d63d9e954)]:
    -   @vercel/build-utils@7.4.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-18 12:25:56 -07:00
Ethan Arrowood
9146885f80 [cli] replace --deprecated with --update-required in vc project ls (#10965)
Replaces the new `--deprecated` option with `--update-required` in the `vc project ls` command.
2023-12-18 19:10:07 +00:00
Mitch (a.k.a Voz)
98bc41d49a fix: Doc links in auth files (#10955)
Fixed the links in the auth files to reflect what the doc links currently are.
2023-12-18 16:59:19 +00:00
Vercel Release Bot
a38c102208 [tests] Upgrade Turbo to version 1.11.2 (#10960)
This auto-generated PR updates Turbo to version 1.11.2
2023-12-18 16:39:28 +00:00
Trek Glowacki
211c74a7d2 [static-build] Add vite@5 test fixture (#10953)
Add vite@5 test fixture
2023-12-15 18:58:29 +00:00
Trek Glowacki
2a40ff564e [static-build] update ember-v5 fixture to latest minor (#10957)
Update ember-v5 fixture to latest minor.
2023-12-15 18:32:14 +00:00
Trek Glowacki
d4cf2b9ae6 [static-build] Update astro-v3 to fixture to latest (#10952)
Update astro-v3 to fixture to latest
2023-12-15 18:07:55 +00:00
Trek Glowacki
7695316cd4 [examples] Update sveltekit1 fixture to latest 1.x (#10948)
Update sveltekit1 fixture to latest 1.x
2023-12-15 16:22:00 +00:00
Trek Glowacki
7ecb146fdb [examples] Update ionic-react to latest (#10949)
Update ionic-react example to latest minor of its current major.
2023-12-15 09:02:18 +00:00
Trek Glowacki
ec3d6ad640 [static-build] Update storybook-v7 fixture to latest (#10951)
Update storybook-v7 fixture to latest
2023-12-15 08:38:45 +00:00
Nathan Rajlich
5d521af586 [cli] Fix vc bisect selecting too many deployments (#10956) 2023-12-15 00:17:29 -08:00
Nathan Rajlich
652a312753 [gatsby-plugin-vercel-builder] Add support for "rewrites" (#10954) 2023-12-14 17:08:07 -08:00
Trek Glowacki
bd516c505b [static-build] Update test fixture stencil-v4 to latest (#10950)
Update test fixture stencil-v4 to latest
2023-12-14 17:18:43 +00:00
Felix Haus
4d63d9e954 [build-utils] Add getPathForPackageManager (#10918)
To use this outside of CLI we want a way to suppress the `console.log`s in `getEnvForPackageManager`.
For achieving this, we introduce a new helper `getPathForPackageManager()` which contains the core logic.

Best to review commit by commit + hide whitespace.

**X-Ref**
- [Internal Context](https://vercel.slack.com/archives/C03F2CMNGKG/p1701970097725689)
2023-12-14 15:17:20 +00:00
Vercel Release Bot
6a9002f229 [remix] Update @remix-run/dev to v2.4.0 (#10943)
This auto-generated PR updates `@remix-run/dev` to version 2.4.0.
2023-12-14 04:05:10 +00:00
Vercel Release Bot
2829d541b8 Version Packages (#10939) 2023-12-13 07:46:11 -07:00
Ethan Arrowood
6880dcb3c3 [cli] Use new deprecated query param in projects api for vc project ls --deprecated (#10938)
Uses the new `deprecated` query param for the GET /projects API instead of client-side filtering.

This enables a better UX so that results are properly paginated. 

Here are some example runs:

Pagination works as expected:
<img width="831" alt="Screenshot 2023-12-12 at 20 59 57" src="https://github.com/vercel/vercel/assets/16144158/c592752d-bf49-41a0-8dae-8b8e233052f8">

Usage without the flag results in different output (as expected!)
<img width="830" alt="Screenshot 2023-12-12 at 21 04 52" src="https://github.com/vercel/vercel/assets/16144158/c65461e0-b4a0-4725-aaae-a63739e6c8e9">
2023-12-13 07:22:10 +00:00
Trek Glowacki
832ba4b69a [tests] Add "Summary" Step to release workflow (#10936) 2023-12-12 15:08:12 -06:00
Vercel Release Bot
9a250d528c Version Packages (#10935)
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.7.1

### Patch Changes

- [cli] double page limit for vc project ls --deprecated
([#10932](https://github.com/vercel/vercel/pull/10932))

- Updated dependencies
\[[`d09dd1794`](d09dd1794b)]:
    -   @vercel/remix-builder@2.0.14

## @vercel/remix-builder@2.0.14

### Patch Changes

- Reinstall dependencies during `prepareCache()`
([#10922](https://github.com/vercel/vercel/pull/10922))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-12 10:31:23 -07:00
Vercel Release Bot
382ff2f526 [tests] Update Gatsby fixture versions (#10931)
Automatically generated PR to update Gatsby fixture versions in
`@vercel/static-build`

---------

Co-authored-by: Ethan Arrowood <ethan.arrowood@vercel.com>
2023-12-12 09:52:07 -07:00
Ethan Arrowood
f80a59c73f [cli] double page limit for vc project ls --deprecated (#10932)
As titled. Increases api page size for `vc project ls` when
`--deprecated` is used.

This is a temporary workaround since we do the filtering "client-side".
We will eventually update the API itself to support this and then we can
remove the client-based filter and reduce the page limit back to the
ideal `20`.

---------

Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-12-12 08:27:25 -07:00
Nathan Rajlich
d09dd1794b [remix] Reinstall dependencies during prepareCache() (#10922)
https://github.com/vercel/vercel/pull/10819 introduced a bug causing the `prepareCache()` function to fail (due to `@remix-run/dev` no longer being require-able). Even if it were not failing, the deps installed are not a valid representation of the user's `package.json` / lockfile. So to have more truthful cache contents, run `npm install` once again during `prepareCache()` to fix both issues at the same time.
2023-12-12 00:41:51 +00:00
Zack Tanner
ab34a26205 [tests] fix brittle next rewrite probe test (#10934)
It seems the intention of this test was to verify that the rewritten
file matches the original file, but it does so by just asserting on
arbitrary script text, which is brittle and broke as a result of
https://github.com/vercel/next.js/pull/56294

The right way to test this would be to fetch the original script and
compare the contents with the rewritten script, but this relies on
`__NEXT_SCRIPT__` magic which is only available in probe checks. For now
this just asserts on a valid status code, as a chunk that isn't properly
rewritten should 404 in this case.
2023-12-11 16:24:43 -08:00
Vercel Release Bot
7582571d94 Version Packages (#10913)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-11 10:39:34 -06:00
John Pham
e6aaf79d04 Update Next.js screenshot preview (#10921)
This new screenshot matches the template. It removes the version number
so this screenshot will not go stale.
2023-12-08 11:25:42 -08:00
Ethan Arrowood
a1df25a197 [cli] Clean up project ls --deprecate (#10926)
Follow up to #10919

Removes console.log statements and changes log into warning.
2023-12-08 17:55:24 +00:00
Ethan Arrowood
dfe47f6e6c [cli] add --deprecated option to vc project ls command (#10919)
Adds a `--deprecated` option to the `vc project ls` command that will only show projects currently running on a soon-to-be-deprecated Node.js version.

It also adds additional output providing more information to the user about what versions and a link to our documentation so they can learn more.

Example:

<img width="836" alt="Screenshot 2023-12-07 at 15 01 22" src="https://github.com/vercel/vercel/assets/16144158/3b7f7b13-802e-4af1-a76e-a158a477beb4">
2023-12-08 17:09:18 +00:00
Vercel Release Bot
3a58431695 [examples][tests] Upgrade Next.js to version 14.0.4 (#10923)
This auto-generated PR updates 7 packages to Next.js version 14.0.4
2023-12-08 11:17:39 +01:00
Vercel Release Bot
204c3592c7 [remix] Update @remix-run/dev to v2.3.1 (#10908)
This auto-generated PR updates `@remix-run/dev` to version 2.3.1.
2023-12-07 01:29:54 +00:00
Nathan Rajlich
3cede43ca7 [ruby] Remove VERCEL_ALLOW_RUBY32 env var check (#10910) 2023-12-07 01:28:17 +00:00
Nathan Rajlich
1dbb22bb6d [ruby] Use Ruby 3.2 in test fixtures (#10909) 2023-12-07 00:57:10 +00:00
Matt Straka
f124779b35 Update README.md (#10898) 2023-12-02 14:23:03 -05:00
Vercel Release Bot
371c7a08f2 Version Packages (#10896) 2023-12-01 11:43:49 -08:00
Ethan Arrowood
447c20fb99 Add GitHub Runner Image Version to turbo-cache-key.json (#10887)
Add GitHub Runner Image Version to turbo-cache-key.json
2023-12-01 19:39:07 +00:00
Nathan Rajlich
0fe8c07194 [cli] Revert "forbids globally installed @vercel/speed-insights and @vercel/analytics (#10848)" (#10895)
This reverts commit 6afdd7fb0b.
2023-12-01 19:35:04 +00:00
Vercel Release Bot
78d1d548d9 Version Packages (#10865) 2023-11-30 11:01:27 -08:00
Trek Glowacki
c41ff450c0 [cli] Fix behavior for combination of northstar user + team scope provided to cli as an argument. (#10884)
Fixes a neat little bug with the intersection of northstar users, teams, and the behavior of `Array#find_index`:

When selecting an org for various cli actions _non_ northstar users will see a select list with their user in the 0th position, and their teams in the 1..nth positions, like so:

```
// user: Logan
// teams: [Avengers, X-Men]
○ Logan
○ Avengers
○ X-Men
``` 

We'd like to preselect either a team referenced in `client.config.currentTeam` or if said team cannot be found in the collection of a user's teams, preselect the user. So if `X-Men` is `currentTeam`, we find that item (element `1` in the teams array) and increment that value by `1` to account for the user being element `0` in the list of choices:

```
// currentTeam: X-Men
// user: Logan
// teams: [Avengers, X-Men]
○ Logan
○ Avengers
● X-Men
``` 

If we _can't_ find the `currentTeam` in the list of teams (or one isn't provided), `Array#find_index` returns `-1`, which we increment to by `1` to get the 0th element in the list of choices:

```
// currentTeam: undefined
// user: Logan
// teams: [Avengers, X-Men]
● Logan
○ Avengers
○ X-Men
``` 

Neat trick!

However, Northstar users _don't_ use the user account as the 0th element in the list of choices. Northstar users will in fact have a team that represents a hidden default team with the same name as their `user.name` and this will be the 0th element in their teams:

```
// user: Logan
// teams: [Logan, Avengers, X-Men]
○ Logan
○ Avengers
○ X-Men
``` 

This of course means the trick of `+1` to index of the team selects the wrong item _and_ can result in `undefined` in cases where the `currentTeam` references the last team.

```
// currentTeam: X-Men
// user: Logan
// teams: [Logan, Avengers, X-Men]
○ Logan
○ Avengers
○ X-Men
``` 

● how'd we get out here?!?! 👀 

To address the issue this PR:
1. calls `findIndex` on the array of _choices_ checking for matches to `currentTeam`
2. wraps that in `Math.max` to set to `0` if `find_index` returns `-1` when a `currentTeam` can't be found.
2023-11-29 14:15:17 +00:00
Chris Barber
ca2cbf06fb [remix] Resolve static dir using non-parent publicPath segments (#10685) 2023-11-28 17:22:36 -06:00
Trek Glowacki
2d86a2d4ba [tests] tidy and make select-org tests more realistic (#10882)
Tracking down a bug with "northstar" users and have a little prefactor that 

a) isolates setup code so it's less repeated
b) makes the "northstar" tests more reflective of actual execution.

Northstar users will always have a `currentTeam` value on their `client.config`:

aa0f3d712b/packages/cli/src/util/get-scope.ts (L18-L20)

And finally c) add tests for the case of a non-northstar users where a team scope is supplied.

The final hypothetical matching group (northstart users with team scope provided) is the bug that I'll fix with a refactor.
2023-11-28 23:21:32 +00:00
Nathan Rajlich
4edfcd74b6 [remix] Fix issue where npm install was not properly injecting forked compiler (#10819)
User reported a scenario in which npm was ignoring the second `npm install` command to replace the Remix compiler with our forked version. This seems like a bug in npm. Workaround that seems to work is to remove `@remix-run/dev` entirely and install our forked version as a "standard" dependency (instead of using the `npm:` syntax). The `bin` entry for `remix` should at that point be our forked compiler.
2023-11-28 22:41:39 +00:00
Nathan Rajlich
c52bdf7758 [go] Set Lambda runtime to "provided.al2" behind env var (#10880)
This is a re-land of https://github.com/vercel/vercel/pull/10856, but with the addition of the env var check so that we can feature flag this change.
2023-11-28 22:38:37 +00:00
Nathan Rajlich
bc5ac1ec50 [static-build] Add yarn.lock and force jsdom@22 to fix "umi-v2" test fixture (#10881)
`jsdom@23` does not work with Node 16, but UmiJS v2 does not work with Node 18. So use the lower common denominator and force a older version of jsdom that still works with 16.x.
2023-11-28 18:49:02 +00:00
Lee Robinson
aa0f3d712b chore: update Nuxt example (#10869)
This updates the default Nuxt example to start with a static route, plus
updates dependencies with the latest version.

Demo: https://nuxt-vercel-inky.vercel.app/

---------

Co-authored-by: Trek Glowacki <trek.glowacki@vercel.com>
2023-11-27 19:40:30 -06:00
Csaba Palfi
e02212ae80 Fix changeset lint for forks (#10737) 2023-11-27 16:38:02 -08:00
Lee Robinson
a8934da623 Update placeholder for Nuxt to be correct command. (#10873)
Co-authored-by: Trek Glowacki <trek.glowacki@vercel.com>
2023-11-27 10:54:49 -06:00
Vercel Release Bot
0e9bb30fd2 [tests] Update Gatsby fixture versions (#10875)
Automatically generated PR to update Gatsby fixture versions in `@vercel/static-build`
2023-11-27 14:56:18 +00:00
Damien Simonin Feugas
6afdd7fb0b [cli] forbids globally installed @vercel/speed-insights and @vercel/analytics (#10848) 2023-11-22 09:29:40 +01:00
Vercel Release Bot
fdef0339f2 Version Packages (#10861) 2023-11-21 13:59:05 -08:00
Nathan Rajlich
4636ae54c6 [ruby] Enable ruby3.2 runtime (#10859)
Allows for Ruby 3.2 Serverless Functions to be created.

**Note:** New test fixtures will be added after this is deployed to production.
2023-11-21 21:57:23 +00:00
Nathan Rajlich
61a23f1382 Revert "[go] Set Lambda runtime to provided.al2" (#10864)
This reverts commit 4b8b4992c4.

We'll re-land this after Thanksgiving.
2023-11-21 21:13:24 +00:00
Nathan Rajlich
4b8b4992c4 [go] Set Lambda runtime to "provided.al2" (#10856)
Migrate from the deprecated `go1.x` runtime to the `provided.al2` runtime, [as suggested by AWS in their migration guide](https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/).
2023-11-21 19:29:53 +00:00
Zack Tanner
611fbdd5ac Revert "[cli][tests] Work around Yarn + Corepack issue in tests" (#10860) 2023-11-21 10:21:56 -06:00
Zack Tanner
ffd2f34c6c [next] ensure function configs apply to route groups (#10855)
`getSourceFilePathFromPage` attempts to match patterns found in `vercel.json` with source files. However, the `page` argument to this function is stripped of route groups, so these files are erroneously skipped and function settings are not applied. 

For app-dir routes which might contain route groups, this checks an internal mapping which maps the "normalized" paths (e.g. `app/dashboard/[slug]/page.js`) to the file-system path (e.g. `app/dashboard/[slug]/(group)/page.js`)
2023-11-21 00:44:46 +00:00
Nathan Rajlich
8feaa9c3b3 [cli][tests] Work around Yarn + Corepack issue in tests (#10858)
CI started failing on corepack related tests with error:

```
error This project's package.json defines "packageManager": "yarn@npm@8.1.0". However the current global version of Yarn is 1.22.21.
```

This appears to be a bug in the Yarn v1.22.21, which was released a week ago: https://github.com/yarnpkg/yarn/releases/tag/v1.22.21

Setting the `SKIP_YARN_COREPACK_CHECK` env var disables this new check which fixes the issue for us.

**NOTE:** Review with [whitespace changes disabled](https://github.com/vercel/vercel/pull/10858/files?w=1) for an easier view.
2023-11-20 21:47:39 +00:00
Vercel Release Bot
31daff66af [examples][tests] Upgrade Next.js to version 14.0.3 (#10847) 2023-11-19 10:54:04 -08:00
Simon H
48c6b2dcc3 [docs] mention nodejs20.x in LambdaRuntime (#10849)
The error message when trying to deploy with an invalid runtime value
leads you there, where `nodejs20.x` is missing currently
2023-11-18 22:43:16 -06:00
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
Nathan Rajlich
88da7463ce [build-utils] Remove Node v20 env var check (#10834)
It's safe to remove this env var check, because #10822 makes it explicit on which versions of Node are actually present in the build environment.
2023-11-15 22:04:36 +00:00
Ethan Arrowood
142aa55a5d Add .node-version file (#10820)
This a small QOL change. Essentially if you have a tool like `fnm` on your machine for using multiple versions of Node.js, they will look for files like this one and automatically switch your terminal session node version to the value in it. 

The `vercel/front` repo uses this too
2023-11-15 20:12:05 +00: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
Nathan Rajlich
65dec5b7e7 [build-utils] Select Node.js version based on what's available in build-container (#10822)
Makes `getLatestNodeVersion()` and `getSupportedNodeVersion()` (and thus by extension - `getNodeVersion()`) be aware of the available Node.js versions when running inside the build-container. This is to address the situation with the new AL2023 build-container image which has different Node versions installed compared to the existing AL2 build image.

### Project Settings `20.x` with package.json `"engines": "18.x"`

If the Project Settings Node Version is set to `20.x`, but the package.json has `"engines": "18.x"`, then the build will fail like so, because Node 18 is not present on the AL2023 build image:

<img width="1044" alt="Screenshot 2023-11-09 at 1 25 41 PM" src="https://github.com/vercel/vercel/assets/71256/572c544b-6574-4eb1-98f7-787075a60000">

### Project Settings `18.x` with package.json `"engines": "20.x"`

If the Project Settings Node Version is set to `18.x`, but the package.json has `"engines": "20.x"`, then the build will fail like so, because Node 20 is not present on the AL2 build image:

<img width="1042" alt="Screenshot 2023-11-09 at 1 34 43 PM" src="https://github.com/vercel/vercel/assets/71256/c6a2d955-9453-4ef5-a99d-b49a6d9af766">

### Project Settings `18.x` with no package.json `"engines"`

If Project Settings Node Version is set to `18.x`, but the package.json has no "engines" (and thus wants "latest"), then the latest available Node version in the build-container, which would be Node 18.
2023-11-14 23:08:27 +00:00
Brooks Lybrand
f3b62d8ea2 chore: Update Remix example README (#10830)
Not sure the best spot to put this command in the Readme, but I thought having a `create-remix` command might be useful for people trying to get going.

If there's a more preferred way to scaffold this project on your machine, I'm open to that, just using what I know
2023-11-13 20:10:57 +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
Ethan Arrowood
89c1e03233 [node] swap undici.fetch for undici.request in serverless-handler.mts (#10767)
In a recent undici update, setting the `host` header for fetch requests became invalid (https://github.com/nodejs/undici/pull/2322). 

We relied on this in order to proxy serverless dev server requests via `@vercel/node`. 

This PR replaces the usage of `undici.fetch` with `undici.request`. 

It is blocked by an `undici` type change: https://github.com/nodejs/undici/pull/2373
2023-11-08 17:31:03 +00:00
Zach Ward
ebd7e3ac39 Project limits error handling (#10807)
This PR adds improved error handling for the 200 project limit error
that will start being returned for free tier teams/accounts. The
following changes have been made:
- improve error message format by using `client.output.prettyError` so
that the docs link
(https://vercel.com/docs/limits/overview#general-limits) returned with
the error response is included with the error message
- add explicit error handling of this error from any places where
`createProject` is called, which includes the following commands:
  - `vc project add`
  - `vc link` (indirectly called via `ensureLink`)
  - `vc list` (indirectly called via `ensureLink`)
  - `vc git connect` (indirectly called via `ensureLink`)

### Testing
- sign in to a vercel account that is associated with your work email
(ends in `@vercel.com`), this is necessary for creating a team with the
proper conditions to artificially trigger the error message
- create a Pro Trial team and make sure to prefix the name with:
`vtest314 too many projects `, for example `vtest314 too many projects
test 1`
- check out this branch and cd to `vercel/vercel/packages/cli`
- run: `pnpm dev add [project-name] --cwd=/path/to/some/project`
- the project should fail to be created and you should see the expected
error message (screenshot below) in the terminal output

**Screenshot of error message when attempting to add project from cli**
<img width="798" alt="image"
src="https://github.com/vercel/vercel/assets/14896430/43e6ac2c-ae1c-4367-8d57-0aeb7fbddf33">

---------

Co-authored-by: Nathan Rajlich <n@n8.io>
2023-11-08 11:48:12 -05: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
255 changed files with 76906 additions and 35324 deletions

16
.github/CODEOWNERS vendored
View File

@@ -2,17 +2,17 @@
# https://help.github.com/en/articles/about-code-owners
# Restricted Paths
* @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek
/.github/workflows @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek @ijjk
/packages/fs-detectors @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek @agadzik @chloetedder
/packages/next @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek @ijjk @ztanner
/packages/routing-utils @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek @ijjk
/packages/static-build @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek
/packages/edge @vercel/compute @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek
* @TooTallNate @EndangeredMassa @trek
/.github/workflows @TooTallNate @EndangeredMassa @trek @ijjk
/packages/fs-detectors @TooTallNate @EndangeredMassa @trek @agadzik @chloetedder
/packages/next @TooTallNate @EndangeredMassa @Ethan-Arrowood @trek @ijjk @ztanner
/packages/routing-utils @TooTallNate @EndangeredMassa @trek @ijjk
/packages/static-build @TooTallNate @EndangeredMassa @trek
/packages/edge @vercel/compute @TooTallNate @EndangeredMassa @trek
/examples @leerob
/examples/create-react-app @Timer
/examples/nextjs @timneutkens @ijjk @ztanner @huozhi
/packages/node @TooTallNate @EndangeredMassa @cb1kenobi @Ethan-Arrowood @trek @Kikobeats
/packages/node @TooTallNate @EndangeredMassa @trek @Kikobeats
# Unrestricted Paths
.changeset/

View File

@@ -1,8 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Bug Report
url: https://vercel.com/support/request
about: Report a bug using the Vercel support form
url: https://vercel.com/help
about: Reach out to our support team
- name: Feature Request
url: https://github.com/orgs/vercel/discussions/new?category=ideas
about: Share ideas for new features

View File

@@ -76,3 +76,12 @@ jobs:
script: |
const script = require('./utils/update-latest-release.js')
await script({ github, context })
summary:
name: Summary
runs-on: ubuntu-latest
timeout-minutes: 5
needs:
- release
steps:
- name: Check All
run: echo OK

View File

@@ -28,7 +28,8 @@ jobs:
with:
fetch-depth: 0
ref: main
- run: git checkout ${{ github.event.pull_request.head.ref }}
- run: git fetch origin ${{ github.event.pull_request.head.sha }}:pr-${{ github.event.pull_request.number }}
- run: git checkout pr-${{ github.event.pull_request.number }}
- name: install pnpm@8.3.1
run: npm i -g pnpm@8.3.1
- run: pnpm install

View File

@@ -70,6 +70,11 @@ jobs:
if: matrix.runner == 'macos-latest'
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
# yarn 1.22.21 introduced a Corepack bug when running tests.
# this can be removed once https://github.com/yarnpkg/yarn/issues/9015 is resolved
- name: install yarn@1.22.19
run: npm i -g yarn@1.22.19
- name: install pnpm@8.3.1
run: npm i -g pnpm@8.3.1

1
.node_version Normal file
View File

@@ -0,0 +1 @@
v16.20.2

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
16.20.2

View File

@@ -385,15 +385,16 @@ This is a [class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
This is an abstract enumeration type that is implemented by one of the following possible `String` values:
- `nodejs20.x`
- `nodejs18.x`
- `nodejs16.x`
- `go1.x`
- `java11`
- `python3.9`
- `dotnet6`
- `dotnetcore3.1`
- `ruby2.7`
- `provided.al2`
- `provided.al2023`
## `@vercel/build-utils` Helper Functions

View File

@@ -19,7 +19,7 @@
## Vercel
Vercel's frontend cloud gives developers frameworks, workflows, and infrastructure to build a faster, more personalized web.
Vercels Frontend Cloud provides the developer experience and infrastructure to build, scale, and secure a faster, more personalized Web.
## Deploy

View File

@@ -4,4 +4,10 @@
### Patch Changes
- chore: update Nuxt example ([#10869](https://github.com/vercel/vercel/pull/10869))
## null
### Patch Changes
- update examples to use at least node@16 ([#10395](https://github.com/vercel/vercel/pull/10395))

View File

@@ -23,7 +23,7 @@
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"typescript": "3.8.3"
"typescript": "4.9.5"
},
"scripts": {
"start": "react-scripts start",

File diff suppressed because it is too large Load Diff

View File

@@ -25,3 +25,9 @@ body {
)
rgb(var(--background-start-rgb));
}
@layer utilities {
.text-balance {
text-wrap: balance;
}
}

View File

@@ -1,22 +1,22 @@
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import './globals.css'
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
const inter = Inter({ subsets: ['latin'] })
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
)
);
}

View File

@@ -1,4 +1,4 @@
import Image from 'next/image'
import Image from "next/image";
export default function Home() {
return (
@@ -15,7 +15,7 @@ export default function Home() {
target="_blank"
rel="noopener noreferrer"
>
By{' '}
By{" "}
<Image
src="/vercel.svg"
alt="Vercel Logo"
@@ -28,7 +28,7 @@ export default function Home() {
</div>
</div>
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-full sm:before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full sm:after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
@@ -47,7 +47,7 @@ export default function Home() {
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Docs{' '}
Docs{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
@@ -64,7 +64,7 @@ export default function Home() {
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Learn{' '}
Learn{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
@@ -81,13 +81,13 @@ export default function Home() {
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Templates{' '}
Templates{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
Explore the Next.js 13 playground.
Explore starter templates for Next.js.
</p>
</a>
@@ -98,16 +98,16 @@ export default function Home() {
rel="noopener noreferrer"
>
<h2 className={`mb-3 text-2xl font-semibold`}>
Deploy{' '}
Deploy{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
<p className={`m-0 max-w-[30ch] text-sm opacity-50 text-balance`}>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
)
);
}

View File

@@ -1,4 +0,0 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig

View File

@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
export default nextConfig;

File diff suppressed because it is too large Load Diff

View File

@@ -11,17 +11,17 @@
"dependencies": {
"react": "^18",
"react-dom": "^18",
"next": "14.0.0"
"next": "14.1.0"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10",
"autoprefixer": "^10.0.1",
"postcss": "^8",
"tailwindcss": "^3",
"tailwindcss": "^3.3.0",
"eslint": "^8",
"eslint-config-next": "14.0.0"
"eslint-config-next": "14.1.0"
}
}

View File

@@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};

View File

@@ -1,20 +1,20 @@
import type { Config } from 'tailwindcss'
import type { Config } from "tailwindcss";
const config: Config = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
plugins: [],
}
export default config
};
export default config;

View File

@@ -1,6 +1,5 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,

View File

@@ -2,4 +2,4 @@
<div>
<NuxtWelcome />
</div>
</template>
</template>

View File

@@ -1,5 +1,8 @@
export default {
nitro: {
preset: 'vercel-edge',
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
routeRules: {
// prerender index route by default
'/': { prerender: true },
},
};
});

View File

@@ -1,5 +1,6 @@
{
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
@@ -8,6 +9,9 @@
"postinstall": "nuxt prepare"
},
"devDependencies": {
"nuxt": "^3.0.0"
"@nuxt/devtools": "^1.0.3",
"nuxt": "^3.8.2",
"vue": "^3.3.8",
"vue-router": "^4.2.5"
}
}

6100
examples/nuxtjs/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}

View File

@@ -1,4 +1,4 @@
{
// https://v3.nuxtjs.org/concepts/typescript
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
},
"devDependencies": {
"@types/jest": "27.4.1",
"@vercel/frameworks": "2.0.3"
"@vercel/frameworks": "2.0.6"
},
"version": null
}

View File

@@ -2,6 +2,12 @@
This directory is a brief example of a [Remix](https://remix.run/docs) site that can be deployed to Vercel with zero configuration.
To get started, run the Remix cli with this template
```sh
npx create-remix@latest --template vercel/vercel/examples/remix
```
## Deploy Your Own
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/vercel/tree/main/examples/remix&template=remix)

View File

@@ -15,21 +15,21 @@
"devDependencies": {
"@fontsource/fira-mono": "^4.5.10",
"@neoconfetti/svelte": "^1.0.0",
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-vercel": "^3.0.0",
"@sveltejs/kit": "^1.5.0",
"@types/cookie": "^0.5.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.26.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"typescript": "^5.0.0",
"vite": "^4.3.0",
"vitest": "^0.25.3",
"web-vitals": "^3.3.1"
"@playwright/test": "^1.40.1",
"@sveltejs/adapter-vercel": "^3.1.0",
"@sveltejs/kit": "^1.30.3",
"@types/cookie": "^0.5.4",
"eslint": "^8.55.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-svelte": "^2.35.1",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^3.59.2",
"svelte-check": "^3.6.2",
"typescript": "^5.3.3",
"vite": "^4.5.1",
"vitest": "^0.25.8",
"web-vitals": "^3.5.0"
},
"type": "module"
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,54 @@
# @vercel-internals/types
## 1.0.21
### Patch Changes
- Updated dependencies [[`cdddb33ad`](https://github.com/vercel/vercel/commit/cdddb33ad49f6080c49f4fff3767e6111acd0bbe)]:
- @vercel/build-utils@7.5.1
## 1.0.20
### Patch Changes
- Updated dependencies [[`98040ec24`](https://github.com/vercel/vercel/commit/98040ec24e1ee585865d11eb216b6525d39d209e)]:
- @vercel/build-utils@7.5.0
## 1.0.19
### Patch Changes
- Updated dependencies [[`67fa2f3dd`](https://github.com/vercel/vercel/commit/67fa2f3dd6a6d5a3504b7f9081e56deff7b36eab)]:
- @vercel/build-utils@7.4.1
## 1.0.18
### Patch Changes
- Updated dependencies [[`4d63d9e95`](https://github.com/vercel/vercel/commit/4d63d9e954549d811063d259250d1865b7de2ba1)]:
- @vercel/build-utils@7.4.0
## 1.0.17
### Patch Changes
- Updated dependencies [[`dfe47f6e6`](https://github.com/vercel/vercel/commit/dfe47f6e6c1d395ae24d802f4b7c98e39b9f90f4)]:
- @vercel/build-utils@7.3.0
## 1.0.16
### Patch Changes
- Updated dependencies [[`88da7463c`](https://github.com/vercel/vercel/commit/88da7463ce12df91d49fbde85cb617030d55f558)]:
- @vercel/build-utils@7.2.5
## 1.0.15
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 1.0.14
### Patch Changes

View File

@@ -428,7 +428,8 @@ export type ProjectLinkedError = {
| 'TEAM_DELETED'
| 'PATH_IS_FILE'
| 'INVALID_ROOT_DIRECTORY'
| 'MISSING_PROJECT_SETTINGS';
| 'MISSING_PROJECT_SETTINGS'
| 'TOO_MANY_PROJECTS';
};
export type ProjectLinkResult =

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@vercel-internals/types",
"version": "1.0.14",
"version": "1.0.21",
"types": "index.d.ts",
"main": "index.d.ts",
"files": [
@@ -10,7 +10,7 @@
"dependencies": {
"@types/node": "14.14.31",
"@vercel-internals/constants": "1.0.4",
"@vercel/build-utils": "7.2.3",
"@vercel/build-utils": "7.5.1",
"@vercel/routing-utils": "3.1.0"
},
"devDependencies": {

View File

@@ -17,7 +17,7 @@
"create-svelte": "2.0.1",
"dot": "1.1.3",
"esbuild": "0.19.2",
"eslint": "8.14.0",
"eslint": "8.24.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.1.5",
"execa": "3.2.0",
@@ -29,11 +29,11 @@
"lint-staged": "9.2.5",
"node-fetch": "2.6.7",
"npm-package-arg": "6.1.0",
"prettier": "2.6.2",
"prettier": "2.7.0",
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "29.1.0",
"turbo": "1.10.16",
"turbo": "1.11.3",
"typescript": "4.9.5"
},
"scripts": {

View File

@@ -1,5 +1,47 @@
# @vercel/build-utils
## 7.5.1
### Patch Changes
- Add experimental field to Lambda and size to FileFsRef output ([#11059](https://github.com/vercel/vercel/pull/11059))
## 7.5.0
### Minor Changes
- Deprecate `EdgeFunction#name` property ([#11010](https://github.com/vercel/vercel/pull/11010))
## 7.4.1
### Patch Changes
- Extend Node v16 discontinue date to 2024-06-15 ([#10967](https://github.com/vercel/vercel/pull/10967))
## 7.4.0
### Minor Changes
- Adds new helper `getPathForPackageManager()` ([#10918](https://github.com/vercel/vercel/pull/10918))
## 7.3.0
### Minor Changes
- [cli] add `--deprecated` option to `vc project ls` command ([#10919](https://github.com/vercel/vercel/pull/10919))
## 7.2.5
### Patch Changes
- Remove Node.js v20 env var check ([#10834](https://github.com/vercel/vercel/pull/10834))
## 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))
## 7.2.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "7.2.3",
"version": "7.5.1",
"license": "Apache-2.0",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -8,12 +8,13 @@ export class EdgeFunction {
/**
* A display name for the edge function.
* @deprecated This property should no longer be used. The name is inferred from the URL path of the function.
*/
name: string;
name?: string;
/**
* The deployment target.
* Only v8-worker is currently supported.
* Only `v8-worker` is currently supported.
*/
deploymentTarget: 'v8-worker';

View File

@@ -11,6 +11,7 @@ interface FileFsRefOptions {
mode?: number;
contentType?: string;
fsPath: string;
size?: number;
}
interface FromStreamOptions {
@@ -24,28 +25,38 @@ class FileFsRef implements FileBase {
public type: 'FileFsRef';
public mode: number;
public fsPath: string;
public size?: number;
public contentType: string | undefined;
constructor({ mode = 0o100644, contentType, fsPath }: FileFsRefOptions) {
constructor({
mode = 0o100644,
contentType,
fsPath,
size,
}: FileFsRefOptions) {
assert(typeof mode === 'number');
assert(typeof fsPath === 'string');
this.type = 'FileFsRef';
this.mode = mode;
this.contentType = contentType;
this.fsPath = fsPath;
this.size = size;
}
static async fromFsPath({
mode,
contentType,
fsPath,
size,
}: FileFsRefOptions): Promise<FileFsRef> {
let m = mode;
if (!m) {
let s = size;
if (!m || typeof s === 'undefined') {
const stat = await fs.lstat(fsPath);
m = stat.mode;
s = stat.size;
}
return new FileFsRef({ mode: m, contentType, fsPath });
return new FileFsRef({ mode: m, contentType, fsPath, size: s });
}
static async fromStream({
@@ -69,7 +80,7 @@ class FileFsRef implements FileBase {
dest.on('error', reject);
});
return new FileFsRef({ mode, contentType, fsPath });
return FileFsRef.fromFsPath({ mode, contentType, fsPath });
}
async toStreamAsync(): Promise<NodeJS.ReadableStream> {

View File

@@ -1,60 +1,88 @@
import { statSync } from 'fs';
import { intersects, validRange } from 'semver';
import { NodeVersion } from '../types';
import { NowBuildError } from '../errors';
import debug from '../debug';
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
export const NODE_VERSIONS: NodeVersion[] = [
{ major: 20, range: '20.x', runtime: 'nodejs20.x' },
{ major: 18, range: '18.x', runtime: 'nodejs18.x' },
{
major: 16,
range: '16.x',
runtime: 'nodejs16.x',
discontinueDate: new Date('2024-06-15'),
},
{
major: 14,
range: '14.x',
runtime: 'nodejs14.x',
discontinueDate: new Date('2023-08-15'),
},
{
major: 12,
range: '12.x',
runtime: 'nodejs12.x',
discontinueDate: new Date('2022-10-03'),
},
{
major: 10,
range: '10.x',
runtime: 'nodejs10.x',
discontinueDate: new Date('2021-04-20'),
},
{
major: 8,
range: '8.10.x',
runtime: 'nodejs8.10',
discontinueDate: new Date('2020-01-06'),
},
];
function getOptions() {
const options = [
{ major: 18, range: '18.x', runtime: 'nodejs18.x' },
{
major: 16,
range: '16.x',
runtime: 'nodejs16.x',
discontinueDate: new Date('2024-02-06'),
},
{
major: 14,
range: '14.x',
runtime: 'nodejs14.x',
discontinueDate: new Date('2023-08-15'),
},
{
major: 12,
range: '12.x',
runtime: 'nodejs12.x',
discontinueDate: new Date('2022-10-03'),
},
{
major: 10,
range: '10.x',
runtime: 'nodejs10.x',
discontinueDate: new Date('2021-04-20'),
},
{
major: 8,
range: '8.10.x',
runtime: 'nodejs8.10',
discontinueDate: new Date('2020-01-06'),
},
] as const;
if (process.env.VERCEL_ALLOW_NODEJS20 === '1') {
return [
{ major: 20, range: '20.x', runtime: 'nodejs20.x' },
...options,
] as const;
}
return options;
return NODE_VERSIONS;
}
function getHint(isAuto = false) {
const { major, range } = getLatestNodeVersion();
function isNodeVersionAvailable(version: NodeVersion): boolean {
try {
return statSync(`/node${version.major}`).isDirectory();
} catch {
// ENOENT, or any other error, we don't care about
}
return false;
}
export function getAvailableNodeVersions(): NodeVersionMajor[] {
return getOptions()
.filter(isNodeVersionAvailable)
.map(n => n.major);
}
function getHint(isAuto = false, availableVersions?: NodeVersionMajor[]) {
const { major, range } = getLatestNodeVersion(availableVersions);
return isAuto
? `Please set Node.js Version to ${range} in your Project Settings to use Node.js ${major}.`
: `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
}
export function getLatestNodeVersion() {
return getOptions()[0];
export function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]) {
const all = getOptions();
if (availableVersions) {
// Return the first node version that is definitely
// available in the build-container.
for (const version of all) {
for (const major of availableVersions) {
if (version.major === major) {
return version;
}
}
}
}
// As a fallback for local `vc build` and the tests,
// return the first node version if none is found.
return all[0];
}
export function getDiscontinuedNodeVersions(): NodeVersion[] {
@@ -63,9 +91,10 @@ export function getDiscontinuedNodeVersions(): NodeVersion[] {
export async function getSupportedNodeVersion(
engineRange: string | undefined,
isAuto = false
isAuto = false,
availableVersions?: NodeVersionMajor[]
): Promise<NodeVersion> {
let selection: NodeVersion = getLatestNodeVersion();
let selection: NodeVersion | undefined;
if (engineRange) {
const found =
@@ -74,19 +103,29 @@ export async function getSupportedNodeVersion(
// the array is already in order so return the first
// match which will be the newest version of node
selection = o;
return intersects(o.range, engineRange);
return (
intersects(o.range, engineRange) &&
(availableVersions?.length
? availableVersions.includes(o.major)
: true)
);
});
if (!found) {
throw new NowBuildError({
code: 'BUILD_UTILS_NODE_VERSION_INVALID',
link: 'http://vercel.link/node-version',
message: `Found invalid Node.js Version: "${engineRange}". ${getHint(
isAuto
isAuto,
availableVersions
)}`,
});
}
}
if (!selection) {
selection = getLatestNodeVersion(availableVersions);
}
if (isDiscontinued(selection)) {
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
throw new NowBuildError({

View File

@@ -9,7 +9,11 @@ import { deprecate } from 'util';
import debug from '../debug';
import { NowBuildError } from '../errors';
import { Meta, PackageJson, NodeVersion, Config } from '../types';
import { getSupportedNodeVersion, getLatestNodeVersion } from './node-version';
import {
getSupportedNodeVersion,
getLatestNodeVersion,
getAvailableNodeVersions,
} from './node-version';
import { readConfigFile } from './read-config-file';
import { cloneEnv } from '../clone-env';
@@ -238,9 +242,10 @@ export async function getNodeVersion(
destPath: string,
nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION,
config: Config = {},
meta: Meta = {}
meta: Meta = {},
availableVersions = getAvailableNodeVersions()
): Promise<NodeVersion> {
const latest = getLatestNodeVersion();
const latest = getLatestNodeVersion(availableVersions);
if (meta.isDev) {
// Use the system-installed version of `node` in PATH for `vercel dev`
return { ...latest, runtime: 'nodejs' };
@@ -266,7 +271,7 @@ export async function getNodeVersion(
nodeVersion = node;
isAuto = false;
}
return getSupportedNodeVersion(nodeVersion, isAuto);
return getSupportedNodeVersion(nodeVersion, isAuto, availableVersions);
}
export async function scanParentDirs(
@@ -511,6 +516,10 @@ export async function runNpmInstall(
}
}
/**
* Prepares the input environment based on the used package manager and lockfile
* versions.
*/
export function getEnvForPackageManager({
cliType,
lockfileVersion,
@@ -522,7 +531,90 @@ export function getEnvForPackageManager({
nodeVersion: NodeVersion | undefined;
env: { [x: string]: string | undefined };
}) {
const newEnv: { [x: string]: string | undefined } = { ...env };
const {
detectedLockfile,
detectedPackageManager,
path: newPath,
yarnNodeLinker,
} = getPathForPackageManager({
cliType,
lockfileVersion,
nodeVersion,
env,
});
const newEnv: { [x: string]: string | undefined } = {
...env,
};
if (newPath) {
// Ensure that the binaries of the detected package manager are at the
// beginning of the `$PATH`.
const oldPath = env.PATH + '';
newEnv.PATH = `${newPath}${path.delimiter}${oldPath}`;
}
if (yarnNodeLinker) {
newEnv.YARN_NODE_LINKER = yarnNodeLinker;
}
if (detectedLockfile && detectedPackageManager) {
// For pnpm we also show the version of the lockfile we found
const versionString =
cliType === 'pnpm' ? `version ${lockfileVersion} ` : '';
console.log(
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
);
if (cliType === 'bun') {
console.warn(
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions'
);
}
}
return newEnv;
}
/**
* Helper to get the binary paths that link to the used package manager.
* Note: Make sure it doesn't contain any `console.log` calls.
*/
export function getPathForPackageManager({
cliType,
lockfileVersion,
nodeVersion,
env,
}: {
cliType: CliType;
lockfileVersion: number | undefined;
nodeVersion: NodeVersion | undefined;
env: { [x: string]: string | undefined };
}): {
/**
* Which lockfile was detected.
*/
detectedLockfile: string | undefined;
/**
* Detected package manager that generated the found lockfile.
*/
detectedPackageManager: string | undefined;
/**
* Value of $PATH that includes the binaries for the detected package manager.
* Undefined if no $PATH are necessary.
*/
path: string | undefined;
/**
* Set if yarn was identified as package manager and `YARN_NODE_LINKER`
* environment variable was not found on the input environment.
*/
yarnNodeLinker: string | undefined;
} {
let detectedLockfile: string | undefined;
let detectedPackageManager: string | undefined;
let pathValue: string | undefined;
let yarnNodeLinker: string | undefined;
const oldPath = env.PATH + '';
const npm7 = '/node16/bin-npm7';
const pnpm7 = '/pnpm7/node_modules/.bin';
@@ -537,9 +629,10 @@ export function getEnvForPackageManager({
!oldPath.includes(npm7) &&
!corepackEnabled
) {
// Ensure that npm 7 is at the beginning of the `$PATH`
newEnv.PATH = `${npm7}${path.delimiter}${oldPath}`;
console.log('Detected `package-lock.json` generated by npm 7+');
// npm 7
pathValue = npm7;
detectedLockfile = 'package-lock.json';
detectedPackageManager = 'npm 7+';
}
} else if (cliType === 'pnpm') {
if (
@@ -548,39 +641,40 @@ export function getEnvForPackageManager({
!oldPath.includes(pnpm7) &&
!corepackEnabled
) {
// Ensure that pnpm 7 is at the beginning of the `$PATH`
newEnv.PATH = `${pnpm7}${path.delimiter}${oldPath}`;
console.log(
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7`
);
// pnpm 7
pathValue = pnpm7;
detectedLockfile = 'pnpm-lock.yaml';
detectedPackageManager = 'pnpm 7';
} else if (
typeof lockfileVersion === 'number' &&
lockfileVersion >= 6 &&
!oldPath.includes(pnpm8) &&
!corepackEnabled
) {
// Ensure that pnpm 8 is at the beginning of the `$PATH`
newEnv.PATH = `${pnpm8}${path.delimiter}${oldPath}`;
console.log(
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8`
);
// pnpm 8
pathValue = pnpm8;
detectedLockfile = 'pnpm-lock.yaml';
detectedPackageManager = 'pnpm 8';
}
} else if (cliType === 'bun') {
if (!oldPath.includes(bun1) && !corepackEnabled) {
// Ensure that Bun 1 is at the beginning of the `$PATH`
newEnv.PATH = `${bun1}${path.delimiter}${oldPath}`;
console.log('Detected `bun.lockb` generated by Bun');
console.warn(
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions'
);
// Bun 1
pathValue = bun1;
detectedLockfile = 'bun.lockb';
detectedPackageManager = 'Bun';
}
} else {
// Yarn v2 PnP mode may be activated, so force "node-modules" linker style
if (!env.YARN_NODE_LINKER) {
newEnv.YARN_NODE_LINKER = 'node-modules';
yarnNodeLinker = 'node-modules';
}
}
return newEnv;
return {
detectedLockfile,
detectedPackageManager,
path: pathValue,
yarnNodeLinker,
};
}
export async function runCustomInstallCommand({

View File

@@ -28,6 +28,7 @@ import {
runCustomInstallCommand,
getEnvForPackageManager,
getNodeVersion,
getPathForPackageManager,
getSpawnOptions,
getNodeBinPath,
getNodeBinPaths,
@@ -78,6 +79,7 @@ export {
runCustomInstallCommand,
getEnvForPackageManager,
getNodeVersion,
getPathForPackageManager,
getLatestNodeVersion,
getDiscontinuedNodeVersions,
getSpawnOptions,
@@ -104,3 +106,5 @@ export * from './should-serve';
export * from './schemas';
export * from './types';
export * from './errors';
export { NODE_VERSIONS } from './fs/node-version';

View File

@@ -37,6 +37,7 @@ export interface LambdaOptionsBase {
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
files: Files;
experimentalAllowBundling?: boolean;
}
/**
@@ -79,6 +80,7 @@ export class Lambda {
supportsWrapper?: boolean;
supportsResponseStreaming?: boolean;
framework?: FunctionFramework;
experimentalAllowBundling?: boolean;
constructor(opts: LambdaOptions) {
const {
@@ -114,6 +116,16 @@ export class Lambda {
);
}
if (
'experimentalAllowBundling' in opts &&
opts.experimentalAllowBundling !== undefined
) {
assert(
typeof opts.experimentalAllowBundling === 'boolean',
'"experimentalAllowBundling" is not a boolean'
);
}
if (memory !== undefined) {
assert(typeof memory === 'number', '"memory" is not a number');
}
@@ -183,6 +195,10 @@ export class Lambda {
this.supportsResponseStreaming =
supportsResponseStreaming ?? experimentalResponseStreaming;
this.framework = framework;
this.experimentalAllowBundling =
'experimentalAllowBundling' in opts
? opts.experimentalAllowBundling
: undefined;
}
async createZip(): Promise<Buffer> {

View File

@@ -196,6 +196,12 @@ export interface StartDevServerSuccess {
* shut down the dev server once an HTTP request has been fulfilled.
*/
pid: number;
/**
* An optional function to shut down the dev server. If not provided, the
* dev server will forcefully be killed.
*/
shutdown?: () => Promise<void>;
}
/**

View File

@@ -1,13 +1,34 @@
import assert from 'assert';
import { delimiter } from 'path';
import { getEnvForPackageManager } from '../src';
import { getEnvForPackageManager, getPathForPackageManager } from '../src';
describe('Test `getEnvForPackageManager()`', () => {
const cases: Array<{
let consoleLogSpy: jest.SpyInstance;
let consoleWarnSpy: jest.SpyInstance;
beforeEach(() => {
consoleLogSpy = jest.spyOn(console, 'log');
consoleWarnSpy = jest.spyOn(console, 'warn');
});
afterEach(() => {
jest.restoreAllMocks();
});
test.each<{
name: string;
args: Parameters<typeof getEnvForPackageManager>[0];
want: unknown;
}> = [
/**
* Expected output on `console.log`. Set to `null` when no output is
* expected.
*/
consoleLogOutput?: string | null;
/**
* Expected output on `console.warn`. Set to `null` when no output is
* expected.
*/
consoleWarnOutput?: string | null;
}>([
{
name: 'should do nothing to env for npm < 6 and node < 16',
args: {
@@ -21,6 +42,8 @@ describe('Test `getEnvForPackageManager()`', () => {
want: {
FOO: 'bar',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should set path if npm 7+ is detected and node < 16',
@@ -37,6 +60,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
PATH: `/node16/bin-npm7${delimiter}foo`,
},
consoleLogOutput: 'Detected `package-lock.json` generated by npm 7+',
consoleWarnOutput: null,
},
{
name: 'should not set npm path if corepack enabled',
@@ -53,6 +78,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
ENABLE_EXPERIMENTAL_COREPACK: '1',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should not prepend npm path again if already detected',
@@ -69,6 +96,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
PATH: `/node16/bin-npm7${delimiter}foo`,
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should not set path if node is 16 and npm 7+ is detected',
@@ -85,6 +114,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
PATH: 'foo',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should set YARN_NODE_LINKER w/yarn if it is not already defined',
@@ -100,6 +131,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
YARN_NODE_LINKER: 'node-modules',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should not set YARN_NODE_LINKER if it already exists',
@@ -116,6 +149,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
YARN_NODE_LINKER: 'exists',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should set path if pnpm 7+ is detected',
@@ -132,6 +167,9 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
},
consoleLogOutput:
'Detected `pnpm-lock.yaml` version 5.4 generated by pnpm 7',
consoleWarnOutput: null,
},
{
name: 'should set path if bun v1 is detected',
@@ -148,6 +186,9 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
PATH: `/bun1${delimiter}/usr/local/bin`,
},
consoleLogOutput: 'Detected `bun.lockb` generated by Bun',
consoleWarnOutput:
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions',
},
{
name: 'should not set pnpm path if corepack is enabled',
@@ -164,6 +205,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
ENABLE_EXPERIMENTAL_COREPACK: '1',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should not prepend pnpm path again if already detected',
@@ -180,6 +223,8 @@ describe('Test `getEnvForPackageManager()`', () => {
FOO: 'bar',
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
{
name: 'should not set path if pnpm 6 is detected',
@@ -194,20 +239,262 @@ describe('Test `getEnvForPackageManager()`', () => {
want: {
FOO: 'bar',
},
consoleLogOutput: null,
consoleWarnOutput: null,
},
];
])('$name', ({ args, want, consoleLogOutput, consoleWarnOutput }) => {
expect(
getEnvForPackageManager({
cliType: args.cliType,
lockfileVersion: args.lockfileVersion,
nodeVersion: args.nodeVersion,
env: args.env,
})
).toStrictEqual(want);
for (const { name, want, args } of cases) {
it(name, () => {
assert.deepStrictEqual(
getEnvForPackageManager({
cliType: args.cliType,
lockfileVersion: args.lockfileVersion,
nodeVersion: args.nodeVersion,
env: args.env,
}),
want
);
});
}
// Check console.log output
if (typeof consoleLogOutput === 'string') {
expect(consoleLogSpy).toHaveBeenCalledWith(consoleLogOutput);
} else if (consoleLogOutput === null) {
expect(consoleLogSpy).not.toHaveBeenCalled();
}
// Check console.warn output
if (typeof consoleWarnOutput === 'string') {
expect(consoleWarnSpy).toHaveBeenCalledWith(consoleWarnOutput);
} else if (consoleLogOutput === null) {
expect(consoleWarnSpy).not.toHaveBeenCalled();
}
});
});
describe('Test `getPathForPackageManager()`', () => {
test.each<{
name: string;
args: Parameters<typeof getEnvForPackageManager>[0];
want: unknown;
}>([
{
name: 'should do nothing to env for npm < 6 and node < 16',
args: {
cliType: 'npm',
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
lockfileVersion: 1,
env: {
FOO: 'bar',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should set path if npm 7+ is detected and node < 16',
args: {
cliType: 'npm',
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
lockfileVersion: 2,
env: {
FOO: 'bar',
PATH: 'foo',
},
},
want: {
detectedLockfile: 'package-lock.json',
detectedPackageManager: 'npm 7+',
path: '/node16/bin-npm7',
yarnNodeLinker: undefined,
},
},
{
name: 'should not set npm path if corepack enabled',
args: {
cliType: 'npm',
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
lockfileVersion: 2,
env: {
FOO: 'bar',
ENABLE_EXPERIMENTAL_COREPACK: '1',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should not prepend npm path again if already detected',
args: {
cliType: 'npm',
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
lockfileVersion: 2,
env: {
FOO: 'bar',
PATH: `/node16/bin-npm7${delimiter}foo`,
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should not set path if node is 16 and npm 7+ is detected',
args: {
cliType: 'npm',
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
lockfileVersion: 2,
env: {
FOO: 'bar',
PATH: 'foo',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should set YARN_NODE_LINKER w/yarn if it is not already defined',
args: {
cliType: 'yarn',
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
lockfileVersion: 2,
env: {
FOO: 'bar',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: 'node-modules',
},
},
{
name: 'should not set YARN_NODE_LINKER if it already exists',
args: {
cliType: 'yarn',
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
lockfileVersion: 2,
env: {
FOO: 'bar',
YARN_NODE_LINKER: 'exists',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should set path if pnpm 7+ is detected',
args: {
cliType: 'pnpm',
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
lockfileVersion: 5.4,
env: {
FOO: 'bar',
PATH: 'foo',
},
},
want: {
detectedLockfile: 'pnpm-lock.yaml',
detectedPackageManager: 'pnpm 7',
path: '/pnpm7/node_modules/.bin',
yarnNodeLinker: undefined,
},
},
{
name: 'should set path if bun v1 is detected',
args: {
cliType: 'bun',
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
lockfileVersion: 0,
env: {
FOO: 'bar',
PATH: '/usr/local/bin',
},
},
want: {
detectedLockfile: 'bun.lockb',
detectedPackageManager: 'Bun',
path: '/bun1',
yarnNodeLinker: undefined,
},
},
{
name: 'should not set pnpm path if corepack is enabled',
args: {
cliType: 'pnpm',
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
lockfileVersion: 5.4,
env: {
FOO: 'bar',
ENABLE_EXPERIMENTAL_COREPACK: '1',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should not prepend pnpm path again if already detected',
args: {
cliType: 'pnpm',
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' },
lockfileVersion: 5.4,
env: {
FOO: 'bar',
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
{
name: 'should not set path if pnpm 6 is detected',
args: {
cliType: 'pnpm',
nodeVersion: { major: 14, range: '14.x', runtime: 'nodejs14.x' },
lockfileVersion: 5.3,
env: {
FOO: 'bar',
},
},
want: {
detectedLockfile: undefined,
detectedPackageManager: undefined,
path: undefined,
yarnNodeLinker: undefined,
},
},
])('$name', ({ args, want }) => {
expect(
getPathForPackageManager({
cliType: args.cliType,
lockfileVersion: args.lockfileVersion,
nodeVersion: args.nodeVersion,
env: args.env,
})
).toStrictEqual(want);
});
});

View File

@@ -60,7 +60,7 @@ it('should only match supported node versions, otherwise throw an error', async
);
const autoMessage =
'Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.';
'Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.';
await expectBuilderError(
getSupportedNodeVersion('8.11.x', true),
autoMessage
@@ -80,7 +80,7 @@ it('should only match supported node versions, otherwise throw an error', async
);
const foundMessage =
'Please set "engines": { "node": "18.x" } in your `package.json` file to use Node.js 18.';
'Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.';
await expectBuilderError(
getSupportedNodeVersion('8.11.x', false),
foundMessage
@@ -101,8 +101,8 @@ it('should match all semver ranges', async () => {
// See https://docs.npmjs.com/files/package.json#engines
expect(await getSupportedNodeVersion('16.0.0')).toHaveProperty('major', 16);
expect(await getSupportedNodeVersion('16.x')).toHaveProperty('major', 16);
expect(await getSupportedNodeVersion('>=10')).toHaveProperty('major', 18);
expect(await getSupportedNodeVersion('>=10.3.0')).toHaveProperty('major', 18);
expect(await getSupportedNodeVersion('>=10')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('>=10.3.0')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('16.5.0 - 16.9.0')).toHaveProperty(
'major',
16
@@ -120,11 +120,33 @@ it('should match all semver ranges', async () => {
});
it('should allow nodejs18.x', async () => {
expect(getLatestNodeVersion()).toHaveProperty('major', 18);
expect(await getSupportedNodeVersion('18.x')).toHaveProperty('major', 18);
expect(await getSupportedNodeVersion('18')).toHaveProperty('major', 18);
expect(await getSupportedNodeVersion('18.1.0')).toHaveProperty('major', 18);
expect(await getSupportedNodeVersion('>=16')).toHaveProperty('major', 18);
});
it('should allow nodejs20.x', async () => {
expect(getLatestNodeVersion()).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20.x')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20.1.0')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('>=18')).toHaveProperty('major', 20);
});
it('should not allow nodejs20.x when not available', async () => {
// Simulates AL2 build-container
await expect(
getSupportedNodeVersion('20.x', true, [14, 16, 18])
).rejects.toThrow(
'Found invalid Node.js Version: "20.x". Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.'
);
});
it('should not allow nodejs18.x when not available', async () => {
// Simulates AL2023 build-container
await expect(getSupportedNodeVersion('18.x', true, [20])).rejects.toThrow(
'Found invalid Node.js Version: "18.x". Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.'
);
});
it('should ignore node version in vercel dev getNodeVersion()', async () => {
@@ -193,7 +215,7 @@ it('should warn when package.json engines is greater than', async () => {
{},
{}
)
).toHaveProperty('range', '18.x');
).toHaveProperty('range', '20.x');
expect(warningMessages).toStrictEqual([
'Warning: Detected "engines": { "node": ">=16" } in your `package.json` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version',
]);
@@ -232,101 +254,98 @@ it('should not warn when package.json engines matches project setting from confi
});
it('should get latest node version', async () => {
expect(getLatestNodeVersion()).toHaveProperty('major', 18);
expect(getLatestNodeVersion()).toHaveProperty('major', 20);
});
it('should get latest node version with Node 18.x in build-container', async () => {
// Simulates AL2 build-container
expect(getLatestNodeVersion([14, 16, 18])).toHaveProperty('major', 18);
});
it('should get latest node version with Node 20.x in build-container', async () => {
// Simulates AL2023 build-container
expect(getLatestNodeVersion([20])).toHaveProperty('major', 20);
});
it('should throw for discontinued versions', async () => {
// Mock a future date so that Node 8 and 10 become discontinued
const realDateNow = Date.now.bind(global.Date);
global.Date.now = () => new Date('2024-02-13').getTime();
// Mock a future date so that Node 16 becomes discontinued
const realDateNow = Date.now;
try {
global.Date.now = () => new Date('2024-07-16').getTime();
expect(getSupportedNodeVersion('8.10.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('8.10.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('10.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('10.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('12.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('12.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('14.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('14.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('16.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('16.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('8.10.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('8.10.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('10.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('10.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('12.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('12.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('14.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('14.x', true)).rejects.toThrow();
expect(getSupportedNodeVersion('16.x', false)).rejects.toThrow();
expect(getSupportedNodeVersion('16.x', true)).rejects.toThrow();
const discontinued = getDiscontinuedNodeVersions();
expect(discontinued.length).toBe(5);
expect(discontinued[0]).toHaveProperty('range', '16.x');
expect(discontinued[1]).toHaveProperty('range', '14.x');
expect(discontinued[2]).toHaveProperty('range', '12.x');
expect(discontinued[3]).toHaveProperty('range', '10.x');
expect(discontinued[4]).toHaveProperty('range', '8.10.x');
global.Date.now = realDateNow;
const discontinued = getDiscontinuedNodeVersions();
expect(discontinued.length).toBe(5);
expect(discontinued[0]).toHaveProperty('range', '16.x');
expect(discontinued[1]).toHaveProperty('range', '14.x');
expect(discontinued[2]).toHaveProperty('range', '12.x');
expect(discontinued[3]).toHaveProperty('range', '10.x');
expect(discontinued[4]).toHaveProperty('range', '8.10.x');
} finally {
global.Date.now = realDateNow;
}
});
it('should warn for deprecated versions, soon to be discontinued', async () => {
// Mock a future date so that Node 10 warns
const realDateNow = Date.now.bind(global.Date);
global.Date.now = () => new Date('2021-02-23').getTime();
expect(await getSupportedNodeVersion('10.x', false)).toHaveProperty(
'major',
10
);
expect(await getSupportedNodeVersion('10.x', true)).toHaveProperty(
'major',
10
);
expect(await getSupportedNodeVersion('12.x', false)).toHaveProperty(
'major',
12
);
expect(await getSupportedNodeVersion('12.x', true)).toHaveProperty(
'major',
12
);
expect(await getSupportedNodeVersion('14.x', false)).toHaveProperty(
'major',
14
);
expect(await getSupportedNodeVersion('14.x', true)).toHaveProperty(
'major',
14
);
expect(await getSupportedNodeVersion('16.x', false)).toHaveProperty(
'major',
16
);
expect(await getSupportedNodeVersion('16.x', true)).toHaveProperty(
'major',
16
);
expect(warningMessages).toStrictEqual([
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set "engines": { "node": "18.x" } in your `package.json` file to use Node.js 18.',
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.',
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-03 will fail to build. Please set "engines": { "node": "18.x" } in your `package.json` file to use Node.js 18.',
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-03 will fail to build. Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.',
'Error: Node.js version 14.x has reached End-of-Life. Deployments created on or after 2023-08-15 will fail to build. Please set "engines": { "node": "18.x" } in your `package.json` file to use Node.js 18.',
'Error: Node.js version 14.x has reached End-of-Life. Deployments created on or after 2023-08-15 will fail to build. Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2024-02-06 will fail to build. Please set "engines": { "node": "18.x" } in your `package.json` file to use Node.js 18.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2024-02-06 will fail to build. Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.',
]);
global.Date.now = realDateNow;
});
it('should only allow nodejs20.x when env var is set', async () => {
// Mock a future date so that Node 16 warns
const realDateNow = Date.now;
try {
expect(getLatestNodeVersion()).toHaveProperty('major', 18);
await expect(getSupportedNodeVersion('20.x')).rejects.toThrow();
global.Date.now = () => new Date('2021-02-23').getTime();
process.env.VERCEL_ALLOW_NODEJS20 = '1';
expect(getLatestNodeVersion()).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20.x')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('20.1.0')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('>=16')).toHaveProperty('major', 20);
expect(await getSupportedNodeVersion('10.x', false)).toHaveProperty(
'major',
10
);
expect(await getSupportedNodeVersion('10.x', true)).toHaveProperty(
'major',
10
);
expect(await getSupportedNodeVersion('12.x', false)).toHaveProperty(
'major',
12
);
expect(await getSupportedNodeVersion('12.x', true)).toHaveProperty(
'major',
12
);
expect(await getSupportedNodeVersion('14.x', false)).toHaveProperty(
'major',
14
);
expect(await getSupportedNodeVersion('14.x', true)).toHaveProperty(
'major',
14
);
expect(await getSupportedNodeVersion('16.x', false)).toHaveProperty(
'major',
16
);
expect(await getSupportedNodeVersion('16.x', true)).toHaveProperty(
'major',
16
);
expect(warningMessages).toStrictEqual([
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 10.x has reached End-of-Life. Deployments created on or after 2021-04-20 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-03 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-03 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
'Error: Node.js version 14.x has reached End-of-Life. Deployments created on or after 2023-08-15 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 14.x has reached End-of-Life. Deployments created on or after 2023-08-15 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2024-06-15 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2024-06-15 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
]);
} finally {
delete process.env.VERCEL_ALLOW_NODEJS20;
global.Date.now = realDateNow;
}
});

View File

@@ -1,5 +1,185 @@
# vercel
## 33.3.0
### Minor Changes
- Emit "filePathMap" in `vc-config.json` for `FileFsRef` instances ([#11060](https://github.com/vercel/vercel/pull/11060))
### Patch Changes
- Update `vc dev` to support `Lambda` instances without `zipBuffer` ([#11080](https://github.com/vercel/vercel/pull/11080))
- Updated dependencies [[`322c88536`](https://github.com/vercel/vercel/commit/322c88536dfa0ba3892eb580858ee54f6b04ed3f), [`62ca2efa7`](https://github.com/vercel/vercel/commit/62ca2efa731c4df46d586b94078b2dcb1c0bb934)]:
- @vercel/ruby@2.0.5
- @vercel/python@4.1.1
## 33.2.0
### Minor Changes
- chore: deprecate next/nuxt/gastby Speed Insights injection in favor of @vercel/speed-insights ([#11048](https://github.com/vercel/vercel/pull/11048))
### Patch Changes
- fix error when @vercel/analytics is a transitive dependency of the deployed application ([#10892](https://github.com/vercel/vercel/pull/10892))
- [cli] Add documentation string for `skip-domain` option ([#11051](https://github.com/vercel/vercel/pull/11051))
- Updated dependencies [[`260125784`](https://github.com/vercel/vercel/commit/2601257846fa201fc9efde021a906c706f6191aa), [`cdddb33ad`](https://github.com/vercel/vercel/commit/cdddb33ad49f6080c49f4fff3767e6111acd0bbe), [`72d8604c9`](https://github.com/vercel/vercel/commit/72d8604c9dba108ccca41d6288b765a7ba727295), [`90d0455e1`](https://github.com/vercel/vercel/commit/90d0455e1ff7b5892ff4960226535f57f704ef6f), [`0716130e5`](https://github.com/vercel/vercel/commit/0716130e580a920d92d249d029ed37f92f2ca847), [`b6b151f39`](https://github.com/vercel/vercel/commit/b6b151f3917c5cb47226951446b9dbb96c7d872b), [`b185a7e20`](https://github.com/vercel/vercel/commit/b185a7e207b153c378bd3db2618eece3a3b6a93e)]:
- @vercel/static-build@2.1.0
- @vercel/build-utils@7.5.1
- @vercel/next@4.1.0
- @vercel/remix-builder@2.0.18
- @vercel/node@3.0.17
## 33.1.0
### Minor Changes
- Serialize duplicate `EdgeFunction` references as symlinks in `vc build` ([#11027](https://github.com/vercel/vercel/pull/11027))
### Patch Changes
- Handle rate limit response when fetching /teams ([#11013](https://github.com/vercel/vercel/pull/11013))
- Display actual deployment's 'target' ([#11025](https://github.com/vercel/vercel/pull/11025))
- Updated dependencies [[`98040ec24`](https://github.com/vercel/vercel/commit/98040ec24e1ee585865d11eb216b6525d39d209e)]:
- @vercel/build-utils@7.5.0
- @vercel/static-build@2.0.17
- @vercel/hydrogen@1.0.2
- @vercel/remix-builder@2.0.17
- @vercel/node@3.0.16
## 33.0.2
### Patch Changes
- Log extension execution failures ([#10937](https://github.com/vercel/vercel/pull/10937))
- Updated dependencies [[`fbe08fe57`](https://github.com/vercel/vercel/commit/fbe08fe57eededc0bcd2409692b23d185c70069d), [`77585013d`](https://github.com/vercel/vercel/commit/77585013dec5fc406b8b7ea00918e49fdb8f10ec), [`c536a74bc`](https://github.com/vercel/vercel/commit/c536a74bc9e7188a87b292615fa88d6fc506b105), [`91f8763ed`](https://github.com/vercel/vercel/commit/91f8763edce672a3c05b6096db6084f1e6741384), [`7f8f5f865`](https://github.com/vercel/vercel/commit/7f8f5f86516934acb0c4b936ea601433c8d30c5c)]:
- @vercel/next@4.0.17
- @vercel/go@3.0.5
- @vercel/node@3.0.15
- @vercel/redwood@2.0.6
- @vercel/remix-builder@2.0.16
## 33.0.1
### Patch Changes
- Updated dependencies [[`67fa2f3dd`](https://github.com/vercel/vercel/commit/67fa2f3dd6a6d5a3504b7f9081e56deff7b36eab), [`7b0adf371`](https://github.com/vercel/vercel/commit/7b0adf371bae64d33ed0a1b966fc50b1f7c9639b)]:
- @vercel/build-utils@7.4.1
- @vercel/next@4.0.16
- @vercel/static-build@2.0.16
- @vercel/node@3.0.14
## 33.0.0
### Major Changes
- [cli] replace `--deprecated` with `--update-required` in `vc project ls` ([#10965](https://github.com/vercel/vercel/pull/10965))
### Patch Changes
- Fix `vercel bisect` selecting too many deployments ([#10956](https://github.com/vercel/vercel/pull/10956))
- Updated dependencies [[`6a9002f22`](https://github.com/vercel/vercel/commit/6a9002f2296c5ccce4522c0fa9a8938c3d7a4849), [`4d63d9e95`](https://github.com/vercel/vercel/commit/4d63d9e954549d811063d259250d1865b7de2ba1)]:
- @vercel/remix-builder@2.0.15
- @vercel/build-utils@7.4.0
- @vercel/static-build@2.0.15
- @vercel/node@3.0.13
## 32.7.2
### Patch Changes
- [cli] Use new `deprecated` query param in projects api for `vc project ls --deprecated` ([#10938](https://github.com/vercel/vercel/pull/10938))
## 32.7.1
### Patch Changes
- [cli] double page limit for vc project ls --deprecated ([#10932](https://github.com/vercel/vercel/pull/10932))
- Updated dependencies [[`d09dd1794`](https://github.com/vercel/vercel/commit/d09dd1794b5ffa28c15d3ad2880b90db2f4c06f0)]:
- @vercel/remix-builder@2.0.14
## 32.7.0
### Minor Changes
- [cli] add `--deprecated` option to `vc project ls` command ([#10919](https://github.com/vercel/vercel/pull/10919))
### Patch Changes
- Remove some debug statements and make log into warning ([#10926](https://github.com/vercel/vercel/pull/10926))
- Updated dependencies [[`3cede43ca`](https://github.com/vercel/vercel/commit/3cede43ca7ea3aec3ff33864b7d33da57891ddb2), [`dfe47f6e6`](https://github.com/vercel/vercel/commit/dfe47f6e6c1d395ae24d802f4b7c98e39b9f90f4), [`1dbb22bb6`](https://github.com/vercel/vercel/commit/1dbb22bb6d33657faa78376f527fe350188c5257), [`204c3592c`](https://github.com/vercel/vercel/commit/204c3592c78fc544e62f0210b0e7e1e4cd382a0c)]:
- @vercel/ruby@2.0.4
- @vercel/build-utils@7.3.0
- @vercel/remix-builder@2.0.13
- @vercel/node@3.0.12
- @vercel/static-build@2.0.14
## 32.6.1
### Patch Changes
- Revert "forbids globally installed @vercel/speed-insights and @vercel/analytics (#10848)" ([#10895](https://github.com/vercel/vercel/pull/10895))
## 32.6.0
### Minor Changes
- forbids globally installed @vercel/speed-insights and @vercel/analytics ([#10848](https://github.com/vercel/vercel/pull/10848))
### Patch Changes
- [cli] Fix behavior for combination of northstar user + team scope provided to cli as an argument. ([#10884](https://github.com/vercel/vercel/pull/10884))
- Updated dependencies [[`4edfcd74b`](https://github.com/vercel/vercel/commit/4edfcd74b6dfd8e9cbc05a71d47578051a2a7d63), [`0e9bb30fd`](https://github.com/vercel/vercel/commit/0e9bb30fd285492beadc365bece2ab1df67b387b), [`ca2cbf06f`](https://github.com/vercel/vercel/commit/ca2cbf06fbf252e23aff6e007d0df5ffc243b56e), [`c52bdf775`](https://github.com/vercel/vercel/commit/c52bdf77585dfa41b25cabe2f9403827d0964169)]:
- @vercel/remix-builder@2.0.12
- @vercel/static-build@2.0.13
- @vercel/go@3.0.4
## 32.5.6
### Patch Changes
- Updated dependencies [[`ffd2f34c6`](https://github.com/vercel/vercel/commit/ffd2f34c6c3d53bbb673aa3241845abc50e67c5e), [`4636ae54c`](https://github.com/vercel/vercel/commit/4636ae54c6c17709c1a058169cdca19c3df73ddb)]:
- @vercel/next@4.0.15
- @vercel/ruby@2.0.3
## 32.5.5
### Patch Changes
- Updated dependencies [[`88da7463c`](https://github.com/vercel/vercel/commit/88da7463ce12df91d49fbde85cb617030d55f558)]:
- @vercel/build-utils@7.2.5
- @vercel/node@3.0.11
- @vercel/static-build@2.0.12
## 32.5.4
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
- @vercel/node@3.0.10
- @vercel/static-build@2.0.11
## 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`](https://github.com/vercel/vercel/commit/89c1e032335d9ec0fcfc84fe499cf004fe73fafc), [`fd29b966d`](https://github.com/vercel/vercel/commit/fd29b966d39776318b0e11a53909edb43d1fc5f2)]:
- @vercel/node@3.0.9
- @vercel/next@4.0.14
## 32.5.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "32.5.2",
"version": "33.3.0",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -31,17 +31,17 @@
"node": ">= 16"
},
"dependencies": {
"@vercel/build-utils": "7.2.3",
"@vercel/build-utils": "7.5.1",
"@vercel/fun": "1.1.0",
"@vercel/go": "3.0.3",
"@vercel/hydrogen": "1.0.1",
"@vercel/next": "4.0.13",
"@vercel/node": "3.0.8",
"@vercel/python": "4.1.0",
"@vercel/redwood": "2.0.5",
"@vercel/remix-builder": "2.0.11",
"@vercel/ruby": "2.0.2",
"@vercel/static-build": "2.0.10",
"@vercel/go": "3.0.5",
"@vercel/hydrogen": "1.0.2",
"@vercel/next": "4.1.0",
"@vercel/node": "3.0.17",
"@vercel/python": "4.1.1",
"@vercel/redwood": "2.0.6",
"@vercel/remix-builder": "2.0.18",
"@vercel/ruby": "2.0.5",
"@vercel/static-build": "2.1.0",
"chokidar": "3.3.1"
},
"devDependencies": {
@@ -88,11 +88,11 @@
"@types/yauzl-promise": "2.1.0",
"@vercel-internals/constants": "1.0.4",
"@vercel-internals/get-package-json": "1.0.0",
"@vercel-internals/types": "1.0.14",
"@vercel/client": "13.0.7",
"@vercel-internals/types": "1.0.21",
"@vercel/client": "13.1.0",
"@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "2.0.3",
"@vercel/fs-detectors": "5.1.3",
"@vercel/frameworks": "2.0.6",
"@vercel/fs-detectors": "5.1.6",
"@vercel/routing-utils": "3.1.0",
"ajv": "6.12.2",
"alpha-sort": "2.0.1",

View File

@@ -188,15 +188,18 @@ export default async function bisect(client: Client): Promise<number> {
let newDeployments = chunk.deployments;
// If we have the "good" deployment in this chunk, then we're done
let hasGood = false;
for (let i = 0; i < newDeployments.length; i++) {
if (newDeployments[i].url === good) {
// grab all deployments up until the good one
newDeployments = newDeployments.slice(0, i);
hasGood = true;
break;
}
}
deployments = deployments.concat(newDeployments);
if (hasGood) break;
}
if (!deployments.length) {

View File

@@ -1,4 +1,4 @@
import fs from 'fs-extra';
import fs, { readJSON } from 'fs-extra';
import chalk from 'chalk';
import dotenv from 'dotenv';
import semver from 'semver';
@@ -71,6 +71,7 @@ import { setMonorepoDefaultSettings } from '../../util/build/monorepo';
import { help } from '../help';
import { buildCommand } from './command';
import { scrubArgv } from '../../util/build/scrub-argv';
import { cwd } from 'process';
type BuildResult = BuildResultV2 | BuildResultV3;
@@ -257,6 +258,9 @@ export default async function main(client: Client): Promise<number> {
if (project.settings.analyticsId) {
envToUnset.add('VERCEL_ANALYTICS_ID');
process.env.VERCEL_ANALYTICS_ID = project.settings.analyticsId;
output.warn(
'Vercel Speed Insights auto-injection is deprecated in favor of @vercel/speed-insights package. Learn more: https://vercel.link/upgrate-to-speed-insights-package'
);
}
// Some build processes use these env vars to platform detect Vercel
@@ -432,29 +436,6 @@ async function doBuild(
const ops: Promise<Error | void>[] = [];
const dependencyMap = makeDepencyMap(pkg);
const speedInsighsVersion = dependencyMap.get('@vercel/speed-insights');
if (speedInsighsVersion) {
if (process.env.VERCEL_ANALYTICS_ID) {
output.warn(
`The \`VERCEL_ANALYTICS_ID\` environment variable is deprecated and will be removed in a future release. Please remove it from your environment variables`
);
delete process.env.VERCEL_ANALYTICS_ID;
}
buildsJson.features = {
...(buildsJson.features ?? {}),
speedInsightsVersion: speedInsighsVersion,
};
}
const webAnalyticsVersion = dependencyMap.get('@vercel/analytics');
if (webAnalyticsVersion) {
buildsJson.features = {
...(buildsJson.features ?? {}),
webAnalyticsVersion: webAnalyticsVersion,
};
}
// Write the `detectedBuilders` result to output dir
const buildsJsonBuilds = new Map<Builder, SerializedBuilder>(
builds.map(build => {
@@ -474,10 +455,9 @@ async function doBuild(
];
})
);
buildsJson.builds = Array.from(buildsJsonBuilds.values());
await fs.writeJSON(join(outputDir, 'builds.json'), buildsJson, {
spaces: 2,
});
await writeBuildJson(buildsJson, outputDir);
// The `meta` config property is re-used for each Builder
// invocation so that Builders can share state between
@@ -573,6 +553,7 @@ async function doBuild(
// Start flushing the file outputs to the filesystem asynchronously
ops.push(
writeBuildResult(
repoRootPath,
outputDir,
buildResult,
build,
@@ -608,6 +589,33 @@ async function doBuild(
}
}
let needBuildsJsonOverride = false;
const speedInsightsVersion = await readInstalledVersion(
client,
'@vercel/speed-insights'
);
if (speedInsightsVersion) {
buildsJson.features = {
...(buildsJson.features ?? {}),
speedInsightsVersion,
};
needBuildsJsonOverride = true;
}
const webAnalyticsVersion = await readInstalledVersion(
client,
'@vercel/analytics'
);
if (webAnalyticsVersion) {
buildsJson.features = {
...(buildsJson.features ?? {}),
webAnalyticsVersion,
};
needBuildsJsonOverride = true;
}
if (needBuildsJsonOverride) {
await writeBuildJson(buildsJson, outputDir);
}
// Merge existing `config.json` file into the one that will be produced
const configPath = join(outputDir, 'config.json');
const existingConfig = await readJSONFile<BuildOutputConfig>(configPath);
@@ -818,9 +826,24 @@ function mergeFlags(
});
}
function makeDepencyMap(pkg: PackageJson | null): Map<string, string> {
return new Map([
...Object.entries(pkg?.devDependencies ?? {}),
...Object.entries(pkg?.dependencies ?? {}),
]);
async function writeBuildJson(buildsJson: BuildsManifest, outputDir: string) {
await fs.writeJSON(join(outputDir, 'builds.json'), buildsJson, { spaces: 2 });
}
export async function readInstalledVersion(
{ output }: Client,
pkgName: string
): Promise<string | undefined> {
try {
const descriptorPath = require.resolve(`${pkgName}/package.json`, {
paths: [cwd()],
});
const descriptor = await readJSON(descriptorPath);
return descriptor?.version;
} catch (err) {
output.debug(
`Package ${pkgName} is not installed (failed to read its package.json: ${err})`
);
}
return;
}

View File

@@ -112,7 +112,8 @@ export const deployCommand: Command = {
shorthand: null,
type: 'boolean',
deprecated: false,
description: undefined,
description:
'Disable the automatic promotion (aliasing) of the relevant domains to a new production deployment. You can use `vc promote` to complete the domain-assignment process later',
multi: false,
},
{

View File

@@ -3,6 +3,7 @@ import ms from 'ms';
import Client from '../../util/client';
import { isAPIError } from '../../util/errors-ts';
import { getCommandName } from '../../util/pkg-name';
import createProject from '../../util/projects/create-project';
export default async function add(
client: Client,
@@ -32,12 +33,14 @@ export default async function add(
const start = Date.now();
const [name] = args;
try {
await client.fetch('/projects', {
method: 'POST',
body: { name },
});
await createProject(client, { name });
} catch (err: unknown) {
if (isAPIError(err) && err.code === 'too_many_projects') {
output.prettyError(err);
return 1;
}
if (isAPIError(err) && err.status === 409) {
// project already exists, so we can
// show a success message

View File

@@ -15,7 +15,17 @@ export const projectCommand: Command = {
name: 'ls',
description: 'Show all projects in the selected scope',
arguments: [],
options: [],
options: [
{
name: 'update-required',
description: 'A list of projects affected by an upcoming deprecation',
argument: 'update-required',
shorthand: null,
type: 'boolean',
deprecated: false,
multi: false,
},
],
examples: [],
},
{

View File

@@ -23,6 +23,7 @@ export default async function main(client: Client) {
argv = getArgs(client.argv.slice(2), {
'--next': Number,
'-N': '--next',
'--update-required': Boolean,
});
} catch (error) {
handleError(error);

View File

@@ -6,6 +6,7 @@ import Client from '../../util/client';
import getCommandFlags from '../../util/get-command-flags';
import { getCommandName } from '../../util/pkg-name';
import strlen from '../../util/strlen';
import { NODE_VERSIONS } from '@vercel/build-utils';
export default async function list(
client: Client,
@@ -27,14 +28,19 @@ export default async function list(
output.spinner(`Fetching projects in ${chalk.bold(contextName)}`);
let projectsUrl = '/v4/projects/?limit=20';
let projectsUrl = `/v4/projects/?limit=20`;
const deprecated = argv['--update-required'] || false;
if (deprecated) {
projectsUrl += `&deprecated=${deprecated}`;
}
const next = argv['--next'] || false;
if (next) {
projectsUrl += `&until=${next}`;
}
const {
let {
projects: projectList,
pagination,
}: {
@@ -48,10 +54,34 @@ export default async function list(
const elapsed = ms(Date.now() - start);
if (deprecated) {
const upcomingDeprecationVersionsList = [];
for (const nodeVersion of NODE_VERSIONS) {
if (
nodeVersion.discontinueDate &&
nodeVersion.discontinueDate.valueOf() > Date.now()
) {
upcomingDeprecationVersionsList.push(nodeVersion.range);
}
}
output.warn(
`The following Node.js versions will be deprecated soon: ${upcomingDeprecationVersionsList.join(
', '
)}. Please upgrade your projects immediately.`
);
output.log(
`For more information visit: https://vercel.com/docs/functions/serverless-functions/runtimes/node-js#node.js-version`
);
}
output.log(
`${
projectList.length > 0 ? 'Projects' : 'No projects'
} found under ${chalk.bold(contextName)} ${chalk.gray(`[${elapsed}]`)}`
} found under ${chalk.bold(contextName)} ${
deprecated ? 'that are using a deprecated Node.js version' : '\b'
} ${chalk.gray(`[${elapsed}]`)}`
);
if (projectList.length > 0) {

View File

@@ -465,6 +465,15 @@ const main = async () => {
return 1;
}
if (isErrnoException(err) && err.code === 'rate_limited') {
output.prettyError({
message:
'Rate limited. Too many requests to the same endpoint: /teams',
});
return 1;
}
console.error(error('Not able to load teams'));
return 1;
}

View File

@@ -14,6 +14,7 @@ import {
BuildResultV2,
BuildResultV3,
File,
Files,
FileFsRef,
BuilderV2,
BuilderV3,
@@ -45,6 +46,7 @@ interface FunctionConfiguration {
}
export async function writeBuildResult(
repoRootPath: string,
outputDir: string,
buildResult: BuildResultV2 | BuildResultV3,
build: Builder,
@@ -55,6 +57,7 @@ export async function writeBuildResult(
const { version } = builder;
if (typeof version !== 'number' || version === 2) {
return writeBuildResultV2(
repoRootPath,
outputDir,
buildResult as BuildResultV2,
build,
@@ -62,6 +65,7 @@ export async function writeBuildResult(
);
} else if (version === 3) {
return writeBuildResultV3(
repoRootPath,
outputDir,
buildResult as BuildResultV3,
build,
@@ -107,6 +111,7 @@ function stripDuplicateSlashes(path: string): string {
* the filesystem.
*/
async function writeBuildResultV2(
repoRootPath: string,
outputDir: string,
buildResult: BuildResultV2,
build: Builder,
@@ -129,13 +134,20 @@ async function writeBuildResultV2(
);
}
const lambdas = new Map<Lambda, string>();
const existingFunctions = new Map<Lambda | EdgeFunction, string>();
const overrides: Record<string, PathOverride> = {};
for (const [path, output] of Object.entries(buildResult.output)) {
const normalizedPath = stripDuplicateSlashes(path);
if (isLambda(output)) {
await writeLambda(outputDir, output, normalizedPath, undefined, lambdas);
await writeLambda(
repoRootPath,
outputDir,
output,
normalizedPath,
undefined,
existingFunctions
);
} else if (isPrerender(output)) {
if (!output.lambda) {
throw new Error(
@@ -144,11 +156,12 @@ async function writeBuildResultV2(
}
await writeLambda(
repoRootPath,
outputDir,
output.lambda,
normalizedPath,
undefined,
lambdas
existingFunctions
);
// Write the fallback file alongside the Lambda directory
@@ -203,7 +216,13 @@ async function writeBuildResultV2(
vercelConfig?.cleanUrls
);
} else if (isEdgeFunction(output)) {
await writeEdgeFunction(outputDir, output, normalizedPath);
await writeEdgeFunction(
repoRootPath,
outputDir,
output,
normalizedPath,
existingFunctions
);
} else {
throw new Error(
`Unsupported output type: "${
@@ -220,6 +239,7 @@ async function writeBuildResultV2(
* the filesystem.
*/
async function writeBuildResultV3(
repoRootPath: string,
outputDir: string,
buildResult: BuildResultV3,
build: Builder,
@@ -243,9 +263,15 @@ async function writeBuildResultV3(
build.config?.zeroConfig ? src.substring(0, src.length - ext.length) : src
);
if (isLambda(output)) {
await writeLambda(outputDir, output, path, functionConfiguration);
await writeLambda(
repoRootPath,
outputDir,
output,
path,
functionConfiguration
);
} else if (isEdgeFunction(output)) {
await writeEdgeFunction(outputDir, output, path);
await writeEdgeFunction(repoRootPath, outputDir, output, path);
} else {
throw new Error(
`Unsupported output type: "${(output as any).type}" for ${build.src}`
@@ -315,27 +341,79 @@ async function writeStaticFile(
await downloadFile(file, dest);
}
/**
* If the `fn` Lambda or Edge function has already been written to
* the filesystem at a different location, then create a symlink
* to the previous location instead of copying the files again.
*
* @param outputPath The path of the `.vercel/output` directory
* @param dest The path of destination function's `.func` directory
* @param fn The Lambda or EdgeFunction instance to create the symlink for
* @param existingFunctions Map of `Lambda`/`EdgeFunction` instances that have previously been written
*/
async function writeFunctionSymlink(
outputDir: string,
dest: string,
fn: Lambda | EdgeFunction,
existingFunctions: Map<Lambda | EdgeFunction, string>
) {
const existingPath = existingFunctions.get(fn);
// Function has not been written to the filesystem, so bail
if (!existingPath) return false;
const destDir = dirname(dest);
const targetDest = join(outputDir, 'functions', `${existingPath}.func`);
const target = relative(destDir, targetDest);
await fs.mkdirp(destDir);
await fs.symlink(target, dest);
return true;
}
/**
* Serializes the `EdgeFunction` instance to the file system.
*
* @param outputPath The path of the `.vercel/output` directory
* @param edgeFunction The `EdgeFunction` instance
* @param path The URL path where the `EdgeFunction` can be accessed from
* @param existingFunctions (optional) Map of `Lambda`/`EdgeFunction` instances that have previously been written
*/
async function writeEdgeFunction(
repoRootPath: string,
outputDir: string,
edgeFunction: EdgeFunction,
path: string
path: string,
existingFunctions?: Map<Lambda | EdgeFunction, string>
) {
const dest = join(outputDir, 'functions', `${path}.func`);
if (existingFunctions) {
if (
await writeFunctionSymlink(
outputDir,
dest,
edgeFunction,
existingFunctions
)
) {
return;
}
existingFunctions.set(edgeFunction, path);
}
await fs.mkdirp(dest);
const ops: Promise<any>[] = [];
ops.push(download(edgeFunction.files, dest));
const { files, filePathMap } = filesWithoutFsRefs(
edgeFunction.files,
repoRootPath
);
ops.push(download(files, dest));
const config = {
runtime: 'edge',
...edgeFunction,
entrypoint: normalizePath(edgeFunction.entrypoint),
filePathMap,
files: undefined,
type: undefined,
};
@@ -351,42 +429,39 @@ async function writeEdgeFunction(
/**
* Writes the file references from the `Lambda` instance to the file system.
*
* @param outputPath The path of the `.vercel/output` directory
* @param lambda The `Lambda` instance
* @param path The URL path where the `Lambda` can be accessed from
* @param lambdas (optional) Map of `Lambda` instances that have previously been written
* @param functionConfiguration (optional) Extra configuration to apply to the function's `.vc-config.json` file
* @param existingFunctions (optional) Map of `Lambda`/`EdgeFunction` instances that have previously been written
*/
async function writeLambda(
repoRootPath: string,
outputDir: string,
lambda: Lambda,
path: string,
functionConfiguration?: FunctionConfiguration,
lambdas?: Map<Lambda, string>
existingFunctions?: Map<Lambda | EdgeFunction, string>
) {
const dest = join(outputDir, 'functions', `${path}.func`);
// If the `lambda` has already been written to the filesystem at a different
// location then create a symlink to the previous location instead of copying
// the files again.
const existingLambdaPath = lambdas?.get(lambda);
if (existingLambdaPath) {
const destDir = dirname(dest);
const targetDest = join(
outputDir,
'functions',
`${existingLambdaPath}.func`
);
const target = relative(destDir, targetDest);
await fs.mkdirp(destDir);
await fs.symlink(target, dest);
return;
if (existingFunctions) {
if (
await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)
) {
return;
}
existingFunctions.set(lambda, path);
}
lambdas?.set(lambda, path);
await fs.mkdirp(dest);
const ops: Promise<any>[] = [];
let filePathMap: Record<string, string> | undefined;
if (lambda.files) {
// `files` is defined
ops.push(download(lambda.files, dest));
const f = filesWithoutFsRefs(lambda.files, repoRootPath);
filePathMap = f.filePathMap;
ops.push(download(f.files, dest));
} else if (lambda.zipBuffer) {
// Builders that use the deprecated `createLambda()` might only have `zipBuffer`
ops.push(unzip(lambda.zipBuffer, dest));
@@ -402,6 +477,7 @@ async function writeLambda(
handler: normalizePath(lambda.handler),
memory,
maxDuration,
filePathMap,
type: undefined,
files: undefined,
zipBuffer: undefined,
@@ -509,3 +585,25 @@ export async function* findDirs(
}
}
}
/**
* Removes the `FileFsRef` instances from the `Files` object
* and returns them in a JSON serializable map of repo root
* relative paths to Lambda destination paths.
*/
function filesWithoutFsRefs(
files: Files,
repoRootPath: string
): { files: Files; filePathMap?: Record<string, string> } {
let filePathMap: Record<string, string> | undefined;
const out: Files = {};
for (const [path, file] of Object.entries(files)) {
if (file.type === 'FileFsRef') {
if (!filePathMap) filePathMap = {};
filePathMap[path] = relative(repoRootPath, file.fsPath);
} else {
out[path] = file;
}
}
return { files: out, filePathMap };
}

View File

@@ -4,12 +4,12 @@ export const defaultGlobalConfig: GlobalConfig = {
'// Note':
'This is your Vercel config file. For more information see the global configuration documentation.',
'// Docs':
'https://vercel.com/docs/project-configuration#global-configuration/config-json',
'https://vercel.com/docs/projects/project-configuration/global-configuration#config.json',
collectMetrics: true,
};
export const defaultAuthConfig: AuthConfig = {
'// Note': 'This is your Vercel credentials file. DO NOT SHARE!',
'// Docs':
'https://vercel.com/docs/project-configuration#global-configuration/auth-json',
'https://vercel.com/docs/projects/project-configuration/global-configuration#auth.json',
};

View File

@@ -185,7 +185,7 @@ export default async function processDeployment({
printInspectUrl(output, deployment.inspectorUrl, deployStamp);
const isProdDeployment = requestBody.target === 'production';
const isProdDeployment = deployment.target === 'production';
const previewUrl = `https://${deployment.url}`;
output.print(

View File

@@ -42,6 +42,18 @@ async function processMessage(message) {
// structure to JSON" errors, so delete the property...
delete result.childProcesses;
if (builder.version === 3) {
if (result.output.type === 'Lambda') {
result.output.zipBuffer = await result.output.createZip();
}
} else {
for (const output of Object.values(result.output)) {
if (output.type === 'Lambda') {
output.zipBuffer = await output.createZip();
}
}
}
process.send({ type: 'buildResult', result });
}

View File

@@ -361,8 +361,10 @@ export async function executeBuild(
await oldAsset.fn.destroy();
}
const ZipFile = asset.zipBuffer || (await asset.createZip());
asset.fn = await createFunction({
Code: { ZipFile: asset.zipBuffer },
Code: { ZipFile },
Handler: asset.handler,
Runtime: asset.runtime,
MemorySize: asset.memory || 3008,

View File

@@ -158,7 +158,10 @@ export default class DevServer {
private podId: string;
private devProcess?: ChildProcess;
private devProcessOrigin?: string;
private devServerPids: Set<number>;
private shutdownCallbacks: Map<
number /* PID */,
undefined | (() => Promise<void>)
>;
private originalProjectSettings?: ProjectSettings;
private projectSettings?: ProjectSettings;
@@ -211,7 +214,7 @@ export default class DevServer {
this.filter = path => Boolean(path);
this.podId = Math.random().toString(32).slice(-5);
this.devServerPids = new Set();
this.shutdownCallbacks = new Map();
}
async exit(code = 1) {
@@ -1006,7 +1009,7 @@ export default class DevServer {
ops.push(this.watcher.close());
}
for (const pid of this.devServerPids) {
for (const pid of this.shutdownCallbacks.keys()) {
ops.push(this.killBuilderDevServer(pid));
}
@@ -1024,7 +1027,15 @@ export default class DevServer {
async killBuilderDevServer(pid: number) {
const { debug } = this.output;
debug(`Killing builder dev server with PID ${pid}`);
this.devServerPids.delete(pid);
const shutdownCb = this.shutdownCallbacks.get(pid);
this.shutdownCallbacks.delete(pid);
if (shutdownCb) {
debug(`Running shutdown callback for PID ${pid}`);
await shutdownCb();
return;
}
try {
await treeKill(pid);
debug(`Killed builder dev server with PID ${pid}`);
@@ -1432,9 +1443,9 @@ export default class DevServer {
}
if (startMiddlewareResult) {
const { port, pid } = startMiddlewareResult;
const { port, pid, shutdown } = startMiddlewareResult;
middlewarePid = pid;
this.devServerPids.add(pid);
this.shutdownCallbacks.set(pid, shutdown);
const middlewareReqHeaders = nodeHeadersToFetchHeaders(req.headers);
@@ -1899,8 +1910,8 @@ export default class DevServer {
// is also included in the request ID. So use the same `dev1` fake region.
requestId = generateRequestId(this.podId, true);
const { port, pid } = devServerResult;
this.devServerPids.add(pid);
const { port, pid, shutdown } = devServerResult;
this.shutdownCallbacks.set(pid, shutdown);
res.once('close', () => {
this.killBuilderDevServer(pid);

View File

@@ -21,7 +21,7 @@ export async function execExtension(
args: string[],
cwd: string
): Promise<number> {
const { debug } = client.output;
const { debug, log } = client.output;
const extensionCommand = `vercel-${name}`;
const { packageJsonPath, lockfilePath } = await scanParentDirs(cwd);
@@ -76,7 +76,7 @@ export async function execExtension(
proxy.close();
if (result instanceof Error) {
debug(`error running extension: ${result.message}`);
log(`Error running extension ${extensionCommand}: ${result.message}`);
}
return result.exitCode;

View File

@@ -43,10 +43,13 @@ export default async function selectOrg(
})),
];
const defaultOrgIndex = teams.findIndex(team => team.id === currentTeam) + 1;
const defaultChoiceIndex = Math.max(
choices.findIndex(choice => choice.value.id === currentTeam),
0
);
if (autoConfirm) {
return choices[defaultOrgIndex].value;
return choices[defaultChoiceIndex].value;
}
const answers = await client.prompt({
@@ -54,7 +57,7 @@ export default async function selectOrg(
name: 'org',
message: question,
choices,
default: defaultOrgIndex,
default: defaultChoiceIndex,
});
const org = answers.org;

View File

@@ -21,6 +21,7 @@ import createProject from '../projects/create-project';
import { detectProjects } from '../projects/detect-projects';
import { repoInfoToUrl } from '../git/repo-info-to-url';
import { connectGitProvider, parseRepoUrl } from '../git/connect-git-provider';
import { isAPIError } from '../errors-ts';
const home = homedir();
@@ -283,24 +284,31 @@ export async function ensureRepoLink(
output.spinner(`Creating new Project: ${orgAndName}`);
delete selection.newProject;
if (!selection.rootDirectory) delete selection.rootDirectory;
const project = (selected[i] = await createProject(client, {
...selection,
framework: selection.framework.slug,
}));
await connectGitProvider(
client,
org,
project.id,
parsedRepoUrl.provider,
`${parsedRepoUrl.org}/${parsedRepoUrl.repo}`
);
output.log(
`Created new Project: ${output.link(
orgAndName,
`https://vercel.com/${orgAndName}`,
{ fallback: false }
)}`
);
try {
const project = (selected[i] = await createProject(client, {
...selection,
framework: selection.framework.slug,
}));
await connectGitProvider(
client,
org,
project.id,
parsedRepoUrl.provider,
`${parsedRepoUrl.org}/${parsedRepoUrl.repo}`
);
output.log(
`Created new Project: ${output.link(
orgAndName,
`https://vercel.com/${orgAndName}`,
{ fallback: false }
)}`
);
} catch (err) {
if (isAPIError(err) && err.code === 'too_many_projects') {
output.prettyError(err);
return;
}
}
}
repoConfig = {

View File

@@ -263,6 +263,10 @@ export default async function setupAndLink(
return { status: 'linked', org, project };
} catch (err) {
if (isAPIError(err) && err.code === 'too_many_projects') {
output.prettyError(err);
return { status: 'error', exitCode: 1, reason: 'TOO_MANY_PROJECTS' };
}
handleError(err);
return { status: 'error', exitCode: 1 };

View File

@@ -0,0 +1 @@
!node_modules

View File

@@ -0,0 +1,21 @@
const { Lambda, EdgeFunction } = require('@vercel/build-utils');
exports.build = async () => {
const lambda = new Lambda({
files: {},
runtime: 'provided',
handler: 'example.js'
});
const edge = new EdgeFunction({
files: {},
deploymentTarget: 'v8-worker',
entrypoint: 'example.js'
});
const output = {
lambda,
lambda2: lambda,
edge,
edge2: edge
};
return { output };
};

View File

@@ -0,0 +1,6 @@
{
"name": "functions-symlink",
"private": true,
"version": "0.0.0",
"main": "main.js"
}

View File

@@ -0,0 +1,7 @@
{
"orgId": ".",
"projectId": ".",
"settings": {
"framework": null
}
}

View File

@@ -0,0 +1,4 @@
{
"name": "functions-symlink-test",
"private": true
}

View File

@@ -0,0 +1,3 @@
{
"builds": [{ "src": "package.json", "use": "functions-symlink@0.0.0" }]
}

View File

@@ -421,7 +421,6 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
projectId: '.',
settings: {
framework: null,
installCommand: 'echo "skipping install"',
},
}),
'package.json': JSON.stringify({
@@ -429,7 +428,22 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
build: 'mkdir -p public && echo hi > public/index.txt',
},
dependencies: {
'@vercel/speed-insights': '0.0.1',
'@vercel/speed-insights': '0.0.4',
},
}),
},
'vc-build-indirect-web-analytics': {
'.vercel/project.json': JSON.stringify({
orgId: '.',
projectId: '.',
settings: {
framework: null,
installCommand: 'yarn add @vercel/analytics@1.1.1',
},
}),
'package.json': JSON.stringify({
scripts: {
build: 'mkdir -p public && echo hi > public/index.txt',
},
}),
},
@@ -439,7 +453,6 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
projectId: '.',
settings: {
framework: null,
installCommand: 'echo "skipping install"',
},
}),
'package.json': JSON.stringify({

View File

@@ -238,51 +238,59 @@ test('[vc build] should build project with corepack and select npm@8.1.0', async
});
test('[vc build] should build project with corepack and select pnpm@7.1.0', async () => {
process.env.ENABLE_EXPERIMENTAL_COREPACK = '1';
const directory = await setupE2EFixture('vc-build-corepack-pnpm');
const before = await exec(directory, 'pnpm', ['--version']);
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toMatch(/Build Completed/gm);
const after = await exec(directory, 'pnpm', ['--version']);
// Ensure global pnpm didn't change
expect(before.stdout).toBe(after.stdout);
// Ensure version is correct
expect(
await fs.readFile(
path.join(directory, '.vercel/output/static/index.txt'),
'utf8'
)
).toBe('7.1.0\n');
// Ensure corepack will be cached
const contents = fs.readdirSync(
path.join(directory, '.vercel/cache/corepack')
);
expect(contents).toEqual(['home', 'shim']);
try {
process.env.ENABLE_EXPERIMENTAL_COREPACK = '1';
const directory = await setupE2EFixture('vc-build-corepack-pnpm');
const before = await exec(directory, 'pnpm', ['--version']);
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toMatch(/Build Completed/gm);
const after = await exec(directory, 'pnpm', ['--version']);
// Ensure global pnpm didn't change
expect(before.stdout).toBe(after.stdout);
// Ensure version is correct
expect(
await fs.readFile(
path.join(directory, '.vercel/output/static/index.txt'),
'utf8'
)
).toBe('7.1.0\n');
// Ensure corepack will be cached
const contents = fs.readdirSync(
path.join(directory, '.vercel/cache/corepack')
);
expect(contents).toEqual(['home', 'shim']);
} finally {
delete process.env.ENABLE_EXPERIMENTAL_COREPACK;
}
});
test('[vc build] should build project with corepack and select yarn@2.4.3', async () => {
process.env.ENABLE_EXPERIMENTAL_COREPACK = '1';
const directory = await setupE2EFixture('vc-build-corepack-yarn');
const before = await exec(directory, 'yarn', ['--version']);
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toMatch(/Build Completed/gm);
const after = await exec(directory, 'yarn', ['--version']);
// Ensure global yarn didn't change
expect(before.stdout).toBe(after.stdout);
// Ensure version is correct
expect(
await fs.readFile(
path.join(directory, '.vercel/output/static/index.txt'),
'utf8'
)
).toBe('2.4.3\n');
// Ensure corepack will be cached
const contents = fs.readdirSync(
path.join(directory, '.vercel/cache/corepack')
);
expect(contents).toEqual(['home', 'shim']);
try {
process.env.ENABLE_EXPERIMENTAL_COREPACK = '1';
const directory = await setupE2EFixture('vc-build-corepack-yarn');
const before = await exec(directory, 'yarn', ['--version']);
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toMatch(/Build Completed/gm);
const after = await exec(directory, 'yarn', ['--version']);
// Ensure global yarn didn't change
expect(before.stdout).toBe(after.stdout);
// Ensure version is correct
expect(
await fs.readFile(
path.join(directory, '.vercel/output/static/index.txt'),
'utf8'
)
).toBe('2.4.3\n');
// Ensure corepack will be cached
const contents = fs.readdirSync(
path.join(directory, '.vercel/cache/corepack')
);
expect(contents).toEqual(['home', 'shim']);
} finally {
delete process.env.ENABLE_EXPERIMENTAL_COREPACK;
}
});
test('[vc dev] should print help from `vc develop --help`', async () => {

View File

@@ -750,7 +750,7 @@ test('deploys with only vercel.json and README.md', async () => {
// assert timing order of showing URLs vs status updates
expect(stderr).toMatch(
/Inspect.*\nPreview.*\nQueued.*\nBuilding.*\nCompleting/
/Inspect.*\nProduction.*\nQueued.*\nBuilding.*\nCompleting/
);
const { host } = new URL(stdout);
@@ -857,7 +857,7 @@ test('deploy pnpm twice using pnp and symlink=false', async () => {
page = await fetch(stdout);
text = await page.text();
expect(text).toBe('cache exists\n');
expect(text).toContain('cache exists\n');
});
test('reject deploying with wrong team .vercel config', async () => {
@@ -1168,23 +1168,25 @@ test('[vc build] should build project with `@vercel/static-build`', async () =>
});
test('[vc build] should build project with `@vercel/speed-insights`', async () => {
try {
process.env.VERCEL_ANALYTICS_ID = '123';
const directory = await setupE2EFixture('vc-build-speed-insights');
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toContain('Build Completed in .vercel/output');
const builds = await fs.readJSON(
path.join(directory, '.vercel/output/builds.json')
);
expect(builds?.features?.speedInsightsVersion).toEqual('0.0.4');
});
const directory = await setupE2EFixture('vc-build-speed-insights');
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toContain('Build Completed in .vercel/output');
expect(output.stderr).toContain(
'The `VERCEL_ANALYTICS_ID` environment variable is deprecated and will be removed in a future release. Please remove it from your environment variables'
);
const builds = await fs.readJSON(
path.join(directory, '.vercel/output/builds.json')
);
expect(builds?.features?.speedInsightsVersion).toEqual('0.0.1');
} finally {
delete process.env.VERCEL_ANALYTICS_ID;
}
test('[vc build] should build project with an indirect dependency to `@vercel/analytics`', async () => {
const directory = await setupE2EFixture('vc-build-indirect-web-analytics');
const output = await execCli(binaryPath, ['build'], { cwd: directory });
expect(output.exitCode, formatOutput(output)).toBe(0);
expect(output.stderr).toContain('Build Completed in .vercel/output');
const builds = await fs.readJSON(
path.join(directory, '.vercel/output/builds.json')
);
expect(builds?.features?.webAnalyticsVersion).toEqual('1.1.1');
});
test('[vc build] should build project with `@vercel/analytics`', async () => {

View File

@@ -353,11 +353,11 @@ export function useProject(
});
client.scenario.get(`/v4/projects`, (req, res) => {
res.json({
projects: [defaultProject],
projects: [project],
pagination: null,
});
});
client.scenario.post(`/projects`, (req, res) => {
client.scenario.post(`/v1/projects`, (req, res) => {
const { name } = req.body;
if (name === project.name) {
res.json(project);

View File

@@ -88,6 +88,26 @@ exports[`help command help output snapshots column width 40 1`] = `
the
deploym…
on
--skip-domain Disable
the
automat…
promoti…
(aliasi…
of the
relevant
domains
to a new
product…
deploym…
You can
use \`vc
promote\`
to
complete
the
domain-…
process
later
--with-cache Retain
build
cache
@@ -192,6 +212,10 @@ exports[`help command help output snapshots column width 80 1`] = `
--prod Create a production deployment
-p, --public Deployment is public (\`/_src\`) is exposed)
--regions Set default regions to enable the deployment on
--skip-domain Disable the automatic promotion (aliasing) of
the relevant domains to a new production
deployment. You can use \`vc promote\` to complete
the domain-assignment process later
--with-cache Retain build cache when using "--force"
-y, --yes Use default options to skip all prompts
@@ -255,6 +279,8 @@ exports[`help command help output snapshots column width 120 1`] = `
--prod Create a production deployment
-p, --public Deployment is public (\`/_src\`) is exposed)
--regions Set default regions to enable the deployment on
--skip-domain Disable the automatic promotion (aliasing) of the relevant domains to a new production
deployment. You can use \`vc promote\` to complete the domain-assignment process later
--with-cache Retain build cache when using "--force"
-y, --yes Use default options to skip all prompts

View File

@@ -785,7 +785,7 @@ describe('build', () => {
expect(files.sort()).toEqual(['index.html', 'package.json']);
});
it('should set `VERCEL_ANALYTICS_ID` environment variable', async () => {
it('should set `VERCEL_ANALYTICS_ID` environment variable and warn users', async () => {
const cwd = fixture('vercel-analytics');
const output = join(cwd, '.vercel/output');
client.cwd = cwd;
@@ -794,6 +794,9 @@ describe('build', () => {
const env = await fs.readJSON(join(output, 'static', 'env.json'));
expect(Object.keys(env).includes('VERCEL_ANALYTICS_ID')).toEqual(true);
await expect(client.stderr).toOutput(
'Vercel Speed Insights auto-injection is deprecated in favor of @vercel/speed-insights package. Learn more: https://vercel.link/upgrate-to-speed-insights-package'
);
});
it('should load environment variables from `.vercel/.env.preview.local`', async () => {
@@ -1248,3 +1251,42 @@ describe('build', () => {
).toEqual('marketing');
});
});
it('should create symlinks for duplicate references to Lambda / EdgeFunction instances', async () => {
if (process.platform === 'win32') {
console.log('Skipping test on Windows');
return;
}
const cwd = fixture('functions-symlink');
const output = join(cwd, '.vercel/output');
client.cwd = cwd;
const exitCode = await build(client);
expect(exitCode).toEqual(0);
// "functions" directory has output Functions
const functions = await fs.readdir(join(output, 'functions'));
expect(functions.sort()).toEqual([
'edge.func',
'edge2.func',
'lambda.func',
'lambda2.func',
]);
expect(
fs.lstatSync(join(output, 'functions/lambda.func')).isDirectory()
).toEqual(true);
expect(
fs.lstatSync(join(output, 'functions/edge.func')).isDirectory()
).toEqual(true);
expect(
fs.lstatSync(join(output, 'functions/lambda2.func')).isSymbolicLink()
).toEqual(true);
expect(
fs.lstatSync(join(output, 'functions/edge2.func')).isSymbolicLink()
).toEqual(true);
expect(fs.readlinkSync(join(output, 'functions/lambda2.func'))).toEqual(
'lambda.func'
);
expect(fs.readlinkSync(join(output, 'functions/edge2.func'))).toEqual(
'edge.func'
);
});

View File

@@ -5,10 +5,7 @@ import { useTeams } from '../../mocks/team';
import { defaultProject, useProject } from '../../mocks/project';
import { client } from '../../mocks/client';
import type { Project } from '@vercel-internals/types';
import {
pluckIdentifiersFromDeploymentList,
parseSpacedTableRow,
} from '../../helpers/parse-table';
import { parseSpacedTableRow } from '../../helpers/parse-table';
describe('project', () => {
describe('list', () => {
@@ -28,8 +25,7 @@ describe('project', () => {
expect(line.value).toEqual(`Fetching projects in ${user.username}`);
line = await lines.next();
const { org } = pluckIdentifiersFromDeploymentList(line.value!);
expect(org).toEqual(user.username);
expect(line.value).toContain(user.username);
// empty line
line = await lines.next();
@@ -49,6 +45,55 @@ describe('project', () => {
expect(data).toEqual([project.project.name, 'https://foobar.com']);
});
it('should list projects running on an soon-to-be-deprecated Node.js version', async () => {
jest.useFakeTimers().setSystemTime(new Date('2023-12-08'));
const user = useUser();
useTeams('team_dummy');
const project = useProject({
...defaultProject,
nodeVersion: '16.x',
});
client.setArgv('project', 'ls', '--update-required');
await projects(client);
const lines = createLineIterator(client.stderr);
let line = await lines.next();
expect(line.value).toEqual(`Fetching projects in ${user.username}`);
line = await lines.next();
expect(line.value).toEqual(
'WARN! The following Node.js versions will be deprecated soon: 16.x. Please upgrade your projects immediately.'
);
line = await lines.next();
expect(line.value).toEqual(
'> For more information visit: https://vercel.com/docs/functions/serverless-functions/runtimes/node-js#node.js-version'
);
line = await lines.next();
expect(line.value).toContain(user.username);
// empty line
line = await lines.next();
expect(line.value).toEqual('');
line = await lines.next();
const header = parseSpacedTableRow(line.value!);
expect(header).toEqual([
'Project Name',
'Latest Production URL',
'Updated',
]);
line = await lines.next();
const data = parseSpacedTableRow(line.value!);
data.pop();
expect(data).toEqual([project.project.name, 'https://foobar.com']);
jest.clearAllTimers();
});
it('should list projects when there is no production deployment', async () => {
const user = useUser();
useTeams('team_dummy');
@@ -66,8 +111,7 @@ describe('project', () => {
expect(line.value).toEqual(`Fetching projects in ${user.username}`);
line = await lines.next();
const { org } = pluckIdentifiersFromDeploymentList(line.value!);
expect(org).toEqual(user.username);
expect(line.value).toContain(user.username);
// empty line
line = await lines.next();

View File

@@ -4,10 +4,19 @@ import { useTeams } from '../../../mocks/team';
import { useUser } from '../../../mocks/user';
describe('selectOrg', () => {
let user;
let team;
beforeEach(() => {
team = useTeams()[0];
});
describe('non-northstar', () => {
beforeEach(() => {
user = useUser();
});
it('should allow selecting user', async () => {
const user = useUser();
useTeams();
const selectOrgPromise = selectOrg(client, 'Select the scope');
await expect(client.stderr).toOutput(user.name);
client.stdin.write('\r'); // Return key
@@ -15,26 +24,71 @@ describe('selectOrg', () => {
});
it('should allow selecting team', async () => {
useUser();
const team = useTeams()[0];
const selectOrgPromise = selectOrg(client, 'Select the scope');
await expect(client.stderr).toOutput('Select the scope');
client.stdin.write('\x1B[B'); // Down arrow
client.stdin.write('\r'); // Return key
await expect(selectOrgPromise).resolves.toHaveProperty('id', team.id);
});
it('automatically selects the correct scope when autoconfirm flag is passed', async () => {
const selectOrgPromise = selectOrg(client, 'Select the scope', true);
await expect(selectOrgPromise).resolves.toHaveProperty('id', user.id);
});
describe('with a selected team scope', () => {
beforeEach(() => {
client.config.currentTeam = team.id;
});
afterEach(() => {
delete client.config.currentTeam;
});
it('should allow selecting user', async () => {
const selectOrgPromise = selectOrg(client, 'Select the scope');
await expect(client.stderr).toOutput(user.name);
client.stdin.write('\r'); // Return key
await expect(selectOrgPromise).resolves.toHaveProperty('id', team.id);
});
it('should allow selecting team', async () => {
const selectOrgPromise = selectOrg(client, 'Select the scope');
await expect(client.stderr).toOutput('Select the scope');
client.stdin.write('\x1B[B'); // Down arrow
client.stdin.write('\r'); // Return key
await expect(selectOrgPromise).resolves.toHaveProperty('id', user.id);
});
it('automatically selects the correct scope when autoconfirm flag is passed', async () => {
const selectOrgPromise = selectOrg(client, 'Select the scope', true);
await expect(selectOrgPromise).resolves.toHaveProperty('id', team.id);
});
});
});
describe('northstar', () => {
it('should not allow selecting user', async () => {
const user = useUser({
beforeEach(() => {
user = useUser({
version: 'northstar',
});
const team = useTeams()[0];
client.config.currentTeam = team.id;
});
afterEach(() => {
delete client.config.currentTeam;
});
it('should not allow selecting user', async () => {
const selectOrgPromise = selectOrg(client, 'Select the scope');
await expect(client.stderr).not.toOutput(user.name);
client.stdin.write('\r'); // Return key
await expect(selectOrgPromise).resolves.toHaveProperty('id', team.id);
});
it('automatically selects the correct scope when autoconfirm flag is passed', async () => {
const selectOrgPromise = selectOrg(client, 'Select the scope', true);
await expect(selectOrgPromise).resolves.toHaveProperty('id', team.id);
});
});
});

View File

@@ -1,5 +1,60 @@
# @vercel/client
## 13.1.0
### Minor Changes
- Upload files referenced by "filePathMap" during `vc deploy --prebuilt` ([#11077](https://github.com/vercel/vercel/pull/11077))
## 13.0.14
### Patch Changes
- Updated dependencies [[`cdddb33ad`](https://github.com/vercel/vercel/commit/cdddb33ad49f6080c49f4fff3767e6111acd0bbe)]:
- @vercel/build-utils@7.5.1
## 13.0.13
### Patch Changes
- Updated dependencies [[`98040ec24`](https://github.com/vercel/vercel/commit/98040ec24e1ee585865d11eb216b6525d39d209e)]:
- @vercel/build-utils@7.5.0
## 13.0.12
### Patch Changes
- Updated dependencies [[`67fa2f3dd`](https://github.com/vercel/vercel/commit/67fa2f3dd6a6d5a3504b7f9081e56deff7b36eab)]:
- @vercel/build-utils@7.4.1
## 13.0.11
### Patch Changes
- Updated dependencies [[`4d63d9e95`](https://github.com/vercel/vercel/commit/4d63d9e954549d811063d259250d1865b7de2ba1)]:
- @vercel/build-utils@7.4.0
## 13.0.10
### Patch Changes
- Updated dependencies [[`dfe47f6e6`](https://github.com/vercel/vercel/commit/dfe47f6e6c1d395ae24d802f4b7c98e39b9f90f4)]:
- @vercel/build-utils@7.3.0
## 13.0.9
### Patch Changes
- Updated dependencies [[`88da7463c`](https://github.com/vercel/vercel/commit/88da7463ce12df91d49fbde85cb617030d55f558)]:
- @vercel/build-utils@7.2.5
## 13.0.8
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 13.0.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "13.0.7",
"version": "13.1.0",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -37,7 +37,7 @@
"typescript": "4.9.5"
},
"dependencies": {
"@vercel/build-utils": "7.2.3",
"@vercel/build-utils": "7.5.1",
"@vercel/routing-utils": "3.1.0",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",

View File

@@ -1,7 +1,7 @@
import { FilesMap } from './hashes';
import { FetchOptions } from '@zeit/fetch';
import { nodeFetch, zeitFetch } from './fetch';
import { join, sep, relative } from 'path';
import { join, sep, relative, basename } from 'path';
import { URL } from 'url';
import ignore from 'ignore';
import { pkgVersion } from '../pkg';
@@ -109,6 +109,29 @@ export async function buildFileTree(
return ignored;
};
fileList = await readdir(path, [ignores]);
if (prebuilt) {
// Traverse over the `.vc-config.json` files and include
// the files referenced by the "filePathMap" properties
const refs = new Set<string>();
const vcConfigFilePaths = fileList.filter(
file => basename(file) === '.vc-config.json'
);
await Promise.all(
vcConfigFilePaths.map(async p => {
const configJson = await readFile(p, 'utf8');
const config = JSON.parse(configJson);
if (!config.filePathMap) return;
for (const v of Object.values(config.filePathMap) as string[]) {
refs.add(join(path, v));
}
})
);
if (refs.size > 0) {
fileList = fileList.concat(Array.from(refs));
}
}
debug(`Found ${fileList.length} files in the specified directory`);
} else if (Array.isArray(path)) {
// Array of file paths

View File

@@ -0,0 +1 @@
!/.vercel

View File

@@ -0,0 +1,5 @@
{
"filePathMap": {
"node_modules/another/index.js": "node_modules/another/index.js"
}
}

View File

@@ -0,0 +1,5 @@
{
"filePathMap": {
"node_modules/example/index.js": "node_modules/example/index.js"
}
}

View File

@@ -109,7 +109,7 @@ describe('buildFileTree()', () => {
normalizeWindowsPaths(fileList).sort()
);
const expectedIgnoreList = ['.vercel'];
const expectedIgnoreList = ['.gitignore', '.vercel'];
expect(normalizeWindowsPaths(expectedIgnoreList).sort()).toEqual(
normalizeWindowsPaths(ignoreList).sort()
);
@@ -124,14 +124,18 @@ describe('buildFileTree()', () => {
);
const expectedFileList = toAbsolutePaths(cwd, [
'.vercel/output/functions/api/another.func/.vc-config.json',
'.vercel/output/functions/api/example.func/.vc-config.json',
'.vercel/output/static/baz.txt',
'.vercel/output/static/sub/qux.txt',
'node_modules/another/index.js',
'node_modules/example/index.js',
]);
expect(normalizeWindowsPaths(expectedFileList).sort()).toEqual(
normalizeWindowsPaths(fileList).sort()
);
const expectedIgnoreList = ['foo.txt', 'sub'];
const expectedIgnoreList = ['.gitignore', 'foo.txt', 'sub'];
expect(normalizeWindowsPaths(expectedIgnoreList).sort()).toEqual(
normalizeWindowsPaths(ignoreList).sort()
);

View File

@@ -70,7 +70,7 @@ Unicode characters for emoji flags start at this number, and run up to 127469.
`Const` **IP_HEADER_NAME**: `"x-real-ip"`
Client IP as calcualted by Vercel Proxy.
Client IP as calculated by Vercel Proxy.
#### Defined in

View File

@@ -7,7 +7,7 @@ export const CITY_HEADER_NAME = 'x-vercel-ip-city';
*/
export const COUNTRY_HEADER_NAME = 'x-vercel-ip-country';
/**
* Client IP as calcualted by Vercel Proxy.
* Client IP as calculated by Vercel Proxy.
*/
export const IP_HEADER_NAME = 'x-real-ip';
/**

View File

@@ -1,5 +1,23 @@
# @vercel/frameworks
## 2.0.6
### Patch Changes
- Update nuxt logo ([#10977](https://github.com/vercel/vercel/pull/10977))
## 2.0.5
### Patch Changes
- This new screenshot matches the template. It removes the version number so this screenshot will not go stale. ([#10921](https://github.com/vercel/vercel/pull/10921))
## 2.0.4
### Patch Changes
- Update placeholder for Nuxt to be correct command. ([#10873](https://github.com/vercel/vercel/pull/10873))
## 2.0.3
### Patch Changes

View File

@@ -1,5 +1,3 @@
<svg width="48" height="38" viewBox="0 0 48 38" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.7599 35.9199L14.6399 35.7999C14.3999 35.3199 14.3999 34.8399 14.3999 34.3599H2.99992L20.0399 4.11988L27.1199 16.9599L29.3999 15.2799L22.3199 2.43988C22.1999 2.19988 21.3599 0.879883 19.9199 0.879883C19.3199 0.879883 18.3599 1.11988 17.6399 2.43988L0.479919 33.0399C0.359919 33.2799 -0.360081 34.7199 0.359919 35.9199C0.599919 36.5199 1.31992 37.1199 2.87992 37.1199H17.2799C15.7199 37.1199 14.9999 36.5199 14.7599 35.9199Z" fill="#00C58E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M47.3999 33.1598L33.5999 8.31977C33.3599 8.07977 32.6399 6.75977 31.1999 6.75977C30.5999 6.75977 29.7599 6.99977 28.9199 8.31977L27.1199 11.1998V16.9598L31.1999 9.87977L44.8799 34.3598H39.7199C39.7913 34.853 39.7075 35.3563 39.4799 35.7998V35.9198C38.7599 37.1198 37.1999 37.1198 36.9599 37.1198H45.1199C45.3599 37.1198 46.9199 37.1198 47.6399 35.9198C47.8799 35.3198 48.1199 34.3598 47.3999 33.1598Z" fill="#108775"/>
<path d="M39.84 35.9199V35.7999L39.96 35.5599C40.08 35.1999 40.2 34.7199 40.08 34.3599L39.6 33.0399L28.8 14.08L27.24 11.2H27.12L25.56 14.08L14.64 33.0399L14.28 34.3599C14.1908 34.8922 14.275 35.4391 14.52 35.9199C14.88 36.5199 15.6 37.1199 17.04 37.1199H37.2C37.56 37.1199 39.12 37.1199 39.84 35.9199ZM27.12 16.96L37.08 34.3599H17.28L27.12 16.96Z" fill="#2F495E"/>
<svg width="61" height="40" viewBox="0 0 61 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M33.997 39.539h22.528c.715 0 1.418-.183 2.038-.53a4.014 4.014 0 0 0 1.492-1.447 3.861 3.861 0 0 0 .545-1.977 3.86 3.86 0 0 0-.547-1.977L44.923 8.19a4.016 4.016 0 0 0-1.49-1.447 4.172 4.172 0 0 0-2.038-.53c-.716 0-1.418.183-2.038.53a4.016 4.016 0 0 0-1.492 1.447l-3.868 6.504-7.563-12.718A4.018 4.018 0 0 0 24.942.53 4.175 4.175 0 0 0 22.904 0c-.716 0-1.419.183-2.039.53a4.018 4.018 0 0 0-1.492 1.446L.547 33.608A3.861 3.861 0 0 0 0 35.585c0 .694.188 1.376.545 1.977.358.601.873 1.1 1.492 1.447.62.347 1.323.53 2.038.53h14.141c5.603 0 9.735-2.387 12.578-7.044l6.902-11.596 3.698-6.205 11.096 18.64H37.695l-3.699 6.205Zm-16.011-6.212-9.869-.002L22.91 8.474l7.381 12.425-4.942 8.305c-1.888 3.022-4.033 4.123-7.363 4.123Z" fill="#00DC82"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 850 B

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/frameworks",
"version": "2.0.3",
"version": "2.0.6",
"main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts",
"files": [

View File

@@ -66,7 +66,7 @@ export const frameworks = [
darkModeLogo:
'https://api-frameworks.vercel.sh/framework-logos/next-dark.svg',
screenshot:
'https://assets.vercel.com/image/upload/v1673027027/front/import/nextjs.png',
'https://assets.vercel.com/image/upload/v1701461207/front/import/nextjs.png',
tagline:
'Next.js makes you productive with React instantly — whether you want to build static or dynamic sites.',
description: 'A Next.js app and a Serverless Function API.',
@@ -1456,8 +1456,8 @@ export const frameworks = [
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `nuxt generate`',
value: 'nuxt generate',
placeholder: '`npm run build` or `nuxt build`',
value: 'nuxt build',
},
devCommand: {
value: 'nuxt',

View File

@@ -1,5 +1,26 @@
# @vercel/fs-detectors
## 5.1.6
### Patch Changes
- Updated dependencies [[`471bdd5b4`](https://github.com/vercel/vercel/commit/471bdd5b4506f1410afd7bca6efae3bc696cd939)]:
- @vercel/frameworks@2.0.6
## 5.1.5
### Patch Changes
- Updated dependencies [[`e6aaf79d0`](https://github.com/vercel/vercel/commit/e6aaf79d04fafd032d9a28143b02d28766add415)]:
- @vercel/frameworks@2.0.5
## 5.1.4
### Patch Changes
- Updated dependencies [[`a8934da62`](https://github.com/vercel/vercel/commit/a8934da6232b66a98e9ce43ebf5342eac664d40d)]:
- @vercel/frameworks@2.0.4
## 5.1.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/fs-detectors",
"version": "5.1.3",
"version": "5.1.6",
"description": "Vercel filesystem detectors",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -22,7 +22,7 @@
},
"dependencies": {
"@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "2.0.3",
"@vercel/frameworks": "2.0.6",
"@vercel/routing-utils": "3.1.0",
"glob": "8.0.3",
"js-yaml": "4.1.0",
@@ -37,7 +37,7 @@
"@types/minimatch": "3.0.5",
"@types/node": "14.18.33",
"@types/semver": "7.3.10",
"@vercel/build-utils": "7.2.3",
"@vercel/build-utils": "7.5.1",
"jest-junit": "16.0.0",
"typescript": "4.9.5"
}

View File

@@ -1,5 +1,56 @@
# @vercel/gatsby-plugin-vercel-builder
## 2.0.16
### Patch Changes
- Updated dependencies [[`cdddb33ad`](https://github.com/vercel/vercel/commit/cdddb33ad49f6080c49f4fff3767e6111acd0bbe)]:
- @vercel/build-utils@7.5.1
## 2.0.15
### Patch Changes
- Updated dependencies [[`98040ec24`](https://github.com/vercel/vercel/commit/98040ec24e1ee585865d11eb216b6525d39d209e)]:
- @vercel/build-utils@7.5.0
## 2.0.14
### Patch Changes
- Updated dependencies [[`67fa2f3dd`](https://github.com/vercel/vercel/commit/67fa2f3dd6a6d5a3504b7f9081e56deff7b36eab)]:
- @vercel/build-utils@7.4.1
## 2.0.13
### Patch Changes
- Add support for "rewrites" ([#10954](https://github.com/vercel/vercel/pull/10954))
- Updated dependencies [[`4d63d9e95`](https://github.com/vercel/vercel/commit/4d63d9e954549d811063d259250d1865b7de2ba1)]:
- @vercel/build-utils@7.4.0
## 2.0.12
### Patch Changes
- Updated dependencies [[`dfe47f6e6`](https://github.com/vercel/vercel/commit/dfe47f6e6c1d395ae24d802f4b7c98e39b9f90f4)]:
- @vercel/build-utils@7.3.0
## 2.0.11
### Patch Changes
- Updated dependencies [[`88da7463c`](https://github.com/vercel/vercel/commit/88da7463ce12df91d49fbde85cb617030d55f558)]:
- @vercel/build-utils@7.2.5
## 2.0.10
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 2.0.9
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/gatsby-plugin-vercel-builder",
"version": "2.0.9",
"version": "2.0.16",
"main": "dist/index.js",
"files": [
"dist",
@@ -20,7 +20,7 @@
},
"dependencies": {
"@sinclair/typebox": "0.25.24",
"@vercel/build-utils": "7.2.3",
"@vercel/build-utils": "7.5.1",
"@vercel/routing-utils": "3.1.0",
"esbuild": "0.14.47",
"etag": "1.8.1",

Some files were not shown because too many files have changed in this diff Show More