@stacksjs/router 0.58.62 → 0.58.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -1
- package/package.json +1 -1
- package/src/router.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -210,6 +210,9 @@ function actionsPath(path2) {
|
|
|
210
210
|
function relativeActionsPath(path2) {
|
|
211
211
|
return relative(projectPath(), actionsPath(path2));
|
|
212
212
|
}
|
|
213
|
+
function userActionsPath(path2) {
|
|
214
|
+
return appPath(`Actions/${path2 || ""}`);
|
|
215
|
+
}
|
|
213
216
|
function aiPath(path2) {
|
|
214
217
|
return corePath(`ai/${path2 || ""}`);
|
|
215
218
|
}
|
|
@@ -504,6 +507,7 @@ function xRayPath(path2) {
|
|
|
504
507
|
}
|
|
505
508
|
var path2 = {
|
|
506
509
|
actionsPath,
|
|
510
|
+
userActionsPath,
|
|
507
511
|
aiPath,
|
|
508
512
|
assetsPath,
|
|
509
513
|
relativeActionsPath,
|
|
@@ -786,7 +790,7 @@ class Router {
|
|
|
786
790
|
}
|
|
787
791
|
async get(path5, callback) {
|
|
788
792
|
if (typeof callback === "string") {
|
|
789
|
-
const actionModule = await import(path2.
|
|
793
|
+
const actionModule = await import(path2.userActionsPath(`${callback}.ts`));
|
|
790
794
|
callback = actionModule.default.handle;
|
|
791
795
|
}
|
|
792
796
|
this.addRoute("GET", path5, callback, 200);
|
package/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -50,7 +50,7 @@ export class Router implements RouterInterface {
|
|
|
50
50
|
// check if callback is a string and if it is, then import that module path and use the default.handle function as the callback
|
|
51
51
|
if (typeof callback === 'string') {
|
|
52
52
|
// import the module and use the default.handle function as the callback
|
|
53
|
-
const actionModule = await import(p.
|
|
53
|
+
const actionModule = await import(p.userActionsPath(`${callback}.ts`))
|
|
54
54
|
callback = actionModule.default.handle
|
|
55
55
|
}
|
|
56
56
|
|