@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,299 @@
1
+ /**
2
+ * The page's requests, as bytes on a socket.
3
+ *
4
+ * The page bridge used to reach a guest's server by calling a method on the
5
+ * engine's own `http.Server` object. `http` is Node's own file now and its
6
+ * `Server` has no such method -- it has a socket, and a request is what
7
+ * arrives on one. So the bridge is a client here: it finds the port in the
8
+ * net binding's listening registry, connects to it through the same loopback
9
+ * pairing any guest client uses, writes the request, and reads the answer
10
+ * back through the RESPONSE side of `./binding/http_parser.ts`.
11
+ *
12
+ * What this buys beyond correctness: the guest's server sees a real
13
+ * connection. Its `req.socket` is a socket, `server.on('connection')` fires,
14
+ * keep-alive, `Transfer-Encoding: chunked`, `Expect: 100-continue` and an
15
+ * `upgrade` are the server's own code path rather than something the bridge
16
+ * has to imitate -- and an upgraded connection is a socket the page can be
17
+ * handed, which is what lets the real `ws` run on it.
18
+ */
19
+ import { netModule } from './net-module';
20
+ import type { Socket } from './net-module';
21
+ import { Buffer } from './buffer-module';
22
+ import { HTTPParser } from './binding/http_parser';
23
+ import { listenerOnPort } from './binding/tcp_wrap';
24
+
25
+ /** What a page request answers with, the shape the bridge has always answered. */
26
+ export interface ResponseData {
27
+ statusCode: number;
28
+ /** Absent where the server sent none, as Node's `res.statusMessage` may be. */
29
+ statusMessage?: string;
30
+ /** A header's value is a string, or the strings of a header sent more than once, as Node's `res.getHeaders()` answers. */
31
+ headers: Record<string, string | string[]>;
32
+ /** Bytes, as a host's own server answers them; Node's Buffer is a Uint8Array. Absent where there is no body. */
33
+ body?: Uint8Array;
34
+ }
35
+
36
+ /** Whether any guest is listening on this port right now. */
37
+ export function __listening(port: number): boolean {
38
+ return listenerOnPort(port) !== undefined;
39
+ }
40
+
41
+ /** The request head a server reads, from the parts the page gave. */
42
+ function requestHead(method: string, url: string, headers: Record<string, string>, body?: Buffer): string {
43
+ const lines = [`${method.toUpperCase()} ${url} HTTP/1.1`];
44
+ let hasLength = false;
45
+ let hasEncoding = false;
46
+ for (const [name, value] of Object.entries(headers)) {
47
+ const lower = name.toLowerCase();
48
+ if (lower === 'content-length') hasLength = true;
49
+ if (lower === 'transfer-encoding') hasEncoding = true;
50
+ if (lower === 'connection') continue;
51
+ lines.push(`${name}: ${value}`);
52
+ }
53
+ // A body needs a length or the server waits for one that never ends; a
54
+ // request without a body says zero, which is what a browser sends.
55
+ if (!hasLength && !hasEncoding) lines.push(`Content-Length: ${body ? body.length : 0}`);
56
+ lines.push('Connection: close', '', '');
57
+ return lines.join('\r\n');
58
+ }
59
+
60
+ /** What the RESPONSE parser collected while the answer arrived. */
61
+ interface Collected {
62
+ statusCode: number;
63
+ statusMessage: string;
64
+ headers: Record<string, string>;
65
+ chunks: Uint8Array[];
66
+ complete: boolean;
67
+ upgrade: boolean;
68
+ }
69
+
70
+ /**
71
+ * A response parser wired to collect. Node's own `_http_client.js` does this
72
+ * with the same binding; the bridge needs the parts rather than an
73
+ * `IncomingMessage`, so it reads them off the parser directly.
74
+ */
75
+ function responseParser(collected: Collected, onHead?: () => void, onChunk?: (chunk: Uint8Array) => void): HTTPParser {
76
+ const parser = new HTTPParser();
77
+ parser.initialize(HTTPParser.RESPONSE, null, 0, 0);
78
+ parser[HTTPParser.kOnHeadersComplete] = ((
79
+ _major: number, _minor: number, headers: string[], _method: unknown, _url: unknown,
80
+ statusCode: number, statusMessage: string, upgrade: boolean,
81
+ ) => {
82
+ if (collected.complete) return 0;
83
+ collected.statusCode = statusCode;
84
+ collected.statusMessage = statusMessage;
85
+ collected.upgrade = upgrade;
86
+ for (let index = 0; index + 1 < headers.length; index += 2) {
87
+ const name = headers[index]!.toLowerCase();
88
+ const value = headers[index + 1]!;
89
+ // A header sent twice is joined the way a client reads it.
90
+ collected.headers[name] = collected.headers[name] === undefined
91
+ ? value
92
+ : `${collected.headers[name]}, ${value}`;
93
+ }
94
+ onHead?.();
95
+ return 0;
96
+ }) as never;
97
+ parser[HTTPParser.kOnBody] = ((chunk: Uint8Array) => {
98
+ if (collected.complete) return;
99
+ if (onChunk) onChunk(chunk);
100
+ else collected.chunks.push(chunk);
101
+ }) as never;
102
+ parser[HTTPParser.kOnMessageComplete] = (() => {
103
+ if (collected.complete) return collected.upgrade ? 0 : -1;
104
+ collected.complete = true;
105
+ // Stop at Content-Length or the chunked terminator: later bytes on this
106
+ // socket are another message, and must not join this body. pause()
107
+ // alone does not stop the rest of this execute(); a non-zero return
108
+ // does (measured: a 200 followed by a 400 in one write became status 400).
109
+ // An upgrade must not stop that way: execute() has to answer the pause
110
+ // so the leftover bytes can be pushed back onto the socket.
111
+ if (collected.upgrade) return 0;
112
+ parser.pause();
113
+ return -1;
114
+ }) as never;
115
+ return parser;
116
+ }
117
+
118
+ function emptyCollected(): Collected {
119
+ return { statusCode: 0, statusMessage: '', headers: {}, chunks: [], complete: false, upgrade: false };
120
+ }
121
+
122
+ /**
123
+ * The bytes these views name, in a buffer of their own. Node's
124
+ * `Buffer.concat` of a short body is a window on the 8 KB pool, and the
125
+ * page's Fetch Response is built from `body.slice().buffer` — the whole
126
+ * backing store, neighbours included.
127
+ */
128
+ function ownedConcat(chunks: Uint8Array[]): Uint8Array {
129
+ let total = 0;
130
+ for (const chunk of chunks) total += chunk.byteLength;
131
+ const joined = new Uint8Array(total);
132
+ let at = 0;
133
+ for (const chunk of chunks) {
134
+ joined.set(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength), at);
135
+ at += chunk.byteLength;
136
+ }
137
+ return joined;
138
+ }
139
+
140
+ function serviceUnavailable(port: number): ResponseData {
141
+ return {
142
+ statusCode: 503,
143
+ statusMessage: 'Service Unavailable',
144
+ headers: { 'Content-Type': 'text/plain' },
145
+ body: ownedConcat([Buffer.from(`No server listening on port ${port}`)]),
146
+ };
147
+ }
148
+
149
+ /**
150
+ * A request to a guest's server, answered whole. The connection is this
151
+ * engine's own loopback: the guest's server accepts it, and nothing leaves
152
+ * the tab.
153
+ */
154
+ export function __requestOverLoopback(
155
+ port: number, method: string, url: string, headers: Record<string, string>, body?: Buffer,
156
+ ): Promise<ResponseData> {
157
+ if (!__listening(port)) return Promise.resolve(serviceUnavailable(port));
158
+ return new Promise<ResponseData>((resolve) => {
159
+ const collected = emptyCollected();
160
+ const parser = responseParser(collected);
161
+ let settled = false;
162
+ const answer = (): void => {
163
+ if (settled) return;
164
+ settled = true;
165
+ parser.free();
166
+ resolve({
167
+ statusCode: collected.statusCode || 502,
168
+ statusMessage: collected.statusMessage,
169
+ headers: collected.headers,
170
+ body: ownedConcat(collected.chunks),
171
+ });
172
+ };
173
+ const socket = netModule.connect({ port, host: '127.0.0.1' }) as unknown as Socket;
174
+ socket.on('data', (chunk: Uint8Array) => {
175
+ if (settled) return;
176
+ const read = parser.execute(chunk);
177
+ if (read instanceof Error) { socket.destroy(); answer(); }
178
+ else if (collected.complete) { socket.destroy(); answer(); }
179
+ });
180
+ socket.on('end', () => { if (!settled) { parser.finish(); } answer(); });
181
+ socket.on('close', answer);
182
+ socket.on('error', () => {
183
+ if (settled) return;
184
+ settled = true;
185
+ parser.free();
186
+ resolve(serviceUnavailable(port));
187
+ });
188
+ socket.write(requestHead(method, url, headers, body));
189
+ if (body && body.length > 0) socket.write(body);
190
+ });
191
+ }
192
+
193
+ /**
194
+ * The same request, answered as it arrives: the head first, then each chunk
195
+ * the server writes, then the end. This is what the service worker streams
196
+ * to the page.
197
+ */
198
+ export function __streamOverLoopback(
199
+ port: number, method: string, url: string, headers: Record<string, string>, body: Buffer | undefined,
200
+ onStart: (statusCode: number, statusMessage: string, headers: Record<string, string>) => void,
201
+ onChunk: (chunk: Uint8Array) => void,
202
+ onEnd: () => void,
203
+ ): Promise<void> {
204
+ if (!__listening(port)) {
205
+ onStart(503, 'Service Unavailable', { 'Content-Type': 'text/plain' });
206
+ onEnd();
207
+ return Promise.resolve();
208
+ }
209
+ return new Promise<void>((resolve) => {
210
+ const collected = emptyCollected();
211
+ let started = false;
212
+ let ended = false;
213
+ const finish = (): void => { if (ended) return; ended = true; parser.free(); onEnd(); resolve(); };
214
+ const parser = responseParser(
215
+ collected,
216
+ () => { started = true; onStart(collected.statusCode, collected.statusMessage, collected.headers); },
217
+ (chunk) => onChunk(chunk),
218
+ );
219
+ const socket = netModule.connect({ port, host: '127.0.0.1' }) as unknown as Socket;
220
+ socket.on('data', (chunk: Uint8Array) => {
221
+ if (ended) return;
222
+ const read = parser.execute(chunk);
223
+ if (read instanceof Error) { socket.destroy(); finish(); }
224
+ else if (collected.complete) { socket.destroy(); finish(); }
225
+ });
226
+ socket.on('end', () => { if (!ended) { parser.finish(); } finish(); });
227
+ socket.on('close', finish);
228
+ socket.on('error', () => {
229
+ if (!started) onStart(503, 'Service Unavailable', { 'Content-Type': 'text/plain' });
230
+ finish();
231
+ });
232
+ socket.write(requestHead(method, url, headers, body));
233
+ if (body && body.length > 0) socket.write(body);
234
+ });
235
+ }
236
+
237
+ /** What an upgrade answered with: the 101 and the socket the page now owns. */
238
+ export interface UpgradeResult {
239
+ statusCode: number;
240
+ /** Absent where the server sent none, as Node's `res.statusMessage` may be. */
241
+ statusMessage?: string;
242
+ headers: Record<string, string>;
243
+ socket: Socket | null;
244
+ }
245
+
246
+ /**
247
+ * An `Upgrade` request through the same door. On a 101 the connection stops
248
+ * being HTTP and becomes the two ends of a socket: the guest's server holds
249
+ * one -- its `upgrade` listener was handed it by Node's own `http` -- and the
250
+ * page holds this one, which is exactly what the real `ws` needs on both
251
+ * sides. The bytes llhttp had already read past the head are pushed back
252
+ * onto this end, because they are the first frame.
253
+ */
254
+ export function __upgradeOverLoopback(
255
+ port: number, method: string, url: string, headers: Record<string, string>,
256
+ ): Promise<UpgradeResult> {
257
+ if (!__listening(port)) {
258
+ return Promise.resolve({ statusCode: 503, statusMessage: 'Service Unavailable', headers: {}, socket: null });
259
+ }
260
+ return new Promise<UpgradeResult>((resolve) => {
261
+ const collected = emptyCollected();
262
+ let settled = false;
263
+ const parser = responseParser(collected);
264
+ const socket = netModule.connect({ port, host: '127.0.0.1' }) as unknown as Socket;
265
+ const fail = (): void => {
266
+ if (settled) return;
267
+ settled = true;
268
+ parser.free();
269
+ resolve({ statusCode: collected.statusCode || 502, statusMessage: collected.statusMessage, headers: collected.headers, socket: null });
270
+ };
271
+ socket.on('data', (chunk: Uint8Array) => {
272
+ if (settled) return;
273
+ const read = parser.execute(chunk);
274
+ if (read instanceof Error) { socket.destroy(); fail(); return; }
275
+ if (collected.upgrade || collected.statusCode === 101) {
276
+ settled = true;
277
+ parser.free();
278
+ // Anything after the head is the protocol's first bytes; the reader
279
+ // that takes this socket next must see them.
280
+ const consumed = typeof read === 'number' ? read : chunk.length;
281
+ const rest = chunk.subarray(consumed);
282
+ if (rest.length > 0) (socket as unknown as { unshift(data: Uint8Array): void }).unshift(rest);
283
+ resolve({ statusCode: collected.statusCode, statusMessage: collected.statusMessage, headers: collected.headers, socket });
284
+ return;
285
+ }
286
+ if (collected.complete) { socket.destroy(); fail(); }
287
+ });
288
+ socket.on('error', fail);
289
+ socket.on('close', fail);
290
+ const upgradeHeaders = { ...headers, Connection: 'Upgrade' };
291
+ const lines = [`${method.toUpperCase()} ${url} HTTP/1.1`];
292
+ for (const [name, value] of Object.entries(upgradeHeaders)) {
293
+ if (name.toLowerCase() === 'connection') continue;
294
+ lines.push(`${name}: ${value}`);
295
+ }
296
+ lines.push('Connection: Upgrade', '', '');
297
+ socket.write(lines.join('\r\n'));
298
+ });
299
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * `http` and `https`, as Node's own `http.js` on llhttp.
3
+ *
4
+ * What died: the engine's `http` was a hand-written parser and server, 1,374
5
+ * lines. Node's own `test-http-*`: 28 of 377 passed.
6
+ *
7
+ * What this is: Node's `http.js`, `https.js` and the five `_http_*.js` files
8
+ * v22.18.0, vendored unmodified, on `./binding/http_parser.ts` -- llhttp's own
9
+ * WebAssembly build, which is the parser Node itself links. `Agent`,
10
+ * `ClientRequest`, `IncomingMessage`, `OutgoingMessage`, `Server` and
11
+ * `ServerResponse` are Node's own code, over the engine's `net`.
12
+ *
13
+ * The rule for this file: it binds, it does not implement.
14
+ */
15
+ import { lazyModule } from './lazy';
16
+
17
+ /** The whole of Node's `http` module object, as the engine's parts read it. */
18
+ export interface HttpModule {
19
+ Agent: new (options?: unknown) => unknown;
20
+ ClientRequest: new (...args: unknown[]) => unknown;
21
+ IncomingMessage: new (socket?: unknown) => unknown;
22
+ OutgoingMessage: new () => unknown;
23
+ Server: new (options?: unknown, listener?: unknown) => unknown;
24
+ ServerResponse: new (request: unknown) => unknown;
25
+ createServer(options?: unknown, listener?: unknown): unknown;
26
+ request(...args: unknown[]): unknown;
27
+ get(...args: unknown[]): unknown;
28
+ globalAgent: unknown;
29
+ METHODS: string[];
30
+ STATUS_CODES: Record<number, string>;
31
+ maxHeaderSize: number;
32
+ setMaxIdleHTTPParsers(max: number): void;
33
+ validateHeaderName(name: string, label?: string): void;
34
+ validateHeaderValue(name: string, value: unknown): void;
35
+ }
36
+
37
+ export const httpModule = lazyModule<HttpModule>('http');
38
+ export const httpsModule = lazyModule<HttpModule>('https');
39
+
40
+ /**
41
+ * The five `_http_*` modules, which Node lets a program require by name --
42
+ * they are legacy public names, not internals, and a program that subclasses
43
+ * `_http_outgoing`'s `OutgoingMessage` or reads `_http_server`'s `STATUS_CODES`
44
+ * reaches them that way.
45
+ */
46
+ export const httpCommonModule = lazyModule<Record<string, unknown>>('_http_common');
47
+ export const httpIncomingModule = lazyModule<Record<string, unknown>>('_http_incoming');
48
+ export const httpOutgoingModule = lazyModule<Record<string, unknown>>('_http_outgoing');
49
+ export const httpServerModule = lazyModule<Record<string, unknown>>('_http_server');
50
+ export const httpClientModule = lazyModule<Record<string, unknown>>('_http_client');
51
+ export const httpAgentModule = lazyModule<Record<string, unknown>>('_http_agent');
52
+
53
+ export default httpModule;
@@ -0,0 +1,198 @@
1
+ // Copyright Joyent, Inc. and other Node contributors.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a
4
+ // copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ // persons to whom the Software is furnished to do so, subject to the
9
+ // following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included
12
+ // in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ 'use strict';
23
+
24
+ const {
25
+ ObjectDefineProperty,
26
+ } = primordials;
27
+
28
+ const { validateInteger } = require('internal/validators');
29
+ const httpAgent = require('_http_agent');
30
+ const { ClientRequest } = require('_http_client');
31
+ const { methods, parsers } = require('_http_common');
32
+ const { IncomingMessage } = require('_http_incoming');
33
+ const {
34
+ validateHeaderName,
35
+ validateHeaderValue,
36
+ OutgoingMessage,
37
+ } = require('_http_outgoing');
38
+ const {
39
+ _connectionListener,
40
+ STATUS_CODES,
41
+ Server,
42
+ ServerResponse,
43
+ } = require('_http_server');
44
+ let maxHeaderSize;
45
+ let undici;
46
+
47
+ /**
48
+ * Returns a new instance of `http.Server`.
49
+ * @param {{
50
+ * IncomingMessage?: IncomingMessage;
51
+ * ServerResponse?: ServerResponse;
52
+ * insecureHTTPParser?: boolean;
53
+ * maxHeaderSize?: number;
54
+ * requireHostHeader?: boolean;
55
+ * joinDuplicateHeaders?: boolean;
56
+ * highWaterMark?: number;
57
+ * rejectNonStandardBodyWrites?: boolean;
58
+ * }} [opts]
59
+ * @param {Function} [requestListener]
60
+ * @returns {Server}
61
+ */
62
+ function createServer(opts, requestListener) {
63
+ return new Server(opts, requestListener);
64
+ }
65
+
66
+ /**
67
+ * @typedef {object} HTTPRequestOptions
68
+ * @property {httpAgent.Agent | boolean} [agent] Controls Agent behavior.
69
+ * @property {string} [auth] Basic authentication ('user:password') to compute an Authorization header.
70
+ * @property {Function} [createConnection] Produces a socket/stream to use when the agent option is not used.
71
+ * @property {number} [defaultPort] Default port for the protocol.
72
+ * @property {number} [family] IP address family to use when resolving host or hostname.
73
+ * @property {object} [headers] An object containing request headers.
74
+ * @property {number} [hints] Optional dns.lookup() hints.
75
+ * @property {string} [host] A domain name or IP address of the server to issue the request to.
76
+ * @property {string} [hostname] Alias for host.
77
+ * @property {boolean} [insecureHTTPParser] Use an insecure HTTP parser that accepts invalid HTTP headers when true.
78
+ * @property {boolean} [joinDuplicateHeaders] Multiple header that joined with `,` field line values.
79
+ * @property {string} [localAddress] Local interface to bind for network connections.
80
+ * @property {number} [localPort] Local port to connect from.
81
+ * @property {Function} [lookup] Custom lookup function. Default: dns.lookup().
82
+ * @property {number} [maxHeaderSize] Overrides the --max-http-header-size value for responses received from the server.
83
+ * @property {string} [method] A string specifying the HTTP request method.
84
+ * @property {string} [path] Request path.
85
+ * @property {number} [port] Port of remote server.
86
+ * @property {string} [protocol] Protocol to use.
87
+ * @property {boolean} [setHost] Specifies whether or not to automatically add the Host header.
88
+ * @property {AbortSignal} [signal] An AbortSignal that may be used to abort an ongoing request.
89
+ * @property {string} [socketPath] Unix domain socket.
90
+ * @property {number} [timeout] A number specifying the socket timeout in milliseconds.
91
+ * @property {Array} [uniqueHeaders] A list of request headers that should be sent only once.
92
+ */
93
+
94
+ /**
95
+ * Makes an HTTP request.
96
+ * @param {string | URL} url
97
+ * @param {HTTPRequestOptions} [options]
98
+ * @param {Function} [cb]
99
+ * @returns {ClientRequest}
100
+ */
101
+ function request(url, options, cb) {
102
+ return new ClientRequest(url, options, cb);
103
+ }
104
+
105
+ /**
106
+ * Makes a `GET` HTTP request.
107
+ * @param {string | URL} url
108
+ * @param {HTTPRequestOptions} [options]
109
+ * @param {Function} [cb]
110
+ * @returns {ClientRequest}
111
+ */
112
+ function get(url, options, cb) {
113
+ const req = request(url, options, cb);
114
+ req.end();
115
+ return req;
116
+ }
117
+
118
+ /**
119
+ * Lazy loads WebSocket, CloseEvent and MessageEvent classes from undici
120
+ * @returns {object} An object containing WebSocket, CloseEvent, and MessageEvent classes.
121
+ */
122
+ function lazyUndici() {
123
+ return undici ??= require('internal/deps/undici/undici');
124
+ }
125
+
126
+ module.exports = {
127
+ _connectionListener,
128
+ METHODS: methods.toSorted(),
129
+ STATUS_CODES,
130
+ Agent: httpAgent.Agent,
131
+ ClientRequest,
132
+ IncomingMessage,
133
+ OutgoingMessage,
134
+ Server,
135
+ ServerResponse,
136
+ createServer,
137
+ validateHeaderName,
138
+ validateHeaderValue,
139
+ get,
140
+ request,
141
+ setMaxIdleHTTPParsers(max) {
142
+ validateInteger(max, 'max', 1);
143
+ parsers.max = max;
144
+ },
145
+ };
146
+
147
+ ObjectDefineProperty(module.exports, 'maxHeaderSize', {
148
+ __proto__: null,
149
+ configurable: true,
150
+ enumerable: true,
151
+ get() {
152
+ if (maxHeaderSize === undefined) {
153
+ const { getOptionValue } = require('internal/options');
154
+ maxHeaderSize = getOptionValue('--max-http-header-size');
155
+ }
156
+
157
+ return maxHeaderSize;
158
+ },
159
+ });
160
+
161
+ ObjectDefineProperty(module.exports, 'globalAgent', {
162
+ __proto__: null,
163
+ configurable: true,
164
+ enumerable: true,
165
+ get() {
166
+ return httpAgent.globalAgent;
167
+ },
168
+ set(value) {
169
+ httpAgent.globalAgent = value;
170
+ },
171
+ });
172
+
173
+ ObjectDefineProperty(module.exports, 'WebSocket', {
174
+ __proto__: null,
175
+ configurable: true,
176
+ enumerable: true,
177
+ get() {
178
+ return lazyUndici().WebSocket;
179
+ },
180
+ });
181
+
182
+ ObjectDefineProperty(module.exports, 'CloseEvent', {
183
+ __proto__: null,
184
+ configurable: true,
185
+ enumerable: true,
186
+ get() {
187
+ return lazyUndici().CloseEvent;
188
+ },
189
+ });
190
+
191
+ ObjectDefineProperty(module.exports, 'MessageEvent', {
192
+ __proto__: null,
193
+ configurable: true,
194
+ enumerable: true,
195
+ get() {
196
+ return lazyUndici().MessageEvent;
197
+ },
198
+ });