@vesk/vesk-cli 0.2.85 → 0.2.87

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.
Files changed (2) hide show
  1. package/dist/cli.js +15 -4
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -37422,6 +37422,15 @@ function generatePlatformHandlerSource(input) {
37422
37422
  const hasEvents = !!input.hasEvents;
37423
37423
  let imports = "";
37424
37424
  const routeEntries = [];
37425
+ const routeSpecificity = (path) => {
37426
+ if (/:path\b|:rest\b|\[\.\.\./.test(path)) return 3;
37427
+ if (/:/.test(path)) return 2;
37428
+ return 1;
37429
+ };
37430
+ const pushEntry = (path, type, handler, extra) => {
37431
+ const entry = `{ path: ${JSON.stringify(path)}, type: '${type}', handler: ${handler}${extra}}`;
37432
+ routeEntries.push({ path, entry, specificity: routeSpecificity(path) });
37433
+ };
37425
37434
  for (const r of ssrRoutes) {
37426
37435
  const name = routeName2(r.fullPath.split("/").filter(Boolean));
37427
37436
  const id = `__ssr_${toId(name)}`;
@@ -37430,7 +37439,7 @@ function generatePlatformHandlerSource(input) {
37430
37439
  `;
37431
37440
  const revalidate2 = r._revalidate != null ? `revalidate: ${r._revalidate}, ` : "";
37432
37441
  const tags = r._isrTags ? `tags: ${JSON.stringify(r._isrTags)}, ` : "";
37433
- routeEntries.push(`{ path: ${JSON.stringify(r.fullPath)}, type: 'ssr', handler: ${id}, ${revalidate2}${tags}}`);
37442
+ pushEntry(r.fullPath, "ssr", id, `, ${revalidate2}${tags}`);
37434
37443
  }
37435
37444
  for (const r of apiRoutes) {
37436
37445
  const name = apiRouteName2(r.fullPath);
@@ -37438,8 +37447,9 @@ function generatePlatformHandlerSource(input) {
37438
37447
  const funcPath = `./server/api/${name}.js`;
37439
37448
  imports += `import { handle as ${id} } from ${JSON.stringify(funcPath)};
37440
37449
  `;
37441
- routeEntries.push(`{ path: ${JSON.stringify("/api" + r.fullPath)}, type: 'api', handler: ${id} }`);
37450
+ pushEntry("/api" + r.fullPath, "api", id, "");
37442
37451
  }
37452
+ routeEntries.sort((a, b) => a.specificity - b.specificity);
37443
37453
  const mwImport = hasMiddleware ? "import { execute as __executeMw } from './server/middleware.js';" : "";
37444
37454
  const hasMwLiteral = hasMiddleware ? "true" : "false";
37445
37455
  const eventsImport = hasEvents ? "import { executeStart as __eventsStart, executeRequest as __eventsRequest } from './server/events.js';" : "";
@@ -37461,7 +37471,7 @@ ${eventsImport}
37461
37471
  ${prerenderedList}
37462
37472
  ${isrCache}
37463
37473
  ${defaultNotFoundLine}
37464
- const __routes = [${routeEntries.join(",\n")}];
37474
+ const __routes = [${routeEntries.map((e) => e.entry).join(",\n")}];
37465
37475
 
37466
37476
  async function __invokeRoute(route, request) {
37467
37477
  try {
@@ -50707,7 +50717,8 @@ function generateApiFunction(apiNode, _apiDir, outDir, options) {
50707
50717
  } catch {
50708
50718
  }
50709
50719
  }
50710
- const urlParts = apiNode.fullPath.split("/").filter(Boolean);
50720
+ const routeParts = apiNode.fullPath.split("/").filter(Boolean);
50721
+ const urlParts = routeParts[0] === "api" ? routeParts.slice(1) : routeParts;
50711
50722
  const extracts = [];
50712
50723
  let partIdx = 0;
50713
50724
  for (let i = 0; i < urlParts.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.85",
3
+ "version": "0.2.87",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.85",
12
- "@vesk/compiler": "^0.2.85",
13
- "@vesk/plugin-tailwind": "^0.2.85",
14
- "@vesk/runtime": "^0.2.85",
11
+ "@vesk/adapter": "^0.2.87",
12
+ "@vesk/compiler": "^0.2.87",
13
+ "@vesk/plugin-tailwind": "^0.2.87",
14
+ "@vesk/runtime": "^0.2.87",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",