{"version":"2.1.242","anchor":"plugin-hooks-modules-a-javascript-engine-for-plugin-hooks-of","canonical_anchor":"plugin-hooks-modules-a-javascript-engine-for-plugin-hooks-of","heading":"Plugin hooks modules: a JavaScript engine for plugin hooks, off unless enabled remotely","tier":"soon","area":"Plugins","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.242\/e\/plugin-hooks-modules-a-javascript-engine-for-plugin-hooks-of","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.242","markdown":"### Plugin hooks modules: a JavaScript engine for plugin hooks, off unless enabled remotely\n\nPlugin hooks.json gains a modules key for code-registered hooks, off unless enabled remotely.\n\n**What**\n\nA plugin can now ship a JavaScript module that registers hooks in code with `register(on, options)`, instead of only declarative matchers in hooks.json. That file gains a `modules` key alongside `hooks`, and either or both may be present. The engine loads and evaluates the module, dispatches each hook event through a chain with `next()`, reports failures, and reloads or prunes when a plugin is disabled. It is controlled by `tengu_plugin_hooks_modules`, whose built-in fallback is off, so nothing loads unless server config turns it on.\n\n**Details**\n\n- A plugin manifest may declare a hooks module path, and hook config parsing now returns both the matchers and the modules.\n- The gate also drives a new plugin-types entry in the capability and notice map.\n\n**Evidence**\n\n``hooks.json must have `hooks` (the hook matchers) or `modules` (hooks modules), or both``, `var Lnt = \"tengu_plugin_hooks_modules\"`\n\n- Area: Plugins\n- Names: `modules`\n- Tier: Nothing to try yet\n- Useful: 3\/5\n- Signal: 5\/5\n- Present in the build but not switched on"}