@vercel/client 18.3.3 → 18.3.4

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/README.md CHANGED
@@ -41,6 +41,28 @@ async function deploy() {
41
41
  }
42
42
  ```
43
43
 
44
+ The optional second argument accepts deployment options, either as an object or
45
+ as a `Promise<DeploymentOptions>`. Use a promise to resolve metadata concurrently
46
+ with local file collection:
47
+
48
+ ```js
49
+ const options = readDeploymentMetadata().then(gitMetadata => ({ gitMetadata }));
50
+
51
+ for await (const event of createDeployment(
52
+ { token: process.env.TOKEN, path: '/path/to/project' },
53
+ options
54
+ )) {
55
+ // Handle deployment progress.
56
+ }
57
+ ```
58
+
59
+ Start consuming the iterator immediately after creating the promise: the async
60
+ generator begins running on its first iteration. File collection and the
61
+ `hashes-calculated` event can finish before the options resolve, but uploads and
62
+ deployment creation wait for them. If the options reject, iteration throws before
63
+ uploading or creating the deployment. If local file collection fails first, that
64
+ error is reported and a later options rejection is handled internally.
65
+
44
66
  Full list of events:
45
67
 
46
68
  ```js
@@ -1,5 +1,5 @@
1
1
  import { VercelClientOptions, DeploymentOptions, DeploymentEventType } from './types';
2
- export default function buildCreateDeployment(): (clientOptions: VercelClientOptions, deploymentOptions?: DeploymentOptions) => AsyncIterableIterator<{
2
+ export default function buildCreateDeployment(): (clientOptions: VercelClientOptions, deploymentOptions?: DeploymentOptions | Promise<DeploymentOptions>) => AsyncIterableIterator<{
3
3
  type: DeploymentEventType;
4
4
  payload: any;
5
5
  }>;
@@ -29,6 +29,9 @@ var import_errors = require("./errors");
29
29
  var import_collect_deployment_files = require("./collect-deployment-files");
30
30
  function buildCreateDeployment() {
31
31
  return async function* createDeployment(clientOptions, deploymentOptions = {}) {
32
+ const options = Promise.resolve(deploymentOptions);
33
+ void options.catch(() => {
34
+ });
32
35
  const { path } = clientOptions;
33
36
  const debug = (0, import_utils.createDebug)(clientOptions.debug);
34
37
  debug("Creating deployment...");
@@ -50,12 +53,13 @@ function buildCreateDeployment() {
50
53
  message: "The `manual` option requires `prebuilt` to be true"
51
54
  });
52
55
  }
53
- deploymentOptions.build = deploymentOptions.build || {};
54
- deploymentOptions.build.env = deploymentOptions.build.env || {};
55
- deploymentOptions.build.env.VERCEL_MANUAL_PROVISIONING = "1";
56
- deploymentOptions.version = 2;
56
+ const deploymentOptions2 = await options;
57
+ deploymentOptions2.build = deploymentOptions2.build || {};
58
+ deploymentOptions2.build.env = deploymentOptions2.build.env || {};
59
+ deploymentOptions2.build.env.VERCEL_MANUAL_PROVISIONING = "1";
60
+ deploymentOptions2.version = 2;
57
61
  debug("Creating deployment with manual provisioning...");
58
- yield* (0, import_deploy.deploy)(/* @__PURE__ */ new Map(), clientOptions, deploymentOptions);
62
+ yield* (0, import_deploy.deploy)(/* @__PURE__ */ new Map(), clientOptions, deploymentOptions2);
59
63
  return;
60
64
  }
61
65
  const { fileList, filesMap: files } = await (0, import_collect_deployment_files.collectDeploymentFiles)(
@@ -78,10 +82,11 @@ function buildCreateDeployment() {
78
82
  if (clientOptions.userAgent) {
79
83
  debug(`Using provided user agent: ${clientOptions.userAgent}`);
80
84
  }
85
+ const resolvedOptions = await options;
81
86
  debug(`Setting platform version to harcoded value 2`);
82
- deploymentOptions.version = 2;
87
+ resolvedOptions.version = 2;
83
88
  debug(`Creating the deployment and starting upload...`);
84
- for await (const event of (0, import_upload.upload)(files, clientOptions, deploymentOptions)) {
89
+ for await (const event of (0, import_upload.upload)(files, clientOptions, resolvedOptions)) {
85
90
  debug(`Yielding a '${event.type}' event`);
86
91
  yield event;
87
92
  }
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { continueDeployment } from './continue';
2
2
  export { checkDeploymentStatus } from './check-deployment-status';
3
3
  export { inspectDeploymentFiles } from './inspect-deployment-files';
4
4
  export { getVercelIgnore, buildFileTree } from './utils/index';
5
- export declare const createDeployment: (clientOptions: import("./types").VercelClientOptions, deploymentOptions?: import("./types").DeploymentOptions) => AsyncIterableIterator<{
5
+ export declare const createDeployment: (clientOptions: import("./types").VercelClientOptions, deploymentOptions?: import("./types").DeploymentOptions | Promise<import("./types").DeploymentOptions>) => AsyncIterableIterator<{
6
6
  type: import("./types").DeploymentEventType;
7
7
  payload: any;
8
8
  }>;
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Builder, BuilderFunctions, Images, ProjectSettings, Cron, Schedule, ExperimentalServices, ExperimentalServiceGroups, ExperimentalServicesV2, Services } from '@vercel/build-utils';
2
2
  import type { Header, Route, Redirect, Rewrite } from '@vercel/routing-utils';
3
- export { DeploymentEventType } from './utils';
3
+ export type { DeploymentEventType } from './utils';
4
4
  /**
5
5
  * Minimal interface of an undici `Dispatcher` (e.g. `undici.ProxyAgent`),
6
6
  * passed to `fetch` as the non-standard `dispatcher` init option to customize
package/dist/types.js CHANGED
@@ -18,17 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var types_exports = {};
20
20
  __export(types_exports, {
21
- DeploymentEventType: () => import_utils.DeploymentEventType,
22
21
  VALID_ARCHIVE_FORMATS: () => VALID_ARCHIVE_FORMATS,
23
22
  fileNameSymbol: () => fileNameSymbol
24
23
  });
25
24
  module.exports = __toCommonJS(types_exports);
26
- var import_utils = require("./utils");
27
25
  const VALID_ARCHIVE_FORMATS = ["tgz"];
28
26
  const fileNameSymbol = Symbol("fileName");
29
27
  // Annotate the CommonJS export names for ESM import in node:
30
28
  0 && (module.exports = {
31
- DeploymentEventType,
32
29
  VALID_ARCHIVE_FORMATS,
33
30
  fileNameSymbol
34
31
  });
@@ -49,7 +49,6 @@ var import_build_utils = require("@vercel/build-utils");
49
49
  var import_async_sema = require("async-sema");
50
50
  var import_fs_extra = require("fs-extra");
51
51
  var import_readdir_recursive = __toESM(require("./readdir-recursive"));
52
- var import_utils = require("@vercel/microfrontends/microfrontends/utils");
53
52
  const semaphore = new import_async_sema.Sema(10);
54
53
  const API_FILES = "/v2/files";
55
54
  const EVENTS_ARRAY = [
@@ -198,12 +197,16 @@ async function buildFileTree(path, {
198
197
  })
199
198
  );
200
199
  try {
201
- let microfrontendConfigPath = (0, import_utils.findConfig)({
200
+ const {
201
+ findConfig: findMicrofrontendsConfig,
202
+ inferMicrofrontendsLocation
203
+ } = await import("@vercel/microfrontends/microfrontends/utils");
204
+ let microfrontendConfigPath = findMicrofrontendsConfig({
202
205
  dir: (0, import_path.join)(path, rootDirectory || "")
203
206
  });
204
207
  if (!microfrontendConfigPath && !rootDirectory && projectName) {
205
- microfrontendConfigPath = (0, import_utils.findConfig)({
206
- dir: (0, import_utils.inferMicrofrontendsLocation)({
208
+ microfrontendConfigPath = findMicrofrontendsConfig({
209
+ dir: inferMicrofrontendsLocation({
207
210
  repositoryRoot: path,
208
211
  applicationName: projectName
209
212
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "18.3.3",
3
+ "version": "18.3.4",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "homepage": "https://vercel.com",
@@ -37,9 +37,9 @@
37
37
  "querystring": "^0.2.0",
38
38
  "sleep-promise": "8.0.1",
39
39
  "tar-fs": "1.16.3",
40
- "@vercel/routing-utils": "6.5.0",
40
+ "@vercel/build-utils": "14.9.3",
41
41
  "@vercel/error-utils": "2.2.1",
42
- "@vercel/build-utils": "14.9.2"
42
+ "@vercel/routing-utils": "6.5.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "node ../../utils/build.mjs",