@vercel/build-utils 13.14.2 → 13.15.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/CHANGELOG.md +10 -0
- package/dist/deserialize/create-functions-iterator.d.ts +8 -0
- package/dist/deserialize/create-functions-iterator.js +52 -0
- package/dist/deserialize/hydrate-files-map.d.ts +3 -0
- package/dist/deserialize/hydrate-files-map.js +55 -0
- package/dist/deserialize/maybe-read-json.d.ts +5 -0
- package/dist/deserialize/maybe-read-json.js +37 -0
- package/dist/deserialize/validate-framework-version.d.ts +5 -0
- package/dist/deserialize/validate-framework-version.js +53 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +182 -90
- package/dist/lambda.js +5 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [services] allow multiple v2beta triggers for a single Lambda when config is coming from services ([#15890](https://github.com/vercel/vercel/pull/15890))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Add deserialization utilities ([#15927](https://github.com/vercel/vercel/pull/15927))
|
|
12
|
+
|
|
3
13
|
## 13.14.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an async iterator that scans a directory for sub-directories
|
|
3
|
+
* that end with the suffix `.func`.
|
|
4
|
+
*
|
|
5
|
+
* @param dir Absolute path to scan for `.func` directories
|
|
6
|
+
* @param root The root directory from where the scanning started
|
|
7
|
+
*/
|
|
8
|
+
export declare function createFunctionsIterator(dir: string, root?: string): AsyncIterable<string>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var create_functions_iterator_exports = {};
|
|
20
|
+
__export(create_functions_iterator_exports, {
|
|
21
|
+
createFunctionsIterator: () => createFunctionsIterator
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(create_functions_iterator_exports);
|
|
24
|
+
var import_path = require("path");
|
|
25
|
+
var import_fs_extra = require("fs-extra");
|
|
26
|
+
const SUFFIX = ".func";
|
|
27
|
+
async function* createFunctionsIterator(dir, root = dir) {
|
|
28
|
+
let paths;
|
|
29
|
+
try {
|
|
30
|
+
paths = await (0, import_fs_extra.readdir)(dir);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
if (err.code !== "ENOENT" && err.code !== "ENOTDIR") {
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
paths = [];
|
|
36
|
+
}
|
|
37
|
+
for (const path of paths) {
|
|
38
|
+
const abs = (0, import_path.join)(dir, path);
|
|
39
|
+
const s = await (0, import_fs_extra.stat)(abs);
|
|
40
|
+
if (s.isDirectory()) {
|
|
41
|
+
if (path.endsWith(SUFFIX)) {
|
|
42
|
+
yield (0, import_path.relative)(root, abs.substring(0, abs.length - SUFFIX.length));
|
|
43
|
+
} else {
|
|
44
|
+
yield* createFunctionsIterator(abs, root);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
createFunctionsIterator
|
|
52
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var hydrate_files_map_exports = {};
|
|
30
|
+
__export(hydrate_files_map_exports, {
|
|
31
|
+
hydrateFilesMap: () => hydrateFilesMap
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(hydrate_files_map_exports);
|
|
34
|
+
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
|
|
35
|
+
var import_path = require("path");
|
|
36
|
+
async function hydrateFilesMap(files, filesMap, repoRootPath, fileFsRefsCache) {
|
|
37
|
+
for (const [funcPath, projectPath] of Object.entries(filesMap)) {
|
|
38
|
+
files[funcPath] = await fileFsRefCached(
|
|
39
|
+
(0, import_path.join)(repoRootPath, projectPath),
|
|
40
|
+
fileFsRefsCache
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function fileFsRefCached(fsPath, cache) {
|
|
45
|
+
let file = cache.get(fsPath);
|
|
46
|
+
if (!file) {
|
|
47
|
+
file = await import_file_fs_ref.default.fromFsPath({ fsPath });
|
|
48
|
+
cache.set(fsPath, file);
|
|
49
|
+
}
|
|
50
|
+
return file;
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
hydrateFilesMap
|
|
55
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var maybe_read_json_exports = {};
|
|
20
|
+
__export(maybe_read_json_exports, {
|
|
21
|
+
maybeReadJSON: () => maybeReadJSON
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(maybe_read_json_exports);
|
|
24
|
+
var import_fs_extra = require("fs-extra");
|
|
25
|
+
async function maybeReadJSON(path) {
|
|
26
|
+
try {
|
|
27
|
+
return await (0, import_fs_extra.readJSON)(path);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
if (err.code !== "ENOENT")
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
maybeReadJSON
|
|
37
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var validate_framework_version_exports = {};
|
|
20
|
+
__export(validate_framework_version_exports, {
|
|
21
|
+
validateFrameworkVersion: () => validateFrameworkVersion
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(validate_framework_version_exports);
|
|
24
|
+
var import_errors = require("../errors");
|
|
25
|
+
const MAX_FRAMEWORK_VERSION_LENGTH = 50;
|
|
26
|
+
function validateFrameworkVersion(frameworkVersion) {
|
|
27
|
+
if (!frameworkVersion) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
if (typeof frameworkVersion !== "string") {
|
|
31
|
+
throw new import_errors.NowBuildError({
|
|
32
|
+
message: `Invalid config.json: "framework.version" type "${typeof frameworkVersion}" should be "string"`,
|
|
33
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_TYPE"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (frameworkVersion.length > MAX_FRAMEWORK_VERSION_LENGTH) {
|
|
37
|
+
const trimmedFrameworkVersion = frameworkVersion.slice(
|
|
38
|
+
0,
|
|
39
|
+
MAX_FRAMEWORK_VERSION_LENGTH
|
|
40
|
+
);
|
|
41
|
+
throw new import_errors.NowBuildError({
|
|
42
|
+
message: `Invalid config.json: "framework.version" length ${frameworkVersion.length} > ${MAX_FRAMEWORK_VERSION_LENGTH}. "${trimmedFrameworkVersion}..."`,
|
|
43
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_LENGTH"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
version: frameworkVersion
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
validateFrameworkVersion
|
|
53
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -50,3 +50,7 @@ export { streamWithExtendedPayload, type ExtendedBodyData, } from './collect-bui
|
|
|
50
50
|
export { collectUncompressedSize } from './collect-uncompressed-size';
|
|
51
51
|
export { finalizeLambda, type CreateZipResult, type CreateZipFn, type FinalizeLambdaParams, type FinalizeLambdaResult, type TraceFn, } from './finalize-lambda';
|
|
52
52
|
export { validateLambdaSize, validateUncompressedLambdaSize, FunctionSizeError, MAX_LAMBDA_SIZE, MAX_LAMBDA_UNCOMPRESSED_SIZE, validateEnvWrapperSupport, ENV_WRAPPER_SUPPORTED_FAMILIES, } from './validate-lambda-size';
|
|
53
|
+
export { validateFrameworkVersion } from './deserialize/validate-framework-version';
|
|
54
|
+
export { hydrateFilesMap } from './deserialize/hydrate-files-map';
|
|
55
|
+
export { createFunctionsIterator } from './deserialize/create-functions-iterator';
|
|
56
|
+
export { maybeReadJSON } from './deserialize/maybe-read-json';
|
package/dist/index.js
CHANGED
|
@@ -341,7 +341,7 @@ var require_BufferList = __commonJS({
|
|
|
341
341
|
this.head = this.tail = null;
|
|
342
342
|
this.length = 0;
|
|
343
343
|
};
|
|
344
|
-
BufferList.prototype.join = function
|
|
344
|
+
BufferList.prototype.join = function join7(s) {
|
|
345
345
|
if (this.length === 0)
|
|
346
346
|
return "";
|
|
347
347
|
var p = this.head;
|
|
@@ -2990,9 +2990,9 @@ var require_graceful_fs = __commonJS({
|
|
|
2990
2990
|
}
|
|
2991
2991
|
}
|
|
2992
2992
|
var fs$readdir = fs9.readdir;
|
|
2993
|
-
fs9.readdir =
|
|
2993
|
+
fs9.readdir = readdir2;
|
|
2994
2994
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
2995
|
-
function
|
|
2995
|
+
function readdir2(path7, options, cb) {
|
|
2996
2996
|
if (typeof options === "function")
|
|
2997
2997
|
cb = options, options = null;
|
|
2998
2998
|
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path8, options2, cb2, startTime) {
|
|
@@ -3542,7 +3542,7 @@ var require_copy_sync = __commonJS({
|
|
|
3542
3542
|
var path7 = require("path");
|
|
3543
3543
|
var mkdirsSync = require_mkdirs().mkdirsSync;
|
|
3544
3544
|
var utimesMillisSync = require_utimes().utimesMillisSync;
|
|
3545
|
-
var
|
|
3545
|
+
var stat2 = require_stat();
|
|
3546
3546
|
function copySync(src, dest, opts) {
|
|
3547
3547
|
if (typeof opts === "function") {
|
|
3548
3548
|
opts = { filter: opts };
|
|
@@ -3555,8 +3555,8 @@ var require_copy_sync = __commonJS({
|
|
|
3555
3555
|
|
|
3556
3556
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);
|
|
3557
3557
|
}
|
|
3558
|
-
const { srcStat, destStat } =
|
|
3559
|
-
|
|
3558
|
+
const { srcStat, destStat } = stat2.checkPathsSync(src, dest, "copy", opts);
|
|
3559
|
+
stat2.checkParentPathsSync(src, srcStat, dest, "copy");
|
|
3560
3560
|
return handleFilterAndCopy(destStat, src, dest, opts);
|
|
3561
3561
|
}
|
|
3562
3562
|
function handleFilterAndCopy(destStat, src, dest, opts) {
|
|
@@ -3640,7 +3640,7 @@ var require_copy_sync = __commonJS({
|
|
|
3640
3640
|
function copyDirItem(item, src, dest, opts) {
|
|
3641
3641
|
const srcItem = path7.join(src, item);
|
|
3642
3642
|
const destItem = path7.join(dest, item);
|
|
3643
|
-
const { destStat } =
|
|
3643
|
+
const { destStat } = stat2.checkPathsSync(srcItem, destItem, "copy", opts);
|
|
3644
3644
|
return startCopy(destStat, srcItem, destItem, opts);
|
|
3645
3645
|
}
|
|
3646
3646
|
function onLink(destStat, src, dest, opts) {
|
|
@@ -3662,10 +3662,10 @@ var require_copy_sync = __commonJS({
|
|
|
3662
3662
|
if (opts.dereference) {
|
|
3663
3663
|
resolvedDest = path7.resolve(process.cwd(), resolvedDest);
|
|
3664
3664
|
}
|
|
3665
|
-
if (
|
|
3665
|
+
if (stat2.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
3666
3666
|
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
|
|
3667
3667
|
}
|
|
3668
|
-
if (fs8.statSync(dest).isDirectory() &&
|
|
3668
|
+
if (fs8.statSync(dest).isDirectory() && stat2.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
3669
3669
|
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
|
|
3670
3670
|
}
|
|
3671
3671
|
return copyLink(resolvedSrc, dest);
|
|
@@ -3714,7 +3714,7 @@ var require_copy = __commonJS({
|
|
|
3714
3714
|
var mkdirs = require_mkdirs().mkdirs;
|
|
3715
3715
|
var pathExists = require_path_exists().pathExists;
|
|
3716
3716
|
var utimesMillis = require_utimes().utimesMillis;
|
|
3717
|
-
var
|
|
3717
|
+
var stat2 = require_stat();
|
|
3718
3718
|
function copy(src, dest, opts, cb) {
|
|
3719
3719
|
if (typeof opts === "function" && !cb) {
|
|
3720
3720
|
cb = opts;
|
|
@@ -3732,11 +3732,11 @@ var require_copy = __commonJS({
|
|
|
3732
3732
|
|
|
3733
3733
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);
|
|
3734
3734
|
}
|
|
3735
|
-
|
|
3735
|
+
stat2.checkPaths(src, dest, "copy", opts, (err, stats) => {
|
|
3736
3736
|
if (err)
|
|
3737
3737
|
return cb(err);
|
|
3738
3738
|
const { srcStat, destStat } = stats;
|
|
3739
|
-
|
|
3739
|
+
stat2.checkParentPaths(src, srcStat, dest, "copy", (err2) => {
|
|
3740
3740
|
if (err2)
|
|
3741
3741
|
return cb(err2);
|
|
3742
3742
|
if (opts.filter)
|
|
@@ -3772,8 +3772,8 @@ var require_copy = __commonJS({
|
|
|
3772
3772
|
return getStats(destStat, src, dest, opts, cb);
|
|
3773
3773
|
}
|
|
3774
3774
|
function getStats(destStat, src, dest, opts, cb) {
|
|
3775
|
-
const
|
|
3776
|
-
|
|
3775
|
+
const stat3 = opts.dereference ? fs8.stat : fs8.lstat;
|
|
3776
|
+
stat3(src, (err, srcStat) => {
|
|
3777
3777
|
if (err)
|
|
3778
3778
|
return cb(err);
|
|
3779
3779
|
if (srcStat.isDirectory())
|
|
@@ -3880,7 +3880,7 @@ var require_copy = __commonJS({
|
|
|
3880
3880
|
function copyDirItem(items, item, src, dest, opts, cb) {
|
|
3881
3881
|
const srcItem = path7.join(src, item);
|
|
3882
3882
|
const destItem = path7.join(dest, item);
|
|
3883
|
-
|
|
3883
|
+
stat2.checkPaths(srcItem, destItem, "copy", opts, (err, stats) => {
|
|
3884
3884
|
if (err)
|
|
3885
3885
|
return cb(err);
|
|
3886
3886
|
const { destStat } = stats;
|
|
@@ -3910,10 +3910,10 @@ var require_copy = __commonJS({
|
|
|
3910
3910
|
if (opts.dereference) {
|
|
3911
3911
|
resolvedDest = path7.resolve(process.cwd(), resolvedDest);
|
|
3912
3912
|
}
|
|
3913
|
-
if (
|
|
3913
|
+
if (stat2.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
3914
3914
|
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
|
|
3915
3915
|
}
|
|
3916
|
-
if (destStat.isDirectory() &&
|
|
3916
|
+
if (destStat.isDirectory() && stat2.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
3917
3917
|
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
|
|
3918
3918
|
}
|
|
3919
3919
|
return copyLink(resolvedSrc, dest, cb);
|
|
@@ -4537,11 +4537,11 @@ var require_symlink = __commonJS({
|
|
|
4537
4537
|
});
|
|
4538
4538
|
}
|
|
4539
4539
|
function _createSymlink(srcpath, dstpath, type, callback) {
|
|
4540
|
-
symlinkPaths(srcpath, dstpath, (err,
|
|
4540
|
+
symlinkPaths(srcpath, dstpath, (err, relative2) => {
|
|
4541
4541
|
if (err)
|
|
4542
4542
|
return callback(err);
|
|
4543
|
-
srcpath =
|
|
4544
|
-
symlinkType(
|
|
4543
|
+
srcpath = relative2.toDst;
|
|
4544
|
+
symlinkType(relative2.toCwd, type, (err2, type2) => {
|
|
4545
4545
|
if (err2)
|
|
4546
4546
|
return callback(err2);
|
|
4547
4547
|
const dir = path7.dirname(dstpath);
|
|
@@ -4571,9 +4571,9 @@ var require_symlink = __commonJS({
|
|
|
4571
4571
|
if (areIdentical(srcStat, dstStat))
|
|
4572
4572
|
return;
|
|
4573
4573
|
}
|
|
4574
|
-
const
|
|
4575
|
-
srcpath =
|
|
4576
|
-
type = symlinkTypeSync(
|
|
4574
|
+
const relative2 = symlinkPathsSync(srcpath, dstpath);
|
|
4575
|
+
srcpath = relative2.toDst;
|
|
4576
|
+
type = symlinkTypeSync(relative2.toCwd, type);
|
|
4577
4577
|
const dir = path7.dirname(dstpath);
|
|
4578
4578
|
const exists = fs8.existsSync(dir);
|
|
4579
4579
|
if (exists)
|
|
@@ -4817,12 +4817,12 @@ var require_move_sync = __commonJS({
|
|
|
4817
4817
|
var copySync = require_copy_sync2().copySync;
|
|
4818
4818
|
var removeSync = require_remove().removeSync;
|
|
4819
4819
|
var mkdirpSync = require_mkdirs().mkdirpSync;
|
|
4820
|
-
var
|
|
4820
|
+
var stat2 = require_stat();
|
|
4821
4821
|
function moveSync(src, dest, opts) {
|
|
4822
4822
|
opts = opts || {};
|
|
4823
4823
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
4824
|
-
const { srcStat, isChangingCase = false } =
|
|
4825
|
-
|
|
4824
|
+
const { srcStat, isChangingCase = false } = stat2.checkPathsSync(src, dest, "move", opts);
|
|
4825
|
+
stat2.checkParentPathsSync(src, srcStat, dest, "move");
|
|
4826
4826
|
if (!isParentRoot(dest))
|
|
4827
4827
|
mkdirpSync(path7.dirname(dest));
|
|
4828
4828
|
return doRename(src, dest, overwrite, isChangingCase);
|
|
@@ -4884,18 +4884,18 @@ var require_move = __commonJS({
|
|
|
4884
4884
|
var remove2 = require_remove().remove;
|
|
4885
4885
|
var mkdirp3 = require_mkdirs().mkdirp;
|
|
4886
4886
|
var pathExists = require_path_exists().pathExists;
|
|
4887
|
-
var
|
|
4887
|
+
var stat2 = require_stat();
|
|
4888
4888
|
function move(src, dest, opts, cb) {
|
|
4889
4889
|
if (typeof opts === "function") {
|
|
4890
4890
|
cb = opts;
|
|
4891
4891
|
opts = {};
|
|
4892
4892
|
}
|
|
4893
4893
|
const overwrite = opts.overwrite || opts.clobber || false;
|
|
4894
|
-
|
|
4894
|
+
stat2.checkPaths(src, dest, "move", opts, (err, stats) => {
|
|
4895
4895
|
if (err)
|
|
4896
4896
|
return cb(err);
|
|
4897
4897
|
const { srcStat, isChangingCase = false } = stats;
|
|
4898
|
-
|
|
4898
|
+
stat2.checkParentPaths(src, srcStat, dest, "move", (err2) => {
|
|
4899
4899
|
if (err2)
|
|
4900
4900
|
return cb(err2);
|
|
4901
4901
|
if (isParentRoot(dest))
|
|
@@ -10665,8 +10665,8 @@ var require_old = __commonJS({
|
|
|
10665
10665
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
10666
10666
|
resolvedLink = cache[base];
|
|
10667
10667
|
} else {
|
|
10668
|
-
var
|
|
10669
|
-
if (!
|
|
10668
|
+
var stat2 = fs8.lstatSync(base);
|
|
10669
|
+
if (!stat2.isSymbolicLink()) {
|
|
10670
10670
|
knownHard[base] = true;
|
|
10671
10671
|
if (cache)
|
|
10672
10672
|
cache[base] = base;
|
|
@@ -10674,7 +10674,7 @@ var require_old = __commonJS({
|
|
|
10674
10674
|
}
|
|
10675
10675
|
var linkTarget = null;
|
|
10676
10676
|
if (!isWindows) {
|
|
10677
|
-
var id =
|
|
10677
|
+
var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
|
|
10678
10678
|
if (seenLinks.hasOwnProperty(id)) {
|
|
10679
10679
|
linkTarget = seenLinks[id];
|
|
10680
10680
|
}
|
|
@@ -10748,17 +10748,17 @@ var require_old = __commonJS({
|
|
|
10748
10748
|
}
|
|
10749
10749
|
return fs8.lstat(base, gotStat);
|
|
10750
10750
|
}
|
|
10751
|
-
function gotStat(err,
|
|
10751
|
+
function gotStat(err, stat2) {
|
|
10752
10752
|
if (err)
|
|
10753
10753
|
return cb(err);
|
|
10754
|
-
if (!
|
|
10754
|
+
if (!stat2.isSymbolicLink()) {
|
|
10755
10755
|
knownHard[base] = true;
|
|
10756
10756
|
if (cache)
|
|
10757
10757
|
cache[base] = base;
|
|
10758
10758
|
return process.nextTick(LOOP);
|
|
10759
10759
|
}
|
|
10760
10760
|
if (!isWindows) {
|
|
10761
|
-
var id =
|
|
10761
|
+
var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
|
|
10762
10762
|
if (seenLinks.hasOwnProperty(id)) {
|
|
10763
10763
|
return gotTarget(null, seenLinks[id], base);
|
|
10764
10764
|
}
|
|
@@ -11925,7 +11925,7 @@ var require_sync = __commonJS({
|
|
|
11925
11925
|
return this._readdir(abs, false);
|
|
11926
11926
|
var entries;
|
|
11927
11927
|
var lstat3;
|
|
11928
|
-
var
|
|
11928
|
+
var stat2;
|
|
11929
11929
|
try {
|
|
11930
11930
|
lstat3 = this.fs.lstatSync(abs);
|
|
11931
11931
|
} catch (er) {
|
|
@@ -12058,8 +12058,8 @@ var require_sync = __commonJS({
|
|
|
12058
12058
|
return false;
|
|
12059
12059
|
}
|
|
12060
12060
|
var exists;
|
|
12061
|
-
var
|
|
12062
|
-
if (!
|
|
12061
|
+
var stat2 = this.statCache[abs];
|
|
12062
|
+
if (!stat2) {
|
|
12063
12063
|
var lstat3;
|
|
12064
12064
|
try {
|
|
12065
12065
|
lstat3 = this.fs.lstatSync(abs);
|
|
@@ -12071,18 +12071,18 @@ var require_sync = __commonJS({
|
|
|
12071
12071
|
}
|
|
12072
12072
|
if (lstat3 && lstat3.isSymbolicLink()) {
|
|
12073
12073
|
try {
|
|
12074
|
-
|
|
12074
|
+
stat2 = this.fs.statSync(abs);
|
|
12075
12075
|
} catch (er) {
|
|
12076
|
-
|
|
12076
|
+
stat2 = lstat3;
|
|
12077
12077
|
}
|
|
12078
12078
|
} else {
|
|
12079
|
-
|
|
12079
|
+
stat2 = lstat3;
|
|
12080
12080
|
}
|
|
12081
12081
|
}
|
|
12082
|
-
this.statCache[abs] =
|
|
12082
|
+
this.statCache[abs] = stat2;
|
|
12083
12083
|
var c = true;
|
|
12084
|
-
if (
|
|
12085
|
-
c =
|
|
12084
|
+
if (stat2)
|
|
12085
|
+
c = stat2.isDirectory() ? "DIR" : "FILE";
|
|
12086
12086
|
this.cache[abs] = this.cache[abs] || c;
|
|
12087
12087
|
if (needDir && c === "FILE")
|
|
12088
12088
|
return false;
|
|
@@ -12650,16 +12650,16 @@ var require_glob = __commonJS({
|
|
|
12650
12650
|
return cb();
|
|
12651
12651
|
}
|
|
12652
12652
|
var exists;
|
|
12653
|
-
var
|
|
12654
|
-
if (
|
|
12655
|
-
if (
|
|
12656
|
-
return cb(null,
|
|
12653
|
+
var stat2 = this.statCache[abs];
|
|
12654
|
+
if (stat2 !== void 0) {
|
|
12655
|
+
if (stat2 === false)
|
|
12656
|
+
return cb(null, stat2);
|
|
12657
12657
|
else {
|
|
12658
|
-
var type =
|
|
12658
|
+
var type = stat2.isDirectory() ? "DIR" : "FILE";
|
|
12659
12659
|
if (needDir && type === "FILE")
|
|
12660
12660
|
return cb();
|
|
12661
12661
|
else
|
|
12662
|
-
return cb(null, type,
|
|
12662
|
+
return cb(null, type, stat2);
|
|
12663
12663
|
}
|
|
12664
12664
|
}
|
|
12665
12665
|
var self2 = this;
|
|
@@ -12668,33 +12668,33 @@ var require_glob = __commonJS({
|
|
|
12668
12668
|
self2.fs.lstat(abs, statcb);
|
|
12669
12669
|
function lstatcb_(er, lstat3) {
|
|
12670
12670
|
if (lstat3 && lstat3.isSymbolicLink()) {
|
|
12671
|
-
return self2.fs.stat(abs, function(er2,
|
|
12671
|
+
return self2.fs.stat(abs, function(er2, stat3) {
|
|
12672
12672
|
if (er2)
|
|
12673
12673
|
self2._stat2(f, abs, null, lstat3, cb);
|
|
12674
12674
|
else
|
|
12675
|
-
self2._stat2(f, abs, er2,
|
|
12675
|
+
self2._stat2(f, abs, er2, stat3, cb);
|
|
12676
12676
|
});
|
|
12677
12677
|
} else {
|
|
12678
12678
|
self2._stat2(f, abs, er, lstat3, cb);
|
|
12679
12679
|
}
|
|
12680
12680
|
}
|
|
12681
12681
|
};
|
|
12682
|
-
Glob.prototype._stat2 = function(f, abs, er,
|
|
12682
|
+
Glob.prototype._stat2 = function(f, abs, er, stat2, cb) {
|
|
12683
12683
|
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
12684
12684
|
this.statCache[abs] = false;
|
|
12685
12685
|
return cb();
|
|
12686
12686
|
}
|
|
12687
12687
|
var needDir = f.slice(-1) === "/";
|
|
12688
|
-
this.statCache[abs] =
|
|
12689
|
-
if (abs.slice(-1) === "/" &&
|
|
12690
|
-
return cb(null, false,
|
|
12688
|
+
this.statCache[abs] = stat2;
|
|
12689
|
+
if (abs.slice(-1) === "/" && stat2 && !stat2.isDirectory())
|
|
12690
|
+
return cb(null, false, stat2);
|
|
12691
12691
|
var c = true;
|
|
12692
|
-
if (
|
|
12693
|
-
c =
|
|
12692
|
+
if (stat2)
|
|
12693
|
+
c = stat2.isDirectory() ? "DIR" : "FILE";
|
|
12694
12694
|
this.cache[abs] = this.cache[abs] || c;
|
|
12695
12695
|
if (needDir && c === "FILE")
|
|
12696
12696
|
return cb();
|
|
12697
|
-
return cb(null, c,
|
|
12697
|
+
return cb(null, c, stat2);
|
|
12698
12698
|
};
|
|
12699
12699
|
}
|
|
12700
12700
|
});
|
|
@@ -12735,15 +12735,15 @@ var require_windows = __commonJS({
|
|
|
12735
12735
|
}
|
|
12736
12736
|
return false;
|
|
12737
12737
|
}
|
|
12738
|
-
function checkStat(
|
|
12739
|
-
if (!
|
|
12738
|
+
function checkStat(stat2, path7, options) {
|
|
12739
|
+
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
12740
12740
|
return false;
|
|
12741
12741
|
}
|
|
12742
12742
|
return checkPathExt(path7, options);
|
|
12743
12743
|
}
|
|
12744
12744
|
function isexe(path7, options, cb) {
|
|
12745
|
-
fs8.stat(path7, function(er,
|
|
12746
|
-
cb(er, er ? false : checkStat(
|
|
12745
|
+
fs8.stat(path7, function(er, stat2) {
|
|
12746
|
+
cb(er, er ? false : checkStat(stat2, path7, options));
|
|
12747
12747
|
});
|
|
12748
12748
|
}
|
|
12749
12749
|
function sync(path7, options) {
|
|
@@ -12759,20 +12759,20 @@ var require_mode = __commonJS({
|
|
|
12759
12759
|
isexe.sync = sync;
|
|
12760
12760
|
var fs8 = require("fs");
|
|
12761
12761
|
function isexe(path7, options, cb) {
|
|
12762
|
-
fs8.stat(path7, function(er,
|
|
12763
|
-
cb(er, er ? false : checkStat(
|
|
12762
|
+
fs8.stat(path7, function(er, stat2) {
|
|
12763
|
+
cb(er, er ? false : checkStat(stat2, options));
|
|
12764
12764
|
});
|
|
12765
12765
|
}
|
|
12766
12766
|
function sync(path7, options) {
|
|
12767
12767
|
return checkStat(fs8.statSync(path7), options);
|
|
12768
12768
|
}
|
|
12769
|
-
function checkStat(
|
|
12770
|
-
return
|
|
12769
|
+
function checkStat(stat2, options) {
|
|
12770
|
+
return stat2.isFile() && checkMode(stat2, options);
|
|
12771
12771
|
}
|
|
12772
|
-
function checkMode(
|
|
12773
|
-
var mod =
|
|
12774
|
-
var uid =
|
|
12775
|
-
var gid =
|
|
12772
|
+
function checkMode(stat2, options) {
|
|
12773
|
+
var mod = stat2.mode;
|
|
12774
|
+
var uid = stat2.uid;
|
|
12775
|
+
var gid = stat2.gid;
|
|
12776
12776
|
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
12777
12777
|
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
12778
12778
|
var u = parseInt("100", 8);
|
|
@@ -19924,6 +19924,7 @@ __export(src_exports, {
|
|
|
19924
19924
|
buildsSchema: () => buildsSchema,
|
|
19925
19925
|
cloneEnv: () => cloneEnv,
|
|
19926
19926
|
collectUncompressedSize: () => collectUncompressedSize,
|
|
19927
|
+
createFunctionsIterator: () => createFunctionsIterator,
|
|
19927
19928
|
createLambda: () => createLambda,
|
|
19928
19929
|
debug: () => debug,
|
|
19929
19930
|
defaultCachePathGlob: () => defaultCachePathGlob,
|
|
@@ -19967,6 +19968,7 @@ __export(src_exports, {
|
|
|
19967
19968
|
getWriteableDirectory: () => getWritableDirectory,
|
|
19968
19969
|
glob: () => glob,
|
|
19969
19970
|
hardLinkDir: () => hardLinkDir,
|
|
19971
|
+
hydrateFilesMap: () => hydrateFilesMap,
|
|
19970
19972
|
installDependencies: () => installDependencies,
|
|
19971
19973
|
isBackendBuilder: () => isBackendBuilder,
|
|
19972
19974
|
isBackendFramework: () => isBackendFramework,
|
|
@@ -19980,6 +19982,7 @@ __export(src_exports, {
|
|
|
19980
19982
|
isPythonFramework: () => isPythonFramework,
|
|
19981
19983
|
isRouteMiddleware: () => isRouteMiddleware,
|
|
19982
19984
|
isSymbolicLink: () => isSymbolicLink,
|
|
19985
|
+
maybeReadJSON: () => maybeReadJSON,
|
|
19983
19986
|
md5: () => md5,
|
|
19984
19987
|
normalizePath: () => normalizePath,
|
|
19985
19988
|
packageManifestSchema: () => packageManifestSchema,
|
|
@@ -20005,6 +20008,7 @@ __export(src_exports, {
|
|
|
20005
20008
|
streamWithExtendedPayload: () => streamWithExtendedPayload,
|
|
20006
20009
|
traverseUpDirectories: () => traverseUpDirectories,
|
|
20007
20010
|
validateEnvWrapperSupport: () => validateEnvWrapperSupport,
|
|
20011
|
+
validateFrameworkVersion: () => validateFrameworkVersion,
|
|
20008
20012
|
validateLambdaSize: () => validateLambdaSize,
|
|
20009
20013
|
validateNpmrc: () => validateNpmrc,
|
|
20010
20014
|
validateUncompressedLambdaSize: () => validateUncompressedLambdaSize,
|
|
@@ -20086,9 +20090,9 @@ var FileFsRef = class _FileFsRef {
|
|
|
20086
20090
|
let m = mode;
|
|
20087
20091
|
let s = size;
|
|
20088
20092
|
if (!m || typeof s === "undefined") {
|
|
20089
|
-
const
|
|
20090
|
-
m =
|
|
20091
|
-
s =
|
|
20093
|
+
const stat2 = await import_fs_extra.default.lstat(fsPath);
|
|
20094
|
+
m = stat2.mode;
|
|
20095
|
+
s = stat2.size;
|
|
20092
20096
|
}
|
|
20093
20097
|
return new _FileFsRef({ mode: m, contentType, fsPath, size: s });
|
|
20094
20098
|
}
|
|
@@ -20687,12 +20691,6 @@ var Lambda = class {
|
|
|
20687
20691
|
trigger.consumer.length > 0,
|
|
20688
20692
|
`${prefix}.consumer cannot be empty`
|
|
20689
20693
|
);
|
|
20690
|
-
if (trigger.type === "queue/v2beta") {
|
|
20691
|
-
(0, import_assert4.default)(
|
|
20692
|
-
experimentalTriggers.length === 1,
|
|
20693
|
-
'"experimentalTriggers" can only have one item for queue/v2beta'
|
|
20694
|
-
);
|
|
20695
|
-
}
|
|
20696
20694
|
if (trigger.maxDeliveries !== void 0) {
|
|
20697
20695
|
(0, import_assert4.default)(
|
|
20698
20696
|
typeof trigger.maxDeliveries === "number",
|
|
@@ -20845,6 +20843,11 @@ async function getLambdaOptionsFromFunction({
|
|
|
20845
20843
|
return trigger;
|
|
20846
20844
|
}
|
|
20847
20845
|
);
|
|
20846
|
+
if (experimentalTriggers && experimentalTriggers.length > 1 && experimentalTriggers.some((t) => t.type === "queue/v2beta")) {
|
|
20847
|
+
throw new Error(
|
|
20848
|
+
`functions["${pattern}"].experimentalTriggers can only have one item for queue/v2beta`
|
|
20849
|
+
);
|
|
20850
|
+
}
|
|
20848
20851
|
return {
|
|
20849
20852
|
architecture: fn.architecture,
|
|
20850
20853
|
memory: fn.memory,
|
|
@@ -21090,9 +21093,9 @@ async function glob(pattern, opts, mountpoint) {
|
|
|
21090
21093
|
for (const relativePath of files) {
|
|
21091
21094
|
const absPath = import_path4.default.join(options.cwd, relativePath);
|
|
21092
21095
|
const fsPath = normalizePath(absPath);
|
|
21093
|
-
let
|
|
21096
|
+
let stat2 = statCache[fsPath];
|
|
21094
21097
|
(0, import_assert5.default)(
|
|
21095
|
-
|
|
21098
|
+
stat2,
|
|
21096
21099
|
`statCache does not contain value for ${relativePath} (resolved to ${fsPath})`
|
|
21097
21100
|
);
|
|
21098
21101
|
const isSymlink = symlinks[fsPath];
|
|
@@ -21103,13 +21106,13 @@ async function glob(pattern, opts, mountpoint) {
|
|
|
21103
21106
|
continue;
|
|
21104
21107
|
}
|
|
21105
21108
|
}
|
|
21106
|
-
if (isSymlink ||
|
|
21109
|
+
if (isSymlink || stat2.isFile() || stat2.isDirectory()) {
|
|
21107
21110
|
if (isSymlink) {
|
|
21108
|
-
|
|
21111
|
+
stat2 = await (0, import_fs_extra5.lstat)(absPath);
|
|
21109
21112
|
}
|
|
21110
21113
|
const dirname = import_path4.default.dirname(relativePath);
|
|
21111
21114
|
dirsWithEntries.add(dirname);
|
|
21112
|
-
if (
|
|
21115
|
+
if (stat2.isDirectory()) {
|
|
21113
21116
|
dirs.add(relativePath);
|
|
21114
21117
|
continue;
|
|
21115
21118
|
}
|
|
@@ -21117,7 +21120,7 @@ async function glob(pattern, opts, mountpoint) {
|
|
|
21117
21120
|
if (mountpoint) {
|
|
21118
21121
|
finalPath = import_path4.default.join(mountpoint, finalPath);
|
|
21119
21122
|
}
|
|
21120
|
-
results[finalPath] = new file_fs_ref_default({ mode:
|
|
21123
|
+
results[finalPath] = new file_fs_ref_default({ mode: stat2.mode, fsPath });
|
|
21121
21124
|
}
|
|
21122
21125
|
}
|
|
21123
21126
|
if (options.includeDirectories) {
|
|
@@ -21129,8 +21132,8 @@ async function glob(pattern, opts, mountpoint) {
|
|
|
21129
21132
|
finalPath = import_path4.default.join(mountpoint, finalPath);
|
|
21130
21133
|
}
|
|
21131
21134
|
const fsPath = normalizePath(import_path4.default.join(options.cwd, relativePath));
|
|
21132
|
-
const
|
|
21133
|
-
results[finalPath] = new file_fs_ref_default({ mode:
|
|
21135
|
+
const stat2 = statCache[fsPath];
|
|
21136
|
+
results[finalPath] = new file_fs_ref_default({ mode: stat2.mode, fsPath });
|
|
21134
21137
|
}
|
|
21135
21138
|
}
|
|
21136
21139
|
return results;
|
|
@@ -21252,8 +21255,8 @@ function getOptions() {
|
|
|
21252
21255
|
return NODE_VERSIONS;
|
|
21253
21256
|
}
|
|
21254
21257
|
function isNodeVersionAvailable(version) {
|
|
21255
|
-
const
|
|
21256
|
-
return
|
|
21258
|
+
const stat2 = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
|
|
21259
|
+
return stat2?.isDirectory() ?? false;
|
|
21257
21260
|
}
|
|
21258
21261
|
function getAvailableNodeVersions() {
|
|
21259
21262
|
return getOptions().filter((v) => v.major >= 18).filter(isNodeVersionAvailable).map((n) => n.major);
|
|
@@ -24671,6 +24674,91 @@ function validateEnvWrapperSupport(encryptedEnvFilename, encryptedEnvContent, la
|
|
|
24671
24674
|
);
|
|
24672
24675
|
}
|
|
24673
24676
|
}
|
|
24677
|
+
|
|
24678
|
+
// src/deserialize/validate-framework-version.ts
|
|
24679
|
+
var MAX_FRAMEWORK_VERSION_LENGTH = 50;
|
|
24680
|
+
function validateFrameworkVersion(frameworkVersion) {
|
|
24681
|
+
if (!frameworkVersion) {
|
|
24682
|
+
return void 0;
|
|
24683
|
+
}
|
|
24684
|
+
if (typeof frameworkVersion !== "string") {
|
|
24685
|
+
throw new NowBuildError({
|
|
24686
|
+
message: `Invalid config.json: "framework.version" type "${typeof frameworkVersion}" should be "string"`,
|
|
24687
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_TYPE"
|
|
24688
|
+
});
|
|
24689
|
+
}
|
|
24690
|
+
if (frameworkVersion.length > MAX_FRAMEWORK_VERSION_LENGTH) {
|
|
24691
|
+
const trimmedFrameworkVersion = frameworkVersion.slice(
|
|
24692
|
+
0,
|
|
24693
|
+
MAX_FRAMEWORK_VERSION_LENGTH
|
|
24694
|
+
);
|
|
24695
|
+
throw new NowBuildError({
|
|
24696
|
+
message: `Invalid config.json: "framework.version" length ${frameworkVersion.length} > ${MAX_FRAMEWORK_VERSION_LENGTH}. "${trimmedFrameworkVersion}..."`,
|
|
24697
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_LENGTH"
|
|
24698
|
+
});
|
|
24699
|
+
}
|
|
24700
|
+
return {
|
|
24701
|
+
version: frameworkVersion
|
|
24702
|
+
};
|
|
24703
|
+
}
|
|
24704
|
+
|
|
24705
|
+
// src/deserialize/hydrate-files-map.ts
|
|
24706
|
+
var import_path11 = require("path");
|
|
24707
|
+
async function hydrateFilesMap(files, filesMap, repoRootPath, fileFsRefsCache) {
|
|
24708
|
+
for (const [funcPath, projectPath] of Object.entries(filesMap)) {
|
|
24709
|
+
files[funcPath] = await fileFsRefCached(
|
|
24710
|
+
(0, import_path11.join)(repoRootPath, projectPath),
|
|
24711
|
+
fileFsRefsCache
|
|
24712
|
+
);
|
|
24713
|
+
}
|
|
24714
|
+
}
|
|
24715
|
+
async function fileFsRefCached(fsPath, cache) {
|
|
24716
|
+
let file = cache.get(fsPath);
|
|
24717
|
+
if (!file) {
|
|
24718
|
+
file = await file_fs_ref_default.fromFsPath({ fsPath });
|
|
24719
|
+
cache.set(fsPath, file);
|
|
24720
|
+
}
|
|
24721
|
+
return file;
|
|
24722
|
+
}
|
|
24723
|
+
|
|
24724
|
+
// src/deserialize/create-functions-iterator.ts
|
|
24725
|
+
var import_path12 = require("path");
|
|
24726
|
+
var import_fs_extra10 = __toESM(require_lib());
|
|
24727
|
+
var SUFFIX = ".func";
|
|
24728
|
+
async function* createFunctionsIterator(dir, root = dir) {
|
|
24729
|
+
let paths;
|
|
24730
|
+
try {
|
|
24731
|
+
paths = await (0, import_fs_extra10.readdir)(dir);
|
|
24732
|
+
} catch (err) {
|
|
24733
|
+
if (err.code !== "ENOENT" && err.code !== "ENOTDIR") {
|
|
24734
|
+
throw err;
|
|
24735
|
+
}
|
|
24736
|
+
paths = [];
|
|
24737
|
+
}
|
|
24738
|
+
for (const path7 of paths) {
|
|
24739
|
+
const abs = (0, import_path12.join)(dir, path7);
|
|
24740
|
+
const s = await (0, import_fs_extra10.stat)(abs);
|
|
24741
|
+
if (s.isDirectory()) {
|
|
24742
|
+
if (path7.endsWith(SUFFIX)) {
|
|
24743
|
+
yield (0, import_path12.relative)(root, abs.substring(0, abs.length - SUFFIX.length));
|
|
24744
|
+
} else {
|
|
24745
|
+
yield* createFunctionsIterator(abs, root);
|
|
24746
|
+
}
|
|
24747
|
+
}
|
|
24748
|
+
}
|
|
24749
|
+
}
|
|
24750
|
+
|
|
24751
|
+
// src/deserialize/maybe-read-json.ts
|
|
24752
|
+
var import_fs_extra11 = __toESM(require_lib());
|
|
24753
|
+
async function maybeReadJSON(path7) {
|
|
24754
|
+
try {
|
|
24755
|
+
return await (0, import_fs_extra11.readJSON)(path7);
|
|
24756
|
+
} catch (err) {
|
|
24757
|
+
if (err.code !== "ENOENT")
|
|
24758
|
+
throw err;
|
|
24759
|
+
}
|
|
24760
|
+
return void 0;
|
|
24761
|
+
}
|
|
24674
24762
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24675
24763
|
0 && (module.exports = {
|
|
24676
24764
|
BACKEND_BUILDERS,
|
|
@@ -24699,6 +24787,7 @@ function validateEnvWrapperSupport(encryptedEnvFilename, encryptedEnvContent, la
|
|
|
24699
24787
|
buildsSchema,
|
|
24700
24788
|
cloneEnv,
|
|
24701
24789
|
collectUncompressedSize,
|
|
24790
|
+
createFunctionsIterator,
|
|
24702
24791
|
createLambda,
|
|
24703
24792
|
debug,
|
|
24704
24793
|
defaultCachePathGlob,
|
|
@@ -24742,6 +24831,7 @@ function validateEnvWrapperSupport(encryptedEnvFilename, encryptedEnvContent, la
|
|
|
24742
24831
|
getWriteableDirectory,
|
|
24743
24832
|
glob,
|
|
24744
24833
|
hardLinkDir,
|
|
24834
|
+
hydrateFilesMap,
|
|
24745
24835
|
installDependencies,
|
|
24746
24836
|
isBackendBuilder,
|
|
24747
24837
|
isBackendFramework,
|
|
@@ -24755,6 +24845,7 @@ function validateEnvWrapperSupport(encryptedEnvFilename, encryptedEnvContent, la
|
|
|
24755
24845
|
isPythonFramework,
|
|
24756
24846
|
isRouteMiddleware,
|
|
24757
24847
|
isSymbolicLink,
|
|
24848
|
+
maybeReadJSON,
|
|
24758
24849
|
md5,
|
|
24759
24850
|
normalizePath,
|
|
24760
24851
|
packageManifestSchema,
|
|
@@ -24780,6 +24871,7 @@ function validateEnvWrapperSupport(encryptedEnvFilename, encryptedEnvContent, la
|
|
|
24780
24871
|
streamWithExtendedPayload,
|
|
24781
24872
|
traverseUpDirectories,
|
|
24782
24873
|
validateEnvWrapperSupport,
|
|
24874
|
+
validateFrameworkVersion,
|
|
24783
24875
|
validateLambdaSize,
|
|
24784
24876
|
validateNpmrc,
|
|
24785
24877
|
validateUncompressedLambdaSize,
|
package/dist/lambda.js
CHANGED
|
@@ -210,12 +210,6 @@ class Lambda {
|
|
|
210
210
|
trigger.consumer.length > 0,
|
|
211
211
|
`${prefix}.consumer cannot be empty`
|
|
212
212
|
);
|
|
213
|
-
if (trigger.type === "queue/v2beta") {
|
|
214
|
-
(0, import_assert.default)(
|
|
215
|
-
experimentalTriggers.length === 1,
|
|
216
|
-
'"experimentalTriggers" can only have one item for queue/v2beta'
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
213
|
if (trigger.maxDeliveries !== void 0) {
|
|
220
214
|
(0, import_assert.default)(
|
|
221
215
|
typeof trigger.maxDeliveries === "number",
|
|
@@ -368,6 +362,11 @@ async function getLambdaOptionsFromFunction({
|
|
|
368
362
|
return trigger;
|
|
369
363
|
}
|
|
370
364
|
);
|
|
365
|
+
if (experimentalTriggers && experimentalTriggers.length > 1 && experimentalTriggers.some((t) => t.type === "queue/v2beta")) {
|
|
366
|
+
throw new Error(
|
|
367
|
+
`functions["${pattern}"].experimentalTriggers can only have one item for queue/v2beta`
|
|
368
|
+
);
|
|
369
|
+
}
|
|
371
370
|
return {
|
|
372
371
|
architecture: fn.architecture,
|
|
373
372
|
memory: fn.memory,
|