@vercel/build-utils
Advanced tools
Comparing version 6.7.1 to 6.7.2
@@ -5,3 +5,3 @@ "use strict"; | ||
function debug(message, ...additional) { | ||
if (get_platform_env_1.getPlatformEnv('BUILDER_DEBUG')) { | ||
if ((0, get_platform_env_1.getPlatformEnv)('BUILDER_DEBUG')) { | ||
console.log(message, ...additional); | ||
@@ -8,0 +8,0 @@ } |
@@ -10,4 +10,4 @@ "use strict"; | ||
constructor({ mode = 0o100644, contentType, data }) { | ||
assert_1.default(typeof mode === 'number'); | ||
assert_1.default(typeof data === 'string' || Buffer.isBuffer(data)); | ||
(0, assert_1.default)(typeof mode === 'number'); | ||
(0, assert_1.default)(typeof data === 'string' || Buffer.isBuffer(data)); | ||
this.type = 'FileBlob'; | ||
@@ -19,4 +19,4 @@ this.mode = mode; | ||
static async fromStream({ mode = 0o100644, contentType, stream, }) { | ||
assert_1.default(typeof mode === 'number'); | ||
assert_1.default(typeof stream.pipe === 'function'); // is-stream | ||
(0, assert_1.default)(typeof mode === 'number'); | ||
(0, assert_1.default)(typeof stream.pipe === 'function'); // is-stream | ||
const chunks = []; | ||
@@ -35,5 +35,5 @@ await new Promise((resolve, reject) => { | ||
toStream() { | ||
return into_stream_1.default(this.data); | ||
return (0, into_stream_1.default)(this.data); | ||
} | ||
} | ||
exports.default = FileBlob; |
@@ -15,4 +15,4 @@ "use strict"; | ||
constructor({ mode = 0o100644, contentType, fsPath }) { | ||
assert_1.default(typeof mode === 'number'); | ||
assert_1.default(typeof fsPath === 'string'); | ||
(0, assert_1.default)(typeof mode === 'number'); | ||
(0, assert_1.default)(typeof fsPath === 'string'); | ||
this.type = 'FileFsRef'; | ||
@@ -32,5 +32,5 @@ this.mode = mode; | ||
static async fromStream({ mode = 0o100644, contentType, stream, fsPath, }) { | ||
assert_1.default(typeof mode === 'number'); | ||
assert_1.default(typeof stream.pipe === 'function'); // is-stream | ||
assert_1.default(typeof fsPath === 'string'); | ||
(0, assert_1.default)(typeof mode === 'number'); | ||
(0, assert_1.default)(typeof stream.pipe === 'function'); // is-stream | ||
(0, assert_1.default)(typeof fsPath === 'string'); | ||
await fs_extra_1.default.mkdirp(path_1.default.dirname(fsPath)); | ||
@@ -59,3 +59,3 @@ await new Promise((resolve, reject) => { | ||
// eslint-disable-next-line consistent-return | ||
return multistream_1.default(cb => { | ||
return (0, multistream_1.default)(cb => { | ||
if (flag) | ||
@@ -62,0 +62,0 @@ return cb(null, null); |
@@ -21,4 +21,4 @@ "use strict"; | ||
constructor({ mode = 0o100644, digest, contentType, mutable = false, }) { | ||
assert_1.default(typeof mode === 'number'); | ||
assert_1.default(typeof digest === 'string'); | ||
(0, assert_1.default)(typeof mode === 'number'); | ||
(0, assert_1.default)(typeof digest === 'string'); | ||
this.type = 'FileRef'; | ||
@@ -54,4 +54,4 @@ this.mode = mode; | ||
try { | ||
return await async_retry_1.default(async () => { | ||
const resp = await node_fetch_1.default(url); | ||
return await (0, async_retry_1.default)(async () => { | ||
const resp = await (0, node_fetch_1.default)(url); | ||
if (!resp.ok) { | ||
@@ -74,3 +74,3 @@ const error = new BailableError(`download: ${resp.status} ${resp.statusText} for ${url}`); | ||
// eslint-disable-next-line consistent-return | ||
return multistream_1.default(cb => { | ||
return (0, multistream_1.default)(cb => { | ||
if (flag) | ||
@@ -77,0 +77,0 @@ return cb(null, null); |
@@ -24,9 +24,9 @@ "use strict"; | ||
async function prepareSymlinkTarget(file, fsPath) { | ||
const mkdirPromise = fs_extra_1.mkdirp(path_1.default.dirname(fsPath)); | ||
const mkdirPromise = (0, fs_extra_1.mkdirp)(path_1.default.dirname(fsPath)); | ||
if (file.type === 'FileFsRef') { | ||
const [target] = await Promise.all([fs_extra_1.readlink(file.fsPath), mkdirPromise]); | ||
const [target] = await Promise.all([(0, fs_extra_1.readlink)(file.fsPath), mkdirPromise]); | ||
return target; | ||
} | ||
if (file.type === 'FileRef' || file.type === 'FileBlob') { | ||
const targetPathBufferPromise = stream_to_buffer_1.default(await file.toStreamAsync()); | ||
const targetPathBufferPromise = (0, stream_to_buffer_1.default)(await file.toStreamAsync()); | ||
const [targetPathBuffer] = await Promise.all([ | ||
@@ -43,4 +43,4 @@ targetPathBufferPromise, | ||
if (isDirectory(mode)) { | ||
await fs_extra_1.mkdirp(fsPath); | ||
await fs_extra_1.chmod(fsPath, mode); | ||
await (0, fs_extra_1.mkdirp)(fsPath); | ||
await (0, fs_extra_1.chmod)(fsPath, mode); | ||
return file_fs_ref_1.default.fromFsPath({ mode, fsPath }); | ||
@@ -53,3 +53,3 @@ } | ||
const target = await prepareSymlinkTarget(file, fsPath); | ||
await fs_extra_1.symlink(target, fsPath); | ||
await (0, fs_extra_1.symlink)(target, fsPath); | ||
return file_fs_ref_1.default.fromFsPath({ mode, fsPath }); | ||
@@ -63,3 +63,3 @@ } | ||
const file = path_1.default.join(basePath, fileMatched); | ||
await fs_extra_1.remove(file); | ||
await (0, fs_extra_1.remove)(file); | ||
} | ||
@@ -74,3 +74,3 @@ async function download(files, basePath, meta) { | ||
} | ||
debug_1.default('Downloading deployment source files...'); | ||
(0, debug_1.default)('Downloading deployment source files...'); | ||
const start = Date.now(); | ||
@@ -108,5 +108,5 @@ const files2 = {}; | ||
const duration = Date.now() - start; | ||
debug_1.default(`Downloaded ${filenames.length} source files: ${duration}ms`); | ||
(0, debug_1.default)(`Downloaded ${filenames.length} source files: ${duration}ms`); | ||
return files2; | ||
} | ||
exports.default = download; |
@@ -8,6 +8,6 @@ "use strict"; | ||
const name = Math.floor(Math.random() * 0x7fffffff).toString(16); | ||
const directory = path_1.join(os_1.tmpdir(), name); | ||
await fs_extra_1.mkdirp(directory); | ||
const directory = (0, path_1.join)((0, os_1.tmpdir)(), name); | ||
await (0, fs_extra_1.mkdirp)(directory); | ||
return directory; | ||
} | ||
exports.default = getWritableDirectory; |
@@ -13,3 +13,3 @@ "use strict"; | ||
const file_fs_ref_1 = __importDefault(require("../file-fs-ref")); | ||
const vanillaGlob = util_1.promisify(glob_1.default); | ||
const vanillaGlob = (0, util_1.promisify)(glob_1.default); | ||
async function glob(pattern, opts, mountpoint) { | ||
@@ -37,5 +37,5 @@ const options = typeof opts === 'string' ? { cwd: opts } : opts; | ||
const absPath = path_1.default.join(options.cwd, relativePath); | ||
const fsPath = normalize_path_1.normalizePath(absPath); | ||
const fsPath = (0, normalize_path_1.normalizePath)(absPath); | ||
let stat = statCache[fsPath]; | ||
assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`); | ||
(0, assert_1.default)(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`); | ||
const isSymlink = symlinks[fsPath]; | ||
@@ -45,4 +45,4 @@ // When `follow` mode is enabled, ensure that the entry is not a symlink | ||
if (options.follow && | ||
(isSymlink || (await fs_extra_1.lstat(fsPath)).isSymbolicLink())) { | ||
const target = await fs_extra_1.readlink(absPath); | ||
(isSymlink || (await (0, fs_extra_1.lstat)(fsPath)).isSymbolicLink())) { | ||
const target = await (0, fs_extra_1.readlink)(absPath); | ||
const absTarget = path_1.default.resolve(path_1.default.dirname(absPath), target); | ||
@@ -55,3 +55,3 @@ if (path_1.default.relative(options.cwd, absTarget).startsWith(`..${path_1.default.sep}`)) { | ||
if (isSymlink) { | ||
stat = await fs_extra_1.lstat(absPath); | ||
stat = await (0, fs_extra_1.lstat)(absPath); | ||
} | ||
@@ -81,3 +81,3 @@ // Some bookkeeping to track which directories already have entries within | ||
} | ||
const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath)); | ||
const fsPath = (0, normalize_path_1.normalizePath)(path_1.default.join(options.cwd, relativePath)); | ||
const stat = statCache[fsPath]; | ||
@@ -84,0 +84,0 @@ results[finalPath] = new file_fs_ref_1.default({ mode: stat.mode, fsPath }); |
@@ -53,3 +53,3 @@ "use strict"; | ||
if (engineRange) { | ||
const found = semver_1.validRange(engineRange) && | ||
const found = (0, semver_1.validRange)(engineRange) && | ||
getOptions().some(o => { | ||
@@ -59,3 +59,3 @@ // the array is already in order so return the first | ||
selection = o; | ||
return semver_1.intersects(o.range, engineRange); | ||
return (0, semver_1.intersects)(o.range, engineRange); | ||
}); | ||
@@ -78,3 +78,3 @@ if (!found) { | ||
} | ||
debug_1.default(`Selected Node.js ${selection.range}`); | ||
(0, debug_1.default)(`Selected Node.js ${selection.range}`); | ||
if (selection.discontinueDate) { | ||
@@ -81,0 +81,0 @@ const d = selection.discontinueDate.toISOString().split('T')[0]; |
@@ -10,11 +10,15 @@ "use strict"; | ||
const fs_extra_1 = require("fs-extra"); | ||
const error_utils_1 = require("@vercel/error-utils"); | ||
async function readFileOrNull(file) { | ||
try { | ||
const data = await fs_extra_1.readFile(file); | ||
const data = await (0, fs_extra_1.readFile)(file); | ||
return data; | ||
} | ||
catch (err) { | ||
if (err.code !== 'ENOENT') { | ||
throw err; | ||
catch (error) { | ||
if (!(0, error_utils_1.isErrnoException)(error)) { | ||
throw error; | ||
} | ||
if (error.code !== 'ENOENT') { | ||
throw error; | ||
} | ||
} | ||
@@ -21,0 +25,0 @@ return null; |
import { Files } from '../types'; | ||
declare type Delegate = (name: string) => string; | ||
type Delegate = (name: string) => string; | ||
/** | ||
@@ -4,0 +4,0 @@ * Renames the keys of a `Files` map. |
/// <reference types="node" /> | ||
import { SpawnOptions } from 'child_process'; | ||
import { Meta, PackageJson, NodeVersion, Config } from '../types'; | ||
export declare type CliType = 'yarn' | 'npm' | 'pnpm'; | ||
export type CliType = 'yarn' | 'npm' | 'pnpm'; | ||
export interface ScanParentDirsResult { | ||
@@ -6,0 +6,0 @@ /** |
@@ -25,3 +25,3 @@ "use strict"; | ||
opts = { stdio: 'inherit', ...opts }; | ||
const child = cross_spawn_1.default(command, args, opts); | ||
const child = (0, cross_spawn_1.default)(command, args, opts); | ||
if (opts.stdio === 'pipe' && child.stderr) { | ||
@@ -51,5 +51,5 @@ child.stderr.on('data', data => stderrLogs.push(data)); | ||
if (process.platform === 'win32') { | ||
return cross_spawn_1.default('cmd.exe', ['/C', command], opts); | ||
return (0, cross_spawn_1.default)('cmd.exe', ['/C', command], opts); | ||
} | ||
return cross_spawn_1.default('sh', ['-c', command], opts); | ||
return (0, cross_spawn_1.default)('sh', ['-c', command], opts); | ||
} | ||
@@ -83,3 +83,3 @@ exports.spawnCommand = spawnCommand; | ||
async function runShellScript(fsPath, args = [], spawnOpts) { | ||
assert_1.default(path_1.default.isAbsolute(fsPath)); | ||
(0, assert_1.default)(path_1.default.isAbsolute(fsPath)); | ||
const destPath = path_1.default.dirname(fsPath); | ||
@@ -98,3 +98,3 @@ await chmodPlusX(fsPath); | ||
const opts = { | ||
env: clone_env_1.cloneEnv(process.env), | ||
env: (0, clone_env_1.cloneEnv)(process.env), | ||
}; | ||
@@ -121,3 +121,3 @@ if (!meta.isDev) { | ||
async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}) { | ||
const latest = node_version_1.getLatestNodeVersion(); | ||
const latest = (0, node_version_1.getLatestNodeVersion)(); | ||
if (meta.isDev) { | ||
@@ -132,9 +132,9 @@ // Use the system-installed version of `node` in PATH for `vercel dev` | ||
const { node } = packageJson.engines; | ||
if (nodeVersion && semver_1.validRange(node) && !semver_1.intersects(nodeVersion, node)) { | ||
if (nodeVersion && (0, semver_1.validRange)(node) && !(0, semver_1.intersects)(nodeVersion, node)) { | ||
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`); | ||
} | ||
else if (semver_1.coerce(node)?.raw === node) { | ||
else if ((0, semver_1.coerce)(node)?.raw === node) { | ||
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`); | ||
} | ||
else if (semver_1.validRange(node) && semver_1.intersects(`${latest.major + 1}.x`, node)) { | ||
else if ((0, semver_1.validRange)(node) && (0, semver_1.intersects)(`${latest.major + 1}.x`, node)) { | ||
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`); | ||
@@ -145,7 +145,7 @@ } | ||
} | ||
return node_version_1.getSupportedNodeVersion(nodeVersion, isAuto); | ||
return (0, node_version_1.getSupportedNodeVersion)(nodeVersion, isAuto); | ||
} | ||
exports.getNodeVersion = getNodeVersion; | ||
async function scanParentDirs(destPath, readPackageJson = false) { | ||
assert_1.default(path_1.default.isAbsolute(destPath)); | ||
(0, assert_1.default)(path_1.default.isAbsolute(destPath)); | ||
const pkgJsonPath = await walkParentDirs({ | ||
@@ -170,6 +170,6 @@ base: '/', | ||
npmLockPath | ||
? read_config_file_1.readConfigFile(npmLockPath) | ||
? (0, read_config_file_1.readConfigFile)(npmLockPath) | ||
: null, | ||
pnpmLockPath | ||
? read_config_file_1.readConfigFile(pnpmLockPath) | ||
? (0, read_config_file_1.readConfigFile)(pnpmLockPath) | ||
: null, | ||
@@ -203,4 +203,4 @@ ]); | ||
async function walkParentDirs({ base, start, filename, }) { | ||
assert_1.default(path_1.default.isAbsolute(base), 'Expected "base" to be absolute path'); | ||
assert_1.default(path_1.default.isAbsolute(start), 'Expected "start" to be absolute path'); | ||
(0, assert_1.default)(path_1.default.isAbsolute(base), 'Expected "base" to be absolute path'); | ||
(0, assert_1.default)(path_1.default.isAbsolute(start), 'Expected "start" to be absolute path'); | ||
let parent = ''; | ||
@@ -244,6 +244,6 @@ for (let current = start; base.length <= current.length; current = parent) { | ||
if (meta?.isDev) { | ||
debug_1.default('Skipping dependency installation because dev mode is enabled'); | ||
(0, debug_1.default)('Skipping dependency installation because dev mode is enabled'); | ||
return false; | ||
} | ||
assert_1.default(path_1.default.isAbsolute(destPath)); | ||
(0, assert_1.default)(path_1.default.isAbsolute(destPath)); | ||
try { | ||
@@ -269,5 +269,5 @@ await runNpmInstallSema.acquire(); | ||
console.log('Installing dependencies...'); | ||
debug_1.default(`Installing to ${destPath}`); | ||
(0, debug_1.default)(`Installing to ${destPath}`); | ||
const opts = { cwd: destPath, ...spawnOpts }; | ||
const env = clone_env_1.cloneEnv(opts.env || process.env); | ||
const env = (0, clone_env_1.cloneEnv)(opts.env || process.env); | ||
delete env.NODE_ENV; | ||
@@ -333,3 +333,3 @@ opts.env = getEnvForPackageManager({ | ||
} | ||
debug_1.default(`Install complete [${Date.now() - installTime}ms]`); | ||
(0, debug_1.default)(`Install complete [${Date.now() - installTime}ms]`); | ||
return true; | ||
@@ -396,3 +396,3 @@ } | ||
}); | ||
debug_1.default(`Running with $PATH:`, env?.PATH || ''); | ||
(0, debug_1.default)(`Running with $PATH:`, env?.PATH || ''); | ||
await execCommand(installCommand, { | ||
@@ -406,3 +406,3 @@ ...spawnOpts, | ||
async function runPackageJsonScript(destPath, scriptNames, spawnOpts) { | ||
assert_1.default(path_1.default.isAbsolute(destPath)); | ||
(0, assert_1.default)(path_1.default.isAbsolute(destPath)); | ||
const { packageJson, cliType, lockfileVersion } = await scanParentDirs(destPath, true); | ||
@@ -412,3 +412,3 @@ const scriptName = getScriptName(packageJson, typeof scriptNames === 'string' ? [scriptNames] : scriptNames); | ||
return false; | ||
debug_1.default('Running user script...'); | ||
(0, debug_1.default)('Running user script...'); | ||
const runScriptTime = Date.now(); | ||
@@ -422,3 +422,3 @@ const opts = { | ||
nodeVersion: undefined, | ||
env: clone_env_1.cloneEnv(process.env, spawnOpts?.env), | ||
env: (0, clone_env_1.cloneEnv)(process.env, spawnOpts?.env), | ||
}), | ||
@@ -437,3 +437,3 @@ }; | ||
await spawnAsync(cliType, ['run', scriptName], opts); | ||
debug_1.default(`Script complete [${Date.now() - runScriptTime}ms]`); | ||
(0, debug_1.default)(`Script complete [${Date.now() - runScriptTime}ms]`); | ||
return true; | ||
@@ -444,6 +444,6 @@ } | ||
if (meta && meta.isDev) { | ||
debug_1.default('Skipping dependency installation because dev mode is enabled'); | ||
(0, debug_1.default)('Skipping dependency installation because dev mode is enabled'); | ||
return; | ||
} | ||
assert_1.default(path_1.default.isAbsolute(destPath)); | ||
(0, assert_1.default)(path_1.default.isAbsolute(destPath)); | ||
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: 'bundle install' }; | ||
@@ -455,6 +455,6 @@ await spawnAsync('bundle', args.concat(['install']), opts); | ||
if (meta && meta.isDev) { | ||
debug_1.default('Skipping dependency installation because dev mode is enabled'); | ||
(0, debug_1.default)('Skipping dependency installation because dev mode is enabled'); | ||
return; | ||
} | ||
assert_1.default(path_1.default.isAbsolute(destPath)); | ||
(0, assert_1.default)(path_1.default.isAbsolute(destPath)); | ||
const opts = { ...spawnOpts, cwd: destPath, prettyCommand: 'pip3 install' }; | ||
@@ -479,2 +479,2 @@ await spawnAsync('pip3', ['install', '--disable-pip-version-check', ...args], opts); | ||
*/ | ||
exports.installDependencies = util_1.deprecate(runNpmInstall, 'installDependencies() is deprecated. Please use runNpmInstall() instead.'); | ||
exports.installDependencies = (0, util_1.deprecate)(runNpmInstall, 'installDependencies() is deprecated. Please use runNpmInstall() instead.'); |
@@ -11,3 +11,3 @@ "use strict"; | ||
stream.on('data', buffers.push.bind(buffers)); | ||
end_of_stream_1.default(stream, err => { | ||
(0, end_of_stream_1.default)(stream, err => { | ||
if (err) { | ||
@@ -14,0 +14,0 @@ reject(err); |
@@ -50,3 +50,3 @@ "use strict"; | ||
} | ||
const ignoreFilter = ignore_1.default().add(clearRelative(ignoreContents[0])); | ||
const ignoreFilter = (0, ignore_1.default)().add(clearRelative(ignoreContents[0])); | ||
return function (p) { | ||
@@ -53,0 +53,0 @@ // we should not ignore now.json and vercel.json if it asked to. |
@@ -1,2 +0,2 @@ | ||
declare type Envs = { | ||
type Envs = { | ||
[key: string]: string | undefined; | ||
@@ -3,0 +3,0 @@ }; |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
} | ||
export declare type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer; | ||
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer; | ||
export interface LambdaOptionsBase { | ||
@@ -9,0 +9,0 @@ handler: string; |
@@ -18,35 +18,35 @@ "use strict"; | ||
if ('files' in opts) { | ||
assert_1.default(typeof opts.files === 'object', '"files" must be an object'); | ||
(0, assert_1.default)(typeof opts.files === 'object', '"files" must be an object'); | ||
} | ||
if ('zipBuffer' in opts) { | ||
assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer'); | ||
(0, assert_1.default)(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer'); | ||
} | ||
assert_1.default(typeof handler === 'string', '"handler" is not a string'); | ||
assert_1.default(typeof runtime === 'string', '"runtime" is not a string'); | ||
assert_1.default(typeof environment === 'object', '"environment" is not an object'); | ||
(0, assert_1.default)(typeof handler === 'string', '"handler" is not a string'); | ||
(0, assert_1.default)(typeof runtime === 'string', '"runtime" is not a string'); | ||
(0, assert_1.default)(typeof environment === 'object', '"environment" is not an object'); | ||
if (memory !== undefined) { | ||
assert_1.default(typeof memory === 'number', '"memory" is not a number'); | ||
(0, assert_1.default)(typeof memory === 'number', '"memory" is not a number'); | ||
} | ||
if (maxDuration !== undefined) { | ||
assert_1.default(typeof maxDuration === 'number', '"maxDuration" is not a number'); | ||
(0, assert_1.default)(typeof maxDuration === 'number', '"maxDuration" is not a number'); | ||
} | ||
if (allowQuery !== undefined) { | ||
assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array'); | ||
assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array'); | ||
(0, assert_1.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array'); | ||
(0, assert_1.default)(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array'); | ||
} | ||
if (supportsMultiPayloads !== undefined) { | ||
assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean'); | ||
(0, assert_1.default)(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean'); | ||
} | ||
if (supportsWrapper !== undefined) { | ||
assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean'); | ||
(0, assert_1.default)(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean'); | ||
} | ||
if (regions !== undefined) { | ||
assert_1.default(Array.isArray(regions), '"regions" is not an Array'); | ||
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array'); | ||
(0, assert_1.default)(Array.isArray(regions), '"regions" is not an Array'); | ||
(0, assert_1.default)(regions.every(r => typeof r === 'string'), '"regions" is not a string Array'); | ||
} | ||
if (framework !== undefined) { | ||
assert_1.default(typeof framework === 'object', '"framework" is not an object'); | ||
assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string'); | ||
(0, assert_1.default)(typeof framework === 'object', '"framework" is not an object'); | ||
(0, assert_1.default)(typeof framework.slug === 'string', '"framework.slug" is not a string'); | ||
if (framework.version !== undefined) { | ||
assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string'); | ||
(0, assert_1.default)(typeof framework.version === 'string', '"framework.version" is not a string'); | ||
} | ||
@@ -115,4 +115,4 @@ } | ||
const file = files[name]; | ||
if (file.mode && download_1.isSymbolicLink(file.mode) && file.type === 'FileFsRef') { | ||
const symlinkTarget = await fs_extra_1.readlink(file.fsPath); | ||
if (file.mode && (0, download_1.isSymbolicLink)(file.mode) && file.type === 'FileFsRef') { | ||
const symlinkTarget = await (0, fs_extra_1.readlink)(file.fsPath); | ||
symlinkTargets.set(name, symlinkTarget); | ||
@@ -130,3 +130,3 @@ } | ||
} | ||
else if (file.mode && download_1.isDirectory(file.mode)) { | ||
else if (file.mode && (0, download_1.isDirectory)(file.mode)) { | ||
zipFile.addEmptyDirectory(name, opts); | ||
@@ -141,3 +141,3 @@ } | ||
zipFile.end(); | ||
stream_to_buffer_1.default(zipFile.outputStream).then(resolve).catch(reject); | ||
(0, stream_to_buffer_1.default)(zipFile.outputStream).then(resolve).catch(reject); | ||
}); | ||
@@ -150,3 +150,3 @@ return zipBuffer; | ||
for (const [pattern, fn] of Object.entries(config.functions)) { | ||
if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) { | ||
if (sourceFile === pattern || (0, minimatch_1.default)(sourceFile, pattern)) { | ||
return { | ||
@@ -153,0 +153,0 @@ memory: fn.memory, |
@@ -11,3 +11,3 @@ "use strict"; | ||
} | ||
const { dir, name } = path_1.parse(entrypoint); | ||
const { dir, name } = (0, path_1.parse)(entrypoint); | ||
if (name === 'index' && dir === requestPath && hasProp(files, entrypoint)) { | ||
@@ -14,0 +14,0 @@ return true; |
@@ -11,3 +11,3 @@ /// <reference types="node" /> | ||
} | ||
export declare type File = FileRef | FileFsRef | FileBlob; | ||
export type File = FileRef | FileFsRef | FileBlob; | ||
export interface FileBase { | ||
@@ -155,3 +155,3 @@ type: string; | ||
*/ | ||
export declare type StartDevServerOptions = BuildOptions; | ||
export type StartDevServerOptions = BuildOptions; | ||
export interface StartDevServerSuccess { | ||
@@ -173,3 +173,3 @@ /** | ||
*/ | ||
export declare type StartDevServerResult = StartDevServerSuccess | null; | ||
export type StartDevServerResult = StartDevServerSuccess | null; | ||
/** | ||
@@ -318,5 +318,5 @@ * Credit to Iain Reid, MIT license. | ||
} | ||
declare type ImageFormat = 'image/avif' | 'image/webp'; | ||
declare type ImageContentDispositionType = 'inline' | 'attachment'; | ||
export declare type RemotePattern = { | ||
type ImageFormat = 'image/avif' | 'image/webp'; | ||
type ImageContentDispositionType = 'inline' | 'attachment'; | ||
export type RemotePattern = { | ||
/** | ||
@@ -398,3 +398,3 @@ * Must be `http` or `https`. | ||
} | ||
export declare type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput; | ||
export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput; | ||
export interface BuildResultV3 { | ||
@@ -404,7 +404,7 @@ routes?: any[]; | ||
} | ||
export declare type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>; | ||
export declare type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>; | ||
export declare type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>; | ||
export declare type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>; | ||
export declare type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>; | ||
export type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>; | ||
export type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>; | ||
export type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>; | ||
export type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>; | ||
export type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>; | ||
export {}; |
{ | ||
"name": "@vercel/build-utils", | ||
"version": "6.7.1", | ||
"version": "6.7.2", | ||
"license": "Apache-2.0", | ||
@@ -35,2 +35,3 @@ "main": "./dist/index.js", | ||
"@types/yazl": "2.4.2", | ||
"@vercel/error-utils": "1.0.10", | ||
"@vercel/ncc": "0.24.0", | ||
@@ -52,6 +53,6 @@ "aggregate-error": "3.0.1", | ||
"semver": "6.1.1", | ||
"typescript": "4.3.4", | ||
"typescript": "4.9.5", | ||
"yazl": "2.5.1" | ||
}, | ||
"gitHead": "925c8ba18ceec80174d9440cd2cad0e725ed4f56" | ||
"gitHead": "2de365f9cfea3ce283d2bf855507c71209f1e3d8" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1578548
32741
34