@vercel/build-utils 5.0.8 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fs/download.d.ts +2 -1
- package/dist/fs/download.js +6 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -3
- package/package.json +2 -2
package/dist/fs/download.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import FileFsRef from '../file-fs-ref';
|
2
|
-
import { Files, Meta } from '../types';
|
2
|
+
import { File, Files, Meta } from '../types';
|
3
3
|
export interface DownloadedFiles {
|
4
4
|
[filePath: string]: FileFsRef;
|
5
5
|
}
|
6
6
|
export declare function isSymbolicLink(mode: number): boolean;
|
7
|
+
export declare function downloadFile(file: File, fsPath: string): Promise<FileFsRef>;
|
7
8
|
export default function download(files: Files, basePath: string, meta?: Meta): Promise<DownloadedFiles>;
|
package/dist/fs/download.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.isSymbolicLink = void 0;
|
6
|
+
exports.downloadFile = exports.isSymbolicLink = void 0;
|
7
7
|
const path_1 = __importDefault(require("path"));
|
8
8
|
const debug_1 = __importDefault(require("../debug"));
|
9
9
|
const file_fs_ref_1 = __importDefault(require("../file-fs-ref"));
|
@@ -22,7 +22,7 @@ async function prepareSymlinkTarget(file, fsPath) {
|
|
22
22
|
return target;
|
23
23
|
}
|
24
24
|
if (file.type === 'FileRef' || file.type === 'FileBlob') {
|
25
|
-
const targetPathBufferPromise =
|
25
|
+
const targetPathBufferPromise = stream_to_buffer_1.default(await file.toStreamAsync());
|
26
26
|
const [targetPathBuffer] = await Promise.all([
|
27
27
|
targetPathBufferPromise,
|
28
28
|
mkdirPromise,
|
@@ -33,6 +33,9 @@ async function prepareSymlinkTarget(file, fsPath) {
|
|
33
33
|
}
|
34
34
|
async function downloadFile(file, fsPath) {
|
35
35
|
const { mode } = file;
|
36
|
+
// If the source is a symlink, try to create it instead of copying the file.
|
37
|
+
// Note: creating symlinks on Windows requires admin priviliges or symlinks
|
38
|
+
// enabled in the group policy. We may want to improve the error message.
|
36
39
|
if (isSymbolicLink(mode)) {
|
37
40
|
const target = await prepareSymlinkTarget(file, fsPath);
|
38
41
|
await fs_extra_1.symlink(target, fsPath);
|
@@ -41,6 +44,7 @@ async function downloadFile(file, fsPath) {
|
|
41
44
|
const stream = file.toStream();
|
42
45
|
return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
|
43
46
|
}
|
47
|
+
exports.downloadFile = downloadFile;
|
44
48
|
async function removeFile(basePath, fileMatched) {
|
45
49
|
const file = path_1.default.join(basePath, fileMatched);
|
46
50
|
await fs_extra_1.remove(file);
|
package/dist/index.d.ts
CHANGED
@@ -4,7 +4,7 @@ import FileRef from './file-ref';
|
|
4
4
|
import { Lambda, createLambda, getLambdaOptionsFromFunction } from './lambda';
|
5
5
|
import { NodejsLambda } from './nodejs-lambda';
|
6
6
|
import { Prerender } from './prerender';
|
7
|
-
import download, { DownloadedFiles, isSymbolicLink } from './fs/download';
|
7
|
+
import download, { downloadFile, DownloadedFiles, isSymbolicLink } from './fs/download';
|
8
8
|
import getWriteableDirectory from './fs/get-writable-directory';
|
9
9
|
import glob, { GlobOptions } from './fs/glob';
|
10
10
|
import rename from './fs/rename';
|
@@ -14,7 +14,7 @@ import streamToBuffer from './fs/stream-to-buffer';
|
|
14
14
|
import debug from './debug';
|
15
15
|
import getIgnoreFilter from './get-ignore-filter';
|
16
16
|
import { getPlatformEnv } from './get-platform-env';
|
17
|
-
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, streamToBuffer, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
|
17
|
+
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, streamToBuffer, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
|
18
18
|
export { EdgeFunction } from './edge-function';
|
19
19
|
export { readConfigFile } from './fs/read-config-file';
|
20
20
|
export { normalizePath } from './fs/normalize-path';
|
package/dist/index.js
CHANGED
@@ -30471,7 +30471,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30471
30471
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
30472
30472
|
};
|
30473
30473
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
30474
|
-
exports.isSymbolicLink = void 0;
|
30474
|
+
exports.downloadFile = exports.isSymbolicLink = void 0;
|
30475
30475
|
const path_1 = __importDefault(__webpack_require__(5622));
|
30476
30476
|
const debug_1 = __importDefault(__webpack_require__(1868));
|
30477
30477
|
const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
|
@@ -30490,7 +30490,7 @@ async function prepareSymlinkTarget(file, fsPath) {
|
|
30490
30490
|
return target;
|
30491
30491
|
}
|
30492
30492
|
if (file.type === 'FileRef' || file.type === 'FileBlob') {
|
30493
|
-
const targetPathBufferPromise =
|
30493
|
+
const targetPathBufferPromise = stream_to_buffer_1.default(await file.toStreamAsync());
|
30494
30494
|
const [targetPathBuffer] = await Promise.all([
|
30495
30495
|
targetPathBufferPromise,
|
30496
30496
|
mkdirPromise,
|
@@ -30501,6 +30501,9 @@ async function prepareSymlinkTarget(file, fsPath) {
|
|
30501
30501
|
}
|
30502
30502
|
async function downloadFile(file, fsPath) {
|
30503
30503
|
const { mode } = file;
|
30504
|
+
// If the source is a symlink, try to create it instead of copying the file.
|
30505
|
+
// Note: creating symlinks on Windows requires admin priviliges or symlinks
|
30506
|
+
// enabled in the group policy. We may want to improve the error message.
|
30504
30507
|
if (isSymbolicLink(mode)) {
|
30505
30508
|
const target = await prepareSymlinkTarget(file, fsPath);
|
30506
30509
|
await fs_extra_1.symlink(target, fsPath);
|
@@ -30509,6 +30512,7 @@ async function downloadFile(file, fsPath) {
|
|
30509
30512
|
const stream = file.toStream();
|
30510
30513
|
return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
|
30511
30514
|
}
|
30515
|
+
exports.downloadFile = downloadFile;
|
30512
30516
|
async function removeFile(basePath, fileMatched) {
|
30513
30517
|
const file = path_1.default.join(basePath, fileMatched);
|
30514
30518
|
await fs_extra_1.remove(file);
|
@@ -31458,7 +31462,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31458
31462
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
31459
31463
|
};
|
31460
31464
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
31461
|
-
exports.normalizePath = exports.readConfigFile = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
|
31465
|
+
exports.normalizePath = exports.readConfigFile = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.downloadFile = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
|
31462
31466
|
const file_blob_1 = __importDefault(__webpack_require__(2397));
|
31463
31467
|
exports.FileBlob = file_blob_1.default;
|
31464
31468
|
const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
|
@@ -31475,6 +31479,7 @@ const prerender_1 = __webpack_require__(2850);
|
|
31475
31479
|
Object.defineProperty(exports, "Prerender", ({ enumerable: true, get: function () { return prerender_1.Prerender; } }));
|
31476
31480
|
const download_1 = __importStar(__webpack_require__(1611));
|
31477
31481
|
exports.download = download_1.default;
|
31482
|
+
Object.defineProperty(exports, "downloadFile", ({ enumerable: true, get: function () { return download_1.downloadFile; } }));
|
31478
31483
|
Object.defineProperty(exports, "isSymbolicLink", ({ enumerable: true, get: function () { return download_1.isSymbolicLink; } }));
|
31479
31484
|
const get_writable_directory_1 = __importDefault(__webpack_require__(3838));
|
31480
31485
|
exports.getWriteableDirectory = get_writable_directory_1.default;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "5.0
|
3
|
+
"version": "5.1.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"typescript": "4.3.4",
|
49
49
|
"yazl": "2.5.1"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "7db6436797d0b4131113f0b8dccc3b66bc9b1981"
|
52
52
|
}
|