Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
9
node_modules/@vercel/build-utils/dist/fs/download.d.ts
generated
vendored
Normal file
9
node_modules/@vercel/build-utils/dist/fs/download.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import FileFsRef from '../file-fs-ref';
|
||||
import { File, Files, Meta } from '../types';
|
||||
export interface DownloadedFiles {
|
||||
[filePath: string]: FileFsRef;
|
||||
}
|
||||
export declare function isDirectory(mode: number): boolean;
|
||||
export declare function isSymbolicLink(mode: number): boolean;
|
||||
export declare function downloadFile(file: File, fsPath: string): Promise<FileFsRef>;
|
||||
export default function download(files: Files, basePath: string, meta?: Meta): Promise<DownloadedFiles>;
|
||||
136
node_modules/@vercel/build-utils/dist/fs/download.js
generated
vendored
Normal file
136
node_modules/@vercel/build-utils/dist/fs/download.js
generated
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var download_exports = {};
|
||||
__export(download_exports, {
|
||||
default: () => download,
|
||||
downloadFile: () => downloadFile,
|
||||
isDirectory: () => isDirectory,
|
||||
isSymbolicLink: () => isSymbolicLink
|
||||
});
|
||||
module.exports = __toCommonJS(download_exports);
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_debug = __toESM(require("../debug"));
|
||||
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
|
||||
var import_fs_extra = require("fs-extra");
|
||||
var import_stream_to_buffer = __toESM(require("./stream-to-buffer"));
|
||||
const S_IFDIR = 16384;
|
||||
const S_IFLNK = 40960;
|
||||
const S_IFMT = 61440;
|
||||
function isDirectory(mode) {
|
||||
return (mode & S_IFMT) === S_IFDIR;
|
||||
}
|
||||
function isSymbolicLink(mode) {
|
||||
return (mode & S_IFMT) === S_IFLNK;
|
||||
}
|
||||
async function prepareSymlinkTarget(file, fsPath) {
|
||||
const mkdirPromise = (0, import_fs_extra.mkdirp)(import_path.default.dirname(fsPath));
|
||||
if (file.type === "FileFsRef") {
|
||||
const [target] = await Promise.all([(0, import_fs_extra.readlink)(file.fsPath), mkdirPromise]);
|
||||
return target;
|
||||
}
|
||||
if (file.type === "FileRef" || file.type === "FileBlob") {
|
||||
const targetPathBufferPromise = (0, import_stream_to_buffer.default)(await file.toStreamAsync());
|
||||
const [targetPathBuffer] = await Promise.all([
|
||||
targetPathBufferPromise,
|
||||
mkdirPromise
|
||||
]);
|
||||
return targetPathBuffer.toString("utf8");
|
||||
}
|
||||
throw new Error(
|
||||
`file.type "${file.type}" not supported for symlink`
|
||||
);
|
||||
}
|
||||
async function downloadFile(file, fsPath) {
|
||||
const { mode } = file;
|
||||
if (isDirectory(mode)) {
|
||||
await (0, import_fs_extra.mkdirp)(fsPath);
|
||||
await (0, import_fs_extra.chmod)(fsPath, mode);
|
||||
return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
|
||||
}
|
||||
if (isSymbolicLink(mode)) {
|
||||
const target = await prepareSymlinkTarget(file, fsPath);
|
||||
await (0, import_fs_extra.symlink)(target, fsPath);
|
||||
return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
|
||||
}
|
||||
const stream = file.toStream();
|
||||
return import_file_fs_ref.default.fromStream({ mode, stream, fsPath });
|
||||
}
|
||||
async function removeFile(basePath, fileMatched) {
|
||||
const file = import_path.default.join(basePath, fileMatched);
|
||||
await (0, import_fs_extra.remove)(file);
|
||||
}
|
||||
async function download(files, basePath, meta) {
|
||||
const {
|
||||
isDev = false,
|
||||
skipDownload = false,
|
||||
filesChanged = null,
|
||||
filesRemoved = null
|
||||
} = meta || {};
|
||||
if (isDev || skipDownload) {
|
||||
return files;
|
||||
}
|
||||
(0, import_debug.default)("Downloading deployment source files...");
|
||||
const start = Date.now();
|
||||
const files2 = {};
|
||||
const filenames = Object.keys(files);
|
||||
await Promise.all(
|
||||
filenames.map(async (name) => {
|
||||
if (Array.isArray(filesRemoved) && filesRemoved.includes(name)) {
|
||||
await removeFile(basePath, name);
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(filesChanged) && !filesChanged.includes(name)) {
|
||||
return;
|
||||
}
|
||||
const parts = name.split("/");
|
||||
for (let i = 1; i < parts.length; i++) {
|
||||
const dir = parts.slice(0, i).join("/");
|
||||
const parent = files[dir];
|
||||
if (parent && isSymbolicLink(parent.mode)) {
|
||||
console.warn(
|
||||
`Warning: file "${name}" is within a symlinked directory "${dir}" and will be ignored`
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const file = files[name];
|
||||
const fsPath = import_path.default.join(basePath, name);
|
||||
files2[name] = await downloadFile(file, fsPath);
|
||||
})
|
||||
);
|
||||
const duration = Date.now() - start;
|
||||
(0, import_debug.default)(`Downloaded ${filenames.length} source files: ${duration}ms`);
|
||||
return files2;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
downloadFile,
|
||||
isDirectory,
|
||||
isSymbolicLink
|
||||
});
|
||||
1
node_modules/@vercel/build-utils/dist/fs/get-writable-directory.d.ts
generated
vendored
Normal file
1
node_modules/@vercel/build-utils/dist/fs/get-writable-directory.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default function getWritableDirectory(): Promise<string>;
|
||||
32
node_modules/@vercel/build-utils/dist/fs/get-writable-directory.js
generated
vendored
Normal file
32
node_modules/@vercel/build-utils/dist/fs/get-writable-directory.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var get_writable_directory_exports = {};
|
||||
__export(get_writable_directory_exports, {
|
||||
default: () => getWritableDirectory
|
||||
});
|
||||
module.exports = __toCommonJS(get_writable_directory_exports);
|
||||
var import_path = require("path");
|
||||
var import_os = require("os");
|
||||
var import_fs_extra = require("fs-extra");
|
||||
async function getWritableDirectory() {
|
||||
const name = Math.floor(Math.random() * 2147483647).toString(16);
|
||||
const directory = (0, import_path.join)((0, import_os.tmpdir)(), name);
|
||||
await (0, import_fs_extra.mkdirp)(directory);
|
||||
return directory;
|
||||
}
|
||||
10
node_modules/@vercel/build-utils/dist/fs/glob.d.ts
generated
vendored
Normal file
10
node_modules/@vercel/build-utils/dist/fs/glob.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import FileFsRef from '../file-fs-ref';
|
||||
export interface GlobOptions {
|
||||
cwd?: string;
|
||||
dot?: boolean;
|
||||
follow?: boolean;
|
||||
ignore?: string | ReadonlyArray<string>;
|
||||
includeDirectories?: boolean;
|
||||
nodir?: boolean;
|
||||
}
|
||||
export default function glob(pattern: string, opts: GlobOptions | string, mountpoint?: string): Promise<Record<string, FileFsRef>>;
|
||||
111
node_modules/@vercel/build-utils/dist/fs/glob.js
generated
vendored
Normal file
111
node_modules/@vercel/build-utils/dist/fs/glob.js
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var glob_exports = {};
|
||||
__export(glob_exports, {
|
||||
default: () => glob
|
||||
});
|
||||
module.exports = __toCommonJS(glob_exports);
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_assert = __toESM(require("assert"));
|
||||
var import_glob = __toESM(require("glob"));
|
||||
var import_util = require("util");
|
||||
var import_fs_extra = require("fs-extra");
|
||||
var import_normalize_path = require("./normalize-path");
|
||||
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
|
||||
const vanillaGlob = (0, import_util.promisify)(import_glob.default);
|
||||
async function glob(pattern, opts, mountpoint) {
|
||||
const options = typeof opts === "string" ? { cwd: opts } : opts;
|
||||
if (!options.cwd) {
|
||||
throw new Error(
|
||||
"Second argument (basePath) must be specified for names of resulting files"
|
||||
);
|
||||
}
|
||||
if (!import_path.default.isAbsolute(options.cwd)) {
|
||||
throw new Error(`basePath/cwd must be an absolute path (${options.cwd})`);
|
||||
}
|
||||
const results = {};
|
||||
const statCache = {};
|
||||
const symlinks = {};
|
||||
const files = await vanillaGlob(pattern, {
|
||||
...options,
|
||||
symlinks,
|
||||
statCache,
|
||||
stat: true,
|
||||
dot: true
|
||||
});
|
||||
const dirs = /* @__PURE__ */ new Set();
|
||||
const dirsWithEntries = /* @__PURE__ */ new Set();
|
||||
for (const relativePath of files) {
|
||||
const absPath = import_path.default.join(options.cwd, relativePath);
|
||||
const fsPath = (0, import_normalize_path.normalizePath)(absPath);
|
||||
let stat = statCache[fsPath];
|
||||
(0, import_assert.default)(
|
||||
stat,
|
||||
`statCache does not contain value for ${relativePath} (resolved to ${fsPath})`
|
||||
);
|
||||
const isSymlink = symlinks[fsPath];
|
||||
if (options.follow && (isSymlink || (await (0, import_fs_extra.lstat)(fsPath)).isSymbolicLink())) {
|
||||
const target = await (0, import_fs_extra.readlink)(absPath);
|
||||
const absTarget = import_path.default.resolve(import_path.default.dirname(absPath), target);
|
||||
if (import_path.default.relative(options.cwd, absTarget).startsWith(`..${import_path.default.sep}`)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (isSymlink || stat.isFile() || stat.isDirectory()) {
|
||||
if (isSymlink) {
|
||||
stat = await (0, import_fs_extra.lstat)(absPath);
|
||||
}
|
||||
const dirname = import_path.default.dirname(relativePath);
|
||||
dirsWithEntries.add(dirname);
|
||||
if (stat.isDirectory()) {
|
||||
dirs.add(relativePath);
|
||||
continue;
|
||||
}
|
||||
let finalPath = relativePath;
|
||||
if (mountpoint) {
|
||||
finalPath = import_path.default.join(mountpoint, finalPath);
|
||||
}
|
||||
results[finalPath] = new import_file_fs_ref.default({ mode: stat.mode, fsPath });
|
||||
}
|
||||
}
|
||||
if (options.includeDirectories) {
|
||||
for (const relativePath of dirs) {
|
||||
if (dirsWithEntries.has(relativePath))
|
||||
continue;
|
||||
let finalPath = relativePath;
|
||||
if (mountpoint) {
|
||||
finalPath = import_path.default.join(mountpoint, finalPath);
|
||||
}
|
||||
const fsPath = (0, import_normalize_path.normalizePath)(import_path.default.join(options.cwd, relativePath));
|
||||
const stat = statCache[fsPath];
|
||||
results[finalPath] = new import_file_fs_ref.default({ mode: stat.mode, fsPath });
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
13
node_modules/@vercel/build-utils/dist/fs/node-version.d.ts
generated
vendored
Normal file
13
node_modules/@vercel/build-utils/dist/fs/node-version.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { BunVersion, NodeVersion, Version } from '../types';
|
||||
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
|
||||
export declare const NODE_VERSIONS: NodeVersion[];
|
||||
export declare const BUN_VERSIONS: BunVersion[];
|
||||
export declare function getNodeVersionByMajor(major: number): NodeVersion | undefined;
|
||||
declare function getOptions(): NodeVersion[];
|
||||
export declare function getAvailableNodeVersions(): NodeVersionMajor[];
|
||||
export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): NodeVersion;
|
||||
export declare function getDiscontinuedNodeVersions(): NodeVersion[];
|
||||
export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[]): Promise<NodeVersion>;
|
||||
export declare function getSupportedBunVersion(engineRange: string): BunVersion;
|
||||
export declare function isBunVersion(version: Version): boolean;
|
||||
export {};
|
||||
222
node_modules/@vercel/build-utils/dist/fs/node-version.js
generated
vendored
Normal file
222
node_modules/@vercel/build-utils/dist/fs/node-version.js
generated
vendored
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var node_version_exports = {};
|
||||
__export(node_version_exports, {
|
||||
BUN_VERSIONS: () => BUN_VERSIONS,
|
||||
NODE_VERSIONS: () => NODE_VERSIONS,
|
||||
getAvailableNodeVersions: () => getAvailableNodeVersions,
|
||||
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
||||
getLatestNodeVersion: () => getLatestNodeVersion,
|
||||
getNodeVersionByMajor: () => getNodeVersionByMajor,
|
||||
getSupportedBunVersion: () => getSupportedBunVersion,
|
||||
getSupportedNodeVersion: () => getSupportedNodeVersion,
|
||||
isBunVersion: () => isBunVersion
|
||||
});
|
||||
module.exports = __toCommonJS(node_version_exports);
|
||||
var import_fs = require("fs");
|
||||
var import_semver = require("semver");
|
||||
var import_types = require("../types");
|
||||
var import_errors = require("../errors");
|
||||
var import_debug = __toESM(require("../debug"));
|
||||
const NODE_VERSIONS = [
|
||||
new import_types.NodeVersion({
|
||||
major: 24,
|
||||
range: "24.x",
|
||||
runtime: "nodejs24.x"
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 22,
|
||||
range: "22.x",
|
||||
runtime: "nodejs22.x"
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 20,
|
||||
range: "20.x",
|
||||
runtime: "nodejs20.x"
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 18,
|
||||
range: "18.x",
|
||||
runtime: "nodejs18.x",
|
||||
discontinueDate: /* @__PURE__ */ new Date("2025-09-01")
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 16,
|
||||
range: "16.x",
|
||||
runtime: "nodejs16.x",
|
||||
discontinueDate: /* @__PURE__ */ new Date("2025-02-03")
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 14,
|
||||
range: "14.x",
|
||||
runtime: "nodejs14.x",
|
||||
discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 12,
|
||||
range: "12.x",
|
||||
runtime: "nodejs12.x",
|
||||
discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 10,
|
||||
range: "10.x",
|
||||
runtime: "nodejs10.x",
|
||||
discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
|
||||
}),
|
||||
new import_types.NodeVersion({
|
||||
major: 8,
|
||||
range: "8.10.x",
|
||||
runtime: "nodejs8.10",
|
||||
discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
|
||||
})
|
||||
];
|
||||
const BUN_VERSIONS = [
|
||||
new import_types.BunVersion({
|
||||
major: 1,
|
||||
range: "1.x",
|
||||
runtime: "bun1.x"
|
||||
})
|
||||
];
|
||||
function getNodeVersionByMajor(major) {
|
||||
return getOptions().find((v) => v.major === major);
|
||||
}
|
||||
function getOptions() {
|
||||
return NODE_VERSIONS;
|
||||
}
|
||||
function isNodeVersionAvailable(version) {
|
||||
const stat = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
|
||||
return stat?.isDirectory() ?? false;
|
||||
}
|
||||
function getAvailableNodeVersions() {
|
||||
return getOptions().filter((v) => v.major >= 18).filter(isNodeVersionAvailable).map((n) => n.major);
|
||||
}
|
||||
function getHint(isAuto = false, availableVersions) {
|
||||
const { major, range } = getLatestNodeVersion(availableVersions);
|
||||
return isAuto ? `Please set Node.js Version to ${range} in your Project Settings to use Node.js ${major}.` : `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
|
||||
}
|
||||
function getLatestNodeVersion(availableVersions) {
|
||||
const all = getOptions();
|
||||
if (availableVersions) {
|
||||
for (const version of all) {
|
||||
for (const major of availableVersions) {
|
||||
if (version.major === major) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return all[0];
|
||||
}
|
||||
function getDiscontinuedNodeVersions() {
|
||||
return getOptions().filter((version) => {
|
||||
return version.state === "discontinued";
|
||||
});
|
||||
}
|
||||
async function getSupportedNodeVersion(engineRange, isAuto = false, availableVersions) {
|
||||
let selection;
|
||||
if (engineRange) {
|
||||
const found = (0, import_semver.validRange)(engineRange) && getOptions().some((o) => {
|
||||
selection = o;
|
||||
return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
|
||||
});
|
||||
if (!found) {
|
||||
throw new import_errors.NowBuildError({
|
||||
code: "BUILD_UTILS_NODE_VERSION_INVALID",
|
||||
link: "https://vercel.link/node-version",
|
||||
message: `Found invalid or discontinued Node.js Version: "${engineRange}". ${getHint(
|
||||
isAuto,
|
||||
availableVersions
|
||||
)}`
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!selection) {
|
||||
selection = getLatestNodeVersion(availableVersions);
|
||||
}
|
||||
if (selection.state === "discontinued") {
|
||||
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
|
||||
throw new import_errors.NowBuildError({
|
||||
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
||||
link: "https://vercel.link/node-version",
|
||||
message: `${intro} ${getHint(isAuto)}`
|
||||
});
|
||||
}
|
||||
(0, import_debug.default)(`Selected Node.js ${selection.range}`);
|
||||
if (selection.state === "deprecated") {
|
||||
const d = selection.formattedDate;
|
||||
if (d) {
|
||||
console.warn(
|
||||
`Error: Node.js version ${selection.range} is deprecated. Deployments created on or after ${d} will fail to build. ${getHint(
|
||||
isAuto
|
||||
)}`
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
`Error: Node.js version ${selection.range} is deprecated. ${getHint(
|
||||
isAuto
|
||||
)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
function getSupportedBunVersion(engineRange) {
|
||||
if ((0, import_semver.validRange)(engineRange)) {
|
||||
const selected = BUN_VERSIONS.find((version) => {
|
||||
return (0, import_semver.intersects)(version.range, engineRange);
|
||||
});
|
||||
if (selected) {
|
||||
return new import_types.BunVersion({
|
||||
major: selected.major,
|
||||
range: selected.range,
|
||||
runtime: selected.runtime
|
||||
});
|
||||
}
|
||||
}
|
||||
throw new import_errors.NowBuildError({
|
||||
message: `Found invalid Bun Version: "${engineRange}".`,
|
||||
code: "BUILD_UTILS_BUN_VERSION_INVALID"
|
||||
});
|
||||
}
|
||||
function isBunVersion(version) {
|
||||
return version.runtime.startsWith("bun");
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BUN_VERSIONS,
|
||||
NODE_VERSIONS,
|
||||
getAvailableNodeVersions,
|
||||
getDiscontinuedNodeVersions,
|
||||
getLatestNodeVersion,
|
||||
getNodeVersionByMajor,
|
||||
getSupportedBunVersion,
|
||||
getSupportedNodeVersion,
|
||||
isBunVersion
|
||||
});
|
||||
4
node_modules/@vercel/build-utils/dist/fs/normalize-path.d.ts
generated
vendored
Normal file
4
node_modules/@vercel/build-utils/dist/fs/normalize-path.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Convert Windows separators to Unix separators.
|
||||
*/
|
||||
export declare function normalizePath(p: string): string;
|
||||
31
node_modules/@vercel/build-utils/dist/fs/normalize-path.js
generated
vendored
Normal file
31
node_modules/@vercel/build-utils/dist/fs/normalize-path.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var normalize_path_exports = {};
|
||||
__export(normalize_path_exports, {
|
||||
normalizePath: () => normalizePath
|
||||
});
|
||||
module.exports = __toCommonJS(normalize_path_exports);
|
||||
const isWin = process.platform === "win32";
|
||||
function normalizePath(p) {
|
||||
return isWin ? p.replace(/\\/g, "/") : p;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
normalizePath
|
||||
});
|
||||
7
node_modules/@vercel/build-utils/dist/fs/read-config-file.d.ts
generated
vendored
Normal file
7
node_modules/@vercel/build-utils/dist/fs/read-config-file.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { PackageJson } from '../types';
|
||||
export declare function readConfigFile<T>(files: string | string[]): Promise<T | null>;
|
||||
/**
|
||||
* Reads and parses the package.json file from a directory.
|
||||
* Returns an empty object if the file doesn't exist or can't be parsed.
|
||||
*/
|
||||
export declare function getPackageJson(dir: string): Promise<PackageJson>;
|
||||
87
node_modules/@vercel/build-utils/dist/fs/read-config-file.js
generated
vendored
Normal file
87
node_modules/@vercel/build-utils/dist/fs/read-config-file.js
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var read_config_file_exports = {};
|
||||
__export(read_config_file_exports, {
|
||||
getPackageJson: () => getPackageJson,
|
||||
readConfigFile: () => readConfigFile
|
||||
});
|
||||
module.exports = __toCommonJS(read_config_file_exports);
|
||||
var import_js_yaml = __toESM(require("js-yaml"));
|
||||
var import_toml = __toESM(require("@iarna/toml"));
|
||||
var import_fs_extra = require("fs-extra");
|
||||
var import_error_utils = require("@vercel/error-utils");
|
||||
var import_path = require("path");
|
||||
async function readFileOrNull(file) {
|
||||
try {
|
||||
const data = await (0, import_fs_extra.readFile)(file);
|
||||
return data;
|
||||
} catch (error) {
|
||||
if (!(0, import_error_utils.isErrnoException)(error)) {
|
||||
throw error;
|
||||
}
|
||||
if (error.code !== "ENOENT") {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async function readConfigFile(files) {
|
||||
files = Array.isArray(files) ? files : [files];
|
||||
for (const name of files) {
|
||||
const data = await readFileOrNull(name);
|
||||
if (data) {
|
||||
const str = data.toString("utf8");
|
||||
try {
|
||||
if (name.endsWith(".json")) {
|
||||
return JSON.parse(str);
|
||||
} else if (name.endsWith(".toml")) {
|
||||
return import_toml.default.parse(str);
|
||||
} else if (name.endsWith(".yaml") || name.endsWith(".yml")) {
|
||||
return import_js_yaml.default.safeLoad(str, { filename: name });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`Error while parsing config file: "${name}"`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async function getPackageJson(dir) {
|
||||
const packagePath = (0, import_path.join)(dir, "package.json");
|
||||
try {
|
||||
return JSON.parse(await (0, import_fs_extra.readFile)(packagePath, "utf8"));
|
||||
} catch (err) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
getPackageJson,
|
||||
readConfigFile
|
||||
});
|
||||
11
node_modules/@vercel/build-utils/dist/fs/rename.d.ts
generated
vendored
Normal file
11
node_modules/@vercel/build-utils/dist/fs/rename.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { Files } from '../types';
|
||||
type Delegate = (name: string) => string;
|
||||
/**
|
||||
* Renames the keys of a `Files` map.
|
||||
*
|
||||
* @param files A map of filenames to `File` instances
|
||||
* @param delegate A function that returns the new filename
|
||||
* @returns A new file map with the renamed filenames
|
||||
*/
|
||||
export default function rename(files: Files, delegate: Delegate): Files;
|
||||
export {};
|
||||
30
node_modules/@vercel/build-utils/dist/fs/rename.js
generated
vendored
Normal file
30
node_modules/@vercel/build-utils/dist/fs/rename.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var rename_exports = {};
|
||||
__export(rename_exports, {
|
||||
default: () => rename
|
||||
});
|
||||
module.exports = __toCommonJS(rename_exports);
|
||||
function rename(files, delegate) {
|
||||
const result = {};
|
||||
for (const [name, file] of Object.entries(files)) {
|
||||
result[delegate(name)] = file;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
230
node_modules/@vercel/build-utils/dist/fs/run-user-scripts.d.ts
generated
vendored
Normal file
230
node_modules/@vercel/build-utils/dist/fs/run-user-scripts.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
/// <reference types="node" />
|
||||
import { SpawnOptions } from 'child_process';
|
||||
import { Meta, PackageJson, NodeVersion, Config, BunVersion } from '../types';
|
||||
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun' | 'vlt';
|
||||
export interface FindPackageJsonResult {
|
||||
/**
|
||||
* The file path of found `package.json` file, or `undefined` if not found.
|
||||
*/
|
||||
packageJsonPath?: string;
|
||||
/**
|
||||
* The contents of found `package.json` file, when the `readPackageJson`
|
||||
* option is enabled.
|
||||
*/
|
||||
packageJson?: PackageJson;
|
||||
}
|
||||
export interface ScanParentDirsResult extends FindPackageJsonResult {
|
||||
/**
|
||||
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
||||
*/
|
||||
cliType: CliType;
|
||||
/**
|
||||
* The file path of the lockfile (`yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`)
|
||||
* or `undefined` if not found.
|
||||
*/
|
||||
lockfilePath?: string;
|
||||
/**
|
||||
* The `lockfileVersion` number from lockfile (`package-lock.json` or `pnpm-lock.yaml`),
|
||||
* or `undefined` if not found.
|
||||
*/
|
||||
lockfileVersion?: number;
|
||||
/**
|
||||
* The contents of the `packageManager` field from `package.json` if found.
|
||||
* The value may come from a different `package.json` file than the one
|
||||
* specified by `packageJsonPath`, in the case of a monorepo.
|
||||
*/
|
||||
packageJsonPackageManager?: string;
|
||||
/**
|
||||
* Whether Turborepo supports the `COREPACK_HOME` environment variable.
|
||||
* `undefined` if not a Turborepo project.
|
||||
*/
|
||||
turboSupportsCorepackHome?: boolean;
|
||||
}
|
||||
export interface TraverseUpDirectoriesProps {
|
||||
/**
|
||||
* The directory to start iterating from, typically the same directory of the entrypoint.
|
||||
*/
|
||||
start: string;
|
||||
/**
|
||||
* The highest directory, typically the workPath root of the project.
|
||||
*/
|
||||
base?: string;
|
||||
}
|
||||
export interface WalkParentDirsProps extends Required<TraverseUpDirectoriesProps> {
|
||||
/**
|
||||
* The name of the file to search for, typically `package.json` or `Gemfile`.
|
||||
*/
|
||||
filename: string;
|
||||
}
|
||||
export interface WalkParentDirsMultiProps extends Required<TraverseUpDirectoriesProps> {
|
||||
/**
|
||||
* The name of the file to search for, typically `package.json` or `Gemfile`.
|
||||
*/
|
||||
filenames: string[];
|
||||
}
|
||||
export interface SpawnOptionsExtended extends SpawnOptions {
|
||||
/**
|
||||
* Pretty formatted command that is being spawned for logging purposes.
|
||||
*/
|
||||
prettyCommand?: string;
|
||||
/**
|
||||
* Returns instead of throwing an error when the process exits with a
|
||||
* non-0 exit code. When relevant, the returned object will include
|
||||
* the error code, stdout and stderr.
|
||||
*/
|
||||
ignoreNon0Exit?: boolean;
|
||||
}
|
||||
export declare function spawnAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<void>;
|
||||
export declare function spawnCommand(command: string, options?: SpawnOptions): import("child_process").ChildProcess;
|
||||
export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>;
|
||||
export declare function traverseUpDirectories({ start, base, }: TraverseUpDirectoriesProps): Generator<string, void, unknown>;
|
||||
/**
|
||||
* @deprecated Use `getNodeBinPaths()` instead.
|
||||
*/
|
||||
export declare function getNodeBinPath({ cwd, }: {
|
||||
cwd: string;
|
||||
}): Promise<string>;
|
||||
export declare function getNodeBinPaths({ start, base, }: TraverseUpDirectoriesProps): string[];
|
||||
export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
|
||||
/**
|
||||
* @deprecated Don't use this function directly.
|
||||
*
|
||||
* Use getEnvForPackageManager() instead when within a builder.
|
||||
*/
|
||||
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
|
||||
export declare function getNodeVersion(destPath: string, fallbackVersion?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion | BunVersion>;
|
||||
/**
|
||||
* Traverses up directories to find and optionally read package.json.
|
||||
* This is a lightweight alternative to `scanParentDirs` when only
|
||||
* package.json information is needed (without lockfile detection).
|
||||
*/
|
||||
export declare function findPackageJson(destPath: string, readPackageJson?: boolean, base?: string): Promise<FindPackageJsonResult>;
|
||||
export declare function scanParentDirs(destPath: string, readPackageJson?: boolean, base?: string): Promise<ScanParentDirsResult>;
|
||||
export declare function turboVersionSpecifierSupportsCorepack(turboVersionSpecifier: string): boolean;
|
||||
export declare function usingCorepack(env: {
|
||||
[x: string]: string | undefined;
|
||||
}, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
|
||||
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
|
||||
/**
|
||||
* Reset the customInstallCommandSet. This should be called at the start of each build
|
||||
* to prevent custom install commands from being skipped due to the set persisting
|
||||
* across multiple builds in the same Node process (e.g., in unit tests).
|
||||
*/
|
||||
export declare function resetCustomInstallCommandSet(): void;
|
||||
export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, projectCreatedAt?: number): Promise<boolean>;
|
||||
/**
|
||||
* Prepares the input environment based on the used package manager and lockfile
|
||||
* versions.
|
||||
*/
|
||||
export declare function getEnvForPackageManager({ cliType, lockfileVersion, packageJsonPackageManager, env, packageJsonEngines, turboSupportsCorepackHome, projectCreatedAt, }: {
|
||||
cliType: CliType;
|
||||
lockfileVersion: number | undefined;
|
||||
packageJsonPackageManager?: string | undefined;
|
||||
env: {
|
||||
[x: string]: string | undefined;
|
||||
};
|
||||
packageJsonEngines?: PackageJson.Engines;
|
||||
turboSupportsCorepackHome?: boolean | undefined;
|
||||
projectCreatedAt?: number | undefined;
|
||||
}): {
|
||||
[x: string]: string | undefined;
|
||||
};
|
||||
export declare const PNPM_10_PREFERRED_AT: Date;
|
||||
/**
|
||||
* Helper to get the binary paths that link to the used package manager.
|
||||
* Note: Make sure it doesn't contain any `console.log` calls.
|
||||
*/
|
||||
export declare function getPathOverrideForPackageManager({ cliType, lockfileVersion, corepackPackageManager, corepackEnabled, packageJsonEngines, projectCreatedAt, }: {
|
||||
cliType: CliType;
|
||||
lockfileVersion: number | undefined;
|
||||
corepackPackageManager: string | undefined;
|
||||
corepackEnabled?: boolean;
|
||||
packageJsonEngines?: PackageJson.Engines;
|
||||
projectCreatedAt?: number;
|
||||
}): {
|
||||
/**
|
||||
* Which lockfile was detected.
|
||||
*/
|
||||
detectedLockfile: string | undefined;
|
||||
/**
|
||||
* Detected package manager that generated the found lockfile.
|
||||
*/
|
||||
detectedPackageManager: string | undefined;
|
||||
/**
|
||||
* Value of $PATH that includes the binaries for the detected package manager.
|
||||
* Undefined if no $PATH are necessary.
|
||||
*/
|
||||
path: string | undefined;
|
||||
};
|
||||
export declare function detectPackageManager(cliType: CliType, lockfileVersion: number | undefined, projectCreatedAt?: number): {
|
||||
path: string;
|
||||
detectedLockfile: string;
|
||||
detectedPackageManager: string;
|
||||
pnpmVersionRange: string;
|
||||
} | {
|
||||
path: string;
|
||||
detectedLockfile: string;
|
||||
detectedPackageManager: string;
|
||||
pnpmVersionRange?: undefined;
|
||||
} | {
|
||||
path: undefined;
|
||||
detectedLockfile: string;
|
||||
detectedPackageManager: string;
|
||||
pnpmVersionRange?: undefined;
|
||||
} | undefined;
|
||||
/**
|
||||
* Helper to get the binary paths that link to the used package manager.
|
||||
* Note: Make sure it doesn't contain any `console.log` calls.
|
||||
* @deprecated use `getEnvForPackageManager` instead
|
||||
*/
|
||||
export declare function getPathForPackageManager({ cliType, lockfileVersion, env, }: {
|
||||
cliType: CliType;
|
||||
lockfileVersion: number | undefined;
|
||||
env: {
|
||||
[x: string]: string | undefined;
|
||||
};
|
||||
}): {
|
||||
/**
|
||||
* Which lockfile was detected.
|
||||
*/
|
||||
detectedLockfile: string | undefined;
|
||||
/**
|
||||
* Detected package manager that generated the found lockfile.
|
||||
*/
|
||||
detectedPackageManager: string | undefined;
|
||||
/**
|
||||
* Value of $PATH that includes the binaries for the detected package manager.
|
||||
* Undefined if no $PATH are necessary.
|
||||
*/
|
||||
path: string | undefined;
|
||||
/**
|
||||
* Set if yarn was identified as package manager and `YARN_NODE_LINKER`
|
||||
* environment variable was not found on the input environment.
|
||||
*/
|
||||
yarnNodeLinker: string | undefined;
|
||||
};
|
||||
export declare function runCustomInstallCommand({ destPath, installCommand, spawnOpts, projectCreatedAt, }: {
|
||||
destPath: string;
|
||||
installCommand: string;
|
||||
spawnOpts?: SpawnOptions;
|
||||
projectCreatedAt?: number;
|
||||
}): Promise<boolean>;
|
||||
export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions, projectCreatedAt?: number): Promise<boolean>;
|
||||
export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
|
||||
export type PipInstallResult = {
|
||||
installed: false;
|
||||
} | {
|
||||
installed: true;
|
||||
/**
|
||||
* The directory where packages were installed.
|
||||
* Add this to PYTHONPATH when running Python commands.
|
||||
*/
|
||||
targetDir: string;
|
||||
};
|
||||
export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<PipInstallResult>;
|
||||
export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string | undefined;
|
||||
/**
|
||||
* @deprecate installDependencies() is deprecated.
|
||||
* Please use runNpmInstall() instead.
|
||||
*/
|
||||
export declare const installDependencies: typeof runNpmInstall;
|
||||
1135
node_modules/@vercel/build-utils/dist/fs/run-user-scripts.js
generated
vendored
Normal file
1135
node_modules/@vercel/build-utils/dist/fs/run-user-scripts.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
4
node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.d.ts
generated
vendored
Normal file
4
node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
export default function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer>;
|
||||
export declare function streamToBufferChunks(stream: NodeJS.ReadableStream, chunkSize?: number): Promise<Buffer[]>;
|
||||
87
node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.js
generated
vendored
Normal file
87
node_modules/@vercel/build-utils/dist/fs/stream-to-buffer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stream_to_buffer_exports = {};
|
||||
__export(stream_to_buffer_exports, {
|
||||
default: () => streamToBuffer,
|
||||
streamToBufferChunks: () => streamToBufferChunks
|
||||
});
|
||||
module.exports = __toCommonJS(stream_to_buffer_exports);
|
||||
var import_end_of_stream = __toESM(require("end-of-stream"));
|
||||
function streamToBuffer(stream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const buffers = [];
|
||||
stream.on("data", buffers.push.bind(buffers));
|
||||
(0, import_end_of_stream.default)(stream, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
switch (buffers.length) {
|
||||
case 0:
|
||||
resolve(Buffer.allocUnsafe(0));
|
||||
break;
|
||||
case 1:
|
||||
resolve(buffers[0]);
|
||||
break;
|
||||
default:
|
||||
resolve(Buffer.concat(buffers));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const MB = 1024 * 1024;
|
||||
async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
|
||||
const chunks = [];
|
||||
let currentChunk = [];
|
||||
let currentSize = 0;
|
||||
for await (const chunk of stream) {
|
||||
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
||||
let offset = 0;
|
||||
while (offset < buffer.length) {
|
||||
const remainingSpace = chunkSize - currentSize;
|
||||
const sliceSize = Math.min(remainingSpace, buffer.length - offset);
|
||||
currentChunk.push(buffer.slice(offset, offset + sliceSize));
|
||||
currentSize += sliceSize;
|
||||
offset += sliceSize;
|
||||
if (currentSize >= chunkSize) {
|
||||
chunks.push(Buffer.concat(currentChunk));
|
||||
currentChunk = [];
|
||||
currentSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentChunk.length > 0) {
|
||||
chunks.push(Buffer.concat(currentChunk));
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
streamToBufferChunks
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue