Compare commits

..

4 Commits

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


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

### Patch Changes

-   Select Node.js version based on what's available in build-container ([#10822](https://github.com/vercel/vercel/pull/10822))

## vercel@32.5.4

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4
    -   @vercel/node@3.0.10
    -   @vercel/static-build@2.0.11

## @vercel/client@13.0.8

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4

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

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4

## @vercel/node@3.0.10

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4

## @vercel/static-build@2.0.11

### Patch Changes

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

## @vercel-internals/types@1.0.15

### Patch Changes

-   Updated dependencies \[[`65dec5b7e`](65dec5b7e7)]:
    -   @vercel/build-utils@7.2.4
2023-11-15 00:45:19 +00:00
Nathan Rajlich
65dec5b7e7 [build-utils] Select Node.js version based on what's available in build-container (#10822)
Makes `getLatestNodeVersion()` and `getSupportedNodeVersion()` (and thus by extension - `getNodeVersion()`) be aware of the available Node.js versions when running inside the build-container. This is to address the situation with the new AL2023 build-container image which has different Node versions installed compared to the existing AL2 build image.

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

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

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

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

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

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

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

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

If there's a more preferred way to scaffold this project on your machine, I'm open to that, just using what I know
2023-11-13 20:10:57 +00:00
Wyatt Johnson
9472c22bf7 [next] Added more PPR tests (#10823)
This adds additional regression tests for PPR support for Next.js.
2023-11-09 23:45:35 +00:00
33 changed files with 300 additions and 101 deletions

View File

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

View File

@@ -1,5 +1,12 @@
# @vercel-internals/types # @vercel-internals/types
## 1.0.15
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 1.0.14 ## 1.0.14
### Patch Changes ### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @vercel/build-utils # @vercel/build-utils
## 7.2.4
### Patch Changes
- Select Node.js version based on what's available in build-container ([#10822](https://github.com/vercel/vercel/pull/10822))
## 7.2.3 ## 7.2.3
### Patch Changes ### Patch Changes

View File

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

View File

@@ -1,8 +1,11 @@
import { statSync } from 'fs';
import { intersects, validRange } from 'semver'; import { intersects, validRange } from 'semver';
import { NodeVersion } from '../types'; import { NodeVersion } from '../types';
import { NowBuildError } from '../errors'; import { NowBuildError } from '../errors';
import debug from '../debug'; import debug from '../debug';
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
function getOptions() { function getOptions() {
const options = [ const options = [
{ major: 18, range: '18.x', runtime: 'nodejs18.x' }, { major: 18, range: '18.x', runtime: 'nodejs18.x' },
@@ -46,6 +49,21 @@ function getOptions() {
return options; return options;
} }
function isNodeVersionAvailable(version: NodeVersion): boolean {
try {
return statSync(`/node${version.major}`).isDirectory();
} catch {
// ENOENT, or any other error, we don't care about
}
return false;
}
export function getAvailableNodeVersions(): NodeVersionMajor[] {
return getOptions()
.filter(isNodeVersionAvailable)
.map(n => n.major);
}
function getHint(isAuto = false) { function getHint(isAuto = false) {
const { major, range } = getLatestNodeVersion(); const { major, range } = getLatestNodeVersion();
return isAuto return isAuto
@@ -53,8 +71,22 @@ function getHint(isAuto = false) {
: `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`; : `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
} }
export function getLatestNodeVersion() { export function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]) {
return getOptions()[0]; const all = getOptions();
if (availableVersions) {
// Return the first node version that is definitely
// available in the build-container.
for (const version of all) {
for (const major of availableVersions) {
if (version.major === major) {
return version;
}
}
}
}
// As a fallback for local `vc build` and the tests,
// return the first node version if none is found.
return all[0];
} }
export function getDiscontinuedNodeVersions(): NodeVersion[] { export function getDiscontinuedNodeVersions(): NodeVersion[] {
@@ -63,9 +95,10 @@ export function getDiscontinuedNodeVersions(): NodeVersion[] {
export async function getSupportedNodeVersion( export async function getSupportedNodeVersion(
engineRange: string | undefined, engineRange: string | undefined,
isAuto = false isAuto = false,
availableVersions?: NodeVersionMajor[]
): Promise<NodeVersion> { ): Promise<NodeVersion> {
let selection: NodeVersion = getLatestNodeVersion(); let selection: NodeVersion | undefined;
if (engineRange) { if (engineRange) {
const found = const found =
@@ -74,7 +107,12 @@ export async function getSupportedNodeVersion(
// the array is already in order so return the first // the array is already in order so return the first
// match which will be the newest version of node // match which will be the newest version of node
selection = o; selection = o;
return intersects(o.range, engineRange); return (
intersects(o.range, engineRange) &&
(availableVersions?.length
? availableVersions.includes(o.major)
: true)
);
}); });
if (!found) { if (!found) {
throw new NowBuildError({ throw new NowBuildError({
@@ -87,6 +125,10 @@ export async function getSupportedNodeVersion(
} }
} }
if (!selection) {
selection = getLatestNodeVersion(availableVersions);
}
if (isDiscontinued(selection)) { if (isDiscontinued(selection)) {
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`; const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
throw new NowBuildError({ throw new NowBuildError({

View File

@@ -9,7 +9,11 @@ import { deprecate } from 'util';
import debug from '../debug'; import debug from '../debug';
import { NowBuildError } from '../errors'; import { NowBuildError } from '../errors';
import { Meta, PackageJson, NodeVersion, Config } from '../types'; import { Meta, PackageJson, NodeVersion, Config } from '../types';
import { getSupportedNodeVersion, getLatestNodeVersion } from './node-version'; import {
getSupportedNodeVersion,
getLatestNodeVersion,
getAvailableNodeVersions,
} from './node-version';
import { readConfigFile } from './read-config-file'; import { readConfigFile } from './read-config-file';
import { cloneEnv } from '../clone-env'; import { cloneEnv } from '../clone-env';
@@ -238,9 +242,10 @@ export async function getNodeVersion(
destPath: string, destPath: string,
nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION,
config: Config = {}, config: Config = {},
meta: Meta = {} meta: Meta = {},
availableVersions = getAvailableNodeVersions()
): Promise<NodeVersion> { ): Promise<NodeVersion> {
const latest = getLatestNodeVersion(); const latest = getLatestNodeVersion(availableVersions);
if (meta.isDev) { if (meta.isDev) {
// Use the system-installed version of `node` in PATH for `vercel dev` // Use the system-installed version of `node` in PATH for `vercel dev`
return { ...latest, runtime: 'nodejs' }; return { ...latest, runtime: 'nodejs' };
@@ -266,7 +271,7 @@ export async function getNodeVersion(
nodeVersion = node; nodeVersion = node;
isAuto = false; isAuto = false;
} }
return getSupportedNodeVersion(nodeVersion, isAuto); return getSupportedNodeVersion(nodeVersion, isAuto, availableVersions);
} }
export async function scanParentDirs( export async function scanParentDirs(

View File

@@ -127,6 +127,27 @@ it('should allow nodejs18.x', async () => {
expect(await getSupportedNodeVersion('>=16')).toHaveProperty('major', 18); expect(await getSupportedNodeVersion('>=16')).toHaveProperty('major', 18);
}); });
it('should not allow nodejs20.x when not available', async () => {
// Simulates AL2 build-container
await expect(
getSupportedNodeVersion('20.x', true, [14, 16, 18])
).rejects.toThrow(
'Found invalid Node.js Version: "20.x". Please set Node.js Version to 18.x in your Project Settings to use Node.js 18.'
);
});
it('should not allow nodejs18.x when not available', async () => {
// Simulates AL2023 build-container
try {
process.env.VERCEL_ALLOW_NODEJS20 = '1';
await expect(getSupportedNodeVersion('18.x', true, [20])).rejects.toThrow(
'Found invalid Node.js Version: "18.x". Please set Node.js Version to 20.x in your Project Settings to use Node.js 20.'
);
} finally {
delete process.env.VERCEL_ALLOW_NODEJS20;
}
});
it('should ignore node version in vercel dev getNodeVersion()', async () => { it('should ignore node version in vercel dev getNodeVersion()', async () => {
expect( expect(
await getNodeVersion( await getNodeVersion(
@@ -235,6 +256,21 @@ it('should get latest node version', async () => {
expect(getLatestNodeVersion()).toHaveProperty('major', 18); expect(getLatestNodeVersion()).toHaveProperty('major', 18);
}); });
it('should get latest node version with Node 18.x in build-container', async () => {
// Simulates AL2 build-container
expect(getLatestNodeVersion([14, 16, 18])).toHaveProperty('major', 18);
});
it('should get latest node version with Node 20.x in build-container', async () => {
// Simulates AL2023 build-container
try {
process.env.VERCEL_ALLOW_NODEJS20 = '1';
expect(getLatestNodeVersion([20])).toHaveProperty('major', 20);
} finally {
delete process.env.VERCEL_ALLOW_NODEJS20;
}
});
it('should throw for discontinued versions', async () => { it('should throw for discontinued versions', async () => {
// Mock a future date so that Node 8 and 10 become discontinued // Mock a future date so that Node 8 and 10 become discontinued
const realDateNow = Date.now.bind(global.Date); const realDateNow = Date.now.bind(global.Date);

View File

@@ -1,5 +1,14 @@
# vercel # vercel
## 32.5.4
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
- @vercel/node@3.0.10
- @vercel/static-build@2.0.11
## 32.5.3 ## 32.5.3
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "vercel", "name": "vercel",
"version": "32.5.3", "version": "32.5.4",
"preferGlobal": true, "preferGlobal": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "The command-line interface for Vercel", "description": "The command-line interface for Vercel",
@@ -31,17 +31,17 @@
"node": ">= 16" "node": ">= 16"
}, },
"dependencies": { "dependencies": {
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"@vercel/fun": "1.1.0", "@vercel/fun": "1.1.0",
"@vercel/go": "3.0.3", "@vercel/go": "3.0.3",
"@vercel/hydrogen": "1.0.1", "@vercel/hydrogen": "1.0.1",
"@vercel/next": "4.0.14", "@vercel/next": "4.0.14",
"@vercel/node": "3.0.9", "@vercel/node": "3.0.10",
"@vercel/python": "4.1.0", "@vercel/python": "4.1.0",
"@vercel/redwood": "2.0.5", "@vercel/redwood": "2.0.5",
"@vercel/remix-builder": "2.0.11", "@vercel/remix-builder": "2.0.11",
"@vercel/ruby": "2.0.2", "@vercel/ruby": "2.0.2",
"@vercel/static-build": "2.0.10", "@vercel/static-build": "2.0.11",
"chokidar": "3.3.1" "chokidar": "3.3.1"
}, },
"devDependencies": { "devDependencies": {
@@ -88,8 +88,8 @@
"@types/yauzl-promise": "2.1.0", "@types/yauzl-promise": "2.1.0",
"@vercel-internals/constants": "1.0.4", "@vercel-internals/constants": "1.0.4",
"@vercel-internals/get-package-json": "1.0.0", "@vercel-internals/get-package-json": "1.0.0",
"@vercel-internals/types": "1.0.14", "@vercel-internals/types": "1.0.15",
"@vercel/client": "13.0.7", "@vercel/client": "13.0.8",
"@vercel/error-utils": "2.0.2", "@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "2.0.3", "@vercel/frameworks": "2.0.3",
"@vercel/fs-detectors": "5.1.3", "@vercel/fs-detectors": "5.1.3",

View File

@@ -1,5 +1,12 @@
# @vercel/client # @vercel/client
## 13.0.8
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 13.0.7 ## 13.0.7
### Patch Changes ### Patch Changes

View File

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

View File

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

View File

@@ -1,5 +1,12 @@
# @vercel/gatsby-plugin-vercel-builder # @vercel/gatsby-plugin-vercel-builder
## 2.0.10
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 2.0.9 ## 2.0.9
### Patch Changes ### Patch Changes

View File

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

View File

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

View File

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

View File

@@ -40,7 +40,7 @@
"@types/semver": "6.0.0", "@types/semver": "6.0.0",
"@types/text-table": "0.2.1", "@types/text-table": "0.2.1",
"@types/webpack-sources": "3.2.0", "@types/webpack-sources": "3.2.0",
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"@vercel/routing-utils": "3.1.0", "@vercel/routing-utils": "3.1.0",
"async-sema": "3.0.1", "async-sema": "3.0.1",
"buffer-crc32": "0.2.13", "buffer-crc32": "0.2.13",

View File

@@ -1,22 +1,4 @@
import React from 'react' import { Links } from '../components/links';
import Link from 'next/link'
const links = [
{ href: '/', tag: 'pre-generated' },
{ href: '/nested/a', tag: 'pre-generated' },
{ href: '/nested/b', tag: 'on-demand' },
{ href: '/nested/c', tag: 'on-demand' },
{ href: '/on-demand/a', tag: 'on-demand, no-gsp' },
{ href: '/on-demand/b', tag: 'on-demand, no-gsp' },
{ href: '/on-demand/c', tag: 'on-demand, no-gsp' },
{ href: '/static', tag: 'static' },
{ href: '/no-suspense', tag: 'no suspense' },
{ href: '/no-suspense/nested/a', tag: 'no suspense, pre-generated' },
{ href: '/no-suspense/nested/b', tag: 'no suspense, on-demand' },
{ href: '/no-suspense/nested/c', tag: 'no suspense, on-demand' },
{ href: '/dynamic/force-dynamic', tag: "dynamic = 'force-dynamic'" },
{ href: '/dynamic/force-static', tag: "dynamic = 'force-static'" },
]
export default ({ children }) => { export default ({ children }) => {
return ( return (
@@ -28,16 +10,10 @@ export default ({ children }) => {
partially prerender partially prerender
</p> </p>
<aside> <aside>
<ul> <Links />
{links.map(({ href, tag }) => (
<li key={href}>
<Link href={href}>{href}</Link> <span>{tag}</span>
</li>
))}
</ul>
</aside> </aside>
<main>{children}</main> <main>{children}</main>
</body> </body>
</html> </html>
) );
} };

View File

@@ -0,0 +1,16 @@
import React, { Suspense } from 'react'
import { Dynamic } from '../../../components/dynamic'
export const revalidate = 60
export default ({ params: { slug } }) => {
return (
<Suspense fallback={<Dynamic pathname={`/loading/${slug}`} fallback />}>
<Dynamic pathname={`/loading/${slug}`} />
</Suspense>
)
}
export const generateStaticParams = async () => {
return [{ slug: 'a' }]
}

View File

@@ -0,0 +1,3 @@
export default () => {
return <code>loading.jsx</code>
}

View File

@@ -6,16 +6,16 @@ export const Dynamic = ({ pathname, fallback }) => {
return <div>Loading...</div> return <div>Loading...</div>
} }
const messages = [] const messages = [];
const names = ['x-test-input', 'user-agent'] const names = ['x-test-input', 'user-agent'];
const list = headers() const list = headers();
for (const name of names) { for (const name of names) {
messages.push({ name, value: list.get(name) }) messages.push({ name, value: list.get(name) });
} }
return ( return (
<div> <div id="needle">
<dl> <dl>
{pathname && ( {pathname && (
<> <>
@@ -33,5 +33,5 @@ export const Dynamic = ({ pathname, fallback }) => {
))} ))}
</dl> </dl>
</div> </div>
) );
} };

View File

@@ -0,0 +1,42 @@
import React from 'react';
import Link from 'next/link';
const links = [
{ href: '/', tag: 'pre-generated' },
{ href: '/nested/a', tag: 'pre-generated' },
{ href: '/nested/b', tag: 'on-demand' },
{ href: '/nested/c', tag: 'on-demand' },
{ href: '/on-demand/a', tag: 'on-demand, no-gsp' },
{ href: '/on-demand/b', tag: 'on-demand, no-gsp' },
{ href: '/on-demand/c', tag: 'on-demand, no-gsp' },
{ href: '/loading/a', tag: 'loading.jsx, pre-generated' },
{ href: '/loading/b', tag: 'loading.jsx, on-demand' },
{ href: '/loading/c', tag: 'loading.jsx, on-demand' },
{ href: '/static', tag: 'static' },
{ href: '/no-suspense', tag: 'no suspense' },
{ href: '/no-suspense/nested/a', tag: 'no suspense, pre-generated' },
{ href: '/no-suspense/nested/b', tag: 'no suspense, on-demand' },
{ href: '/no-suspense/nested/c', tag: 'no suspense, on-demand' },
{ href: '/dynamic/force-dynamic', tag: "dynamic = 'force-dynamic'" },
{ href: '/dynamic/force-static', tag: "dynamic = 'force-static'" },
{ href: '/edge/suspense', tag: 'edge, pre-generated' },
{ href: '/edge/suspense/a', tag: 'edge, pre-generated' },
{ href: '/edge/suspense/b', tag: 'edge, on-demand' },
{ href: '/edge/suspense/c', tag: 'edge, on-demand' },
{ href: '/edge/no-suspense', tag: 'edge, no suspense, pre-generated' },
{ href: '/edge/no-suspense/a', tag: 'edge, no suspense, pre-generated' },
{ href: '/edge/no-suspense/b', tag: 'edge, no suspense, on-demand' },
{ href: '/edge/no-suspense/c', tag: 'edge, no suspense, on-demand' },
];
export const Links = () => {
return (
<ul>
{links.map(({ href, tag }) => (
<li key={href}>
<Link href={href}>{href}</Link> <span>{tag}</span>
</li>
))}
</ul>
);
};

View File

@@ -11,6 +11,9 @@ const pages = [
{ pathname: '/on-demand/a', dynamic: true }, { pathname: '/on-demand/a', dynamic: true },
{ pathname: '/on-demand/b', dynamic: true }, { pathname: '/on-demand/b', dynamic: true },
{ pathname: '/on-demand/c', dynamic: true }, { pathname: '/on-demand/c', dynamic: true },
{ pathname: '/loading/a', dynamic: true },
{ pathname: '/loading/b', dynamic: true },
{ pathname: '/loading/c', dynamic: true },
{ pathname: '/static', dynamic: false }, { pathname: '/static', dynamic: false },
{ pathname: '/no-suspense', dynamic: true }, { pathname: '/no-suspense', dynamic: true },
{ pathname: '/no-suspense/nested/a', dynamic: true }, { pathname: '/no-suspense/nested/a', dynamic: true },
@@ -18,7 +21,7 @@ const pages = [
{ pathname: '/no-suspense/nested/c', dynamic: true }, { pathname: '/no-suspense/nested/c', dynamic: true },
// TODO: uncomment when we've fixed the 404 case for force-dynamic pages // TODO: uncomment when we've fixed the 404 case for force-dynamic pages
// { pathname: '/dynamic/force-dynamic', dynamic: 'force-dynamic' }, // { pathname: '/dynamic/force-dynamic', dynamic: 'force-dynamic' },
{ pathname: '/dynamic/force-static', dynamic: false }, { pathname: '/dynamic/force-static', dynamic: 'force-static' },
]; ];
const ctx = {}; const ctx = {};
@@ -30,7 +33,7 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
}); });
describe('dynamic pages should resume', () => { describe('dynamic pages should resume', () => {
it.each(pages.filter(p => p.dynamic))( it.each(pages.filter(p => p.dynamic === true))(
'should resume $pathname', 'should resume $pathname',
async ({ pathname }) => { async ({ pathname }) => {
const expected = `${Date.now()}:${Math.random()}`; const expected = `${Date.now()}:${Math.random()}`;
@@ -62,19 +65,27 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
}); });
expect(res.status).toEqual(200); expect(res.status).toEqual(200);
expect(res.headers.get('content-type')).toEqual('text/x-component'); expect(res.headers.get('content-type')).toEqual('text/x-component');
console.log(
'X-NextJS-Postponed-Reason', const cache = res.headers.get('cache-control');
res.headers.get('X-NextJS-Postponed-Reason') expect(cache).toContain('public');
); expect(cache).toContain('must-revalidate');
if (dynamic) {
expect(res.headers.get('X-NextJS-Postponed')).toEqual('1');
} else {
expect(res.headers.has('X-NextJS-Postponed')).toEqual(false);
}
// Expect that static RSC prefetches do not contain the dynamic text. // Expect that static RSC prefetches do not contain the dynamic text.
const text = await res.text(); const text = await res.text();
expect(text).not.toContain(unexpected); expect(text).not.toContain(unexpected);
if (dynamic === true) {
// The dynamic component will contain the text "needle" if it was
// rendered using dynamic content.
expect(text).not.toContain('needle');
expect(res.headers.get('X-NextJS-Postponed')).toEqual('1');
} else {
if (dynamic !== false) {
expect(text).toContain('needle');
}
expect(res.headers.has('X-NextJS-Postponed')).toEqual(false);
}
} }
); );
}); });
@@ -89,8 +100,20 @@ describe(`${__dirname.split(path.sep).pop()}`, () => {
expect(res.headers.get('content-type')).toEqual('text/x-component'); expect(res.headers.get('content-type')).toEqual('text/x-component');
expect(res.headers.has('X-NextJS-Postponed')).toEqual(false); expect(res.headers.has('X-NextJS-Postponed')).toEqual(false);
const cache = res.headers.get('cache-control');
expect(cache).toContain('private');
expect(cache).toContain('no-store');
expect(cache).toContain('no-cache');
expect(cache).toContain('max-age=0');
expect(cache).toContain('must-revalidate');
const text = await res.text(); const text = await res.text();
if (dynamic) {
if (dynamic !== false) {
expect(text).toContain('needle');
}
if (dynamic === true) {
// Expect that dynamic RSC prefetches do contain the dynamic text. // Expect that dynamic RSC prefetches do contain the dynamic text.
expect(text).toContain(expected); expect(text).toContain(expected);
} else { } else {

View File

@@ -1,5 +1,12 @@
# @vercel/node # @vercel/node
## 3.0.10
### Patch Changes
- Updated dependencies [[`65dec5b7e`](https://github.com/vercel/vercel/commit/65dec5b7e752f4da8fe0ffdb25215170453f6f8b)]:
- @vercel/build-utils@7.2.4
## 3.0.9 ## 3.0.9
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/node", "name": "@vercel/node",
"version": "3.0.9", "version": "3.0.10",
"license": "Apache-2.0", "license": "Apache-2.0",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js", "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -24,7 +24,7 @@
"@edge-runtime/primitives": "4.0.5", "@edge-runtime/primitives": "4.0.5",
"@edge-runtime/vm": "3.1.7", "@edge-runtime/vm": "3.1.7",
"@types/node": "14.18.33", "@types/node": "14.18.33",
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"@vercel/error-utils": "2.0.2", "@vercel/error-utils": "2.0.2",
"@vercel/nft": "0.24.2", "@vercel/nft": "0.24.2",
"@vercel/static-config": "3.0.0", "@vercel/static-config": "3.0.0",

View File

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

View File

@@ -28,7 +28,7 @@
"@types/aws-lambda": "8.10.19", "@types/aws-lambda": "8.10.19",
"@types/node": "14.18.33", "@types/node": "14.18.33",
"@types/semver": "6.0.0", "@types/semver": "6.0.0",
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"execa": "3.2.0", "execa": "3.2.0",
"fs-extra": "11.1.0", "fs-extra": "11.1.0",
"jest-junit": "16.0.0" "jest-junit": "16.0.0"

View File

@@ -30,7 +30,7 @@
"@types/jest": "27.5.1", "@types/jest": "27.5.1",
"@types/node": "14.18.33", "@types/node": "14.18.33",
"@types/semver": "7.3.13", "@types/semver": "7.3.13",
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"jest-junit": "16.0.0", "jest-junit": "16.0.0",
"path-to-regexp": "6.2.1", "path-to-regexp": "6.2.1",
"semver": "7.5.2" "semver": "7.5.2"

View File

@@ -23,7 +23,7 @@
"devDependencies": { "devDependencies": {
"@types/fs-extra": "8.0.0", "@types/fs-extra": "8.0.0",
"@types/semver": "6.0.0", "@types/semver": "6.0.0",
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"execa": "2.0.4", "execa": "2.0.4",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",
"jest-junit": "16.0.0", "jest-junit": "16.0.0",

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/static-build", "name": "@vercel/static-build",
"version": "2.0.10", "version": "2.0.11",
"license": "Apache-2.0", "license": "Apache-2.0",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/build-step", "homepage": "https://vercel.com/docs/build-step",
@@ -21,7 +21,7 @@
}, },
"dependencies": { "dependencies": {
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11", "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
"@vercel/gatsby-plugin-vercel-builder": "2.0.9", "@vercel/gatsby-plugin-vercel-builder": "2.0.10",
"@vercel/static-config": "3.0.0", "@vercel/static-config": "3.0.0",
"ts-morph": "12.0.0" "ts-morph": "12.0.0"
}, },
@@ -35,7 +35,7 @@
"@types/node-fetch": "2.5.4", "@types/node-fetch": "2.5.4",
"@types/promise-timeout": "1.3.0", "@types/promise-timeout": "1.3.0",
"@types/semver": "7.3.13", "@types/semver": "7.3.13",
"@vercel/build-utils": "7.2.3", "@vercel/build-utils": "7.2.4",
"@vercel/error-utils": "2.0.2", "@vercel/error-utils": "2.0.2",
"@vercel/frameworks": "2.0.3", "@vercel/frameworks": "2.0.3",
"@vercel/fs-detectors": "5.1.3", "@vercel/fs-detectors": "5.1.3",

38
pnpm-lock.yaml generated
View File

@@ -186,7 +186,7 @@ importers:
specifier: 1.0.4 specifier: 1.0.4
version: link:../constants version: link:../constants
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../../packages/build-utils version: link:../../packages/build-utils
'@vercel/routing-utils': '@vercel/routing-utils':
specifier: 3.1.0 specifier: 3.1.0
@@ -310,7 +310,7 @@ importers:
packages/cli: packages/cli:
dependencies: dependencies:
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
'@vercel/fun': '@vercel/fun':
specifier: 1.1.0 specifier: 1.1.0
@@ -325,7 +325,7 @@ importers:
specifier: 4.0.14 specifier: 4.0.14
version: link:../next version: link:../next
'@vercel/node': '@vercel/node':
specifier: 3.0.9 specifier: 3.0.10
version: link:../node version: link:../node
'@vercel/python': '@vercel/python':
specifier: 4.1.0 specifier: 4.1.0
@@ -340,7 +340,7 @@ importers:
specifier: 2.0.2 specifier: 2.0.2
version: link:../ruby version: link:../ruby
'@vercel/static-build': '@vercel/static-build':
specifier: 2.0.10 specifier: 2.0.11
version: link:../static-build version: link:../static-build
chokidar: chokidar:
specifier: 3.3.1 specifier: 3.3.1
@@ -476,10 +476,10 @@ importers:
specifier: 1.0.0 specifier: 1.0.0
version: link:../../internals/get-package-json version: link:../../internals/get-package-json
'@vercel-internals/types': '@vercel-internals/types':
specifier: 1.0.14 specifier: 1.0.15
version: link:../../internals/types version: link:../../internals/types
'@vercel/client': '@vercel/client':
specifier: 13.0.7 specifier: 13.0.8
version: link:../client version: link:../client
'@vercel/error-utils': '@vercel/error-utils':
specifier: 2.0.2 specifier: 2.0.2
@@ -722,7 +722,7 @@ importers:
packages/client: packages/client:
dependencies: dependencies:
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
'@vercel/routing-utils': '@vercel/routing-utils':
specifier: 3.1.0 specifier: 3.1.0
@@ -923,7 +923,7 @@ importers:
specifier: 7.3.10 specifier: 7.3.10
version: 7.3.10 version: 7.3.10
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
jest-junit: jest-junit:
specifier: 16.0.0 specifier: 16.0.0
@@ -948,7 +948,7 @@ importers:
specifier: 0.25.24 specifier: 0.25.24
version: 0.25.24 version: 0.25.24
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
'@vercel/routing-utils': '@vercel/routing-utils':
specifier: 3.1.0 specifier: 3.1.0
@@ -1015,7 +1015,7 @@ importers:
specifier: 2.1.0 specifier: 2.1.0
version: 2.1.0 version: 2.1.0
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
async-retry: async-retry:
specifier: 1.3.3 specifier: 1.3.3
@@ -1064,7 +1064,7 @@ importers:
specifier: 14.18.33 specifier: 14.18.33
version: 14.18.33 version: 14.18.33
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
execa: execa:
specifier: 3.2.0 specifier: 3.2.0
@@ -1125,7 +1125,7 @@ importers:
specifier: 3.2.0 specifier: 3.2.0
version: 3.2.0 version: 3.2.0
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
'@vercel/routing-utils': '@vercel/routing-utils':
specifier: 3.1.0 specifier: 3.1.0
@@ -1212,7 +1212,7 @@ importers:
specifier: 14.18.33 specifier: 14.18.33
version: 14.18.33 version: 14.18.33
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
'@vercel/error-utils': '@vercel/error-utils':
specifier: 2.0.2 specifier: 2.0.2
@@ -1321,7 +1321,7 @@ importers:
specifier: 3.0.0 specifier: 3.0.0
version: 3.0.0 version: 3.0.0
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
execa: execa:
specifier: ^1.0.0 specifier: ^1.0.0
@@ -1358,7 +1358,7 @@ importers:
specifier: 6.0.0 specifier: 6.0.0
version: 6.0.0 version: 6.0.0
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
execa: execa:
specifier: 3.2.0 specifier: 3.2.0
@@ -1395,7 +1395,7 @@ importers:
specifier: 7.3.13 specifier: 7.3.13
version: 7.3.13 version: 7.3.13
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
jest-junit: jest-junit:
specifier: 16.0.0 specifier: 16.0.0
@@ -1439,7 +1439,7 @@ importers:
specifier: 6.0.0 specifier: 6.0.0
version: 6.0.0 version: 6.0.0
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
execa: execa:
specifier: 2.0.4 specifier: 2.0.4
@@ -1460,7 +1460,7 @@ importers:
specifier: 1.0.11 specifier: 1.0.11
version: link:../gatsby-plugin-vercel-analytics version: link:../gatsby-plugin-vercel-analytics
'@vercel/gatsby-plugin-vercel-builder': '@vercel/gatsby-plugin-vercel-builder':
specifier: 2.0.9 specifier: 2.0.10
version: link:../gatsby-plugin-vercel-builder version: link:../gatsby-plugin-vercel-builder
'@vercel/static-config': '@vercel/static-config':
specifier: 3.0.0 specifier: 3.0.0
@@ -1497,7 +1497,7 @@ importers:
specifier: 7.3.13 specifier: 7.3.13
version: 7.3.13 version: 7.3.13
'@vercel/build-utils': '@vercel/build-utils':
specifier: 7.2.3 specifier: 7.2.4
version: link:../build-utils version: link:../build-utils
'@vercel/error-utils': '@vercel/error-utils':
specifier: 2.0.2 specifier: 2.0.2