@decantr/verifier 3.5.0 → 3.5.3
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.js +14 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2655,6 +2655,9 @@ function scanReactRouter(projectRoot) {
|
|
|
2655
2655
|
for (const route of detectPathnameBranchRoutes(content)) {
|
|
2656
2656
|
routes.set(route, { path: route, file, hasLayout: false });
|
|
2657
2657
|
}
|
|
2658
|
+
for (const route of detectDeclarativeRouteSpecRoutes(content)) {
|
|
2659
|
+
routes.set(route, { path: route, file, hasLayout: false });
|
|
2660
|
+
}
|
|
2658
2661
|
}
|
|
2659
2662
|
return { routes: [...routes.values()], hashRouting };
|
|
2660
2663
|
}
|
|
@@ -2695,6 +2698,17 @@ function detectPathnameBranchRoutes(content) {
|
|
|
2695
2698
|
}
|
|
2696
2699
|
return [...routes];
|
|
2697
2700
|
}
|
|
2701
|
+
function detectDeclarativeRouteSpecRoutes(content) {
|
|
2702
|
+
const routes = /* @__PURE__ */ new Set();
|
|
2703
|
+
const hasRouteSpecSignal = content.includes("@wasp.sh/spec") || /\b(?:const|export\s+const)\s+\w*Spec\b/.test(content) || /\bapp\s*\(\s*\{[\s\S]*\bspec\s*:/.test(content);
|
|
2704
|
+
if (!hasRouteSpecSignal) return [];
|
|
2705
|
+
collectRouteLiterals(
|
|
2706
|
+
/\broute\s*\(\s*["'`][^"'`]*["'`]\s*,\s*["'`](\/[^"'`]*)["'`]\s*,\s*page\s*\(/g,
|
|
2707
|
+
content,
|
|
2708
|
+
routes
|
|
2709
|
+
);
|
|
2710
|
+
return [...routes];
|
|
2711
|
+
}
|
|
2698
2712
|
function scanRoutes(projectRoot, detection) {
|
|
2699
2713
|
const appRoutes = ["src/app", "app"].flatMap(
|
|
2700
2714
|
(dir) => existsSync3(join3(projectRoot, dir)) ? walkNextAppRoutes(join3(projectRoot, dir), projectRoot, []) : []
|