@volter/tabnode 0.2.14-volter.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +78 -0
  3. package/THIRD-PARTY-NOTICES.md +12 -0
  4. package/dist/__sw__.js +526 -0
  5. package/dist/assets/runtime-worker-4MKaHFVb.js +75221 -0
  6. package/dist/assets/runtime-worker-4MKaHFVb.js.map +1 -0
  7. package/dist/code-transforms.d.ts +21 -0
  8. package/dist/code-transforms.d.ts.map +1 -0
  9. package/dist/config/cdn.d.ts +12 -0
  10. package/dist/config/cdn.d.ts.map +1 -0
  11. package/dist/create-runtime.d.ts +22 -0
  12. package/dist/create-runtime.d.ts.map +1 -0
  13. package/dist/host-globals.d.ts +62 -0
  14. package/dist/host-globals.d.ts.map +1 -0
  15. package/dist/index.cjs +36021 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.ts +127 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.mjs +36020 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/node-internals.d.ts +68 -0
  22. package/dist/node-internals.d.ts.map +1 -0
  23. package/dist/node-lib/binding/blob.d.ts +12 -0
  24. package/dist/node-lib/binding/blob.d.ts.map +1 -0
  25. package/dist/node-lib/binding/buffer.d.ts +144 -0
  26. package/dist/node-lib/binding/buffer.d.ts.map +1 -0
  27. package/dist/node-lib/binding/cares_wrap.d.ts +14 -0
  28. package/dist/node-lib/binding/cares_wrap.d.ts.map +1 -0
  29. package/dist/node-lib/binding/fds.d.ts +30 -0
  30. package/dist/node-lib/binding/fds.d.ts.map +1 -0
  31. package/dist/node-lib/binding/fs.d.ts +157 -0
  32. package/dist/node-lib/binding/fs.d.ts.map +1 -0
  33. package/dist/node-lib/binding/handles.d.ts +81 -0
  34. package/dist/node-lib/binding/handles.d.ts.map +1 -0
  35. package/dist/node-lib/binding/http_parser.d.ts +122 -0
  36. package/dist/node-lib/binding/http_parser.d.ts.map +1 -0
  37. package/dist/node-lib/binding/index.d.ts +3 -0
  38. package/dist/node-lib/binding/index.d.ts.map +1 -0
  39. package/dist/node-lib/binding/llhttp-wasm.d.ts +22 -0
  40. package/dist/node-lib/binding/llhttp-wasm.d.ts.map +1 -0
  41. package/dist/node-lib/binding/misc.d.ts +123 -0
  42. package/dist/node-lib/binding/misc.d.ts.map +1 -0
  43. package/dist/node-lib/binding/pipe_wrap.d.ts +84 -0
  44. package/dist/node-lib/binding/pipe_wrap.d.ts.map +1 -0
  45. package/dist/node-lib/binding/process_wrap.d.ts +173 -0
  46. package/dist/node-lib/binding/process_wrap.d.ts.map +1 -0
  47. package/dist/node-lib/binding/spawn_sync.d.ts +30 -0
  48. package/dist/node-lib/binding/spawn_sync.d.ts.map +1 -0
  49. package/dist/node-lib/binding/stream_wrap.d.ts +191 -0
  50. package/dist/node-lib/binding/stream_wrap.d.ts.map +1 -0
  51. package/dist/node-lib/binding/stubs.d.ts +23 -0
  52. package/dist/node-lib/binding/stubs.d.ts.map +1 -0
  53. package/dist/node-lib/binding/tcp_wrap.d.ts +98 -0
  54. package/dist/node-lib/binding/tcp_wrap.d.ts.map +1 -0
  55. package/dist/node-lib/binding/tty_wrap.d.ts +36 -0
  56. package/dist/node-lib/binding/tty_wrap.d.ts.map +1 -0
  57. package/dist/node-lib/binding/util.d.ts +126 -0
  58. package/dist/node-lib/binding/util.d.ts.map +1 -0
  59. package/dist/node-lib/binding/uv.d.ts +32 -0
  60. package/dist/node-lib/binding/uv.d.ts.map +1 -0
  61. package/dist/node-lib/binding/zlib-pako.d.ts +22 -0
  62. package/dist/node-lib/binding/zlib-pako.d.ts.map +1 -0
  63. package/dist/node-lib/binding/zlib.d.ts +38 -0
  64. package/dist/node-lib/binding/zlib.d.ts.map +1 -0
  65. package/dist/node-lib/buffer-module.d.ts +51 -0
  66. package/dist/node-lib/buffer-module.d.ts.map +1 -0
  67. package/dist/node-lib/child-process-module.d.ts +26 -0
  68. package/dist/node-lib/child-process-module.d.ts.map +1 -0
  69. package/dist/node-lib/events-module.d.ts +58 -0
  70. package/dist/node-lib/events-module.d.ts.map +1 -0
  71. package/dist/node-lib/fs-module.d.ts +5 -0
  72. package/dist/node-lib/fs-module.d.ts.map +1 -0
  73. package/dist/node-lib/http-bridge.d.ts +43 -0
  74. package/dist/node-lib/http-bridge.d.ts.map +1 -0
  75. package/dist/node-lib/http-module.d.ts +35 -0
  76. package/dist/node-lib/http-module.d.ts.map +1 -0
  77. package/dist/node-lib/internals/addresses.d.ts +40 -0
  78. package/dist/node-lib/internals/addresses.d.ts.map +1 -0
  79. package/dist/node-lib/internals/buffer-and-streams.d.ts +96 -0
  80. package/dist/node-lib/internals/buffer-and-streams.d.ts.map +1 -0
  81. package/dist/node-lib/internals/child-process.d.ts +27 -0
  82. package/dist/node-lib/internals/child-process.d.ts.map +1 -0
  83. package/dist/node-lib/internals/events-util.d.ts +83 -0
  84. package/dist/node-lib/internals/events-util.d.ts.map +1 -0
  85. package/dist/node-lib/internals/index.d.ts +2 -0
  86. package/dist/node-lib/internals/index.d.ts.map +1 -0
  87. package/dist/node-lib/internals/modules.d.ts +67 -0
  88. package/dist/node-lib/internals/modules.d.ts.map +1 -0
  89. package/dist/node-lib/internals/readline-access.d.ts +2 -0
  90. package/dist/node-lib/internals/readline-access.d.ts.map +1 -0
  91. package/dist/node-lib/internals/runtime.d.ts +150 -0
  92. package/dist/node-lib/internals/runtime.d.ts.map +1 -0
  93. package/dist/node-lib/internals/util.d.ts +33 -0
  94. package/dist/node-lib/internals/util.d.ts.map +1 -0
  95. package/dist/node-lib/lazy.d.ts +31 -0
  96. package/dist/node-lib/lazy.d.ts.map +1 -0
  97. package/dist/node-lib/load.d.ts +27 -0
  98. package/dist/node-lib/load.d.ts.map +1 -0
  99. package/dist/node-lib/module-hooks.d.ts +89 -0
  100. package/dist/node-lib/module-hooks.d.ts.map +1 -0
  101. package/dist/node-lib/net-module.d.ts +181 -0
  102. package/dist/node-lib/net-module.d.ts.map +1 -0
  103. package/dist/node-lib/node-versions.d.ts +27 -0
  104. package/dist/node-lib/node-versions.d.ts.map +1 -0
  105. package/dist/node-lib/public-modules.d.ts +2 -0
  106. package/dist/node-lib/public-modules.d.ts.map +1 -0
  107. package/dist/node-lib/require-hook.d.ts +15 -0
  108. package/dist/node-lib/require-hook.d.ts.map +1 -0
  109. package/dist/node-lib/small-modules.d.ts +16 -0
  110. package/dist/node-lib/small-modules.d.ts.map +1 -0
  111. package/dist/node-lib/sources.d.ts +4 -0
  112. package/dist/node-lib/sources.d.ts.map +1 -0
  113. package/dist/node-lib/stream-module.d.ts +77 -0
  114. package/dist/node-lib/stream-module.d.ts.map +1 -0
  115. package/dist/node-lib/timers.d.ts +19 -0
  116. package/dist/node-lib/timers.d.ts.map +1 -0
  117. package/dist/node-lib/util-module.d.ts +76 -0
  118. package/dist/node-lib/util-module.d.ts.map +1 -0
  119. package/dist/node-resolution.d.ts +50 -0
  120. package/dist/node-resolution.d.ts.map +1 -0
  121. package/dist/node-resolver.d.ts +7 -0
  122. package/dist/node-resolver.d.ts.map +1 -0
  123. package/dist/npm/index.d.ts +73 -0
  124. package/dist/npm/index.d.ts.map +1 -0
  125. package/dist/npm/registry.d.ts +111 -0
  126. package/dist/npm/registry.d.ts.map +1 -0
  127. package/dist/npm/resolver.d.ts +79 -0
  128. package/dist/npm/resolver.d.ts.map +1 -0
  129. package/dist/npm/tarball.d.ts +28 -0
  130. package/dist/npm/tarball.d.ts.map +1 -0
  131. package/dist/process-tokens.d.ts +77 -0
  132. package/dist/process-tokens.d.ts.map +1 -0
  133. package/dist/punycode-source.d.ts +3 -0
  134. package/dist/punycode-source.d.ts.map +1 -0
  135. package/dist/runtime-interface.d.ts +74 -0
  136. package/dist/runtime-interface.d.ts.map +1 -0
  137. package/dist/runtime.d.ts +144 -0
  138. package/dist/runtime.d.ts.map +1 -0
  139. package/dist/server-bridge.d.ts +147 -0
  140. package/dist/server-bridge.d.ts.map +1 -0
  141. package/dist/shims/async_hooks.d.ts +50 -0
  142. package/dist/shims/async_hooks.d.ts.map +1 -0
  143. package/dist/shims/child_process.d.ts +104 -0
  144. package/dist/shims/child_process.d.ts.map +1 -0
  145. package/dist/shims/cluster.d.ts +52 -0
  146. package/dist/shims/cluster.d.ts.map +1 -0
  147. package/dist/shims/command-line.d.ts +43 -0
  148. package/dist/shims/command-line.d.ts.map +1 -0
  149. package/dist/shims/constants.d.ts +222 -0
  150. package/dist/shims/constants.d.ts.map +1 -0
  151. package/dist/shims/crypto-constants.d.ts +12 -0
  152. package/dist/shims/crypto-constants.d.ts.map +1 -0
  153. package/dist/shims/crypto.d.ts +144 -0
  154. package/dist/shims/crypto.d.ts.map +1 -0
  155. package/dist/shims/dgram.d.ts +34 -0
  156. package/dist/shims/dgram.d.ts.map +1 -0
  157. package/dist/shims/dns.d.ts +91 -0
  158. package/dist/shims/dns.d.ts.map +1 -0
  159. package/dist/shims/domain.d.ts +25 -0
  160. package/dist/shims/domain.d.ts.map +1 -0
  161. package/dist/shims/esbuild.d.ts +205 -0
  162. package/dist/shims/esbuild.d.ts.map +1 -0
  163. package/dist/shims/fs.d.ts +25 -0
  164. package/dist/shims/fs.d.ts.map +1 -0
  165. package/dist/shims/http2.d.ts +81 -0
  166. package/dist/shims/http2.d.ts.map +1 -0
  167. package/dist/shims/inspector.d.ts +25 -0
  168. package/dist/shims/inspector.d.ts.map +1 -0
  169. package/dist/shims/module.d.ts +22 -0
  170. package/dist/shims/module.d.ts.map +1 -0
  171. package/dist/shims/os.d.ts +159 -0
  172. package/dist/shims/os.d.ts.map +1 -0
  173. package/dist/shims/path.d.ts +52 -0
  174. package/dist/shims/path.d.ts.map +1 -0
  175. package/dist/shims/perf_hooks.d.ts +50 -0
  176. package/dist/shims/perf_hooks.d.ts.map +1 -0
  177. package/dist/shims/process.d.ts +226 -0
  178. package/dist/shims/process.d.ts.map +1 -0
  179. package/dist/shims/rollup.d.ts +71 -0
  180. package/dist/shims/rollup.d.ts.map +1 -0
  181. package/dist/shims/string_decoder.d.ts +41 -0
  182. package/dist/shims/string_decoder.d.ts.map +1 -0
  183. package/dist/shims/sync-child.d.ts +64 -0
  184. package/dist/shims/sync-child.d.ts.map +1 -0
  185. package/dist/shims/tls.d.ts +53 -0
  186. package/dist/shims/tls.d.ts.map +1 -0
  187. package/dist/shims/url.d.ts +84 -0
  188. package/dist/shims/url.d.ts.map +1 -0
  189. package/dist/shims/v8.d.ts +73 -0
  190. package/dist/shims/v8.d.ts.map +1 -0
  191. package/dist/shims/vfs-adapter.d.ts +126 -0
  192. package/dist/shims/vfs-adapter.d.ts.map +1 -0
  193. package/dist/shims/vm.d.ts +52 -0
  194. package/dist/shims/vm.d.ts.map +1 -0
  195. package/dist/shims/wasi.d.ts +78 -0
  196. package/dist/shims/wasi.d.ts.map +1 -0
  197. package/dist/shims/worker_threads.d.ts +66 -0
  198. package/dist/shims/worker_threads.d.ts.map +1 -0
  199. package/dist/shims/zlib-constants.d.ts +66 -0
  200. package/dist/shims/zlib-constants.d.ts.map +1 -0
  201. package/dist/shims/zlib.d.ts +102 -0
  202. package/dist/shims/zlib.d.ts.map +1 -0
  203. package/dist/transform.d.ts +24 -0
  204. package/dist/transform.d.ts.map +1 -0
  205. package/dist/types/package-json.d.ts +18 -0
  206. package/dist/types/package-json.d.ts.map +1 -0
  207. package/dist/utils/binary-encoding.d.ts +13 -0
  208. package/dist/utils/binary-encoding.d.ts.map +1 -0
  209. package/dist/utils/glob.d.ts +19 -0
  210. package/dist/utils/glob.d.ts.map +1 -0
  211. package/dist/utils/hash.d.ts +6 -0
  212. package/dist/utils/hash.d.ts.map +1 -0
  213. package/dist/virtual-fs.d.ts +259 -0
  214. package/dist/virtual-fs.d.ts.map +1 -0
  215. package/dist/vite-plugin.cjs +50 -0
  216. package/dist/vite-plugin.cjs.map +1 -0
  217. package/dist/vite-plugin.d.ts +36 -0
  218. package/dist/vite-plugin.d.ts.map +1 -0
  219. package/dist/vite-plugin.mjs +31 -0
  220. package/dist/vite-plugin.mjs.map +1 -0
  221. package/dist/worker/runtime-worker.d.ts +8 -0
  222. package/dist/worker/runtime-worker.d.ts.map +1 -0
  223. package/dist/worker-runtime.d.ts +50 -0
  224. package/dist/worker-runtime.d.ts.map +1 -0
  225. package/package.json +88 -0
  226. package/src/code-transforms.ts +560 -0
  227. package/src/config/cdn.ts +13 -0
  228. package/src/create-runtime.ts +89 -0
  229. package/src/host-globals.ts +121 -0
  230. package/src/index.ts +235 -0
  231. package/src/node-internals.ts +283 -0
  232. package/src/node-lib/LICENSE +47 -0
  233. package/src/node-lib/_http_agent.js +547 -0
  234. package/src/node-lib/_http_client.js +996 -0
  235. package/src/node-lib/_http_common.js +269 -0
  236. package/src/node-lib/_http_incoming.js +453 -0
  237. package/src/node-lib/_http_outgoing.js +1262 -0
  238. package/src/node-lib/_http_server.js +1230 -0
  239. package/src/node-lib/assert/strict.js +3 -0
  240. package/src/node-lib/assert.js +844 -0
  241. package/src/node-lib/binding/blob.ts +35 -0
  242. package/src/node-lib/binding/buffer.ts +465 -0
  243. package/src/node-lib/binding/cares_wrap.ts +57 -0
  244. package/src/node-lib/binding/fds.ts +80 -0
  245. package/src/node-lib/binding/fs.ts +857 -0
  246. package/src/node-lib/binding/handles.ts +187 -0
  247. package/src/node-lib/binding/http_parser.ts +536 -0
  248. package/src/node-lib/binding/index.ts +77 -0
  249. package/src/node-lib/binding/llhttp-wasm.ts +670 -0
  250. package/src/node-lib/binding/misc.ts +252 -0
  251. package/src/node-lib/binding/pipe_wrap.ts +166 -0
  252. package/src/node-lib/binding/process_wrap.ts +371 -0
  253. package/src/node-lib/binding/spawn_sync.ts +141 -0
  254. package/src/node-lib/binding/stream_wrap.ts +413 -0
  255. package/src/node-lib/binding/stubs.ts +19 -0
  256. package/src/node-lib/binding/tcp_wrap.ts +254 -0
  257. package/src/node-lib/binding/tty_wrap.ts +56 -0
  258. package/src/node-lib/binding/util.ts +274 -0
  259. package/src/node-lib/binding/uv.ts +102 -0
  260. package/src/node-lib/binding/zlib-pako.ts +50 -0
  261. package/src/node-lib/binding/zlib.ts +259 -0
  262. package/src/node-lib/buffer-module.ts +70 -0
  263. package/src/node-lib/buffer.js +1373 -0
  264. package/src/node-lib/child-process-module.ts +58 -0
  265. package/src/node-lib/child_process.js +1046 -0
  266. package/src/node-lib/constants.js +41 -0
  267. package/src/node-lib/diagnostics_channel.js +438 -0
  268. package/src/node-lib/events-module.ts +80 -0
  269. package/src/node-lib/events.js +1223 -0
  270. package/src/node-lib/fs-module.ts +43 -0
  271. package/src/node-lib/fs.js +3377 -0
  272. package/src/node-lib/http-bridge.ts +299 -0
  273. package/src/node-lib/http-module.ts +53 -0
  274. package/src/node-lib/http.js +198 -0
  275. package/src/node-lib/https.js +429 -0
  276. package/src/node-lib/internal/assert/assertion_error.js +417 -0
  277. package/src/node-lib/internal/assert/calltracker.js +153 -0
  278. package/src/node-lib/internal/assert/myers_diff.js +177 -0
  279. package/src/node-lib/internal/assert/utils.js +278 -0
  280. package/src/node-lib/internal/buffer.js +1120 -0
  281. package/src/node-lib/internal/child_process/serialization.js +169 -0
  282. package/src/node-lib/internal/child_process.js +1135 -0
  283. package/src/node-lib/internal/constants.js +56 -0
  284. package/src/node-lib/internal/deps/minimatch/index.js +1628 -0
  285. package/src/node-lib/internal/errors.js +1912 -0
  286. package/src/node-lib/internal/events/abort_listener.js +54 -0
  287. package/src/node-lib/internal/events/symbols.js +11 -0
  288. package/src/node-lib/internal/fixed_queue.js +119 -0
  289. package/src/node-lib/internal/freelist.js +30 -0
  290. package/src/node-lib/internal/fs/cp/cp-sync.js +242 -0
  291. package/src/node-lib/internal/fs/cp/cp.js +382 -0
  292. package/src/node-lib/internal/fs/dir.js +369 -0
  293. package/src/node-lib/internal/fs/glob.js +763 -0
  294. package/src/node-lib/internal/fs/promises.js +1312 -0
  295. package/src/node-lib/internal/fs/read/context.js +129 -0
  296. package/src/node-lib/internal/fs/recursive_watch.js +275 -0
  297. package/src/node-lib/internal/fs/rimraf.js +311 -0
  298. package/src/node-lib/internal/fs/streams.js +571 -0
  299. package/src/node-lib/internal/fs/sync_write_stream.js +49 -0
  300. package/src/node-lib/internal/fs/utils.js +987 -0
  301. package/src/node-lib/internal/fs/watchers.js +418 -0
  302. package/src/node-lib/internal/http.js +62 -0
  303. package/src/node-lib/internal/mime.js +389 -0
  304. package/src/node-lib/internal/modules/customization_hooks.js +406 -0
  305. package/src/node-lib/internal/net.js +95 -0
  306. package/src/node-lib/internal/querystring.js +119 -0
  307. package/src/node-lib/internal/readline/callbacks.js +132 -0
  308. package/src/node-lib/internal/readline/emitKeypressEvents.js +99 -0
  309. package/src/node-lib/internal/readline/interface.js +1418 -0
  310. package/src/node-lib/internal/readline/promises.js +144 -0
  311. package/src/node-lib/internal/readline/utils.js +405 -0
  312. package/src/node-lib/internal/socket_list.js +108 -0
  313. package/src/node-lib/internal/stream_base_commons.js +280 -0
  314. package/src/node-lib/internal/streams/add-abort-signal.js +60 -0
  315. package/src/node-lib/internal/streams/compose.js +257 -0
  316. package/src/node-lib/internal/streams/destroy.js +361 -0
  317. package/src/node-lib/internal/streams/duplex.js +203 -0
  318. package/src/node-lib/internal/streams/duplexify.js +379 -0
  319. package/src/node-lib/internal/streams/duplexpair.js +62 -0
  320. package/src/node-lib/internal/streams/end-of-stream.js +331 -0
  321. package/src/node-lib/internal/streams/from.js +208 -0
  322. package/src/node-lib/internal/streams/lazy_transform.js +57 -0
  323. package/src/node-lib/internal/streams/legacy.js +125 -0
  324. package/src/node-lib/internal/streams/operators.js +436 -0
  325. package/src/node-lib/internal/streams/passthrough.js +47 -0
  326. package/src/node-lib/internal/streams/pipeline.js +465 -0
  327. package/src/node-lib/internal/streams/readable.js +1762 -0
  328. package/src/node-lib/internal/streams/state.js +51 -0
  329. package/src/node-lib/internal/streams/transform.js +204 -0
  330. package/src/node-lib/internal/streams/utils.js +363 -0
  331. package/src/node-lib/internal/streams/writable.js +1163 -0
  332. package/src/node-lib/internal/tty.js +260 -0
  333. package/src/node-lib/internal/util/colors.js +40 -0
  334. package/src/node-lib/internal/util/comparisons.js +1028 -0
  335. package/src/node-lib/internal/util/debuglog.js +524 -0
  336. package/src/node-lib/internal/util/inspect.js +2535 -0
  337. package/src/node-lib/internal/util/parse_args/parse_args.js +412 -0
  338. package/src/node-lib/internal/util/parse_args/utils.js +197 -0
  339. package/src/node-lib/internal/util.js +1003 -0
  340. package/src/node-lib/internal/validators.js +654 -0
  341. package/src/node-lib/internals/addresses.ts +159 -0
  342. package/src/node-lib/internals/buffer-and-streams.ts +224 -0
  343. package/src/node-lib/internals/child-process.ts +64 -0
  344. package/src/node-lib/internals/events-util.ts +105 -0
  345. package/src/node-lib/internals/index.ts +66 -0
  346. package/src/node-lib/internals/modules.ts +117 -0
  347. package/src/node-lib/internals/readline-access.ts +16 -0
  348. package/src/node-lib/internals/runtime.ts +277 -0
  349. package/src/node-lib/internals/util.ts +98 -0
  350. package/src/node-lib/lazy.ts +158 -0
  351. package/src/node-lib/load.ts +390 -0
  352. package/src/node-lib/module-hooks.ts +281 -0
  353. package/src/node-lib/net-module.ts +248 -0
  354. package/src/node-lib/net.js +2540 -0
  355. package/src/node-lib/node-versions.ts +34 -0
  356. package/src/node-lib/os.js +356 -0
  357. package/src/node-lib/path.js +1694 -0
  358. package/src/node-lib/primordials.js +743 -0
  359. package/src/node-lib/public-modules.ts +109 -0
  360. package/src/node-lib/punycode.js +455 -0
  361. package/src/node-lib/querystring.js +484 -0
  362. package/src/node-lib/readline/promises.js +73 -0
  363. package/src/node-lib/readline.js +523 -0
  364. package/src/node-lib/require-hook.ts +27 -0
  365. package/src/node-lib/small-modules.ts +35 -0
  366. package/src/node-lib/sources.ts +200 -0
  367. package/src/node-lib/stream/promises.js +44 -0
  368. package/src/node-lib/stream-module.ts +101 -0
  369. package/src/node-lib/stream.js +152 -0
  370. package/src/node-lib/timers.ts +33 -0
  371. package/src/node-lib/tty.js +168 -0
  372. package/src/node-lib/util-module.ts +104 -0
  373. package/src/node-lib/util.js +689 -0
  374. package/src/node-lib/wasi.js +179 -0
  375. package/src/node-lib/zlib.js +1036 -0
  376. package/src/node-resolution.ts +241 -0
  377. package/src/node-resolver.ts +33 -0
  378. package/src/npm/index.ts +425 -0
  379. package/src/npm/registry.ts +235 -0
  380. package/src/npm/resolver.ts +589 -0
  381. package/src/npm/tarball.ts +246 -0
  382. package/src/process-tokens.ts +156 -0
  383. package/src/punycode-source.ts +6 -0
  384. package/src/runtime-interface.ts +85 -0
  385. package/src/runtime.ts +3073 -0
  386. package/src/server-bridge.ts +971 -0
  387. package/src/shims/async_hooks.ts +181 -0
  388. package/src/shims/child_process.ts +1591 -0
  389. package/src/shims/cluster.ts +79 -0
  390. package/src/shims/command-line.ts +79 -0
  391. package/src/shims/constants.ts +68 -0
  392. package/src/shims/crypto-constants.ts +11 -0
  393. package/src/shims/crypto.ts +1061 -0
  394. package/src/shims/dgram.ts +47 -0
  395. package/src/shims/dns.ts +185 -0
  396. package/src/shims/domain.ts +58 -0
  397. package/src/shims/esbuild.ts +1638 -0
  398. package/src/shims/fs.ts +82 -0
  399. package/src/shims/http2.ts +96 -0
  400. package/src/shims/inspector.ts +30 -0
  401. package/src/shims/module.ts +86 -0
  402. package/src/shims/os.ts +195 -0
  403. package/src/shims/path.ts +246 -0
  404. package/src/shims/perf_hooks.ts +92 -0
  405. package/src/shims/process.ts +804 -0
  406. package/src/shims/rollup.ts +149 -0
  407. package/src/shims/string_decoder.ts +396 -0
  408. package/src/shims/sync-child.ts +469 -0
  409. package/src/shims/tls.ts +94 -0
  410. package/src/shims/url.ts +217 -0
  411. package/src/shims/v8.ts +113 -0
  412. package/src/shims/vfs-adapter.ts +408 -0
  413. package/src/shims/vm.ts +132 -0
  414. package/src/shims/wasi.ts +1440 -0
  415. package/src/shims/worker_threads.ts +114 -0
  416. package/src/shims/zlib-constants.ts +65 -0
  417. package/src/shims/zlib.ts +228 -0
  418. package/src/transform.ts +324 -0
  419. package/src/types/external.d.ts +55 -0
  420. package/src/types/package-json.ts +17 -0
  421. package/src/types/pako-zlib.d.ts +30 -0
  422. package/src/types/sha.js.d.ts +14 -0
  423. package/src/utils/binary-encoding.ts +43 -0
  424. package/src/utils/glob.ts +54 -0
  425. package/src/utils/hash.ts +12 -0
  426. package/src/virtual-fs.ts +1048 -0
  427. package/src/vite-plugin.ts +76 -0
  428. package/src/worker/runtime-worker.ts +128 -0
  429. package/src/worker-runtime.ts +145 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * `internalBinding('tty_wrap')`: the engine's standard streams, where a host
3
+ * reports one of them as a terminal.
4
+ *
5
+ * `internal/child_process.js` reads two things from it: whether a descriptor
6
+ * is a terminal, which decides whether an `inherit` entry is a TTY, and the
7
+ * `TTY` class, which `getHandleWrapType` asks an `instanceof` of. The engine
8
+ * writes to a page or to a host's pipe, so a descriptor is a terminal only
9
+ * when the running program's own `process.stdout.isTTY` says so -- which is
10
+ * what a held run gets, and what a program reads to decide on colour.
11
+ */
12
+ import { LibuvStreamWrap } from './stream_wrap';
13
+ import { guessHandleTypeOfFd } from './fds';
14
+
15
+ /** libuv's `uv_tty_t`, over the same stream the rest of the binding is. */
16
+ export class TTY extends LibuvStreamWrap {
17
+ readonly fdNumber: number;
18
+
19
+ /**
20
+ * Node's `new TTY(fd, ctx)` writes an errno onto `ctx` when the fd is not
21
+ * a terminal, so `tty.WriteStream` refuses to wrap a pipe. A run's stdout
22
+ * that was not given a TTY is a pipe: `isTTY` is false and `hasColors`
23
+ * answers false, and `util.inspect` does not colorize a number on it.
24
+ */
25
+ constructor(fd: number, ctx?: { code?: string } | boolean) {
26
+ super();
27
+ this.fdNumber = fd;
28
+ this.fd = fd;
29
+ if (ctx && typeof ctx === 'object' && !isTTY(fd)) {
30
+ ctx.code = 'ENOTTY';
31
+ }
32
+ }
33
+
34
+ /** A terminal the engine does not own has one size and no mode to set. */
35
+ getWindowSize(out: number[]): number {
36
+ out[0] = 80;
37
+ out[1] = 24;
38
+ return 0;
39
+ }
40
+
41
+ setRawMode(_raw: number): number {
42
+ return 0;
43
+ }
44
+ }
45
+
46
+ /** libuv's `uv_guess_handle(fd) === UV_TTY`, as the running program sees it. */
47
+ export function isTTY(fd: number): boolean {
48
+ if (fd !== 0 && fd !== 1 && fd !== 2) return guessHandleTypeOfFd(fd) === 'TTY';
49
+ const realm = (globalThis as unknown as {
50
+ process?: { stdin?: { isTTY?: boolean }; stdout?: { isTTY?: boolean }; stderr?: { isTTY?: boolean } };
51
+ }).process;
52
+ const stream = fd === 0 ? realm?.stdin : fd === 1 ? realm?.stdout : realm?.stderr;
53
+ return stream?.isTTY === true;
54
+ }
55
+
56
+ export default { TTY, isTTY };
@@ -0,0 +1,274 @@
1
+ /**
2
+ * `internalBinding('util')`: what V8 tells Node about a value.
3
+ *
4
+ * `internal/util/inspect.js` is the reason this file is the size it is.
5
+ * Printing a value the way Node prints it means asking V8 questions
6
+ * JavaScript cannot ask itself, and each one is answered here out of the
7
+ * realm's own built-ins -- an object's non-index properties, the name of the
8
+ * constructor that made it, the entries inside a `Map` or a `Set`.
9
+ *
10
+ * THE TWO NAMED LOSSES, and why they are losses rather than gaps to close:
11
+ *
12
+ * `getProxyDetails` asks V8 for a `Proxy`'s target and handler. A proxy is
13
+ * invisible to the code it wraps -- that is the whole of what a proxy is --
14
+ * and no JavaScript can see through one. This answers undefined, which is
15
+ * `not a proxy`, so `inspect` prints the value the proxy stands for. That is
16
+ * also what Node prints without `--show-proxy`, so the loss shows only under
17
+ * `showProxy: true`.
18
+ *
19
+ * `defineLazyProperties` is how `util.js` exposes `parseArgs`, `TextDecoder`,
20
+ * `MIMEType` and the rest: each is a getter that requires its own file on the
21
+ * first read. It must reach the loader's require, not the realm's -- there is
22
+ * no `require` on a realm -- or every one of those names reads undefined.
23
+ *
24
+ * `getConstructorName` asks V8 which constructor made a value, which V8 knows
25
+ * from the object's own shape even after its prototype has been severed.
26
+ * This walks the prototype chain for an own `constructor`, which is the only
27
+ * record JavaScript keeps -- so an object whose prototype was set to null
28
+ * prints as `[Object: null prototype]` where Node prints `[Foo: null
29
+ * prototype]`. Everything with a prototype still names its constructor.
30
+ *
31
+ * `getPromiseDetails` asks V8 for a promise's state and its value without
32
+ * awaiting it. A promise's state cannot be read synchronously from
33
+ * JavaScript; `then` is the only door and it is asynchronous by definition.
34
+ * This answers `[kPending]`, so `inspect` prints `Promise { <pending> }` for
35
+ * every promise, settled or not. A program that needs to know awaits it.
36
+ */
37
+ import { guessHandleTypeOfFd } from './fds';
38
+ import { nodeLibInternalRequire } from '../load';
39
+
40
+ /** Node's `propertyFilter` and promise-state constants, by their own values. */
41
+ const constants = {
42
+ ALL_PROPERTIES: 0,
43
+ ONLY_WRITABLE: 1,
44
+ ONLY_ENUMERABLE: 2,
45
+ ONLY_CONFIGURABLE: 4,
46
+ SKIP_STRINGS: 8,
47
+ SKIP_SYMBOLS: 16,
48
+ kPending: 0,
49
+ kFulfilled: 1,
50
+ kRejected: 2,
51
+ };
52
+
53
+ /** Whether a key is an array index, which `getOwnNonIndexProperties` leaves out. */
54
+ function isIndexKey(key: string): boolean {
55
+ const number = Number(key);
56
+ return Number.isInteger(number) && number >= 0 && String(number) === key;
57
+ }
58
+
59
+ export const utilBinding = {
60
+ privateSymbols: {
61
+ arrow_message_private_symbol: Symbol('arrow_message_private_symbol'),
62
+ decorated_private_symbol: Symbol('decorated_private_symbol'),
63
+ untransferable_object_private_symbol: Symbol('untransferable_object_private_symbol'),
64
+ host_defined_option_symbol: Symbol('host_defined_option_symbol'),
65
+ transfer_mode_private_symbol: Symbol('transfer_mode_private_symbol'),
66
+ },
67
+ constants,
68
+
69
+ /** Node warns differently for a deprecation raised inside a dependency; nothing here is. */
70
+ isInsideNodeModules: (): boolean => false,
71
+
72
+ /**
73
+ * An object's own properties that are not array indices, filtered the way
74
+ * V8's `GetOwnNonIndexProperties` filters: `ONLY_ENUMERABLE` keeps the
75
+ * enumerable ones, `SKIP_SYMBOLS` and `SKIP_STRINGS` drop a kind outright.
76
+ * `inspect` asks for this to list an array's non-index keys and a typed
77
+ * array's own properties without walking its elements.
78
+ */
79
+ getOwnNonIndexProperties: (target: object, filter = 0): Array<string | symbol> => {
80
+ const keys: Array<string | symbol> = [];
81
+ if ((filter & constants.SKIP_STRINGS) === 0) {
82
+ for (const key of Object.getOwnPropertyNames(target)) {
83
+ if (isIndexKey(key)) continue;
84
+ if ((filter & constants.ONLY_ENUMERABLE) !== 0) {
85
+ const own = Object.getOwnPropertyDescriptor(target, key);
86
+ if (!own?.enumerable) continue;
87
+ }
88
+ keys.push(key);
89
+ }
90
+ }
91
+ if ((filter & constants.SKIP_SYMBOLS) === 0) {
92
+ for (const key of Object.getOwnPropertySymbols(target)) {
93
+ if ((filter & constants.ONLY_ENUMERABLE) !== 0) {
94
+ const own = Object.getOwnPropertyDescriptor(target, key);
95
+ if (!own?.enumerable) continue;
96
+ }
97
+ keys.push(key);
98
+ }
99
+ }
100
+ return keys;
101
+ },
102
+
103
+ /** The promise loss named at the top of this file. */
104
+ getPromiseDetails: (): [number] => [constants.kPending],
105
+
106
+ /** The proxy loss named at the top of this file. */
107
+ getProxyDetails: (): undefined => void 0,
108
+
109
+ /**
110
+ * The entries inside a `Map` or a `Set`, which `inspect` prints. V8 reads
111
+ * them out of the object's own storage; this reads them the way any program
112
+ * does, which answers for a real map or set. An ITERATOR over one keeps its
113
+ * position in V8's own state and cannot be previewed without consuming it,
114
+ * so an iterator previews as empty rather than being spent -- a printed
115
+ * value is not worth destroying the thing printed.
116
+ */
117
+ previewEntries: (value: unknown, isIterator?: boolean): [unknown[], boolean] => {
118
+ if (value instanceof Map) {
119
+ const entries: unknown[] = [];
120
+ for (const [key, item] of value) { entries.push(key, item); }
121
+ return [entries, true];
122
+ }
123
+ if (value instanceof Set) return [[...value], false];
124
+ if (isIterator) return [[], false];
125
+ return [[], false];
126
+ },
127
+
128
+ /**
129
+ * The name of the constructor that made a value, as V8 reports it: the
130
+ * first prototype in the chain with an own `constructor` whose name is not
131
+ * empty. `inspect` prints it before an object's braces.
132
+ */
133
+ getConstructorName: (value: object): string => {
134
+ let current: object | null = value;
135
+ while (current !== null) {
136
+ const own = Object.getOwnPropertyDescriptor(current, 'constructor');
137
+ const constructor = own?.value as { name?: string } | undefined;
138
+ if (typeof constructor === 'function' && constructor.name) return constructor.name;
139
+ current = Object.getPrototypeOf(current) as object | null;
140
+ }
141
+ return '';
142
+ },
143
+
144
+ /** A pointer's value, printed for an external. A tab has no externals. */
145
+ getExternalValue: (): bigint => BigInt(0),
146
+
147
+ /** What kind of thing a descriptor is, out of the engine's own table. */
148
+ guessHandleType: guessHandleTypeOfFd,
149
+
150
+ /**
151
+ * Node's `defineLazyProperties`: each key becomes a getter that requires
152
+ * the module the first time it is read, so a builtin that exposes another
153
+ * builtin's class does not load it to say so.
154
+ */
155
+ defineLazyProperties: (target: object, id: string, keys: string[], writable = true): void => {
156
+ for (const key of keys) {
157
+ let built: unknown;
158
+ let ready = false;
159
+ Object.defineProperty(target, key, {
160
+ configurable: true,
161
+ enumerable: true,
162
+ get() {
163
+ if (!ready) { ready = true; built = (nodeLibInternalRequire(id) as Record<string, unknown>)[key]; }
164
+ return built;
165
+ },
166
+ set: writable ? (value: unknown) => { built = value; ready = true; } : void 0,
167
+ });
168
+ }
169
+ },
170
+
171
+ /**
172
+ * The stack, as `util.getCallSites()` reports it: one entry per frame with
173
+ * the function's name, the script it is in, and where in that script. V8's
174
+ * own structured-stack door is what Node reads too -- `Error
175
+ * .prepareStackTrace` handed an array of call sites -- so this asks the
176
+ * realm the same question and shapes the answer the same way. The harness
177
+ * of Node's own tests calls it on every `mustNotCall`, which is why a
178
+ * missing one showed up as thirty test files at once.
179
+ */
180
+ getCallSites: (frameCount = 10): Array<Record<string, unknown>> => {
181
+ const original = Error.prepareStackTrace;
182
+ const limit = Error.stackTraceLimit;
183
+ try {
184
+ Error.stackTraceLimit = Math.max(frameCount + 2, 10);
185
+ Error.prepareStackTrace = (_error, sites: unknown[]) => sites.map((raw) => {
186
+ const site = raw as {
187
+ getFunctionName?: () => string | null; getFileName?: () => string | null;
188
+ getLineNumber?: () => number | null; getColumnNumber?: () => number | null;
189
+ getScriptNameOrSourceURL?: () => string | null;
190
+ };
191
+ return {
192
+ functionName: site.getFunctionName?.() ?? '',
193
+ scriptName: site.getFileName?.() ?? site.getScriptNameOrSourceURL?.() ?? '',
194
+ scriptId: '0',
195
+ lineNumber: site.getLineNumber?.() ?? 0,
196
+ column: site.getColumnNumber?.() ?? 0,
197
+ columnNumber: site.getColumnNumber?.() ?? 0,
198
+ };
199
+ });
200
+ const holder: { stack?: unknown } = {};
201
+ Error.captureStackTrace(holder, utilBinding.getCallSites);
202
+ const sites = holder.stack as Array<Record<string, unknown>> | undefined;
203
+ if (!Array.isArray(sites)) return [];
204
+ // A frame inside a builtin is not the caller's business: Node drops the
205
+ // `node:util` frame its own `getCallSites` stands in, and so does this.
206
+ return sites.filter((site) => !String(site.scriptName ?? '').startsWith('node:')).slice(0, frameCount);
207
+ } finally {
208
+ Error.prepareStackTrace = original;
209
+ Error.stackTraceLimit = limit;
210
+ }
211
+ },
212
+
213
+ /**
214
+ * A `.env` file's contents as an object, which `util.parseEnv` returns and
215
+ * which `--env-file` loads a process's environment from. Node parses it in
216
+ * C++; the rules are the ones its own fixture states, and they are the
217
+ * whole of the format: a `KEY=VALUE` per line, `export ` allowed in front
218
+ * of the key and dropped, a `#` starting a comment outside quotes wherever
219
+ * it stands -- `a#b` is `a`, no space needed -- and a
220
+ * value that may be wrapped in single quotes, double quotes or backticks --
221
+ * a quoted value keeps its spaces and may run over several lines, and only
222
+ * a double-quoted one expands `\n` and `\r`.
223
+ */
224
+ parseEnv: (content: string): Record<string, string> => {
225
+ const parsed: Record<string, string> = {};
226
+ const text = String(content);
227
+ let at = 0;
228
+ while (at < text.length) {
229
+ // A line's key, up to its `=`; anything with no `=` is not a setting.
230
+ let lineEnd = text.indexOf('\n', at);
231
+ if (lineEnd === -1) lineEnd = text.length;
232
+ let line = text.slice(at, lineEnd);
233
+ const hash = line.indexOf('#');
234
+ const keyEnd = line.indexOf('=');
235
+ if (keyEnd === -1 || (hash !== -1 && hash < keyEnd)) { at = lineEnd + 1; continue; }
236
+ let key = line.slice(0, keyEnd).trim();
237
+ if (key.startsWith('export ')) key = key.slice(7).trim();
238
+ if (key === '') { at = lineEnd + 1; continue; }
239
+
240
+ const rest = text.slice(at + keyEnd + 1);
241
+ const first = rest[rest.search(/\S|$/u)];
242
+ if (first === '"' || first === "'" || first === '`') {
243
+ // A quoted value ends at its own closing quote, wherever that is.
244
+ const open = at + keyEnd + 1 + rest.indexOf(first);
245
+ const close = text.indexOf(first, open + 1);
246
+ if (close !== -1) {
247
+ const value = text.slice(open + 1, close);
248
+ parsed[key] = first === '"' ? value.replace(/\\n/gu, '\n').replace(/\\r/gu, '\r') : value;
249
+ const after = text.indexOf('\n', close);
250
+ at = after === -1 ? text.length : after + 1;
251
+ continue;
252
+ }
253
+ }
254
+ // An unquoted value runs to the end of its line, minus any comment.
255
+ line = text.slice(at + keyEnd + 1, lineEnd);
256
+ const comment = line.indexOf('#');
257
+ parsed[key] = (comment === -1 ? line : line.slice(0, comment)).trim();
258
+ at = lineEnd + 1;
259
+ }
260
+ return parsed;
261
+ },
262
+
263
+ /**
264
+ * A blocking sleep. A tab has one thread and nothing else can run while
265
+ * this spins, which is exactly what a blocking sleep is; only a program
266
+ * that asked for one gets it.
267
+ */
268
+ sleep: (milliseconds: number): void => {
269
+ const until = Date.now() + milliseconds;
270
+ while (Date.now() < until) { /* the caller asked to block */ }
271
+ },
272
+ };
273
+
274
+ export default utilBinding;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * `internalBinding('uv')`: libuv's error numbers and names.
3
+ *
4
+ * The engine has no libuv, and the numbers are still libuv's, because Node's
5
+ * own files compare against them and a program reads `err.errno` and
6
+ * `err.code` and expects the pair a Linux Node reports. The engine's platform
7
+ * is `linux`, so these are Linux's.
8
+ */
9
+
10
+ /** The codes Node's `net`, `child_process` and their internals name. */
11
+ const codes: Record<string, [number, string]> = {
12
+ UV_E2BIG: [-7, 'argument list too long'],
13
+ UV_EACCES: [-13, 'permission denied'],
14
+ UV_EADDRINUSE: [-98, 'address already in use'],
15
+ UV_EADDRNOTAVAIL: [-99, 'address not available'],
16
+ UV_EAFNOSUPPORT: [-97, 'address family not supported'],
17
+ UV_EAGAIN: [-11, 'resource temporarily unavailable'],
18
+ UV_EALREADY: [-114, 'connection already in progress'],
19
+ UV_EBADF: [-9, 'bad file descriptor'],
20
+ UV_EBUSY: [-16, 'resource busy or locked'],
21
+ UV_ECANCELED: [-125, 'operation canceled'],
22
+ UV_ECONNABORTED: [-103, 'software caused connection abort'],
23
+ UV_ECONNREFUSED: [-111, 'connection refused'],
24
+ UV_ECONNRESET: [-104, 'connection reset by peer'],
25
+ UV_EEXIST: [-17, 'file already exists'],
26
+ UV_EFAULT: [-14, 'bad address in system call argument'],
27
+ UV_EHOSTUNREACH: [-113, 'host is unreachable'],
28
+ UV_EINTR: [-4, 'interrupted system call'],
29
+ UV_EINVAL: [-22, 'invalid argument'],
30
+ UV_EIO: [-5, 'i/o error'],
31
+ UV_EISCONN: [-106, 'socket is already connected'],
32
+ UV_EISDIR: [-21, 'illegal operation on a directory'],
33
+ UV_EMFILE: [-24, 'too many open files'],
34
+ UV_ENAMETOOLONG: [-36, 'name too long'],
35
+ UV_ENETDOWN: [-100, 'network is down'],
36
+ UV_ENETUNREACH: [-101, 'network is unreachable'],
37
+ UV_ENFILE: [-23, 'file table overflow'],
38
+ UV_ENOBUFS: [-105, 'no buffer space available'],
39
+ UV_ENOENT: [-2, 'no such file or directory'],
40
+ UV_ENOMEM: [-12, 'not enough memory'],
41
+ UV_ENOSYS: [-38, 'function not implemented'],
42
+ UV_ENOTCONN: [-107, 'socket is not connected'],
43
+ UV_ENOTDIR: [-20, 'not a directory'],
44
+ UV_ENOTEMPTY: [-39, 'directory not empty'],
45
+ UV_ENOTSOCK: [-88, 'socket operation on non-socket'],
46
+ UV_ENOTSUP: [-95, 'operation not supported on socket'],
47
+ UV_EOF: [-4095, 'end of file'],
48
+ UV_EPERM: [-1, 'operation not permitted'],
49
+ UV_EPIPE: [-32, 'broken pipe'],
50
+ UV_EPROTO: [-71, 'protocol error'],
51
+ UV_ESHUTDOWN: [-108, 'cannot send after transport endpoint shutdown'],
52
+ UV_ESRCH: [-3, 'no such process'],
53
+ UV_ETIMEDOUT: [-110, 'connection timed out'],
54
+ UV_UNKNOWN: [-4094, 'unknown error'],
55
+ };
56
+
57
+ const names = new Map<number, string>();
58
+ for (const [name, [value]] of Object.entries(codes)) if (!names.has(value)) names.set(value, name.slice(3));
59
+ // The constants table (and a Darwin host's `require('constants')`) names
60
+ // EADDRNOTAVAIL 49 and EAGAIN 35; `util.getSystemErrorName` reads this map,
61
+ // so those numbers must name the same errors Linux's -99 and -11 do.
62
+ if (!names.has(-49)) names.set(-49, 'EADDRNOTAVAIL');
63
+ if (!names.has(-35)) names.set(-35, 'EAGAIN');
64
+
65
+ /** libuv's `uv_err_name`: the code a number stands for, `UNKNOWN` for a number none does. */
66
+ export function errname(code: number): string {
67
+ return names.get(code) ?? `Unknown system error ${code}`;
68
+ }
69
+
70
+ /** Node's `getErrorMap()`: every number to its `[name, message]` pair. */
71
+ export function getErrorMap(): Map<number, [string, string]> {
72
+ const map = new Map<number, [string, string]>();
73
+ for (const [name, [value, message]] of Object.entries(codes)) {
74
+ if (!map.has(value)) map.set(value, [name.slice(3), message]);
75
+ }
76
+ if (!map.has(-49)) map.set(-49, ['EADDRNOTAVAIL', 'address not available']);
77
+ if (!map.has(-35)) map.set(-35, ['EAGAIN', 'resource temporarily unavailable']);
78
+ return map;
79
+ }
80
+
81
+ const uvBinding: Record<string, unknown> = { errname, getErrorMap };
82
+ for (const [name, [value]] of Object.entries(codes)) uvBinding[name] = value;
83
+
84
+ export const UV_EOF = codes.UV_EOF[0];
85
+ export const UV_ECONNREFUSED = codes.UV_ECONNREFUSED[0];
86
+ export const UV_ECONNRESET = codes.UV_ECONNRESET[0];
87
+ export const UV_EADDRINUSE = codes.UV_EADDRINUSE[0];
88
+ export const UV_ENOENT = codes.UV_ENOENT[0];
89
+ export const UV_ENOTSOCK = codes.UV_ENOTSOCK[0];
90
+ export const UV_EPIPE = codes.UV_EPIPE[0];
91
+ export const UV_EINVAL = codes.UV_EINVAL[0];
92
+ export const UV_ENOTCONN = codes.UV_ENOTCONN[0];
93
+ export const UV_ECANCELED = codes.UV_ECANCELED[0];
94
+ export const UV_ENOTSUP = codes.UV_ENOTSUP[0];
95
+ export const UV_EBADF = codes.UV_EBADF[0];
96
+ export const UV_ENOSYS = codes.UV_ENOSYS[0];
97
+ export const UV_EADDRNOTAVAIL = codes.UV_EADDRNOTAVAIL[0];
98
+ export const UV_EACCES = codes.UV_EACCES[0];
99
+ export const UV_ENOBUFS = codes.UV_ENOBUFS[0];
100
+ export const UV_ESRCH = codes.UV_ESRCH[0];
101
+
102
+ export default uvBinding;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * zlib's own inflate and deflate, as pako ports them.
3
+ *
4
+ * pako is already the engine's dependency, and `pako/lib/zlib/*` is not
5
+ * pako's convenience API -- it is zlib's `inflate.c` and `deflate.c` ported
6
+ * line for line, taking a `z_stream` and honouring `next_in`, `avail_in`,
7
+ * `next_out` and `avail_out` exactly as the C does. `./zlib.ts` says why the
8
+ * binding sits at this layer and not on pako's `Inflate`/`Deflate`, which
9
+ * cannot answer Node's contract.
10
+ */
11
+ import ZStream from 'pako/lib/zlib/zstream.js';
12
+ import * as pakoInflate from 'pako/lib/zlib/inflate.js';
13
+ import * as pakoDeflate from 'pako/lib/zlib/deflate.js';
14
+ import pakoConstants from 'pako/lib/zlib/constants.js';
15
+ import pakoCrc32 from 'pako/lib/zlib/crc32.js';
16
+ import pakoMessages from 'pako/lib/zlib/messages.js';
17
+
18
+ /** A fresh `z_stream`, the object every call below reads and writes. */
19
+ export function zstream(): Record<string, unknown> {
20
+ return new (ZStream as unknown as new () => Record<string, unknown>)();
21
+ }
22
+
23
+ export const inflateModule = pakoInflate as unknown as {
24
+ inflateInit2(strm: unknown, windowBits: number): number;
25
+ inflate(strm: unknown, flush: number): number;
26
+ inflateEnd(strm: unknown): number;
27
+ inflateReset(strm: unknown): number;
28
+ inflateSetDictionary(strm: unknown, dictionary: Uint8Array): number;
29
+ };
30
+
31
+ export const deflateModule = pakoDeflate as unknown as {
32
+ deflateInit2(strm: unknown, level: number, method: number, windowBits: number, memLevel: number, strategy: number): number;
33
+ deflate(strm: unknown, flush: number): number;
34
+ deflateEnd(strm: unknown): number;
35
+ deflateReset(strm: unknown): number;
36
+ deflateSetDictionary(strm: unknown, dictionary: Uint8Array): number;
37
+ };
38
+
39
+ /** zlib's constants and its own error text, beside the checksum it defines. */
40
+ export const zlibConstants: Record<string, number> & {
41
+ messages: Record<number, string>;
42
+ crc32: (crc: number, buffer: Uint8Array, length: number, position: number) => number;
43
+ } = {
44
+ ...(pakoConstants as unknown as Record<string, number>),
45
+ messages: pakoMessages as unknown as Record<number, string>,
46
+ crc32: pakoCrc32 as unknown as (crc: number, buffer: Uint8Array, length: number, position: number) => number,
47
+ } as Record<string, number> & {
48
+ messages: Record<number, string>;
49
+ crc32: (crc: number, buffer: Uint8Array, length: number, position: number) => number;
50
+ };