@lingui/cli
Version:
Lingui CLI to extract messages, compile catalogs, and manage translation workflows
17 lines (16 loc) • 584 B
JavaScript
import { Tinypool } from "tinypool";
const createTypedPool = (options) => {
const pool = new Tinypool(options);
return {
run: (...args) => pool.run(args),
destroy: () => pool.destroy(),
};
};
const resolveWorkerFile = (basePath, baseUrl) => new URL(process.env.NODE_ENV === "test"
? `${basePath}.jiti.js`
: `${basePath}.prod.js`, baseUrl).href;
export const createWorkerPool = (workerBasePath, baseUrl, poolSize) => createTypedPool({
filename: resolveWorkerFile(workerBasePath, baseUrl),
minThreads: poolSize,
maxThreads: poolSize,
});