@vercel/build-utils 2.14.1-canary.1 → 2.14.1-canary.4

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.
@@ -18,16 +18,17 @@ 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
25
+ 1kB dist/main/edge-function.d.ts
26
26
  1kB dist/main/detect-file-system-api.d.ts
27
27
  1kB dist/main/detect-builders.d.ts
28
- 2kB dist/main/index.d.ts
28
+ 2kB dist/main/lambda.d.ts
29
29
  2kB dist/main/detectors/filesystem.d.ts
30
+ 3kB dist/main/index.d.ts
30
31
  4kB dist/main/fs/run-user-scripts.d.ts
31
32
  10kB dist/main/types.d.ts
32
- 1231kB dist/main/index.js
33
- 1259kB [9313ms] - ncc 0.24.0
33
+ 1234kB dist/main/index.js
34
+ 1265kB [7426ms] - ncc 0.24.0
@@ -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
  }
@@ -0,0 +1,30 @@
1
+ import type { Files } from './types';
2
+ /**
3
+ * An Edge Functions output
4
+ */
5
+ export declare class EdgeFunction {
6
+ type: 'EdgeFunction';
7
+ /**
8
+ * A display name for the edge function.
9
+ */
10
+ name: string;
11
+ /**
12
+ * The deployment target.
13
+ * Only v8-worker is currently supported.
14
+ */
15
+ deploymentTarget: 'v8-worker';
16
+ /**
17
+ * The entrypoint for the edge function.
18
+ */
19
+ entrypoint: string;
20
+ /**
21
+ * The list of files to be included in the edge function bundle.
22
+ */
23
+ files: Files;
24
+ /**
25
+ * Extra environment variables in use for the user code, to be
26
+ * assigned to the edge function.
27
+ */
28
+ envVarsInUse?: string[];
29
+ constructor(params: Omit<EdgeFunction, 'type'>);
30
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EdgeFunction = void 0;
4
+ /**
5
+ * An Edge Functions output
6
+ */
7
+ class EdgeFunction {
8
+ constructor(params) {
9
+ this.type = 'EdgeFunction';
10
+ this.name = params.name;
11
+ this.deploymentTarget = params.deploymentTarget;
12
+ this.entrypoint = params.entrypoint;
13
+ this.files = params.files;
14
+ this.envVarsInUse = params.envVarsInUse;
15
+ }
16
+ }
17
+ exports.EdgeFunction = EdgeFunction;
@@ -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" or "npm", depending on the presence of lockfiles.
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];
@@ -305,6 +320,9 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
305
320
  if (cliType === 'npm') {
306
321
  opts.prettyCommand = `npm run ${scriptName}`;
307
322
  }
323
+ else if (cliType === 'pnpm') {
324
+ opts.prettyCommand = `pnpm run ${scriptName}`;
325
+ }
308
326
  else {
309
327
  opts.prettyCommand = `yarn run ${scriptName}`;
310
328
  }
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ import debug from './debug';
16
16
  import getIgnoreFilter from './get-ignore-filter';
17
17
  import { getPlatformEnv } from './get-platform-env';
18
18
  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, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
19
+ export { EdgeFunction } from './edge-function';
19
20
  export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, } from './detect-builders';
20
21
  export { detectFileSystemAPI } from './detect-file-system-api';
21
22
  export { detectFramework } from './detect-framework';
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.58.2',
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.13.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
  }
@@ -33932,6 +33932,31 @@ class DetectorFilesystem {
33932
33932
  exports.DetectorFilesystem = DetectorFilesystem;
33933
33933
 
33934
33934
 
33935
+ /***/ }),
33936
+
33937
+ /***/ 8038:
33938
+ /***/ ((__unused_webpack_module, exports) => {
33939
+
33940
+ "use strict";
33941
+
33942
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33943
+ exports.EdgeFunction = void 0;
33944
+ /**
33945
+ * An Edge Functions output
33946
+ */
33947
+ class EdgeFunction {
33948
+ constructor(params) {
33949
+ this.type = 'EdgeFunction';
33950
+ this.name = params.name;
33951
+ this.deploymentTarget = params.deploymentTarget;
33952
+ this.entrypoint = params.entrypoint;
33953
+ this.files = params.files;
33954
+ this.envVarsInUse = params.envVarsInUse;
33955
+ }
33956
+ }
33957
+ exports.EdgeFunction = EdgeFunction;
33958
+
33959
+
33935
33960
  /***/ }),
33936
33961
 
33937
33962
  /***/ 3983:
@@ -34583,6 +34608,7 @@ const cross_spawn_1 = __importDefault(__webpack_require__(7618));
34583
34608
  const util_1 = __webpack_require__(1669);
34584
34609
  const errors_1 = __webpack_require__(3983);
34585
34610
  const node_version_1 = __webpack_require__(7903);
34611
+ const read_config_file_1 = __webpack_require__(7792);
34586
34612
  function spawnAsync(command, args, opts = {}) {
34587
34613
  return new Promise((resolve, reject) => {
34588
34614
  const stderrLogs = [];
@@ -34735,7 +34761,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
34735
34761
  packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
34736
34762
  }
34737
34763
  // eslint-disable-next-line no-await-in-loop
34738
- const [packageLockJson, hasYarnLock] = await Promise.all([
34764
+ const [packageLockJson, hasYarnLock, pnpmLockYaml] = await Promise.all([
34739
34765
  fs_extra_1.default
34740
34766
  .readJson(path_1.default.join(currentDestPath, 'package-lock.json'))
34741
34767
  .catch(error => {
@@ -34746,15 +34772,21 @@ async function scanParentDirs(destPath, readPackageJson = false) {
34746
34772
  throw error;
34747
34773
  }),
34748
34774
  fs_extra_1.default.pathExists(path_1.default.join(currentDestPath, 'yarn.lock')),
34775
+ read_config_file_1.readConfigFile(path_1.default.join(currentDestPath, 'pnpm-lock.yaml')),
34749
34776
  ]);
34750
- if (packageLockJson && !hasYarnLock) {
34777
+ if (packageLockJson && !hasYarnLock && !pnpmLockYaml) {
34751
34778
  cliType = 'npm';
34752
34779
  lockfileVersion = packageLockJson.lockfileVersion;
34753
34780
  }
34781
+ if (!packageLockJson && !hasYarnLock && pnpmLockYaml) {
34782
+ cliType = 'pnpm';
34783
+ // just ensure that it is read as a number and not a string
34784
+ lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
34785
+ }
34754
34786
  // Only stop iterating if a lockfile was found, because it's possible
34755
34787
  // that the lockfile is in a higher path than where the `package.json`
34756
34788
  // file was found.
34757
- if (packageLockJson || hasYarnLock) {
34789
+ if (packageLockJson || hasYarnLock || pnpmLockYaml) {
34758
34790
  break;
34759
34791
  }
34760
34792
  }
@@ -34805,6 +34837,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
34805
34837
  .filter(a => a !== '--prefer-offline')
34806
34838
  .concat(['install', '--no-audit', '--unsafe-perm']);
34807
34839
  }
34840
+ else if (cliType === 'pnpm') {
34841
+ // PNPM's install command is similar to NPM's but without the audit nonsense
34842
+ // @see options https://pnpm.io/cli/install
34843
+ opts.prettyCommand = 'pnpm install';
34844
+ commandArgs = args
34845
+ .filter(a => a !== '--prefer-offline')
34846
+ .concat(['install', '--unsafe-perm']);
34847
+ }
34808
34848
  else {
34809
34849
  opts.prettyCommand = 'yarn install';
34810
34850
  commandArgs = ['install', ...args];
@@ -34876,6 +34916,9 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
34876
34916
  if (cliType === 'npm') {
34877
34917
  opts.prettyCommand = `npm run ${scriptName}`;
34878
34918
  }
34919
+ else if (cliType === 'pnpm') {
34920
+ opts.prettyCommand = `pnpm run ${scriptName}`;
34921
+ }
34879
34922
  else {
34880
34923
  opts.prettyCommand = `yarn run ${scriptName}`;
34881
34924
  }
@@ -35094,7 +35137,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35094
35137
  return (mod && mod.__esModule) ? mod : { "default": mod };
35095
35138
  };
35096
35139
  Object.defineProperty(exports, "__esModule", ({ value: true }));
35097
- exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = 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;
35140
+ exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = 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;
35098
35141
  const file_blob_1 = __importDefault(__webpack_require__(2397));
35099
35142
  exports.FileBlob = file_blob_1.default;
35100
35143
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -35150,6 +35193,8 @@ const get_ignore_filter_1 = __importDefault(__webpack_require__(1148));
35150
35193
  exports.getIgnoreFilter = get_ignore_filter_1.default;
35151
35194
  const get_platform_env_1 = __webpack_require__(4678);
35152
35195
  Object.defineProperty(exports, "getPlatformEnv", ({ enumerable: true, get: function () { return get_platform_env_1.getPlatformEnv; } }));
35196
+ var edge_function_1 = __webpack_require__(8038);
35197
+ Object.defineProperty(exports, "EdgeFunction", ({ enumerable: true, get: function () { return edge_function_1.EdgeFunction; } }));
35153
35198
  var detect_builders_1 = __webpack_require__(4246);
35154
35199
  Object.defineProperty(exports, "detectBuilders", ({ enumerable: true, get: function () { return detect_builders_1.detectBuilders; } }));
35155
35200
  Object.defineProperty(exports, "detectOutputDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectOutputDirectory; } }));
@@ -35207,9 +35252,13 @@ const fs_extra_1 = __webpack_require__(5392);
35207
35252
  const download_1 = __webpack_require__(1611);
35208
35253
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
35209
35254
  class Lambda {
35210
- constructor({ files, handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, zipBuffer, }) {
35211
- if (!zipBuffer) {
35212
- assert_1.default(typeof files === 'object', '"files" must be an object');
35255
+ constructor(opts) {
35256
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
35257
+ if ('files' in opts) {
35258
+ assert_1.default(typeof opts.files === 'object', '"files" must be an object');
35259
+ }
35260
+ if ('zipBuffer' in opts) {
35261
+ assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
35213
35262
  }
35214
35263
  assert_1.default(typeof handler === 'string', '"handler" is not a string');
35215
35264
  assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
@@ -35224,12 +35273,15 @@ class Lambda {
35224
35273
  assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
35225
35274
  assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
35226
35275
  }
35276
+ if (supportsMultiPayloads !== undefined) {
35277
+ assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
35278
+ }
35227
35279
  if (regions !== undefined) {
35228
35280
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
35229
35281
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
35230
35282
  }
35231
35283
  this.type = 'Lambda';
35232
- this.files = files;
35284
+ this.files = 'files' in opts ? opts.files : undefined;
35233
35285
  this.handler = handler;
35234
35286
  this.runtime = runtime;
35235
35287
  this.memory = memory;
@@ -35237,11 +35289,15 @@ class Lambda {
35237
35289
  this.environment = environment;
35238
35290
  this.allowQuery = allowQuery;
35239
35291
  this.regions = regions;
35240
- this.zipBuffer = zipBuffer;
35292
+ this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
35293
+ this.supportsMultiPayloads = supportsMultiPayloads;
35241
35294
  }
35242
35295
  async createZip() {
35243
35296
  let { zipBuffer } = this;
35244
35297
  if (!zipBuffer) {
35298
+ if (!this.files) {
35299
+ throw new Error('`files` is not defined');
35300
+ }
35245
35301
  await sema.acquire();
35246
35302
  try {
35247
35303
  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 interface LambdaOptions {
7
- files: Files;
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,19 @@ export interface LambdaOptions {
12
12
  environment?: Environment;
13
13
  allowQuery?: string[];
14
14
  regions?: string[];
15
+ supportsMultiPayloads?: boolean;
16
+ }
17
+ export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
18
+ files: Files;
19
+ }
20
+ /**
21
+ * @deprecated Use `LambdaOptionsWithFiles` instead.
22
+ */
23
+ export interface LambdaOptionsWithZipBuffer extends LambdaOptionsBase {
15
24
  /**
16
25
  * @deprecated Use `files` property instead.
17
26
  */
18
- zipBuffer?: Buffer;
27
+ zipBuffer: Buffer;
19
28
  }
20
29
  interface GetLambdaOptionsFromFunctionOptions {
21
30
  sourceFile: string;
@@ -23,7 +32,7 @@ interface GetLambdaOptionsFromFunctionOptions {
23
32
  }
24
33
  export declare class Lambda {
25
34
  type: 'Lambda';
26
- files: Files;
35
+ files?: Files;
27
36
  handler: string;
28
37
  runtime: string;
29
38
  memory?: number;
@@ -35,7 +44,8 @@ export declare class Lambda {
35
44
  * @deprecated Use `await lambda.createZip()` instead.
36
45
  */
37
46
  zipBuffer?: Buffer;
38
- constructor({ files, handler, runtime, maxDuration, memory, environment, allowQuery, regions, zipBuffer, }: LambdaOptions);
47
+ supportsMultiPayloads?: boolean;
48
+ constructor(opts: LambdaOptions);
39
49
  createZip(): Promise<Buffer>;
40
50
  }
41
51
  /**
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({ files, handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, zipBuffer, }) {
16
- if (!zipBuffer) {
17
- assert_1.default(typeof files === 'object', '"files" must be an object');
15
+ constructor(opts) {
16
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = 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');
@@ -29,12 +33,15 @@ class Lambda {
29
33
  assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
30
34
  assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
31
35
  }
36
+ if (supportsMultiPayloads !== undefined) {
37
+ assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
38
+ }
32
39
  if (regions !== undefined) {
33
40
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
34
41
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
35
42
  }
36
43
  this.type = 'Lambda';
37
- this.files = files;
44
+ this.files = 'files' in opts ? opts.files : undefined;
38
45
  this.handler = handler;
39
46
  this.runtime = runtime;
40
47
  this.memory = memory;
@@ -42,11 +49,15 @@ class Lambda {
42
49
  this.environment = environment;
43
50
  this.allowQuery = allowQuery;
44
51
  this.regions = regions;
45
- this.zipBuffer = zipBuffer;
52
+ this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
53
+ this.supportsMultiPayloads = supportsMultiPayloads;
46
54
  }
47
55
  async createZip() {
48
56
  let { zipBuffer } = this;
49
57
  if (!zipBuffer) {
58
+ if (!this.files) {
59
+ throw new Error('`files` is not defined');
60
+ }
50
61
  await sema.acquire();
51
62
  try {
52
63
  zipBuffer = await createZip(this.files);
@@ -1,5 +1,5 @@
1
- import { Lambda, LambdaOptions } from './lambda';
2
- interface NodejsLambdaOptions extends LambdaOptions {
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
@@ -1,7 +1,9 @@
1
1
  /// <reference types="node" />
2
- import FileRef from './file-ref';
3
- import FileFsRef from './file-fs-ref';
4
- import { Lambda } from './lambda';
2
+ import type FileRef from './file-ref';
3
+ import type FileFsRef from './file-fs-ref';
4
+ import type { Lambda } from './lambda';
5
+ import type { Prerender } from './prerender';
6
+ import type { EdgeFunction } from './edge-function';
5
7
  export interface Env {
6
8
  [name: string]: string | undefined;
7
9
  }
@@ -339,10 +341,10 @@ export interface Images {
339
341
  formats?: ImageFormat[];
340
342
  }
341
343
  export interface BuildResultV2 {
342
- routes: any[];
344
+ routes?: any[];
343
345
  images?: Images;
344
346
  output: {
345
- [key: string]: File | Lambda;
347
+ [key: string]: File | Lambda | Prerender | EdgeFunction;
346
348
  };
347
349
  wildcard?: Array<{
348
350
  domain: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "2.14.1-canary.1",
3
+ "version": "2.14.1-canary.4",
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.1",
33
+ "@vercel/frameworks": "0.6.1-canary.3",
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": "0351f02dff357a396f581e11dd06a72619dbcfb1"
52
+ "gitHead": "a24fd64bce88d5025c52ac7dfbdc3c0f457de077"
53
53
  }