Clean up some typings in build

- Adding ts-check in a few more js files
- Switching to use `@types` for a few more packages
- Remove some unused code
This commit is contained in:
Matt Bierner
2025-08-07 09:38:52 -07:00
parent 7ffbe1141d
commit d865a99c49
27 changed files with 144 additions and 511 deletions
+1 -31
View File
@@ -12,7 +12,7 @@ const fancyLog = require('fancy-log');
const ansiColors = require('ansi-colors');
const cp = require('child_process');
const { tmpdir } = require('os');
const { promises: fs, existsSync, mkdirSync, rmSync } = require('fs');
const { existsSync, mkdirSync, rmSync } = require('fs');
const task = require('./lib/task');
const watcher = require('./lib/watch');
@@ -58,36 +58,6 @@ const hasLocalRust = (() => {
};
})();
const debounceEsStream = (fn, duration = 100) => {
let handle = undefined;
let pending = [];
const sendAll = (pending) => (event, ...args) => {
for (const stream of pending) {
pending.emit(event, ...args);
}
};
return es.map(function (_, callback) {
console.log('defer');
if (handle !== undefined) {
clearTimeout(handle);
}
handle = setTimeout(() => {
handle = undefined;
const previous = pending;
pending = [];
fn()
.on('error', sendAll('error'))
.on('data', sendAll('data'))
.on('end', sendAll('end'));
}, duration);
pending.push(this);
});
};
const compileFromSources = (callback) => {
const proc = cp.spawn('cargo', ['--color', 'always', 'build'], {
cwd: root,