#!/usr/bin/env node /* global process, console */ /** * Disable @xterm/addon-webgl cross-terminal texture-atlas sharing for NyaTerm. * * NyaTerm uses multiple live xterm WebGL instances in split panes. When xterm * reuses one TextureAtlas for terminals with the same render configuration, * clearing or rebuilding the atlas for one terminal can corrupt glyph rendering * in another terminal. * * Fix: remove the "reuse a matching atlas" loop from the published CJS and ESM * bundles, so each terminal creates and owns its own TextureAtlas. * * This script is intended for: * @xterm/addon-webgl@0.20.0-beta.287 * * It is idempotent and fails fast when the installed package or minified bundle * no longer matches the expected version, so dependency upgrades cannot silently * reintroduce the issue. */ "use strict"; const fs = require("node:fs"); const path = require("node:path"); const PACKAGE_NAME = "@xterm/addon-webgl"; const EXPECTED_VERSION = "0.20.0-beta.287"; const MARKER = "/*nyaterm:webgl-atlas-isolation*/"; const PACKAGE_DIR = path.resolve( process.cwd(), "node_modules", "@xterm", "addon-webgl", ); const PACKAGE_JSON = path.join(PACKAGE_DIR, "package.json"); const TARGETS = [ { file: path.join(PACKAGE_DIR, "lib", "addon-webgl.mjs"), // @xterm/addon-webgl@0.20.0-beta.287 ESM bundle loop: "for(let c=0;c