diff --git a/packages/cli/src/lib/content-utils.js b/packages/cli/src/lib/content-utils.js index 6fa16af21..7418918bf 100644 --- a/packages/cli/src/lib/content-utils.js +++ b/packages/cli/src/lib/content-utils.js @@ -1,5 +1,19 @@ const activeFrontmatterKeys = ['route', 'label', 'title', 'id']; +function pruneGraph(pages) { + return pages.map(page => { + const p = { + ...page, + title: page.title ?? page.label + }; + + delete p.resources; + delete p.imports; + + return p; + }); +} + function cleanContentCollection(collection = []) { return collection.map((page) => { let prunedPage = {}; @@ -18,6 +32,7 @@ function cleanContentCollection(collection = []) { } export { + pruneGraph, activeFrontmatterKeys, cleanContentCollection }; \ No newline at end of file diff --git a/packages/cli/src/lifecycles/graph.js b/packages/cli/src/lifecycles/graph.js index 3441b55ab..456b832fd 100644 --- a/packages/cli/src/lifecycles/graph.js +++ b/packages/cli/src/lifecycles/graph.js @@ -116,7 +116,6 @@ const generateGraph = async (compilation) => { id: getIdFromRelativePathPath(relativePagePath, `.${extension}`).replace('api-', ''), pageHref: new URL(relativePagePath, pagesDir).href, outputHref: new URL(relativePagePath, outputDir).href, - // outputPath: relativePagePath, route: `${basePath}${route}`, isolation }); @@ -191,8 +190,6 @@ const generateGraph = async (compilation) => { executeModuleUrl: routeWorkerUrl.href, moduleUrl: filenameUrl.href, compilation: JSON.stringify(compilation), - // TODO need to get as many of these params as possible - // or ignore completely? page: JSON.stringify({ servePage: isCustom, route, @@ -274,9 +271,6 @@ const generateGraph = async (compilation) => { outputHref: route === '/404/' ? new URL('./404.html', outputDir).href : new URL(`.${route}index.html`, outputDir).href, - // outputPath: route === '/404/' - // ? '/404.html' - // : `${route}index.html`, isSSR: !isStatic, prerender, isolation, @@ -337,7 +331,6 @@ const generateGraph = async (compilation) => { { ...oldGraph, id: '404', - // outputPath: '/404.html', outputHref: new URL('./404.html', outputDir).href, pageHref: new URL('./404.html', pagesDir).href, route: `${basePath}/404/`, diff --git a/packages/cli/src/plugins/resource/plugin-content-as-data.js b/packages/cli/src/plugins/resource/plugin-active-content.js similarity index 94% rename from packages/cli/src/plugins/resource/plugin-content-as-data.js rename to packages/cli/src/plugins/resource/plugin-active-content.js index cb26908a9..1ce5ff247 100644 --- a/packages/cli/src/plugins/resource/plugin-content-as-data.js +++ b/packages/cli/src/plugins/resource/plugin-active-content.js @@ -1,23 +1,9 @@ import { mergeImportMap } from '../../lib/walker-package-ranger.js'; import { ResourceInterface } from '../../lib/resource-interface.js'; import { checkResourceExists } from '../../lib/resource-utils.js'; -import { activeFrontmatterKeys, cleanContentCollection } from '../../lib/content-utils.js'; +import { activeFrontmatterKeys, cleanContentCollection, pruneGraph } from '../../lib/content-utils.js'; import fs from 'fs/promises'; -function pruneGraph(pages) { - return pages.map(page => { - const p = { - ...page, - title: page.title ?? page.label - }; - - delete p.resources; - delete p.imports; - - return p; - }); -} - const importMap = { '@greenwood/cli/src/data/client.js': '/node_modules/@greenwood/cli/src/data/client.js' };