@vercel/build-utils 6.2.3 → 6.3.0

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 { Files, FunctionFramework } from './types';
2
2
  /**
3
3
  * An Edge Functions output
4
4
  */
@@ -35,7 +35,7 @@ export declare class EdgeFunction {
35
35
  }[];
36
36
  /** The regions where the edge function will be executed on */
37
37
  regions?: string | string[];
38
- /** Cronjob definition for the edge function */
39
- cron?: Cron;
38
+ /** The framework */
39
+ framework?: FunctionFramework;
40
40
  constructor(params: Omit<EdgeFunction, 'type'>);
41
41
  }
@@ -14,7 +14,7 @@ class EdgeFunction {
14
14
  this.envVarsInUse = params.envVarsInUse;
15
15
  this.assets = params.assets;
16
16
  this.regions = params.regions;
17
- this.cron = params.cron;
17
+ this.framework = params.framework;
18
18
  }
19
19
  }
20
20
  exports.EdgeFunction = EdgeFunction;
package/dist/index.js CHANGED
@@ -30253,7 +30253,7 @@ class EdgeFunction {
30253
30253
  this.envVarsInUse = params.envVarsInUse;
30254
30254
  this.assets = params.assets;
30255
30255
  this.regions = params.regions;
30256
- this.cron = params.cron;
30256
+ this.framework = params.framework;
30257
30257
  }
30258
30258
  }
30259
30259
  exports.EdgeFunction = EdgeFunction;
@@ -31742,7 +31742,7 @@ const download_1 = __webpack_require__(3166);
31742
31742
  const stream_to_buffer_1 = __importDefault(__webpack_require__(9688));
31743
31743
  class Lambda {
31744
31744
  constructor(opts) {
31745
- const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
31745
+ const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, framework, } = opts;
31746
31746
  if ('files' in opts) {
31747
31747
  assert_1.default(typeof opts.files === 'object', '"files" must be an object');
31748
31748
  }
@@ -31772,8 +31772,12 @@ class Lambda {
31772
31772
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
31773
31773
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
31774
31774
  }
31775
- if (cron !== undefined) {
31776
- assert_1.default(typeof cron === 'string', '"cron" is not a string');
31775
+ if (framework !== undefined) {
31776
+ assert_1.default(typeof framework === 'object', '"framework" is not an object');
31777
+ assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string');
31778
+ if (framework.version !== undefined) {
31779
+ assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string');
31780
+ }
31777
31781
  }
31778
31782
  this.type = 'Lambda';
31779
31783
  this.operationType = operationType;
@@ -31785,11 +31789,11 @@ class Lambda {
31785
31789
  this.environment = environment;
31786
31790
  this.allowQuery = allowQuery;
31787
31791
  this.regions = regions;
31788
- this.cron = cron;
31789
31792
  this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
31790
31793
  this.supportsMultiPayloads = supportsMultiPayloads;
31791
31794
  this.supportsWrapper = supportsWrapper;
31792
31795
  this.experimentalResponseStreaming = experimentalResponseStreaming;
31796
+ this.framework = framework;
31793
31797
  }
31794
31798
  async createZip() {
31795
31799
  let { zipBuffer } = this;
@@ -31862,7 +31866,6 @@ async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
31862
31866
  return {
31863
31867
  memory: fn.memory,
31864
31868
  maxDuration: fn.maxDuration,
31865
- cron: fn.cron,
31866
31869
  };
31867
31870
  }
31868
31871
  }
@@ -32009,11 +32012,6 @@ exports.functionsSchema = {
32009
32012
  type: 'string',
32010
32013
  maxLength: 256,
32011
32014
  },
32012
- cron: {
32013
- type: 'string',
32014
- minLength: 9,
32015
- maxLength: 256,
32016
- },
32017
32015
  },
32018
32016
  },
32019
32017
  },
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, FunctionFramework } from './types';
3
3
  interface Environment {
4
4
  [key: string]: string;
5
5
  }
@@ -16,7 +16,7 @@ export interface LambdaOptionsBase {
16
16
  supportsWrapper?: boolean;
17
17
  experimentalResponseStreaming?: boolean;
18
18
  operationType?: string;
19
- cron?: Cron;
19
+ framework?: FunctionFramework;
20
20
  }
21
21
  export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
22
22
  files: Files;
@@ -50,7 +50,6 @@ export declare class Lambda {
50
50
  environment: Environment;
51
51
  allowQuery?: string[];
52
52
  regions?: string[];
53
- cron?: Cron;
54
53
  /**
55
54
  * @deprecated Use `await lambda.createZip()` instead.
56
55
  */
@@ -58,6 +57,7 @@ export declare class Lambda {
58
57
  supportsMultiPayloads?: boolean;
59
58
  supportsWrapper?: boolean;
60
59
  experimentalResponseStreaming?: boolean;
60
+ framework?: FunctionFramework;
61
61
  constructor(opts: LambdaOptions);
62
62
  createZip(): Promise<Buffer>;
63
63
  }
@@ -66,5 +66,5 @@ export declare class Lambda {
66
66
  */
67
67
  export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
68
68
  export declare function createZip(files: Files): Promise<Buffer>;
69
- export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration' | 'cron'>>;
69
+ export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration'>>;
70
70
  export {};
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, 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
  }
@@ -43,8 +43,12 @@ class Lambda {
43
43
  assert_1.default(Array.isArray(regions), '"regions" is not an Array');
44
44
  assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
45
45
  }
46
- if (cron !== undefined) {
47
- assert_1.default(typeof cron === 'string', '"cron" is not a string');
46
+ if (framework !== undefined) {
47
+ assert_1.default(typeof framework === 'object', '"framework" is not an object');
48
+ assert_1.default(typeof framework.slug === 'string', '"framework.slug" is not a string');
49
+ if (framework.version !== undefined) {
50
+ assert_1.default(typeof framework.version === 'string', '"framework.version" is not a string');
51
+ }
48
52
  }
49
53
  this.type = 'Lambda';
50
54
  this.operationType = operationType;
@@ -56,11 +60,11 @@ class Lambda {
56
60
  this.environment = environment;
57
61
  this.allowQuery = allowQuery;
58
62
  this.regions = regions;
59
- this.cron = cron;
60
63
  this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
61
64
  this.supportsMultiPayloads = supportsMultiPayloads;
62
65
  this.supportsWrapper = supportsWrapper;
63
66
  this.experimentalResponseStreaming = experimentalResponseStreaming;
67
+ this.framework = framework;
64
68
  }
65
69
  async createZip() {
66
70
  let { zipBuffer } = this;
@@ -133,7 +137,6 @@ async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
133
137
  return {
134
138
  memory: fn.memory,
135
139
  maxDuration: fn.maxDuration,
136
- cron: fn.cron,
137
140
  };
138
141
  }
139
142
  }
package/dist/schemas.d.ts CHANGED
@@ -29,11 +29,6 @@ export declare const functionsSchema: {
29
29
  type: string;
30
30
  maxLength: number;
31
31
  };
32
- cron: {
33
- type: string;
34
- minLength: number;
35
- maxLength: number;
36
- };
37
32
  };
38
33
  };
39
34
  };
package/dist/schemas.js CHANGED
@@ -32,11 +32,6 @@ exports.functionsSchema = {
32
32
  type: 'string',
33
33
  maxLength: 256,
34
34
  },
35
- cron: {
36
- type: 'string',
37
- minLength: 9,
38
- maxLength: 256,
39
- },
40
35
  },
41
36
  },
42
37
  },
package/dist/types.d.ts CHANGED
@@ -282,7 +282,6 @@ export interface BuilderFunctions {
282
282
  runtime?: string;
283
283
  includeFiles?: string;
284
284
  excludeFiles?: string;
285
- cron?: Cron;
286
285
  };
287
286
  }
288
287
  export interface ProjectSettings {
@@ -363,7 +362,15 @@ export interface BuildResultBuildOutput {
363
362
  */
364
363
  buildOutputPath: string;
365
364
  }
366
- export declare type Cron = string;
365
+ export interface Cron {
366
+ path: string;
367
+ schedule: string;
368
+ }
369
+ /** The framework which created the function */
370
+ export interface FunctionFramework {
371
+ slug: string;
372
+ version?: string;
373
+ }
367
374
  /**
368
375
  * When a Builder implements `version: 2`, the `build()` function is expected
369
376
  * to return this type.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "6.2.3",
3
+ "version": "6.3.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -51,5 +51,5 @@
51
51
  "typescript": "4.3.4",
52
52
  "yazl": "2.5.1"
53
53
  },
54
- "gitHead": "881e43a0e2d6daa2f7654ad16566960b00d412aa"
54
+ "gitHead": "3d98d1cdea151b7125deb082c2c8469c865027d0"
55
55
  }