#!/usr/bin/env node /** * check-script-registry — one bundle script executes ONCE PER PAGE, not once per bundle that asks. * * WHY THIS TEST EXISTS AND WHY IT IS SHAPED LIKE THIS. Every plugin ships as a self-contained IIFE, * so library/utils/embedScript.js is compiled separately into each one: eleven bundles on * origin/main each carry their own copy. A module-scoped cache in that file is therefore one cache * PER BUNDLE, and two shells on one page each loaded the same child — fetched from the HTTP cache, * so no failed request and no extra network row, then the whole bundle EXECUTED a second time and * its guarded `customElements.define` quietly declined. Nothing threw. Nothing warned. * * The test reproduces the packaging rather than describing it: it imports the module TWICE under * two different URLs, which in ESM yields two independent module instances sharing one globalThis — * structurally the same thing as two IIFEs on one page. * * ★ THERE ARE TWO LAYERS AND THIS FILE TESTS THEM SEPARATELY, BECAUSE MUTATION-TESTING SHOWED THEY * MASK EACH OTHER. Reverting the page registry to module scope did NOT change the number of *