@vercel/client 13.1.8 → 13.2.0

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.
@@ -40,10 +40,7 @@ async function* checkDeploymentStatus(deployment, clientOptions) {
40
40
  const { token, teamId, apiUrl, userAgent } = clientOptions;
41
41
  const debug = (0, import_utils2.createDebug)(clientOptions.debug);
42
42
  let deploymentState = deployment;
43
- const apiDeployments = (0, import_utils.getApiDeploymentsUrl)({
44
- builds: deployment.builds,
45
- functions: deployment.functions
46
- });
43
+ const apiDeployments = (0, import_utils.getApiDeploymentsUrl)();
47
44
  if ((0, import_ready_state.isDone)(deploymentState) && (0, import_ready_state.isAliasAssigned)(deploymentState)) {
48
45
  debug(
49
46
  `Deployment is already READY and aliases are assigned. Not running status checks`
package/dist/deploy.js CHANGED
@@ -28,7 +28,10 @@ var import_utils = require("./utils");
28
28
  async function* postDeployment(files, clientOptions, deploymentOptions) {
29
29
  const debug = (0, import_utils.createDebug)(clientOptions.debug);
30
30
  const preparedFiles = (0, import_utils.prepareFiles)(files, clientOptions);
31
- const apiDeployments = (0, import_utils.getApiDeploymentsUrl)(deploymentOptions);
31
+ const apiDeployments = (0, import_utils.getApiDeploymentsUrl)();
32
+ if (deploymentOptions?.builds && !deploymentOptions.functions) {
33
+ clientOptions.skipAutoDetectionConfirmation = true;
34
+ }
32
35
  debug("Sending deployment creation API request");
33
36
  try {
34
37
  const response = await (0, import_utils.fetch)(
package/dist/types.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface VercelClientOptions {
16
16
  apiUrl?: string;
17
17
  force?: boolean;
18
18
  prebuilt?: boolean;
19
+ vercelOutputDir?: string;
19
20
  rootDirectory?: string | null;
20
21
  withCache?: boolean;
21
22
  userAgent?: string;
@@ -1,19 +1,19 @@
1
1
  import { FilesMap } from './hashes';
2
2
  import { FetchOptions } from '@zeit/fetch';
3
3
  import ignore from 'ignore';
4
- import { VercelClientOptions, DeploymentOptions, VercelConfig } from '../types';
4
+ import { VercelClientOptions, VercelConfig } from '../types';
5
5
  type Ignore = ReturnType<typeof ignore>;
6
6
  export declare const API_FILES = "/v2/files";
7
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"];
8
8
  export type DeploymentEventType = typeof EVENTS_ARRAY[number];
9
9
  export declare const EVENTS: Set<"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">;
10
- export declare function getApiDeploymentsUrl(metadata?: Pick<DeploymentOptions, 'builds' | 'functions'>): "/v10/deployments" | "/v13/deployments";
10
+ export declare function getApiDeploymentsUrl(): string;
11
11
  export declare function parseVercelConfig(filePath?: string): Promise<VercelConfig>;
12
- export declare function buildFileTree(path: string | string[], { isDirectory, prebuilt, }: Pick<VercelClientOptions, 'isDirectory' | 'prebuilt'>, debug: Debug): Promise<{
12
+ export declare function buildFileTree(path: string | string[], { isDirectory, prebuilt, vercelOutputDir, }: Pick<VercelClientOptions, 'isDirectory' | 'prebuilt' | 'vercelOutputDir'>, debug: Debug): Promise<{
13
13
  fileList: string[];
14
14
  ignoreList: string[];
15
15
  }>;
16
- export declare function getVercelIgnore(cwd: string | string[], prebuilt?: boolean): Promise<{
16
+ export declare function getVercelIgnore(cwd: string | string[], prebuilt?: boolean, vercelOutputDir?: string): Promise<{
17
17
  ig: Ignore;
18
18
  ignores: string[];
19
19
  }>;
@@ -76,10 +76,7 @@ const EVENTS_ARRAY = [
76
76
  "checks-conclusion-canceled"
77
77
  ];
78
78
  const EVENTS = new Set(EVENTS_ARRAY);
79
- function getApiDeploymentsUrl(metadata) {
80
- if (metadata && metadata.builds && !metadata.functions) {
81
- return "/v10/deployments";
82
- }
79
+ function getApiDeploymentsUrl() {
83
80
  return "/v13/deployments";
84
81
  }
85
82
  async function parseVercelConfig(filePath) {
@@ -103,11 +100,12 @@ const maybeRead = async function(path, default_) {
103
100
  };
104
101
  async function buildFileTree(path, {
105
102
  isDirectory,
106
- prebuilt
103
+ prebuilt,
104
+ vercelOutputDir
107
105
  }, debug) {
108
106
  const ignoreList = [];
109
107
  let fileList;
110
- let { ig, ignores } = await getVercelIgnore(path, prebuilt);
108
+ let { ig, ignores } = await getVercelIgnore(path, prebuilt, vercelOutputDir);
111
109
  debug(`Found ${ignores.length} rules in .vercelignore`);
112
110
  debug("Building file tree...");
113
111
  if (isDirectory && !Array.isArray(path)) {
@@ -150,18 +148,26 @@ async function buildFileTree(path, {
150
148
  }
151
149
  return { fileList, ignoreList };
152
150
  }
153
- async function getVercelIgnore(cwd, prebuilt) {
151
+ async function getVercelIgnore(cwd, prebuilt, vercelOutputDir) {
154
152
  const ig = (0, import_ignore.default)();
155
153
  let ignores;
156
154
  if (prebuilt) {
157
- const outputDir = ".vercel/output";
155
+ if (typeof vercelOutputDir !== "string") {
156
+ throw new Error(
157
+ `Missing required \`vercelOutputDir\` parameter when "prebuilt" is true`
158
+ );
159
+ }
160
+ if (typeof cwd !== "string") {
161
+ throw new Error(`\`cwd\` must be a "string"`);
162
+ }
163
+ const relOutputDir = (0, import_path.relative)(cwd, vercelOutputDir);
158
164
  ignores = ["*"];
159
- const parts = outputDir.split("/");
165
+ const parts = relOutputDir.split(import_path.sep);
160
166
  parts.forEach((_, i) => {
161
167
  const level = parts.slice(0, i + 1).join("/");
162
168
  ignores.push(`!${level}`);
163
169
  });
164
- ignores.push(`!${outputDir}/**`);
170
+ ignores.push(`!${parts.join("/")}/**`);
165
171
  ig.add(ignores.join("\n"));
166
172
  } else {
167
173
  ignores = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "13.1.8",
3
+ "version": "13.2.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "homepage": "https://vercel.com",
@@ -30,7 +30,7 @@
30
30
  "typescript": "4.9.5"
31
31
  },
32
32
  "dependencies": {
33
- "@vercel/build-utils": "7.10.0",
33
+ "@vercel/build-utils": "7.11.0",
34
34
  "@vercel/error-utils": "2.0.2",
35
35
  "@vercel/routing-utils": "3.1.0",
36
36
  "@zeit/fetch": "5.2.0",