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

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,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
- 1231kB dist/main/index.js
33
- 1259kB [9313ms] - ncc 0.24.0
32
+ 1232kB dist/main/index.js
33
+ 1261kB [7389ms] - 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
  }
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
  }
@@ -35207,9 +35207,13 @@ const fs_extra_1 = __webpack_require__(5392);
35207
35207
  const download_1 = __webpack_require__(1611);
35208
35208
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
35209
35209
  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');
35210
+ constructor(opts) {
35211
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, } = opts;
35212
+ if ('files' in opts) {
35213
+ assert_1.default(typeof opts.files === 'object', '"files" must be an object');
35214
+ }
35215
+ if ('zipBuffer' in opts) {
35216
+ assert_1.default(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
35213
35217
  }
35214
35218
  assert_1.default(typeof handler === 'string', '"handler" is not a string');
35215
35219
  assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
@@ -35229,7 +35233,7 @@ class Lambda {
35229
35233
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
35230
35234
  }
35231
35235
  this.type = 'Lambda';
35232
- this.files = files;
35236
+ this.files = 'files' in opts ? opts.files : undefined;
35233
35237
  this.handler = handler;
35234
35238
  this.runtime = runtime;
35235
35239
  this.memory = memory;
@@ -35237,11 +35241,14 @@ class Lambda {
35237
35241
  this.environment = environment;
35238
35242
  this.allowQuery = allowQuery;
35239
35243
  this.regions = regions;
35240
- this.zipBuffer = zipBuffer;
35244
+ this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
35241
35245
  }
35242
35246
  async createZip() {
35243
35247
  let { zipBuffer } = this;
35244
35248
  if (!zipBuffer) {
35249
+ if (!this.files) {
35250
+ throw new Error('`files` is not defined');
35251
+ }
35245
35252
  await sema.acquire();
35246
35253
  try {
35247
35254
  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,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?: Buffer;
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: 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({ files, handler, runtime, maxDuration, memory, environment, allowQuery, regions, zipBuffer, }: LambdaOptions);
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({ 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, } = 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);
@@ -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
@@ -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: any[];
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.1",
3
+ "version": "2.14.1-canary.2",
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.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": "0351f02dff357a396f581e11dd06a72619dbcfb1"
52
+ "gitHead": "82ba9324471e7bf3f4426793c86694fdeb4530a4"
53
53
  }