@vercel/build-utils 10.3.0 → 10.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 10.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Parse yarn.lock file version ([#13114](https://github.com/vercel/vercel/pull/13114))
8
+
9
+ - [env-vars] expose VERCEL_DEPLOYMENT_ID as NEXT_PUBLIC_VERCEL_DEPLOYMENT_ID ([#13115](https://github.com/vercel/vercel/pull/13115))
10
+
11
+ - Fix vitest-e2e glob to include integration.test.ts ([#13097](https://github.com/vercel/vercel/pull/13097))
12
+
3
13
  ## 10.3.0
4
14
 
5
15
  ### Minor Changes
@@ -68,6 +68,7 @@ var import_node_version = require("./node-version");
68
68
  var import_read_config_file = require("./read-config-file");
69
69
  var import_clone_env = require("../clone-env");
70
70
  var import_json5 = __toESM(require("json5"));
71
+ var import_js_yaml = __toESM(require("js-yaml"));
71
72
  const NO_OVERRIDE = {
72
73
  detectedLockfile: void 0,
73
74
  detectedPackageManager: void 0,
@@ -263,11 +264,11 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
263
264
  let lockfileVersion;
264
265
  let cliType;
265
266
  const bunLockPath = bunLockTextPath ?? bunLockBinPath;
266
- const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLock] = await Promise.all([
267
- Boolean(yarnLockPath),
267
+ const [packageLockJson, pnpmLockYaml, bunLock, yarnLock] = await Promise.all([
268
268
  npmLockPath ? (0, import_read_config_file.readConfigFile)(npmLockPath) : null,
269
269
  pnpmLockPath ? (0, import_read_config_file.readConfigFile)(pnpmLockPath) : null,
270
- bunLockPath ? import_fs_extra.default.readFile(bunLockPath) : null
270
+ bunLockPath ? import_fs_extra.default.readFile(bunLockPath) : null,
271
+ yarnLockPath ? import_fs_extra.default.readFile(yarnLockPath, "utf8") : null
271
272
  ]);
272
273
  const rootProjectInfo = readPackageJson ? await readProjectRootInfo({
273
274
  base,
@@ -278,13 +279,14 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
278
279
  turboVersionRange,
279
280
  rootProjectInfo?.rootDir
280
281
  ) : void 0;
281
- if (bunLock && hasYarnLock) {
282
+ if (bunLock && yarnLock) {
282
283
  cliType = "bun";
283
284
  lockfilePath = bunLockPath;
284
285
  lockfileVersion = bunLockTextPath ? 1 : 0;
285
- } else if (hasYarnLock) {
286
+ } else if (yarnLock) {
286
287
  cliType = "yarn";
287
288
  lockfilePath = yarnLockPath;
289
+ lockfileVersion = parseYarnLockVersion(yarnLock);
288
290
  } else if (pnpmLockYaml) {
289
291
  cliType = "pnpm";
290
292
  lockfilePath = pnpmLockPath;
@@ -314,6 +316,17 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
314
316
  turboSupportsCorepackHome
315
317
  };
316
318
  }
319
+ function parseYarnLockVersion(yarnLock) {
320
+ if (!yarnLock.includes("__metadata:")) {
321
+ return 1;
322
+ }
323
+ try {
324
+ const metadata = import_js_yaml.default.load(yarnLock).__metadata;
325
+ return Number(metadata.version);
326
+ } catch {
327
+ return void 0;
328
+ }
329
+ }
317
330
  async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
318
331
  if (turboVersionSpecifierSupportsCorepack(turboVersionRange)) {
319
332
  return true;
@@ -32,7 +32,8 @@ function getPrefixedEnvVars({
32
32
  "VERCEL_TARGET_ENV",
33
33
  "VERCEL_REGION",
34
34
  "VERCEL_BRANCH_URL",
35
- "VERCEL_PROJECT_PRODUCTION_URL"
35
+ "VERCEL_PROJECT_PRODUCTION_URL",
36
+ "VERCEL_DEPLOYMENT_ID"
36
37
  ];
37
38
  const newEnvs = {};
38
39
  if (envPrefix && envs.VERCEL_URL) {
package/dist/index.js CHANGED
@@ -18333,8 +18333,8 @@ var require_js_yaml = __commonJS({
18333
18333
  var require_js_yaml2 = __commonJS({
18334
18334
  "../../node_modules/.pnpm/js-yaml@3.13.1/node_modules/js-yaml/index.js"(exports2, module2) {
18335
18335
  "use strict";
18336
- var yaml2 = require_js_yaml();
18337
- module2.exports = yaml2;
18336
+ var yaml3 = require_js_yaml();
18337
+ module2.exports = yaml3;
18338
18338
  }
18339
18339
  });
18340
18340
 
@@ -23080,6 +23080,7 @@ function cloneEnv(...envs) {
23080
23080
 
23081
23081
  // src/fs/run-user-scripts.ts
23082
23082
  var import_json5 = __toESM(require_lib5());
23083
+ var import_js_yaml2 = __toESM(require_js_yaml2());
23083
23084
  var NO_OVERRIDE = {
23084
23085
  detectedLockfile: void 0,
23085
23086
  detectedPackageManager: void 0,
@@ -23275,11 +23276,11 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
23275
23276
  let lockfileVersion;
23276
23277
  let cliType;
23277
23278
  const bunLockPath = bunLockTextPath ?? bunLockBinPath;
23278
- const [hasYarnLock, packageLockJson, pnpmLockYaml, bunLock] = await Promise.all([
23279
- Boolean(yarnLockPath),
23279
+ const [packageLockJson, pnpmLockYaml, bunLock, yarnLock] = await Promise.all([
23280
23280
  npmLockPath ? readConfigFile(npmLockPath) : null,
23281
23281
  pnpmLockPath ? readConfigFile(pnpmLockPath) : null,
23282
- bunLockPath ? import_fs_extra7.default.readFile(bunLockPath) : null
23282
+ bunLockPath ? import_fs_extra7.default.readFile(bunLockPath) : null,
23283
+ yarnLockPath ? import_fs_extra7.default.readFile(yarnLockPath, "utf8") : null
23283
23284
  ]);
23284
23285
  const rootProjectInfo = readPackageJson ? await readProjectRootInfo({
23285
23286
  base,
@@ -23290,13 +23291,14 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
23290
23291
  turboVersionRange,
23291
23292
  rootProjectInfo?.rootDir
23292
23293
  ) : void 0;
23293
- if (bunLock && hasYarnLock) {
23294
+ if (bunLock && yarnLock) {
23294
23295
  cliType = "bun";
23295
23296
  lockfilePath = bunLockPath;
23296
23297
  lockfileVersion = bunLockTextPath ? 1 : 0;
23297
- } else if (hasYarnLock) {
23298
+ } else if (yarnLock) {
23298
23299
  cliType = "yarn";
23299
23300
  lockfilePath = yarnLockPath;
23301
+ lockfileVersion = parseYarnLockVersion(yarnLock);
23300
23302
  } else if (pnpmLockYaml) {
23301
23303
  cliType = "pnpm";
23302
23304
  lockfilePath = pnpmLockPath;
@@ -23326,6 +23328,17 @@ async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
23326
23328
  turboSupportsCorepackHome
23327
23329
  };
23328
23330
  }
23331
+ function parseYarnLockVersion(yarnLock) {
23332
+ if (!yarnLock.includes("__metadata:")) {
23333
+ return 1;
23334
+ }
23335
+ try {
23336
+ const metadata = import_js_yaml2.default.load(yarnLock).__metadata;
23337
+ return Number(metadata.version);
23338
+ } catch {
23339
+ return void 0;
23340
+ }
23341
+ }
23329
23342
  async function checkTurboSupportsCorepack(turboVersionRange, rootDir) {
23330
23343
  if (turboVersionSpecifierSupportsCorepack(turboVersionRange)) {
23331
23344
  return true;
@@ -24060,7 +24073,8 @@ function getPrefixedEnvVars({
24060
24073
  "VERCEL_TARGET_ENV",
24061
24074
  "VERCEL_REGION",
24062
24075
  "VERCEL_BRANCH_URL",
24063
- "VERCEL_PROJECT_PRODUCTION_URL"
24076
+ "VERCEL_PROJECT_PRODUCTION_URL",
24077
+ "VERCEL_DEPLOYMENT_ID"
24064
24078
  ];
24065
24079
  const newEnvs = {};
24066
24080
  if (envPrefix && envs.VERCEL_URL) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "10.3.0",
3
+ "version": "10.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -54,7 +54,7 @@
54
54
  "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
55
55
  "vitest-run": "vitest -c ../../vitest.config.mts",
56
56
  "vitest-unit": "glob --absolute 'test/unit.*test.ts'",
57
- "vitest-e2e": "glob --absolute 'test/integration-*.test.ts'",
57
+ "vitest-e2e": "glob --absolute 'test/integration*.test.ts'",
58
58
  "type-check": "tsc --noEmit"
59
59
  }
60
60
  }