vercel 37.0.0 → 37.1.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.
Files changed (2) hide show
  1. package/dist/index.js +182 -47
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -96679,9 +96679,10 @@ var require_esprima = __commonJS2({
96679
96679
  }
96680
96680
  });
96681
96681
 
96682
- // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.es6.js
96682
+ // ../../node_modules/.pnpm/tslib@2.6.3/node_modules/tslib/tslib.es6.mjs
96683
96683
  var tslib_es6_exports2 = {};
96684
96684
  __export3(tslib_es6_exports2, {
96685
+ __addDisposableResource: () => __addDisposableResource,
96685
96686
  __assign: () => __assign2,
96686
96687
  __asyncDelegator: () => __asyncDelegator2,
96687
96688
  __asyncGenerator: () => __asyncGenerator2,
@@ -96693,6 +96694,7 @@ __export3(tslib_es6_exports2, {
96693
96694
  __classPrivateFieldSet: () => __classPrivateFieldSet2,
96694
96695
  __createBinding: () => __createBinding2,
96695
96696
  __decorate: () => __decorate2,
96697
+ __disposeResources: () => __disposeResources,
96696
96698
  __esDecorate: () => __esDecorate,
96697
96699
  __exportStar: () => __exportStar2,
96698
96700
  __extends: () => __extends2,
@@ -96710,7 +96712,8 @@ __export3(tslib_es6_exports2, {
96710
96712
  __spread: () => __spread2,
96711
96713
  __spreadArray: () => __spreadArray,
96712
96714
  __spreadArrays: () => __spreadArrays2,
96713
- __values: () => __values2
96715
+ __values: () => __values2,
96716
+ default: () => tslib_es6_default
96714
96717
  });
96715
96718
  function __extends2(d, b) {
96716
96719
  if (typeof b !== "function" && b !== null)
@@ -96780,10 +96783,10 @@ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, e
96780
96783
  if (_ = accept(result.set))
96781
96784
  descriptor2.set = _;
96782
96785
  if (_ = accept(result.init))
96783
- initializers.push(_);
96786
+ initializers.unshift(_);
96784
96787
  } else if (_ = accept(result)) {
96785
96788
  if (kind === "field")
96786
- initializers.push(_);
96789
+ initializers.unshift(_);
96787
96790
  else
96788
96791
  descriptor2[key] = _;
96789
96792
  }
@@ -96985,16 +96988,24 @@ function __asyncGenerator2(thisArg, _arguments, generator) {
96985
96988
  if (!Symbol.asyncIterator)
96986
96989
  throw new TypeError("Symbol.asyncIterator is not defined.");
96987
96990
  var g = generator.apply(thisArg, _arguments || []), i, q2 = [];
96988
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
96991
+ return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
96989
96992
  return this;
96990
96993
  }, i;
96991
- function verb(n) {
96992
- if (g[n])
96994
+ function awaitReturn(f) {
96995
+ return function(v) {
96996
+ return Promise.resolve(v).then(f, reject);
96997
+ };
96998
+ }
96999
+ function verb(n, f) {
97000
+ if (g[n]) {
96993
97001
  i[n] = function(v) {
96994
97002
  return new Promise(function(a, b) {
96995
97003
  q2.push([n, v, a, b]) > 1 || resume(n, v);
96996
97004
  });
96997
97005
  };
97006
+ if (f)
97007
+ i[n] = f(i[n]);
97008
+ }
96998
97009
  }
96999
97010
  function resume(n, v) {
97000
97011
  try {
@@ -97094,9 +97105,66 @@ function __classPrivateFieldIn(state, receiver) {
97094
97105
  throw new TypeError("Cannot use 'in' operator on non-object");
97095
97106
  return typeof state === "function" ? receiver === state : state.has(receiver);
97096
97107
  }
97097
- var extendStatics2, __assign2, __createBinding2, __setModuleDefault;
97108
+ function __addDisposableResource(env, value, async) {
97109
+ if (value !== null && value !== void 0) {
97110
+ if (typeof value !== "object" && typeof value !== "function")
97111
+ throw new TypeError("Object expected.");
97112
+ var dispose, inner;
97113
+ if (async) {
97114
+ if (!Symbol.asyncDispose)
97115
+ throw new TypeError("Symbol.asyncDispose is not defined.");
97116
+ dispose = value[Symbol.asyncDispose];
97117
+ }
97118
+ if (dispose === void 0) {
97119
+ if (!Symbol.dispose)
97120
+ throw new TypeError("Symbol.dispose is not defined.");
97121
+ dispose = value[Symbol.dispose];
97122
+ if (async)
97123
+ inner = dispose;
97124
+ }
97125
+ if (typeof dispose !== "function")
97126
+ throw new TypeError("Object not disposable.");
97127
+ if (inner)
97128
+ dispose = function() {
97129
+ try {
97130
+ inner.call(this);
97131
+ } catch (e2) {
97132
+ return Promise.reject(e2);
97133
+ }
97134
+ };
97135
+ env.stack.push({ value, dispose, async });
97136
+ } else if (async) {
97137
+ env.stack.push({ async: true });
97138
+ }
97139
+ return value;
97140
+ }
97141
+ function __disposeResources(env) {
97142
+ function fail(e2) {
97143
+ env.error = env.hasError ? new _SuppressedError(e2, env.error, "An error was suppressed during disposal.") : e2;
97144
+ env.hasError = true;
97145
+ }
97146
+ function next() {
97147
+ while (env.stack.length) {
97148
+ var rec = env.stack.pop();
97149
+ try {
97150
+ var result = rec.dispose && rec.dispose.call(rec.value);
97151
+ if (rec.async)
97152
+ return Promise.resolve(result).then(next, function(e2) {
97153
+ fail(e2);
97154
+ return next();
97155
+ });
97156
+ } catch (e2) {
97157
+ fail(e2);
97158
+ }
97159
+ }
97160
+ if (env.hasError)
97161
+ throw env.error;
97162
+ }
97163
+ return next();
97164
+ }
97165
+ var extendStatics2, __assign2, __createBinding2, __setModuleDefault, _SuppressedError, tslib_es6_default;
97098
97166
  var init_tslib_es62 = __esm({
97099
- "../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.es6.js"() {
97167
+ "../../node_modules/.pnpm/tslib@2.6.3/node_modules/tslib/tslib.es6.mjs"() {
97100
97168
  extendStatics2 = function(d, b) {
97101
97169
  extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
97102
97170
  d2.__proto__ = b2;
@@ -97139,6 +97207,39 @@ var init_tslib_es62 = __esm({
97139
97207
  } : function(o, v) {
97140
97208
  o["default"] = v;
97141
97209
  };
97210
+ _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error3, suppressed, message2) {
97211
+ var e2 = new Error(message2);
97212
+ return e2.name = "SuppressedError", e2.error = error3, e2.suppressed = suppressed, e2;
97213
+ };
97214
+ tslib_es6_default = {
97215
+ __extends: __extends2,
97216
+ __assign: __assign2,
97217
+ __rest: __rest2,
97218
+ __decorate: __decorate2,
97219
+ __param: __param2,
97220
+ __metadata: __metadata2,
97221
+ __awaiter: __awaiter2,
97222
+ __generator: __generator2,
97223
+ __createBinding: __createBinding2,
97224
+ __exportStar: __exportStar2,
97225
+ __values: __values2,
97226
+ __read: __read2,
97227
+ __spread: __spread2,
97228
+ __spreadArrays: __spreadArrays2,
97229
+ __spreadArray,
97230
+ __await: __await2,
97231
+ __asyncGenerator: __asyncGenerator2,
97232
+ __asyncDelegator: __asyncDelegator2,
97233
+ __asyncValues: __asyncValues2,
97234
+ __makeTemplateObject: __makeTemplateObject2,
97235
+ __importStar: __importStar2,
97236
+ __importDefault: __importDefault2,
97237
+ __classPrivateFieldGet: __classPrivateFieldGet2,
97238
+ __classPrivateFieldSet: __classPrivateFieldSet2,
97239
+ __classPrivateFieldIn,
97240
+ __addDisposableResource,
97241
+ __disposeResources
97242
+ };
97142
97243
  }
97143
97244
  });
97144
97245
 
@@ -172643,11 +172744,18 @@ async function addEnvRecord(output2, client2, projectId, upsert, type, key, valu
172643
172744
  output2.debug(
172644
172745
  `${actionWord} ${type} Environment Variable ${key} to ${targets.length} targets`
172645
172746
  );
172747
+ const target = [];
172748
+ const customEnvironmentIds = [];
172749
+ for (const t of targets) {
172750
+ const arr = import_constants4.PROJECT_ENV_TARGET.includes(t) ? target : customEnvironmentIds;
172751
+ arr.push(t);
172752
+ }
172646
172753
  const body = {
172647
172754
  type,
172648
172755
  key,
172649
172756
  value,
172650
- target: targets,
172757
+ target,
172758
+ customEnvironmentIds: customEnvironmentIds.length > 0 ? customEnvironmentIds : void 0,
172651
172759
  gitBranch: gitBranch || void 0
172652
172760
  };
172653
172761
  const args2 = upsert ? `?upsert=${upsert}` : "";
@@ -172657,9 +172765,11 @@ async function addEnvRecord(output2, client2, projectId, upsert, type, key, valu
172657
172765
  body
172658
172766
  });
172659
172767
  }
172768
+ var import_constants4;
172660
172769
  var init_add_env_record = __esm({
172661
172770
  "src/util/env/add-env-record.ts"() {
172662
172771
  "use strict";
172772
+ import_constants4 = __toESM3(require_dist26());
172663
172773
  }
172664
172774
  });
172665
172775
 
@@ -172724,6 +172834,29 @@ var init_known_error = __esm({
172724
172834
  }
172725
172835
  });
172726
172836
 
172837
+ // src/util/target/get-custom-environments.ts
172838
+ async function getCustomEnvironments(client2, projectId) {
172839
+ try {
172840
+ const res = await client2.fetch(
172841
+ `/projects/${encodeURIComponent(projectId)}/custom-environments`,
172842
+ { method: "GET" }
172843
+ );
172844
+ return res.environments;
172845
+ } catch (error3) {
172846
+ if ((0, import_error_utils23.isObject)(error3) && error3.status === 404) {
172847
+ return [];
172848
+ }
172849
+ throw error3;
172850
+ }
172851
+ }
172852
+ var import_error_utils23;
172853
+ var init_get_custom_environments = __esm({
172854
+ "src/util/target/get-custom-environments.ts"() {
172855
+ "use strict";
172856
+ import_error_utils23 = __toESM3(require_dist2());
172857
+ }
172858
+ });
172859
+
172727
172860
  // src/commands/env/add.ts
172728
172861
  async function add5(client2, project, opts, args2, output2) {
172729
172862
  const stdInput = await readStandardInput(client2.stdin);
@@ -172746,32 +172879,42 @@ async function add5(client2, project, opts, args2, output2) {
172746
172879
  }
172747
172880
  let envTargets = [];
172748
172881
  if (envTargetArg) {
172749
- if (!isValidEnvTarget(envTargetArg)) {
172750
- output2.error(
172751
- `The Environment ${param(
172752
- envTargetArg
172753
- )} is invalid. It must be one of: ${getEnvTargetPlaceholder()}.`
172754
- );
172755
- return 1;
172756
- }
172757
172882
  envTargets.push(envTargetArg);
172758
172883
  }
172759
172884
  if (!envName) {
172760
172885
  envName = await client2.input.text({
172761
- message: `What\u2019s the name of the variable?`,
172886
+ message: `What's the name of the variable?`,
172762
172887
  validate: (val) => val ? true : "Name cannot be empty"
172763
172888
  });
172764
172889
  }
172765
- const { envs } = await getEnvRecords(
172766
- output2,
172767
- client2,
172768
- project.id,
172769
- "vercel-cli:env:add"
172770
- );
172771
- const existing = new Set(
172772
- envs.filter((r) => r.key === envName).map((r) => r.target)
172773
- );
172774
- const choices = envTargetChoices.filter((c) => !existing.has(c.value));
172890
+ const [{ envs }, customEnvironments] = await Promise.all([
172891
+ getEnvRecords(output2, client2, project.id, "vercel-cli:env:add"),
172892
+ getCustomEnvironments(client2, project.id)
172893
+ ]);
172894
+ const matchingEnvs = envs.filter((r) => r.key === envName);
172895
+ const existingTargets = /* @__PURE__ */ new Set();
172896
+ const existingCustomEnvs = /* @__PURE__ */ new Set();
172897
+ for (const env of matchingEnvs) {
172898
+ if (typeof env.target === "string") {
172899
+ existingTargets.add(env.target);
172900
+ } else if (Array.isArray(env.target)) {
172901
+ for (const target of env.target) {
172902
+ existingTargets.add(target);
172903
+ }
172904
+ }
172905
+ if (env.customEnvironmentIds) {
172906
+ for (const customEnvId of env.customEnvironmentIds) {
172907
+ existingCustomEnvs.add(customEnvId);
172908
+ }
172909
+ }
172910
+ }
172911
+ const choices = [
172912
+ ...envTargetChoices.filter((c) => !existingTargets.has(c.value)),
172913
+ ...customEnvironments.filter((c) => !existingCustomEnvs.has(c.id)).map((c) => ({
172914
+ name: c.name,
172915
+ value: c.id
172916
+ }))
172917
+ ];
172775
172918
  if (choices.length === 0 && !opts["--force"]) {
172776
172919
  output2.error(
172777
172920
  `The variable ${param(
@@ -172787,7 +172930,7 @@ async function add5(client2, project, opts, args2, output2) {
172787
172930
  envValue = stdInput;
172788
172931
  } else {
172789
172932
  envValue = await client2.input.text({
172790
- message: `What\u2019s the value of ${envName}?`
172933
+ message: `What's the value of ${envName}?`
172791
172934
  });
172792
172935
  }
172793
172936
  while (envTargets.length === 0) {
@@ -172853,6 +172996,7 @@ var init_add4 = __esm({
172853
172996
  init_known_error();
172854
172997
  init_pkg_name();
172855
172998
  init_errors_ts();
172999
+ init_get_custom_environments();
172856
173000
  }
172857
173001
  });
172858
173002
 
@@ -172903,20 +173047,6 @@ async function ls5(client2, project, opts, args2, output2) {
172903
173047
  }
172904
173048
  return 0;
172905
173049
  }
172906
- async function getCustomEnvironments(client2, projectId) {
172907
- try {
172908
- const res = await client2.fetch(
172909
- `/projects/${encodeURIComponent(projectId)}/custom-environments`,
172910
- { method: "GET" }
172911
- );
172912
- return res.environments;
172913
- } catch (error3) {
172914
- if ((0, import_error_utils23.isObject)(error3) && error3.status === 404) {
172915
- return [];
172916
- }
172917
- throw error3;
172918
- }
172919
- }
172920
173050
  function getTable(records, customEnvironments) {
172921
173051
  const label = records.some((env) => env.gitBranch) ? "environments (git branch)" : "environments";
172922
173052
  return formatTable(
@@ -172954,7 +173084,7 @@ function formatEnvTarget(env, customEnvironments) {
172954
173084
  const targetsString = [...defaultTargets, ...customTargets].join(", ");
172955
173085
  return env.gitBranch ? `${targetsString} (${env.gitBranch})` : targetsString;
172956
173086
  }
172957
- var import_chalk81, import_ms16, import_title4, import_error_utils23;
173087
+ var import_chalk81, import_ms16, import_title4;
172958
173088
  var init_ls5 = __esm({
172959
173089
  "src/commands/env/ls.ts"() {
172960
173090
  "use strict";
@@ -172967,7 +173097,7 @@ var init_ls5 = __esm({
172967
173097
  init_stamp();
172968
173098
  init_pkg_name();
172969
173099
  init_ellipsis();
172970
- import_error_utils23 = __toESM3(require_dist2());
173100
+ init_get_custom_environments();
172971
173101
  }
172972
173102
  });
172973
173103
 
@@ -173127,7 +173257,12 @@ var init_command11 = __esm({
173127
173257
  {
173128
173258
  name: "ls",
173129
173259
  description: "List all variables for the specified Environment",
173130
- arguments: [],
173260
+ arguments: [
173261
+ {
173262
+ name: "environment",
173263
+ required: false
173264
+ }
173265
+ ],
173131
173266
  options: [],
173132
173267
  examples: []
173133
173268
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "37.0.0",
3
+ "version": "37.1.0",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",