vercel 51.7.0 → 52.0.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 (51) hide show
  1. package/dist/chunks/{add-HLIPDOM3.js → add-32PTAGQE.js} +4 -4
  2. package/dist/chunks/{chunk-QZ3UQIL3.js → chunk-2OPPBD5D.js} +76 -6
  3. package/dist/chunks/{chunk-YDCXNOCS.js → chunk-3Q7JX627.js} +2 -2
  4. package/dist/chunks/{chunk-YKYISUXV.js → chunk-BNSXPMDP.js} +1 -1
  5. package/dist/chunks/{chunk-HYAMHBSF.js → chunk-EG4NYQUS.js} +1 -1
  6. package/dist/chunks/{chunk-IDDYXD6T.js → chunk-FOWUL5QD.js} +1 -1
  7. package/dist/chunks/{chunk-LGSOFQRC.js → chunk-FVWOH3F3.js} +1 -1
  8. package/dist/chunks/{chunk-VNDSVCGB.js → chunk-GJEZXG32.js} +4 -4
  9. package/dist/chunks/{chunk-5QNVUXGF.js → chunk-HUUTUVP5.js} +5 -5
  10. package/dist/chunks/{chunk-6GTUL6VG.js → chunk-I5IBRE7Q.js} +2 -2
  11. package/dist/chunks/{chunk-QLO5NXAS.js → chunk-JJBN66Y6.js} +1 -1
  12. package/dist/chunks/{chunk-QO6J4DC7.js → chunk-K7R6WOLC.js} +1 -1
  13. package/dist/chunks/{chunk-T74PTRRA.js → chunk-LY3PUG7C.js} +3 -3
  14. package/dist/chunks/{chunk-L7AFYPER.js → chunk-OP4YIHHX.js} +1 -1
  15. package/dist/chunks/{chunk-IS75MWZN.js → chunk-PEB65MJA.js} +2 -2
  16. package/dist/chunks/{chunk-BXSWMI6W.js → chunk-QQWE4QMB.js} +1 -1
  17. package/dist/chunks/{chunk-BO7LOGQA.js → chunk-UC4NDDAU.js} +4 -4
  18. package/dist/chunks/{chunk-WKRF7JKF.js → chunk-US5SYA7N.js} +1 -1
  19. package/dist/chunks/{chunk-V766LKN6.js → chunk-V67XYW74.js} +1 -1
  20. package/dist/chunks/{chunk-LOUKPRIS.js → chunk-VPI2ZRPP.js} +30 -6
  21. package/dist/chunks/{chunk-LKIVGPRE.js → chunk-YLGCZTHB.js} +21 -3
  22. package/dist/chunks/{compile-vercel-config-U4OJGTLE.js → compile-vercel-config-RAC75XPY.js} +1 -1
  23. package/dist/chunks/{delete-H2OF5N72.js → delete-VBCRT33S.js} +2 -2
  24. package/dist/chunks/{disable-Z4ENND33.js → disable-4AGI6NFV.js} +2 -2
  25. package/dist/chunks/{discard-UQGHXIL4.js → discard-JUCF555L.js} +2 -2
  26. package/dist/chunks/{edit-UFYK3Z3T.js → edit-NNTNLAVV.js} +3 -3
  27. package/dist/chunks/{enable-2MEB4O5O.js → enable-DCCSTYJV.js} +2 -2
  28. package/dist/chunks/{export-T5VEXLYZ.js → export-2VCMSLPY.js} +2 -2
  29. package/dist/chunks/{inspect-7CDEJF2U.js → inspect-TGMNTP57.js} +3 -3
  30. package/dist/chunks/{list-LTDGGY5C.js → list-2EQRO64T.js} +2 -2
  31. package/dist/chunks/{list-MKMRMDWW.js → list-JQLSGKZN.js} +3 -3
  32. package/dist/chunks/{ls-GRDKWPVP.js → ls-XCMOFSVP.js} +4 -4
  33. package/dist/chunks/{publish-SMAXMKKV.js → publish-JY65X2KM.js} +2 -2
  34. package/dist/chunks/{query-WGX6PLTN.js → query-ID2PPUU6.js} +2 -2
  35. package/dist/chunks/{reorder-SQ52RGDY.js → reorder-HYBSLO2T.js} +2 -2
  36. package/dist/chunks/{restore-P6RHBBEG.js → restore-33F7XKHU.js} +2 -2
  37. package/dist/chunks/{rm-EDOGYDVM.js → rm-D4MBLVAI.js} +4 -4
  38. package/dist/chunks/{rule-inspect-GW54LGXF.js → rule-inspect-ZQQK2DV3.js} +4 -4
  39. package/dist/chunks/{rules-MCUCN322.js → rules-R2BZLO6I.js} +6 -6
  40. package/dist/chunks/{schema-CZ7B2GTS.js → schema-3G43CXHB.js} +2 -2
  41. package/dist/chunks/{update-QHI4MJ6N.js → update-MI26ZSNY.js} +4 -4
  42. package/dist/commands/build/index.js +9 -9
  43. package/dist/commands/deploy/index.js +10 -10
  44. package/dist/commands/dev/index.js +8 -8
  45. package/dist/commands/env/index.js +215 -23
  46. package/dist/commands/link/index.js +6 -6
  47. package/dist/commands/list/index.js +3 -3
  48. package/dist/commands-bulk.js +274 -89
  49. package/dist/index.js +9 -9
  50. package/dist/version.mjs +1 -1
  51. package/package.json +17 -17
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  formatEnvironment,
21
21
  validateLsArgs
22
- } from "../../chunks/chunk-BXSWMI6W.js";
22
+ } from "../../chunks/chunk-QQWE4QMB.js";
23
23
  import {
24
24
  validateJsonOutput
25
25
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "../../chunks/chunk-YPQSDAEW.js";
29
29
  import {
30
30
  getCommandAliases
31
- } from "../../chunks/chunk-QZ3UQIL3.js";
31
+ } from "../../chunks/chunk-2OPPBD5D.js";
32
32
  import "../../chunks/chunk-CRZM5WM2.js";
33
33
  import "../../chunks/chunk-BHDZCUTT.js";
34
34
  import "../../chunks/chunk-BJQTGP42.js";
@@ -38,10 +38,10 @@ import "../../chunks/chunk-DVQ4SIWF.js";
38
38
  import "../../chunks/chunk-VGWGLBUC.js";
39
39
  import {
40
40
  require_execa
41
- } from "../../chunks/chunk-HYAMHBSF.js";
41
+ } from "../../chunks/chunk-EG4NYQUS.js";
42
42
  import {
43
43
  autoInstallVercelPlugin
44
- } from "../../chunks/chunk-QO6J4DC7.js";
44
+ } from "../../chunks/chunk-K7R6WOLC.js";
45
45
  import "../../chunks/chunk-E3NE4SKN.js";
46
46
  import {
47
47
  help
@@ -56,6 +56,7 @@ import {
56
56
  getEnvRecords,
57
57
  getEnvTargetPlaceholder,
58
58
  getLinkedProject,
59
+ getTeamById,
59
60
  listSubcommand,
60
61
  param,
61
62
  parseTarget,
@@ -66,7 +67,7 @@ import {
66
67
  require_frameworks,
67
68
  runSubcommand,
68
69
  updateSubcommand
69
- } from "../../chunks/chunk-LOUKPRIS.js";
70
+ } from "../../chunks/chunk-VPI2ZRPP.js";
70
71
  import {
71
72
  TelemetryClient,
72
73
  require_dist as require_dist2
@@ -255,6 +256,29 @@ function hasOnlyWhitespaceWarnings(warnings) {
255
256
  function trimValue(value) {
256
257
  return value.replace(/\n$/, "").trim();
257
258
  }
259
+ function normalizeStdinEnvValue(value) {
260
+ let valueWithoutTrailingNewline = value;
261
+ if (value.endsWith("\r\n")) {
262
+ valueWithoutTrailingNewline = value.slice(0, -2);
263
+ } else if (value.endsWith("\n")) {
264
+ valueWithoutTrailingNewline = value.slice(0, -1);
265
+ } else {
266
+ return {
267
+ value,
268
+ strippedTrailingNewline: false
269
+ };
270
+ }
271
+ if (valueWithoutTrailingNewline.includes("\n") || valueWithoutTrailingNewline.includes("\r")) {
272
+ return {
273
+ value,
274
+ strippedTrailingNewline: false
275
+ };
276
+ }
277
+ return {
278
+ value: valueWithoutTrailingNewline,
279
+ strippedTrailingNewline: true
280
+ };
281
+ }
258
282
  function getPublicPrefix(key) {
259
283
  const upperKey = key.toUpperCase();
260
284
  return PUBLIC_PREFIXES.find((p) => upperKey.startsWith(p)) || null;
@@ -371,6 +395,11 @@ var EnvAddTelemetryClient = class extends TelemetryClient {
371
395
  this.trackCliFlag("sensitive");
372
396
  }
373
397
  }
398
+ trackCliFlagNoSensitive(noSensitive) {
399
+ if (noSensitive) {
400
+ this.trackCliFlag("no-sensitive");
401
+ }
402
+ }
374
403
  trackCliFlagForce(force) {
375
404
  if (force) {
376
405
  this.trackCliFlag("force");
@@ -390,6 +419,18 @@ var EnvAddTelemetryClient = class extends TelemetryClient {
390
419
 
391
420
  // src/commands/env/add.ts
392
421
  import { determineAgent } from "@vercel/detect-agent";
422
+ function resolveTypeForTarget(target, opts) {
423
+ if (target === "development") {
424
+ return "encrypted";
425
+ }
426
+ if (opts.forceEncrypted)
427
+ return "encrypted";
428
+ if (opts.forceSensitive)
429
+ return "sensitive";
430
+ if (opts.policyOn)
431
+ return "sensitive";
432
+ return "sensitive";
433
+ }
393
434
  function valueForNextCommand(value) {
394
435
  if (!/[\s'"\\]/.test(value))
395
436
  return value;
@@ -439,6 +480,7 @@ async function add(client, argv) {
439
480
  telemetryClient.trackCliArgumentGitBranch(envGitBranch);
440
481
  telemetryClient.trackCliOptionValue(opts["--value"]);
441
482
  telemetryClient.trackCliFlagSensitive(opts["--sensitive"]);
483
+ telemetryClient.trackCliFlagNoSensitive(opts["--no-sensitive"]);
442
484
  telemetryClient.trackCliFlagForce(opts["--force"]);
443
485
  telemetryClient.trackCliFlagGuidance(opts["--guidance"]);
444
486
  telemetryClient.trackCliFlagYes(opts["--yes"]);
@@ -797,11 +839,8 @@ async function add(client, argv) {
797
839
  }
798
840
  }
799
841
  const choices = [
800
- ...envTargetChoices.filter((c) => !existingTargets.has(c.value)),
801
- ...customEnvironments.filter((c) => !existingCustomEnvs.has(c.id)).map((c) => ({
802
- name: c.slug,
803
- value: c.id
804
- }))
842
+ ...envTargetChoices.filter((c) => !existingTargets.has(c.value)).map((c) => ({ name: c.name, value: c.value })),
843
+ ...customEnvironments.filter((c) => !existingCustomEnvs.has(c.id)).map((c) => ({ name: c.slug, value: c.id }))
805
844
  ];
806
845
  if (!envGitBranch && choices.length === 0 && !opts["--force"]) {
807
846
  output_manager_default.error(
@@ -813,10 +852,38 @@ async function add(client, argv) {
813
852
  );
814
853
  return 1;
815
854
  }
816
- let type = opts["--sensitive"] ? "sensitive" : "encrypted";
855
+ const forceSensitive = Boolean(opts["--sensitive"]);
856
+ const forceEncrypted = Boolean(opts["--no-sensitive"]);
857
+ if (forceSensitive && forceEncrypted) {
858
+ output_manager_default.error(
859
+ `--sensitive and --no-sensitive cannot be used together. Pick one.`
860
+ );
861
+ return 1;
862
+ }
863
+ let policyOn = false;
864
+ if (link.org.type === "team") {
865
+ try {
866
+ const team = await getTeamById(client, link.org.id);
867
+ policyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
868
+ } catch {
869
+ }
870
+ }
871
+ if (policyOn) {
872
+ for (const choice of choices) {
873
+ if (choice.value === "development") {
874
+ choice.disabled = "(disallowed)";
875
+ } else if (choice.value === "production" || choice.value === "preview") {
876
+ choice.checked = true;
877
+ }
878
+ }
879
+ }
817
880
  let envValue;
818
881
  if (stdInput) {
819
- envValue = stdInput;
882
+ const normalizedStdinValue = normalizeStdinEnvValue(stdInput);
883
+ envValue = normalizedStdinValue.value;
884
+ if (normalizedStdinValue.strippedTrailingNewline) {
885
+ output_manager_default.log("Removed trailing newline from stdin input");
886
+ }
820
887
  } else if (valueFromFlag !== void 0) {
821
888
  envValue = valueFromFlag;
822
889
  } else {
@@ -835,15 +902,6 @@ async function add(client, argv) {
835
902
  ]
836
903
  });
837
904
  }
838
- if (type === "encrypted") {
839
- const isSensitive = await client.input.confirm(
840
- `Your value will be encrypted. Mark as sensitive?`,
841
- false
842
- );
843
- if (isSensitive) {
844
- type = "sensitive";
845
- }
846
- }
847
905
  envValue = await client.input.password({
848
906
  message: `What's the value of ${envName}?`,
849
907
  mask: true
@@ -923,6 +981,88 @@ async function add(client, argv) {
923
981
  });
924
982
  }
925
983
  }
984
+ const hasDevelopment = envTargets.includes("development");
985
+ const hasSensitiveCapable = envTargets.some((t) => t !== "development");
986
+ if (policyOn && hasDevelopment) {
987
+ const msg = `Your team has enabled the Sensitive Environment Variables Policy and the Development Environment does not support sensitive values. https://vercel.com/docs/environment-variables/sensitive-environment-variables#environment-variables-policy`;
988
+ if (client.nonInteractive) {
989
+ outputAgentError(
990
+ client,
991
+ {
992
+ status: "error",
993
+ reason: "development_disallowed_by_team_policy",
994
+ message: msg
995
+ },
996
+ 1
997
+ );
998
+ }
999
+ output_manager_default.error(msg);
1000
+ return 1;
1001
+ }
1002
+ if (forceSensitive && hasDevelopment) {
1003
+ const msg = `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
1004
+ if (client.nonInteractive) {
1005
+ outputAgentError(
1006
+ client,
1007
+ {
1008
+ status: "error",
1009
+ reason: "sensitive_not_allowed_on_development",
1010
+ message: msg
1011
+ },
1012
+ 1
1013
+ );
1014
+ }
1015
+ output_manager_default.error(msg);
1016
+ return 1;
1017
+ }
1018
+ if (hasDevelopment && hasSensitiveCapable) {
1019
+ const msg = `Development cannot be combined with other Environments because Development does not support sensitive Environment Variables. Run ${getCommandName(
1020
+ "env add"
1021
+ )} separately for Development.`;
1022
+ if (client.nonInteractive) {
1023
+ outputAgentError(
1024
+ client,
1025
+ {
1026
+ status: "error",
1027
+ reason: "mixed_development_and_sensitive_capable_targets",
1028
+ message: msg
1029
+ },
1030
+ 1
1031
+ );
1032
+ }
1033
+ output_manager_default.error(msg);
1034
+ return 1;
1035
+ }
1036
+ let finalType = resolveTypeForTarget(
1037
+ hasDevelopment ? "development" : "production",
1038
+ { forceSensitive, forceEncrypted, policyOn }
1039
+ );
1040
+ const userWasExplicit = forceSensitive || forceEncrypted;
1041
+ const canPromptForType = !client.nonInteractive && !userWasExplicit && !policyOn && hasSensitiveCapable && !skipConfirm;
1042
+ if (canPromptForType) {
1043
+ output_manager_default.log(
1044
+ `Sensitive values cannot be retrieved later from the dashboard or CLI.`
1045
+ );
1046
+ const keepSensitive = await client.input.confirm(
1047
+ `Make it sensitive?`,
1048
+ true
1049
+ );
1050
+ if (!keepSensitive) {
1051
+ finalType = "encrypted";
1052
+ }
1053
+ }
1054
+ if (policyOn && hasSensitiveCapable) {
1055
+ if (forceEncrypted) {
1056
+ output_manager_default.warn(
1057
+ `--no-sensitive is ignored: your team enforces sensitive Environment Variables for Production and Preview.`
1058
+ );
1059
+ finalType = "sensitive";
1060
+ } else if (!userWasExplicit) {
1061
+ output_manager_default.log(
1062
+ `Your team requires sensitive Environment Variables for Production and Preview.`
1063
+ );
1064
+ }
1065
+ }
926
1066
  const upsert = opts["--force"] ? "true" : "";
927
1067
  const addStamp = stamp_default();
928
1068
  try {
@@ -931,7 +1071,7 @@ async function add(client, argv) {
931
1071
  client,
932
1072
  project.id,
933
1073
  upsert,
934
- type,
1074
+ finalType,
935
1075
  envName,
936
1076
  finalValue,
937
1077
  envTargets,
@@ -1612,6 +1752,13 @@ var EnvUpdateTelemetryClient = class extends TelemetryClient {
1612
1752
  };
1613
1753
 
1614
1754
  // src/commands/env/update.ts
1755
+ function selectedEnvTargetsDevelopment(env) {
1756
+ if (typeof env.target === "string")
1757
+ return env.target === "development";
1758
+ if (Array.isArray(env.target))
1759
+ return env.target.includes("development");
1760
+ return false;
1761
+ }
1615
1762
  async function update(client, argv) {
1616
1763
  let parsedArgs;
1617
1764
  const flagsSpecification = getFlagsSpecification(updateSubcommand.options);
@@ -1899,9 +2046,54 @@ async function update(client, argv) {
1899
2046
  });
1900
2047
  selectedEnv = matchingEnvs[selectedIndex];
1901
2048
  }
2049
+ let policyOn = false;
2050
+ if (link.org.type === "team") {
2051
+ try {
2052
+ const team = await getTeamById(client, link.org.id);
2053
+ policyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
2054
+ } catch {
2055
+ }
2056
+ }
2057
+ const selectedIsDevelopment = selectedEnvTargetsDevelopment(selectedEnv);
2058
+ if (policyOn && selectedIsDevelopment) {
2059
+ const msg = `Your team has enabled the Sensitive Environment Variables Policy and the Development Environment does not support sensitive values. https://vercel.com/docs/environment-variables/sensitive-environment-variables#environment-variables-policy`;
2060
+ if (client.nonInteractive) {
2061
+ outputAgentError(
2062
+ client,
2063
+ {
2064
+ status: "error",
2065
+ reason: "development_disallowed_by_team_policy",
2066
+ message: msg
2067
+ },
2068
+ 1
2069
+ );
2070
+ }
2071
+ output_manager_default.error(msg);
2072
+ return 1;
2073
+ }
2074
+ if (opts["--sensitive"] && selectedIsDevelopment) {
2075
+ const msg = `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
2076
+ if (client.nonInteractive) {
2077
+ outputAgentError(
2078
+ client,
2079
+ {
2080
+ status: "error",
2081
+ reason: "sensitive_not_allowed_on_development",
2082
+ message: msg
2083
+ },
2084
+ 1
2085
+ );
2086
+ }
2087
+ output_manager_default.error(msg);
2088
+ return 1;
2089
+ }
1902
2090
  let envValue;
1903
2091
  if (stdInput) {
1904
- envValue = stdInput;
2092
+ const normalizedStdinValue = normalizeStdinEnvValue(stdInput);
2093
+ envValue = normalizedStdinValue.value;
2094
+ if (normalizedStdinValue.strippedTrailingNewline) {
2095
+ output_manager_default.log("Removed trailing newline from stdin input");
2096
+ }
1905
2097
  } else if (valueFromFlag !== void 0) {
1906
2098
  envValue = valueFromFlag;
1907
2099
  } else {
@@ -11,7 +11,7 @@ import {
11
11
  addSubcommand7 as addSubcommand,
12
12
  getCommandAliases,
13
13
  linkCommand
14
- } from "../../chunks/chunk-QZ3UQIL3.js";
14
+ } from "../../chunks/chunk-2OPPBD5D.js";
15
15
  import "../../chunks/chunk-CRZM5WM2.js";
16
16
  import "../../chunks/chunk-BHDZCUTT.js";
17
17
  import "../../chunks/chunk-BJQTGP42.js";
@@ -21,12 +21,12 @@ import "../../chunks/chunk-DVQ4SIWF.js";
21
21
  import "../../chunks/chunk-VGWGLBUC.js";
22
22
  import {
23
23
  ensureLink
24
- } from "../../chunks/chunk-6GTUL6VG.js";
25
- import "../../chunks/chunk-IS75MWZN.js";
26
- import "../../chunks/chunk-LGSOFQRC.js";
24
+ } from "../../chunks/chunk-I5IBRE7Q.js";
25
+ import "../../chunks/chunk-PEB65MJA.js";
26
+ import "../../chunks/chunk-FVWOH3F3.js";
27
27
  import {
28
28
  autoInstallVercelPlugin
29
- } from "../../chunks/chunk-QO6J4DC7.js";
29
+ } from "../../chunks/chunk-K7R6WOLC.js";
30
30
  import "../../chunks/chunk-E3NE4SKN.js";
31
31
  import {
32
32
  help
@@ -36,7 +36,7 @@ import {
36
36
  addRepoLink,
37
37
  ensureRepoLink,
38
38
  getTeams
39
- } from "../../chunks/chunk-LOUKPRIS.js";
39
+ } from "../../chunks/chunk-VPI2ZRPP.js";
40
40
  import {
41
41
  TelemetryClient
42
42
  } from "../../chunks/chunk-U3WLEFHU.js";
@@ -19,11 +19,11 @@ import {
19
19
  } from "../../chunks/chunk-N45K6NXC.js";
20
20
  import {
21
21
  getScope
22
- } from "../../chunks/chunk-V766LKN6.js";
22
+ } from "../../chunks/chunk-V67XYW74.js";
23
23
  import {
24
24
  formatEnvironment,
25
25
  validateLsArgs
26
- } from "../../chunks/chunk-BXSWMI6W.js";
26
+ } from "../../chunks/chunk-QQWE4QMB.js";
27
27
  import {
28
28
  validateJsonOutput
29
29
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -41,7 +41,7 @@ import {
41
41
  getLinkedProject,
42
42
  getProjectByNameOrId,
43
43
  parseTarget
44
- } from "../../chunks/chunk-LOUKPRIS.js";
44
+ } from "../../chunks/chunk-VPI2ZRPP.js";
45
45
  import {
46
46
  TelemetryClient
47
47
  } from "../../chunks/chunk-U3WLEFHU.js";