Compare commits

...

38 Commits

Author SHA1 Message Date
Vercel Release Bot
a92467719b Version Packages (#10528)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.2.5

### Patch Changes

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

## @vercel/next@4.0.6

### Patch Changes

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

## @vercel/remix-builder@2.0.6

### Patch Changes

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

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

- Fixes for Remix v2
([#10525](https://github.com/vercel/vercel/pull/10525))
2023-09-18 15:44:07 -03:00
Nathan Rajlich
f6f16b0347 [remix] Fix ESM mode for Edge runtime, add Remix v2 E2E test (#10530)
Similar to the default import fix from #10525 which was for Node runtime, but this one fixes Edge runtime.

Also adds an E2E test for Remix v2, including both a Node route and Edge route.
2023-09-18 18:26:53 +00:00
Trek Glowacki
92ad73b8f3 Restore datadog checking with logs not exit codes (#10527)
Restores DataDog flakey test detection. Briefly disabled because the old method of using exit codes would bail the entire workflow.

Taking the Turbo team's suggestion of looking at `runData.execution` values to avoid an extra loop. Now with unit tests!
2023-09-18 16:43:16 +00:00
Steven
849eedf0f2 [next] fix feature flag detection (#10531)
For feature flags, we use the string `1` for enabled and the string `0` for disabled.

So we need to check the value of the env var, not the presence of the env var.
2023-09-18 16:17:55 +00:00
Vercel Release Bot
848a62e4a5 [tests] Upgrade Turbo to version 1.10.14 (#10529)
This auto-generated PR updates Turbo to version 1.10.14
2023-09-18 15:31:52 +00:00
Nathan Rajlich
cb784aeb9c [remix] Fixes for Remix v2 (#10525)
The Remix v2 template now uses `"type": "module"` by default, so adjust our bundling logic to account for that possibility.
2023-09-18 14:32:08 +00:00
Vercel Release Bot
3035e18fb6 [remix] Update @remix-run/dev to v2.0.0 (#10526)
This auto-generated PR updates `@remix-run/dev` to version 2.0.0.
2023-09-18 14:05:42 +00:00
Vercel Release Bot
eb40c4c4a0 Version Packages (#10514)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @vercel/fs-detectors@5.1.0

### Minor Changes

- Add support for bun detection in monorepo
([#10511](https://github.com/vercel/vercel/pull/10511))

## vercel@32.2.4

### Patch Changes

- Add support for bun detection in monorepo
([#10511](https://github.com/vercel/vercel/pull/10511))

- Updated dependencies
\[[`1b6f3a0f6`](1b6f3a0f65)]:
    -   @vercel/static-build@2.0.6

## @vercel/static-build@2.0.6

### Patch Changes

- Add support for bun detection in monorepo
([#10511](https://github.com/vercel/vercel/pull/10511))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-15 15:13:54 -04:00
Nathan Rajlich
c90ee12b17 Update bun changeset to bump static-build + CLI (#10516)
Also reverts https://github.com/vercel/vercel/pull/10515 since it didn't
work the way we were hoping.
2023-09-15 16:06:32 -03:00
Nathan Rajlich
78be0200b4 Enable changesets experimental updateInternalDependents: 'always' config (#10515)
From the [sounds of
it](https://github.com/changesets/changesets/blob/main/docs/experimental-options.md#updateinternaldependents-type-out-of-range--always),
setting this config value to "always" will make it so that a patch
release will happen for a package that depends on another package which
is being bumped. This would normally happen anyways, but does not happen
when a dependency is a `devDependency` rather than a `dependency` (which
happens for the Builders and CLI, since those packages get bundled and
thus have their deps listed as devDependencies).
2023-09-15 15:54:47 -03:00
Steven
1b6f3a0f65 [fs-detectors] Add support for bun detection in monorepo (#10511)
E2E test looks like:

```sh
bunx create-turbo@canary
cd my-turborepo
gh repo create
vc link --repo
vc deploy
```
2023-09-15 14:13:26 -04:00
Trek Glowacki
eceb15ace9 Revert skipping datadog reports (#10513)
Revert
[.github/workflows/test.yml](https://github.com/vercel/vercel/pull/10513/files#diff-faff1af3d8ff408964a57b2e475f69a6b7c7b71c9978cccc8f471798caac2c88)
to an earlier version.
2023-09-15 13:49:24 -04:00
Vercel Release Bot
fa3f701e05 Version Packages (#10505)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-14 16:06:33 -05:00
Trek Glowacki
9953fc765f Complete the error message (#10509) 2023-09-14 11:39:53 -05:00
Trek Glowacki
29ea1af971 Skip DataDog reporting if Turbo cache indicates the uploaded files would be identical (#10501) 2023-09-14 10:47:20 -05:00
Zack Tanner
083aad448e [next] missed a prerender for experimentalBypassFor (#10504)
Missed this in https://github.com/vercel/vercel/pull/10497
2023-09-14 01:19:13 +00:00
Vercel Release Bot
314a105ba1 Version Packages (#10493)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-13 17:15:29 -05:00
Ikko Eltociear Ashimine
1abda9ca87 [cli] Fix typo in corepack.ts (#10499)
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-09-13 08:26:51 -05:00
Zack Tanner
7a0fed970c [next] provide experimentalBypassFor to prerender from manifest (#10497) 2023-09-12 17:40:49 -05:00
Jimmy Lai
2f461a8b0b next.js: add option to use bundled runtime (#10485)
This PR adds an environment variable that should allow us to test the bundled version for Next.js on Vercel, see https://github.com/vercel/next.js/pull/52997 for reference.

The changes include:
- a new environment variable `VERCEL_NEXT_BUNDLED_SERVER`
- some logic changes that will put app route handlers into their own lambda groups
- extra logic to require early the rendering runtimes (see PR above for details)
2023-09-12 19:45:23 +00:00
Steven
ec894bdf7f [frameworks] Add bun install placeholder (#10492)
<img width="899" alt="image"
src="https://github.com/vercel/vercel/assets/229881/f37a3cfd-bbb9-4c33-88dc-cd19b9855a47">
2023-09-12 11:29:24 -04:00
Andy
009cea6d30 [examples] Use placeholder for API Key (#10490)
The Ionic example has an actual Google Maps API key by default and we'd
like to not have it displayed, so we'll replace it with a placeholder
instead. Considering it's commented out anyways, this will be a no-op.

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-09-12 11:25:02 -04:00
Nathan Rajlich
1bab21026e [remix] Fix usage with bun install (#10489) 2023-09-12 09:55:16 -05:00
Vercel Release Bot
bcebab7517 Version Packages (#10478)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


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

### Minor Changes

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

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

### Patch Changes

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

## vercel@32.2.1

### Patch Changes

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

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

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

## @vercel/client@13.0.3

### Patch Changes

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

## @vercel/edge@1.0.2

### Patch Changes

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

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

### Patch Changes

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

## @vercel/go@3.0.1

### Patch Changes

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

## @vercel/hydrogen@1.0.1

### Patch Changes

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

## @vercel/next@4.0.3

### Patch Changes

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

## @vercel/node@3.0.5

### Patch Changes

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

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

## @vercel/python@4.0.1

### Patch Changes

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

## @vercel/redwood@2.0.2

### Patch Changes

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

## @vercel/remix-builder@2.0.4

### Patch Changes

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

## @vercel/ruby@2.0.2

### Patch Changes

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

## @vercel/static-build@2.0.5

### Patch Changes

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

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

## @vercel-internals/types@1.0.10

### Patch Changes

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

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-11 17:30:02 -04:00
Steven
45b73c7e86 [build-utils] Add zero config detection for bun package manager (#10486)
> [!IMPORTANT]  
> This PR will only support Bun as a package manager at build time. 
> Bun will **not** work at runtime with Serverless Functions or Edge
Functions at this time.

- Depends on https://github.com/vercel/api/pull/21869
- Fixes https://github.com/orgs/vercel/discussions/2021
- Closes https://github.com/vercel/vercel/pull/10244
- Related https://github.com/nodejs/corepack/issues/295
- Docs https://bun.sh/docs/install
2023-09-11 17:26:34 -04:00
Zack Tanner
a732d30c84 [next] fix content-type for RSC prefetches (#10487)
This ensures that the `.prefetch.rsc` requests respond with the correct `content-type` since this is used by Next.js to determine if a request is valid or not (and in the case it's invalid, an mpa navigation will occur)

Fixes: https://github.com/vercel/next.js/issues/54934
2023-09-11 19:04:16 +00:00
Lee Robinson
8504735808 [examples] Update Astro starter (#10397)
Deployed https://astro.vercel.app/image.
2023-09-11 16:29:54 +00:00
Kiko Beats
9d64312aaa [node] upgrade edge-runtime (#10451) 2023-09-10 13:14:43 +00:00
Chris Barber
a8ad176262 [redwood] Use new esbuild script (#10471) 2023-09-09 01:48:54 +00:00
Nathan Rajlich
0ee089a501 [remix] Bundle, remove types and source maps (#10479)
For consistency with other Builders.
2023-09-09 00:35:56 +00:00
Zack Tanner
d8bc570f60 [build-utils] add experimentalBypassFor field to Prerender (#10481)
This adds an experimental flag to `Prerender` outputs as a way to programmatically bypass the cache and hit the lambda directly, using a similar interface to `has`. 

(Note: I copied over `HasField` from `@vercel/router-utils` since it wasn't available for import in `build-utils`, but can add it as a dep if that's preferred)

The specific use-case being targeted here relates to https://github.com/vercel/next.js/pull/51534 -- a Next.js page marked static should still be able to initiate server actions.
2023-09-08 23:33:59 +00:00
Nathan Rajlich
f15cba6148 [hydrogen] Bundle, remove types and source maps (#10480)
Similar to #10479, but for `@vercel/hydrogen`.
2023-09-08 22:55:03 +00:00
Chris Barber
989f0d8139 [ruby] Use new esbuild script (#10472) 2023-09-08 17:27:17 -05:00
Chris Barber
6784e77516 [go] Update to esbuild script (#10468)
Co-authored-by: Nathan Rajlich <n@n8.io>
2023-09-08 17:00:40 -05:00
Chris Barber
6baefc825a [python] Update to esbuild script (#10470)
Co-authored-by: Steven <steven@ceriously.com>
2023-09-08 16:23:23 -05:00
Chris Barber
0a08e4b23e [cli] Update @vercel/fun@1.1.0 (#10477) 2023-09-08 15:39:13 -05:00
Nathan Rajlich
b265e13d40 [static-build] Use esbuild (#10462)
Switch to using esbuild to compile + bundle `@vercel/static-build`.
2023-09-08 19:39:12 +00:00
Nabeel Sulieman
50e04dd858 Add optional experimentalStreamingLambda field for prerender (#10476)
This adds a new `experimentalStreamingLambda` field to Prerender
outputs, allowing references to an optional streaming lambda path.
2023-09-08 11:42:06 -07:00
118 changed files with 6447 additions and 1729 deletions

View File

@@ -83,7 +83,7 @@ jobs:
env:
FORCE_COLOR: '1'
- name: Test ${{matrix.packageName}}
run: node utils/gen.js && node_modules/.bin/turbo run test --cache-dir=".turbo" --log-order=stream --scope=${{matrix.packageName}} --no-deps -- ${{ join(matrix.testPaths, ' ') }}
run: node utils/gen.js && node_modules/.bin/turbo run test --summarize --cache-dir=".turbo" --log-order=stream --scope=${{matrix.packageName}} --no-deps -- ${{ join(matrix.testPaths, ' ') }}
shell: bash
env:
JEST_JUNIT_OUTPUT_FILE: ${{github.workspace}}/.junit-reports/${{matrix.scriptName}}-${{matrix.packageName}}-${{matrix.chunkNumber}}-${{ matrix.runner }}.xml
@@ -91,13 +91,18 @@ jobs:
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
VERCEL_TEST_REGISTRATION_URL: ${{ secrets.VERCEL_TEST_REGISTRATION_URL }}
FORCE_COLOR: '1'
- name: 'Determing Turbo HIT or MISS'
id: turbo-summary
shell: bash
run: |
TURBO_MISS_COUNT=`node utils/determine-turbo-hit-or-miss.js`
echo "MISS COUNT: $TURBO_MISS_COUNT"
echo "misses=$TURBO_MISS_COUNT" >> $GITHUB_OUTPUT
- name: fetch ssl certificate after tests (linux, os x)
if: matrix.runner != 'windows-latest'
run: echo | openssl s_client -showcerts -servername 'api.vercel.com' -connect 76.76.21.21:443
- name: 'Upload Test Report to Datadog'
if: always()
if: ${{ steps['turbo-summary'].outputs.misses != '0' }}
run: 'npx @datadog/datadog-ci@2.18.1 junit upload --service vercel-cli .junit-reports'
env:
DATADOG_API_KEY: ${{secrets.DATADOG_API_KEY_CLI}}

View File

@@ -3,9 +3,10 @@
This directory is a brief example of an [Astro](https://astro.build/) site that can be deployed to Vercel with zero configuration. This demo showcases:
- `/` - A static page (pre-rendered)
- `/ssr` - A page that uses server-side rendering (through Vercel Edge Functions)
- `/ssr-with-swr-caching` - Similar to the previous page, but also caches the response on the Vercel Edge Network using `cache-control` headers
- `/edge.json` - An Astro API Endpoint that returns JSON data using Vercel Edge Functions
- `/ssr` - A page that uses server-side rendering (through [Vercel Edge Functions](https://vercel.com/docs/functions/edge-functions))
- `/ssr-with-swr-caching` - Similar to the previous page, but also caches the response on the [Vercel Edge Network](https://vercel.com/docs/edge-network/overview) using `cache-control` headers
- `/image` - Astro [Asset](https://docs.astro.build/en/guides/assets/) using Vercel [Image Optimization](https://vercel.com/docs/image-optimization)
- `/edge.json` - An Astro API Endpoint that returns JSON data using [Vercel Edge Functions](https://vercel.com/docs/functions/edge-functions)
Learn more about [Astro on Vercel](https://vercel.com/docs/frameworks/astro).

View File

@@ -1,7 +1,17 @@
import { defineConfig } from 'astro/config';
// Use Vercel Edge Functions (Recommended)
import vercel from '@astrojs/vercel/edge';
// Can also use Serverless Functions
// import vercel from '@astrojs/vercel/serverless';
// Or a completely static build
// import vercel from '@astrojs/vercel/static';
export default defineConfig({
output: 'server',
adapter: vercel(),
experimental: {
assets: true
},
adapter: vercel({
imageService: true,
}),
});

View File

@@ -8,8 +8,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/vercel": "3.2.2",
"astro": "^2.2.1",
"@astrojs/vercel": "3.8.2",
"astro": "^2.10.14",
"react": "18.2.0",
"web-vitals": "^3.3.1"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -1,4 +1,4 @@
/// <reference types="astro/client" />
/// <reference types="astro/client-image" />
interface ImportMetaEnv {
readonly PUBLIC_VERCEL_ANALYTICS_ID: string;

View File

@@ -0,0 +1,6 @@
---
import { Image } from 'astro:assets';
import astroLogo from '../assets/logo.png';
---
<Image src={astroLogo} alt="Astro Logo" width={50} quality={75} />

View File

@@ -29,7 +29,7 @@
<!-- Replace the API key with your own, see:
https://developers.google.com/maps/documentation/javascript/get-api-key -->
<!-- <script async="" defer="" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB8pf6ZdFQj5qw7rc_HSGrhUwQKfIe9ICw"></script> -->
<!-- <script async="" defer="" src="https://maps.googleapis.com/maps/api/js?key=<YOUR_GOOGLE_MAPS_API_KEY>"></script> -->
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body>

View File

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

View File

@@ -1,5 +1,12 @@
# @vercel-internals/types
## 1.0.10
### Patch Changes
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
- @vercel/build-utils@7.2.0
## 1.0.9
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@vercel-internals/types",
"version": "1.0.9",
"version": "1.0.10",
"types": "index.d.ts",
"main": "index.d.ts",
"files": [
@@ -10,7 +10,7 @@
"dependencies": {
"@types/node": "14.14.31",
"@vercel-internals/constants": "1.0.4",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"@vercel/routing-utils": "3.0.0"
},
"devDependencies": {

View File

@@ -33,7 +33,7 @@
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "29.1.0",
"turbo": "1.10.13",
"turbo": "1.10.14",
"typescript": "4.9.5"
},
"scripts": {

View File

@@ -1,5 +1,17 @@
# @vercel/build-utils
## 7.2.0
### Minor Changes
- Add new optional prerender field: experimentalStreamingLambdaPath ([#10476](https://github.com/vercel/vercel/pull/10476))
- [build-utils] Add zero config detection for bun package manager ([#10486](https://github.com/vercel/vercel/pull/10486))
### Patch Changes
- add `experimentalBypassFor` field to Prerender ([#10481](https://github.com/vercel/vercel/pull/10481))
## 7.1.1
### Patch Changes

View File

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

View File

@@ -16,7 +16,7 @@ import { cloneEnv } from '../clone-env';
// Only allow one `runNpmInstall()` invocation to run concurrently
const runNpmInstallSema = new Sema(1);
export type CliType = 'yarn' | 'npm' | 'pnpm';
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun';
export interface ScanParentDirsResult {
/**
@@ -284,26 +284,34 @@ export async function scanParentDirs(
readPackageJson && pkgJsonPath
? JSON.parse(await fs.readFile(pkgJsonPath, 'utf8'))
: undefined;
const [yarnLockPath, npmLockPath, pnpmLockPath] = await walkParentDirsMulti({
base: '/',
start: destPath,
filenames: ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml'],
});
const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] =
await walkParentDirsMulti({
base: '/',
start: destPath,
filenames: [
'yarn.lock',
'package-lock.json',
'pnpm-lock.yaml',
'bun.lockb',
],
});
let lockfilePath: string | undefined;
let lockfileVersion: number | undefined;
let cliType: CliType = 'yarn';
const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
Boolean(yarnLockPath),
npmLockPath
? readConfigFile<{ lockfileVersion: number }>(npmLockPath)
: null,
pnpmLockPath
? readConfigFile<{ lockfileVersion: number }>(pnpmLockPath)
: null,
]);
const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] =
await Promise.all([
Boolean(yarnLockPath),
npmLockPath
? readConfigFile<{ lockfileVersion: number }>(npmLockPath)
: null,
pnpmLockPath
? readConfigFile<{ lockfileVersion: number }>(pnpmLockPath)
: null,
bunLockPath ? fs.readFile(bunLockPath, 'utf8') : null,
]);
// Priority order is Yarn > pnpm > npm
// Priority order is Yarn > pnpm > npm > bun
if (hasYarnLock) {
cliType = 'yarn';
lockfilePath = yarnLockPath;
@@ -315,6 +323,11 @@ export async function scanParentDirs(
cliType = 'npm';
lockfilePath = npmLockPath;
lockfileVersion = packageLockJson.lockfileVersion;
} else if (bunLockBin) {
cliType = 'bun';
lockfilePath = bunLockPath;
// TODO: read "bun-lockfile-format-v0"
lockfileVersion = 0;
}
const packageJsonPath = pkgJsonPath || undefined;
@@ -451,6 +464,10 @@ export async function runNpmInstall(
commandArgs = args
.filter(a => a !== '--prefer-offline')
.concat(['install', '--unsafe-perm']);
} else if (cliType === 'bun') {
// @see options https://bun.sh/docs/cli/install
opts.prettyCommand = 'bun install';
commandArgs = ['install', ...args];
} else {
opts.prettyCommand = 'yarn install';
commandArgs = ['install', ...args];
@@ -505,6 +522,7 @@ export function getEnvForPackageManager({
const npm7 = '/node16/bin-npm7';
const pnpm7 = '/pnpm7/node_modules/.bin';
const pnpm8 = '/pnpm8/node_modules/.bin';
const bun1 = '/bun1';
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
if (cliType === 'npm') {
if (
@@ -516,7 +534,7 @@ export function getEnvForPackageManager({
) {
// Ensure that npm 7 is at the beginning of the `$PATH`
newEnv.PATH = `${npm7}${path.delimiter}${oldPath}`;
console.log('Detected `package-lock.json` generated by npm 7+...');
console.log('Detected `package-lock.json` generated by npm 7+');
}
} else if (cliType === 'pnpm') {
if (
@@ -528,7 +546,7 @@ 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\` version ${lockfileVersion} generated by pnpm 7...`
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7`
);
} else if (
typeof lockfileVersion === 'number' &&
@@ -539,7 +557,16 @@ export function getEnvForPackageManager({
// 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...`
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8`
);
}
} else if (cliType === 'bun') {
if (!oldPath.includes(bun1) && !corepackEnabled) {
// Ensure that Bun 1 is at the beginning of the `$PATH`
newEnv.PATH = `${bun1}${path.delimiter}${oldPath}`;
console.log('Detected `bun.lockb` generated by Bun');
console.warn(
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions'
);
}
} else {
@@ -548,7 +575,6 @@ export function getEnvForPackageManager({
newEnv.YARN_NODE_LINKER = 'node-modules';
}
}
return newEnv;
}
@@ -614,6 +640,8 @@ export async function runPackageJsonScript(
opts.prettyCommand = `npm run ${scriptName}`;
} else if (cliType === 'pnpm') {
opts.prettyCommand = `pnpm run ${scriptName}`;
} else if (cliType === 'bun') {
opts.prettyCommand = `bun run ${scriptName}`;
} else {
opts.prettyCommand = `yarn run ${scriptName}`;
}

View File

@@ -1,4 +1,4 @@
import { File } from './types';
import type { File, HasField } from './types';
import { Lambda } from './lambda';
interface PrerenderOptions {
@@ -12,6 +12,8 @@ interface PrerenderOptions {
initialStatus?: number;
passQuery?: boolean;
sourcePath?: string;
experimentalBypassFor?: HasField;
experimentalStreamingLambdaPath?: string;
}
export class Prerender {
@@ -26,6 +28,8 @@ export class Prerender {
public initialStatus?: number;
public passQuery?: boolean;
public sourcePath?: string;
public experimentalBypassFor?: HasField;
public experimentalStreamingLambdaPath?: string;
constructor({
expiration,
@@ -38,6 +42,8 @@ export class Prerender {
initialStatus,
passQuery,
sourcePath,
experimentalBypassFor,
experimentalStreamingLambdaPath,
}: PrerenderOptions) {
this.type = 'Prerender';
this.expiration = expiration;
@@ -86,6 +92,26 @@ export class Prerender {
);
}
if (experimentalBypassFor !== undefined) {
if (
!Array.isArray(experimentalBypassFor) ||
experimentalBypassFor.some(
field =>
typeof field !== 'object' ||
// host doesn't need a key
(field.type !== 'host' && typeof field.key !== 'string') ||
typeof field.type !== 'string' ||
(field.value !== undefined && typeof field.value !== 'string')
)
) {
throw new Error(
'The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`.'
);
}
this.experimentalBypassFor = experimentalBypassFor;
}
if (typeof fallback === 'undefined') {
throw new Error(
'The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null.'
@@ -130,5 +156,14 @@ export class Prerender {
}
this.allowQuery = allowQuery;
}
if (experimentalStreamingLambdaPath !== undefined) {
if (typeof experimentalStreamingLambdaPath !== 'string') {
throw new Error(
'The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string.'
);
}
this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
}
}
}

View File

@@ -45,6 +45,18 @@ export interface Config {
[key: string]: unknown;
}
export type HasField = Array<
| {
type: 'host';
value: string;
}
| {
type: 'header' | 'cookie' | 'query';
key: string;
value?: string;
}
>;
export interface Meta {
isDev?: boolean;
devCacheDir?: string;

View File

@@ -0,0 +1,2 @@
.vercel
public

View File

@@ -0,0 +1,8 @@
import { mkdir, rm, writeFile } from 'node:fs/promises'
import { say } from 'cowsay'
const text = say({ text: `bun version: ${process.versions.bun}` })
const content = say({ text })
await rm('./public', { recursive: true, force: true })
await mkdir('./public', { recursive: true })
await writeFile('./public/index.txt', content)

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"private": true,
"scripts": {
"build": "bun build.js"
},
"dependencies": {
"cowsay": "1.5.0"
}
}

View File

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

View File

@@ -133,6 +133,22 @@ describe('Test `getEnvForPackageManager()`', () => {
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
},
},
{
name: 'should set path if bun v1 is detected',
args: {
cliType: 'bun',
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
lockfileVersion: 0,
env: {
FOO: 'bar',
PATH: '/usr/local/bin',
},
},
want: {
FOO: 'bar',
PATH: `/bun1${delimiter}/usr/local/bin`,
},
},
{
name: 'should not set pnpm path if corepack is enabled',
args: {

View File

@@ -344,6 +344,70 @@ it('should support initialHeaders and initialStatus correctly', async () => {
});
});
it('should support experimentalBypassFor correctly', async () => {
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
experimentalBypassFor: [{ type: 'header', key: 'Next-Action' }],
});
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
experimentalBypassFor: [
{ type: 'header', key: 'Next-Action' },
{
type: 'cookie',
key: '__prerender_bypass',
value: 'some-long-bypass-token-to-make-it-work',
},
],
});
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
experimentalBypassFor: [{ type: 'query', key: 'bypass', value: '1' }],
});
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
experimentalBypassFor: [{ type: 'host', value: 'vercel.com' }],
});
expect(() => {
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
// @ts-expect-error: testing invalid args
experimentalBypassFor: 'foo',
});
}).toThrowError(
'The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`.'
);
expect(() => {
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
// @ts-expect-error: testing invalid args
experimentalBypassFor: [{ type: 'header', value: { foo: 'bar' } }],
});
}).toThrowError(
'The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`.'
);
});
it('should support passQuery correctly', async () => {
new Prerender({
expiration: 1,
@@ -387,6 +451,42 @@ it('should support passQuery correctly', async () => {
);
});
it('should support experimentalStreamingLambdaPath correctly', async () => {
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
experimentalStreamingLambdaPath: undefined,
});
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
experimentalStreamingLambdaPath: '/some/path/to/lambda',
});
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
});
expect(() => {
new Prerender({
expiration: 1,
fallback: null,
group: 1,
bypassToken: 'some-long-bypass-token-to-make-it-work',
// @ts-expect-error testing invalid field
experimentalStreamingLambdaPath: 1,
});
}).toThrowError(
`The \`experimentalStreamingLambdaPath\` argument for \`Prerender\` must be a string.`
);
});
it('should support require by path for legacy builders', () => {
const index = require('../');
@@ -440,6 +540,15 @@ it(
ms('1m')
);
it('should return cliType bun and correct lock file for bun v1', async () => {
const fixture = path.join(__dirname, 'fixtures', '30-bun-v1');
const result = await scanParentDirs(fixture);
expect(result.cliType).toEqual('bun');
expect(result.lockfileVersion).toEqual(0);
expect(result.lockfilePath).toEqual(path.join(fixture, 'bun.lockb'));
expect(result.packageJsonPath).toEqual(path.join(fixture, 'package.json'));
});
it('should return lockfileVersion 2 with npm7', async () => {
const fixture = path.join(__dirname, 'fixtures', '20-npm-7');
const result = await scanParentDirs(fixture);

View File

@@ -1,5 +1,57 @@
# vercel
## 32.2.5
### Patch Changes
- Updated dependencies [[`849eedf0f`](https://github.com/vercel/vercel/commit/849eedf0f2841211e4175d374f1cf01330bf9611), [`f6f16b034`](https://github.com/vercel/vercel/commit/f6f16b0347bac9f5c33c79ccb1fb9fd9d254cae5), [`3035e18fb`](https://github.com/vercel/vercel/commit/3035e18fb67dfe7031e235a74136a41948f86d5a), [`cb784aeb9`](https://github.com/vercel/vercel/commit/cb784aeb9c9e4eddf1c65b61849a87edb1117af1)]:
- @vercel/next@4.0.6
- @vercel/remix-builder@2.0.6
## 32.2.4
### Patch Changes
- Add support for bun detection in monorepo ([#10511](https://github.com/vercel/vercel/pull/10511))
- Updated dependencies [[`1b6f3a0f6`](https://github.com/vercel/vercel/commit/1b6f3a0f6534f71c7486a4e33ac199f1da330626)]:
- @vercel/static-build@2.0.6
## 32.2.3
### Patch Changes
- Updated dependencies [[`083aad448`](https://github.com/vercel/vercel/commit/083aad448e45edae296da3201eec9f890a01d22d)]:
- @vercel/next@4.0.5
## 32.2.2
### Patch Changes
- Updated dependencies [[`7a0fed970`](https://github.com/vercel/vercel/commit/7a0fed970c39cb8f4df70544ded3284d3538b06a), [`2f461a8b0`](https://github.com/vercel/vercel/commit/2f461a8b0bcbdd05da0516395c2905c2d0242682), [`1bab21026`](https://github.com/vercel/vercel/commit/1bab21026ec0bb8a4a8fbeac3d6e4a197f1030fd)]:
- @vercel/next@4.0.4
- @vercel/remix-builder@2.0.5
## 32.2.1
### Patch Changes
- Update @vercel/fun@1.1.0 ([#10477](https://github.com/vercel/vercel/pull/10477))
- [node] upgrade edge-runtime ([#10451](https://github.com/vercel/vercel/pull/10451))
- Updated dependencies [[`6784e7751`](https://github.com/vercel/vercel/commit/6784e77516ba180a691e3c48323b32bb4506d7b6), [`a8ad17626`](https://github.com/vercel/vercel/commit/a8ad176262ef822860ce338927e6f959961d2d32), [`0ee089a50`](https://github.com/vercel/vercel/commit/0ee089a501ebb78901c4afe1658e794917998f8f), [`f15cba614`](https://github.com/vercel/vercel/commit/f15cba6148a0cdb6975db7724775c35ab7d929b2), [`b265e13d4`](https://github.com/vercel/vercel/commit/b265e13d40d541b77148fa79ac60b4c4dd10974c), [`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`a732d30c8`](https://github.com/vercel/vercel/commit/a732d30c8409f96f59ea5406e974a6c4186cc130), [`9d64312aa`](https://github.com/vercel/vercel/commit/9d64312aaaa875a4e193b7602c50e5dc68979aad), [`6baefc825`](https://github.com/vercel/vercel/commit/6baefc825ad7cfc3a5edce31cb4244721452f753), [`989f0d813`](https://github.com/vercel/vercel/commit/989f0d813910d8d67ed355de93018f1dcd91b6ba), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
- @vercel/go@3.0.1
- @vercel/redwood@2.0.2
- @vercel/remix-builder@2.0.4
- @vercel/hydrogen@1.0.1
- @vercel/static-build@2.0.5
- @vercel/build-utils@7.2.0
- @vercel/next@4.0.3
- @vercel/node@3.0.5
- @vercel/python@4.0.1
- @vercel/ruby@2.0.2
## 32.2.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "32.2.0",
"version": "32.2.5",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -31,20 +31,20 @@
"node": ">= 16"
},
"dependencies": {
"@vercel/build-utils": "7.1.1",
"@vercel/go": "3.0.0",
"@vercel/hydrogen": "1.0.0",
"@vercel/next": "4.0.2",
"@vercel/node": "3.0.4",
"@vercel/python": "4.0.0",
"@vercel/redwood": "2.0.1",
"@vercel/remix-builder": "2.0.3",
"@vercel/ruby": "2.0.1",
"@vercel/static-build": "2.0.4"
"@vercel/build-utils": "7.2.0",
"@vercel/go": "3.0.1",
"@vercel/hydrogen": "1.0.1",
"@vercel/next": "4.0.6",
"@vercel/node": "3.0.5",
"@vercel/python": "4.0.1",
"@vercel/redwood": "2.0.2",
"@vercel/remix-builder": "2.0.6",
"@vercel/ruby": "2.0.2",
"@vercel/static-build": "2.0.6"
},
"devDependencies": {
"@alex_neo/jest-expect-message": "1.0.5",
"@edge-runtime/node-utils": "2.2.0",
"@edge-runtime/node-utils": "2.2.1",
"@next/env": "11.1.2",
"@sentry/node": "5.5.0",
"@sindresorhus/slugify": "0.11.0",
@@ -86,12 +86,12 @@
"@types/yauzl-promise": "2.1.0",
"@vercel-internals/constants": "1.0.4",
"@vercel-internals/get-package-json": "1.0.0",
"@vercel-internals/types": "1.0.9",
"@vercel/client": "13.0.2",
"@vercel-internals/types": "1.0.10",
"@vercel/client": "13.0.3",
"@vercel/error-utils": "2.0.1",
"@vercel/frameworks": "2.0.1",
"@vercel/fs-detectors": "5.0.2",
"@vercel/fun": "1.0.4",
"@vercel/frameworks": "2.0.2",
"@vercel/fs-detectors": "5.1.0",
"@vercel/fun": "1.1.0",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "3.0.0",
"@zeit/source-map-support": "0.6.2",

View File

@@ -41,7 +41,7 @@ export async function initCorepack({
const pkgManagerName = pkg.packageManager.split('@')[0];
// We must explicitly call `corepack enable npm` since `corepack enable`
// doesn't work with npm. See https://github.com/nodejs/corepack/pull/24
// Also, `corepack enable` is too broad and will change the verison of
// Also, `corepack enable` is too broad and will change the version of
// yarn & pnpm even though those versions are not specified by the user.
// See https://github.com/nodejs/corepack#known-good-releases
// Finally, we use `--install-directory` so we can cache the result to

View File

@@ -13,8 +13,8 @@ import { setupTmpDir } from '../../helpers/setup-unit-fixture';
describe('link', () => {
it('should prompt for link', async () => {
const cwd = setupTmpDir();
const user = useUser();
const cwd = setupTmpDir();
useTeams('team_dummy');
const { project } = useProject({
...defaultProject,

View File

@@ -1,5 +1,12 @@
# @vercel/client
## 13.0.3
### Patch Changes
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
- @vercel/build-utils@7.2.0
## 13.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "13.0.2",
"version": "13.0.3",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -36,7 +36,7 @@
"typescript": "4.9.5"
},
"dependencies": {
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"@vercel/routing-utils": "3.0.0",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",

View File

@@ -1,5 +1,11 @@
# @vercel/edge
## 1.0.2
### Patch Changes
- [node] upgrade edge-runtime ([#10451](https://github.com/vercel/vercel/pull/10451))
## 1.0.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/edge",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
@@ -21,7 +21,7 @@
"build:docs": "typedoc && node scripts/fix-links.js && prettier --write docs/**/*.md docs/*.md"
},
"devDependencies": {
"@edge-runtime/jest-environment": "2.3.0",
"@edge-runtime/jest-environment": "2.3.1",
"@types/jest": "27.4.1",
"jest-junit": "16.0.0",
"ts-node": "8.9.1",

View File

@@ -1,5 +1,11 @@
# @vercel/frameworks
## 2.0.2
### Patch Changes
- Add `bun install` placeholder ([#10492](https://github.com/vercel/vercel/pull/10492))
## 2.0.1
### Patch Changes

View File

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

View File

@@ -42,7 +42,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `blitz build`',
@@ -82,7 +83,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `next build`',
@@ -125,7 +127,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `gatsby build`',
@@ -214,7 +217,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
value: 'remix build',
@@ -252,7 +256,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install` or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
value: 'astro build',
@@ -299,7 +304,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `hexo generate`',
@@ -334,7 +340,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `npx @11ty/eleventy`',
@@ -371,7 +378,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `docusaurus build`',
@@ -457,7 +465,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `docusaurus-build`',
@@ -508,7 +517,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `preact build`',
@@ -555,7 +565,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `solid-start build`',
@@ -591,7 +602,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `dojo build`',
@@ -651,7 +663,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `ember build`',
@@ -696,7 +709,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `vue-cli-service build`',
@@ -749,7 +763,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `ng build && scully`',
@@ -784,7 +799,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `ng build`',
@@ -827,7 +843,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `ng build`',
@@ -885,7 +902,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `polymer build`',
@@ -944,7 +962,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `rollup -c`',
@@ -994,7 +1013,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `svelte-kit build`',
@@ -1032,7 +1052,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: 'vite build',
@@ -1066,7 +1087,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `react-scripts build`',
@@ -1129,7 +1151,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `react-scripts build`',
@@ -1188,7 +1211,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `gridsome build`',
@@ -1223,7 +1247,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `umi build`',
@@ -1267,7 +1292,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `sapper export`',
@@ -1302,7 +1328,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `saber build`',
@@ -1351,7 +1378,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `stencil build`',
@@ -1420,7 +1448,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `nuxt generate`',
@@ -1476,7 +1505,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
value: 'yarn rw deploy vercel',
@@ -1606,7 +1636,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `brunch build --production`',
@@ -1717,7 +1748,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
value: 'shopify hydrogen build',
@@ -1753,7 +1785,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `vite build`',
@@ -1787,7 +1820,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `vitepress build docs`',
@@ -1819,7 +1853,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `vuepress build src`',
@@ -1852,7 +1887,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `parcel build`',
@@ -1909,7 +1945,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run build` or `sanity build`',
@@ -1953,7 +1990,8 @@ export const frameworks = [
},
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
value: 'storybook build',
@@ -1975,7 +2013,8 @@ export const frameworks = [
description: 'No framework or an unoptimized framework.',
settings: {
installCommand: {
placeholder: '`yarn install`, `pnpm install`, or `npm install`',
placeholder:
'`yarn install`, `pnpm install`, `npm install`, or `bun install`',
},
buildCommand: {
placeholder: '`npm run vercel-build` or `npm run build`',

View File

@@ -1,5 +1,18 @@
# @vercel/fs-detectors
## 5.1.0
### Minor Changes
- Add support for bun detection in monorepo ([#10511](https://github.com/vercel/vercel/pull/10511))
## 5.0.3
### Patch Changes
- Updated dependencies [[`ec894bdf7`](https://github.com/vercel/vercel/commit/ec894bdf7f167debded37183f11360756f577f14)]:
- @vercel/frameworks@2.0.2
## 5.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/fs-detectors",
"version": "5.0.2",
"version": "5.1.0",
"description": "Vercel filesystem detectors",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -21,7 +21,7 @@
},
"dependencies": {
"@vercel/error-utils": "2.0.1",
"@vercel/frameworks": "2.0.1",
"@vercel/frameworks": "2.0.2",
"@vercel/routing-utils": "3.0.0",
"glob": "8.0.3",
"js-yaml": "4.1.0",
@@ -36,7 +36,7 @@
"@types/minimatch": "3.0.5",
"@types/node": "14.18.33",
"@types/semver": "7.3.10",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"jest-junit": "16.0.0",
"typescript": "4.9.5"
}

View File

@@ -37,6 +37,24 @@ export const packageManagers: Array<
],
},
},
{
name: 'bun',
slug: 'bun',
logo: '',
darkModeLogo: '',
detectors: {
some: [
{
path: 'bun.lockb',
},
{
path: 'package.json',
// Depends on https://github.com/nodejs/corepack/pull/307
matchContent: '"packageManager":\\s*"bun@.*"',
},
],
},
},
{
name: 'yarn',
slug: 'yarn',

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,3 @@
{
"packageManager": "bun@1.0.1"
}

View File

@@ -14,6 +14,8 @@ describe('package-managers', () => {
['54-yarn-with-corepack', 'yarn'],
['55-pnpm-with-lockfile', 'pnpm'],
['56-pnpm-with-corepack', 'pnpm'],
['57-bun-with-lockfile', 'bun'],
['58-bun-with-corepack', 'bun'],
])('with detectFramework', (fixturePath, frameworkSlug) => {
const testName = `should detect package manager '${frameworkSlug}' for ${fixturePath}`;

View File

@@ -1,5 +1,13 @@
# @vercel/gatsby-plugin-vercel-builder
## 2.0.5
### Patch Changes
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`9d64312aa`](https://github.com/vercel/vercel/commit/9d64312aaaa875a4e193b7602c50e5dc68979aad), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
- @vercel/build-utils@7.2.0
- @vercel/node@3.0.5
## 2.0.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/gatsby-plugin-vercel-builder",
"version": "2.0.4",
"version": "2.0.5",
"main": "dist/index.js",
"files": [
"dist",
@@ -20,8 +20,8 @@
},
"dependencies": {
"@sinclair/typebox": "0.25.24",
"@vercel/build-utils": "7.1.1",
"@vercel/node": "3.0.4",
"@vercel/build-utils": "7.2.0",
"@vercel/node": "3.0.5",
"@vercel/routing-utils": "3.0.0",
"esbuild": "0.14.47",
"etag": "1.8.1",

View File

@@ -1,5 +1,11 @@
# @vercel/go
## 3.0.1
### Patch Changes
- Update to esbuild script ([#10468](https://github.com/vercel/vercel/pull/10468))
## 3.0.0
### Major Changes

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env node
const fs = require('fs-extra');
const execa = require('execa');
const { join } = require('path');
async function main() {
const outDir = join(__dirname, 'dist');
// Start fresh
await fs.remove(outDir);
// Build with `ncc`
await execa(
'ncc',
['build', 'index.ts', '-e', '@vercel/build-utils', '-o', outDir],
{
stdio: 'inherit',
}
);
}
main().catch(err => {
console.error(err);
process.exit(1);
});

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/go",
"version": "3.0.0",
"version": "3.0.1",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -10,32 +10,33 @@
"directory": "packages/go"
},
"scripts": {
"build": "node build",
"build": "node ../../utils/build-builder.mjs",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
"test-e2e": "pnpm test"
},
"files": [
"dist"
"dist",
"*.go"
],
"devDependencies": {
"@tootallnate/once": "1.1.2",
"@types/async-retry": "1.4.2",
"@types/async-retry": "1.4.5",
"@types/execa": "^0.9.0",
"@types/fs-extra": "^5.0.5",
"@types/jest": "28.1.6",
"@types/node": "14.18.33",
"@types/node-fetch": "^2.3.0",
"@types/tar": "^4.0.0",
"@types/tar": "6.1.5",
"@types/yauzl-promise": "2.1.0",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"@vercel/ncc": "0.24.0",
"async-retry": "1.3.1",
"async-retry": "1.3.3",
"execa": "^1.0.0",
"fs-extra": "^7.0.0",
"jest-junit": "16.0.0",
"node-fetch": "^2.2.1",
"string-argv": "0.3.1",
"tar": "4.4.6",
"tar": "6.2.0",
"typescript": "4.3.4",
"xdg-app-paths": "5.1.0",
"yauzl-promise": "2.1.3"

View File

@@ -108,7 +108,7 @@ export async function getAnalyzedEntrypoint({
const isAnalyzeExist = await pathExists(bin);
if (!isAnalyzeExist) {
debug(`Building analyze bin: ${bin}`);
const src = join(__dirname, 'util', 'analyze.go');
const src = join(__dirname, '../analyze.go');
let go;
const createOpts = {
modulePath,

View File

@@ -621,7 +621,7 @@ async function copyDevServer(
functionName: string,
dest: string
): Promise<void> {
const data = await readFile(join(__dirname, 'dev-server.go'), 'utf8');
const data = await readFile(join(__dirname, '../dev-server.go'), 'utf8');
// Populate the handler function name
const patched = data.replace('__HANDLER_FUNC_NAME', functionName);
@@ -634,7 +634,10 @@ async function writeEntrypoint(
goPackageName: string,
goFuncName: string
) {
const modMainGoContents = await readFile(join(__dirname, 'main.go'), 'utf8');
const modMainGoContents = await readFile(
join(__dirname, '../main.go'),
'utf8'
);
const mainModGoContents = modMainGoContents
.replace('__VC_HANDLER_PACKAGE_NAME', goPackageName)
.replace('__VC_HANDLER_FUNC_NAME', goFuncName);

View File

@@ -1,4 +1,4 @@
import { getNewHandlerFunctionName } from '../index';
import { getNewHandlerFunctionName } from '../src/index';
describe('getNewHandlerFunctionName', function () {
it('does nothing with empty original function name', async () => {

View File

@@ -11,8 +11,10 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitThis": false,
"outDir": "./dist",
"types": ["node", "jest"],
"strict": true,
"target": "ES2021"
}
},
"include": ["src/**/*"]
}

View File

@@ -1,5 +1,11 @@
# @vercel/hydrogen
## 1.0.1
### Patch Changes
- Use `build-builder.mjs` script to bundle, and remove types and source maps ([#10480](https://github.com/vercel/vercel/pull/10480))
## 1.0.0
### Major Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/hydrogen",
"version": "1.0.0",
"version": "1.0.1",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -10,7 +10,7 @@
"directory": "packages/hydrogen"
},
"scripts": {
"build": "node ../../utils/build.mjs",
"build": "node ../../utils/build-builder.mjs",
"test-e2e": "pnpm test test/test.js",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand"
},
@@ -18,14 +18,16 @@
"dist",
"edge-entry.js"
],
"dependencies": {
"@vercel/static-config": "3.0.0",
"ts-morph": "12.0.0"
},
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "7.1.1",
"@vercel/static-config": "3.0.0",
"@vercel/build-utils": "7.2.0",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"jest-junit": "16.0.0",
"ts-morph": "12.0.0"
"jest-junit": "16.0.0"
}
}

View File

@@ -1,7 +1,6 @@
{
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"declaration": false,
"esModuleInterop": true,
"lib": ["ES2021"],
"module": "commonjs",
@@ -14,8 +13,7 @@
"outDir": "./dist",
"types": ["node", "jest"],
"strict": true,
"target": "ES2021",
"sourceMap": true
"target": "ES2021"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]

View File

@@ -1,5 +1,31 @@
# @vercel/next
## 4.0.6
### Patch Changes
- Fix feature flag detection ([#10531](https://github.com/vercel/vercel/pull/10531))
## 4.0.5
### Patch Changes
- missed a prerender for experimentalBypassFor ([#10504](https://github.com/vercel/vercel/pull/10504))
## 4.0.4
### Patch Changes
- provide `experimentalBypassFor` to Prerender from manifest ([#10497](https://github.com/vercel/vercel/pull/10497))
- next.js: move app route handlers in their own lambda grouping, add flag to use bundled runtime ([#10485](https://github.com/vercel/vercel/pull/10485))
## 4.0.3
### Patch Changes
- fix content-type for RSC prefetches ([#10487](https://github.com/vercel/vercel/pull/10487))
## 4.0.2
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/next",
"version": "4.0.2",
"version": "4.0.6",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -35,7 +35,7 @@
"@types/semver": "6.0.0",
"@types/text-table": "0.2.1",
"@types/webpack-sources": "3.2.0",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"@vercel/nft": "0.22.5",
"@vercel/routing-utils": "3.0.0",
"async-sema": "3.0.1",

View File

@@ -45,6 +45,8 @@ import {
UnwrapPromise,
getOperationType,
FunctionsConfigManifestV1,
RSC_CONTENT_TYPE,
RSC_PREFETCH_SUFFIX,
} from './utils';
import {
nodeFileTrace,
@@ -63,6 +65,12 @@ const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
const CORRECTED_MANIFESTS_VERSION = 'v12.2.0';
// related PR: https://github.com/vercel/next.js/pull/52997
const BUNDLED_SERVER_NEXT_VERSION = '13.4.20-canary.26';
const BUNDLED_SERVER_NEXT_PATH =
'next/dist/compiled/next-server/server.runtime.prod.js';
export async function serverBuild({
dynamicPages,
pagesDir,
@@ -168,7 +176,6 @@ export async function serverBuild({
}
}
const APP_PREFETCH_SUFFIX = '.prefetch.rsc';
let appRscPrefetches: UnwrapPromise<ReturnType<typeof glob>> = {};
let appBuildTraces: UnwrapPromise<ReturnType<typeof glob>> = {};
let appDir: string | null = null;
@@ -176,7 +183,18 @@ export async function serverBuild({
if (appPathRoutesManifest) {
appDir = path.join(pagesDir, '../app');
appBuildTraces = await glob('**/*.js.nft.json', appDir);
appRscPrefetches = await glob(`**/*${APP_PREFETCH_SUFFIX}`, appDir);
appRscPrefetches = await glob(`**/*${RSC_PREFETCH_SUFFIX}`, appDir);
const rscContentTypeHeader =
routesManifest?.rsc?.contentTypeHeader || RSC_CONTENT_TYPE;
// ensure all appRscPrefetches have a contentType since this is used by Next.js
// to determine if it's a valid response
for (const value of Object.values(appRscPrefetches)) {
if (!value.contentType) {
value.contentType = rscContentTypeHeader;
}
}
}
const isCorrectNotFoundRoutes = semver.gte(
@@ -293,16 +311,32 @@ export async function serverBuild({
let nextServerBuildTrace;
let instrumentationHookBuildTrace;
const useBundledServer =
semver.gte(nextVersion, BUNDLED_SERVER_NEXT_VERSION) &&
process.env.VERCEL_NEXT_BUNDLED_SERVER === '1';
if (useBundledServer) {
debug('Using bundled Next.js server');
}
const nextServerFile = resolveFrom(
projectDir,
`${getNextServerPath(nextVersion)}/next-server.js`
useBundledServer
? BUNDLED_SERVER_NEXT_PATH
: `${getNextServerPath(nextVersion)}/next-server.js`
);
try {
// leverage next-server trace from build if available
nextServerBuildTrace = JSON.parse(
await fs.readFile(
path.join(entryPath, outputDirectory, 'next-server.js.nft.json'),
path.join(
entryPath,
outputDirectory,
useBundledServer
? 'next-minimal-server.js.nft.json'
: 'next-server.js.nft.json'
),
'utf8'
)
);
@@ -395,6 +429,7 @@ export async function serverBuild({
const apiPages: string[] = [];
const nonApiPages: string[] = [];
const appRouterPages: string[] = [];
const appRouteHandlers: string[] = [];
lambdaPageKeys.forEach(page => {
if (
@@ -416,7 +451,11 @@ export async function serverBuild({
}
if (lambdaAppPaths[page]) {
appRouterPages.push(page);
if (lambdaAppPaths[page].fsPath.endsWith('route.js')) {
appRouteHandlers.push(page);
} else {
appRouterPages.push(page);
}
} else if (pageMatchesApi(page)) {
apiPages.push(page);
} else {
@@ -584,7 +623,9 @@ export async function serverBuild({
)
.replace(
'__NEXT_SERVER_PATH__',
`${getNextServerPath(nextVersion)}/next-server.js`
useBundledServer
? BUNDLED_SERVER_NEXT_PATH
: `${getNextServerPath(nextVersion)}/next-server.js`
);
const appLauncher = launcher.replace(
@@ -620,6 +661,7 @@ export async function serverBuild({
const mergedPageKeys = [
...nonApiPages,
...appRouterPages,
...appRouteHandlers,
...apiPages,
...internalPages,
];
@@ -781,6 +823,10 @@ export async function serverBuild({
pageExtensions,
});
for (const group of pageLambdaGroups) {
group.isPages = true;
}
const appRouterLambdaGroups = await getPageLambdaGroups({
entryPath: projectDir,
config,
@@ -797,6 +843,22 @@ export async function serverBuild({
pageExtensions,
});
const appRouteHandlersLambdaGroups = await getPageLambdaGroups({
entryPath: projectDir,
config,
functionsConfigManifest,
pages: appRouteHandlers,
prerenderRoutes,
pageTraces,
compressedPages,
tracedPseudoLayer: tracedPseudoLayer.pseudoLayer,
initialPseudoLayer,
lambdaCompressedByteLimit,
initialPseudoLayerUncompressed: uncompressedInitialSize,
internalPages,
pageExtensions,
});
for (const group of appRouterLambdaGroups) {
if (!group.isPrerenders) {
group.isStreaming = true;
@@ -804,6 +866,14 @@ export async function serverBuild({
group.isAppRouter = true;
}
for (const group of appRouteHandlersLambdaGroups) {
if (!group.isPrerenders) {
group.isStreaming = true;
}
group.isAppRouter = true;
group.isAppRouteHandler = true;
}
const apiLambdaGroups = await getPageLambdaGroups({
entryPath: projectDir,
config,
@@ -845,6 +915,14 @@ export async function serverBuild({
pseudoLayerBytes: group.pseudoLayerBytes,
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
})),
appRouteHandlersLambdaGroups: appRouteHandlersLambdaGroups.map(
group => ({
pages: group.pages,
isPrerender: group.isPrerenders,
pseudoLayerBytes: group.pseudoLayerBytes,
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
})
),
nextServerLayerSize: initialPseudoLayer.pseudoLayerBytes,
},
null,
@@ -855,6 +933,7 @@ export async function serverBuild({
...pageLambdaGroups,
...appRouterLambdaGroups,
...apiLambdaGroups,
...appRouteHandlersLambdaGroups,
];
await detectLambdaLimitExceeding(
@@ -1526,7 +1605,7 @@ export async function serverBuild({
dest: path.posix.join(
'/',
entryDirectory,
'/index.prefetch.rsc'
`/index${RSC_PREFETCH_SUFFIX}`
),
headers: { vary: rscVaryHeader },
continue: true,
@@ -1547,7 +1626,7 @@ export async function serverBuild({
dest: path.posix.join(
'/',
entryDirectory,
`/$1${APP_PREFETCH_SUFFIX}`
`/$1${RSC_PREFETCH_SUFFIX}`
),
headers: { vary: rscVaryHeader },
continue: true,
@@ -1626,7 +1705,7 @@ export async function serverBuild({
src: path.posix.join(
'/',
entryDirectory,
`/index${APP_PREFETCH_SUFFIX}`
`/index${RSC_PREFETCH_SUFFIX}`
),
dest: path.posix.join('/', entryDirectory, '/index.rsc'),
has: [
@@ -1642,7 +1721,7 @@ export async function serverBuild({
src: `^${path.posix.join(
'/',
entryDirectory,
`/(.+?)${APP_PREFETCH_SUFFIX}(?:/)?$`
`/(.+?)${RSC_PREFETCH_SUFFIX}(?:/)?$`
)}`,
dest: path.posix.join('/', entryDirectory, '/$1.rsc'),
has: [

View File

@@ -29,6 +29,7 @@ const nextServer = new NextServer({
minimalMode: true,
customServer: false,
});
const requestHandler = nextServer.getRequestHandler();
module.exports = async (req: IncomingMessage, res: ServerResponse) => {

View File

@@ -48,6 +48,9 @@ export const MIB = 1024 * KIB;
export const prettyBytes = (n: number) => bytes(n, { unitSeparator: ' ' });
export const RSC_CONTENT_TYPE = 'x-component';
export const RSC_PREFETCH_SUFFIX = '.prefetch.rsc';
// Identify /[param]/ in route string
// eslint-disable-next-line no-useless-escape
const TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
@@ -853,6 +856,7 @@ export type NextPrerenderedRoutes = {
srcRoute: string | null;
initialStatus?: number;
initialHeaders?: Record<string, string>;
experimentalBypassFor?: HasField;
};
};
@@ -861,6 +865,7 @@ export type NextPrerenderedRoutes = {
routeRegex: string;
dataRoute: string | null;
dataRouteRegex: string | null;
experimentalBypassFor?: HasField;
};
};
@@ -870,6 +875,7 @@ export type NextPrerenderedRoutes = {
routeRegex: string;
dataRoute: string | null;
dataRouteRegex: string | null;
experimentalBypassFor?: HasField;
};
};
@@ -878,6 +884,7 @@ export type NextPrerenderedRoutes = {
routeRegex: string;
dataRoute: string | null;
dataRouteRegex: string | null;
experimentalBypassFor?: HasField;
};
};
@@ -1081,6 +1088,7 @@ export async function getPrerenderManifest(
dataRoute: string | null;
initialStatus?: number;
initialHeaders?: Record<string, string>;
experimentalBypassFor?: HasField;
};
};
dynamicRoutes: {
@@ -1089,6 +1097,7 @@ export async function getPrerenderManifest(
fallback: string | false;
dataRoute: string | null;
dataRouteRegex: string | null;
experimentalBypassFor?: HasField;
};
};
preview: {
@@ -1174,10 +1183,12 @@ export async function getPrerenderManifest(
let initialStatus: undefined | number;
let initialHeaders: undefined | Record<string, string>;
let experimentalBypassFor: undefined | HasField;
if (manifest.version === 4) {
initialStatus = manifest.routes[route].initialStatus;
initialHeaders = manifest.routes[route].initialHeaders;
experimentalBypassFor = manifest.routes[route].experimentalBypassFor;
}
ret.staticRoutes[route] = {
@@ -1189,15 +1200,23 @@ export async function getPrerenderManifest(
srcRoute,
initialStatus,
initialHeaders,
experimentalBypassFor,
};
});
lazyRoutes.forEach(lazyRoute => {
const { routeRegex, fallback, dataRoute, dataRouteRegex } =
manifest.dynamicRoutes[lazyRoute];
let experimentalBypassFor: undefined | HasField;
if (manifest.version === 4) {
experimentalBypassFor =
manifest.dynamicRoutes[lazyRoute].experimentalBypassFor;
}
if (typeof fallback === 'string') {
ret.fallbackRoutes[lazyRoute] = {
experimentalBypassFor,
routeRegex,
fallback,
dataRoute,
@@ -1205,6 +1224,7 @@ export async function getPrerenderManifest(
};
} else if (fallback === null) {
ret.blockingFallbackRoutes[lazyRoute] = {
experimentalBypassFor,
routeRegex,
dataRoute,
dataRouteRegex,
@@ -1213,6 +1233,7 @@ export async function getPrerenderManifest(
// Fallback behavior is disabled, all routes would've been provided
// in the top-level `routes` key (`staticRoutes`).
ret.omittedRoutes[lazyRoute] = {
experimentalBypassFor,
routeRegex,
dataRoute,
dataRouteRegex,
@@ -1388,8 +1409,10 @@ export type LambdaGroup = {
memory?: number;
maxDuration?: number;
isAppRouter?: boolean;
isAppRouteHandler?: boolean;
isStreaming?: boolean;
isPrerenders?: boolean;
isPages?: boolean;
isApiLambda: boolean;
pseudoLayer: PseudoLayer;
pseudoLayerBytes: number;
@@ -1904,6 +1927,7 @@ export const onPrerenderRoute =
let dataRoute: string | null;
let initialStatus: number | undefined;
let initialHeaders: Record<string, string> | undefined;
let experimentalBypassFor: HasField | undefined;
if (isFallback || isBlocking) {
const pr = isFallback
@@ -1920,10 +1944,13 @@ export const onPrerenderRoute =
}
srcRoute = null;
dataRoute = pr.dataRoute;
experimentalBypassFor = pr.experimentalBypassFor;
} else if (isOmitted) {
initialRevalidate = false;
srcRoute = routeKey;
dataRoute = prerenderManifest.omittedRoutes[routeKey].dataRoute;
experimentalBypassFor =
prerenderManifest.omittedRoutes[routeKey].experimentalBypassFor;
} else {
const pr = prerenderManifest.staticRoutes[routeKey];
({
@@ -1932,6 +1959,7 @@ export const onPrerenderRoute =
dataRoute,
initialHeaders,
initialStatus,
experimentalBypassFor,
} = pr);
}
@@ -2158,7 +2186,7 @@ export const onPrerenderRoute =
routesManifest?.rsc?.varyHeader ||
'RSC, Next-Router-State-Tree, Next-Router-Prefetch';
const rscContentTypeHeader =
routesManifest?.rsc?.contentTypeHeader || 'text/x-component';
routesManifest?.rsc?.contentTypeHeader || RSC_CONTENT_TYPE;
let sourcePath: string | undefined;
if (`/${outputPathPage}` !== srcRoute && srcRoute) {
@@ -2172,6 +2200,7 @@ export const onPrerenderRoute =
fallback: htmlFsRef,
group: prerenderGroup,
bypassToken: prerenderManifest.bypassToken,
experimentalBypassFor,
initialStatus,
initialHeaders,
sourcePath,
@@ -2200,6 +2229,7 @@ export const onPrerenderRoute =
fallback: jsonFsRef,
group: prerenderGroup,
bypassToken: prerenderManifest.bypassToken,
experimentalBypassFor,
...(isNotFound
? {

View File

@@ -44,6 +44,9 @@
"RSC": "1",
"Next-Router-Prefetch": "1"
},
"responseHeaders": {
"content-type":"text/x-component"
},
"mustContain": ":",
"mustNotContain": "<html"
},
@@ -72,6 +75,9 @@
"headers": {
"Next-Router-Prefetch": "1",
"RSC": "1"
},
"responseHeaders": {
"content-type":"text/x-component"
}
},
{
@@ -99,7 +105,8 @@
"path": "/ssg",
"status": 200,
"responseHeaders": {
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Url"
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Url",
"content-type":"text/x-component"
},
"headers": {
"RSC": "1",

View File

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

View File

@@ -0,0 +1,5 @@
export async function GET() {
return new Response('hello world from app route')
}
export const dynamic = 'force-dynamic'

View File

@@ -0,0 +1,5 @@
export default function Page() {
return <p>hello world from app router</p>
}
export const dynamic = 'force-dynamic'

View File

@@ -0,0 +1,10 @@
export default function Layout({children}) {
return <html>
<head>
<title>My page</title>
</head>
<body>
{children}
</body>
</html>
}

View File

@@ -0,0 +1,8 @@
const path = require('path');
const { deployAndTest } = require('../../utils');
describe(`${__dirname.split(path.sep).pop()}`, () => {
it('should deploy and pass probe checks', async () => {
await deployAndTest(__dirname);
});
});

View File

@@ -0,0 +1,15 @@
{
"name": "bundled-server",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "canary",
"react": "latest",
"react-dom": "latest"
}
}

View File

@@ -0,0 +1,5 @@
export default async (req, res) => {
res.status(200).json({
payload: `hello world from api`
});
};

View File

@@ -0,0 +1,7 @@
export default function Home(props) {
return `hello world from pages`;
}
export async function getServerSideProps() {
return {};
}

View File

@@ -0,0 +1,24 @@
{
"probes": [
{
"path": "/app",
"status": 200,
"mustContain": "hello world from app router"
},
{
"path": "/app-route",
"status": 200,
"mustContain": "hello world from app route"
},
{
"path": "/api/hello",
"status": 200,
"mustContain": "hello world from api"
},
{
"path": "/",
"status": 200,
"mustContain": "hello world from pages"
}
]
}

View File

@@ -0,0 +1,7 @@
{
"build": {
"env": {
"VERCEL_NEXT_BUNDLED_SERVER": "1"
}
}
}

View File

@@ -72,7 +72,7 @@ if (parseInt(process.versions.node.split('.')[0], 10) >= 16) {
)
).toBeFalsy();
expect(lambdas.size).toBe(4);
expect(lambdas.size).toBe(5);
// RSC, root-level page.js
expect(buildResult.output['index']).toBeDefined();

View File

@@ -1,5 +1,14 @@
# @vercel/node
## 3.0.5
### Patch Changes
- [node] upgrade edge-runtime ([#10451](https://github.com/vercel/vercel/pull/10451))
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
- @vercel/build-utils@7.2.0
## 3.0.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "3.0.4",
"version": "3.0.5",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -19,16 +19,16 @@
"dist"
],
"dependencies": {
"@edge-runtime/node-utils": "2.2.0",
"@edge-runtime/primitives": "3.1.0",
"@edge-runtime/vm": "3.1.0",
"@edge-runtime/node-utils": "2.2.1",
"@edge-runtime/primitives": "3.1.1",
"@edge-runtime/vm": "3.1.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"@vercel/error-utils": "2.0.1",
"@vercel/static-config": "3.0.0",
"async-listen": "3.0.0",
"content-type": "1.0.5",
"edge-runtime": "2.5.0",
"edge-runtime": "2.5.1",
"esbuild": "0.14.47",
"exit-hook": "2.2.1",
"node-fetch": "2.6.9",

View File

@@ -1,5 +1,11 @@
# @vercel/python
## 4.0.1
### Patch Changes
- Update to esbuild script ([#10470](https://github.com/vercel/vercel/pull/10470))
## 4.0.0
### Major Changes

View File

@@ -1,29 +0,0 @@
#!/usr/bin/env node
const fs = require('fs-extra');
const execa = require('execa');
const { join } = require('path');
async function main() {
const outDir = join(__dirname, 'dist');
// Start fresh
await fs.remove(outDir);
await execa(
'ncc',
[
'build',
join(__dirname, 'src/index.ts'),
'-e',
'@vercel/build-utils',
'-o',
outDir,
],
{ stdio: 'inherit' }
);
}
main().catch(err => {
console.error(err);
process.exit(1);
});

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/python",
"version": "4.0.0",
"version": "4.0.1",
"main": "./dist/index.js",
"license": "Apache-2.0",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -14,7 +14,7 @@
"directory": "packages/python"
},
"scripts": {
"build": "node build",
"build": "node ../../utils/build-builder.mjs",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
"test-unit": "pnpm test test/unit.test.ts",
"test-e2e": "pnpm test test/integration-*"
@@ -23,7 +23,7 @@
"@types/execa": "^0.9.0",
"@types/jest": "27.4.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"@vercel/ncc": "0.24.0",
"execa": "^1.0.0",
"jest-junit": "16.0.0"

View File

@@ -1,6 +1,6 @@
{
"compilerOptions": {
"declaration": true,
"declaration": false,
"esModuleInterop": true,
"lib": ["ES2021"],
"module": "commonjs",
@@ -15,6 +15,5 @@
"strict": true,
"target": "ES2021"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
"include": ["src/**/*"]
}

View File

@@ -1,5 +1,11 @@
# @vercel/redwood
## 2.0.2
### Patch Changes
- Update to esbuild script ([#10471](https://github.com/vercel/vercel/pull/10471))
## 2.0.1
### Patch Changes

View File

@@ -1,12 +0,0 @@
const execa = require('execa');
const { remove } = require('fs-extra');
async function main() {
await remove('dist');
await execa('tsc', [], { stdio: 'inherit' });
}
main().catch(err => {
console.error(err);
process.exit(1);
});

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/redwood",
"version": "2.0.1",
"version": "2.0.2",
"main": "./dist/index.js",
"license": "Apache-2.0",
"homepage": "https://vercel.com/docs",
@@ -13,7 +13,7 @@
"directory": "packages/redwood"
},
"scripts": {
"build": "node build.js",
"build": "node ../../utils/build-builder.mjs",
"test-e2e": "pnpm test test/test.js",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
"test-unit": "pnpm test test/prepare-cache.test.js"
@@ -27,7 +27,7 @@
"@types/aws-lambda": "8.10.19",
"@types/node": "14.18.33",
"@types/semver": "6.0.0",
"@vercel/build-utils": "7.1.1",
"@vercel/build-utils": "7.2.0",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"jest-junit": "16.0.0"

View File

@@ -1,5 +1,27 @@
# @vercel/remix-builder
## 2.0.6
### Patch Changes
- Fix ESM mode for Edge runtime ([#10530](https://github.com/vercel/vercel/pull/10530))
- Update `@remix-run/dev` fork to v2.0.0 ([#10526](https://github.com/vercel/vercel/pull/10526))
- Fixes for Remix v2 ([#10525](https://github.com/vercel/vercel/pull/10525))
## 2.0.5
### Patch Changes
- Fix usage with `bun install` ([#10489](https://github.com/vercel/vercel/pull/10489))
## 2.0.4
### Patch Changes
- Use `build-builder.mjs` script to bundle, and remove types and source maps ([#10479](https://github.com/vercel/vercel/pull/10479))
## 2.0.3
### Patch Changes

View File

@@ -1,3 +1,3 @@
import { createRequestHandler } from '@remix-run/server-runtime';
import build from '@remix-run/dev/server-build';
export default createRequestHandler(build);
import * as build from '@remix-run/dev/server-build';
export default createRequestHandler(build.default || build);

View File

@@ -1,20 +1,20 @@
import {
AbortController as NodeAbortController,
createRequestHandler as createRemixRequestHandler,
Headers as NodeHeaders,
Request as NodeRequest,
writeReadableStreamToWritable,
installGlobals,
} from '@remix-run/node';
installGlobals();
import build from '@remix-run/dev/server-build';
import * as build from '@remix-run/dev/server-build';
const handleRequest = createRemixRequestHandler(build, process.env.NODE_ENV);
const handleRequest = createRemixRequestHandler(
build.default || build,
process.env.NODE_ENV
);
function createRemixHeaders(requestHeaders) {
const headers = new NodeHeaders();
const headers = new Headers();
for (const key in requestHeaders) {
const header = requestHeaders[key];
@@ -37,7 +37,7 @@ function createRemixRequest(req, res) {
const url = new URL(req.url, `${protocol}://${host}`);
// Abort action/loaders once we can no longer write a response
const controller = new NodeAbortController();
const controller = new AbortController();
res.on('close', () => controller.abort());
const init = {
@@ -50,7 +50,7 @@ function createRemixRequest(req, res) {
init.body = req;
}
return new NodeRequest(url.href, init);
return new Request(url.href, init);
}
async function sendRemixResponse(res, nodeResponse) {

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix-builder",
"version": "2.0.3",
"version": "2.0.6",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -10,7 +10,7 @@
"directory": "packages/remix"
},
"scripts": {
"build": "node ../../utils/build.mjs",
"build": "node ../../utils/build-builder.mjs",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
"test-unit": "pnpm test test/unit.*test.*",
"test-e2e": "pnpm test test/integration.test.ts"
@@ -20,18 +20,18 @@
"defaults"
],
"dependencies": {
"@vercel/build-utils": "7.1.1",
"@vercel/nft": "0.22.5",
"@vercel/static-config": "3.0.0",
"path-to-regexp": "6.2.1",
"semver": "7.5.2",
"ts-morph": "12.0.0"
},
"devDependencies": {
"@remix-run/dev": "npm:@vercel/remix-run-dev@1.19.3",
"@remix-run/dev": "npm:@vercel/remix-run-dev@2.0.0",
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@types/semver": "7.3.13",
"jest-junit": "16.0.0"
"@vercel/build-utils": "7.2.0",
"jest-junit": "16.0.0",
"path-to-regexp": "6.2.1",
"semver": "7.5.2"
}
}

View File

@@ -141,9 +141,10 @@ export const build: BuildV2 = async ({
await runNpmInstall(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
}
const isHydrogen2 =
const isHydrogen2 = Boolean(
pkg.dependencies?.['@shopify/remix-oxygen'] ||
pkg.devDependencies?.['@shopify/remix-oxygen'];
pkg.devDependencies?.['@shopify/remix-oxygen']
);
// Determine the version of Remix based on the `@remix-run/dev`
// package version.
@@ -167,9 +168,17 @@ export const build: BuildV2 = async ({
const depsToAdd: string[] = [];
const remixRunDevPkgVersion: string | undefined =
pkg.dependencies?.['@remix-run/dev'] ||
pkg.devDependencies?.['@remix-run/dev'];
// Override the official `@remix-run/dev` package with the
// Vercel fork, which supports the `serverBundles` config
if (!isHydrogen2 && remixRunDevPkg.name !== '@vercel/remix-run-dev') {
if (
!isHydrogen2 &&
remixRunDevPkg.name !== '@vercel/remix-run-dev' &&
!remixRunDevPkgVersion?.startsWith('https:')
) {
const remixDevForkVersion = resolveSemverMinMax(
REMIX_RUN_DEV_MIN_VERSION,
REMIX_RUN_DEV_MAX_VERSION,
@@ -308,7 +317,7 @@ export const build: BuildV2 = async ({
renamedRemixConfigPath
)}';
config.serverBuildTarget = undefined;
config.serverModuleFormat = 'cjs';
config.serverModuleFormat = '${pkg.type === 'module' ? 'esm' : 'cjs'}';
config.serverPlatform = 'node';
config.serverBuildPath = undefined;
config.serverBundles = ${JSON.stringify(serverBundles)};
@@ -318,7 +327,7 @@ export default config;`;
renamedRemixConfigPath
)}');
config.serverBuildTarget = undefined;
config.serverModuleFormat = 'cjs';
config.serverModuleFormat = '${pkg.type === 'module' ? 'esm' : 'cjs'}';
config.serverPlatform = 'node';
config.serverBuildPath = undefined;
config.serverBundles = ${JSON.stringify(serverBundles)};

View File

@@ -1,6 +1,6 @@
import { glob } from '@vercel/build-utils';
import { dirname, join, relative } from 'path';
import { _require, chdirAndReadConfig } from './utils';
import { require_, chdirAndReadConfig } from './utils';
import type { PrepareCache } from '@vercel/build-utils';
export const prepareCache: PrepareCache = async ({
@@ -13,7 +13,7 @@ export const prepareCache: PrepareCache = async ({
const entrypointFsDirname = join(workPath, mountpoint);
const packageJsonPath = join(entrypointFsDirname, 'package.json');
const remixRunDevPath = dirname(
_require.resolve('@remix-run/dev/package.json', {
require_.resolve('@remix-run/dev/package.json', {
paths: [entrypointFsDirname],
})
);

View File

@@ -5,6 +5,7 @@ import { basename, dirname, join, relative, resolve, sep } from 'path';
import { pathToRegexp, Key } from 'path-to-regexp';
import { debug, spawnAsync } from '@vercel/build-utils';
import { walkParentDirs } from '@vercel/build-utils';
import { createRequire } from 'module';
import type {
ConfigRoute,
RouteManifest,
@@ -16,7 +17,7 @@ import type {
SpawnOptionsExtended,
} from '@vercel/build-utils/dist/fs/run-user-scripts';
export const _require: typeof require = eval('require');
export const require_ = createRequire(__filename);
export interface ResolvedNodeRouteConfig {
runtime: 'nodejs';
@@ -277,29 +278,41 @@ export function addDependencies(
}
const args: string[] = [];
if (cliType === 'npm' || cliType === 'pnpm') {
args.push('install');
if (opts.saveDev) {
args.push('--save-dev');
}
} else {
// 'yarn'
args.push('add');
if (opts.saveDev) {
args.push('--dev');
}
const yarnVersion = execSync('yarn -v', { encoding: 'utf8' }).trim();
const isYarnV1 = semver.satisfies(yarnVersion, '1');
if (isYarnV1) {
// Ignoring workspace check is only needed on Yarn v1
args.push('--ignore-workspace-root-check');
}
}
switch (cliType) {
case 'npm':
case 'pnpm':
args.push('install');
if (opts.saveDev) {
args.push('--save-dev');
}
// Don't fail if pnpm is being run at the workspace root
if (cliType === 'pnpm' && opts.cwd) {
if (existsSync(join(opts.cwd, 'pnpm-workspace.yaml'))) {
args.push('--workspace-root');
// Don't fail if pnpm is being run at the workspace root
if (cliType === 'pnpm' && opts.cwd) {
if (existsSync(join(opts.cwd, 'pnpm-workspace.yaml'))) {
args.push('--workspace-root');
}
}
break;
case 'bun':
case 'yarn':
args.push('add');
if (opts.saveDev) {
args.push('--dev');
}
if (cliType === 'yarn') {
const yarnVersion = execSync('yarn -v', { encoding: 'utf8' }).trim();
const isYarnV1 = semver.satisfies(yarnVersion, '1');
if (isYarnV1) {
// Ignoring workspace check is only needed on Yarn v1
args.push('--ignore-workspace-root-check');
}
}
break;
default: {
const n: never = cliType;
throw new Error(`Unexpected package manager: ${n}`);
}
}
@@ -321,7 +334,7 @@ export async function ensureResolvable(
pkgName: string
): Promise<string> {
try {
const resolvedPkgPath = _require.resolve(`${pkgName}/package.json`, {
const resolvedPkgPath = require_.resolve(`${pkgName}/package.json`, {
paths: [start],
});
const resolvedPath = dirname(resolvedPkgPath);
@@ -412,7 +425,7 @@ export function isESM(path: string): boolean {
// Figure out if the `remix.config` file is using ESM syntax
let isESM = false;
try {
_require(path);
require_(path);
} catch (err: any) {
isESM = err.code === 'ERR_REQUIRE_ESM';
}

View File

@@ -0,0 +1,7 @@
node_modules
/.cache
/build
/public/build
.env
.vercel

View File

@@ -0,0 +1,38 @@
# Welcome to Remix!
- [Remix Docs](https://remix.run/docs)
## Development
From your terminal:
```sh
npm run dev
```
This starts your app in development mode, rebuilding assets on file changes.
## Deployment
First, build your app for production:
```sh
npm run build
```
Then run the app in production mode:
```sh
npm start
```
Now you'll need to pick a host to deploy it to.
### DIY
If you're familiar with deploying node applications, the built-in Remix app server is production-ready.
Make sure to deploy the output of `remix build`
- `build/`
- `public/build/`

View File

@@ -0,0 +1,33 @@
import { cssBundleHref } from "@remix-run/css-bundle";
import type { LinksFunction } from "@vercel/remix";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
export const links: LinksFunction = () => [
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
];
export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
}

View File

@@ -0,0 +1,41 @@
import type { MetaFunction } from "@vercel/remix";
export const meta: MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};
export default function Index() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix</h1>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/blog"
rel="noreferrer"
>
15m Quickstart Blog Tutorial
</a>
</li>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/jokes"
rel="noreferrer"
>
Deep Dive Jokes App Tutorial
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
);
}

View File

@@ -0,0 +1,13 @@
import type { MetaFunction } from "@vercel/remix";
export const config = { runtime: "edge" };
export const meta: MetaFunction = () => [{ title: "Remix@Edge | New Remix App" }];
export default function Edge() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
<h1>Welcome to Remix@Edge</h1>
</div>
);
}

View File

@@ -0,0 +1,31 @@
{
"name": "my-remix-app",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "remix dev --manual",
"start": "remix-serve ./build/index.js",
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/css-bundle": "^2.0.0",
"@remix-run/node": "^2.0.0",
"@remix-run/react": "^2.0.0",
"@remix-run/serve": "^2.0.0",
"@vercel/remix": "^2.0.0",
"isbot": "^3.6.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^2.0.0",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"typescript": "^5.1.6"
},
"engines": {
"node": ">=18.0.0"
}
}

4384
packages/remix/test/fixtures/12-remix-v2/pnpm-lock.yaml generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
{
"probes": [
{ "path": "/", "mustContain": "Welcome to Remix" },
{ "path": "/edge", "mustContain": "Welcome to Remix@Edge" }
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,8 @@
/** @type {import('@remix-run/dev').AppConfig} */
export default {
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};

View File

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

View File

@@ -0,0 +1,22 @@
{
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
// Remix takes care of building everything in `remix build`.
"noEmit": true
}
}

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