refactor: cleanup type import
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 20 Sep 2023 20:02:40 +0000 (22:02 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 20 Sep 2023 20:02:40 +0000 (22:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
16 files changed:
examples/typescript/http-client-pool/src/main.ts
examples/typescript/http-client-pool/src/pool.ts
examples/typescript/http-client-pool/src/types.ts
examples/typescript/http-client-pool/src/worker.ts
examples/typescript/http-server-pool/express-cluster/src/worker.ts
examples/typescript/http-server-pool/fastify-hybrid/@types/fastify/index.d.ts
examples/typescript/http-server-pool/fastify-hybrid/src/fastify-poolifier.ts
examples/typescript/http-server-pool/fastify-worker_threads/@types/fastify/index.d.ts
examples/typescript/http-server-pool/fastify-worker_threads/src/fastify-poolifier.ts
examples/typescript/http-server-pool/fastify-worker_threads/src/types.ts
examples/typescript/smtp-client-pool/src/pool.ts
examples/typescript/smtp-client-pool/src/worker.ts
examples/typescript/websocket-server-pool/ws-cluster/src/main.ts
examples/typescript/websocket-server-pool/ws-hybrid/src/main.ts
src/pools/abstract-pool.ts
src/pools/pool.ts

index 8217434fddd4af8cf4b3c6b3a2722c373bda2494..41028e630fca19b8759790d8bfb5c30b5e773c9a 100644 (file)
@@ -1,6 +1,6 @@
 import { availableParallelism } from 'poolifier'
 import { httpClientPool } from './pool.js'
-import { type WorkerResponse } from './types.js'
+import type { WorkerResponse } from './types.js'
 
 const parallelism = availableParallelism() * 2
 const requestUrl = 'http://localhost:8080/'
index 3d64150a8af14c161c4a005a044ad2b003bacad0..7fbb20d55ac803f0aac47dee1e287edccd234e63 100644 (file)
@@ -1,7 +1,7 @@
 import { fileURLToPath } from 'node:url'
 import { dirname, extname, join } from 'node:path'
 import { DynamicThreadPool, availableParallelism } from 'poolifier'
-import { type WorkerData, type WorkerResponse } from './types.js'
+import type { WorkerData, WorkerResponse } from './types.js'
 
 const workerFile = join(
   dirname(fileURLToPath(import.meta.url)),
index ff0d3262e2d05644669108e2a412489afabb853c..11fe73e84d1fa4bc31ad5ce3b0cf15cb94b75239 100644 (file)
@@ -1,9 +1,9 @@
-import { type URL } from 'node:url'
+import type { URL } from 'node:url'
 import {
   type RequestInfo as NodeFetchRequestInfo,
   type RequestInit as NodeFetchRequestInit
 } from 'node-fetch'
-import { type AxiosRequestConfig } from 'axios'
+import type { AxiosRequestConfig } from 'axios'
 
 export interface WorkerData {
   input: URL | RequestInfo | NodeFetchRequestInfo
index b7c5962914cd0e0e8ab9604182232875c392c771..63f77fd753ae02f7e5ac4d29b74a2065487347f5 100644 (file)
@@ -4,7 +4,7 @@ import nodeFetch, {
   type ResponseInit as NodeFetchRequestInit
 } from 'node-fetch'
 import axios from 'axios'
-import { type WorkerData, type WorkerResponse } from './types.js'
+import type { WorkerData, WorkerResponse } from './types.js'
 
 class HttpClientWorker extends ThreadWorker<WorkerData, WorkerResponse> {
   public constructor () {
index c5fe74acc122c0c391d419c559d613026ea56354..7dd607b5b17cfd703d4dd75ae0c08d5aa6c5dd7b 100644 (file)
@@ -2,7 +2,7 @@ import type { Server } from 'node:http'
 import type { AddressInfo } from 'node:net'
 import { ClusterWorker } from 'poolifier'
 import express, { type Express, type Request, type Response } from 'express'
-import { type WorkerData, type WorkerResponse } from './types.js'
+import type { WorkerData, WorkerResponse } from './types.js'
 
 const factorial: (n: number) => number = n => {
   if (n === 0) {
index 70a804b14fb902dc67d8b6ebed490c89a5389144..3ff88aa2b46b3f6048869bc95dd97d6f160c95b6 100644 (file)
@@ -1,6 +1,6 @@
 import type { TransferListItem } from 'node:worker_threads'
 import type * as fastify from 'fastify'
-import { type DynamicThreadPool } from 'poolifier'
+import type { DynamicThreadPool } from 'poolifier'
 import {
   type ThreadWorkerData,
   type ThreadWorkerResponse
index 2d13758028f8105f893226d91ed1c8ff07482949..2bdf2040bbbb3354ea1d703318ca3832ba109904 100644 (file)
@@ -1,6 +1,6 @@
 import type { TransferListItem } from 'node:worker_threads'
 import { DynamicThreadPool, availableParallelism } from 'poolifier'
-import { type FastifyPluginCallback } from 'fastify'
+import type { FastifyPluginCallback } from 'fastify'
 import fp from 'fastify-plugin'
 import {
   type FastifyPoolifierOptions,
index e2ec4062820d299647132f7ac0306127e0ebe57e..93fb69eb806a7a112aebe7a72a9fbc2ef1df49f3 100644 (file)
@@ -1,7 +1,7 @@
 import type { TransferListItem } from 'node:worker_threads'
 import type * as fastify from 'fastify'
-import { type DynamicThreadPool } from 'poolifier'
-import { type WorkerData, type WorkerResponse } from '../../src/types.ts'
+import type { DynamicThreadPool } from 'poolifier'
+import type { WorkerData, WorkerResponse } from '../../src/types.ts'
 
 declare module 'fastify' {
   export interface FastifyInstance extends fastify.FastifyInstance {
index 74c0c1687a7ee3dd586e570f7968f623f84d42c7..aa9a6d1459813c6a4cf66f0d2ce9795db5b63288 100644 (file)
@@ -1,6 +1,6 @@
 import type { TransferListItem } from 'node:worker_threads'
 import { DynamicThreadPool, availableParallelism } from 'poolifier'
-import { type FastifyPluginCallback } from 'fastify'
+import type { FastifyPluginCallback } from 'fastify'
 import fp from 'fastify-plugin'
 import {
   type FastifyPoolifierOptions,
index 9e0cf696d4cc22492e947649599712203d4594e6..97c2c540df9edbf44a01c01f6b8517c3d04a4d73 100644 (file)
@@ -1,4 +1,4 @@
-import { type ThreadPoolOptions } from 'poolifier'
+import type { ThreadPoolOptions } from 'poolifier'
 
 export interface BodyPayload {
   number?: number
index ec2ec1367c5f0219dd8f685d3977e1f61d0ddf7a..85fb4cdf94b187753900825f02720c8c60ff9450 100644 (file)
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url'
 import { dirname, extname, join } from 'node:path'
 import { DynamicThreadPool, availableParallelism } from 'poolifier'
 import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js'
-import { type WorkerData } from './types.js'
+import type { WorkerData } from './types.js'
 
 const workerFile = join(
   dirname(fileURLToPath(import.meta.url)),
index 3ac62ccac60ecf7ffd2fb75d04c35e06a7303872..448575d12cbe03a43c0c14de39d5d97c07b39ce7 100644 (file)
@@ -2,7 +2,7 @@ import { ThreadWorker } from 'poolifier'
 import { createTransport } from 'nodemailer'
 import type Mail from 'nodemailer/lib/mailer/index.js'
 import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js'
-import { type WorkerData } from './types.js'
+import type { WorkerData } from './types.js'
 
 class SmtpClientWorker extends ThreadWorker<
 WorkerData,
index ad58bd20ccb8806f2954da84f46b82886f9dd71c..6187d71fc3ae157177c2172e9bbdfdee3d5d56ad 100644 (file)
@@ -1,7 +1,7 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
 import { FixedClusterPool, availableParallelism } from 'poolifier'
-import { type WorkerData, type WorkerResponse } from './types.js'
+import type { WorkerData, WorkerResponse } from './types.js'
 
 const workerFile = join(
   dirname(fileURLToPath(import.meta.url)),
index f6536bd0bbc3bbde78e8cd5bf68cfb48099e1fc6..3adac7e819b3c6a35fd5fbd6f40196ea1df2846b 100644 (file)
@@ -1,7 +1,7 @@
 import { dirname, extname, join } from 'node:path'
 import { fileURLToPath } from 'node:url'
 import { FixedClusterPool, availableParallelism } from 'poolifier'
-import { type ClusterWorkerData, type ClusterWorkerResponse } from './types.js'
+import type { ClusterWorkerData, ClusterWorkerResponse } from './types.js'
 
 const webSocketServerWorkerFile = join(
   dirname(fileURLToPath(import.meta.url)),
index 4fe0c0388d898adae0222e281e4fb70eb66a4c82..e525cc9a5ccd1ac9b3e58bbc5d867e4f82ea2603 100644 (file)
@@ -1,6 +1,6 @@
 import { randomUUID } from 'node:crypto'
 import { performance } from 'node:perf_hooks'
-import { type TransferListItem } from 'node:worker_threads'
+import type { TransferListItem } from 'node:worker_threads'
 import type {
   MessageValue,
   PromiseResponseWrapper,
index ab2cf2e49258acf35c267f03d5c88bab91f1428e..f0c7d886fb5258db41f4c6c7277d474afe200369 100644 (file)
@@ -1,5 +1,5 @@
 import { EventEmitter } from 'node:events'
-import { type TransferListItem } from 'node:worker_threads'
+import type { TransferListItem } from 'node:worker_threads'
 import type { TaskFunction } from '../worker/task-functions'
 import type {
   ErrorHandler,