@thexjs/core 1.10.1 → 1.10.2

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/adapter.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  scanNotFound,
10
10
  scanPages,
11
11
  scanRoutes
12
- } from "./chunk-ME4ES2PD.js";
12
+ } from "./chunk-GVDJW4PD.js";
13
13
  import "./chunk-OXV2QTWV.js";
14
14
 
15
15
  // src/adapter/bundle.ts
@@ -593,7 +593,28 @@ function snapshotActionRoutes() {
593
593
  routePath: entry.routePath,
594
594
  paramNames: entry.paramNames,
595
595
  fns: new Map(entry.fns)
596
- }));
596
+ })).sort(compareActionRoutes);
597
+ }
598
+ function compareActionRoutes(a, b) {
599
+ const aCategory = routeCategory(a);
600
+ const bCategory = routeCategory(b);
601
+ if (aCategory !== bCategory) return aCategory - bCategory;
602
+ const aSpecificity = segmentSpecificity(a);
603
+ const bSpecificity = segmentSpecificity(b);
604
+ for (let i = 0; i < Math.max(aSpecificity.length, bSpecificity.length); i++) {
605
+ const as = aSpecificity[i] ?? -1;
606
+ const bs = bSpecificity[i] ?? -1;
607
+ if (as !== bs) return as - bs;
608
+ }
609
+ return a.routePath < b.routePath ? -1 : a.routePath > b.routePath ? 1 : 0;
610
+ }
611
+ function routeCategory(entry) {
612
+ if (entry.paramNames.length === 0) return 0;
613
+ if (entry.routePath.includes("*")) return 2;
614
+ return 1;
615
+ }
616
+ function segmentSpecificity(entry) {
617
+ return entry.routePath.split("/").filter((segment) => segment.length > 0).map((segment) => segment === "*" ? 2 : segment.startsWith(":") ? 1 : 0);
597
618
  }
598
619
  function getServerFunctionHandler(csrfOptions) {
599
620
  return async (req) => {
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  verifyOrigin,
40
40
  withCsrfCookie,
41
41
  writeManifest
42
- } from "./chunk-ME4ES2PD.js";
42
+ } from "./chunk-GVDJW4PD.js";
43
43
  import {
44
44
  OTEL_ERROR_STATUS_CODE,
45
45
  REDACTED,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thexjs/core",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Full-stack React framework core (router, SSR/SSG renderer, islands, server functions) for the x framework, built on Bun.",
5
5
  "keywords": [
6
6
  "react",