Lines 121-161javascript
121 // screen's "back to parent" edge can be declared in the journey
122 // without forcing the implementer to inline a raw router.replace.
123 new RegExp(`safeBack\\s*\\(\\s*router\\s*,\\s*${quoteClass}${pattern}${quoteClass}`),
125 return patterns.some((re) => re.test(source));
129 * Normalise screen.next to an array of edge objects. Supports:
130 * - Single edge object: { when, route, skip_via?, optional? }
131 * - Array of edge objects: [{ ... }, { ... }]
133 * Returns [] when next is missing (terminal screen).
135function normaliseEdges(next) {
136 if (!next) return [];
137 if (Array.isArray(next)) return next;
141async function main() {
142 const { USER_JOURNEYS } = await import(pathToFileURL(journeysFile).href);
143 const failures = [];
MediumDynamic Require
Package source references dynamic require/import behavior.
pgd-setup/assets/scripts/adaptable/validate-journey-wiring.mjsView on unpkg · L141 146 for (const [journeyName, journey] of Object.entries(USER_JOURNEYS)) {
147 for (const screen of journey.screens ?? []) {
148 const edges = normaliseEdges(screen.next);
149 for (const edge of edges) {
150 const target = edge.skip_via ?? edge.route;
151 if (!target) continue;
154 const { path: srcPath, content } = await findScreenSource(screen.app, screen.route);
155 if (!containsRouterRef(content, target)) {
157 journey: journeyName,