#!/usr/bin/env node const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const vm = require('node:vm'); const root = path.resolve(__dirname, '..'); const sourceRoot = path.join(root, 'prototype-src'); const manifest = JSON.parse(fs.readFileSync(path.join(sourceRoot, 'manifest.json'), 'utf8')); const financeHtml = fs.readFileSync(path.join(sourceRoot, 'modules', '08-finance.html'), 'utf8'); const shellHtml = fs.readFileSync(path.join(sourceRoot, 'shell.html'), 'utf8'); const overlaysHtml = fs.readFileSync(path.join(sourceRoot, 'overlays.html'), 'utf8'); const appJs = fs.readFileSync(path.join(sourceRoot, 'app.js'), 'utf8'); function countMatches(source, pattern) { return [...source.matchAll(pattern)].length; } function extractPage(source, pageId) { const escaped = pageId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); const opening = new RegExp(`