@vercel/build-utils 3.1.1 → 4.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.
- package/dist/detect-builders.js +8 -11
- package/dist/detect-file-system-api.js +5 -5
- package/dist/fs/run-user-scripts.js +21 -10
- package/dist/index.js +35 -27
- package/dist/lambda.js +1 -1
- package/dist/types.d.ts +3 -2
- package/package.json +3 -3
package/dist/detect-builders.js
CHANGED
@@ -18,7 +18,7 @@ function sortFiles(fileA, fileB) {
|
|
18
18
|
exports.sortFiles = sortFiles;
|
19
19
|
function detectApiExtensions(builders) {
|
20
20
|
return new Set(builders
|
21
|
-
.filter((b) =>
|
21
|
+
.filter((b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith('api/')))
|
22
22
|
.map(b => path_1.extname(b.src))
|
23
23
|
.filter(Boolean));
|
24
24
|
}
|
@@ -26,18 +26,17 @@ exports.detectApiExtensions = detectApiExtensions;
|
|
26
26
|
function detectApiDirectory(builders) {
|
27
27
|
// TODO: We eventually want to save the api directory to
|
28
28
|
// builder.config.apiDirectory so it is only detected once
|
29
|
-
const found = builders.some(b =>
|
29
|
+
const found = builders.some(b => b.config && b.config.zeroConfig && b.src?.startsWith('api/'));
|
30
30
|
return found ? 'api' : null;
|
31
31
|
}
|
32
32
|
exports.detectApiDirectory = detectApiDirectory;
|
33
33
|
// TODO: Replace this function with `config.outputDirectory`
|
34
34
|
function getPublicBuilder(builders) {
|
35
|
-
var _a;
|
36
35
|
for (const builder of builders) {
|
37
36
|
if (typeof builder.src === 'string' &&
|
38
37
|
_1.isOfficialRuntime('static', builder.use) &&
|
39
38
|
/^.*\/\*\*\/\*$/.test(builder.src) &&
|
40
|
-
|
39
|
+
builder.config?.zeroConfig === true) {
|
41
40
|
return builder;
|
42
41
|
}
|
43
42
|
}
|
@@ -51,7 +50,6 @@ function detectOutputDirectory(builders) {
|
|
51
50
|
}
|
52
51
|
exports.detectOutputDirectory = detectOutputDirectory;
|
53
52
|
async function detectBuilders(files, pkg, options = {}) {
|
54
|
-
var _a;
|
55
53
|
const errors = [];
|
56
54
|
const warnings = [];
|
57
55
|
const apiBuilders = [];
|
@@ -81,7 +79,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
81
79
|
const absolutePathCache = new Map();
|
82
80
|
const { projectSettings = {} } = options;
|
83
81
|
const { buildCommand, outputDirectory, framework } = projectSettings;
|
84
|
-
const ignoreRuntimes = new Set(
|
82
|
+
const ignoreRuntimes = new Set(slugToFramework.get(framework || '')?.ignoreRuntimes);
|
85
83
|
const withTag = options.tag ? `@${options.tag}` : '';
|
86
84
|
const apiMatches = getApiMatches()
|
87
85
|
.filter(b => !ignoreRuntimes.has(b.use))
|
@@ -676,8 +674,7 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
676
674
|
return { route, isDynamic };
|
677
675
|
}
|
678
676
|
function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
679
|
-
|
680
|
-
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
677
|
+
const deps = Object.assign({}, pkg?.dependencies, pkg?.devDependencies);
|
681
678
|
const defaultRoutes = [];
|
682
679
|
const redirectRoutes = [];
|
683
680
|
const rewriteRoutes = [];
|
@@ -687,9 +684,9 @@ function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuild
|
|
687
684
|
redirectRoutes: [],
|
688
685
|
rewriteRoutes: [],
|
689
686
|
};
|
690
|
-
const framework =
|
691
|
-
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder
|
692
|
-
const ignoreRuntimes =
|
687
|
+
const framework = frontendBuilder?.config?.framework || '';
|
688
|
+
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder?.use);
|
689
|
+
const ignoreRuntimes = slugToFramework.get(framework)?.ignoreRuntimes;
|
693
690
|
if (apiRoutes && apiRoutes.length > 0) {
|
694
691
|
if (options.featHandleMiss) {
|
695
692
|
// Exclude extension names if the corresponding plugin is not found in package.json
|
@@ -14,7 +14,7 @@ const enableFileSystemApiFrameworks = new Set(['solidstart']);
|
|
14
14
|
*/
|
15
15
|
async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
|
16
16
|
const framework = projectSettings.framework || '';
|
17
|
-
const deps = Object.assign({}, pkg
|
17
|
+
const deps = Object.assign({}, pkg?.dependencies, pkg?.devDependencies);
|
18
18
|
const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
|
19
19
|
const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
|
20
20
|
const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
|
@@ -30,14 +30,14 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
30
30
|
if (!isEnabled) {
|
31
31
|
return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
|
32
32
|
}
|
33
|
-
if (
|
33
|
+
if (vercelConfig?.builds && vercelConfig.builds.length > 0) {
|
34
34
|
return {
|
35
35
|
metadata,
|
36
36
|
fsApiBuilder: null,
|
37
37
|
reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
|
38
38
|
};
|
39
39
|
}
|
40
|
-
if (Object.values(
|
40
|
+
if (Object.values(vercelConfig?.functions || {}).some(fn => !!fn.runtime)) {
|
41
41
|
return {
|
42
42
|
metadata,
|
43
43
|
fsApiBuilder: null,
|
@@ -107,7 +107,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
107
107
|
// Use the old pipeline if a custom output directory was specified for Next.js
|
108
108
|
// because `vercel build` cannot ensure that the directory will be in the same
|
109
109
|
// location as `.output`, which can break imports (not just nft.json files).
|
110
|
-
if (projectSettings
|
110
|
+
if (projectSettings?.outputDirectory) {
|
111
111
|
return {
|
112
112
|
metadata,
|
113
113
|
fsApiBuilder: null,
|
@@ -154,7 +154,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
154
154
|
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
155
155
|
_1.isOfficialRuntime('static', use) ||
|
156
156
|
_1.isOfficialRuntime('static-build', use));
|
157
|
-
const config =
|
157
|
+
const config = frontendBuilder?.config || {};
|
158
158
|
const withTag = tag ? `@${tag}` : '';
|
159
159
|
const fsApiBuilder = {
|
160
160
|
use: `@vercelruntimes/file-system-api${withTag}`,
|
@@ -9,6 +9,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
10
10
|
const async_sema_1 = __importDefault(require("async-sema"));
|
11
11
|
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
12
|
+
const semver_1 = require("semver");
|
12
13
|
const util_1 = require("util");
|
13
14
|
const debug_1 = __importDefault(require("../debug"));
|
14
15
|
const errors_1 = require("../errors");
|
@@ -131,9 +132,9 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
131
132
|
}
|
132
133
|
exports.getSpawnOptions = getSpawnOptions;
|
133
134
|
async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
135
|
+
const latest = node_version_1.getLatestNodeVersion();
|
134
136
|
if (meta && meta.isDev) {
|
135
137
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
136
|
-
const latest = node_version_1.getLatestNodeVersion();
|
137
138
|
return { ...latest, runtime: 'nodejs' };
|
138
139
|
}
|
139
140
|
const { packageJson } = await scanParentDirs(destPath, true);
|
@@ -141,9 +142,20 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
|
141
142
|
let isAuto = true;
|
142
143
|
if (packageJson && packageJson.engines && packageJson.engines.node) {
|
143
144
|
const { node } = packageJson.engines;
|
144
|
-
if (nodeVersion &&
|
145
|
+
if (nodeVersion &&
|
146
|
+
semver_1.validRange(node) &&
|
147
|
+
!semver_1.intersects(nodeVersion, node) &&
|
148
|
+
!meta.isDev) {
|
145
149
|
console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${nodeVersion}") will not apply. Learn More: http://vercel.link/node-version`);
|
146
150
|
}
|
151
|
+
else if (semver_1.coerce(node)?.raw === node && !meta.isDev) {
|
152
|
+
console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version`);
|
153
|
+
}
|
154
|
+
else if (semver_1.validRange(node) &&
|
155
|
+
semver_1.intersects(`${latest.major + 1}.x`, node) &&
|
156
|
+
!meta.isDev) {
|
157
|
+
console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version`);
|
158
|
+
}
|
147
159
|
nodeVersion = node;
|
148
160
|
isAuto = false;
|
149
161
|
}
|
@@ -227,11 +239,10 @@ async function walkParentDirs({ base, start, filename, }) {
|
|
227
239
|
}
|
228
240
|
exports.walkParentDirs = walkParentDirs;
|
229
241
|
function isSet(v) {
|
230
|
-
|
231
|
-
return ((_a = v === null || v === void 0 ? void 0 : v.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Set';
|
242
|
+
return v?.constructor?.name === 'Set';
|
232
243
|
}
|
233
244
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
234
|
-
if (meta
|
245
|
+
if (meta?.isDev) {
|
235
246
|
debug_1.default('Skipping dependency installation because dev mode is enabled');
|
236
247
|
return false;
|
237
248
|
}
|
@@ -302,7 +313,7 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
|
|
302
313
|
if (cliType === 'npm') {
|
303
314
|
if (typeof lockfileVersion === 'number' &&
|
304
315
|
lockfileVersion >= 2 &&
|
305
|
-
(
|
316
|
+
(nodeVersion?.major || 0) < 16) {
|
306
317
|
// Ensure that npm 7 is at the beginning of the `$PATH`
|
307
318
|
newEnv.PATH = `/node16/bin-npm7${path_1.default.delimiter}${env.PATH}`;
|
308
319
|
console.log('Detected `package-lock.json` generated by npm 7...');
|
@@ -331,9 +342,9 @@ async function runCustomInstallCommand({ destPath, installCommand, nodeVersion,
|
|
331
342
|
cliType,
|
332
343
|
lockfileVersion,
|
333
344
|
nodeVersion,
|
334
|
-
env:
|
345
|
+
env: spawnOpts?.env || {},
|
335
346
|
});
|
336
|
-
debug_1.default(`Running with $PATH:`,
|
347
|
+
debug_1.default(`Running with $PATH:`, env?.PATH || '');
|
337
348
|
await execCommand(installCommand, {
|
338
349
|
...spawnOpts,
|
339
350
|
env,
|
@@ -358,7 +369,7 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
358
369
|
nodeVersion: undefined,
|
359
370
|
env: {
|
360
371
|
...process.env,
|
361
|
-
...spawnOpts
|
372
|
+
...spawnOpts?.env,
|
362
373
|
},
|
363
374
|
}),
|
364
375
|
};
|
@@ -398,7 +409,7 @@ async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
398
409
|
}
|
399
410
|
exports.runPipInstall = runPipInstall;
|
400
411
|
function getScriptName(pkg, possibleNames) {
|
401
|
-
if (pkg
|
412
|
+
if (pkg?.scripts) {
|
402
413
|
for (const name of possibleNames) {
|
403
414
|
if (name in pkg.scripts) {
|
404
415
|
return name;
|
package/dist/index.js
CHANGED
@@ -32800,7 +32800,7 @@ function sortFiles(fileA, fileB) {
|
|
32800
32800
|
exports.sortFiles = sortFiles;
|
32801
32801
|
function detectApiExtensions(builders) {
|
32802
32802
|
return new Set(builders
|
32803
|
-
.filter((b) =>
|
32803
|
+
.filter((b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith('api/')))
|
32804
32804
|
.map(b => path_1.extname(b.src))
|
32805
32805
|
.filter(Boolean));
|
32806
32806
|
}
|
@@ -32808,18 +32808,17 @@ exports.detectApiExtensions = detectApiExtensions;
|
|
32808
32808
|
function detectApiDirectory(builders) {
|
32809
32809
|
// TODO: We eventually want to save the api directory to
|
32810
32810
|
// builder.config.apiDirectory so it is only detected once
|
32811
|
-
const found = builders.some(b =>
|
32811
|
+
const found = builders.some(b => b.config && b.config.zeroConfig && b.src?.startsWith('api/'));
|
32812
32812
|
return found ? 'api' : null;
|
32813
32813
|
}
|
32814
32814
|
exports.detectApiDirectory = detectApiDirectory;
|
32815
32815
|
// TODO: Replace this function with `config.outputDirectory`
|
32816
32816
|
function getPublicBuilder(builders) {
|
32817
|
-
var _a;
|
32818
32817
|
for (const builder of builders) {
|
32819
32818
|
if (typeof builder.src === 'string' &&
|
32820
32819
|
_1.isOfficialRuntime('static', builder.use) &&
|
32821
32820
|
/^.*\/\*\*\/\*$/.test(builder.src) &&
|
32822
|
-
|
32821
|
+
builder.config?.zeroConfig === true) {
|
32823
32822
|
return builder;
|
32824
32823
|
}
|
32825
32824
|
}
|
@@ -32833,7 +32832,6 @@ function detectOutputDirectory(builders) {
|
|
32833
32832
|
}
|
32834
32833
|
exports.detectOutputDirectory = detectOutputDirectory;
|
32835
32834
|
async function detectBuilders(files, pkg, options = {}) {
|
32836
|
-
var _a;
|
32837
32835
|
const errors = [];
|
32838
32836
|
const warnings = [];
|
32839
32837
|
const apiBuilders = [];
|
@@ -32863,7 +32861,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32863
32861
|
const absolutePathCache = new Map();
|
32864
32862
|
const { projectSettings = {} } = options;
|
32865
32863
|
const { buildCommand, outputDirectory, framework } = projectSettings;
|
32866
|
-
const ignoreRuntimes = new Set(
|
32864
|
+
const ignoreRuntimes = new Set(slugToFramework.get(framework || '')?.ignoreRuntimes);
|
32867
32865
|
const withTag = options.tag ? `@${options.tag}` : '';
|
32868
32866
|
const apiMatches = getApiMatches()
|
32869
32867
|
.filter(b => !ignoreRuntimes.has(b.use))
|
@@ -33458,8 +33456,7 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
33458
33456
|
return { route, isDynamic };
|
33459
33457
|
}
|
33460
33458
|
function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
33461
|
-
|
33462
|
-
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
33459
|
+
const deps = Object.assign({}, pkg?.dependencies, pkg?.devDependencies);
|
33463
33460
|
const defaultRoutes = [];
|
33464
33461
|
const redirectRoutes = [];
|
33465
33462
|
const rewriteRoutes = [];
|
@@ -33469,9 +33466,9 @@ function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuild
|
|
33469
33466
|
redirectRoutes: [],
|
33470
33467
|
rewriteRoutes: [],
|
33471
33468
|
};
|
33472
|
-
const framework =
|
33473
|
-
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder
|
33474
|
-
const ignoreRuntimes =
|
33469
|
+
const framework = frontendBuilder?.config?.framework || '';
|
33470
|
+
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder?.use);
|
33471
|
+
const ignoreRuntimes = slugToFramework.get(framework)?.ignoreRuntimes;
|
33475
33472
|
if (apiRoutes && apiRoutes.length > 0) {
|
33476
33473
|
if (options.featHandleMiss) {
|
33477
33474
|
// Exclude extension names if the corresponding plugin is not found in package.json
|
@@ -33638,7 +33635,7 @@ const enableFileSystemApiFrameworks = new Set(['solidstart']);
|
|
33638
33635
|
*/
|
33639
33636
|
async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
|
33640
33637
|
const framework = projectSettings.framework || '';
|
33641
|
-
const deps = Object.assign({}, pkg
|
33638
|
+
const deps = Object.assign({}, pkg?.dependencies, pkg?.devDependencies);
|
33642
33639
|
const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
|
33643
33640
|
const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
|
33644
33641
|
const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
|
@@ -33654,14 +33651,14 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
33654
33651
|
if (!isEnabled) {
|
33655
33652
|
return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
|
33656
33653
|
}
|
33657
|
-
if (
|
33654
|
+
if (vercelConfig?.builds && vercelConfig.builds.length > 0) {
|
33658
33655
|
return {
|
33659
33656
|
metadata,
|
33660
33657
|
fsApiBuilder: null,
|
33661
33658
|
reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
|
33662
33659
|
};
|
33663
33660
|
}
|
33664
|
-
if (Object.values(
|
33661
|
+
if (Object.values(vercelConfig?.functions || {}).some(fn => !!fn.runtime)) {
|
33665
33662
|
return {
|
33666
33663
|
metadata,
|
33667
33664
|
fsApiBuilder: null,
|
@@ -33731,7 +33728,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
33731
33728
|
// Use the old pipeline if a custom output directory was specified for Next.js
|
33732
33729
|
// because `vercel build` cannot ensure that the directory will be in the same
|
33733
33730
|
// location as `.output`, which can break imports (not just nft.json files).
|
33734
|
-
if (projectSettings
|
33731
|
+
if (projectSettings?.outputDirectory) {
|
33735
33732
|
return {
|
33736
33733
|
metadata,
|
33737
33734
|
fsApiBuilder: null,
|
@@ -33778,7 +33775,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
33778
33775
|
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
33779
33776
|
_1.isOfficialRuntime('static', use) ||
|
33780
33777
|
_1.isOfficialRuntime('static-build', use));
|
33781
|
-
const config =
|
33778
|
+
const config = frontendBuilder?.config || {};
|
33782
33779
|
const withTag = tag ? `@${tag}` : '';
|
33783
33780
|
const fsApiBuilder = {
|
33784
33781
|
use: `@vercelruntimes/file-system-api${withTag}`,
|
@@ -34645,6 +34642,7 @@ const fs_extra_1 = __importDefault(__webpack_require__(5392));
|
|
34645
34642
|
const path_1 = __importDefault(__webpack_require__(5622));
|
34646
34643
|
const async_sema_1 = __importDefault(__webpack_require__(5758));
|
34647
34644
|
const cross_spawn_1 = __importDefault(__webpack_require__(7618));
|
34645
|
+
const semver_1 = __webpack_require__(2879);
|
34648
34646
|
const util_1 = __webpack_require__(1669);
|
34649
34647
|
const debug_1 = __importDefault(__webpack_require__(1868));
|
34650
34648
|
const errors_1 = __webpack_require__(3983);
|
@@ -34767,9 +34765,9 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
34767
34765
|
}
|
34768
34766
|
exports.getSpawnOptions = getSpawnOptions;
|
34769
34767
|
async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
34768
|
+
const latest = node_version_1.getLatestNodeVersion();
|
34770
34769
|
if (meta && meta.isDev) {
|
34771
34770
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
34772
|
-
const latest = node_version_1.getLatestNodeVersion();
|
34773
34771
|
return { ...latest, runtime: 'nodejs' };
|
34774
34772
|
}
|
34775
34773
|
const { packageJson } = await scanParentDirs(destPath, true);
|
@@ -34777,9 +34775,20 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
|
34777
34775
|
let isAuto = true;
|
34778
34776
|
if (packageJson && packageJson.engines && packageJson.engines.node) {
|
34779
34777
|
const { node } = packageJson.engines;
|
34780
|
-
if (nodeVersion &&
|
34778
|
+
if (nodeVersion &&
|
34779
|
+
semver_1.validRange(node) &&
|
34780
|
+
!semver_1.intersects(nodeVersion, node) &&
|
34781
|
+
!meta.isDev) {
|
34781
34782
|
console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${nodeVersion}") will not apply. Learn More: http://vercel.link/node-version`);
|
34782
34783
|
}
|
34784
|
+
else if (semver_1.coerce(node)?.raw === node && !meta.isDev) {
|
34785
|
+
console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version`);
|
34786
|
+
}
|
34787
|
+
else if (semver_1.validRange(node) &&
|
34788
|
+
semver_1.intersects(`${latest.major + 1}.x`, node) &&
|
34789
|
+
!meta.isDev) {
|
34790
|
+
console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version`);
|
34791
|
+
}
|
34783
34792
|
nodeVersion = node;
|
34784
34793
|
isAuto = false;
|
34785
34794
|
}
|
@@ -34863,11 +34872,10 @@ async function walkParentDirs({ base, start, filename, }) {
|
|
34863
34872
|
}
|
34864
34873
|
exports.walkParentDirs = walkParentDirs;
|
34865
34874
|
function isSet(v) {
|
34866
|
-
|
34867
|
-
return ((_a = v === null || v === void 0 ? void 0 : v.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Set';
|
34875
|
+
return v?.constructor?.name === 'Set';
|
34868
34876
|
}
|
34869
34877
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
34870
|
-
if (meta
|
34878
|
+
if (meta?.isDev) {
|
34871
34879
|
debug_1.default('Skipping dependency installation because dev mode is enabled');
|
34872
34880
|
return false;
|
34873
34881
|
}
|
@@ -34938,7 +34946,7 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
|
|
34938
34946
|
if (cliType === 'npm') {
|
34939
34947
|
if (typeof lockfileVersion === 'number' &&
|
34940
34948
|
lockfileVersion >= 2 &&
|
34941
|
-
(
|
34949
|
+
(nodeVersion?.major || 0) < 16) {
|
34942
34950
|
// Ensure that npm 7 is at the beginning of the `$PATH`
|
34943
34951
|
newEnv.PATH = `/node16/bin-npm7${path_1.default.delimiter}${env.PATH}`;
|
34944
34952
|
console.log('Detected `package-lock.json` generated by npm 7...');
|
@@ -34967,9 +34975,9 @@ async function runCustomInstallCommand({ destPath, installCommand, nodeVersion,
|
|
34967
34975
|
cliType,
|
34968
34976
|
lockfileVersion,
|
34969
34977
|
nodeVersion,
|
34970
|
-
env:
|
34978
|
+
env: spawnOpts?.env || {},
|
34971
34979
|
});
|
34972
|
-
debug_1.default(`Running with $PATH:`,
|
34980
|
+
debug_1.default(`Running with $PATH:`, env?.PATH || '');
|
34973
34981
|
await execCommand(installCommand, {
|
34974
34982
|
...spawnOpts,
|
34975
34983
|
env,
|
@@ -34994,7 +35002,7 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
34994
35002
|
nodeVersion: undefined,
|
34995
35003
|
env: {
|
34996
35004
|
...process.env,
|
34997
|
-
...spawnOpts
|
35005
|
+
...spawnOpts?.env,
|
34998
35006
|
},
|
34999
35007
|
}),
|
35000
35008
|
};
|
@@ -35034,7 +35042,7 @@ async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
35034
35042
|
}
|
35035
35043
|
exports.runPipInstall = runPipInstall;
|
35036
35044
|
function getScriptName(pkg, possibleNames) {
|
35037
|
-
if (pkg
|
35045
|
+
if (pkg?.scripts) {
|
35038
35046
|
for (const name of possibleNames) {
|
35039
35047
|
if (name in pkg.scripts) {
|
35040
35048
|
return name;
|
@@ -35445,7 +35453,7 @@ async function createZip(files) {
|
|
35445
35453
|
}
|
35446
35454
|
exports.createZip = createZip;
|
35447
35455
|
async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
35448
|
-
if (config
|
35456
|
+
if (config?.functions) {
|
35449
35457
|
for (const [pattern, fn] of Object.entries(config.functions)) {
|
35450
35458
|
if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) {
|
35451
35459
|
return {
|
package/dist/lambda.js
CHANGED
@@ -114,7 +114,7 @@ async function createZip(files) {
|
|
114
114
|
}
|
115
115
|
exports.createZip = createZip;
|
116
116
|
async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
117
|
-
if (config
|
117
|
+
if (config?.functions) {
|
118
118
|
for (const [pattern, fn] of Object.entries(config.functions)) {
|
119
119
|
if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) {
|
120
120
|
return {
|
package/dist/types.d.ts
CHANGED
@@ -76,7 +76,7 @@ export interface BuildOptions {
|
|
76
76
|
* is the Git Repository Root. This is only relevant for Monorepos.
|
77
77
|
* See https://vercel.com/blog/monorepos
|
78
78
|
*/
|
79
|
-
repoRootPath
|
79
|
+
repoRootPath: string;
|
80
80
|
/**
|
81
81
|
* An arbitrary object passed by the user in the build definition defined
|
82
82
|
* in `vercel.json`.
|
@@ -111,7 +111,7 @@ export interface PrepareCacheOptions {
|
|
111
111
|
* is the Git Repository Root. This is only relevant for Monorepos.
|
112
112
|
* See https://vercel.com/blog/monorepos
|
113
113
|
*/
|
114
|
-
repoRootPath
|
114
|
+
repoRootPath: string;
|
115
115
|
/**
|
116
116
|
* An arbitrary object passed by the user in the build definition defined
|
117
117
|
* in `vercel.json`.
|
@@ -261,6 +261,7 @@ export interface PackageJson {
|
|
261
261
|
readonly preferGlobal?: boolean;
|
262
262
|
readonly private?: boolean;
|
263
263
|
readonly publishConfig?: PackageJson.PublishConfig;
|
264
|
+
readonly packageManager?: string;
|
264
265
|
}
|
265
266
|
export interface NodeVersion {
|
266
267
|
major: number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"@types/node-fetch": "^2.1.6",
|
32
32
|
"@types/semver": "6.0.0",
|
33
33
|
"@types/yazl": "2.4.2",
|
34
|
-
"@vercel/frameworks": "1.0.
|
34
|
+
"@vercel/frameworks": "1.0.1",
|
35
35
|
"@vercel/ncc": "0.24.0",
|
36
36
|
"aggregate-error": "3.0.1",
|
37
37
|
"async-retry": "1.2.3",
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"typescript": "4.3.4",
|
51
51
|
"yazl": "2.5.1"
|
52
52
|
},
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "de0d2fba0b32588726a2799015eaff4e6bb65ffb"
|
54
54
|
}
|