@vercel/client 12.4.11 → 12.5.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.
@@ -12,14 +12,14 @@ const utils_2 = require("./utils");
12
12
  /* eslint-disable */
13
13
  async function* checkDeploymentStatus(deployment, clientOptions) {
14
14
  const { token, teamId, apiUrl, userAgent } = clientOptions;
15
- const debug = utils_2.createDebug(clientOptions.debug);
15
+ const debug = (0, utils_2.createDebug)(clientOptions.debug);
16
16
  let deploymentState = deployment;
17
- const apiDeployments = utils_1.getApiDeploymentsUrl({
17
+ const apiDeployments = (0, utils_1.getApiDeploymentsUrl)({
18
18
  builds: deployment.builds,
19
19
  functions: deployment.functions,
20
20
  });
21
21
  // If the deployment is ready, we don't want any of this to run
22
- if (ready_state_1.isDone(deploymentState) && ready_state_1.isAliasAssigned(deploymentState)) {
22
+ if ((0, ready_state_1.isDone)(deploymentState) && (0, ready_state_1.isAliasAssigned)(deploymentState)) {
23
23
  debug(`Deployment is already READY and aliases are assigned. Not running status checks`);
24
24
  return;
25
25
  }
@@ -29,7 +29,7 @@ async function* checkDeploymentStatus(deployment, clientOptions) {
29
29
  const startTime = Date.now();
30
30
  while (true) {
31
31
  // Deployment polling
32
- const deploymentData = await utils_1.fetch(`${apiDeployments}/${deployment.id || deployment.deploymentId}${teamId ? `?teamId=${teamId}` : ''}`, token, { apiUrl, userAgent });
32
+ const deploymentData = await (0, utils_1.fetch)(`${apiDeployments}/${deployment.id || deployment.deploymentId}${teamId ? `?teamId=${teamId}` : ''}`, token, { apiUrl, userAgent, agent: clientOptions.agent });
33
33
  const deploymentUpdate = await deploymentData.json();
34
34
  if (deploymentUpdate.error) {
35
35
  debug('Deployment status check has errorred');
@@ -47,7 +47,7 @@ async function* checkDeploymentStatus(deployment, clientOptions) {
47
47
  finishedEvents.add('canceled');
48
48
  yield { type: 'canceled', payload: deploymentUpdate };
49
49
  }
50
- if (ready_state_1.isReady(deploymentUpdate) && !finishedEvents.has('ready')) {
50
+ if ((0, ready_state_1.isReady)(deploymentUpdate) && !finishedEvents.has('ready')) {
51
51
  debug('Deployment state changed to READY');
52
52
  finishedEvents.add('ready');
53
53
  yield { type: 'ready', payload: deploymentUpdate };
@@ -89,26 +89,26 @@ async function* checkDeploymentStatus(deployment, clientOptions) {
89
89
  yield { type: 'checks-running', payload: deploymentUpdate };
90
90
  }
91
91
  }
92
- if (ready_state_1.isAliasAssigned(deploymentUpdate)) {
92
+ if ((0, ready_state_1.isAliasAssigned)(deploymentUpdate)) {
93
93
  debug('Deployment alias assigned');
94
94
  return yield { type: 'alias-assigned', payload: deploymentUpdate };
95
95
  }
96
- if (ready_state_1.isAliasError(deploymentUpdate)) {
96
+ if ((0, ready_state_1.isAliasError)(deploymentUpdate)) {
97
97
  return yield { type: 'error', payload: deploymentUpdate.aliasError };
98
98
  }
99
99
  if (deploymentUpdate.readyState === 'ERROR' &&
100
100
  deploymentUpdate.errorCode === 'BUILD_FAILED') {
101
101
  return yield { type: 'error', payload: deploymentUpdate };
102
102
  }
103
- if (ready_state_1.isFailed(deploymentUpdate)) {
103
+ if ((0, ready_state_1.isFailed)(deploymentUpdate)) {
104
104
  return yield {
105
105
  type: 'error',
106
106
  payload: deploymentUpdate.error || deploymentUpdate,
107
107
  };
108
108
  }
109
109
  const elapsed = Date.now() - startTime;
110
- const duration = get_polling_delay_1.getPollingDelay(elapsed);
111
- await sleep_promise_1.default(duration);
110
+ const duration = (0, get_polling_delay_1.getPollingDelay)(elapsed);
111
+ await (0, sleep_promise_1.default)(duration);
112
112
  }
113
113
  }
114
114
  exports.checkDeploymentStatus = checkDeploymentStatus;
@@ -15,7 +15,7 @@ const zlib_1 = require("zlib");
15
15
  function buildCreateDeployment() {
16
16
  return async function* createDeployment(clientOptions, deploymentOptions = {}) {
17
17
  const { path } = clientOptions;
18
- const debug = utils_1.createDebug(clientOptions.debug);
18
+ const debug = (0, utils_1.createDebug)(clientOptions.debug);
19
19
  debug('Creating deployment...');
20
20
  if (typeof path !== 'string' && !Array.isArray(path)) {
21
21
  debug(`Error: 'path' is expected to be a string or an array. Received ${typeof path}`);
@@ -32,10 +32,10 @@ function buildCreateDeployment() {
32
32
  });
33
33
  }
34
34
  clientOptions.isDirectory =
35
- !Array.isArray(path) && fs_extra_1.lstatSync(path).isDirectory();
35
+ !Array.isArray(path) && (0, fs_extra_1.lstatSync)(path).isDirectory();
36
36
  if (Array.isArray(path)) {
37
37
  for (const filePath of path) {
38
- if (!path_1.isAbsolute(filePath)) {
38
+ if (!(0, path_1.isAbsolute)(filePath)) {
39
39
  throw new errors_1.DeploymentError({
40
40
  code: 'invalid_path',
41
41
  message: `Provided path ${filePath} is not absolute`,
@@ -43,7 +43,7 @@ function buildCreateDeployment() {
43
43
  }
44
44
  }
45
45
  }
46
- else if (!path_1.isAbsolute(path)) {
46
+ else if (!(0, path_1.isAbsolute)(path)) {
47
47
  throw new errors_1.DeploymentError({
48
48
  code: 'invalid_path',
49
49
  message: `Provided path ${path} is not absolute`,
@@ -58,7 +58,7 @@ function buildCreateDeployment() {
58
58
  else {
59
59
  debug(`Provided 'path' is a single file`);
60
60
  }
61
- const { fileList } = await utils_1.buildFileTree(path, clientOptions, debug);
61
+ const { fileList } = await (0, utils_1.buildFileTree)(path, clientOptions, debug);
62
62
  // This is a useful warning because it prevents people
63
63
  // from getting confused about a deployment that renders 404.
64
64
  if (fileList.length === 0) {
@@ -75,16 +75,16 @@ function buildCreateDeployment() {
75
75
  debug('Packing tarball');
76
76
  const tarStream = tar_fs_1.default
77
77
  .pack(workPath, {
78
- entries: fileList.map(file => path_1.relative(workPath, file)),
78
+ entries: fileList.map(file => (0, path_1.relative)(workPath, file)),
79
79
  })
80
- .pipe(zlib_1.createGzip());
81
- const tarBuffer = await build_utils_1.streamToBuffer(tarStream);
80
+ .pipe((0, zlib_1.createGzip)());
81
+ const tarBuffer = await (0, build_utils_1.streamToBuffer)(tarStream);
82
82
  debug('Packed tarball');
83
83
  files = new Map([
84
84
  [
85
- hashes_1.hash(tarBuffer),
85
+ (0, hashes_1.hash)(tarBuffer),
86
86
  {
87
- names: [path_1.join(workPath, '.vercel/source.tgz')],
87
+ names: [(0, path_1.join)(workPath, '.vercel/source.tgz')],
88
88
  data: tarBuffer,
89
89
  mode: 0o666,
90
90
  },
@@ -92,10 +92,10 @@ function buildCreateDeployment() {
92
92
  ]);
93
93
  }
94
94
  else {
95
- files = await hashes_1.hashes(fileList);
95
+ files = await (0, hashes_1.hashes)(fileList);
96
96
  }
97
97
  debug(`Yielding a 'hashes-calculated' event with ${files.size} hashes`);
98
- yield { type: 'hashes-calculated', payload: hashes_1.mapToObject(files) };
98
+ yield { type: 'hashes-calculated', payload: (0, hashes_1.mapToObject)(files) };
99
99
  if (clientOptions.apiUrl) {
100
100
  debug(`Using provided API URL: ${clientOptions.apiUrl}`);
101
101
  }
@@ -105,7 +105,7 @@ function buildCreateDeployment() {
105
105
  debug(`Setting platform version to harcoded value 2`);
106
106
  deploymentOptions.version = 2;
107
107
  debug(`Creating the deployment and starting upload...`);
108
- for await (const event of upload_1.upload(files, clientOptions, deploymentOptions)) {
108
+ for await (const event of (0, upload_1.upload)(files, clientOptions, deploymentOptions)) {
109
109
  debug(`Yielding a '${event.type}' event`);
110
110
  yield event;
111
111
  }
package/dist/deploy.js CHANGED
@@ -6,12 +6,12 @@ const ready_state_1 = require("./utils/ready-state");
6
6
  const check_deployment_status_1 = require("./check-deployment-status");
7
7
  const utils_1 = require("./utils");
8
8
  async function* postDeployment(files, clientOptions, deploymentOptions) {
9
- const debug = utils_1.createDebug(clientOptions.debug);
10
- const preparedFiles = utils_1.prepareFiles(files, clientOptions);
11
- const apiDeployments = utils_1.getApiDeploymentsUrl(deploymentOptions);
9
+ const debug = (0, utils_1.createDebug)(clientOptions.debug);
10
+ const preparedFiles = (0, utils_1.prepareFiles)(files, clientOptions);
11
+ const apiDeployments = (0, utils_1.getApiDeploymentsUrl)(deploymentOptions);
12
12
  debug('Sending deployment creation API request');
13
13
  try {
14
- const response = await utils_1.fetch(`${apiDeployments}${query_string_1.generateQueryString(clientOptions)}`, clientOptions.token, {
14
+ const response = await (0, utils_1.fetch)(`${apiDeployments}${(0, query_string_1.generateQueryString)(clientOptions)}`, clientOptions.token, {
15
15
  method: 'POST',
16
16
  headers: {
17
17
  Accept: 'application/json',
@@ -23,6 +23,7 @@ async function* postDeployment(files, clientOptions, deploymentOptions) {
23
23
  }),
24
24
  apiUrl: clientOptions.apiUrl,
25
25
  userAgent: clientOptions.userAgent,
26
+ agent: clientOptions.agent,
26
27
  });
27
28
  const deployment = await response.json();
28
29
  if (clientOptions.debug) {
@@ -61,7 +62,7 @@ async function* postDeployment(files, clientOptions, deploymentOptions) {
61
62
  }
62
63
  }
63
64
  function getDefaultName(files, clientOptions) {
64
- const debug = utils_1.createDebug(clientOptions.debug);
65
+ const debug = (0, utils_1.createDebug)(clientOptions.debug);
65
66
  const { isDirectory, path } = clientOptions;
66
67
  if (isDirectory && typeof path === 'string') {
67
68
  debug('Provided path is a directory. Using last segment as default name');
@@ -74,7 +75,7 @@ function getDefaultName(files, clientOptions) {
74
75
  }
75
76
  }
76
77
  async function* deploy(files, clientOptions, deploymentOptions) {
77
- const debug = utils_1.createDebug(clientOptions.debug);
78
+ const debug = (0, utils_1.createDebug)(clientOptions.debug);
78
79
  // Check if we should default to a static deployment
79
80
  if (!deploymentOptions.name) {
80
81
  deploymentOptions.version = 2;
@@ -108,7 +109,7 @@ async function* deploy(files, clientOptions, deploymentOptions) {
108
109
  return yield { type: 'error', payload: e };
109
110
  }
110
111
  if (deployment) {
111
- if (ready_state_1.isReady(deployment) && ready_state_1.isAliasAssigned(deployment)) {
112
+ if ((0, ready_state_1.isReady)(deployment) && (0, ready_state_1.isAliasAssigned)(deployment)) {
112
113
  debug('Deployment state changed to READY 3');
113
114
  yield { type: 'ready', payload: deployment };
114
115
  debug('Deployment alias assigned');
@@ -116,7 +117,7 @@ async function* deploy(files, clientOptions, deploymentOptions) {
116
117
  }
117
118
  try {
118
119
  debug('Waiting for deployment to be ready...');
119
- for await (const event of check_deployment_status_1.checkDeploymentStatus(deployment, clientOptions)) {
120
+ for await (const event of (0, check_deployment_status_1.checkDeploymentStatus)(deployment, clientOptions)) {
120
121
  yield event;
121
122
  }
122
123
  }
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -18,6 +22,6 @@ const create_deployment_1 = __importDefault(require("./create-deployment"));
18
22
  var index_1 = require("./utils/index");
19
23
  Object.defineProperty(exports, "getVercelIgnore", { enumerable: true, get: function () { return index_1.getVercelIgnore; } });
20
24
  Object.defineProperty(exports, "buildFileTree", { enumerable: true, get: function () { return index_1.buildFileTree; } });
21
- exports.createDeployment = create_deployment_1.default();
25
+ exports.createDeployment = (0, create_deployment_1.default)();
22
26
  __exportStar(require("./errors"), exports);
23
27
  __exportStar(require("./types"), exports);
package/dist/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ import type { Agent } from 'http';
1
3
  import type { Builder, BuilderFunctions, Images, ProjectSettings, Cron } from '@vercel/build-utils';
2
4
  import type { Header, Route, Redirect, Rewrite } from '@vercel/routing-utils';
3
5
  export { DeploymentEventType } from './utils';
@@ -5,7 +7,7 @@ export interface Dictionary<T> {
5
7
  [key: string]: T;
6
8
  }
7
9
  export declare const VALID_ARCHIVE_FORMATS: readonly ["tgz"];
8
- export declare type ArchiveFormat = typeof VALID_ARCHIVE_FORMATS[number];
10
+ export type ArchiveFormat = typeof VALID_ARCHIVE_FORMATS[number];
9
11
  export interface VercelClientOptions {
10
12
  token: string;
11
13
  path: string | string[];
@@ -21,11 +23,12 @@ export interface VercelClientOptions {
21
23
  isDirectory?: boolean;
22
24
  skipAutoDetectionConfirmation?: boolean;
23
25
  archive?: ArchiveFormat;
26
+ agent?: Agent;
24
27
  }
25
28
  /** @deprecated Use VercelClientOptions instead. */
26
- export declare type NowClientOptions = VercelClientOptions;
29
+ export type NowClientOptions = VercelClientOptions;
27
30
  /** @deprecated Use VercelConfig instead. */
28
- export declare type NowConfig = VercelConfig;
31
+ export type NowConfig = VercelConfig;
29
32
  export interface Deployment {
30
33
  id: string;
31
34
  deploymentId?: string;
package/dist/upload.js CHANGED
@@ -28,14 +28,14 @@ const isClientNetworkError = (err) => {
28
28
  };
29
29
  async function* upload(files, clientOptions, deploymentOptions) {
30
30
  const { token, teamId, apiUrl, userAgent } = clientOptions;
31
- const debug = utils_1.createDebug(clientOptions.debug);
31
+ const debug = (0, utils_1.createDebug)(clientOptions.debug);
32
32
  if (!files && !token && !teamId) {
33
33
  debug(`Neither 'files', 'token' nor 'teamId are present. Exiting`);
34
34
  return;
35
35
  }
36
36
  let shas = [];
37
37
  debug('Determining necessary files for upload...');
38
- for await (const event of deploy_1.deploy(files, clientOptions, deploymentOptions)) {
38
+ for await (const event of (0, deploy_1.deploy)(files, clientOptions, deploymentOptions)) {
39
39
  if (event.type === 'error') {
40
40
  if (event.payload.code === 'missing_files') {
41
41
  shas = event.payload.missing;
@@ -64,12 +64,12 @@ async function* upload(files, clientOptions, deploymentOptions) {
64
64
  const uploadList = {};
65
65
  debug('Building an upload list...');
66
66
  const semaphore = new async_sema_1.Sema(50, { capacity: 50 });
67
- const agent = apiUrl?.startsWith('https://')
67
+ const defaultAgent = apiUrl?.startsWith('https://')
68
68
  ? new https_1.default.Agent({ keepAlive: true })
69
69
  : new http_1.default.Agent({ keepAlive: true });
70
70
  shas.forEach((sha, index) => {
71
71
  const uploadProgress = uploads[index];
72
- uploadList[sha] = async_retry_1.default(async (bail) => {
72
+ uploadList[sha] = (0, async_retry_1.default)(async (bail) => {
73
73
  const file = files.get(sha);
74
74
  if (!file) {
75
75
  debug(`File ${sha} is undefined. Bailing`);
@@ -102,8 +102,8 @@ async function* upload(files, clientOptions, deploymentOptions) {
102
102
  let err;
103
103
  let result;
104
104
  try {
105
- const res = await utils_1.fetch(utils_1.API_FILES, token, {
106
- agent,
105
+ const res = await (0, utils_1.fetch)(utils_1.API_FILES, token, {
106
+ agent: clientOptions.agent || defaultAgent,
107
107
  method: 'POST',
108
108
  headers: {
109
109
  'Content-Type': 'application/octet-stream',
@@ -175,7 +175,7 @@ async function* upload(files, clientOptions, deploymentOptions) {
175
175
  yield { type: 'all-files-uploaded', payload: files };
176
176
  try {
177
177
  debug('Starting deployment creation');
178
- for await (const event of deploy_1.deploy(files, clientOptions, deploymentOptions)) {
178
+ for await (const event of (0, deploy_1.deploy)(files, clientOptions, deploymentOptions)) {
179
179
  if (event.type === 'alias-assigned') {
180
180
  debug('Deployment is ready');
181
181
  return yield event;
@@ -7,5 +7,5 @@ exports.nodeFetch = exports.zeitFetch = void 0;
7
7
  const node_fetch_1 = __importDefault(require("node-fetch"));
8
8
  exports.nodeFetch = node_fetch_1.default;
9
9
  const fetch_1 = __importDefault(require("@zeit/fetch"));
10
- const zeitFetch = fetch_1.default(node_fetch_1.default);
10
+ const zeitFetch = (0, fetch_1.default)(node_fetch_1.default);
11
11
  exports.zeitFetch = zeitFetch;
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getPollingDelay = void 0;
7
7
  const ms_1 = __importDefault(require("ms"));
8
8
  function getPollingDelay(elapsed) {
9
- if (elapsed <= ms_1.default('15s')) {
10
- return ms_1.default('1s');
9
+ if (elapsed <= (0, ms_1.default)('15s')) {
10
+ return (0, ms_1.default)('1s');
11
11
  }
12
- if (elapsed <= ms_1.default('1m')) {
13
- return ms_1.default('5s');
12
+ if (elapsed <= (0, ms_1.default)('1m')) {
13
+ return (0, ms_1.default)('5s');
14
14
  }
15
- if (elapsed <= ms_1.default('5m')) {
16
- return ms_1.default('15s');
15
+ if (elapsed <= (0, ms_1.default)('5m')) {
16
+ return (0, ms_1.default)('15s');
17
17
  }
18
- return ms_1.default('30s');
18
+ return (0, ms_1.default)('30s');
19
19
  }
20
20
  exports.getPollingDelay = getPollingDelay;
@@ -4,7 +4,7 @@ export interface DeploymentFile {
4
4
  data?: Buffer;
5
5
  mode: number;
6
6
  }
7
- export declare type FilesMap = Map<string | undefined, DeploymentFile>;
7
+ export type FilesMap = Map<string | undefined, DeploymentFile>;
8
8
  /**
9
9
  * Computes a hash for the given buf.
10
10
  *
@@ -14,7 +14,7 @@ const async_sema_1 = require("async-sema");
14
14
  * @return {String} hex digest
15
15
  */
16
16
  function hash(buf) {
17
- return crypto_1.createHash('sha1').update(buf).digest('hex');
17
+ return (0, crypto_1.createHash)('sha1').update(buf).digest('hex');
18
18
  }
19
19
  exports.hash = hash;
20
20
  /**
@@ -2,10 +2,10 @@ import { FilesMap } from './hashes';
2
2
  import { FetchOptions } from '@zeit/fetch';
3
3
  import ignore from 'ignore';
4
4
  import { VercelClientOptions, DeploymentOptions, VercelConfig } from '../types';
5
- declare type Ignore = ReturnType<typeof ignore>;
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
- export declare type DeploymentEventType = typeof EVENTS_ARRAY[number];
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
10
  export declare function getApiDeploymentsUrl(metadata?: Pick<DeploymentOptions, 'builds' | 'functions'>): "/v10/deployments" | "/v13/deployments";
11
11
  export declare function parseVercelConfig(filePath?: string): Promise<VercelConfig>;
@@ -26,7 +26,7 @@ interface FetchOpts extends FetchOptions {
26
26
  };
27
27
  userAgent?: string;
28
28
  }
29
- export declare const fetch: (url: string, token: string, opts?: FetchOpts, debugEnabled?: boolean | undefined, useNodeFetch?: boolean | undefined) => Promise<any>;
29
+ export declare const fetch: (url: string, token: string, opts?: FetchOpts, debugEnabled?: boolean, useNodeFetch?: boolean) => Promise<any>;
30
30
  export interface PreparedFile {
31
31
  file: string;
32
32
  sha?: string;
@@ -35,5 +35,5 @@ export interface PreparedFile {
35
35
  }
36
36
  export declare const prepareFiles: (files: FilesMap, clientOptions: VercelClientOptions) => PreparedFile[];
37
37
  export declare function createDebug(debug?: boolean): (...logs: string[]) => void;
38
- declare type Debug = ReturnType<typeof createDebug>;
38
+ type Debug = ReturnType<typeof createDebug>;
39
39
  export {};
@@ -53,7 +53,7 @@ async function parseVercelConfig(filePath) {
53
53
  return {};
54
54
  }
55
55
  try {
56
- const jsonString = await fs_extra_1.readFile(filePath, 'utf8');
56
+ const jsonString = await (0, fs_extra_1.readFile)(filePath, 'utf8');
57
57
  return JSON.parse(jsonString);
58
58
  }
59
59
  catch (e) {
@@ -65,7 +65,7 @@ async function parseVercelConfig(filePath) {
65
65
  exports.parseVercelConfig = parseVercelConfig;
66
66
  const maybeRead = async function (path, default_) {
67
67
  try {
68
- return await fs_extra_1.readFile(path, 'utf8');
68
+ return await (0, fs_extra_1.readFile)(path, 'utf8');
69
69
  }
70
70
  catch (err) {
71
71
  return default_;
@@ -80,14 +80,14 @@ async function buildFileTree(path, { isDirectory, prebuilt, }, debug) {
80
80
  if (isDirectory && !Array.isArray(path)) {
81
81
  // Directory path
82
82
  const ignores = (absPath) => {
83
- const rel = path_1.relative(path, absPath);
83
+ const rel = (0, path_1.relative)(path, absPath);
84
84
  const ignored = ig.ignores(rel);
85
85
  if (ignored) {
86
86
  ignoreList.push(rel);
87
87
  }
88
88
  return ignored;
89
89
  };
90
- fileList = await readdir_recursive_1.default(path, [ignores]);
90
+ fileList = await (0, readdir_recursive_1.default)(path, [ignores]);
91
91
  debug(`Found ${fileList.length} files in the specified directory`);
92
92
  }
93
93
  else if (Array.isArray(path)) {
@@ -104,7 +104,7 @@ async function buildFileTree(path, { isDirectory, prebuilt, }, debug) {
104
104
  }
105
105
  exports.buildFileTree = buildFileTree;
106
106
  async function getVercelIgnore(cwd, prebuilt) {
107
- const ig = ignore_1.default();
107
+ const ig = (0, ignore_1.default)();
108
108
  let ignores;
109
109
  if (prebuilt) {
110
110
  const outputDir = '.vercel/output';
@@ -147,8 +147,8 @@ async function getVercelIgnore(cwd, prebuilt) {
147
147
  const cwds = Array.isArray(cwd) ? cwd : [cwd];
148
148
  const files = await Promise.all(cwds.map(async (cwd) => {
149
149
  const [vercelignore, nowignore] = await Promise.all([
150
- maybeRead(path_1.join(cwd, '.vercelignore'), ''),
151
- maybeRead(path_1.join(cwd, '.nowignore'), ''),
150
+ maybeRead((0, path_1.join)(cwd, '.vercelignore'), ''),
151
+ maybeRead((0, path_1.join)(cwd, '.nowignore'), ''),
152
152
  ]);
153
153
  if (vercelignore && nowignore) {
154
154
  throw new build_utils_1.NowBuildError({
@@ -195,8 +195,8 @@ const fetch = async (url, token, opts = {}, debugEnabled, useNodeFetch) => {
195
195
  debug(`${opts.method || 'GET'} ${url}`);
196
196
  time = Date.now();
197
197
  const res = useNodeFetch
198
- ? await fetch_1.nodeFetch(url, opts)
199
- : await fetch_1.zeitFetch(url, opts);
198
+ ? await (0, fetch_1.nodeFetch)(url, opts)
199
+ : await (0, fetch_1.zeitFetch)(url, opts);
200
200
  debug(`DONE in ${Date.now() - time}ms: ${opts.method || 'GET'} ${url}`);
201
201
  semaphore.release();
202
202
  return res;
@@ -212,7 +212,7 @@ const prepareFiles = (files, clientOptions) => {
212
212
  // Directory
213
213
  fileName =
214
214
  typeof clientOptions.path === 'string'
215
- ? path_1.relative(clientOptions.path, name)
215
+ ? (0, path_1.relative)(clientOptions.path, name)
216
216
  : name;
217
217
  }
218
218
  else {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import fs from 'fs';
3
- declare type Ignoreable = (path: string, stats: fs.Stats) => boolean;
3
+ type Ignoreable = (path: string, stats: fs.Stats) => boolean;
4
4
  export default function readdir(path: string, ignores: Ignoreable[]): Promise<string[]>;
5
5
  export {};
@@ -3,11 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAliasError = exports.isAliasAssigned = exports.isDone = exports.isFailed = exports.isReady = void 0;
4
4
  const isReady = ({ readyState, state, }) => readyState === 'READY' || state === 'READY';
5
5
  exports.isReady = isReady;
6
- const isFailed = ({ readyState, state, }) => readyState
7
- ? readyState.endsWith('_ERROR') || readyState === 'ERROR'
8
- : (state && state.endsWith('_ERROR')) || state === 'ERROR';
6
+ const isFailed = ({ readyState, state, }) => {
7
+ if (readyState) {
8
+ return readyState.endsWith('_ERROR') || readyState === 'ERROR';
9
+ }
10
+ if (!state) {
11
+ return false;
12
+ }
13
+ // TS is convinced `state` is `never`, but it's definitely a `string | undefined` entering this function
14
+ return state.endsWith('_ERROR') || state === 'ERROR';
15
+ };
9
16
  exports.isFailed = isFailed;
10
- const isDone = (buildOrDeployment) => exports.isReady(buildOrDeployment) || exports.isFailed(buildOrDeployment);
17
+ const isDone = (buildOrDeployment) => (0, exports.isReady)(buildOrDeployment) || (0, exports.isFailed)(buildOrDeployment);
11
18
  exports.isDone = isDone;
12
19
  const isAliasAssigned = (deployment) => Boolean(deployment.aliasAssigned);
13
20
  exports.isAliasAssigned = isAliasAssigned;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "12.4.11",
3
+ "version": "12.5.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "homepage": "https://vercel.com",
@@ -32,11 +32,11 @@
32
32
  "@types/node-fetch": "2.5.4",
33
33
  "@types/recursive-readdir": "2.2.0",
34
34
  "@types/tar-fs": "1.16.1",
35
- "typescript": "4.3.4"
35
+ "typescript": "4.9.5"
36
36
  },
37
37
  "dependencies": {
38
- "@vercel/build-utils": "6.7.1",
39
- "@vercel/routing-utils": "2.2.0",
38
+ "@vercel/build-utils": "6.7.2",
39
+ "@vercel/routing-utils": "2.2.1",
40
40
  "@zeit/fetch": "5.2.0",
41
41
  "async-retry": "1.2.3",
42
42
  "async-sema": "3.0.0",
@@ -49,5 +49,5 @@
49
49
  "sleep-promise": "8.0.1",
50
50
  "tar-fs": "1.16.3"
51
51
  },
52
- "gitHead": "7082da84511740ea0304b5f93b0073bbb3f3a9ed"
52
+ "gitHead": "d1d3e9384d139a06acca521348f8f9209bb3d214"
53
53
  }