Hey, all — Introducing the *Mod-Loader Plugin*: https://evanbalster.com/tiddlywiki/formulas.html#Mod-Loader%20Plugin
This plugin allows shadow tiddlers in a wiki to be patched at boot-time. This makes it possible to change the TiddlyWiki core without creating conflicts or errors when the wiki is upgraded. Almost any code in the core can be patched. † It's also possible to patch other, non-core plugins. If any conflicts do arise, the patch operation is aborted and the wiki will load without modifications. While it's still in development, the modloader is ready to use. I expect this will be useful for developing plugins that change TiddlyWiki's behavior at deeper levels, including the instrumentation and optimization work we've been discussing here. It should be possible to generate a mod from a git branch and distribute this, making it easier to distribute and test branch functionality. More tools will be necessary to make this practical. The plugin includes a Patch Maker utility <https://evanbalster.com/tiddlywiki/formulas.html#%24%3A%2Fplugins%2Febalster%2Fmodloader%2Fpatchmaker> to generate patch files by comparing a shadow tiddler with a non-shadow tiddler that is overriding it. I'll probably make this a bit more convenient to use in the future. As a final note, and echoing Jeremy's sentiment, it remains preferable to avoid using mods to create a plugin whenever possible. The modloader is designed to offer a safer alternative to overshadowing core code, when new functionality does require core changes. *Example Mod*: Here's my attribute-modules "mod" plugin: https://evanbalster.com/tiddlywiki/formulas.html#%24%3A%2Fplugins%2Febalster%2Fattribute-modules It also renders patch tiddlers with some nice formatting. Example: https://evanbalster.com/tiddlywiki/formulas.html#%24%3A%2Fplugins%2Febalster%2Fattribute-modules%2Fpatch%2Fcore%2Fmodules%2Fwidgets%2Fwidget.js *Technical detail*: The modloader runs as a startup module, before all modules provided by the core. It scans the wiki for patch tiddlers and applies them to the specified "source" tiddlers. The results are generated into a new plugin, $:/temp/mod-plugin If any conflicts are encountered while applying patches, the modloader aborts completely to preserve the integrity of the wiki and no mods are applied. A visual warning will be generated. Warnings are also generated if a mod attempts to patch an "unpatchable" tiddler †. † Raw markup tiddlers and bootloader code cannot be patched. Startup modules cannot be patched, because they are loaded before the modloader runs. I'm discussing ways to remove the latter restriction with Jeremy. The modloader currently overshadows startup.js in order to prevent non-startup modules from being loaded before the modloader runs. This might impact the modloader's compatibility with future versions of the core. This is another restriction that might be lifted in future versions of the core. -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscr...@googlegroups.com. To post to this group, send email to firstname.lastname@example.org. Visit this group at https://groups.google.com/group/tiddlywikidev. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/e7717207-74af-43fd-9b9f-98df7b755f12%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.