@jskit-ai/jskit-catalog 0.2.58 → 0.2.60
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/catalog/packages.json +264 -264
- package/package.json +1 -1
- package/scripts/navigation.mjs +16 -3
package/package.json
CHANGED
package/scripts/navigation.mjs
CHANGED
|
@@ -301,6 +301,16 @@ function normalisePath(value) {
|
|
|
301
301
|
return trimmed === "/" ? "/" : trimmed;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
// Whether a literal path is one a page's route pattern serves: segment by segment, each `:param` stands for exactly
|
|
305
|
+
// one non-empty segment and every other segment is the same text. /modules/:moduleKey serves /modules/incidents, not
|
|
306
|
+
// /modules or /modules/incidents/open; a catch-all (:rest*) matches only its own text.
|
|
307
|
+
function patternServes(pattern, literal) {
|
|
308
|
+
const patternSegments = pattern.split("/");
|
|
309
|
+
const literalSegments = literal.split("/");
|
|
310
|
+
return patternSegments.length === literalSegments.length && patternSegments.every((segment, index) =>
|
|
311
|
+
segment === literalSegments[index] || (/^:[\w$]+$/u.test(segment) && literalSegments[index] !== ""));
|
|
312
|
+
}
|
|
313
|
+
|
|
304
314
|
// unplugin-vue-router file routes: src/pages/home/suppliers/[supplierId]/edit.vue is home/suppliers/:supplierId/edit,
|
|
305
315
|
// and an index file or folder adds no segment.
|
|
306
316
|
function routeOf(file) {
|
|
@@ -555,12 +565,15 @@ async function checkPageParents({ root, appFiles, pageFiles, report }) {
|
|
|
555
565
|
const surfacePath = (file, surface) => normalisePath(routePattern(routeOf(file).slice(surface.pagesRoot.length)));
|
|
556
566
|
const addressOf = (relative, surface) => normalisePath(routePattern(`${surface.pagesRoot}${relative}`));
|
|
557
567
|
const shownOn = (owners, surface) => owners.length === 0 || owners.includes(surface.id) || owners.includes("*");
|
|
558
|
-
// A destination by its suffix on the surface, or by its address (`to`).
|
|
568
|
+
// A destination by its suffix on the surface, or by its address (`to`). A page with a dynamic route (one page for
|
|
569
|
+
// every module, at /modules/:moduleKey) is a destination when a destination's literal path is one it serves.
|
|
559
570
|
const isDestination = (relative, surface) => navigation.destinations.some(({ suffix, to, surfaces: owners }) =>
|
|
560
|
-
to === undefined ? suffix
|
|
571
|
+
to === undefined ? patternServes(relative, suffix) && shownOn(owners, surface) : patternServes(addressOf(relative, surface), to));
|
|
561
572
|
// A global route's address is a destination when a link's `to` names it, or a suffix leads there on a surface.
|
|
562
573
|
const isAddress = (address) => navigation.destinations.some(({ suffix, to, surfaces: owners }) =>
|
|
563
|
-
to === undefined
|
|
574
|
+
to === undefined
|
|
575
|
+
? surfaces.some((surface) => shownOn(owners, surface) && patternServes(address, addressOf(suffix, surface)))
|
|
576
|
+
: patternServes(address, to));
|
|
564
577
|
// An App.vue that wraps every page in the shell's bar leaves no page outside it.
|
|
565
578
|
const appShell = appFiles.includes("src/App.vue") && await drawsShellBar("src/App.vue");
|
|
566
579
|
const judged = [];
|