mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-12 12:57:47 +00:00
Compare commits
29 Commits
esbuild-py
...
@vercel/ru
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcebab7517 | ||
|
|
45b73c7e86 | ||
|
|
a732d30c84 | ||
|
|
8504735808 | ||
|
|
9d64312aaa | ||
|
|
a8ad176262 | ||
|
|
0ee089a501 | ||
|
|
d8bc570f60 | ||
|
|
f15cba6148 | ||
|
|
989f0d8139 | ||
|
|
6784e77516 | ||
|
|
6baefc825a | ||
|
|
0a08e4b23e | ||
|
|
b265e13d40 | ||
|
|
50e04dd858 | ||
|
|
82231058da | ||
|
|
61227bf7e3 | ||
|
|
6aa0aa4e65 | ||
|
|
caaba0d685 | ||
|
|
335fd70a68 | ||
|
|
c3c54d6e69 | ||
|
|
43048a0dd8 | ||
|
|
60c75fd76c | ||
|
|
bd1319d7a3 | ||
|
|
1138f7e3d1 | ||
|
|
bb95cb9225 | ||
|
|
0048eb999e | ||
|
|
1b4de4a986 | ||
|
|
c9ad4084ee |
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"@vercel/build-utils": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
add descriptions to NodeVersion properties
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'vercel': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Migrates the vc env command to the command data structure for use in the help output.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'vercel': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update domains command to new structure
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"vercel": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
migrate `rollback` command structure for help output
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"vercel": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
migrate `inti` command structure for help output
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'vercel': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Remove mri workaround
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"vercel": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
migrate dev command structure for help output
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"@vercel/next": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix 404 enoent for i18n
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'vercel': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Migrate `vc secrets` to new help command structure
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"vercel": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
migrate `promote` command structure for help output
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"@vercel/node": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
remove console.log
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"examples": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
update examples to use at least node@16
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"vercel": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
migrate `git` command structure for help output
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'vercel': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Update project command to new data structure
|
|
||||||
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
@@ -5,12 +5,12 @@
|
|||||||
* @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek
|
* @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek
|
||||||
/.github/workflows @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @ijjk
|
/.github/workflows @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @ijjk
|
||||||
/packages/fs-detectors @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @agadzik @chloetedder
|
/packages/fs-detectors @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @agadzik @chloetedder
|
||||||
/packages/next @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @ijjk
|
/packages/next @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @ijjk @ztanner
|
||||||
/packages/routing-utils @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @ijjk
|
/packages/routing-utils @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @trek @ijjk
|
||||||
/packages/edge @vercel/compute
|
/packages/edge @vercel/compute
|
||||||
/examples @leerob
|
/examples @leerob
|
||||||
/examples/create-react-app @Timer
|
/examples/create-react-app @Timer
|
||||||
/examples/nextjs @timneutkens @ijjk @styfle
|
/examples/nextjs @timneutkens @ijjk @styfle @ztanner
|
||||||
/examples/hugo @styfle
|
/examples/hugo @styfle
|
||||||
/examples/jekyll @styfle
|
/examples/jekyll @styfle
|
||||||
/examples/zola @styfle
|
/examples/zola @styfle
|
||||||
|
|||||||
7
examples/CHANGELOG.md
vendored
Normal file
7
examples/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# examples
|
||||||
|
|
||||||
|
## null
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- update examples to use at least node@16 ([#10395](https://github.com/vercel/vercel/pull/10395))
|
||||||
@@ -3,9 +3,10 @@
|
|||||||
This directory is a brief example of an [Astro](https://astro.build/) site that can be deployed to Vercel with zero configuration. This demo showcases:
|
This directory is a brief example of an [Astro](https://astro.build/) site that can be deployed to Vercel with zero configuration. This demo showcases:
|
||||||
|
|
||||||
- `/` - A static page (pre-rendered)
|
- `/` - A static page (pre-rendered)
|
||||||
- `/ssr` - A page that uses server-side rendering (through Vercel Edge Functions)
|
- `/ssr` - A page that uses server-side rendering (through [Vercel Edge Functions](https://vercel.com/docs/functions/edge-functions))
|
||||||
- `/ssr-with-swr-caching` - Similar to the previous page, but also caches the response on the Vercel Edge Network using `cache-control` headers
|
- `/ssr-with-swr-caching` - Similar to the previous page, but also caches the response on the [Vercel Edge Network](https://vercel.com/docs/edge-network/overview) using `cache-control` headers
|
||||||
- `/edge.json` - An Astro API Endpoint that returns JSON data using Vercel Edge Functions
|
- `/image` - Astro [Asset](https://docs.astro.build/en/guides/assets/) using Vercel [Image Optimization](https://vercel.com/docs/image-optimization)
|
||||||
|
- `/edge.json` - An Astro API Endpoint that returns JSON data using [Vercel Edge Functions](https://vercel.com/docs/functions/edge-functions)
|
||||||
|
|
||||||
Learn more about [Astro on Vercel](https://vercel.com/docs/frameworks/astro).
|
Learn more about [Astro on Vercel](https://vercel.com/docs/frameworks/astro).
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
// Use Vercel Edge Functions (Recommended)
|
||||||
import vercel from '@astrojs/vercel/edge';
|
import vercel from '@astrojs/vercel/edge';
|
||||||
|
// Can also use Serverless Functions
|
||||||
|
// import vercel from '@astrojs/vercel/serverless';
|
||||||
|
// Or a completely static build
|
||||||
|
// import vercel from '@astrojs/vercel/static';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
output: 'server',
|
output: 'server',
|
||||||
adapter: vercel(),
|
experimental: {
|
||||||
|
assets: true
|
||||||
|
},
|
||||||
|
adapter: vercel({
|
||||||
|
imageService: true,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/vercel": "3.2.2",
|
"@astrojs/vercel": "3.8.2",
|
||||||
"astro": "^2.2.1",
|
"astro": "^2.10.14",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"web-vitals": "^3.3.1"
|
"web-vitals": "^3.3.1"
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
examples/astro/src/assets/logo.png
Normal file
BIN
examples/astro/src/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
2
examples/astro/src/env.d.ts
vendored
2
examples/astro/src/env.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
/// <reference types="astro/client" />
|
/// <reference types="astro/client-image" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly PUBLIC_VERCEL_ANALYTICS_ID: string;
|
readonly PUBLIC_VERCEL_ANALYTICS_ID: string;
|
||||||
|
|||||||
6
examples/astro/src/pages/image.astro
Normal file
6
examples/astro/src/pages/image.astro
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
import { Image } from 'astro:assets';
|
||||||
|
import astroLogo from '../assets/logo.png';
|
||||||
|
---
|
||||||
|
|
||||||
|
<Image src={astroLogo} alt="Astro Logo" width={50} quality={75} />
|
||||||
3
examples/package.json
vendored
3
examples/package.json
vendored
@@ -10,5 +10,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "27.4.1",
|
"@types/jest": "27.4.1",
|
||||||
"@vercel/frameworks": "2.0.1"
|
"@vercel/frameworks": "2.0.1"
|
||||||
}
|
},
|
||||||
|
"version": null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "node ../../utils/build.mjs",
|
||||||
"build:js": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||||
"test-unit": "pnpm test tests/unit"
|
"test-unit": "pnpm test tests/unit"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
# @vercel-internals/types
|
# @vercel-internals/types
|
||||||
|
|
||||||
|
## 1.0.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
|
||||||
|
- @vercel/build-utils@7.2.0
|
||||||
|
|
||||||
|
## 1.0.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`5609a1187`](https://github.com/vercel/vercel/commit/5609a1187be9d6cf8d5f16825690c5ea72f17dc5), [`1b4de4a98`](https://github.com/vercel/vercel/commit/1b4de4a986f7a612aac834ebae3ec7bb9e9b8cf8)]:
|
||||||
|
- @vercel/build-utils@7.1.1
|
||||||
|
|
||||||
## 1.0.8
|
## 1.0.8
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "@vercel-internals/types",
|
"name": "@vercel-internals/types",
|
||||||
"version": "1.0.8",
|
"version": "1.0.10",
|
||||||
"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.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/routing-utils": "3.0.0"
|
"@vercel/routing-utils": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
"lint-staged": "9.2.5",
|
"lint-staged": "9.2.5",
|
||||||
"node-fetch": "2.6.7",
|
"node-fetch": "2.6.7",
|
||||||
"npm-package-arg": "6.1.0",
|
"npm-package-arg": "6.1.0",
|
||||||
"npm-run-all": "4.1.5",
|
|
||||||
"prettier": "2.6.2",
|
"prettier": "2.6.2",
|
||||||
"source-map-support": "0.5.12",
|
"source-map-support": "0.5.12",
|
||||||
"ts-eager": "2.0.2",
|
"ts-eager": "2.0.2",
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
# @vercel/build-utils
|
# @vercel/build-utils
|
||||||
|
|
||||||
|
## 7.2.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- Add new optional prerender field: experimentalStreamingLambdaPath ([#10476](https://github.com/vercel/vercel/pull/10476))
|
||||||
|
|
||||||
|
- [build-utils] Add zero config detection for bun package manager ([#10486](https://github.com/vercel/vercel/pull/10486))
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- add `experimentalBypassFor` field to Prerender ([#10481](https://github.com/vercel/vercel/pull/10481))
|
||||||
|
|
||||||
|
## 7.1.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- add descriptions to NodeVersion properties ([#10403](https://github.com/vercel/vercel/pull/10403))
|
||||||
|
|
||||||
|
- Updated semver dependency ([#10411](https://github.com/vercel/vercel/pull/10411))
|
||||||
|
|
||||||
## 7.1.0
|
## 7.1.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
3
packages/build-utils/build.mjs
Normal file
3
packages/build-utils/build.mjs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { tsc, esbuild } from '../../utils/build.mjs';
|
||||||
|
|
||||||
|
await Promise.all([tsc(), esbuild().then(() => esbuild({ bundle: true }))]);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/build-utils",
|
"name": "@vercel/build-utils",
|
||||||
"version": "7.1.0",
|
"version": "7.2.0",
|
||||||
"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",
|
||||||
@@ -11,11 +11,7 @@
|
|||||||
"directory": "packages/now-build-utils"
|
"directory": "packages/now-build-utils"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:js build:types",
|
"build": "node build.mjs",
|
||||||
"build:js": "run-s build:single build:bundle",
|
|
||||||
"build:single": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:bundle": "node ../../scripts/esbuild.mjs --bundle",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||||
"test-unit": "pnpm test test/unit.*test.*",
|
"test-unit": "pnpm test test/unit.*test.*",
|
||||||
"test-e2e": "pnpm test test/integration.test.ts"
|
"test-e2e": "pnpm test test/integration.test.ts"
|
||||||
@@ -53,7 +49,7 @@
|
|||||||
"minimatch": "3.1.2",
|
"minimatch": "3.1.2",
|
||||||
"multistream": "2.1.1",
|
"multistream": "2.1.1",
|
||||||
"node-fetch": "2.6.7",
|
"node-fetch": "2.6.7",
|
||||||
"semver": "6.1.1",
|
"semver": "6.3.1",
|
||||||
"typescript": "4.9.5",
|
"typescript": "4.9.5",
|
||||||
"yazl": "2.5.1"
|
"yazl": "2.5.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { cloneEnv } from '../clone-env';
|
|||||||
// Only allow one `runNpmInstall()` invocation to run concurrently
|
// Only allow one `runNpmInstall()` invocation to run concurrently
|
||||||
const runNpmInstallSema = new Sema(1);
|
const runNpmInstallSema = new Sema(1);
|
||||||
|
|
||||||
export type CliType = 'yarn' | 'npm' | 'pnpm';
|
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun';
|
||||||
|
|
||||||
export interface ScanParentDirsResult {
|
export interface ScanParentDirsResult {
|
||||||
/**
|
/**
|
||||||
@@ -284,16 +284,23 @@ export async function scanParentDirs(
|
|||||||
readPackageJson && pkgJsonPath
|
readPackageJson && pkgJsonPath
|
||||||
? JSON.parse(await fs.readFile(pkgJsonPath, 'utf8'))
|
? JSON.parse(await fs.readFile(pkgJsonPath, 'utf8'))
|
||||||
: undefined;
|
: undefined;
|
||||||
const [yarnLockPath, npmLockPath, pnpmLockPath] = await walkParentDirsMulti({
|
const [yarnLockPath, npmLockPath, pnpmLockPath, bunLockPath] =
|
||||||
|
await walkParentDirsMulti({
|
||||||
base: '/',
|
base: '/',
|
||||||
start: destPath,
|
start: destPath,
|
||||||
filenames: ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml'],
|
filenames: [
|
||||||
|
'yarn.lock',
|
||||||
|
'package-lock.json',
|
||||||
|
'pnpm-lock.yaml',
|
||||||
|
'bun.lockb',
|
||||||
|
],
|
||||||
});
|
});
|
||||||
let lockfilePath: string | undefined;
|
let lockfilePath: string | undefined;
|
||||||
let lockfileVersion: number | undefined;
|
let lockfileVersion: number | undefined;
|
||||||
let cliType: CliType = 'yarn';
|
let cliType: CliType = 'yarn';
|
||||||
|
|
||||||
const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
|
const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLockBin] =
|
||||||
|
await Promise.all([
|
||||||
Boolean(yarnLockPath),
|
Boolean(yarnLockPath),
|
||||||
npmLockPath
|
npmLockPath
|
||||||
? readConfigFile<{ lockfileVersion: number }>(npmLockPath)
|
? readConfigFile<{ lockfileVersion: number }>(npmLockPath)
|
||||||
@@ -301,9 +308,10 @@ export async function scanParentDirs(
|
|||||||
pnpmLockPath
|
pnpmLockPath
|
||||||
? readConfigFile<{ lockfileVersion: number }>(pnpmLockPath)
|
? readConfigFile<{ lockfileVersion: number }>(pnpmLockPath)
|
||||||
: null,
|
: null,
|
||||||
|
bunLockPath ? fs.readFile(bunLockPath, 'utf8') : null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Priority order is Yarn > pnpm > npm
|
// Priority order is Yarn > pnpm > npm > bun
|
||||||
if (hasYarnLock) {
|
if (hasYarnLock) {
|
||||||
cliType = 'yarn';
|
cliType = 'yarn';
|
||||||
lockfilePath = yarnLockPath;
|
lockfilePath = yarnLockPath;
|
||||||
@@ -315,6 +323,11 @@ export async function scanParentDirs(
|
|||||||
cliType = 'npm';
|
cliType = 'npm';
|
||||||
lockfilePath = npmLockPath;
|
lockfilePath = npmLockPath;
|
||||||
lockfileVersion = packageLockJson.lockfileVersion;
|
lockfileVersion = packageLockJson.lockfileVersion;
|
||||||
|
} else if (bunLockBin) {
|
||||||
|
cliType = 'bun';
|
||||||
|
lockfilePath = bunLockPath;
|
||||||
|
// TODO: read "bun-lockfile-format-v0"
|
||||||
|
lockfileVersion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const packageJsonPath = pkgJsonPath || undefined;
|
const packageJsonPath = pkgJsonPath || undefined;
|
||||||
@@ -451,6 +464,10 @@ export async function runNpmInstall(
|
|||||||
commandArgs = args
|
commandArgs = args
|
||||||
.filter(a => a !== '--prefer-offline')
|
.filter(a => a !== '--prefer-offline')
|
||||||
.concat(['install', '--unsafe-perm']);
|
.concat(['install', '--unsafe-perm']);
|
||||||
|
} else if (cliType === 'bun') {
|
||||||
|
// @see options https://bun.sh/docs/cli/install
|
||||||
|
opts.prettyCommand = 'bun install';
|
||||||
|
commandArgs = ['install', ...args];
|
||||||
} else {
|
} else {
|
||||||
opts.prettyCommand = 'yarn install';
|
opts.prettyCommand = 'yarn install';
|
||||||
commandArgs = ['install', ...args];
|
commandArgs = ['install', ...args];
|
||||||
@@ -505,6 +522,7 @@ export function getEnvForPackageManager({
|
|||||||
const npm7 = '/node16/bin-npm7';
|
const npm7 = '/node16/bin-npm7';
|
||||||
const pnpm7 = '/pnpm7/node_modules/.bin';
|
const pnpm7 = '/pnpm7/node_modules/.bin';
|
||||||
const pnpm8 = '/pnpm8/node_modules/.bin';
|
const pnpm8 = '/pnpm8/node_modules/.bin';
|
||||||
|
const bun1 = '/bun1';
|
||||||
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
||||||
if (cliType === 'npm') {
|
if (cliType === 'npm') {
|
||||||
if (
|
if (
|
||||||
@@ -516,7 +534,7 @@ export function getEnvForPackageManager({
|
|||||||
) {
|
) {
|
||||||
// Ensure that npm 7 is at the beginning of the `$PATH`
|
// Ensure that npm 7 is at the beginning of the `$PATH`
|
||||||
newEnv.PATH = `${npm7}${path.delimiter}${oldPath}`;
|
newEnv.PATH = `${npm7}${path.delimiter}${oldPath}`;
|
||||||
console.log('Detected `package-lock.json` generated by npm 7+...');
|
console.log('Detected `package-lock.json` generated by npm 7+');
|
||||||
}
|
}
|
||||||
} else if (cliType === 'pnpm') {
|
} else if (cliType === 'pnpm') {
|
||||||
if (
|
if (
|
||||||
@@ -528,7 +546,7 @@ export function getEnvForPackageManager({
|
|||||||
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
||||||
newEnv.PATH = `${pnpm7}${path.delimiter}${oldPath}`;
|
newEnv.PATH = `${pnpm7}${path.delimiter}${oldPath}`;
|
||||||
console.log(
|
console.log(
|
||||||
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7...`
|
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7`
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (
|
||||||
typeof lockfileVersion === 'number' &&
|
typeof lockfileVersion === 'number' &&
|
||||||
@@ -539,7 +557,16 @@ export function getEnvForPackageManager({
|
|||||||
// Ensure that pnpm 8 is at the beginning of the `$PATH`
|
// Ensure that pnpm 8 is at the beginning of the `$PATH`
|
||||||
newEnv.PATH = `${pnpm8}${path.delimiter}${oldPath}`;
|
newEnv.PATH = `${pnpm8}${path.delimiter}${oldPath}`;
|
||||||
console.log(
|
console.log(
|
||||||
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8...`
|
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (cliType === 'bun') {
|
||||||
|
if (!oldPath.includes(bun1) && !corepackEnabled) {
|
||||||
|
// Ensure that Bun 1 is at the beginning of the `$PATH`
|
||||||
|
newEnv.PATH = `${bun1}${path.delimiter}${oldPath}`;
|
||||||
|
console.log('Detected `bun.lockb` generated by Bun');
|
||||||
|
console.warn(
|
||||||
|
'Warning: Bun is used as a package manager at build time only, not at runtime with Functions'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -548,7 +575,6 @@ export function getEnvForPackageManager({
|
|||||||
newEnv.YARN_NODE_LINKER = 'node-modules';
|
newEnv.YARN_NODE_LINKER = 'node-modules';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newEnv;
|
return newEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,6 +640,8 @@ export async function runPackageJsonScript(
|
|||||||
opts.prettyCommand = `npm run ${scriptName}`;
|
opts.prettyCommand = `npm run ${scriptName}`;
|
||||||
} else if (cliType === 'pnpm') {
|
} else if (cliType === 'pnpm') {
|
||||||
opts.prettyCommand = `pnpm run ${scriptName}`;
|
opts.prettyCommand = `pnpm run ${scriptName}`;
|
||||||
|
} else if (cliType === 'bun') {
|
||||||
|
opts.prettyCommand = `bun run ${scriptName}`;
|
||||||
} else {
|
} else {
|
||||||
opts.prettyCommand = `yarn run ${scriptName}`;
|
opts.prettyCommand = `yarn run ${scriptName}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { File } from './types';
|
import type { File, HasField } from './types';
|
||||||
import { Lambda } from './lambda';
|
import { Lambda } from './lambda';
|
||||||
|
|
||||||
interface PrerenderOptions {
|
interface PrerenderOptions {
|
||||||
@@ -12,6 +12,8 @@ interface PrerenderOptions {
|
|||||||
initialStatus?: number;
|
initialStatus?: number;
|
||||||
passQuery?: boolean;
|
passQuery?: boolean;
|
||||||
sourcePath?: string;
|
sourcePath?: string;
|
||||||
|
experimentalBypassFor?: HasField;
|
||||||
|
experimentalStreamingLambdaPath?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Prerender {
|
export class Prerender {
|
||||||
@@ -26,6 +28,8 @@ export class Prerender {
|
|||||||
public initialStatus?: number;
|
public initialStatus?: number;
|
||||||
public passQuery?: boolean;
|
public passQuery?: boolean;
|
||||||
public sourcePath?: string;
|
public sourcePath?: string;
|
||||||
|
public experimentalBypassFor?: HasField;
|
||||||
|
public experimentalStreamingLambdaPath?: string;
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
expiration,
|
expiration,
|
||||||
@@ -38,6 +42,8 @@ export class Prerender {
|
|||||||
initialStatus,
|
initialStatus,
|
||||||
passQuery,
|
passQuery,
|
||||||
sourcePath,
|
sourcePath,
|
||||||
|
experimentalBypassFor,
|
||||||
|
experimentalStreamingLambdaPath,
|
||||||
}: PrerenderOptions) {
|
}: PrerenderOptions) {
|
||||||
this.type = 'Prerender';
|
this.type = 'Prerender';
|
||||||
this.expiration = expiration;
|
this.expiration = expiration;
|
||||||
@@ -86,6 +92,26 @@ export class Prerender {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (experimentalBypassFor !== undefined) {
|
||||||
|
if (
|
||||||
|
!Array.isArray(experimentalBypassFor) ||
|
||||||
|
experimentalBypassFor.some(
|
||||||
|
field =>
|
||||||
|
typeof field !== 'object' ||
|
||||||
|
// host doesn't need a key
|
||||||
|
(field.type !== 'host' && typeof field.key !== 'string') ||
|
||||||
|
typeof field.type !== 'string' ||
|
||||||
|
(field.value !== undefined && typeof field.value !== 'string')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
'The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.experimentalBypassFor = experimentalBypassFor;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof fallback === 'undefined') {
|
if (typeof fallback === 'undefined') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null.'
|
'The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null.'
|
||||||
@@ -130,5 +156,14 @@ export class Prerender {
|
|||||||
}
|
}
|
||||||
this.allowQuery = allowQuery;
|
this.allowQuery = allowQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (experimentalStreamingLambdaPath !== undefined) {
|
||||||
|
if (typeof experimentalStreamingLambdaPath !== 'string') {
|
||||||
|
throw new Error(
|
||||||
|
'The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,18 @@ export interface Config {
|
|||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type HasField = Array<
|
||||||
|
| {
|
||||||
|
type: 'host';
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: 'header' | 'cookie' | 'query';
|
||||||
|
key: string;
|
||||||
|
value?: string;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
|
||||||
export interface Meta {
|
export interface Meta {
|
||||||
isDev?: boolean;
|
isDev?: boolean;
|
||||||
devCacheDir?: string;
|
devCacheDir?: string;
|
||||||
|
|||||||
2
packages/build-utils/test/fixtures/30-bun-v1/.gitignore
vendored
Normal file
2
packages/build-utils/test/fixtures/30-bun-v1/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.vercel
|
||||||
|
public
|
||||||
8
packages/build-utils/test/fixtures/30-bun-v1/build.js
vendored
Normal file
8
packages/build-utils/test/fixtures/30-bun-v1/build.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { mkdir, rm, writeFile } from 'node:fs/promises'
|
||||||
|
import { say } from 'cowsay'
|
||||||
|
|
||||||
|
const text = say({ text: `bun version: ${process.versions.bun}` })
|
||||||
|
const content = say({ text })
|
||||||
|
await rm('./public', { recursive: true, force: true })
|
||||||
|
await mkdir('./public', { recursive: true })
|
||||||
|
await writeFile('./public/index.txt', content)
|
||||||
BIN
packages/build-utils/test/fixtures/30-bun-v1/bun.lockb
vendored
Executable file
BIN
packages/build-utils/test/fixtures/30-bun-v1/bun.lockb
vendored
Executable file
Binary file not shown.
9
packages/build-utils/test/fixtures/30-bun-v1/package.json
vendored
Normal file
9
packages/build-utils/test/fixtures/30-bun-v1/package.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "bun build.js"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cowsay": "1.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
8
packages/build-utils/test/fixtures/30-bun-v1/probes.json
vendored
Normal file
8
packages/build-utils/test/fixtures/30-bun-v1/probes.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"probes": [
|
||||||
|
{
|
||||||
|
"path": "/",
|
||||||
|
"mustContain": "bun version: 1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -133,6 +133,22 @@ describe('Test `getEnvForPackageManager()`', () => {
|
|||||||
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
|
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'should set path if bun v1 is detected',
|
||||||
|
args: {
|
||||||
|
cliType: 'bun',
|
||||||
|
nodeVersion: { major: 18, range: '18.x', runtime: 'nodejs18.x' },
|
||||||
|
lockfileVersion: 0,
|
||||||
|
env: {
|
||||||
|
FOO: 'bar',
|
||||||
|
PATH: '/usr/local/bin',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: {
|
||||||
|
FOO: 'bar',
|
||||||
|
PATH: `/bun1${delimiter}/usr/local/bin`,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'should not set pnpm path if corepack is enabled',
|
name: 'should not set pnpm path if corepack is enabled',
|
||||||
args: {
|
args: {
|
||||||
|
|||||||
109
packages/build-utils/test/unit.test.ts
vendored
109
packages/build-utils/test/unit.test.ts
vendored
@@ -344,6 +344,70 @@ it('should support initialHeaders and initialStatus correctly', async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support experimentalBypassFor correctly', async () => {
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
experimentalBypassFor: [{ type: 'header', key: 'Next-Action' }],
|
||||||
|
});
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
experimentalBypassFor: [
|
||||||
|
{ type: 'header', key: 'Next-Action' },
|
||||||
|
{
|
||||||
|
type: 'cookie',
|
||||||
|
key: '__prerender_bypass',
|
||||||
|
value: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
experimentalBypassFor: [{ type: 'query', key: 'bypass', value: '1' }],
|
||||||
|
});
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
experimentalBypassFor: [{ type: 'host', value: 'vercel.com' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
// @ts-expect-error: testing invalid args
|
||||||
|
experimentalBypassFor: 'foo',
|
||||||
|
});
|
||||||
|
}).toThrowError(
|
||||||
|
'The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`.'
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
// @ts-expect-error: testing invalid args
|
||||||
|
experimentalBypassFor: [{ type: 'header', value: { foo: 'bar' } }],
|
||||||
|
});
|
||||||
|
}).toThrowError(
|
||||||
|
'The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should support passQuery correctly', async () => {
|
it('should support passQuery correctly', async () => {
|
||||||
new Prerender({
|
new Prerender({
|
||||||
expiration: 1,
|
expiration: 1,
|
||||||
@@ -387,6 +451,42 @@ it('should support passQuery correctly', async () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support experimentalStreamingLambdaPath correctly', async () => {
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
experimentalStreamingLambdaPath: undefined,
|
||||||
|
});
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
experimentalStreamingLambdaPath: '/some/path/to/lambda',
|
||||||
|
});
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new Prerender({
|
||||||
|
expiration: 1,
|
||||||
|
fallback: null,
|
||||||
|
group: 1,
|
||||||
|
bypassToken: 'some-long-bypass-token-to-make-it-work',
|
||||||
|
// @ts-expect-error testing invalid field
|
||||||
|
experimentalStreamingLambdaPath: 1,
|
||||||
|
});
|
||||||
|
}).toThrowError(
|
||||||
|
`The \`experimentalStreamingLambdaPath\` argument for \`Prerender\` must be a string.`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should support require by path for legacy builders', () => {
|
it('should support require by path for legacy builders', () => {
|
||||||
const index = require('../');
|
const index = require('../');
|
||||||
|
|
||||||
@@ -440,6 +540,15 @@ it(
|
|||||||
ms('1m')
|
ms('1m')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it('should return cliType bun and correct lock file for bun v1', async () => {
|
||||||
|
const fixture = path.join(__dirname, 'fixtures', '30-bun-v1');
|
||||||
|
const result = await scanParentDirs(fixture);
|
||||||
|
expect(result.cliType).toEqual('bun');
|
||||||
|
expect(result.lockfileVersion).toEqual(0);
|
||||||
|
expect(result.lockfilePath).toEqual(path.join(fixture, 'bun.lockb'));
|
||||||
|
expect(result.packageJsonPath).toEqual(path.join(fixture, 'package.json'));
|
||||||
|
});
|
||||||
|
|
||||||
it('should return lockfileVersion 2 with npm7', async () => {
|
it('should return lockfileVersion 2 with npm7', async () => {
|
||||||
const fixture = path.join(__dirname, 'fixtures', '20-npm-7');
|
const fixture = path.join(__dirname, 'fixtures', '20-npm-7');
|
||||||
const result = await scanParentDirs(fixture);
|
const result = await scanParentDirs(fixture);
|
||||||
|
|||||||
@@ -1,5 +1,72 @@
|
|||||||
# vercel
|
# vercel
|
||||||
|
|
||||||
|
## 32.2.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Update @vercel/fun@1.1.0 ([#10477](https://github.com/vercel/vercel/pull/10477))
|
||||||
|
|
||||||
|
- [node] upgrade edge-runtime ([#10451](https://github.com/vercel/vercel/pull/10451))
|
||||||
|
|
||||||
|
- Updated dependencies [[`6784e7751`](https://github.com/vercel/vercel/commit/6784e77516ba180a691e3c48323b32bb4506d7b6), [`a8ad17626`](https://github.com/vercel/vercel/commit/a8ad176262ef822860ce338927e6f959961d2d32), [`0ee089a50`](https://github.com/vercel/vercel/commit/0ee089a501ebb78901c4afe1658e794917998f8f), [`f15cba614`](https://github.com/vercel/vercel/commit/f15cba6148a0cdb6975db7724775c35ab7d929b2), [`b265e13d4`](https://github.com/vercel/vercel/commit/b265e13d40d541b77148fa79ac60b4c4dd10974c), [`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`a732d30c8`](https://github.com/vercel/vercel/commit/a732d30c8409f96f59ea5406e974a6c4186cc130), [`9d64312aa`](https://github.com/vercel/vercel/commit/9d64312aaaa875a4e193b7602c50e5dc68979aad), [`6baefc825`](https://github.com/vercel/vercel/commit/6baefc825ad7cfc3a5edce31cb4244721452f753), [`989f0d813`](https://github.com/vercel/vercel/commit/989f0d813910d8d67ed355de93018f1dcd91b6ba), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
|
||||||
|
- @vercel/go@3.0.1
|
||||||
|
- @vercel/redwood@2.0.2
|
||||||
|
- @vercel/remix-builder@2.0.4
|
||||||
|
- @vercel/hydrogen@1.0.1
|
||||||
|
- @vercel/static-build@2.0.5
|
||||||
|
- @vercel/build-utils@7.2.0
|
||||||
|
- @vercel/next@4.0.3
|
||||||
|
- @vercel/node@3.0.5
|
||||||
|
- @vercel/python@4.0.1
|
||||||
|
- @vercel/ruby@2.0.2
|
||||||
|
|
||||||
|
## 32.2.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- show instant preview url on deploy ([#10458](https://github.com/vercel/vercel/pull/10458))
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- N, not n. ([#10460](https://github.com/vercel/vercel/pull/10460))
|
||||||
|
|
||||||
|
- Fix team URL on `vercel help switch` ([#10466](https://github.com/vercel/vercel/pull/10466))
|
||||||
|
|
||||||
|
- Migrates the vc env command to the command data structure for use in the help output. ([#10429](https://github.com/vercel/vercel/pull/10429))
|
||||||
|
|
||||||
|
- Update domains command to new structure ([#10427](https://github.com/vercel/vercel/pull/10427))
|
||||||
|
|
||||||
|
- Updated semver dependency ([#10411](https://github.com/vercel/vercel/pull/10411))
|
||||||
|
|
||||||
|
- migrate `rollback` command structure for help output ([#10426](https://github.com/vercel/vercel/pull/10426))
|
||||||
|
|
||||||
|
- migrate `inti` command structure for help output ([#10428](https://github.com/vercel/vercel/pull/10428))
|
||||||
|
|
||||||
|
- Remove mri workaround ([#10452](https://github.com/vercel/vercel/pull/10452))
|
||||||
|
|
||||||
|
- migrate dev command structure for help output ([#10433](https://github.com/vercel/vercel/pull/10433))
|
||||||
|
|
||||||
|
- Update secrets to more recent structure ([#10461](https://github.com/vercel/vercel/pull/10461))
|
||||||
|
|
||||||
|
- Migrate `vc secrets` to new help command structure ([#10435](https://github.com/vercel/vercel/pull/10435))
|
||||||
|
|
||||||
|
- migrate `promote` command structure for help output ([#10425](https://github.com/vercel/vercel/pull/10425))
|
||||||
|
|
||||||
|
- migrate `git` command structure for help output ([#10431](https://github.com/vercel/vercel/pull/10431))
|
||||||
|
|
||||||
|
- Update project command to new data structure ([#10432](https://github.com/vercel/vercel/pull/10432))
|
||||||
|
|
||||||
|
- migrate teams command ([#10434](https://github.com/vercel/vercel/pull/10434))
|
||||||
|
|
||||||
|
- Updated dependencies [[`5609a1187`](https://github.com/vercel/vercel/commit/5609a1187be9d6cf8d5f16825690c5ea72f17dc5), [`caaba0d68`](https://github.com/vercel/vercel/commit/caaba0d6855eff4350b6a04acc3ea502025bff8f), [`1b4de4a98`](https://github.com/vercel/vercel/commit/1b4de4a986f7a612aac834ebae3ec7bb9e9b8cf8), [`c3c54d6e6`](https://github.com/vercel/vercel/commit/c3c54d6e695ec078777c4b1f4f23acbeee3c3b09), [`6aa0aa4e6`](https://github.com/vercel/vercel/commit/6aa0aa4e65b81903f4fce677a198dcfaebee744b), [`e43191b18`](https://github.com/vercel/vercel/commit/e43191b1866da70a3dab3815a3f2176942240ef3), [`fc1e13c09`](https://github.com/vercel/vercel/commit/fc1e13c09928c654410b373fc1775c2b63c6ef4a)]:
|
||||||
|
- @vercel/build-utils@7.1.1
|
||||||
|
- @vercel/next@4.0.2
|
||||||
|
- @vercel/static-build@2.0.4
|
||||||
|
- @vercel/redwood@2.0.1
|
||||||
|
- @vercel/remix-builder@2.0.3
|
||||||
|
- @vercel/ruby@2.0.1
|
||||||
|
- @vercel/node@3.0.4
|
||||||
|
|
||||||
## 32.1.0
|
## 32.1.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vercel",
|
"name": "vercel",
|
||||||
"version": "32.1.0",
|
"version": "32.2.1",
|
||||||
"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,20 +31,20 @@
|
|||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "7.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/go": "3.0.0",
|
"@vercel/go": "3.0.1",
|
||||||
"@vercel/hydrogen": "1.0.0",
|
"@vercel/hydrogen": "1.0.1",
|
||||||
"@vercel/next": "4.0.1",
|
"@vercel/next": "4.0.3",
|
||||||
"@vercel/node": "3.0.3",
|
"@vercel/node": "3.0.5",
|
||||||
"@vercel/python": "4.0.0",
|
"@vercel/python": "4.0.1",
|
||||||
"@vercel/redwood": "2.0.0",
|
"@vercel/redwood": "2.0.2",
|
||||||
"@vercel/remix-builder": "2.0.2",
|
"@vercel/remix-builder": "2.0.4",
|
||||||
"@vercel/ruby": "2.0.0",
|
"@vercel/ruby": "2.0.2",
|
||||||
"@vercel/static-build": "2.0.3"
|
"@vercel/static-build": "2.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alex_neo/jest-expect-message": "1.0.5",
|
"@alex_neo/jest-expect-message": "1.0.5",
|
||||||
"@edge-runtime/node-utils": "2.2.0",
|
"@edge-runtime/node-utils": "2.2.1",
|
||||||
"@next/env": "11.1.2",
|
"@next/env": "11.1.2",
|
||||||
"@sentry/node": "5.5.0",
|
"@sentry/node": "5.5.0",
|
||||||
"@sindresorhus/slugify": "0.11.0",
|
"@sindresorhus/slugify": "0.11.0",
|
||||||
@@ -86,12 +86,12 @@
|
|||||||
"@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.8",
|
"@vercel-internals/types": "1.0.10",
|
||||||
"@vercel/client": "13.0.1",
|
"@vercel/client": "13.0.3",
|
||||||
"@vercel/error-utils": "2.0.1",
|
"@vercel/error-utils": "2.0.1",
|
||||||
"@vercel/frameworks": "2.0.1",
|
"@vercel/frameworks": "2.0.1",
|
||||||
"@vercel/fs-detectors": "5.0.1",
|
"@vercel/fs-detectors": "5.0.2",
|
||||||
"@vercel/fun": "1.0.4",
|
"@vercel/fun": "1.1.0",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"@vercel/routing-utils": "3.0.0",
|
"@vercel/routing-utils": "3.0.0",
|
||||||
"@zeit/source-map-support": "0.6.2",
|
"@zeit/source-map-support": "0.6.2",
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
"qr-image": "3.2.0",
|
"qr-image": "3.2.0",
|
||||||
"raw-body": "2.4.1",
|
"raw-body": "2.4.1",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"semver": "5.5.0",
|
"semver": "5.7.2",
|
||||||
"serve-handler": "6.1.1",
|
"serve-handler": "6.1.1",
|
||||||
"strip-ansi": "6.0.1",
|
"strip-ansi": "6.0.1",
|
||||||
"supports-hyperlinks": "3.0.0",
|
"supports-hyperlinks": "3.0.0",
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export const projectCommand: Command = {
|
|||||||
name: 'next',
|
name: 'next',
|
||||||
description: 'Show next page of results',
|
description: 'Show next page of results',
|
||||||
argument: 'MS',
|
argument: 'MS',
|
||||||
shorthand: 'n',
|
shorthand: 'N',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
deprecated: false,
|
deprecated: false,
|
||||||
multi: false,
|
multi: false,
|
||||||
|
|||||||
@@ -76,12 +76,23 @@ export default async function redeploy(client: Client): Promise<number> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
output.stopSpinner();
|
output.stopSpinner();
|
||||||
|
|
||||||
|
const isProdDeployment = deployment.target === 'production';
|
||||||
|
const previewUrl = `https://${deployment.url}`;
|
||||||
output.print(
|
output.print(
|
||||||
`${prependEmoji(
|
`${prependEmoji(
|
||||||
`Inspect: ${chalk.bold(deployment.inspectorUrl)} ${deployStamp()}`,
|
`Inspect: ${chalk.bold(deployment.inspectorUrl)} ${deployStamp()}`,
|
||||||
emoji('inspect')
|
emoji('inspect')
|
||||||
)}\n`
|
)}\n`
|
||||||
);
|
);
|
||||||
|
output.print(
|
||||||
|
prependEmoji(
|
||||||
|
`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk.bold(
|
||||||
|
previewUrl
|
||||||
|
)} ${deployStamp()}`,
|
||||||
|
emoji('success')
|
||||||
|
) + `\n`
|
||||||
|
);
|
||||||
|
|
||||||
if (!client.stdout.isTTY) {
|
if (!client.stdout.isTTY) {
|
||||||
client.stdout.write(`https://${deployment.url}`);
|
client.stdout.write(`https://${deployment.url}`);
|
||||||
|
|||||||
96
packages/cli/src/commands/secrets/command.js
Normal file
96
packages/cli/src/commands/secrets/command.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import { packageName, getCommandName } from '../../util/pkg-name';
|
||||||
|
|
||||||
|
export const secretsCommand = {
|
||||||
|
name: 'secrets',
|
||||||
|
description: `NOTE: The ${getCommandName(
|
||||||
|
'env'
|
||||||
|
)} command is recommended instead of ${getCommandName('secrets')}`,
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'command',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
subcommands: [
|
||||||
|
{
|
||||||
|
name: 'ls',
|
||||||
|
description: 'Show all secrets in a list',
|
||||||
|
arguments: [],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'add',
|
||||||
|
description: 'Add a new secret',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'value',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rename',
|
||||||
|
description: 'Change the name of a secret',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'old-name',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'new-name',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rm',
|
||||||
|
description: 'Remove a secret',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'next',
|
||||||
|
description: 'Show next page of results',
|
||||||
|
argument: 'MS',
|
||||||
|
shorthand: 'n',
|
||||||
|
type: 'string',
|
||||||
|
deprecated: false,
|
||||||
|
multi: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
name: 'Add a new secret',
|
||||||
|
value: `${packageName} secrets add my-secret "my value"
|
||||||
|
|
||||||
|
- Once added, a secret's value can't be retrieved in plain text anymore
|
||||||
|
- If the secret's value is more than one word, wrap it in quotes
|
||||||
|
- When in doubt, always wrap your value in quotes`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Expose a secret as an environment variable (notice the `@` symbol)',
|
||||||
|
value: `${packageName} -e MY_SECRET=@my-secret`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Paginate results, where 1584722256178 is the time in milliseconds since the UNIX epoch',
|
||||||
|
value: `$ ${packageName} secrets ls --next 1584722256178`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,111 +1,17 @@
|
|||||||
|
import isErrnoException from '@vercel/error-utils';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import table from 'text-table';
|
import table from 'text-table';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import strlen from '../util/strlen.ts';
|
import strlen from '../../util/strlen';
|
||||||
import { handleError, error } from '../util/error';
|
import { handleError, error } from '../../util/error';
|
||||||
import NowSecrets from '../util/secrets';
|
import NowSecrets from '../../util/secrets';
|
||||||
import exit from '../util/exit';
|
import getScope from '../../util/get-scope';
|
||||||
import getScope from '../util/get-scope.ts';
|
import confirm from '../../util/input/confirm';
|
||||||
import confirm from '../util/input/confirm';
|
import getCommandFlags from '../../util/get-command-flags';
|
||||||
import getCommandFlags from '../util/get-command-flags';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
import { packageName, getCommandName } from '../util/pkg-name.ts';
|
import getArgs from '../../util/get-args';
|
||||||
import getArgs from '../util/get-args';
|
import { help } from '../help';
|
||||||
import { help } from './help';
|
import { secretsCommand } from './command';
|
||||||
|
|
||||||
export const secretsCommand = {
|
|
||||||
name: 'secrets',
|
|
||||||
description: `NOTE: The ${getCommandName(
|
|
||||||
'env'
|
|
||||||
)} command is recommended instead of ${getCommandName('secrets')}`,
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'command',
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
subcommands: [
|
|
||||||
{
|
|
||||||
name: 'ls',
|
|
||||||
description: 'Show all secrets in a list',
|
|
||||||
arguments: [],
|
|
||||||
options: [],
|
|
||||||
examples: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'add',
|
|
||||||
description: 'Add a new secret',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'value',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
options: [],
|
|
||||||
examples: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'rename',
|
|
||||||
description: 'Change the name of a secret',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'old-name',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'new-name',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
options: [],
|
|
||||||
examples: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'rm',
|
|
||||||
description: 'Remove a secret',
|
|
||||||
arguments: [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
options: [],
|
|
||||||
examples: [],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'next',
|
|
||||||
description: 'Show next page of results',
|
|
||||||
argument: 'MS',
|
|
||||||
shorthand: 'n',
|
|
||||||
type: 'string',
|
|
||||||
deprecated: false,
|
|
||||||
multi: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
examples: [
|
|
||||||
{
|
|
||||||
name: 'Add a new secret',
|
|
||||||
value: `${packageName} secrets add my-secret "my value"
|
|
||||||
|
|
||||||
- Once added, a secret's value can't be retrieved in plain text anymore
|
|
||||||
- If the secret's value is more than one word, wrap it in quotes
|
|
||||||
- When in doubt, always wrap your value in quotes`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Expose a secret as an environment variable (notice the `@` symbol)',
|
|
||||||
value: `${packageName} -e MY_SECRET=@my-secret`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Paginate results, where 1584722256178 is the time in milliseconds since the UNIX epoch',
|
|
||||||
value: `$ ${packageName} secrets ls --next 1584722256178`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
let argv;
|
let argv;
|
||||||
@@ -130,7 +36,7 @@ const main = async client => {
|
|||||||
client.output.print(
|
client.output.print(
|
||||||
help(secretsCommand, { columns: client.stderr.columns })
|
help(secretsCommand, { columns: client.stderr.columns })
|
||||||
);
|
);
|
||||||
await exit(2);
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -142,10 +48,12 @@ const main = async client => {
|
|||||||
try {
|
try {
|
||||||
({ contextName } = await getScope(client));
|
({ contextName } = await getScope(client));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (isErrnoException(err)) {
|
||||||
if (err.code === 'NOT_AUTHORIZED' || err.code === 'TEAM_DELETED') {
|
if (err.code === 'NOT_AUTHORIZED' || err.code === 'TEAM_DELETED') {
|
||||||
output.error(err.message);
|
output.error(err.message);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -155,7 +63,7 @@ const main = async client => {
|
|||||||
|
|
||||||
export default async client => {
|
export default async client => {
|
||||||
try {
|
try {
|
||||||
await main(client);
|
return await main(client);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
handleError(err);
|
handleError(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@@ -218,7 +126,7 @@ async function run({ output, contextName, currentTeam, client }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (out) {
|
if (out) {
|
||||||
console.log(`\n${out}\n`);
|
client.output.print(`\n${out}\n`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
77
packages/cli/src/commands/teams/command.ts
Normal file
77
packages/cli/src/commands/teams/command.ts
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import { Command } from '../help';
|
||||||
|
import { packageName } from '../../util/pkg-name';
|
||||||
|
|
||||||
|
export const teamsCommand: Command = {
|
||||||
|
name: 'teams',
|
||||||
|
description: 'Manage teams under your Vercel account',
|
||||||
|
arguments: [],
|
||||||
|
subcommands: [
|
||||||
|
{
|
||||||
|
name: 'add',
|
||||||
|
description: 'Create a new team',
|
||||||
|
arguments: [],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ls',
|
||||||
|
description: "Show all teams you're a part of",
|
||||||
|
arguments: [],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'switch',
|
||||||
|
description: 'Switch to a different team',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'invite',
|
||||||
|
description: 'Invite a new member to a team',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'emails',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [],
|
||||||
|
examples: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'next',
|
||||||
|
shorthand: 'N',
|
||||||
|
type: 'string',
|
||||||
|
argument: 'MS',
|
||||||
|
deprecated: false,
|
||||||
|
multi: false,
|
||||||
|
description: 'Show next page of results',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
name: "Switch to a team. If your team's url is 'vercel.com/name', then 'name' is the slug. If the slug is omitted, you can choose interactively.",
|
||||||
|
value: `${packageName} teams switch <slug>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Invite new members (interactively)',
|
||||||
|
value: `${packageName} teams invite`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Invite multiple members simultaneously',
|
||||||
|
value: `${packageName} teams invite abc@vercel.com xyz@vercel.com`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Paginate results, where `1584722256178` is the time in milliseconds since the UNIX epoch.',
|
||||||
|
value: `${packageName} teams ls --next 1584722256178`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -1,63 +1,12 @@
|
|||||||
import chalk from 'chalk';
|
|
||||||
import error from '../../util/output/error';
|
import error from '../../util/output/error';
|
||||||
import list from './list';
|
import list from './list';
|
||||||
import add from './add';
|
import add from './add';
|
||||||
import change from './switch';
|
import change from './switch';
|
||||||
import invite from './invite';
|
import invite from './invite';
|
||||||
import { packageName, logo } from '../../util/pkg-name';
|
|
||||||
import getArgs from '../../util/get-args';
|
import getArgs from '../../util/get-args';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
|
import { teamsCommand } from './command';
|
||||||
const help = () => {
|
import { help } from '../help';
|
||||||
console.log(`
|
|
||||||
${chalk.bold(`${logo} ${packageName} teams`)} [options] <command>
|
|
||||||
|
|
||||||
${chalk.dim('Commands:')}
|
|
||||||
|
|
||||||
add Create a new team
|
|
||||||
ls Show all teams you're a part of
|
|
||||||
switch [name] Switch to a different team
|
|
||||||
invite [email] Invite a new member to a team
|
|
||||||
|
|
||||||
${chalk.dim('Options:')}
|
|
||||||
|
|
||||||
-h, --help Output usage information
|
|
||||||
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
|
||||||
'FILE'
|
|
||||||
)} Path to the local ${'`vercel.json`'} file
|
|
||||||
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
|
||||||
'DIR'
|
|
||||||
)} Path to the global ${'`.vercel`'} directory
|
|
||||||
-d, --debug Debug mode [off]
|
|
||||||
--no-color No color mode [off]
|
|
||||||
-N, --next Show next page of results
|
|
||||||
|
|
||||||
${chalk.dim('Examples:')}
|
|
||||||
|
|
||||||
${chalk.gray('–')} Switch to a team
|
|
||||||
|
|
||||||
${chalk.cyan(`$ ${packageName} switch <slug>`)}
|
|
||||||
|
|
||||||
${chalk.gray(
|
|
||||||
'–'
|
|
||||||
)} If your team's url is 'vercel.com/teams/name', 'name' is the slug
|
|
||||||
${chalk.gray('–')} If the slug is omitted, you can choose interactively
|
|
||||||
|
|
||||||
${chalk.yellow(
|
|
||||||
'NOTE:'
|
|
||||||
)} When you switch, everything you add, list or remove will be scoped that team!
|
|
||||||
|
|
||||||
${chalk.gray('–')} Invite new members (interactively)
|
|
||||||
|
|
||||||
${chalk.cyan(`$ ${packageName} teams invite`)}
|
|
||||||
|
|
||||||
${chalk.gray('–')} Paginate results, where ${chalk.dim(
|
|
||||||
'`1584722256178`'
|
|
||||||
)} is the time in milliseconds since the UNIX epoch.
|
|
||||||
|
|
||||||
${chalk.cyan(`$ ${packageName} teams ls --next 1584722256178`)}
|
|
||||||
`);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default async (client: Client) => {
|
export default async (client: Client) => {
|
||||||
let subcommand;
|
let subcommand;
|
||||||
@@ -74,7 +23,7 @@ export default async (client: Client) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argv['--help'] || !subcommand) {
|
if (argv['--help'] || !subcommand) {
|
||||||
help();
|
client.output.print(help(teamsCommand, { columns: client.stderr.columns }));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +56,9 @@ export default async (client: Client) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
exitCode = 2;
|
exitCode = 2;
|
||||||
help();
|
client.output.print(
|
||||||
|
help(teamsCommand, { columns: client.stderr.columns })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return exitCode;
|
return exitCode;
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
import isWildcardAlias from '../alias/is-wildcard-alias';
|
|
||||||
import { getCertsForCn } from '../certs/get-certs-for-cn';
|
|
||||||
import Client from '../client';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to find the "best" alias url.
|
|
||||||
* @param aliasList
|
|
||||||
*/
|
|
||||||
export async function getPreferredPreviewURL(
|
|
||||||
client: Client,
|
|
||||||
aliasList: string[]
|
|
||||||
) {
|
|
||||||
if (aliasList.length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* First checks for non public aliases and non wildcard domains.
|
|
||||||
*/
|
|
||||||
const preferredAliases = aliasList.filter(
|
|
||||||
alias =>
|
|
||||||
!alias.endsWith('.now.sh') &&
|
|
||||||
!alias.endsWith('.vercel.app') &&
|
|
||||||
!isWildcardAlias(alias)
|
|
||||||
);
|
|
||||||
for (const alias of preferredAliases) {
|
|
||||||
const certs = await getCertsForCn(client, alias, { limit: 1 }).catch(() => {
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
if (certs && certs.length > 0) {
|
|
||||||
return { previewUrl: `https://${alias}`, isWildcard: false };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fallback to first alias
|
|
||||||
*/
|
|
||||||
const [firstAlias] = aliasList;
|
|
||||||
if (isWildcardAlias(firstAlias)) {
|
|
||||||
return { previewUrl: firstAlias, isWildcard: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (firstAlias.endsWith('.vercel.app') || firstAlias.endsWith('.now.sh')) {
|
|
||||||
return { previewUrl: `https://${firstAlias}`, isWildcard: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { previewUrl: `http://${firstAlias}`, isWildcard: false };
|
|
||||||
}
|
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import type Client from '../client';
|
import type Client from '../client';
|
||||||
import type { Deployment } from '@vercel-internals/types';
|
import type { Deployment } from '@vercel-internals/types';
|
||||||
import { getPreferredPreviewURL } from '../../util/deploy/get-preferred-preview-url';
|
|
||||||
import { isDeploying } from '../../util/deploy/is-deploying';
|
import { isDeploying } from '../../util/deploy/is-deploying';
|
||||||
import linkStyle from '../output/link';
|
import linkStyle from '../output/link';
|
||||||
import { prependEmoji, emoji } from '../../util/emoji';
|
import { prependEmoji, emoji } from '../../util/emoji';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints (to `client.output`) warnings and errors, if any.
|
||||||
|
*/
|
||||||
export async function printDeploymentStatus(
|
export async function printDeploymentStatus(
|
||||||
client: Client,
|
client: Client,
|
||||||
{
|
{
|
||||||
readyState,
|
readyState,
|
||||||
alias: aliasList,
|
|
||||||
aliasError,
|
aliasError,
|
||||||
target,
|
|
||||||
indications,
|
indications,
|
||||||
url: deploymentUrl,
|
|
||||||
aliasWarning,
|
aliasWarning,
|
||||||
}: {
|
}: {
|
||||||
readyState: Deployment['readyState'];
|
readyState: Deployment['readyState'];
|
||||||
@@ -36,7 +36,6 @@ export async function printDeploymentStatus(
|
|||||||
const { output } = client;
|
const { output } = client;
|
||||||
|
|
||||||
indications = indications || [];
|
indications = indications || [];
|
||||||
const isProdDeployment = target === 'production';
|
|
||||||
|
|
||||||
let isStillBuilding = false;
|
let isStillBuilding = false;
|
||||||
if (noWait) {
|
if (noWait) {
|
||||||
@@ -64,30 +63,6 @@ export async function printDeploymentStatus(
|
|||||||
aliasError.message ? `: ${aliasError.message}` : ''
|
aliasError.message ? `: ${aliasError.message}` : ''
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
// print preview/production url
|
|
||||||
let previewUrl: string;
|
|
||||||
// if `noWait` is true, then use the deployment url, not an alias
|
|
||||||
if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
|
|
||||||
const previewUrlInfo = await getPreferredPreviewURL(client, aliasList);
|
|
||||||
if (previewUrlInfo) {
|
|
||||||
previewUrl = previewUrlInfo.previewUrl;
|
|
||||||
} else {
|
|
||||||
previewUrl = `https://${deploymentUrl}`;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// fallback to deployment url
|
|
||||||
previewUrl = `https://${deploymentUrl}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
output.print(
|
|
||||||
prependEmoji(
|
|
||||||
`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk.bold(
|
|
||||||
previewUrl
|
|
||||||
)} ${deployStamp()}`,
|
|
||||||
emoji('success')
|
|
||||||
) + `\n`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aliasWarning?.message) {
|
if (aliasWarning?.message) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import { Output } from '../output';
|
import { Output } from '../output';
|
||||||
import { progress } from '../output/progress';
|
import { progress } from '../output/progress';
|
||||||
import Now from '../../util';
|
import Now from '../../util';
|
||||||
import type { Org } from '@vercel-internals/types';
|
import type { Deployment, Org } from '@vercel-internals/types';
|
||||||
import ua from '../ua';
|
import ua from '../ua';
|
||||||
import { linkFolderToProject } from '../projects/link';
|
import { linkFolderToProject } from '../projects/link';
|
||||||
import { prependEmoji, emoji } from '../emoji';
|
import { prependEmoji, emoji } from '../emoji';
|
||||||
@@ -17,9 +17,13 @@ import type { Agent } from 'http';
|
|||||||
|
|
||||||
function printInspectUrl(
|
function printInspectUrl(
|
||||||
output: Output,
|
output: Output,
|
||||||
inspectorUrl: string,
|
inspectorUrl: string | null | undefined,
|
||||||
deployStamp: () => string
|
deployStamp: () => string
|
||||||
) {
|
) {
|
||||||
|
if (!inspectorUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
output.print(
|
output.print(
|
||||||
prependEmoji(
|
prependEmoji(
|
||||||
`Inspect: ${chalk.bold(inspectorUrl)} ${deployStamp()}`,
|
`Inspect: ${chalk.bold(inspectorUrl)} ${deployStamp()}`,
|
||||||
@@ -162,33 +166,47 @@ export default async function processDeployment({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.type === 'created') {
|
if (event.type === 'created') {
|
||||||
|
const deployment: Deployment = event.payload;
|
||||||
|
|
||||||
await linkFolderToProject(
|
await linkFolderToProject(
|
||||||
client,
|
client,
|
||||||
cwd,
|
cwd,
|
||||||
{
|
{
|
||||||
orgId: org.id,
|
orgId: org.id,
|
||||||
projectId: event.payload.projectId,
|
projectId: deployment.projectId!,
|
||||||
},
|
},
|
||||||
projectName,
|
projectName,
|
||||||
org.slug
|
org.slug
|
||||||
);
|
);
|
||||||
|
|
||||||
now.url = event.payload.url;
|
now.url = deployment.url;
|
||||||
|
|
||||||
output.stopSpinner();
|
output.stopSpinner();
|
||||||
|
|
||||||
printInspectUrl(output, event.payload.inspectorUrl, deployStamp);
|
printInspectUrl(output, deployment.inspectorUrl, deployStamp);
|
||||||
|
|
||||||
|
const isProdDeployment = requestBody.target === 'production';
|
||||||
|
const previewUrl = `https://${deployment.url}`;
|
||||||
|
|
||||||
|
output.print(
|
||||||
|
prependEmoji(
|
||||||
|
`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk.bold(
|
||||||
|
previewUrl
|
||||||
|
)} ${deployStamp()}`,
|
||||||
|
emoji('success')
|
||||||
|
) + `\n`
|
||||||
|
);
|
||||||
|
|
||||||
if (quiet) {
|
if (quiet) {
|
||||||
process.stdout.write(`https://${event.payload.url}`);
|
process.stdout.write(`https://${event.payload.url}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noWait) {
|
if (noWait) {
|
||||||
return event.payload;
|
return deployment;
|
||||||
}
|
}
|
||||||
|
|
||||||
output.spinner(
|
output.spinner(
|
||||||
event.payload.readyState === 'QUEUED' ? 'Queued' : 'Building',
|
deployment.readyState === 'QUEUED' ? 'Queued' : 'Building',
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -243,6 +261,7 @@ export default async function processDeployment({
|
|||||||
|
|
||||||
// Handle alias-assigned event
|
// Handle alias-assigned event
|
||||||
if (event.type === 'alias-assigned') {
|
if (event.type === 'alias-assigned') {
|
||||||
|
output.stopSpinner();
|
||||||
event.payload.indications = indications;
|
event.payload.indications = indications;
|
||||||
return event.payload;
|
return event.payload;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
export default (code?: number) =>
|
|
||||||
new Promise(() => {
|
|
||||||
// We give stdout some time to flush out
|
|
||||||
// because there's a node bug where
|
|
||||||
// stdout writes are asynchronous
|
|
||||||
// https://github.com/nodejs/node/issues/6456
|
|
||||||
setTimeout(() => process.exit(code || 0), 100);
|
|
||||||
});
|
|
||||||
6
packages/cli/test/integration-2.test.ts
vendored
6
packages/cli/test/integration-2.test.ts
vendored
@@ -735,6 +735,12 @@ test('deploys with only vercel.json and README.md', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(exitCode, formatOutput({ stdout, stderr })).toBe(0);
|
expect(exitCode, formatOutput({ stdout, stderr })).toBe(0);
|
||||||
|
|
||||||
|
// assert timing order of showing URLs vs status updates
|
||||||
|
expect(stderr).toMatch(
|
||||||
|
/Inspect.*\nPreview.*\nQueued.*\nBuilding.*\nCompleting/
|
||||||
|
);
|
||||||
|
|
||||||
const { host } = new URL(stdout);
|
const { host } = new URL(stdout);
|
||||||
const res = await fetch(`https://${host}/README.md`);
|
const res = await fetch(`https://${host}/README.md`);
|
||||||
const text = await res.text();
|
const text = await res.text();
|
||||||
|
|||||||
29
packages/cli/test/mocks/secrets.ts
Normal file
29
packages/cli/test/mocks/secrets.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import chance from 'chance';
|
||||||
|
import { client } from './client';
|
||||||
|
|
||||||
|
export function useSecrets({
|
||||||
|
name,
|
||||||
|
created,
|
||||||
|
}: {
|
||||||
|
name: string;
|
||||||
|
created: number;
|
||||||
|
}) {
|
||||||
|
const secret = {
|
||||||
|
uid: chance().guid(),
|
||||||
|
name: name || chance().name(),
|
||||||
|
created: created || chance().timestamp(),
|
||||||
|
};
|
||||||
|
|
||||||
|
client.scenario.get('/v3/now/secrets', (_req, res) => {
|
||||||
|
res.json({
|
||||||
|
secrets: [secret],
|
||||||
|
pagination: {
|
||||||
|
count: 1,
|
||||||
|
next: 0,
|
||||||
|
prev: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return secret;
|
||||||
|
}
|
||||||
37
packages/cli/test/unit/commands/secrets.test.ts
Normal file
37
packages/cli/test/unit/commands/secrets.test.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { client } from '../../mocks/client';
|
||||||
|
import secrets from '../../../src/commands/secrets';
|
||||||
|
import { useSecrets } from '../../mocks/secrets';
|
||||||
|
import { useUser } from '../../mocks/user';
|
||||||
|
import { useTeams } from '../../mocks/team';
|
||||||
|
import ms from 'ms';
|
||||||
|
|
||||||
|
describe('secrets', () => {
|
||||||
|
it('errors when no subcommand is provided', async () => {
|
||||||
|
client.setArgv('secrets');
|
||||||
|
const exitCode = await secrets(client);
|
||||||
|
|
||||||
|
expect(exitCode).toEqual(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('lists secrets with ls subcommand', async () => {
|
||||||
|
useUser();
|
||||||
|
useTeams('team_dummy');
|
||||||
|
const name = 'secret-api-password';
|
||||||
|
const created = 1519555701;
|
||||||
|
useSecrets({ name, created });
|
||||||
|
|
||||||
|
client.setArgv('secrets', 'ls');
|
||||||
|
await secrets(client);
|
||||||
|
|
||||||
|
const timeAgo = `${ms(
|
||||||
|
new Date().getTime() - new Date(created).getTime()
|
||||||
|
)} ago`;
|
||||||
|
await expect(client.stderr).toOutput(
|
||||||
|
'> NOTE: The `vercel env ls` command is recommended instead of `vercel secret ls`'
|
||||||
|
);
|
||||||
|
|
||||||
|
const output = client.stderr.read();
|
||||||
|
await expect(output).toMatch(name);
|
||||||
|
await expect(output).toMatch(timeAgo);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,5 +1,19 @@
|
|||||||
# @vercel/client
|
# @vercel/client
|
||||||
|
|
||||||
|
## 13.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
|
||||||
|
- @vercel/build-utils@7.2.0
|
||||||
|
|
||||||
|
## 13.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`5609a1187`](https://github.com/vercel/vercel/commit/5609a1187be9d6cf8d5f16825690c5ea72f17dc5), [`1b4de4a98`](https://github.com/vercel/vercel/commit/1b4de4a986f7a612aac834ebae3ec7bb9e9b8cf8)]:
|
||||||
|
- @vercel/build-utils@7.1.1
|
||||||
|
|
||||||
## 13.0.1
|
## 13.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/client",
|
"name": "@vercel/client",
|
||||||
"version": "13.0.1",
|
"version": "13.0.3",
|
||||||
"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",
|
||||||
@@ -14,9 +14,7 @@
|
|||||||
"directory": "packages/client"
|
"directory": "packages/client"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "node ../../utils/build.mjs",
|
||||||
"build:js": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test-e2e": "pnpm test tests/create-deployment.test.ts tests/create-legacy-deployment.test.ts tests/paths.test.ts",
|
"test-e2e": "pnpm test tests/create-deployment.test.ts tests/create-legacy-deployment.test.ts tests/paths.test.ts",
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||||
"test-unit": "pnpm test tests/unit.*test.*"
|
"test-unit": "pnpm test tests/unit.*test.*"
|
||||||
@@ -38,7 +36,7 @@
|
|||||||
"typescript": "4.9.5"
|
"typescript": "4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "7.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/routing-utils": "3.0.0",
|
"@vercel/routing-utils": "3.0.0",
|
||||||
"@zeit/fetch": "5.2.0",
|
"@zeit/fetch": "5.2.0",
|
||||||
"async-retry": "1.2.3",
|
"async-retry": "1.2.3",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @vercel/edge
|
# @vercel/edge
|
||||||
|
|
||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [node] upgrade edge-runtime ([#10451](https://github.com/vercel/vercel/pull/10451))
|
||||||
|
|
||||||
## 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/edge",
|
"name": "@vercel/edge",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.mjs",
|
"module": "dist/index.mjs",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"build:docs": "typedoc && node scripts/fix-links.js && prettier --write docs/**/*.md docs/*.md"
|
"build:docs": "typedoc && node scripts/fix-links.js && prettier --write docs/**/*.md docs/*.md"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@edge-runtime/jest-environment": "2.3.0",
|
"@edge-runtime/jest-environment": "2.3.1",
|
||||||
"@types/jest": "27.4.1",
|
"@types/jest": "27.4.1",
|
||||||
"jest-junit": "16.0.0",
|
"jest-junit": "16.0.0",
|
||||||
"ts-node": "8.9.1",
|
"ts-node": "8.9.1",
|
||||||
|
|||||||
@@ -13,9 +13,7 @@
|
|||||||
"directory": "packages/error-utils"
|
"directory": "packages/error-utils"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "node ../../utils/build.mjs",
|
||||||
"build:js": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --coverage --env node --verbose",
|
"test": "jest --reporters=default --reporters=jest-junit --coverage --env node --verbose",
|
||||||
"test-unit": "pnpm test"
|
"test-unit": "pnpm test"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,9 +13,7 @@
|
|||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "node ../../utils/build.mjs",
|
||||||
"build:src": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||||
"test-unit": "pnpm test"
|
"test-unit": "pnpm test"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @vercel/fs-detectors
|
# @vercel/fs-detectors
|
||||||
|
|
||||||
|
## 5.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated semver dependency ([#10411](https://github.com/vercel/vercel/pull/10411))
|
||||||
|
|
||||||
## 5.0.1
|
## 5.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/fs-detectors",
|
"name": "@vercel/fs-detectors",
|
||||||
"version": "5.0.1",
|
"version": "5.0.2",
|
||||||
"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",
|
||||||
@@ -14,9 +14,7 @@
|
|||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "node ../../utils/build.mjs",
|
||||||
"build:js": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||||
"test-unit": "pnpm test test/unit.*test.*",
|
"test-unit": "pnpm test test/unit.*test.*",
|
||||||
"test-e2e": "pnpm test test/integration.test.ts"
|
"test-e2e": "pnpm test test/integration.test.ts"
|
||||||
@@ -29,7 +27,7 @@
|
|||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"json5": "2.2.2",
|
"json5": "2.2.2",
|
||||||
"minimatch": "3.1.2",
|
"minimatch": "3.1.2",
|
||||||
"semver": "6.1.1"
|
"semver": "6.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "7.2.0",
|
"@types/glob": "7.2.0",
|
||||||
@@ -38,7 +36,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.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"jest-junit": "16.0.0",
|
"jest-junit": "16.0.0",
|
||||||
"typescript": "4.9.5"
|
"typescript": "4.9.5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
# @vercel/gatsby-plugin-vercel-builder
|
# @vercel/gatsby-plugin-vercel-builder
|
||||||
|
|
||||||
|
## 2.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`50e04dd85`](https://github.com/vercel/vercel/commit/50e04dd8584664c842a86c15d92d654f4ea8dcbb), [`45b73c7e8`](https://github.com/vercel/vercel/commit/45b73c7e86458564dc0bab007f6f6365c4c4ab5d), [`9d64312aa`](https://github.com/vercel/vercel/commit/9d64312aaaa875a4e193b7602c50e5dc68979aad), [`d8bc570f6`](https://github.com/vercel/vercel/commit/d8bc570f604950d97156d4f33c8accecf3b3b28f)]:
|
||||||
|
- @vercel/build-utils@7.2.0
|
||||||
|
- @vercel/node@3.0.5
|
||||||
|
|
||||||
|
## 2.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`5609a1187`](https://github.com/vercel/vercel/commit/5609a1187be9d6cf8d5f16825690c5ea72f17dc5), [`1b4de4a98`](https://github.com/vercel/vercel/commit/1b4de4a986f7a612aac834ebae3ec7bb9e9b8cf8), [`fc1e13c09`](https://github.com/vercel/vercel/commit/fc1e13c09928c654410b373fc1775c2b63c6ef4a)]:
|
||||||
|
- @vercel/build-utils@7.1.1
|
||||||
|
- @vercel/node@3.0.4
|
||||||
|
|
||||||
## 2.0.3
|
## 2.0.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/gatsby-plugin-vercel-builder",
|
"name": "@vercel/gatsby-plugin-vercel-builder",
|
||||||
"version": "2.0.3",
|
"version": "2.0.5",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sinclair/typebox": "0.25.24",
|
"@sinclair/typebox": "0.25.24",
|
||||||
"@vercel/build-utils": "7.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/node": "3.0.3",
|
"@vercel/node": "3.0.5",
|
||||||
"@vercel/routing-utils": "3.0.0",
|
"@vercel/routing-utils": "3.0.0",
|
||||||
"esbuild": "0.14.47",
|
"esbuild": "0.14.47",
|
||||||
"etag": "1.8.1",
|
"etag": "1.8.1",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @vercel/go
|
# @vercel/go
|
||||||
|
|
||||||
|
## 3.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Update to esbuild script ([#10468](https://github.com/vercel/vercel/pull/10468))
|
||||||
|
|
||||||
## 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
const fs = require('fs-extra');
|
|
||||||
const execa = require('execa');
|
|
||||||
const { join } = require('path');
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const outDir = join(__dirname, 'dist');
|
|
||||||
|
|
||||||
// Start fresh
|
|
||||||
await fs.remove(outDir);
|
|
||||||
|
|
||||||
// Build with `ncc`
|
|
||||||
await execa(
|
|
||||||
'ncc',
|
|
||||||
['build', 'index.ts', '-e', '@vercel/build-utils', '-o', outDir],
|
|
||||||
{
|
|
||||||
stdio: 'inherit',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
main().catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/go",
|
"name": "@vercel/go",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "./dist/index",
|
"main": "./dist/index",
|
||||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
||||||
@@ -10,32 +10,33 @@
|
|||||||
"directory": "packages/go"
|
"directory": "packages/go"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build",
|
"build": "node ../../utils/build-builder.mjs",
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||||
"test-e2e": "pnpm test"
|
"test-e2e": "pnpm test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist",
|
||||||
|
"*.go"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tootallnate/once": "1.1.2",
|
"@tootallnate/once": "1.1.2",
|
||||||
"@types/async-retry": "1.4.2",
|
"@types/async-retry": "1.4.5",
|
||||||
"@types/execa": "^0.9.0",
|
"@types/execa": "^0.9.0",
|
||||||
"@types/fs-extra": "^5.0.5",
|
"@types/fs-extra": "^5.0.5",
|
||||||
"@types/jest": "28.1.6",
|
"@types/jest": "28.1.6",
|
||||||
"@types/node": "14.18.33",
|
"@types/node": "14.18.33",
|
||||||
"@types/node-fetch": "^2.3.0",
|
"@types/node-fetch": "^2.3.0",
|
||||||
"@types/tar": "^4.0.0",
|
"@types/tar": "6.1.5",
|
||||||
"@types/yauzl-promise": "2.1.0",
|
"@types/yauzl-promise": "2.1.0",
|
||||||
"@vercel/build-utils": "7.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"async-retry": "1.3.1",
|
"async-retry": "1.3.3",
|
||||||
"execa": "^1.0.0",
|
"execa": "^1.0.0",
|
||||||
"fs-extra": "^7.0.0",
|
"fs-extra": "^7.0.0",
|
||||||
"jest-junit": "16.0.0",
|
"jest-junit": "16.0.0",
|
||||||
"node-fetch": "^2.2.1",
|
"node-fetch": "^2.2.1",
|
||||||
"string-argv": "0.3.1",
|
"string-argv": "0.3.1",
|
||||||
"tar": "4.4.6",
|
"tar": "6.2.0",
|
||||||
"typescript": "4.3.4",
|
"typescript": "4.3.4",
|
||||||
"xdg-app-paths": "5.1.0",
|
"xdg-app-paths": "5.1.0",
|
||||||
"yauzl-promise": "2.1.3"
|
"yauzl-promise": "2.1.3"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export async function getAnalyzedEntrypoint({
|
|||||||
const isAnalyzeExist = await pathExists(bin);
|
const isAnalyzeExist = await pathExists(bin);
|
||||||
if (!isAnalyzeExist) {
|
if (!isAnalyzeExist) {
|
||||||
debug(`Building analyze bin: ${bin}`);
|
debug(`Building analyze bin: ${bin}`);
|
||||||
const src = join(__dirname, 'util', 'analyze.go');
|
const src = join(__dirname, '../analyze.go');
|
||||||
let go;
|
let go;
|
||||||
const createOpts = {
|
const createOpts = {
|
||||||
modulePath,
|
modulePath,
|
||||||
@@ -621,7 +621,7 @@ async function copyDevServer(
|
|||||||
functionName: string,
|
functionName: string,
|
||||||
dest: string
|
dest: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const data = await readFile(join(__dirname, 'dev-server.go'), 'utf8');
|
const data = await readFile(join(__dirname, '../dev-server.go'), 'utf8');
|
||||||
|
|
||||||
// Populate the handler function name
|
// Populate the handler function name
|
||||||
const patched = data.replace('__HANDLER_FUNC_NAME', functionName);
|
const patched = data.replace('__HANDLER_FUNC_NAME', functionName);
|
||||||
@@ -634,7 +634,10 @@ async function writeEntrypoint(
|
|||||||
goPackageName: string,
|
goPackageName: string,
|
||||||
goFuncName: string
|
goFuncName: string
|
||||||
) {
|
) {
|
||||||
const modMainGoContents = await readFile(join(__dirname, 'main.go'), 'utf8');
|
const modMainGoContents = await readFile(
|
||||||
|
join(__dirname, '../main.go'),
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
const mainModGoContents = modMainGoContents
|
const mainModGoContents = modMainGoContents
|
||||||
.replace('__VC_HANDLER_PACKAGE_NAME', goPackageName)
|
.replace('__VC_HANDLER_PACKAGE_NAME', goPackageName)
|
||||||
.replace('__VC_HANDLER_FUNC_NAME', goFuncName);
|
.replace('__VC_HANDLER_FUNC_NAME', goFuncName);
|
||||||
2
packages/go/test/index.test.ts
vendored
2
packages/go/test/index.test.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { getNewHandlerFunctionName } from '../index';
|
import { getNewHandlerFunctionName } from '../src/index';
|
||||||
|
|
||||||
describe('getNewHandlerFunctionName', function () {
|
describe('getNewHandlerFunctionName', function () {
|
||||||
it('does nothing with empty original function name', async () => {
|
it('does nothing with empty original function name', async () => {
|
||||||
|
|||||||
@@ -11,8 +11,10 @@
|
|||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitThis": false,
|
"noImplicitThis": false,
|
||||||
|
"outDir": "./dist",
|
||||||
"types": ["node", "jest"],
|
"types": ["node", "jest"],
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "ES2021"
|
"target": "ES2021"
|
||||||
}
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @vercel/hydrogen
|
# @vercel/hydrogen
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Use `build-builder.mjs` script to bundle, and remove types and source maps ([#10480](https://github.com/vercel/vercel/pull/10480))
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/hydrogen",
|
"name": "@vercel/hydrogen",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"homepage": "https://vercel.com/docs",
|
"homepage": "https://vercel.com/docs",
|
||||||
@@ -10,9 +10,7 @@
|
|||||||
"directory": "packages/hydrogen"
|
"directory": "packages/hydrogen"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "node ../../utils/build-builder.mjs",
|
||||||
"build:js": "node ../../scripts/esbuild.mjs",
|
|
||||||
"build:types": "tsc",
|
|
||||||
"test-e2e": "pnpm test test/test.js",
|
"test-e2e": "pnpm test test/test.js",
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand"
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand"
|
||||||
},
|
},
|
||||||
@@ -20,14 +18,16 @@
|
|||||||
"dist",
|
"dist",
|
||||||
"edge-entry.js"
|
"edge-entry.js"
|
||||||
],
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@vercel/static-config": "3.0.0",
|
||||||
|
"ts-morph": "12.0.0"
|
||||||
|
},
|
||||||
"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.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/static-config": "3.0.0",
|
|
||||||
"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"
|
||||||
"ts-morph": "12.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": false,
|
||||||
"emitDeclarationOnly": true,
|
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["ES2021"],
|
"lib": ["ES2021"],
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
@@ -14,8 +13,7 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"types": ["node", "jest"],
|
"types": ["node", "jest"],
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "ES2021",
|
"target": "ES2021"
|
||||||
"sourceMap": true
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
# @vercel/next
|
# @vercel/next
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- fix content-type for RSC prefetches ([#10487](https://github.com/vercel/vercel/pull/10487))
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Fix Next.js with `basePath` + Edge runtime + App Router on a top level `page.jsx` ([#10465](https://github.com/vercel/vercel/pull/10465))
|
||||||
|
|
||||||
|
- Updated semver dependency ([#10411](https://github.com/vercel/vercel/pull/10411))
|
||||||
|
|
||||||
|
- Fix RSC rewrite behavior ([#10415](https://github.com/vercel/vercel/pull/10415))
|
||||||
|
|
||||||
|
- fix ENOENT on /404.html when `fallback: false` w/ `basePath` ([#10473](https://github.com/vercel/vercel/pull/10473))
|
||||||
|
|
||||||
|
- fix 404 enoent for i18n ([#10416](https://github.com/vercel/vercel/pull/10416))
|
||||||
|
|
||||||
## 4.0.1
|
## 4.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/next",
|
"name": "@vercel/next",
|
||||||
"version": "4.0.1",
|
"version": "4.0.3",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"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",
|
||||||
@@ -35,7 +35,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.1.0",
|
"@vercel/build-utils": "7.2.0",
|
||||||
"@vercel/nft": "0.22.5",
|
"@vercel/nft": "0.22.5",
|
||||||
"@vercel/routing-utils": "3.0.0",
|
"@vercel/routing-utils": "3.0.0",
|
||||||
"async-sema": "3.0.1",
|
"async-sema": "3.0.1",
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
"ndjson": "2.0.0",
|
"ndjson": "2.0.0",
|
||||||
"pretty-bytes": "5.3.0",
|
"pretty-bytes": "5.3.0",
|
||||||
"resolve-from": "5.0.0",
|
"resolve-from": "5.0.0",
|
||||||
"semver": "6.1.1",
|
"semver": "6.3.1",
|
||||||
"set-cookie-parser": "2.4.6",
|
"set-cookie-parser": "2.4.6",
|
||||||
"source-map": "0.7.3",
|
"source-map": "0.7.3",
|
||||||
"test-listen": "1.1.0",
|
"test-listen": "1.1.0",
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ import {
|
|||||||
getOperationType,
|
getOperationType,
|
||||||
isApiPage,
|
isApiPage,
|
||||||
getFunctionsConfigManifest,
|
getFunctionsConfigManifest,
|
||||||
|
normalizeEdgeFunctionPath,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
export const version = 2;
|
export const version = 2;
|
||||||
@@ -1320,11 +1321,7 @@ export const build: BuildV2 = async ({
|
|||||||
const localePrefixed404 = !!(
|
const localePrefixed404 = !!(
|
||||||
routesManifest.i18n &&
|
routesManifest.i18n &&
|
||||||
originalStaticPages[
|
originalStaticPages[
|
||||||
path.posix.join(
|
path.posix.join('.', routesManifest.i18n.defaultLocale, '404.html')
|
||||||
entryDirectory,
|
|
||||||
routesManifest.i18n.defaultLocale,
|
|
||||||
'404.html'
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2720,7 +2717,15 @@ async function getServerlessPages(params: {
|
|||||||
for (const edgeFunctionFile of Object.keys(
|
for (const edgeFunctionFile of Object.keys(
|
||||||
middlewareManifest?.functions ?? {}
|
middlewareManifest?.functions ?? {}
|
||||||
)) {
|
)) {
|
||||||
const edgePath = (edgeFunctionFile.slice(1) || 'index') + '.js';
|
let edgePath =
|
||||||
|
middlewareManifest?.functions?.[edgeFunctionFile].name ||
|
||||||
|
edgeFunctionFile;
|
||||||
|
|
||||||
|
edgePath = normalizeEdgeFunctionPath(
|
||||||
|
edgePath,
|
||||||
|
params.appPathRoutesManifest || {}
|
||||||
|
);
|
||||||
|
edgePath = (edgePath || 'index') + '.js';
|
||||||
delete normalizedAppPaths[edgePath];
|
delete normalizedAppPaths[edgePath];
|
||||||
delete pages[edgePath];
|
delete pages[edgePath];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ import {
|
|||||||
UnwrapPromise,
|
UnwrapPromise,
|
||||||
getOperationType,
|
getOperationType,
|
||||||
FunctionsConfigManifestV1,
|
FunctionsConfigManifestV1,
|
||||||
|
RSC_CONTENT_TYPE,
|
||||||
|
RSC_PREFETCH_SUFFIX,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import {
|
import {
|
||||||
nodeFileTrace,
|
nodeFileTrace,
|
||||||
@@ -168,7 +170,6 @@ export async function serverBuild({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const APP_PREFETCH_SUFFIX = '.prefetch.rsc';
|
|
||||||
let appRscPrefetches: UnwrapPromise<ReturnType<typeof glob>> = {};
|
let appRscPrefetches: UnwrapPromise<ReturnType<typeof glob>> = {};
|
||||||
let appBuildTraces: UnwrapPromise<ReturnType<typeof glob>> = {};
|
let appBuildTraces: UnwrapPromise<ReturnType<typeof glob>> = {};
|
||||||
let appDir: string | null = null;
|
let appDir: string | null = null;
|
||||||
@@ -176,7 +177,18 @@ export async function serverBuild({
|
|||||||
if (appPathRoutesManifest) {
|
if (appPathRoutesManifest) {
|
||||||
appDir = path.join(pagesDir, '../app');
|
appDir = path.join(pagesDir, '../app');
|
||||||
appBuildTraces = await glob('**/*.js.nft.json', appDir);
|
appBuildTraces = await glob('**/*.js.nft.json', appDir);
|
||||||
appRscPrefetches = await glob(`**/*${APP_PREFETCH_SUFFIX}`, appDir);
|
appRscPrefetches = await glob(`**/*${RSC_PREFETCH_SUFFIX}`, appDir);
|
||||||
|
|
||||||
|
const rscContentTypeHeader =
|
||||||
|
routesManifest?.rsc?.contentTypeHeader || RSC_CONTENT_TYPE;
|
||||||
|
|
||||||
|
// ensure all appRscPrefetches have a contentType since this is used by Next.js
|
||||||
|
// to determine if it's a valid response
|
||||||
|
for (const value of Object.values(appRscPrefetches)) {
|
||||||
|
if (!value.contentType) {
|
||||||
|
value.contentType = rscContentTypeHeader;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isCorrectNotFoundRoutes = semver.gte(
|
const isCorrectNotFoundRoutes = semver.gte(
|
||||||
@@ -1074,8 +1086,7 @@ export async function serverBuild({
|
|||||||
canUsePreviewMode,
|
canUsePreviewMode,
|
||||||
prerenderManifest.bypassToken || '',
|
prerenderManifest.bypassToken || '',
|
||||||
true,
|
true,
|
||||||
middleware.dynamicRouteMap,
|
middleware.dynamicRouteMap
|
||||||
inversedAppPathManifest
|
|
||||||
).then(arr =>
|
).then(arr =>
|
||||||
localizeDynamicRoutes(
|
localizeDynamicRoutes(
|
||||||
arr,
|
arr,
|
||||||
@@ -1090,6 +1101,32 @@ export async function serverBuild({
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const pagesPlaceholderRscEntries: Record<string, FileBlob> = {};
|
||||||
|
|
||||||
|
if (appDir) {
|
||||||
|
// since we attempt to rewrite all paths to an .rsc variant,
|
||||||
|
// we need to create dummy rsc outputs for all pages entries
|
||||||
|
// this is so that an RSC request to a `pages` entry will match
|
||||||
|
// rather than falling back to a catchall `app` entry
|
||||||
|
// on the nextjs side, invalid RSC response payloads will correctly trigger an mpa navigation
|
||||||
|
const pagesManifest = path.join(
|
||||||
|
entryPath,
|
||||||
|
outputDirectory,
|
||||||
|
`server/pages-manifest.json`
|
||||||
|
);
|
||||||
|
|
||||||
|
const pagesData = await fs.readJSON(pagesManifest);
|
||||||
|
const pagesEntries = Object.keys(pagesData);
|
||||||
|
|
||||||
|
for (const page of pagesEntries) {
|
||||||
|
const pathName = page.startsWith('/') ? page.slice(1) : page;
|
||||||
|
pagesPlaceholderRscEntries[`${pathName}.rsc`] = new FileBlob({
|
||||||
|
data: '{}',
|
||||||
|
contentType: 'application/json',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } =
|
const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } =
|
||||||
await getStaticFiles(entryPath, entryDirectory, outputDirectory);
|
await getStaticFiles(entryPath, entryDirectory, outputDirectory);
|
||||||
|
|
||||||
@@ -1220,10 +1257,9 @@ export async function serverBuild({
|
|||||||
if (ogRoute.endsWith('/route')) {
|
if (ogRoute.endsWith('/route')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
route = path.posix.join(
|
route = normalizeIndexOutput(
|
||||||
'./',
|
path.posix.join('./', entryDirectory, route === '/' ? '/index' : route),
|
||||||
entryDirectory,
|
true
|
||||||
route === '/' ? '/index' : route
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (lambdas[route]) {
|
if (lambdas[route]) {
|
||||||
@@ -1249,6 +1285,7 @@ export async function serverBuild({
|
|||||||
...publicDirectoryFiles,
|
...publicDirectoryFiles,
|
||||||
...lambdas,
|
...lambdas,
|
||||||
...appRscPrefetches,
|
...appRscPrefetches,
|
||||||
|
...pagesPlaceholderRscEntries,
|
||||||
// Prerenders may override Lambdas -- this is an intentional behavior.
|
// Prerenders may override Lambdas -- this is an intentional behavior.
|
||||||
...prerenders,
|
...prerenders,
|
||||||
...staticPages,
|
...staticPages,
|
||||||
@@ -1501,7 +1538,7 @@ export async function serverBuild({
|
|||||||
dest: path.posix.join(
|
dest: path.posix.join(
|
||||||
'/',
|
'/',
|
||||||
entryDirectory,
|
entryDirectory,
|
||||||
'/index.prefetch.rsc'
|
`/index${RSC_PREFETCH_SUFFIX}`
|
||||||
),
|
),
|
||||||
headers: { vary: rscVaryHeader },
|
headers: { vary: rscVaryHeader },
|
||||||
continue: true,
|
continue: true,
|
||||||
@@ -1522,7 +1559,7 @@ export async function serverBuild({
|
|||||||
dest: path.posix.join(
|
dest: path.posix.join(
|
||||||
'/',
|
'/',
|
||||||
entryDirectory,
|
entryDirectory,
|
||||||
`/$1${APP_PREFETCH_SUFFIX}`
|
`/$1${RSC_PREFETCH_SUFFIX}`
|
||||||
),
|
),
|
||||||
headers: { vary: rscVaryHeader },
|
headers: { vary: rscVaryHeader },
|
||||||
continue: true,
|
continue: true,
|
||||||
@@ -1601,7 +1638,7 @@ export async function serverBuild({
|
|||||||
src: path.posix.join(
|
src: path.posix.join(
|
||||||
'/',
|
'/',
|
||||||
entryDirectory,
|
entryDirectory,
|
||||||
`/index${APP_PREFETCH_SUFFIX}`
|
`/index${RSC_PREFETCH_SUFFIX}`
|
||||||
),
|
),
|
||||||
dest: path.posix.join('/', entryDirectory, '/index.rsc'),
|
dest: path.posix.join('/', entryDirectory, '/index.rsc'),
|
||||||
has: [
|
has: [
|
||||||
@@ -1617,7 +1654,7 @@ export async function serverBuild({
|
|||||||
src: `^${path.posix.join(
|
src: `^${path.posix.join(
|
||||||
'/',
|
'/',
|
||||||
entryDirectory,
|
entryDirectory,
|
||||||
`/(.+?)${APP_PREFETCH_SUFFIX}(?:/)?$`
|
`/(.+?)${RSC_PREFETCH_SUFFIX}(?:/)?$`
|
||||||
)}`,
|
)}`,
|
||||||
dest: path.posix.join('/', entryDirectory, '/$1.rsc'),
|
dest: path.posix.join('/', entryDirectory, '/$1.rsc'),
|
||||||
has: [
|
has: [
|
||||||
@@ -1632,72 +1669,22 @@ export async function serverBuild({
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
|
||||||
...(appDir
|
|
||||||
? [
|
|
||||||
// check routes that end in `.rsc` to see if a page with the resulting name (sans-.rsc) exists in the filesystem
|
|
||||||
// if so, we want to match that page instead. (This matters when prefetching a pages route while on an appdir route)
|
|
||||||
{
|
|
||||||
src: `^${path.posix.join('/', entryDirectory, '/(.*)\\.rsc$')}`,
|
|
||||||
dest: path.posix.join('/', entryDirectory, '/$1'),
|
|
||||||
has: [
|
|
||||||
{
|
|
||||||
type: 'header',
|
|
||||||
key: rscHeader,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
...(rscPrefetchHeader
|
|
||||||
? {
|
|
||||||
missing: [
|
|
||||||
{
|
|
||||||
type: 'header',
|
|
||||||
key: rscPrefetchHeader,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
check: true,
|
|
||||||
} as Route,
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
|
|
||||||
// These need to come before handle: miss or else they are grouped
|
// These need to come before handle: miss or else they are grouped
|
||||||
// with that routing section
|
// with that routing section
|
||||||
...afterFilesRewrites,
|
...afterFilesRewrites,
|
||||||
|
|
||||||
...(appDir
|
|
||||||
? [
|
|
||||||
// rewrite route back to `.rsc`, but skip checking fs
|
|
||||||
{
|
|
||||||
src: `^${path.posix.join(
|
|
||||||
'/',
|
|
||||||
entryDirectory,
|
|
||||||
'/((?!.+\\.rsc).+?)(?:/)?$'
|
|
||||||
)}`,
|
|
||||||
has: [
|
|
||||||
{
|
|
||||||
type: 'header',
|
|
||||||
key: rscHeader,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
dest: path.posix.join('/', entryDirectory, '/$1.rsc'),
|
|
||||||
headers: { vary: rscVaryHeader },
|
|
||||||
continue: true,
|
|
||||||
override: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
|
|
||||||
// make sure 404 page is used when a directory is matched without
|
|
||||||
// an index page
|
|
||||||
{ handle: 'resource' },
|
{ handle: 'resource' },
|
||||||
|
|
||||||
...fallbackRewrites,
|
...fallbackRewrites,
|
||||||
|
|
||||||
|
// make sure 404 page is used when a directory is matched without
|
||||||
|
// an index page
|
||||||
{ src: path.posix.join('/', entryDirectory, '.*'), status: 404 },
|
{ src: path.posix.join('/', entryDirectory, '.*'), status: 404 },
|
||||||
|
|
||||||
|
{ handle: 'miss' },
|
||||||
|
|
||||||
// We need to make sure to 404 for /_next after handle: miss since
|
// We need to make sure to 404 for /_next after handle: miss since
|
||||||
// handle: miss is called before rewrites and to prevent rewriting /_next
|
// handle: miss is called before rewrites and to prevent rewriting /_next
|
||||||
{ handle: 'miss' },
|
|
||||||
{
|
{
|
||||||
src: path.posix.join(
|
src: path.posix.join(
|
||||||
'/',
|
'/',
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ export const MIB = 1024 * KIB;
|
|||||||
|
|
||||||
export const prettyBytes = (n: number) => bytes(n, { unitSeparator: ' ' });
|
export const prettyBytes = (n: number) => bytes(n, { unitSeparator: ' ' });
|
||||||
|
|
||||||
|
export const RSC_CONTENT_TYPE = 'x-component';
|
||||||
|
export const RSC_PREFETCH_SUFFIX = '.prefetch.rsc';
|
||||||
|
|
||||||
// Identify /[param]/ in route string
|
// Identify /[param]/ in route string
|
||||||
// eslint-disable-next-line no-useless-escape
|
// eslint-disable-next-line no-useless-escape
|
||||||
const TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
|
const TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
|
||||||
@@ -305,8 +308,7 @@ export async function getDynamicRoutes(
|
|||||||
canUsePreviewMode?: boolean,
|
canUsePreviewMode?: boolean,
|
||||||
bypassToken?: string,
|
bypassToken?: string,
|
||||||
isServerMode?: boolean,
|
isServerMode?: boolean,
|
||||||
dynamicMiddlewareRouteMap?: Map<string, RouteWithSrc>,
|
dynamicMiddlewareRouteMap?: Map<string, RouteWithSrc>
|
||||||
appPathRoutesManifest?: Record<string, string>
|
|
||||||
): Promise<RouteWithSrc[]> {
|
): Promise<RouteWithSrc[]> {
|
||||||
if (routesManifest) {
|
if (routesManifest) {
|
||||||
switch (routesManifest.version) {
|
switch (routesManifest.version) {
|
||||||
@@ -379,8 +381,6 @@ export async function getDynamicRoutes(
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appPathRoutesManifest?.[page]) {
|
|
||||||
routes.push({
|
routes.push({
|
||||||
...route,
|
...route,
|
||||||
src: route.src.replace(
|
src: route.src.replace(
|
||||||
@@ -389,7 +389,7 @@ export async function getDynamicRoutes(
|
|||||||
),
|
),
|
||||||
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
|
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
|
||||||
});
|
});
|
||||||
}
|
|
||||||
routes.push(route);
|
routes.push(route);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2161,7 +2161,7 @@ export const onPrerenderRoute =
|
|||||||
routesManifest?.rsc?.varyHeader ||
|
routesManifest?.rsc?.varyHeader ||
|
||||||
'RSC, Next-Router-State-Tree, Next-Router-Prefetch';
|
'RSC, Next-Router-State-Tree, Next-Router-Prefetch';
|
||||||
const rscContentTypeHeader =
|
const rscContentTypeHeader =
|
||||||
routesManifest?.rsc?.contentTypeHeader || 'text/x-component';
|
routesManifest?.rsc?.contentTypeHeader || RSC_CONTENT_TYPE;
|
||||||
|
|
||||||
let sourcePath: string | undefined;
|
let sourcePath: string | undefined;
|
||||||
if (`/${outputPathPage}` !== srcRoute && srcRoute) {
|
if (`/${outputPathPage}` !== srcRoute && srcRoute) {
|
||||||
@@ -2347,7 +2347,7 @@ export function normalizeIndexOutput(
|
|||||||
outputName: string,
|
outputName: string,
|
||||||
isServerMode: boolean
|
isServerMode: boolean
|
||||||
) {
|
) {
|
||||||
if (outputName !== '/index' && isServerMode) {
|
if (outputName !== 'index' && outputName !== '/index' && isServerMode) {
|
||||||
return outputName.replace(/\/index$/, '');
|
return outputName.replace(/\/index$/, '');
|
||||||
}
|
}
|
||||||
return outputName;
|
return outputName;
|
||||||
@@ -2524,6 +2524,29 @@ function normalizeRegions(regions: Regions): undefined | string | string[] {
|
|||||||
return newRegions;
|
return newRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeEdgeFunctionPath(
|
||||||
|
shortPath: string,
|
||||||
|
appPathRoutesManifest: Record<string, string>
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
shortPath.startsWith('app/') &&
|
||||||
|
(shortPath.endsWith('/page') ||
|
||||||
|
shortPath.endsWith('/route') ||
|
||||||
|
shortPath === 'app/_not-found')
|
||||||
|
) {
|
||||||
|
const ogRoute = shortPath.replace(/^app\//, '/');
|
||||||
|
shortPath = (
|
||||||
|
appPathRoutesManifest[ogRoute] ||
|
||||||
|
shortPath.replace(/(^|\/)(page|route)$/, '')
|
||||||
|
).replace(/^\//, '');
|
||||||
|
|
||||||
|
if (!shortPath || shortPath === '/') {
|
||||||
|
shortPath = 'index';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return shortPath;
|
||||||
|
}
|
||||||
|
|
||||||
export async function getMiddlewareBundle({
|
export async function getMiddlewareBundle({
|
||||||
entryPath,
|
entryPath,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
@@ -2702,27 +2725,19 @@ export async function getMiddlewareBundle({
|
|||||||
// app/index/page -> index/index
|
// app/index/page -> index/index
|
||||||
if (shortPath.startsWith('pages/')) {
|
if (shortPath.startsWith('pages/')) {
|
||||||
shortPath = shortPath.replace(/^pages\//, '');
|
shortPath = shortPath.replace(/^pages\//, '');
|
||||||
} else if (
|
} else {
|
||||||
shortPath.startsWith('app/') &&
|
shortPath = normalizeEdgeFunctionPath(shortPath, appPathRoutesManifest);
|
||||||
(shortPath.endsWith('/page') ||
|
|
||||||
shortPath.endsWith('/route') ||
|
|
||||||
shortPath === 'app/_not-found')
|
|
||||||
) {
|
|
||||||
const ogRoute = shortPath.replace(/^app\//, '/');
|
|
||||||
shortPath = (
|
|
||||||
appPathRoutesManifest[ogRoute] ||
|
|
||||||
shortPath.replace(/(^|\/)(page|route)$/, '')
|
|
||||||
).replace(/^\//, '');
|
|
||||||
|
|
||||||
if (!shortPath || shortPath === '/') {
|
|
||||||
shortPath = 'index';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (routesManifest?.basePath) {
|
if (routesManifest?.basePath) {
|
||||||
shortPath = path.posix
|
shortPath = normalizeIndexOutput(
|
||||||
.join(routesManifest.basePath, shortPath)
|
path.posix.join(
|
||||||
.replace(/^\//, '');
|
'./',
|
||||||
|
routesManifest?.basePath,
|
||||||
|
shortPath.replace(/^\//, '')
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
worker.edgeFunction.name = shortPath;
|
worker.edgeFunction.name = shortPath;
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>Home</h1>
|
<h1>Home</h1>
|
||||||
|
<Link href="/en/about">About</Link>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"headers": {
|
"headers": {
|
||||||
"RSC": "1"
|
"RSC": "1"
|
||||||
},
|
},
|
||||||
"mustContain": "<html"
|
"bodyMustBe": "{}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "/en/foobar",
|
"path": "/en/foobar",
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ export default function handler(req, res) {
|
|||||||
return res.json({ hello: 'world' });
|
return res.json({ hello: 'world' });
|
||||||
}
|
}
|
||||||
|
|
||||||
export const maxDuration = 7;
|
export const config = {
|
||||||
|
maxDuration: 7
|
||||||
|
};
|
||||||
|
|||||||
16
packages/next/test/fixtures/00-app-dir/app/gsp/[text]/page.js
vendored
Normal file
16
packages/next/test/fixtures/00-app-dir/app/gsp/[text]/page.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export default async function DynamicPage({ params }) {
|
||||||
|
return (
|
||||||
|
<main>
|
||||||
|
<h1>Dynamic page</h1>
|
||||||
|
<p>Param: {params.text}</p>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function generateStaticParams() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
text: 'one',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
9
packages/next/test/fixtures/00-app-dir/pages/[segmentA]/[segmentB]/[segmentC]/index.js
vendored
Normal file
9
packages/next/test/fixtures/00-app-dir/pages/[segmentA]/[segmentB]/[segmentC]/index.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export default function Page(props) {
|
||||||
|
return <div>SSRed Page</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
3
packages/next/test/fixtures/00-app-dir/pages/docs/categories/foo.js
vendored
Normal file
3
packages/next/test/fixtures/00-app-dir/pages/docs/categories/foo.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default function Page() {
|
||||||
|
return 'Hello World'
|
||||||
|
}
|
||||||
@@ -44,9 +44,21 @@
|
|||||||
"RSC": "1",
|
"RSC": "1",
|
||||||
"Next-Router-Prefetch": "1"
|
"Next-Router-Prefetch": "1"
|
||||||
},
|
},
|
||||||
|
"responseHeaders": {
|
||||||
|
"content-type":"text/x-component"
|
||||||
|
},
|
||||||
"mustContain": ":",
|
"mustContain": ":",
|
||||||
"mustNotContain": "<html"
|
"mustNotContain": "<html"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "/docs/categories/foo?_rsc=f7pci",
|
||||||
|
"status": 200,
|
||||||
|
"headers": {
|
||||||
|
"RSC": "1",
|
||||||
|
"Next-Router-Prefetch": "1"
|
||||||
|
},
|
||||||
|
"bodyMustBe": "{}"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "/ssg",
|
"path": "/ssg",
|
||||||
"status": 200,
|
"status": 200,
|
||||||
@@ -63,6 +75,9 @@
|
|||||||
"headers": {
|
"headers": {
|
||||||
"Next-Router-Prefetch": "1",
|
"Next-Router-Prefetch": "1",
|
||||||
"RSC": "1"
|
"RSC": "1"
|
||||||
|
},
|
||||||
|
"responseHeaders": {
|
||||||
|
"content-type":"text/x-component"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -90,7 +105,8 @@
|
|||||||
"path": "/ssg",
|
"path": "/ssg",
|
||||||
"status": 200,
|
"status": 200,
|
||||||
"responseHeaders": {
|
"responseHeaders": {
|
||||||
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Url"
|
"vary": "RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Url",
|
||||||
|
"content-type":"text/x-component"
|
||||||
},
|
},
|
||||||
"headers": {
|
"headers": {
|
||||||
"RSC": "1",
|
"RSC": "1",
|
||||||
@@ -235,6 +251,24 @@
|
|||||||
},
|
},
|
||||||
"mustContain": ":{",
|
"mustContain": ":{",
|
||||||
"mustNotContain": "<html"
|
"mustNotContain": "<html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/gsp/one",
|
||||||
|
"status": 200,
|
||||||
|
"headers": {
|
||||||
|
"RSC": "1"
|
||||||
|
},
|
||||||
|
"mustContain": ":{",
|
||||||
|
"mustNotContain": "<html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/gsp/two",
|
||||||
|
"status": 200,
|
||||||
|
"headers": {
|
||||||
|
"RSC": "1"
|
||||||
|
},
|
||||||
|
"mustContain": ":{",
|
||||||
|
"mustNotContain": "<html"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
8
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/index.test.js
vendored
Normal file
8
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/index.test.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const { deployAndTest } = require('../../utils');
|
||||||
|
|
||||||
|
describe(`${__dirname.split(path.sep).pop()}`, () => {
|
||||||
|
it('should deploy and pass probe checks', async () => {
|
||||||
|
await deployAndTest(__dirname);
|
||||||
|
});
|
||||||
|
});
|
||||||
10
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/next.config.js
vendored
Normal file
10
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/next.config.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
generateBuildId() {
|
||||||
|
return 'testing-build-id';
|
||||||
|
},
|
||||||
|
basePath: '/docs',
|
||||||
|
i18n: {
|
||||||
|
locales: ['en', 'fr', 'nl'],
|
||||||
|
defaultLocale: 'en',
|
||||||
|
},
|
||||||
|
};
|
||||||
8
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/package.json
vendored
Normal file
8
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/package.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"next": "canary",
|
||||||
|
"react": "latest",
|
||||||
|
"react-dom": "latest"
|
||||||
|
},
|
||||||
|
"ignoreNextjsUpdates": true
|
||||||
|
}
|
||||||
3
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/404.js
vendored
Normal file
3
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/404.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default function NotFound() {
|
||||||
|
return 'not found page';
|
||||||
|
}
|
||||||
13
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/_app.js
vendored
Normal file
13
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/_app.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
function MyApp({ Component, pageProps }) {
|
||||||
|
return <Component {...pageProps} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getStaticProps = ({ locale }) => ({
|
||||||
|
props: {
|
||||||
|
locale
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default MyApp;
|
||||||
|
|
||||||
11
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/another.js
vendored
Normal file
11
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/another.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
export default function Another() {
|
||||||
|
return 'another page';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getStaticProps = ({ locale }) => ({
|
||||||
|
props: {
|
||||||
|
locale,
|
||||||
|
hello: 'world',
|
||||||
|
},
|
||||||
|
revalidate: 1,
|
||||||
|
});
|
||||||
3
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/api/blog/[slug].js
vendored
Normal file
3
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/api/blog/[slug].js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default function handler(req, res) {
|
||||||
|
res.json({ slug: req.query.slug });
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export default function handler(req, res) {
|
||||||
|
res.json({ rest: req.query.rest.join('/') });
|
||||||
|
}
|
||||||
6
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/api/hello.js
vendored
Normal file
6
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/api/hello.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
|
|
||||||
|
export default (req, res) => {
|
||||||
|
res.statusCode = 200;
|
||||||
|
res.json({ name: 'John Doe' });
|
||||||
|
};
|
||||||
25
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/foo/[slug].js
vendored
Normal file
25
packages/next/test/fixtures/00-i18n-basepath-fallback-false-404/pages/foo/[slug].js
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
export default function Page() {
|
||||||
|
return 'Hello World';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getStaticProps = async ({ locale, params }) => {
|
||||||
|
const id = params?.['slug'];
|
||||||
|
if (!id) {
|
||||||
|
return {
|
||||||
|
notFound: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
locale,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getStaticPaths = async () => {
|
||||||
|
return {
|
||||||
|
paths: [{ params: { slug: 'test' } }],
|
||||||
|
fallback: false,
|
||||||
|
};
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user