mirror of
https://github.com/felixrieseberg/windows95.git
synced 2026-05-10 00:31:58 +00:00
The previous build patched libv86.js by exact-string match against
Closure-mangled identifiers (k.load_file, H.exportSymbol, pa, qa),
which broke on every upstream rebuild.
Of the three old patches:
- exportSymbol order: now a one-line HTML shim copying module.exports.V86
to window after libv86 loads
- this.fetch binding: fixed upstream
- load_file XHR vs fs: replaced by patching await import('node:fs/promises')
to require('fs').promises - string literals survive Closure, fails loud
if absent
Also adds tools/update-v86.js to pull new builds from copy.sh, and exposes
the renderer DevTools protocol on localhost:9222 in dev.
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
#!/usr/bin/env node
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const https = require('https');
|
|
|
|
const LIB_DIR = path.join(__dirname, '../src/renderer/lib');
|
|
const FILES = [
|
|
{ url: 'https://copy.sh/v86/build/libv86.js', dest: path.join(LIB_DIR, 'libv86.js') },
|
|
{ url: 'https://copy.sh/v86/build/v86.wasm', dest: path.join(LIB_DIR, 'build/v86.wasm') },
|
|
];
|
|
|
|
function download(url, dest) {
|
|
return new Promise((resolve, reject) => {
|
|
https.get(url, (res) => {
|
|
if (res.statusCode !== 200) {
|
|
return reject(new Error(`${url} → HTTP ${res.statusCode}`));
|
|
}
|
|
const chunks = [];
|
|
res.on('data', (c) => chunks.push(c));
|
|
res.on('end', () => {
|
|
const buf = Buffer.concat(chunks);
|
|
fs.writeFileSync(dest, buf);
|
|
console.log(`✓ ${path.relative(process.cwd(), dest)} (${(buf.length / 1024).toFixed(0)} KB)`);
|
|
resolve();
|
|
});
|
|
res.on('error', reject);
|
|
}).on('error', reject);
|
|
});
|
|
}
|
|
|
|
(async () => {
|
|
for (const { url, dest } of FILES) {
|
|
await download(url, dest);
|
|
}
|
|
})();
|