@vercel/client 18.11.2 → 18.12.1-snapshot-23cc3b13430e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check-deployment-status.js +4 -0
- package/dist/collect-deployment-files.d.ts +6 -1
- package/dist/collect-deployment-files.js +27 -0
- package/dist/inspect-deployment-files.d.ts +1 -1
- package/dist/types.d.ts +23 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +1 -0
- package/dist/utils/ready-state.d.ts +5 -0
- package/dist/utils/ready-state.js +7 -1
- package/package.json +2 -2
|
@@ -232,6 +232,10 @@ async function* checkDeploymentStatus(deployment, clientOptions) {
|
|
|
232
232
|
finishedEvents.add("canceled");
|
|
233
233
|
yield { type: "canceled", payload: deploymentUpdate };
|
|
234
234
|
}
|
|
235
|
+
if ((0, import_ready_state.isBlocked)(deploymentUpdate)) {
|
|
236
|
+
debug("Deployment state changed to BLOCKED");
|
|
237
|
+
return yield { type: "blocked", payload: deploymentUpdate };
|
|
238
|
+
}
|
|
235
239
|
if ((0, import_ready_state.isReady)(deploymentUpdate) && !finishedEvents.has("ready")) {
|
|
236
240
|
debug("Deployment state changed to READY");
|
|
237
241
|
finishedEvents.add("ready");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { VercelClientOptions } from './types';
|
|
2
2
|
import { type Debug } from './utils';
|
|
3
3
|
import { type FilesMap } from './utils/hashes';
|
|
4
|
-
type CollectDeploymentFilesOptions = Pick<VercelClientOptions, 'archive' | 'bulkRedirectsPath' | 'isDirectory' | 'prebuilt' | 'projectName' | 'rootDirectory' | 'vercelOutputDir'>;
|
|
4
|
+
type CollectDeploymentFilesOptions = Pick<VercelClientOptions, 'archive' | 'bulkRedirectsPath' | 'isDirectory' | 'prebuilt' | 'projectName' | 'rootDirectory' | 'servePageAtRoot' | 'vercelOutputDir'>;
|
|
5
5
|
export interface CollectedDeploymentFiles {
|
|
6
6
|
fileList: string[];
|
|
7
7
|
filesMap: FilesMap;
|
|
@@ -12,4 +12,9 @@ export interface CollectedDeploymentFiles {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function assertDeploymentPath(path: VercelClientOptions['path'] | undefined, debug: Debug): asserts path is VercelClientOptions['path'];
|
|
14
14
|
export declare function collectDeploymentFiles(path: VercelClientOptions['path'] | undefined, clientOptions: CollectDeploymentFilesOptions, debug: Debug): Promise<CollectedDeploymentFiles>;
|
|
15
|
+
/**
|
|
16
|
+
* Adds `index.html` as a second name for the only HTML page of a plain HTML
|
|
17
|
+
* site, so `/` serves it. See `servePageAtRoot`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function addRootPageAlias(filesMap: FilesMap, root: string, debug: Debug): void;
|
|
15
20
|
export {};
|
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var collect_deployment_files_exports = {};
|
|
20
20
|
__export(collect_deployment_files_exports, {
|
|
21
|
+
addRootPageAlias: () => addRootPageAlias,
|
|
21
22
|
assertDeploymentPath: () => assertDeploymentPath,
|
|
22
23
|
collectDeploymentFiles: () => collectDeploymentFiles
|
|
23
24
|
});
|
|
@@ -86,10 +87,36 @@ ${err.message}`;
|
|
|
86
87
|
}
|
|
87
88
|
throw err;
|
|
88
89
|
}
|
|
90
|
+
if (clientOptions.servePageAtRoot && !clientOptions.prebuilt && clientOptions.archive !== "tgz" && typeof path === "string") {
|
|
91
|
+
addRootPageAlias(filesMap, isDirectory ? path : (0, import_path.dirname)(path), debug);
|
|
92
|
+
}
|
|
89
93
|
return { fileList, filesMap, workPath, isDirectory, ignoreList, warning };
|
|
90
94
|
}
|
|
95
|
+
function addRootPageAlias(filesMap, root, debug) {
|
|
96
|
+
let page;
|
|
97
|
+
for (const file of filesMap.values()) {
|
|
98
|
+
for (const name of file.names) {
|
|
99
|
+
const rel = (0, import_path.relative)(root, name).split(import_path.sep).join("/");
|
|
100
|
+
if (rel === "package.json" || rel === "middleware.js" || rel === "middleware.ts" || rel.startsWith("api/") || rel.startsWith("public/")) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const lower = rel.toLowerCase();
|
|
104
|
+
if (!lower.endsWith(".html") && !lower.endsWith(".htm"))
|
|
105
|
+
continue;
|
|
106
|
+
if (page || rel.includes("/") || rel === "index.html" || rel === "index.htm") {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
page = { names: file.names, name: rel };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!page)
|
|
113
|
+
return;
|
|
114
|
+
debug(`Also uploading "${page.name}" as "index.html" so / serves it`);
|
|
115
|
+
page.names.push((0, import_path.join)(root, "index.html"));
|
|
116
|
+
}
|
|
91
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
118
|
0 && (module.exports = {
|
|
119
|
+
addRootPageAlias,
|
|
93
120
|
assertDeploymentPath,
|
|
94
121
|
collectDeploymentFiles
|
|
95
122
|
});
|
|
@@ -14,4 +14,4 @@ export interface DeploymentFileSummary {
|
|
|
14
14
|
ignored: string[];
|
|
15
15
|
warning?: string;
|
|
16
16
|
}
|
|
17
|
-
export declare function inspectDeploymentFiles(clientOptions: Pick<VercelClientOptions, 'archive' | 'bulkRedirectsPath' | 'debug' | 'path' | 'prebuilt' | 'projectName' | 'rootDirectory' | 'vercelOutputDir'>): Promise<DeploymentFileSummary>;
|
|
17
|
+
export declare function inspectDeploymentFiles(clientOptions: Pick<VercelClientOptions, 'archive' | 'bulkRedirectsPath' | 'debug' | 'path' | 'prebuilt' | 'projectName' | 'rootDirectory' | 'servePageAtRoot' | 'vercelOutputDir'>): Promise<DeploymentFileSummary>;
|
package/dist/types.d.ts
CHANGED
|
@@ -81,6 +81,15 @@ export interface VercelClientOptions {
|
|
|
81
81
|
* This file will be included in prebuilt deployments.
|
|
82
82
|
*/
|
|
83
83
|
bulkRedirectsPath?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* When the upload is a plain HTML site with no top-level `index.html`, also
|
|
86
|
+
* send its page as `index.html`, so `/` serves it instead of a 404. Applies
|
|
87
|
+
* only with exactly one `.html` or `.htm` file, at the top level, and no
|
|
88
|
+
* `package.json`, root `middleware.js` or `middleware.ts`, or `api/` or
|
|
89
|
+
* `public/` files. Both names share one upload.
|
|
90
|
+
* Ignored for prebuilt and archived deployments.
|
|
91
|
+
*/
|
|
92
|
+
servePageAtRoot?: boolean;
|
|
84
93
|
/**
|
|
85
94
|
* When true, creates an experimental manual deployment. This mode requires
|
|
86
95
|
* that the user later continues the deployment with an API call.
|
|
@@ -111,8 +120,15 @@ export interface Deployment {
|
|
|
111
120
|
plan: string;
|
|
112
121
|
public: boolean;
|
|
113
122
|
ownerId: string;
|
|
114
|
-
readyState: 'INITIALIZING' | 'ANALYZING' | 'BUILDING' | 'DEPLOYING' | 'READY' | 'QUEUED' | 'CANCELED' | 'ERROR';
|
|
115
|
-
state?: 'INITIALIZING' | 'ANALYZING' | 'BUILDING' | 'DEPLOYING' | 'READY' | 'QUEUED' | 'CANCELED' | 'ERROR';
|
|
123
|
+
readyState: 'INITIALIZING' | 'ANALYZING' | 'BUILDING' | 'DEPLOYING' | 'READY' | 'QUEUED' | 'CANCELED' | 'ERROR' | 'BLOCKED';
|
|
124
|
+
state?: 'INITIALIZING' | 'ANALYZING' | 'BUILDING' | 'DEPLOYING' | 'READY' | 'QUEUED' | 'CANCELED' | 'ERROR' | 'BLOCKED';
|
|
125
|
+
/** Why the deployment is in its `readyState`, such as a `BLOCKED` reason. */
|
|
126
|
+
readyStateReason?: string;
|
|
127
|
+
errorLink?: string;
|
|
128
|
+
/** Set when the deployment will never build, such as a `BLOCKED` one. */
|
|
129
|
+
alwaysRefuseToBuild?: boolean;
|
|
130
|
+
/** Set when the commit author's team access blocked the deployment. */
|
|
131
|
+
seatBlock?: DeploymentSeatBlock;
|
|
116
132
|
ready?: number;
|
|
117
133
|
createdAt: number;
|
|
118
134
|
createdIn: string;
|
|
@@ -141,6 +157,11 @@ export interface Deployment {
|
|
|
141
157
|
proposedExpiration?: number;
|
|
142
158
|
undeletedAt?: number;
|
|
143
159
|
}
|
|
160
|
+
export interface DeploymentSeatBlock {
|
|
161
|
+
blockCode: 'TEAM_ACCESS_REQUIRED' | 'COMMIT_AUTHOR_REQUIRED' | (string & {});
|
|
162
|
+
userId?: string;
|
|
163
|
+
isVerified?: boolean;
|
|
164
|
+
}
|
|
144
165
|
export interface DeploymentBuild {
|
|
145
166
|
id: string;
|
|
146
167
|
use: string;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import ignore from 'ignore';
|
|
|
4
4
|
import { FetchDispatcher, GetAuthHeaders, VercelClientOptions, VercelConfig } from '../types';
|
|
5
5
|
type Ignore = ReturnType<typeof ignore>;
|
|
6
6
|
export declare const API_FILES = "/v2/files";
|
|
7
|
-
declare const EVENTS_ARRAY: readonly ["hashes-calculated", "file-count", "file-uploaded", "all-files-uploaded", "created", "building", "ready", "alias-assigned", "warning", "error", "notice", "tip", "canceled", "checks-registered", "checks-completed", "checks-running", "checks-conclusion-succeeded", "checks-conclusion-failed", "checks-conclusion-skipped", "checks-conclusion-canceled", "checks-v2-failed"];
|
|
7
|
+
declare const EVENTS_ARRAY: readonly ["hashes-calculated", "file-count", "file-uploaded", "all-files-uploaded", "created", "building", "ready", "alias-assigned", "warning", "error", "notice", "tip", "canceled", "blocked", "checks-registered", "checks-completed", "checks-running", "checks-conclusion-succeeded", "checks-conclusion-failed", "checks-conclusion-skipped", "checks-conclusion-canceled", "checks-v2-failed"];
|
|
8
8
|
export type DeploymentEventType = (typeof EVENTS_ARRAY)[number];
|
|
9
|
-
export declare const EVENTS: Set<"alias-assigned" | "error" | "hashes-calculated" | "file-count" | "file-uploaded" | "all-files-uploaded" | "created" | "building" | "ready" | "warning" | "notice" | "tip" | "canceled" | "checks-registered" | "checks-completed" | "checks-running" | "checks-conclusion-succeeded" | "checks-conclusion-failed" | "checks-conclusion-skipped" | "checks-conclusion-canceled" | "checks-v2-failed">;
|
|
9
|
+
export declare const EVENTS: Set<"alias-assigned" | "error" | "hashes-calculated" | "file-count" | "file-uploaded" | "all-files-uploaded" | "created" | "building" | "ready" | "warning" | "notice" | "tip" | "canceled" | "blocked" | "checks-registered" | "checks-completed" | "checks-running" | "checks-conclusion-succeeded" | "checks-conclusion-failed" | "checks-conclusion-skipped" | "checks-conclusion-canceled" | "checks-v2-failed">;
|
|
10
10
|
export declare function getApiDeploymentsUrl(): string;
|
|
11
11
|
export declare function parseVercelConfig(filePath?: string): Promise<VercelConfig>;
|
|
12
12
|
export declare function buildFileTree(path: string | string[], { isDirectory, prebuilt, vercelOutputDir, rootDirectory, projectName, bulkRedirectsPath, }: Pick<VercelClientOptions, 'isDirectory' | 'prebuilt' | 'vercelOutputDir' | 'rootDirectory' | 'projectName' | 'bulkRedirectsPath'>, debug: Debug): Promise<{
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Deployment, DeploymentBuild } from '../types';
|
|
2
2
|
export declare const isReady: ({ readyState, state, }: Deployment | DeploymentBuild) => boolean;
|
|
3
3
|
export declare const isFailed: ({ readyState, state, }: Deployment | DeploymentBuild) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* A `BLOCKED` deployment never builds (for example, the commit author lacks
|
|
6
|
+
* team access). It is final, but it is not a build failure.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isBlocked: ({ readyState, state, }: Deployment | DeploymentBuild) => boolean;
|
|
4
9
|
export declare const isDone: (buildOrDeployment: Deployment | DeploymentBuild) => boolean;
|
|
5
10
|
export declare const isAliasAssigned: (deployment: Deployment) => boolean;
|
|
6
11
|
export declare const isAliasError: (deployment: Deployment) => boolean;
|
|
@@ -20,6 +20,7 @@ var ready_state_exports = {};
|
|
|
20
20
|
__export(ready_state_exports, {
|
|
21
21
|
isAliasAssigned: () => isAliasAssigned,
|
|
22
22
|
isAliasError: () => isAliasError,
|
|
23
|
+
isBlocked: () => isBlocked,
|
|
23
24
|
isDone: () => isDone,
|
|
24
25
|
isFailed: () => isFailed,
|
|
25
26
|
isReady: () => isReady
|
|
@@ -41,13 +42,18 @@ const isFailed = ({
|
|
|
41
42
|
}
|
|
42
43
|
return state.endsWith("_ERROR") || state === "ERROR";
|
|
43
44
|
};
|
|
44
|
-
const
|
|
45
|
+
const isBlocked = ({
|
|
46
|
+
readyState,
|
|
47
|
+
state
|
|
48
|
+
}) => readyState === "BLOCKED" || state === "BLOCKED";
|
|
49
|
+
const isDone = (buildOrDeployment) => isReady(buildOrDeployment) || isFailed(buildOrDeployment) || isBlocked(buildOrDeployment);
|
|
45
50
|
const isAliasAssigned = (deployment) => Boolean(deployment.aliasAssigned);
|
|
46
51
|
const isAliasError = (deployment) => Boolean(deployment.aliasError);
|
|
47
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
53
|
0 && (module.exports = {
|
|
49
54
|
isAliasAssigned,
|
|
50
55
|
isAliasError,
|
|
56
|
+
isBlocked,
|
|
51
57
|
isDone,
|
|
52
58
|
isFailed,
|
|
53
59
|
isReady
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/client",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.12.1-snapshot-23cc3b13430e",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"homepage": "https://vercel.com",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"tar-fs": "1.16.3",
|
|
40
40
|
"@vercel/error-utils": "2.2.1",
|
|
41
41
|
"@vercel/routing-utils": "6.6.1",
|
|
42
|
-
"@vercel/build-utils": "15.
|
|
42
|
+
"@vercel/build-utils": "15.4.0-snapshot-23cc3b13430e"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "node ../../utils/build.mjs",
|