Compare commits

...

52 Commits

Author SHA1 Message Date
Sean Massa
54514a44af Publish Stable
- @vercel/build-utils@6.6.0
 - vercel@28.18.2
 - @vercel/client@12.4.7
 - @vercel/fs-detectors@3.8.7
 - @vercel/gatsby-plugin-vercel-builder@1.2.5
 - @vercel/go@2.4.2
 - @vercel/hydrogen@0.0.60
 - @vercel/next@3.7.2
 - @vercel/node-bridge@4.0.0
 - @vercel/node@2.10.1
 - @vercel/python@3.1.56
 - @vercel/redwood@1.1.12
 - @vercel/remix-builder@1.8.2
 - @vercel/ruby@1.3.73
 - @vercel/static-build@1.3.20
2023-03-27 22:25:08 -05:00
Ethan Arrowood
0db8fadf74 [build-utils] add pnpm v8 auto detection (#9720)
Adds automatic detection for pnpm v8 based on lockfile v6
2023-03-27 23:07:39 +00:00
Sean Massa
6f01e5ab75 [cli] support build -y shorthand (#9717)
The `build` command wasn't supporting the `-y` shorthand for `--yes`. Now it does.

I looked at the other uses and they all seem fine.
2023-03-27 15:18:16 +00:00
Kiko Beats
78d45f9e7e [node-bridge] add feature flags support (#9713)
This PR allows executing conditional logic based in feature flags.

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-03-26 10:34:12 +02:00
Kiko Beats
22e1a6a9ce [node-bridge]: remove API Gateway normalization (#9711)
We no longer use since a long time ago
2023-03-24 20:12:36 +01:00
Steven
8391734b5e [build-utils] Fix system env var detection for prefixed env vars (#9709)
This PR fixes a bug that was causing too many env vars to be exposed to the frontend by adding the framework `envPrefix`.

Some frameworks, such as CRA, will include all of these in the frontend even if not explicitly used so we must only prefix known [System Environment Variables](https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables).

This PR adds an allowlist to ensure this is handle properly.

- Fixes https://linear.app/vercel/issue/VCCLI-639
2023-03-24 05:45:27 +00:00
Sean Massa
6a7fa1526c Publish Stable
- vercel@28.18.1
 - @vercel/gatsby-plugin-vercel-builder@1.2.4
 - @vercel/next@3.7.1
 - @vercel/node@2.10.0
 - @vercel/remix-builder@1.8.1
 - @vercel/static-build@1.3.19
2023-03-23 14:45:33 -05:00
Nathan Rajlich
64b15d2409 [remix] Fix zero matching on sub catch-all routes (#9707)
Fixes https://github.com/vercel/remix/issues/20.
2023-03-23 12:35:46 -07:00
Gal Schlezinger
40f73e7978 [node] support node:[lib] in vc dev (#9694)
- [node] add edge-node-compat-plugin
- [node] implement edge-handler
2023-03-23 17:48:49 +00:00
Nathan Rajlich
4c9ca27195 [examples] Remove entry.server.tsx file from "remix" template (#9698)
This file is now optional, and a default implementation is used when the
file does not exist.
2023-03-23 11:35:05 -04:00
Steven
a847ef43fd [tests] Try publishing with provenance (#9706)
This is a follow up to #9583 since it didn't work as expected.
2023-03-23 11:34:46 -04:00
JJ Kasper
3b466232a9 [next] Remove extra env variables (#9704)
These env variables were temporarily added to bust turbo/nx cache although this should no longer be needed as a proper fix has been landed in Next.js itself. 

x-ref: [slack thread](https://vercel.slack.com/archives/C04Q0GWSB8W/p1679518040946589)
2023-03-22 21:36:40 +00:00
Chris Barber
efdeea9db2 [tests] Disable Turbo's update notifier (#9302)
Since switching to the canary releases of Turbo, we are seeing the
update notification often. We have a cron job
(https://github.com/vercel/vercel/pull/9301) that will keep this
up-to-date for us, so we don't need to have Turbo notify us of updates.

<img width="587" alt="image"
src="https://user-images.githubusercontent.com/97262/214372374-a2682014-2deb-4942-b694-fd140c26a6ef.png">
2023-03-22 14:39:36 -05:00
Sean Massa
ab9915af32 Publish Stable
- @vercel/build-utils@6.5.0
 - vercel@28.18.0
 - @vercel/client@12.4.6
 - @vercel/fs-detectors@3.8.6
 - @vercel/gatsby-plugin-vercel-builder@1.2.3
 - @vercel/go@2.4.1
 - @vercel/hydrogen@0.0.59
 - @vercel/next@3.7.0
 - @vercel/node@2.9.14
 - @vercel/python@3.1.55
 - @vercel/redwood@1.1.11
 - @vercel/remix-builder@1.8.0
 - @vercel/ruby@1.3.72
 - @vercel/static-build@1.3.18
2023-03-22 12:37:51 -05:00
Chris Barber
d6dc27638c [build-utils][next] Add prerender source path (#9686)
Adds the `sourcePath` for ISR prerender lambdas so that the front end can associate derived pages with the source route.

There's an accompanying `api` PR (https://github.com/vercel/api/pull/17940) which uses this deployment's tarballs to test the functionality. Here's the result:

![image](https://user-images.githubusercontent.com/97262/226947180-a8e6b75e-f6a5-44fa-8034-08bd24569f3f.png)

Linear: https://linear.app/vercel/issue/VCCLI-410/communicate-how-functions-are-bundled
2023-03-22 17:16:44 +00:00
Sean Massa
0fb0601d19 [node] Improve edge-handler-template error handling (#9697) 2023-03-22 11:31:44 -05:00
Nathan Rajlich
ce25dec97d [remix] Inject @vercel/remix package instead of @vercel/remix-entry-server (#9684)
The `handleRequest()` function has been moved to the `@vercel/remix` package, so we can deprecate `@vercel/remix-entry-server` entirely and install `@vercel/remix` in the project instead, when there is no `app/entry.server.tsx` file defined in the project already.
2023-03-22 01:06:14 +00:00
Nathan Rajlich
20bd71ce70 [node][remix] Update nft conditions to include "edge-light" for Edge Functions (#9700) 2023-03-21 23:59:49 +00:00
Sean Massa
4c77dab5cb [tests][cli] convert CLI integration tests to TS (#9672)
Converts the CLI integration tests to TypeScript. This will make it easier to pick apart the test pollution.
2023-03-18 18:21:45 +00:00
Sean Massa
151b0dfb63 [cli] handle BUILD_UTILS_SPAWN_* errors (#9689)
Some condition in the system caused `BUILD_UTILS_SPAWN_1` errors to be thrown for failed deployments. The error handling logic wasn't handling this properly, causing the error message to never show up in the output.

```
Error: Unexpected error. Please try again later. ()
```
2023-03-17 22:12:23 +00:00
Nathan Rajlich
42e9bbea5b [examples] Update "remix" template to use @vercel/remix package (#9683) 2023-03-17 21:47:05 +00:00
Steven
c0471302e9 [cli] Ignore vc build subdirectory warning on vercel (#9685)
This warning is only relevant when running `vc build` locally so we can hide it for Vercel deployments.

I noticed this in the build logs here:

<img width="862" alt="image" src="https://user-images.githubusercontent.com/229881/225774670-9b4aecf5-d020-489f-819f-7b55ce96f877.png">
2023-03-16 23:57:33 +00:00
Nathan Rajlich
b2c68f1301 Publish Stable
- @vercel/build-utils@6.4.0
 - vercel@28.17.0
 - @vercel/client@12.4.5
 - @vercel/frameworks@1.3.3
 - @vercel/fs-detectors@3.8.5
 - @vercel/gatsby-plugin-vercel-builder@1.2.2
 - @vercel/go@2.4.0
 - @vercel/hydrogen@0.0.58
 - @vercel/next@3.6.7
 - @vercel/node@2.9.13
 - @vercel/python@3.1.54
 - @vercel/redwood@1.1.10
 - @vercel/remix-builder@1.7.0
 - @vercel/routing-utils@2.1.11
 - @vercel/ruby@1.3.71
 - @vercel/static-build@1.3.17
 - @vercel/static-config@2.0.14
2023-03-16 12:23:51 -07:00
Vedant
9712640fe3 [go] Add support for Go 1.20 (#9367)
Co-authored-by: Chris Barber <chris.barber@vercel.com>
2023-03-16 14:11:49 -05:00
Chris Barber
0dd3711f63 [go] Go builder improvements (#9576)
This PR fixes a handful of Go builder issues all related to the selected Golang version being used to build the function:

- `go.mod` version ignored for `vc build` and `vc dev`, uses system `PATH` version only
- `vc dev` fails if `go.mod` does not exist
- If the analyze bin doesn’t exist, downloads golang into `.vercel/cache/golang` instead of a global shared dir
- When running `vc dev`, doesn’t reuse go build code/common settings
- go tidy fails when `go.mod` set to 1.19 or 1.20, but 1.18 or older is installed
- `vc build` builds wrong arch on Apple Silicon/arm64
- `vc build` on Windows doesn't properly resolve "builds" in `vercel.json` due to posix separator issue
- `vc build` on Windows fails with `package <pkg/name> is not in GOROOT` due to posix separator issue
- Removed `actions/setup-go` from all test workflows

I added a test that tests the `go tidy` issue.
2023-03-16 19:05:09 +00:00
Chris Barber
4b657debed [cli] Honor --local-config when present during vc build (#9675)
As reported https://github.com/vercel/vercel/discussions/9648, `vc build` does not honor the `--local-config <file>` option.

`vc build` will only load the `vercel.json` (or `now.json`) in the `workPath` which is based on the `rootDirctory`.

If `--local-config` is specified in the command line arguments, then it should take precedence.
2023-03-16 18:31:43 +00:00
Sean Massa
ffdca76155 [gatsby-plugin-vercel-builder] link instead of move (#9673)
When creating the `./vercel/output/static` dir...

**Moving the `public` dir** is what currently happens. This causes Gatsby to believe that the build was not complete:

> info We've detected that the Gatsby cache is incomplete (the .cache directory exists but the public directory does not). As a precaution, we're deleting your site's cache to ensure there's no stale data.

**Copying the `public` dir** is not an option because it can cause a build to run out of space.

**Symlinking the `public` dir** would work, but it would require more changes throughout the system to make sure the symlink was followed properly.

**Hard Linking the `public` dir's files** is the best option. This PR links the directories instead of moving them. We did look for a library that already does the `hardlinkFileTree` thing, but couldn't find one.

---

**Testing**

This was manually tested with real deployments.

---

* paired with @TooTallNate 
* [user report](https://github.com/vercel/vercel/issues/9452#issuecomment-1432858615)
2023-03-16 18:00:56 +00:00
Vladislav Ponomarev
af7b34aa45 [node] Handle multi-protocol in Edge Functions (#9502)
Co-authored-by: Chris Barber <chris.barber@vercel.com>
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
fix #9501
2023-03-16 11:01:07 -05:00
Sean Massa
e210977a9c [tests] update python tests to use zero config (#9668)
This PR is some cleanup before splitting python e2e tests.

Changes:

- use `probes.json`
- use `/api` autodetection instead of `builds` array

---

I was also trying to figure out why these tests are so much faster when run locally (293s) vs. CI (1099s). I encountered issues trying to view the build logs for the deployments that are made.
2023-03-16 14:41:40 +00:00
Nathan Rajlich
1c2ef37173 [remix] Remove symlink creation warning (#9679)
We're now going to encourage users to use `@vercel/remix` instead of `@remix-run/node`. So switch the symlink warning to a `debug()` call instead.
2023-03-16 09:47:13 +00:00
matamatanot
65bbcd3e62 [Astro example] Replace npm with pnpm (#9662)
Based on lockfile and `.npmrc`, pnpm seems to be correct.
2023-03-14 17:52:04 -07:00
Vercel Release Bot
5caf73380d [remix] Upgrade @remix-run/dev to version 1.14.2 (#9676)
This auto-generated PR updates @remix-run/dev to version 1.14.2
2023-03-15 00:32:54 +00:00
Sean Massa
395929b36a [tests] remove comment (#9671)
We don't need this comment.
2023-03-14 16:18:56 +00:00
Sean Massa
0e235a926a [tests][cli] CLI Integration tests - better failure messages (#9667)
Co-authored-by: Steven <steven@ceriously.com>
2023-03-14 10:48:27 -05:00
Nathan Rajlich
f1bdc0bfd1 [remix] Rename @vercel/remix to @vercel/remix-builder (#9665)
We're changing the name of the Remix Builder to free up the name `@vercel/remix` for user-facing usage within Remix applications.
2023-03-13 22:10:52 +00:00
Amy
59ca86365c [docs] Update issue and discussion templates (#9666)
Updates the existing [issue
template](https://github.com/vercel/vercel/issues/new/choose) and adds
[new discussion
forms](https://docs.github.com/en/discussions/managing-discussions-for-your-community/syntax-for-discussion-category-forms)
to direct Vercel platform questions to
https://github.com/vercel/community/discussions

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-03-13 17:27:50 -04:00
Nathan Rajlich
13d54b2095 [remix] Support optional entry.{server,client}.tsx file (#9620)
Remix v1.14.0 added support for having no `app/entry.server.tsx`/`app/entry.client.tsx` files in a project (there are default versions bundled into `@remix-run/dev`). Projects configured like this are currently failing because we symlink our forked version of the `remix` CLI into the project, so it cannot resolve the necessary modules at build time.

To solve this, instead of relying on the default versions of these files in `@remix-run/dev` package, we'll include our own versions in `@vercel/remix`, and physically copy them into the project dir. This way, the modules used will be properly resolved relative to the project's own `node_modules` dir.

Our default version of `app/entry.server.tsx` is also slightly different then upstream one, because it uses `@vercel/remix-entry-server` to enable isomorphic React streaming on both Node + Edge runtimes. Because of this, if that dependency is not present, then we'll automatically install the dependency at build-time.
2023-03-13 20:47:56 +00:00
Steven
bada86b8d6 [tests] Add prettier check (#9664)
This PR fixes the formatting on several files that were never run through `prettier`.

It also makes sure to run `prettier` in CI to to [fail fast](https://github.com/vercel/vercel/actions/runs/4408442998/jobs/7723453978) when the incorrect formatting is attempted.
2023-03-13 19:55:59 +00:00
Ethan Arrowood
7ec377757d [cli] update monorepo default setting log (#9654)
Updates the `setMonorepoDefaultSetting` log
2023-03-10 19:23:38 +00:00
Vercel Release Bot
8040c8806b [examples] Upgrade Next.js to version 13.2.4 (#9647)
This auto-generated PR updates Next.js to version 13.2.4
2023-03-10 16:34:54 +00:00
Chris Barber
2b1c8d89d4 [docs] Add more info about prepareCache (#9644)
I felt the `prepareCache()` docs could use an additional note and example.
2023-03-10 15:55:13 +00:00
Sean Massa
c5e9ccfacf [tests] convert CLI Integration tests from ava to jest (#9632)
Co-authored-by: Steven <steven@ceriously.com>
2023-03-09 18:34:03 -06:00
Sean Massa
66fe3db888 [tests] add tests to edge handler template (#9528)
The Edge Handler wrapping logic we add during `vc dev` was not testable. This PR refactors it to be testable and adds some basic tests.
2023-03-08 22:56:51 +00:00
Steven
765ec05cea [next] Fix i18n for app dir and sublocales (#9623)
- Applies this fix again #9582
- Applies a test for https://github.com/orgs/vercel/discussions/1714
2023-03-08 20:50:45 +00:00
Chris Barber
413706d72a [tests] Bump test timeouts for slow tests (#9631)
This PR address the following slow tests:

* https://linear.app/vercel/issue/VCCLI-560/flakey-test-login-with-no-color
* https://linear.app/vercel/issue/VCCLI-561/flakey-test-[vercel-dev]-04-create-react-app
* https://linear.app/vercel/issue/VCCLI-563/flakey-test-build-›-should-build-with-vercelnode
* https://linear.app/vercel/issue/VCCLI-574/flakey-test-build-output-api-v1-should-detect-the-output-format
* https://linear.app/vercel/issue/VCCLI-578/flakey-test-importbuilders-›-should-install-and-import-1st-party
* https://linear.app/vercel/issue/VCCLI-580/flakey-test-creategitmeta-›-detects-dirty-commit
2023-03-08 18:44:13 +00:00
Sean Massa
9bc8817f92 [tests] remove eslint from fixture (#9629)
In a previous PR https://github.com/vercel/vercel/pull/9622/files#diff-508a8f08333e1f42e2b2f02e99081c181802b6b2e7baa4e75c18e51e1e703ce4, this fixture was added which contained an eslint config file. We do have these fixtures eslint ignored, but it seems the presence of this config file re-enables it. This causes eslint failures inside the fixture to bubble up and fail lint checks.

This PR removes eslint from the fixture.
2023-03-08 16:42:11 +00:00
Steven
9da41dcafa [tests] Change test-unit to test-lint (#9627)
In a previous PR (#9615) the unit tests were moved to separate jobs in
the `test.yml` workflow. So we can now change the `test-unit.yml`
workflow to simply be `test-lint.yml` to avoid redundancy.

I also checked to see if this would affect code coverage but it turns
out codecov was [disabled a long time
ago](https://app.codecov.io/gh/vercel/vercel).
2023-03-08 10:17:44 -05:00
Steven
f1ab5704f1 [cli] Fix example list api to exclude node_modules (#9626)
<img width="219" alt="image"
src="https://user-images.githubusercontent.com/229881/223744886-e4bf430d-078c-49c4-81c3-0c30dce08f2e.png">
2023-03-08 10:04:33 -05:00
Nathan Rajlich
d8cf3e8831 [remix] Add turborepo monorepo E2E test (#9622)
Adds a Remix E2E test with a Turborepo monorepo configuration.
2023-03-08 06:58:18 +00:00
Steven
c06209901c [tests] Run unit tests concurrently in chunks (#9615)
We can separate each package `test-unit` into a separate job. This will help isolate problems and we can re-run CI for a specific package.
2023-03-07 23:50:21 +00:00
Ethan Arrowood
f20756344e [internals] Initialize @vercel-internals/utils and create @vercel-internals/tsconfig (#9618)
- Creates `@vercel-internals/tsconfig`
- Changes `@vercel-internals/types` to depend on `@vercel-intenrals/tsconfig`
- Creates `@vercel-internals/utils`

Moving these to another PR:
- ~Moves all top level util files from `@vercel/cli` to `@vercel-internals/utils`~
- ~Updates all relevant imports within `@vercel/cli` to use `@vercel-internals/utils`~
2023-03-07 21:52:01 +00:00
Steven
21a440b832 Publish Stable
- @vercel/build-utils@6.3.4
 - vercel@28.16.15
 - @vercel/client@12.4.4
 - @vercel/fs-detectors@3.8.4
 - @vercel/gatsby-plugin-vercel-builder@1.2.1
 - @vercel/go@2.3.11
 - @vercel/hydrogen@0.0.57
 - @vercel/next@3.6.6
 - @vercel/node@2.9.12
 - @vercel/python@3.1.53
 - @vercel/redwood@1.1.9
 - @vercel/remix@1.6.2
 - @vercel/ruby@1.3.70
 - @vercel/static-build@1.3.16
2023-03-07 13:56:14 -05:00
281 changed files with 27083 additions and 3780 deletions

10
.github/DISCUSSION_TEMPLATE/general.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
- type: textarea
attributes:
label: Description
validations:
required: true

10
.github/DISCUSSION_TEMPLATE/help.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions/categories/help)
- type: textarea
attributes:
label: Problem Description
validations:
required: true

10
.github/DISCUSSION_TEMPLATE/ideas.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions/categories/ideas)
- type: textarea
attributes:
label: Idea
validations:
required: true

10
.github/DISCUSSION_TEMPLATE/polls.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -0,0 +1,10 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -0,0 +1,5 @@
body:
- type: markdown
attributes:
value: |
> **Note**: This category should not be used for new discussions. Please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)

View File

@@ -4,8 +4,8 @@ contact_links:
url: https://vercel.com/support/request
about: Report a bug using the Vercel support form
- name: Feature Request
url: https://github.com/vercel/vercel/discussions/new?category=ideas
url: https://github.com/orgs/vercel/discussions/new?category=ideas
about: Share ideas for new features
- name: Ask a Question
url: https://github.com/vercel/vercel/discussions/new?category=help
url: https://github.com/orgs/vercel/discussions/new?category=help
about: Ask the community for help

View File

@@ -16,7 +16,7 @@ jobs:
issue-number: ${{ github.event.issue.number }}
body: |
Thank you for taking the time to created this request!
We added it to our backlog but need to discuss design/architecture before we can accept a PR.
Please let us know if you would be interested in sending a PR once we approve the design.

View File

@@ -16,9 +16,9 @@ jobs:
issue-number: ${{ github.event.issue.number }}
comment: |
Thank you so much for filing this issue.
We do try to keep issues in this repository focused on the vercel command line and related code.
At this point we think that this issue is best handled by our friendly Vercel support team. They can be found by contacting them at: https://vercel.com/help#issues
If you think closing of this is a mistake, then please re-open this issue and we'll take another look :bow:

View File

@@ -16,9 +16,9 @@ jobs:
issue-number: ${{ github.event.issue.number }}
body: |
Thank you for taking the time to file this issue!
We have confirmed this is a bug and added it to our backlog.
We don't have a timeline for when this issue will be fixed, but we will accept a Pull Request with a fix and a test.
See the [contributing guidelines](https://github.com/vercel/vercel/blob/main/.github/CONTRIBUTING.md) for more info.

View File

@@ -3,9 +3,9 @@ name: Publish
on:
push:
branches:
- main
- main
tags:
- '!*'
- '!*'
env:
TURBO_REMOTE_ONLY: 'true'
@@ -17,50 +17,51 @@ jobs:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release
id: check-release
run: |
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
if [[ -z "$tag" ]];
then
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- name: Setup Node
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 16
- name: install npm@9
run: npm i -g npm@9
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- name: Install
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm install
- name: Build
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm build
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Publish
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm publish-from-github
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release
id: check-release
run: |
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
if [[ -z "$tag" ]];
then
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- name: Setup Node
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 16
- name: install npm@9
run: npm i -g npm@9
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- name: Install
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm install
- name: Build
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm build
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Publish
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm publish-from-github
env:
NPM_CONFIG_PROVENANCE: 'true'
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

View File

@@ -3,9 +3,9 @@ name: CLI
on:
push:
branches:
- main
- main
tags:
- '!*'
- '!*'
pull_request:
env:
@@ -31,9 +31,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

35
.github/workflows/test-lint.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Lint
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
env:
TURBO_REMOTE_ONLY: 'true'
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
NODE_VERSION: '16'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
name: Lint
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- run: pnpm install
- run: pnpm run lint
- run: pnpm run prettier-check

View File

@@ -1,50 +0,0 @@
name: Unit
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
env:
TURBO_REMOTE_ONLY: 'true'
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
name: Unit
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [16]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- run: pnpm install
- run: pnpm run build
- run: pnpm run lint
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run lint once
- run: pnpm run test-unit
- run: pnpm -C packages/cli run coverage
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run coverage once
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -3,9 +3,9 @@ name: Tests
on:
push:
branches:
- main
- main
tags:
- '!*'
- '!*'
pull_request:
env:
@@ -29,9 +29,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
@@ -66,9 +63,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

View File

@@ -5,7 +5,7 @@ on:
inputs:
new-version:
type: string
description: "Optional version to update @remix-run/dev to inside of @vercel/remix"
description: 'Optional version to update @remix-run/dev to inside of @vercel/remix-builder'
jobs:
update-remix-run-dev:

View File

@@ -7,3 +7,28 @@ examples/sveltekit-1
# gatsby-plugin-vercel-analytics
packages/gatsby-plugin-vercel-analytics
# ignore directories that are not source code
node_modules
dist
pnpm-lock.yaml
.vscode
.DS_Store
.next
.vercel
.turbo
.eslintcache
.output
.vercel_build_output
.vercel
coverage
turbo-cache-key.json
/examples
/public
packages/*/dist
packages/*/node_modules
packages/**/test/fixtures
packages/**/test/dev/fixtures
packages/**/test/build-fixtures
packages/**/test/cache-fixtures

View File

@@ -79,18 +79,23 @@ project. An example use-case is that `@vercel/node` uses this function to cache
the `node_modules` directory, making it faster to install npm dependencies for
future builds.
> Note: Only files within the repo root directory can be cached.
**Example:**
```typescript
import { PrepareCacheOptions } from '@vercel/build-utils';
import { relative } from 'path';
import { glob, PrepareCache } from '@vercel/build-utils';
export async function prepareCache(options: PrepareCacheOptions) {
export const prepareCache: PrepareCache = async ({
workPath,
repoRootPath,
}) => {
// Create a mapping of file names and `File` object instances to cache here…
return {
'path-to-file': File,
};
}
const rootDirectory = relative(repoRootPath, workPath);
const cache = await glob(`${rootDirectory}/some/dir/**`, repoRootPath);
return cache;
};
```
### `shouldServe()`

View File

@@ -51,8 +51,11 @@ export async function getGitHubRepoInfo(repo: Repo) {
data.subdir = repo.path.slice(subdirPath.length).split('/');
}
if (data.id === 'vercel/vercel' && data.subdir && data.subdir[0] === 'examples') {
if (
data.id === 'vercel/vercel' &&
data.subdir &&
data.subdir[0] === 'examples'
) {
// from our examples, add `homepage` and `description` fields
const example = data.subdir[1];
const exampleList = await getExampleList();

View File

@@ -33,7 +33,12 @@ async function main() {
});
const existingExamples = exampleDirs
.filter(dir => dir.isDirectory())
.filter(
dir =>
dir.isDirectory() &&
dir.name !== 'node_modules' &&
dir.name !== '__tests__'
)
.map(dir => ({
name: dir.name,
visible: true,

View File

@@ -1,10 +0,0 @@
codecov:
require_ci_to_pass: yes
coverage:
status:
project: off
patch: off
fixes:
- "::packages/cli/" # move root e.g., "path/" => "after/path/"

View File

@@ -38,9 +38,9 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :--------------------- | :------------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `npm run astro --help` | Get help using the Astro CLI |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:3000` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `pnpm run astro --help` | Get help using the Astro CLI |

View File

@@ -9,8 +9,8 @@
"version": "0.1.0",
"dependencies": {
"eslint": "8.35.0",
"eslint-config-next": "13.2.3",
"next": "13.2.3",
"eslint-config-next": "13.2.4",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
}
@@ -87,22 +87,22 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA=="
},
"node_modules/@next/env": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.2.3.tgz",
"integrity": "sha512-FN50r/E+b8wuqyRjmGaqvqNDuWBWYWQiigfZ50KnSFH0f+AMQQyaZl+Zm2+CIpKk0fL9QxhLxOpTVA3xFHgFow=="
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.2.4.tgz",
"integrity": "sha512-+Mq3TtpkeeKFZanPturjcXt+KHfKYnLlX6jMLyCrmpq6OOs4i1GqBOAauSkii9QeKCMTYzGppar21JU57b/GEA=="
},
"node_modules/@next/eslint-plugin-next": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.2.3.tgz",
"integrity": "sha512-QmMPItnU7VeojI1KnuwL9SLFWEwmaNHNlnOGpoTwdLoSiP9sc8KYiAHWEc4/44L+cAdCxcZYvn7frcRNP5l84Q==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.2.4.tgz",
"integrity": "sha512-ck1lI+7r1mMJpqLNa3LJ5pxCfOB1lfJncKmRJeJxcJqcngaFwylreLP7da6Rrjr6u2gVRTfmnkSkjc80IiQCwQ==",
"dependencies": {
"glob": "7.1.7"
}
},
"node_modules/@next/swc-android-arm-eabi": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.2.3.tgz",
"integrity": "sha512-mykdVaAXX/gm+eFO2kPeVjnOCKwanJ9mV2U0lsUGLrEdMUifPUjiXKc6qFAIs08PvmTMOLMNnUxqhGsJlWGKSw==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.2.4.tgz",
"integrity": "sha512-DWlalTSkLjDU11MY11jg17O1gGQzpRccM9Oes2yTqj2DpHndajrXHGxj9HGtJ+idq2k7ImUdJVWS2h2l/EDJOw==",
"cpu": [
"arm"
],
@@ -115,9 +115,9 @@
}
},
"node_modules/@next/swc-android-arm64": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.2.3.tgz",
"integrity": "sha512-8XwHPpA12gdIFtope+n9xCtJZM3U4gH4vVTpUwJ2w1kfxFmCpwQ4xmeGSkR67uOg80yRMuF0h9V1ueo05sws5w==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.2.4.tgz",
"integrity": "sha512-sRavmUImUCf332Gy+PjIfLkMhiRX1Ez4SI+3vFDRs1N5eXp+uNzjFUK/oLMMOzk6KFSkbiK/3Wt8+dHQR/flNg==",
"cpu": [
"arm64"
],
@@ -130,9 +130,9 @@
}
},
"node_modules/@next/swc-darwin-arm64": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.2.3.tgz",
"integrity": "sha512-TXOubiFdLpMfMtaRu1K5d1I9ipKbW5iS2BNbu8zJhoqrhk3Kp7aRKTxqFfWrbliAHhWVE/3fQZUYZOWSXVQi1w==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.2.4.tgz",
"integrity": "sha512-S6vBl+OrInP47TM3LlYx65betocKUUlTZDDKzTiRDbsRESeyIkBtZ6Qi5uT2zQs4imqllJznVjFd1bXLx3Aa6A==",
"cpu": [
"arm64"
],
@@ -145,9 +145,9 @@
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.2.3.tgz",
"integrity": "sha512-GZctkN6bJbpjlFiS5pylgB2pifHvgkqLAPumJzxnxkf7kqNm6rOGuNjsROvOWVWXmKhrzQkREO/WPS2aWsr/yw==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.2.4.tgz",
"integrity": "sha512-a6LBuoYGcFOPGd4o8TPo7wmv5FnMr+Prz+vYHopEDuhDoMSHOnC+v+Ab4D7F0NMZkvQjEJQdJS3rqgFhlZmKlw==",
"cpu": [
"x64"
],
@@ -160,9 +160,9 @@
}
},
"node_modules/@next/swc-freebsd-x64": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.2.3.tgz",
"integrity": "sha512-rK6GpmMt/mU6MPuav0/M7hJ/3t8HbKPCELw/Uqhi4732xoq2hJ2zbo2FkYs56y6w0KiXrIp4IOwNB9K8L/q62g==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.2.4.tgz",
"integrity": "sha512-kkbzKVZGPaXRBPisoAQkh3xh22r+TD+5HwoC5bOkALraJ0dsOQgSMAvzMXKsN3tMzJUPS0tjtRf1cTzrQ0I5vQ==",
"cpu": [
"x64"
],
@@ -175,9 +175,9 @@
}
},
"node_modules/@next/swc-linux-arm-gnueabihf": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.2.3.tgz",
"integrity": "sha512-yeiCp/Odt1UJ4KUE89XkeaaboIDiVFqKP4esvoLKGJ0fcqJXMofj4ad3tuQxAMs3F+qqrz9MclqhAHkex1aPZA==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.2.4.tgz",
"integrity": "sha512-7qA1++UY0fjprqtjBZaOA6cas/7GekpjVsZn/0uHvquuITFCdKGFCsKNBx3S0Rpxmx6WYo0GcmhNRM9ru08BGg==",
"cpu": [
"arm"
],
@@ -190,9 +190,9 @@
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.2.3.tgz",
"integrity": "sha512-/miIopDOUsuNlvjBjTipvoyjjaxgkOuvlz+cIbbPcm1eFvzX2ltSfgMgty15GuOiR8Hub4FeTSiq3g2dmCkzGA==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.2.4.tgz",
"integrity": "sha512-xzYZdAeq883MwXgcwc72hqo/F/dwUxCukpDOkx/j1HTq/J0wJthMGjinN9wH5bPR98Mfeh1MZJ91WWPnZOedOg==",
"cpu": [
"arm64"
],
@@ -205,9 +205,9 @@
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.2.3.tgz",
"integrity": "sha512-sujxFDhMMDjqhruup8LLGV/y+nCPi6nm5DlFoThMJFvaaKr/imhkXuk8uCTq4YJDbtRxnjydFv2y8laBSJVC2g==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.2.4.tgz",
"integrity": "sha512-8rXr3WfmqSiYkb71qzuDP6I6R2T2tpkmf83elDN8z783N9nvTJf2E7eLx86wu2OJCi4T05nuxCsh4IOU3LQ5xw==",
"cpu": [
"arm64"
],
@@ -220,9 +220,9 @@
}
},
"node_modules/@next/swc-linux-x64-gnu": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.2.3.tgz",
"integrity": "sha512-w5MyxPknVvC9LVnMenAYMXMx4KxPwXuJRMQFvY71uXg68n7cvcas85U5zkdrbmuZ+JvsO5SIG8k36/6X3nUhmQ==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.2.4.tgz",
"integrity": "sha512-Ngxh51zGSlYJ4EfpKG4LI6WfquulNdtmHg1yuOYlaAr33KyPJp4HeN/tivBnAHcZkoNy0hh/SbwDyCnz5PFJQQ==",
"cpu": [
"x64"
],
@@ -235,9 +235,9 @@
}
},
"node_modules/@next/swc-linux-x64-musl": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.2.3.tgz",
"integrity": "sha512-CTeelh8OzSOVqpzMFMFnVRJIFAFQoTsI9RmVJWW/92S4xfECGcOzgsX37CZ8K982WHRzKU7exeh7vYdG/Eh4CA==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.2.4.tgz",
"integrity": "sha512-gOvwIYoSxd+j14LOcvJr+ekd9fwYT1RyMAHOp7znA10+l40wkFiMONPLWiZuHxfRk+Dy7YdNdDh3ImumvL6VwA==",
"cpu": [
"x64"
],
@@ -250,9 +250,9 @@
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.2.3.tgz",
"integrity": "sha512-7N1KBQP5mo4xf52cFCHgMjzbc9jizIlkTepe9tMa2WFvEIlKDfdt38QYcr9mbtny17yuaIw02FXOVEytGzqdOQ==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.2.4.tgz",
"integrity": "sha512-q3NJzcfClgBm4HvdcnoEncmztxrA5GXqKeiZ/hADvC56pwNALt3ngDC6t6qr1YW9V/EPDxCYeaX4zYxHciW4Dw==",
"cpu": [
"arm64"
],
@@ -265,9 +265,9 @@
}
},
"node_modules/@next/swc-win32-ia32-msvc": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.2.3.tgz",
"integrity": "sha512-LzWD5pTSipUXTEMRjtxES/NBYktuZdo7xExJqGDMnZU8WOI+v9mQzsmQgZS/q02eIv78JOCSemqVVKZBGCgUvA==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.2.4.tgz",
"integrity": "sha512-/eZ5ncmHUYtD2fc6EUmAIZlAJnVT2YmxDsKs1Ourx0ttTtvtma/WKlMV5NoUsyOez0f9ExLyOpeCoz5aj+MPXw==",
"cpu": [
"ia32"
],
@@ -280,9 +280,9 @@
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.2.3.tgz",
"integrity": "sha512-aLG2MaFs4y7IwaMTosz2r4mVbqRyCnMoFqOcmfTi7/mAS+G4IMH0vJp4oLdbshqiVoiVuKrAfqtXj55/m7Qu1Q==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.2.4.tgz",
"integrity": "sha512-0MffFmyv7tBLlji01qc0IaPP/LVExzvj7/R5x1Jph1bTAIj4Vu81yFQWHHQAP6r4ff9Ukj1mBK6MDNVXm7Tcvw==",
"cpu": [
"x64"
],
@@ -364,13 +364,13 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="
},
"node_modules/@typescript-eslint/parser": {
"version": "5.54.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.0.tgz",
"integrity": "sha512-aAVL3Mu2qTi+h/r04WI/5PfNWvO6pdhpeMRWk9R7rEV4mwJNzoWf5CCU5vDKBsPIFQFjEq1xg7XBI2rjiMXQbQ==",
"version": "5.54.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.1.tgz",
"integrity": "sha512-8zaIXJp/nG9Ff9vQNh7TI+C3nA6q6iIsGJ4B4L6MhZ7mHnTMR4YP5vp2xydmFXIy8rpyIVbNAG44871LMt6ujg==",
"dependencies": {
"@typescript-eslint/scope-manager": "5.54.0",
"@typescript-eslint/types": "5.54.0",
"@typescript-eslint/typescript-estree": "5.54.0",
"@typescript-eslint/scope-manager": "5.54.1",
"@typescript-eslint/types": "5.54.1",
"@typescript-eslint/typescript-estree": "5.54.1",
"debug": "^4.3.4"
},
"engines": {
@@ -390,12 +390,12 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.54.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz",
"integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==",
"version": "5.54.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz",
"integrity": "sha512-zWKuGliXxvuxyM71UA/EcPxaviw39dB2504LqAmFDjmkpO8qNLHcmzlh6pbHs1h/7YQ9bnsO8CCcYCSA8sykUg==",
"dependencies": {
"@typescript-eslint/types": "5.54.0",
"@typescript-eslint/visitor-keys": "5.54.0"
"@typescript-eslint/types": "5.54.1",
"@typescript-eslint/visitor-keys": "5.54.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -406,9 +406,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.54.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz",
"integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==",
"version": "5.54.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.1.tgz",
"integrity": "sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@@ -418,12 +418,12 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.54.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz",
"integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==",
"version": "5.54.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz",
"integrity": "sha512-bjK5t+S6ffHnVwA0qRPTZrxKSaFYocwFIkZx5k7pvWfsB1I57pO/0M0Skatzzw1sCkjJ83AfGTL0oFIFiDX3bg==",
"dependencies": {
"@typescript-eslint/types": "5.54.0",
"@typescript-eslint/visitor-keys": "5.54.0",
"@typescript-eslint/types": "5.54.1",
"@typescript-eslint/visitor-keys": "5.54.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -444,11 +444,11 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.54.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz",
"integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==",
"version": "5.54.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz",
"integrity": "sha512-q8iSoHTgwCfgcRJ2l2x+xCbu8nBlRAlsQ33k24Adj8eoVBE0f8dUeI+bAa8F84Mv05UGbAx57g2zrRsYIooqQg==",
"dependencies": {
"@typescript-eslint/types": "5.54.0",
"@typescript-eslint/types": "5.54.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -678,9 +678,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001458",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz",
"integrity": "sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w==",
"version": "1.0.30001464",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001464.tgz",
"integrity": "sha512-oww27MtUmusatpRpCGSOneQk2/l5czXANDSFvsc7VuOQ86s3ANhZetpwXNf1zY/zdfP63Xvjz325DAdAoES13g==",
"funding": [
{
"type": "opencollective",
@@ -1031,11 +1031,11 @@
}
},
"node_modules/eslint-config-next": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.2.3.tgz",
"integrity": "sha512-kPulHiQEHGei9hIaaNGygHRc0UzlWM+3euOmYbxNkd2Nbhci5rrCDeMBMPSV8xgUssphDGmwDHWbk4VZz3rlZQ==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.2.4.tgz",
"integrity": "sha512-lunIBhsoeqw6/Lfkd6zPt25w1bn0znLA/JCL+au1HoEpSb4/PpsOYsYtgV/q+YPsoKIOzFyU5xnb04iZnXjUvg==",
"dependencies": {
"@next/eslint-plugin-next": "13.2.3",
"@next/eslint-plugin-next": "13.2.4",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0",
"eslint-import-resolver-node": "^0.3.6",
@@ -1378,9 +1378,9 @@
}
},
"node_modules/esquery": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz",
"integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
"integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
"dependencies": {
"estraverse": "^5.1.0"
},
@@ -1853,12 +1853,12 @@
}
},
"node_modules/is-array-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
"integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
"integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==",
"dependencies": {
"call-bind": "^1.0.2",
"get-intrinsic": "^1.1.3",
"get-intrinsic": "^1.2.0",
"is-typed-array": "^1.1.10"
},
"funding": {
@@ -2326,11 +2326,11 @@
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="
},
"node_modules/next": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/next/-/next-13.2.3.tgz",
"integrity": "sha512-nKFJC6upCPN7DWRx4+0S/1PIOT7vNlCT157w9AzbXEgKy6zkiPKEt5YyRUsRZkmpEqBVrGgOqNfwecTociyg+w==",
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/next/-/next-13.2.4.tgz",
"integrity": "sha512-g1I30317cThkEpvzfXujf0O4wtaQHtDCLhlivwlTJ885Ld+eOgcz7r3TGQzeU+cSRoNHtD8tsJgzxVdYojFssw==",
"dependencies": {
"@next/env": "13.2.3",
"@next/env": "13.2.4",
"@swc/helpers": "0.4.14",
"caniuse-lite": "^1.0.30001406",
"postcss": "8.4.14",
@@ -2343,19 +2343,19 @@
"node": ">=14.6.0"
},
"optionalDependencies": {
"@next/swc-android-arm-eabi": "13.2.3",
"@next/swc-android-arm64": "13.2.3",
"@next/swc-darwin-arm64": "13.2.3",
"@next/swc-darwin-x64": "13.2.3",
"@next/swc-freebsd-x64": "13.2.3",
"@next/swc-linux-arm-gnueabihf": "13.2.3",
"@next/swc-linux-arm64-gnu": "13.2.3",
"@next/swc-linux-arm64-musl": "13.2.3",
"@next/swc-linux-x64-gnu": "13.2.3",
"@next/swc-linux-x64-musl": "13.2.3",
"@next/swc-win32-arm64-msvc": "13.2.3",
"@next/swc-win32-ia32-msvc": "13.2.3",
"@next/swc-win32-x64-msvc": "13.2.3"
"@next/swc-android-arm-eabi": "13.2.4",
"@next/swc-android-arm64": "13.2.4",
"@next/swc-darwin-arm64": "13.2.4",
"@next/swc-darwin-x64": "13.2.4",
"@next/swc-freebsd-x64": "13.2.4",
"@next/swc-linux-arm-gnueabihf": "13.2.4",
"@next/swc-linux-arm64-gnu": "13.2.4",
"@next/swc-linux-arm64-musl": "13.2.4",
"@next/swc-linux-x64-gnu": "13.2.4",
"@next/swc-linux-x64-musl": "13.2.4",
"@next/swc-win32-arm64-msvc": "13.2.4",
"@next/swc-win32-ia32-msvc": "13.2.4",
"@next/swc-win32-x64-msvc": "13.2.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.4.0",

View File

@@ -10,8 +10,8 @@
},
"dependencies": {
"eslint": "8.35.0",
"eslint-config-next": "13.2.3",
"next": "13.2.3",
"eslint-config-next": "13.2.4",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
}

View File

@@ -1,18 +0,0 @@
import handleRequest from "@vercel/remix-entry-server";
import { RemixServer } from "@remix-run/react";
import type { EntryContext } from "@remix-run/server-runtime";
export default function (
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
const remixServer = <RemixServer context={remixContext} url={request.url} />;
return handleRequest(
request,
responseStatusCode,
responseHeaders,
remixServer
);
}

View File

@@ -1,4 +1,4 @@
import type { MetaFunction } from "@remix-run/node";
import type { MetaFunction } from "@vercel/remix";
import {
Links,
LiveReload,

View File

@@ -6,18 +6,17 @@
"dev": "remix dev"
},
"dependencies": {
"@remix-run/node": "^1.13.0",
"@remix-run/react": "^1.13.0",
"@remix-run/serve": "^1.13.0",
"@remix-run/server-runtime": "^1.13.0",
"@vercel/analytics": "^0.1.10",
"@vercel/remix-entry-server": "^0.1.0",
"@remix-run/node": "^1.14.3",
"@remix-run/react": "^1.14.3",
"@remix-run/serve": "^1.14.3",
"@vercel/analytics": "^0.1.11",
"@vercel/remix": "1.14.3-patch.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^1.13.0",
"@remix-run/eslint-config": "^1.13.0",
"@remix-run/dev": "^1.14.3",
"@remix-run/eslint-config": "^1.14.3",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.11",
"eslint": "^8.28.0",

View File

@@ -4,32 +4,30 @@ importers:
.:
specifiers:
'@remix-run/dev': ^1.13.0
'@remix-run/eslint-config': ^1.13.0
'@remix-run/node': ^1.13.0
'@remix-run/react': ^1.13.0
'@remix-run/serve': ^1.13.0
'@remix-run/server-runtime': ^1.13.0
'@remix-run/dev': ^1.14.3
'@remix-run/eslint-config': ^1.14.3
'@remix-run/node': ^1.14.3
'@remix-run/react': ^1.14.3
'@remix-run/serve': ^1.14.3
'@types/react': ^18.0.25
'@types/react-dom': ^18.0.11
'@vercel/analytics': ^0.1.10
'@vercel/remix-entry-server': ^0.1.0
'@vercel/analytics': ^0.1.11
'@vercel/remix': 1.14.3-patch.1
eslint: ^8.28.0
react: ^18.2.0
react-dom: ^18.2.0
typescript: ^4.9.3
dependencies:
'@remix-run/node': 1.13.0
'@remix-run/react': 1.13.0_biqbaboplfbrettd7655fr4n2y
'@remix-run/serve': 1.13.0
'@remix-run/server-runtime': 1.13.0
'@vercel/analytics': 0.1.10_react@18.2.0
'@vercel/remix-entry-server': 0.1.0_react@18.2.0
'@remix-run/node': 1.14.3
'@remix-run/react': 1.14.3_biqbaboplfbrettd7655fr4n2y
'@remix-run/serve': 1.14.3
'@vercel/analytics': 0.1.11_react@18.2.0
'@vercel/remix': 1.14.3-patch.1_biqbaboplfbrettd7655fr4n2y
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
devDependencies:
'@remix-run/dev': 1.13.0_@remix-run+serve@1.13.0
'@remix-run/eslint-config': 1.13.0_km5ddj7uwb23cqeymeyvzjsfb4
'@remix-run/dev': 1.14.3_@remix-run+serve@1.14.3
'@remix-run/eslint-config': 1.14.3_km5ddj7uwb23cqeymeyvzjsfb4
'@types/react': 18.0.28
'@types/react-dom': 18.0.11
eslint: 8.34.0
@@ -1665,12 +1663,12 @@ packages:
tslib: 2.5.0
dev: true
/@remix-run/dev/1.13.0_@remix-run+serve@1.13.0:
resolution: {integrity: sha512-hPqUjM9RRcz3inBOWqP3GKhggVz0a0ikWaRZpdKrhpQNCNiF6Hunbx876mJERj2YrmIzJ05eoeQmmdF6xcr4qg==}
/@remix-run/dev/1.14.3_@remix-run+serve@1.14.3:
resolution: {integrity: sha512-46mmwiA/k9YDkg0UrP90UB3azVVWRXw16NLHRSbZiaaYe8XgUkddEtBnH/nBp/IrVCtzUL3LObplUe5sFk5Z9Q==}
engines: {node: '>=14'}
hasBin: true
peerDependencies:
'@remix-run/serve': ^1.13.0
'@remix-run/serve': ^1.14.3
peerDependenciesMeta:
'@remix-run/serve':
optional: true
@@ -1686,8 +1684,8 @@ packages:
'@babel/types': 7.20.7
'@esbuild-plugins/node-modules-polyfill': 0.1.4_esbuild@0.16.3
'@npmcli/package-json': 2.0.0
'@remix-run/serve': 1.13.0
'@remix-run/server-runtime': 1.13.0
'@remix-run/serve': 1.14.3
'@remix-run/server-runtime': 1.14.3
'@vanilla-extract/integration': 6.1.0
arg: 5.0.2
cacache: 15.3.0
@@ -1718,6 +1716,7 @@ packages:
prettier: 2.7.1
pretty-ms: 7.0.1
proxy-agent: 5.0.0
react-refresh: 0.14.0
recast: 0.21.5
remark-frontmatter: 4.0.1
remark-mdx-frontmatter: 1.1.1
@@ -1736,8 +1735,8 @@ packages:
- utf-8-validate
dev: true
/@remix-run/eslint-config/1.13.0_km5ddj7uwb23cqeymeyvzjsfb4:
resolution: {integrity: sha512-qz/N99D/q1mQefZl2X+p11xVk03r6aFDMvk/4mG+8IrMRU4BqMJ/bF53/CUOveSzvzLua4Pfi2wmqF+deHw0GQ==}
/@remix-run/eslint-config/1.14.3_km5ddj7uwb23cqeymeyvzjsfb4:
resolution: {integrity: sha512-Yy4PYSvAehj31LmkDA+lS5yCPL1lR9O04gMIo0xwHT2o59pF4QU54lEAvJJH+9MI0byZUI/v9DoGz1oGIb44IA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^8.0.0
@@ -1772,35 +1771,20 @@ packages:
- supports-color
dev: true
/@remix-run/express/1.13.0_express@4.18.2:
resolution: {integrity: sha512-MX80PdQu3k1HlQsHlUjPBZe5rpTdn4FqZ5Fg4d85cVi+GMfu3x8n8hB0xbCDLhmRbKTR01PQ01j3UUNtsWWikg==}
/@remix-run/express/1.14.3_express@4.18.2:
resolution: {integrity: sha512-v3TT+zBFSnOiVTHNiLp5A783UVYyZYbePxmPhvoe9JwHCmzVDA9mfyxYgDl/8NPDtYS+dAPU7mQ+aE1M5MXc7g==}
engines: {node: '>=14'}
peerDependencies:
express: ^4.17.1
dependencies:
'@remix-run/node': 1.13.0
'@remix-run/node': 1.14.3
express: 4.18.2
/@remix-run/node/1.12.0:
resolution: {integrity: sha512-WiyRTEQKTUTf3Z3ke5DOwx+fjCkeD8ilI9kbRws1bG3xfdugaDrV9ra76DOZcrYlmVwjwtKE3mVDSRFtiYTTMw==}
/@remix-run/node/1.14.3:
resolution: {integrity: sha512-Mq0wUtgJtGwMQEBr/8p9XpdPBm7N+lby5CEbW6IKV59UC9N3VMGY3snfrsphBCq3sNZfbhIpaDdu2W+8EoqfnQ==}
engines: {node: '>=14'}
dependencies:
'@remix-run/server-runtime': 1.12.0
'@remix-run/web-fetch': 4.3.2
'@remix-run/web-file': 3.0.2
'@remix-run/web-stream': 1.0.3
'@web3-storage/multipart-parser': 1.0.0
abort-controller: 3.0.0
cookie-signature: 1.2.0
source-map-support: 0.5.21
stream-slice: 0.1.2
dev: false
/@remix-run/node/1.13.0:
resolution: {integrity: sha512-FDvPGaoDyon8UGYQ9DroLtiX8vFa0efBQQSHV3az0s7HbUpugw7BcA6NBW5pIs2z5sszCCeRbAgSIXcETLzfhw==}
engines: {node: '>=14'}
dependencies:
'@remix-run/server-runtime': 1.13.0
'@remix-run/server-runtime': 1.14.3
'@remix-run/web-fetch': 4.3.2
'@remix-run/web-file': 3.0.2
'@remix-run/web-stream': 1.0.3
@@ -1810,59 +1794,41 @@ packages:
source-map-support: 0.5.21
stream-slice: 0.1.2
/@remix-run/react/1.13.0_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-LT9TStmMavBlLqRG8u5Ku8bxdYcpIbqpmh44/f2Fyw8RvdaRCYYMkuUXsr8bhOqftaEZMFLqFhi19NWY/18DLA==}
/@remix-run/react/1.14.3_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-dvwIx+9ZdE/9LHe8Rjos9gEOdQFLvC0dojCnKlsUIwfGhyjKE4wOHfqS9mZcmKFCvOFDakcZDallLNGaj0mEYg==}
engines: {node: '>=14'}
peerDependencies:
react: '>=16.8'
react-dom: '>=16.8'
dependencies:
'@remix-run/router': 1.3.2
'@remix-run/router': 1.3.3
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-router-dom: 6.8.1_biqbaboplfbrettd7655fr4n2y
react-router-dom: 6.8.2_biqbaboplfbrettd7655fr4n2y
use-sync-external-store: 1.2.0_react@18.2.0
dev: false
/@remix-run/router/1.3.1:
resolution: {integrity: sha512-+eun1Wtf72RNRSqgU7qM2AMX/oHp+dnx7BHk1qhK5ZHzdHTUU4LA1mGG1vT+jMc8sbhG3orvsfOmryjzx2PzQw==}
engines: {node: '>=14'}
dev: false
/@remix-run/router/1.3.2:
resolution: {integrity: sha512-t54ONhl/h75X94SWsHGQ4G/ZrCEguKSRQr7DrjTciJXW0YU1QhlwYeycvK5JgkzlxmvrK7wq1NB/PLtHxoiDcA==}
/@remix-run/router/1.3.3:
resolution: {integrity: sha512-YRHie1yQEj0kqqCTCJEfHqYSSNlZQ696QJG+MMiW4mxSl9I0ojz/eRhJS4fs88Z5i6D1SmoF9d3K99/QOhI8/w==}
engines: {node: '>=14'}
/@remix-run/serve/1.13.0:
resolution: {integrity: sha512-ondApr1ZUbQR6iy1iGvdarBGqvTZdET4wSNFb2+2NrbxW9Y9E3RZ7q+5M5/iiuy1qbdqubqsoq2N7uFk+gDGxw==}
/@remix-run/serve/1.14.3:
resolution: {integrity: sha512-5So5+PtAaYZq3hc45snkCKIOh51Z45WvhHpRgB0ZsOuhUf6p9UAY9LQk7GRNvkcqL9LChE3LQ9O4gPqnUiZgpA==}
engines: {node: '>=14'}
hasBin: true
dependencies:
'@remix-run/express': 1.13.0_express@4.18.2
'@remix-run/express': 1.14.3_express@4.18.2
compression: 1.7.4
express: 4.18.2
morgan: 1.10.0
transitivePeerDependencies:
- supports-color
/@remix-run/server-runtime/1.12.0:
resolution: {integrity: sha512-7I0165Ns/ffPfCEfuiqD58lMderTn2s/sew1xJ34ONa21mG/7+5T7diHIgxKST8rS3816JPmlwSqUaHgwbmO6Q==}
/@remix-run/server-runtime/1.14.3:
resolution: {integrity: sha512-qh8sxfLj/XW1u6rluN7yIgbvMCoKrVacYGUiPM7g0VHk8h8MlZGAIUfsWM45Poxo3X0uLhNuqqxMaPWldKawIQ==}
engines: {node: '>=14'}
dependencies:
'@remix-run/router': 1.3.1
'@types/cookie': 0.4.1
'@types/react': 18.0.28
'@web3-storage/multipart-parser': 1.0.0
cookie: 0.4.2
set-cookie-parser: 2.5.1
source-map: 0.7.4
dev: false
/@remix-run/server-runtime/1.13.0:
resolution: {integrity: sha512-gjIW3XCeIlOt3rrOZMD6HixQydRgs1SwYjP99ZAVruG2+gNq/tL2OusMFYTLvtWrybt215tPROyF/6iTLsaO3g==}
engines: {node: '>=14'}
dependencies:
'@remix-run/router': 1.3.2
'@remix-run/router': 1.3.3
'@types/cookie': 0.4.1
'@types/react': 18.0.28
'@web3-storage/multipart-parser': 1.0.0
@@ -2252,21 +2218,24 @@ packages:
resolution: {integrity: sha512-17kVyLq3ePTKOkveHxXuIJZtGYs+cSoev7BlP+Lf4916qfDhk/HBjvlYDe8egrea7LNPHKwSZJK/bzZC+Q6AwQ==}
dev: true
/@vercel/analytics/0.1.10_react@18.2.0:
resolution: {integrity: sha512-jjJ8GzcPnQp0cMxpfYoUycMRBtDiaIeyVjZPiEPe99Dj1PdjMzAFYEASiV/hpNsXHkpcNYCveDFh6jnmh0YSDQ==}
/@vercel/analytics/0.1.11_react@18.2.0:
resolution: {integrity: sha512-mj5CPR02y0BRs1tN3oZcBNAX9a8NxsIUl9vElDPcqxnMfP0RbRc9fI9Ud7+QDg/1Izvt5uMumsr+6YsmVHcyuw==}
peerDependencies:
react: ^16.8||^17||^18
dependencies:
react: 18.2.0
dev: false
/@vercel/remix-entry-server/0.1.0_react@18.2.0:
resolution: {integrity: sha512-ux1pcYvcPXAUXQuSH4fwNfkrzYYemFpdc3r4lF3L3PBE5doGhYDuBdTfXZpWl1M5zXi6VAbK6V6qkD33iZWGDA==}
/@vercel/remix/1.14.3-patch.1_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-TBI/FS77HYZqjbgeABi7Rbg7RVQ1YLHcXm4/zroV4zl0nVbcXM2jVR3SXm0EuQKze+NZ0p3VBUz4I/xocTvq0w==}
engines: {node: '>=14'}
peerDependencies:
react: ^18.0.0
react: '*'
react-dom: '*'
dependencies:
'@remix-run/node': 1.12.0
isbot: 3.6.5
'@remix-run/node': 1.14.3
'@remix-run/server-runtime': 1.14.3
isbot: 3.6.6
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
dev: false
@@ -3092,7 +3061,7 @@ packages:
dev: true
/ee-first/1.1.1:
resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=}
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
/electron-to-chromium/1.4.296:
resolution: {integrity: sha512-i/6Q+Y9bluDa2a0NbMvdtG5TuS/1Fr3TKK8L+7UUL9QjRS5iFJzCC3r70xjyOnLiYG8qGV4/mMpe6HuAbdJW4w==}
@@ -3901,7 +3870,7 @@ packages:
engines: {node: '>= 0.6'}
/fresh/0.5.2:
resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=}
resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==}
engines: {node: '>= 0.6'}
/fs-constants/1.0.0:
@@ -4638,8 +4607,8 @@ packages:
resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==}
dev: true
/isbot/3.6.5:
resolution: {integrity: sha512-BchONELXt6yMad++BwGpa0oQxo/uD0keL7N15cYVf0A1oMIoNQ79OqeYdPMFWDrNhCqCbRuw9Y9F3QBjvAxZ5g==}
/isbot/3.6.6:
resolution: {integrity: sha512-98aGl1Spbx1led422YFrusDJ4ZutSNOymb2avZ2V4BCCjF3MqAF2k+J2zoaLYahubaFkb+3UyvbVDVlk/Ngrew==}
engines: {node: '>=12'}
dev: false
@@ -5006,11 +4975,11 @@ packages:
dev: true
/media-typer/0.3.0:
resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=}
resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==}
engines: {node: '>= 0.6'}
/merge-descriptors/1.0.1:
resolution: {integrity: sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=}
resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==}
/merge-stream/2.0.0:
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
@@ -6057,26 +6026,31 @@ packages:
resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
dev: true
/react-router-dom/6.8.1_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-67EXNfkQgf34P7+PSb6VlBuaacGhkKn3kpE51+P6zYSG2kiRoumXEL6e27zTa9+PGF2MNXbgIUHTVlleLbIcHQ==}
/react-refresh/0.14.0:
resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==}
engines: {node: '>=0.10.0'}
dev: true
/react-router-dom/6.8.2_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-N/oAF1Shd7g4tWy+75IIufCGsHBqT74tnzHQhbiUTYILYF0Blk65cg+HPZqwC+6SqEyx033nKqU7by38v3lBZg==}
engines: {node: '>=14'}
peerDependencies:
react: '>=16.8'
react-dom: '>=16.8'
dependencies:
'@remix-run/router': 1.3.2
'@remix-run/router': 1.3.3
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-router: 6.8.1_react@18.2.0
react-router: 6.8.2_react@18.2.0
dev: false
/react-router/6.8.1_react@18.2.0:
resolution: {integrity: sha512-Jgi8BzAJQ8MkPt8ipXnR73rnD7EmZ0HFFb7jdQU24TynGW1Ooqin2KVDN9voSC+7xhqbbCd2cjGUepb6RObnyg==}
/react-router/6.8.2_react@18.2.0:
resolution: {integrity: sha512-lF7S0UmXI5Pd8bmHvMdPKI4u4S5McxmHnzJhrYi9ZQ6wE+DA8JN5BzVC5EEBuduWWDaiJ8u6YhVOCmThBli+rw==}
engines: {node: '>=14'}
peerDependencies:
react: '>=16.8'
dependencies:
'@remix-run/router': 1.3.2
'@remix-run/router': 1.3.3
react: 18.2.0
dev: false
@@ -6993,7 +6967,7 @@ packages:
which-typed-array: 1.1.9
/utils-merge/1.0.1:
resolution: {integrity: sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=}
resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==}
engines: {node: '>= 0.4.0'}
/uvu/0.5.6:

View File

@@ -1,2 +1,2 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node" />
/// <reference types="@vercel/remix" />

View File

@@ -0,0 +1,11 @@
{
"private": true,
"name": "@vercel-internals/tsconfig",
"description": "Node.js tsconfig file based on `@vercel/style-guide`",
"files": [
"tsconfig.json"
],
"devDependencies": {
"@vercel/style-guide": "4.0.2"
}
}

View File

@@ -0,0 +1,12 @@
{
"extends": "@vercel/style-guide/typescript",
"compilerOptions": {
"declaration": true,
"allowJs": true,
"moduleResolution": "node",
"module": "commonjs",
"lib": ["ES2020"],
"resolveJsonModule": true,
"sourceMap": true
}
}

View File

@@ -3,6 +3,9 @@
"name": "@vercel-internals/types",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json"
},
@@ -11,6 +14,7 @@
"@vercel/routing-utils": "2.1.10"
},
"devDependencies": {
"@vercel-internals/tsconfig": "*",
"@vercel/style-guide": "4.0.2",
"typescript": "4.9.4"
}

View File

@@ -1,8 +1,7 @@
{
"extends": "@vercel/style-guide/typescript",
"extends": "@vercel-internals/tsconfig",
"compilerOptions": {
"outDir": "dist",
"declaration": true
"outDir": "./dist"
},
"include": ["index.ts"]
}

View File

@@ -0,0 +1,17 @@
{
"private": true,
"name": "@vercel-internals/utils",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json"
},
"devDependencies": {
"@vercel-internals/tsconfig": "*",
"@vercel/style-guide": "4.0.2",
"typescript": "4.9.4"
}
}

View File

View File

@@ -0,0 +1,7 @@
{
"extends": "@vercel-internals/tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src/**/*"]
}

View File

@@ -32,7 +32,7 @@
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "28.0.5",
"turbo": "1.8.3"
"turbo": "1.8.5"
},
"scripts": {
"lerna": "lerna",
@@ -42,15 +42,16 @@
"publish-canary": "git checkout main && git pull && lerna version prerelease --preid canary --message \"Publish Canary\" --exact",
"publish-from-github": "./utils/publish.sh",
"changelog": "node utils/changelog.js",
"build": "node utils/gen.js && turbo run build",
"build": "node utils/gen.js && turbo --no-update-notifier run build",
"vercel-build": "pnpm build && pnpm run pack && cd api && node -r ts-eager/register ./_lib/script/build.ts",
"pre-commit": "lint-staged",
"test": "jest --rootDir=\"test\" --testPathPattern=\"\\.test.js\"",
"test-unit": "pnpm test && node utils/gen.js && turbo run test-unit",
"test-cli": "node utils/gen.js && turbo run test-cli",
"test-e2e": "node utils/gen.js && turbo run test-e2e",
"test-dev": "node utils/gen.js && turbo run test-dev",
"test-unit": "pnpm test && node utils/gen.js && turbo --no-update-notifier run test-unit",
"test-cli": "node utils/gen.js && turbo --no-update-notifier run test-cli",
"test-e2e": "node utils/gen.js && turbo --no-update-notifier run test-e2e",
"test-dev": "node utils/gen.js && turbo --no-update-notifier run test-dev",
"lint": "eslint . --cache --ext .ts,.js",
"prettier-check": "prettier --check .",
"prepare": "husky install",
"pack": "cd utils && node -r ts-eager/register ./pack.ts"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "6.3.3",
"version": "6.6.0",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -487,6 +487,7 @@ export function getEnvForPackageManager({
const oldPath = env.PATH + '';
const npm7 = '/node16/bin-npm7';
const pnpm7 = '/pnpm7/node_modules/.bin';
const pnpm8 = '/pnpm8/node_modules/.bin';
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
if (cliType === 'npm') {
if (
@@ -509,7 +510,20 @@ export function getEnvForPackageManager({
) {
// Ensure that pnpm 7 is at the beginning of the `$PATH`
newEnv.PATH = `${pnpm7}${path.delimiter}${oldPath}`;
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
console.log(
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7...`
);
} else if (
typeof lockfileVersion === 'number' &&
lockfileVersion >= 6 &&
!oldPath.includes(pnpm8) &&
!corepackEnabled
) {
// Ensure that pnpm 8 is at the beginning of the `$PATH`
newEnv.PATH = `${pnpm8}${path.delimiter}${oldPath}`;
console.log(
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8...`
);
}
} else {
// Yarn v2 PnP mode may be activated, so force "node-modules" linker style

View File

@@ -14,10 +14,11 @@ export function getPrefixedEnvVars({
envs: Envs;
}): Envs {
const vercelSystemEnvPrefix = 'VERCEL_';
const allowed = ['VERCEL_URL', 'VERCEL_ENV', 'VERCEL_REGION'];
const newEnvs: Envs = {};
if (envPrefix && envs.VERCEL_URL) {
Object.keys(envs)
.filter(key => key.startsWith(vercelSystemEnvPrefix))
.filter(key => allowed.includes(key) || key.startsWith('VERCEL_GIT_'))
.forEach(key => {
const newKey = `${envPrefix}${key}`;
if (!(newKey in envs)) {

View File

@@ -0,0 +1,79 @@
// Source: https://github.com/pnpm/pnpm/blob/b38d711f3892a473e20e69dd32ca7e1b439efaec/fs/hard-link-dir/src/index.ts#L4
// LICENSE (MIT): https://github.com/pnpm/pnpm/blob/b38d711f3892a473e20e69dd32ca7e1b439efaec/LICENSE
import path from 'path';
import { promises as fs } from 'fs';
export async function hardLinkDir(src: string, destDirs: string[]) {
if (destDirs.length === 0) return;
// Don't try to hard link the source directory to itself
destDirs = destDirs.filter(destDir => path.relative(destDir, src) !== '');
const files = await fs.readdir(src);
await Promise.all(
files.map(async file => {
if (file === 'node_modules') return;
const srcFile = path.join(src, file);
if ((await fs.lstat(srcFile)).isDirectory()) {
const destSubdirs = await Promise.all(
destDirs.map(async destDir => {
const destSubdir = path.join(destDir, file);
try {
await fs.mkdir(destSubdir, { recursive: true });
} catch (err: any) {
// eslint-disable-line
if (err.code !== 'EEXIST') throw err;
}
return destSubdir;
})
);
await hardLinkDir(srcFile, destSubdirs);
return;
}
await Promise.all(
destDirs.map(async destDir => {
const destFile = path.join(destDir, file);
try {
await linkOrCopyFile(srcFile, destFile);
} catch (err: any) {
// eslint-disable-line
if (err.code === 'ENOENT') {
// Ignore broken symlinks
return;
}
throw err;
}
})
);
})
);
}
async function linkOrCopyFile(srcFile: string, destFile: string) {
try {
await linkOrCopy(srcFile, destFile);
} catch (err: any) {
// eslint-disable-line
if (err.code === 'ENOENT') {
await fs.mkdir(path.dirname(destFile), { recursive: true });
await linkOrCopy(srcFile, destFile);
return;
}
if (err.code !== 'EEXIST') {
throw err;
}
}
}
/*
* This function could be optimized because we don't really need to try linking again
* if linking failed once.
*/
async function linkOrCopy(srcFile: string, destFile: string) {
try {
await fs.link(srcFile, destFile);
} catch (err: any) {
// eslint-disable-line
if (err.code !== 'EXDEV') throw err;
await fs.copyFile(srcFile, destFile);
}
}

View File

@@ -42,6 +42,7 @@ import getIgnoreFilter from './get-ignore-filter';
import { getPlatformEnv } from './get-platform-env';
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
import { cloneEnv } from './clone-env';
import { hardLinkDir } from './hard-link-dir';
export {
FileBlob,
@@ -86,6 +87,7 @@ export {
scanParentDirs,
getIgnoreFilter,
cloneEnv,
hardLinkDir,
};
export { EdgeFunction } from './edge-function';

View File

@@ -11,6 +11,7 @@ interface PrerenderOptions {
initialHeaders?: Record<string, string>;
initialStatus?: number;
passQuery?: boolean;
sourcePath?: string;
}
export class Prerender {
@@ -24,6 +25,7 @@ export class Prerender {
public initialHeaders?: Record<string, string>;
public initialStatus?: number;
public passQuery?: boolean;
public sourcePath?: string;
constructor({
expiration,
@@ -35,9 +37,11 @@ export class Prerender {
initialHeaders,
initialStatus,
passQuery,
sourcePath,
}: PrerenderOptions) {
this.type = 'Prerender';
this.expiration = expiration;
this.sourcePath = sourcePath;
this.lambda = lambda;
if (this.lambda) {

View File

@@ -4,8 +4,7 @@
"probes": [
{
"path": "/",
"mustContain": "pnpm version: 6",
"logMustContain": "pnpm run build"
"mustContain": "pnpm version: 7"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"private": true,
"scripts": {
"build": "mkdir -p public && (printf \"pnpm version: \" && pnpm -v) > public/index.txt"
},
"dependencies": {
"once": "^1.4.0"
}
}

View File

@@ -0,0 +1,21 @@
lockfileVersion: 5.4
importers:
.:
specifiers:
once: ^1.4.0
dependencies:
once: 1.4.0
packages:
/once/1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
dependencies:
wrappy: 1.0.2
dev: false
/wrappy/1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
dev: false

View File

@@ -0,0 +1 @@
# Empty so this is treated as its own pnpm workspace

View File

@@ -0,0 +1,8 @@
{
"probes": [
{
"path": "/",
"mustContain": "pnpm version: 7"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"private": true,
"scripts": {
"build": "mkdir -p public && (printf \"pnpm version: \" && pnpm -v) > public/index.txt"
},
"dependencies": {
"once": "^1.4.0"
}
}

View File

@@ -0,0 +1,21 @@
lockfileVersion: '6.0'
importers:
.:
dependencies:
once:
specifier: ^1.4.0
version: 1.4.0
packages:
/once@1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
dependencies:
wrappy: 1.0.2
dev: false
/wrappy@1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
dev: false

View File

@@ -0,0 +1 @@
# Empty so this is treated as its own pnpm workspace

View File

@@ -0,0 +1,8 @@
{
"probes": [
{
"path": "/",
"mustContain": "pnpm version: 8"
}
]
}

View File

@@ -14,6 +14,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
VERCEL: '1',
VERCEL_URL: 'example.vercel.sh',
USER_ENV_VAR_NOT_VERCEL: 'example.com',
VERCEL_ARTIFACTS_TOKEN: 'abc123',
FOO: 'bar',
},
},
@@ -28,6 +29,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
envPrefix: 'GATSBY_',
envs: {
USER_ENV_VAR_NOT_VERCEL: 'example.com',
VERCEL_ARTIFACTS_TOKEN: 'abc123',
FOO: 'bar',
VERCEL_URL: 'example.vercel.sh',
VERCEL_ENV: 'production',
@@ -51,6 +53,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
USER_ENV_VAR_NOT_VERCEL: 'example.com',
FOO: 'bar',
BLARG_VERCEL_THING: 'fake',
VERCEL_ARTIFACTS_TOKEN: 'abc123',
},
},
want: {},

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "28.16.14",
"version": "28.18.2",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -14,7 +14,7 @@
"preinstall": "node ./scripts/preinstall.js",
"test": "jest --env node --verbose --bail",
"test-unit": "pnpm test test/unit/",
"test-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
"test-cli": "rimraf test/fixtures/integration && pnpm test test/integration.test.ts",
"test-dev": "pnpm test test/dev/",
"coverage": "codecov",
"build": "ts-node ./scripts/build.ts",
@@ -28,29 +28,20 @@
"dist",
"scripts/preinstall.js"
],
"ava": {
"extensions": [
"ts"
],
"require": [
"ts-node/register/transpile-only",
"esm"
]
},
"engines": {
"node": ">= 14"
},
"dependencies": {
"@vercel/build-utils": "6.3.3",
"@vercel/go": "2.3.10",
"@vercel/hydrogen": "0.0.56",
"@vercel/next": "3.6.5",
"@vercel/node": "2.9.11",
"@vercel/python": "3.1.52",
"@vercel/redwood": "1.1.8",
"@vercel/remix": "1.6.1",
"@vercel/ruby": "1.3.69",
"@vercel/static-build": "1.3.15"
"@vercel/build-utils": "6.6.0",
"@vercel/go": "2.4.2",
"@vercel/hydrogen": "0.0.60",
"@vercel/next": "3.7.2",
"@vercel/node": "2.10.1",
"@vercel/python": "3.1.56",
"@vercel/redwood": "1.1.12",
"@vercel/remix-builder": "1.8.2",
"@vercel/ruby": "1.3.73",
"@vercel/static-build": "1.3.20"
},
"devDependencies": {
"@alex_neo/jest-expect-message": "1.0.5",
@@ -94,13 +85,13 @@
"@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0",
"@vercel-internals/types": "*",
"@vercel/client": "12.4.3",
"@vercel/client": "12.4.7",
"@vercel/error-utils": "1.0.8",
"@vercel/frameworks": "1.3.2",
"@vercel/fs-detectors": "3.8.3",
"@vercel/frameworks": "1.3.3",
"@vercel/fs-detectors": "3.8.7",
"@vercel/fun": "1.0.4",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.1.10",
"@vercel/routing-utils": "2.1.11",
"@zeit/source-map-support": "0.6.2",
"ajv": "6.12.2",
"alpha-sort": "2.0.1",
@@ -110,7 +101,6 @@
"async-listen": "1.2.0",
"async-retry": "1.1.3",
"async-sema": "2.1.4",
"ava": "2.2.0",
"bytes": "3.0.0",
"chalk": "4.1.0",
"chance": "1.1.7",

View File

@@ -36,9 +36,7 @@ async function main() {
const def = await readFile(fnPath.replace(/\.js$/, '.tsdef'), 'utf8');
const interfaceName = def.match(/interface (\w+)/)[1];
const lines = require(fnPath)
.toString()
.split('\n');
const lines = require(fnPath).toString().split('\n');
let errorHtmlStart = -1;
let errorHtmlEnd = -1;
for (let i = 0; i < lines.length; i++) {

View File

@@ -1,7 +1,7 @@
import fs from 'fs-extra';
import chalk from 'chalk';
import dotenv from 'dotenv';
import { join, normalize, relative, resolve } from 'path';
import { join, normalize, relative, resolve, sep } from 'path';
import {
getDiscontinuedNodeVersions,
normalizePath,
@@ -157,6 +157,7 @@ export default async function main(client: Client): Promise<number> {
'--output': String,
'--prod': Boolean,
'--yes': Boolean,
'-y': '--yes',
});
if (argv['--help']) {
@@ -296,13 +297,15 @@ async function doBuild(
cwd: string,
outputDir: string
): Promise<void> {
const { output } = client;
const { localConfigPath, output } = client;
const workPath = join(cwd, project.settings.rootDirectory || '.');
const [pkg, vercelConfig, nowConfig] = await Promise.all([
readJSONFile<PackageJson>(join(workPath, 'package.json')),
readJSONFile<VercelConfig>(join(workPath, 'vercel.json')),
readJSONFile<VercelConfig>(
localConfigPath || join(workPath, 'vercel.json')
),
readJSONFile<VercelConfig>(join(workPath, 'now.json')),
]);
@@ -710,7 +713,9 @@ function expandBuild(files: string[], build: Builder): Builder[] {
});
}
let src = normalize(build.src || '**');
let src = normalize(build.src || '**')
.split(sep)
.join('/');
if (src === '.' || src === './') {
throw new NowBuildError({
code: `invalid_build_specification`,

View File

@@ -1,5 +1,9 @@
import chalk from 'chalk';
import { ProjectEnvTarget, Project, ProjectEnvType } from '@vercel-internals/types';
import {
ProjectEnvTarget,
Project,
ProjectEnvType,
} from '@vercel-internals/types';
import { Output } from '../../util/output';
import Client from '../../util/client';
import stamp from '../../util/output/stamp';

View File

@@ -1,7 +1,11 @@
import chalk from 'chalk';
import ms from 'ms';
import { Output } from '../../util/output';
import { Project, ProjectEnvVariable, ProjectEnvType } from '@vercel-internals/types';
import {
Project,
ProjectEnvVariable,
ProjectEnvType,
} from '@vercel-internals/types';
import Client from '../../util/client';
import formatTable from '../../util/format-table';
import getEnvRecords from '../../util/env/get-env-records';

View File

@@ -267,6 +267,7 @@ const main = async () => {
config,
authConfig,
localConfig,
localConfigPath,
argv: process.argv,
});
@@ -280,7 +281,12 @@ const main = async () => {
GLOBAL_COMMANDS.has(targetOrSubcommand) ||
commands.has(targetOrSubcommand);
if (targetPathExists && subcommandExists && !argv['--cwd']) {
if (
targetPathExists &&
subcommandExists &&
!argv['--cwd'] &&
!process.env.NOW_BUILDER
) {
output.warn(
`Did you mean to deploy the subdirectory "${targetOrSubcommand}"? ` +
`Use \`vc --cwd ${targetOrSubcommand}\` instead.`

View File

@@ -50,9 +50,7 @@ export async function setMonorepoDefaultSettings(
const { monorepoManager, ...commands } = result;
output.log(
`Automatically detected ${title(
monorepoManager
)} monorepo manager. Attempting to assign default settings.`
`Detected ${title(monorepoManager)}. Adjusting default settings...`
);
if (commands.buildCommand) {

View File

@@ -20,10 +20,7 @@ export default function getWildcardCNSForAlias(alias: string) {
const secondLevel =
subdomain && subdomain.includes('.')
? subdomain
.split('.')
.slice(1)
.join('.')
? subdomain.split('.').slice(1).join('.')
: null;
const root = secondLevel ? `${secondLevel}.${domain}` : domain;

View File

@@ -43,6 +43,7 @@ export interface ClientOptions extends Stdio {
output: Output;
config: GlobalConfig;
localConfig?: VercelConfig;
localConfigPath?: string;
}
export const isJSONObject = (v: any): v is JSONObject => {
@@ -59,6 +60,7 @@ export default class Client extends EventEmitter implements Stdio {
output: Output;
config: GlobalConfig;
localConfig?: VercelConfig;
localConfigPath?: string;
prompt!: inquirer.PromptModule;
private requestIdCounter: number;
@@ -73,6 +75,7 @@ export default class Client extends EventEmitter implements Stdio {
this.output = opts.output;
this.config = opts.config;
this.localConfig = opts.localConfig;
this.localConfigPath = opts.localConfigPath;
this.requestIdCounter = 1;
this._createPromptModule();
}

View File

@@ -4,7 +4,7 @@ export default function createPollingFn<R>(
future: (...args: any[]) => Promise<R>,
sleepTime: number
) {
return async function*(...args: any[]) {
return async function* (...args: any[]) {
while (true) {
yield await future(...args);
await sleep(sleepTime);

View File

@@ -8,7 +8,7 @@ export default async function deleteDNSRecordById(
return client.fetch(
`/v3/domains/${encodeURIComponent(domain)}/records/${recordId}`,
{
method: 'DELETE'
method: 'DELETE',
}
);
}

View File

@@ -11,7 +11,7 @@ export default function parseAddArgs(
if (domain && rest.length === 0) {
return {
domain,
data: null
data: null,
};
}
@@ -26,7 +26,7 @@ export default function parseAddArgs(
if (type === 'MX' && args.length === 5) {
return {
domain,
data: { name, type, value, mxPriority: Number(args[4]) }
data: { name, type, value, mxPriority: Number(args[4]) },
};
}
@@ -40,9 +40,9 @@ export default function parseAddArgs(
priority: Number(value),
weight: Number(args[4]),
port: Number(args[5]),
target: args[6]
}
}
target: args[6],
},
},
};
}
@@ -52,8 +52,8 @@ export default function parseAddArgs(
data: {
name,
type,
value
}
value,
},
};
}

View File

@@ -6,7 +6,7 @@ export default async function getAuthCode(code?: string) {
}
return textInput({
label: `- Transfer auth code: `,
validateValue: isValidAuthCode
validateValue: isValidAuthCode,
});
}

View File

@@ -11,6 +11,6 @@ export default function formatDNSTable(
return table([HEADER, ...rows], {
align: ['l', 'l', 'l'],
hsep: ' '.repeat(8),
stringLength: strlen
stringLength: strlen,
}).replace(/^(.*)/gm, `${extraSpace}$1`);
}

View File

@@ -22,19 +22,23 @@ export default function formatNSTable(
sortedCurrent[i] || chalk.gray('-'),
sortedIntended[i] === sortedCurrent[i]
? chalk.green(chars.tick)
: chalk.red(chars.cross)
: chalk.red(chars.cross),
]);
}
return table(
[
[chalk.gray('Intended Nameservers'), chalk.gray('Current Nameservers'), ''],
...rows
[
chalk.gray('Intended Nameservers'),
chalk.gray('Current Nameservers'),
'',
],
...rows,
],
{
align: ['l', 'l', 'l', 'l'],
hsep: ' '.repeat(4),
stringLength: strlen
stringLength: strlen,
}
).replace(/^(.*)/gm, `${extraSpace}$1`);
}

View File

@@ -7,4 +7,3 @@ export function getDistTag(version: string): string {
}
return 'latest';
}

View File

@@ -14,7 +14,9 @@ export function getPaginationOpts(opts: PaginationOptions) {
typeof limit === 'number' &&
(!Number.isInteger(limit) || limit > 100 || limit < 1)
) {
throw new Error('Please provide an integer from 1 to 100 for option --limit');
throw new Error(
'Please provide an integer from 1 to 100 for option --limit'
);
}
return [nextTimestamp, limit];

View File

@@ -14,6 +14,6 @@ export default function getSubcommand(
}
return {
subcommand: config.default,
args: cliArgs
args: cliArgs,
};
}

View File

@@ -290,7 +290,8 @@ export default class Now extends EventEmitter {
if (
error.errorCode === 'BUILD_FAILED' ||
error.errorCode === 'UNEXPECTED_ERROR'
error.errorCode === 'UNEXPECTED_ERROR' ||
error.errorCode.includes('BUILD_UTILS_SPAWN_')
) {
return new BuildError({
message: error.errorMessage,
@@ -298,7 +299,7 @@ export default class Now extends EventEmitter {
});
}
return new Error(error.message);
return new Error(error.message || error.errorMessage);
}
async listSecrets(next?: number, testWarningFlag?: boolean) {

View File

@@ -11,7 +11,7 @@ function didYouMean(input: string, list: string[], threshold: number = 0.5) {
const found = rated.filter(item => item[0] > threshold);
if (found.length) {
const highestRated = found.reduce((accu, curr) => {
return accu[0] > curr[0] ? accu : curr
return accu[0] > curr[0] ? accu : curr;
});
return highestRated[1];
}
@@ -23,6 +23,7 @@ function didYouMean(input: string, list: string[], threshold: number = 0.5) {
function dashAwareDistance(word: string, dashWord: string) {
const fullDistance = distance(word, dashWord);
const distances = dashWord.split('-').map(w => distance(w, word));
const meanDistance = distances.reduce((accu, curr) => accu + curr) / distances.length;
const meanDistance =
distances.reduce((accu, curr) => accu + curr) / distances.length;
return fullDistance > meanDistance ? fullDistance : meanDistance;
}

View File

@@ -5,7 +5,7 @@ export class NowError<C, Meta> extends Error {
constructor({
code,
message,
meta
meta,
}: {
code: C;
message: string;

View File

@@ -2,4 +2,4 @@ import chalk from 'chalk';
export default function highlight(text: string): string {
return chalk.bold.underline(text);
}
}

View File

@@ -1,5 +1,5 @@
import chalk from 'chalk';
export default function success (msg: string): string {
export default function success(msg: string): string {
return `${chalk.cyan('> Success!')} ${msg}`;
}

View File

@@ -6,7 +6,7 @@ export default async function* raceAsyncGenerators(...args: any[]) {
yield new Promise(resolve => {
let resolved = false;
nextPromises.forEach((nextPromise, idx) => {
nextPromise.then(({ value, done }: { value: any, done: boolean }) => {
nextPromise.then(({ value, done }: { value: any; done: boolean }) => {
if (!resolved) {
resolved = true;
resolve(value);
@@ -15,7 +15,7 @@ export default async function* raceAsyncGenerators(...args: any[]) {
} else {
nextPromises = [
...nextPromises.slice(0, idx),
...nextPromises.slice(idx + 1)
...nextPromises.slice(idx + 1),
];
}
}

View File

@@ -105,7 +105,7 @@ test('[vercel dev] throws an error when an edge function has no response', async
expect(await res.status).toBe(500);
expect(await res.text()).toMatch('FUNCTION_INVOCATION_FAILED');
expect(stdout).toMatch(
/Error from API Route \/api\/edge-no-response: Edge Function "api\/edge-no-response.js" did not return a response./g
/Error from API Route \/api\/edge-no-response: Edge Function did not return a response./g
);
} finally {
await dev.kill();
@@ -304,12 +304,12 @@ test('[vercel dev] should handle missing handler errors thrown in edge functions
);
validateResponseHeaders(res);
const { stdout } = await dev.kill();
const { stderr } = await dev.kill();
expect(await res.text()).toMatch(
/<strong>500<\/strong>: INTERNAL_SERVER_ERROR/g
);
expect(stdout).toMatch(
expect(stderr).toMatch(
/No default export was found. Add a default export to handle requests./g
);
} finally {

View File

@@ -12,7 +12,7 @@ const {
} = require('../../../../test/lib/deployment/now-deploy');
const { spawnSync, execFileSync } = require('child_process');
jest.setTimeout(6 * 60 * 1000);
jest.setTimeout(10 * 60 * 1000);
const isCI = !!process.env.CI;
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

View File

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

View File

@@ -0,0 +1 @@
<h1>hello main</h1>

View File

@@ -0,0 +1 @@
<h1>hello test</h1>

View File

@@ -0,0 +1,15 @@
{
"name": "secondary",
"builds": [
{
"src": "test.html",
"use": "@vercel/static"
}
],
"routes": [
{
"src": "/another-test",
"dest": "/test.html"
}
]
}

View File

@@ -0,0 +1,15 @@
{
"name": "original",
"builds": [
{
"src": "main.html",
"use": "@vercel/static"
}
],
"routes": [
{
"src": "/another-main",
"dest": "/main.html"
}
]
}

View File

@@ -96,7 +96,15 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
),
},
'dev-fail-on-recursion-command': {
'package.json': '{}',
'package.json': JSON.stringify({
scripts: {
build: 'echo "build script"',
},
}),
'vercel.json': JSON.stringify({
version: 2,
devCommand: `${binaryPath} dev`,
}),
},
'build-fail-on-recursion-command': {
'package.json': '{}',
@@ -176,12 +184,12 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
'local-config-v2': {
[`main-${session}.html`]: '<h1>hello main</h1>',
[`test-${session}.html`]: '<h1>hello test</h1>',
'now.json': JSON.stringify({
'vercel.json': JSON.stringify({
name: 'original',
builds: [{ src: `main-${session}.html`, use: '@vercel/static' }],
routes: [{ src: '/another-main', dest: `/main-${session}.html` }],
}),
'now-test.json': JSON.stringify({
'vercel-test.json': JSON.stringify({
name: 'secondary',
builds: [{ src: `test-${session}.html`, use: '@vercel/static' }],
routes: [{ src: '/another-test', dest: `/test-${session}.html` }],

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
import ms from 'ms';
import fs from 'fs-extra';
import { join } from 'path';
import { getWriteableDirectory } from '@vercel/build-utils';
@@ -8,7 +7,7 @@ import { defaultProject, useProject } from '../../../mocks/project';
import { useTeams } from '../../../mocks/team';
import { useUser } from '../../../mocks/user';
jest.setTimeout(ms('1 minute'));
jest.setTimeout(2 * 60 * 1000);
const fixture = (name: string) =>
join(__dirname, '../../../fixtures/unit/commands/build', name);
@@ -1263,4 +1262,46 @@ describe('build', () => {
expect(packageDistFiles).toContain('dist-module.js');
});
});
it('should use --local-config over default vercel.json', async () => {
const cwd = fixture('local-config');
const output = join(cwd, '.vercel/output');
try {
client.stdout.pipe(process.stdout);
client.stderr.pipe(process.stderr);
process.chdir(cwd);
let exitCode = await build(client);
delete process.env.__VERCEL_BUILD_RUNNING;
expect(exitCode).toEqual(0);
let config = await fs.readJSON(join(output, 'config.json'));
expect(config.routes).toContainEqual({
src: '^/another-main$',
dest: '/main.html',
});
expect(config.routes).not.toContainEqual({
src: '^/another-test$',
dest: '/test.html',
});
client.localConfigPath = 'vercel-test.json';
exitCode = await build(client);
expect(exitCode).toEqual(0);
config = await fs.readJSON(join(output, 'config.json'));
expect(config.routes).not.toContainEqual({
src: '^/another-main$',
dest: '/main.html',
});
expect(config.routes).toContainEqual({
src: '^/another-test$',
dest: '/test.html',
});
} finally {
process.chdir(originalCwd);
delete client.localConfigPath;
delete process.env.__VERCEL_BUILD_RUNNING;
}
});
});

View File

@@ -3,6 +3,8 @@ import { emoji } from '../../../src/util/emoji';
import { client } from '../../mocks/client';
import { useUser } from '../../mocks/user';
jest.setTimeout(10000);
describe('login', () => {
it('should not allow the `--token` flag', async () => {
client.setArgv('login', '--token', 'foo');

View File

@@ -1,4 +1,3 @@
import ms from 'ms';
import { join } from 'path';
import { remove } from 'fs-extra';
import { getWriteableDirectory } from '@vercel/build-utils';
@@ -10,7 +9,7 @@ import {
import vercelNextPkg from '@vercel/next/package.json';
import vercelNodePkg from '@vercel/node/package.json';
jest.setTimeout(ms('30 seconds'));
jest.setTimeout(60 * 1000);
const repoRoot = join(__dirname, '../../../../../..');

View File

@@ -14,8 +14,8 @@ describe('sortBuilders()', () => {
},
{
name: 'should sort @vercel/remix from end to beginning',
input: ['@vercel/python', '@vercel/node', '@vercel/remix'],
output: ['@vercel/remix', '@vercel/python', '@vercel/node'],
input: ['@vercel/python', '@vercel/node', '@vercel/remix-builder'],
output: ['@vercel/remix-builder', '@vercel/python', '@vercel/node'],
},
{
name: 'should sort @vercel/redwood from beginning to beginning',

View File

@@ -15,6 +15,8 @@ import { useUser } from '../../../mocks/user';
import { defaultProject, useProject } from '../../../mocks/project';
import { Project } from '@vercel-internals/types';
jest.setTimeout(10 * 1000);
const fixture = (name: string) =>
join(__dirname, '../../../fixtures/unit/create-git-meta', name);

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "12.4.3",
"version": "12.4.7",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -43,8 +43,8 @@
]
},
"dependencies": {
"@vercel/build-utils": "6.3.3",
"@vercel/routing-utils": "2.1.10",
"@vercel/build-utils": "6.6.0",
"@vercel/routing-utils": "2.1.11",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",
"async-sema": "3.0.0",

View File

@@ -30,19 +30,19 @@ export interface Deployment {
public: boolean;
ownerId: string;
readyState:
| 'INITIALIZING'
| 'ANALYZING'
| 'BUILDING'
| 'DEPLOYING'
| 'READY'
| 'ERROR';
| 'INITIALIZING'
| 'ANALYZING'
| 'BUILDING'
| 'DEPLOYING'
| 'READY'
| 'ERROR';
state?:
| 'INITIALIZING'
| 'ANALYZING'
| 'BUILDING'
| 'DEPLOYING'
| 'READY'
| 'ERROR';
| 'INITIALIZING'
| 'ANALYZING'
| 'BUILDING'
| 'DEPLOYING'
| 'READY'
| 'ERROR';
createdAt: string;
createdIn: string;
env: {

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/frameworks",
"version": "1.3.2",
"version": "1.3.3",
"main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts",
"files": [
@@ -21,7 +21,7 @@
"@types/js-yaml": "3.12.1",
"@types/node": "14.18.33",
"@types/node-fetch": "2.5.8",
"@vercel/routing-utils": "2.1.10",
"@vercel/routing-utils": "2.1.11",
"ajv": "6.12.2",
"typescript": "4.3.4"
}

View File

@@ -199,7 +199,7 @@ export const frameworks = [
description: 'A new Remix app — the result of running `npx create-remix`.',
website: 'https://remix.run',
sort: 6,
useRuntime: { src: 'package.json', use: '@vercel/remix' },
useRuntime: { src: 'package.json', use: '@vercel/remix-builder' },
ignoreRuntimes: ['@vercel/node'],
detectors: {
some: [

View File

@@ -30,7 +30,7 @@ export async function readConfigFile<T>(
if (name.endsWith('.json')) {
return JSON.parse(str) as T;
} else if (name.endsWith('.toml')) {
return (toml.parse(str) as unknown) as T;
return toml.parse(str) as unknown as T;
} else if (name.endsWith('.yaml') || name.endsWith('.yml')) {
return yaml.safeLoad(str, { filename: name }) as T;
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/fs-detectors",
"version": "3.8.3",
"version": "3.8.7",
"description": "Vercel filesystem detectors",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -20,8 +20,8 @@
},
"dependencies": {
"@vercel/error-utils": "1.0.8",
"@vercel/frameworks": "1.3.2",
"@vercel/routing-utils": "2.1.10",
"@vercel/frameworks": "1.3.3",
"@vercel/routing-utils": "2.1.11",
"glob": "8.0.3",
"js-yaml": "4.1.0",
"json5": "2.2.2",
@@ -35,7 +35,7 @@
"@types/minimatch": "3.0.5",
"@types/node": "14.18.33",
"@types/semver": "7.3.10",
"@vercel/build-utils": "6.3.3",
"@vercel/build-utils": "6.6.0",
"typescript": "4.3.4"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/gatsby-plugin-vercel-builder",
"version": "1.2.0",
"version": "1.2.5",
"main": "dist/index.js",
"files": [
"dist",
@@ -15,9 +15,9 @@
},
"dependencies": {
"@sinclair/typebox": "0.25.24",
"@vercel/build-utils": "6.3.3",
"@vercel/node": "2.9.11",
"@vercel/routing-utils": "2.1.10",
"@vercel/build-utils": "6.6.0",
"@vercel/node": "2.10.1",
"@vercel/routing-utils": "2.1.11",
"esbuild": "0.14.47",
"etag": "1.8.1",
"fs-extra": "11.1.0"

View File

@@ -1,5 +1,5 @@
import { join, dirname } from 'path';
import { copy, move, ensureDir } from 'fs-extra';
import { join } from 'path';
import { hardLinkDir } from '@vercel/build-utils';
export async function createStaticDir(prefix?: string) {
const publicDir = join(process.cwd(), 'public');
@@ -10,14 +10,13 @@ export async function createStaticDir(prefix?: string) {
'static',
prefix ?? ''
);
await ensureDir(dirname(targetDir));
try {
await move(publicDir, targetDir);
await hardLinkDir(publicDir, [targetDir]);
} catch (err: any) {
console.error(
`Failed to move "public" dir from "${publicDir}" to "${targetDir}". Copying instead.`,
err
console.error(err);
throw new Error(
`Failed to hardlink (or copy) "public" dir files from "${publicDir}" to "${targetDir}".`
);
await copy(publicDir, targetDir);
}
}

View File

@@ -1,16 +1,33 @@
import tar from 'tar';
import execa from 'execa';
import fetch from 'node-fetch';
import { mkdirp, pathExists, readFile } from 'fs-extra';
import { join, delimiter } from 'path';
import {
createWriteStream,
mkdirp,
pathExists,
readFile,
remove,
symlink,
} from 'fs-extra';
import { join, delimiter, dirname } from 'path';
import stringArgv from 'string-argv';
import { debug } from '@vercel/build-utils';
import { cloneEnv, debug } from '@vercel/build-utils';
import { pipeline } from 'stream';
import { promisify } from 'util';
import { tmpdir } from 'os';
import yauzl from 'yauzl-promise';
import XDGAppPaths from 'xdg-app-paths';
import type { Env } from '@vercel/build-utils';
const streamPipeline = promisify(pipeline);
const versionMap = new Map([
['1.19', '1.19.5'],
['1.18', '1.18.1'],
['1.17', '1.17.3'],
['1.16', '1.16.10'],
['1.15', '1.15.8'],
['1.20', '1.20.1'],
['1.19', '1.19.6'],
['1.18', '1.18.10'],
['1.17', '1.17.13'],
['1.16', '1.16.15'],
['1.15', '1.15.15'],
['1.14', '1.14.15'],
['1.13', '1.13.15'],
]);
@@ -20,17 +37,27 @@ const archMap = new Map([
]);
const platformMap = new Map([['win32', 'windows']]);
export const cacheDir = join('.vercel', 'cache', 'golang');
const getGoDir = (workPath: string) => join(workPath, cacheDir);
const GO_FLAGS = process.platform === 'win32' ? [] : ['-ldflags', '-s -w'];
const GO_MIN_VERSION = 13;
const getPlatform = (p: string) => platformMap.get(p) || p;
const getArch = (a: string) => archMap.get(a) || a;
const getGoUrl = (version: string, platform: string, arch: string) => {
function getGoUrl(version: string) {
const { arch, platform } = process;
const goArch = getArch(arch);
const goPlatform = getPlatform(platform);
const ext = platform === 'win32' ? 'zip' : 'tar.gz';
return `https://dl.google.com/go/go${version}.${goPlatform}-${goArch}.${ext}`;
};
const filename = `go${version}.${goPlatform}-${goArch}.${ext}`;
return {
filename,
url: `https://dl.google.com/go/${filename}`,
};
}
export const goGlobalCachePath = join(
XDGAppPaths('com.vercel.cli').cache(),
'golang'
);
export const OUT_EXTENSION = process.platform === 'win32' ? '.exe' : '';
@@ -39,39 +66,31 @@ export async function getAnalyzedEntrypoint(
filePath: string,
modulePath: string
) {
debug('Analyzing entrypoint %o with modulePath %o', filePath, modulePath);
const bin = join(__dirname, `analyze${OUT_EXTENSION}`);
const isAnalyzeExist = await pathExists(bin);
if (!isAnalyzeExist) {
debug(`Building analyze bin: ${bin}`);
const src = join(__dirname, 'util', 'analyze.go');
const go = await downloadGo(workPath, modulePath);
const go = await createGo({
modulePath,
workPath,
});
await go.build(src, bin);
}
debug(`Analyzing entrypoint ${filePath} with modulePath ${modulePath}`);
const args = [`-modpath=${modulePath}`, filePath];
const analyzed = await execa.stdout(bin, args);
debug('Analyzed entrypoint %o', analyzed);
debug(`Analyzed entrypoint ${analyzed}`);
return analyzed;
}
// Creates a `$GOPATH` directory tree, as per `go help gopath` instructions.
// Without this, `go` won't recognize the `$GOPATH`.
function createGoPathTree(goPath: string, platform: string, arch: string) {
const tuple = `${getPlatform(platform)}_${getArch(arch)}`;
debug('Creating GOPATH directory structure for %o (%s)', goPath, tuple);
return Promise.all([
mkdirp(join(goPath, 'bin')),
mkdirp(join(goPath, 'pkg', tuple)),
]);
}
class GoWrapper {
private env: { [key: string]: string };
private env: Env;
private opts: execa.Options;
constructor(env: { [key: string]: string }, opts: execa.Options = {}) {
constructor(env: Env, opts: execa.Options = {}) {
if (!opts.cwd) {
opts.cwd = process.cwd();
}
@@ -81,8 +100,12 @@ class GoWrapper {
private execute(...args: string[]) {
const { opts, env } = this;
debug('Exec %o', `go ${args.join(' ')}`);
return execa('go', args, { stdio: 'pipe', ...opts, env });
debug(
`Exec: go ${args
.map(a => (a.includes(' ') ? `"${a}"` : a))
.join(' ')} CWD=${opts.cwd}`
);
return execa('go', args, { stdio: 'inherit', ...opts, env });
}
mod() {
@@ -92,16 +115,16 @@ class GoWrapper {
get(src?: string) {
const args = ['get'];
if (src) {
debug('Fetching `go` dependencies for file %o', src);
debug(`Fetching 'go' dependencies for file ${src}`);
args.push(src);
} else {
debug('Fetching `go` dependencies for cwd %o', this.opts.cwd);
debug(`Fetching 'go' dependencies for cwd ${this.opts.cwd}`);
}
return this.execute(...args);
}
build(src: string | string[], dest: string) {
debug('Building optimized `go` binary %o -> %o', src, dest);
debug(`Building optimized 'go' binary ${src} -> ${dest}`);
const sources = Array.isArray(src) ? src : [src];
const flags = process.env.GO_BUILD_FLAGS
@@ -112,72 +135,222 @@ class GoWrapper {
}
}
export async function createGo(
workPath: string,
goPath: string,
platform = process.platform,
arch = process.arch,
opts: execa.Options = {},
goMod = false
) {
const binPath = join(getGoDir(workPath), 'bin');
debug(`Adding ${binPath} to PATH`);
const path = `${binPath}${delimiter}${process.env.PATH}`;
const env: { [key: string]: string } = {
...process.env,
PATH: path,
GOPATH: goPath,
...opts.env,
};
if (goMod) {
env.GO111MODULE = 'on';
type CreateGoOptions = {
modulePath?: string;
opts?: execa.Options;
workPath: string;
};
/**
* Initializes a `GoWrapper` instance.
*
* This function determines the Go version to use by first looking in the
* `go.mod`, if exists, otherwise uses the latest version from the version
* map.
*
* Next it will attempt to find the desired Go version by checking the
* following locations:
* 1. The "local" project cache directory (e.g. `.vercel/cache/golang`)
* 2. The "global" cache directory (e.g. `~/.cache/com.vercel.com/golang`)
* 3. The system PATH
*
* If the Go version is not found, it's downloaded and installed in the
* global cache directory so it can be shared across projects. When using
* Linux or macOS, it creates a symlink from the global cache to the local
* cache directory so that `prepareCache` will persist it.
*
* @param modulePath The path possibly containing a `go.mod` file
* @param opts `execa` options (`cwd`, `env`, `stdio`, etc)
* @param workPath The path to the project to be built
* @returns An initialized `GoWrapper` instance
*/
export async function createGo({
modulePath,
opts = {},
workPath,
}: CreateGoOptions): Promise<GoWrapper> {
// parse the `go.mod`, if exists
let goPreferredVersion: string | undefined;
if (modulePath) {
goPreferredVersion = await parseGoModVersion(modulePath);
}
await createGoPathTree(goPath, platform, arch);
// default to newest (first) supported go version
const goSelectedVersion =
goPreferredVersion || Array.from(versionMap.values())[0];
const env = cloneEnv(process.env, opts.env);
const { PATH } = env;
const { platform } = process;
const goGlobalCacheDir = join(
goGlobalCachePath,
`${goSelectedVersion}_${platform}_${process.arch}`
);
const goCacheDir = join(workPath, cacheDir);
if (goPreferredVersion) {
debug(`Preferred go version ${goPreferredVersion} (from go.mod)`);
env.GO111MODULE = 'on';
} else {
debug(
`Preferred go version ${goSelectedVersion} (latest from version map)`
);
}
const setGoEnv = async (goDir: string | null) => {
if (platform !== 'win32' && goDir === goGlobalCacheDir) {
debug(`Symlinking ${goDir} -> ${goCacheDir}`);
await remove(goCacheDir);
await mkdirp(dirname(goCacheDir));
await symlink(goDir, goCacheDir);
goDir = goCacheDir;
}
env.GOROOT = goDir || undefined;
env.PATH = goDir ? `${join(goDir, 'bin')}${delimiter}${PATH}` : PATH;
};
// try each of these Go directories looking for the version we need
const goDirs = {
'local cache': goCacheDir,
'global cache': goGlobalCacheDir,
'system PATH': null,
};
for (const [label, goDir] of Object.entries(goDirs)) {
try {
const goBinDir = goDir && join(goDir, 'bin');
if (goBinDir && !(await pathExists(goBinDir))) {
debug(`Go not found in ${label}`);
continue;
}
env.GOROOT = goDir || undefined;
env.PATH = goBinDir || PATH;
const { stdout } = await execa('go', ['version'], { env });
const { minor, short, version } = parseGoVersionString(stdout);
if (minor < GO_MIN_VERSION) {
debug(`Found go ${version} in ${label}, but version is unsupported`);
}
if (version === goSelectedVersion || short === goSelectedVersion) {
console.log(`Selected go ${version} (from ${label})`);
await setGoEnv(goDir);
return new GoWrapper(env, opts);
} else {
debug(`Found go ${version} in ${label}, but need ${goSelectedVersion}`);
}
} catch {
debug(`Go not found in ${label}`);
}
}
// we need to download and cache the desired `go` version
await download({
dest: goGlobalCacheDir,
version: goSelectedVersion,
});
await setGoEnv(goGlobalCacheDir);
return new GoWrapper(env, opts);
}
export async function downloadGo(workPath: string, modulePath: string) {
const dir = getGoDir(workPath);
const { platform, arch } = process;
const version = await parseGoVersion(modulePath);
/**
* Download and installs the Go distribution.
*
* @param dest The directory to install Go into. If directory exists, it is
* first deleted before installing.
* @param version The Go version to download
*/
async function download({ dest, version }: { dest: string; version: string }) {
const { filename, url } = getGoUrl(version);
console.log(`Downloading go: ${url}`);
const res = await fetch(url);
// Check if `go` is already installed in user's `$PATH`
const { failed, stdout } = await execa('go', ['version'], { reject: false });
if (!failed && parseInt(stdout.split('.')[1]) >= GO_MIN_VERSION) {
debug('Using system installed version of `go`: %o', stdout.trim());
return createGo(workPath, dir, platform, arch);
if (!res.ok) {
throw new Error(`Failed to download: ${url} (${res.status})`);
}
// Check `go` bin in cacheDir
const isGoExist = await pathExists(join(dir, 'bin'));
if (!isGoExist) {
debug('Installing `go` v%s to %o for %s %s', version, dir, platform, arch);
const url = getGoUrl(version, platform, arch);
debug('Downloading `go` URL: %o', url);
const res = await fetch(url);
debug(`Installing go ${version} to ${dest}`);
if (!res.ok) {
throw new Error(`Failed to download: ${url} (${res.status})`);
await remove(dest);
await mkdirp(dest);
if (/\.zip$/.test(filename)) {
const zipFile = join(tmpdir(), filename);
try {
await streamPipeline(res.body, createWriteStream(zipFile));
const zip = await yauzl.open(zipFile);
let entry = await zip.readEntry();
while (entry) {
const fileName = entry.fileName.split('/').slice(1).join('/');
if (fileName) {
const destPath = join(dest, fileName);
if (/\/$/.test(fileName)) {
await mkdirp(destPath);
} else {
const [entryStream] = await Promise.all([
entry.openReadStream(),
mkdirp(dirname(destPath)),
]);
const out = createWriteStream(destPath);
await streamPipeline(entryStream, out);
}
}
entry = await zip.readEntry();
}
} finally {
await remove(zipFile);
}
// TODO: use a zip extractor when `ext === "zip"`
await mkdirp(dir);
await new Promise((resolve, reject) => {
res.body
.on('error', reject)
.pipe(tar.extract({ cwd: dir, strip: 1 }))
.on('error', reject)
.on('finish', resolve);
});
return;
}
return createGo(workPath, dir, platform, arch);
await new Promise((resolve, reject) => {
res.body
.on('error', reject)
.pipe(tar.extract({ cwd: dest, strip: 1 }))
.on('error', reject)
.on('finish', resolve);
});
}
async function parseGoVersion(modulePath: string): Promise<string> {
// default to newest (first)
let version = Array.from(versionMap.values())[0];
const goVersionRegExp = /(\d+)\.(\d+)(?:\.(\d+))?/;
/**
* Parses the raw output from `go version` and returns the version parts.
*
* @param goVersionOutput The output from `go version`
*/
function parseGoVersionString(goVersionOutput: string) {
const matches = goVersionOutput.match(goVersionRegExp) || [];
const major = parseInt(matches[1], 10);
const minor = parseInt(matches[2], 10);
const patch = parseInt(matches[3] || '0', 10);
return {
version: `${major}.${minor}.${patch}`,
short: `${major}.${minor}`,
major,
minor,
patch,
};
}
/**
* Attempts to parse the preferred Go version from the `go.mod` file.
*
* @param modulePath The directory containing the `go.mod` file
* @returns
*/
async function parseGoModVersion(
modulePath: string
): Promise<string | undefined> {
let version;
const file = join(modulePath, 'go.mod');
try {
const content = await readFile(file, 'utf8');
const matches = /^go (\d+)\.(\d+)\.?$/gm.exec(content) || [];
@@ -189,7 +362,7 @@ async function parseGoVersion(modulePath: string): Promise<string> {
} else {
console.log(`Warning: Unknown Go version in ${file}`);
}
} catch (err) {
} catch (err: any) {
if (err.code === 'ENOENT') {
debug(`File not found: ${file}`);
} else {
@@ -197,6 +370,5 @@ async function parseGoVersion(modulePath: string): Promise<string> {
}
}
debug(`Selected Go version ${version}`);
return version;
}

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