@vercel/build-utils 2.14.0 → 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
- 1230kB dist/main/index.js
33
- 1258kB [8263ms] - 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',
@@ -28485,6 +28485,49 @@ exports.frameworks = [
28485
28485
  },
28486
28486
  ],
28487
28487
  },
28488
+ {
28489
+ name: 'Sanity',
28490
+ slug: 'sanity',
28491
+ demo: 'https://sanity-studio-template.vercel.app',
28492
+ logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/sanity.svg',
28493
+ tagline: 'The structured content platform.',
28494
+ description: 'A Sanity Studio',
28495
+ website: 'https://www.sanity.io',
28496
+ envPrefix: 'SANITY_STUDIO_',
28497
+ detectors: {
28498
+ every: [
28499
+ {
28500
+ path: 'sanity.json',
28501
+ },
28502
+ ],
28503
+ },
28504
+ settings: {
28505
+ installCommand: {
28506
+ placeholder: '`yarn install` or `npm install`',
28507
+ },
28508
+ buildCommand: {
28509
+ placeholder: '`npm run build` or `sanity build`',
28510
+ value: 'sanity build',
28511
+ },
28512
+ devCommand: {
28513
+ value: 'sanity start --port $PORT',
28514
+ },
28515
+ outputDirectory: {
28516
+ value: 'dist',
28517
+ },
28518
+ },
28519
+ dependency: '@sanity/cli',
28520
+ getOutputDirName: async () => 'dist',
28521
+ defaultRoutes: [
28522
+ {
28523
+ handle: 'filesystem',
28524
+ },
28525
+ {
28526
+ src: '/(.*)',
28527
+ dest: '/index.html',
28528
+ },
28529
+ ],
28530
+ },
28488
28531
  {
28489
28532
  name: 'Other',
28490
28533
  slug: null,
@@ -32770,12 +32813,12 @@ function detectApiDirectory(builders) {
32770
32813
  exports.detectApiDirectory = detectApiDirectory;
32771
32814
  // TODO: Replace this function with `config.outputDirectory`
32772
32815
  function getPublicBuilder(builders) {
32816
+ var _a;
32773
32817
  for (const builder of builders) {
32774
32818
  if (typeof builder.src === 'string' &&
32775
32819
  _1.isOfficialRuntime('static', builder.use) &&
32776
32820
  /^.*\/\*\*\/\*$/.test(builder.src) &&
32777
- builder.config &&
32778
- builder.config.zeroConfig === true) {
32821
+ ((_a = builder.config) === null || _a === void 0 ? void 0 : _a.zeroConfig) === true) {
32779
32822
  return builder;
32780
32823
  }
32781
32824
  }
@@ -35164,9 +35207,13 @@ const fs_extra_1 = __webpack_require__(5392);
35164
35207
  const download_1 = __webpack_require__(1611);
35165
35208
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
35166
35209
  class Lambda {
35167
- constructor({ files, handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, zipBuffer, }) {
35168
- if (!zipBuffer) {
35169
- 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');
35170
35217
  }
35171
35218
  assert_1.default(typeof handler === 'string', '"handler" is not a string');
35172
35219
  assert_1.default(typeof runtime === 'string', '"runtime" is not a string');
@@ -35186,7 +35233,7 @@ class Lambda {
35186
35233
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
35187
35234
  }
35188
35235
  this.type = 'Lambda';
35189
- this.files = files;
35236
+ this.files = 'files' in opts ? opts.files : undefined;
35190
35237
  this.handler = handler;
35191
35238
  this.runtime = runtime;
35192
35239
  this.memory = memory;
@@ -35194,11 +35241,14 @@ class Lambda {
35194
35241
  this.environment = environment;
35195
35242
  this.allowQuery = allowQuery;
35196
35243
  this.regions = regions;
35197
- this.zipBuffer = zipBuffer;
35244
+ this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
35198
35245
  }
35199
35246
  async createZip() {
35200
35247
  let { zipBuffer } = this;
35201
35248
  if (!zipBuffer) {
35249
+ if (!this.files) {
35250
+ throw new Error('`files` is not defined');
35251
+ }
35202
35252
  await sema.acquire();
35203
35253
  try {
35204
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.0",
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.0",
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": "99fa729966c4334aa2d64c592421cc65e1644bdb"
52
+ "gitHead": "82ba9324471e7bf3f4426793c86694fdeb4530a4"
53
53
  }