Files
scriptc/packages/compiler/src/native/task.ts
T
Chris Tate c08ab955ae Enforce linting and consistent source formatting
- Enforce oxlint and oxfmt for owned JavaScript and TypeScript with independent CI checks.
- Preserve compiler import boundaries and protected fixtures while cleaning up lint findings.
- Standardize source formatting and validate import, fixture, and embedded-source protections.
2026-10-05 17:51:24 -05:00

15 lines
461 B
TypeScript

/** Compiler traversals use the main stack; async fibers have small stacks
* intended for suspended application work. Queueing also preserves the
* promise rejection boundary for synchronous compiler failures. */
export function runCompilerTask<T>(work: () => T): Promise<T> {
return new Promise<T>((resolve, reject) => {
queueMicrotask(() => {
try {
resolve(work());
} catch (error) {
reject(error);
}
});
});
}