Lines 130-170javascript
130 // screen's "back to parent" edge can be declared in the journey
131 // without forcing the implementer to inline a raw router.replace.
132 new RegExp(`safeBack\\s*\\(\\s*router\\s*,\\s*${quoteClass}${pattern}${quoteClass}`),
134 return patterns.some((re) => re.test(source));
138 * Normalise screen.next to an array of edge objects. Supports:
139 * - Single edge object: { when, route, skip_via?, optional? }
140 * - Array of edge objects: [{ ... }, { ... }]
142 * Returns [] when next is missing (terminal screen).
144function normaliseEdges(next) {
145 if (!next) return [];
146 if (Array.isArray(next)) return next;
150async function main() {
151 const { USER_JOURNEYS } = await import(pathToFileURL(journeysFile).href);
152 const failures = [];
MediumDynamic Require
Package source references dynamic require/import behavior.
pgd-setup/assets/scripts/adaptable/validate-journey-wiring.mjsView on unpkg · L150 155 for (const [journeyName, journey] of Object.entries(USER_JOURNEYS)) {
156 for (const screen of journey.screens ?? []) {
157 const edges = normaliseEdges(screen.next);
158 for (const edge of edges) {
159 const target = edge.skip_via ?? edge.route;
160 if (!target) continue;
163 const { path: srcPath, content } = await findScreenSource(screen.app, screen.route);
164 if (!containsRouterRef(content, target)) {
166 journey: journeyName,