vitek-plugin 0.1.0-beta → 0.1.1-beta

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.
@@ -9,6 +9,7 @@
9
9
  * - users/[id].get.ts -> users/:id
10
10
  * - posts/[...ids].get.ts -> posts/*ids
11
11
  * - health.get.ts -> health
12
+ * - execute/index.post.ts -> execute (index treated as directory index)
12
13
  */
13
14
  export declare function normalizeRoutePath(filePath: string): string;
14
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../../../src/core/normalize/normalize-path.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2B3D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAUlE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA0BtD"}
1
+ {"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../../../src/core/normalize/normalize-path.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiC3D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAUlE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA0BtD"}
@@ -10,6 +10,7 @@ import { PARAM_PATTERN } from '../../shared/constants.js';
10
10
  * - users/[id].get.ts -> users/:id
11
11
  * - posts/[...ids].get.ts -> posts/*ids
12
12
  * - health.get.ts -> health
13
+ * - execute/index.post.ts -> execute (index treated as directory index)
13
14
  */
14
15
  export function normalizeRoutePath(filePath) {
15
16
  // Remove extensions (.ts, .js) and HTTP method
@@ -31,7 +32,12 @@ export function normalizeRoutePath(filePath) {
31
32
  }
32
33
  return `:${paramName}`;
33
34
  });
34
- // Return without normalizing (without adding /), as it will be used in patternToRegex
35
+ if (path === 'index') {
36
+ return '';
37
+ }
38
+ if (path.endsWith('/index')) {
39
+ path = path.slice(0, -6);
40
+ }
35
41
  return path;
36
42
  }
37
43
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitek-plugin",
3
- "version": "0.1.0-beta",
3
+ "version": "0.1.1-beta",
4
4
  "description": "Vite plugin for file-based HTTP API generation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,4 +45,3 @@
45
45
  "vite": "^5.0.0"
46
46
  }
47
47
  }
48
-