#!/usr/bin/env node /* * Make a `jupyter lite build` output cross-origin isolated: * 1. copy coi-serviceworker.js into the output root, and * 2. inject a `; // Inject as the first thing in so isolation is gained (and the // one-time reload happens) before the heavy app bundle loads. const replaced = html.replace(/]*)?>/i, m => `${m}\n ${tag}`); if (replaced === html) { continue; // no , skip } writeFileSync(file, replaced); count++; } console.log(`coi: injected ${SW} into ${count} page(s) under ${outDir}`);