vercel 49.2.0 → 50.0.1

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 +183 -7
  2. package/package.json +17 -17
package/dist/index.js CHANGED
@@ -33066,6 +33066,13 @@ var init_command16 = __esm({
33066
33066
  type: Boolean,
33067
33067
  deprecated: false,
33068
33068
  description: "Prints the build logs instead of the deployment summary"
33069
+ },
33070
+ {
33071
+ name: "json",
33072
+ shorthand: null,
33073
+ type: Boolean,
33074
+ deprecated: false,
33075
+ description: "Output the deployment information as JSON"
33069
33076
  }
33070
33077
  ],
33071
33078
  examples: [
@@ -33088,6 +33095,10 @@ var init_command16 = __esm({
33088
33095
  {
33089
33096
  name: "Get deployment build logs",
33090
33097
  value: `${packageName} inspect my-deployment.vercel.app --logs`
33098
+ },
33099
+ {
33100
+ name: "Get deployment information as JSON",
33101
+ value: `${packageName} inspect my-deployment.vercel.app --json`
33091
33102
  }
33092
33103
  ]
33093
33104
  };
@@ -50046,7 +50057,7 @@ var require_package = __commonJS2({
50046
50057
  "../client/package.json"(exports2, module2) {
50047
50058
  module2.exports = {
50048
50059
  name: "@vercel/client",
50049
- version: "17.2.15",
50060
+ version: "17.2.16",
50050
50061
  main: "dist/index.js",
50051
50062
  typings: "dist/index.d.ts",
50052
50063
  homepage: "https://vercel.com",
@@ -91657,6 +91668,15 @@ var init_diff_env_files = __esm({
91657
91668
  function formatEnvValue(value) {
91658
91669
  if (value == null)
91659
91670
  return "";
91671
+ if (!/[\r\n]/.test(value)) {
91672
+ try {
91673
+ const parsed = JSON.parse(value);
91674
+ if (typeof parsed === "object" && parsed !== null) {
91675
+ return value;
91676
+ }
91677
+ } catch {
91678
+ }
91679
+ }
91660
91680
  const needsQuotes = /\s/.test(value) || value.startsWith("#") || value.startsWith('"');
91661
91681
  if (!needsQuotes)
91662
91682
  return value;
@@ -92892,6 +92912,29 @@ async function findVercelConfigFile(workPath) {
92892
92912
  }
92893
92913
  return foundFiles[0] || null;
92894
92914
  }
92915
+ function parseConfigLoaderError(stderr) {
92916
+ if (!stderr.trim()) {
92917
+ return "";
92918
+ }
92919
+ const moduleNotFoundMatch = stderr.match(
92920
+ /Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package '([^']+)'/
92921
+ );
92922
+ if (moduleNotFoundMatch) {
92923
+ const packageName2 = moduleNotFoundMatch[1];
92924
+ return `Cannot find package '${packageName2}'. Make sure it's installed in your project dependencies.`;
92925
+ }
92926
+ const syntaxErrorMatch = stderr.match(/SyntaxError: (.+?)(?:\n|$)/);
92927
+ if (syntaxErrorMatch) {
92928
+ return `Syntax error: ${syntaxErrorMatch[1]}`;
92929
+ }
92930
+ const errorMatch = stderr.match(
92931
+ /^(?:Error|TypeError|ReferenceError): (.+?)(?:\n|$)/m
92932
+ );
92933
+ if (errorMatch) {
92934
+ return errorMatch[1];
92935
+ }
92936
+ return stderr.trim();
92937
+ }
92895
92938
  async function compileVercelConfig(workPath) {
92896
92939
  const vercelJsonPath = (0, import_path12.join)(workPath, "vercel.json");
92897
92940
  const nowJsonPath = (0, import_path12.join)(workPath, "now.json");
@@ -92976,6 +93019,18 @@ async function compileVercelConfig(workPath) {
92976
93019
  const child = (0, import_child_process3.fork)(loaderPath, [tempOutPath], {
92977
93020
  stdio: ["pipe", "pipe", "pipe", "ipc"]
92978
93021
  });
93022
+ let stderrOutput = "";
93023
+ let stdoutOutput = "";
93024
+ if (child.stderr) {
93025
+ child.stderr.on("data", (data) => {
93026
+ stderrOutput += data.toString();
93027
+ });
93028
+ }
93029
+ if (child.stdout) {
93030
+ child.stdout.on("data", (data) => {
93031
+ stdoutOutput += data.toString();
93032
+ });
93033
+ }
92979
93034
  const timeout = setTimeout(() => {
92980
93035
  child.kill();
92981
93036
  reject(new Error("Config loader timed out after 10 seconds"));
@@ -92992,7 +93047,20 @@ async function compileVercelConfig(workPath) {
92992
93047
  child.on("exit", (code2) => {
92993
93048
  clearTimeout(timeout);
92994
93049
  if (code2 !== 0) {
92995
- reject(new Error(`Config loader exited with code ${code2}`));
93050
+ if (stderrOutput.trim()) {
93051
+ output_manager_default.log(stderrOutput);
93052
+ }
93053
+ if (stdoutOutput.trim()) {
93054
+ output_manager_default.log(stdoutOutput);
93055
+ }
93056
+ const parsedError = parseConfigLoaderError(stderrOutput);
93057
+ if (parsedError) {
93058
+ reject(new Error(parsedError));
93059
+ } else if (stdoutOutput.trim()) {
93060
+ reject(new Error(stdoutOutput.trim()));
93061
+ } else {
93062
+ reject(new Error(`Config loader exited with code ${code2}`));
93063
+ }
92996
93064
  }
92997
93065
  });
92998
93066
  });
@@ -134561,6 +134629,9 @@ var require_superstatic = __commonJS2({
134561
134629
  headers: { Location: loc },
134562
134630
  status: status3
134563
134631
  };
134632
+ if (typeof r.env !== "undefined") {
134633
+ route.env = r.env;
134634
+ }
134564
134635
  if (r.has) {
134565
134636
  route.has = r.has;
134566
134637
  }
@@ -134588,6 +134659,9 @@ var require_superstatic = __commonJS2({
134588
134659
  internalParamNames
134589
134660
  );
134590
134661
  const route = { src, dest, check: true };
134662
+ if (typeof r.env !== "undefined") {
134663
+ route.env = r.env;
134664
+ }
134591
134665
  if (r.has) {
134592
134666
  route.has = r.has;
134593
134667
  }
@@ -135506,7 +135580,17 @@ var require_schemas = __commonJS2({
135506
135580
  has: hasSchema,
135507
135581
  missing: hasSchema,
135508
135582
  mitigate: mitigateSchema,
135509
- transforms: transformsSchema
135583
+ transforms: transformsSchema,
135584
+ env: {
135585
+ description: "An array of environment variable names that should be replaced at runtime in the destination or headers",
135586
+ type: "array",
135587
+ minItems: 1,
135588
+ maxItems: 64,
135589
+ items: {
135590
+ type: "string",
135591
+ maxLength: 256
135592
+ }
135593
+ }
135510
135594
  }
135511
135595
  },
135512
135596
  {
@@ -135550,6 +135634,16 @@ var require_schemas = __commonJS2({
135550
135634
  type: "integer",
135551
135635
  minimum: 100,
135552
135636
  maximum: 999
135637
+ },
135638
+ env: {
135639
+ description: "An array of environment variable names that should be replaced at runtime in the destination",
135640
+ type: "array",
135641
+ minItems: 1,
135642
+ maxItems: 64,
135643
+ items: {
135644
+ type: "string",
135645
+ maxLength: 256
135646
+ }
135553
135647
  }
135554
135648
  }
135555
135649
  }
@@ -135586,7 +135680,17 @@ var require_schemas = __commonJS2({
135586
135680
  maximum: 999
135587
135681
  },
135588
135682
  has: hasSchema,
135589
- missing: hasSchema
135683
+ missing: hasSchema,
135684
+ env: {
135685
+ description: "An array of environment variable names that should be replaced at runtime in the destination",
135686
+ type: "array",
135687
+ minItems: 1,
135688
+ maxItems: 64,
135689
+ items: {
135690
+ type: "string",
135691
+ maxLength: 256
135692
+ }
135693
+ }
135590
135694
  }
135591
135695
  }
135592
135696
  };
@@ -149415,6 +149519,34 @@ async function main3(client2) {
149415
149519
  async function doBuild(client2, project, buildsJson, cwd, outputDir, span, standalone = false) {
149416
149520
  const { localConfigPath } = client2;
149417
149521
  const workPath = (0, import_path28.join)(cwd, project.settings.rootDirectory || ".");
149522
+ const sourceConfigFile = await findSourceVercelConfigFile(workPath);
149523
+ let corepackShimDir;
149524
+ if (sourceConfigFile && process.env.VERCEL_TS_CONFIG_ENABLED) {
149525
+ corepackShimDir = await initCorepack({ repoRootPath: cwd });
149526
+ const installCommand2 = project.settings.installCommand;
149527
+ if (typeof installCommand2 === "string") {
149528
+ if (installCommand2.trim()) {
149529
+ output_manager_default.log(`Running install command before config compilation...`);
149530
+ await (0, import_build_utils14.runCustomInstallCommand)({
149531
+ destPath: workPath,
149532
+ installCommand: installCommand2,
149533
+ spawnOpts: { env: process.env },
149534
+ projectCreatedAt: project.settings.createdAt
149535
+ });
149536
+ } else {
149537
+ output_manager_default.debug("Skipping empty install command");
149538
+ }
149539
+ } else {
149540
+ output_manager_default.log(`Installing dependencies before config compilation...`);
149541
+ await (0, import_build_utils14.runNpmInstall)(
149542
+ workPath,
149543
+ [],
149544
+ { env: process.env },
149545
+ void 0,
149546
+ project.settings.createdAt
149547
+ );
149548
+ }
149549
+ }
149418
149550
  const compileResult = await compileVercelConfig(workPath);
149419
149551
  const vercelConfigPath = localConfigPath || compileResult.configPath || (0, import_path28.join)(workPath, "vercel.json");
149420
149552
  const [pkg, vercelConfig, nowConfig, hasInstrumentation] = await Promise.all([
@@ -149547,7 +149679,9 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
149547
149679
  const buildResults = /* @__PURE__ */ new Map();
149548
149680
  const overrides = [];
149549
149681
  const repoRootPath = cwd;
149550
- const corepackShimDir = await initCorepack({ repoRootPath });
149682
+ if (!corepackShimDir) {
149683
+ corepackShimDir = await initCorepack({ repoRootPath });
149684
+ }
149551
149685
  const diagnostics = {};
149552
149686
  for (const build2 of sortedBuilders) {
149553
149687
  if (typeof build2.src !== "string")
@@ -179895,6 +180029,11 @@ var init_inspect3 = __esm({
179895
180029
  this.trackCliFlag("wait");
179896
180030
  }
179897
180031
  }
180032
+ trackCliFlagJson(json) {
180033
+ if (json) {
180034
+ this.trackCliFlag("json");
180035
+ }
180036
+ }
179898
180037
  };
179899
180038
  }
179900
180039
  });
@@ -179943,6 +180082,7 @@ async function inspect3(client2) {
179943
180082
  telemetry2.trackCliOptionTimeout(parsedArguments.flags["--timeout"]);
179944
180083
  telemetry2.trackCliFlagLogs(parsedArguments.flags["--logs"]);
179945
180084
  telemetry2.trackCliFlagWait(parsedArguments.flags["--wait"]);
180085
+ telemetry2.trackCliFlagJson(parsedArguments.flags["--json"]);
179946
180086
  const timeout = (0, import_ms19.default)(parsedArguments.flags["--timeout"] ?? "3m");
179947
180087
  if (timeout === void 0) {
179948
180088
  error3(`Invalid timeout "${parsedArguments.flags["--timeout"]}"`);
@@ -179961,6 +180101,7 @@ async function inspect3(client2) {
179961
180101
  const until = Date.now() + timeout;
179962
180102
  const wait3 = parsedArguments.flags["--wait"] ?? false;
179963
180103
  const withLogs = parsedArguments.flags["--logs"];
180104
+ const asJson = parsedArguments.flags["--json"] ?? false;
179964
180105
  const startTimestamp = Date.now();
179965
180106
  try {
179966
180107
  deploymentIdOrHost = new import_url16.URL(deploymentIdOrHost).hostname;
@@ -179971,7 +180112,7 @@ async function inspect3(client2) {
179971
180112
  );
179972
180113
  let deployment = await getDeployment(client2, contextName, deploymentIdOrHost);
179973
180114
  let abortController;
179974
- if (withLogs) {
180115
+ if (withLogs && !asJson) {
179975
180116
  let promise;
179976
180117
  ({ abortController, promise } = displayBuildLogs(client2, deployment, wait3));
179977
180118
  if (wait3) {
@@ -179993,7 +180134,10 @@ async function inspect3(client2) {
179993
180134
  break;
179994
180135
  }
179995
180136
  }
179996
- if (withLogs) {
180137
+ if (asJson) {
180138
+ output_manager_default.stopSpinner();
180139
+ await printJson({ deployment, contextName, client: client2 });
180140
+ } else if (withLogs) {
179997
180141
  print(`${import_chalk103.default.cyan("status")} ${stateString(deployment.readyState)}
179998
180142
  `);
179999
180143
  } else {
@@ -180102,6 +180246,38 @@ async function printDetails({
180102
180246
  `);
180103
180247
  }
180104
180248
  }
180249
+ async function printJson({
180250
+ deployment,
180251
+ contextName,
180252
+ client: client2
180253
+ }) {
180254
+ const {
180255
+ id,
180256
+ name,
180257
+ url: url3,
180258
+ createdAt,
180259
+ routes: routes2,
180260
+ readyState,
180261
+ alias: aliases,
180262
+ target,
180263
+ customEnvironment
180264
+ } = deployment;
180265
+ const { builds } = deployment.version === 2 ? await client2.fetch(`/v11/deployments/${id}/builds`) : { builds: [] };
180266
+ const jsonOutput = {
180267
+ id,
180268
+ name,
180269
+ url: url3,
180270
+ target: customEnvironment?.slug ?? target ?? "preview",
180271
+ readyState,
180272
+ createdAt,
180273
+ ...aliases && aliases.length > 0 && { aliases },
180274
+ ...builds.length > 0 && { builds },
180275
+ ...Array.isArray(routes2) && routes2.length > 0 && { routes: routes2 },
180276
+ ...contextName && { contextName }
180277
+ };
180278
+ client2.stdout.write(`${JSON.stringify(jsonOutput, null, 2)}
180279
+ `);
180280
+ }
180105
180281
  function exitCode(state) {
180106
180282
  if (state === "ERROR" || state === "CANCELED") {
180107
180283
  return 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "49.2.0",
3
+ "version": "50.0.1",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -27,24 +27,24 @@
27
27
  "esbuild": "0.27.0",
28
28
  "jose": "5.9.6",
29
29
  "@vercel/backends": "0.0.17",
30
- "@vercel/build-utils": "13.2.3",
31
30
  "@vercel/detect-agent": "1.0.0",
32
- "@vercel/elysia": "0.1.13",
33
- "@vercel/fastify": "0.1.16",
34
- "@vercel/express": "0.1.19",
31
+ "@vercel/build-utils": "13.2.3",
32
+ "@vercel/express": "0.1.20",
33
+ "@vercel/fastify": "0.1.17",
35
34
  "@vercel/go": "3.2.4",
36
- "@vercel/h3": "0.1.22",
37
- "@vercel/hono": "0.2.16",
35
+ "@vercel/h3": "0.1.23",
36
+ "@vercel/elysia": "0.1.14",
38
37
  "@vercel/hydrogen": "1.3.3",
39
- "@vercel/nestjs": "0.2.17",
40
- "@vercel/next": "4.15.8",
38
+ "@vercel/hono": "0.2.17",
39
+ "@vercel/nestjs": "0.2.18",
41
40
  "@vercel/node": "5.5.15",
41
+ "@vercel/next": "4.15.8",
42
+ "@vercel/python": "6.1.3",
42
43
  "@vercel/remix-builder": "5.5.6",
43
- "@vercel/python": "6.1.2",
44
- "@vercel/ruby": "2.2.3",
45
44
  "@vercel/redwood": "2.4.6",
46
- "@vercel/static-build": "2.8.14",
47
- "@vercel/rust": "1.0.4"
45
+ "@vercel/ruby": "2.2.3",
46
+ "@vercel/rust": "1.0.4",
47
+ "@vercel/static-build": "2.8.14"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@alex_neo/jest-expect-message": "1.0.5",
@@ -170,12 +170,12 @@
170
170
  "yauzl-promise": "2.1.3",
171
171
  "@vercel-internals/constants": "1.0.4",
172
172
  "@vercel-internals/get-package-json": "1.0.0",
173
- "@vercel/client": "17.2.15",
174
- "@vercel/error-utils": "2.0.3",
175
173
  "@vercel-internals/types": "3.0.6",
174
+ "@vercel/error-utils": "2.0.3",
175
+ "@vercel/client": "17.2.16",
176
+ "@vercel/fs-detectors": "5.7.10",
176
177
  "@vercel/frameworks": "3.15.4",
177
- "@vercel/fs-detectors": "5.7.9",
178
- "@vercel/routing-utils": "5.3.0"
178
+ "@vercel/routing-utils": "5.3.1"
179
179
  },
180
180
  "scripts": {
181
181
  "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail",