Improve extensibility with plugin architecture. - #11
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugins for PureStack sites
Adds a plugin system and loads it from the CLI, so a site extends PureStack without a build script of its own.
What's new
definePlugin: a named bundle ofskins,components,templates,markdown(remark/rehype plugins),pages(generated pages),hooks, anddevMiddleware. Plugins are validated when a build starts, and errors name the plugin.purestack.config.ts: lives next tositeConfig.jsonand is loaded bybuild,serve, andpublish.servereloads it when the config or a local file it imports changes. Packages resolve to the copies the CLI runs.pages()returns{ path, source }entries that build like files: routes, navigation, links, partials.sourceis a string, or a function PureStack calls only when it needs the content, so the plugin controls memory and caching. Inserve, pages regenerate when content or assets change.onPageDocumenthook: changes a page's DOM before it becomes HTML, and may be async. Each render gets its own document through an injectable async scope (useDomScopein ts-minidom). ts-ssg installsAsyncLocalStorage, so overlapping renders never see each other's pages. As a result,renderAppis now async.serve.Fixes and cleanup
buildAll.renderApp, along withcreateDomcleanup clearing whatever document happened to be current.purestack serve/build/publish.frontend/studio.tsis removed;studioPlugin.tsandpurestack.config.tsreplace it.Docs
New Plugins guide. Updated the CLI guide, the READMEs (ts-ssg, purestack, ts-render, ts-minidom), and the incremental build notes.
Verification