@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
|
@@ -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
package/package.json
CHANGED