@travetto/compiler
Advanced tools
Comparing version 4.0.4 to 4.0.5
{ | ||
"name": "@travetto/compiler", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "The compiler infrastructure for the Travetto framework", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -13,3 +13,3 @@ import fs from 'node:fs/promises'; | ||
import { IpcLogger } from '../support/log'; | ||
import { CommonUtil } from '../support/util'; | ||
import { TimerUtil } from '../support/timer'; | ||
@@ -86,3 +86,3 @@ const log = new IpcLogger({ level: 'debug' }); | ||
this.#ctrl.abort(); | ||
CommonUtil.nonBlockingTimeout(1000).then(() => process.exit()); // Allow upto 1s to shutdown gracefully | ||
TimerUtil.nonBlockingTimeout(1000).then(() => process.exit()); // Allow upto 1s to shutdown gracefully | ||
} | ||
@@ -118,3 +118,3 @@ | ||
await CommonUtil.queueMacroTask(); | ||
await TimerUtil.queueMacroTask(); | ||
@@ -121,0 +121,0 @@ log.debug(`Compiled ${i} files`); |
@@ -9,3 +9,3 @@ import rl from 'node:readline/promises'; | ||
import type { LogShape } from '../log'; | ||
import { CommonUtil } from '../util'; | ||
import { TimerUtil } from '../timer'; | ||
import { ProcessHandle } from './process-handle'; | ||
@@ -133,3 +133,3 @@ | ||
if (cfg.until?.(val)) { | ||
await CommonUtil.queueMacroTask(); | ||
await TimerUtil.queueMacroTask(); | ||
ctrl.abort(); | ||
@@ -145,3 +145,3 @@ } | ||
await CommonUtil.queueMacroTask(); | ||
await TimerUtil.queueMacroTask(); | ||
@@ -148,0 +148,0 @@ info = await this.info(); |
@@ -6,3 +6,3 @@ import fs from 'node:fs/promises'; | ||
import { Log, Logger } from '../log'; | ||
import { CommonUtil } from '../util'; | ||
import { TimerUtil } from '../timer'; | ||
@@ -60,3 +60,3 @@ export class ProcessHandle { | ||
} | ||
await CommonUtil.nonBlockingTimeout(100); | ||
await TimerUtil.nonBlockingTimeout(100); | ||
} | ||
@@ -63,0 +63,0 @@ try { |
@@ -11,2 +11,3 @@ import http from 'node:http'; | ||
import { CommonUtil } from '../util'; | ||
import { TimerUtil } from '../timer'; | ||
import { CompilerClient } from './client'; | ||
@@ -81,3 +82,3 @@ import { ProcessHandle } from './process-handle'; | ||
const url = new URL(this.#url); | ||
CommonUtil.queueMacroTask().then(() => this.#server.listen(+url.port, url.hostname)); // Run async | ||
TimerUtil.queueMacroTask().then(() => this.#server.listen(+url.port, url.hostname)); // Run async | ||
}); | ||
@@ -126,3 +127,3 @@ | ||
this.info.iteration = Date.now(); | ||
await CommonUtil.nonBlockingTimeout(20); | ||
await TimerUtil.nonBlockingTimeout(20); | ||
for (const el of Object.values(this.#listeners)) { | ||
@@ -210,3 +211,3 @@ try { el.res.end(); } catch { } | ||
await new Promise((resolve, reject) => { | ||
CommonUtil.nonBlockingTimeout(2000).then(reject); // Wait 2s max | ||
TimerUtil.nonBlockingTimeout(2000).then(reject); // Wait 2s max | ||
this.#server.close(resolve); | ||
@@ -213,0 +214,0 @@ this.#emitEvent({ type: 'state', payload: { state: 'closed' } }); |
import fs from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
import timers from 'node:timers/promises'; | ||
import { setMaxListeners } from 'node:events'; | ||
@@ -109,16 +108,2 @@ | ||
} | ||
/** | ||
* Non-blocking timeout, that is cancellable | ||
*/ | ||
static nonBlockingTimeout(time: number): Promise<void> { | ||
return timers.setTimeout(time, undefined, { ref: false }).catch(() => { }); | ||
} | ||
/** | ||
* Queue new macrotask | ||
*/ | ||
static queueMacroTask(): Promise<void> { | ||
return timers.setImmediate(undefined); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82453
24
1809