Skip to content

Commit 1101ede

Browse files
committedJul 2, 2022
chore: add donate and funding fields, update node engine field
1 parent 0dcba40 commit 1101ede

16 files changed

+2783
-2361
lines changed
 

‎.changeset/breezy-olives-complain.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'synckit': patch
3+
---
4+
5+
chore: add donate and funding fields, update node engine field

‎.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
coverage
2+
dist
23
lib
34
CHANGELOG.md
45
!/.*.cjs

‎.github/FUNDING.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
github: [JounQin]
2-
open_collective: rxts
1+
github:
2+
- JounQin
3+
- 1stG
4+
- rxts
5+
- unts
6+
open_collective: unts
7+
patreon: 1stG
8+
custom:
9+
- https://opencollective.com/1stG
10+
- https://opencollective.com/rxts

‎.github/workflows/pkg-size.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Package Size Report
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
pkg-size-report:
10+
name: Package Size Report
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
cache: yarn
22+
23+
- name: Package Size Report
24+
uses: pkg-size/action@v1
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1717
fetch-depth: 0
1818

19-
- name: Setup Node.js 16.x
19+
- name: Setup Node.js 16
2020
uses: actions/setup-node@v3
2121
with:
22-
node-version: 16.x
22+
node-version: 16
2323
cache: yarn
2424

2525
- name: Install Dependencies

‎README.md

+14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Perform async work synchronously in Node.js using `worker_threads` with first-cl
2222
- [Envs](#envs)
2323
- [TypeScript](#typescript)
2424
- [Benchmark](#benchmark)
25+
- [Sponsors](#sponsors)
26+
- [Backers](#backers)
2527
- [Changelog](#changelog)
2628
- [License](#license)
2729

@@ -86,6 +88,18 @@ See [benchmark.cjs](./benchmarks/benchmark.cjs.txt) and [benchmark.esm](./benchm
8688

8789
You can try it with running `yarn benchmark` by yourself. [Here](./benchmarks/benchmark.js) is the benchmark source code.
8890

91+
## Sponsors
92+
93+
| 1stG | RxTS | UnTS |
94+
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
95+
| [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |
96+
97+
## Backers
98+
99+
| 1stG | RxTS | UnTS |
100+
| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
101+
| [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |
102+
89103
## Changelog
90104

91105
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).

‎benchmarks/benchmark.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { performance } = require('node:perf_hooks')
44

5-
const RUN_TIMES = +process.env.RUN_TIMES || 1000
5+
const RUN_TIMES = +(process.env.RUN_TIMES || 1000)
66

77
/**
88
* @param {string} name

‎benchmarks/benchmark.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { performance } from 'node:perf_hooks'
44
import { fileURLToPath } from 'node:url'
55

6-
const RUN_TIMES = +process.env.RUN_TIMES || 1000
6+
const RUN_TIMES = +(process.env.RUN_TIMES || 1000)
77

88
const __filename = fileURLToPath(import.meta.url)
99

@@ -91,15 +91,11 @@ class Benchmark {
9191
}
9292
}
9393

94-
const main = async () => {
95-
console.table(
96-
new Benchmark({
97-
synckit: await perfCase('synckit'),
98-
syncThreads: await perfCase('sync-threads'),
99-
deasync: await perfCase('deasync'),
100-
native: await perfCase('native'),
101-
}),
102-
)
103-
}
104-
105-
main()
94+
console.table(
95+
new Benchmark({
96+
synckit: await perfCase('synckit'),
97+
syncThreads: await perfCase('sync-threads'),
98+
deasync: await perfCase('deasync'),
99+
native: await perfCase('native'),
100+
}),
101+
)

‎benchmarks/deasync.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('fs')
1+
const fs = require('node:fs')
22

33
const deasync = require('deasync')
44

‎benchmarks/native.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const fs = require('fs')
1+
const fs = require('node:fs')
22

33
module.exports = filename => fs.readFileSync(filename, 'utf8')

‎benchmarks/sync-threads.worker.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('fs')
1+
const fs = require('node:fs')
22

33
const { runAsWorker } = require('sync-threads')
44

‎benchmarks/synckit.worker.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('fs')
1+
const fs = require('node:fs')
22

33
const { runAsWorker } = require('../lib/index.cjs')
44

‎package.json

+49-14
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,42 @@
44
"type": "module",
55
"description": "Perform async work synchronously in Node.js using `worker_threads`, or `child_process` as fallback, with first-class TypeScript support.",
66
"repository": "git+https://github.com/rx-ts/synckit.git",
7-
"author": "JounQin <admin@1stg.me>",
7+
"author": "JounQin (https://www.1stG.me) <admin@1stg.me>",
8+
"donate": {
9+
"recipients": [
10+
{
11+
"name": "unts",
12+
"platform": "opencollective",
13+
"address": "https://opencollective.com/unts",
14+
"weight": 60
15+
},
16+
{
17+
"name": "rxts",
18+
"platform": "opencollective",
19+
"address": "https://opencollective.com/rxts",
20+
"weight": 20
21+
},
22+
{
23+
"name": "1stG",
24+
"email": "i@1stg.me",
25+
"weight": 20,
26+
"platforms": [
27+
{
28+
"platform": "opencollective",
29+
"address": "https://opencollective.com/1stG"
30+
},
31+
{
32+
"platform": "patreon",
33+
"address": "https://www.patreon.com/1stG"
34+
}
35+
]
36+
}
37+
]
38+
},
39+
"funding": "https://opencollective.com/unts",
840
"license": "MIT",
941
"engines": {
10-
"node": ">=12.20"
42+
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
1143
},
1244
"main": "./lib/index.cjs",
1345
"module": "./lib/index.js",
@@ -56,23 +88,23 @@
5688
"tslib": "^2.4.0"
5789
},
5890
"devDependencies": {
59-
"@1stg/lib-config": "^6.1.1",
60-
"@changesets/changelog-github": "^0.4.4",
61-
"@changesets/cli": "^2.22.0",
62-
"@types/jest": "^27.5.1",
63-
"@types/node": "^17.0.35",
64-
"clean-publish": "^4.0.0",
91+
"@1stg/lib-config": "^7.2.3",
92+
"@changesets/changelog-github": "^0.4.5",
93+
"@changesets/cli": "^2.23.0",
94+
"@types/jest": "^28.1.4",
95+
"@types/node": "^18.0.0",
96+
"clean-publish": "^4.0.1",
6597
"deasync": "^0.1.26",
6698
"patch-package": "^6.4.7",
6799
"sync-threads": "^1.0.1",
68100
"ts-expect": "^1.3.0",
69-
"ts-jest": "^28.0.2",
70-
"ts-node": "^10.8.0",
71-
"type-coverage": "^2.21.1",
72-
"typescript": "^4.6.4"
101+
"ts-jest": "^28.0.5",
102+
"ts-node": "^10.8.1",
103+
"type-coverage": "^2.21.2",
104+
"typescript": "^4.7.4"
73105
},
74106
"resolutions": {
75-
"prettier": "^2.6.2",
107+
"prettier": "^2.7.1",
76108
"tslib": "^2.4.0"
77109
},
78110
"commitlint": {
@@ -105,10 +137,13 @@
105137
]
106138
},
107139
"typeCoverage": {
108-
"atLeast": 99.73,
140+
"atLeast": 100,
109141
"cache": true,
110142
"detail": true,
111143
"ignoreAsAssertion": true,
144+
"ignoreFiles": [
145+
"**/*.d.ts"
146+
],
112147
"ignoreNonNullAssertion": true,
113148
"showRelativePath": true,
114149
"strict": true,

‎src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import {
55
MessageChannel,
66
Worker,
77
receiveMessageOnPort,
8+
// type-coverage:ignore-next-line -- we can't control
89
workerData,
910
parentPort,
10-
} from 'worker_threads'
11+
} from 'node:worker_threads'
1112

1213
import { findUp, tryExtensions } from '@pkgr/utils'
1314

@@ -225,6 +226,7 @@ export function runAsWorker<
225226
R = unknown,
226227
T extends AnyAsyncFn<R> = AnyAsyncFn<R>,
227228
>(fn: T) {
229+
// type-coverage:ignore-next-line -- we can't control
228230
if (!workerData) {
229231
return
230232
}

‎src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MessagePort } from 'worker_threads'
1+
import { MessagePort } from 'node:worker_threads'
22

33
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44
export type AnyFn<R = any, T extends any[] = any[]> = (...args: T) => R

‎yarn.lock

+2,658-2,323
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.