diff --git a/scripts/dev.js b/scripts/dev.js index 2a5ffda..2f4fab5 100644 --- a/scripts/dev.js +++ b/scripts/dev.js @@ -12,6 +12,7 @@ const http = require('node:http'); const path = require('node:path'); const { assemble, ROOT } = require('./lib/page'); const { createRelay } = require('./agent/relay'); +const { lit } = require('./lib/js-literal'); // --host/--port; a bare --host binds loopback (never undefined, which would listen on every interface). const argOf = (k) => { const i = process.argv.indexOf(k); return i >= 0 && process.argv[i + 1] && !process.argv[i + 1].startsWith('--') ? process.argv[i + 1] : null; }; @@ -27,7 +28,7 @@ const clients = new Set(); function page() { const { html, map } = assemble({ dev: true }); // Errors report a line of the assembled page; the console also says which file under src/ that is. - const hint = ``; + const hint = ``; return html.replace('', `${hint}${RELOAD}`); } diff --git a/scripts/gpu-bench.js b/scripts/gpu-bench.js index b2e45ff..59ed482 100644 --- a/scripts/gpu-bench.js +++ b/scripts/gpu-bench.js @@ -15,6 +15,7 @@ const os = require('node:os'); const http = require('node:http'); const path = require('node:path'); const { assemble, ROOT } = require('./lib/page'); +const { lit } = require('./lib/js-literal'); const args = process.argv.slice(2); const opt = (k, d) => { const i = args.indexOf('--' + k); return i >= 0 ? args[i + 1] : d; }; @@ -27,7 +28,7 @@ const TYPES = { '.html': 'text/html; charset=utf-8', '.js': 'text/javascript; ch // An exported save is {app, version, S}; a plain one is S itself. const save = (() => { const d = JSON.parse(fs.readFileSync(SAVE, 'utf8')); return JSON.stringify({ S: d && d.S && d.S.pops ? d.S : d }); })(); const client = fs.readFileSync(path.join(__dirname, 'lib', 'gpu-bench-client.js'), 'utf8'); -const page = () => assemble().html.replace('', ``); +const page = () => assemble().html.replace('', ``); /* Only the page this server hands out may talk to it. Any other site open in the same browser could otherwise POST results (printed to this terminal, written to --out) or, through DNS rebinding, read the save. So the Host diff --git a/scripts/i18n-check.js b/scripts/i18n-check.js index eacf61a..7db2676 100644 --- a/scripts/i18n-check.js +++ b/scripts/i18n-check.js @@ -20,10 +20,21 @@ const SITE = path.join(__dirname, '..', 'site'); const page = () => require('./lib/page').assemble({ dev: true }).html; const LABEL = /^[a-z0-9_]+(\.[a-z0-9_]+)+$/; +// The bodies of the page's bare ', i += 8); + if (end < 0) break; + out.push(html.slice(i, end)); i = end; + } + return out; +} + // The labels the game uses, with problems in how they are used. function sourceLabels(html) { const labels = new Set(), problems = []; - const scripts = [...html.matchAll(/