@gigadrive/network-config 2.0.1 → 2.0.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.
- package/dist/index.js +423 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +344 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/tsconfig.json +2 -1
package/dist/index.js
CHANGED
|
@@ -3408,8 +3408,8 @@
|
|
|
3408
3408
|
wsComponents.secure = void 0;
|
|
3409
3409
|
}
|
|
3410
3410
|
if (wsComponents.resourceName) {
|
|
3411
|
-
const [
|
|
3412
|
-
wsComponents.path =
|
|
3411
|
+
const [path5, query] = wsComponents.resourceName.split("?");
|
|
3412
|
+
wsComponents.path = path5 && path5 !== "/" ? path5 : void 0;
|
|
3413
3413
|
wsComponents.query = query;
|
|
3414
3414
|
wsComponents.resourceName = void 0;
|
|
3415
3415
|
}
|
|
@@ -6725,12 +6725,12 @@
|
|
|
6725
6725
|
throw new Error(`Unknown format "${name}"`);
|
|
6726
6726
|
return f;
|
|
6727
6727
|
};
|
|
6728
|
-
function addFormats2(ajv, list,
|
|
6728
|
+
function addFormats2(ajv, list, fs5, exportName) {
|
|
6729
6729
|
var _a;
|
|
6730
6730
|
var _b;
|
|
6731
6731
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6732
6732
|
for (const f of list)
|
|
6733
|
-
ajv.addFormat(f,
|
|
6733
|
+
ajv.addFormat(f, fs5[f]);
|
|
6734
6734
|
}
|
|
6735
6735
|
module.exports = exports = formatsPlugin;
|
|
6736
6736
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7024,17 +7024,17 @@
|
|
|
7024
7024
|
visit.BREAK = BREAK;
|
|
7025
7025
|
visit.SKIP = SKIP;
|
|
7026
7026
|
visit.REMOVE = REMOVE;
|
|
7027
|
-
function visit_(key, node, visitor,
|
|
7028
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
7027
|
+
function visit_(key, node, visitor, path5) {
|
|
7028
|
+
const ctrl = callVisitor(key, node, visitor, path5);
|
|
7029
7029
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
7030
|
-
replaceNode(key,
|
|
7031
|
-
return visit_(key, ctrl, visitor,
|
|
7030
|
+
replaceNode(key, path5, ctrl);
|
|
7031
|
+
return visit_(key, ctrl, visitor, path5);
|
|
7032
7032
|
}
|
|
7033
7033
|
if (typeof ctrl !== "symbol") {
|
|
7034
7034
|
if (identity.isCollection(node)) {
|
|
7035
|
-
|
|
7035
|
+
path5 = Object.freeze(path5.concat(node));
|
|
7036
7036
|
for (let i = 0; i < node.items.length; ++i) {
|
|
7037
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
7037
|
+
const ci = visit_(i, node.items[i], visitor, path5);
|
|
7038
7038
|
if (typeof ci === "number")
|
|
7039
7039
|
i = ci - 1;
|
|
7040
7040
|
else if (ci === BREAK)
|
|
@@ -7045,13 +7045,13 @@
|
|
|
7045
7045
|
}
|
|
7046
7046
|
}
|
|
7047
7047
|
} else if (identity.isPair(node)) {
|
|
7048
|
-
|
|
7049
|
-
const ck = visit_("key", node.key, visitor,
|
|
7048
|
+
path5 = Object.freeze(path5.concat(node));
|
|
7049
|
+
const ck = visit_("key", node.key, visitor, path5);
|
|
7050
7050
|
if (ck === BREAK)
|
|
7051
7051
|
return BREAK;
|
|
7052
7052
|
else if (ck === REMOVE)
|
|
7053
7053
|
node.key = null;
|
|
7054
|
-
const cv = visit_("value", node.value, visitor,
|
|
7054
|
+
const cv = visit_("value", node.value, visitor, path5);
|
|
7055
7055
|
if (cv === BREAK)
|
|
7056
7056
|
return BREAK;
|
|
7057
7057
|
else if (cv === REMOVE)
|
|
@@ -7072,17 +7072,17 @@
|
|
|
7072
7072
|
visitAsync.BREAK = BREAK;
|
|
7073
7073
|
visitAsync.SKIP = SKIP;
|
|
7074
7074
|
visitAsync.REMOVE = REMOVE;
|
|
7075
|
-
async function visitAsync_(key, node, visitor,
|
|
7076
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
7075
|
+
async function visitAsync_(key, node, visitor, path5) {
|
|
7076
|
+
const ctrl = await callVisitor(key, node, visitor, path5);
|
|
7077
7077
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
7078
|
-
replaceNode(key,
|
|
7079
|
-
return visitAsync_(key, ctrl, visitor,
|
|
7078
|
+
replaceNode(key, path5, ctrl);
|
|
7079
|
+
return visitAsync_(key, ctrl, visitor, path5);
|
|
7080
7080
|
}
|
|
7081
7081
|
if (typeof ctrl !== "symbol") {
|
|
7082
7082
|
if (identity.isCollection(node)) {
|
|
7083
|
-
|
|
7083
|
+
path5 = Object.freeze(path5.concat(node));
|
|
7084
7084
|
for (let i = 0; i < node.items.length; ++i) {
|
|
7085
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
7085
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path5);
|
|
7086
7086
|
if (typeof ci === "number")
|
|
7087
7087
|
i = ci - 1;
|
|
7088
7088
|
else if (ci === BREAK)
|
|
@@ -7093,13 +7093,13 @@
|
|
|
7093
7093
|
}
|
|
7094
7094
|
}
|
|
7095
7095
|
} else if (identity.isPair(node)) {
|
|
7096
|
-
|
|
7097
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
7096
|
+
path5 = Object.freeze(path5.concat(node));
|
|
7097
|
+
const ck = await visitAsync_("key", node.key, visitor, path5);
|
|
7098
7098
|
if (ck === BREAK)
|
|
7099
7099
|
return BREAK;
|
|
7100
7100
|
else if (ck === REMOVE)
|
|
7101
7101
|
node.key = null;
|
|
7102
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
7102
|
+
const cv = await visitAsync_("value", node.value, visitor, path5);
|
|
7103
7103
|
if (cv === BREAK)
|
|
7104
7104
|
return BREAK;
|
|
7105
7105
|
else if (cv === REMOVE)
|
|
@@ -7126,23 +7126,23 @@
|
|
|
7126
7126
|
}
|
|
7127
7127
|
return visitor;
|
|
7128
7128
|
}
|
|
7129
|
-
function callVisitor(key, node, visitor,
|
|
7129
|
+
function callVisitor(key, node, visitor, path5) {
|
|
7130
7130
|
if (typeof visitor === "function")
|
|
7131
|
-
return visitor(key, node,
|
|
7131
|
+
return visitor(key, node, path5);
|
|
7132
7132
|
if (identity.isMap(node))
|
|
7133
|
-
return visitor.Map?.(key, node,
|
|
7133
|
+
return visitor.Map?.(key, node, path5);
|
|
7134
7134
|
if (identity.isSeq(node))
|
|
7135
|
-
return visitor.Seq?.(key, node,
|
|
7135
|
+
return visitor.Seq?.(key, node, path5);
|
|
7136
7136
|
if (identity.isPair(node))
|
|
7137
|
-
return visitor.Pair?.(key, node,
|
|
7137
|
+
return visitor.Pair?.(key, node, path5);
|
|
7138
7138
|
if (identity.isScalar(node))
|
|
7139
|
-
return visitor.Scalar?.(key, node,
|
|
7139
|
+
return visitor.Scalar?.(key, node, path5);
|
|
7140
7140
|
if (identity.isAlias(node))
|
|
7141
|
-
return visitor.Alias?.(key, node,
|
|
7141
|
+
return visitor.Alias?.(key, node, path5);
|
|
7142
7142
|
return void 0;
|
|
7143
7143
|
}
|
|
7144
|
-
function replaceNode(key,
|
|
7145
|
-
const parent =
|
|
7144
|
+
function replaceNode(key, path5, node) {
|
|
7145
|
+
const parent = path5[path5.length - 1];
|
|
7146
7146
|
if (identity.isCollection(parent)) {
|
|
7147
7147
|
parent.items[key] = node;
|
|
7148
7148
|
} else if (identity.isPair(parent)) {
|
|
@@ -7740,10 +7740,10 @@
|
|
|
7740
7740
|
var createNode = require_createNode();
|
|
7741
7741
|
var identity = require_identity();
|
|
7742
7742
|
var Node = require_Node();
|
|
7743
|
-
function collectionFromPath(schema,
|
|
7743
|
+
function collectionFromPath(schema, path5, value) {
|
|
7744
7744
|
let v = value;
|
|
7745
|
-
for (let i =
|
|
7746
|
-
const k =
|
|
7745
|
+
for (let i = path5.length - 1; i >= 0; --i) {
|
|
7746
|
+
const k = path5[i];
|
|
7747
7747
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
7748
7748
|
const a = [];
|
|
7749
7749
|
a[k] = v;
|
|
@@ -7762,7 +7762,7 @@
|
|
|
7762
7762
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
7763
7763
|
});
|
|
7764
7764
|
}
|
|
7765
|
-
var isEmptyPath = (
|
|
7765
|
+
var isEmptyPath = (path5) => path5 == null || typeof path5 === "object" && !!path5[Symbol.iterator]().next().done;
|
|
7766
7766
|
var Collection = class extends Node.NodeBase {
|
|
7767
7767
|
constructor(type, schema) {
|
|
7768
7768
|
super(type);
|
|
@@ -7792,11 +7792,11 @@
|
|
|
7792
7792
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
7793
7793
|
* that already exists in the map.
|
|
7794
7794
|
*/
|
|
7795
|
-
addIn(
|
|
7796
|
-
if (isEmptyPath(
|
|
7795
|
+
addIn(path5, value) {
|
|
7796
|
+
if (isEmptyPath(path5))
|
|
7797
7797
|
this.add(value);
|
|
7798
7798
|
else {
|
|
7799
|
-
const [key, ...rest] =
|
|
7799
|
+
const [key, ...rest] = path5;
|
|
7800
7800
|
const node = this.get(key, true);
|
|
7801
7801
|
if (identity.isCollection(node))
|
|
7802
7802
|
node.addIn(rest, value);
|
|
@@ -7810,8 +7810,8 @@
|
|
|
7810
7810
|
* Removes a value from the collection.
|
|
7811
7811
|
* @returns `true` if the item was found and removed.
|
|
7812
7812
|
*/
|
|
7813
|
-
deleteIn(
|
|
7814
|
-
const [key, ...rest] =
|
|
7813
|
+
deleteIn(path5) {
|
|
7814
|
+
const [key, ...rest] = path5;
|
|
7815
7815
|
if (rest.length === 0)
|
|
7816
7816
|
return this.delete(key);
|
|
7817
7817
|
const node = this.get(key, true);
|
|
@@ -7825,8 +7825,8 @@
|
|
|
7825
7825
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7826
7826
|
* `true` (collections are always returned intact).
|
|
7827
7827
|
*/
|
|
7828
|
-
getIn(
|
|
7829
|
-
const [key, ...rest] =
|
|
7828
|
+
getIn(path5, keepScalar) {
|
|
7829
|
+
const [key, ...rest] = path5;
|
|
7830
7830
|
const node = this.get(key, true);
|
|
7831
7831
|
if (rest.length === 0)
|
|
7832
7832
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -7844,8 +7844,8 @@
|
|
|
7844
7844
|
/**
|
|
7845
7845
|
* Checks if the collection includes a value with the key `key`.
|
|
7846
7846
|
*/
|
|
7847
|
-
hasIn(
|
|
7848
|
-
const [key, ...rest] =
|
|
7847
|
+
hasIn(path5) {
|
|
7848
|
+
const [key, ...rest] = path5;
|
|
7849
7849
|
if (rest.length === 0)
|
|
7850
7850
|
return this.has(key);
|
|
7851
7851
|
const node = this.get(key, true);
|
|
@@ -7855,8 +7855,8 @@
|
|
|
7855
7855
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
7856
7856
|
* boolean to add/remove the item from the set.
|
|
7857
7857
|
*/
|
|
7858
|
-
setIn(
|
|
7859
|
-
const [key, ...rest] =
|
|
7858
|
+
setIn(path5, value) {
|
|
7859
|
+
const [key, ...rest] = path5;
|
|
7860
7860
|
if (rest.length === 0) {
|
|
7861
7861
|
this.set(key, value);
|
|
7862
7862
|
} else {
|
|
@@ -10360,9 +10360,9 @@ ${cn.comment}` : item.comment;
|
|
|
10360
10360
|
this.contents.add(value);
|
|
10361
10361
|
}
|
|
10362
10362
|
/** Adds a value to the document. */
|
|
10363
|
-
addIn(
|
|
10363
|
+
addIn(path5, value) {
|
|
10364
10364
|
if (assertCollection(this.contents))
|
|
10365
|
-
this.contents.addIn(
|
|
10365
|
+
this.contents.addIn(path5, value);
|
|
10366
10366
|
}
|
|
10367
10367
|
/**
|
|
10368
10368
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -10437,14 +10437,14 @@ ${cn.comment}` : item.comment;
|
|
|
10437
10437
|
* Removes a value from the document.
|
|
10438
10438
|
* @returns `true` if the item was found and removed.
|
|
10439
10439
|
*/
|
|
10440
|
-
deleteIn(
|
|
10441
|
-
if (Collection.isEmptyPath(
|
|
10440
|
+
deleteIn(path5) {
|
|
10441
|
+
if (Collection.isEmptyPath(path5)) {
|
|
10442
10442
|
if (this.contents == null)
|
|
10443
10443
|
return false;
|
|
10444
10444
|
this.contents = null;
|
|
10445
10445
|
return true;
|
|
10446
10446
|
}
|
|
10447
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
10447
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path5) : false;
|
|
10448
10448
|
}
|
|
10449
10449
|
/**
|
|
10450
10450
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -10459,10 +10459,10 @@ ${cn.comment}` : item.comment;
|
|
|
10459
10459
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
10460
10460
|
* `true` (collections are always returned intact).
|
|
10461
10461
|
*/
|
|
10462
|
-
getIn(
|
|
10463
|
-
if (Collection.isEmptyPath(
|
|
10462
|
+
getIn(path5, keepScalar) {
|
|
10463
|
+
if (Collection.isEmptyPath(path5))
|
|
10464
10464
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
10465
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
10465
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path5, keepScalar) : void 0;
|
|
10466
10466
|
}
|
|
10467
10467
|
/**
|
|
10468
10468
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -10473,10 +10473,10 @@ ${cn.comment}` : item.comment;
|
|
|
10473
10473
|
/**
|
|
10474
10474
|
* Checks if the document includes a value at `path`.
|
|
10475
10475
|
*/
|
|
10476
|
-
hasIn(
|
|
10477
|
-
if (Collection.isEmptyPath(
|
|
10476
|
+
hasIn(path5) {
|
|
10477
|
+
if (Collection.isEmptyPath(path5))
|
|
10478
10478
|
return this.contents !== void 0;
|
|
10479
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
10479
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path5) : false;
|
|
10480
10480
|
}
|
|
10481
10481
|
/**
|
|
10482
10482
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -10493,13 +10493,13 @@ ${cn.comment}` : item.comment;
|
|
|
10493
10493
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
10494
10494
|
* boolean to add/remove the item from the set.
|
|
10495
10495
|
*/
|
|
10496
|
-
setIn(
|
|
10497
|
-
if (Collection.isEmptyPath(
|
|
10496
|
+
setIn(path5, value) {
|
|
10497
|
+
if (Collection.isEmptyPath(path5)) {
|
|
10498
10498
|
this.contents = value;
|
|
10499
10499
|
} else if (this.contents == null) {
|
|
10500
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
10500
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path5), value);
|
|
10501
10501
|
} else if (assertCollection(this.contents)) {
|
|
10502
|
-
this.contents.setIn(
|
|
10502
|
+
this.contents.setIn(path5, value);
|
|
10503
10503
|
}
|
|
10504
10504
|
}
|
|
10505
10505
|
/**
|
|
@@ -12454,9 +12454,9 @@ ${end.comment}` : end.comment;
|
|
|
12454
12454
|
visit.BREAK = BREAK;
|
|
12455
12455
|
visit.SKIP = SKIP;
|
|
12456
12456
|
visit.REMOVE = REMOVE;
|
|
12457
|
-
visit.itemAtPath = (cst,
|
|
12457
|
+
visit.itemAtPath = (cst, path5) => {
|
|
12458
12458
|
let item = cst;
|
|
12459
|
-
for (const [field, index] of
|
|
12459
|
+
for (const [field, index] of path5) {
|
|
12460
12460
|
const tok = item?.[field];
|
|
12461
12461
|
if (tok && "items" in tok) {
|
|
12462
12462
|
item = tok.items[index];
|
|
@@ -12465,23 +12465,23 @@ ${end.comment}` : end.comment;
|
|
|
12465
12465
|
}
|
|
12466
12466
|
return item;
|
|
12467
12467
|
};
|
|
12468
|
-
visit.parentCollection = (cst,
|
|
12469
|
-
const parent = visit.itemAtPath(cst,
|
|
12470
|
-
const field =
|
|
12468
|
+
visit.parentCollection = (cst, path5) => {
|
|
12469
|
+
const parent = visit.itemAtPath(cst, path5.slice(0, -1));
|
|
12470
|
+
const field = path5[path5.length - 1][0];
|
|
12471
12471
|
const coll = parent?.[field];
|
|
12472
12472
|
if (coll && "items" in coll)
|
|
12473
12473
|
return coll;
|
|
12474
12474
|
throw new Error("Parent collection not found");
|
|
12475
12475
|
};
|
|
12476
|
-
function _visit(
|
|
12477
|
-
let ctrl = visitor(item,
|
|
12476
|
+
function _visit(path5, item, visitor) {
|
|
12477
|
+
let ctrl = visitor(item, path5);
|
|
12478
12478
|
if (typeof ctrl === "symbol")
|
|
12479
12479
|
return ctrl;
|
|
12480
12480
|
for (const field of ["key", "value"]) {
|
|
12481
12481
|
const token = item[field];
|
|
12482
12482
|
if (token && "items" in token) {
|
|
12483
12483
|
for (let i = 0; i < token.items.length; ++i) {
|
|
12484
|
-
const ci = _visit(Object.freeze(
|
|
12484
|
+
const ci = _visit(Object.freeze(path5.concat([[field, i]])), token.items[i], visitor);
|
|
12485
12485
|
if (typeof ci === "number")
|
|
12486
12486
|
i = ci - 1;
|
|
12487
12487
|
else if (ci === BREAK)
|
|
@@ -12492,10 +12492,10 @@ ${end.comment}` : end.comment;
|
|
|
12492
12492
|
}
|
|
12493
12493
|
}
|
|
12494
12494
|
if (typeof ctrl === "function" && field === "key")
|
|
12495
|
-
ctrl = ctrl(item,
|
|
12495
|
+
ctrl = ctrl(item, path5);
|
|
12496
12496
|
}
|
|
12497
12497
|
}
|
|
12498
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
12498
|
+
return typeof ctrl === "function" ? ctrl(item, path5) : ctrl;
|
|
12499
12499
|
}
|
|
12500
12500
|
exports.visit = visit;
|
|
12501
12501
|
}
|
|
@@ -13780,14 +13780,14 @@ ${end.comment}` : end.comment;
|
|
|
13780
13780
|
case "scalar":
|
|
13781
13781
|
case "single-quoted-scalar":
|
|
13782
13782
|
case "double-quoted-scalar": {
|
|
13783
|
-
const
|
|
13783
|
+
const fs5 = this.flowScalar(this.type);
|
|
13784
13784
|
if (atNextItem || it.value) {
|
|
13785
|
-
map.items.push({ start, key:
|
|
13785
|
+
map.items.push({ start, key: fs5, sep: [] });
|
|
13786
13786
|
this.onKeyLine = true;
|
|
13787
13787
|
} else if (it.sep) {
|
|
13788
|
-
this.stack.push(
|
|
13788
|
+
this.stack.push(fs5);
|
|
13789
13789
|
} else {
|
|
13790
|
-
Object.assign(it, { key:
|
|
13790
|
+
Object.assign(it, { key: fs5, sep: [] });
|
|
13791
13791
|
this.onKeyLine = true;
|
|
13792
13792
|
}
|
|
13793
13793
|
return;
|
|
@@ -13905,13 +13905,13 @@ ${end.comment}` : end.comment;
|
|
|
13905
13905
|
case "scalar":
|
|
13906
13906
|
case "single-quoted-scalar":
|
|
13907
13907
|
case "double-quoted-scalar": {
|
|
13908
|
-
const
|
|
13908
|
+
const fs5 = this.flowScalar(this.type);
|
|
13909
13909
|
if (!it || it.value)
|
|
13910
|
-
fc.items.push({ start: [], key:
|
|
13910
|
+
fc.items.push({ start: [], key: fs5, sep: [] });
|
|
13911
13911
|
else if (it.sep)
|
|
13912
|
-
this.stack.push(
|
|
13912
|
+
this.stack.push(fs5);
|
|
13913
13913
|
else
|
|
13914
|
-
Object.assign(it, { key:
|
|
13914
|
+
Object.assign(it, { key: fs5, sep: [] });
|
|
13915
13915
|
return;
|
|
13916
13916
|
}
|
|
13917
13917
|
case "flow-map-end":
|
|
@@ -14236,8 +14236,6 @@ ${end.comment}` : end.comment;
|
|
|
14236
14236
|
// src/parse-config.ts
|
|
14237
14237
|
var import_ajv = __toESM(require_ajv());
|
|
14238
14238
|
var import_ajv_formats = __toESM(require_dist());
|
|
14239
|
-
var import_fs5 = __toESM(__require("fs"));
|
|
14240
|
-
var import_path4 = __toESM(__require("path"));
|
|
14241
14239
|
|
|
14242
14240
|
// ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.js
|
|
14243
14241
|
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
@@ -15819,16 +15817,16 @@ ${end.comment}` : end.comment;
|
|
|
15819
15817
|
const errors = [];
|
|
15820
15818
|
const warnings = [];
|
|
15821
15819
|
if (config.functions != null) {
|
|
15822
|
-
for (const [
|
|
15823
|
-
const settings = getFunctionSettings(
|
|
15820
|
+
for (const [path5, func] of Object.entries(config.functions)) {
|
|
15821
|
+
const settings = getFunctionSettings(path5, config);
|
|
15824
15822
|
if (settings == null) {
|
|
15825
|
-
throw new Error(`Settings invalid for function at path '${
|
|
15823
|
+
throw new Error(`Settings invalid for function at path '${path5}'`);
|
|
15826
15824
|
}
|
|
15827
|
-
(await getFilesForPattern(
|
|
15825
|
+
(await getFilesForPattern(path5, projectFolder, func.excludeFiles)).forEach((file) => {
|
|
15828
15826
|
if (entrypoints.find((entrypoint) => entrypoint.path === file)) {
|
|
15829
15827
|
return;
|
|
15830
15828
|
}
|
|
15831
|
-
if (config.functions != null && Object.keys(config.functions).find((func2) => func2 === file && func2 !==
|
|
15829
|
+
if (config.functions != null && Object.keys(config.functions).find((func2) => func2 === file && func2 !== path5)) {
|
|
15832
15830
|
return;
|
|
15833
15831
|
}
|
|
15834
15832
|
entrypoints.push({
|
|
@@ -15891,10 +15889,10 @@ ${end.comment}` : end.comment;
|
|
|
15891
15889
|
})
|
|
15892
15890
|
};
|
|
15893
15891
|
};
|
|
15894
|
-
var getFunctionSettings = (
|
|
15892
|
+
var getFunctionSettings = (path5, config) => {
|
|
15895
15893
|
let functionSettings;
|
|
15896
15894
|
for (const [key, value] of Object.entries(config.functions ?? {})) {
|
|
15897
|
-
if (minimatch(
|
|
15895
|
+
if (minimatch(path5, key) || new RegExp(key).test(path5)) {
|
|
15898
15896
|
if (functionSettings == null) {
|
|
15899
15897
|
functionSettings = {
|
|
15900
15898
|
memory: 128,
|
|
@@ -15931,8 +15929,343 @@ ${end.comment}` : end.comment;
|
|
|
15931
15929
|
return functionSettings;
|
|
15932
15930
|
};
|
|
15933
15931
|
|
|
15932
|
+
// src/v4/schema.json
|
|
15933
|
+
var schema_default = {
|
|
15934
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
15935
|
+
title: "Config V4",
|
|
15936
|
+
description: "Configuration schema for version 4",
|
|
15937
|
+
type: "object",
|
|
15938
|
+
required: ["version"],
|
|
15939
|
+
properties: {
|
|
15940
|
+
version: {
|
|
15941
|
+
type: "integer",
|
|
15942
|
+
enum: [4],
|
|
15943
|
+
description: "The version of the configuration file"
|
|
15944
|
+
},
|
|
15945
|
+
presets: {
|
|
15946
|
+
type: ["array", "null"],
|
|
15947
|
+
items: {
|
|
15948
|
+
type: "string",
|
|
15949
|
+
format: "uri"
|
|
15950
|
+
},
|
|
15951
|
+
description: "A list of presets to apply to the project. Each preset will be applied in order."
|
|
15952
|
+
},
|
|
15953
|
+
assets: {
|
|
15954
|
+
type: ["string", "null"],
|
|
15955
|
+
description: "The folder which holds the assets to be deployed to the edge. Defaults to none."
|
|
15956
|
+
},
|
|
15957
|
+
populateAssetCache: {
|
|
15958
|
+
type: ["boolean", "null"],
|
|
15959
|
+
description: "If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false."
|
|
15960
|
+
},
|
|
15961
|
+
regions: {
|
|
15962
|
+
type: ["array", "null"],
|
|
15963
|
+
description: 'The regions to which the project will be deployed. Use "global" to deploy to all regions. More regions will incur higher costs.',
|
|
15964
|
+
items: {
|
|
15965
|
+
type: "string"
|
|
15966
|
+
}
|
|
15967
|
+
},
|
|
15968
|
+
build_commands: {
|
|
15969
|
+
type: ["array", "null"],
|
|
15970
|
+
description: "The commands to run to build the project. For example, `bun install` or `npm install`.",
|
|
15971
|
+
items: {
|
|
15972
|
+
type: "string"
|
|
15973
|
+
}
|
|
15974
|
+
},
|
|
15975
|
+
functions: {
|
|
15976
|
+
type: ["object", "null"],
|
|
15977
|
+
description: "The serverless functions to deploy.",
|
|
15978
|
+
additionalProperties: {
|
|
15979
|
+
type: "object",
|
|
15980
|
+
properties: {
|
|
15981
|
+
memory: {
|
|
15982
|
+
type: "number",
|
|
15983
|
+
description: "The memory in MB to allocate to the function. Defaults to 128.",
|
|
15984
|
+
maximum: 3009,
|
|
15985
|
+
minimum: 128
|
|
15986
|
+
},
|
|
15987
|
+
max_duration: {
|
|
15988
|
+
type: "number",
|
|
15989
|
+
description: "The max duration in seconds for the function after which it will be terminated. Defaults to 30.",
|
|
15990
|
+
maximum: 900,
|
|
15991
|
+
minimum: 1
|
|
15992
|
+
},
|
|
15993
|
+
runtime: {
|
|
15994
|
+
$ref: "#/$defs/runtimes",
|
|
15995
|
+
description: "The runtime to use for the function."
|
|
15996
|
+
},
|
|
15997
|
+
schedule: {
|
|
15998
|
+
type: "string",
|
|
15999
|
+
description: "An expression to schedule the function to run at specific times.",
|
|
16000
|
+
pattern: "^(?:rate[(](?:(?:1[ ]+(hour|minute|day))|(?:[0-9]+[ ]+(hours|minutes|days)))[)])|(?:cron[(](?:(?:(?:[0-5]?[0-9])|[*])(?:(?:[-](?:(?:[0-5]?[0-9])|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[0-5]?[0-9])|[*])(?:(?:[-](?:(?:[0-5]?[0-9])|[*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[0-2]?[0-9])|[*])(?:(?:[-](?:(?:[0-2]?[0-9])|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[0-2]?[0-9])|[*])(?:(?:[-](?:(?:[0-2]?[0-9])|[*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:[?][ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))[#][0-5])|(?:(?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*])(?:(?:[-](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*])(?:(?:[-](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*]))|(?:[/][0-9]+))?)*)))|(?:(?:(?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+[?]))[ ]+(?:(?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?)*)[)])$"
|
|
16001
|
+
},
|
|
16002
|
+
symlinks: {
|
|
16003
|
+
type: "object",
|
|
16004
|
+
description: "A list of symbolic links to create in the function's package.",
|
|
16005
|
+
maxProperties: 100,
|
|
16006
|
+
minProperties: 1,
|
|
16007
|
+
patternProperties: {
|
|
16008
|
+
"^.{1,256}$": {
|
|
16009
|
+
type: "string",
|
|
16010
|
+
maxLength: 256
|
|
16011
|
+
}
|
|
16012
|
+
},
|
|
16013
|
+
additionalProperties: false
|
|
16014
|
+
},
|
|
16015
|
+
excludeFiles: {
|
|
16016
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
|
|
16017
|
+
description: "A glob pattern to match files that should be excluded from your Serverless Function. If you're using a Community Runtime, the behavior might vary."
|
|
16018
|
+
},
|
|
16019
|
+
includeFiles: {
|
|
16020
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
|
|
16021
|
+
description: "A glob pattern to match files that should be included in your Serverless Function. If you're using a Community Runtime, the behavior might vary."
|
|
16022
|
+
}
|
|
16023
|
+
}
|
|
16024
|
+
}
|
|
16025
|
+
},
|
|
16026
|
+
env: {
|
|
16027
|
+
type: "object",
|
|
16028
|
+
maxProperties: 100,
|
|
16029
|
+
minProperties: 0,
|
|
16030
|
+
patternProperties: {
|
|
16031
|
+
".+": {
|
|
16032
|
+
maxLength: 65536,
|
|
16033
|
+
minLength: 0,
|
|
16034
|
+
type: "string"
|
|
16035
|
+
}
|
|
16036
|
+
},
|
|
16037
|
+
additionalProperties: false,
|
|
16038
|
+
description: "Additional environment variables to set during runtime and build."
|
|
16039
|
+
},
|
|
16040
|
+
routes: {
|
|
16041
|
+
type: ["array", "null"],
|
|
16042
|
+
description: "A list of route definitions.",
|
|
16043
|
+
maxItems: 1024,
|
|
16044
|
+
items: {
|
|
16045
|
+
type: "object",
|
|
16046
|
+
required: ["source", "destination"],
|
|
16047
|
+
properties: {
|
|
16048
|
+
source: {
|
|
16049
|
+
description: "A pattern that matches each incoming pathname (excluding querystring).",
|
|
16050
|
+
type: "string",
|
|
16051
|
+
maxLength: 4096
|
|
16052
|
+
},
|
|
16053
|
+
destination: {
|
|
16054
|
+
description: "An absolute pathname to an existing resource or an external URL.",
|
|
16055
|
+
type: "string",
|
|
16056
|
+
maxLength: 4096
|
|
16057
|
+
},
|
|
16058
|
+
has: {
|
|
16059
|
+
$ref: "#/$defs/matchRequirements"
|
|
16060
|
+
},
|
|
16061
|
+
missing: {
|
|
16062
|
+
$ref: "#/$defs/matchRequirements"
|
|
16063
|
+
},
|
|
16064
|
+
statusCode: {
|
|
16065
|
+
description: "An optional integer to override the status code of the response.",
|
|
16066
|
+
type: "integer",
|
|
16067
|
+
minimum: 100,
|
|
16068
|
+
maximum: 999
|
|
16069
|
+
},
|
|
16070
|
+
redirect: {
|
|
16071
|
+
type: "boolean",
|
|
16072
|
+
description: "An optional boolean to force a redirect response."
|
|
16073
|
+
},
|
|
16074
|
+
methods: {
|
|
16075
|
+
type: "array",
|
|
16076
|
+
description: "The HTTP methods to match for the route. Defaults to all methods.",
|
|
16077
|
+
items: {
|
|
16078
|
+
type: "string",
|
|
16079
|
+
enum: ["ANY", "GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
|
|
16080
|
+
}
|
|
16081
|
+
},
|
|
16082
|
+
headers: {
|
|
16083
|
+
type: "object",
|
|
16084
|
+
description: "Additional headers to add to the response.",
|
|
16085
|
+
additionalProperties: {
|
|
16086
|
+
type: "string"
|
|
16087
|
+
}
|
|
16088
|
+
}
|
|
16089
|
+
}
|
|
16090
|
+
}
|
|
16091
|
+
},
|
|
16092
|
+
services: {
|
|
16093
|
+
type: "object",
|
|
16094
|
+
description: "Optionally, specify additional services like databases to deploy.",
|
|
16095
|
+
properties: {
|
|
16096
|
+
redis: {
|
|
16097
|
+
oneOf: [
|
|
16098
|
+
{
|
|
16099
|
+
type: "null"
|
|
16100
|
+
},
|
|
16101
|
+
{
|
|
16102
|
+
type: "object",
|
|
16103
|
+
properties: {
|
|
16104
|
+
envBindings: {
|
|
16105
|
+
type: "object",
|
|
16106
|
+
description: "Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'REDIS_URL' }` will bind the `url` environment variable to the Redis URL. If you don't specify any bindings, they will be bound to the REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_DB, and REDIS_SSL environment variables.",
|
|
16107
|
+
additionalProperties: false,
|
|
16108
|
+
properties: {
|
|
16109
|
+
url: { type: "string" },
|
|
16110
|
+
host: { type: "string" },
|
|
16111
|
+
port: { type: "string" },
|
|
16112
|
+
password: { type: "string" },
|
|
16113
|
+
db: { type: "string" },
|
|
16114
|
+
ssl: { type: "string" }
|
|
16115
|
+
}
|
|
16116
|
+
},
|
|
16117
|
+
primaryRegion: {
|
|
16118
|
+
type: "string",
|
|
16119
|
+
description: "The primary region to deploy the Redis instance to.",
|
|
16120
|
+
enum: [
|
|
16121
|
+
"us-east-1",
|
|
16122
|
+
"us-east-2",
|
|
16123
|
+
"us-west-1",
|
|
16124
|
+
"us-west-2",
|
|
16125
|
+
"eu-central-1",
|
|
16126
|
+
"eu-west-1",
|
|
16127
|
+
"eu-west-2",
|
|
16128
|
+
"sa-east-1",
|
|
16129
|
+
"ap-south-1",
|
|
16130
|
+
"ap-northeast-1",
|
|
16131
|
+
"ap-southeast-1",
|
|
16132
|
+
"ap-southeast-2",
|
|
16133
|
+
"us-central1"
|
|
16134
|
+
]
|
|
16135
|
+
},
|
|
16136
|
+
readRegions: {
|
|
16137
|
+
type: "array",
|
|
16138
|
+
description: "Optionally, add additional regions to read from. More regions will incur higher costs.",
|
|
16139
|
+
items: {
|
|
16140
|
+
type: "string",
|
|
16141
|
+
enum: [
|
|
16142
|
+
"us-east-1",
|
|
16143
|
+
"us-east-2",
|
|
16144
|
+
"us-west-1",
|
|
16145
|
+
"us-west-2",
|
|
16146
|
+
"eu-central-1",
|
|
16147
|
+
"eu-west-1",
|
|
16148
|
+
"eu-west-2",
|
|
16149
|
+
"sa-east-1",
|
|
16150
|
+
"ap-south-1",
|
|
16151
|
+
"ap-northeast-1",
|
|
16152
|
+
"ap-southeast-1",
|
|
16153
|
+
"ap-southeast-2"
|
|
16154
|
+
]
|
|
16155
|
+
}
|
|
16156
|
+
},
|
|
16157
|
+
eviction: {
|
|
16158
|
+
type: "boolean",
|
|
16159
|
+
description: "Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones."
|
|
16160
|
+
}
|
|
16161
|
+
}
|
|
16162
|
+
}
|
|
16163
|
+
]
|
|
16164
|
+
},
|
|
16165
|
+
postgres: {
|
|
16166
|
+
oneOf: [
|
|
16167
|
+
{
|
|
16168
|
+
type: "null"
|
|
16169
|
+
},
|
|
16170
|
+
{
|
|
16171
|
+
type: "object",
|
|
16172
|
+
properties: {
|
|
16173
|
+
envBindings: {
|
|
16174
|
+
type: "object",
|
|
16175
|
+
description: "Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'POSTGRES_URL' }` will bind the `url` environment variable to the Postgres URL. If you don't specify any bindings, they will be bound to the POSTGRES_URL, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DATABASE environment variables.",
|
|
16176
|
+
additionalProperties: false,
|
|
16177
|
+
properties: {
|
|
16178
|
+
url: { type: "string" },
|
|
16179
|
+
host: { type: "string" },
|
|
16180
|
+
port: { type: "string" },
|
|
16181
|
+
user: { type: "string" },
|
|
16182
|
+
password: { type: "string" },
|
|
16183
|
+
database: { type: "string" }
|
|
16184
|
+
}
|
|
16185
|
+
},
|
|
16186
|
+
postgresVersion: {
|
|
16187
|
+
type: "string",
|
|
16188
|
+
description: "The version of Postgres to deploy.",
|
|
16189
|
+
enum: ["17", "16", "15", "14"]
|
|
16190
|
+
},
|
|
16191
|
+
region: {
|
|
16192
|
+
type: "string",
|
|
16193
|
+
description: "The region to deploy the Postgres instance to.",
|
|
16194
|
+
enum: [
|
|
16195
|
+
"us-east-1",
|
|
16196
|
+
"us-east-2",
|
|
16197
|
+
"us-west-2",
|
|
16198
|
+
"ap-southeast-1",
|
|
16199
|
+
"ap-southeast-2",
|
|
16200
|
+
"eu-central-1",
|
|
16201
|
+
"eu-west-2",
|
|
16202
|
+
"sa-east-1"
|
|
16203
|
+
]
|
|
16204
|
+
}
|
|
16205
|
+
}
|
|
16206
|
+
}
|
|
16207
|
+
]
|
|
16208
|
+
}
|
|
16209
|
+
}
|
|
16210
|
+
}
|
|
16211
|
+
},
|
|
16212
|
+
$defs: {
|
|
16213
|
+
runtimes: {
|
|
16214
|
+
type: "string",
|
|
16215
|
+
enum: ["php-83", "php-82", "php-81", "php-80", "node-20", "node-18", "node-16", "bun-1"]
|
|
16216
|
+
},
|
|
16217
|
+
matchRequirements: {
|
|
16218
|
+
description: "An array of requirements that are needed to match",
|
|
16219
|
+
type: "array",
|
|
16220
|
+
maxItems: 16,
|
|
16221
|
+
items: {
|
|
16222
|
+
anyOf: [
|
|
16223
|
+
{
|
|
16224
|
+
type: "object",
|
|
16225
|
+
additionalProperties: false,
|
|
16226
|
+
required: ["type", "value"],
|
|
16227
|
+
properties: {
|
|
16228
|
+
type: {
|
|
16229
|
+
description: "The type of request element to check",
|
|
16230
|
+
type: "string",
|
|
16231
|
+
enum: ["host"]
|
|
16232
|
+
},
|
|
16233
|
+
value: {
|
|
16234
|
+
description: "A regular expression used to match the value. Named groups can be used in the destination",
|
|
16235
|
+
type: "string",
|
|
16236
|
+
maxLength: 4096
|
|
16237
|
+
}
|
|
16238
|
+
}
|
|
16239
|
+
},
|
|
16240
|
+
{
|
|
16241
|
+
type: "object",
|
|
16242
|
+
additionalProperties: false,
|
|
16243
|
+
required: ["type", "key"],
|
|
16244
|
+
properties: {
|
|
16245
|
+
type: {
|
|
16246
|
+
description: "The type of request element to check",
|
|
16247
|
+
type: "string",
|
|
16248
|
+
enum: ["header", "cookie", "query"]
|
|
16249
|
+
},
|
|
16250
|
+
key: {
|
|
16251
|
+
description: "The name of the element contained in the particular type",
|
|
16252
|
+
type: "string",
|
|
16253
|
+
maxLength: 4096
|
|
16254
|
+
},
|
|
16255
|
+
value: {
|
|
16256
|
+
description: "A regular expression used to match the value. Named groups can be used in the destination",
|
|
16257
|
+
type: "string",
|
|
16258
|
+
maxLength: 4096
|
|
16259
|
+
}
|
|
16260
|
+
}
|
|
16261
|
+
}
|
|
16262
|
+
]
|
|
16263
|
+
}
|
|
16264
|
+
}
|
|
16265
|
+
}
|
|
16266
|
+
};
|
|
16267
|
+
|
|
15934
16268
|
// src/parse-config.ts
|
|
15935
|
-
var schemaV4 = JSON.parse(import_fs5.default.readFileSync(import_path4.default.join(__dirname, "./v4/schema.json"), "utf8"));
|
|
15936
16269
|
var parseConfig = async (filePath, projectFolder) => {
|
|
15937
16270
|
const parsed = await parseRawConfig(filePath);
|
|
15938
16271
|
const version = parsed.version;
|
|
@@ -15940,7 +16273,7 @@ ${end.comment}` : end.comment;
|
|
|
15940
16273
|
/*1: schemaV1,
|
|
15941
16274
|
2: schemaV2,
|
|
15942
16275
|
3: schemaV3,*/
|
|
15943
|
-
4:
|
|
16276
|
+
4: schema_default
|
|
15944
16277
|
};
|
|
15945
16278
|
const relativePath = filePath.replace("/tmp/unzipped/", "");
|
|
15946
16279
|
const schema = schemaMap[version];
|