{"version":"2.1.246","anchor":"a-plugin-s-javascript-hooks-module-can-now-span-several-file","canonical_anchor":"a-plugin-s-javascript-hooks-module-can-now-span-several-file","heading":"A plugin's JavaScript hooks module can now span several files","tier":"use","area":"Plugins","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.246\/e\/a-plugin-s-javascript-hooks-module-can-now-span-several-file","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.246","markdown":"### A plugin's JavaScript hooks module can now span several files\n\nJavaScript plugin hooks can now import other files instead of being squeezed into one.\n\n**What**\n\nHooks written in JavaScript were limited to one file; the entry file may now import other files, which are followed, compiled and parsed as part of the module. Two new ceilings apply, `MAX_HOOKS_MODULE_FILES` and `MAX_HOOKS_MODULE_TOTAL_BYTES`, on top of the existing per-file byte cap. Anything outside the import graph is refused. No new flag: this works wherever hooks modules already load.\n\n**Details**\n\n- Only the entry file may use top-level await. An imported file that uses it is refused, because the runtime links the entry alone as an async module.\n- Hook registrations made through `on` are followed into imported helper functions.\n- Refused outright: shadowing or reassigning the registration API, re-exporting it from another file, and `export *`.\n\n**Evidence**\n\n`a top-level await in a file the entry imports; the environment links the entry alone as an async module`\n\n- Area: Plugins\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 3\/5"}