Lines 88-128javascript
88// Decided once, before `--color`/`--no-color` are stripped from argv below
89// (#1281). Piped/redirected stdout, NO_COLOR, or --no-color -> plain output.
90const COLORS_ENABLED = (0, color_1.ansiColorsEnabled)();
91// Lazy-load heavy modules (LatticeSensor, runInstaller) to keep CLI startup fast.
92async function loadLatticeSensor() {
94 return await Promise.resolve().then(() => __importStar(require('../index')));
97 const msg = err instanceof Error ? err.message : String(err);
98 const [red, reset] = COLORS_ENABLED ? ['\x1b[31m', '\x1b[0m'] : ['', ''];
99 console.error(`${red}${(0, glyphs_1.getGlyphs)().err}${reset} Failed to load LatticeSensor modules.`);
100 console.error(`\n Node: ${process.version} Platform: ${process.platform} ${process.arch}`);
101 console.error(`\n Error: ${msg}`);
102 console.error('\n Reinstall the owning package with: npm install -g @quolu/lattice@latest\n');
106// Dynamic import helper — tsc compiles import() to require() in CJS mode,
107// which fails for ESM-only packages. This bypasses the transformation.
108// eslint-disable-next-line @typescript-eslint/no-implied-eval
109const importESM = new Function('specifier', 'return import(specifier)');
110// Block LatticeSensor on Node.js 25.x — V8's turboshaft WASM JIT has a Zone
HighEval
Package source references dynamic code evaluation.
sensor/dist/bin/lattice-sensor.jsView on unpkg · L108 111// allocator bug that reliably crashes when compiling tree-sitter
112// grammars (see #54, #81, #140). The previous behaviour was a soft
113// console.warn that scrolls off-screen before the OOM crash 30 seconds
114// later, leading to a steady stream of "what is this OOM" reports.
115// Hard-exit before any WASM work; allow override via env var for users
116// who patched V8 themselves or want to test a future fix.
117const nodeVersion = process.versions.node;
118const nodeMajor = parseInt(nodeVersion.split('.')[0] ?? '0', 10);
119if ((0, node_version_check_1.isNode25Affected)(nodeMajor)) {
120 process.stderr.write((0, node_version_check_1.buildNode25BlockBanner)(nodeVersion) + '\n');
121 if (!process.env.LATTICE_SENSOR_ALLOW_UNSAFE_NODE) {
124 // Override active — banner shown for visibility, continuing.
126// Enforce the supported Node floor. `engines` in package.json only *warns* on
127// install (unless engine-strict), so hard-block here to actually keep users off
128// unsupported versions. Mirrors the Node 25 block above. See package.json `engines`.