Skip to content

Commit

Permalink
fix!: migrate to EventEmitterAsyncResource (#91)
Browse files Browse the repository at this point in the history
* fix!: migrate to EventEmitterAsyncResource

* chore: update engines + cleanup

* chore: update lock file

* chore: cleanup dependencies

* chore: apply suggestion

Co-authored-by: Ari Perkkiö <[email protected]>

* chore: include types in wait-for-others

---------

Co-authored-by: Ari Perkkiö <[email protected]>
  • Loading branch information
userquin and AriPerkkio authored May 8, 2024
1 parent c444320 commit 4bd4327
Show file tree
Hide file tree
Showing 19 changed files with 1,345 additions and 2,099 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.nyc_output
.vscode
.idea
node_modules
dist
coverage
2 changes: 1 addition & 1 deletion benchmark/isolate-benchmark.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { cpus } from 'node:os'
import { Worker } from 'node:worker_threads'

import Tinypool from '../dist/esm/index.js'
import Tinypool from '../dist/index.js'

const THREADS = cpus().length - 1
const ROUNDS = 5_000
Expand Down
2 changes: 1 addition & 1 deletion benchmark/simple-benchmark.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Tinypool from '../dist/esm/index.js'
import Tinypool from '../dist/index.js'

async function simpleBenchmark({ duration = 10000 } = {}) {
const pool = new Tinypool({
Expand Down
12 changes: 12 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// only for tsup build, excluded from the final tgz
declare namespace NodeJS {
interface Process {
__tinypool_state__: {
isTinypoolWorker: boolean
isWorkerThread?: boolean
isChildProcess?: boolean
workerData: any
workerId: number
}
}
}
67 changes: 31 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,56 @@
{
"name": "tinypool",
"type": "module",
"version": "0.8.4",
"packageManager": "[email protected]",
"description": "A minimal and tiny Node.js Worker Thread Pool implementation, a fork of piscina, but with fewer features",
"type": "module",
"main": "./dist/esm/index.js",
"module": "./dist/esm/index.js",
"license": "MIT",
"homepage": "https://github.com/tinylibs/tinypool#readme",
"repository": {
"type": "git",
"url": "https://github.com/tinylibs/tinypool.git"
},
"bugs": {
"url": "https://github.com/tinylibs/tinypool/issues"
},
"keywords": [
"fast",
"worker threads",
"thread pool"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/**"
"dist"
],
"packageManager": "[email protected]",
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
"scripts": {
"test": "vitest",
"dev": "tsup --watch",
"build": "tsup",
"publish": "clean-publish",
"prepare": "husky install"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tinylibs/tinypool.git"
},
"keywords": [
"fast",
"worker threads",
"thread pool"
],
"license": "MIT",
"devDependencies": {
"@types/concat-stream": "^1.6.1",
"@types/node": "^15.0.1",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"abort-controller": "^3.0.0",
"@types/node": "^20.12.8",
"clean-publish": "^3.4.4",
"concat-stream": "^2.0.0",
"esbuild": "^0.14.5",
"esbuild-register": "^3.2.1",
"eventemitter-asyncresource": "^1.0.0",
"gen-esm-wrapper": "^1.1.1",
"husky": "^7.0.4",
"nano-staged": "^0.5.0",
"prettier": "^2.5.1",
"regenerator-runtime": "^0.13.9",
"snazzy": "^9.0.0",
"tsup": "^5.11.6",
"typescript": "4.3.x",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"vite": "^5.2.10",
"vitest": "^1.5.0"
},
"bugs": {
"url": "https://github.com/tinylibs/tinypool/issues"
},
"homepage": "https://github.com/tinylibs/tinypool#readme",
"engines": {
"node": ">=14.0.0"
},
"pnpm": {
"overrides": {
"vitest>tinypool": "link:./"
Expand Down
Loading

0 comments on commit 4bd4327

Please sign in to comment.