Compare commits

..

7 Commits

Author SHA1 Message Date
Vercel Release Bot
9d6088e0b5 Version Packages (#11693)
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@8.2.2

### Patch Changes

- Change node 16.x EOL for Vercel
([#11704](https://github.com/vercel/vercel/pull/11704))

- Improve error message and refactor
([#11706](https://github.com/vercel/vercel/pull/11706))

- [built-utils] Handle case of not having lockfile when corepack is
enabled ([#11697](https://github.com/vercel/vercel/pull/11697))

## vercel@34.2.6

### Patch Changes

- [built-utils] Handle case of not having lockfile when corepack is
enabled ([#11697](https://github.com/vercel/vercel/pull/11697))

- Updated dependencies
\[[`5c12ed695`](5c12ed6950),
[`21444a38e`](21444a38e5),
[`fa9789a93`](fa9789a93e),
[`c925dc4a1`](c925dc4a1b),
[`06d2d860e`](06d2d860e4),
[`b735f37fd`](b735f37fd9)]:
    -   @vercel/build-utils@8.2.2
    -   @vercel/next@4.2.16
    -   @vercel/redwood@2.0.10
    -   @vercel/remix-builder@2.1.7
    -   @vercel/node@3.1.7
    -   @vercel/static-build@2.5.11

## @vercel/client@13.2.9

### Patch Changes

- Updated dependencies
\[[`5c12ed695`](5c12ed6950),
[`21444a38e`](21444a38e5),
[`06d2d860e`](06d2d860e4)]:
    -   @vercel/build-utils@8.2.2

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

### Patch Changes

- Updated dependencies
\[[`5c12ed695`](5c12ed6950),
[`21444a38e`](21444a38e5),
[`06d2d860e`](06d2d860e4)]:
    -   @vercel/build-utils@8.2.2

## @vercel/next@4.2.16

### Patch Changes

- prevent /index from being incorrectly normalized in rewrites
([#11707](https://github.com/vercel/vercel/pull/11707))

- Upgrade to @vercel/nft 0.27.2 with browser remapping support
([#11700](https://github.com/vercel/vercel/pull/11700))

- ensure unmatched rsc rewrites are routed to correct handler
([#11688](https://github.com/vercel/vercel/pull/11688))

## @vercel/node@3.1.7

### Patch Changes

- Upgrade to @vercel/nft 0.27.2 with browser remapping support
([#11700](https://github.com/vercel/vercel/pull/11700))

- Updated dependencies
\[[`5c12ed695`](5c12ed6950),
[`21444a38e`](21444a38e5),
[`06d2d860e`](06d2d860e4)]:
    -   @vercel/build-utils@8.2.2

## @vercel/redwood@2.0.10

### Patch Changes

- Upgrade to @vercel/nft 0.27.2 with browser remapping support
([#11700](https://github.com/vercel/vercel/pull/11700))

## @vercel/remix-builder@2.1.7

### Patch Changes

- Upgrade to @vercel/nft 0.27.2 with browser remapping support
([#11700](https://github.com/vercel/vercel/pull/11700))

## @vercel/static-build@2.5.11

### Patch Changes

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

## @vercel-internals/types@1.0.38

### Patch Changes

- Updated dependencies
\[[`5c12ed695`](5c12ed6950),
[`21444a38e`](21444a38e5),
[`06d2d860e`](06d2d860e4)]:
    -   @vercel/build-utils@8.2.2

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-07 10:40:38 -05:00
Dima Voytenko
c925dc4a1b Upgrade to @vercel/nft 0.27.2 with browser remapping support (#11700)
See https://github.com/vercel/nft/pull/424 for more details.
2024-06-06 23:45:45 +00:00
Austin Merrick
21444a38e5 [build-utils] Improve no lockfile detection logic (#11706)
Two minor improvements missed from the review of https://github.com/vercel/vercel/pull/11697:

- [Include supported package manager names in error message](https://github.com/vercel/vercel/pull/11697#discussion_r1628382867)
- [Avoid `as` to improve type safety](https://github.com/vercel/vercel/pull/11697#discussion_r1628384789)
2024-06-06 23:20:23 +00:00
Zack Tanner
fa9789a93e [next]: fix issues with rewrite normalization of index routes (#11707)
The Next.js builder currently normalizes user rewrites to ensure the internal `.rsc` / `.action` rewrites are still handled even after following the rewrite.

However we have special rewrites: `/index.rsc` and `/index.action`. When those routes pass through the normalization logic, a request routed to a catch-all route (e.g. `[[...param]]`) will go from `/` -> `/index.rsc` -> `<someRewriteString>?param=index`. This is inconsistent `next start` or other spots where the param should be an empty string.

Similarly, if a user rewrites their entire app to a subdirectory (eg `/:path*` -> `/base/:path*`, a route will go from `/` -> `/index.rsc` -> `/base/index.rsc` which won't exist, causing a 404. 

The solution here is to return the `index.rsc` / `index.action` routes back to `/` so they can be handled by user rewrites, if necessary. 

This also disables the `hasActionOutputSupport` flag if `routesManifest.i18n` is detected as they are not compatible.
2024-06-06 23:15:47 +00:00
Trek Glowacki
5c12ed6950 Change node 16.x EOL for Vercel (#11704)
https://github.com/vercel/vercel/pull/11671 changed the EOL date for
node 16.x to be AWS's final date. We want ours to be ~ a month earlier.
2024-06-06 14:54:22 -05:00
Austin Merrick
06d2d860e4 [build-utils] Handle case of not having lockfile (#11697)
In the scenario where we don't have a lockfile, cliType was detected by build utils as npm regardless of what's set in corepack. This fixes that.
2024-06-05 20:23:39 +00:00
Zack Tanner
b735f37fd9 [next]: ensure unmatched rsc rewrites are routed to correct handler (#11688)
Same reasoning as:

- https://github.com/vercel/vercel/pull/11686

Split this into a separate PR so it can be tested/released separately.
2024-06-04 18:52:44 +00:00
52 changed files with 574 additions and 78 deletions

View File

@@ -9,7 +9,7 @@
},
"devDependencies": {
"@types/jest": "27.4.1",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"@vercel/frameworks": "3.0.2"
},
"version": null

View File

@@ -1,5 +1,12 @@
# @vercel-internals/types
## 1.0.38
### Patch Changes
- Updated dependencies [[`5c12ed695`](https://github.com/vercel/vercel/commit/5c12ed69500ceff6a9dc544eab0acd7af64c044a), [`21444a38e`](https://github.com/vercel/vercel/commit/21444a38e50ed680c91b0e3955f15e378eeda64b), [`06d2d860e`](https://github.com/vercel/vercel/commit/06d2d860e47aed792247bf929805b180ed6e2dab)]:
- @vercel/build-utils@8.2.2
## 1.0.37
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@vercel-internals/types",
"version": "1.0.37",
"version": "1.0.38",
"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": "8.2.1",
"@vercel/build-utils": "8.2.2",
"@vercel/routing-utils": "3.1.0"
},
"devDependencies": {

View File

@@ -1,5 +1,15 @@
# @vercel/build-utils
## 8.2.2
### Patch Changes
- Change node 16.x EOL for Vercel ([#11704](https://github.com/vercel/vercel/pull/11704))
- Improve error message and refactor ([#11706](https://github.com/vercel/vercel/pull/11706))
- [built-utils] Handle case of not having lockfile when corepack is enabled ([#11697](https://github.com/vercel/vercel/pull/11697))
## 8.2.1
### Patch Changes

View File

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

View File

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

View File

@@ -353,7 +353,9 @@ export async function scanParentDirs(
// TODO: read "bun-lockfile-format-v0"
lockfileVersion = 0;
} else {
cliType = 'npm';
cliType = packageJson
? detectPackageManagerNameWithoutLockfile(packageJson)
: 'npm';
}
const packageJsonPath = pkgJsonPath || undefined;
@@ -366,6 +368,37 @@ export async function scanParentDirs(
};
}
function detectPackageManagerNameWithoutLockfile(packageJson: PackageJson) {
const packageJsonPackageManager = packageJson.packageManager;
if (usingCorepack(process.env, packageJsonPackageManager)) {
const corepackPackageManager = validateVersionSpecifier(
packageJsonPackageManager
);
switch (corepackPackageManager?.packageName) {
case 'npm':
case 'pnpm':
case 'yarn':
case 'bun':
return corepackPackageManager.packageName;
case undefined:
return 'npm';
default:
throw new Error(
`Unknown package manager "${corepackPackageManager?.packageName}". Change your package.json "packageManager" field to a known package manager: npm, pnpm, yarn, bun.`
);
}
}
return 'npm';
}
function usingCorepack(
env: { [x: string]: string | undefined },
packageJsonPackageManager: string | undefined
) {
const corepackFlagged = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
return corepackFlagged && Boolean(packageJsonPackageManager);
}
export async function walkParentDirs({
base,
start,
@@ -557,8 +590,7 @@ export function getEnvForPackageManager({
nodeVersion: NodeVersion | undefined;
env: { [x: string]: string | undefined };
}) {
const corepackFlagged = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
const corepackEnabled = corepackFlagged && Boolean(packageJsonPackageManager);
const corepackEnabled = usingCorepack(env, packageJsonPackageManager);
const {
detectedLockfile,
@@ -753,6 +785,39 @@ export function getPathOverrideForPackageManager({
}
}
function validateVersionSpecifier(version?: string) {
if (!version) {
return undefined;
}
const [before, after, ...extra] = version.split('@');
if (extra.length) {
// should not have more than one `@`
return undefined;
}
if (!before) {
// should have a package before the `@`
return undefined;
}
if (!after) {
// should have a version after the `@`
return undefined;
}
if (!validRange(after)) {
// the version after the `@` should be a valid semver value
return undefined;
}
return {
packageName: before,
packageVersionRange: after,
};
}
/**
* Helper to get the binary paths that link to the used package manager.
* Note: Make sure it doesn't contain any `console.log` calls.

View File

@@ -356,8 +356,8 @@ it('should warn for deprecated versions, soon to be discontinued', async () => {
'Error: Node.js version 12.x has reached End-of-Life. Deployments created on or after 2022-10-03 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
'Error: Node.js version 14.x has reached End-of-Life. Deployments created on or after 2023-08-15 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 14.x has reached End-of-Life. Deployments created on or after 2023-08-15 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2025-02-28 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2025-02-28 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2025-01-31 will fail to build. Please set "engines": { "node": "20.x" } in your `package.json` file to use Node.js 20.',
'Error: Node.js version 16.x has reached End-of-Life. Deployments created on or after 2025-01-31 will fail to build. Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.',
]);
} finally {
global.Date.now = realDateNow;

View File

@@ -1,5 +1,19 @@
# vercel
## 34.2.6
### Patch Changes
- [built-utils] Handle case of not having lockfile when corepack is enabled ([#11697](https://github.com/vercel/vercel/pull/11697))
- Updated dependencies [[`5c12ed695`](https://github.com/vercel/vercel/commit/5c12ed69500ceff6a9dc544eab0acd7af64c044a), [`21444a38e`](https://github.com/vercel/vercel/commit/21444a38e50ed680c91b0e3955f15e378eeda64b), [`fa9789a93`](https://github.com/vercel/vercel/commit/fa9789a93ebe64c4246f441590cb695d296af336), [`c925dc4a1`](https://github.com/vercel/vercel/commit/c925dc4a1bf3a47b684b5f7fd788ddd24ba1ed1e), [`06d2d860e`](https://github.com/vercel/vercel/commit/06d2d860e47aed792247bf929805b180ed6e2dab), [`b735f37fd`](https://github.com/vercel/vercel/commit/b735f37fd92c707040e72084b0fdb4f8fd01dd51)]:
- @vercel/build-utils@8.2.2
- @vercel/next@4.2.16
- @vercel/redwood@2.0.10
- @vercel/remix-builder@2.1.7
- @vercel/node@3.1.7
- @vercel/static-build@2.5.11
## 34.2.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "34.2.5",
"version": "34.2.6",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -32,17 +32,17 @@
"node": ">= 16"
},
"dependencies": {
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"@vercel/fun": "1.1.0",
"@vercel/go": "3.1.1",
"@vercel/hydrogen": "1.0.2",
"@vercel/next": "4.2.15",
"@vercel/node": "3.1.6",
"@vercel/next": "4.2.16",
"@vercel/node": "3.1.7",
"@vercel/python": "4.3.0",
"@vercel/redwood": "2.0.9",
"@vercel/remix-builder": "2.1.6",
"@vercel/redwood": "2.0.10",
"@vercel/remix-builder": "2.1.7",
"@vercel/ruby": "2.1.0",
"@vercel/static-build": "2.5.10",
"@vercel/static-build": "2.5.11",
"chokidar": "3.3.1"
},
"devDependencies": {
@@ -92,8 +92,8 @@
"@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.37",
"@vercel/client": "13.2.8",
"@vercel-internals/types": "1.0.38",
"@vercel/client": "13.2.9",
"@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "3.0.2",
"@vercel/fs-detectors": "5.2.4",

View File

@@ -263,6 +263,7 @@ test('[vc build] should build project with corepack and select pnpm@7.1.0', asyn
path.join(directory, '.vercel/cache/corepack')
);
expect(contents).toEqual(['home', 'shim']);
expect(output.stdout).toMatch(/Running "pnpm run build"/gm);
} finally {
delete process.env.ENABLE_EXPERIMENTAL_COREPACK;
}
@@ -291,6 +292,7 @@ test('[vc build] should build project with corepack and select yarn@2.4.3', asyn
path.join(directory, '.vercel/cache/corepack')
);
expect(contents).toEqual(['home', 'shim']);
expect(output.stdout).toMatch(/Running "yarn run build"/gm);
} finally {
delete process.env.ENABLE_EXPERIMENTAL_COREPACK;
}

View File

@@ -1,5 +1,12 @@
# @vercel/client
## 13.2.9
### Patch Changes
- Updated dependencies [[`5c12ed695`](https://github.com/vercel/vercel/commit/5c12ed69500ceff6a9dc544eab0acd7af64c044a), [`21444a38e`](https://github.com/vercel/vercel/commit/21444a38e50ed680c91b0e3955f15e378eeda64b), [`06d2d860e`](https://github.com/vercel/vercel/commit/06d2d860e47aed792247bf929805b180ed6e2dab)]:
- @vercel/build-utils@8.2.2
## 13.2.8
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "13.2.8",
"version": "13.2.9",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -37,7 +37,7 @@
"typescript": "4.9.5"
},
"dependencies": {
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"@vercel/error-utils": "2.0.2",
"@vercel/routing-utils": "3.1.0",
"@zeit/fetch": "5.2.0",

View File

@@ -37,7 +37,7 @@
"@types/minimatch": "3.0.5",
"@types/node": "14.18.33",
"@types/semver": "7.3.10",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"jest-junit": "16.0.0",
"typescript": "4.9.5"
}

View File

@@ -1,5 +1,12 @@
# @vercel/gatsby-plugin-vercel-builder
## 2.0.33
### Patch Changes
- Updated dependencies [[`5c12ed695`](https://github.com/vercel/vercel/commit/5c12ed69500ceff6a9dc544eab0acd7af64c044a), [`21444a38e`](https://github.com/vercel/vercel/commit/21444a38e50ed680c91b0e3955f15e378eeda64b), [`06d2d860e`](https://github.com/vercel/vercel/commit/06d2d860e47aed792247bf929805b180ed6e2dab)]:
- @vercel/build-utils@8.2.2
## 2.0.32
### Patch Changes

View File

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

View File

@@ -29,7 +29,7 @@
"@types/node-fetch": "^2.3.0",
"@types/tar": "6.1.5",
"@types/yauzl-promise": "2.1.0",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"async-retry": "1.3.3",
"execa": "^1.0.0",
"fs-extra": "^7.0.0",

View File

@@ -26,7 +26,7 @@
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"jest-junit": "16.0.0"

View File

@@ -1,5 +1,15 @@
# @vercel/next
## 4.2.16
### Patch Changes
- prevent /index from being incorrectly normalized in rewrites ([#11707](https://github.com/vercel/vercel/pull/11707))
- Upgrade to @vercel/nft 0.27.2 with browser remapping support ([#11700](https://github.com/vercel/vercel/pull/11700))
- ensure unmatched rsc rewrites are routed to correct handler ([#11688](https://github.com/vercel/vercel/pull/11688))
## 4.2.15
### Patch Changes

View File

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

View File

@@ -212,7 +212,8 @@ export async function serverBuild({
);
const hasActionOutputSupport =
semver.gte(nextVersion, ACTION_OUTPUT_SUPPORT_VERSION) &&
Boolean(process.env.NEXT_EXPERIMENTAL_STREAMING_ACTIONS);
Boolean(process.env.NEXT_EXPERIMENTAL_STREAMING_ACTIONS) &&
!routesManifest.i18n;
const projectDir = requiredServerFilesManifest.relativeAppDir
? path.join(baseDir, requiredServerFilesManifest.relativeAppDir)
: requiredServerFilesManifest.appDir || entryPath;
@@ -2085,6 +2086,22 @@ export async function serverBuild({
]
: []),
// before processing rewrites, remove any special `/index` routes that were added
// as these won't be properly normalized by `afterFilesRewrites` / `dynamicRoutes`
...(appPathRoutesManifest
? [
{
src: path.posix.join(
'/',
entryDirectory,
'/index(\\.action|\\.rsc)'
),
dest: path.posix.join('/', entryDirectory),
continue: true,
},
]
: []),
// These need to come before handle: miss or else they are grouped
// with that routing section
...afterFilesRewrites,
@@ -2120,11 +2137,29 @@ export async function serverBuild({
),
check: true,
},
{
src: path.posix.join(
'/',
entryDirectory,
'(.+)/\\.prefetch\\.rsc$'
),
dest: path.posix.join(
'/',
entryDirectory,
`$1${RSC_PREFETCH_SUFFIX}`
),
check: true,
},
{
src: path.posix.join('/', entryDirectory, '/\\.rsc$'),
dest: path.posix.join('/', entryDirectory, `/index.rsc`),
check: true,
},
{
src: path.posix.join('/', entryDirectory, '(.+)/\\.rsc$'),
dest: path.posix.join('/', entryDirectory, '$1.rsc'),
check: true,
},
]
: []),

View File

@@ -0,0 +1,6 @@
'use server';
export async function increment(value) {
await new Promise(resolve => setTimeout(resolve, 500));
return value + 1;
}

View File

@@ -0,0 +1,10 @@
export default function Root({ children }) {
return (
<html>
<head>
<title>Hello World</title>
</head>
<body>{children}</body>
</html>
);
}

View File

@@ -0,0 +1,25 @@
"use client";
import { useState } from "react";
import { increment } from "../actions";
export default function Home() {
const [count, setCount] = useState(0);
return (
<div>
{count}
<button
onClick={async () => {
const actionResult = await increment(count);
// @ts-ignore
setCount(actionResult);
console.log(actionResult);
}}
>
Trigger
</button>
Static
</div>
);
}

View File

@@ -0,0 +1,55 @@
/* eslint-env jest */
const path = require('path');
const { deployAndTest } = require('../../utils');
const fetch = require('../../../../../test/lib/deployment/fetch-retry');
const ctx = {};
function findActionId(page, runtime) {
page = `app${page}/page`; // add /app prefix and /page suffix
for (const [actionId, details] of Object.entries(
ctx.actionManifest[runtime]
)) {
if (details.workers[page]) {
return actionId;
}
}
throw new Error("Couldn't find action ID");
}
describe(`${__dirname.split(path.sep).pop()}`, () => {
beforeAll(async () => {
const info = await deployAndTest(__dirname);
const actionManifest = await fetch(
`${info.deploymentUrl}/server-reference-manifest.json`
).then(res => res.json());
ctx.actionManifest = actionManifest;
Object.assign(ctx, info);
});
it('should work when there is a rewrite targeting the root page', async () => {
const actionId = findActionId('/static', 'node');
const res = await fetch(ctx.deploymentUrl, {
method: 'POST',
body: JSON.stringify([1337]),
headers: {
'Content-Type': 'text/plain;charset=UTF-8',
'Next-Action': actionId,
},
});
expect(res.status).toEqual(200);
expect(res.headers.get('x-matched-path')).toBe('/static/');
expect(res.headers.get('x-vercel-cache')).toBe('BYPASS');
const body = await res.text();
// The action incremented the provided count by 1
expect(body).toContain('1338');
});
});

View File

@@ -0,0 +1,10 @@
module.exports = {
rewrites() {
return [
{
source: '/:path*',
destination: '/static/:path*',
},
];
},
};

View File

@@ -0,0 +1,9 @@
{
"dependencies": {
"next": "canary"
},
"scripts": {
"build": "next build && cp .next/server/server-reference-manifest.json public/"
},
"ignoreNextjsUpdates": true
}

View File

@@ -0,0 +1,14 @@
{
"builds": [
{
"src": "package.json",
"use": "@vercel/next"
}
],
"build": {
"env": {
"NEXT_EXPERIMENTAL_STREAMING_ACTIONS": "1"
}
},
"probes": []
}

View File

@@ -15,7 +15,8 @@ function findActionId(page, runtime) {
return actionId;
}
}
return null;
throw new Error("Couldn't find action ID");
}
function generateFormDataPayload(actionId) {
@@ -313,6 +314,21 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
expect(res.headers.get('x-edge-runtime')).toBe('1');
}
});
it('should work on the index route', async () => {
const canonicalPath = '/';
const actionId = findActionId('', 'node');
const res = await fetch(
`${ctx.deploymentUrl}${canonicalPath}`,
generateFormDataPayload(actionId)
);
expect(res.status).toEqual(200);
expect(res.headers.get('x-matched-path')).toBe('/index.action');
expect(res.headers.get('content-type')).toBe('text/x-component');
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
});
});
describe('rewrite to index', () => {
@@ -330,6 +346,28 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
expect(res.headers.get('content-type')).toBe('text/x-component');
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
});
it('should work when entire path is rewritten', async () => {
const actionId = findActionId('/static', 'node');
const res = await fetch(ctx.deploymentUrl, {
method: 'POST',
body: JSON.stringify([1337]),
headers: {
'Content-Type': 'text/plain;charset=UTF-8',
'Next-Action': actionId,
'x-rewrite-me': '1',
},
});
expect(res.status).toEqual(200);
expect(res.headers.get('x-matched-path')).toBe('/index.action');
expect(res.headers.get('x-vercel-cache')).toBe('MISS');
const body = await res.text();
// The action incremented the provided count by 1
expect(body).toContain('1338');
});
});
describe('pages', () => {

View File

@@ -21,6 +21,16 @@ module.exports = {
source: '/rewritten-to-index',
destination: '/?fromRewrite=1',
},
{
source: '/:path*',
destination: '/static/:path*',
has: [
{
type: 'header',
key: 'x-rewrite-me',
},
],
},
];
},
};

View File

@@ -0,0 +1,14 @@
import Link from 'next/link';
const Page = ({ params }) => {
return (
<div>
<div id="page-param">page-param-{params.slug?.[0] ?? ''}</div>
<Link href="/">Home</Link>
<Link href="/foo">Foo</Link>
<Link href="/bar">Bar</Link>
</div>
);
};
export default Page;

View File

@@ -0,0 +1,10 @@
export default function Root({ children }) {
return (
<html>
<head>
<title>Hello World</title>
</head>
<body>{children}</body>
</html>
);
}

View File

@@ -0,0 +1,12 @@
/* eslint-env jest */
const path = require('path');
const { deployAndTest } = require('../../utils');
const ctx = {};
describe(`${__dirname.split(path.sep).pop()}`, () => {
it('should deploy and pass probe checks', async () => {
const info = await deployAndTest(__dirname);
Object.assign(ctx, info);
});
});

View File

@@ -0,0 +1 @@
module.exports = {};

View File

@@ -0,0 +1,8 @@
{
"dependencies": {
"next": "canary",
"react": "19.0.0-rc-f994737d14-20240522",
"react-dom": "19.0.0-rc-f994737d14-20240522"
},
"ignoreNextjsUpdates": true
}

View File

@@ -0,0 +1,27 @@
{
"builds": [
{
"src": "package.json",
"use": "@vercel/next"
}
],
"probes": [
{
"path": "/",
"status": 200,
"mustContain": "\"page-param-\",\"\"",
"mustNotContain": "\"page-param-\",\"index\"",
"headers": {
"RSC": "1"
}
},
{
"path": "/foo",
"status": 200,
"mustContain": "\"page-param-\",\"foo\"",
"headers": {
"RSC": "1"
}
}
]
}

View File

@@ -17,6 +17,10 @@ module.exports = {
source: '/to-product/:productId.html',
destination: '/products/:productId',
},
{
source: '/greedy-rewrite/test-page/:path*',
destination: '/test-page/:path*',
}
];
},
};

View File

@@ -429,6 +429,31 @@
},
"mustContain": ":{",
"mustNotContain": "<html"
},
{
"path": "/greedy-rewrite/test-page",
"status": 200,
"mustContain": ":{",
"mustNotContain": "<html",
"responseHeaders": {
"x-matched-path": "/test-page.rsc"
},
"headers": {
"RSC": "1"
}
},
{
"path": "/greedy-rewrite/test-page",
"status": 200,
"mustContain": ":{",
"mustNotContain": "<html",
"responseHeaders": {
"x-matched-path": "/test-page.rsc"
},
"headers": {
"RSC": "1",
"Next-Router-Prefetch": "1"
}
}
]
}

View File

@@ -14,6 +14,10 @@ module.exports = {
source: '/rewritten-to-index',
destination: '/?fromRewrite=1',
},
{
source: '/greedy-rewrite/test-page/:path*',
destination: '/test-page/:path*',
}
];
},
};

View File

@@ -350,6 +350,31 @@
"status": 200,
"mustContain": "{\"port\":\"443\"}"
},
{
"path": "/greedy-rewrite/test-page",
"status": 200,
"mustContain": ":{",
"mustNotContain": "<html",
"responseHeaders": {
"x-matched-path": "/test-page.rsc"
},
"headers": {
"RSC": 1
}
},
{
"path": "/greedy-rewrite/test-page",
"status": 200,
"mustContain": ":{",
"mustNotContain": "<html",
"responseHeaders": {
"x-matched-path": "/test-page.prefetch.rsc"
},
"headers": {
"RSC": "1",
"Next-Router-Prefetch": "1"
}
},
{
"path": "/static",
"status": 200,

View File

@@ -1,5 +1,14 @@
# @vercel/node
## 3.1.7
### Patch Changes
- Upgrade to @vercel/nft 0.27.2 with browser remapping support ([#11700](https://github.com/vercel/vercel/pull/11700))
- Updated dependencies [[`5c12ed695`](https://github.com/vercel/vercel/commit/5c12ed69500ceff6a9dc544eab0acd7af64c044a), [`21444a38e`](https://github.com/vercel/vercel/commit/21444a38e50ed680c91b0e3955f15e378eeda64b), [`06d2d860e`](https://github.com/vercel/vercel/commit/06d2d860e47aed792247bf929805b180ed6e2dab)]:
- @vercel/build-utils@8.2.2
## 3.1.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "3.1.6",
"version": "3.1.7",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -25,9 +25,9 @@
"@edge-runtime/primitives": "4.1.0",
"@edge-runtime/vm": "3.2.0",
"@types/node": "16.18.11",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"@vercel/error-utils": "2.0.2",
"@vercel/nft": "0.27.0",
"@vercel/nft": "0.27.2",
"@vercel/static-config": "3.0.0",
"async-listen": "3.0.0",
"cjs-module-lexer": "1.2.3",

View File

@@ -26,7 +26,7 @@
"@types/jest": "27.4.1",
"@types/node": "14.18.33",
"@types/which": "3.0.0",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"execa": "^1.0.0",
"fs-extra": "11.1.1",
"jest-junit": "16.0.0",

View File

@@ -1,5 +1,11 @@
# @vercel/redwood
## 2.0.10
### Patch Changes
- Upgrade to @vercel/nft 0.27.2 with browser remapping support ([#11700](https://github.com/vercel/vercel/pull/11700))
## 2.0.9
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @vercel/remix-builder
## 2.1.7
### Patch Changes
- Upgrade to @vercel/nft 0.27.2 with browser remapping support ([#11700](https://github.com/vercel/vercel/pull/11700))
## 2.1.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix-builder",
"version": "2.1.6",
"version": "2.1.7",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -24,7 +24,7 @@
],
"dependencies": {
"@vercel/error-utils": "2.0.2",
"@vercel/nft": "0.27.0",
"@vercel/nft": "0.27.2",
"@vercel/static-config": "3.0.0",
"ts-morph": "12.0.0"
},
@@ -33,7 +33,7 @@
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@types/semver": "7.3.13",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"glob": "10.3.16",
"jest-junit": "16.0.0",
"path-to-regexp": "6.2.1",

View File

@@ -24,7 +24,7 @@
"@types/fs-extra": "8.0.0",
"@types/semver": "6.0.0",
"@types/which": "3.0.0",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"execa": "2.0.4",
"fs-extra": "^7.0.1",
"jest-junit": "16.0.0",

View File

@@ -1,5 +1,12 @@
# @vercel/static-build
## 2.5.11
### Patch Changes
- Updated dependencies []:
- @vercel/gatsby-plugin-vercel-builder@2.0.33
## 2.5.10
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/static-build",
"version": "2.5.10",
"version": "2.5.11",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/build-step",
@@ -21,7 +21,7 @@
},
"dependencies": {
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
"@vercel/gatsby-plugin-vercel-builder": "2.0.32",
"@vercel/gatsby-plugin-vercel-builder": "2.0.33",
"@vercel/static-config": "3.0.0",
"ts-morph": "12.0.0"
},
@@ -35,7 +35,7 @@
"@types/node-fetch": "2.5.4",
"@types/promise-timeout": "1.3.0",
"@types/semver": "7.3.13",
"@vercel/build-utils": "8.2.1",
"@vercel/build-utils": "8.2.2",
"@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "3.0.2",
"@vercel/fs-detectors": "5.2.4",

70
pnpm-lock.yaml generated
View File

@@ -132,7 +132,7 @@ importers:
specifier: 27.4.1
version: 27.4.1
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../packages/build-utils
'@vercel/frameworks':
specifier: 3.0.2
@@ -189,7 +189,7 @@ importers:
specifier: 1.0.4
version: link:../constants
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../../packages/build-utils
'@vercel/routing-utils':
specifier: 3.1.0
@@ -313,7 +313,7 @@ importers:
packages/cli:
dependencies:
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
'@vercel/fun':
specifier: 1.1.0
@@ -325,25 +325,25 @@ importers:
specifier: 1.0.2
version: link:../hydrogen
'@vercel/next':
specifier: 4.2.15
specifier: 4.2.16
version: link:../next
'@vercel/node':
specifier: 3.1.6
specifier: 3.1.7
version: link:../node
'@vercel/python':
specifier: 4.3.0
version: link:../python
'@vercel/redwood':
specifier: 2.0.9
specifier: 2.0.10
version: link:../redwood
'@vercel/remix-builder':
specifier: 2.1.6
specifier: 2.1.7
version: link:../remix
'@vercel/ruby':
specifier: 2.1.0
version: link:../ruby
'@vercel/static-build':
specifier: 2.5.10
specifier: 2.5.11
version: link:../static-build
chokidar:
specifier: 3.3.1
@@ -488,10 +488,10 @@ importers:
specifier: 1.0.0
version: link:../../internals/get-package-json
'@vercel-internals/types':
specifier: 1.0.37
specifier: 1.0.38
version: link:../../internals/types
'@vercel/client':
specifier: 13.2.8
specifier: 13.2.9
version: link:../client
'@vercel/error-utils':
specifier: 2.0.2
@@ -737,7 +737,7 @@ importers:
packages/client:
dependencies:
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
'@vercel/error-utils':
specifier: 2.0.2
@@ -941,7 +941,7 @@ importers:
specifier: 7.3.10
version: 7.3.10
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
jest-junit:
specifier: 16.0.0
@@ -972,7 +972,7 @@ importers:
specifier: 0.25.24
version: 0.25.24
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
'@vercel/routing-utils':
specifier: 3.1.0
@@ -1039,7 +1039,7 @@ importers:
specifier: 2.1.0
version: 2.1.0
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
async-retry:
specifier: 1.3.3
@@ -1088,7 +1088,7 @@ importers:
specifier: 14.18.33
version: 14.18.33
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
execa:
specifier: 3.2.0
@@ -1103,8 +1103,8 @@ importers:
packages/next:
dependencies:
'@vercel/nft':
specifier: 0.27.0
version: 0.27.0
specifier: 0.27.2
version: 0.27.2
devDependencies:
'@types/aws-lambda':
specifier: 8.10.19
@@ -1149,7 +1149,7 @@ importers:
specifier: 3.2.0
version: 3.2.0
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
'@vercel/routing-utils':
specifier: 3.1.0
@@ -1236,14 +1236,14 @@ importers:
specifier: 16.18.11
version: 16.18.11
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
'@vercel/error-utils':
specifier: 2.0.2
version: link:../error-utils
'@vercel/nft':
specifier: 0.27.0
version: 0.27.0
specifier: 0.27.2
version: 0.27.2
'@vercel/static-config':
specifier: 3.0.0
version: link:../static-config
@@ -1366,7 +1366,7 @@ importers:
specifier: 3.0.0
version: 3.0.0
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
execa:
specifier: ^1.0.0
@@ -1384,8 +1384,8 @@ importers:
packages/redwood:
dependencies:
'@vercel/nft':
specifier: 0.27.0
version: 0.27.0
specifier: 0.27.2
version: 0.27.2
'@vercel/routing-utils':
specifier: 3.1.0
version: link:../routing-utils
@@ -1403,7 +1403,7 @@ importers:
specifier: 6.0.0
version: 6.0.0
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
execa:
specifier: 3.2.0
@@ -1421,8 +1421,8 @@ importers:
specifier: 2.0.2
version: link:../error-utils
'@vercel/nft':
specifier: 0.27.0
version: 0.27.0
specifier: 0.27.2
version: 0.27.2
'@vercel/static-config':
specifier: 3.0.0
version: link:../static-config
@@ -1443,7 +1443,7 @@ importers:
specifier: 7.3.13
version: 7.3.13
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
glob:
specifier: 10.3.16
@@ -1496,7 +1496,7 @@ importers:
specifier: 3.0.0
version: 3.0.0
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
execa:
specifier: 2.0.4
@@ -1520,7 +1520,7 @@ importers:
specifier: 1.0.11
version: link:../gatsby-plugin-vercel-analytics
'@vercel/gatsby-plugin-vercel-builder':
specifier: 2.0.32
specifier: 2.0.33
version: link:../gatsby-plugin-vercel-builder
'@vercel/static-config':
specifier: 3.0.0
@@ -1557,7 +1557,7 @@ importers:
specifier: 7.3.13
version: 7.3.13
'@vercel/build-utils':
specifier: 8.2.1
specifier: 8.2.2
version: link:../build-utils
'@vercel/error-utils':
specifier: 2.0.2
@@ -5529,8 +5529,8 @@ packages:
- supports-color
dev: false
/@vercel/nft@0.27.0:
resolution: {integrity: sha512-W5pValyhToK9hbgEUAM6sLRUIl1I++RsFnXKHXtND50P1+vZ+OYPCzq1OOz0Ok6ghK6aOwae8G/rEAXkLedC+w==}
/@vercel/nft@0.27.2:
resolution: {integrity: sha512-7LeioS1yE5hwPpQfD3DdH04tuugKjo5KrJk3yK5kAI3Lh76iSsK/ezoFQfzuT08X3ZASQOd1y9ePjLNI9+TxTQ==}
engines: {node: '>=16'}
hasBin: true
dependencies:
@@ -6098,6 +6098,7 @@ packages:
/are-we-there-yet@2.0.0:
resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==}
engines: {node: '>=10'}
deprecated: This package is no longer supported.
dependencies:
delegates: 1.0.0
readable-stream: 3.6.2
@@ -9252,6 +9253,7 @@ packages:
/gauge@3.0.2:
resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==}
engines: {node: '>=10'}
deprecated: This package is no longer supported.
dependencies:
aproba: 2.0.0
color-support: 1.1.3
@@ -9437,6 +9439,7 @@ packages:
/glob@7.1.6:
resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==}
deprecated: Glob versions prior to v9 are no longer supported
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
@@ -12540,6 +12543,7 @@ packages:
/npmlog@5.0.1:
resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==}
deprecated: This package is no longer supported.
dependencies:
are-we-there-yet: 2.0.0
console-control-strings: 1.1.0