@valkyrjaio/sindri 26.1.3 → 26.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.
- package/dist/bin/sindri.cjs +580 -309
- package/package.json +2 -2
- package/src/Sindri/Ast/Abstract/AstReader.ts +80 -0
- package/src/Sindri/Ast/CliRouteAttributeReader.ts +11 -11
- package/src/Sindri/Ast/ComponentProviderReader.ts +9 -5
- package/src/Sindri/Ast/ConfigReader.ts +14 -6
- package/src/Sindri/Ast/Contract/HttpRouteMiddlewareReaderContract.ts +1 -1
- package/src/Sindri/Ast/Data/CliRouteData.ts +1 -1
- package/src/Sindri/Ast/Data/Contract/CliRouteDataContract.ts +1 -1
- package/src/Sindri/Ast/Data/Contract/HttpRouteDataContract.ts +1 -1
- package/src/Sindri/Ast/Data/HttpRouteData.ts +1 -1
- package/src/Sindri/Ast/HttpRouteAttributeReader.ts +2 -2
- package/src/Sindri/Ast/HttpRouteMiddlewareReader.ts +9 -9
- package/src/Sindri/Ast/RouteProviderReader.ts +24 -3
- package/src/Sindri/Constant/SindriInfo.ts +2 -2
- package/src/Sindri/Generate/Abstract/GenerateDataFromAst.ts +66 -13
- package/src/Sindri/Generator/Abstract/AstFileGenerator.ts +13 -0
- package/src/Sindri/Generator/Ast/Cli/AstCliDataFileGenerator.ts +47 -11
- package/src/Sindri/Generator/Ast/Container/AstContainerDataFileGenerator.ts +4 -9
- package/src/Sindri/Generator/Ast/Event/AstEventDataFileGenerator.ts +13 -7
- package/src/Sindri/Generator/Ast/Http/AstHttpDataFileGenerator.ts +176 -12
- package/src/Sindri/Generator/Cli/Contract/CliDataFileGeneratorContract.ts +10 -0
- package/src/Sindri/Generator/Container/Contract/ContainerDataFileGeneratorContract.ts +3 -0
- package/src/Sindri/Generator/Http/Contract/HttpDataFileGeneratorContract.ts +10 -0
package/dist/bin/sindri.cjs
CHANGED
|
@@ -33,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
// node_modules/@ts-morph/common/dist/typescript.js
|
|
34
34
|
var require_typescript = __commonJS({
|
|
35
35
|
"node_modules/@ts-morph/common/dist/typescript.js"(exports2, module2) {
|
|
36
|
-
var
|
|
36
|
+
var ts13 = {};
|
|
37
37
|
((module3) => {
|
|
38
38
|
"use strict";
|
|
39
39
|
var __defProp2 = Object.defineProperty;
|
|
@@ -9433,11 +9433,11 @@ ${lanes.join("\n")}
|
|
|
9433
9433
|
return toComponents;
|
|
9434
9434
|
}
|
|
9435
9435
|
const components = toComponents.slice(start);
|
|
9436
|
-
const
|
|
9436
|
+
const relative2 = [];
|
|
9437
9437
|
for (; start < fromComponents.length; start++) {
|
|
9438
|
-
|
|
9438
|
+
relative2.push("..");
|
|
9439
9439
|
}
|
|
9440
|
-
return ["", ...
|
|
9440
|
+
return ["", ...relative2, ...components];
|
|
9441
9441
|
}
|
|
9442
9442
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
9443
9443
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -48133,11 +48133,11 @@ ${lanes.join("\n")}
|
|
|
48133
48133
|
if (i < rootLength) {
|
|
48134
48134
|
return void 0;
|
|
48135
48135
|
}
|
|
48136
|
-
const
|
|
48137
|
-
if (
|
|
48136
|
+
const sep2 = directory.lastIndexOf(directorySeparator, i - 1);
|
|
48137
|
+
if (sep2 === -1) {
|
|
48138
48138
|
return void 0;
|
|
48139
48139
|
}
|
|
48140
|
-
return directory.substr(0, Math.max(
|
|
48140
|
+
return directory.substr(0, Math.max(sep2, rootLength));
|
|
48141
48141
|
}
|
|
48142
48142
|
}
|
|
48143
48143
|
}
|
|
@@ -53980,9 +53980,9 @@ ${lanes.join("\n")}
|
|
|
53980
53980
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
53981
53981
|
return;
|
|
53982
53982
|
}
|
|
53983
|
-
const
|
|
53983
|
+
const relative2 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
53984
53984
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
53985
|
-
const option = resolvePath(symlinkDirectory,
|
|
53985
|
+
const option = resolvePath(symlinkDirectory, relative2);
|
|
53986
53986
|
const result2 = cb(option, target === referenceRedirect);
|
|
53987
53987
|
shouldFilterIgnoredPaths = true;
|
|
53988
53988
|
if (result2) return result2;
|
|
@@ -137157,9 +137157,9 @@ ${lanes.join("\n")}
|
|
|
137157
137157
|
/*ignoreCase*/
|
|
137158
137158
|
false
|
|
137159
137159
|
)) {
|
|
137160
|
-
const
|
|
137161
|
-
if (
|
|
137162
|
-
const name = removeSuffix(removePrefix(
|
|
137160
|
+
const basename2 = getBaseFileName(a.fileName);
|
|
137161
|
+
if (basename2 === "lib.d.ts" || basename2 === "lib.es6.d.ts") return 0;
|
|
137162
|
+
const name = removeSuffix(removePrefix(basename2, "lib."), ".d.ts");
|
|
137163
137163
|
const index = libs.indexOf(name);
|
|
137164
137164
|
if (index !== -1) return index + 1;
|
|
137165
137165
|
}
|
|
@@ -201085,8 +201085,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
201085
201085
|
}
|
|
201086
201086
|
};
|
|
201087
201087
|
for (const file of files) {
|
|
201088
|
-
const
|
|
201089
|
-
if (
|
|
201088
|
+
const basename2 = getBaseFileName(file);
|
|
201089
|
+
if (basename2 === "package.json" || basename2 === "bower.json") {
|
|
201090
201090
|
createProjectWatcher(
|
|
201091
201091
|
file,
|
|
201092
201092
|
"FileWatcher"
|
|
@@ -204770,8 +204770,8 @@ All files are: ${JSON.stringify(names)}`,
|
|
|
204770
204770
|
var _a;
|
|
204771
204771
|
const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
|
|
204772
204772
|
if (!fileOrDirectoryPath) return;
|
|
204773
|
-
const
|
|
204774
|
-
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (
|
|
204773
|
+
const basename2 = getBaseFileName(fileOrDirectoryPath);
|
|
204774
|
+
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename2 === "package.json" || basename2 === "node_modules")) {
|
|
204775
204775
|
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
204776
204776
|
var _a2;
|
|
204777
204777
|
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
@@ -211530,9 +211530,9 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
211530
211530
|
};
|
|
211531
211531
|
}
|
|
211532
211532
|
})({ get exports() {
|
|
211533
|
-
return
|
|
211533
|
+
return ts13;
|
|
211534
211534
|
}, set exports(v) {
|
|
211535
|
-
|
|
211535
|
+
ts13 = v;
|
|
211536
211536
|
if (typeof module2 !== "undefined" && module2.exports) {
|
|
211537
211537
|
module2.exports = v;
|
|
211538
211538
|
}
|
|
@@ -211607,7 +211607,7 @@ var require_commonjs2 = __commonJS({
|
|
|
211607
211607
|
"node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
|
|
211608
211608
|
"use strict";
|
|
211609
211609
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
211610
|
-
exports2.EXPANSION_MAX = void 0;
|
|
211610
|
+
exports2.EXPANSION_MAX_LENGTH = exports2.EXPANSION_MAX = void 0;
|
|
211611
211611
|
exports2.expand = expand;
|
|
211612
211612
|
var balanced_match_1 = require_commonjs();
|
|
211613
211613
|
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
@@ -211626,6 +211626,7 @@ var require_commonjs2 = __commonJS({
|
|
|
211626
211626
|
var commaPattern = /\\,/g;
|
|
211627
211627
|
var periodPattern = /\\\./g;
|
|
211628
211628
|
exports2.EXPANSION_MAX = 1e5;
|
|
211629
|
+
exports2.EXPANSION_MAX_LENGTH = 4e6;
|
|
211629
211630
|
function numeric(str) {
|
|
211630
211631
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
211631
211632
|
}
|
|
@@ -211660,11 +211661,11 @@ var require_commonjs2 = __commonJS({
|
|
|
211660
211661
|
if (!str) {
|
|
211661
211662
|
return [];
|
|
211662
211663
|
}
|
|
211663
|
-
const { max = exports2.EXPANSION_MAX } = options;
|
|
211664
|
+
const { max = exports2.EXPANSION_MAX, maxLength = exports2.EXPANSION_MAX_LENGTH } = options;
|
|
211664
211665
|
if (str.slice(0, 2) === "{}") {
|
|
211665
211666
|
str = "\\{\\}" + str.slice(2);
|
|
211666
211667
|
}
|
|
211667
|
-
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
211668
|
+
return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
|
|
211668
211669
|
}
|
|
211669
211670
|
function embrace(str) {
|
|
211670
211671
|
return "{" + str + "}";
|
|
@@ -211678,19 +211679,84 @@ var require_commonjs2 = __commonJS({
|
|
|
211678
211679
|
function gte(i, y) {
|
|
211679
211680
|
return i >= y;
|
|
211680
211681
|
}
|
|
211681
|
-
function
|
|
211682
|
-
const
|
|
211683
|
-
|
|
211684
|
-
|
|
211685
|
-
|
|
211686
|
-
|
|
211687
|
-
|
|
211688
|
-
|
|
211689
|
-
|
|
211690
|
-
|
|
211691
|
-
|
|
211682
|
+
function combine(acc, pre, values, max, maxLength, dropEmpties) {
|
|
211683
|
+
const out = [];
|
|
211684
|
+
let length = 0;
|
|
211685
|
+
for (let a = 0; a < acc.length; a++) {
|
|
211686
|
+
for (let v = 0; v < values.length; v++) {
|
|
211687
|
+
if (out.length >= max)
|
|
211688
|
+
return out;
|
|
211689
|
+
const expansion = acc[a] + pre + values[v];
|
|
211690
|
+
if (dropEmpties && !expansion)
|
|
211691
|
+
continue;
|
|
211692
|
+
if (length + expansion.length > maxLength)
|
|
211693
|
+
return out;
|
|
211694
|
+
out.push(expansion);
|
|
211695
|
+
length += expansion.length;
|
|
211696
|
+
}
|
|
211697
|
+
}
|
|
211698
|
+
return out;
|
|
211699
|
+
}
|
|
211700
|
+
function expandSequence(body, isAlphaSequence, max) {
|
|
211701
|
+
const n = body.split(/\.\./);
|
|
211702
|
+
const N = [];
|
|
211703
|
+
if (n[0] === void 0 || n[1] === void 0) {
|
|
211704
|
+
return N;
|
|
211705
|
+
}
|
|
211706
|
+
const x = numeric(n[0]);
|
|
211707
|
+
const y = numeric(n[1]);
|
|
211708
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
211709
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
211710
|
+
let test = lte;
|
|
211711
|
+
const reverse = y < x;
|
|
211712
|
+
if (reverse) {
|
|
211713
|
+
incr *= -1;
|
|
211714
|
+
test = gte;
|
|
211715
|
+
}
|
|
211716
|
+
const pad = n.some(isPadded);
|
|
211717
|
+
for (let i = x; test(i, y) && N.length < max; i += incr) {
|
|
211718
|
+
let c;
|
|
211719
|
+
if (isAlphaSequence) {
|
|
211720
|
+
c = String.fromCharCode(i);
|
|
211721
|
+
if (c === "\\") {
|
|
211722
|
+
c = "";
|
|
211723
|
+
}
|
|
211724
|
+
} else {
|
|
211725
|
+
c = String(i);
|
|
211726
|
+
if (pad) {
|
|
211727
|
+
const need = width - c.length;
|
|
211728
|
+
if (need > 0) {
|
|
211729
|
+
const z = new Array(need + 1).join("0");
|
|
211730
|
+
if (i < 0) {
|
|
211731
|
+
c = "-" + z + c.slice(1);
|
|
211732
|
+
} else {
|
|
211733
|
+
c = z + c;
|
|
211734
|
+
}
|
|
211735
|
+
}
|
|
211736
|
+
}
|
|
211737
|
+
}
|
|
211738
|
+
N.push(c);
|
|
211739
|
+
}
|
|
211740
|
+
return N;
|
|
211741
|
+
}
|
|
211742
|
+
function expand_(str, max, maxLength, isTop) {
|
|
211743
|
+
let acc = [""];
|
|
211744
|
+
let dropEmpties = false;
|
|
211745
|
+
let firstGroup = true;
|
|
211746
|
+
for (; ; ) {
|
|
211747
|
+
const m = (0, balanced_match_1.balanced)("{", "}", str);
|
|
211748
|
+
if (!m) {
|
|
211749
|
+
return combine(acc, str, [""], max, maxLength, dropEmpties);
|
|
211750
|
+
}
|
|
211751
|
+
const pre = m.pre;
|
|
211752
|
+
if (/\$$/.test(pre)) {
|
|
211753
|
+
acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
|
|
211754
|
+
firstGroup = false;
|
|
211755
|
+
if (!m.post.length)
|
|
211756
|
+
break;
|
|
211757
|
+
str = m.post;
|
|
211758
|
+
continue;
|
|
211692
211759
|
}
|
|
211693
|
-
} else {
|
|
211694
211760
|
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
211695
211761
|
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
211696
211762
|
const isSequence = isNumericSequence || isAlphaSequence;
|
|
@@ -211698,75 +211764,41 @@ var require_commonjs2 = __commonJS({
|
|
|
211698
211764
|
if (!isSequence && !isOptions) {
|
|
211699
211765
|
if (m.post.match(/,(?!,).*\}/)) {
|
|
211700
211766
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
211701
|
-
|
|
211767
|
+
isTop = true;
|
|
211768
|
+
continue;
|
|
211702
211769
|
}
|
|
211703
|
-
return [
|
|
211770
|
+
return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
|
|
211704
211771
|
}
|
|
211705
|
-
|
|
211772
|
+
if (firstGroup) {
|
|
211773
|
+
dropEmpties = isTop && !isSequence;
|
|
211774
|
+
firstGroup = false;
|
|
211775
|
+
}
|
|
211776
|
+
let values;
|
|
211706
211777
|
if (isSequence) {
|
|
211707
|
-
|
|
211778
|
+
values = expandSequence(m.body, isAlphaSequence, max);
|
|
211708
211779
|
} else {
|
|
211709
|
-
n = parseCommaParts(m.body);
|
|
211780
|
+
let n = parseCommaParts(m.body);
|
|
211710
211781
|
if (n.length === 1 && n[0] !== void 0) {
|
|
211711
|
-
n = expand_(n[0], max, false).map(embrace);
|
|
211782
|
+
n = expand_(n[0], max, maxLength, false).map(embrace);
|
|
211712
211783
|
if (n.length === 1) {
|
|
211713
|
-
|
|
211714
|
-
|
|
211715
|
-
|
|
211716
|
-
|
|
211717
|
-
|
|
211718
|
-
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
211719
|
-
const x = numeric(n[0]);
|
|
211720
|
-
const y = numeric(n[1]);
|
|
211721
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
211722
|
-
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
211723
|
-
let test = lte;
|
|
211724
|
-
const reverse = y < x;
|
|
211725
|
-
if (reverse) {
|
|
211726
|
-
incr *= -1;
|
|
211727
|
-
test = gte;
|
|
211728
|
-
}
|
|
211729
|
-
const pad = n.some(isPadded);
|
|
211730
|
-
N = [];
|
|
211731
|
-
for (let i = x; test(i, y) && N.length < max; i += incr) {
|
|
211732
|
-
let c;
|
|
211733
|
-
if (isAlphaSequence) {
|
|
211734
|
-
c = String.fromCharCode(i);
|
|
211735
|
-
if (c === "\\") {
|
|
211736
|
-
c = "";
|
|
211737
|
-
}
|
|
211738
|
-
} else {
|
|
211739
|
-
c = String(i);
|
|
211740
|
-
if (pad) {
|
|
211741
|
-
const need = width - c.length;
|
|
211742
|
-
if (need > 0) {
|
|
211743
|
-
const z = new Array(need + 1).join("0");
|
|
211744
|
-
if (i < 0) {
|
|
211745
|
-
c = "-" + z + c.slice(1);
|
|
211746
|
-
} else {
|
|
211747
|
-
c = z + c;
|
|
211748
|
-
}
|
|
211749
|
-
}
|
|
211750
|
-
}
|
|
211784
|
+
acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
|
|
211785
|
+
if (!m.post.length)
|
|
211786
|
+
break;
|
|
211787
|
+
str = m.post;
|
|
211788
|
+
continue;
|
|
211751
211789
|
}
|
|
211752
|
-
N.push(c);
|
|
211753
211790
|
}
|
|
211754
|
-
|
|
211755
|
-
N = [];
|
|
211791
|
+
values = [];
|
|
211756
211792
|
for (let j = 0; j < n.length; j++) {
|
|
211757
|
-
|
|
211758
|
-
}
|
|
211759
|
-
}
|
|
211760
|
-
for (let j = 0; j < N.length; j++) {
|
|
211761
|
-
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
211762
|
-
const expansion = pre + N[j] + post[k];
|
|
211763
|
-
if (!isTop || isSequence || expansion) {
|
|
211764
|
-
expansions.push(expansion);
|
|
211765
|
-
}
|
|
211793
|
+
values.push.apply(values, expand_(n[j], max, maxLength, false));
|
|
211766
211794
|
}
|
|
211767
211795
|
}
|
|
211796
|
+
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
|
|
211797
|
+
if (!m.post.length)
|
|
211798
|
+
break;
|
|
211799
|
+
str = m.post;
|
|
211768
211800
|
}
|
|
211769
|
-
return
|
|
211801
|
+
return acc;
|
|
211770
211802
|
}
|
|
211771
211803
|
}
|
|
211772
211804
|
});
|
|
@@ -213505,7 +213537,7 @@ var require_path_browserify = __commonJS({
|
|
|
213505
213537
|
}
|
|
213506
213538
|
return res;
|
|
213507
213539
|
}
|
|
213508
|
-
function _format(
|
|
213540
|
+
function _format(sep2, pathObject) {
|
|
213509
213541
|
var dir = pathObject.dir || pathObject.root;
|
|
213510
213542
|
var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
213511
213543
|
if (!dir) {
|
|
@@ -213514,7 +213546,7 @@ var require_path_browserify = __commonJS({
|
|
|
213514
213546
|
if (dir === pathObject.root) {
|
|
213515
213547
|
return dir + base;
|
|
213516
213548
|
}
|
|
213517
|
-
return dir +
|
|
213549
|
+
return dir + sep2 + base;
|
|
213518
213550
|
}
|
|
213519
213551
|
var posix = {
|
|
213520
213552
|
// path.resolve([from ...], to)
|
|
@@ -213583,7 +213615,7 @@ var require_path_browserify = __commonJS({
|
|
|
213583
213615
|
return ".";
|
|
213584
213616
|
return posix.normalize(joined);
|
|
213585
213617
|
},
|
|
213586
|
-
relative: function
|
|
213618
|
+
relative: function relative2(from, to) {
|
|
213587
213619
|
assertPath(from);
|
|
213588
213620
|
assertPath(to);
|
|
213589
213621
|
if (from === to) return "";
|
|
@@ -213674,7 +213706,7 @@ var require_path_browserify = __commonJS({
|
|
|
213674
213706
|
if (hasRoot && end === 1) return "//";
|
|
213675
213707
|
return path4.slice(0, end);
|
|
213676
213708
|
},
|
|
213677
|
-
basename: function
|
|
213709
|
+
basename: function basename2(path4, ext) {
|
|
213678
213710
|
if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
|
|
213679
213711
|
assertPath(path4);
|
|
213680
213712
|
var start = 0;
|
|
@@ -214614,7 +214646,11 @@ var require_parse = __commonJS({
|
|
|
214614
214646
|
}
|
|
214615
214647
|
}
|
|
214616
214648
|
};
|
|
214617
|
-
var
|
|
214649
|
+
var buildCharClassStar = (chars) => {
|
|
214650
|
+
const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
|
|
214651
|
+
return `${source}*`;
|
|
214652
|
+
};
|
|
214653
|
+
var getStarExtglobSequenceChars = (pattern) => {
|
|
214618
214654
|
let index = 0;
|
|
214619
214655
|
const chars = [];
|
|
214620
214656
|
while (index < pattern.length) {
|
|
@@ -214636,8 +214672,7 @@ var require_parse = __commonJS({
|
|
|
214636
214672
|
if (chars.length < 1) {
|
|
214637
214673
|
return;
|
|
214638
214674
|
}
|
|
214639
|
-
|
|
214640
|
-
return `${source}*`;
|
|
214675
|
+
return chars;
|
|
214641
214676
|
};
|
|
214642
214677
|
var repeatedExtglobRecursion = (pattern) => {
|
|
214643
214678
|
let depth = 0;
|
|
@@ -214661,15 +214696,29 @@ var require_parse = __commonJS({
|
|
|
214661
214696
|
return { risky: true };
|
|
214662
214697
|
}
|
|
214663
214698
|
}
|
|
214699
|
+
const safeChars = [];
|
|
214700
|
+
let sawStarSequence = false;
|
|
214701
|
+
let combinable = true;
|
|
214664
214702
|
for (const branch of branches) {
|
|
214665
|
-
const
|
|
214666
|
-
if (
|
|
214667
|
-
|
|
214703
|
+
const chars = getStarExtglobSequenceChars(branch);
|
|
214704
|
+
if (chars) {
|
|
214705
|
+
sawStarSequence = true;
|
|
214706
|
+
safeChars.push(...chars);
|
|
214707
|
+
continue;
|
|
214708
|
+
}
|
|
214709
|
+
const literal = normalizeSimpleBranch(branch);
|
|
214710
|
+
if (literal && literal.length === 1) {
|
|
214711
|
+
safeChars.push(literal);
|
|
214712
|
+
continue;
|
|
214668
214713
|
}
|
|
214714
|
+
combinable = false;
|
|
214669
214715
|
if (repeatedExtglobRecursion(branch) > max) {
|
|
214670
214716
|
return { risky: true };
|
|
214671
214717
|
}
|
|
214672
214718
|
}
|
|
214719
|
+
if (sawStarSequence) {
|
|
214720
|
+
return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
|
|
214721
|
+
}
|
|
214673
214722
|
return { risky: false };
|
|
214674
214723
|
};
|
|
214675
214724
|
var parse = (input, options) => {
|
|
@@ -215519,9 +215568,9 @@ var require_picomatch = __commonJS({
|
|
|
215519
215568
|
}
|
|
215520
215569
|
return { isMatch: Boolean(match), match, output };
|
|
215521
215570
|
};
|
|
215522
|
-
picomatch.matchBase = (input, glob, options) => {
|
|
215571
|
+
picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
|
|
215523
215572
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
215524
|
-
return regex.test(utils.basename(input));
|
|
215573
|
+
return regex.test(utils.basename(input, { windows: posix }));
|
|
215525
215574
|
};
|
|
215526
215575
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
215527
215576
|
picomatch.parse = (pattern, options) => {
|
|
@@ -216414,12 +216463,12 @@ var require_dist2 = __commonJS({
|
|
|
216414
216463
|
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
216415
216464
|
}
|
|
216416
216465
|
async function glob(globInput, options) {
|
|
216417
|
-
const [crawler,
|
|
216418
|
-
return crawler ? formatPaths(await crawler.withPromise(),
|
|
216466
|
+
const [crawler, relative2] = getCrawler(globInput, options);
|
|
216467
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative2) : [];
|
|
216419
216468
|
}
|
|
216420
216469
|
function globSync(globInput, options) {
|
|
216421
|
-
const [crawler,
|
|
216422
|
-
return crawler ? formatPaths(crawler.sync(),
|
|
216470
|
+
const [crawler, relative2] = getCrawler(globInput, options);
|
|
216471
|
+
return crawler ? formatPaths(crawler.sync(), relative2) : [];
|
|
216423
216472
|
}
|
|
216424
216473
|
exports2.convertPathToPattern = convertPathToPattern;
|
|
216425
216474
|
exports2.escapePath = escapePath;
|
|
@@ -216433,7 +216482,7 @@ var require_dist2 = __commonJS({
|
|
|
216433
216482
|
var require_ts_morph_common = __commonJS({
|
|
216434
216483
|
"node_modules/@ts-morph/common/dist/ts-morph-common.js"(exports2) {
|
|
216435
216484
|
"use strict";
|
|
216436
|
-
var
|
|
216485
|
+
var ts13 = require_typescript();
|
|
216437
216486
|
var minimatch = require_commonjs3();
|
|
216438
216487
|
var path$1 = require_path_browserify();
|
|
216439
216488
|
var fs$1 = require("node:fs");
|
|
@@ -216463,7 +216512,7 @@ var require_ts_morph_common = __commonJS({
|
|
|
216463
216512
|
n.default = e;
|
|
216464
216513
|
return Object.freeze(n);
|
|
216465
216514
|
}
|
|
216466
|
-
var ts__namespace = /* @__PURE__ */ _interopNamespaceCompat(
|
|
216515
|
+
var ts__namespace = /* @__PURE__ */ _interopNamespaceCompat(ts13);
|
|
216467
216516
|
var minimatch__namespace = /* @__PURE__ */ _interopNamespaceCompat(minimatch);
|
|
216468
216517
|
var path__default = /* @__PURE__ */ _interopDefaultCompat(path$1);
|
|
216469
216518
|
var fs__namespace = /* @__PURE__ */ _interopNamespaceCompat(fs$1);
|
|
@@ -219573,85 +219622,85 @@ ${nodeLocation}` : message;
|
|
|
219573
219622
|
Object.defineProperty(exports2, "DiagnosticCategory", {
|
|
219574
219623
|
enumerable: true,
|
|
219575
219624
|
get: function() {
|
|
219576
|
-
return
|
|
219625
|
+
return ts13.DiagnosticCategory;
|
|
219577
219626
|
}
|
|
219578
219627
|
});
|
|
219579
219628
|
Object.defineProperty(exports2, "EmitHint", {
|
|
219580
219629
|
enumerable: true,
|
|
219581
219630
|
get: function() {
|
|
219582
|
-
return
|
|
219631
|
+
return ts13.EmitHint;
|
|
219583
219632
|
}
|
|
219584
219633
|
});
|
|
219585
219634
|
Object.defineProperty(exports2, "LanguageVariant", {
|
|
219586
219635
|
enumerable: true,
|
|
219587
219636
|
get: function() {
|
|
219588
|
-
return
|
|
219637
|
+
return ts13.LanguageVariant;
|
|
219589
219638
|
}
|
|
219590
219639
|
});
|
|
219591
219640
|
Object.defineProperty(exports2, "ModuleKind", {
|
|
219592
219641
|
enumerable: true,
|
|
219593
219642
|
get: function() {
|
|
219594
|
-
return
|
|
219643
|
+
return ts13.ModuleKind;
|
|
219595
219644
|
}
|
|
219596
219645
|
});
|
|
219597
219646
|
Object.defineProperty(exports2, "ModuleResolutionKind", {
|
|
219598
219647
|
enumerable: true,
|
|
219599
219648
|
get: function() {
|
|
219600
|
-
return
|
|
219649
|
+
return ts13.ModuleResolutionKind;
|
|
219601
219650
|
}
|
|
219602
219651
|
});
|
|
219603
219652
|
Object.defineProperty(exports2, "NewLineKind", {
|
|
219604
219653
|
enumerable: true,
|
|
219605
219654
|
get: function() {
|
|
219606
|
-
return
|
|
219655
|
+
return ts13.NewLineKind;
|
|
219607
219656
|
}
|
|
219608
219657
|
});
|
|
219609
219658
|
Object.defineProperty(exports2, "NodeFlags", {
|
|
219610
219659
|
enumerable: true,
|
|
219611
219660
|
get: function() {
|
|
219612
|
-
return
|
|
219661
|
+
return ts13.NodeFlags;
|
|
219613
219662
|
}
|
|
219614
219663
|
});
|
|
219615
219664
|
Object.defineProperty(exports2, "ObjectFlags", {
|
|
219616
219665
|
enumerable: true,
|
|
219617
219666
|
get: function() {
|
|
219618
|
-
return
|
|
219667
|
+
return ts13.ObjectFlags;
|
|
219619
219668
|
}
|
|
219620
219669
|
});
|
|
219621
219670
|
Object.defineProperty(exports2, "ScriptKind", {
|
|
219622
219671
|
enumerable: true,
|
|
219623
219672
|
get: function() {
|
|
219624
|
-
return
|
|
219673
|
+
return ts13.ScriptKind;
|
|
219625
219674
|
}
|
|
219626
219675
|
});
|
|
219627
219676
|
Object.defineProperty(exports2, "ScriptTarget", {
|
|
219628
219677
|
enumerable: true,
|
|
219629
219678
|
get: function() {
|
|
219630
|
-
return
|
|
219679
|
+
return ts13.ScriptTarget;
|
|
219631
219680
|
}
|
|
219632
219681
|
});
|
|
219633
219682
|
Object.defineProperty(exports2, "SymbolFlags", {
|
|
219634
219683
|
enumerable: true,
|
|
219635
219684
|
get: function() {
|
|
219636
|
-
return
|
|
219685
|
+
return ts13.SymbolFlags;
|
|
219637
219686
|
}
|
|
219638
219687
|
});
|
|
219639
219688
|
Object.defineProperty(exports2, "SyntaxKind", {
|
|
219640
219689
|
enumerable: true,
|
|
219641
219690
|
get: function() {
|
|
219642
|
-
return
|
|
219691
|
+
return ts13.SyntaxKind;
|
|
219643
219692
|
}
|
|
219644
219693
|
});
|
|
219645
219694
|
Object.defineProperty(exports2, "TypeFlags", {
|
|
219646
219695
|
enumerable: true,
|
|
219647
219696
|
get: function() {
|
|
219648
|
-
return
|
|
219697
|
+
return ts13.TypeFlags;
|
|
219649
219698
|
}
|
|
219650
219699
|
});
|
|
219651
219700
|
Object.defineProperty(exports2, "TypeFormatFlags", {
|
|
219652
219701
|
enumerable: true,
|
|
219653
219702
|
get: function() {
|
|
219654
|
-
return
|
|
219703
|
+
return ts13.TypeFormatFlags;
|
|
219655
219704
|
}
|
|
219656
219705
|
});
|
|
219657
219706
|
exports2.ts = ts__namespace;
|
|
@@ -241756,31 +241805,9 @@ var CliInteractionExpectedQuestionOutputException = class extends CliInteraction
|
|
|
241756
241805
|
};
|
|
241757
241806
|
|
|
241758
241807
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Cli/Interaction/Enum/TextColor.ts
|
|
241759
|
-
|
|
241760
|
-
|
|
241761
|
-
|
|
241762
|
-
TextColor2[TextColor2["GREEN"] = 32] = "GREEN";
|
|
241763
|
-
TextColor2[TextColor2["YELLOW"] = 33] = "YELLOW";
|
|
241764
|
-
TextColor2[TextColor2["BLUE"] = 34] = "BLUE";
|
|
241765
|
-
TextColor2[TextColor2["MAGENTA"] = 35] = "MAGENTA";
|
|
241766
|
-
TextColor2[TextColor2["CYAN"] = 36] = "CYAN";
|
|
241767
|
-
TextColor2[TextColor2["WHITE"] = 37] = "WHITE";
|
|
241768
|
-
TextColor2[TextColor2["DARK_GRAY"] = 90] = "DARK_GRAY";
|
|
241769
|
-
TextColor2[TextColor2["LIGHT_RED"] = 91] = "LIGHT_RED";
|
|
241770
|
-
TextColor2[TextColor2["LIGHT_GREEN"] = 92] = "LIGHT_GREEN";
|
|
241771
|
-
TextColor2[TextColor2["LIGHT_YELLOW"] = 93] = "LIGHT_YELLOW";
|
|
241772
|
-
TextColor2[TextColor2["LIGHT_BLUE"] = 94] = "LIGHT_BLUE";
|
|
241773
|
-
TextColor2[TextColor2["LIGHT_MAGENTA"] = 95] = "LIGHT_MAGENTA";
|
|
241774
|
-
TextColor2[TextColor2["LIGHT_CYAN"] = 96] = "LIGHT_CYAN";
|
|
241775
|
-
TextColor2[TextColor2["LIGHT_WHITE"] = 97] = "LIGHT_WHITE";
|
|
241776
|
-
return TextColor2;
|
|
241777
|
-
})(TextColor || {});
|
|
241778
|
-
((TextColor2) => {
|
|
241779
|
-
function getDefault() {
|
|
241780
|
-
return 39;
|
|
241781
|
-
}
|
|
241782
|
-
TextColor2.getDefault = getDefault;
|
|
241783
|
-
})(TextColor || (TextColor = {}));
|
|
241808
|
+
function textColorDefault() {
|
|
241809
|
+
return 39;
|
|
241810
|
+
}
|
|
241784
241811
|
|
|
241785
241812
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Cli/Interaction/Format/Format.ts
|
|
241786
241813
|
var Format = class {
|
|
@@ -241811,7 +241838,7 @@ var Format = class {
|
|
|
241811
241838
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Cli/Interaction/Format/TextColorFormat.ts
|
|
241812
241839
|
var TextColorFormat = class extends Format {
|
|
241813
241840
|
constructor(textColor) {
|
|
241814
|
-
super(String(textColor), String(
|
|
241841
|
+
super(String(textColor), String(textColorDefault()));
|
|
241815
241842
|
}
|
|
241816
241843
|
};
|
|
241817
241844
|
|
|
@@ -242351,7 +242378,7 @@ var CliRoutingNoHelpTextException = class extends CliRoutingRuntimeException {
|
|
|
242351
242378
|
|
|
242352
242379
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Cli/Routing/Data/Route.ts
|
|
242353
242380
|
var Route = class {
|
|
242354
|
-
constructor(name, description, handler, helpText = null, routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [],
|
|
242381
|
+
constructor(name, description, handler, helpText = null, routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], processExitingMiddleware = [], arguments_ = [], options = []) {
|
|
242355
242382
|
this.name = name;
|
|
242356
242383
|
this.description = description;
|
|
242357
242384
|
this.handler = handler;
|
|
@@ -242359,7 +242386,7 @@ var Route = class {
|
|
|
242359
242386
|
this.routeMatchedMiddleware = routeMatchedMiddleware;
|
|
242360
242387
|
this.routeDispatchedMiddleware = routeDispatchedMiddleware;
|
|
242361
242388
|
this.throwableCaughtMiddleware = throwableCaughtMiddleware;
|
|
242362
|
-
this.
|
|
242389
|
+
this.processExitingMiddleware = processExitingMiddleware;
|
|
242363
242390
|
this.arguments_ = arguments_;
|
|
242364
242391
|
this.options = options;
|
|
242365
242392
|
}
|
|
@@ -242370,7 +242397,7 @@ var Route = class {
|
|
|
242370
242397
|
routeMatchedMiddleware;
|
|
242371
242398
|
routeDispatchedMiddleware;
|
|
242372
242399
|
throwableCaughtMiddleware;
|
|
242373
|
-
|
|
242400
|
+
processExitingMiddleware;
|
|
242374
242401
|
arguments_;
|
|
242375
242402
|
options;
|
|
242376
242403
|
getName() {
|
|
@@ -242497,17 +242524,17 @@ var Route = class {
|
|
|
242497
242524
|
clone.throwableCaughtMiddleware = [...this.throwableCaughtMiddleware, ...middleware];
|
|
242498
242525
|
return clone;
|
|
242499
242526
|
}
|
|
242500
|
-
|
|
242501
|
-
return this.
|
|
242527
|
+
getProcessExitingMiddleware() {
|
|
242528
|
+
return this.processExitingMiddleware;
|
|
242502
242529
|
}
|
|
242503
|
-
|
|
242530
|
+
withProcessExitingMiddleware(...middleware) {
|
|
242504
242531
|
const clone = ObjectFactory.clone(this);
|
|
242505
|
-
clone.
|
|
242532
|
+
clone.processExitingMiddleware = middleware;
|
|
242506
242533
|
return clone;
|
|
242507
242534
|
}
|
|
242508
|
-
|
|
242535
|
+
withAddedProcessExitingMiddleware(...middleware) {
|
|
242509
242536
|
const clone = ObjectFactory.clone(this);
|
|
242510
|
-
clone.
|
|
242537
|
+
clone.processExitingMiddleware = [...this.processExitingMiddleware, ...middleware];
|
|
242511
242538
|
return clone;
|
|
242512
242539
|
}
|
|
242513
242540
|
getHandler() {
|
|
@@ -242623,6 +242650,61 @@ var AstReader = class {
|
|
|
242623
242650
|
}
|
|
242624
242651
|
return classes;
|
|
242625
242652
|
}
|
|
242653
|
+
/**
|
|
242654
|
+
* Resolve a `new X()` or bare `X` identifier element to the absolute file
|
|
242655
|
+
* path of the class it references, using the current file's import map.
|
|
242656
|
+
*
|
|
242657
|
+
* Returns undefined when the element is neither form, or when the name is
|
|
242658
|
+
* not imported via a relative specifier (e.g. framework classes imported
|
|
242659
|
+
* from a package — those are intentionally skipped by the provider walk).
|
|
242660
|
+
*/
|
|
242661
|
+
resolveElementToFilePath(element, useMap, currentFilePath) {
|
|
242662
|
+
let name;
|
|
242663
|
+
if (import_ts_morph.ts.isNewExpression(element)) {
|
|
242664
|
+
name = import_ts_morph.ts.isIdentifier(element.expression) ? element.expression.text : void 0;
|
|
242665
|
+
} else if (import_ts_morph.ts.isIdentifier(element)) {
|
|
242666
|
+
name = element.text;
|
|
242667
|
+
}
|
|
242668
|
+
if (name === void 0) {
|
|
242669
|
+
return void 0;
|
|
242670
|
+
}
|
|
242671
|
+
const resolved = this.resolveImportToFilePath(name, useMap, currentFilePath);
|
|
242672
|
+
return resolved !== "" ? resolved : void 0;
|
|
242673
|
+
}
|
|
242674
|
+
/**
|
|
242675
|
+
* Extract the absolute file paths of the classes referenced by a method
|
|
242676
|
+
* returning [new A(), new B(), ...] (or [A, B, ...]).
|
|
242677
|
+
*
|
|
242678
|
+
* Unlike {@link extractClassListFromValues} (which returns bare class
|
|
242679
|
+
* names), this resolves each reference through the import map so provider
|
|
242680
|
+
* classes are located unambiguously — critical when the same short class
|
|
242681
|
+
* name exists in more than one component tree (e.g. an Http and a Cli
|
|
242682
|
+
* `ComponentProvider`).
|
|
242683
|
+
*/
|
|
242684
|
+
extractClassPathListFromValues(method, useMap, currentFilePath) {
|
|
242685
|
+
if (method === void 0) {
|
|
242686
|
+
return [];
|
|
242687
|
+
}
|
|
242688
|
+
const array = this.findReturnedArray(method);
|
|
242689
|
+
if (array === void 0) {
|
|
242690
|
+
return [];
|
|
242691
|
+
}
|
|
242692
|
+
return this.extractClassPathListFromArrayExpr(array, useMap, currentFilePath);
|
|
242693
|
+
}
|
|
242694
|
+
/**
|
|
242695
|
+
* Extract the absolute file paths of the classes referenced by the elements
|
|
242696
|
+
* of an array literal, using the current file's import map.
|
|
242697
|
+
*/
|
|
242698
|
+
extractClassPathListFromArrayExpr(array, useMap, currentFilePath) {
|
|
242699
|
+
const paths = [];
|
|
242700
|
+
for (const element of array.elements) {
|
|
242701
|
+
const resolved = this.resolveElementToFilePath(element, useMap, currentFilePath);
|
|
242702
|
+
if (resolved !== void 0) {
|
|
242703
|
+
paths.push(resolved);
|
|
242704
|
+
}
|
|
242705
|
+
}
|
|
242706
|
+
return paths;
|
|
242707
|
+
}
|
|
242626
242708
|
/**
|
|
242627
242709
|
* Extract service ID strings from keys of an object-returning method.
|
|
242628
242710
|
*
|
|
@@ -243015,7 +243097,7 @@ var RouteAttributeReader = class extends AstReader {
|
|
|
243015
243097
|
|
|
243016
243098
|
// src/Sindri/Ast/Data/CliRouteData.ts
|
|
243017
243099
|
var CliRouteData = class {
|
|
243018
|
-
constructor(name, description, handler = null, helpText = null, routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [],
|
|
243100
|
+
constructor(name, description, handler = null, helpText = null, routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], processExitingMiddleware = [], args = [], options = []) {
|
|
243019
243101
|
this.name = name;
|
|
243020
243102
|
this.description = description;
|
|
243021
243103
|
this.handler = handler;
|
|
@@ -243023,7 +243105,7 @@ var CliRouteData = class {
|
|
|
243023
243105
|
this.routeMatchedMiddleware = routeMatchedMiddleware;
|
|
243024
243106
|
this.routeDispatchedMiddleware = routeDispatchedMiddleware;
|
|
243025
243107
|
this.throwableCaughtMiddleware = throwableCaughtMiddleware;
|
|
243026
|
-
this.
|
|
243108
|
+
this.processExitingMiddleware = processExitingMiddleware;
|
|
243027
243109
|
this.options = options;
|
|
243028
243110
|
this.arguments = args;
|
|
243029
243111
|
}
|
|
@@ -243034,7 +243116,7 @@ var CliRouteData = class {
|
|
|
243034
243116
|
routeMatchedMiddleware;
|
|
243035
243117
|
routeDispatchedMiddleware;
|
|
243036
243118
|
throwableCaughtMiddleware;
|
|
243037
|
-
|
|
243119
|
+
processExitingMiddleware;
|
|
243038
243120
|
options;
|
|
243039
243121
|
arguments;
|
|
243040
243122
|
};
|
|
@@ -243258,7 +243340,7 @@ var CliRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243258
243340
|
return null;
|
|
243259
243341
|
}
|
|
243260
243342
|
const updatedName = this.updateName(name, method, useMap, currentFilePath, currentClass);
|
|
243261
|
-
const [routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware,
|
|
243343
|
+
const [routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, processExitingMiddleware] = this.updateMiddleware(
|
|
243262
243344
|
method,
|
|
243263
243345
|
useMap,
|
|
243264
243346
|
currentFilePath,
|
|
@@ -243276,7 +243358,7 @@ var CliRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243276
243358
|
routeMatchedMiddleware,
|
|
243277
243359
|
routeDispatchedMiddleware,
|
|
243278
243360
|
throwableCaughtMiddleware,
|
|
243279
|
-
|
|
243361
|
+
processExitingMiddleware,
|
|
243280
243362
|
this.parameterReader.updateArguments(method, useMap, currentFilePath, currentClass),
|
|
243281
243363
|
this.parameterReader.updateOptions(method, useMap, currentFilePath, currentClass)
|
|
243282
243364
|
);
|
|
@@ -243295,7 +243377,7 @@ var CliRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243295
243377
|
}
|
|
243296
243378
|
return name;
|
|
243297
243379
|
}
|
|
243298
|
-
updateMiddleware(method, useMap, currentFilePath, currentClass, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware,
|
|
243380
|
+
updateMiddleware(method, useMap, currentFilePath, currentClass, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, processExitingMiddleware) {
|
|
243299
243381
|
for (const decorator of this.findDecoratorsOnNode(method, "Middleware", useMap, currentFilePath)) {
|
|
243300
243382
|
const mwName = this.extractExprValue(
|
|
243301
243383
|
this.getDecoratorArg(decorator, 0),
|
|
@@ -243306,19 +243388,19 @@ var CliRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243306
243388
|
if (typeof mwName !== "string" || mwName === "") {
|
|
243307
243389
|
continue;
|
|
243308
243390
|
}
|
|
243309
|
-
[routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware,
|
|
243391
|
+
[routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, processExitingMiddleware] = this.classifyMiddleware(
|
|
243310
243392
|
mwName,
|
|
243311
243393
|
useMap,
|
|
243312
243394
|
currentFilePath,
|
|
243313
243395
|
routeMatchedMiddleware,
|
|
243314
243396
|
routeDispatchedMiddleware,
|
|
243315
243397
|
throwableCaughtMiddleware,
|
|
243316
|
-
|
|
243398
|
+
processExitingMiddleware
|
|
243317
243399
|
);
|
|
243318
243400
|
}
|
|
243319
|
-
return [routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware,
|
|
243401
|
+
return [routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, processExitingMiddleware];
|
|
243320
243402
|
}
|
|
243321
|
-
classifyMiddleware(mwName, useMap, currentFilePath, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware,
|
|
243403
|
+
classifyMiddleware(mwName, useMap, currentFilePath, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, processExitingMiddleware) {
|
|
243322
243404
|
if (this.classImplementsInterface(mwName, "RouteMatchedMiddlewareContract", useMap, currentFilePath)) {
|
|
243323
243405
|
routeMatchedMiddleware = [...routeMatchedMiddleware, mwName];
|
|
243324
243406
|
}
|
|
@@ -243328,10 +243410,10 @@ var CliRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243328
243410
|
if (this.classImplementsInterface(mwName, "ThrowableCaughtMiddlewareContract", useMap, currentFilePath)) {
|
|
243329
243411
|
throwableCaughtMiddleware = [...throwableCaughtMiddleware, mwName];
|
|
243330
243412
|
}
|
|
243331
|
-
if (this.classImplementsInterface(mwName, "
|
|
243332
|
-
|
|
243413
|
+
if (this.classImplementsInterface(mwName, "ProcessExitingMiddlewareContract", useMap, currentFilePath)) {
|
|
243414
|
+
processExitingMiddleware = [...processExitingMiddleware, mwName];
|
|
243333
243415
|
}
|
|
243334
|
-
return [routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware,
|
|
243416
|
+
return [routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, processExitingMiddleware];
|
|
243335
243417
|
}
|
|
243336
243418
|
buildRouteExpr(data) {
|
|
243337
243419
|
const args = [this.buildEnumCaseExpr(data.name), this.buildStringExpr(data.description)];
|
|
@@ -243354,7 +243436,7 @@ var CliRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243354
243436
|
this.buildClassArrayExpr(data.routeMatchedMiddleware),
|
|
243355
243437
|
this.buildClassArrayExpr(data.routeDispatchedMiddleware),
|
|
243356
243438
|
this.buildClassArrayExpr(data.throwableCaughtMiddleware),
|
|
243357
|
-
this.buildClassArrayExpr(data.
|
|
243439
|
+
this.buildClassArrayExpr(data.processExitingMiddleware)
|
|
243358
243440
|
];
|
|
243359
243441
|
}
|
|
243360
243442
|
};
|
|
@@ -243400,11 +243482,11 @@ var ComponentProviderReader = class _ComponentProviderReader extends AstReader {
|
|
|
243400
243482
|
const useMap = this.buildUseMap(sourceFile);
|
|
243401
243483
|
const methods = this.indexMethods(classDecl);
|
|
243402
243484
|
return new ComponentProviderResult(
|
|
243403
|
-
this.
|
|
243404
|
-
this.
|
|
243405
|
-
this.
|
|
243406
|
-
this.
|
|
243407
|
-
this.
|
|
243485
|
+
this.extractClassPathListFromValues(methods[_ComponentProviderReader.METHOD_COMPONENT], useMap, filePath),
|
|
243486
|
+
this.extractClassPathListFromValues(methods[_ComponentProviderReader.METHOD_CONTAINER], useMap, filePath),
|
|
243487
|
+
this.extractClassPathListFromValues(methods[_ComponentProviderReader.METHOD_EVENT], useMap, filePath),
|
|
243488
|
+
this.extractClassPathListFromValues(methods[_ComponentProviderReader.METHOD_CLI], useMap, filePath),
|
|
243489
|
+
this.extractClassPathListFromValues(methods[_ComponentProviderReader.METHOD_HTTP], useMap, filePath)
|
|
243408
243490
|
);
|
|
243409
243491
|
}
|
|
243410
243492
|
};
|
|
@@ -243549,14 +243631,24 @@ var ConfigReader = class extends AstReader {
|
|
|
243549
243631
|
return dataPath;
|
|
243550
243632
|
}
|
|
243551
243633
|
/**
|
|
243552
|
-
* Extract
|
|
243553
|
-
*
|
|
243634
|
+
* Extract the absolute file paths of the configured provider classes.
|
|
243635
|
+
*
|
|
243636
|
+
* The providers array is the first array-literal argument after the
|
|
243637
|
+
* `dataNamespace` (index 8) — every preceding argument is a scalar. Its
|
|
243638
|
+
* exact position varies by config type (index 9 in `HttpConfig`, index 11
|
|
243639
|
+
* in `CliConfig` after `applicationName`/`defaultCommandName`), so the
|
|
243640
|
+
* array is located by scanning rather than by a fixed index.
|
|
243641
|
+
*
|
|
243642
|
+
* Each element (`new ComponentProvider()` or a bare `ComponentProvider`
|
|
243643
|
+
* identifier) is resolved through the config file's import map to an
|
|
243644
|
+
* absolute path, so the walk locates the right provider even when the same
|
|
243645
|
+
* short name exists in multiple trees.
|
|
243554
243646
|
*/
|
|
243555
243647
|
extractProvidersFromArgs(args, useMap, filePath) {
|
|
243556
|
-
for (let i =
|
|
243648
|
+
for (let i = 9; i < args.length; i++) {
|
|
243557
243649
|
const arg = args[i];
|
|
243558
243650
|
if (arg !== void 0 && import_ts_morph3.ts.isArrayLiteralExpression(arg)) {
|
|
243559
|
-
return this.
|
|
243651
|
+
return this.extractClassPathListFromArrayExpr(arg, useMap, filePath);
|
|
243560
243652
|
}
|
|
243561
243653
|
}
|
|
243562
243654
|
return [];
|
|
@@ -243565,7 +243657,7 @@ var ConfigReader = class extends AstReader {
|
|
|
243565
243657
|
|
|
243566
243658
|
// src/Sindri/Ast/Data/HttpRouteData.ts
|
|
243567
243659
|
var HttpRouteData = class {
|
|
243568
|
-
constructor(path4, name, handler = null, requestMethods = [], routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], sendingResponseMiddleware = [],
|
|
243660
|
+
constructor(path4, name, handler = null, requestMethods = [], routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], sendingResponseMiddleware = [], responseSentMiddleware = [], requestStruct = null, responseStruct = null, isDynamic = false, parameters = []) {
|
|
243569
243661
|
this.path = path4;
|
|
243570
243662
|
this.name = name;
|
|
243571
243663
|
this.handler = handler;
|
|
@@ -243574,7 +243666,7 @@ var HttpRouteData = class {
|
|
|
243574
243666
|
this.routeDispatchedMiddleware = routeDispatchedMiddleware;
|
|
243575
243667
|
this.throwableCaughtMiddleware = throwableCaughtMiddleware;
|
|
243576
243668
|
this.sendingResponseMiddleware = sendingResponseMiddleware;
|
|
243577
|
-
this.
|
|
243669
|
+
this.responseSentMiddleware = responseSentMiddleware;
|
|
243578
243670
|
this.requestStruct = requestStruct;
|
|
243579
243671
|
this.responseStruct = responseStruct;
|
|
243580
243672
|
this.isDynamic = isDynamic;
|
|
@@ -243588,7 +243680,7 @@ var HttpRouteData = class {
|
|
|
243588
243680
|
routeDispatchedMiddleware;
|
|
243589
243681
|
throwableCaughtMiddleware;
|
|
243590
243682
|
sendingResponseMiddleware;
|
|
243591
|
-
|
|
243683
|
+
responseSentMiddleware;
|
|
243592
243684
|
requestStruct;
|
|
243593
243685
|
responseStruct;
|
|
243594
243686
|
isDynamic;
|
|
@@ -243632,7 +243724,7 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243632
243724
|
}
|
|
243633
243725
|
return requestMethods;
|
|
243634
243726
|
}
|
|
243635
|
-
updateMiddleware(method, useMap, namespace, currentClass, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, sendingResponseMiddleware,
|
|
243727
|
+
updateMiddleware(method, useMap, namespace, currentClass, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, sendingResponseMiddleware, responseSentMiddleware) {
|
|
243636
243728
|
for (const decorator of this.findDecoratorsOnNode(method, "Middleware", useMap, namespace)) {
|
|
243637
243729
|
const mwName = this.extractExprValue(this.getDecoratorArg(decorator, 0), useMap, namespace, currentClass);
|
|
243638
243730
|
if (typeof mwName !== "string" || mwName === "") {
|
|
@@ -243643,7 +243735,7 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243643
243735
|
routeDispatchedMiddleware,
|
|
243644
243736
|
throwableCaughtMiddleware,
|
|
243645
243737
|
sendingResponseMiddleware,
|
|
243646
|
-
|
|
243738
|
+
responseSentMiddleware
|
|
243647
243739
|
] = this.classifyMiddleware(
|
|
243648
243740
|
mwName,
|
|
243649
243741
|
useMap,
|
|
@@ -243652,7 +243744,7 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243652
243744
|
routeDispatchedMiddleware,
|
|
243653
243745
|
throwableCaughtMiddleware,
|
|
243654
243746
|
sendingResponseMiddleware,
|
|
243655
|
-
|
|
243747
|
+
responseSentMiddleware
|
|
243656
243748
|
);
|
|
243657
243749
|
}
|
|
243658
243750
|
return [
|
|
@@ -243660,7 +243752,7 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243660
243752
|
routeDispatchedMiddleware,
|
|
243661
243753
|
throwableCaughtMiddleware,
|
|
243662
243754
|
sendingResponseMiddleware,
|
|
243663
|
-
|
|
243755
|
+
responseSentMiddleware
|
|
243664
243756
|
];
|
|
243665
243757
|
}
|
|
243666
243758
|
updateRequestStruct(method, useMap, namespace, currentClass) {
|
|
@@ -243687,7 +243779,7 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243687
243779
|
this.buildClassIdentifierArrayExpr(data.routeDispatchedMiddleware),
|
|
243688
243780
|
this.buildClassIdentifierArrayExpr(data.throwableCaughtMiddleware),
|
|
243689
243781
|
this.buildClassIdentifierArrayExpr(data.sendingResponseMiddleware),
|
|
243690
|
-
this.buildClassIdentifierArrayExpr(data.
|
|
243782
|
+
this.buildClassIdentifierArrayExpr(data.responseSentMiddleware)
|
|
243691
243783
|
];
|
|
243692
243784
|
}
|
|
243693
243785
|
buildRouteStructArgs(data) {
|
|
@@ -243704,7 +243796,7 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243704
243796
|
}
|
|
243705
243797
|
return args;
|
|
243706
243798
|
}
|
|
243707
|
-
classifyMiddleware(mwName, useMap, currentFilePath, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, sendingResponseMiddleware,
|
|
243799
|
+
classifyMiddleware(mwName, useMap, currentFilePath, routeMatchedMiddleware, routeDispatchedMiddleware, throwableCaughtMiddleware, sendingResponseMiddleware, responseSentMiddleware) {
|
|
243708
243800
|
if (this.classImplementsInterface(mwName, "RouteMatchedMiddlewareContract", useMap, currentFilePath)) {
|
|
243709
243801
|
routeMatchedMiddleware = [...routeMatchedMiddleware, mwName];
|
|
243710
243802
|
}
|
|
@@ -243717,15 +243809,15 @@ var HttpRouteMiddlewareReader = class extends AstReader {
|
|
|
243717
243809
|
if (this.classImplementsInterface(mwName, "SendingResponseMiddlewareContract", useMap, currentFilePath)) {
|
|
243718
243810
|
sendingResponseMiddleware = [...sendingResponseMiddleware, mwName];
|
|
243719
243811
|
}
|
|
243720
|
-
if (this.classImplementsInterface(mwName, "
|
|
243721
|
-
|
|
243812
|
+
if (this.classImplementsInterface(mwName, "ResponseSentMiddlewareContract", useMap, currentFilePath)) {
|
|
243813
|
+
responseSentMiddleware = [...responseSentMiddleware, mwName];
|
|
243722
243814
|
}
|
|
243723
243815
|
return [
|
|
243724
243816
|
routeMatchedMiddleware,
|
|
243725
243817
|
routeDispatchedMiddleware,
|
|
243726
243818
|
throwableCaughtMiddleware,
|
|
243727
243819
|
sendingResponseMiddleware,
|
|
243728
|
-
|
|
243820
|
+
responseSentMiddleware
|
|
243729
243821
|
];
|
|
243730
243822
|
}
|
|
243731
243823
|
};
|
|
@@ -243961,7 +244053,7 @@ var HttpRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243961
244053
|
routeDispatchedMiddleware,
|
|
243962
244054
|
throwableCaughtMiddleware,
|
|
243963
244055
|
sendingResponseMiddleware,
|
|
243964
|
-
|
|
244056
|
+
responseSentMiddleware
|
|
243965
244057
|
] = this.middlewareReader.updateMiddleware(
|
|
243966
244058
|
method,
|
|
243967
244059
|
useMap,
|
|
@@ -243982,7 +244074,7 @@ var HttpRouteAttributeReader = class extends RouteAttributeReader {
|
|
|
243982
244074
|
routeDispatchedMiddleware,
|
|
243983
244075
|
throwableCaughtMiddleware,
|
|
243984
244076
|
sendingResponseMiddleware,
|
|
243985
|
-
|
|
244077
|
+
responseSentMiddleware,
|
|
243986
244078
|
this.middlewareReader.updateRequestStruct(method, useMap, currentFilePath, currentClass),
|
|
243987
244079
|
this.middlewareReader.updateResponseStruct(method, useMap, currentFilePath, currentClass),
|
|
243988
244080
|
resolvedIsDynamic,
|
|
@@ -244174,6 +244266,9 @@ var ListenerProviderReader = class _ListenerProviderReader extends AstReader {
|
|
|
244174
244266
|
}
|
|
244175
244267
|
};
|
|
244176
244268
|
|
|
244269
|
+
// src/Sindri/Ast/RouteProviderReader.ts
|
|
244270
|
+
var import_ts_morph6 = __toESM(require_ts_morph(), 1);
|
|
244271
|
+
|
|
244177
244272
|
// src/Sindri/Ast/Data/Result/RouteProviderResult.ts
|
|
244178
244273
|
var RouteProviderResult = class _RouteProviderResult {
|
|
244179
244274
|
constructor(controllerClasses = [], routes = []) {
|
|
@@ -244207,13 +244302,31 @@ var RouteProviderReader = class _RouteProviderReader extends AstReader {
|
|
|
244207
244302
|
this.extractRoutes(methods[_RouteProviderReader.METHOD_ROUTES], useMap, filePath)
|
|
244208
244303
|
);
|
|
244209
244304
|
}
|
|
244210
|
-
|
|
244211
|
-
|
|
244305
|
+
/**
|
|
244306
|
+
* Extract the route objects returned by a provider's `getRoutes()` method.
|
|
244307
|
+
*
|
|
244308
|
+
* TS route providers register routes imperatively — `getRoutes()` returns
|
|
244309
|
+
* the concrete `new Route(...)` / `new DynamicRoute(...)` (or CLI
|
|
244310
|
+
* `new Route(...)`) instances. Those expressions are returned verbatim for
|
|
244311
|
+
* the data-cache generator to emit as route closures and to derive the
|
|
244312
|
+
* path/regex lookup maps from. (Attribute/decorator scanning — the other,
|
|
244313
|
+
* optional source of routes — is handled separately via
|
|
244314
|
+
* {@link readFile}'s controller-class list.)
|
|
244315
|
+
*/
|
|
244316
|
+
extractRoutes(method, _useMap, _filePath) {
|
|
244317
|
+
if (method === void 0) {
|
|
244318
|
+
return [];
|
|
244319
|
+
}
|
|
244320
|
+
const array = this.findReturnedArray(method);
|
|
244321
|
+
if (array === void 0) {
|
|
244322
|
+
return [];
|
|
244323
|
+
}
|
|
244324
|
+
return array.elements.filter((element) => import_ts_morph6.ts.isNewExpression(element));
|
|
244212
244325
|
}
|
|
244213
244326
|
};
|
|
244214
244327
|
|
|
244215
244328
|
// src/Sindri/Ast/ServiceProviderReader.ts
|
|
244216
|
-
var
|
|
244329
|
+
var import_ts_morph7 = __toESM(require_ts_morph(), 1);
|
|
244217
244330
|
|
|
244218
244331
|
// src/Sindri/Ast/Data/Result/ServiceProviderResult.ts
|
|
244219
244332
|
var ServiceProviderResult = class _ServiceProviderResult {
|
|
@@ -244266,7 +244379,7 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244266
244379
|
}
|
|
244267
244380
|
const map = {};
|
|
244268
244381
|
for (const prop of obj.properties) {
|
|
244269
|
-
if (!
|
|
244382
|
+
if (!import_ts_morph7.ts.isPropertyAssignment(prop)) {
|
|
244270
244383
|
continue;
|
|
244271
244384
|
}
|
|
244272
244385
|
const serviceId = this.resolvePropertyKeyToString(prop.name, useMap, filePath);
|
|
@@ -244287,8 +244400,8 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244287
244400
|
* Handles: `ProviderClass.publishMethod` and `[ProviderClass, 'method']`.
|
|
244288
244401
|
*/
|
|
244289
244402
|
extractHandlerFromValue(node, useMap, filePath, currentClass) {
|
|
244290
|
-
if (
|
|
244291
|
-
const className =
|
|
244403
|
+
if (import_ts_morph7.ts.isPropertyAccessExpression(node)) {
|
|
244404
|
+
const className = import_ts_morph7.ts.isIdentifier(node.expression) ? node.expression.text : void 0;
|
|
244292
244405
|
if (className === void 0) {
|
|
244293
244406
|
return void 0;
|
|
244294
244407
|
}
|
|
@@ -244296,7 +244409,7 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244296
244409
|
const resolvedClass = className === "self" || className === "this" ? currentClass : className;
|
|
244297
244410
|
return [resolvedClass, methodName];
|
|
244298
244411
|
}
|
|
244299
|
-
if (
|
|
244412
|
+
if (import_ts_morph7.ts.isArrayLiteralExpression(node) && node.elements.length === 2) {
|
|
244300
244413
|
const raw = this.extractHandlerFromTsArray(node, useMap, filePath, currentClass);
|
|
244301
244414
|
if (raw !== void 0) {
|
|
244302
244415
|
return [raw.class, raw.method];
|
|
@@ -244307,11 +244420,11 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244307
244420
|
};
|
|
244308
244421
|
|
|
244309
244422
|
// src/Sindri/Generator/Ast/Cli/AstCliDataFileGenerator.ts
|
|
244310
|
-
var
|
|
244423
|
+
var import_ts_morph9 = __toESM(require_ts_morph(), 1);
|
|
244311
244424
|
|
|
244312
244425
|
// src/Sindri/Generator/Abstract/AstFileGenerator.ts
|
|
244313
244426
|
var fs2 = __toESM(require("fs"), 1);
|
|
244314
|
-
var
|
|
244427
|
+
var import_ts_morph8 = __toESM(require_ts_morph(), 1);
|
|
244315
244428
|
var AstFileGenerator = class {
|
|
244316
244429
|
/**
|
|
244317
244430
|
* Build a property access or string literal expression from a "ClassName::CASE" string.
|
|
@@ -244319,12 +244432,22 @@ var AstFileGenerator = class {
|
|
|
244319
244432
|
buildEnumCaseExpr(fqnColonCase) {
|
|
244320
244433
|
const pos = fqnColonCase.indexOf("::");
|
|
244321
244434
|
if (pos === -1) {
|
|
244322
|
-
return
|
|
244435
|
+
return import_ts_morph8.ts.factory.createStringLiteral(fqnColonCase);
|
|
244323
244436
|
}
|
|
244324
244437
|
const fqn = fqnColonCase.substring(0, pos);
|
|
244325
244438
|
const caseName = fqnColonCase.substring(pos + 2);
|
|
244326
244439
|
const className = fqn.slice(fqn.lastIndexOf("\\") + 1);
|
|
244327
|
-
return
|
|
244440
|
+
return import_ts_morph8.ts.factory.createPropertyAccessExpression(import_ts_morph8.ts.factory.createIdentifier(className), caseName);
|
|
244441
|
+
}
|
|
244442
|
+
/**
|
|
244443
|
+
* Build the `import { X } from '...';` block for the provider/handler classes
|
|
244444
|
+
* a generated data cache references, followed by a trailing newline (or an
|
|
244445
|
+
* empty string when there are no such imports).
|
|
244446
|
+
*/
|
|
244447
|
+
buildUserImportsBlock(classImportMap) {
|
|
244448
|
+
const userImports = Object.entries(classImportMap).map(([name, specifier]) => `import { ${name} } from '${specifier}';`).join("\n");
|
|
244449
|
+
return userImports ? `${userImports}
|
|
244450
|
+
` : "";
|
|
244328
244451
|
}
|
|
244329
244452
|
writeFile(directory, className, data) {
|
|
244330
244453
|
const filePath = directory.replace(/\/$/, "") + `/${className}.ts`;
|
|
@@ -244345,18 +244468,16 @@ var AstFileGenerator = class {
|
|
|
244345
244468
|
// src/Sindri/Generator/Ast/Cli/AstCliDataFileGenerator.ts
|
|
244346
244469
|
var AstCliDataFileGenerator = class extends AstFileGenerator {
|
|
244347
244470
|
classImportMap = {};
|
|
244348
|
-
printer =
|
|
244349
|
-
dummySourceFile =
|
|
244471
|
+
printer = import_ts_morph9.ts.createPrinter({ newLine: import_ts_morph9.ts.NewLineKind.LineFeed });
|
|
244472
|
+
dummySourceFile = import_ts_morph9.ts.createSourceFile(
|
|
244350
244473
|
"_dummy.ts",
|
|
244351
244474
|
"",
|
|
244352
|
-
|
|
244475
|
+
import_ts_morph9.ts.ScriptTarget.ESNext,
|
|
244353
244476
|
false,
|
|
244354
|
-
|
|
244477
|
+
import_ts_morph9.ts.ScriptKind.TS
|
|
244355
244478
|
);
|
|
244356
244479
|
generateFile(directory, className, namespace, routes) {
|
|
244357
|
-
const
|
|
244358
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244359
|
-
` : "";
|
|
244480
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244360
244481
|
const contents = this.generateClassContents(routes);
|
|
244361
244482
|
const data = [
|
|
244362
244483
|
"// This file was automatically generated by Sindri.",
|
|
@@ -244380,6 +244501,25 @@ var AstCliDataFileGenerator = class extends AstFileGenerator {
|
|
|
244380
244501
|
].join("\n");
|
|
244381
244502
|
return this.writeFile(directory, className, data);
|
|
244382
244503
|
}
|
|
244504
|
+
/**
|
|
244505
|
+
* Generate the CLI routing data file from imperative `getRoutes()` route
|
|
244506
|
+
* objects — each `new Route(name, description, handler, ...)` is keyed by
|
|
244507
|
+
* its command name (the first constructor argument) and emitted verbatim.
|
|
244508
|
+
*/
|
|
244509
|
+
generateFileFromRoutes(directory, className, namespace, routeExprs) {
|
|
244510
|
+
const routes = {};
|
|
244511
|
+
for (const expr of routeExprs) {
|
|
244512
|
+
if (!import_ts_morph9.ts.isNewExpression(expr)) {
|
|
244513
|
+
continue;
|
|
244514
|
+
}
|
|
244515
|
+
const nameArg = (expr.arguments ?? [])[0];
|
|
244516
|
+
if (nameArg === void 0 || !import_ts_morph9.ts.isStringLiteral(nameArg)) {
|
|
244517
|
+
continue;
|
|
244518
|
+
}
|
|
244519
|
+
routes[nameArg.text] = expr;
|
|
244520
|
+
}
|
|
244521
|
+
return this.generateFile(directory, className, namespace, routes);
|
|
244522
|
+
}
|
|
244383
244523
|
generateClassContents(routes) {
|
|
244384
244524
|
const entries = Object.entries(routes);
|
|
244385
244525
|
if (entries.length === 0) {
|
|
@@ -244387,32 +244527,36 @@ var AstCliDataFileGenerator = class extends AstFileGenerator {
|
|
|
244387
244527
|
}
|
|
244388
244528
|
const lines = [];
|
|
244389
244529
|
for (const [key, valueExpr] of entries) {
|
|
244390
|
-
const
|
|
244391
|
-
const
|
|
244392
|
-
const printedValue = this.printer.printNode(import_ts_morph8.ts.EmitHint.Unspecified, valueExpr, this.dummySourceFile);
|
|
244393
|
-
const formattedKey = key.includes("::") ? `[${printedKey}]` : `['${printedKey}']`;
|
|
244530
|
+
const printedValue = this.printExpr(valueExpr);
|
|
244531
|
+
const formattedKey = key.includes("::") ? `[${this.printer.printNode(import_ts_morph9.ts.EmitHint.Unspecified, this.buildEnumCaseExpr(key), this.dummySourceFile)}]` : `['${key}']`;
|
|
244394
244532
|
lines.push(` ${formattedKey}: (): RouteContract => ${printedValue},`);
|
|
244395
244533
|
}
|
|
244396
|
-
return ["super({",
|
|
244534
|
+
return ["super({", ...lines, " });"].join("\n ");
|
|
244535
|
+
}
|
|
244536
|
+
/**
|
|
244537
|
+
* Print an expression to source. Parsed nodes (from a `getRoutes()` body)
|
|
244538
|
+
* are emitted via their original source text; synthesized nodes (which
|
|
244539
|
+
* carry no source positions) are emitted through the printer.
|
|
244540
|
+
*/
|
|
244541
|
+
printExpr(expr) {
|
|
244542
|
+
return expr.pos >= 0 ? expr.getText() : this.printer.printNode(import_ts_morph9.ts.EmitHint.Unspecified, expr, this.dummySourceFile);
|
|
244397
244543
|
}
|
|
244398
244544
|
};
|
|
244399
244545
|
|
|
244400
244546
|
// src/Sindri/Generator/Ast/Container/AstContainerDataFileGenerator.ts
|
|
244401
|
-
var
|
|
244547
|
+
var import_ts_morph10 = __toESM(require_ts_morph(), 1);
|
|
244402
244548
|
var AstContainerDataFileGenerator = class extends AstFileGenerator {
|
|
244403
244549
|
classImportMap = {};
|
|
244404
|
-
printer =
|
|
244405
|
-
dummySourceFile =
|
|
244550
|
+
printer = import_ts_morph10.ts.createPrinter({ newLine: import_ts_morph10.ts.NewLineKind.LineFeed });
|
|
244551
|
+
dummySourceFile = import_ts_morph10.ts.createSourceFile(
|
|
244406
244552
|
"_dummy.ts",
|
|
244407
244553
|
"",
|
|
244408
|
-
|
|
244554
|
+
import_ts_morph10.ts.ScriptTarget.ESNext,
|
|
244409
244555
|
false,
|
|
244410
|
-
|
|
244556
|
+
import_ts_morph10.ts.ScriptKind.TS
|
|
244411
244557
|
);
|
|
244412
244558
|
generateFile(directory, className, namespace, publishers) {
|
|
244413
|
-
const
|
|
244414
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244415
|
-
` : "";
|
|
244559
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244416
244560
|
const contents = this.generateClassContents(publishers);
|
|
244417
244561
|
const data = [
|
|
244418
244562
|
"// This file was automatically generated by Sindri.",
|
|
@@ -244436,10 +244580,8 @@ var AstContainerDataFileGenerator = class extends AstFileGenerator {
|
|
|
244436
244580
|
}
|
|
244437
244581
|
const lines = [];
|
|
244438
244582
|
for (const [serviceId, [providerClass, methodName]] of entries) {
|
|
244439
|
-
const keyExpr = this.buildEnumCaseExpr(serviceId);
|
|
244440
|
-
const printedKey = this.printer.printNode(import_ts_morph9.ts.EmitHint.Unspecified, keyExpr, this.dummySourceFile);
|
|
244441
244583
|
const shortProviderClass = providerClass.slice(providerClass.lastIndexOf("\\") + 1);
|
|
244442
|
-
const formattedKey = serviceId.includes("::") ? `[${
|
|
244584
|
+
const formattedKey = serviceId.includes("::") ? `[${this.printer.printNode(import_ts_morph10.ts.EmitHint.Unspecified, this.buildEnumCaseExpr(serviceId), this.dummySourceFile)}]` : `['${serviceId}']`;
|
|
244443
244585
|
lines.push(
|
|
244444
244586
|
` ${formattedKey}: (container: ContainerContract) => ${shortProviderClass}.${methodName}(container),`
|
|
244445
244587
|
);
|
|
@@ -244451,28 +244593,29 @@ var AstContainerDataFileGenerator = class extends AstFileGenerator {
|
|
|
244451
244593
|
};
|
|
244452
244594
|
|
|
244453
244595
|
// src/Sindri/Generator/Ast/Event/AstEventDataFileGenerator.ts
|
|
244454
|
-
var
|
|
244596
|
+
var import_ts_morph11 = __toESM(require_ts_morph(), 1);
|
|
244455
244597
|
var AstEventDataFileGenerator = class extends AstFileGenerator {
|
|
244456
244598
|
classImportMap = {};
|
|
244457
|
-
printer =
|
|
244458
|
-
dummySourceFile =
|
|
244599
|
+
printer = import_ts_morph11.ts.createPrinter({ newLine: import_ts_morph11.ts.NewLineKind.LineFeed });
|
|
244600
|
+
dummySourceFile = import_ts_morph11.ts.createSourceFile(
|
|
244459
244601
|
"_dummy.ts",
|
|
244460
244602
|
"",
|
|
244461
|
-
|
|
244603
|
+
import_ts_morph11.ts.ScriptTarget.ESNext,
|
|
244462
244604
|
false,
|
|
244463
|
-
|
|
244605
|
+
import_ts_morph11.ts.ScriptKind.TS
|
|
244464
244606
|
);
|
|
244465
244607
|
generateFile(directory, className, namespace, listeners) {
|
|
244466
|
-
const
|
|
244467
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244468
|
-
` : "";
|
|
244608
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244469
244609
|
const contents = this.generateClassContents(listeners);
|
|
244610
|
+
const listenerImports = Object.keys(listeners).length > 0 ? [
|
|
244611
|
+
`import { Listener } from '@valkyrjaio/valkyrja/Event/Data/Listener.ts';`,
|
|
244612
|
+
`import type { ListenerContract } from '@valkyrjaio/valkyrja/Event/Data/Contract/ListenerContract.ts';`
|
|
244613
|
+
] : [];
|
|
244470
244614
|
const data = [
|
|
244471
244615
|
"// This file was automatically generated by Sindri.",
|
|
244472
244616
|
"",
|
|
244473
244617
|
`import { EventData } from '@valkyrjaio/valkyrja/Event/Data/EventData.ts';`,
|
|
244474
|
-
|
|
244475
|
-
`import type { ListenerContract } from '@valkyrjaio/valkyrja/Event/Data/Contract/ListenerContract.ts';`,
|
|
244618
|
+
...listenerImports,
|
|
244476
244619
|
userImportsBlock,
|
|
244477
244620
|
`export class ${className} extends EventData {`,
|
|
244478
244621
|
` constructor() {`,
|
|
@@ -244490,7 +244633,7 @@ var AstEventDataFileGenerator = class extends AstFileGenerator {
|
|
|
244490
244633
|
}
|
|
244491
244634
|
const lines = [];
|
|
244492
244635
|
for (const [key, valueExpr] of entries) {
|
|
244493
|
-
const printed = this.printer.printNode(
|
|
244636
|
+
const printed = this.printer.printNode(import_ts_morph11.ts.EmitHint.Unspecified, valueExpr, this.dummySourceFile);
|
|
244494
244637
|
lines.push(` ['${key}']: (): ListenerContract => ${printed},`);
|
|
244495
244638
|
}
|
|
244496
244639
|
return ["super(", " {},", " {", ...lines, " },", " );"].join(
|
|
@@ -244500,7 +244643,22 @@ var AstEventDataFileGenerator = class extends AstFileGenerator {
|
|
|
244500
244643
|
};
|
|
244501
244644
|
|
|
244502
244645
|
// src/Sindri/Generator/Ast/Http/AstHttpDataFileGenerator.ts
|
|
244503
|
-
var
|
|
244646
|
+
var import_ts_morph12 = __toESM(require_ts_morph(), 1);
|
|
244647
|
+
|
|
244648
|
+
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Http/Message/Enum/RequestMethod.ts
|
|
244649
|
+
function allRequestMethods() {
|
|
244650
|
+
return [
|
|
244651
|
+
"GET" /* GET */,
|
|
244652
|
+
"HEAD" /* HEAD */,
|
|
244653
|
+
"POST" /* POST */,
|
|
244654
|
+
"PUT" /* PUT */,
|
|
244655
|
+
"DELETE" /* DELETE */,
|
|
244656
|
+
"CONNECT" /* CONNECT */,
|
|
244657
|
+
"OPTIONS" /* OPTIONS */,
|
|
244658
|
+
"TRACE" /* TRACE */,
|
|
244659
|
+
"PATCH" /* PATCH */
|
|
244660
|
+
];
|
|
244661
|
+
}
|
|
244504
244662
|
|
|
244505
244663
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Http/Throwable/Exception/Abstract/HttpRuntimeException.ts
|
|
244506
244664
|
var HttpRuntimeException = class extends ValkyrjaRuntimeException {
|
|
@@ -244520,7 +244678,7 @@ var HttpRoutingNoResponseStructException = class extends HttpRoutingRuntimeExcep
|
|
|
244520
244678
|
|
|
244521
244679
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Http/Routing/Data/Route.ts
|
|
244522
244680
|
var Route2 = class {
|
|
244523
|
-
constructor(path4, name, handler, requestMethods = ["HEAD" /* HEAD */, "GET" /* GET */], routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], sendingResponseMiddleware = [],
|
|
244681
|
+
constructor(path4, name, handler, requestMethods = ["HEAD" /* HEAD */, "GET" /* GET */], routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], sendingResponseMiddleware = [], responseSentMiddleware = [], requestStruct = null, responseStruct = null) {
|
|
244524
244682
|
this.path = path4;
|
|
244525
244683
|
this.name = name;
|
|
244526
244684
|
this.requestMethods = requestMethods;
|
|
@@ -244528,7 +244686,7 @@ var Route2 = class {
|
|
|
244528
244686
|
this.routeDispatchedMiddleware = routeDispatchedMiddleware;
|
|
244529
244687
|
this.throwableCaughtMiddleware = throwableCaughtMiddleware;
|
|
244530
244688
|
this.sendingResponseMiddleware = sendingResponseMiddleware;
|
|
244531
|
-
this.
|
|
244689
|
+
this.responseSentMiddleware = responseSentMiddleware;
|
|
244532
244690
|
this.requestStruct = requestStruct;
|
|
244533
244691
|
this.responseStruct = responseStruct;
|
|
244534
244692
|
this.handler = handler;
|
|
@@ -244540,7 +244698,7 @@ var Route2 = class {
|
|
|
244540
244698
|
routeDispatchedMiddleware;
|
|
244541
244699
|
throwableCaughtMiddleware;
|
|
244542
244700
|
sendingResponseMiddleware;
|
|
244543
|
-
|
|
244701
|
+
responseSentMiddleware;
|
|
244544
244702
|
requestStruct;
|
|
244545
244703
|
responseStruct;
|
|
244546
244704
|
handler;
|
|
@@ -244652,17 +244810,17 @@ var Route2 = class {
|
|
|
244652
244810
|
clone.sendingResponseMiddleware = [...this.sendingResponseMiddleware, ...middleware];
|
|
244653
244811
|
return clone;
|
|
244654
244812
|
}
|
|
244655
|
-
|
|
244656
|
-
return this.
|
|
244813
|
+
getResponseSentMiddleware() {
|
|
244814
|
+
return this.responseSentMiddleware;
|
|
244657
244815
|
}
|
|
244658
|
-
|
|
244816
|
+
withResponseSentMiddleware(...middleware) {
|
|
244659
244817
|
const clone = ObjectFactory.clone(this);
|
|
244660
|
-
clone.
|
|
244818
|
+
clone.responseSentMiddleware = middleware;
|
|
244661
244819
|
return clone;
|
|
244662
244820
|
}
|
|
244663
|
-
|
|
244821
|
+
withAddedResponseSentMiddleware(...middleware) {
|
|
244664
244822
|
const clone = ObjectFactory.clone(this);
|
|
244665
|
-
clone.
|
|
244823
|
+
clone.responseSentMiddleware = [...this.responseSentMiddleware, ...middleware];
|
|
244666
244824
|
return clone;
|
|
244667
244825
|
}
|
|
244668
244826
|
hasRequestStruct() {
|
|
@@ -244701,7 +244859,7 @@ var Route2 = class {
|
|
|
244701
244859
|
|
|
244702
244860
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Http/Routing/Data/DynamicRoute.ts
|
|
244703
244861
|
var DynamicRoute = class extends Route2 {
|
|
244704
|
-
constructor(path4, name, regex, parameters, handler, requestMethods = ["HEAD" /* HEAD */, "GET" /* GET */], routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], sendingResponseMiddleware = [],
|
|
244862
|
+
constructor(path4, name, regex, parameters, handler, requestMethods = ["HEAD" /* HEAD */, "GET" /* GET */], routeMatchedMiddleware = [], routeDispatchedMiddleware = [], throwableCaughtMiddleware = [], sendingResponseMiddleware = [], responseSentMiddleware = [], requestStruct = null, responseStruct = null) {
|
|
244705
244863
|
super(
|
|
244706
244864
|
path4,
|
|
244707
244865
|
name,
|
|
@@ -244711,7 +244869,7 @@ var DynamicRoute = class extends Route2 {
|
|
|
244711
244869
|
routeDispatchedMiddleware,
|
|
244712
244870
|
throwableCaughtMiddleware,
|
|
244713
244871
|
sendingResponseMiddleware,
|
|
244714
|
-
|
|
244872
|
+
responseSentMiddleware,
|
|
244715
244873
|
requestStruct,
|
|
244716
244874
|
responseStruct
|
|
244717
244875
|
);
|
|
@@ -244953,27 +245111,48 @@ var GeneratorUnreachableException = class extends GeneratorRuntimeException {
|
|
|
244953
245111
|
var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
244954
245112
|
classImportMap = {};
|
|
244955
245113
|
processor;
|
|
244956
|
-
printer =
|
|
244957
|
-
dummySourceFile =
|
|
245114
|
+
printer = import_ts_morph12.ts.createPrinter({ newLine: import_ts_morph12.ts.NewLineKind.LineFeed });
|
|
245115
|
+
dummySourceFile = import_ts_morph12.ts.createSourceFile(
|
|
244958
245116
|
"_dummy.ts",
|
|
244959
245117
|
"",
|
|
244960
|
-
|
|
245118
|
+
import_ts_morph12.ts.ScriptTarget.ESNext,
|
|
244961
245119
|
false,
|
|
244962
|
-
|
|
245120
|
+
import_ts_morph12.ts.ScriptKind.TS
|
|
244963
245121
|
);
|
|
244964
245122
|
constructor(processor = new Processor()) {
|
|
244965
245123
|
super();
|
|
244966
245124
|
this.processor = processor;
|
|
244967
245125
|
}
|
|
244968
245126
|
generateFile(directory, className, namespace, routes, routeData) {
|
|
244969
|
-
const
|
|
244970
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244971
|
-
` : "";
|
|
245127
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244972
245128
|
const routesContent = this.getRoutesAsContent(routes, routeData);
|
|
244973
245129
|
const paths = this.printNestedObject(this.buildPaths(routeData));
|
|
244974
245130
|
const dynamicPaths = this.printNestedObject(this.buildDynamicPaths(routeData));
|
|
244975
245131
|
const regexes = this.printNestedObject(this.buildRegexes(routeData));
|
|
244976
|
-
const data =
|
|
245132
|
+
const data = this.assembleFile(className, userImportsBlock, routesContent, paths, dynamicPaths, regexes);
|
|
245133
|
+
return this.writeFile(directory, className, data);
|
|
245134
|
+
}
|
|
245135
|
+
/**
|
|
245136
|
+
* Generate the routing data file from imperative `getRoutes()` route
|
|
245137
|
+
* objects (as opposed to attribute-scanned routes).
|
|
245138
|
+
*
|
|
245139
|
+
* Each route expression is emitted verbatim as a route closure and the
|
|
245140
|
+
* path/dynamic-path/regex lookup maps are derived from the route objects'
|
|
245141
|
+
* own arguments, mirroring the framework's runtime `RouteCollection`
|
|
245142
|
+
* (literal path and regex, request methods defaulting to `[HEAD, GET]`).
|
|
245143
|
+
*/
|
|
245144
|
+
generateFileFromRoutes(directory, className, _namespace, routeExprs) {
|
|
245145
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
245146
|
+
const metas = routeExprs.map((expr) => this.extractRouteMeta(expr)).filter((meta) => meta !== void 0);
|
|
245147
|
+
const routesContent = this.getImperativeRoutesContent(metas);
|
|
245148
|
+
const paths = this.printNestedObject(this.buildImperativePaths(metas, false));
|
|
245149
|
+
const dynamicPaths = this.printNestedObject(this.buildImperativePaths(metas, true));
|
|
245150
|
+
const regexes = this.printNestedObject(this.buildImperativeRegexes(metas));
|
|
245151
|
+
const data = this.assembleFile(className, userImportsBlock, routesContent, paths, dynamicPaths, regexes);
|
|
245152
|
+
return this.writeFile(directory, className, data);
|
|
245153
|
+
}
|
|
245154
|
+
assembleFile(className, userImportsBlock, routesContent, paths, dynamicPaths, regexes) {
|
|
245155
|
+
return [
|
|
244977
245156
|
"// This file was automatically generated by Sindri.",
|
|
244978
245157
|
"",
|
|
244979
245158
|
`import { HttpRoutingData } from '@valkyrjaio/valkyrja/Http/Routing/Data/HttpRoutingData.ts';`,
|
|
@@ -244996,7 +245175,6 @@ var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
|
244996
245175
|
`}`,
|
|
244997
245176
|
""
|
|
244998
245177
|
].join("\n");
|
|
244999
|
-
return this.writeFile(directory, className, data);
|
|
245000
245178
|
}
|
|
245001
245179
|
generateClassContents(routes, routeData) {
|
|
245002
245180
|
const routesContent = this.getRoutesAsContent(routes, routeData);
|
|
@@ -245069,24 +245247,24 @@ var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
|
245069
245247
|
const innerProps = [];
|
|
245070
245248
|
for (const [innerKey, value] of Object.entries(innerMap)) {
|
|
245071
245249
|
innerProps.push(
|
|
245072
|
-
|
|
245073
|
-
|
|
245074
|
-
|
|
245250
|
+
import_ts_morph12.ts.factory.createPropertyAssignment(
|
|
245251
|
+
import_ts_morph12.ts.factory.createStringLiteral(innerKey),
|
|
245252
|
+
import_ts_morph12.ts.factory.createStringLiteral(value)
|
|
245075
245253
|
)
|
|
245076
245254
|
);
|
|
245077
245255
|
}
|
|
245078
245256
|
outerProps.push(
|
|
245079
|
-
|
|
245080
|
-
|
|
245081
|
-
|
|
245257
|
+
import_ts_morph12.ts.factory.createPropertyAssignment(
|
|
245258
|
+
import_ts_morph12.ts.factory.createStringLiteral(outerKey),
|
|
245259
|
+
import_ts_morph12.ts.factory.createObjectLiteralExpression(innerProps, true)
|
|
245082
245260
|
)
|
|
245083
245261
|
);
|
|
245084
245262
|
}
|
|
245085
|
-
return
|
|
245263
|
+
return import_ts_morph12.ts.factory.createObjectLiteralExpression(outerProps, true);
|
|
245086
245264
|
}
|
|
245087
245265
|
printNestedObject(data) {
|
|
245088
245266
|
return this.printer.printNode(
|
|
245089
|
-
|
|
245267
|
+
import_ts_morph12.ts.EmitHint.Unspecified,
|
|
245090
245268
|
this.buildNestedStringArrayExpr(data),
|
|
245091
245269
|
this.dummySourceFile
|
|
245092
245270
|
);
|
|
@@ -245145,19 +245323,101 @@ var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
|
245145
245323
|
for (const [key, routeExpr] of entries) {
|
|
245146
245324
|
const data = routeData[key] ?? null;
|
|
245147
245325
|
let expr = routeExpr;
|
|
245148
|
-
if (data !== null && data.isDynamic &&
|
|
245326
|
+
if (data !== null && data.isDynamic && import_ts_morph12.ts.isNewExpression(expr)) {
|
|
245149
245327
|
const computedRegex = data.parameters.length > 0 ? this.computeRegex(data) : "";
|
|
245150
|
-
const args = [...expr.arguments ?? [],
|
|
245151
|
-
expr =
|
|
245328
|
+
const args = [...expr.arguments ?? [], import_ts_morph12.ts.factory.createStringLiteral(computedRegex)];
|
|
245329
|
+
expr = import_ts_morph12.ts.factory.createNewExpression(expr.expression, expr.typeArguments, args);
|
|
245152
245330
|
}
|
|
245153
|
-
const
|
|
245154
|
-
const
|
|
245155
|
-
const printedRoute = this.printer.printNode(import_ts_morph11.ts.EmitHint.Unspecified, expr, this.dummySourceFile);
|
|
245156
|
-
const formattedKey = key.includes("::") ? `[${printedKey}]` : `['${printedKey}']`;
|
|
245331
|
+
const printedRoute = this.printer.printNode(import_ts_morph12.ts.EmitHint.Unspecified, expr, this.dummySourceFile);
|
|
245332
|
+
const formattedKey = key.includes("::") ? `[${this.printer.printNode(import_ts_morph12.ts.EmitHint.Unspecified, this.buildEnumCaseExpr(key), this.dummySourceFile)}]` : `['${key}']`;
|
|
245157
245333
|
lines.push(` ${formattedKey}: (): RouteContract => ${printedRoute},`);
|
|
245158
245334
|
}
|
|
245159
245335
|
return ["{", ...lines, " }"].join("\n ");
|
|
245160
245336
|
}
|
|
245337
|
+
// -------------------------------------------------------------------------
|
|
245338
|
+
// Imperative `getRoutes()` support
|
|
245339
|
+
// -------------------------------------------------------------------------
|
|
245340
|
+
/**
|
|
245341
|
+
* Extract routing metadata from a `new Route(...)` / `new DynamicRoute(...)`
|
|
245342
|
+
* expression, matching the framework constructor argument order:
|
|
245343
|
+
* Route(path, name, handler, requestMethods?)
|
|
245344
|
+
* DynamicRoute(path, name, regex, parameters, handler, requestMethods?)
|
|
245345
|
+
*/
|
|
245346
|
+
extractRouteMeta(expr) {
|
|
245347
|
+
if (!import_ts_morph12.ts.isNewExpression(expr) || !import_ts_morph12.ts.isIdentifier(expr.expression)) {
|
|
245348
|
+
return void 0;
|
|
245349
|
+
}
|
|
245350
|
+
const isDynamic = expr.expression.text === "DynamicRoute";
|
|
245351
|
+
const args = expr.arguments ?? import_ts_morph12.ts.factory.createNodeArray();
|
|
245352
|
+
const path4 = this.stringArg(args[0]);
|
|
245353
|
+
const name = this.stringArg(args[1]);
|
|
245354
|
+
if (name === void 0 || path4 === void 0) {
|
|
245355
|
+
return void 0;
|
|
245356
|
+
}
|
|
245357
|
+
const regex = isDynamic ? this.stringArg(args[2]) ?? "" : "";
|
|
245358
|
+
const methodsArg = isDynamic ? args[5] : args[3];
|
|
245359
|
+
const methods = this.extractMethodNamesFromArg(methodsArg);
|
|
245360
|
+
return { expr, name, path: path4, isDynamic, regex, methods };
|
|
245361
|
+
}
|
|
245362
|
+
stringArg(node) {
|
|
245363
|
+
return node !== void 0 && import_ts_morph12.ts.isStringLiteral(node) ? node.text : void 0;
|
|
245364
|
+
}
|
|
245365
|
+
/**
|
|
245366
|
+
* Resolve a `[RequestMethod.GET, ...]` argument to method-name strings,
|
|
245367
|
+
* defaulting to `[HEAD, GET]` (the framework `Route` default) when omitted
|
|
245368
|
+
* and expanding `RequestMethod.ANY` to every request method.
|
|
245369
|
+
*/
|
|
245370
|
+
extractMethodNamesFromArg(node) {
|
|
245371
|
+
if (node === void 0 || !import_ts_morph12.ts.isArrayLiteralExpression(node)) {
|
|
245372
|
+
return ["HEAD" /* HEAD */, "GET" /* GET */];
|
|
245373
|
+
}
|
|
245374
|
+
const methods = [];
|
|
245375
|
+
for (const element of node.elements) {
|
|
245376
|
+
if (!import_ts_morph12.ts.isPropertyAccessExpression(element)) {
|
|
245377
|
+
continue;
|
|
245378
|
+
}
|
|
245379
|
+
const method = element.name.text;
|
|
245380
|
+
if (method === "ANY") {
|
|
245381
|
+
return allRequestMethods();
|
|
245382
|
+
}
|
|
245383
|
+
methods.push(method);
|
|
245384
|
+
}
|
|
245385
|
+
return methods;
|
|
245386
|
+
}
|
|
245387
|
+
getImperativeRoutesContent(metas) {
|
|
245388
|
+
if (metas.length === 0) {
|
|
245389
|
+
return "{}";
|
|
245390
|
+
}
|
|
245391
|
+
const lines = [];
|
|
245392
|
+
for (const meta of metas) {
|
|
245393
|
+
lines.push(` ['${meta.name}']: (): RouteContract => ${meta.expr.getText()},`);
|
|
245394
|
+
}
|
|
245395
|
+
return ["{", ...lines, " }"].join("\n ");
|
|
245396
|
+
}
|
|
245397
|
+
buildImperativePaths(metas, dynamic) {
|
|
245398
|
+
const paths = {};
|
|
245399
|
+
for (const meta of metas) {
|
|
245400
|
+
if (meta.isDynamic !== dynamic) {
|
|
245401
|
+
continue;
|
|
245402
|
+
}
|
|
245403
|
+
for (const method of meta.methods) {
|
|
245404
|
+
(paths[method] ??= {})[meta.path] = meta.name;
|
|
245405
|
+
}
|
|
245406
|
+
}
|
|
245407
|
+
return paths;
|
|
245408
|
+
}
|
|
245409
|
+
buildImperativeRegexes(metas) {
|
|
245410
|
+
const regexes = {};
|
|
245411
|
+
for (const meta of metas) {
|
|
245412
|
+
if (!meta.isDynamic || meta.regex === "") {
|
|
245413
|
+
continue;
|
|
245414
|
+
}
|
|
245415
|
+
for (const method of meta.methods) {
|
|
245416
|
+
(regexes[method] ??= {})[meta.regex] = meta.name;
|
|
245417
|
+
}
|
|
245418
|
+
}
|
|
245419
|
+
return regexes;
|
|
245420
|
+
}
|
|
245161
245421
|
};
|
|
245162
245422
|
|
|
245163
245423
|
// src/Sindri/Generate/Abstract/GenerateDataFromAst.ts
|
|
@@ -245165,36 +245425,14 @@ var fs3 = __toESM(require("fs"), 1);
|
|
|
245165
245425
|
var path3 = __toESM(require("path"), 1);
|
|
245166
245426
|
|
|
245167
245427
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Cli/Interaction/Enum/BackgroundColor.ts
|
|
245168
|
-
|
|
245169
|
-
|
|
245170
|
-
|
|
245171
|
-
BackgroundColor2[BackgroundColor2["GREEN"] = 42] = "GREEN";
|
|
245172
|
-
BackgroundColor2[BackgroundColor2["YELLOW"] = 43] = "YELLOW";
|
|
245173
|
-
BackgroundColor2[BackgroundColor2["BLUE"] = 44] = "BLUE";
|
|
245174
|
-
BackgroundColor2[BackgroundColor2["MAGENTA"] = 45] = "MAGENTA";
|
|
245175
|
-
BackgroundColor2[BackgroundColor2["CYAN"] = 46] = "CYAN";
|
|
245176
|
-
BackgroundColor2[BackgroundColor2["WHITE"] = 47] = "WHITE";
|
|
245177
|
-
BackgroundColor2[BackgroundColor2["DARK_GRAY"] = 100] = "DARK_GRAY";
|
|
245178
|
-
BackgroundColor2[BackgroundColor2["LIGHT_RED"] = 101] = "LIGHT_RED";
|
|
245179
|
-
BackgroundColor2[BackgroundColor2["LIGHT_GREEN"] = 102] = "LIGHT_GREEN";
|
|
245180
|
-
BackgroundColor2[BackgroundColor2["LIGHT_YELLOW"] = 103] = "LIGHT_YELLOW";
|
|
245181
|
-
BackgroundColor2[BackgroundColor2["LIGHT_BLUE"] = 104] = "LIGHT_BLUE";
|
|
245182
|
-
BackgroundColor2[BackgroundColor2["LIGHT_MAGENTA"] = 105] = "LIGHT_MAGENTA";
|
|
245183
|
-
BackgroundColor2[BackgroundColor2["LIGHT_CYAN"] = 106] = "LIGHT_CYAN";
|
|
245184
|
-
BackgroundColor2[BackgroundColor2["LIGHT_WHITE"] = 107] = "LIGHT_WHITE";
|
|
245185
|
-
return BackgroundColor2;
|
|
245186
|
-
})(BackgroundColor || {});
|
|
245187
|
-
((BackgroundColor2) => {
|
|
245188
|
-
function getDefault() {
|
|
245189
|
-
return 49;
|
|
245190
|
-
}
|
|
245191
|
-
BackgroundColor2.getDefault = getDefault;
|
|
245192
|
-
})(BackgroundColor || (BackgroundColor = {}));
|
|
245428
|
+
function backgroundColorDefault() {
|
|
245429
|
+
return 49;
|
|
245430
|
+
}
|
|
245193
245431
|
|
|
245194
245432
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Cli/Interaction/Format/BackgroundColorFormat.ts
|
|
245195
245433
|
var BackgroundColorFormat = class extends Format {
|
|
245196
245434
|
constructor(backgroundColor) {
|
|
245197
|
-
super(String(backgroundColor), String(
|
|
245435
|
+
super(String(backgroundColor), String(backgroundColorDefault()));
|
|
245198
245436
|
}
|
|
245199
245437
|
};
|
|
245200
245438
|
|
|
@@ -245221,8 +245459,8 @@ var WarningFormatter = class extends Formatter {
|
|
|
245221
245459
|
|
|
245222
245460
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Application/Constant/ApplicationInfo.ts
|
|
245223
245461
|
var ApplicationInfo = class {
|
|
245224
|
-
static VERSION = "26.
|
|
245225
|
-
static VERSION_BUILD_DATE_TIME = "
|
|
245462
|
+
static VERSION = "26.3.0";
|
|
245463
|
+
static VERSION_BUILD_DATE_TIME = "July 25 2026 20:40:59 MST";
|
|
245226
245464
|
static ASCII = `
|
|
245227
245465
|
_ _ _
|
|
245228
245466
|
/\\ /\\__ _| | | ___ _ _ __(_) __ _
|
|
@@ -245331,8 +245569,8 @@ var Header = class extends Message {
|
|
|
245331
245569
|
|
|
245332
245570
|
// src/Sindri/Constant/SindriInfo.ts
|
|
245333
245571
|
var SindriInfo = class {
|
|
245334
|
-
static VERSION = "26.
|
|
245335
|
-
static VERSION_BUILD_DATE_TIME = "
|
|
245572
|
+
static VERSION = "26.3.0";
|
|
245573
|
+
static VERSION_BUILD_DATE_TIME = "July 25 2026 21:11:03 MST";
|
|
245336
245574
|
static ICON = ` \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
|
|
245337
245575
|
\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588
|
|
245338
245576
|
\u2588\u2588\u2588\u2588
|
|
@@ -245478,17 +245716,31 @@ var GenerateDataFromAst = class {
|
|
|
245478
245716
|
}
|
|
245479
245717
|
return "";
|
|
245480
245718
|
}
|
|
245719
|
+
/**
|
|
245720
|
+
* Build the `import { X } from '...'` specifier for a class file, relative
|
|
245721
|
+
* to the generated data file's output directory. Used to import the
|
|
245722
|
+
* provider/handler classes referenced by the generated data caches.
|
|
245723
|
+
*/
|
|
245724
|
+
relativeSpecifier(fromDir, toFile) {
|
|
245725
|
+
const relative2 = path3.relative(fromDir, toFile).split(path3.sep).join("/");
|
|
245726
|
+
return relative2.startsWith(".") ? relative2 : `./${relative2}`;
|
|
245727
|
+
}
|
|
245481
245728
|
generateContainerData(serviceProviders, config, output) {
|
|
245482
245729
|
output = output.withAddedMessages(new Message("Generating Container Data......................")).writeMessages();
|
|
245483
245730
|
const publishers = {};
|
|
245731
|
+
const importMap = {};
|
|
245484
245732
|
for (const providerClass of serviceProviders) {
|
|
245485
245733
|
const filePath = this.fqnToFilePath(providerClass, config.namespace, config.dir);
|
|
245486
245734
|
if (filePath === "" || !fs3.existsSync(filePath)) {
|
|
245487
245735
|
continue;
|
|
245488
245736
|
}
|
|
245489
245737
|
const result = this.serviceProviderReader.readFile(filePath);
|
|
245738
|
+
if (Object.keys(result.publishers).length > 0) {
|
|
245739
|
+
importMap[path3.basename(filePath, ".ts")] = this.relativeSpecifier(config.dataPath, filePath);
|
|
245740
|
+
}
|
|
245490
245741
|
Object.assign(publishers, result.publishers);
|
|
245491
245742
|
}
|
|
245743
|
+
this.containerGenerator.classImportMap = importMap;
|
|
245492
245744
|
const status = this.containerGenerator.generateFile(
|
|
245493
245745
|
config.dataPath,
|
|
245494
245746
|
"AppContainerData",
|
|
@@ -245526,12 +245778,18 @@ var GenerateDataFromAst = class {
|
|
|
245526
245778
|
generateCliData(cliRouteProviders, config, output) {
|
|
245527
245779
|
output = output.withAddedMessages(new Message("Generating Cli Routes Data.....................")).writeMessages();
|
|
245528
245780
|
const allRoutes = {};
|
|
245781
|
+
const imperativeRoutes = [];
|
|
245782
|
+
const importMap = {};
|
|
245529
245783
|
for (const providerClass of cliRouteProviders) {
|
|
245530
245784
|
const filePath = this.fqnToFilePath(providerClass, config.namespace, config.dir);
|
|
245531
245785
|
if (filePath === "" || !fs3.existsSync(filePath)) {
|
|
245532
245786
|
continue;
|
|
245533
245787
|
}
|
|
245534
245788
|
const providerResult = this.routeProviderReader.readFile(filePath);
|
|
245789
|
+
if (providerResult.routes.length > 0) {
|
|
245790
|
+
imperativeRoutes.push(...providerResult.routes);
|
|
245791
|
+
importMap[path3.basename(filePath, ".ts")] = this.relativeSpecifier(config.dataPath, filePath);
|
|
245792
|
+
}
|
|
245535
245793
|
for (const controllerClass of providerResult.controllerClasses) {
|
|
245536
245794
|
const controllerPath = this.fqnToFilePath(controllerClass, config.namespace, config.dir);
|
|
245537
245795
|
if (controllerPath === "" || !fs3.existsSync(controllerPath)) {
|
|
@@ -245541,24 +245799,31 @@ var GenerateDataFromAst = class {
|
|
|
245541
245799
|
Object.assign(allRoutes, attrResult.routes);
|
|
245542
245800
|
}
|
|
245543
245801
|
}
|
|
245544
|
-
|
|
245802
|
+
this.cliGenerator.classImportMap = importMap;
|
|
245803
|
+
const status = imperativeRoutes.length > 0 ? this.cliGenerator.generateFileFromRoutes(
|
|
245545
245804
|
config.dataPath,
|
|
245546
245805
|
"AppCliRoutingData",
|
|
245547
245806
|
config.dataNamespace,
|
|
245548
|
-
|
|
245549
|
-
);
|
|
245807
|
+
imperativeRoutes
|
|
245808
|
+
) : this.cliGenerator.generateFile(config.dataPath, "AppCliRoutingData", config.dataNamespace, allRoutes);
|
|
245550
245809
|
return this.addMessagesForGenerateStatus(output, status).withAddedMessages(new NewLine()).writeMessages();
|
|
245551
245810
|
}
|
|
245552
245811
|
generateHttpData(httpRouteProviders, config, output) {
|
|
245553
245812
|
output = output.withAddedMessages(new Message("Generating Http Routes Data....................")).writeMessages();
|
|
245554
245813
|
const allRoutes = {};
|
|
245555
245814
|
const allRouteData = {};
|
|
245815
|
+
const imperativeRoutes = [];
|
|
245816
|
+
const importMap = {};
|
|
245556
245817
|
for (const providerClass of httpRouteProviders) {
|
|
245557
245818
|
const filePath = this.fqnToFilePath(providerClass, config.namespace, config.dir);
|
|
245558
245819
|
if (filePath === "" || !fs3.existsSync(filePath)) {
|
|
245559
245820
|
continue;
|
|
245560
245821
|
}
|
|
245561
245822
|
const providerResult = this.routeProviderReader.readFile(filePath);
|
|
245823
|
+
if (providerResult.routes.length > 0) {
|
|
245824
|
+
imperativeRoutes.push(...providerResult.routes);
|
|
245825
|
+
importMap[path3.basename(filePath, ".ts")] = this.relativeSpecifier(config.dataPath, filePath);
|
|
245826
|
+
}
|
|
245562
245827
|
for (const controllerClass of providerResult.controllerClasses) {
|
|
245563
245828
|
const controllerPath = this.fqnToFilePath(controllerClass, config.namespace, config.dir);
|
|
245564
245829
|
if (controllerPath === "" || !fs3.existsSync(controllerPath)) {
|
|
@@ -245569,7 +245834,13 @@ var GenerateDataFromAst = class {
|
|
|
245569
245834
|
Object.assign(allRouteData, attrResult.routeData);
|
|
245570
245835
|
}
|
|
245571
245836
|
}
|
|
245572
|
-
|
|
245837
|
+
this.httpGenerator.classImportMap = importMap;
|
|
245838
|
+
const status = imperativeRoutes.length > 0 ? this.httpGenerator.generateFileFromRoutes(
|
|
245839
|
+
config.dataPath,
|
|
245840
|
+
"AppHttpRoutingData",
|
|
245841
|
+
config.dataNamespace,
|
|
245842
|
+
imperativeRoutes
|
|
245843
|
+
) : this.httpGenerator.generateFile(
|
|
245573
245844
|
config.dataPath,
|
|
245574
245845
|
"AppHttpRoutingData",
|
|
245575
245846
|
config.dataNamespace,
|