You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+19
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,10 @@ Perform async work synchronously in Node.js using `worker_threads` with first-cl
21
21
-[API](#api)
22
22
-[Envs](#envs)
23
23
-[TypeScript](#typescript)
24
+
-[`ts-node`](#ts-node)
25
+
-[`esbuild-register`](#esbuild-register)
26
+
-[`esbuild-runner`](#esbuild-runner)
27
+
-[`tsx`](#tsx)
24
28
-[Benchmark](#benchmark)
25
29
-[Sponsors](#sponsors)
26
30
-[Backers](#backers)
@@ -69,15 +73,30 @@ You must make sure, the `result` is serializable by [`Structured Clone Algorithm
69
73
1.`SYNCKIT_BUFFER_SIZE`: `bufferSize` to create `SharedArrayBuffer` for `worker_threads` (default as `1024`)
70
74
2.`SYNCKIT_TIMEOUT`: `timeout` for performing the async job (no default)
71
75
3.`SYNCKIT_EXEC_ARGV`: List of node CLI options passed to the worker, split with comma `,`. (default as `[]`), see also [`node` docs](https://nodejs.org/api/worker_threads.html)
76
+
4.`SYNCKIT_TS_RUNNER`: Which TypeScript runner to be used, it could be very useful for development, could be `'ts-node' | 'esbuild-register' | 'esbuild-runner' | 'tsx'`, `'ts-node'` is used by default, make sure you have installed them already
72
77
73
78
### TypeScript
74
79
80
+
#### `ts-node`
81
+
75
82
If you want to use `ts-node` for worker file (a `.ts` file), it is supported out of box!
76
83
77
84
If you want to use a custom tsconfig as project instead of default `tsconfig.json`, use `TS_NODE_PROJECT` env. Please view [ts-node](https://github.com/TypeStrong/ts-node#tsconfig) for more details.
78
85
79
86
If you want to integrate with [tsconfig-paths](https://www.npmjs.com/package/tsconfig-paths), please view [ts-node](https://github.com/TypeStrong/ts-node#paths-and-baseurl) for more details.
80
87
88
+
#### `esbuild-register`
89
+
90
+
Please view <https://github.com/egoist/esbuild-register> for its document
91
+
92
+
#### `esbuild-runner`
93
+
94
+
Please view <https://github.com/folke/esbuild-runner> for its document
95
+
96
+
#### `tsx`
97
+
98
+
Please view <https://github.com/esbuild-kit/tsx> for its document
99
+
81
100
## Benchmark
82
101
83
102
It is about 20x faster than [`sync-threads`](https://github.com/lambci/sync-threads) but 3x slower than native for reading the file content itself 1000 times during runtime, and 18x faster than `sync-threads` but 4x slower than native for total time.
0 commit comments