@pracht/core 0.3.0 → 0.4.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/index.d.mts CHANGED
@@ -237,6 +237,7 @@ declare function buildPathFromSegments(segments: RouteSegment[], params: RoutePa
237
237
  *
238
238
  * Example: `"/src/api/health.ts"` → path `/api/health`
239
239
  * `"/src/api/users/[id].ts"` → path `/api/users/:id`
240
+ * `"/src/api/files/[...path].ts"` → path `/api/files/*`
240
241
  * `"/src/api/index.ts"` → path `/api`
241
242
  */
242
243
  declare function resolveApiRoutes(files: string[], apiDir?: string): ResolvedApiRoute[];
package/dist/index.mjs CHANGED
@@ -191,6 +191,7 @@ function encodeCatchAllSegment(part) {
191
191
  *
192
192
  * Example: `"/src/api/health.ts"` → path `/api/health`
193
193
  * `"/src/api/users/[id].ts"` → path `/api/users/:id`
194
+ * `"/src/api/files/[...path].ts"` → path `/api/files/*`
194
195
  * `"/src/api/index.ts"` → path `/api`
195
196
  */
196
197
  function resolveApiRoutes(files, apiDir = "/src/api") {
@@ -200,6 +201,7 @@ function resolveApiRoutes(files, apiDir = "/src/api") {
200
201
  if (relative.startsWith(normalizedDir)) relative = relative.slice(normalizedDir.length);
201
202
  relative = relative.replace(/\.(ts|tsx|js|jsx)$/, "");
202
203
  if (relative.endsWith("/index")) relative = relative.slice(0, -6) || "/";
204
+ relative = relative.replace(/\[\.\.\.[^\]]+\]/g, "*");
203
205
  relative = relative.replace(/\[([^\]]+)\]/g, ":$1");
204
206
  const path = normalizeRoutePath(`/api${relative}`);
205
207
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pracht/core",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/JoviDeCroock/pracht/tree/main/packages/framework",
6
6
  "bugs": {