kawapress/generator #
Node.js helpers for Generator Plugins. They run only on the generator side; never import this entry from a Runtime Plugin.
Plugins #
GeneratorPluginHost— Plugins set up on a resolved site, ready to run their remaining hooks.setupGeneratorPlugins— Sets up the plugins of a site config the waykawapress builddoes: runs each plugin'ssetup(),config()andconfigResolved()with KawaPress's own defaults and checks. Plugin tests and tools drive the other hooks through the returned host instead of imitating the plugin API.useRuntimeDependencies— Declares the packages that a plugin imports from its runtime code, so both module graphs resolve them from the plugin's own installation instead of from the site root.
Markdown #
createPageSummaryReader— Reads route summaries without running the Markdown pipeline, so listing the site never renders pages: no Shiki, no Twoslash, no MathJax and no pluginpageData()handler runs here.ExpandedMarkdownSource— A page source with includes and snippets written out, and where each line came from.expandMarkdownSource— Writes out<!--@include: ...-->and<<< ...in a page source, so every reader of the page, from the compiler to the search index, sees the same Markdown. Directives inside fenced code blocks stay as they are written, which lets a page show the syntax itself.MarkdownSourceLocation— Where the Markdown being expanded comes from.PageSummary— What a page says about itself without being rendered: the title its author wrote and the layout its frontmatter asks for. Reading it needs no Markdown pipeline, so listing a site never renders a page.PageSummaryReader— Reads the summary of a page from its source and keeps it until the source changes.readMarkdownSource— Reads a Markdown page and expands its includes and snippets.
Pages #
isMarkdownPage— Whetherfileis a page of this scope, without reading any directory.listMarkdownPages— Every Markdown page belowscope.sourceRoot, in the order the site itself reads them: directories before their content, both sorted by name, files outside the public directory only.listSitePages— Every page of a site: its Markdown files in the orderlistMarkdownPages()reads them, then the pages plugins add, in plugin order. Two pages on one route are an error that names both sources.markdownFileToPagePath— Page path of a Markdown file: its source path afterrewrites, for example/a/intro.mdforpackages/a/src/intro.mdand the rule'packages/:pkg/src/:page*': ':pkg/:page*'. Without rewrites it is the source path. The route of the page and its relative links both start here.markdownFileToRoutePath— Public route of a Markdown file, afterrewrites.MarkdownPage— One Markdown page on disk.MarkdownPageScope— Where the pages of a site are.onSitePagesChange— Callslistenerwhen the pages of a site changed: a Markdown file was added or removed, or a file a plugin'spages()group depends on changed the pages it produces. Only the dev server reports changes. Returns the function that stops the notifications.parseGitLog— Turns the output of thegit logcall ofreadGitLastUpdatedinto last commit times, keyed by absolute path.pluginPageSourcePath— Source path of a plugin page, read from either form of its id: the request id or the resolved id below the site root.undefinedfor any other id.readGitLastUpdated— Reads the last commit time (milliseconds) of every file under the site root in onegit logcall, keyed by absolute path. Returnsundefinedwith a warning outside a git repository or in a shallow clone, where the dates would be wrong.ReadGitLastUpdatedOptions— Names the caller, so a warning about missing git history says who skipped what.resolveMarkdownPageScope— The pages of a resolved site config: the scope KawaPress itself uses to list pages, with absolute source and public folders.
Functions #
resolveHeadingTitle— The plain-text title of a heading: the text its author wrote on the heading line, without the Markdown formatting markup and without HTML tags.
Types #
SitePage— One page of the site, whether it is a Markdown file or a plugin's page.


Comments