@vercel/build-utils 5.0.8 → 5.2.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 +13 -4
- package/dist/lambda.d.ts +2 -0
- package/dist/lambda.js +5 -1
- package/package.json +3 -4
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;
|
@@ -31545,7 +31550,7 @@ const download_1 = __webpack_require__(1611);
|
|
31545
31550
|
const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
|
31546
31551
|
class Lambda {
|
31547
31552
|
constructor(opts) {
|
31548
|
-
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
|
31553
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, } = opts;
|
31549
31554
|
if ('files' in opts) {
|
31550
31555
|
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
31551
31556
|
}
|
@@ -31568,6 +31573,9 @@ class Lambda {
|
|
31568
31573
|
if (supportsMultiPayloads !== undefined) {
|
31569
31574
|
assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
|
31570
31575
|
}
|
31576
|
+
if (supportsWrapper !== undefined) {
|
31577
|
+
assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
|
31578
|
+
}
|
31571
31579
|
if (regions !== undefined) {
|
31572
31580
|
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
31573
31581
|
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
@@ -31583,6 +31591,7 @@ class Lambda {
|
|
31583
31591
|
this.regions = regions;
|
31584
31592
|
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
31585
31593
|
this.supportsMultiPayloads = supportsMultiPayloads;
|
31594
|
+
this.supportsWrapper = supportsWrapper;
|
31586
31595
|
}
|
31587
31596
|
async createZip() {
|
31588
31597
|
let { zipBuffer } = this;
|
package/dist/lambda.d.ts
CHANGED
@@ -13,6 +13,7 @@ export interface LambdaOptionsBase {
|
|
13
13
|
allowQuery?: string[];
|
14
14
|
regions?: string[];
|
15
15
|
supportsMultiPayloads?: boolean;
|
16
|
+
supportsWrapper?: boolean;
|
16
17
|
}
|
17
18
|
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
|
18
19
|
files: Files;
|
@@ -45,6 +46,7 @@ export declare class Lambda {
|
|
45
46
|
*/
|
46
47
|
zipBuffer?: Buffer;
|
47
48
|
supportsMultiPayloads?: boolean;
|
49
|
+
supportsWrapper?: boolean;
|
48
50
|
constructor(opts: LambdaOptions);
|
49
51
|
createZip(): Promise<Buffer>;
|
50
52
|
}
|
package/dist/lambda.js
CHANGED
@@ -13,7 +13,7 @@ const download_1 = require("./fs/download");
|
|
13
13
|
const stream_to_buffer_1 = __importDefault(require("./fs/stream-to-buffer"));
|
14
14
|
class Lambda {
|
15
15
|
constructor(opts) {
|
16
|
-
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
|
16
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, } = opts;
|
17
17
|
if ('files' in opts) {
|
18
18
|
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
19
19
|
}
|
@@ -36,6 +36,9 @@ class Lambda {
|
|
36
36
|
if (supportsMultiPayloads !== undefined) {
|
37
37
|
assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
|
38
38
|
}
|
39
|
+
if (supportsWrapper !== undefined) {
|
40
|
+
assert_1.default(typeof supportsWrapper === 'boolean', '"supportsWrapper" is not a boolean');
|
41
|
+
}
|
39
42
|
if (regions !== undefined) {
|
40
43
|
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
41
44
|
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
@@ -51,6 +54,7 @@ class Lambda {
|
|
51
54
|
this.regions = regions;
|
52
55
|
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
53
56
|
this.supportsMultiPayloads = supportsMultiPayloads;
|
57
|
+
this.supportsWrapper = supportsWrapper;
|
54
58
|
}
|
55
59
|
async createZip() {
|
56
60
|
let { zipBuffer } = this;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "5.0
|
3
|
+
"version": "5.2.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -14,8 +14,7 @@
|
|
14
14
|
"build": "node build",
|
15
15
|
"test": "jest --env node --verbose --runInBand --bail",
|
16
16
|
"test-unit": "yarn test test/unit.*test.*",
|
17
|
-
"test-integration-once": "yarn test test/integration.test.ts"
|
18
|
-
"prepublishOnly": "node build"
|
17
|
+
"test-integration-once": "yarn test test/integration.test.ts"
|
19
18
|
},
|
20
19
|
"devDependencies": {
|
21
20
|
"@iarna/toml": "2.2.3",
|
@@ -48,5 +47,5 @@
|
|
48
47
|
"typescript": "4.3.4",
|
49
48
|
"yazl": "2.5.1"
|
50
49
|
},
|
51
|
-
"gitHead": "
|
50
|
+
"gitHead": "32afd67d29d46f67027091ab9695d8ff330355b5"
|
52
51
|
}
|