Skip to content

Plugin system? #109

@botandrose

Description

@botandrose

Overview

I think Idiomorph could benefit from a plugin system.

The idea here to is make it easy to encapsulate useful ideas and integrations in individual files or packages, e.g. "idiomorph/ignore-value", "idiomorph/htmx", "idiomorph/ignore-active-value", "idiomorph/turbo", etc. Multiple plugins should be able to be easily composed.

Benefits

  • Potentially slimming down core by extracting less-used options into plugins. Maybe ignoreActive or ignoreActiveValue might be good candidates for this... we'd need to determine their frequency of usage.
  • Allowing transparent composition of different callback-related concerns. Right now, all lifecycle callbacks are singletons. So if one wants to register multiple beforeNodeMorphed callbacks, for example, they'd have to manually compose the individual functions themselves.
  • Enabling experimentation and third-party integration outside of core. This could enable third-party npm packages to be published that provide an Idiomorph integration or modification, without requiring us to merge anything into core.

Challenges

  • Can this system support require, import, and <script src>?
  • What if we don't control the Idiomorph call itself? For example, Idiomorph is a hidden implementation detail of Turbo. Could a user of Turbo add a plugin to Idiomorph, even though it's buried in the guts of Turbo?

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions