.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2026 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { spawnSync } from 'child_process';
|
||||
import { copyFileSync, mkdirSync, renameSync } from 'fs';
|
||||
import path from 'path';
|
||||
import process from 'process';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const ghosttyDir = path.join(repoRoot, 'vendor', 'ghostty');
|
||||
const wasmOutDir = path.join(repoRoot, 'vendor', 'ghostty-wasm');
|
||||
const wasmBinDir = path.join(wasmOutDir, 'bin');
|
||||
const wasmFile = path.join(wasmOutDir, 'ghostty-vt.wasm');
|
||||
const wasmBinFile = path.join(wasmBinDir, 'ghostty-vt.wasm');
|
||||
|
||||
mkdirSync(wasmOutDir, { recursive: true });
|
||||
|
||||
const result = spawnSync('zig', [
|
||||
'build',
|
||||
'lib-vt',
|
||||
'-Dtarget=wasm32-freestanding',
|
||||
'-Doptimize=ReleaseSmall',
|
||||
'-p',
|
||||
path.relative(ghosttyDir, wasmOutDir)
|
||||
], {
|
||||
cwd: ghosttyDir,
|
||||
stdio: 'inherit',
|
||||
shell: true
|
||||
});
|
||||
|
||||
if (result.status !== 0) {
|
||||
process.exit(result.status ?? 1);
|
||||
}
|
||||
|
||||
try {
|
||||
renameSync(wasmBinFile, wasmFile);
|
||||
} catch {
|
||||
copyFileSync(wasmBinFile, wasmFile);
|
||||
}
|
||||
@@ -6,6 +6,9 @@
|
||||
const cp = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
globalThis.require = require;
|
||||
globalThis.XTERM_GHOSTTY_WASM_URL = path.resolve(__dirname, '../vendor/ghostty-wasm/ghostty-vt.wasm');
|
||||
|
||||
const COVERAGE_LINES_THRESHOLD = 40;
|
||||
|
||||
// Add `out` to the NODE_PATH so absolute paths can be resolved.
|
||||
|
||||
Reference in New Issue
Block a user