mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-08 08:44:37 +08:00
- 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.
15 lines
461 B
TypeScript
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);
|
|
}
|
|
});
|
|
});
|
|
}
|