From c8c9c465b241062570cc3955c01fb5d59d20d888 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 1 May 2024 19:57:48 -0300 Subject: web-routes, upd8, write: integrate web routes with url-spec [Note: due to a fantastical Rebase Fail Moment, this commit accidentally reintroduced some bad imports in upd8.js that are meant to be factored into #import-heck. So this commit is rewritten to not do that, but it means the commits in pull requests #442 and #479 don't line up with main history like they should. Oops.] --- src/upd8.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/upd8.js') diff --git a/src/upd8.js b/src/upd8.js index a1ef2924..4b5064a6 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -40,7 +40,7 @@ import {fileURLToPath} from 'node:url'; import wrap from 'word-wrap'; -import {showAggregate} from '#aggregate'; +import {mapAggregate, showAggregate} from '#aggregate'; import CacheableObject from '#cacheable-object'; import {displayCompositeCacheAnalysis} from '#composite'; import {bindFind, getAllFindSpecs} from '#find'; @@ -1788,13 +1788,27 @@ async function main() { timeStart: Date.now(), }); + const fromRoot = urls.from('shared.root'); + try { - webRoutes = await identifyAllWebRoutes({ + const webRouteSources = await identifyAllWebRoutes({ mediaCachePath, mediaPath, }); + + const {aggregate, result} = + mapAggregate( + webRouteSources, + ({to, ...rest}) => ({ + ...rest, + to: fromRoot.to(...to), + }), + {message: `Errors computing effective web route paths`},); + + aggregate.close(); + webRoutes = result; } catch (error) { - console.error(error); + niceShowAggregate(error); logError`There was an issue identifying web routes!`; fileIssue(); -- cgit 1.3.0-6-gf8a5