@vercel/build-utils 5.4.3 → 5.5.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/clone-env.js +11 -7
- package/dist/edge-function.d.ts +2 -0
- package/dist/edge-function.js +1 -0
- package/dist/fs/run-user-scripts.js +19 -4
- package/dist/index.js +32 -12
- package/package.json +2 -2
package/dist/clone-env.js
CHANGED
@@ -15,14 +15,18 @@ function cloneEnv(...envs) {
|
|
15
15
|
if (env === undefined || env === null) {
|
16
16
|
return obj;
|
17
17
|
}
|
18
|
-
// the
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
// mixin the env first
|
19
|
+
obj = Object.assign(obj, env);
|
20
|
+
if (hasOwnProperty.call(env, 'Path')) {
|
21
|
+
// the system path is called `Path` on Windows and Node.js will
|
22
|
+
// automatically return the system path when accessing `PATH`,
|
23
|
+
// however we lose this proxied value when we destructure and
|
24
|
+
// thus we must explicitly copy it, but we must also remove the
|
25
|
+
// `Path` property since we can't have both a `PATH` and `Path`
|
26
|
+
obj.PATH = obj.Path;
|
27
|
+
delete obj.Path;
|
24
28
|
}
|
25
|
-
return
|
29
|
+
return obj;
|
26
30
|
}, {});
|
27
31
|
}
|
28
32
|
exports.cloneEnv = cloneEnv;
|
package/dist/edge-function.d.ts
CHANGED
package/dist/edge-function.js
CHANGED
@@ -304,14 +304,17 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
304
304
|
env,
|
305
305
|
});
|
306
306
|
let commandArgs;
|
307
|
+
const isPotentiallyBrokenNpm = cliType === 'npm' &&
|
308
|
+
nodeVersion?.major === 16 &&
|
309
|
+
!args.includes('--legacy-peer-deps') &&
|
310
|
+
spawnOpts?.env?.ENABLE_EXPERIMENTAL_COREPACK !== '1';
|
307
311
|
if (cliType === 'npm') {
|
308
312
|
opts.prettyCommand = 'npm install';
|
309
313
|
commandArgs = args
|
310
314
|
.filter(a => a !== '--prefer-offline')
|
311
315
|
.concat(['install', '--no-audit', '--unsafe-perm']);
|
312
|
-
if (
|
313
|
-
spawnOpts?.env?.VERCEL_NPM_LEGACY_PEER_DEPS === '1'
|
314
|
-
spawnOpts?.env?.ENABLE_EXPERIMENTAL_COREPACK !== '1') {
|
316
|
+
if (isPotentiallyBrokenNpm &&
|
317
|
+
spawnOpts?.env?.VERCEL_NPM_LEGACY_PEER_DEPS === '1') {
|
315
318
|
// Starting in npm@8.6.0, if you ran `npm install --legacy-peer-deps`,
|
316
319
|
// and then later ran `npm install`, it would fail. So the only way
|
317
320
|
// to safely upgrade npm from npm@8.5.0 is to set this flag. The docs
|
@@ -336,7 +339,19 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
336
339
|
if (process.env.NPM_ONLY_PRODUCTION) {
|
337
340
|
commandArgs.push('--production');
|
338
341
|
}
|
339
|
-
|
342
|
+
try {
|
343
|
+
await spawnAsync(cliType, commandArgs, opts);
|
344
|
+
}
|
345
|
+
catch (_) {
|
346
|
+
const potentialErrorPath = path_1.default.join(process.env.HOME || '/', '.npm', 'eresolve-report.txt');
|
347
|
+
if (isPotentiallyBrokenNpm &&
|
348
|
+
!commandArgs.includes('--legacy-peer-deps') &&
|
349
|
+
fs_extra_1.default.existsSync(potentialErrorPath)) {
|
350
|
+
console.warn('Warning: Retrying "Install Command" with `--legacy-peer-deps` which may accept a potentially broken dependency and slow install time.');
|
351
|
+
commandArgs.push('--legacy-peer-deps');
|
352
|
+
await spawnAsync(cliType, commandArgs, opts);
|
353
|
+
}
|
354
|
+
}
|
340
355
|
debug_1.default(`Install complete [${Date.now() - installTime}ms]`);
|
341
356
|
return true;
|
342
357
|
}
|
package/dist/index.js
CHANGED
@@ -30131,14 +30131,18 @@ function cloneEnv(...envs) {
|
|
30131
30131
|
if (env === undefined || env === null) {
|
30132
30132
|
return obj;
|
30133
30133
|
}
|
30134
|
-
// the
|
30135
|
-
|
30136
|
-
|
30137
|
-
|
30138
|
-
|
30139
|
-
|
30140
|
-
|
30141
|
-
|
30134
|
+
// mixin the env first
|
30135
|
+
obj = Object.assign(obj, env);
|
30136
|
+
if (hasOwnProperty.call(env, 'Path')) {
|
30137
|
+
// the system path is called `Path` on Windows and Node.js will
|
30138
|
+
// automatically return the system path when accessing `PATH`,
|
30139
|
+
// however we lose this proxied value when we destructure and
|
30140
|
+
// thus we must explicitly copy it, but we must also remove the
|
30141
|
+
// `Path` property since we can't have both a `PATH` and `Path`
|
30142
|
+
obj.PATH = obj.Path;
|
30143
|
+
delete obj.Path;
|
30144
|
+
}
|
30145
|
+
return obj;
|
30142
30146
|
}, {});
|
30143
30147
|
}
|
30144
30148
|
exports.cloneEnv = cloneEnv;
|
@@ -30185,6 +30189,7 @@ class EdgeFunction {
|
|
30185
30189
|
this.files = params.files;
|
30186
30190
|
this.envVarsInUse = params.envVarsInUse;
|
30187
30191
|
this.assets = params.assets;
|
30192
|
+
this.regions = params.regions;
|
30188
30193
|
}
|
30189
30194
|
}
|
30190
30195
|
exports.EdgeFunction = EdgeFunction;
|
@@ -31172,14 +31177,17 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
31172
31177
|
env,
|
31173
31178
|
});
|
31174
31179
|
let commandArgs;
|
31180
|
+
const isPotentiallyBrokenNpm = cliType === 'npm' &&
|
31181
|
+
nodeVersion?.major === 16 &&
|
31182
|
+
!args.includes('--legacy-peer-deps') &&
|
31183
|
+
spawnOpts?.env?.ENABLE_EXPERIMENTAL_COREPACK !== '1';
|
31175
31184
|
if (cliType === 'npm') {
|
31176
31185
|
opts.prettyCommand = 'npm install';
|
31177
31186
|
commandArgs = args
|
31178
31187
|
.filter(a => a !== '--prefer-offline')
|
31179
31188
|
.concat(['install', '--no-audit', '--unsafe-perm']);
|
31180
|
-
if (
|
31181
|
-
spawnOpts?.env?.VERCEL_NPM_LEGACY_PEER_DEPS === '1'
|
31182
|
-
spawnOpts?.env?.ENABLE_EXPERIMENTAL_COREPACK !== '1') {
|
31189
|
+
if (isPotentiallyBrokenNpm &&
|
31190
|
+
spawnOpts?.env?.VERCEL_NPM_LEGACY_PEER_DEPS === '1') {
|
31183
31191
|
// Starting in npm@8.6.0, if you ran `npm install --legacy-peer-deps`,
|
31184
31192
|
// and then later ran `npm install`, it would fail. So the only way
|
31185
31193
|
// to safely upgrade npm from npm@8.5.0 is to set this flag. The docs
|
@@ -31204,7 +31212,19 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
31204
31212
|
if (process.env.NPM_ONLY_PRODUCTION) {
|
31205
31213
|
commandArgs.push('--production');
|
31206
31214
|
}
|
31207
|
-
|
31215
|
+
try {
|
31216
|
+
await spawnAsync(cliType, commandArgs, opts);
|
31217
|
+
}
|
31218
|
+
catch (_) {
|
31219
|
+
const potentialErrorPath = path_1.default.join(process.env.HOME || '/', '.npm', 'eresolve-report.txt');
|
31220
|
+
if (isPotentiallyBrokenNpm &&
|
31221
|
+
!commandArgs.includes('--legacy-peer-deps') &&
|
31222
|
+
fs_extra_1.default.existsSync(potentialErrorPath)) {
|
31223
|
+
console.warn('Warning: Retrying "Install Command" with `--legacy-peer-deps` which may accept a potentially broken dependency and slow install time.');
|
31224
|
+
commandArgs.push('--legacy-peer-deps');
|
31225
|
+
await spawnAsync(cliType, commandArgs, opts);
|
31226
|
+
}
|
31227
|
+
}
|
31208
31228
|
debug_1.default(`Install complete [${Date.now() - installTime}ms]`);
|
31209
31229
|
return true;
|
31210
31230
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.5.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -47,5 +47,5 @@
|
|
47
47
|
"typescript": "4.3.4",
|
48
48
|
"yazl": "2.5.1"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "a825bc95409aa1403e062e45afebe194c8197061"
|
51
51
|
}
|