@vercel/build-utils 2.14.1-canary.2 → 2.14.1-canary.5

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.
@@ -22,12 +22,13 @@ ncc: Using typescript@4.3.4 (local user-provided)
22
22
  1kB dist/main/file-fs-ref.d.ts
23
23
  1kB dist/main/file-blob.d.ts
24
24
  1kB dist/main/errors.d.ts
25
+ 1kB dist/main/edge-function.d.ts
25
26
  1kB dist/main/detect-file-system-api.d.ts
26
27
  1kB dist/main/detect-builders.d.ts
27
28
  2kB dist/main/lambda.d.ts
28
- 2kB dist/main/index.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
- 1232kB dist/main/index.js
33
- 1261kB [7389ms] - ncc 0.24.0
33
+ 1235kB dist/main/index.js
34
+ 1266kB [6928ms] - ncc 0.24.0
@@ -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,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { File } from './types';
2
+ import { FileBase } from './types';
3
3
  interface FileBlobOptions {
4
4
  mode?: number;
5
5
  contentType?: string;
@@ -10,13 +10,14 @@ interface FromStreamOptions {
10
10
  contentType?: string;
11
11
  stream: NodeJS.ReadableStream;
12
12
  }
13
- export default class FileBlob implements File {
13
+ export default class FileBlob implements FileBase {
14
14
  type: 'FileBlob';
15
15
  mode: number;
16
16
  data: string | Buffer;
17
17
  contentType: string | undefined;
18
18
  constructor({ mode, contentType, data }: FileBlobOptions);
19
19
  static fromStream({ mode, contentType, stream, }: FromStreamOptions): Promise<FileBlob>;
20
+ toStreamAsync(): Promise<NodeJS.ReadableStream>;
20
21
  toStream(): NodeJS.ReadableStream;
21
22
  }
22
23
  export {};
package/dist/file-blob.js CHANGED
@@ -26,6 +26,9 @@ class FileBlob {
26
26
  const data = Buffer.concat(chunks);
27
27
  return new FileBlob({ mode, contentType, data });
28
28
  }
29
+ async toStreamAsync() {
30
+ return this.toStream();
31
+ }
29
32
  toStream() {
30
33
  return into_stream_1.default(this.data);
31
34
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { File } from './types';
2
+ import { FileBase } from './types';
3
3
  interface FileFsRefOptions {
4
4
  mode?: number;
5
5
  contentType?: string;
@@ -11,7 +11,7 @@ interface FromStreamOptions {
11
11
  stream: NodeJS.ReadableStream;
12
12
  fsPath: string;
13
13
  }
14
- declare class FileFsRef implements File {
14
+ declare class FileFsRef implements FileBase {
15
15
  type: 'FileFsRef';
16
16
  mode: number;
17
17
  fsPath: string;
@@ -1,12 +1,12 @@
1
1
  /// <reference types="node" />
2
- import { File } from './types';
2
+ import { FileBase } from './types';
3
3
  interface FileRefOptions {
4
4
  mode?: number;
5
5
  digest: string;
6
6
  contentType?: string;
7
7
  mutable?: boolean;
8
8
  }
9
- export default class FileRef implements File {
9
+ export default class FileRef implements FileBase {
10
10
  type: 'FileRef';
11
11
  mode: number;
12
12
  digest: string;
@@ -8,26 +8,38 @@ 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"));
10
10
  const fs_extra_1 = require("fs-extra");
11
+ const stream_to_buffer_1 = __importDefault(require("./stream-to-buffer"));
11
12
  const S_IFMT = 61440; /* 0170000 type of file */
12
13
  const S_IFLNK = 40960; /* 0120000 symbolic link */
13
14
  function isSymbolicLink(mode) {
14
15
  return (mode & S_IFMT) === S_IFLNK;
15
16
  }
16
17
  exports.isSymbolicLink = isSymbolicLink;
18
+ async function prepareSymlinkTarget(file, fsPath) {
19
+ const mkdirPromise = fs_extra_1.mkdirp(path_1.default.dirname(fsPath));
20
+ if (file.type === 'FileFsRef') {
21
+ const [target] = await Promise.all([fs_extra_1.readlink(file.fsPath), mkdirPromise]);
22
+ return target;
23
+ }
24
+ if (file.type === 'FileRef' || file.type === 'FileBlob') {
25
+ const targetPathBufferPromise = await stream_to_buffer_1.default(await file.toStreamAsync());
26
+ const [targetPathBuffer] = await Promise.all([
27
+ targetPathBufferPromise,
28
+ mkdirPromise,
29
+ ]);
30
+ return targetPathBuffer.toString('utf8');
31
+ }
32
+ throw new Error(`file.type "${file.type}" not supported for symlink`);
33
+ }
17
34
  async function downloadFile(file, fsPath) {
18
35
  const { mode } = file;
19
- if (mode && isSymbolicLink(mode) && file.type === 'FileFsRef') {
20
- const [target] = await Promise.all([
21
- fs_extra_1.readlink(file.fsPath),
22
- fs_extra_1.mkdirp(path_1.default.dirname(fsPath)),
23
- ]);
36
+ if (isSymbolicLink(mode)) {
37
+ const target = await prepareSymlinkTarget(file, fsPath);
24
38
  await fs_extra_1.symlink(target, fsPath);
25
39
  return file_fs_ref_1.default.fromFsPath({ mode, fsPath });
26
40
  }
27
- else {
28
- const stream = file.toStream();
29
- return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
30
- }
41
+ const stream = file.toStream();
42
+ return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
31
43
  }
32
44
  async function removeFile(basePath, fileMatched) {
33
45
  const file = path_1.default.join(basePath, fileMatched);
@@ -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
@@ -26617,6 +26617,7 @@ exports.frameworks = [
26617
26617
  slug: 'nextjs',
26618
26618
  demo: 'https://nextjs-template.vercel.app',
26619
26619
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/next.svg',
26620
+ screenshot: 'https://assets.vercel.com/image/upload/v1647366075/front/import/nextjs.png',
26620
26621
  tagline: 'Next.js makes you productive with React instantly — whether you want to build static or dynamic sites.',
26621
26622
  description: 'A Next.js app and a Serverless Function API.',
26622
26623
  website: 'https://nextjs.org',
@@ -27613,6 +27614,7 @@ exports.frameworks = [
27613
27614
  slug: 'sveltekit',
27614
27615
  demo: 'https://sveltekit-template.vercel.app',
27615
27616
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/svelte.svg',
27617
+ screenshot: 'https://assets.vercel.com/image/upload/v1647366075/front/import/sveltekit.png',
27616
27618
  tagline: 'SvelteKit is a framework for building web applications of all sizes.',
27617
27619
  description: 'A SvelteKit app optimized Edge-first.',
27618
27620
  website: 'https://kit.svelte.dev',
@@ -28122,6 +28124,7 @@ exports.frameworks = [
28122
28124
  slug: 'nuxtjs',
28123
28125
  demo: 'https://nuxtjs-template.vercel.app',
28124
28126
  logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/nuxt.svg',
28127
+ screenshot: 'https://assets.vercel.com/image/upload/v1647366075/front/import/nuxtjs.png',
28125
28128
  tagline: 'Nuxt.js is the web comprehensive framework that lets you dream big with Vue.js.',
28126
28129
  description: 'A Nuxt.js app, bootstrapped with create-nuxt-app.',
28127
28130
  website: 'https://nuxtjs.org',
@@ -33932,6 +33935,31 @@ class DetectorFilesystem {
33932
33935
  exports.DetectorFilesystem = DetectorFilesystem;
33933
33936
 
33934
33937
 
33938
+ /***/ }),
33939
+
33940
+ /***/ 8038:
33941
+ /***/ ((__unused_webpack_module, exports) => {
33942
+
33943
+ "use strict";
33944
+
33945
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33946
+ exports.EdgeFunction = void 0;
33947
+ /**
33948
+ * An Edge Functions output
33949
+ */
33950
+ class EdgeFunction {
33951
+ constructor(params) {
33952
+ this.type = 'EdgeFunction';
33953
+ this.name = params.name;
33954
+ this.deploymentTarget = params.deploymentTarget;
33955
+ this.entrypoint = params.entrypoint;
33956
+ this.files = params.files;
33957
+ this.envVarsInUse = params.envVarsInUse;
33958
+ }
33959
+ }
33960
+ exports.EdgeFunction = EdgeFunction;
33961
+
33962
+
33935
33963
  /***/ }),
33936
33964
 
33937
33965
  /***/ 3983:
@@ -34060,6 +34088,9 @@ class FileBlob {
34060
34088
  const data = Buffer.concat(chunks);
34061
34089
  return new FileBlob({ mode, contentType, data });
34062
34090
  }
34091
+ async toStreamAsync() {
34092
+ return this.toStream();
34093
+ }
34063
34094
  toStream() {
34064
34095
  return into_stream_1.default(this.data);
34065
34096
  }
@@ -34254,26 +34285,38 @@ const path_1 = __importDefault(__webpack_require__(5622));
34254
34285
  const debug_1 = __importDefault(__webpack_require__(1868));
34255
34286
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
34256
34287
  const fs_extra_1 = __webpack_require__(5392);
34288
+ const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
34257
34289
  const S_IFMT = 61440; /* 0170000 type of file */
34258
34290
  const S_IFLNK = 40960; /* 0120000 symbolic link */
34259
34291
  function isSymbolicLink(mode) {
34260
34292
  return (mode & S_IFMT) === S_IFLNK;
34261
34293
  }
34262
34294
  exports.isSymbolicLink = isSymbolicLink;
34295
+ async function prepareSymlinkTarget(file, fsPath) {
34296
+ const mkdirPromise = fs_extra_1.mkdirp(path_1.default.dirname(fsPath));
34297
+ if (file.type === 'FileFsRef') {
34298
+ const [target] = await Promise.all([fs_extra_1.readlink(file.fsPath), mkdirPromise]);
34299
+ return target;
34300
+ }
34301
+ if (file.type === 'FileRef' || file.type === 'FileBlob') {
34302
+ const targetPathBufferPromise = await stream_to_buffer_1.default(await file.toStreamAsync());
34303
+ const [targetPathBuffer] = await Promise.all([
34304
+ targetPathBufferPromise,
34305
+ mkdirPromise,
34306
+ ]);
34307
+ return targetPathBuffer.toString('utf8');
34308
+ }
34309
+ throw new Error(`file.type "${file.type}" not supported for symlink`);
34310
+ }
34263
34311
  async function downloadFile(file, fsPath) {
34264
34312
  const { mode } = file;
34265
- if (mode && isSymbolicLink(mode) && file.type === 'FileFsRef') {
34266
- const [target] = await Promise.all([
34267
- fs_extra_1.readlink(file.fsPath),
34268
- fs_extra_1.mkdirp(path_1.default.dirname(fsPath)),
34269
- ]);
34313
+ if (isSymbolicLink(mode)) {
34314
+ const target = await prepareSymlinkTarget(file, fsPath);
34270
34315
  await fs_extra_1.symlink(target, fsPath);
34271
34316
  return file_fs_ref_1.default.fromFsPath({ mode, fsPath });
34272
34317
  }
34273
- else {
34274
- const stream = file.toStream();
34275
- return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
34276
- }
34318
+ const stream = file.toStream();
34319
+ return file_fs_ref_1.default.fromStream({ mode, stream, fsPath });
34277
34320
  }
34278
34321
  async function removeFile(basePath, fileMatched) {
34279
34322
  const file = path_1.default.join(basePath, fileMatched);
@@ -34583,6 +34626,7 @@ const cross_spawn_1 = __importDefault(__webpack_require__(7618));
34583
34626
  const util_1 = __webpack_require__(1669);
34584
34627
  const errors_1 = __webpack_require__(3983);
34585
34628
  const node_version_1 = __webpack_require__(7903);
34629
+ const read_config_file_1 = __webpack_require__(7792);
34586
34630
  function spawnAsync(command, args, opts = {}) {
34587
34631
  return new Promise((resolve, reject) => {
34588
34632
  const stderrLogs = [];
@@ -34735,7 +34779,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
34735
34779
  packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
34736
34780
  }
34737
34781
  // eslint-disable-next-line no-await-in-loop
34738
- const [packageLockJson, hasYarnLock] = await Promise.all([
34782
+ const [packageLockJson, hasYarnLock, pnpmLockYaml] = await Promise.all([
34739
34783
  fs_extra_1.default
34740
34784
  .readJson(path_1.default.join(currentDestPath, 'package-lock.json'))
34741
34785
  .catch(error => {
@@ -34746,15 +34790,21 @@ async function scanParentDirs(destPath, readPackageJson = false) {
34746
34790
  throw error;
34747
34791
  }),
34748
34792
  fs_extra_1.default.pathExists(path_1.default.join(currentDestPath, 'yarn.lock')),
34793
+ read_config_file_1.readConfigFile(path_1.default.join(currentDestPath, 'pnpm-lock.yaml')),
34749
34794
  ]);
34750
- if (packageLockJson && !hasYarnLock) {
34795
+ if (packageLockJson && !hasYarnLock && !pnpmLockYaml) {
34751
34796
  cliType = 'npm';
34752
34797
  lockfileVersion = packageLockJson.lockfileVersion;
34753
34798
  }
34799
+ if (!packageLockJson && !hasYarnLock && pnpmLockYaml) {
34800
+ cliType = 'pnpm';
34801
+ // just ensure that it is read as a number and not a string
34802
+ lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
34803
+ }
34754
34804
  // Only stop iterating if a lockfile was found, because it's possible
34755
34805
  // that the lockfile is in a higher path than where the `package.json`
34756
34806
  // file was found.
34757
- if (packageLockJson || hasYarnLock) {
34807
+ if (packageLockJson || hasYarnLock || pnpmLockYaml) {
34758
34808
  break;
34759
34809
  }
34760
34810
  }
@@ -34805,6 +34855,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
34805
34855
  .filter(a => a !== '--prefer-offline')
34806
34856
  .concat(['install', '--no-audit', '--unsafe-perm']);
34807
34857
  }
34858
+ else if (cliType === 'pnpm') {
34859
+ // PNPM's install command is similar to NPM's but without the audit nonsense
34860
+ // @see options https://pnpm.io/cli/install
34861
+ opts.prettyCommand = 'pnpm install';
34862
+ commandArgs = args
34863
+ .filter(a => a !== '--prefer-offline')
34864
+ .concat(['install', '--unsafe-perm']);
34865
+ }
34808
34866
  else {
34809
34867
  opts.prettyCommand = 'yarn install';
34810
34868
  commandArgs = ['install', ...args];
@@ -34876,6 +34934,9 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
34876
34934
  if (cliType === 'npm') {
34877
34935
  opts.prettyCommand = `npm run ${scriptName}`;
34878
34936
  }
34937
+ else if (cliType === 'pnpm') {
34938
+ opts.prettyCommand = `pnpm run ${scriptName}`;
34939
+ }
34879
34940
  else {
34880
34941
  opts.prettyCommand = `yarn run ${scriptName}`;
34881
34942
  }
@@ -35094,7 +35155,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35094
35155
  return (mod && mod.__esModule) ? mod : { "default": mod };
35095
35156
  };
35096
35157
  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;
35158
+ 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
35159
  const file_blob_1 = __importDefault(__webpack_require__(2397));
35099
35160
  exports.FileBlob = file_blob_1.default;
35100
35161
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -35150,6 +35211,8 @@ const get_ignore_filter_1 = __importDefault(__webpack_require__(1148));
35150
35211
  exports.getIgnoreFilter = get_ignore_filter_1.default;
35151
35212
  const get_platform_env_1 = __webpack_require__(4678);
35152
35213
  Object.defineProperty(exports, "getPlatformEnv", ({ enumerable: true, get: function () { return get_platform_env_1.getPlatformEnv; } }));
35214
+ var edge_function_1 = __webpack_require__(8038);
35215
+ Object.defineProperty(exports, "EdgeFunction", ({ enumerable: true, get: function () { return edge_function_1.EdgeFunction; } }));
35153
35216
  var detect_builders_1 = __webpack_require__(4246);
35154
35217
  Object.defineProperty(exports, "detectBuilders", ({ enumerable: true, get: function () { return detect_builders_1.detectBuilders; } }));
35155
35218
  Object.defineProperty(exports, "detectOutputDirectory", ({ enumerable: true, get: function () { return detect_builders_1.detectOutputDirectory; } }));
@@ -35208,7 +35271,7 @@ const download_1 = __webpack_require__(1611);
35208
35271
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
35209
35272
  class Lambda {
35210
35273
  constructor(opts) {
35211
- const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, } = opts;
35274
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
35212
35275
  if ('files' in opts) {
35213
35276
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
35214
35277
  }
@@ -35228,6 +35291,9 @@ class Lambda {
35228
35291
  assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
35229
35292
  assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
35230
35293
  }
35294
+ if (supportsMultiPayloads !== undefined) {
35295
+ assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
35296
+ }
35231
35297
  if (regions !== undefined) {
35232
35298
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
35233
35299
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
@@ -35242,6 +35308,7 @@ class Lambda {
35242
35308
  this.allowQuery = allowQuery;
35243
35309
  this.regions = regions;
35244
35310
  this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
35311
+ this.supportsMultiPayloads = supportsMultiPayloads;
35245
35312
  }
35246
35313
  async createZip() {
35247
35314
  let { zipBuffer } = this;
package/dist/lambda.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Files, Config } from './types';
2
+ import type { Files, Config } from './types';
3
3
  interface Environment {
4
4
  [key: string]: string;
5
5
  }
@@ -12,6 +12,7 @@ export interface LambdaOptionsBase {
12
12
  environment?: Environment;
13
13
  allowQuery?: string[];
14
14
  regions?: string[];
15
+ supportsMultiPayloads?: boolean;
15
16
  }
16
17
  export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
17
18
  files: Files;
@@ -43,6 +44,7 @@ export declare class Lambda {
43
44
  * @deprecated Use `await lambda.createZip()` instead.
44
45
  */
45
46
  zipBuffer?: Buffer;
47
+ supportsMultiPayloads?: boolean;
46
48
  constructor(opts: LambdaOptions);
47
49
  createZip(): Promise<Buffer>;
48
50
  }
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, } = opts;
16
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, } = opts;
17
17
  if ('files' in opts) {
18
18
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
19
19
  }
@@ -33,6 +33,9 @@ class Lambda {
33
33
  assert_1.default(Array.isArray(allowQuery), '"allowQuery" is not an Array');
34
34
  assert_1.default(allowQuery.every(q => typeof q === 'string'), '"allowQuery" is not a string Array');
35
35
  }
36
+ if (supportsMultiPayloads !== undefined) {
37
+ assert_1.default(typeof supportsMultiPayloads === 'boolean', '"supportsMultiPayloads" is not a boolean');
38
+ }
36
39
  if (regions !== undefined) {
37
40
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
38
41
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
@@ -47,6 +50,7 @@ class Lambda {
47
50
  this.allowQuery = allowQuery;
48
51
  this.regions = regions;
49
52
  this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
53
+ this.supportsMultiPayloads = supportsMultiPayloads;
50
54
  }
51
55
  async createZip() {
52
56
  let { zipBuffer } = this;
@@ -1,11 +1,9 @@
1
- import FileBlob from './file-blob';
2
- import FileFsRef from './file-fs-ref';
3
- import FileRef from './file-ref';
1
+ import { File } from './types';
4
2
  import { Lambda } from './lambda';
5
3
  interface PrerenderOptions {
6
4
  expiration: number | false;
7
5
  lambda: Lambda;
8
- fallback: FileBlob | FileFsRef | FileRef | null;
6
+ fallback: File | null;
9
7
  group?: number;
10
8
  bypassToken?: string | null;
11
9
  allowQuery?: string[];
@@ -14,7 +12,7 @@ export declare class Prerender {
14
12
  type: 'Prerender';
15
13
  expiration: number | false;
16
14
  lambda: Lambda;
17
- fallback: FileBlob | FileFsRef | FileRef | null;
15
+ fallback: File | null;
18
16
  group?: number;
19
17
  bypassToken: string | null;
20
18
  allowQuery?: string[];
package/dist/types.d.ts CHANGED
@@ -1,21 +1,20 @@
1
1
  /// <reference types="node" />
2
- import FileRef from './file-ref';
3
- import FileFsRef from './file-fs-ref';
4
- import { Lambda } from './lambda';
5
- import { Prerender } from './prerender';
2
+ import type FileRef from './file-ref';
3
+ import type FileFsRef from './file-fs-ref';
4
+ import type FileBlob from './file-blob';
5
+ import type { Lambda } from './lambda';
6
+ import type { Prerender } from './prerender';
7
+ import type { EdgeFunction } from './edge-function';
6
8
  export interface Env {
7
9
  [name: string]: string | undefined;
8
10
  }
9
- export interface File {
11
+ export declare type File = FileRef | FileFsRef | FileBlob;
12
+ export interface FileBase {
10
13
  type: string;
11
14
  mode: number;
12
15
  contentType?: string;
13
16
  toStream: () => NodeJS.ReadableStream;
14
17
  toStreamAsync?: () => Promise<NodeJS.ReadableStream>;
15
- /**
16
- * The absolute path to the file in the filesystem
17
- */
18
- fsPath?: string;
19
18
  }
20
19
  export interface Files {
21
20
  [filePath: string]: File;
@@ -343,7 +342,7 @@ export interface BuildResultV2 {
343
342
  routes?: any[];
344
343
  images?: Images;
345
344
  output: {
346
- [key: string]: File | Lambda | Prerender;
345
+ [key: string]: FileBase | Lambda | Prerender | EdgeFunction;
347
346
  };
348
347
  wildcard?: Array<{
349
348
  domain: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "2.14.1-canary.2",
3
+ "version": "2.14.1-canary.5",
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.2",
33
+ "@vercel/frameworks": "0.6.1-canary.4",
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": "82ba9324471e7bf3f4426793c86694fdeb4530a4"
52
+ "gitHead": "b3ccb5f3ef354da577eeff6ce63d8ee51cfb3e17"
53
53
  }