vercel 35.1.0 → 35.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.
Files changed (2) hide show
  1. package/dist/index.js +151 -56
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -96,7 +96,7 @@ var require_dist2 = __commonJS2({
96
96
  __export4(src_exports2, {
97
97
  errorToString: () => errorToString13,
98
98
  isErrnoException: () => isErrnoException21,
99
- isError: () => isError14,
99
+ isError: () => isError15,
100
100
  isErrorLike: () => isErrorLike,
101
101
  isObject: () => isObject,
102
102
  isSpawnError: () => isSpawnError2,
@@ -105,22 +105,22 @@ var require_dist2 = __commonJS2({
105
105
  module2.exports = __toCommonJS4(src_exports2);
106
106
  var import_node_util = __toESM4(require("util"));
107
107
  var isObject = (obj) => typeof obj === "object" && obj !== null;
108
- var isError14 = (error4) => {
108
+ var isError15 = (error4) => {
109
109
  return import_node_util.default.types.isNativeError(error4);
110
110
  };
111
111
  var isErrnoException21 = (error4) => {
112
- return isError14(error4) && "code" in error4;
112
+ return isError15(error4) && "code" in error4;
113
113
  };
114
114
  var isErrorLike = (error4) => isObject(error4) && "message" in error4;
115
115
  var errorToString13 = (error4, fallback) => {
116
- if (isError14(error4) || isErrorLike(error4))
116
+ if (isError15(error4) || isErrorLike(error4))
117
117
  return error4.message;
118
118
  if (typeof error4 === "string")
119
119
  return error4;
120
120
  return fallback ?? "An unknown error has ocurred.";
121
121
  };
122
122
  var normalizeError3 = (error4) => {
123
- if (isError14(error4))
123
+ if (isError15(error4))
124
124
  return error4;
125
125
  const errorMessage = errorToString13(error4);
126
126
  return isErrorLike(error4) ? Object.assign(new Error(errorMessage), error4) : new Error(errorMessage);
@@ -6204,7 +6204,7 @@ var require_error = __commonJS2({
6204
6204
  var require_is = __commonJS2({
6205
6205
  "../../node_modules/.pnpm/@sentry+utils@5.5.0/node_modules/@sentry/utils/dist/is.js"(exports2) {
6206
6206
  Object.defineProperty(exports2, "__esModule", { value: true });
6207
- function isError14(wat) {
6207
+ function isError15(wat) {
6208
6208
  switch (Object.prototype.toString.call(wat)) {
6209
6209
  case "[object Error]":
6210
6210
  return true;
@@ -6216,7 +6216,7 @@ var require_is = __commonJS2({
6216
6216
  return wat instanceof Error;
6217
6217
  }
6218
6218
  }
6219
- exports2.isError = isError14;
6219
+ exports2.isError = isError15;
6220
6220
  function isErrorEvent(wat) {
6221
6221
  return Object.prototype.toString.call(wat) === "[object ErrorEvent]";
6222
6222
  }
@@ -30929,10 +30929,10 @@ var require_util2 = __commonJS2({
30929
30929
  return objectToString(d) === "[object Date]";
30930
30930
  }
30931
30931
  exports2.isDate = isDate;
30932
- function isError14(e2) {
30932
+ function isError15(e2) {
30933
30933
  return objectToString(e2) === "[object Error]" || e2 instanceof Error;
30934
30934
  }
30935
- exports2.isError = isError14;
30935
+ exports2.isError = isError15;
30936
30936
  function isFunction(arg2) {
30937
30937
  return typeof arg2 === "function";
30938
30938
  }
@@ -64828,10 +64828,10 @@ var require_util4 = __commonJS2({
64828
64828
  return objectToString(d) === "[object Date]";
64829
64829
  }
64830
64830
  exports2.isDate = isDate;
64831
- function isError14(e2) {
64831
+ function isError15(e2) {
64832
64832
  return objectToString(e2) === "[object Error]" || e2 instanceof Error;
64833
64833
  }
64834
- exports2.isError = isError14;
64834
+ exports2.isError = isError15;
64835
64835
  function isFunction(arg2) {
64836
64836
  return typeof arg2 === "function";
64837
64837
  }
@@ -120569,6 +120569,48 @@ var require_frameworks = __commonJS2({
120569
120569
  }
120570
120570
  ]
120571
120571
  },
120572
+ {
120573
+ name: "FastHTML (Experimental)",
120574
+ slug: "fasthtml",
120575
+ demo: "https://fasthtml-template.vercel.app",
120576
+ logo: "https://api-frameworks.vercel.sh/framework-logos/fasthtml.svg",
120577
+ tagline: "The fastest way to create an HTML app",
120578
+ description: "A library for writing fast and scalable Starlette-powered web applications",
120579
+ website: "https://fastht.ml",
120580
+ useRuntime: { src: "main.py", use: "@vercel/python" },
120581
+ detectors: {
120582
+ every: [
120583
+ {
120584
+ path: "main.py"
120585
+ }
120586
+ ]
120587
+ },
120588
+ settings: {
120589
+ installCommand: {
120590
+ placeholder: "`pip install`"
120591
+ },
120592
+ buildCommand: {
120593
+ placeholder: "None",
120594
+ value: null
120595
+ },
120596
+ devCommand: {
120597
+ value: "uvicorn main:app --reload"
120598
+ },
120599
+ outputDirectory: {
120600
+ value: "N/A"
120601
+ }
120602
+ },
120603
+ getOutputDirName: async () => "",
120604
+ defaultRoutes: [
120605
+ {
120606
+ handle: "filesystem"
120607
+ },
120608
+ {
120609
+ src: "/(.*)",
120610
+ dest: "/main"
120611
+ }
120612
+ ]
120613
+ },
120572
120614
  {
120573
120615
  name: "Sanity",
120574
120616
  slug: "sanity",
@@ -142934,6 +142976,7 @@ async function displayRuntimeLogs(client2, options, abortController) {
142934
142976
  }
142935
142977
  const handleData = (data) => {
142936
142978
  let log3 = parse5 ? data : JSON.parse(data);
142979
+ stopSpinner();
142937
142980
  if (isRuntimeLimitDelimiter(log3)) {
142938
142981
  abortController.abort();
142939
142982
  warn(`${import_chalk44.default.bold(log3.message)}
@@ -142971,18 +143014,11 @@ async function displayRuntimeLogs(client2, options, abortController) {
142971
143014
  function printBuildLog(log2, print) {
142972
143015
  if (!log2.created)
142973
143016
  return;
142974
- let data;
142975
- data = (log2.text || "").replace(/\n$/, "").replace(/^\n/, "").replace(/\x1b\[1000D/g, "").replace(/\x1b\[0K/g, "").replace(/\x1b\[1A/g, "");
142976
- if (/warning/i.test(data)) {
142977
- data = import_chalk44.default.yellow(data);
142978
- } else if (log2.type === "stderr") {
142979
- data = import_chalk44.default.red(data);
142980
- }
142981
143017
  const date = new Date(log2.created).toISOString();
142982
- data.split("\n").forEach((line) => {
143018
+ for (const line of colorize(sanitize(log2)).split("\n")) {
142983
143019
  print(`${import_chalk44.default.dim(date)} ${line.replace("[now-builder-debug] ", "")}
142984
143020
  `);
142985
- });
143021
+ }
142986
143022
  }
142987
143023
  function isRuntimeLimitDelimiter(log2) {
142988
143024
  return log2.rowId === "" && log2.level === "error" && log2.source === "delimiter";
@@ -143043,6 +143079,25 @@ function getSourceIcon(source) {
143043
143079
  return "\u0192";
143044
143080
  return " ";
143045
143081
  }
143082
+ function sanitize(log2) {
143083
+ return (log2.text || "").replace(/\n$/, "").replace(/^\n/, "").replace(/\x1b\[1000D/g, "").replace(/\x1b\[0K/g, "").replace(/\x1b\[1A/g, "");
143084
+ }
143085
+ function colorize(text2) {
143086
+ if (isError7(text2)) {
143087
+ return import_chalk44.default.red(text2);
143088
+ }
143089
+ return isWarning(text2) ? import_chalk44.default.yellow(text2) : text2;
143090
+ }
143091
+ function isError7(text2) {
143092
+ return /^(\s+⨯\s+|\s+at\s+|npm err!)/i.test(text2) || /(^| |\[|eval|internal|range|reference|syntax|type|uri|fetch)err(or)?( |:)/i.test(
143093
+ text2
143094
+ ) || /(command not found|module not found|failed to compile|cannot open shared object file|err_pnpm_|please contact vercel.com\/help|exit code 1|elifecycle|exited)/i.test(
143095
+ text2
143096
+ );
143097
+ }
143098
+ function isWarning(text2) {
143099
+ return /^warn(ing)?(:|!)/i.test(text2) && !text2.includes("deprecationwarning");
143100
+ }
143046
143101
  var import_chalk44, import_date_fns, import_ms7, import_jsonlines2, import_split2, import_url13, runtimeLogSpinnerMessage, dateTimeFormat, moreSymbol, statusWidth;
143047
143102
  var init_logs = __esm({
143048
143103
  "src/util/logs.ts"() {
@@ -147921,7 +147976,8 @@ function sortBuilders(builds) {
147921
147976
  const frontendRuntimeSet2 = new Set(
147922
147977
  import_frameworks3.frameworkList.map((f) => f.useRuntime?.use || "@vercel/static-build")
147923
147978
  );
147924
- const toNumber = (build2) => frontendRuntimeSet2.has(build2.use) ? 0 : 1;
147979
+ frontendRuntimeSet2.delete("@vercel/python");
147980
+ const toNumber = (build2) => build2.use === "@vercel/python" ? 1 : frontendRuntimeSet2.has(build2.use) ? 0 : 2;
147925
147981
  return builds.sort((build1, build2) => {
147926
147982
  return toNumber(build1) - toNumber(build2);
147927
147983
  });
@@ -148220,6 +148276,35 @@ var init_scrub_argv = __esm({
148220
148276
  }
148221
148277
  });
148222
148278
 
148279
+ // src/util/parse-target.ts
148280
+ function parseTarget({
148281
+ output: output2,
148282
+ targetFlagName,
148283
+ targetFlagValue,
148284
+ prodFlagValue
148285
+ }) {
148286
+ if (prodFlagValue && targetFlagValue) {
148287
+ output2.warn(
148288
+ `Both \`--prod\` and \`--${targetFlagName}\` detected. Ignoring \`--prod\`.`
148289
+ );
148290
+ }
148291
+ if (targetFlagValue) {
148292
+ const lowerCaseTarget = targetFlagValue.toLowerCase();
148293
+ output2.debug(`Setting target to ${lowerCaseTarget}`);
148294
+ return lowerCaseTarget;
148295
+ }
148296
+ if (prodFlagValue) {
148297
+ output2.debug("Setting target to production");
148298
+ return "production";
148299
+ }
148300
+ return void 0;
148301
+ }
148302
+ var init_parse_target = __esm({
148303
+ "src/util/parse-target.ts"() {
148304
+ "use strict";
148305
+ }
148306
+ });
148307
+
148223
148308
  // src/commands/build/index.ts
148224
148309
  var build_exports = {};
148225
148310
  __export3(build_exports, {
@@ -148255,7 +148340,12 @@ async function main2(client2) {
148255
148340
  output2.print(help2(buildCommand, { columns: client2.stderr.columns }));
148256
148341
  return 2;
148257
148342
  }
148258
- const target = parsedArgs.flags["--prod"] ? "production" : typeof parsedArgs.flags["--target"] === "string" ? String(parsedArgs.flags["--target"]).toLowerCase() : "preview";
148343
+ const target = parseTarget({
148344
+ output: output2,
148345
+ targetFlagName: "target",
148346
+ targetFlagValue: parsedArgs.flags["--target"],
148347
+ prodFlagValue: parsedArgs.flags["--prod"]
148348
+ }) || "preview";
148259
148349
  const yes = Boolean(parsedArgs.flags["--yes"]);
148260
148350
  try {
148261
148351
  await (0, import_build_utils13.validateNpmrc)(cwd);
@@ -148545,6 +148635,15 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
148545
148635
  let buildResult;
148546
148636
  try {
148547
148637
  buildResult = await builder.build(buildOptions);
148638
+ if (buildConfig.zeroConfig && buildConfig.framework && "output" in buildResult && !buildResult.routes) {
148639
+ const framework2 = import_frameworks4.frameworkList.find(
148640
+ (f) => f.slug === buildConfig.framework
148641
+ );
148642
+ if (framework2) {
148643
+ const defaultRoutes = await getFrameworkRoutes(framework2, workPath);
148644
+ buildResult.routes = defaultRoutes;
148645
+ }
148646
+ }
148548
148647
  } finally {
148549
148648
  try {
148550
148649
  Object.assign(diagnostics, await builder.diagnostics?.(buildOptions));
@@ -148811,6 +148910,15 @@ async function writeFlagsJSON({ output: output2 }, buildResults, outputDir) {
148811
148910
  async function writeBuildJson(buildsJson, outputDir) {
148812
148911
  await import_fs_extra18.default.writeJSON((0, import_path28.join)(outputDir, "builds.json"), buildsJson, { spaces: 2 });
148813
148912
  }
148913
+ async function getFrameworkRoutes(framework, dirPrefix) {
148914
+ let routes2 = [];
148915
+ if (typeof framework.defaultRoutes === "function") {
148916
+ routes2 = await framework.defaultRoutes(dirPrefix);
148917
+ } else if (Array.isArray(framework.defaultRoutes)) {
148918
+ routes2 = framework.defaultRoutes;
148919
+ }
148920
+ return routes2;
148921
+ }
148814
148922
  var import_fs_extra18, import_chalk49, import_dotenv, import_semver3, import_minimatch2, import_path28, import_frameworks4, import_build_utils13, import_fs_detectors4, import_routing_utils2, import_client8;
148815
148923
  var init_build = __esm({
148816
148924
  "src/commands/build/index.ts"() {
@@ -148850,6 +148958,7 @@ var init_build = __esm({
148850
148958
  init_command5();
148851
148959
  init_scrub_argv();
148852
148960
  init_get_flags_specification();
148961
+ init_parse_target();
148853
148962
  }
148854
148963
  });
148855
148964
 
@@ -149717,29 +149826,6 @@ var init_get_prebuilt_json = __esm({
149717
149826
  }
149718
149827
  });
149719
149828
 
149720
- // src/util/deploy/parse-target.ts
149721
- function parseTarget(output2, targetArg, prodArg) {
149722
- if (targetArg) {
149723
- if (targetArg === "production") {
149724
- output2.warn(
149725
- "We recommend using the much shorter `--prod` option instead of `--target production` (deprecated)"
149726
- );
149727
- }
149728
- output2.debug(`Setting target to ${targetArg}`);
149729
- return targetArg;
149730
- }
149731
- if (prodArg) {
149732
- output2.debug("Setting target to production");
149733
- return "production";
149734
- }
149735
- return void 0;
149736
- }
149737
- var init_parse_target = __esm({
149738
- "src/util/deploy/parse-target.ts"() {
149739
- "use strict";
149740
- }
149741
- });
149742
-
149743
149829
  // src/util/deploy/is-deploying.ts
149744
149830
  function isDeploying(readyState) {
149745
149831
  return deploymentInProgressStates.includes(readyState);
@@ -150130,7 +150216,6 @@ var init_deploy = __esm({
150130
150216
  init_create_deploy();
150131
150217
  init_get_deployment_checks();
150132
150218
  init_get_prebuilt_json();
150133
- init_parse_target();
150134
150219
  init_print_deployment_status();
150135
150220
  init_validate_archive_format();
150136
150221
  init_purchase_domain_if_available();
@@ -150160,6 +150245,7 @@ var init_deploy = __esm({
150160
150245
  init_validate_paths();
150161
150246
  init_help();
150162
150247
  init_command7();
150248
+ init_parse_target();
150163
150249
  deploy_default = async (client2) => {
150164
150250
  const { output: output2 } = client2;
150165
150251
  let parsedArguments = null;
@@ -150239,14 +150325,12 @@ var init_deploy = __esm({
150239
150325
  `
150240
150326
  );
150241
150327
  }
150242
- const target = parseTarget(
150243
- output2,
150244
- parsedArguments.flags["--target"],
150245
- parsedArguments.flags["--prod"]
150246
- );
150247
- if (typeof target === "number") {
150248
- return target;
150249
- }
150328
+ const target = parseTarget({
150329
+ output: output2,
150330
+ targetFlagName: "target",
150331
+ targetFlagValue: parsedArguments.flags["--target"],
150332
+ prodFlagValue: parsedArguments.flags["--prod"]
150333
+ });
150250
150334
  const archive = parsedArguments.flags["--archive"];
150251
150335
  if (typeof archive === "string" && !isValidArchive(archive)) {
150252
150336
  output2.error(`Format must be one of: ${import_client10.VALID_ARCHIVE_FORMATS.join(", ")}`);
@@ -173307,7 +173391,11 @@ async function main6(client2) {
173307
173391
  const subArgs = argv2._.slice(1);
173308
173392
  const { subcommand: subcommand2, args: args2 } = getSubcommand(subArgs, COMMAND_CONFIG6);
173309
173393
  const { cwd, output: output2, config: config3 } = client2;
173310
- const target = argv2["--environment"]?.toLowerCase() || "development";
173394
+ const target = parseTarget({
173395
+ output: output2,
173396
+ targetFlagName: "environment",
173397
+ targetFlagValue: argv2["--environment"]
173398
+ }) || "development";
173311
173399
  if (!isValidEnvTarget(target)) {
173312
173400
  output2.error(
173313
173401
  `Invalid environment \`${import_chalk83.default.cyan(
@@ -173375,6 +173463,7 @@ var init_env = __esm({
173375
173463
  init_pull();
173376
173464
  init_rm5();
173377
173465
  init_command11();
173466
+ init_parse_target();
173378
173467
  COMMAND_CONFIG6 = {
173379
173468
  ls: ["ls", "list"],
173380
173469
  add: ["add"],
@@ -175131,7 +175220,12 @@ async function list2(client2) {
175131
175220
  }
175132
175221
  const autoConfirm = !!argv2["--yes"];
175133
175222
  const meta = parseMeta(argv2["--meta"]);
175134
- const target = argv2["--prod"] ? "production" : typeof argv2["--environment"] === "string" ? argv2["--environment"].toLowerCase() : void 0;
175223
+ const target = parseTarget({
175224
+ output: output2,
175225
+ targetFlagName: "environment",
175226
+ targetFlagValue: argv2["--environment"],
175227
+ prodFlagValue: argv2["--prod"]
175228
+ });
175135
175229
  let link4 = await getLinkedProject(client2, cwd);
175136
175230
  if (link4.status === "error") {
175137
175231
  return link4.exitCode;
@@ -175375,6 +175469,7 @@ var init_list2 = __esm({
175375
175469
  import_error_utils25 = __toESM3(require_dist2());
175376
175470
  init_help();
175377
175471
  init_command16();
175472
+ init_parse_target();
175378
175473
  }
175379
175474
  });
175380
175475
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "35.1.0",
3
+ "version": "35.2.0",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -85,8 +85,8 @@
85
85
  "@vercel-internals/types": "1.0.44",
86
86
  "@vercel/client": "13.3.3",
87
87
  "@vercel/error-utils": "2.0.2",
88
- "@vercel/frameworks": "3.0.3",
89
- "@vercel/fs-detectors": "5.2.5",
88
+ "@vercel/frameworks": "3.1.0",
89
+ "@vercel/fs-detectors": "5.2.6",
90
90
  "@vercel/routing-utils": "3.1.0",
91
91
  "@vitest/expect": "1.4.0",
92
92
  "ajv": "6.12.2",