build: switch default to ESM
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 27 Dec 2023 11:21:55 +0000 (12:21 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 27 Dec 2023 11:21:55 +0000 (12:21 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
80 files changed:
.eslintrc.cjs [moved from .eslintrc.js with 95% similarity]
.lintstagedrc.js
README.md
benchmarks/benchmarks-types.cjs [moved from benchmarks/benchmarks-types.js with 100% similarity]
benchmarks/benchmarks-utils.cjs [moved from benchmarks/benchmarks-utils.js with 97% similarity]
benchmarks/internal/bench.mjs
benchmarks/internal/cluster-worker.cjs [moved from benchmarks/internal/cluster-worker.js with 67% similarity]
benchmarks/internal/thread-worker.mjs
benchmarks/worker-selection/least.mjs
benchmarks/worker-selection/round-robin.mjs
commitlint.config.js
examples/javascript/dynamicExample.cjs [moved from examples/javascript/dynamicExample.js with 100% similarity]
examples/javascript/fixedExample.cjs [moved from examples/javascript/fixedExample.js with 98% similarity]
examples/javascript/multiFunctionExample.cjs [moved from examples/javascript/multiFunctionExample.js with 94% similarity]
examples/javascript/multiFunctionWorker.cjs [moved from examples/javascript/multiFunctionWorker.js with 100% similarity]
examples/javascript/yourWorker.cjs [moved from examples/javascript/yourWorker.js with 100% similarity]
examples/typescript/pool.ts
package.json
rollup.config.mjs
src/index.ts
src/pools/abstract-pool.ts
src/pools/cluster/dynamic.ts
src/pools/cluster/fixed.ts
src/pools/pool.ts
src/pools/selection-strategies/abstract-worker-choice-strategy.ts
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/least-busy-worker-choice-strategy.ts
src/pools/selection-strategies/least-elu-worker-choice-strategy.ts
src/pools/selection-strategies/least-used-worker-choice-strategy.ts
src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/worker-choice-strategy-context.ts
src/pools/thread/dynamic.ts
src/pools/thread/fixed.ts
src/pools/utils.ts
src/pools/worker-node.ts
src/pools/worker.ts
src/utility-types.ts
src/utils.ts
src/worker/abstract-worker.ts
src/worker/cluster-worker.ts
src/worker/thread-worker.ts
src/worker/utils.ts
tests/circular-array.test.mjs
tests/deque.test.mjs
tests/pools/abstract-pool.test.mjs
tests/pools/cluster/dynamic.test.mjs
tests/pools/cluster/fixed.test.mjs
tests/pools/selection-strategies/selection-strategies.test.mjs
tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs
tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs
tests/pools/thread/dynamic.test.mjs
tests/pools/thread/fixed.test.mjs
tests/pools/utils.test.mjs
tests/pools/worker-node.test.mjs
tests/test-types.cjs [moved from tests/test-types.js with 100% similarity]
tests/test-utils.cjs [moved from tests/test-utils.js with 98% similarity]
tests/utils.test.mjs
tests/worker-files/cluster/asyncErrorWorker.cjs [moved from tests/worker-files/cluster/asyncErrorWorker.js with 65% similarity]
tests/worker-files/cluster/asyncWorker.cjs [moved from tests/worker-files/cluster/asyncWorker.js with 58% similarity]
tests/worker-files/cluster/echoWorker.cjs [moved from tests/worker-files/cluster/echoWorker.js with 64% similarity]
tests/worker-files/cluster/emptyWorker.cjs [moved from tests/worker-files/cluster/emptyWorker.js with 65% similarity]
tests/worker-files/cluster/errorWorker.cjs [moved from tests/worker-files/cluster/errorWorker.js with 72% similarity]
tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs [moved from tests/worker-files/cluster/longRunningWorkerHardBehavior.js with 58% similarity]
tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs [moved from tests/worker-files/cluster/longRunningWorkerSoftBehavior.js with 56% similarity]
tests/worker-files/cluster/testMultipleTaskFunctionsWorker.cjs [moved from tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js with 75% similarity]
tests/worker-files/cluster/testWorker.cjs [moved from tests/worker-files/cluster/testWorker.js with 58% similarity]
tests/worker-files/thread/asyncErrorWorker.mjs
tests/worker-files/thread/asyncWorker.mjs
tests/worker-files/thread/echoWorker.mjs
tests/worker-files/thread/emptyWorker.mjs
tests/worker-files/thread/errorWorker.mjs
tests/worker-files/thread/longRunningWorkerHardBehavior.mjs
tests/worker-files/thread/longRunningWorkerSoftBehavior.mjs
tests/worker-files/thread/testMultipleTaskFunctionsWorker.mjs
tests/worker-files/thread/testWorker.mjs
tests/worker/abstract-worker.test.mjs
tests/worker/cluster-worker.test.mjs
tests/worker/thread-worker.test.mjs

similarity index 95%
rename from .eslintrc.js
rename to .eslintrc.cjs
index c1e571d5fda56bf1c550cac7c0c4e78fa3712239..85ae204ae62ae0b6de420a5391614a04e2fe4f35 100644 (file)
@@ -155,24 +155,24 @@ module.exports = defineConfig({
       }
     },
     {
-      files: ['**/*.js', '**/*.mjs'],
+      files: ['**/*.cjs', '**/*.mjs'],
       plugins: ['jsdoc'],
       extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard']
     },
     {
-      files: ['tests/**/*.js', 'tests/**/*.mjs'],
+      files: ['tests/**/*.cjs', 'tests/**/*.mjs'],
       rules: {
         'jsdoc/require-jsdoc': 'off'
       }
     },
     {
-      files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'],
+      files: ['benchmarks/**/*.cjs', 'benchmarks/**/*.mjs'],
       rules: {
         'jsdoc/require-jsdoc': 'off'
       }
     },
     {
-      files: ['examples/javascript/**/*.js'],
+      files: ['examples/javascript/**/*.cjs'],
       rules: {
         'jsdoc/require-jsdoc': 'off'
       }
index 361afe3d2718bf20f580fb1f74b4662945c3a78b..1886925b219e90889d85b37fb58572a850e12398 100644 (file)
@@ -1,4 +1,4 @@
-module.exports = {
+export default {
   '**/*.{ts,tsx,js,jsx,cjs,mjs}': [
     'biome format --write',
     'ts-standard --fix',
index 68e9fe6589ff64573e18eb25a3bd48a8b3ba7650..8cea8d6279757d3d9cbc75fa715a3341df1171bd 100644 (file)
--- a/README.md
+++ b/README.md
@@ -90,8 +90,7 @@ npm install poolifier --save
 You can implement a [worker_threads](https://nodejs.org/api/worker_threads.html#class-worker) worker in a simple way by extending the class _ThreadWorker_:
 
 ```js
-'use strict'
-const { ThreadWorker } = require('poolifier')
+import { ThreadWorker } from 'poolifier'
 
 function yourFunction(data) {
   // this will be executed in the worker thread,
@@ -107,8 +106,7 @@ module.exports = new ThreadWorker(yourFunction, {
 Instantiate your pool based on your needs :
 
 ```js
-'use strict'
-const { DynamicThreadPool, FixedThreadPool, PoolEvents, availableParallelism } = require('poolifier')
+import { DynamicThreadPool, FixedThreadPool, PoolEvents, availableParallelism } from 'poolifier'
 
 // a fixed worker_threads pool
 const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', {
similarity index 97%
rename from benchmarks/benchmarks-utils.js
rename to benchmarks/benchmarks-utils.cjs
index a0a42b95d06642cbb8e7aeb282c06e7f20720b16..e94910984831770041715c33b301f6a68c4ec862 100644 (file)
@@ -17,8 +17,8 @@ const {
   PoolTypes,
   WorkerChoiceStrategies,
   WorkerTypes
-} = require('../lib/index.js')
-const { TaskFunctions } = require('./benchmarks-types.js')
+} = require('../lib/index.cjs')
+const { TaskFunctions } = require('./benchmarks-types.cjs')
 
 const buildPoolifierPool = (workerType, poolType, poolSize, poolOptions) => {
   switch (poolType) {
@@ -33,7 +33,7 @@ const buildPoolifierPool = (workerType, poolType, poolSize, poolOptions) => {
         case WorkerTypes.cluster:
           return new FixedClusterPool(
             poolSize,
-            './benchmarks/internal/cluster-worker.js',
+            './benchmarks/internal/cluster-worker.cjs',
             poolOptions
           )
       }
@@ -51,7 +51,7 @@ const buildPoolifierPool = (workerType, poolType, poolSize, poolOptions) => {
           return new DynamicClusterPool(
             Math.floor(poolSize / 2),
             poolSize,
-            './benchmarks/internal/cluster-worker.js',
+            './benchmarks/internal/cluster-worker.cjs',
             poolOptions
           )
       }
index 5ea11e18414b6f9c474a32ec92c0eba3d0538cb1..88868af7c43c1c3e4e5cce039f2fac71a6b99946 100644 (file)
@@ -4,8 +4,8 @@ import {
   WorkerTypes,
   availableParallelism
 } from '../../lib/index.mjs'
-import { TaskFunctions } from '../benchmarks-types.js'
-import { runPoolifierPoolBenchmark } from '../benchmarks-utils.js'
+import { TaskFunctions } from '../benchmarks-types.cjs'
+import { runPoolifierPoolBenchmark } from '../benchmarks-utils.cjs'
 
 const poolSize = availableParallelism()
 const taskExecutions = 1
similarity index 67%
rename from benchmarks/internal/cluster-worker.js
rename to benchmarks/internal/cluster-worker.cjs
index 18bd648c72ce73d454b3503b038719aeade6bd11..94980725624e9897db66b55b0fda6a3392776b38 100644 (file)
@@ -1,7 +1,7 @@
 const { isPrimary } = require('node:cluster')
-const { ClusterWorker } = require('../../lib')
-const { executeTaskFunction } = require('../benchmarks-utils.js')
-const { TaskFunctions } = require('../benchmarks-types.js')
+const { ClusterWorker } = require('../../lib/index.cjs')
+const { executeTaskFunction } = require('../benchmarks-utils.cjs')
+const { TaskFunctions } = require('../benchmarks-types.cjs')
 
 const taskFunction = data => {
   data = data || {}
index b0994e77bd1af7183f98559481e43fdaf7ec92bb..92508dd887c80e7f6c210d87dec673c0b8952ee3 100644 (file)
@@ -1,7 +1,7 @@
 import { isMainThread } from 'node:worker_threads'
 import { ThreadWorker } from '../../lib/index.mjs'
-import { executeTaskFunction } from '../benchmarks-utils.js'
-import { TaskFunctions } from '../benchmarks-types.js'
+import { executeTaskFunction } from '../benchmarks-utils.cjs'
+import { TaskFunctions } from '../benchmarks-types.cjs'
 
 const taskFunction = data => {
   data = data || {}
index 0969369fb6e1a49c6b10563aa5ab5b6fc1935b5b..6dd91df0e1e0e436c4921748c0e622c6c020147d 100644 (file)
@@ -1,5 +1,5 @@
 import Benchmark from 'benchmark'
-import { LIST_FORMATTER, generateRandomInteger } from '../benchmarks-utils.js'
+import { LIST_FORMATTER, generateRandomInteger } from '../benchmarks-utils.cjs'
 
 function generateRandomTasksMap (
   numberOfWorkers,
index 302cd2c6dffa5e5fa1a76c42f6056327a857c895..b13c81118910b66147b6915a731648ed3974603e 100644 (file)
@@ -1,5 +1,5 @@
 import Benchmark from 'benchmark'
-import { LIST_FORMATTER } from '../benchmarks-utils.js'
+import { LIST_FORMATTER } from '../benchmarks-utils.cjs'
 
 function generateWorkersArray (numberOfWorkers) {
   return [...Array(numberOfWorkers).keys()]
index 4fedde6daf0b816025b8d16a7b8af9e06b33bec5..7c4ff4d984107759ade90b600caeca9637f75883 100644 (file)
@@ -1 +1 @@
-module.exports = { extends: ['@commitlint/config-conventional'] }
+export default { extends: ['@commitlint/config-conventional'] }
similarity index 98%
rename from examples/javascript/fixedExample.js
rename to examples/javascript/fixedExample.cjs
index 55ed724d1e7e5bc4f0e204b5722cf480c1b5cad5..38e0c8afbe30a66e2ab66dba1a7a2d152d6d4b01 100644 (file)
@@ -5,7 +5,7 @@ const {
   availableParallelism
 } = require('poolifier')
 
-const pool = new FixedThreadPool(availableParallelism(), './yourWorker.js', {
+const pool = new FixedThreadPool(availableParallelism(), './yourWorker.cjs', {
   errorHandler: e => console.error(e),
   onlineHandler: () => console.info('worker is online')
 })
similarity index 94%
rename from examples/javascript/multiFunctionExample.js
rename to examples/javascript/multiFunctionExample.cjs
index 9667be3d090d0ba3c735af22d2afc4fb69ca0854..7ab57ab72a5f689b870f210bbc1fc8c9d0a08c70 100644 (file)
@@ -3,7 +3,7 @@ const { FixedThreadPool, availableParallelism } = require('poolifier')
 
 const pool = new FixedThreadPool(
   availableParallelism(),
-  './multiFunctionWorker.js',
+  './multiFunctionWorker.cjs',
   {
     errorHandler: e => console.error(e),
     onlineHandler: () => console.info('worker is online')
index de49c93ad6f8c73bc3cfaa680a78134cdd8daa56..57898d98a9d53a8c89c3d774847e9cae694a53fe 100644 (file)
@@ -1,6 +1,6 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
-import type { MyData, MyResponse } from './worker'
+import type { MyData, MyResponse } from './worker.js'
 import {
   DynamicThreadPool,
   FixedThreadPool,
index 983fda593e5f348cf484084d3f199d2e434c476c..6eb05ce49cc016741690a5be0edc13f4de653759 100644 (file)
@@ -4,11 +4,12 @@
   "version": "3.1.11",
   "description": "Fast and small Node.js Worker_Threads and Cluster Worker Pool",
   "license": "MIT",
-  "main": "./lib/index.js",
+  "type": "module",
+  "main": "./lib/index.cjs",
   "exports": {
     ".": {
       "types": "./lib/index.d.ts",
-      "require": "./lib/index.js",
+      "require": "./lib/index.cjs",
       "import": "./lib/index.mjs"
     }
   },
index d4af3f3ff624310388649f22934a60e7cf867d18..26739f65d88ca4d12f75c24425ac19ef3dedcbda 100644 (file)
@@ -37,11 +37,13 @@ export default defineConfig([
         format: 'cjs',
         ...(isDevelopmentBuild && {
           dir: './lib',
+          entryFileNames: '[name].cjs',
+          chunkFileNames: '[name]-[hash].cjs',
           preserveModules: true,
           preserveModulesRoot: './src'
         }),
         ...(!isDevelopmentBuild && {
-          file: './lib/index.js',
+          file: './lib/index.cjs',
           plugins: [terser({ maxWorkers })]
         }),
         ...(sourcemap && {
index 880fdcbac253caac0e4055f52102d8bdb3a52854..0a9ab8f1ce44c43de8dd4e1c9e1a4617959afdd3 100644 (file)
@@ -1,8 +1,8 @@
-export type { AbstractPool } from './pools/abstract-pool'
-export { DynamicClusterPool } from './pools/cluster/dynamic'
-export { FixedClusterPool } from './pools/cluster/fixed'
-export type { ClusterPoolOptions } from './pools/cluster/fixed'
-export { PoolEvents, PoolTypes } from './pools/pool'
+export type { AbstractPool } from './pools/abstract-pool.js'
+export { DynamicClusterPool } from './pools/cluster/dynamic.js'
+export { FixedClusterPool } from './pools/cluster/fixed.js'
+export type { ClusterPoolOptions } from './pools/cluster/fixed.js'
+export { PoolEvents, PoolTypes } from './pools/pool.js'
 export type {
   IPool,
   PoolEvent,
@@ -10,8 +10,8 @@ export type {
   PoolOptions,
   PoolType,
   TasksQueueOptions
-} from './pools/pool'
-export { WorkerTypes } from './pools/worker'
+} from './pools/pool.js'
+export { WorkerTypes } from './pools/worker.js'
 export type {
   ErrorHandler,
   EventLoopUtilizationMeasurementStatistics,
@@ -28,11 +28,11 @@ export type {
   WorkerNodeOptions,
   WorkerType,
   WorkerUsage
-} from './pools/worker'
+} from './pools/worker.js'
 export {
   Measurements,
   WorkerChoiceStrategies
-} from './pools/selection-strategies/selection-strategies-types'
+} from './pools/selection-strategies/selection-strategies-types.js'
 export type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
@@ -43,27 +43,27 @@ export type {
   TaskStatisticsRequirements,
   WorkerChoiceStrategy,
   WorkerChoiceStrategyOptions
-} from './pools/selection-strategies/selection-strategies-types'
-export type { WorkerChoiceStrategyContext } from './pools/selection-strategies/worker-choice-strategy-context'
-export { DynamicThreadPool } from './pools/thread/dynamic'
-export { FixedThreadPool } from './pools/thread/fixed'
-export type { ThreadPoolOptions } from './pools/thread/fixed'
-export type { AbstractWorker } from './worker/abstract-worker'
-export { ClusterWorker } from './worker/cluster-worker'
-export { ThreadWorker } from './worker/thread-worker'
-export { KillBehaviors } from './worker/worker-options'
+} from './pools/selection-strategies/selection-strategies-types.js'
+export type { WorkerChoiceStrategyContext } from './pools/selection-strategies/worker-choice-strategy-context.js'
+export { DynamicThreadPool } from './pools/thread/dynamic.js'
+export { FixedThreadPool } from './pools/thread/fixed.js'
+export type { ThreadPoolOptions } from './pools/thread/fixed.js'
+export type { AbstractWorker } from './worker/abstract-worker.js'
+export { ClusterWorker } from './worker/cluster-worker.js'
+export { ThreadWorker } from './worker/thread-worker.js'
+export { KillBehaviors } from './worker/worker-options.js'
 export type {
   KillBehavior,
   KillHandler,
   WorkerOptions
-} from './worker/worker-options'
+} from './worker/worker-options.js'
 export type {
   TaskAsyncFunction,
   TaskFunction,
   TaskFunctionOperationResult,
   TaskFunctions,
   TaskSyncFunction
-} from './worker/task-functions'
+} from './worker/task-functions.js'
 export type {
   MessageValue,
   PromiseResponseWrapper,
@@ -72,7 +72,7 @@ export type {
   WorkerError,
   WorkerStatistics,
   Writable
-} from './utility-types'
-export type { CircularArray } from './circular-array'
-export type { Deque, Node } from './deque'
-export { availableParallelism } from './utils'
+} from './utility-types.js'
+export type { CircularArray } from './circular-array.js'
+export type { Deque, Node } from './deque.js'
+export { availableParallelism } from './utils.js'
index 7b18d3556c72e6aee4629ae9831452325ea9d087..e210fa0fabdf13dbe66d77b7fb277c4460ba43f0 100644 (file)
@@ -7,7 +7,7 @@ import type {
   MessageValue,
   PromiseResponseWrapper,
   Task
-} from '../utility-types'
+} from '../utility-types.js'
 import {
   DEFAULT_TASK_NAME,
   EMPTY_FUNCTION,
@@ -20,9 +20,9 @@ import {
   min,
   round,
   sleep
-} from '../utils'
-import { KillBehaviors } from '../worker/worker-options'
-import type { TaskFunction } from '../worker/task-functions'
+} from '../utils.js'
+import { KillBehaviors } from '../worker/worker-options.js'
+import type { TaskFunction } from '../worker/task-functions.js'
 import {
   type IPool,
   PoolEvents,
@@ -31,7 +31,7 @@ import {
   type PoolType,
   PoolTypes,
   type TasksQueueOptions
-} from './pool'
+} from './pool.js'
 import type {
   IWorker,
   IWorkerNode,
@@ -40,16 +40,16 @@ import type {
   WorkerNodeEventDetail,
   WorkerType,
   WorkerUsage
-} from './worker'
+} from './worker.js'
 import {
   Measurements,
   WorkerChoiceStrategies,
   type WorkerChoiceStrategy,
   type WorkerChoiceStrategyOptions
-} from './selection-strategies/selection-strategies-types'
-import { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context'
-import { version } from './version'
-import { WorkerNode } from './worker-node'
+} from './selection-strategies/selection-strategies-types.js'
+import { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context.js'
+import { version } from './version.js'
+import { WorkerNode } from './worker-node.js'
 import {
   checkFilePath,
   checkValidTasksQueueOptions,
@@ -60,7 +60,7 @@ import {
   updateTaskStatisticsWorkerUsage,
   updateWaitTimeWorkerUsage,
   waitWorkerNodeEvents
-} from './utils'
+} from './utils.js'
 
 /**
  * Base class that implements some shared logic for all poolifier pools.
index 08ebc75c76a66ba5ca311c2e269988d741ad5aff..311d5c9d9393157205d03e5029f5515d7ba9a46b 100644 (file)
@@ -1,6 +1,6 @@
-import { checkDynamicPoolSize } from '../utils'
-import { PoolEvents, type PoolType, PoolTypes } from '../pool'
-import { type ClusterPoolOptions, FixedClusterPool } from './fixed'
+import { checkDynamicPoolSize } from '../utils.js'
+import { PoolEvents, type PoolType, PoolTypes } from '../pool.js'
+import { type ClusterPoolOptions, FixedClusterPool } from './fixed.js'
 
 /**
  * A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.
index 63f129f6a7d09323db3390ffdd61b1fd6918c1d4..3b45dc17e005f9495ea73a05c6abef478fccb2de 100644 (file)
@@ -1,8 +1,8 @@
 import cluster, { type Worker } from 'node:cluster'
-import type { MessageValue } from '../../utility-types'
-import { AbstractPool } from '../abstract-pool'
-import { type PoolOptions, type PoolType, PoolTypes } from '../pool'
-import { type WorkerType, WorkerTypes } from '../worker'
+import type { MessageValue } from '../../utility-types.js'
+import { AbstractPool } from '../abstract-pool.js'
+import { type PoolOptions, type PoolType, PoolTypes } from '../pool.js'
+import { type WorkerType, WorkerTypes } from '../worker.js'
 
 /**
  * Options for a poolifier cluster pool.
index 08aad620f5cde2ef28892e43e47f99ba545e6707..546f67b79ad8f48cf1019cdc67d132c41975c0b4 100644 (file)
@@ -1,7 +1,7 @@
 import type { TransferListItem, WorkerOptions } from 'node:worker_threads'
 import type { EventEmitterAsyncResource } from 'node:events'
 import type { ClusterSettings } from 'node:cluster'
-import type { TaskFunction } from '../worker/task-functions'
+import type { TaskFunction } from '../worker/task-functions.js'
 import type {
   ErrorHandler,
   ExitHandler,
@@ -10,11 +10,11 @@ import type {
   MessageHandler,
   OnlineHandler,
   WorkerType
-} from './worker'
+} from './worker.js'
 import type {
   WorkerChoiceStrategy,
   WorkerChoiceStrategyOptions
-} from './selection-strategies/selection-strategies-types'
+} from './selection-strategies/selection-strategies-types.js'
 
 /**
  * Enumeration of pool types.
index d91f3c69e3ccf8782a5d945ad696aa1eea88d4c1..49b7c58442572b9dfd1d2aee691238b152ce54ca 100644 (file)
@@ -1,16 +1,16 @@
 import {
   DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
   buildInternalWorkerChoiceStrategyOptions
-} from '../../utils'
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
+} from '../../utils.js'
+import type { IPool } from '../pool.js'
+import type { IWorker } from '../worker.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
   MeasurementStatisticsRequirements,
   StrategyPolicy,
   TaskStatisticsRequirements
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Worker choice strategy abstract base class.
index aff4e73dd3a6e5a641a626e153f39bd796b32108..c6b87ade001759855115117d155a170a2e104c08 100644 (file)
@@ -1,13 +1,13 @@
-import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils'
-import type { IPool } from '../pool'
-import type { IWorker, StrategyData } from '../worker'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils.js'
+import type { IPool } from '../pool.js'
+import type { IWorker, StrategyData } from '../worker.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import {
   type IWorkerChoiceStrategy,
   type InternalWorkerChoiceStrategyOptions,
   Measurements,
   type TaskStatisticsRequirements
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the next worker with a fair share scheduling algorithm.
index b11f0a177aa44925d510b697e48b578fe14169b4..db439f0209c2ddf21cbe081f3d2b72138453545b 100644 (file)
@@ -1,12 +1,12 @@
-import type { IWorker } from '../worker'
-import type { IPool } from '../pool'
-import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import type { IWorker } from '../worker.js'
+import type { IPool } from '../pool.js'
+import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
   TaskStatisticsRequirements
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the next worker with an interleaved weighted round robin scheduling algorithm.
index a37f91d44fa67276542b8d70b3969a04046f4e72..d800c3839af8c2675a4b7947872a72f0de385d08 100644 (file)
@@ -1,12 +1,12 @@
-import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils'
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils.js'
+import type { IPool } from '../pool.js'
+import type { IWorker } from '../worker.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
   TaskStatisticsRequirements
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the least busy worker.
index d81f206481262eb33eeb0cf77cbeb803073b7855..81d108a3df6e4006e531ac51d05170fc3748d7f5 100644 (file)
@@ -1,12 +1,12 @@
-import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils'
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils.js'
+import type { IPool } from '../pool.js'
+import type { IWorker } from '../worker.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
   TaskStatisticsRequirements
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the worker with the least ELU.
index 6318affe0a306492fe7d1257d6a99e05e3938a67..c1a4a6ac73dd8277ab6b73784a5c3bfcf6f42f89 100644 (file)
@@ -1,10 +1,10 @@
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import type { IPool } from '../pool.js'
+import type { IWorker } from '../worker.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the least used worker.
index 2d08cff20621ba564bb0b424c32a4bcd904f53bb..34c4f596db2af9c3f44e7940c9444effc9d44b77 100644 (file)
@@ -1,10 +1,10 @@
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import type { IPool } from '../pool.js'
+import type { IWorker } from '../worker.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the next worker in a round robin fashion.
index 5338b320b0586bab67195ed5b93e23a0e74cd2f0..4b7eac7a17d3f2f4963a21d3f7db429bc73a21b9 100644 (file)
@@ -1,12 +1,12 @@
-import type { IWorker } from '../worker'
-import type { IPool } from '../pool'
-import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import type { IWorker } from '../worker.js'
+import type { IPool } from '../pool.js'
+import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
   TaskStatisticsRequirements
-} from './selection-strategies-types'
+} from './selection-strategies-types.js'
 
 /**
  * Selects the next worker with a weighted round robin scheduling algorithm.
index 9a015347bc2a430172855116224da8cfc89f2800..d76ee8afef2a15668fe1e921be6e6ac365df3a92 100644 (file)
@@ -1,21 +1,21 @@
-import { buildInternalWorkerChoiceStrategyOptions } from '../../utils'
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
-import { FairShareWorkerChoiceStrategy } from './fair-share-worker-choice-strategy'
-import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from './interleaved-weighted-round-robin-worker-choice-strategy'
-import { LeastBusyWorkerChoiceStrategy } from './least-busy-worker-choice-strategy'
-import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strategy'
-import { LeastEluWorkerChoiceStrategy } from './least-elu-worker-choice-strategy'
-import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy'
+import { buildInternalWorkerChoiceStrategyOptions } from '../../utils.js'
+import type { IPool } from '../pool.js'
+import type { IWorker } from '../worker.js'
+import { FairShareWorkerChoiceStrategy } from './fair-share-worker-choice-strategy.js'
+import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from './interleaved-weighted-round-robin-worker-choice-strategy.js'
+import { LeastBusyWorkerChoiceStrategy } from './least-busy-worker-choice-strategy.js'
+import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strategy.js'
+import { LeastEluWorkerChoiceStrategy } from './least-elu-worker-choice-strategy.js'
+import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy.js'
 import type {
   IWorkerChoiceStrategy,
   InternalWorkerChoiceStrategyOptions,
   StrategyPolicy,
   TaskStatisticsRequirements,
   WorkerChoiceStrategy
-} from './selection-strategies-types'
-import { WorkerChoiceStrategies } from './selection-strategies-types'
-import { WeightedRoundRobinWorkerChoiceStrategy } from './weighted-round-robin-worker-choice-strategy'
+} from './selection-strategies-types.js'
+import { WorkerChoiceStrategies } from './selection-strategies-types.js'
+import { WeightedRoundRobinWorkerChoiceStrategy } from './weighted-round-robin-worker-choice-strategy.js'
 
 /**
  * The worker choice strategy context.
index d3764c285291407d75b1ee293ece40ebbc8c5dfd..2fc360817d2b7bab3e634365b03ca9b541c76715 100644 (file)
@@ -1,6 +1,6 @@
-import { PoolEvents, type PoolType, PoolTypes } from '../pool'
-import { checkDynamicPoolSize } from '../utils'
-import { FixedThreadPool, type ThreadPoolOptions } from './fixed'
+import { PoolEvents, type PoolType, PoolTypes } from '../pool.js'
+import { checkDynamicPoolSize } from '../utils.js'
+import { FixedThreadPool, type ThreadPoolOptions } from './fixed.js'
 
 /**
  * A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.
index f48d0bcd9960da1a2ff89582035a9ad9a9581774..11a24e2780dc445a37cdca15808eb71f95dd5bd9 100644 (file)
@@ -5,10 +5,10 @@ import {
   type Worker,
   isMainThread
 } from 'node:worker_threads'
-import type { MessageValue } from '../../utility-types'
-import { AbstractPool } from '../abstract-pool'
-import { type PoolOptions, type PoolType, PoolTypes } from '../pool'
-import { type WorkerType, WorkerTypes } from '../worker'
+import type { MessageValue } from '../../utility-types.js'
+import { AbstractPool } from '../abstract-pool.js'
+import { type PoolOptions, type PoolType, PoolTypes } from '../pool.js'
+import { type WorkerType, WorkerTypes } from '../worker.js'
 
 /**
  * Options for a poolifier thread pool.
index 619e2061f382cd82e8b30666149fd4ef11578045..99584d8528d65f5538d3f89e309a6dd77d4fde79 100644 (file)
@@ -2,14 +2,14 @@ import { existsSync } from 'node:fs'
 import cluster from 'node:cluster'
 import { SHARE_ENV, Worker, type WorkerOptions } from 'node:worker_threads'
 import { env } from 'node:process'
-import { average, isPlainObject, max, median, min } from '../utils'
-import type { MessageValue, Task } from '../utility-types'
+import { average, isPlainObject, max, median, min } from '../utils.js'
+import type { MessageValue, Task } from '../utility-types.js'
 import {
   type MeasurementStatisticsRequirements,
   WorkerChoiceStrategies,
   type WorkerChoiceStrategy
-} from './selection-strategies/selection-strategies-types'
-import type { TasksQueueOptions } from './pool'
+} from './selection-strategies/selection-strategies-types.js'
+import type { TasksQueueOptions } from './pool.js'
 import {
   type IWorker,
   type IWorkerNode,
@@ -18,8 +18,8 @@ import {
   type WorkerType,
   WorkerTypes,
   type WorkerUsage
-} from './worker'
-import type { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context'
+} from './worker.js'
+import type { WorkerChoiceStrategyContext } from './selection-strategies/worker-choice-strategy-context.js'
 
 export const getDefaultTasksQueueOptions = (
   poolMaxSize: number
index d2397676bb77235279b72748e7e449c97ed0ca13..bf2600d57782873bea28f50f413a7de945a35b35 100644 (file)
@@ -1,9 +1,9 @@
 import { MessageChannel } from 'node:worker_threads'
 import { EventEmitter } from 'node:events'
-import { CircularArray } from '../circular-array'
-import type { Task } from '../utility-types'
-import { DEFAULT_TASK_NAME, getWorkerId, getWorkerType } from '../utils'
-import { Deque } from '../deque'
+import { CircularArray } from '../circular-array.js'
+import type { Task } from '../utility-types.js'
+import { DEFAULT_TASK_NAME, getWorkerId, getWorkerType } from '../utils.js'
+import { Deque } from '../deque.js'
 import {
   type ErrorHandler,
   type ExitHandler,
@@ -17,8 +17,8 @@ import {
   type WorkerType,
   WorkerTypes,
   type WorkerUsage
-} from './worker'
-import { checkWorkerNodeArguments, createWorker } from './utils'
+} from './worker.js'
+import { checkWorkerNodeArguments, createWorker } from './utils.js'
 
 /**
  * Worker node.
index 9c8b77fc623b68ed2a25aed883531dfa5e25cf70..c7a9dcb3cecba710cf62a345f4efd9f029d2f2fb 100644 (file)
@@ -1,7 +1,7 @@
 import type { MessageChannel, WorkerOptions } from 'node:worker_threads'
 import type { EventEmitter } from 'node:events'
-import type { CircularArray } from '../circular-array'
-import type { Task } from '../utility-types'
+import type { CircularArray } from '../circular-array.js'
+import type { Task } from '../utility-types.js'
 
 /**
  * Callback invoked when the worker has started successfully.
index 5d2376cc585d710a62150b8cb93b1a7a9cfa63da..e407309a3d0e221a929a89a5d25cc84466a1e51e 100644 (file)
@@ -1,7 +1,7 @@
 import type { EventLoopUtilization } from 'node:perf_hooks'
 import type { MessagePort, TransferListItem } from 'node:worker_threads'
 import type { AsyncResource } from 'node:async_hooks'
-import type { KillBehavior } from './worker/worker-options'
+import type { KillBehavior } from './worker/worker-options.js'
 
 /**
  * Worker error.
index f7aab63746e274b328d606fb3659a5353e796132..7d6309d539e22e65b08b64b55924b6df8a51de74 100644 (file)
@@ -6,9 +6,9 @@ import { cpus } from 'node:os'
 import type {
   InternalWorkerChoiceStrategyOptions,
   MeasurementStatisticsRequirements
-} from './pools/selection-strategies/selection-strategies-types'
-import type { KillBehavior } from './worker/worker-options'
-import { type IWorker, type WorkerType, WorkerTypes } from './pools/worker'
+} from './pools/selection-strategies/selection-strategies-types.js'
+import type { KillBehavior } from './worker/worker-options.js'
+import { type IWorker, type WorkerType, WorkerTypes } from './pools/worker.js'
 
 /**
  * Default task name.
index e2b16e25495eafb6a70a8e50ac2fa0e208583d0e..81523d8ca964f5af19308c65e99f36de618699a9 100644 (file)
@@ -6,26 +6,26 @@ import type {
   Task,
   TaskPerformance,
   WorkerStatistics
-} from '../utility-types'
+} from '../utility-types.js'
 import {
   DEFAULT_TASK_NAME,
   EMPTY_FUNCTION,
   isAsyncFunction,
   isPlainObject
-} from '../utils'
-import { KillBehaviors, type WorkerOptions } from './worker-options'
+} from '../utils.js'
+import { KillBehaviors, type WorkerOptions } from './worker-options.js'
 import type {
   TaskAsyncFunction,
   TaskFunction,
   TaskFunctionOperationResult,
   TaskFunctions,
   TaskSyncFunction
-} from './task-functions'
+} from './task-functions.js'
 import {
   checkTaskFunctionName,
   checkValidTaskFunctionEntry,
   checkValidWorkerOptions
-} from './utils'
+} from './utils.js'
 
 const DEFAULT_MAX_INACTIVE_TIME = 60000
 const DEFAULT_WORKER_OPTIONS: WorkerOptions = {
index d972692ec6eb4f182479cac008c47a1f20b75d8d..fa810c7e66451ba978320ab887c8073c74214a88 100644 (file)
@@ -1,8 +1,8 @@
 import cluster, { type Worker } from 'node:cluster'
-import type { MessageValue } from '../utility-types'
-import { AbstractWorker } from './abstract-worker'
-import type { WorkerOptions } from './worker-options'
-import type { TaskFunction, TaskFunctions } from './task-functions'
+import type { MessageValue } from '../utility-types.js'
+import { AbstractWorker } from './abstract-worker.js'
+import type { WorkerOptions } from './worker-options.js'
+import type { TaskFunction, TaskFunctions } from './task-functions.js'
 
 /**
  * A cluster worker used by a poolifier `ClusterPool`.
index bc143a1f914b7e7dba14b395ac456be40c59ed80..2a50249f7bbd406ad6789d80167bace6cb009dc6 100644 (file)
@@ -4,10 +4,10 @@ import {
   parentPort,
   threadId
 } from 'node:worker_threads'
-import type { MessageValue } from '../utility-types'
-import { AbstractWorker } from './abstract-worker'
-import type { WorkerOptions } from './worker-options'
-import type { TaskFunction, TaskFunctions } from './task-functions'
+import type { MessageValue } from '../utility-types.js'
+import { AbstractWorker } from './abstract-worker.js'
+import type { WorkerOptions } from './worker-options.js'
+import type { TaskFunction, TaskFunctions } from './task-functions.js'
 
 /**
  * A thread worker used by a poolifier `ThreadPool`.
index e023cc37588cc8d85b86400872d0f4ee3a2ef234..b9372401ed881988d893248167d98a6b222c00be 100644 (file)
@@ -1,6 +1,6 @@
-import { isPlainObject } from '../utils'
-import type { TaskFunction } from './task-functions'
-import { KillBehaviors, type WorkerOptions } from './worker-options'
+import { isPlainObject } from '../utils.js'
+import type { TaskFunction } from './task-functions.js'
+import { KillBehaviors, type WorkerOptions } from './worker-options.js'
 
 export const checkValidWorkerOptions = (opts: WorkerOptions): void => {
   if (opts != null && !isPlainObject(opts)) {
index dfa1b53c8e01e73a93ce2cc1f09e5c99d336bcba..ed06904578f67e48230271e34bc8c15482579e70 100644 (file)
@@ -2,7 +2,7 @@ import { expect } from 'expect'
 import {
   CircularArray,
   DEFAULT_CIRCULAR_ARRAY_SIZE
-} from '../lib/circular-array.js'
+} from '../lib/circular-array.cjs'
 
 describe('Circular array test suite', () => {
   it('Verify that circular array can be instantiated', () => {
index 6c8ebbb1e86389675c8136a892556986e5bd35b0..91ae5987955234da56ee253ca10228bb2b66c489 100644 (file)
@@ -1,5 +1,5 @@
 import { expect } from 'expect'
-import { Deque } from '../lib/deque.js'
+import { Deque } from '../lib/deque.cjs'
 
 describe('Deque test suite', () => {
   it('Verify push() behavior', () => {
index cf4b55afc26a6a1278f886a0d4c2762b1c230f07..a10222610c4ee064164fba8b03d55879db0472a9 100644 (file)
@@ -14,12 +14,12 @@ import {
   PoolTypes,
   WorkerChoiceStrategies,
   WorkerTypes
-} from '../../lib/index.js'
-import { CircularArray } from '../../lib/circular-array.js'
-import { Deque } from '../../lib/deque.js'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.js'
-import { waitPoolEvents } from '../test-utils.js'
-import { WorkerNode } from '../../lib/pools/worker-node.js'
+} from '../../lib/index.cjs'
+import { CircularArray } from '../../lib/circular-array.cjs'
+import { Deque } from '../../lib/deque.cjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
+import { waitPoolEvents } from '../test-utils.cjs'
+import { WorkerNode } from '../../lib/pools/worker-node.cjs'
 
 describe('Abstract pool test suite', () => {
   const version = JSON.parse(
@@ -105,7 +105,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that a negative number of workers is checked', () => {
     expect(
       () =>
-        new FixedClusterPool(-1, './tests/worker-files/cluster/testWorker.js')
+        new FixedClusterPool(-1, './tests/worker-files/cluster/testWorker.cjs')
     ).toThrow(
       new RangeError(
         'Cannot instantiate a pool with a negative number of workers'
@@ -146,7 +146,7 @@ describe('Abstract pool test suite', () => {
         new DynamicClusterPool(
           1,
           undefined,
-          './tests/worker-files/cluster/testWorker.js'
+          './tests/worker-files/cluster/testWorker.cjs'
         )
     ).toThrow(
       new TypeError(
@@ -170,7 +170,7 @@ describe('Abstract pool test suite', () => {
         new DynamicClusterPool(
           0,
           0.5,
-          './tests/worker-files/cluster/testWorker.js'
+          './tests/worker-files/cluster/testWorker.cjs'
         )
     ).toThrow(
       new TypeError(
@@ -206,7 +206,7 @@ describe('Abstract pool test suite', () => {
         new DynamicClusterPool(
           1,
           1,
-          './tests/worker-files/cluster/testWorker.js'
+          './tests/worker-files/cluster/testWorker.cjs'
         )
     ).toThrow(
       new RangeError(
@@ -788,7 +788,7 @@ describe('Abstract pool test suite', () => {
     pool = new DynamicClusterPool(
       Math.floor(numberOfWorkers / 2),
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     expect(pool.info).toStrictEqual({
       version,
@@ -812,7 +812,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that pool worker tasks usage are initialized', async () => {
     const pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     for (const workerNode of pool.workerNodes) {
       expect(workerNode).toBeInstanceOf(WorkerNode)
@@ -848,7 +848,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that pool worker tasks queue are initialized', async () => {
     let pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     for (const workerNode of pool.workerNodes) {
       expect(workerNode).toBeInstanceOf(WorkerNode)
@@ -874,7 +874,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that pool worker info are initialized', async () => {
     let pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     for (const workerNode of pool.workerNodes) {
       expect(workerNode).toBeInstanceOf(WorkerNode)
@@ -926,7 +926,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that pool can be started after initialization', async () => {
     const pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js',
+      './tests/worker-files/cluster/testWorker.cjs',
       {
         startWorkers: false
       }
@@ -953,7 +953,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that pool execute() arguments are checked', async () => {
     const pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     await expect(pool.execute(undefined, 0)).rejects.toThrow(
       new TypeError('name argument must be a string')
@@ -976,7 +976,7 @@ describe('Abstract pool test suite', () => {
   it('Verify that pool worker tasks usage are computed', async () => {
     const pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     const promises = new Set()
     const maxMultiplier = 2
@@ -1127,7 +1127,7 @@ describe('Abstract pool test suite', () => {
     const pool = new DynamicClusterPool(
       Math.floor(numberOfWorkers / 2),
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     expect(pool.emitter.eventNames()).toStrictEqual([])
     let poolInfo
@@ -1396,7 +1396,7 @@ describe('Abstract pool test suite', () => {
     await dynamicThreadPool.destroy()
     const fixedClusterPool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js'
+      './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.cjs'
     )
     await waitPoolEvents(fixedClusterPool, PoolEvents.ready, 1)
     expect(fixedClusterPool.hasTaskFunction(DEFAULT_TASK_NAME)).toBe(true)
@@ -1536,7 +1536,7 @@ describe('Abstract pool test suite', () => {
     await dynamicThreadPool.destroy()
     const fixedClusterPool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js'
+      './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.cjs'
     )
     await waitPoolEvents(fixedClusterPool, PoolEvents.ready, 1)
     expect(fixedClusterPool.listTaskFunctionNames()).toStrictEqual([
@@ -1606,7 +1606,7 @@ describe('Abstract pool test suite', () => {
     const pool = new DynamicClusterPool(
       Math.floor(numberOfWorkers / 2),
       numberOfWorkers,
-      './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js'
+      './tests/worker-files/cluster/testMultipleTaskFunctionsWorker.cjs'
     )
     const data = { n: 10 }
     const result0 = await pool.execute(data)
@@ -1671,7 +1671,7 @@ describe('Abstract pool test suite', () => {
     const pool = new DynamicClusterPool(
       Math.floor(numberOfWorkers / 2),
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     const workerNodeKey = 0
     await expect(
@@ -1684,7 +1684,7 @@ describe('Abstract pool test suite', () => {
     const pool = new DynamicClusterPool(
       Math.floor(numberOfWorkers / 2),
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     const workerNodeKey = 0
     await expect(
@@ -1704,7 +1704,7 @@ describe('Abstract pool test suite', () => {
     const pool = new DynamicClusterPool(
       Math.floor(numberOfWorkers / 2),
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     await expect(
       pool.sendTaskFunctionOperationToWorkers({
index 2a654b6a878cab03a4da44afb7200ca122acf0c1..8c9196d1e9976db770a21865853187a862d34a00 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'expect'
-import { DynamicClusterPool, PoolEvents } from '../../../lib/index.js'
-import { TaskFunctions } from '../../test-types.js'
-import { sleep, waitWorkerEvents } from '../../test-utils.js'
+import { DynamicClusterPool, PoolEvents } from '../../../lib/index.cjs'
+import { TaskFunctions } from '../../test-types.cjs'
+import { sleep, waitWorkerEvents } from '../../test-utils.cjs'
 
 describe('Dynamic cluster pool test suite', () => {
   const min = 1
@@ -9,7 +9,7 @@ describe('Dynamic cluster pool test suite', () => {
   const pool = new DynamicClusterPool(
     min,
     max,
-    './tests/worker-files/cluster/testWorker.js',
+    './tests/worker-files/cluster/testWorker.cjs',
     {
       errorHandler: e => console.error(e)
     }
@@ -84,7 +84,7 @@ describe('Dynamic cluster pool test suite', () => {
     const pool = new DynamicClusterPool(
       min,
       max,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     const result = await pool.execute()
     expect(result).toStrictEqual({ ok: 1 })
@@ -96,7 +96,7 @@ describe('Dynamic cluster pool test suite', () => {
     const longRunningPool = new DynamicClusterPool(
       min,
       max,
-      './tests/worker-files/cluster/longRunningWorkerHardBehavior.js',
+      './tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs',
       {
         errorHandler: e => console.error(e),
         onlineHandler: () => console.info('long executing worker is online'),
@@ -123,7 +123,7 @@ describe('Dynamic cluster pool test suite', () => {
     const longRunningPool = new DynamicClusterPool(
       min,
       max,
-      './tests/worker-files/cluster/longRunningWorkerSoftBehavior.js',
+      './tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs',
       {
         errorHandler: e => console.error(e),
         onlineHandler: () => console.info('long executing worker is online'),
@@ -146,7 +146,7 @@ describe('Dynamic cluster pool test suite', () => {
     const pool = new DynamicClusterPool(
       0,
       max,
-      './tests/worker-files/cluster/testWorker.js'
+      './tests/worker-files/cluster/testWorker.cjs'
     )
     expect(pool).toBeInstanceOf(DynamicClusterPool)
     // We need to clean up the resources after our test
index de188a2e196edcc9c5f530ae93598416c66874e0..ed5882c4c70c3002936be718f4071802e0ff39ad 100644 (file)
@@ -1,22 +1,22 @@
 import { expect } from 'expect'
-import { FixedClusterPool, PoolEvents } from '../../../lib/index.js'
-import { TaskFunctions } from '../../test-types.js'
-import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.js'
-import { DEFAULT_TASK_NAME } from '../../../lib/utils.js'
+import { FixedClusterPool, PoolEvents } from '../../../lib/index.cjs'
+import { TaskFunctions } from '../../test-types.cjs'
+import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
 
 describe('Fixed cluster pool test suite', () => {
   const numberOfWorkers = 8
   const tasksConcurrency = 2
   const pool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/testWorker.js',
+    './tests/worker-files/cluster/testWorker.cjs',
     {
       errorHandler: e => console.error(e)
     }
   )
   const queuePool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/testWorker.js',
+    './tests/worker-files/cluster/testWorker.cjs',
     {
       enableTasksQueue: true,
       tasksQueueOptions: {
@@ -27,30 +27,30 @@ describe('Fixed cluster pool test suite', () => {
   )
   const emptyPool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/emptyWorker.js',
+    './tests/worker-files/cluster/emptyWorker.cjs',
     { exitHandler: () => console.info('empty pool worker exited') }
   )
   const echoPool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/echoWorker.js'
+    './tests/worker-files/cluster/echoWorker.cjs'
   )
   const errorPool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/errorWorker.js',
+    './tests/worker-files/cluster/errorWorker.cjs',
     {
       errorHandler: e => console.error(e)
     }
   )
   const asyncErrorPool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/asyncErrorWorker.js',
+    './tests/worker-files/cluster/asyncErrorWorker.cjs',
     {
       errorHandler: e => console.error(e)
     }
   )
   const asyncPool = new FixedClusterPool(
     numberOfWorkers,
-    './tests/worker-files/cluster/asyncWorker.js'
+    './tests/worker-files/cluster/asyncWorker.cjs'
   )
 
   after('Destroy all pools', async () => {
@@ -82,7 +82,7 @@ describe('Fixed cluster pool test suite', () => {
   it("Verify that 'ready' event is emitted", async () => {
     const pool = new FixedClusterPool(
       numberOfWorkers,
-      './tests/worker-files/cluster/testWorker.js',
+      './tests/worker-files/cluster/testWorker.cjs',
       {
         errorHandler: e => console.error(e)
       }
@@ -277,7 +277,7 @@ describe('Fixed cluster pool test suite', () => {
   })
 
   it('Verify that cluster pool options are checked', async () => {
-    const workerFilePath = './tests/worker-files/cluster/testWorker.js'
+    const workerFilePath = './tests/worker-files/cluster/testWorker.cjs'
     let pool = new FixedClusterPool(numberOfWorkers, workerFilePath)
     expect(pool.opts.env).toBeUndefined()
     expect(pool.opts.settings).toBeUndefined()
@@ -300,7 +300,7 @@ describe('Fixed cluster pool test suite', () => {
   })
 
   it('Should work even without opts in input', async () => {
-    const workerFilePath = './tests/worker-files/cluster/testWorker.js'
+    const workerFilePath = './tests/worker-files/cluster/testWorker.cjs'
     const pool = new FixedClusterPool(numberOfWorkers, workerFilePath)
     const res = await pool.execute()
     expect(res).toStrictEqual({ ok: 1 })
@@ -309,7 +309,7 @@ describe('Fixed cluster pool test suite', () => {
   })
 
   it('Verify destroyWorkerNode()', async () => {
-    const workerFilePath = './tests/worker-files/cluster/testWorker.js'
+    const workerFilePath = './tests/worker-files/cluster/testWorker.cjs'
     const pool = new FixedClusterPool(numberOfWorkers, workerFilePath)
     const workerNodeKey = 0
     let disconnectEvent = 0
@@ -330,7 +330,7 @@ describe('Fixed cluster pool test suite', () => {
   it('Verify that a pool with zero worker fails', () => {
     expect(
       () =>
-        new FixedClusterPool(0, './tests/worker-files/cluster/testWorker.js')
+        new FixedClusterPool(0, './tests/worker-files/cluster/testWorker.cjs')
     ).toThrow('Cannot instantiate a fixed pool with zero worker')
   })
 })
index e17191557a96edb785748c1fb744bf55f81a15a3..39a2ccc3f7ce0cd84ad995165a85a9227341c688 100644 (file)
@@ -5,8 +5,8 @@ import {
   FixedClusterPool,
   FixedThreadPool,
   WorkerChoiceStrategies
-} from '../../../lib/index.js'
-import { CircularArray } from '../../../lib/circular-array.js'
+} from '../../../lib/index.cjs'
+import { CircularArray } from '../../../lib/circular-array.cjs'
 
 describe('Selection strategies test suite', () => {
   const min = 0
@@ -85,7 +85,7 @@ describe('Selection strategies test suite', () => {
       const pool = new DynamicClusterPool(
         min,
         max,
-        './tests/worker-files/cluster/testWorker.js'
+        './tests/worker-files/cluster/testWorker.cjs'
       )
       pool.setWorkerChoiceStrategy(workerChoiceStrategy)
       expect(pool.opts.workerChoiceStrategy).toBe(workerChoiceStrategy)
@@ -389,7 +389,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
     let pool = new FixedClusterPool(
       max,
-      './tests/worker-files/cluster/testWorker.js',
+      './tests/worker-files/cluster/testWorker.cjs',
       { workerChoiceStrategy }
     )
     let results = new Set()
index 25c262fde5ea946a1a1de8b2a18ca8417636a02d..0e756886f35404338f1dff2e7d2b2f7c97e58654 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'expect'
-import { FixedThreadPool } from '../../../lib/index.js'
-import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.js'
-import { generateRandomInteger } from '../../test-utils.js'
+import { FixedThreadPool } from '../../../lib/index.cjs'
+import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs'
+import { generateRandomInteger } from '../../test-utils.cjs'
 
 describe('Weighted round robin strategy worker choice strategy test suite', () => {
   // const min = 1
index 2b8d35d8f485f1ac45ffa6fd203ce33dd6f04073..6615b8c445f0b069b645577017f2725685a0bafa 100644 (file)
@@ -4,15 +4,15 @@ import {
   DynamicThreadPool,
   FixedThreadPool,
   WorkerChoiceStrategies
-} from '../../../lib/index.js'
-import { WorkerChoiceStrategyContext } from '../../../lib/pools/selection-strategies/worker-choice-strategy-context.js'
-import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.js'
-import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.js'
-import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.js'
-import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.js'
-import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.js'
-import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.js'
-import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.js'
+} from '../../../lib/index.cjs'
+import { WorkerChoiceStrategyContext } from '../../../lib/pools/selection-strategies/worker-choice-strategy-context.cjs'
+import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.cjs'
+import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.cjs'
+import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.cjs'
+import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.cjs'
+import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.cjs'
+import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs'
+import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.cjs'
 
 describe('Worker choice strategy context test suite', () => {
   const min = 1
index f7329710bd3c90e2264bebed7ab7aa628c0bccae..06cf64c64081353b9b5db74aed8b2dc39088ffa7 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'expect'
-import { DynamicThreadPool, PoolEvents } from '../../../lib/index.js'
-import { TaskFunctions } from '../../test-types.js'
-import { sleep, waitWorkerEvents } from '../../test-utils.js'
+import { DynamicThreadPool, PoolEvents } from '../../../lib/index.cjs'
+import { TaskFunctions } from '../../test-types.cjs'
+import { sleep, waitWorkerEvents } from '../../test-utils.cjs'
 
 describe('Dynamic thread pool test suite', () => {
   const min = 1
index a7c4a48f73a4252414b2323db4a2b5e4ac9383c9..85415d63d2b9cdb3835c9e1fd5354c59211bb74b 100644 (file)
@@ -1,8 +1,8 @@
 import { expect } from 'expect'
-import { FixedThreadPool, PoolEvents } from '../../../lib/index.js'
-import { TaskFunctions } from '../../test-types.js'
-import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.js'
-import { DEFAULT_TASK_NAME } from '../../../lib/utils.js'
+import { FixedThreadPool, PoolEvents } from '../../../lib/index.cjs'
+import { TaskFunctions } from '../../test-types.cjs'
+import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
 
 describe('Fixed thread pool test suite', () => {
   const numberOfThreads = 6
index adff47d9ba9781687a9fb89daa31dea7841fa8ca..bc0c7126ddaa225c92e5e8c2f13174e2e2eaa760 100644 (file)
@@ -4,13 +4,13 @@ import { expect } from 'expect'
 import {
   CircularArray,
   DEFAULT_CIRCULAR_ARRAY_SIZE
-} from '../../lib/circular-array.js'
+} from '../../lib/circular-array.cjs'
 import {
   createWorker,
   getDefaultTasksQueueOptions,
   updateMeasurementStatistics
-} from '../../lib/pools/utils.js'
-import { WorkerTypes } from '../../lib/index.js'
+} from '../../lib/pools/utils.cjs'
+import { WorkerTypes } from '../../lib/index.cjs'
 
 describe('Pool utils test suite', () => {
   it('Verify getDefaultTasksQueueOptions() behavior', () => {
index f22ea153f22f00e9af20576431efcae57499eb07..549db4b6aa5ae82ac6d87ab3007c376f2e854853 100644 (file)
@@ -1,11 +1,11 @@
 import { MessageChannel, Worker as ThreadWorker } from 'node:worker_threads'
 import { Worker as ClusterWorker } from 'node:cluster'
 import { expect } from 'expect'
-import { WorkerNode } from '../../lib/pools/worker-node.js'
-import { WorkerTypes } from '../../lib/index.js'
-import { CircularArray } from '../../lib/circular-array.js'
-import { Deque } from '../../lib/deque.js'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.js'
+import { WorkerNode } from '../../lib/pools/worker-node.cjs'
+import { WorkerTypes } from '../../lib/index.cjs'
+import { CircularArray } from '../../lib/circular-array.cjs'
+import { Deque } from '../../lib/deque.cjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 
 describe('Worker node test suite', () => {
   const threadWorkerNode = new WorkerNode(
@@ -15,7 +15,7 @@ describe('Worker node test suite', () => {
   )
   const clusterWorkerNode = new WorkerNode(
     WorkerTypes.cluster,
-    './tests/worker-files/cluster/testWorker.js',
+    './tests/worker-files/cluster/testWorker.cjs',
     { tasksQueueBackPressureSize: 12 }
   )
 
similarity index 100%
rename from tests/test-types.js
rename to tests/test-types.cjs
similarity index 98%
rename from tests/test-utils.js
rename to tests/test-utils.cjs
index ef759824ce7e9b4d0294d84f2fa6dff02aba493a..6dba586641d3b1906caee80c96f38e364b3e9497 100644 (file)
@@ -1,4 +1,4 @@
-const { TaskFunctions } = require('./test-types.js')
+const { TaskFunctions } = require('./test-types.cjs')
 
 const waitWorkerEvents = async (pool, workerEvent, numberOfEventsToWait) => {
   return await new Promise(resolve => {
index fd4f776bf2409c8a725e8d3631be9e8981e545c4..2d1ee9e6f3c70d70bf103793fea14d0dbadb80d2 100644 (file)
@@ -23,8 +23,8 @@ import {
   round,
   secureRandom,
   sleep
-} from '../lib/utils.js'
-import { KillBehaviors, WorkerTypes } from '../lib/index.js'
+} from '../lib/utils.cjs'
+import { KillBehaviors, WorkerTypes } from '../lib/index.cjs'
 
 describe('Utils test suite', () => {
   it('Verify DEFAULT_TASK_NAME value', () => {
similarity index 65%
rename from tests/worker-files/cluster/asyncErrorWorker.js
rename to tests/worker-files/cluster/asyncErrorWorker.cjs
index f358fc3ea409ddb987efa05a1ab38ee245afc4df..022b4536ce1d18ae21eae0c2f245a3681371d2f0 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
-const { sleepTaskFunction } = require('../../test-utils.js')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
+const { sleepTaskFunction } = require('../../test-utils.cjs')
 
 async function error (data) {
   return sleepTaskFunction(
similarity index 58%
rename from tests/worker-files/cluster/asyncWorker.js
rename to tests/worker-files/cluster/asyncWorker.cjs
index 3ec0d9508849627e494139fd0d5b70517abd631c..d680689138d23c8bd2d1312abc6d67192889bad4 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
-const { sleepTaskFunction } = require('../../test-utils.js')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
+const { sleepTaskFunction } = require('../../test-utils.cjs')
 
 async function sleep (data) {
   return sleepTaskFunction(data, 2000)
similarity index 64%
rename from tests/worker-files/cluster/echoWorker.js
rename to tests/worker-files/cluster/echoWorker.cjs
index f9308c70c4bbbecfa0d205db06867a46562e2ac2..4534d985b976c2d01d22c0cbd5d82b466a449dab 100644 (file)
@@ -1,5 +1,5 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
 
 function echo (data) {
   return data
similarity index 65%
rename from tests/worker-files/cluster/emptyWorker.js
rename to tests/worker-files/cluster/emptyWorker.cjs
index 02a733da0b9ada70a623f54d57f446c9ba2ad672..9c6072af255284a9ff1debe20fb77a0d49804c13 100644 (file)
@@ -1,5 +1,5 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
 
 function test () {}
 
similarity index 72%
rename from tests/worker-files/cluster/errorWorker.js
rename to tests/worker-files/cluster/errorWorker.cjs
index b8e11d369d20c3ff06e2fc506f83aeda39feaa49..2dcfe6252fea9f973e99e81c78d785887e9b8799 100644 (file)
@@ -1,5 +1,5 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
 
 function error () {
   throw new Error('Error Message from ClusterWorker')
similarity index 58%
rename from tests/worker-files/cluster/longRunningWorkerHardBehavior.js
rename to tests/worker-files/cluster/longRunningWorkerHardBehavior.cjs
index a95d6538b49f3647c5376c8f4459db799ac92c6c..2d7de52ed7016601a48cf224a42449bee01c5044 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
-const { sleepTaskFunction } = require('../../test-utils.js')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
+const { sleepTaskFunction } = require('../../test-utils.cjs')
 
 async function sleep (data) {
   return sleepTaskFunction(data, 50000)
similarity index 56%
rename from tests/worker-files/cluster/longRunningWorkerSoftBehavior.js
rename to tests/worker-files/cluster/longRunningWorkerSoftBehavior.cjs
index 0459acf73067dde08a3eadf59bbad27783fc2ce5..91eb2b3523c0986410685dfdd0bec2b52dd90fff 100644 (file)
@@ -1,6 +1,6 @@
 'use strict'
-const { ClusterWorker } = require('../../../lib')
-const { sleepTaskFunction } = require('../../test-utils.js')
+const { ClusterWorker } = require('../../../lib/index.cjs')
+const { sleepTaskFunction } = require('../../test-utils.cjs')
 
 async function sleep (data) {
   return sleepTaskFunction(data, 50000)
similarity index 75%
rename from tests/worker-files/cluster/testMultipleTaskFunctionsWorker.js
rename to tests/worker-files/cluster/testMultipleTaskFunctionsWorker.cjs
index 0777cecb011019367c412359bc2ec766066b6a63..ef785aa1da49d098d72340230e90c4f2c5d9db03 100644 (file)
@@ -1,10 +1,10 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
 const {
   jsonIntegerSerialization,
   factorial,
   fibonacci
-} = require('../../test-utils.js')
+} = require('../../test-utils.cjs')
 
 module.exports = new ClusterWorker(
   {
similarity index 58%
rename from tests/worker-files/cluster/testWorker.js
rename to tests/worker-files/cluster/testWorker.cjs
index 57715266bcf7c181c955b4995ec4ee9b9c46c981..fd6b2eb235514a5a05ec66064f718ad781e419d7 100644 (file)
@@ -1,7 +1,7 @@
 'use strict'
-const { ClusterWorker, KillBehaviors } = require('../../../lib')
-const { executeTaskFunction } = require('../../test-utils.js')
-const { TaskFunctions } = require('../../test-types.js')
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
+const { executeTaskFunction } = require('../../test-utils.cjs')
+const { TaskFunctions } = require('../../test-types.cjs')
 
 function test (data) {
   data = data || {}
index c7c9371c565d6b9bcb486737bfd7414825e7cf82..9624b6d8e6fee51d20026af9f98f9a43dd472c4e 100644 (file)
@@ -1,5 +1,5 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
-import { sleepTaskFunction } from '../../test-utils.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
  *
index 30442bfca19b8ca1219eb4ee02c8e17d7425499c..623d517d171a8f1fcf83b999182f60e803a52a97 100644 (file)
@@ -1,5 +1,5 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
-import { sleepTaskFunction } from '../../test-utils.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
  *
index 04b6c9965f2b1b11e3a93d58499f8e02bec73cad..9a8ae66eb689ad731101e7bcc40f980d268a4210 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
 
 /**
  *
index b129244c0103f1c3a6aa793661031926b5e86eba..ad4d52bc1932b4f90dbb7947785d350863b2d7e8 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
 
 /**
  *
index 101e45585ba49afb59ce9a7c0f6f983bd1bf153f..ec86674371bcf16d7b605bbe9bfd86d9152f1eff 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
 
 /**
  *
index 01cf3c0e6013cc8240f36a5866ac72e5bd160cbc..3d58ab456caf19e18e7decb58e115f1f1cf8acc1 100644 (file)
@@ -1,5 +1,5 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
-import { sleepTaskFunction } from '../../test-utils.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
  *
index 9083e1d1b3692119bcda3608ad39738159c262b9..4b7c15004d72b9e0a18d3e256d789e76156e0974 100644 (file)
@@ -1,5 +1,5 @@
-import { ThreadWorker } from '../../../lib/index.js'
-import { sleepTaskFunction } from '../../test-utils.js'
+import { ThreadWorker } from '../../../lib/index.cjs'
+import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
  *
index d559beb7e03baa53c14319fca7b4613b37c09cc6..94e548ef1464916d9c8ffd91b3685caeb34cf984 100644 (file)
@@ -1,9 +1,9 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
 import {
   factorial,
   fibonacci,
   jsonIntegerSerialization
-} from '../../test-utils.js'
+} from '../../test-utils.cjs'
 
 export default new ThreadWorker(
   {
index 618a9ac00c3be427f13e528b097fb449b758cb5a..8a74ae3a150111858ccdaf33b2e80f824b36fdf4 100644 (file)
@@ -1,6 +1,6 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
-import { executeTaskFunction } from '../../test-utils.js'
-import { TaskFunctions } from '../../test-types.js'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { executeTaskFunction } from '../../test-utils.cjs'
+import { TaskFunctions } from '../../test-types.cjs'
 
 /**
  *
index 4abbbeb1e17a0ff0528944e0f6e8707e4ad607d5..3e5f55187f16b3e46ba2ce9bf1292cd6bcf88eb2 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
-import { ClusterWorker, KillBehaviors, ThreadWorker } from '../../lib/index.js'
-import { DEFAULT_TASK_NAME, EMPTY_FUNCTION } from '../../lib/utils.js'
+import { ClusterWorker, KillBehaviors, ThreadWorker } from '../../lib/index.cjs'
+import { DEFAULT_TASK_NAME, EMPTY_FUNCTION } from '../../lib/utils.cjs'
 
 describe('Abstract worker test suite', () => {
   class StubWorkerWithMainWorker extends ThreadWorker {
index b785010ec5cf7b61999852c53658091abba0e5f5..33ddf374099ceeaea63acddd095531ae266d6667 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
-import { ClusterWorker } from '../../lib/index.js'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.js'
+import { ClusterWorker } from '../../lib/index.cjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 
 describe('Cluster worker test suite', () => {
   afterEach(() => {
index 81b096f2b8b308812089cdebfb234e15954199ba..77bb6c08937dd2937bb069e702be43d526865585 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'expect'
 import { restore, stub } from 'sinon'
-import { ThreadWorker } from '../../lib/index.js'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.js'
+import { ThreadWorker } from '../../lib/index.cjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
 
 describe('Thread worker test suite', () => {
   afterEach(() => {