@vercel/build-utils 6.2.2 → 6.2.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.
@@ -1,4 +1,4 @@
1
- import type { Cron, Files } from './types';
1
+ import type { Cron, Files, FunctionFramework } from './types';
2
2
  /**
3
3
  * An Edge Functions output
4
4
  */
@@ -37,5 +37,7 @@ export declare class EdgeFunction {
37
37
  regions?: string | string[];
38
38
  /** Cronjob definition for the edge function */
39
39
  cron?: Cron;
40
+ /** The framework */
41
+ framework?: FunctionFramework;
40
42
  constructor(params: Omit<EdgeFunction, 'type'>);
41
43
  }
@@ -15,6 +15,7 @@ class EdgeFunction {
15
15
  this.assets = params.assets;
16
16
  this.regions = params.regions;
17
17
  this.cron = params.cron;
18
+ this.framework = params.framework;
18
19
  }
19
20
  }
20
21
  exports.EdgeFunction = EdgeFunction;
package/dist/errors.js CHANGED
@@ -17,7 +17,7 @@ class NowBuildError extends Error {
17
17
  }
18
18
  exports.NowBuildError = NowBuildError;
19
19
  function getPrettyError(obj) {
20
- const docsUrl = 'https://vercel.com/docs/configuration';
20
+ const docsUrl = 'https://vercel.com/docs/concepts/projects/project-configuration';
21
21
  try {
22
22
  const { dataPath, params, message: ajvMessage } = obj;
23
23
  const prop = getTopLevelPropertyName(dataPath);
@@ -35,7 +35,7 @@ function getPrettyError(obj) {
35
35
  return new NowBuildError({
36
36
  code: 'INVALID_VERCEL_CONFIG',
37
37
  message: message,
38
- link: prop ? `${docsUrl}#project/${prop.toLowerCase()}` : docsUrl,
38
+ link: prop ? `${docsUrl}#${prop.toLowerCase()}` : docsUrl,
39
39
  action: 'View Documentation',
40
40
  });
41
41
  }
package/dist/index.js CHANGED
@@ -30254,6 +30254,7 @@ class EdgeFunction {
30254
30254
  this.assets = params.assets;
30255
30255
  this.regions = params.regions;
30256
30256
  this.cron = params.cron;
30257
+ this.framework = params.framework;
30257
30258
  }
30258
30259
  }
30259
30260
  exports.EdgeFunction = EdgeFunction;
@@ -30284,7 +30285,7 @@ class NowBuildError extends Error {
30284
30285
  }
30285
30286
  exports.NowBuildError = NowBuildError;
30286
30287
  function getPrettyError(obj) {
30287
- const docsUrl = 'https://vercel.com/docs/configuration';
30288
+ const docsUrl = 'https://vercel.com/docs/concepts/projects/project-configuration';
30288
30289
  try {
30289
30290
  const { dataPath, params, message: ajvMessage } = obj;
30290
30291
  const prop = getTopLevelPropertyName(dataPath);
@@ -30302,7 +30303,7 @@ function getPrettyError(obj) {
30302
30303
  return new NowBuildError({
30303
30304
  code: 'INVALID_VERCEL_CONFIG',
30304
30305
  message: message,
30305
- link: prop ? `${docsUrl}#project/${prop.toLowerCase()}` : docsUrl,
30306
+ link: prop ? `${docsUrl}#${prop.toLowerCase()}` : docsUrl,
30306
30307
  action: 'View Documentation',
30307
30308
  });
30308
30309
  }
@@ -31742,7 +31743,7 @@ const download_1 = __webpack_require__(3166);
31742
31743
  const stream_to_buffer_1 = __importDefault(__webpack_require__(9688));
31743
31744
  class Lambda {
31744
31745
  constructor(opts) {
31745
- const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
31746
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, framework, } = opts;
31746
31747
  if ('files' in opts) {
31747
31748
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
31748
31749
  }
@@ -31775,6 +31776,13 @@ class Lambda {
31775
31776
  if (cron !== undefined) {
31776
31777
  assert_1.default(typeof cron === 'string', '"cron" is not a string');
31777
31778
  }
31779
+ if (framework !== undefined) {
31780
+ assert_1.default(typeof framework === 'object', '"framework" is not an object');
31781
+ assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string');
31782
+ if (framework.version !== undefined) {
31783
+ assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string');
31784
+ }
31785
+ }
31778
31786
  this.type = 'Lambda';
31779
31787
  this.operationType = operationType;
31780
31788
  this.files = 'files' in opts ? opts.files : undefined;
@@ -31790,6 +31798,7 @@ class Lambda {
31790
31798
  this.supportsMultiPayloads = supportsMultiPayloads;
31791
31799
  this.supportsWrapper = supportsWrapper;
31792
31800
  this.experimentalResponseStreaming = experimentalResponseStreaming;
31801
+ this.framework = framework;
31793
31802
  }
31794
31803
  async createZip() {
31795
31804
  let { zipBuffer } = this;
@@ -31993,10 +32002,8 @@ exports.functionsSchema = {
31993
32002
  maxLength: 256,
31994
32003
  },
31995
32004
  memory: {
31996
- // Number between 128 and 3008 in steps of 64
31997
- enum: Object.keys(Array.from({ length: 50 }))
31998
- .slice(2, 48)
31999
- .map(x => Number(x) * 64),
32005
+ minimum: 128,
32006
+ maximum: 3008,
32000
32007
  },
32001
32008
  maxDuration: {
32002
32009
  type: 'number',
package/dist/lambda.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type { Files, Config, Cron } from './types';
2
+ import type { Files, Config, Cron, FunctionFramework } from './types';
3
3
  interface Environment {
4
4
  [key: string]: string;
5
5
  }
@@ -17,6 +17,7 @@ export interface LambdaOptionsBase {
17
17
  experimentalResponseStreaming?: boolean;
18
18
  operationType?: string;
19
19
  cron?: Cron;
20
+ framework?: FunctionFramework;
20
21
  }
21
22
  export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
22
23
  files: Files;
@@ -58,6 +59,7 @@ export declare class Lambda {
58
59
  supportsMultiPayloads?: boolean;
59
60
  supportsWrapper?: boolean;
60
61
  experimentalResponseStreaming?: boolean;
62
+ framework?: FunctionFramework;
61
63
  constructor(opts: LambdaOptions);
62
64
  createZip(): Promise<Buffer>;
63
65
  }
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, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
16
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, framework, } = opts;
17
17
  if ('files' in opts) {
18
18
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
19
19
  }
@@ -46,6 +46,13 @@ class Lambda {
46
46
  if (cron !== undefined) {
47
47
  assert_1.default(typeof cron === 'string', '"cron" is not a string');
48
48
  }
49
+ if (framework !== undefined) {
50
+ assert_1.default(typeof framework === 'object', '"framework" is not an object');
51
+ assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string');
52
+ if (framework.version !== undefined) {
53
+ assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string');
54
+ }
55
+ }
49
56
  this.type = 'Lambda';
50
57
  this.operationType = operationType;
51
58
  this.files = 'files' in opts ? opts.files : undefined;
@@ -61,6 +68,7 @@ class Lambda {
61
68
  this.supportsMultiPayloads = supportsMultiPayloads;
62
69
  this.supportsWrapper = supportsWrapper;
63
70
  this.experimentalResponseStreaming = experimentalResponseStreaming;
71
+ this.framework = framework;
64
72
  }
65
73
  async createZip() {
66
74
  let { zipBuffer } = this;
package/dist/schemas.d.ts CHANGED
@@ -13,7 +13,8 @@ export declare const functionsSchema: {
13
13
  maxLength: number;
14
14
  };
15
15
  memory: {
16
- enum: number[];
16
+ minimum: number;
17
+ maximum: number;
17
18
  };
18
19
  maxDuration: {
19
20
  type: string;
package/dist/schemas.js CHANGED
@@ -16,10 +16,8 @@ exports.functionsSchema = {
16
16
  maxLength: 256,
17
17
  },
18
18
  memory: {
19
- // Number between 128 and 3008 in steps of 64
20
- enum: Object.keys(Array.from({ length: 50 }))
21
- .slice(2, 48)
22
- .map(x => Number(x) * 64),
19
+ minimum: 128,
20
+ maximum: 3008,
23
21
  },
24
22
  maxDuration: {
25
23
  type: 'number',
package/dist/types.d.ts CHANGED
@@ -364,6 +364,11 @@ export interface BuildResultBuildOutput {
364
364
  buildOutputPath: string;
365
365
  }
366
366
  export declare type Cron = string;
367
+ /** The framework which created the function */
368
+ export interface FunctionFramework {
369
+ slug: string;
370
+ version?: string;
371
+ }
367
372
  /**
368
373
  * When a Builder implements `version: 2`, the `build()` function is expected
369
374
  * to return this type.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -14,7 +14,7 @@
14
14
  "build": "node build",
15
15
  "test": "jest --env node --verbose --runInBand --bail",
16
16
  "test-unit": "pnpm test test/unit.*test.*",
17
- "test-integration-once": "pnpm test test/integration.test.ts"
17
+ "test-e2e": "pnpm test test/integration.test.ts"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@iarna/toml": "2.2.3",
@@ -51,5 +51,5 @@
51
51
  "typescript": "4.3.4",
52
52
  "yazl": "2.5.1"
53
53
  },
54
- "gitHead": "95a4dcfb33d813f1a0ef18d766232d42c876ce69"
54
+ "gitHead": "9308a0fda5e14ee8a07b9a3506e4480f5f67d212"
55
55
  }