@vercel/build-utils 10.2.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 +20 -0
- package/dist/fs/node-version.d.ts +1 -0
- package/dist/fs/node-version.js +5 -0
- package/dist/fs/run-user-scripts.js +19 -6
- package/dist/get-prefixed-env-vars.js +2 -1
- package/dist/index.js +23 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
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
|
+
|
13
|
+
## 10.3.0
|
14
|
+
|
15
|
+
### Minor Changes
|
16
|
+
|
17
|
+
- Delay pnpm@10 preferred date ([#13100](https://github.com/vercel/vercel/pull/13100))
|
18
|
+
|
19
|
+
### Patch Changes
|
20
|
+
|
21
|
+
- Type-check tests ([#13096](https://github.com/vercel/vercel/pull/13096))
|
22
|
+
|
3
23
|
## 10.2.0
|
4
24
|
|
5
25
|
### Minor Changes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { NodeVersion } from '../types';
|
2
2
|
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
|
3
3
|
export declare const NODE_VERSIONS: NodeVersion[];
|
4
|
+
export declare function getNodeVersionByMajor(major: number): NodeVersion | undefined;
|
4
5
|
declare function getOptions(): NodeVersion[];
|
5
6
|
export declare function getAvailableNodeVersions(): NodeVersionMajor[];
|
6
7
|
export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): NodeVersion;
|
package/dist/fs/node-version.js
CHANGED
@@ -32,6 +32,7 @@ __export(node_version_exports, {
|
|
32
32
|
getAvailableNodeVersions: () => getAvailableNodeVersions,
|
33
33
|
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
34
34
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
35
|
+
getNodeVersionByMajor: () => getNodeVersionByMajor,
|
35
36
|
getSupportedNodeVersion: () => getSupportedNodeVersion
|
36
37
|
});
|
37
38
|
module.exports = __toCommonJS(node_version_exports);
|
@@ -87,6 +88,9 @@ const NODE_VERSIONS = [
|
|
87
88
|
discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
|
88
89
|
})
|
89
90
|
];
|
91
|
+
function getNodeVersionByMajor(major) {
|
92
|
+
return NODE_VERSIONS.find((v) => v.major === major);
|
93
|
+
}
|
90
94
|
function getOptions() {
|
91
95
|
return NODE_VERSIONS;
|
92
96
|
}
|
@@ -176,5 +180,6 @@ async function getSupportedNodeVersion(engineRange, isAuto = false, availableVer
|
|
176
180
|
getAvailableNodeVersions,
|
177
181
|
getDiscontinuedNodeVersions,
|
178
182
|
getLatestNodeVersion,
|
183
|
+
getNodeVersionByMajor,
|
179
184
|
getSupportedNodeVersion
|
180
185
|
});
|
@@ -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 [
|
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 &&
|
282
|
+
if (bunLock && yarnLock) {
|
282
283
|
cliType = "bun";
|
283
284
|
lockfilePath = bunLockPath;
|
284
285
|
lockfileVersion = bunLockTextPath ? 1 : 0;
|
285
|
-
} else if (
|
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;
|
@@ -615,7 +628,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
615
628
|
}
|
616
629
|
return newEnv;
|
617
630
|
}
|
618
|
-
const PNPM_10_PREFERRED_AT = /* @__PURE__ */ new Date("2025-02-
|
631
|
+
const PNPM_10_PREFERRED_AT = /* @__PURE__ */ new Date("2025-02-27T20:00:00Z");
|
619
632
|
function detectPnpmVersion(lockfileVersion, projectCreatedAt) {
|
620
633
|
switch (true) {
|
621
634
|
case lockfileVersion === void 0:
|
@@ -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
|
18337
|
-
module2.exports =
|
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 [
|
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 &&
|
23294
|
+
if (bunLock && yarnLock) {
|
23294
23295
|
cliType = "bun";
|
23295
23296
|
lockfilePath = bunLockPath;
|
23296
23297
|
lockfileVersion = bunLockTextPath ? 1 : 0;
|
23297
|
-
} else if (
|
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;
|
@@ -23627,7 +23640,7 @@ To use ${otherVersion}, manually opt in using corepack (https://vercel.com/docs/
|
|
23627
23640
|
}
|
23628
23641
|
return newEnv;
|
23629
23642
|
}
|
23630
|
-
var PNPM_10_PREFERRED_AT = /* @__PURE__ */ new Date("2025-02-
|
23643
|
+
var PNPM_10_PREFERRED_AT = /* @__PURE__ */ new Date("2025-02-27T20:00:00Z");
|
23631
23644
|
function detectPnpmVersion(lockfileVersion, projectCreatedAt) {
|
23632
23645
|
switch (true) {
|
23633
23646
|
case lockfileVersion === void 0:
|
@@ -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
|
+
"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
|
57
|
+
"vitest-e2e": "glob --absolute 'test/integration*.test.ts'",
|
58
58
|
"type-check": "tsc --noEmit"
|
59
59
|
}
|
60
60
|
}
|