@stacksjs/router 0.58.70 → 0.58.71

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 CHANGED
@@ -1366,7 +1366,8 @@ class Router {
1366
1366
  }
1367
1367
  async job(path5) {
1368
1368
  if (path5.includes("api/"))
1369
- path5 = pascalCase(path5.replace(/^api\/?|^\//, ""));
1369
+ path5 = path5.replace(/^\/api\//, "");
1370
+ path5 = pascalCase(path5);
1370
1371
  const jobModule = await import(path2.userJobsPath(`${path5}Job.ts`.replace(/JobJob/, "Job")));
1371
1372
  const callback = jobModule.default.handle;
1372
1373
  this.addRoute("GET", path5, callback, 200);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/router",
3
3
  "type": "module",
4
- "version": "0.58.70",
4
+ "version": "0.58.71",
5
5
  "description": "The Stacks framework router.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
package/src/router.ts CHANGED
@@ -76,8 +76,9 @@ export class Router implements RouterInterface {
76
76
 
77
77
  public async job(path: Route['url']): Promise<this> {
78
78
  if (path.includes('api/')) // TODO: once the api prefix is removed from the router/api, remove this
79
- path = pascalCase(path.replace(/^api\/?|^\//, ''))
79
+ path = path.replace(/^\/api\//, '')
80
80
 
81
+ path = pascalCase(path)
81
82
  // removes the potential `JobJob` suffix in case the user does not choose to use the Job suffix in their file name
82
83
  const jobModule = await import(p.userJobsPath(`${path}Job.ts`.replace(/JobJob/, 'Job')))
83
84
  const callback = jobModule.default.handle