Compare commits

..

50 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
144 changed files with 23980 additions and 21018 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

@@ -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",

View File

@@ -11105,10 +11105,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
typescript@3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
typescript@4.9.5:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
uglify-js@3.4.x:
version "3.4.10"

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,7 +81,7 @@ 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>
@@ -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,7 +11,7 @@
"dependencies": {
"react": "^18",
"react-dom": "^18",
"next": "14.0.4"
"next": "14.1.0"
},
"devDependencies": {
"typescript": "^5",
@@ -22,6 +22,6 @@
"postcss": "^8",
"tailwindcss": "^3.3.0",
"eslint": "^8",
"eslint-config-next": "14.0.4"
"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

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,26 @@
# @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

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@vercel-internals/types",
"version": "1.0.18",
"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.4.0",
"@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.11.2",
"turbo": "1.11.3",
"typescript": "4.9.5"
},
"scripts": {

View File

@@ -1,5 +1,23 @@
# @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

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "7.4.0",
"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

@@ -13,7 +13,7 @@ export const NODE_VERSIONS: NodeVersion[] = [
major: 16,
range: '16.x',
runtime: 'nodejs16.x',
discontinueDate: new Date('2024-02-06'),
discontinueDate: new Date('2024-06-15'),
},
{
major: 14,

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

@@ -268,81 +268,85 @@ it('should get latest node version with Node 20.x in build-container', async ()
});
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();
// Mock a future date so that Node 16 warns
const realDateNow = Date.now;
try {
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": "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-02-06 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-02-06 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
]);
global.Date.now = realDateNow;
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 {
global.Date.now = realDateNow;
}
});
it('should support initialHeaders and initialStatus correctly', async () => {

View File

@@ -1,5 +1,80 @@
# 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

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "33.0.0",
"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.4.0",
"@vercel/build-utils": "7.5.1",
"@vercel/fun": "1.1.0",
"@vercel/go": "3.0.4",
"@vercel/hydrogen": "1.0.1",
"@vercel/next": "4.0.15",
"@vercel/node": "3.0.13",
"@vercel/python": "4.1.0",
"@vercel/redwood": "2.0.5",
"@vercel/remix-builder": "2.0.15",
"@vercel/ruby": "2.0.4",
"@vercel/static-build": "2.0.15",
"@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.18",
"@vercel/client": "13.0.11",
"@vercel-internals/types": "1.0.21",
"@vercel/client": "13.1.0",
"@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "2.0.5",
"@vercel/fs-detectors": "5.1.5",
"@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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -1,5 +1,32 @@
# @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

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "13.0.11",
"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.4.0",
"@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,11 @@
# @vercel/frameworks
## 2.0.6
### Patch Changes
- Update nuxt logo ([#10977](https://github.com/vercel/vercel/pull/10977))
## 2.0.5
### 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.5",
"version": "2.0.6",
"main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts",
"files": [

View File

@@ -1,5 +1,12 @@
# @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

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/fs-detectors",
"version": "5.1.5",
"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.5",
"@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.4.0",
"@vercel/build-utils": "7.5.1",
"jest-junit": "16.0.0",
"typescript": "4.9.5"
}

View File

@@ -1,5 +1,26 @@
# @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

View File

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

View File

@@ -1,5 +1,11 @@
# @vercel/go
## 3.0.5
### Patch Changes
- Remove `VERCEL_USE_GO_PROVIDED_RUNTIME` env var check ([#10968](https://github.com/vercel/vercel/pull/10968))
## 3.0.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/go",
"version": "3.0.4",
"version": "3.0.5",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -29,7 +29,7 @@
"@types/node-fetch": "^2.3.0",
"@types/tar": "6.1.5",
"@types/yauzl-promise": "2.1.0",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"async-retry": "1.3.3",
"execa": "^1.0.0",
"fs-extra": "^7.0.0",

View File

@@ -249,10 +249,7 @@ export async function build({
await buildHandlerWithGoMod(buildOptions);
}
const runtime =
process.env.VERCEL_USE_GO_PROVIDED_RUNTIME === '1'
? 'provided.al2'
: 'go1.x';
const runtime = 'provided.al2';
const lambda = new Lambda({
files: { ...(await glob('**', outDir)), ...includedFiles },
handler: HANDLER_FILENAME,

View File

@@ -1,5 +1,11 @@
# @vercel/hydrogen
## 1.0.2
### Patch Changes
- Deprecate `EdgeFunction#name` property ([#11010](https://github.com/vercel/vercel/pull/11010))
## 1.0.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/hydrogen",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -26,7 +26,7 @@
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"jest-junit": "16.0.0"

View File

@@ -126,7 +126,6 @@ export const build: BuildV2 = async ({
]);
const edgeFunction = new EdgeFunction({
name: 'hydrogen',
deploymentTarget: 'v8-worker',
entrypoint: 'index.js',
files: edgeFunctionFiles,

View File

@@ -1,5 +1,30 @@
# @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))
## 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))
## 4.0.16
### Patch Changes
- Entries in the `prerender-manifest.json` without a `dataRoute` but with a `prefetchDataRoute` will be treated as an App Page. App Route's that do not have ([#10978](https://github.com/vercel/vercel/pull/10978))
a body will not cause a build error.
## 4.0.15
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/next",
"version": "4.0.15",
"version": "4.1.0",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -23,7 +23,7 @@
"dist"
],
"dependencies": {
"@vercel/nft": "0.24.2"
"@vercel/nft": "0.26.2"
},
"devDependencies": {
"@types/aws-lambda": "8.10.19",
@@ -40,7 +40,7 @@
"@types/semver": "6.0.0",
"@types/text-table": "0.2.1",
"@types/webpack-sources": "3.2.0",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"@vercel/routing-utils": "3.1.0",
"async-sema": "3.0.1",
"buffer-crc32": "0.2.13",

View File

@@ -213,6 +213,25 @@ export async function serverBuild({
value.contentType = rscContentTypeHeader;
}
}
for (const rewrite of afterFilesRewrites) {
if (rewrite.src && rewrite.dest) {
rewrite.src = rewrite.src.replace(
'(?:/)?',
'(?<rscsuff>(\\.prefetch)?\\.rsc)?(?:/)?'
);
let destQueryIndex = rewrite.dest.indexOf('?');
if (destQueryIndex === -1) {
destQueryIndex = rewrite.dest.length;
}
rewrite.dest =
rewrite.dest.substring(0, destQueryIndex) +
'$rscsuff' +
rewrite.dest.substring(destQueryIndex);
}
}
}
const isCorrectNotFoundRoutes = semver.gte(
@@ -1857,6 +1876,26 @@ export async function serverBuild({
// with that routing section
...afterFilesRewrites,
// ensure non-normalized /.rsc from rewrites is handled
...(appPathRoutesManifest
? [
{
src: path.posix.join('/', entryDirectory, '/\\.prefetch\\.rsc$'),
dest: path.posix.join(
'/',
entryDirectory,
`/__index${RSC_PREFETCH_SUFFIX}`
),
check: true,
},
{
src: path.posix.join('/', entryDirectory, '/\\.rsc$'),
dest: path.posix.join('/', entryDirectory, `/index.rsc`),
check: true,
},
]
: []),
{ handle: 'resource' },
...fallbackRewrites,

View File

@@ -2059,7 +2059,7 @@ export const onPrerenderRoute =
}
const isOmittedOrNotFound = isOmitted || isNotFound;
let htmlFsRef: File | null;
let htmlFsRef: File | null = null;
// If enabled, try to get the postponed route information from the file
// system and use it to assemble the prerender.
@@ -2108,14 +2108,22 @@ export const onPrerenderRoute =
} else if (
appDir &&
!dataRoute &&
!prefetchDataRoute &&
isAppPathRoute &&
!(isBlocking || isFallback)
) {
const contentType = initialHeaders?.['content-type'];
htmlFsRef = new FileFsRef({
fsPath: path.join(appDir, `${routeFileNoExt}.body`),
contentType: contentType || 'text/html;charset=utf-8',
});
// If the route has a body file, use it as the fallback, otherwise it may
// not have an associated fallback. This could be the case for routes that
// have dynamic segments.
const fsPath = path.join(appDir, `${routeFileNoExt}.body`);
if (fs.existsSync(fsPath)) {
htmlFsRef = new FileFsRef({
fsPath,
contentType: contentType || 'text/html;charset=utf-8',
});
}
} else {
htmlFsRef =
isBlocking || (isNotFound && !static404Page)
@@ -2848,6 +2856,7 @@ export async function getMiddlewareBundle({
return {
type,
page: edgeFunction.page,
name: edgeFunction.name,
edgeFunction: (() => {
const { source, map } = wrappedModuleSource.sourceAndMap();
const transformedMap = stringifySourceMap(
@@ -2943,8 +2952,7 @@ export async function getMiddlewareBundle({
};
for (const worker of workerConfigs.values()) {
const edgeFile = worker.edgeFunction.name;
let shortPath = edgeFile;
let shortPath = worker.name;
// Replacing the folder prefix for the page
//

View File

@@ -9,6 +9,10 @@ module.exports = {
source: '/rewritten-to-dashboard',
destination: '/dashboard',
},
{
source: '/rewritten-to-index',
destination: '/?fromRewrite=1',
},
];
},
};

View File

@@ -18,6 +18,54 @@
}
],
"probes": [
{
"path": "/rewritten-to-dashboard",
"status": 200,
"mustContain": "html"
},
{
"path": "/rewritten-to-dashboard",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1,
"Next-Router-Prefetch": 1
}
},
{
"path": "/rewritten-to-dashboard",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1
}
},
{
"path": "/rewritten-to-index",
"status": 200,
"mustContain": "html"
},
{
"path": "/rewritten-to-index",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1,
"Next-Router-Prefetch": 1
}
},
{
"path": "/rewritten-to-index",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1
}
},
{
"path": "/catch-all",
"status": 200,

View File

@@ -10,6 +10,10 @@ module.exports = {
source: '/rewritten-to-dashboard',
destination: '/dashboard',
},
{
source: '/rewritten-to-index',
destination: '/?fromRewrite=1',
},
];
},
};

View File

@@ -18,6 +18,54 @@
}
],
"probes": [
{
"path": "/rewritten-to-dashboard",
"status": 200,
"mustContain": "html"
},
{
"path": "/rewritten-to-dashboard",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1,
"Next-Router-Prefetch": 1
}
},
{
"path": "/rewritten-to-dashboard",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1
}
},
{
"path": "/rewritten-to-index",
"status": 200,
"mustContain": "html"
},
{
"path": "/rewritten-to-index",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1,
"Next-Router-Prefetch": 1
}
},
{
"path": "/rewritten-to-index",
"status": 200,
"mustContain": ":",
"mustNotContain": "<html",
"headers": {
"RSC": 1
}
},
{
"path": "/catch-all",
"status": 200,

View File

@@ -1,5 +1,36 @@
# @vercel/node
## 3.0.17
### Patch Changes
- Updated dependencies [[`cdddb33ad`](https://github.com/vercel/vercel/commit/cdddb33ad49f6080c49f4fff3767e6111acd0bbe)]:
- @vercel/build-utils@7.5.1
## 3.0.16
### Patch Changes
- Deprecate `EdgeFunction#name` property ([#11010](https://github.com/vercel/vercel/pull/11010))
- Updated dependencies [[`98040ec24`](https://github.com/vercel/vercel/commit/98040ec24e1ee585865d11eb216b6525d39d209e)]:
- @vercel/build-utils@7.5.0
## 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))
## 3.0.14
### Patch Changes
- Updated dependencies [[`67fa2f3dd`](https://github.com/vercel/vercel/commit/67fa2f3dd6a6d5a3504b7f9081e56deff7b36eab)]:
- @vercel/build-utils@7.4.1
## 3.0.13
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "3.0.13",
"version": "3.0.17",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -24,15 +24,14 @@
"@edge-runtime/primitives": "4.0.5",
"@edge-runtime/vm": "3.1.7",
"@types/node": "14.18.33",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"@vercel/error-utils": "2.0.2",
"@vercel/nft": "0.24.2",
"@vercel/nft": "0.26.2",
"@vercel/static-config": "3.0.0",
"async-listen": "3.0.0",
"edge-runtime": "2.5.7",
"esbuild": "0.14.47",
"etag": "1.8.1",
"exit-hook": "2.2.1",
"node-fetch": "2.6.9",
"path-to-regexp": "6.2.1",
"ts-morph": "12.0.0",
@@ -55,6 +54,7 @@
"execa": "3.2.0",
"fs-extra": "11.1.0",
"jest-junit": "16.0.0",
"source-map-support": "0.5.12"
"source-map-support": "0.5.12",
"tree-kill": "1.2.2"
}
}

View File

@@ -24,7 +24,10 @@ async function createEventHandler(
entrypoint: string,
config: Config,
options: { shouldAddHelpers: boolean }
): Promise<(request: IncomingMessage) => Promise<VercelProxyResponse>> {
): Promise<{
handler: (request: IncomingMessage) => Promise<VercelProxyResponse>;
onExit: (() => Promise<void>) | undefined;
}> {
const entrypointPath = join(process.cwd(), entrypoint!);
const staticConfig = parseConfig(entrypointPath);
@@ -51,6 +54,7 @@ async function createEventHandler(
let handleEvent: (request: IncomingMessage) => Promise<VercelProxyResponse>;
let handlerEventError: Error;
let onExit: (() => Promise<void>) | undefined;
async function main() {
const config = JSON.parse(process.env.VERCEL_DEV_CONFIG || '{}');
@@ -67,9 +71,11 @@ async function main() {
await listen(proxyServer, { host: '127.0.0.1', port: 0 });
try {
handleEvent = await createEventHandler(entrypoint!, config, {
const result = await createEventHandler(entrypoint!, config, {
shouldAddHelpers,
});
handleEvent = result.handler;
onExit = result.onExit;
} catch (error: any) {
logError(error);
handlerEventError = error;
@@ -129,3 +135,17 @@ main().catch(err => {
logError(err);
process.exit(1);
});
process.on('message', async m => {
switch (m) {
case 'shutdown':
if (onExit) {
await onExit();
}
process.exit(0);
default:
console.error(`unknown IPC message from parent:`, m);
break;
}
});

View File

@@ -9,11 +9,11 @@ import { isError } from '@vercel/error-utils';
import { readFileSync } from 'fs';
import { serializeBody, entrypointToOutputPath, logError } from '../utils.js';
import esbuild from 'esbuild';
import exitHook from 'exit-hook';
import { buildToHeaders } from '@edge-runtime/node-utils';
import type { VercelProxyResponse } from '../types.js';
import type { IncomingMessage } from 'http';
import { fileURLToPath } from 'url';
import { EdgeRuntimeServer } from 'edge-runtime/dist/server/run-server.js';
const NODE_VERSION_MAJOR = process.version.match(/^v(\d+)\.\d+/)?.[1];
const NODE_VERSION_IDENTIFIER = `node${NODE_VERSION_MAJOR}`;
@@ -127,7 +127,9 @@ async function createEdgeRuntimeServer(params?: {
userCode: string;
wasmAssets: WasmAssets;
nodeCompatBindings: NodeCompatBindings;
}) {
}): Promise<
{ server: EdgeRuntimeServer; onExit: () => Promise<void> } | undefined
> {
try {
if (!params) {
return undefined;
@@ -162,8 +164,34 @@ async function createEdgeRuntimeServer(params?: {
});
const server = await runServer({ runtime });
exitHook(() => server.close());
return server;
const onExit = async () => {
// When exiting this process, wait for the Edge Runtime server to finish
// all its work, especially waitUntil promises before exiting this process.
//
// Here we use a short timeout (10 seconds) to let the user know that
// it has a long-running waitUntil promise.
const WAIT_UNTIL_TIMEOUT = 10 * 1000;
const waitUntil = server.close();
return new Promise<void>((resolve, reject) => {
const timeout = setTimeout(() => {
console.warn(
`Edge Runtime server is still running after ${WAIT_UNTIL_TIMEOUT} ms` +
` (hint: do you have a long-running waitUntil() promise?)`
);
resolve();
}, WAIT_UNTIL_TIMEOUT);
waitUntil
.then(() => resolve())
.catch(reject)
.finally(() => {
clearTimeout(timeout);
});
});
};
return { server, onExit };
} catch (error: any) {
// We can't easily show a meaningful stack trace from esbuild -> edge-runtime.
// So, stick with just the message for now.
@@ -178,15 +206,22 @@ export async function createEdgeEventHandler(
entrypointRelativePath: string,
isMiddleware: boolean,
isZeroConfig?: boolean
): Promise<(request: IncomingMessage) => Promise<VercelProxyResponse>> {
): Promise<{
handler: (request: IncomingMessage) => Promise<VercelProxyResponse>;
onExit: (() => Promise<void>) | undefined;
}> {
const userCode = await compileUserCode(
entrypointFullPath,
entrypointRelativePath,
isMiddleware
);
const server = await createEdgeRuntimeServer(userCode);
const result = await createEdgeRuntimeServer(userCode);
const server = result?.server;
const onExit = result?.onExit;
return async function (request: IncomingMessage) {
const handler = async function (
request: IncomingMessage
): Promise<VercelProxyResponse> {
if (!server) {
// this error state is already logged, but we have to wait until here to exit the process
// this matches the serverless function bridge launcher's behavior when
@@ -234,6 +269,11 @@ export async function createEdgeEventHandler(
encoding: 'utf8',
};
};
return {
handler,
onExit,
};
}
function entrypointToRequestPath(

View File

@@ -64,6 +64,8 @@ import {
forkDevServer,
readMessage as readDevServerMessage,
} from './fork-dev-server';
import _treeKill from 'tree-kill';
import { promisify } from 'util';
export { shouldServe };
@@ -84,6 +86,8 @@ const tscPath = resolve(dirname(require_.resolve('typescript')), '../bin/tsc');
// eslint-disable-next-line no-useless-escape
const libPathRegEx = /^node_modules|[\/\\]node_modules[\/\\]/;
const treeKill = promisify(_treeKill);
async function downloadInstallAndBundle({
files,
entrypoint,
@@ -479,9 +483,6 @@ export const build: BuildV3 = async ({
entrypoint: handler,
files: preparedFiles,
regions: staticConfig?.regions,
// TODO: remove - these two properties should not be required
name: outputPath,
deploymentTarget: 'v8-worker',
});
} else {
@@ -653,7 +654,21 @@ export const startDevServer: StartDevServer = async opts => {
});
}
return { port: message.value.port, pid };
// An optional callback for graceful shutdown.
const shutdown = async () => {
// Send a "shutdown" message to the child process. Ideally we'd use a signal
// (SIGTERM) here, but that doesn't work on Windows. This is a portable way
// to tell the child process to exit gracefully.
child.send('shutdown', async err => {
if (err) {
// The process might have already exited, for example, if the application
// handler threw an error. Try terminating the process to be sure.
await treeKill(pid);
}
});
};
return { port: message.value.port, pid, shutdown };
} else {
// Got "exit" event from child process
const [exitCode, signal] = message.value;

View File

@@ -1,7 +1,6 @@
import { addHelpers } from './helpers.js';
import { createServer } from 'http';
import { serializeBody } from '../utils.js';
import exitHook from 'exit-hook';
import { type Dispatcher, Headers, request as undiciRequest } from 'undici';
import { listen } from 'async-listen';
import { isAbsolute } from 'path';
@@ -38,10 +37,16 @@ const HTTP_METHODS = [
'PATCH',
];
async function createServerlessServer(userCode: ServerlessFunctionSignature) {
async function createServerlessServer(
userCode: ServerlessFunctionSignature
): Promise<{ url: URL; onExit: () => Promise<void> }> {
const server = createServer(userCode);
exitHook(() => server.close());
return { url: await listen(server) };
return {
url: await listen(server),
onExit: async () => {
server.close();
},
};
}
async function compileUserCode(
@@ -79,12 +84,17 @@ async function compileUserCode(
export async function createServerlessEventHandler(
entrypointPath: string,
options: ServerlessServerOptions
): Promise<(request: IncomingMessage) => Promise<VercelProxyResponse>> {
): Promise<{
handler: (request: IncomingMessage) => Promise<VercelProxyResponse>;
onExit: () => Promise<void>;
}> {
const userCode = await compileUserCode(entrypointPath, options);
const server = await createServerlessServer(userCode);
const isStreaming = options.mode === 'streaming';
return async function (request: IncomingMessage) {
const handler = async function (
request: IncomingMessage
): Promise<VercelProxyResponse> {
const url = new URL(request.url ?? '/', server.url);
const response = await undiciRequest(url, {
body: await serializeBody(request),
@@ -111,4 +121,9 @@ export async function createServerlessEventHandler(
encoding: 'utf8',
};
};
return {
handler,
onExit: server.onExit,
};
}

View File

@@ -0,0 +1,24 @@
/* global Response */
export const config = { runtime: 'edge' };
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function doSlowWork(pingUrl) {
// Wait for 1 second: if this waitUntil promise is not awaited before
// exiting dev server, the pingUrl won't be fetched.
await sleep(1000);
await fetch(pingUrl);
}
export default async (req, ctx) => {
const pingUrl = req.headers.get('x-ping-url');
if (!pingUrl) {
throw new Error('x-ping-url is not set');
}
ctx.waitUntil(doSlowWork(pingUrl));
return new Response('running waitUntil promises asynchronously...');
};

View File

@@ -307,3 +307,88 @@ test('allow setting multiple cookies with same name', async () => {
child.kill(9);
}
});
test('dev server waits for waitUntil promises to resolve', async () => {
async function startPingServer() {
let resolve: (value: any) => void;
const promise = new Promise<void>(resolve_ => {
resolve = resolve_;
});
const pingServer = createServer((req, res) => {
res.end('pong');
resolve('got a fetch from waitUntil');
});
const pingUrl = (await listen(pingServer)).toString();
return {
pingUrl,
pingServer,
promise,
};
}
async function withTimeout(
promise: Promise<unknown>,
name: string,
ms: number
) {
return await Promise.race([
promise,
new Promise(resolve =>
setTimeout(
() => resolve(`${name} promise was not resolved in ${ms} ms`),
ms
)
),
]);
}
const { promise: pingPromise, pingServer, pingUrl } = await startPingServer();
const child = testForkDevServer('./edge-waituntil.js');
const exitPromise = new Promise(resolve => {
child.on('exit', code => {
resolve(`child has exited with ${code}`);
});
});
try {
const result = await readMessage(child);
if (result.state !== 'message') {
throw new Error('Exited. error: ' + JSON.stringify(result.value));
}
const { address, port } = result.value;
const response = await fetch(
`http://${address}:${port}/api/edge-waituntil`,
{
headers: {
'x-ping-url': pingUrl,
},
}
);
expect({
status: response.status,
body: await response.text(),
}).toEqual({
status: 200,
body: 'running waitUntil promises asynchronously...',
});
// Dev server should keep running until waitUntil promise resolves...
child.send('shutdown');
// Wait for waitUntil promise to resolve...
expect(await withTimeout(pingPromise, 'ping server', 3000)).toBe(
'got a fetch from waitUntil'
);
// Make sure child process has exited.
expect(await withTimeout(exitPromise, 'child exit', 5000)).toBe(
'child has exited with 0'
);
} finally {
child.kill(9);
pingServer.close();
}
});

View File

@@ -1,5 +1,11 @@
# @vercel/python
## 4.1.1
### Patch Changes
- Remove deprecated `createLambda()` usage ([#11080](https://github.com/vercel/vercel/pull/11080))
## 4.1.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/python",
"version": "4.1.0",
"version": "4.1.1",
"main": "./dist/index.js",
"license": "Apache-2.0",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -26,7 +26,7 @@
"@types/jest": "27.4.1",
"@types/node": "14.18.33",
"@types/which": "3.0.0",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"execa": "^1.0.0",
"fs-extra": "11.1.1",
"jest-junit": "16.0.0",

View File

@@ -1,23 +1,27 @@
import { join, dirname, basename } from 'path';
import execa from 'execa';
import fs from 'fs';
import execa from 'execa';
import { promisify } from 'util';
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
import { join, dirname, basename } from 'path';
import {
GlobOptions,
BuildOptions,
getWriteableDirectory,
download,
glob,
createLambda,
Lambda,
FileBlob,
shouldServe,
debug,
NowBuildError,
type BuildOptions,
type GlobOptions,
type BuildV3,
type Files,
} from '@vercel/build-utils';
import { installRequirement, installRequirementsFile } from './install';
import { getLatestPythonVersion, getSupportedPythonVersion } from './version';
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
async function pipenvConvert(cmd: string, srcDir: string) {
debug('Running pipfile2req...');
try {
@@ -53,13 +57,13 @@ export async function downloadFilesInWorkPath({
return workPath;
}
export const build = async ({
export const build: BuildV3 = async ({
workPath,
files: originalFiles,
entrypoint,
meta = {},
config,
}: BuildOptions) => {
}) => {
let pythonVersion = getLatestPythonVersion(meta);
workPath = await downloadFilesInWorkPath({
@@ -190,12 +194,6 @@ export const build = async ({
.replace(/__VC_HANDLER_MODULE_NAME/g, moduleName)
.replace(/__VC_HANDLER_ENTRYPOINT/g, entrypointWithSuffix);
// in order to allow the user to have `server.py`, we need our `server.py` to be called
// somethig else
const handlerPyFilename = 'vc__handler__python';
await writeFile(join(workPath, `${handlerPyFilename}.py`), handlerPyContents);
const globOptions: GlobOptions = {
cwd: workPath,
ignore:
@@ -204,14 +202,22 @@ export const build = async ({
: 'node_modules/**',
};
const lambda = await createLambda({
files: await glob('**', globOptions),
const files: Files = await glob('**', globOptions);
// in order to allow the user to have `server.py`, we
// need our `server.py` to be called something else
const handlerPyFilename = 'vc__handler__python';
files[`${handlerPyFilename}.py`] = new FileBlob({ data: handlerPyContents });
const output = new Lambda({
files,
handler: `${handlerPyFilename}.vc_handler`,
runtime: pythonVersion.runtime,
environment: {},
});
return { output: lambda };
return { output };
};
export { shouldServe };

View File

@@ -1,2 +1,2 @@
fastapi==0.54.1
pydantic==1.5
fastapi==0.109.0
pydantic==2.5.3

View File

@@ -1,5 +1,11 @@
# @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))
## 2.0.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/redwood",
"version": "2.0.5",
"version": "2.0.6",
"main": "./dist/index.js",
"license": "Apache-2.0",
"homepage": "https://vercel.com/docs",
@@ -20,7 +20,7 @@
"type-check": "tsc --noEmit"
},
"dependencies": {
"@vercel/nft": "0.24.2",
"@vercel/nft": "0.26.2",
"@vercel/routing-utils": "3.1.0",
"semver": "6.3.1"
},
@@ -28,7 +28,7 @@
"@types/aws-lambda": "8.10.19",
"@types/node": "14.18.33",
"@types/semver": "6.0.0",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"jest-junit": "16.0.0"

View File

@@ -1,5 +1,29 @@
# @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))
## 2.0.17
### Patch Changes
- Deprecate `EdgeFunction#name` property ([#11010](https://github.com/vercel/vercel/pull/11010))
## 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))
## 2.0.15
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix-builder",
"version": "2.0.15",
"version": "2.0.18",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -21,16 +21,16 @@
"defaults"
],
"dependencies": {
"@vercel/nft": "0.24.2",
"@vercel/nft": "0.26.2",
"@vercel/static-config": "3.0.0",
"ts-morph": "12.0.0"
},
"devDependencies": {
"@remix-run/dev": "npm:@vercel/remix-run-dev@2.4.0",
"@remix-run/dev": "npm:@vercel/remix-run-dev@2.5.1",
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@types/semver": "7.3.13",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"jest-junit": "16.0.0",
"path-to-regexp": "6.2.1",
"semver": "7.5.2"

View File

@@ -540,17 +540,7 @@ module.exports = config;`;
throw new Error(`Could not determine server bundle for "${route.id}"`);
}
output[path] =
func instanceof EdgeFunction
? // `EdgeFunction` currently requires the "name" property to be set.
// Ideally this property will be removed, at which point we can
// return the same `edgeFunction` instance instead of creating a
// new one for each page.
new EdgeFunction({
...func,
name: path,
})
: func;
output[path] = func;
// If this is a dynamic route then add a Vercel route
const re = getRegExpFromPath(rePath);
@@ -573,10 +563,7 @@ module.exports = config;`;
);
const func =
edgeFunctionIndex !== -1 ? functions[edgeFunctionIndex] : functions[0];
output['404'] =
func instanceof EdgeFunction
? new EdgeFunction({ ...func, name: '404' })
: func;
output['404'] = func;
}
routes.push({
src: '/(.*)',
@@ -767,7 +754,6 @@ async function createRenderEdgeFunction(
const fn = new EdgeFunction({
files,
deploymentTarget: 'v8-worker',
name: 'render',
entrypoint: handler,
regions: config.regions,
framework: {

View File

@@ -148,7 +148,9 @@ export function getPathFromRoute(
): ResolvedRoutePaths {
if (
route.id === 'root' ||
(route.parentId === 'root' && !route.path && route.index)
(route.parentId === 'root' &&
(!route.path || route.path === '/') &&
route.index)
) {
return { path: 'index', rePath: '/index' };
}

View File

@@ -112,10 +112,19 @@ describe('getPathFromRoute()', () => {
parentId: 'root',
file: 'routes/admin.(lol).tsx',
},
manual: {
path: '/',
index: true,
caseSensitive: undefined,
id: 'manual',
parentId: 'root',
file: 'manual.tsx',
},
};
it.each([
{ id: 'root', expected: { path: 'index', rePath: '/index' } },
{ id: 'manual', expected: { path: 'index', rePath: '/index' } },
{ id: 'routes/__pathless', expected: { path: '', rePath: '/' } },
{ id: 'routes/index', expected: { path: 'index', rePath: '/index' } },
{

View File

@@ -1,5 +1,13 @@
# @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))
## 2.0.4
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@vercel/ruby",
"author": "Nathan Cahill <nathan@nathancahill.com>",
"version": "2.0.4",
"version": "2.0.5",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -23,7 +23,7 @@
"devDependencies": {
"@types/fs-extra": "8.0.0",
"@types/semver": "6.0.0",
"@vercel/build-utils": "7.4.0",
"@vercel/build-utils": "7.5.1",
"execa": "2.0.4",
"fs-extra": "^7.0.1",
"jest-junit": "16.0.0",

View File

@@ -10,14 +10,16 @@ import {
writeFile,
} from 'fs-extra';
import {
BuildOptions,
download,
getWriteableDirectory,
glob,
createLambda,
Lambda,
debug,
walkParentDirs,
cloneEnv,
FileBlob,
type Files,
type BuildV3,
} from '@vercel/build-utils';
import { installBundler } from './install-ruby';
@@ -46,6 +48,7 @@ async function bundleInstall(
bundlePath: string,
bundleDir: string,
gemfilePath: string,
rubyPath: string,
runtime: string
) {
debug(`running "bundle install --deployment"...`);
@@ -74,7 +77,7 @@ async function bundleInstall(
const bundlerEnv = cloneEnv(process.env, {
// Ensure the correct version of `ruby` is in front of the $PATH
PATH: `${dirname(bundlePath)}:${process.env.PATH}`,
PATH: `${dirname(rubyPath)}:${dirname(bundlePath)}:${process.env.PATH}`,
BUNDLE_SILENCE_ROOT_WARNING: '1',
BUNDLE_APP_CONFIG: bundleAppConfig,
BUNDLE_JOBS: '4',
@@ -114,13 +117,13 @@ async function bundleInstall(
export const version = 3;
export async function build({
export const build: BuildV3 = async ({
workPath,
files,
entrypoint,
config,
meta = {},
}: BuildOptions) {
}) => {
await download(files, workPath, meta);
const entrypointFsDirname = join(workPath, dirname(entrypoint));
const gemfileName = 'Gemfile';
@@ -140,10 +143,8 @@ export async function build({
const gemfileContents = gemfilePath
? await readFile(gemfilePath, 'utf8')
: '';
const { gemHome, bundlerPath, vendorPath, runtime } = await installBundler(
meta,
gemfileContents
);
const { gemHome, bundlerPath, vendorPath, runtime, rubyPath } =
await installBundler(meta, gemfileContents);
process.env.GEM_HOME = gemHome;
debug(`Checking existing vendor directory at "${vendorPath}"`);
const vendorDir = join(workPath, vendorPath);
@@ -187,7 +188,13 @@ export async function build({
} else {
// try installing. this won't work if native extesions are required.
// if that's the case, gems should be vendored locally before deploying.
await bundleInstall(bundlerPath, bundleDir, gemfilePath, runtime);
await bundleInstall(
bundlerPath,
bundleDir,
gemfilePath,
rubyPath,
runtime
);
}
}
} else {
@@ -217,12 +224,11 @@ export async function build({
// somethig else
const handlerRbFilename = 'vc__handler__ruby';
await writeFile(
join(workPath, `${handlerRbFilename}.rb`),
nowHandlerRbContents
);
const outputFiles: Files = await glob('**', workPath);
const outputFiles = await glob('**', workPath);
outputFiles[`${handlerRbFilename}.rb`] = new FileBlob({
data: nowHandlerRbContents,
});
// static analysis is impossible with ruby.
// instead, provide `includeFiles` and `excludeFiles` config options to reduce bundle size.
@@ -253,12 +259,12 @@ export async function build({
}
}
const lambda = await createLambda({
const output = new Lambda({
files: outputFiles,
handler: `${handlerRbFilename}.vc__handler`,
runtime,
environment: {},
});
return { output: lambda };
}
return { output };
};

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