@vercel/build-utils 2.14.1-canary.0 → 2.14.1-canary.3
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/.turbo/turbo-build.log +3 -3
- package/dist/detect-builders.js +2 -2
- package/dist/fs/run-user-scripts.d.ts +2 -2
- package/dist/fs/run-user-scripts.js +18 -3
- package/dist/index.js +34 -12
- package/dist/lambda.d.ts +13 -5
- package/dist/lambda.js +12 -5
- package/dist/nodejs-lambda.d.ts +2 -2
- package/dist/types.d.ts +3 -2
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
@@ -18,16 +18,16 @@ ncc: Using typescript@4.3.4 (local user-provided)
|
|
18
18
|
1kB dist/main/schemas.d.ts
|
19
19
|
1kB dist/main/prerender.d.ts
|
20
20
|
1kB dist/main/nodejs-lambda.d.ts
|
21
|
-
1kB dist/main/lambda.d.ts
|
22
21
|
1kB dist/main/file-ref.d.ts
|
23
22
|
1kB dist/main/file-fs-ref.d.ts
|
24
23
|
1kB dist/main/file-blob.d.ts
|
25
24
|
1kB dist/main/errors.d.ts
|
26
25
|
1kB dist/main/detect-file-system-api.d.ts
|
27
26
|
1kB dist/main/detect-builders.d.ts
|
27
|
+
2kB dist/main/lambda.d.ts
|
28
28
|
2kB dist/main/index.d.ts
|
29
29
|
2kB dist/main/detectors/filesystem.d.ts
|
30
30
|
4kB dist/main/fs/run-user-scripts.d.ts
|
31
31
|
10kB dist/main/types.d.ts
|
32
|
-
|
33
|
-
|
32
|
+
1232kB dist/main/index.js
|
33
|
+
1261kB [9158ms] - ncc 0.24.0
|
package/dist/detect-builders.js
CHANGED
@@ -32,12 +32,12 @@ function detectApiDirectory(builders) {
|
|
32
32
|
exports.detectApiDirectory = detectApiDirectory;
|
33
33
|
// TODO: Replace this function with `config.outputDirectory`
|
34
34
|
function getPublicBuilder(builders) {
|
35
|
+
var _a;
|
35
36
|
for (const builder of builders) {
|
36
37
|
if (typeof builder.src === 'string' &&
|
37
38
|
_1.isOfficialRuntime('static', builder.use) &&
|
38
39
|
/^.*\/\*\*\/\*$/.test(builder.src) &&
|
39
|
-
builder.config
|
40
|
-
builder.config.zeroConfig === true) {
|
40
|
+
((_a = builder.config) === null || _a === void 0 ? void 0 : _a.zeroConfig) === true) {
|
41
41
|
return builder;
|
42
42
|
}
|
43
43
|
}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { SpawnOptions } from 'child_process';
|
3
3
|
import { Meta, PackageJson, NodeVersion, Config } from '../types';
|
4
|
-
export declare type CliType = 'yarn' | 'npm';
|
4
|
+
export declare type CliType = 'yarn' | 'npm' | 'pnpm';
|
5
5
|
export interface ScanParentDirsResult {
|
6
6
|
/**
|
7
|
-
* "yarn"
|
7
|
+
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
8
8
|
*/
|
9
9
|
cliType: CliType;
|
10
10
|
/**
|
@@ -12,6 +12,7 @@ const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
12
12
|
const util_1 = require("util");
|
13
13
|
const errors_1 = require("../errors");
|
14
14
|
const node_version_1 = require("./node-version");
|
15
|
+
const read_config_file_1 = require("./read-config-file");
|
15
16
|
function spawnAsync(command, args, opts = {}) {
|
16
17
|
return new Promise((resolve, reject) => {
|
17
18
|
const stderrLogs = [];
|
@@ -164,7 +165,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
164
165
|
packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
|
165
166
|
}
|
166
167
|
// eslint-disable-next-line no-await-in-loop
|
167
|
-
const [packageLockJson, hasYarnLock] = await Promise.all([
|
168
|
+
const [packageLockJson, hasYarnLock, pnpmLockYaml] = await Promise.all([
|
168
169
|
fs_extra_1.default
|
169
170
|
.readJson(path_1.default.join(currentDestPath, 'package-lock.json'))
|
170
171
|
.catch(error => {
|
@@ -175,15 +176,21 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
175
176
|
throw error;
|
176
177
|
}),
|
177
178
|
fs_extra_1.default.pathExists(path_1.default.join(currentDestPath, 'yarn.lock')),
|
179
|
+
read_config_file_1.readConfigFile(path_1.default.join(currentDestPath, 'pnpm-lock.yaml')),
|
178
180
|
]);
|
179
|
-
if (packageLockJson && !hasYarnLock) {
|
181
|
+
if (packageLockJson && !hasYarnLock && !pnpmLockYaml) {
|
180
182
|
cliType = 'npm';
|
181
183
|
lockfileVersion = packageLockJson.lockfileVersion;
|
182
184
|
}
|
185
|
+
if (!packageLockJson && !hasYarnLock && pnpmLockYaml) {
|
186
|
+
cliType = 'pnpm';
|
187
|
+
// just ensure that it is read as a number and not a string
|
188
|
+
lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
|
189
|
+
}
|
183
190
|
// Only stop iterating if a lockfile was found, because it's possible
|
184
191
|
// that the lockfile is in a higher path than where the `package.json`
|
185
192
|
// file was found.
|
186
|
-
if (packageLockJson || hasYarnLock) {
|
193
|
+
if (packageLockJson || hasYarnLock || pnpmLockYaml) {
|
187
194
|
break;
|
188
195
|
}
|
189
196
|
}
|
@@ -234,6 +241,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
234
241
|
.filter(a => a !== '--prefer-offline')
|
235
242
|
.concat(['install', '--no-audit', '--unsafe-perm']);
|
236
243
|
}
|
244
|
+
else if (cliType === 'pnpm') {
|
245
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
246
|
+
// @see options https://pnpm.io/cli/install
|
247
|
+
opts.prettyCommand = 'pnpm install';
|
248
|
+
commandArgs = args
|
249
|
+
.filter(a => a !== '--prefer-offline')
|
250
|
+
.concat(['install', '--unsafe-perm']);
|
251
|
+
}
|
237
252
|
else {
|
238
253
|
opts.prettyCommand = 'yarn install';
|
239
254
|
commandArgs = ['install', ...args];
|
package/dist/index.js
CHANGED
@@ -28255,7 +28255,7 @@ exports.frameworks = [
|
|
28255
28255
|
}));
|
28256
28256
|
return (config && config.publishDir) || 'public';
|
28257
28257
|
},
|
28258
|
-
defaultVersion: '0.
|
28258
|
+
defaultVersion: '0.92.2',
|
28259
28259
|
},
|
28260
28260
|
{
|
28261
28261
|
name: 'Jekyll',
|
@@ -28393,7 +28393,7 @@ exports.frameworks = [
|
|
28393
28393
|
},
|
28394
28394
|
},
|
28395
28395
|
getOutputDirName: async () => 'public',
|
28396
|
-
defaultVersion: '0.
|
28396
|
+
defaultVersion: '0.15.3',
|
28397
28397
|
},
|
28398
28398
|
{
|
28399
28399
|
name: 'Vite',
|
@@ -32813,12 +32813,12 @@ function detectApiDirectory(builders) {
|
|
32813
32813
|
exports.detectApiDirectory = detectApiDirectory;
|
32814
32814
|
// TODO: Replace this function with `config.outputDirectory`
|
32815
32815
|
function getPublicBuilder(builders) {
|
32816
|
+
var _a;
|
32816
32817
|
for (const builder of builders) {
|
32817
32818
|
if (typeof builder.src === 'string' &&
|
32818
32819
|
_1.isOfficialRuntime('static', builder.use) &&
|
32819
32820
|
/^.*\/\*\*\/\*$/.test(builder.src) &&
|
32820
|
-
builder.config
|
32821
|
-
builder.config.zeroConfig === true) {
|
32821
|
+
((_a = builder.config) === null || _a === void 0 ? void 0 : _a.zeroConfig) === true) {
|
32822
32822
|
return builder;
|
32823
32823
|
}
|
32824
32824
|
}
|
@@ -34583,6 +34583,7 @@ const cross_spawn_1 = __importDefault(__webpack_require__(7618));
|
|
34583
34583
|
const util_1 = __webpack_require__(1669);
|
34584
34584
|
const errors_1 = __webpack_require__(3983);
|
34585
34585
|
const node_version_1 = __webpack_require__(7903);
|
34586
|
+
const read_config_file_1 = __webpack_require__(7792);
|
34586
34587
|
function spawnAsync(command, args, opts = {}) {
|
34587
34588
|
return new Promise((resolve, reject) => {
|
34588
34589
|
const stderrLogs = [];
|
@@ -34735,7 +34736,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
34735
34736
|
packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
|
34736
34737
|
}
|
34737
34738
|
// eslint-disable-next-line no-await-in-loop
|
34738
|
-
const [packageLockJson, hasYarnLock] = await Promise.all([
|
34739
|
+
const [packageLockJson, hasYarnLock, pnpmLockYaml] = await Promise.all([
|
34739
34740
|
fs_extra_1.default
|
34740
34741
|
.readJson(path_1.default.join(currentDestPath, 'package-lock.json'))
|
34741
34742
|
.catch(error => {
|
@@ -34746,15 +34747,21 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
34746
34747
|
throw error;
|
34747
34748
|
}),
|
34748
34749
|
fs_extra_1.default.pathExists(path_1.default.join(currentDestPath, 'yarn.lock')),
|
34750
|
+
read_config_file_1.readConfigFile(path_1.default.join(currentDestPath, 'pnpm-lock.yaml')),
|
34749
34751
|
]);
|
34750
|
-
if (packageLockJson && !hasYarnLock) {
|
34752
|
+
if (packageLockJson && !hasYarnLock && !pnpmLockYaml) {
|
34751
34753
|
cliType = 'npm';
|
34752
34754
|
lockfileVersion = packageLockJson.lockfileVersion;
|
34753
34755
|
}
|
34756
|
+
if (!packageLockJson && !hasYarnLock && pnpmLockYaml) {
|
34757
|
+
cliType = 'pnpm';
|
34758
|
+
// just ensure that it is read as a number and not a string
|
34759
|
+
lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
|
34760
|
+
}
|
34754
34761
|
// Only stop iterating if a lockfile was found, because it's possible
|
34755
34762
|
// that the lockfile is in a higher path than where the `package.json`
|
34756
34763
|
// file was found.
|
34757
|
-
if (packageLockJson || hasYarnLock) {
|
34764
|
+
if (packageLockJson || hasYarnLock || pnpmLockYaml) {
|
34758
34765
|
break;
|
34759
34766
|
}
|
34760
34767
|
}
|
@@ -34805,6 +34812,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
34805
34812
|
.filter(a => a !== '--prefer-offline')
|
34806
34813
|
.concat(['install', '--no-audit', '--unsafe-perm']);
|
34807
34814
|
}
|
34815
|
+
else if (cliType === 'pnpm') {
|
34816
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
34817
|
+
// @see options https://pnpm.io/cli/install
|
34818
|
+
opts.prettyCommand = 'pnpm install';
|
34819
|
+
commandArgs = args
|
34820
|
+
.filter(a => a !== '--prefer-offline')
|
34821
|
+
.concat(['install', '--unsafe-perm']);
|
34822
|
+
}
|
34808
34823
|
else {
|
34809
34824
|
opts.prettyCommand = 'yarn install';
|
34810
34825
|
commandArgs = ['install', ...args];
|
@@ -35207,9 +35222,13 @@ const fs_extra_1 = __webpack_require__(5392);
|
|
35207
35222
|
const download_1 = __webpack_require__(1611);
|
35208
35223
|
const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
|
35209
35224
|
class Lambda {
|
35210
|
-
constructor(
|
35211
|
-
|
35212
|
-
|
35225
|
+
constructor(opts) {
|
35226
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, } = opts;
|
35227
|
+
if ('files' in opts) {
|
35228
|
+
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
35229
|
+
}
|
35230
|
+
if ('zipBuffer' in opts) {
|
35231
|
+
assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
|
35213
35232
|
}
|
35214
35233
|
assert_1.default(typeof handler === 'string', '"handler" is not a string');
|
35215
35234
|
assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
|
@@ -35229,7 +35248,7 @@ class Lambda {
|
|
35229
35248
|
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
35230
35249
|
}
|
35231
35250
|
this.type = 'Lambda';
|
35232
|
-
this.files = files;
|
35251
|
+
this.files = 'files' in opts ? opts.files : undefined;
|
35233
35252
|
this.handler = handler;
|
35234
35253
|
this.runtime = runtime;
|
35235
35254
|
this.memory = memory;
|
@@ -35237,11 +35256,14 @@ class Lambda {
|
|
35237
35256
|
this.environment = environment;
|
35238
35257
|
this.allowQuery = allowQuery;
|
35239
35258
|
this.regions = regions;
|
35240
|
-
this.zipBuffer = zipBuffer;
|
35259
|
+
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
35241
35260
|
}
|
35242
35261
|
async createZip() {
|
35243
35262
|
let { zipBuffer } = this;
|
35244
35263
|
if (!zipBuffer) {
|
35264
|
+
if (!this.files) {
|
35265
|
+
throw new Error('`files` is not defined');
|
35266
|
+
}
|
35245
35267
|
await sema.acquire();
|
35246
35268
|
try {
|
35247
35269
|
zipBuffer = await createZip(this.files);
|
package/dist/lambda.d.ts
CHANGED
@@ -3,8 +3,8 @@ import { Files, Config } from './types';
|
|
3
3
|
interface Environment {
|
4
4
|
[key: string]: string;
|
5
5
|
}
|
6
|
-
export
|
7
|
-
|
6
|
+
export declare type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
7
|
+
export interface LambdaOptionsBase {
|
8
8
|
handler: string;
|
9
9
|
runtime: string;
|
10
10
|
memory?: number;
|
@@ -12,10 +12,18 @@ export interface LambdaOptions {
|
|
12
12
|
environment?: Environment;
|
13
13
|
allowQuery?: string[];
|
14
14
|
regions?: string[];
|
15
|
+
}
|
16
|
+
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
|
17
|
+
files: Files;
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* @deprecated Use `LambdaOptionsWithFiles` instead.
|
21
|
+
*/
|
22
|
+
export interface LambdaOptionsWithZipBuffer extends LambdaOptionsBase {
|
15
23
|
/**
|
16
24
|
* @deprecated Use `files` property instead.
|
17
25
|
*/
|
18
|
-
zipBuffer
|
26
|
+
zipBuffer: Buffer;
|
19
27
|
}
|
20
28
|
interface GetLambdaOptionsFromFunctionOptions {
|
21
29
|
sourceFile: string;
|
@@ -23,7 +31,7 @@ interface GetLambdaOptionsFromFunctionOptions {
|
|
23
31
|
}
|
24
32
|
export declare class Lambda {
|
25
33
|
type: 'Lambda';
|
26
|
-
files
|
34
|
+
files?: Files;
|
27
35
|
handler: string;
|
28
36
|
runtime: string;
|
29
37
|
memory?: number;
|
@@ -35,7 +43,7 @@ export declare class Lambda {
|
|
35
43
|
* @deprecated Use `await lambda.createZip()` instead.
|
36
44
|
*/
|
37
45
|
zipBuffer?: Buffer;
|
38
|
-
constructor(
|
46
|
+
constructor(opts: LambdaOptions);
|
39
47
|
createZip(): Promise<Buffer>;
|
40
48
|
}
|
41
49
|
/**
|
package/dist/lambda.js
CHANGED
@@ -12,9 +12,13 @@ const fs_extra_1 = require("fs-extra");
|
|
12
12
|
const download_1 = require("./fs/download");
|
13
13
|
const stream_to_buffer_1 = __importDefault(require("./fs/stream-to-buffer"));
|
14
14
|
class Lambda {
|
15
|
-
constructor(
|
16
|
-
|
17
|
-
|
15
|
+
constructor(opts) {
|
16
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, } = opts;
|
17
|
+
if ('files' in opts) {
|
18
|
+
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
19
|
+
}
|
20
|
+
if ('zipBuffer' in opts) {
|
21
|
+
assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
|
18
22
|
}
|
19
23
|
assert_1.default(typeof handler === 'string', '"handler" is not a string');
|
20
24
|
assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
|
@@ -34,7 +38,7 @@ class Lambda {
|
|
34
38
|
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
35
39
|
}
|
36
40
|
this.type = 'Lambda';
|
37
|
-
this.files = files;
|
41
|
+
this.files = 'files' in opts ? opts.files : undefined;
|
38
42
|
this.handler = handler;
|
39
43
|
this.runtime = runtime;
|
40
44
|
this.memory = memory;
|
@@ -42,11 +46,14 @@ class Lambda {
|
|
42
46
|
this.environment = environment;
|
43
47
|
this.allowQuery = allowQuery;
|
44
48
|
this.regions = regions;
|
45
|
-
this.zipBuffer = zipBuffer;
|
49
|
+
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
46
50
|
}
|
47
51
|
async createZip() {
|
48
52
|
let { zipBuffer } = this;
|
49
53
|
if (!zipBuffer) {
|
54
|
+
if (!this.files) {
|
55
|
+
throw new Error('`files` is not defined');
|
56
|
+
}
|
50
57
|
await sema.acquire();
|
51
58
|
try {
|
52
59
|
zipBuffer = await createZip(this.files);
|
package/dist/nodejs-lambda.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Lambda,
|
2
|
-
interface NodejsLambdaOptions extends
|
1
|
+
import { Lambda, LambdaOptionsWithFiles } from './lambda';
|
2
|
+
interface NodejsLambdaOptions extends LambdaOptionsWithFiles {
|
3
3
|
shouldAddHelpers: boolean;
|
4
4
|
shouldAddSourcemapSupport: boolean;
|
5
5
|
awsLambdaHandler?: string;
|
package/dist/types.d.ts
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
import FileRef from './file-ref';
|
3
3
|
import FileFsRef from './file-fs-ref';
|
4
4
|
import { Lambda } from './lambda';
|
5
|
+
import { Prerender } from './prerender';
|
5
6
|
export interface Env {
|
6
7
|
[name: string]: string | undefined;
|
7
8
|
}
|
@@ -339,10 +340,10 @@ export interface Images {
|
|
339
340
|
formats?: ImageFormat[];
|
340
341
|
}
|
341
342
|
export interface BuildResultV2 {
|
342
|
-
routes
|
343
|
+
routes?: any[];
|
343
344
|
images?: Images;
|
344
345
|
output: {
|
345
|
-
[key: string]: File | Lambda;
|
346
|
+
[key: string]: File | Lambda | Prerender;
|
346
347
|
};
|
347
348
|
wildcard?: Array<{
|
348
349
|
domain: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.14.1-canary.
|
3
|
+
"version": "2.14.1-canary.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@types/node-fetch": "^2.1.6",
|
31
31
|
"@types/semver": "6.0.0",
|
32
32
|
"@types/yazl": "^2.4.1",
|
33
|
-
"@vercel/frameworks": "0.6.1-canary.
|
33
|
+
"@vercel/frameworks": "0.6.1-canary.2",
|
34
34
|
"@vercel/ncc": "0.24.0",
|
35
35
|
"aggregate-error": "3.0.1",
|
36
36
|
"async-retry": "1.2.3",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.4.3"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "a17f3a96ec12483a28667894dcdc3bb57675ead3"
|
53
53
|
}
|