I'm looking for some high-level guidance or a long term mentorship (1 month+) for a project I'm currently working on.
Inspired by Arcs and GatsbyJS, I'm attempting to build a static site generator.
The way I've visualized this is:
- each "Entity" would correspond to a page
- "Components" would be plugins/pieces of shared data
- Providing data to a render template would be created by composing "Components" on top of the "Entity". (As opposed to in Gatsby, where JavaScript's dynamic ness allows any new data to just be added to the
Node
object.) - The "System" logic would be for each plugin or necessary combinations of plugins. (This logic would be implemented by the plugin)
- A "plugin" would only have access to the other components it needs.
- the rendering to be up to the user. Use ructe, Teras, liquid, etc. as long as it can produce a string (or write to a
Writer
), the generator will accept it.
There are a couple parts I'm having trouble working out:
- Is ECS even the right way to go about this? I've played around with Shipyard, specs, and legion but I'm not attached to any one in particular
- How would I restrict what a plugin can do in terms of messing with the "World"/"System?" The ECS crates I've looked at assume "Systems" or mutations on Entities/Components won't be in a hostile environment (which makes sense for a library) but won't be true with a "plugin."
- It would be ideal for the ECS library this generator uses to be an implementation detail. The user would only have to implement the rendering logic, but the type-heavy way that components are passed around and queried in the crates I've found have made it very difficult for me to reason about how to even go about creating this abstraction.
- Especially for plugins, providing a trait that would allow the plugin to specify any dependent "Components", which may or may not be different for all plugins
Any snippets of wisdom, code, or references would be greatly appreciated!