@vercel/build-utils 6.0.1 → 6.2.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.
- package/dist/edge-function.d.ts +3 -1
- package/dist/edge-function.js +1 -0
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +2 -2
- package/dist/index.js +14 -3
- package/dist/lambda.d.ts +4 -2
- package/dist/lambda.js +6 -1
- package/dist/schemas.d.ts +5 -0
- package/dist/schemas.js +5 -0
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
package/dist/edge-function.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Files } from './types';
|
1
|
+
import type { Cron, Files } from './types';
|
2
2
|
/**
|
3
3
|
* An Edge Functions output
|
4
4
|
*/
|
@@ -35,5 +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
40
|
constructor(params: Omit<EdgeFunction, 'type'>);
|
39
41
|
}
|
package/dist/edge-function.js
CHANGED
@@ -63,7 +63,7 @@ export declare function getNodeBinPath({ cwd, }: {
|
|
63
63
|
}): Promise<string>;
|
64
64
|
export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
|
65
65
|
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
|
66
|
-
export declare function getNodeVersion(destPath: string,
|
66
|
+
export declare function getNodeVersion(destPath: string, nodeVersionFallback?: string | undefined, config?: Config, meta?: Meta): Promise<NodeVersion>;
|
67
67
|
export declare function scanParentDirs(destPath: string, readPackageJson?: boolean): Promise<ScanParentDirsResult>;
|
68
68
|
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
|
69
69
|
export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, nodeVersion?: NodeVersion): Promise<boolean>;
|
@@ -113,14 +113,14 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
113
113
|
return opts;
|
114
114
|
}
|
115
115
|
exports.getSpawnOptions = getSpawnOptions;
|
116
|
-
async function getNodeVersion(destPath,
|
116
|
+
async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}) {
|
117
117
|
const latest = node_version_1.getLatestNodeVersion();
|
118
118
|
if (meta.isDev) {
|
119
119
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
120
120
|
return { ...latest, runtime: 'nodejs' };
|
121
121
|
}
|
122
122
|
const { packageJson } = await scanParentDirs(destPath, true);
|
123
|
-
let
|
123
|
+
let nodeVersion = config.nodeVersion || nodeVersionFallback;
|
124
124
|
let isAuto = true;
|
125
125
|
if (packageJson?.engines?.node) {
|
126
126
|
const { node } = packageJson.engines;
|
package/dist/index.js
CHANGED
@@ -30253,6 +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
30257
|
}
|
30257
30258
|
}
|
30258
30259
|
exports.EdgeFunction = EdgeFunction;
|
@@ -31093,14 +31094,14 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
31093
31094
|
return opts;
|
31094
31095
|
}
|
31095
31096
|
exports.getSpawnOptions = getSpawnOptions;
|
31096
|
-
async function getNodeVersion(destPath,
|
31097
|
+
async function getNodeVersion(destPath, nodeVersionFallback = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}) {
|
31097
31098
|
const latest = node_version_1.getLatestNodeVersion();
|
31098
31099
|
if (meta.isDev) {
|
31099
31100
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
31100
31101
|
return { ...latest, runtime: 'nodejs' };
|
31101
31102
|
}
|
31102
31103
|
const { packageJson } = await scanParentDirs(destPath, true);
|
31103
|
-
let
|
31104
|
+
let nodeVersion = config.nodeVersion || nodeVersionFallback;
|
31104
31105
|
let isAuto = true;
|
31105
31106
|
if (packageJson?.engines?.node) {
|
31106
31107
|
const { node } = packageJson.engines;
|
@@ -31730,7 +31731,7 @@ const download_1 = __webpack_require__(3166);
|
|
31730
31731
|
const stream_to_buffer_1 = __importDefault(__webpack_require__(9688));
|
31731
31732
|
class Lambda {
|
31732
31733
|
constructor(opts) {
|
31733
|
-
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
|
31734
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
|
31734
31735
|
if ('files' in opts) {
|
31735
31736
|
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
31736
31737
|
}
|
@@ -31760,6 +31761,9 @@ class Lambda {
|
|
31760
31761
|
assert_1.default(Array.isArray(regions), '"regions" is not an Array');
|
31761
31762
|
assert_1.default(regions.every(r => typeof r === 'string'), '"regions" is not a string Array');
|
31762
31763
|
}
|
31764
|
+
if (cron !== undefined) {
|
31765
|
+
assert_1.default(typeof cron === 'string', '"cron" is not a string');
|
31766
|
+
}
|
31763
31767
|
this.type = 'Lambda';
|
31764
31768
|
this.operationType = operationType;
|
31765
31769
|
this.files = 'files' in opts ? opts.files : undefined;
|
@@ -31770,6 +31774,7 @@ class Lambda {
|
|
31770
31774
|
this.environment = environment;
|
31771
31775
|
this.allowQuery = allowQuery;
|
31772
31776
|
this.regions = regions;
|
31777
|
+
this.cron = cron;
|
31773
31778
|
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
31774
31779
|
this.supportsMultiPayloads = supportsMultiPayloads;
|
31775
31780
|
this.supportsWrapper = supportsWrapper;
|
@@ -31846,6 +31851,7 @@ async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
|
31846
31851
|
return {
|
31847
31852
|
memory: fn.memory,
|
31848
31853
|
maxDuration: fn.maxDuration,
|
31854
|
+
cron: fn.cron,
|
31849
31855
|
};
|
31850
31856
|
}
|
31851
31857
|
}
|
@@ -31987,6 +31993,11 @@ exports.functionsSchema = {
|
|
31987
31993
|
type: 'string',
|
31988
31994
|
maxLength: 256,
|
31989
31995
|
},
|
31996
|
+
cron: {
|
31997
|
+
type: 'string',
|
31998
|
+
minLength: 9,
|
31999
|
+
maxLength: 256,
|
32000
|
+
},
|
31990
32001
|
},
|
31991
32002
|
},
|
31992
32003
|
},
|
package/dist/lambda.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import type { Files, Config } from './types';
|
2
|
+
import type { Files, Config, Cron } from './types';
|
3
3
|
interface Environment {
|
4
4
|
[key: string]: string;
|
5
5
|
}
|
@@ -16,6 +16,7 @@ export interface LambdaOptionsBase {
|
|
16
16
|
supportsWrapper?: boolean;
|
17
17
|
experimentalResponseStreaming?: boolean;
|
18
18
|
operationType?: string;
|
19
|
+
cron?: Cron;
|
19
20
|
}
|
20
21
|
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
|
21
22
|
files: Files;
|
@@ -49,6 +50,7 @@ export declare class Lambda {
|
|
49
50
|
environment: Environment;
|
50
51
|
allowQuery?: string[];
|
51
52
|
regions?: string[];
|
53
|
+
cron?: Cron;
|
52
54
|
/**
|
53
55
|
* @deprecated Use `await lambda.createZip()` instead.
|
54
56
|
*/
|
@@ -64,5 +66,5 @@ export declare class Lambda {
|
|
64
66
|
*/
|
65
67
|
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
|
66
68
|
export declare function createZip(files: Files): Promise<Buffer>;
|
67
|
-
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration'>>;
|
69
|
+
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'memory' | 'maxDuration' | 'cron'>>;
|
68
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, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
|
16
|
+
const { handler, runtime, maxDuration, memory, environment = {}, allowQuery, regions, cron, supportsMultiPayloads, supportsWrapper, experimentalResponseStreaming, operationType, } = opts;
|
17
17
|
if ('files' in opts) {
|
18
18
|
assert_1.default(typeof opts.files === 'object', '"files" must be an object');
|
19
19
|
}
|
@@ -43,6 +43,9 @@ 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');
|
48
|
+
}
|
46
49
|
this.type = 'Lambda';
|
47
50
|
this.operationType = operationType;
|
48
51
|
this.files = 'files' in opts ? opts.files : undefined;
|
@@ -53,6 +56,7 @@ class Lambda {
|
|
53
56
|
this.environment = environment;
|
54
57
|
this.allowQuery = allowQuery;
|
55
58
|
this.regions = regions;
|
59
|
+
this.cron = cron;
|
56
60
|
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
|
57
61
|
this.supportsMultiPayloads = supportsMultiPayloads;
|
58
62
|
this.supportsWrapper = supportsWrapper;
|
@@ -129,6 +133,7 @@ async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
|
129
133
|
return {
|
130
134
|
memory: fn.memory,
|
131
135
|
maxDuration: fn.maxDuration,
|
136
|
+
cron: fn.cron,
|
132
137
|
};
|
133
138
|
}
|
134
139
|
}
|
package/dist/schemas.d.ts
CHANGED
package/dist/schemas.js
CHANGED
package/dist/types.d.ts
CHANGED
@@ -282,6 +282,7 @@ export interface BuilderFunctions {
|
|
282
282
|
runtime?: string;
|
283
283
|
includeFiles?: string;
|
284
284
|
excludeFiles?: string;
|
285
|
+
cron?: Cron;
|
285
286
|
};
|
286
287
|
}
|
287
288
|
export interface ProjectSettings {
|
@@ -362,6 +363,7 @@ export interface BuildResultBuildOutput {
|
|
362
363
|
*/
|
363
364
|
buildOutputPath: string;
|
364
365
|
}
|
366
|
+
export declare type Cron = string;
|
365
367
|
/**
|
366
368
|
* When a Builder implements `version: 2`, the `build()` function is expected
|
367
369
|
* to return this type.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "6.0
|
3
|
+
"version": "6.2.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": "
|
54
|
+
"gitHead": "a585969dd3b77a4ed36d6a2ca11b34f9050489f1"
|
55
55
|
}
|