Plugin architecture brainstorm #215
Replies: 1 comment
-
Hello @dillonkearns, when designing a plugin mechanism, it first of all must be clear what the sequence of actions are in the lifecycle of publishing a site. As an example, here are the different steps how Antora does it: Once you have this, it must be clear which are the pluggable points and what API each of these pluggable points has. What I like about Antora is that it is the only static site generator I currently know off which can collect content from different repositories. On top of that, it can retrieve multiple tags from each repository to publish versioned documentation. Linking this back to the plugin architecture, retrieving from multiple repositories could be a "content loader" plugin implementation, which off course needs access to the overall config to retrieve which sources to read from. Another point I am thinking about is that some plugin points might only accept a single implementation (rss fead generation?) while other plugin points can have a chain of implementations (e.g. content loaders) |
Beta Was this translation helpful? Give feedback.
-
I'm thinking about ways to extend
elm-pages
for plugin authors.Goals
<head>
and generates a file - should be able to pipeline that easily with the user's config and with other pluginsPages.Platform.application
Platform.Pages.application
should be simple, intuitive, and make it natural to do the right thing. So for example, we want API authors to be able to add global<head>
tags, and different plugins (maybe a sitemap and RSS plugin) might both add global head tags. But for the user, it probably makes sense to define their head tags from a central location, rather than being able to arbitrarily chain it and then have to trace where in their code it came from.It might look something like this:
Security
Potential Strategies
User accepts through config file or CLI
The user could generate a list of files
This seems reasonable for domains. But for secrets, what if the user wants to call it something else? Not very configurable (though the user might want to configure it for domains as well).
User passes a value in that restricts possible values
For example, if you want to allow a plugin to use a secret, the only way a plugin author can access it is if you pass it in to the plugin:
Use cases
File generators
Typically just generate files where the user may depend on StaticHttp, but they don't directly call it, only pass through the user's StaticHttp.
Example:
Source Plugin
Json.Decode.Exploration.Decoder
to encapsulate the data that the service gives you (what if you want to strip out the data you don't use? Do we need a builder-style syntax that allows you to just add in the pieces you want, and store it in your preferred data type? Would be similar to howelm-graphql
provides you decoders but you piece them together)Examples:
content
folder (or let user specify)Things that could just wrap the core APIs
With the designs I have and am imaginging for features, I think plugin authors can just wrap them if they want a different API from these primitives:
Tracing errors
Let's say you have some build-time error, like:
The error message should clearly state that the conflicting generated file is conflicting with the plugin named X, or that the HTTP failure came from the plugin making HTTP call Y.
Beta Was this translation helpful? Give feedback.
All reactions