Compare commits

...

6 Commits

Author SHA1 Message Date
JJ Kasper
0964be1710 Publish Stable
- vercel@28.4.15
 - @vercel/client@12.2.16
 - @vercel/error-utils@1.0.3
 - @vercel/frameworks@1.1.11
 - @vercel/fs-detectors@3.4.8
 - @vercel/hydrogen@0.0.29
 - @vercel/next@3.2.9
 - @vercel/node-bridge@3.1.2
 - @vercel/node@2.6.2
 - @vercel/redwood@1.0.34
 - @vercel/remix@1.0.35
 - @vercel/routing-utils@2.1.2
 - @vercel/static-build@1.0.35
 - @vercel/static-config@2.0.6
2022-11-07 12:46:03 -08:00
JJ Kasper
9618ffe05f [next] Update rsc header handling (#8862)
### Related Issues

Required for https://github.com/vercel/next.js/pull/42482

### 📋 Checklist

<!--
  Please keep your PR as a Draft until the checklist is complete
-->

#### Tests

- [ ] The code changed/added as part of this PR has been covered with
tests
- [ ] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a
reviewer
- [ ] Issue from task tracker has a link to this PR
2022-11-07 12:42:26 -08:00
github-actions[bot]
832ba3fe23 [examples] Upgrade Next.js to version 13.0.2 (#8847)
This auto-generated PR updates Next.js to version 13.0.2
2022-11-04 16:18:30 -07:00
Ethan Arrowood
253b4fd1d2 [cli][client][error-utils][frameworks][fs-detectors][hydrogen][next][node-bridge][node][redwood][remix][routing-utils][static-config] update @types/node to v14 across repo (#8842)
### Related Issues

Updates @types/node to the latest version within the v14 major (based on `npm view @types/node`)

```
❯ npm view @types/node@'>=14.0.0 <15.0.0' version | tail -1
@types/node@14.18.33 '14.18.33'
```

This PR also fixes the various necessary type changes

### 📋 Checklist

<!--
  Please keep your PR as a Draft until the checklist is complete
-->

#### Tests

- [ ] The code changed/added as part of this PR has been covered with tests
- [ ] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a reviewer
- [ ] Issue from task tracker has a link to this PR
2022-11-04 20:21:13 +00:00
Nathan Rajlich
9e5f17b3c6 [cli] Allow vc link to overwrite existing link (#8845)
There was a regression in #8670 which caused `vc link` to be a no-op
when there was already a link to a Vercel project in the `.vercel`
directory.
2022-11-04 12:12:37 -07:00
Ethan Arrowood
39d0f8dbfc [cli] fix broken integration test (#8844)
### Related Issues

https://github.com/vercel/api/pull/15009 broke one of our integration tests. This PR fixes it.

### 📋 Checklist

<!--
  Please keep your PR as a Draft until the checklist is complete
-->

#### Tests

- [ ] The code changed/added as part of this PR has been covered with tests
- [ ] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a reviewer
- [ ] Issue from task tracker has a link to this PR
2022-11-04 00:12:56 +00:00
34 changed files with 4486 additions and 248 deletions

View File

@@ -16,7 +16,7 @@
"unzip-stream": "0.3.0" "unzip-stream": "0.3.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "13.1.4", "@types/node": "14.18.33",
"@types/node-fetch": "2.5.4", "@types/node-fetch": "2.5.4",
"@vercel/node": "1.9.0", "@vercel/node": "1.9.0",
"typescript": "3.9.6" "typescript": "3.9.6"

View File

@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,9 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"next": "13.0.1", "eslint": "8.26.0",
"eslint-config-next": "13.0.2",
"next": "13.0.2",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0" "react-dom": "18.2.0"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "vercel", "name": "vercel",
"version": "28.4.14", "version": "28.4.15",
"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",
@@ -43,14 +43,14 @@
"dependencies": { "dependencies": {
"@vercel/build-utils": "5.5.7", "@vercel/build-utils": "5.5.7",
"@vercel/go": "2.2.15", "@vercel/go": "2.2.15",
"@vercel/hydrogen": "0.0.28", "@vercel/hydrogen": "0.0.29",
"@vercel/next": "3.2.8", "@vercel/next": "3.2.9",
"@vercel/node": "2.6.1", "@vercel/node": "2.6.2",
"@vercel/python": "3.1.24", "@vercel/python": "3.1.24",
"@vercel/redwood": "1.0.33", "@vercel/redwood": "1.0.34",
"@vercel/remix": "1.0.34", "@vercel/remix": "1.0.35",
"@vercel/ruby": "1.3.41", "@vercel/ruby": "1.3.41",
"@vercel/static-build": "1.0.34", "@vercel/static-build": "1.0.35",
"update-notifier": "5.1.0" "update-notifier": "5.1.0"
}, },
"devDependencies": { "devDependencies": {
@@ -81,7 +81,7 @@
"@types/minimatch": "3.0.3", "@types/minimatch": "3.0.3",
"@types/mri": "1.1.0", "@types/mri": "1.1.0",
"@types/ms": "0.7.30", "@types/ms": "0.7.30",
"@types/node": "11.11.0", "@types/node": "14.18.33",
"@types/node-fetch": "2.5.10", "@types/node-fetch": "2.5.10",
"@types/npm-package-arg": "6.1.0", "@types/npm-package-arg": "6.1.0",
"@types/pluralize": "0.0.29", "@types/pluralize": "0.0.29",
@@ -95,10 +95,10 @@
"@types/which": "1.3.2", "@types/which": "1.3.2",
"@types/write-json-file": "2.2.1", "@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0", "@types/yauzl-promise": "2.1.0",
"@vercel/client": "12.2.15", "@vercel/client": "12.2.16",
"@vercel/error-utils": "1.0.2", "@vercel/error-utils": "1.0.3",
"@vercel/frameworks": "1.1.10", "@vercel/frameworks": "1.1.11",
"@vercel/fs-detectors": "3.4.7", "@vercel/fs-detectors": "3.4.8",
"@vercel/fun": "1.0.4", "@vercel/fun": "1.0.4",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"@zeit/source-map-support": "0.6.2", "@zeit/source-map-support": "0.6.2",

View File

@@ -1,8 +1,7 @@
import { bold } from 'chalk'; import { bold } from 'chalk';
import inquirer from 'inquirer'; import inquirer from 'inquirer';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { URLSearchParams } from 'url'; import { URL } from 'url';
import { parse as parseUrl } from 'url';
import { VercelConfig } from '@vercel/client'; import { VercelConfig } from '@vercel/client';
import retry, { RetryFunction, Options as RetryOptions } from 'async-retry'; import retry, { RetryFunction, Options as RetryOptions } from 'async-retry';
import fetch, { BodyInit, Headers, RequestInit, Response } from 'node-fetch'; import fetch, { BodyInit, Headers, RequestInit, Response } from 'node-fetch';
@@ -87,25 +86,18 @@ export default class Client extends EventEmitter implements Stdio {
} }
private _fetch(_url: string, opts: FetchOptions = {}) { private _fetch(_url: string, opts: FetchOptions = {}) {
const parsedUrl = parseUrl(_url, true); const url = new URL(_url, this.apiUrl);
const apiUrl = parsedUrl.host
? `${parsedUrl.protocol}//${parsedUrl.host}`
: '';
if (opts.accountId || opts.useCurrentTeam !== false) { if (opts.accountId || opts.useCurrentTeam !== false) {
const query = new URLSearchParams(parsedUrl.query);
if (opts.accountId) { if (opts.accountId) {
if (opts.accountId.startsWith('team_')) { if (opts.accountId.startsWith('team_')) {
query.set('teamId', opts.accountId); url.searchParams.set('teamId', opts.accountId);
} else { } else {
query.delete('teamId'); url.searchParams.delete('teamId');
} }
} else if (opts.useCurrentTeam !== false && this.config.currentTeam) { } else if (opts.useCurrentTeam !== false && this.config.currentTeam) {
query.set('teamId', this.config.currentTeam); url.searchParams.set('teamId', this.config.currentTeam);
} }
_url = `${apiUrl}${parsedUrl.pathname}?${query}`;
} }
const headers = new Headers(opts.headers); const headers = new Headers(opts.headers);
@@ -122,7 +114,6 @@ export default class Client extends EventEmitter implements Stdio {
body = opts.body; body = opts.body;
} }
const url = `${apiUrl ? '' : this.apiUrl}${_url}`;
const requestId = this.requestIdCounter++; const requestId = this.requestIdCounter++;
return this.output.time(res => { return this.output.time(res => {
if (res) { if (res) {
@@ -130,7 +121,7 @@ export default class Client extends EventEmitter implements Stdio {
res.statusText res.statusText
}: ${res.headers.get('x-vercel-id')}`; }: ${res.headers.get('x-vercel-id')}`;
} else { } else {
return `#${requestId}${opts.method || 'GET'} ${url}`; return `#${requestId}${opts.method || 'GET'} ${url.href}`;
} }
}, fetch(url, { ...opts, headers, body })); }, fetch(url, { ...opts, headers, body }));
} }

View File

@@ -87,8 +87,12 @@ async function createBuildProcess(
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// The first message that the builder process sends is the `ready` event // The first message that the builder process sends is the `ready` event
buildProcess.once('message', ({ type }) => { buildProcess.once('message', data => {
if (type !== 'ready') { if (
data !== null &&
typeof data === 'object' &&
(data as { type: string }).type !== 'ready'
) {
reject(new Error('Did not get "ready" event from builder')); reject(new Error('Did not get "ready" event from builder'));
} else { } else {
resolve(buildProcess); resolve(buildProcess);

View File

@@ -31,11 +31,11 @@ export function parseListen(str: string, defaultPort = 3000): ListenSpec {
return [url.pathname]; return [url.pathname];
case 'tcp:': case 'tcp:':
url.port = url.port || String(defaultPort); url.port = url.port || String(defaultPort);
return [parseInt(url.port, 10), url.hostname]; return [parseInt(url.port, 10), url.hostname ?? undefined];
default: default:
if (!url.slashes) { if (!url.slashes) {
if (url.protocol === null) { if (url.protocol === null) {
return [defaultPort, url.pathname]; return [defaultPort, url.pathname ?? undefined];
} }
port = Number(url.hostname); port = Number(url.hostname);
if (url.protocol && !isNaN(port)) { if (url.protocol && !isNaN(port)) {

View File

@@ -4,7 +4,7 @@
* @param querystring - The querystring to parse, also known as the "search" string. * @param querystring - The querystring to parse, also known as the "search" string.
*/ */
export function parseQueryString( export function parseQueryString(
querystring?: string querystring?: string | null
): Record<string, string[]> { ): Record<string, string[]> {
const query: Record<string, string[]> = Object.create(null); const query: Record<string, string[]> = Object.create(null);
if (!querystring || !querystring.startsWith('?') || querystring === '?') { if (!querystring || !querystring.startsWith('?') || querystring === '?') {
@@ -38,9 +38,9 @@ export function parseQueryString(
*/ */
export function formatQueryString( export function formatQueryString(
query: Record<string, string[]> | undefined query: Record<string, string[]> | undefined
): string | undefined { ): string | null {
if (!query) { if (!query) {
return undefined; return null;
} }
let s = ''; let s = '';
let prefix = '?'; let prefix = '?';
@@ -55,5 +55,5 @@ export function formatQueryString(
prefix = '&'; prefix = '&';
} }
} }
return s || undefined; return s || null;
} }

View File

@@ -57,7 +57,8 @@ export async function devRouter(
phase?: HandleValue | null phase?: HandleValue | null
): Promise<RouteResult> { ): Promise<RouteResult> {
let result: RouteResult | undefined; let result: RouteResult | undefined;
let { pathname: reqPathname = '/', search: reqSearch } = url.parse(reqUrl); let { pathname: reqPathname, search: reqSearch } = url.parse(reqUrl);
reqPathname ??= '/';
const reqQuery = parseQueryString(reqSearch); const reqQuery = parseQueryString(reqSearch);
const combinedHeaders: HttpHeadersConfig = { ...previousHeaders }; const combinedHeaders: HttpHeadersConfig = { ...previousHeaders };
let status: number | undefined; let status: number | undefined;
@@ -130,7 +131,8 @@ export async function devRouter(
phase !== 'hit' && phase !== 'hit' &&
!isDestUrl !isDestUrl
) { ) {
const { pathname = '/' } = url.parse(destPath); let { pathname } = url.parse(destPath);
pathname ??= '/';
const hasDestFile = await devServer.hasFilesystem( const hasDestFile = await devServer.hasFilesystem(
pathname, pathname,
vercelConfig vercelConfig
@@ -186,8 +188,9 @@ export async function devRouter(
if (!destPath.startsWith('/')) { if (!destPath.startsWith('/')) {
destPath = `/${destPath}`; destPath = `/${destPath}`;
} }
const { pathname: destPathname = '/', search: destSearch } = let { pathname: destPathname, search: destSearch } =
url.parse(destPath); url.parse(destPath);
destPathname ??= '/';
const destQuery = parseQueryString(destSearch); const destQuery = parseQueryString(destSearch);
Object.assign(destQuery, reqQuery); Object.assign(destQuery, reqQuery);
result = { result = {

View File

@@ -1,4 +1,4 @@
import Client from '../client'; import type Client from '../client';
export default async function confirm( export default async function confirm(
client: Client, client: Client,

View File

@@ -34,7 +34,10 @@ export async function ensureLink(
): Promise<LinkResult | number> { ): Promise<LinkResult | number> {
let link = await getLinkedProject(client, cwd); let link = await getLinkedProject(client, cwd);
if (link.status === 'not_linked') { if (
(link.status === 'linked' && opts.forceDelete) ||
link.status === 'not_linked'
) {
link = await setupAndLink(client, cwd, opts); link = await setupAndLink(client, cwd, opts);
if (link.status === 'not_linked') { if (link.status === 'not_linked') {

View File

@@ -1,4 +1,6 @@
const { exec } = require('exeggcute'); const { exec } = require('exeggcute');
const path = require('path');
const { existsSync, writeFileSync } = require('fs');
const a = require('./a'); const a = require('./a');
const b = require('./b'); const b = require('./b');
@@ -8,8 +10,14 @@ b();
exec('mkdir public', __dirname) exec('mkdir public', __dirname)
.then(() => { .then(() => {
exec('echo "Hello, World!" > public/index.html', __dirname).then(() => { const cacheFile = path.join(__dirname, 'node_modules/.was-cached');
const cacheExists = existsSync(cacheFile);
exec(
`echo ${cacheExists ? 'cache exists' : 'no cache'} > public/index.html`,
__dirname
).then(() => {
console.log('Success'); console.log('Success');
writeFileSync(cacheFile, '1');
}); });
}) })
.catch(console.error); .catch(console.error);

View File

@@ -3446,23 +3446,20 @@ test('deploy pnpm twice using pnp and symlink=false', async t => {
]); ]);
} }
function logs(deploymentUrl) {
return execa(binaryPath, ['logs', deploymentUrl, ...defaultArgs]);
}
let { exitCode, stderr, stdout } = await deploy(); let { exitCode, stderr, stdout } = await deploy();
t.is(exitCode, 0, formatOutput({ stderr, stdout })); t.is(exitCode, 0, formatOutput({ stderr, stdout }));
let { stdout: logsOutput } = await logs(stdout); let page = await fetch(stdout);
let text = await page.text();
t.regex(logsOutput, /Build Cache not found/m); t.is(text, 'no cache\n');
({ exitCode, stderr, stdout } = await deploy()); ({ exitCode, stderr, stdout } = await deploy());
t.is(exitCode, 0, formatOutput({ stderr, stdout })); t.is(exitCode, 0, formatOutput({ stderr, stdout }));
({ stdout: logsOutput } = await logs(stdout)); page = await fetch(stdout);
text = await page.text();
t.regex(logsOutput, /Build cache downloaded/m); t.is(text, 'cache exists\n');
}); });
test('reject deploying with wrong team .vercel config', async t => { test('reject deploying with wrong team .vercel config', async t => {

View File

@@ -23,7 +23,7 @@ class MockStream extends PassThrough {
this.isTTY = true; this.isTTY = true;
} }
// These is for the `ora` module // These are for the `ora` module
clearLine() {} clearLine() {}
cursorTo() {} cursorTo() {}
} }

View File

@@ -0,0 +1,125 @@
import { basename, join } from 'path';
import { mkdtemp, readJSON, remove } from 'fs-extra';
import link from '../../../src/commands/link';
import { client } from '../../mocks/client';
import { useUser } from '../../mocks/user';
import { useTeams } from '../../mocks/team';
import {
defaultProject,
useProject,
useUnknownProject,
} from '../../mocks/project';
import { tmpdir } from 'os';
describe('link', () => {
const origCwd = process.cwd();
it('should prompt for link', async () => {
const cwd = await mkdtemp(join(tmpdir(), 'cli-'));
try {
process.chdir(cwd);
const user = useUser();
useTeams('team_dummy');
const { project } = useProject({
...defaultProject,
id: basename(cwd),
name: basename(cwd),
});
useUnknownProject();
const exitCodePromise = link(client);
await expect(client.stderr).toOutput('Set up');
client.stdin.write('y\n');
await expect(client.stderr).toOutput(
'Which scope should contain your project?'
);
client.stdin.write('y\n');
await expect(client.stderr).toOutput('Link to it?');
client.stdin.write('y\n');
await expect(client.stderr).toOutput(
`Linked to ${user.username}/${project.name} (created .vercel and added it to .gitignore)`
);
await expect(exitCodePromise).resolves.toEqual(0);
const projectJson = await readJSON(join(cwd, '.vercel/project.json'));
expect(projectJson.orgId).toEqual(user.id);
expect(projectJson.projectId).toEqual(project.id);
} finally {
process.chdir(origCwd);
await remove(cwd);
}
});
it('should allow specifying `--project` flag', async () => {
const cwd = await mkdtemp(join(tmpdir(), 'cli-'));
try {
process.chdir(cwd);
const user = useUser();
useTeams('team_dummy');
const { project } = useProject({
...defaultProject,
id: basename(cwd),
name: basename(cwd),
});
useUnknownProject();
client.setArgv('--project', project.name!, '--yes');
const exitCodePromise = link(client);
await expect(client.stderr).toOutput(
`Linked to ${user.username}/${project.name} (created .vercel and added it to .gitignore)`
);
await expect(exitCodePromise).resolves.toEqual(0);
const projectJson = await readJSON(join(cwd, '.vercel/project.json'));
expect(projectJson.orgId).toEqual(user.id);
expect(projectJson.projectId).toEqual(project.id);
} finally {
process.chdir(origCwd);
await remove(cwd);
}
});
it('should allow overwriting existing link', async () => {
const cwd = await mkdtemp(join(tmpdir(), 'cli-'));
try {
process.chdir(cwd);
const user = useUser();
useTeams('team_dummy');
const { project: proj1 } = useProject({
...defaultProject,
id: 'one',
name: 'one',
});
const { project: proj2 } = useProject({
...defaultProject,
id: 'two',
name: 'two',
});
useUnknownProject();
client.setArgv('--project', proj1.name!, '--yes');
await expect(link(client)).resolves.toEqual(0);
let projectJson = await readJSON(join(cwd, '.vercel/project.json'));
expect(projectJson.orgId).toEqual(user.id);
expect(projectJson.projectId).toEqual(proj1.id);
client.setArgv('--project', proj2.name!, '--yes');
await expect(link(client)).resolves.toEqual(0);
projectJson = await readJSON(join(cwd, '.vercel/project.json'));
expect(projectJson.orgId).toEqual(user.id);
expect(projectJson.projectId).toEqual(proj2.id);
} finally {
process.chdir(origCwd);
await remove(cwd);
}
});
});

View File

@@ -23,24 +23,24 @@ describe('parseQueryString', () => {
const parsed = parseQueryString(''); const parsed = parseQueryString('');
expect(parsed).toEqual({}); expect(parsed).toEqual({});
const format = formatQueryString(parsed); const format = formatQueryString(parsed);
expect(format).toEqual(undefined); expect(format).toEqual(null);
}); });
it('should work with question mark', async () => { it('should work with question mark', async () => {
const parsed = parseQueryString('?'); const parsed = parseQueryString('?');
expect(parsed).toEqual({}); expect(parsed).toEqual({});
const format = formatQueryString(parsed); const format = formatQueryString(parsed);
expect(format).toEqual(undefined); expect(format).toEqual(null);
}); });
it('should work without question mark', async () => { it('should work without question mark', async () => {
const parsed = parseQueryString('blarg'); const parsed = parseQueryString('blarg');
expect(parsed).toEqual({}); expect(parsed).toEqual({});
const format = formatQueryString(parsed); const format = formatQueryString(parsed);
expect(format).toEqual(undefined); expect(format).toEqual(null);
}); });
it('should work with undefined', async () => { it('should work with undefined', async () => {
const parsed = parseQueryString(undefined); const parsed = parseQueryString(undefined);
expect(parsed).toEqual({}); expect(parsed).toEqual({});
const format = formatQueryString(parsed); const format = formatQueryString(parsed);
expect(format).toEqual(undefined); expect(format).toEqual(null);
}); });
}); });

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/client", "name": "@vercel/client",
"version": "12.2.15", "version": "12.2.16",
"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",
@@ -28,7 +28,7 @@
"@types/jest": "27.4.1", "@types/jest": "27.4.1",
"@types/minimatch": "3.0.5", "@types/minimatch": "3.0.5",
"@types/ms": "0.7.30", "@types/ms": "0.7.30",
"@types/node": "12.0.4", "@types/node": "14.18.33",
"@types/node-fetch": "2.5.4", "@types/node-fetch": "2.5.4",
"@types/recursive-readdir": "2.2.0", "@types/recursive-readdir": "2.2.0",
"@types/tar-fs": "1.16.1", "@types/tar-fs": "1.16.1",
@@ -44,7 +44,7 @@
}, },
"dependencies": { "dependencies": {
"@vercel/build-utils": "5.5.7", "@vercel/build-utils": "5.5.7",
"@vercel/routing-utils": "2.1.1", "@vercel/routing-utils": "2.1.2",
"@zeit/fetch": "5.2.0", "@zeit/fetch": "5.2.0",
"async-retry": "1.2.3", "async-retry": "1.2.3",
"async-sema": "3.0.0", "async-sema": "3.0.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/error-utils", "name": "@vercel/error-utils",
"version": "1.0.2", "version": "1.0.3",
"description": "A collection of error utilities for vercel/vercel", "description": "A collection of error utilities for vercel/vercel",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/jest": "29.2.1", "@types/jest": "29.2.1",
"@types/node": "16.11.7", "@types/node": "14.18.33",
"jest": "29.2.2", "jest": "29.2.2",
"ts-jest": "29.0.3", "ts-jest": "29.0.3",
"typescript": "^4.8.4" "typescript": "^4.8.4"

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/frameworks", "name": "@vercel/frameworks",
"version": "1.1.10", "version": "1.1.11",
"main": "./dist/frameworks.js", "main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts", "types": "./dist/frameworks.d.ts",
"files": [ "files": [
@@ -19,9 +19,9 @@
"devDependencies": { "devDependencies": {
"@types/jest": "27.4.1", "@types/jest": "27.4.1",
"@types/js-yaml": "3.12.1", "@types/js-yaml": "3.12.1",
"@types/node": "12.0.4", "@types/node": "14.18.33",
"@types/node-fetch": "2.5.8", "@types/node-fetch": "2.5.8",
"@vercel/routing-utils": "2.1.1", "@vercel/routing-utils": "2.1.2",
"ajv": "6.12.2", "ajv": "6.12.2",
"typescript": "4.3.4" "typescript": "4.3.4"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/fs-detectors", "name": "@vercel/fs-detectors",
"version": "3.4.7", "version": "3.4.8",
"description": "Vercel filesystem detectors", "description": "Vercel filesystem detectors",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -19,8 +19,8 @@
"test-unit": "yarn test" "test-unit": "yarn test"
}, },
"dependencies": { "dependencies": {
"@vercel/frameworks": "1.1.10", "@vercel/frameworks": "1.1.11",
"@vercel/routing-utils": "2.1.1", "@vercel/routing-utils": "2.1.2",
"glob": "8.0.3", "glob": "8.0.3",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"json5": "2.2.1", "json5": "2.2.1",
@@ -32,7 +32,7 @@
"@types/jest": "27.5.1", "@types/jest": "27.5.1",
"@types/js-yaml": "4.0.5", "@types/js-yaml": "4.0.5",
"@types/minimatch": "3.0.5", "@types/minimatch": "3.0.5",
"@types/node": "12.12.20", "@types/node": "14.18.33",
"@types/semver": "7.3.10", "@types/semver": "7.3.10",
"@vercel/build-utils": "4.2.0", "@vercel/build-utils": "4.2.0",
"typescript": "4.3.4" "typescript": "4.3.4"

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/hydrogen", "name": "@vercel/hydrogen",
"version": "0.0.28", "version": "0.0.29",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
"homepage": "https://vercel.com/docs", "homepage": "https://vercel.com/docs",
@@ -20,9 +20,9 @@
], ],
"devDependencies": { "devDependencies": {
"@types/jest": "27.5.1", "@types/jest": "27.5.1",
"@types/node": "*", "@types/node": "14.18.33",
"@vercel/build-utils": "5.5.7", "@vercel/build-utils": "5.5.7",
"@vercel/static-config": "2.0.5", "@vercel/static-config": "2.0.6",
"typescript": "4.6.4" "typescript": "4.6.4"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/next", "name": "@vercel/next",
"version": "3.2.8", "version": "3.2.9",
"license": "MIT", "license": "MIT",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js", "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -39,14 +39,14 @@
"@types/fs-extra": "8.0.0", "@types/fs-extra": "8.0.0",
"@types/glob": "7.1.3", "@types/glob": "7.1.3",
"@types/next-server": "8.0.0", "@types/next-server": "8.0.0",
"@types/node": "14.17.27", "@types/node": "14.18.33",
"@types/resolve-from": "5.0.1", "@types/resolve-from": "5.0.1",
"@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": "5.5.7", "@vercel/build-utils": "5.5.7",
"@vercel/nft": "0.22.1", "@vercel/nft": "0.22.1",
"@vercel/routing-utils": "2.1.1", "@vercel/routing-utils": "2.1.2",
"async-sema": "3.0.1", "async-sema": "3.0.1",
"buffer-crc32": "0.2.13", "buffer-crc32": "0.2.13",
"cheerio": "1.0.0-rc.10", "cheerio": "1.0.0-rc.10",

View File

@@ -1137,6 +1137,8 @@ export async function serverBuild({
} }
} }
const rscHeader = routesManifest.rsc?.header || '__rsc__';
return { return {
wildcard: wildcardConfig, wildcard: wildcardConfig,
images: images:
@@ -1390,7 +1392,7 @@ export async function serverBuild({
has: [ has: [
{ {
type: 'header', type: 'header',
key: '__rsc__', key: rscHeader,
}, },
], ],
dest: path.posix.join('/', entryDirectory, '/index.rsc'), dest: path.posix.join('/', entryDirectory, '/index.rsc'),
@@ -1401,7 +1403,7 @@ export async function serverBuild({
has: [ has: [
{ {
type: 'header', type: 'header',
key: '__rsc__', key: rscHeader,
}, },
], ],
dest: path.posix.join('/', entryDirectory, '/$1.rsc'), dest: path.posix.join('/', entryDirectory, '/$1.rsc'),

View File

@@ -209,6 +209,10 @@ type RoutesManifestOld = {
defaultLocale: string; defaultLocale: string;
}>; }>;
}; };
rsc?: {
header: string;
varyHeader: string;
};
}; };
type RoutesManifestV4 = Omit<RoutesManifestOld, 'dynamicRoutes' | 'version'> & { type RoutesManifestV4 = Omit<RoutesManifestOld, 'dynamicRoutes' | 'version'> & {
@@ -1991,6 +1995,9 @@ export const onPrerenderRoute =
allowQuery = []; allowQuery = [];
} }
} }
const rscVaryHeader =
routesManifest?.rsc?.varyHeader ||
'__rsc__, __next_router_state_tree__, __next_router_prefetch__';
prerenders[outputPathPage] = new Prerender({ prerenders[outputPathPage] = new Prerender({
expiration: initialRevalidate, expiration: initialRevalidate,
@@ -2008,7 +2015,7 @@ export const onPrerenderRoute =
...(isAppPathRoute ...(isAppPathRoute
? { ? {
initialHeaders: { initialHeaders: {
vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__', vary: rscVaryHeader,
}, },
} }
: {}), : {}),
@@ -2031,7 +2038,7 @@ export const onPrerenderRoute =
? { ? {
initialHeaders: { initialHeaders: {
'content-type': 'application/octet-stream', 'content-type': 'application/octet-stream',
vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__', vary: rscVaryHeader,
}, },
} }
: {}), : {}),

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/node-bridge", "name": "@vercel/node-bridge",
"version": "3.1.1", "version": "3.1.2",
"license": "MIT", "license": "MIT",
"main": "./index.js", "main": "./index.js",
"repository": { "repository": {
@@ -22,7 +22,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/aws-lambda": "8.10.19", "@types/aws-lambda": "8.10.19",
"@types/node": "*", "@types/node": "14.18.33",
"jsonlines": "0.1.1", "jsonlines": "0.1.1",
"test-listen": "1.1.0", "test-listen": "1.1.0",
"typescript": "4.3.4" "typescript": "4.3.4"

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/node", "name": "@vercel/node",
"version": "2.6.1", "version": "2.6.2",
"license": "MIT", "license": "MIT",
"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",
@@ -30,10 +30,10 @@
}, },
"dependencies": { "dependencies": {
"@edge-runtime/vm": "2.0.0", "@edge-runtime/vm": "2.0.0",
"@types/node": "*", "@types/node": "14.18.33",
"@vercel/build-utils": "5.5.7", "@vercel/build-utils": "5.5.7",
"@vercel/node-bridge": "3.1.1", "@vercel/node-bridge": "3.1.2",
"@vercel/static-config": "2.0.5", "@vercel/static-config": "2.0.6",
"edge-runtime": "2.0.0", "edge-runtime": "2.0.0",
"esbuild": "0.14.47", "esbuild": "0.14.47",
"exit-hook": "2.2.1", "exit-hook": "2.2.1",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/redwood", "name": "@vercel/redwood",
"version": "1.0.33", "version": "1.0.34",
"main": "./dist/index.js", "main": "./dist/index.js",
"license": "MIT", "license": "MIT",
"homepage": "https://vercel.com/docs", "homepage": "https://vercel.com/docs",
@@ -20,12 +20,12 @@
}, },
"dependencies": { "dependencies": {
"@vercel/nft": "0.22.1", "@vercel/nft": "0.22.1",
"@vercel/routing-utils": "2.1.1", "@vercel/routing-utils": "2.1.2",
"semver": "6.1.1" "semver": "6.1.1"
}, },
"devDependencies": { "devDependencies": {
"@types/aws-lambda": "8.10.19", "@types/aws-lambda": "8.10.19",
"@types/node": "*", "@types/node": "14.18.33",
"@types/semver": "6.0.0", "@types/semver": "6.0.0",
"@vercel/build-utils": "5.5.7" "@vercel/build-utils": "5.5.7"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/remix", "name": "@vercel/remix",
"version": "1.0.34", "version": "1.0.35",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
"homepage": "https://vercel.com/docs", "homepage": "https://vercel.com/docs",
@@ -24,7 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "27.5.1", "@types/jest": "27.5.1",
"@types/node": "*", "@types/node": "14.18.33",
"@vercel/build-utils": "5.5.7", "@vercel/build-utils": "5.5.7",
"typescript": "4.6.4" "typescript": "4.6.4"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/routing-utils", "name": "@vercel/routing-utils",
"version": "2.1.1", "version": "2.1.2",
"description": "Vercel routing utilities", "description": "Vercel routing utilities",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -23,7 +23,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "27.4.1", "@types/jest": "27.4.1",
"@types/node": "12.12.20", "@types/node": "14.18.33",
"ajv": "^6.0.0", "ajv": "^6.0.0",
"typescript": "4.3.4" "typescript": "4.3.4"
}, },

View File

@@ -297,7 +297,12 @@ function replaceSegments(
safelyCompile(unescapeSegments(str), indexes, true) safelyCompile(unescapeSegments(str), indexes, true)
); );
} else { } else {
query[key] = safelyCompile(unescapeSegments(strOrArray), indexes, true); // TODO: handle strOrArray is undefined
query[key] = safelyCompile(
unescapeSegments(strOrArray as string),
indexes,
true
);
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/static-build", "name": "@vercel/static-build",
"version": "1.0.34", "version": "1.0.35",
"license": "MIT", "license": "MIT",
"main": "./dist/index", "main": "./dist/index",
"homepage": "https://vercel.com/docs/build-step", "homepage": "https://vercel.com/docs/build-step",
@@ -37,10 +37,10 @@
"@types/node-fetch": "2.5.4", "@types/node-fetch": "2.5.4",
"@types/promise-timeout": "1.3.0", "@types/promise-timeout": "1.3.0",
"@vercel/build-utils": "5.5.7", "@vercel/build-utils": "5.5.7",
"@vercel/frameworks": "1.1.10", "@vercel/frameworks": "1.1.11",
"@vercel/ncc": "0.24.0", "@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.1.1", "@vercel/routing-utils": "2.1.2",
"@vercel/static-config": "2.0.5", "@vercel/static-config": "2.0.6",
"fs-extra": "10.0.0", "fs-extra": "10.0.0",
"get-port": "5.0.0", "get-port": "5.0.0",
"is-port-reachable": "2.0.1", "is-port-reachable": "2.0.1",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@vercel/static-config", "name": "@vercel/static-config",
"version": "2.0.5", "version": "2.0.6",
"license": "MIT", "license": "MIT",
"main": "./dist/index", "main": "./dist/index",
"repository": { "repository": {
@@ -24,7 +24,7 @@
"devDependencies": { "devDependencies": {
"@swc/core": "1.2.182", "@swc/core": "1.2.182",
"@types/jest": "27.4.1", "@types/jest": "27.4.1",
"@types/node": "*" "@types/node": "14.18.33"
}, },
"jest": { "jest": {
"preset": "ts-jest", "preset": "ts-jest",

View File

@@ -3033,30 +3033,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67"
integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==
"@types/node@11.11.0": "@types/node@14.18.33":
version "11.11.0" version "14.18.33"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.0.tgz#070e9ce7c90e727aca0e0c14e470f9a93ffe9390" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.33.tgz#8c29a0036771569662e4635790ffa9e057db379b"
integrity sha512-D5Rt+HXgEywr3RQJcGlZUCTCx1qVbCZpVk3/tOOA6spLNZdGm8BU+zRgdRYDoF1pO3RuXLxADzMrF903JlQXqg== integrity sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg==
"@types/node@12.0.4":
version "12.0.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.4.tgz#46832183115c904410c275e34cf9403992999c32"
integrity sha512-j8YL2C0fXq7IONwl/Ud5Kt0PeXw22zGERt+HSSnwbKOJVsAGkEz3sFCYwaF9IOuoG1HOtE0vKCj6sXF7Q0+Vaw==
"@types/node@12.12.20":
version "12.12.20"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.20.tgz#7b693038ce661fe57a7ffa4679440b5e7c5e8b99"
integrity sha512-VAe+DiwpnC/g448uN+/3gRl4th0BTdrR9gSLIOHA+SUQskaYZQDOHG7xmjiE7JUhjbXnbXytf6Ih+/pA6CtMFQ==
"@types/node@14.17.27":
version "14.17.27"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.27.tgz#5054610d37bb5f6e21342d0e6d24c494231f3b85"
integrity sha512-94+Ahf9IcaDuJTle/2b+wzvjmutxXAEXU6O81JHblYXUg2BDG+dnBy7VxIPHKAyEEDHzCMQydTJuWvrE+Aanzw==
"@types/node@16.11.7":
version "16.11.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.7.tgz#36820945061326978c42a01e56b61cd223dfdc42"
integrity sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==
"@types/normalize-package-data@^2.4.0": "@types/normalize-package-data@^2.4.0":
version "2.4.0" version "2.4.0"