fix: add missing crypto import
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 Apr 2023 13:37:39 +0000 (15:37 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 Apr 2023 13:37:39 +0000 (15:37 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
rollup.config.mjs
src/pools/abstract-pool.ts
src/pools/cluster/fixed.ts
src/pools/pool.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/thread/fixed.ts
src/utility-types.ts
src/worker/abstract-worker.ts
src/worker/cluster-worker.ts
src/worker/thread-worker.ts

index 44e837d396ab273331cbdb02af9d184123bfd1dd..017ca1b9bee2ea0a1ee01ec6939248a7a23f0a3a 100644 (file)
@@ -34,7 +34,14 @@ export default {
       ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] })
     }
   ],
-  external: ['async_hooks', 'cluster', 'events', 'os', 'worker_threads'],
+  external: [
+    'node:async_hooks',
+    'node:cluster',
+    'node:crypto',
+    'node:events',
+    'node:os',
+    'node:worker_threads'
+  ],
   plugins: [
     typescript({
       tsconfig: isDevelopmentBuild
index d63c19ac7eb008443b6d2b80fc1f1e0bfec02092..363db0e3f9b64ff650a0c351de05135c8de1de96 100644 (file)
@@ -1,3 +1,4 @@
+import crypto from 'node:crypto'
 import type {
   MessageValue,
   PromiseWorkerResponseWrapper
index 2e89b3232dccbc321907b02a73b583d650ee1661..b8a73e4b0562fff6fbca6f48cab4b582c3c5a562 100644 (file)
@@ -1,5 +1,5 @@
-import type { ClusterSettings, Worker } from 'cluster'
-import cluster from 'cluster'
+import type { ClusterSettings, Worker } from 'node:cluster'
+import cluster from 'node:cluster'
 import type { MessageValue } from '../../utility-types'
 import { AbstractPool } from '../abstract-pool'
 import type { PoolOptions } from '../pool'
index dbbb5969ebd920022e31d64d156f087065aa9d12..8a5e505f4f2d23909db36ef3d66e987eee9e9afd 100644 (file)
@@ -1,4 +1,4 @@
-import EventEmitter from 'events'
+import EventEmitter from 'node:events'
 import type {
   ErrorHandler,
   ExitHandler,
index fc9b069522c8366226836a28bac08518dc23b969..2813023face3f6dcfb8df53b6d7607cbf5f3c276 100644 (file)
@@ -1,4 +1,4 @@
-import { cpus } from 'os'
+import { cpus } from 'node:os'
 import type { IPoolInternal } from '../pool-internal'
 import type { IPoolWorker } from '../pool-worker'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
index 13a280b54723e2fcf18f2af5ce73322d4e4f8a11..a37ccbf76b5864b8cc4f27b847596d7b9c533d38 100644 (file)
@@ -1,4 +1,9 @@
-import { isMainThread, MessageChannel, SHARE_ENV, Worker } from 'worker_threads'
+import {
+  isMainThread,
+  MessageChannel,
+  SHARE_ENV,
+  Worker
+} from 'node:worker_threads'
 import type { Draft, MessageValue } from '../../utility-types'
 import { AbstractPool } from '../abstract-pool'
 import type { PoolOptions } from '../pool'
index fba39012e995b24cf135d5050b7d86348b719fb3..1a660434f07dee07dd300b0f3473a33b529af045 100644 (file)
@@ -1,5 +1,5 @@
-import type { Worker as ClusterWorker } from 'cluster'
-import type { MessagePort } from 'worker_threads'
+import type { Worker as ClusterWorker } from 'node:cluster'
+import type { MessagePort } from 'node:worker_threads'
 import type { IPoolWorker } from './pools/pool-worker'
 import type { KillBehavior } from './worker/worker-options'
 
index c71ff297e2485151a89f470c3c9eb4712122a83a..1f42a90bcf073e514a0acf2eec4fa4f04fdb0aea 100644 (file)
@@ -1,6 +1,6 @@
-import { AsyncResource } from 'async_hooks'
-import type { Worker } from 'cluster'
-import type { MessagePort } from 'worker_threads'
+import { AsyncResource } from 'node:async_hooks'
+import type { Worker } from 'node:cluster'
+import type { MessagePort } from 'node:worker_threads'
 import type { MessageValue } from '../utility-types'
 import { EMPTY_FUNCTION } from '../utils'
 import {
index 4f5fbb6b2ea87dcb54227b6b06576d80dba9c849..43e86dd751a5cf8f17a35bbc40185c1ab978920a 100644 (file)
@@ -1,5 +1,5 @@
-import type { Worker } from 'cluster'
-import cluster from 'cluster'
+import type { Worker } from 'node:cluster'
+import cluster from 'node:cluster'
 import type { MessageValue } from '../utility-types'
 import { AbstractWorker } from './abstract-worker'
 import type { WorkerOptions } from './worker-options'
index a8424fbf0151e0ffa59674b4a5575fe604b5543e..639fd19c8437fdb478aeea0ebc481bc9125f019b 100644 (file)
@@ -1,5 +1,5 @@
-import type { MessagePort } from 'worker_threads'
-import { isMainThread, parentPort } from 'worker_threads'
+import type { MessagePort } from 'node:worker_threads'
+import { isMainThread, parentPort } from 'node:worker_threads'
 import type { MessageValue } from '../utility-types'
 import { AbstractWorker } from './abstract-worker'
 import type { WorkerOptions } from './worker-options'