TiddlyWiki Mod-Loader Plugin (a safer way to change the core)

228 views
Skip to first unread message

Evan Balster

unread,
Feb 12, 2018, 1:50:52 PM2/12/18
to TiddlyWikiDev
Hey, all —


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 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:




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.

balste...@gmail.com

unread,
Aug 30, 2020, 1:46:22 AM8/30/20
to TiddlyWikiDev
Hello —

Sorry to bump such an old topic, but I see folks are still using the modloader plugin and I lost the evanbalster.com domain (long story).

The modloader plugin remains accessible on Joshua Fontany's website here:  https://chronicles.wiki/TiddlyWikiFormula/#Mod-Loader%20Plugin

kebi

unread,
Sep 4, 2020, 10:02:16 PM9/4/20
to TiddlyWikiDev

The modloader plugin remains accessible on Joshua Fontany's website here:  https://chronicles.wiki/TiddlyWikiFormula/#Mod-Loader%20Plugin

Thank you for this amazing plugin!

ma...@mklauber.com

unread,
Oct 27, 2020, 11:22:06 PM10/27/20
to TiddlyWikiDev
A couple questions on this plugin. 
1) Is development of this plugin continuing somewhere?
2a) If I have a plugin with a patch file in it, do I also need to have the modloader plugin installed to apply the patch, or can I embed the patch loader in a plugin along with patches?
2b) If I need the modloader as a separate plugin, can I host it in my library so I can use plugin dependencies to auto import it?

Thanks,
Matt

Evan Balster

unread,
Oct 28, 2020, 2:37:10 AM10/28/20
to tiddly...@googlegroups.com
1)  No.  The modloader's function is rather simple and it implements that function more-or-less completely.†

2a)  In principle you can, by embedding the modloader plugin's contents in another plugin.  But this might result in only being able to use one such plugin, and might conflict with the modloader plugin itself.  I suggest keeping your patch plugins separate.
Jeremy Ruston has expressed interest in adding some kind of patching functionality to the core in the future but I don't think it's a high priority for this generation of TiddlyWiki.

2b)  As indicated in the modloader's license, you can do as you like with it including redistributing it through your own site or including it in commercial products.

– Evan


† The only drawback is that it must shadow a certain core tiddler in order to postpone processing most of TiddlyWiki's source before it runs, and it may need to be updated if future versions of TiddlyWiki change that core tiddler.


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/EoynoWzdXAs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/ff39c358-0a5a-4882-81c6-bc39ecfdfb06n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages