@vercel/build-utils 6.7.1 → 6.7.2
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/debug.js +1 -1
- package/dist/file-blob.js +5 -5
- package/dist/file-fs-ref.js +6 -6
- package/dist/file-ref.js +5 -5
- package/dist/fs/download.js +9 -9
- package/dist/fs/get-writable-directory.js +2 -2
- package/dist/fs/glob.js +7 -7
- package/dist/fs/node-version.js +3 -3
- package/dist/fs/read-config-file.js +8 -4
- package/dist/fs/rename.d.ts +1 -1
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +30 -30
- package/dist/fs/stream-to-buffer.js +1 -1
- package/dist/get-ignore-filter.js +1 -1
- package/dist/get-prefixed-env-vars.d.ts +1 -1
- package/dist/index.js +1157 -98
- package/dist/lambda.d.ts +1 -1
- package/dist/lambda.js +21 -21
- package/dist/should-serve.js +1 -1
- package/dist/types.d.ts +12 -12
- package/package.json +4 -3
package/dist/debug.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const get_platform_env_1 = require("./get-platform-env");
|
4
4
|
function debug(message, ...additional) {
|
5
|
-
if (get_platform_env_1.getPlatformEnv('BUILDER_DEBUG')) {
|
5
|
+
if ((0, get_platform_env_1.getPlatformEnv)('BUILDER_DEBUG')) {
|
6
6
|
console.log(message, ...additional);
|
7
7
|
}
|
8
8
|
else if (process.env.VERCEL_DEBUG_PREFIX) {
|
package/dist/file-blob.js
CHANGED
@@ -7,16 +7,16 @@ const assert_1 = __importDefault(require("assert"));
|
|
7
7
|
const into_stream_1 = __importDefault(require("into-stream"));
|
8
8
|
class FileBlob {
|
9
9
|
constructor({ mode = 0o100644, contentType, data }) {
|
10
|
-
assert_1.default(typeof mode === 'number');
|
11
|
-
assert_1.default(typeof data === 'string' || Buffer.isBuffer(data));
|
10
|
+
(0, assert_1.default)(typeof mode === 'number');
|
11
|
+
(0, assert_1.default)(typeof data === 'string' || Buffer.isBuffer(data));
|
12
12
|
this.type = 'FileBlob';
|
13
13
|
this.mode = mode;
|
14
14
|
this.contentType = contentType;
|
15
15
|
this.data = data;
|
16
16
|
}
|
17
17
|
static async fromStream({ mode = 0o100644, contentType, stream, }) {
|
18
|
-
assert_1.default(typeof mode === 'number');
|
19
|
-
assert_1.default(typeof stream.pipe === 'function'); // is-stream
|
18
|
+
(0, assert_1.default)(typeof mode === 'number');
|
19
|
+
(0, assert_1.default)(typeof stream.pipe === 'function'); // is-stream
|
20
20
|
const chunks = [];
|
21
21
|
await new Promise((resolve, reject) => {
|
22
22
|
stream.on('data', chunk => chunks.push(Buffer.from(chunk)));
|
@@ -30,7 +30,7 @@ class FileBlob {
|
|
30
30
|
return this.toStream();
|
31
31
|
}
|
32
32
|
toStream() {
|
33
|
-
return into_stream_1.default(this.data);
|
33
|
+
return (0, into_stream_1.default)(this.data);
|
34
34
|
}
|
35
35
|
}
|
36
36
|
exports.default = FileBlob;
|
package/dist/file-fs-ref.js
CHANGED
@@ -12,8 +12,8 @@ const DEFAULT_SEMA = 20;
|
|
12
12
|
const semaToPreventEMFILE = new async_sema_1.default(parseInt(process.env.VERCEL_INTERNAL_FILE_FS_REF_SEMA || String(DEFAULT_SEMA), 10) || DEFAULT_SEMA);
|
13
13
|
class FileFsRef {
|
14
14
|
constructor({ mode = 0o100644, contentType, fsPath }) {
|
15
|
-
assert_1.default(typeof mode === 'number');
|
16
|
-
assert_1.default(typeof fsPath === 'string');
|
15
|
+
(0, assert_1.default)(typeof mode === 'number');
|
16
|
+
(0, assert_1.default)(typeof fsPath === 'string');
|
17
17
|
this.type = 'FileFsRef';
|
18
18
|
this.mode = mode;
|
19
19
|
this.contentType = contentType;
|
@@ -28,9 +28,9 @@ class FileFsRef {
|
|
28
28
|
return new FileFsRef({ mode: m, contentType, fsPath });
|
29
29
|
}
|
30
30
|
static async fromStream({ mode = 0o100644, contentType, stream, fsPath, }) {
|
31
|
-
assert_1.default(typeof mode === 'number');
|
32
|
-
assert_1.default(typeof stream.pipe === 'function'); // is-stream
|
33
|
-
assert_1.default(typeof fsPath === 'string');
|
31
|
+
(0, assert_1.default)(typeof mode === 'number');
|
32
|
+
(0, assert_1.default)(typeof stream.pipe === 'function'); // is-stream
|
33
|
+
(0, assert_1.default)(typeof fsPath === 'string');
|
34
34
|
await fs_extra_1.default.mkdirp(path_1.default.dirname(fsPath));
|
35
35
|
await new Promise((resolve, reject) => {
|
36
36
|
const dest = fs_extra_1.default.createWriteStream(fsPath, {
|
@@ -54,7 +54,7 @@ class FileFsRef {
|
|
54
54
|
toStream() {
|
55
55
|
let flag = false;
|
56
56
|
// eslint-disable-next-line consistent-return
|
57
|
-
return multistream_1.default(cb => {
|
57
|
+
return (0, multistream_1.default)(cb => {
|
58
58
|
if (flag)
|
59
59
|
return cb(null, null);
|
60
60
|
flag = true;
|
package/dist/file-ref.js
CHANGED
@@ -18,8 +18,8 @@ class BailableError extends Error {
|
|
18
18
|
}
|
19
19
|
class FileRef {
|
20
20
|
constructor({ mode = 0o100644, digest, contentType, mutable = false, }) {
|
21
|
-
assert_1.default(typeof mode === 'number');
|
22
|
-
assert_1.default(typeof digest === 'string');
|
21
|
+
(0, assert_1.default)(typeof mode === 'number');
|
22
|
+
(0, assert_1.default)(typeof digest === 'string');
|
23
23
|
this.type = 'FileRef';
|
24
24
|
this.mode = mode;
|
25
25
|
this.digest = digest;
|
@@ -50,8 +50,8 @@ class FileRef {
|
|
50
50
|
await semaToDownloadFromS3.acquire();
|
51
51
|
// console.time(`downloading ${url}`);
|
52
52
|
try {
|
53
|
-
return await async_retry_1.default(async () => {
|
54
|
-
const resp = await node_fetch_1.default(url);
|
53
|
+
return await (0, async_retry_1.default)(async () => {
|
54
|
+
const resp = await (0, node_fetch_1.default)(url);
|
55
55
|
if (!resp.ok) {
|
56
56
|
const error = new BailableError(`download: ${resp.status} ${resp.statusText} for ${url}`);
|
57
57
|
if (resp.status === 403)
|
@@ -69,7 +69,7 @@ class FileRef {
|
|
69
69
|
toStream() {
|
70
70
|
let flag = false;
|
71
71
|
// eslint-disable-next-line consistent-return
|
72
|
-
return multistream_1.default(cb => {
|
72
|
+
return (0, multistream_1.default)(cb => {
|
73
73
|
if (flag)
|
74
74
|
return cb(null, null);
|
75
75
|
flag = true;
|
package/dist/fs/download.js
CHANGED
@@ -21,13 +21,13 @@ function isSymbolicLink(mode) {
|
|
21
21
|
}
|
22
22
|
exports.isSymbolicLink = isSymbolicLink;
|
23
23
|
async function prepareSymlinkTarget(file, fsPath) {
|
24
|
-
const mkdirPromise = fs_extra_1.mkdirp(path_1.default.dirname(fsPath));
|
24
|
+
const mkdirPromise = (0, fs_extra_1.mkdirp)(path_1.default.dirname(fsPath));
|
25
25
|
if (file.type === 'FileFsRef') {
|
26
|
-
const [target] = await Promise.all([fs_extra_1.readlink(file.fsPath), mkdirPromise]);
|
26
|
+
const [target] = await Promise.all([(0, fs_extra_1.readlink)(file.fsPath), mkdirPromise]);
|
27
27
|
return target;
|
28
28
|
}
|
29
29
|
if (file.type === 'FileRef' || file.type === 'FileBlob') {
|
30
|
-
const targetPathBufferPromise = stream_to_buffer_1.default(await file.toStreamAsync());
|
30
|
+
const targetPathBufferPromise = (0, stream_to_buffer_1.default)(await file.toStreamAsync());
|
31
31
|
const [targetPathBuffer] = await Promise.all([
|
32
32
|
targetPathBufferPromise,
|
33
33
|
mkdirPromise,
|
@@ -39,8 +39,8 @@ async function prepareSymlinkTarget(file, fsPath) {
|
|
39
39
|
async function downloadFile(file, fsPath) {
|
40
40
|
const { mode } = file;
|
41
41
|
if (isDirectory(mode)) {
|
42
|
-
await fs_extra_1.mkdirp(fsPath);
|
43
|
-
await fs_extra_1.chmod(fsPath, mode);
|
42
|
+
await (0, fs_extra_1.mkdirp)(fsPath);
|
43
|
+
await (0, fs_extra_1.chmod)(fsPath, mode);
|
44
44
|
return file_fs_ref_1.default.fromFsPath({ mode, fsPath });
|
45
45
|
}
|
46
46
|
// If the source is a symlink, try to create it instead of copying the file.
|
@@ -48,7 +48,7 @@ async function downloadFile(file, fsPath) {
|
|
48
48
|
// enabled in the group policy. We may want to improve the error message.
|
49
49
|
if (isSymbolicLink(mode)) {
|
50
50
|
const target = await prepareSymlinkTarget(file, fsPath);
|
51
|
-
await fs_extra_1.symlink(target, fsPath);
|
51
|
+
await (0, fs_extra_1.symlink)(target, fsPath);
|
52
52
|
return file_fs_ref_1.default.fromFsPath({ mode, fsPath });
|
53
53
|
}
|
54
54
|
const stream = file.toStream();
|
@@ -57,7 +57,7 @@ async function downloadFile(file, fsPath) {
|
|
57
57
|
exports.downloadFile = downloadFile;
|
58
58
|
async function removeFile(basePath, fileMatched) {
|
59
59
|
const file = path_1.default.join(basePath, fileMatched);
|
60
|
-
await fs_extra_1.remove(file);
|
60
|
+
await (0, fs_extra_1.remove)(file);
|
61
61
|
}
|
62
62
|
async function download(files, basePath, meta) {
|
63
63
|
const { isDev = false, skipDownload = false, filesChanged = null, filesRemoved = null, } = meta || {};
|
@@ -67,7 +67,7 @@ async function download(files, basePath, meta) {
|
|
67
67
|
// source files are already available.
|
68
68
|
return files;
|
69
69
|
}
|
70
|
-
debug_1.default('Downloading deployment source files...');
|
70
|
+
(0, debug_1.default)('Downloading deployment source files...');
|
71
71
|
const start = Date.now();
|
72
72
|
const files2 = {};
|
73
73
|
const filenames = Object.keys(files);
|
@@ -100,7 +100,7 @@ async function download(files, basePath, meta) {
|
|
100
100
|
files2[name] = await downloadFile(file, fsPath);
|
101
101
|
}));
|
102
102
|
const duration = Date.now() - start;
|
103
|
-
debug_1.default(`Downloaded ${filenames.length} source files: ${duration}ms`);
|
103
|
+
(0, debug_1.default)(`Downloaded ${filenames.length} source files: ${duration}ms`);
|
104
104
|
return files2;
|
105
105
|
}
|
106
106
|
exports.default = download;
|
@@ -5,8 +5,8 @@ const os_1 = require("os");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
6
6
|
async function getWritableDirectory() {
|
7
7
|
const name = Math.floor(Math.random() * 0x7fffffff).toString(16);
|
8
|
-
const directory = path_1.join(os_1.tmpdir(), name);
|
9
|
-
await fs_extra_1.mkdirp(directory);
|
8
|
+
const directory = (0, path_1.join)((0, os_1.tmpdir)(), name);
|
9
|
+
await (0, fs_extra_1.mkdirp)(directory);
|
10
10
|
return directory;
|
11
11
|
}
|
12
12
|
exports.default = getWritableDirectory;
|
package/dist/fs/glob.js
CHANGED
@@ -10,7 +10,7 @@ const util_1 = require("util");
|
|
10
10
|
const fs_extra_1 = require("fs-extra");
|
11
11
|
const normalize_path_1 = require("./normalize-path");
|
12
12
|
const file_fs_ref_1 = __importDefault(require("../file-fs-ref"));
|
13
|
-
const vanillaGlob = util_1.promisify(glob_1.default);
|
13
|
+
const vanillaGlob = (0, util_1.promisify)(glob_1.default);
|
14
14
|
async function glob(pattern, opts, mountpoint) {
|
15
15
|
const options = typeof opts === 'string' ? { cwd: opts } : opts;
|
16
16
|
if (!options.cwd) {
|
@@ -33,15 +33,15 @@ async function glob(pattern, opts, mountpoint) {
|
|
33
33
|
const dirsWithEntries = new Set();
|
34
34
|
for (const relativePath of files) {
|
35
35
|
const absPath = path_1.default.join(options.cwd, relativePath);
|
36
|
-
const fsPath = normalize_path_1.normalizePath(absPath);
|
36
|
+
const fsPath = (0, normalize_path_1.normalizePath)(absPath);
|
37
37
|
let stat = statCache[fsPath];
|
38
|
-
assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
|
38
|
+
(0, assert_1.default)(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
|
39
39
|
const isSymlink = symlinks[fsPath];
|
40
40
|
// When `follow` mode is enabled, ensure that the entry is not a symlink
|
41
41
|
// that points to outside of `cwd`
|
42
42
|
if (options.follow &&
|
43
|
-
(isSymlink || (await fs_extra_1.lstat(fsPath)).isSymbolicLink())) {
|
44
|
-
const target = await fs_extra_1.readlink(absPath);
|
43
|
+
(isSymlink || (await (0, fs_extra_1.lstat)(fsPath)).isSymbolicLink())) {
|
44
|
+
const target = await (0, fs_extra_1.readlink)(absPath);
|
45
45
|
const absTarget = path_1.default.resolve(path_1.default.dirname(absPath), target);
|
46
46
|
if (path_1.default.relative(options.cwd, absTarget).startsWith(`..${path_1.default.sep}`)) {
|
47
47
|
continue;
|
@@ -49,7 +49,7 @@ async function glob(pattern, opts, mountpoint) {
|
|
49
49
|
}
|
50
50
|
if (isSymlink || stat.isFile() || stat.isDirectory()) {
|
51
51
|
if (isSymlink) {
|
52
|
-
stat = await fs_extra_1.lstat(absPath);
|
52
|
+
stat = await (0, fs_extra_1.lstat)(absPath);
|
53
53
|
}
|
54
54
|
// Some bookkeeping to track which directories already have entries within
|
55
55
|
const dirname = path_1.default.dirname(relativePath);
|
@@ -74,7 +74,7 @@ async function glob(pattern, opts, mountpoint) {
|
|
74
74
|
if (mountpoint) {
|
75
75
|
finalPath = path_1.default.join(mountpoint, finalPath);
|
76
76
|
}
|
77
|
-
const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath));
|
77
|
+
const fsPath = (0, normalize_path_1.normalizePath)(path_1.default.join(options.cwd, relativePath));
|
78
78
|
const stat = statCache[fsPath];
|
79
79
|
results[finalPath] = new file_fs_ref_1.default({ mode: stat.mode, fsPath });
|
80
80
|
}
|
package/dist/fs/node-version.js
CHANGED
@@ -50,12 +50,12 @@ exports.getDiscontinuedNodeVersions = getDiscontinuedNodeVersions;
|
|
50
50
|
async function getSupportedNodeVersion(engineRange, isAuto = false) {
|
51
51
|
let selection = getLatestNodeVersion();
|
52
52
|
if (engineRange) {
|
53
|
-
const found = semver_1.validRange(engineRange) &&
|
53
|
+
const found = (0, semver_1.validRange)(engineRange) &&
|
54
54
|
getOptions().some(o => {
|
55
55
|
// the array is already in order so return the first
|
56
56
|
// match which will be the newest version of node
|
57
57
|
selection = o;
|
58
|
-
return semver_1.intersects(o.range, engineRange);
|
58
|
+
return (0, semver_1.intersects)(o.range, engineRange);
|
59
59
|
});
|
60
60
|
if (!found) {
|
61
61
|
throw new errors_1.NowBuildError({
|
@@ -73,7 +73,7 @@ async function getSupportedNodeVersion(engineRange, isAuto = false) {
|
|
73
73
|
message: `${intro} ${getHint(isAuto)}`,
|
74
74
|
});
|
75
75
|
}
|
76
|
-
debug_1.default(`Selected Node.js ${selection.range}`);
|
76
|
+
(0, debug_1.default)(`Selected Node.js ${selection.range}`);
|
77
77
|
if (selection.discontinueDate) {
|
78
78
|
const d = selection.discontinueDate.toISOString().split('T')[0];
|
79
79
|
console.warn(`Error: Node.js version ${selection.range} has reached End-of-Life. Deployments created on or after ${d} will fail to build. ${getHint(isAuto)}`);
|
@@ -7,14 +7,18 @@ exports.readConfigFile = void 0;
|
|
7
7
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
8
8
|
const toml_1 = __importDefault(require("@iarna/toml"));
|
9
9
|
const fs_extra_1 = require("fs-extra");
|
10
|
+
const error_utils_1 = require("@vercel/error-utils");
|
10
11
|
async function readFileOrNull(file) {
|
11
12
|
try {
|
12
|
-
const data = await fs_extra_1.readFile(file);
|
13
|
+
const data = await (0, fs_extra_1.readFile)(file);
|
13
14
|
return data;
|
14
15
|
}
|
15
|
-
catch (
|
16
|
-
if (
|
17
|
-
throw
|
16
|
+
catch (error) {
|
17
|
+
if (!(0, error_utils_1.isErrnoException)(error)) {
|
18
|
+
throw error;
|
19
|
+
}
|
20
|
+
if (error.code !== 'ENOENT') {
|
21
|
+
throw error;
|
18
22
|
}
|
19
23
|
}
|
20
24
|
return null;
|
package/dist/fs/rename.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { SpawnOptions } from 'child_process';
|
3
3
|
import { Meta, PackageJson, NodeVersion, Config } from '../types';
|
4
|
-
export
|
4
|
+
export type CliType = 'yarn' | 'npm' | 'pnpm';
|
5
5
|
export interface ScanParentDirsResult {
|
6
6
|
/**
|
7
7
|
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
@@ -22,7 +22,7 @@ function spawnAsync(command, args, opts = {}) {
|
|
22
22
|
return new Promise((resolve, reject) => {
|
23
23
|
const stderrLogs = [];
|
24
24
|
opts = { stdio: 'inherit', ...opts };
|
25
|
-
const child = cross_spawn_1.default(command, args, opts);
|
25
|
+
const child = (0, cross_spawn_1.default)(command, args, opts);
|
26
26
|
if (opts.stdio === 'pipe' && child.stderr) {
|
27
27
|
child.stderr.on('data', data => stderrLogs.push(data));
|
28
28
|
}
|
@@ -47,9 +47,9 @@ exports.spawnAsync = spawnAsync;
|
|
47
47
|
function spawnCommand(command, options = {}) {
|
48
48
|
const opts = { ...options, prettyCommand: command };
|
49
49
|
if (process.platform === 'win32') {
|
50
|
-
return cross_spawn_1.default('cmd.exe', ['/C', command], opts);
|
50
|
+
return (0, cross_spawn_1.default)('cmd.exe', ['/C', command], opts);
|
51
51
|
}
|
52
|
-
return cross_spawn_1.default('sh', ['-c', command], opts);
|
52
|
+
return (0, cross_spawn_1.default)('sh', ['-c', command], opts);
|
53
53
|
}
|
54
54
|
exports.spawnCommand = spawnCommand;
|
55
55
|
async function execCommand(command, options = {}) {
|
@@ -78,7 +78,7 @@ async function chmodPlusX(fsPath) {
|
|
78
78
|
await fs_extra_1.default.chmod(fsPath, base8);
|
79
79
|
}
|
80
80
|
async function runShellScript(fsPath, args = [], spawnOpts) {
|
81
|
-
assert_1.default(path_1.default.isAbsolute(fsPath));
|
81
|
+
(0, assert_1.default)(path_1.default.isAbsolute(fsPath));
|
82
82
|
const destPath = path_1.default.dirname(fsPath);
|
83
83
|
await chmodPlusX(fsPath);
|
84
84
|
const command = `./${path_1.default.basename(fsPath)}`;
|
@@ -92,7 +92,7 @@ async function runShellScript(fsPath, args = [], spawnOpts) {
|
|
92
92
|
exports.runShellScript = runShellScript;
|
93
93
|
function getSpawnOptions(meta, nodeVersion) {
|
94
94
|
const opts = {
|
95
|
-
env: clone_env_1.cloneEnv(process.env),
|
95
|
+
env: (0, clone_env_1.cloneEnv)(process.env),
|
96
96
|
};
|
97
97
|
if (!meta.isDev) {
|
98
98
|
let found = false;
|
@@ -114,7 +114,7 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
114
114
|
}
|
115
115
|
exports.getSpawnOptions = getSpawnOptions;
|
116
116
|
async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}) {
|
117
|
-
const latest = node_version_1.getLatestNodeVersion();
|
117
|
+
const latest = (0, node_version_1.getLatestNodeVersion)();
|
118
118
|
if (meta.isDev) {
|
119
119
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
120
120
|
return { ...latest, runtime: 'nodejs' };
|
@@ -124,23 +124,23 @@ async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL
|
|
124
124
|
let isAuto = true;
|
125
125
|
if (packageJson?.engines?.node) {
|
126
126
|
const { node } = packageJson.engines;
|
127
|
-
if (nodeVersion && semver_1.validRange(node) && !semver_1.intersects(nodeVersion, node)) {
|
127
|
+
if (nodeVersion && (0, semver_1.validRange)(node) && !(0, semver_1.intersects)(nodeVersion, node)) {
|
128
128
|
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`);
|
129
129
|
}
|
130
|
-
else if (semver_1.coerce(node)?.raw === node) {
|
130
|
+
else if ((0, semver_1.coerce)(node)?.raw === node) {
|
131
131
|
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`);
|
132
132
|
}
|
133
|
-
else if (semver_1.validRange(node) && semver_1.intersects(`${latest.major + 1}.x`, node)) {
|
133
|
+
else if ((0, semver_1.validRange)(node) && (0, semver_1.intersects)(`${latest.major + 1}.x`, node)) {
|
134
134
|
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`);
|
135
135
|
}
|
136
136
|
nodeVersion = node;
|
137
137
|
isAuto = false;
|
138
138
|
}
|
139
|
-
return node_version_1.getSupportedNodeVersion(nodeVersion, isAuto);
|
139
|
+
return (0, node_version_1.getSupportedNodeVersion)(nodeVersion, isAuto);
|
140
140
|
}
|
141
141
|
exports.getNodeVersion = getNodeVersion;
|
142
142
|
async function scanParentDirs(destPath, readPackageJson = false) {
|
143
|
-
assert_1.default(path_1.default.isAbsolute(destPath));
|
143
|
+
(0, assert_1.default)(path_1.default.isAbsolute(destPath));
|
144
144
|
const pkgJsonPath = await walkParentDirs({
|
145
145
|
base: '/',
|
146
146
|
start: destPath,
|
@@ -160,10 +160,10 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
160
160
|
const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
|
161
161
|
Boolean(yarnLockPath),
|
162
162
|
npmLockPath
|
163
|
-
? read_config_file_1.readConfigFile(npmLockPath)
|
163
|
+
? (0, read_config_file_1.readConfigFile)(npmLockPath)
|
164
164
|
: null,
|
165
165
|
pnpmLockPath
|
166
|
-
? read_config_file_1.readConfigFile(pnpmLockPath)
|
166
|
+
? (0, read_config_file_1.readConfigFile)(pnpmLockPath)
|
167
167
|
: null,
|
168
168
|
]);
|
169
169
|
// Priority order is Yarn > pnpm > npm
|
@@ -192,8 +192,8 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
192
192
|
}
|
193
193
|
exports.scanParentDirs = scanParentDirs;
|
194
194
|
async function walkParentDirs({ base, start, filename, }) {
|
195
|
-
assert_1.default(path_1.default.isAbsolute(base), 'Expected "base" to be absolute path');
|
196
|
-
assert_1.default(path_1.default.isAbsolute(start), 'Expected "start" to be absolute path');
|
195
|
+
(0, assert_1.default)(path_1.default.isAbsolute(base), 'Expected "base" to be absolute path');
|
196
|
+
(0, assert_1.default)(path_1.default.isAbsolute(start), 'Expected "start" to be absolute path');
|
197
197
|
let parent = '';
|
198
198
|
for (let current = start; base.length <= current.length; current = parent) {
|
199
199
|
const fullPath = path_1.default.join(current, filename);
|
@@ -232,10 +232,10 @@ function isSet(v) {
|
|
232
232
|
}
|
233
233
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
234
234
|
if (meta?.isDev) {
|
235
|
-
debug_1.default('Skipping dependency installation because dev mode is enabled');
|
235
|
+
(0, debug_1.default)('Skipping dependency installation because dev mode is enabled');
|
236
236
|
return false;
|
237
237
|
}
|
238
|
-
assert_1.default(path_1.default.isAbsolute(destPath));
|
238
|
+
(0, assert_1.default)(path_1.default.isAbsolute(destPath));
|
239
239
|
try {
|
240
240
|
await runNpmInstallSema.acquire();
|
241
241
|
const { cliType, packageJsonPath, lockfileVersion } = await scanParentDirs(destPath);
|
@@ -256,9 +256,9 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
256
256
|
}
|
257
257
|
const installTime = Date.now();
|
258
258
|
console.log('Installing dependencies...');
|
259
|
-
debug_1.default(`Installing to ${destPath}`);
|
259
|
+
(0, debug_1.default)(`Installing to ${destPath}`);
|
260
260
|
const opts = { cwd: destPath, ...spawnOpts };
|
261
|
-
const env = clone_env_1.cloneEnv(opts.env || process.env);
|
261
|
+
const env = (0, clone_env_1.cloneEnv)(opts.env || process.env);
|
262
262
|
delete env.NODE_ENV;
|
263
263
|
opts.env = getEnvForPackageManager({
|
264
264
|
cliType,
|
@@ -319,7 +319,7 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
319
319
|
throw err;
|
320
320
|
}
|
321
321
|
}
|
322
|
-
debug_1.default(`Install complete [${Date.now() - installTime}ms]`);
|
322
|
+
(0, debug_1.default)(`Install complete [${Date.now() - installTime}ms]`);
|
323
323
|
return true;
|
324
324
|
}
|
325
325
|
finally {
|
@@ -381,7 +381,7 @@ async function runCustomInstallCommand({ destPath, installCommand, nodeVersion,
|
|
381
381
|
nodeVersion,
|
382
382
|
env: spawnOpts?.env || {},
|
383
383
|
});
|
384
|
-
debug_1.default(`Running with $PATH:`, env?.PATH || '');
|
384
|
+
(0, debug_1.default)(`Running with $PATH:`, env?.PATH || '');
|
385
385
|
await execCommand(installCommand, {
|
386
386
|
...spawnOpts,
|
387
387
|
env,
|
@@ -390,12 +390,12 @@ async function runCustomInstallCommand({ destPath, installCommand, nodeVersion,
|
|
390
390
|
}
|
391
391
|
exports.runCustomInstallCommand = runCustomInstallCommand;
|
392
392
|
async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
393
|
-
assert_1.default(path_1.default.isAbsolute(destPath));
|
393
|
+
(0, assert_1.default)(path_1.default.isAbsolute(destPath));
|
394
394
|
const { packageJson, cliType, lockfileVersion } = await scanParentDirs(destPath, true);
|
395
395
|
const scriptName = getScriptName(packageJson, typeof scriptNames === 'string' ? [scriptNames] : scriptNames);
|
396
396
|
if (!scriptName)
|
397
397
|
return false;
|
398
|
-
debug_1.default('Running user script...');
|
398
|
+
(0, debug_1.default)('Running user script...');
|
399
399
|
const runScriptTime = Date.now();
|
400
400
|
const opts = {
|
401
401
|
cwd: destPath,
|
@@ -404,7 +404,7 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
404
404
|
cliType,
|
405
405
|
lockfileVersion,
|
406
406
|
nodeVersion: undefined,
|
407
|
-
env: clone_env_1.cloneEnv(process.env, spawnOpts?.env),
|
407
|
+
env: (0, clone_env_1.cloneEnv)(process.env, spawnOpts?.env),
|
408
408
|
}),
|
409
409
|
};
|
410
410
|
if (cliType === 'npm') {
|
@@ -418,26 +418,26 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
418
418
|
}
|
419
419
|
console.log(`Running "${opts.prettyCommand}"`);
|
420
420
|
await spawnAsync(cliType, ['run', scriptName], opts);
|
421
|
-
debug_1.default(`Script complete [${Date.now() - runScriptTime}ms]`);
|
421
|
+
(0, debug_1.default)(`Script complete [${Date.now() - runScriptTime}ms]`);
|
422
422
|
return true;
|
423
423
|
}
|
424
424
|
exports.runPackageJsonScript = runPackageJsonScript;
|
425
425
|
async function runBundleInstall(destPath, args = [], spawnOpts, meta) {
|
426
426
|
if (meta && meta.isDev) {
|
427
|
-
debug_1.default('Skipping dependency installation because dev mode is enabled');
|
427
|
+
(0, debug_1.default)('Skipping dependency installation because dev mode is enabled');
|
428
428
|
return;
|
429
429
|
}
|
430
|
-
assert_1.default(path_1.default.isAbsolute(destPath));
|
430
|
+
(0, assert_1.default)(path_1.default.isAbsolute(destPath));
|
431
431
|
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: 'bundle install' };
|
432
432
|
await spawnAsync('bundle', args.concat(['install']), opts);
|
433
433
|
}
|
434
434
|
exports.runBundleInstall = runBundleInstall;
|
435
435
|
async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
436
436
|
if (meta && meta.isDev) {
|
437
|
-
debug_1.default('Skipping dependency installation because dev mode is enabled');
|
437
|
+
(0, debug_1.default)('Skipping dependency installation because dev mode is enabled');
|
438
438
|
return;
|
439
439
|
}
|
440
|
-
assert_1.default(path_1.default.isAbsolute(destPath));
|
440
|
+
(0, assert_1.default)(path_1.default.isAbsolute(destPath));
|
441
441
|
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: 'pip3 install' };
|
442
442
|
await spawnAsync('pip3', ['install', '--disable-pip-version-check', ...args], opts);
|
443
443
|
}
|
@@ -457,4 +457,4 @@ exports.getScriptName = getScriptName;
|
|
457
457
|
* @deprecate installDependencies() is deprecated.
|
458
458
|
* Please use runNpmInstall() instead.
|
459
459
|
*/
|
460
|
-
exports.installDependencies = util_1.deprecate(runNpmInstall, 'installDependencies() is deprecated. Please use runNpmInstall() instead.');
|
460
|
+
exports.installDependencies = (0, util_1.deprecate)(runNpmInstall, 'installDependencies() is deprecated. Please use runNpmInstall() instead.');
|
@@ -8,7 +8,7 @@ function streamToBuffer(stream) {
|
|
8
8
|
return new Promise((resolve, reject) => {
|
9
9
|
const buffers = [];
|
10
10
|
stream.on('data', buffers.push.bind(buffers));
|
11
|
-
end_of_stream_1.default(stream, err => {
|
11
|
+
(0, end_of_stream_1.default)(stream, err => {
|
12
12
|
if (err) {
|
13
13
|
reject(err);
|
14
14
|
return;
|
@@ -47,7 +47,7 @@ async function default_1(downloadPath, rootDirectory) {
|
|
47
47
|
if (ignoreContents.length === 0) {
|
48
48
|
return () => false;
|
49
49
|
}
|
50
|
-
const ignoreFilter = ignore_1.default().add(clearRelative(ignoreContents[0]));
|
50
|
+
const ignoreFilter = (0, ignore_1.default)().add(clearRelative(ignoreContents[0]));
|
51
51
|
return function (p) {
|
52
52
|
// we should not ignore now.json and vercel.json if it asked to.
|
53
53
|
// we depend on these files for building the app with sourceless
|