@valkyrjaio/sindri 26.2.0 → 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 +395 -129
- package/package.json +2 -2
- package/src/Sindri/Ast/Abstract/AstReader.ts +80 -0
- package/src/Sindri/Ast/ComponentProviderReader.ts +9 -5
- package/src/Sindri/Ast/ConfigReader.ts +14 -6
- 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
|
}
|
|
@@ -213537,7 +213537,7 @@ var require_path_browserify = __commonJS({
|
|
|
213537
213537
|
}
|
|
213538
213538
|
return res;
|
|
213539
213539
|
}
|
|
213540
|
-
function _format(
|
|
213540
|
+
function _format(sep2, pathObject) {
|
|
213541
213541
|
var dir = pathObject.dir || pathObject.root;
|
|
213542
213542
|
var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
213543
213543
|
if (!dir) {
|
|
@@ -213546,7 +213546,7 @@ var require_path_browserify = __commonJS({
|
|
|
213546
213546
|
if (dir === pathObject.root) {
|
|
213547
213547
|
return dir + base;
|
|
213548
213548
|
}
|
|
213549
|
-
return dir +
|
|
213549
|
+
return dir + sep2 + base;
|
|
213550
213550
|
}
|
|
213551
213551
|
var posix = {
|
|
213552
213552
|
// path.resolve([from ...], to)
|
|
@@ -213615,7 +213615,7 @@ var require_path_browserify = __commonJS({
|
|
|
213615
213615
|
return ".";
|
|
213616
213616
|
return posix.normalize(joined);
|
|
213617
213617
|
},
|
|
213618
|
-
relative: function
|
|
213618
|
+
relative: function relative2(from, to) {
|
|
213619
213619
|
assertPath(from);
|
|
213620
213620
|
assertPath(to);
|
|
213621
213621
|
if (from === to) return "";
|
|
@@ -213706,7 +213706,7 @@ var require_path_browserify = __commonJS({
|
|
|
213706
213706
|
if (hasRoot && end === 1) return "//";
|
|
213707
213707
|
return path4.slice(0, end);
|
|
213708
213708
|
},
|
|
213709
|
-
basename: function
|
|
213709
|
+
basename: function basename2(path4, ext) {
|
|
213710
213710
|
if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
|
|
213711
213711
|
assertPath(path4);
|
|
213712
213712
|
var start = 0;
|
|
@@ -216463,12 +216463,12 @@ var require_dist2 = __commonJS({
|
|
|
216463
216463
|
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
216464
216464
|
}
|
|
216465
216465
|
async function glob(globInput, options) {
|
|
216466
|
-
const [crawler,
|
|
216467
|
-
return crawler ? formatPaths(await crawler.withPromise(),
|
|
216466
|
+
const [crawler, relative2] = getCrawler(globInput, options);
|
|
216467
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative2) : [];
|
|
216468
216468
|
}
|
|
216469
216469
|
function globSync(globInput, options) {
|
|
216470
|
-
const [crawler,
|
|
216471
|
-
return crawler ? formatPaths(crawler.sync(),
|
|
216470
|
+
const [crawler, relative2] = getCrawler(globInput, options);
|
|
216471
|
+
return crawler ? formatPaths(crawler.sync(), relative2) : [];
|
|
216472
216472
|
}
|
|
216473
216473
|
exports2.convertPathToPattern = convertPathToPattern;
|
|
216474
216474
|
exports2.escapePath = escapePath;
|
|
@@ -216482,7 +216482,7 @@ var require_dist2 = __commonJS({
|
|
|
216482
216482
|
var require_ts_morph_common = __commonJS({
|
|
216483
216483
|
"node_modules/@ts-morph/common/dist/ts-morph-common.js"(exports2) {
|
|
216484
216484
|
"use strict";
|
|
216485
|
-
var
|
|
216485
|
+
var ts13 = require_typescript();
|
|
216486
216486
|
var minimatch = require_commonjs3();
|
|
216487
216487
|
var path$1 = require_path_browserify();
|
|
216488
216488
|
var fs$1 = require("node:fs");
|
|
@@ -216512,7 +216512,7 @@ var require_ts_morph_common = __commonJS({
|
|
|
216512
216512
|
n.default = e;
|
|
216513
216513
|
return Object.freeze(n);
|
|
216514
216514
|
}
|
|
216515
|
-
var ts__namespace = /* @__PURE__ */ _interopNamespaceCompat(
|
|
216515
|
+
var ts__namespace = /* @__PURE__ */ _interopNamespaceCompat(ts13);
|
|
216516
216516
|
var minimatch__namespace = /* @__PURE__ */ _interopNamespaceCompat(minimatch);
|
|
216517
216517
|
var path__default = /* @__PURE__ */ _interopDefaultCompat(path$1);
|
|
216518
216518
|
var fs__namespace = /* @__PURE__ */ _interopNamespaceCompat(fs$1);
|
|
@@ -219622,85 +219622,85 @@ ${nodeLocation}` : message;
|
|
|
219622
219622
|
Object.defineProperty(exports2, "DiagnosticCategory", {
|
|
219623
219623
|
enumerable: true,
|
|
219624
219624
|
get: function() {
|
|
219625
|
-
return
|
|
219625
|
+
return ts13.DiagnosticCategory;
|
|
219626
219626
|
}
|
|
219627
219627
|
});
|
|
219628
219628
|
Object.defineProperty(exports2, "EmitHint", {
|
|
219629
219629
|
enumerable: true,
|
|
219630
219630
|
get: function() {
|
|
219631
|
-
return
|
|
219631
|
+
return ts13.EmitHint;
|
|
219632
219632
|
}
|
|
219633
219633
|
});
|
|
219634
219634
|
Object.defineProperty(exports2, "LanguageVariant", {
|
|
219635
219635
|
enumerable: true,
|
|
219636
219636
|
get: function() {
|
|
219637
|
-
return
|
|
219637
|
+
return ts13.LanguageVariant;
|
|
219638
219638
|
}
|
|
219639
219639
|
});
|
|
219640
219640
|
Object.defineProperty(exports2, "ModuleKind", {
|
|
219641
219641
|
enumerable: true,
|
|
219642
219642
|
get: function() {
|
|
219643
|
-
return
|
|
219643
|
+
return ts13.ModuleKind;
|
|
219644
219644
|
}
|
|
219645
219645
|
});
|
|
219646
219646
|
Object.defineProperty(exports2, "ModuleResolutionKind", {
|
|
219647
219647
|
enumerable: true,
|
|
219648
219648
|
get: function() {
|
|
219649
|
-
return
|
|
219649
|
+
return ts13.ModuleResolutionKind;
|
|
219650
219650
|
}
|
|
219651
219651
|
});
|
|
219652
219652
|
Object.defineProperty(exports2, "NewLineKind", {
|
|
219653
219653
|
enumerable: true,
|
|
219654
219654
|
get: function() {
|
|
219655
|
-
return
|
|
219655
|
+
return ts13.NewLineKind;
|
|
219656
219656
|
}
|
|
219657
219657
|
});
|
|
219658
219658
|
Object.defineProperty(exports2, "NodeFlags", {
|
|
219659
219659
|
enumerable: true,
|
|
219660
219660
|
get: function() {
|
|
219661
|
-
return
|
|
219661
|
+
return ts13.NodeFlags;
|
|
219662
219662
|
}
|
|
219663
219663
|
});
|
|
219664
219664
|
Object.defineProperty(exports2, "ObjectFlags", {
|
|
219665
219665
|
enumerable: true,
|
|
219666
219666
|
get: function() {
|
|
219667
|
-
return
|
|
219667
|
+
return ts13.ObjectFlags;
|
|
219668
219668
|
}
|
|
219669
219669
|
});
|
|
219670
219670
|
Object.defineProperty(exports2, "ScriptKind", {
|
|
219671
219671
|
enumerable: true,
|
|
219672
219672
|
get: function() {
|
|
219673
|
-
return
|
|
219673
|
+
return ts13.ScriptKind;
|
|
219674
219674
|
}
|
|
219675
219675
|
});
|
|
219676
219676
|
Object.defineProperty(exports2, "ScriptTarget", {
|
|
219677
219677
|
enumerable: true,
|
|
219678
219678
|
get: function() {
|
|
219679
|
-
return
|
|
219679
|
+
return ts13.ScriptTarget;
|
|
219680
219680
|
}
|
|
219681
219681
|
});
|
|
219682
219682
|
Object.defineProperty(exports2, "SymbolFlags", {
|
|
219683
219683
|
enumerable: true,
|
|
219684
219684
|
get: function() {
|
|
219685
|
-
return
|
|
219685
|
+
return ts13.SymbolFlags;
|
|
219686
219686
|
}
|
|
219687
219687
|
});
|
|
219688
219688
|
Object.defineProperty(exports2, "SyntaxKind", {
|
|
219689
219689
|
enumerable: true,
|
|
219690
219690
|
get: function() {
|
|
219691
|
-
return
|
|
219691
|
+
return ts13.SyntaxKind;
|
|
219692
219692
|
}
|
|
219693
219693
|
});
|
|
219694
219694
|
Object.defineProperty(exports2, "TypeFlags", {
|
|
219695
219695
|
enumerable: true,
|
|
219696
219696
|
get: function() {
|
|
219697
|
-
return
|
|
219697
|
+
return ts13.TypeFlags;
|
|
219698
219698
|
}
|
|
219699
219699
|
});
|
|
219700
219700
|
Object.defineProperty(exports2, "TypeFormatFlags", {
|
|
219701
219701
|
enumerable: true,
|
|
219702
219702
|
get: function() {
|
|
219703
|
-
return
|
|
219703
|
+
return ts13.TypeFormatFlags;
|
|
219704
219704
|
}
|
|
219705
219705
|
});
|
|
219706
219706
|
exports2.ts = ts__namespace;
|
|
@@ -242650,6 +242650,61 @@ var AstReader = class {
|
|
|
242650
242650
|
}
|
|
242651
242651
|
return classes;
|
|
242652
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
|
+
}
|
|
242653
242708
|
/**
|
|
242654
242709
|
* Extract service ID strings from keys of an object-returning method.
|
|
242655
242710
|
*
|
|
@@ -243427,11 +243482,11 @@ var ComponentProviderReader = class _ComponentProviderReader extends AstReader {
|
|
|
243427
243482
|
const useMap = this.buildUseMap(sourceFile);
|
|
243428
243483
|
const methods = this.indexMethods(classDecl);
|
|
243429
243484
|
return new ComponentProviderResult(
|
|
243430
|
-
this.
|
|
243431
|
-
this.
|
|
243432
|
-
this.
|
|
243433
|
-
this.
|
|
243434
|
-
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)
|
|
243435
243490
|
);
|
|
243436
243491
|
}
|
|
243437
243492
|
};
|
|
@@ -243576,14 +243631,24 @@ var ConfigReader = class extends AstReader {
|
|
|
243576
243631
|
return dataPath;
|
|
243577
243632
|
}
|
|
243578
243633
|
/**
|
|
243579
|
-
* Extract
|
|
243580
|
-
*
|
|
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.
|
|
243581
243646
|
*/
|
|
243582
243647
|
extractProvidersFromArgs(args, useMap, filePath) {
|
|
243583
|
-
for (let i =
|
|
243648
|
+
for (let i = 9; i < args.length; i++) {
|
|
243584
243649
|
const arg = args[i];
|
|
243585
243650
|
if (arg !== void 0 && import_ts_morph3.ts.isArrayLiteralExpression(arg)) {
|
|
243586
|
-
return this.
|
|
243651
|
+
return this.extractClassPathListFromArrayExpr(arg, useMap, filePath);
|
|
243587
243652
|
}
|
|
243588
243653
|
}
|
|
243589
243654
|
return [];
|
|
@@ -244201,6 +244266,9 @@ var ListenerProviderReader = class _ListenerProviderReader extends AstReader {
|
|
|
244201
244266
|
}
|
|
244202
244267
|
};
|
|
244203
244268
|
|
|
244269
|
+
// src/Sindri/Ast/RouteProviderReader.ts
|
|
244270
|
+
var import_ts_morph6 = __toESM(require_ts_morph(), 1);
|
|
244271
|
+
|
|
244204
244272
|
// src/Sindri/Ast/Data/Result/RouteProviderResult.ts
|
|
244205
244273
|
var RouteProviderResult = class _RouteProviderResult {
|
|
244206
244274
|
constructor(controllerClasses = [], routes = []) {
|
|
@@ -244234,13 +244302,31 @@ var RouteProviderReader = class _RouteProviderReader extends AstReader {
|
|
|
244234
244302
|
this.extractRoutes(methods[_RouteProviderReader.METHOD_ROUTES], useMap, filePath)
|
|
244235
244303
|
);
|
|
244236
244304
|
}
|
|
244237
|
-
|
|
244238
|
-
|
|
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));
|
|
244239
244325
|
}
|
|
244240
244326
|
};
|
|
244241
244327
|
|
|
244242
244328
|
// src/Sindri/Ast/ServiceProviderReader.ts
|
|
244243
|
-
var
|
|
244329
|
+
var import_ts_morph7 = __toESM(require_ts_morph(), 1);
|
|
244244
244330
|
|
|
244245
244331
|
// src/Sindri/Ast/Data/Result/ServiceProviderResult.ts
|
|
244246
244332
|
var ServiceProviderResult = class _ServiceProviderResult {
|
|
@@ -244293,7 +244379,7 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244293
244379
|
}
|
|
244294
244380
|
const map = {};
|
|
244295
244381
|
for (const prop of obj.properties) {
|
|
244296
|
-
if (!
|
|
244382
|
+
if (!import_ts_morph7.ts.isPropertyAssignment(prop)) {
|
|
244297
244383
|
continue;
|
|
244298
244384
|
}
|
|
244299
244385
|
const serviceId = this.resolvePropertyKeyToString(prop.name, useMap, filePath);
|
|
@@ -244314,8 +244400,8 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244314
244400
|
* Handles: `ProviderClass.publishMethod` and `[ProviderClass, 'method']`.
|
|
244315
244401
|
*/
|
|
244316
244402
|
extractHandlerFromValue(node, useMap, filePath, currentClass) {
|
|
244317
|
-
if (
|
|
244318
|
-
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;
|
|
244319
244405
|
if (className === void 0) {
|
|
244320
244406
|
return void 0;
|
|
244321
244407
|
}
|
|
@@ -244323,7 +244409,7 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244323
244409
|
const resolvedClass = className === "self" || className === "this" ? currentClass : className;
|
|
244324
244410
|
return [resolvedClass, methodName];
|
|
244325
244411
|
}
|
|
244326
|
-
if (
|
|
244412
|
+
if (import_ts_morph7.ts.isArrayLiteralExpression(node) && node.elements.length === 2) {
|
|
244327
244413
|
const raw = this.extractHandlerFromTsArray(node, useMap, filePath, currentClass);
|
|
244328
244414
|
if (raw !== void 0) {
|
|
244329
244415
|
return [raw.class, raw.method];
|
|
@@ -244334,11 +244420,11 @@ var ServiceProviderReader = class _ServiceProviderReader extends AstReader {
|
|
|
244334
244420
|
};
|
|
244335
244421
|
|
|
244336
244422
|
// src/Sindri/Generator/Ast/Cli/AstCliDataFileGenerator.ts
|
|
244337
|
-
var
|
|
244423
|
+
var import_ts_morph9 = __toESM(require_ts_morph(), 1);
|
|
244338
244424
|
|
|
244339
244425
|
// src/Sindri/Generator/Abstract/AstFileGenerator.ts
|
|
244340
244426
|
var fs2 = __toESM(require("fs"), 1);
|
|
244341
|
-
var
|
|
244427
|
+
var import_ts_morph8 = __toESM(require_ts_morph(), 1);
|
|
244342
244428
|
var AstFileGenerator = class {
|
|
244343
244429
|
/**
|
|
244344
244430
|
* Build a property access or string literal expression from a "ClassName::CASE" string.
|
|
@@ -244346,12 +244432,22 @@ var AstFileGenerator = class {
|
|
|
244346
244432
|
buildEnumCaseExpr(fqnColonCase) {
|
|
244347
244433
|
const pos = fqnColonCase.indexOf("::");
|
|
244348
244434
|
if (pos === -1) {
|
|
244349
|
-
return
|
|
244435
|
+
return import_ts_morph8.ts.factory.createStringLiteral(fqnColonCase);
|
|
244350
244436
|
}
|
|
244351
244437
|
const fqn = fqnColonCase.substring(0, pos);
|
|
244352
244438
|
const caseName = fqnColonCase.substring(pos + 2);
|
|
244353
244439
|
const className = fqn.slice(fqn.lastIndexOf("\\") + 1);
|
|
244354
|
-
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
|
+
` : "";
|
|
244355
244451
|
}
|
|
244356
244452
|
writeFile(directory, className, data) {
|
|
244357
244453
|
const filePath = directory.replace(/\/$/, "") + `/${className}.ts`;
|
|
@@ -244372,18 +244468,16 @@ var AstFileGenerator = class {
|
|
|
244372
244468
|
// src/Sindri/Generator/Ast/Cli/AstCliDataFileGenerator.ts
|
|
244373
244469
|
var AstCliDataFileGenerator = class extends AstFileGenerator {
|
|
244374
244470
|
classImportMap = {};
|
|
244375
|
-
printer =
|
|
244376
|
-
dummySourceFile =
|
|
244471
|
+
printer = import_ts_morph9.ts.createPrinter({ newLine: import_ts_morph9.ts.NewLineKind.LineFeed });
|
|
244472
|
+
dummySourceFile = import_ts_morph9.ts.createSourceFile(
|
|
244377
244473
|
"_dummy.ts",
|
|
244378
244474
|
"",
|
|
244379
|
-
|
|
244475
|
+
import_ts_morph9.ts.ScriptTarget.ESNext,
|
|
244380
244476
|
false,
|
|
244381
|
-
|
|
244477
|
+
import_ts_morph9.ts.ScriptKind.TS
|
|
244382
244478
|
);
|
|
244383
244479
|
generateFile(directory, className, namespace, routes) {
|
|
244384
|
-
const
|
|
244385
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244386
|
-
` : "";
|
|
244480
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244387
244481
|
const contents = this.generateClassContents(routes);
|
|
244388
244482
|
const data = [
|
|
244389
244483
|
"// This file was automatically generated by Sindri.",
|
|
@@ -244407,6 +244501,25 @@ var AstCliDataFileGenerator = class extends AstFileGenerator {
|
|
|
244407
244501
|
].join("\n");
|
|
244408
244502
|
return this.writeFile(directory, className, data);
|
|
244409
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
|
+
}
|
|
244410
244523
|
generateClassContents(routes) {
|
|
244411
244524
|
const entries = Object.entries(routes);
|
|
244412
244525
|
if (entries.length === 0) {
|
|
@@ -244414,32 +244527,36 @@ var AstCliDataFileGenerator = class extends AstFileGenerator {
|
|
|
244414
244527
|
}
|
|
244415
244528
|
const lines = [];
|
|
244416
244529
|
for (const [key, valueExpr] of entries) {
|
|
244417
|
-
const
|
|
244418
|
-
const
|
|
244419
|
-
const printedValue = this.printer.printNode(import_ts_morph8.ts.EmitHint.Unspecified, valueExpr, this.dummySourceFile);
|
|
244420
|
-
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}']`;
|
|
244421
244532
|
lines.push(` ${formattedKey}: (): RouteContract => ${printedValue},`);
|
|
244422
244533
|
}
|
|
244423
|
-
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);
|
|
244424
244543
|
}
|
|
244425
244544
|
};
|
|
244426
244545
|
|
|
244427
244546
|
// src/Sindri/Generator/Ast/Container/AstContainerDataFileGenerator.ts
|
|
244428
|
-
var
|
|
244547
|
+
var import_ts_morph10 = __toESM(require_ts_morph(), 1);
|
|
244429
244548
|
var AstContainerDataFileGenerator = class extends AstFileGenerator {
|
|
244430
244549
|
classImportMap = {};
|
|
244431
|
-
printer =
|
|
244432
|
-
dummySourceFile =
|
|
244550
|
+
printer = import_ts_morph10.ts.createPrinter({ newLine: import_ts_morph10.ts.NewLineKind.LineFeed });
|
|
244551
|
+
dummySourceFile = import_ts_morph10.ts.createSourceFile(
|
|
244433
244552
|
"_dummy.ts",
|
|
244434
244553
|
"",
|
|
244435
|
-
|
|
244554
|
+
import_ts_morph10.ts.ScriptTarget.ESNext,
|
|
244436
244555
|
false,
|
|
244437
|
-
|
|
244556
|
+
import_ts_morph10.ts.ScriptKind.TS
|
|
244438
244557
|
);
|
|
244439
244558
|
generateFile(directory, className, namespace, publishers) {
|
|
244440
|
-
const
|
|
244441
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244442
|
-
` : "";
|
|
244559
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244443
244560
|
const contents = this.generateClassContents(publishers);
|
|
244444
244561
|
const data = [
|
|
244445
244562
|
"// This file was automatically generated by Sindri.",
|
|
@@ -244463,10 +244580,8 @@ var AstContainerDataFileGenerator = class extends AstFileGenerator {
|
|
|
244463
244580
|
}
|
|
244464
244581
|
const lines = [];
|
|
244465
244582
|
for (const [serviceId, [providerClass, methodName]] of entries) {
|
|
244466
|
-
const keyExpr = this.buildEnumCaseExpr(serviceId);
|
|
244467
|
-
const printedKey = this.printer.printNode(import_ts_morph9.ts.EmitHint.Unspecified, keyExpr, this.dummySourceFile);
|
|
244468
244583
|
const shortProviderClass = providerClass.slice(providerClass.lastIndexOf("\\") + 1);
|
|
244469
|
-
const formattedKey = serviceId.includes("::") ? `[${
|
|
244584
|
+
const formattedKey = serviceId.includes("::") ? `[${this.printer.printNode(import_ts_morph10.ts.EmitHint.Unspecified, this.buildEnumCaseExpr(serviceId), this.dummySourceFile)}]` : `['${serviceId}']`;
|
|
244470
244585
|
lines.push(
|
|
244471
244586
|
` ${formattedKey}: (container: ContainerContract) => ${shortProviderClass}.${methodName}(container),`
|
|
244472
244587
|
);
|
|
@@ -244478,28 +244593,29 @@ var AstContainerDataFileGenerator = class extends AstFileGenerator {
|
|
|
244478
244593
|
};
|
|
244479
244594
|
|
|
244480
244595
|
// src/Sindri/Generator/Ast/Event/AstEventDataFileGenerator.ts
|
|
244481
|
-
var
|
|
244596
|
+
var import_ts_morph11 = __toESM(require_ts_morph(), 1);
|
|
244482
244597
|
var AstEventDataFileGenerator = class extends AstFileGenerator {
|
|
244483
244598
|
classImportMap = {};
|
|
244484
|
-
printer =
|
|
244485
|
-
dummySourceFile =
|
|
244599
|
+
printer = import_ts_morph11.ts.createPrinter({ newLine: import_ts_morph11.ts.NewLineKind.LineFeed });
|
|
244600
|
+
dummySourceFile = import_ts_morph11.ts.createSourceFile(
|
|
244486
244601
|
"_dummy.ts",
|
|
244487
244602
|
"",
|
|
244488
|
-
|
|
244603
|
+
import_ts_morph11.ts.ScriptTarget.ESNext,
|
|
244489
244604
|
false,
|
|
244490
|
-
|
|
244605
|
+
import_ts_morph11.ts.ScriptKind.TS
|
|
244491
244606
|
);
|
|
244492
244607
|
generateFile(directory, className, namespace, listeners) {
|
|
244493
|
-
const
|
|
244494
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244495
|
-
` : "";
|
|
244608
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244496
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
|
+
] : [];
|
|
244497
244614
|
const data = [
|
|
244498
244615
|
"// This file was automatically generated by Sindri.",
|
|
244499
244616
|
"",
|
|
244500
244617
|
`import { EventData } from '@valkyrjaio/valkyrja/Event/Data/EventData.ts';`,
|
|
244501
|
-
|
|
244502
|
-
`import type { ListenerContract } from '@valkyrjaio/valkyrja/Event/Data/Contract/ListenerContract.ts';`,
|
|
244618
|
+
...listenerImports,
|
|
244503
244619
|
userImportsBlock,
|
|
244504
244620
|
`export class ${className} extends EventData {`,
|
|
244505
244621
|
` constructor() {`,
|
|
@@ -244517,7 +244633,7 @@ var AstEventDataFileGenerator = class extends AstFileGenerator {
|
|
|
244517
244633
|
}
|
|
244518
244634
|
const lines = [];
|
|
244519
244635
|
for (const [key, valueExpr] of entries) {
|
|
244520
|
-
const printed = this.printer.printNode(
|
|
244636
|
+
const printed = this.printer.printNode(import_ts_morph11.ts.EmitHint.Unspecified, valueExpr, this.dummySourceFile);
|
|
244521
244637
|
lines.push(` ['${key}']: (): ListenerContract => ${printed},`);
|
|
244522
244638
|
}
|
|
244523
244639
|
return ["super(", " {},", " {", ...lines, " },", " );"].join(
|
|
@@ -244527,7 +244643,22 @@ var AstEventDataFileGenerator = class extends AstFileGenerator {
|
|
|
244527
244643
|
};
|
|
244528
244644
|
|
|
244529
244645
|
// src/Sindri/Generator/Ast/Http/AstHttpDataFileGenerator.ts
|
|
244530
|
-
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
|
+
}
|
|
244531
244662
|
|
|
244532
244663
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Http/Throwable/Exception/Abstract/HttpRuntimeException.ts
|
|
244533
244664
|
var HttpRuntimeException = class extends ValkyrjaRuntimeException {
|
|
@@ -244980,27 +245111,48 @@ var GeneratorUnreachableException = class extends GeneratorRuntimeException {
|
|
|
244980
245111
|
var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
244981
245112
|
classImportMap = {};
|
|
244982
245113
|
processor;
|
|
244983
|
-
printer =
|
|
244984
|
-
dummySourceFile =
|
|
245114
|
+
printer = import_ts_morph12.ts.createPrinter({ newLine: import_ts_morph12.ts.NewLineKind.LineFeed });
|
|
245115
|
+
dummySourceFile = import_ts_morph12.ts.createSourceFile(
|
|
244985
245116
|
"_dummy.ts",
|
|
244986
245117
|
"",
|
|
244987
|
-
|
|
245118
|
+
import_ts_morph12.ts.ScriptTarget.ESNext,
|
|
244988
245119
|
false,
|
|
244989
|
-
|
|
245120
|
+
import_ts_morph12.ts.ScriptKind.TS
|
|
244990
245121
|
);
|
|
244991
245122
|
constructor(processor = new Processor()) {
|
|
244992
245123
|
super();
|
|
244993
245124
|
this.processor = processor;
|
|
244994
245125
|
}
|
|
244995
245126
|
generateFile(directory, className, namespace, routes, routeData) {
|
|
244996
|
-
const
|
|
244997
|
-
const userImportsBlock = userImports ? `${userImports}
|
|
244998
|
-
` : "";
|
|
245127
|
+
const userImportsBlock = this.buildUserImportsBlock(this.classImportMap);
|
|
244999
245128
|
const routesContent = this.getRoutesAsContent(routes, routeData);
|
|
245000
245129
|
const paths = this.printNestedObject(this.buildPaths(routeData));
|
|
245001
245130
|
const dynamicPaths = this.printNestedObject(this.buildDynamicPaths(routeData));
|
|
245002
245131
|
const regexes = this.printNestedObject(this.buildRegexes(routeData));
|
|
245003
|
-
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 [
|
|
245004
245156
|
"// This file was automatically generated by Sindri.",
|
|
245005
245157
|
"",
|
|
245006
245158
|
`import { HttpRoutingData } from '@valkyrjaio/valkyrja/Http/Routing/Data/HttpRoutingData.ts';`,
|
|
@@ -245023,7 +245175,6 @@ var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
|
245023
245175
|
`}`,
|
|
245024
245176
|
""
|
|
245025
245177
|
].join("\n");
|
|
245026
|
-
return this.writeFile(directory, className, data);
|
|
245027
245178
|
}
|
|
245028
245179
|
generateClassContents(routes, routeData) {
|
|
245029
245180
|
const routesContent = this.getRoutesAsContent(routes, routeData);
|
|
@@ -245096,24 +245247,24 @@ var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
|
245096
245247
|
const innerProps = [];
|
|
245097
245248
|
for (const [innerKey, value] of Object.entries(innerMap)) {
|
|
245098
245249
|
innerProps.push(
|
|
245099
|
-
|
|
245100
|
-
|
|
245101
|
-
|
|
245250
|
+
import_ts_morph12.ts.factory.createPropertyAssignment(
|
|
245251
|
+
import_ts_morph12.ts.factory.createStringLiteral(innerKey),
|
|
245252
|
+
import_ts_morph12.ts.factory.createStringLiteral(value)
|
|
245102
245253
|
)
|
|
245103
245254
|
);
|
|
245104
245255
|
}
|
|
245105
245256
|
outerProps.push(
|
|
245106
|
-
|
|
245107
|
-
|
|
245108
|
-
|
|
245257
|
+
import_ts_morph12.ts.factory.createPropertyAssignment(
|
|
245258
|
+
import_ts_morph12.ts.factory.createStringLiteral(outerKey),
|
|
245259
|
+
import_ts_morph12.ts.factory.createObjectLiteralExpression(innerProps, true)
|
|
245109
245260
|
)
|
|
245110
245261
|
);
|
|
245111
245262
|
}
|
|
245112
|
-
return
|
|
245263
|
+
return import_ts_morph12.ts.factory.createObjectLiteralExpression(outerProps, true);
|
|
245113
245264
|
}
|
|
245114
245265
|
printNestedObject(data) {
|
|
245115
245266
|
return this.printer.printNode(
|
|
245116
|
-
|
|
245267
|
+
import_ts_morph12.ts.EmitHint.Unspecified,
|
|
245117
245268
|
this.buildNestedStringArrayExpr(data),
|
|
245118
245269
|
this.dummySourceFile
|
|
245119
245270
|
);
|
|
@@ -245172,19 +245323,101 @@ var AstHttpDataFileGenerator = class extends AstFileGenerator {
|
|
|
245172
245323
|
for (const [key, routeExpr] of entries) {
|
|
245173
245324
|
const data = routeData[key] ?? null;
|
|
245174
245325
|
let expr = routeExpr;
|
|
245175
|
-
if (data !== null && data.isDynamic &&
|
|
245326
|
+
if (data !== null && data.isDynamic && import_ts_morph12.ts.isNewExpression(expr)) {
|
|
245176
245327
|
const computedRegex = data.parameters.length > 0 ? this.computeRegex(data) : "";
|
|
245177
|
-
const args = [...expr.arguments ?? [],
|
|
245178
|
-
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);
|
|
245179
245330
|
}
|
|
245180
|
-
const
|
|
245181
|
-
const
|
|
245182
|
-
const printedRoute = this.printer.printNode(import_ts_morph11.ts.EmitHint.Unspecified, expr, this.dummySourceFile);
|
|
245183
|
-
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}']`;
|
|
245184
245333
|
lines.push(` ${formattedKey}: (): RouteContract => ${printedRoute},`);
|
|
245185
245334
|
}
|
|
245186
245335
|
return ["{", ...lines, " }"].join("\n ");
|
|
245187
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
|
+
}
|
|
245188
245421
|
};
|
|
245189
245422
|
|
|
245190
245423
|
// src/Sindri/Generate/Abstract/GenerateDataFromAst.ts
|
|
@@ -245226,8 +245459,8 @@ var WarningFormatter = class extends Formatter {
|
|
|
245226
245459
|
|
|
245227
245460
|
// node_modules/@valkyrjaio/valkyrja/src/Valkyrja/Application/Constant/ApplicationInfo.ts
|
|
245228
245461
|
var ApplicationInfo = class {
|
|
245229
|
-
static VERSION = "26.
|
|
245230
|
-
static VERSION_BUILD_DATE_TIME = "July
|
|
245462
|
+
static VERSION = "26.3.0";
|
|
245463
|
+
static VERSION_BUILD_DATE_TIME = "July 25 2026 20:40:59 MST";
|
|
245231
245464
|
static ASCII = `
|
|
245232
245465
|
_ _ _
|
|
245233
245466
|
/\\ /\\__ _| | | ___ _ _ __(_) __ _
|
|
@@ -245336,8 +245569,8 @@ var Header = class extends Message {
|
|
|
245336
245569
|
|
|
245337
245570
|
// src/Sindri/Constant/SindriInfo.ts
|
|
245338
245571
|
var SindriInfo = class {
|
|
245339
|
-
static VERSION = "26.
|
|
245340
|
-
static VERSION_BUILD_DATE_TIME = "July 25 2026
|
|
245572
|
+
static VERSION = "26.3.0";
|
|
245573
|
+
static VERSION_BUILD_DATE_TIME = "July 25 2026 21:11:03 MST";
|
|
245341
245574
|
static ICON = ` \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
|
|
245342
245575
|
\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588
|
|
245343
245576
|
\u2588\u2588\u2588\u2588
|
|
@@ -245483,17 +245716,31 @@ var GenerateDataFromAst = class {
|
|
|
245483
245716
|
}
|
|
245484
245717
|
return "";
|
|
245485
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
|
+
}
|
|
245486
245728
|
generateContainerData(serviceProviders, config, output) {
|
|
245487
245729
|
output = output.withAddedMessages(new Message("Generating Container Data......................")).writeMessages();
|
|
245488
245730
|
const publishers = {};
|
|
245731
|
+
const importMap = {};
|
|
245489
245732
|
for (const providerClass of serviceProviders) {
|
|
245490
245733
|
const filePath = this.fqnToFilePath(providerClass, config.namespace, config.dir);
|
|
245491
245734
|
if (filePath === "" || !fs3.existsSync(filePath)) {
|
|
245492
245735
|
continue;
|
|
245493
245736
|
}
|
|
245494
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
|
+
}
|
|
245495
245741
|
Object.assign(publishers, result.publishers);
|
|
245496
245742
|
}
|
|
245743
|
+
this.containerGenerator.classImportMap = importMap;
|
|
245497
245744
|
const status = this.containerGenerator.generateFile(
|
|
245498
245745
|
config.dataPath,
|
|
245499
245746
|
"AppContainerData",
|
|
@@ -245531,12 +245778,18 @@ var GenerateDataFromAst = class {
|
|
|
245531
245778
|
generateCliData(cliRouteProviders, config, output) {
|
|
245532
245779
|
output = output.withAddedMessages(new Message("Generating Cli Routes Data.....................")).writeMessages();
|
|
245533
245780
|
const allRoutes = {};
|
|
245781
|
+
const imperativeRoutes = [];
|
|
245782
|
+
const importMap = {};
|
|
245534
245783
|
for (const providerClass of cliRouteProviders) {
|
|
245535
245784
|
const filePath = this.fqnToFilePath(providerClass, config.namespace, config.dir);
|
|
245536
245785
|
if (filePath === "" || !fs3.existsSync(filePath)) {
|
|
245537
245786
|
continue;
|
|
245538
245787
|
}
|
|
245539
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
|
+
}
|
|
245540
245793
|
for (const controllerClass of providerResult.controllerClasses) {
|
|
245541
245794
|
const controllerPath = this.fqnToFilePath(controllerClass, config.namespace, config.dir);
|
|
245542
245795
|
if (controllerPath === "" || !fs3.existsSync(controllerPath)) {
|
|
@@ -245546,24 +245799,31 @@ var GenerateDataFromAst = class {
|
|
|
245546
245799
|
Object.assign(allRoutes, attrResult.routes);
|
|
245547
245800
|
}
|
|
245548
245801
|
}
|
|
245549
|
-
|
|
245802
|
+
this.cliGenerator.classImportMap = importMap;
|
|
245803
|
+
const status = imperativeRoutes.length > 0 ? this.cliGenerator.generateFileFromRoutes(
|
|
245550
245804
|
config.dataPath,
|
|
245551
245805
|
"AppCliRoutingData",
|
|
245552
245806
|
config.dataNamespace,
|
|
245553
|
-
|
|
245554
|
-
);
|
|
245807
|
+
imperativeRoutes
|
|
245808
|
+
) : this.cliGenerator.generateFile(config.dataPath, "AppCliRoutingData", config.dataNamespace, allRoutes);
|
|
245555
245809
|
return this.addMessagesForGenerateStatus(output, status).withAddedMessages(new NewLine()).writeMessages();
|
|
245556
245810
|
}
|
|
245557
245811
|
generateHttpData(httpRouteProviders, config, output) {
|
|
245558
245812
|
output = output.withAddedMessages(new Message("Generating Http Routes Data....................")).writeMessages();
|
|
245559
245813
|
const allRoutes = {};
|
|
245560
245814
|
const allRouteData = {};
|
|
245815
|
+
const imperativeRoutes = [];
|
|
245816
|
+
const importMap = {};
|
|
245561
245817
|
for (const providerClass of httpRouteProviders) {
|
|
245562
245818
|
const filePath = this.fqnToFilePath(providerClass, config.namespace, config.dir);
|
|
245563
245819
|
if (filePath === "" || !fs3.existsSync(filePath)) {
|
|
245564
245820
|
continue;
|
|
245565
245821
|
}
|
|
245566
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
|
+
}
|
|
245567
245827
|
for (const controllerClass of providerResult.controllerClasses) {
|
|
245568
245828
|
const controllerPath = this.fqnToFilePath(controllerClass, config.namespace, config.dir);
|
|
245569
245829
|
if (controllerPath === "" || !fs3.existsSync(controllerPath)) {
|
|
@@ -245574,7 +245834,13 @@ var GenerateDataFromAst = class {
|
|
|
245574
245834
|
Object.assign(allRouteData, attrResult.routeData);
|
|
245575
245835
|
}
|
|
245576
245836
|
}
|
|
245577
|
-
|
|
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(
|
|
245578
245844
|
config.dataPath,
|
|
245579
245845
|
"AppHttpRoutingData",
|
|
245580
245846
|
config.dataNamespace,
|