synckit
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -50,5 +50,10 @@ import { execSync } from 'child_process'; | ||
workerThreads = require("worker_threads"); | ||
if (typeof workerThreads.receiveMessageOnPort !== "function") { | ||
workerThreads = void 0; | ||
} | ||
} catch (e) { | ||
console.warn("`worker_threads` is not available in current environment, `Node >= 12` is required"); | ||
} | ||
if (!workerThreads) { | ||
console.warn("[synckit]: `worker_threads` or `receiveMessageOnPort` is not available in current environment, `Node >= 12` is required"); | ||
} | ||
const { SYNCKIT_WORKER_THREADS, SYNCKIT_BUFFER_SIZE, SYNCKIT_TIMEOUT } = process.env; | ||
@@ -55,0 +60,0 @@ const useWorkerThreads = !!workerThreads && (!SYNCKIT_WORKER_THREADS || !["0", "false"].includes(SYNCKIT_WORKER_THREADS)); |
@@ -19,6 +19,11 @@ "use strict"; | ||
workerThreads = require('worker_threads'); | ||
/* istanbul ignore if */ | ||
if (typeof workerThreads.receiveMessageOnPort !== 'function') { | ||
workerThreads = undefined; | ||
} | ||
} | ||
catch (_a) { | ||
/* istanbul ignore next */ | ||
console.warn('`worker_threads` is not available in current environment, `Node >= 12` is required'); | ||
catch (_a) { } | ||
/* istanbul ignore if */ | ||
if (!workerThreads) { | ||
console.warn('[synckit]: `worker_threads` or `receiveMessageOnPort` is not available in current environment, `Node >= 12` is required'); | ||
} | ||
@@ -25,0 +30,0 @@ const { SYNCKIT_WORKER_THREADS, SYNCKIT_BUFFER_SIZE, SYNCKIT_TIMEOUT } = process.env; |
{ | ||
"name": "synckit", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Perform async work synchronously in Node.js using `worker_threads`, or `child_process` as fallback, with first-class TypeScript support.", | ||
@@ -5,0 +5,0 @@ "repository": "git+https://github.com/rx-ts/synckit.git", |
Sorry, the diff of this file is not supported yet
26185
364