create-jen-app 0.1.0

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 (607) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +89 -0
  3. package/dist/index.js +72 -0
  4. package/package.json +50 -0
  5. package/templates/static/.esbuild/jen.config.js +1 -0
  6. package/templates/static/README.md +67 -0
  7. package/templates/static/build.js +106 -0
  8. package/templates/static/jen.config.ts +128 -0
  9. package/templates/static/jenjs.d.ts +33 -0
  10. package/templates/static/lib/api/(hello).d.ts +7 -0
  11. package/templates/static/lib/api/(hello).js +26 -0
  12. package/templates/static/lib/auth/cookie-utils.d.ts +24 -0
  13. package/templates/static/lib/auth/cookie-utils.js +99 -0
  14. package/templates/static/lib/auth/index.d.ts +2 -0
  15. package/templates/static/lib/auth/index.js +19 -0
  16. package/templates/static/lib/auth/jwt.d.ts +2 -0
  17. package/templates/static/lib/auth/jwt.js +30 -0
  18. package/templates/static/lib/auth/session.d.ts +44 -0
  19. package/templates/static/lib/auth/session.js +111 -0
  20. package/templates/static/lib/build/asset-hashing.d.ts +10 -0
  21. package/templates/static/lib/build/asset-hashing.js +42 -0
  22. package/templates/static/lib/build/asset-manifest.d.ts +11 -0
  23. package/templates/static/lib/build/asset-manifest.js +38 -0
  24. package/templates/static/lib/build/build.d.ts +4 -0
  25. package/templates/static/lib/build/build.js +113 -0
  26. package/templates/static/lib/build/island-hydration.d.ts +25 -0
  27. package/templates/static/lib/build/island-hydration.js +62 -0
  28. package/templates/static/lib/build/minifier.d.ts +20 -0
  29. package/templates/static/lib/build/minifier.js +65 -0
  30. package/templates/static/lib/build/page-renderer.d.ts +17 -0
  31. package/templates/static/lib/build/page-renderer.js +45 -0
  32. package/templates/static/lib/build/production-build.d.ts +10 -0
  33. package/templates/static/lib/build/production-build.js +30 -0
  34. package/templates/static/lib/build/ssg-pipeline.d.ts +15 -0
  35. package/templates/static/lib/build/ssg-pipeline.js +119 -0
  36. package/templates/static/lib/build-tools/build-site.d.ts +6 -0
  37. package/templates/static/lib/build-tools/build-site.js +56 -0
  38. package/templates/static/lib/cache/index.d.ts +2 -0
  39. package/templates/static/lib/cache/index.js +19 -0
  40. package/templates/static/lib/cache/memory.d.ts +6 -0
  41. package/templates/static/lib/cache/memory.js +31 -0
  42. package/templates/static/lib/cache/redis.d.ts +6 -0
  43. package/templates/static/lib/cache/redis.js +33 -0
  44. package/templates/static/lib/cli/banner.d.ts +1 -0
  45. package/templates/static/lib/cli/banner.js +41 -0
  46. package/templates/static/lib/cli/templates/ssg/jen.config.d.ts +3 -0
  47. package/templates/static/lib/cli/templates/ssg/jen.config.js +49 -0
  48. package/templates/static/lib/cli/templates/ssg/site/index.d.ts +2 -0
  49. package/templates/static/lib/cli/templates/ssg/site/index.js +4 -0
  50. package/templates/static/lib/cli/templates/ssr/jen.config.d.ts +3 -0
  51. package/templates/static/lib/cli/templates/ssr/jen.config.js +49 -0
  52. package/templates/static/lib/cli/templates/ssr/site/index.d.ts +2 -0
  53. package/templates/static/lib/cli/templates/ssr/site/index.js +4 -0
  54. package/templates/static/lib/compilers/esbuild-plugins.d.ts +6 -0
  55. package/templates/static/lib/compilers/esbuild-plugins.js +130 -0
  56. package/templates/static/lib/compilers/svelte.d.ts +18 -0
  57. package/templates/static/lib/compilers/svelte.js +61 -0
  58. package/templates/static/lib/compilers/vue.d.ts +15 -0
  59. package/templates/static/lib/compilers/vue.js +99 -0
  60. package/templates/static/lib/core/config.d.ts +53 -0
  61. package/templates/static/lib/core/config.js +18 -0
  62. package/templates/static/lib/core/http.d.ts +3 -0
  63. package/templates/static/lib/core/http.js +42 -0
  64. package/templates/static/lib/core/middleware-hooks.d.ts +46 -0
  65. package/templates/static/lib/core/middleware-hooks.js +69 -0
  66. package/templates/static/lib/core/paths.d.ts +6 -0
  67. package/templates/static/lib/core/paths.js +24 -0
  68. package/templates/static/lib/core/routes/match.d.ts +6 -0
  69. package/templates/static/lib/core/routes/match.js +31 -0
  70. package/templates/static/lib/core/routes/scan.d.ts +9 -0
  71. package/templates/static/lib/core/routes/scan.js +148 -0
  72. package/templates/static/lib/core/types.d.ts +18 -0
  73. package/templates/static/lib/core/types.js +18 -0
  74. package/templates/static/lib/css/compiler.d.ts +20 -0
  75. package/templates/static/lib/css/compiler.js +87 -0
  76. package/templates/static/lib/db/connector.d.ts +4 -0
  77. package/templates/static/lib/db/connector.js +33 -0
  78. package/templates/static/lib/db/drivers/jdb.d.ts +13 -0
  79. package/templates/static/lib/db/drivers/jdb.js +59 -0
  80. package/templates/static/lib/db/drivers/sql.d.ts +18 -0
  81. package/templates/static/lib/db/drivers/sql.js +182 -0
  82. package/templates/static/lib/db/index.d.ts +19 -0
  83. package/templates/static/lib/db/index.js +65 -0
  84. package/templates/static/lib/db/types.d.ts +29 -0
  85. package/templates/static/lib/db/types.js +18 -0
  86. package/templates/static/lib/graphql/index.d.ts +1 -0
  87. package/templates/static/lib/graphql/index.js +22 -0
  88. package/templates/static/lib/graphql/resolvers.d.ts +17 -0
  89. package/templates/static/lib/graphql/resolvers.js +26 -0
  90. package/templates/static/lib/graphql/schema.d.ts +1 -0
  91. package/templates/static/lib/graphql/schema.js +20 -0
  92. package/templates/static/lib/i18n/en.json +4 -0
  93. package/templates/static/lib/i18n/es.json +4 -0
  94. package/templates/static/lib/i18n/index.d.ts +8 -0
  95. package/templates/static/lib/i18n/index.js +32 -0
  96. package/templates/static/lib/import/jen-import.d.ts +27 -0
  97. package/templates/static/lib/import/jen-import.js +128 -0
  98. package/templates/static/lib/index.d.ts +81 -0
  99. package/templates/static/lib/index.js +120 -0
  100. package/templates/static/lib/jdb/engine.d.ts +9 -0
  101. package/templates/static/lib/jdb/engine.js +176 -0
  102. package/templates/static/lib/jdb/index.d.ts +2 -0
  103. package/templates/static/lib/jdb/index.js +19 -0
  104. package/templates/static/lib/jdb/types.d.ts +46 -0
  105. package/templates/static/lib/jdb/types.js +18 -0
  106. package/templates/static/lib/jdb/utils.d.ts +6 -0
  107. package/templates/static/lib/jdb/utils.js +141 -0
  108. package/templates/static/lib/middleware/builtins/body-parser.d.ts +1 -0
  109. package/templates/static/lib/middleware/builtins/body-parser.js +55 -0
  110. package/templates/static/lib/middleware/builtins/cors.d.ts +13 -0
  111. package/templates/static/lib/middleware/builtins/cors.js +67 -0
  112. package/templates/static/lib/middleware/builtins/logger.d.ts +1 -0
  113. package/templates/static/lib/middleware/builtins/logger.js +33 -0
  114. package/templates/static/lib/middleware/builtins/rate-limit.d.ts +5 -0
  115. package/templates/static/lib/middleware/builtins/rate-limit.js +76 -0
  116. package/templates/static/lib/middleware/builtins/request-id.d.ts +1 -0
  117. package/templates/static/lib/middleware/builtins/request-id.js +25 -0
  118. package/templates/static/lib/middleware/builtins/security-headers.d.ts +1 -0
  119. package/templates/static/lib/middleware/builtins/security-headers.js +39 -0
  120. package/templates/static/lib/middleware/context.d.ts +18 -0
  121. package/templates/static/lib/middleware/context.js +50 -0
  122. package/templates/static/lib/middleware/decorators.d.ts +2 -0
  123. package/templates/static/lib/middleware/decorators.js +61 -0
  124. package/templates/static/lib/middleware/errors/handler.d.ts +1 -0
  125. package/templates/static/lib/middleware/errors/handler.js +65 -0
  126. package/templates/static/lib/middleware/errors/http-error.d.ts +5 -0
  127. package/templates/static/lib/middleware/errors/http-error.js +27 -0
  128. package/templates/static/lib/middleware/kernel.d.ts +6 -0
  129. package/templates/static/lib/middleware/kernel.js +39 -0
  130. package/templates/static/lib/middleware/pipeline.d.ts +4 -0
  131. package/templates/static/lib/middleware/pipeline.js +67 -0
  132. package/templates/static/lib/middleware/registry.d.ts +10 -0
  133. package/templates/static/lib/middleware/registry.js +41 -0
  134. package/templates/static/lib/middleware/response.d.ts +13 -0
  135. package/templates/static/lib/middleware/response.js +60 -0
  136. package/templates/static/lib/middleware/types.d.ts +1 -0
  137. package/templates/static/lib/middleware/types.js +18 -0
  138. package/templates/static/lib/middleware/utils/matcher.d.ts +1 -0
  139. package/templates/static/lib/middleware/utils/matcher.js +31 -0
  140. package/templates/static/lib/native/bundle.d.ts +19 -0
  141. package/templates/static/lib/native/bundle.js +39 -0
  142. package/templates/static/lib/native/dev-server.d.ts +6 -0
  143. package/templates/static/lib/native/dev-server.js +38 -0
  144. package/templates/static/lib/native/index.d.ts +30 -0
  145. package/templates/static/lib/native/index.js +48 -0
  146. package/templates/static/lib/native/optimizer.d.ts +17 -0
  147. package/templates/static/lib/native/optimizer.js +37 -0
  148. package/templates/static/lib/native/style-compiler.d.ts +10 -0
  149. package/templates/static/lib/native/style-compiler.js +36 -0
  150. package/templates/static/lib/plugin/loader.d.ts +8 -0
  151. package/templates/static/lib/plugin/loader.js +59 -0
  152. package/templates/static/lib/runtime/client-runtime.d.ts +1 -0
  153. package/templates/static/lib/runtime/client-runtime.js +28 -0
  154. package/templates/static/lib/runtime/hmr.d.ts +1 -0
  155. package/templates/static/lib/runtime/hmr.js +54 -0
  156. package/templates/static/lib/runtime/hydrate.d.ts +1 -0
  157. package/templates/static/lib/runtime/hydrate.js +45 -0
  158. package/templates/static/lib/runtime/island-hydration-client.d.ts +5 -0
  159. package/templates/static/lib/runtime/island-hydration-client.js +132 -0
  160. package/templates/static/lib/runtime/islands.d.ts +46 -0
  161. package/templates/static/lib/runtime/islands.js +89 -0
  162. package/templates/static/lib/runtime/render.d.ts +13 -0
  163. package/templates/static/lib/runtime/render.js +183 -0
  164. package/templates/static/lib/server/api-routes.d.ts +44 -0
  165. package/templates/static/lib/server/api-routes.js +196 -0
  166. package/templates/static/lib/server/api.d.ts +6 -0
  167. package/templates/static/lib/server/api.js +124 -0
  168. package/templates/static/lib/server/app.d.ts +10 -0
  169. package/templates/static/lib/server/app.js +381 -0
  170. package/templates/static/lib/server/runtimeServe.d.ts +4 -0
  171. package/templates/static/lib/server/runtimeServe.js +125 -0
  172. package/templates/static/lib/shared/log.d.ts +5 -0
  173. package/templates/static/lib/shared/log.js +31 -0
  174. package/templates/static/node_modules/.bin/esbuild +16 -0
  175. package/templates/static/node_modules/.bin/esbuild.cmd +17 -0
  176. package/templates/static/node_modules/.bin/esbuild.ps1 +28 -0
  177. package/templates/static/node_modules/.bin/tsc +16 -0
  178. package/templates/static/node_modules/.bin/tsc.cmd +17 -0
  179. package/templates/static/node_modules/.bin/tsc.ps1 +28 -0
  180. package/templates/static/node_modules/.bin/tsserver +16 -0
  181. package/templates/static/node_modules/.bin/tsserver.cmd +17 -0
  182. package/templates/static/node_modules/.bin/tsserver.ps1 +28 -0
  183. package/templates/static/node_modules/.jen/cache/B__Jen.js_packages_create-jen-app_templates_static_site_(home).tsx.mjs +14 -0
  184. package/templates/static/node_modules/.jen/cache/B__Jen.js_packages_create-jen-app_yo_site_(home).tsx.mjs +11 -0
  185. package/templates/static/node_modules/.package-lock.json +585 -0
  186. package/templates/static/node_modules/@esbuild/win32-x64/README.md +3 -0
  187. package/templates/static/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
  188. package/templates/static/node_modules/@esbuild/win32-x64/package.json +20 -0
  189. package/templates/static/node_modules/@jenjs/master/README.md +24 -0
  190. package/templates/static/node_modules/@jenjs/master/index.js +3655 -0
  191. package/templates/static/node_modules/@jenjs/master/package.json +36 -0
  192. package/templates/static/node_modules/@polka/url/build.js +49 -0
  193. package/templates/static/node_modules/@polka/url/build.mjs +47 -0
  194. package/templates/static/node_modules/@polka/url/index.d.ts +11 -0
  195. package/templates/static/node_modules/@polka/url/package.json +30 -0
  196. package/templates/static/node_modules/@polka/url/readme.md +68 -0
  197. package/templates/static/node_modules/@types/node/LICENSE +21 -0
  198. package/templates/static/node_modules/@types/node/README.md +15 -0
  199. package/templates/static/node_modules/@types/node/assert/strict.d.ts +111 -0
  200. package/templates/static/node_modules/@types/node/assert.d.ts +1078 -0
  201. package/templates/static/node_modules/@types/node/async_hooks.d.ts +603 -0
  202. package/templates/static/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  203. package/templates/static/node_modules/@types/node/buffer.d.ts +1934 -0
  204. package/templates/static/node_modules/@types/node/child_process.d.ts +1476 -0
  205. package/templates/static/node_modules/@types/node/cluster.d.ts +578 -0
  206. package/templates/static/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  207. package/templates/static/node_modules/@types/node/compatibility/index.d.ts +9 -0
  208. package/templates/static/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  209. package/templates/static/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
  210. package/templates/static/node_modules/@types/node/console.d.ts +452 -0
  211. package/templates/static/node_modules/@types/node/constants.d.ts +21 -0
  212. package/templates/static/node_modules/@types/node/crypto.d.ts +4545 -0
  213. package/templates/static/node_modules/@types/node/dgram.d.ts +600 -0
  214. package/templates/static/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  215. package/templates/static/node_modules/@types/node/dns/promises.d.ts +503 -0
  216. package/templates/static/node_modules/@types/node/dns.d.ts +923 -0
  217. package/templates/static/node_modules/@types/node/domain.d.ts +170 -0
  218. package/templates/static/node_modules/@types/node/events.d.ts +976 -0
  219. package/templates/static/node_modules/@types/node/fs/promises.d.ts +1295 -0
  220. package/templates/static/node_modules/@types/node/fs.d.ts +4461 -0
  221. package/templates/static/node_modules/@types/node/globals.d.ts +172 -0
  222. package/templates/static/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  223. package/templates/static/node_modules/@types/node/http.d.ts +2089 -0
  224. package/templates/static/node_modules/@types/node/http2.d.ts +2644 -0
  225. package/templates/static/node_modules/@types/node/https.d.ts +579 -0
  226. package/templates/static/node_modules/@types/node/index.d.ts +97 -0
  227. package/templates/static/node_modules/@types/node/inspector.d.ts +253 -0
  228. package/templates/static/node_modules/@types/node/inspector.generated.d.ts +4052 -0
  229. package/templates/static/node_modules/@types/node/module.d.ts +891 -0
  230. package/templates/static/node_modules/@types/node/net.d.ts +1057 -0
  231. package/templates/static/node_modules/@types/node/os.d.ts +506 -0
  232. package/templates/static/node_modules/@types/node/package.json +145 -0
  233. package/templates/static/node_modules/@types/node/path.d.ts +200 -0
  234. package/templates/static/node_modules/@types/node/perf_hooks.d.ts +968 -0
  235. package/templates/static/node_modules/@types/node/process.d.ts +2089 -0
  236. package/templates/static/node_modules/@types/node/punycode.d.ts +117 -0
  237. package/templates/static/node_modules/@types/node/querystring.d.ts +152 -0
  238. package/templates/static/node_modules/@types/node/readline/promises.d.ts +161 -0
  239. package/templates/static/node_modules/@types/node/readline.d.ts +594 -0
  240. package/templates/static/node_modules/@types/node/repl.d.ts +428 -0
  241. package/templates/static/node_modules/@types/node/sea.d.ts +153 -0
  242. package/templates/static/node_modules/@types/node/sqlite.d.ts +721 -0
  243. package/templates/static/node_modules/@types/node/stream/consumers.d.ts +38 -0
  244. package/templates/static/node_modules/@types/node/stream/promises.d.ts +90 -0
  245. package/templates/static/node_modules/@types/node/stream/web.d.ts +622 -0
  246. package/templates/static/node_modules/@types/node/stream.d.ts +1664 -0
  247. package/templates/static/node_modules/@types/node/string_decoder.d.ts +67 -0
  248. package/templates/static/node_modules/@types/node/test.d.ts +2163 -0
  249. package/templates/static/node_modules/@types/node/timers/promises.d.ts +108 -0
  250. package/templates/static/node_modules/@types/node/timers.d.ts +287 -0
  251. package/templates/static/node_modules/@types/node/tls.d.ts +1319 -0
  252. package/templates/static/node_modules/@types/node/trace_events.d.ts +197 -0
  253. package/templates/static/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  254. package/templates/static/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  255. package/templates/static/node_modules/@types/node/ts5.6/index.d.ts +97 -0
  256. package/templates/static/node_modules/@types/node/tty.d.ts +208 -0
  257. package/templates/static/node_modules/@types/node/url.d.ts +984 -0
  258. package/templates/static/node_modules/@types/node/util.d.ts +2606 -0
  259. package/templates/static/node_modules/@types/node/v8.d.ts +920 -0
  260. package/templates/static/node_modules/@types/node/vm.d.ts +1000 -0
  261. package/templates/static/node_modules/@types/node/wasi.d.ts +181 -0
  262. package/templates/static/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  263. package/templates/static/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  264. package/templates/static/node_modules/@types/node/web-globals/events.d.ts +97 -0
  265. package/templates/static/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
  266. package/templates/static/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
  267. package/templates/static/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  268. package/templates/static/node_modules/@types/node/worker_threads.d.ts +784 -0
  269. package/templates/static/node_modules/@types/node/zlib.d.ts +683 -0
  270. package/templates/static/node_modules/esbuild/LICENSE.md +21 -0
  271. package/templates/static/node_modules/esbuild/README.md +3 -0
  272. package/templates/static/node_modules/esbuild/bin/esbuild +223 -0
  273. package/templates/static/node_modules/esbuild/install.js +289 -0
  274. package/templates/static/node_modules/esbuild/lib/main.d.ts +716 -0
  275. package/templates/static/node_modules/esbuild/lib/main.js +2242 -0
  276. package/templates/static/node_modules/esbuild/package.json +49 -0
  277. package/templates/static/node_modules/mrmime/index.d.ts +2 -0
  278. package/templates/static/node_modules/mrmime/index.js +449 -0
  279. package/templates/static/node_modules/mrmime/index.mjs +448 -0
  280. package/templates/static/node_modules/mrmime/license +21 -0
  281. package/templates/static/node_modules/mrmime/package.json +44 -0
  282. package/templates/static/node_modules/mrmime/readme.md +130 -0
  283. package/templates/static/node_modules/preact/LICENSE +21 -0
  284. package/templates/static/node_modules/preact/README.md +185 -0
  285. package/templates/static/node_modules/preact/compat/client.d.ts +13 -0
  286. package/templates/static/node_modules/preact/compat/client.js +21 -0
  287. package/templates/static/node_modules/preact/compat/client.mjs +24 -0
  288. package/templates/static/node_modules/preact/compat/dist/compat.js +2 -0
  289. package/templates/static/node_modules/preact/compat/dist/compat.js.map +1 -0
  290. package/templates/static/node_modules/preact/compat/dist/compat.mjs +2 -0
  291. package/templates/static/node_modules/preact/compat/dist/compat.module.js +2 -0
  292. package/templates/static/node_modules/preact/compat/dist/compat.module.js.map +1 -0
  293. package/templates/static/node_modules/preact/compat/dist/compat.umd.js +2 -0
  294. package/templates/static/node_modules/preact/compat/dist/compat.umd.js.map +1 -0
  295. package/templates/static/node_modules/preact/compat/jsx-dev-runtime.js +3 -0
  296. package/templates/static/node_modules/preact/compat/jsx-dev-runtime.mjs +3 -0
  297. package/templates/static/node_modules/preact/compat/jsx-runtime.js +3 -0
  298. package/templates/static/node_modules/preact/compat/jsx-runtime.mjs +3 -0
  299. package/templates/static/node_modules/preact/compat/package.json +55 -0
  300. package/templates/static/node_modules/preact/compat/scheduler.js +15 -0
  301. package/templates/static/node_modules/preact/compat/scheduler.mjs +23 -0
  302. package/templates/static/node_modules/preact/compat/server.browser.js +11 -0
  303. package/templates/static/node_modules/preact/compat/server.js +36 -0
  304. package/templates/static/node_modules/preact/compat/server.mjs +17 -0
  305. package/templates/static/node_modules/preact/compat/src/Children.js +21 -0
  306. package/templates/static/node_modules/preact/compat/src/PureComponent.js +16 -0
  307. package/templates/static/node_modules/preact/compat/src/forwardRef.js +44 -0
  308. package/templates/static/node_modules/preact/compat/src/hooks.js +70 -0
  309. package/templates/static/node_modules/preact/compat/src/index.d.ts +351 -0
  310. package/templates/static/node_modules/preact/compat/src/index.js +238 -0
  311. package/templates/static/node_modules/preact/compat/src/internal.d.ts +48 -0
  312. package/templates/static/node_modules/preact/compat/src/memo.js +35 -0
  313. package/templates/static/node_modules/preact/compat/src/portals.js +78 -0
  314. package/templates/static/node_modules/preact/compat/src/render.js +313 -0
  315. package/templates/static/node_modules/preact/compat/src/suspense-list.d.ts +16 -0
  316. package/templates/static/node_modules/preact/compat/src/suspense-list.js +127 -0
  317. package/templates/static/node_modules/preact/compat/src/suspense.d.ts +19 -0
  318. package/templates/static/node_modules/preact/compat/src/suspense.js +291 -0
  319. package/templates/static/node_modules/preact/compat/src/util.js +33 -0
  320. package/templates/static/node_modules/preact/compat/test-utils.js +1 -0
  321. package/templates/static/node_modules/preact/compat/test-utils.mjs +1 -0
  322. package/templates/static/node_modules/preact/debug/dist/debug.js +2 -0
  323. package/templates/static/node_modules/preact/debug/dist/debug.js.map +1 -0
  324. package/templates/static/node_modules/preact/debug/dist/debug.mjs +2 -0
  325. package/templates/static/node_modules/preact/debug/dist/debug.module.js +2 -0
  326. package/templates/static/node_modules/preact/debug/dist/debug.module.js.map +1 -0
  327. package/templates/static/node_modules/preact/debug/dist/debug.umd.js +2 -0
  328. package/templates/static/node_modules/preact/debug/dist/debug.umd.js.map +1 -0
  329. package/templates/static/node_modules/preact/debug/package.json +27 -0
  330. package/templates/static/node_modules/preact/debug/src/check-props.js +54 -0
  331. package/templates/static/node_modules/preact/debug/src/component-stack.js +146 -0
  332. package/templates/static/node_modules/preact/debug/src/constants.js +3 -0
  333. package/templates/static/node_modules/preact/debug/src/debug.js +593 -0
  334. package/templates/static/node_modules/preact/debug/src/index.d.ts +23 -0
  335. package/templates/static/node_modules/preact/debug/src/index.js +12 -0
  336. package/templates/static/node_modules/preact/debug/src/internal.d.ts +82 -0
  337. package/templates/static/node_modules/preact/debug/src/util.js +15 -0
  338. package/templates/static/node_modules/preact/devtools/dist/devtools.js +2 -0
  339. package/templates/static/node_modules/preact/devtools/dist/devtools.js.map +1 -0
  340. package/templates/static/node_modules/preact/devtools/dist/devtools.mjs +2 -0
  341. package/templates/static/node_modules/preact/devtools/dist/devtools.module.js +2 -0
  342. package/templates/static/node_modules/preact/devtools/dist/devtools.module.js.map +1 -0
  343. package/templates/static/node_modules/preact/devtools/dist/devtools.umd.js +2 -0
  344. package/templates/static/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -0
  345. package/templates/static/node_modules/preact/devtools/package.json +25 -0
  346. package/templates/static/node_modules/preact/devtools/src/devtools.js +21 -0
  347. package/templates/static/node_modules/preact/devtools/src/index.d.ts +8 -0
  348. package/templates/static/node_modules/preact/devtools/src/index.js +15 -0
  349. package/templates/static/node_modules/preact/dist/preact.js +2 -0
  350. package/templates/static/node_modules/preact/dist/preact.js.map +1 -0
  351. package/templates/static/node_modules/preact/dist/preact.min.js +2 -0
  352. package/templates/static/node_modules/preact/dist/preact.min.js.map +1 -0
  353. package/templates/static/node_modules/preact/dist/preact.min.module.js +2 -0
  354. package/templates/static/node_modules/preact/dist/preact.min.module.js.map +1 -0
  355. package/templates/static/node_modules/preact/dist/preact.min.umd.js +2 -0
  356. package/templates/static/node_modules/preact/dist/preact.min.umd.js.map +1 -0
  357. package/templates/static/node_modules/preact/dist/preact.mjs +2 -0
  358. package/templates/static/node_modules/preact/dist/preact.module.js +2 -0
  359. package/templates/static/node_modules/preact/dist/preact.module.js.map +1 -0
  360. package/templates/static/node_modules/preact/dist/preact.umd.js +2 -0
  361. package/templates/static/node_modules/preact/dist/preact.umd.js.map +1 -0
  362. package/templates/static/node_modules/preact/hooks/dist/hooks.js +2 -0
  363. package/templates/static/node_modules/preact/hooks/dist/hooks.js.map +1 -0
  364. package/templates/static/node_modules/preact/hooks/dist/hooks.mjs +2 -0
  365. package/templates/static/node_modules/preact/hooks/dist/hooks.module.js +2 -0
  366. package/templates/static/node_modules/preact/hooks/dist/hooks.module.js.map +1 -0
  367. package/templates/static/node_modules/preact/hooks/dist/hooks.umd.js +2 -0
  368. package/templates/static/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -0
  369. package/templates/static/node_modules/preact/hooks/package.json +35 -0
  370. package/templates/static/node_modules/preact/hooks/src/index.d.ts +145 -0
  371. package/templates/static/node_modules/preact/hooks/src/index.js +555 -0
  372. package/templates/static/node_modules/preact/hooks/src/internal.d.ts +103 -0
  373. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
  374. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
  375. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
  376. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
  377. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
  378. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
  379. package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
  380. package/templates/static/node_modules/preact/jsx-runtime/package.json +28 -0
  381. package/templates/static/node_modules/preact/jsx-runtime/src/index.d.ts +62 -0
  382. package/templates/static/node_modules/preact/jsx-runtime/src/index.js +206 -0
  383. package/templates/static/node_modules/preact/jsx-runtime/src/utils.js +36 -0
  384. package/templates/static/node_modules/preact/package.json +258 -0
  385. package/templates/static/node_modules/preact/src/cjs.js +3 -0
  386. package/templates/static/node_modules/preact/src/clone-element.js +48 -0
  387. package/templates/static/node_modules/preact/src/component.js +249 -0
  388. package/templates/static/node_modules/preact/src/constants.js +22 -0
  389. package/templates/static/node_modules/preact/src/create-context.js +60 -0
  390. package/templates/static/node_modules/preact/src/create-element.js +97 -0
  391. package/templates/static/node_modules/preact/src/diff/catch-error.js +46 -0
  392. package/templates/static/node_modules/preact/src/diff/children.js +451 -0
  393. package/templates/static/node_modules/preact/src/diff/index.js +684 -0
  394. package/templates/static/node_modules/preact/src/diff/props.js +173 -0
  395. package/templates/static/node_modules/preact/src/dom.d.ts +2476 -0
  396. package/templates/static/node_modules/preact/src/index-5.d.ts +399 -0
  397. package/templates/static/node_modules/preact/src/index.d.ts +402 -0
  398. package/templates/static/node_modules/preact/src/index.js +13 -0
  399. package/templates/static/node_modules/preact/src/internal.d.ts +190 -0
  400. package/templates/static/node_modules/preact/src/jsx.d.ts +2878 -0
  401. package/templates/static/node_modules/preact/src/options.js +16 -0
  402. package/templates/static/node_modules/preact/src/render.js +78 -0
  403. package/templates/static/node_modules/preact/src/util.js +28 -0
  404. package/templates/static/node_modules/preact/test-utils/dist/testUtils.js +2 -0
  405. package/templates/static/node_modules/preact/test-utils/dist/testUtils.js.map +1 -0
  406. package/templates/static/node_modules/preact/test-utils/dist/testUtils.mjs +2 -0
  407. package/templates/static/node_modules/preact/test-utils/dist/testUtils.module.js +2 -0
  408. package/templates/static/node_modules/preact/test-utils/dist/testUtils.module.js.map +1 -0
  409. package/templates/static/node_modules/preact/test-utils/dist/testUtils.umd.js +2 -0
  410. package/templates/static/node_modules/preact/test-utils/dist/testUtils.umd.js.map +1 -0
  411. package/templates/static/node_modules/preact/test-utils/package.json +28 -0
  412. package/templates/static/node_modules/preact/test-utils/src/index.d.ts +3 -0
  413. package/templates/static/node_modules/preact/test-utils/src/index.js +129 -0
  414. package/templates/static/node_modules/preact-render-to-string/LICENSE +21 -0
  415. package/templates/static/node_modules/preact-render-to-string/README.md +149 -0
  416. package/templates/static/node_modules/preact-render-to-string/dist/commonjs.js +2 -0
  417. package/templates/static/node_modules/preact-render-to-string/dist/index.d.ts +17 -0
  418. package/templates/static/node_modules/preact-render-to-string/dist/index.js +6 -0
  419. package/templates/static/node_modules/preact-render-to-string/dist/index.js.map +1 -0
  420. package/templates/static/node_modules/preact-render-to-string/dist/index.mjs +2 -0
  421. package/templates/static/node_modules/preact-render-to-string/dist/index.module.js +2 -0
  422. package/templates/static/node_modules/preact-render-to-string/dist/index.module.js.map +1 -0
  423. package/templates/static/node_modules/preact-render-to-string/dist/index.umd.js +2 -0
  424. package/templates/static/node_modules/preact-render-to-string/dist/index.umd.js.map +1 -0
  425. package/templates/static/node_modules/preact-render-to-string/dist/internal.d.ts +35 -0
  426. package/templates/static/node_modules/preact-render-to-string/dist/jsx/commonjs.js +2 -0
  427. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.js +4 -0
  428. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.js.map +1 -0
  429. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.mjs +2 -0
  430. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.module.js +2 -0
  431. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.module.js.map +1 -0
  432. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.umd.js +2 -0
  433. package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.umd.js.map +1 -0
  434. package/templates/static/node_modules/preact-render-to-string/dist/jsx.d.ts +24 -0
  435. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.js +2 -0
  436. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.js.map +1 -0
  437. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.mjs +2 -0
  438. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.module.js +2 -0
  439. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.module.js.map +1 -0
  440. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.umd.js +2 -0
  441. package/templates/static/node_modules/preact-render-to-string/dist/stream/index.umd.js.map +1 -0
  442. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.js +884 -0
  443. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.js.map +1 -0
  444. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.mjs +884 -0
  445. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.module.js +884 -0
  446. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.module.js.map +1 -0
  447. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.umd.js +888 -0
  448. package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.umd.js.map +1 -0
  449. package/templates/static/node_modules/preact-render-to-string/dist/stream-node.d.ts +19 -0
  450. package/templates/static/node_modules/preact-render-to-string/dist/stream.d.ts +10 -0
  451. package/templates/static/node_modules/preact-render-to-string/jsx.d.ts +24 -0
  452. package/templates/static/node_modules/preact-render-to-string/jsx.js +1 -0
  453. package/templates/static/node_modules/preact-render-to-string/package.json +152 -0
  454. package/templates/static/node_modules/preact-render-to-string/src/index.d.ts +17 -0
  455. package/templates/static/node_modules/preact-render-to-string/src/index.js +764 -0
  456. package/templates/static/node_modules/preact-render-to-string/src/internal.d.ts +35 -0
  457. package/templates/static/node_modules/preact-render-to-string/src/jsx.d.ts +24 -0
  458. package/templates/static/node_modules/preact-render-to-string/src/jsx.js +102 -0
  459. package/templates/static/node_modules/preact-render-to-string/src/lib/chunked.js +97 -0
  460. package/templates/static/node_modules/preact-render-to-string/src/lib/client.js +62 -0
  461. package/templates/static/node_modules/preact-render-to-string/src/lib/constants.js +20 -0
  462. package/templates/static/node_modules/preact-render-to-string/src/lib/polyfills.js +8 -0
  463. package/templates/static/node_modules/preact-render-to-string/src/lib/util.js +208 -0
  464. package/templates/static/node_modules/preact-render-to-string/src/pretty.js +491 -0
  465. package/templates/static/node_modules/preact-render-to-string/src/stream-node.d.ts +19 -0
  466. package/templates/static/node_modules/preact-render-to-string/src/stream-node.js +84 -0
  467. package/templates/static/node_modules/preact-render-to-string/src/stream.d.ts +10 -0
  468. package/templates/static/node_modules/preact-render-to-string/src/stream.js +43 -0
  469. package/templates/static/node_modules/preact-render-to-string/typings.json +5 -0
  470. package/templates/static/node_modules/sirv/build.js +197 -0
  471. package/templates/static/node_modules/sirv/build.mjs +197 -0
  472. package/templates/static/node_modules/sirv/index.d.mts +29 -0
  473. package/templates/static/node_modules/sirv/index.d.ts +33 -0
  474. package/templates/static/node_modules/sirv/package.json +40 -0
  475. package/templates/static/node_modules/sirv/readme.md +238 -0
  476. package/templates/static/node_modules/totalist/dist/index.js +24 -0
  477. package/templates/static/node_modules/totalist/dist/index.mjs +22 -0
  478. package/templates/static/node_modules/totalist/index.d.ts +3 -0
  479. package/templates/static/node_modules/totalist/license +21 -0
  480. package/templates/static/node_modules/totalist/package.json +55 -0
  481. package/templates/static/node_modules/totalist/readme.md +109 -0
  482. package/templates/static/node_modules/totalist/sync/index.d.ts +3 -0
  483. package/templates/static/node_modules/totalist/sync/index.js +17 -0
  484. package/templates/static/node_modules/totalist/sync/index.mjs +15 -0
  485. package/templates/static/node_modules/typescript/bin/tsc +2 -0
  486. package/templates/static/node_modules/typescript/bin/tsserver +2 -0
  487. package/templates/static/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  488. package/templates/static/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  489. package/templates/static/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  490. package/templates/static/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  491. package/templates/static/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  492. package/templates/static/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  493. package/templates/static/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  494. package/templates/static/node_modules/typescript/lib/lib.d.ts +22 -0
  495. package/templates/static/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  496. package/templates/static/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  497. package/templates/static/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  498. package/templates/static/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  499. package/templates/static/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  500. package/templates/static/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  501. package/templates/static/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  502. package/templates/static/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  503. package/templates/static/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  504. package/templates/static/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  505. package/templates/static/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  506. package/templates/static/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  507. package/templates/static/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  508. package/templates/static/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  509. package/templates/static/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  510. package/templates/static/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  511. package/templates/static/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  512. package/templates/static/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  513. package/templates/static/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  514. package/templates/static/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  515. package/templates/static/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  516. package/templates/static/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  517. package/templates/static/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  518. package/templates/static/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  519. package/templates/static/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  520. package/templates/static/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  521. package/templates/static/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  522. package/templates/static/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  523. package/templates/static/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  524. package/templates/static/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  525. package/templates/static/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  526. package/templates/static/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  527. package/templates/static/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  528. package/templates/static/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  529. package/templates/static/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  530. package/templates/static/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  531. package/templates/static/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  532. package/templates/static/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  533. package/templates/static/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  534. package/templates/static/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  535. package/templates/static/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  536. package/templates/static/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  537. package/templates/static/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  538. package/templates/static/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  539. package/templates/static/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  540. package/templates/static/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  541. package/templates/static/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  542. package/templates/static/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  543. package/templates/static/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  544. package/templates/static/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  545. package/templates/static/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  546. package/templates/static/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  547. package/templates/static/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  548. package/templates/static/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  549. package/templates/static/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  550. package/templates/static/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  551. package/templates/static/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  552. package/templates/static/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  553. package/templates/static/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  554. package/templates/static/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  555. package/templates/static/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  556. package/templates/static/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  557. package/templates/static/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  558. package/templates/static/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  559. package/templates/static/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  560. package/templates/static/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  561. package/templates/static/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  562. package/templates/static/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  563. package/templates/static/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  564. package/templates/static/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  565. package/templates/static/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  566. package/templates/static/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  567. package/templates/static/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  568. package/templates/static/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  569. package/templates/static/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  570. package/templates/static/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  571. package/templates/static/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  572. package/templates/static/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  573. package/templates/static/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  574. package/templates/static/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  575. package/templates/static/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  576. package/templates/static/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  577. package/templates/static/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  578. package/templates/static/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  579. package/templates/static/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  580. package/templates/static/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  581. package/templates/static/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  582. package/templates/static/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  583. package/templates/static/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  584. package/templates/static/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  585. package/templates/static/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  586. package/templates/static/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  587. package/templates/static/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  588. package/templates/static/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  589. package/templates/static/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  590. package/templates/static/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  591. package/templates/static/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  592. package/templates/static/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  593. package/templates/static/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  594. package/templates/static/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  595. package/templates/static/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  596. package/templates/static/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  597. package/templates/static/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  598. package/templates/static/node_modules/typescript/lib/tsc.js +8 -0
  599. package/templates/static/node_modules/typescript/lib/tsserver.js +8 -0
  600. package/templates/static/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  601. package/templates/static/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  602. package/templates/static/node_modules/typescript/lib/typescript.d.ts +11437 -0
  603. package/templates/static/package.json +20 -0
  604. package/templates/static/server.js +130 -0
  605. package/templates/static/site/(home).tsx +12 -0
  606. package/templates/static/site/styles/global.scss +78 -0
  607. package/templates/static/tsconfig.json +39 -0
@@ -0,0 +1,2089 @@
1
+ /**
2
+ * To use the HTTP server and client one must import the `node:http` module.
3
+ *
4
+ * The HTTP interfaces in Node.js are designed to support many features
5
+ * of the protocol which have been traditionally difficult to use.
6
+ * In particular, large, possibly chunk-encoded, messages. The interface is
7
+ * careful to never buffer entire requests or responses, so the
8
+ * user is able to stream data.
9
+ *
10
+ * HTTP message headers are represented by an object like this:
11
+ *
12
+ * ```json
13
+ * { "content-length": "123",
14
+ * "content-type": "text/plain",
15
+ * "connection": "keep-alive",
16
+ * "host": "example.com",
17
+ * "accept": "*" }
18
+ * ```
19
+ *
20
+ * Keys are lowercased. Values are not modified.
21
+ *
22
+ * In order to support the full spectrum of possible HTTP applications, the Node.js
23
+ * HTTP API is very low-level. It deals with stream handling and message
24
+ * parsing only. It parses a message into headers and body but it does not
25
+ * parse the actual headers or the body.
26
+ *
27
+ * See `message.headers` for details on how duplicate headers are handled.
28
+ *
29
+ * The raw headers as they were received are retained in the `rawHeaders` property, which is an array of `[key, value, key2, value2, ...]`. For
30
+ * example, the previous message header object might have a `rawHeaders` list like the following:
31
+ *
32
+ * ```js
33
+ * [ 'ConTent-Length', '123456',
34
+ * 'content-LENGTH', '123',
35
+ * 'content-type', 'text/plain',
36
+ * 'CONNECTION', 'keep-alive',
37
+ * 'Host', 'example.com',
38
+ * 'accepT', '*' ]
39
+ * ```
40
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http.js)
41
+ */
42
+ declare module "http" {
43
+ import { NonSharedBuffer } from "node:buffer";
44
+ import * as stream from "node:stream";
45
+ import { URL } from "node:url";
46
+ import { LookupOptions } from "node:dns";
47
+ import { EventEmitter } from "node:events";
48
+ import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net";
49
+ // incoming headers will never contain number
50
+ interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
51
+ accept?: string | undefined;
52
+ "accept-encoding"?: string | undefined;
53
+ "accept-language"?: string | undefined;
54
+ "accept-patch"?: string | undefined;
55
+ "accept-ranges"?: string | undefined;
56
+ "access-control-allow-credentials"?: string | undefined;
57
+ "access-control-allow-headers"?: string | undefined;
58
+ "access-control-allow-methods"?: string | undefined;
59
+ "access-control-allow-origin"?: string | undefined;
60
+ "access-control-expose-headers"?: string | undefined;
61
+ "access-control-max-age"?: string | undefined;
62
+ "access-control-request-headers"?: string | undefined;
63
+ "access-control-request-method"?: string | undefined;
64
+ age?: string | undefined;
65
+ allow?: string | undefined;
66
+ "alt-svc"?: string | undefined;
67
+ authorization?: string | undefined;
68
+ "cache-control"?: string | undefined;
69
+ connection?: string | undefined;
70
+ "content-disposition"?: string | undefined;
71
+ "content-encoding"?: string | undefined;
72
+ "content-language"?: string | undefined;
73
+ "content-length"?: string | undefined;
74
+ "content-location"?: string | undefined;
75
+ "content-range"?: string | undefined;
76
+ "content-type"?: string | undefined;
77
+ cookie?: string | undefined;
78
+ date?: string | undefined;
79
+ etag?: string | undefined;
80
+ expect?: string | undefined;
81
+ expires?: string | undefined;
82
+ forwarded?: string | undefined;
83
+ from?: string | undefined;
84
+ host?: string | undefined;
85
+ "if-match"?: string | undefined;
86
+ "if-modified-since"?: string | undefined;
87
+ "if-none-match"?: string | undefined;
88
+ "if-unmodified-since"?: string | undefined;
89
+ "last-modified"?: string | undefined;
90
+ location?: string | undefined;
91
+ origin?: string | undefined;
92
+ pragma?: string | undefined;
93
+ "proxy-authenticate"?: string | undefined;
94
+ "proxy-authorization"?: string | undefined;
95
+ "public-key-pins"?: string | undefined;
96
+ range?: string | undefined;
97
+ referer?: string | undefined;
98
+ "retry-after"?: string | undefined;
99
+ "sec-fetch-site"?: string | undefined;
100
+ "sec-fetch-mode"?: string | undefined;
101
+ "sec-fetch-user"?: string | undefined;
102
+ "sec-fetch-dest"?: string | undefined;
103
+ "sec-websocket-accept"?: string | undefined;
104
+ "sec-websocket-extensions"?: string | undefined;
105
+ "sec-websocket-key"?: string | undefined;
106
+ "sec-websocket-protocol"?: string | undefined;
107
+ "sec-websocket-version"?: string | undefined;
108
+ "set-cookie"?: string[] | undefined;
109
+ "strict-transport-security"?: string | undefined;
110
+ tk?: string | undefined;
111
+ trailer?: string | undefined;
112
+ "transfer-encoding"?: string | undefined;
113
+ upgrade?: string | undefined;
114
+ "user-agent"?: string | undefined;
115
+ vary?: string | undefined;
116
+ via?: string | undefined;
117
+ warning?: string | undefined;
118
+ "www-authenticate"?: string | undefined;
119
+ }
120
+ // outgoing headers allows numbers (as they are converted internally to strings)
121
+ type OutgoingHttpHeader = number | string | string[];
122
+ interface OutgoingHttpHeaders extends NodeJS.Dict<OutgoingHttpHeader> {
123
+ accept?: string | string[] | undefined;
124
+ "accept-charset"?: string | string[] | undefined;
125
+ "accept-encoding"?: string | string[] | undefined;
126
+ "accept-language"?: string | string[] | undefined;
127
+ "accept-ranges"?: string | undefined;
128
+ "access-control-allow-credentials"?: string | undefined;
129
+ "access-control-allow-headers"?: string | undefined;
130
+ "access-control-allow-methods"?: string | undefined;
131
+ "access-control-allow-origin"?: string | undefined;
132
+ "access-control-expose-headers"?: string | undefined;
133
+ "access-control-max-age"?: string | undefined;
134
+ "access-control-request-headers"?: string | undefined;
135
+ "access-control-request-method"?: string | undefined;
136
+ age?: string | undefined;
137
+ allow?: string | undefined;
138
+ authorization?: string | undefined;
139
+ "cache-control"?: string | undefined;
140
+ "cdn-cache-control"?: string | undefined;
141
+ connection?: string | string[] | undefined;
142
+ "content-disposition"?: string | undefined;
143
+ "content-encoding"?: string | undefined;
144
+ "content-language"?: string | undefined;
145
+ "content-length"?: string | number | undefined;
146
+ "content-location"?: string | undefined;
147
+ "content-range"?: string | undefined;
148
+ "content-security-policy"?: string | undefined;
149
+ "content-security-policy-report-only"?: string | undefined;
150
+ "content-type"?: string | undefined;
151
+ cookie?: string | string[] | undefined;
152
+ dav?: string | string[] | undefined;
153
+ dnt?: string | undefined;
154
+ date?: string | undefined;
155
+ etag?: string | undefined;
156
+ expect?: string | undefined;
157
+ expires?: string | undefined;
158
+ forwarded?: string | undefined;
159
+ from?: string | undefined;
160
+ host?: string | undefined;
161
+ "if-match"?: string | undefined;
162
+ "if-modified-since"?: string | undefined;
163
+ "if-none-match"?: string | undefined;
164
+ "if-range"?: string | undefined;
165
+ "if-unmodified-since"?: string | undefined;
166
+ "last-modified"?: string | undefined;
167
+ link?: string | string[] | undefined;
168
+ location?: string | undefined;
169
+ "max-forwards"?: string | undefined;
170
+ origin?: string | undefined;
171
+ pragma?: string | string[] | undefined;
172
+ "proxy-authenticate"?: string | string[] | undefined;
173
+ "proxy-authorization"?: string | undefined;
174
+ "public-key-pins"?: string | undefined;
175
+ "public-key-pins-report-only"?: string | undefined;
176
+ range?: string | undefined;
177
+ referer?: string | undefined;
178
+ "referrer-policy"?: string | undefined;
179
+ refresh?: string | undefined;
180
+ "retry-after"?: string | undefined;
181
+ "sec-websocket-accept"?: string | undefined;
182
+ "sec-websocket-extensions"?: string | string[] | undefined;
183
+ "sec-websocket-key"?: string | undefined;
184
+ "sec-websocket-protocol"?: string | string[] | undefined;
185
+ "sec-websocket-version"?: string | undefined;
186
+ server?: string | undefined;
187
+ "set-cookie"?: string | string[] | undefined;
188
+ "strict-transport-security"?: string | undefined;
189
+ te?: string | undefined;
190
+ trailer?: string | undefined;
191
+ "transfer-encoding"?: string | undefined;
192
+ "user-agent"?: string | undefined;
193
+ upgrade?: string | undefined;
194
+ "upgrade-insecure-requests"?: string | undefined;
195
+ vary?: string | undefined;
196
+ via?: string | string[] | undefined;
197
+ warning?: string | undefined;
198
+ "www-authenticate"?: string | string[] | undefined;
199
+ "x-content-type-options"?: string | undefined;
200
+ "x-dns-prefetch-control"?: string | undefined;
201
+ "x-frame-options"?: string | undefined;
202
+ "x-xss-protection"?: string | undefined;
203
+ }
204
+ interface ClientRequestArgs extends Pick<LookupOptions, "hints"> {
205
+ _defaultAgent?: Agent | undefined;
206
+ agent?: Agent | boolean | undefined;
207
+ auth?: string | null | undefined;
208
+ createConnection?:
209
+ | ((
210
+ options: ClientRequestArgs,
211
+ oncreate: (err: Error | null, socket: stream.Duplex) => void,
212
+ ) => stream.Duplex | null | undefined)
213
+ | undefined;
214
+ defaultPort?: number | string | undefined;
215
+ family?: number | undefined;
216
+ headers?: OutgoingHttpHeaders | readonly string[] | undefined;
217
+ host?: string | null | undefined;
218
+ hostname?: string | null | undefined;
219
+ insecureHTTPParser?: boolean | undefined;
220
+ localAddress?: string | undefined;
221
+ localPort?: number | undefined;
222
+ lookup?: LookupFunction | undefined;
223
+ /**
224
+ * @default 16384
225
+ */
226
+ maxHeaderSize?: number | undefined;
227
+ method?: string | undefined;
228
+ path?: string | null | undefined;
229
+ port?: number | string | null | undefined;
230
+ protocol?: string | null | undefined;
231
+ setDefaultHeaders?: boolean | undefined;
232
+ setHost?: boolean | undefined;
233
+ signal?: AbortSignal | undefined;
234
+ socketPath?: string | undefined;
235
+ timeout?: number | undefined;
236
+ uniqueHeaders?: Array<string | string[]> | undefined;
237
+ joinDuplicateHeaders?: boolean | undefined;
238
+ }
239
+ interface ServerOptions<
240
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
241
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
242
+ > {
243
+ /**
244
+ * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
245
+ */
246
+ IncomingMessage?: Request | undefined;
247
+ /**
248
+ * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`.
249
+ */
250
+ ServerResponse?: Response | undefined;
251
+ /**
252
+ * Sets the timeout value in milliseconds for receiving the entire request from the client.
253
+ * @see Server.requestTimeout for more information.
254
+ * @default 300000
255
+ * @since v18.0.0
256
+ */
257
+ requestTimeout?: number | undefined;
258
+ /**
259
+ * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates.
260
+ * @default false
261
+ * @since v18.14.0
262
+ */
263
+ joinDuplicateHeaders?: boolean | undefined;
264
+ /**
265
+ * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
266
+ * after it has finished writing the last response, before a socket will be destroyed.
267
+ * @see Server.keepAliveTimeout for more information.
268
+ * @default 5000
269
+ * @since v18.0.0
270
+ */
271
+ keepAliveTimeout?: number | undefined;
272
+ /**
273
+ * An additional buffer time added to the
274
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
275
+ * @since 22.19.0
276
+ * @default 1000
277
+ */
278
+ keepAliveTimeoutBuffer?: number | undefined;
279
+ /**
280
+ * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
281
+ * @default 30000
282
+ */
283
+ connectionsCheckingInterval?: number | undefined;
284
+ /**
285
+ * Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client.
286
+ * See {@link Server.headersTimeout} for more information.
287
+ * @default 60000
288
+ * @since 18.0.0
289
+ */
290
+ headersTimeout?: number | undefined;
291
+ /**
292
+ * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
293
+ * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
294
+ * Default: @see stream.getDefaultHighWaterMark().
295
+ * @since v20.1.0
296
+ */
297
+ highWaterMark?: number | undefined;
298
+ /**
299
+ * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
300
+ * Using the insecure parser should be avoided.
301
+ * See --insecure-http-parser for more information.
302
+ * @default false
303
+ */
304
+ insecureHTTPParser?: boolean | undefined;
305
+ /**
306
+ * Optionally overrides the value of `--max-http-header-size` for requests received by
307
+ * this server, i.e. the maximum length of request headers in bytes.
308
+ * @default 16384
309
+ * @since v13.3.0
310
+ */
311
+ maxHeaderSize?: number | undefined;
312
+ /**
313
+ * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
314
+ * @default true
315
+ * @since v16.5.0
316
+ */
317
+ noDelay?: boolean | undefined;
318
+ /**
319
+ * If set to `true`, it forces the server to respond with a 400 (Bad Request) status code
320
+ * to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification).
321
+ * @default true
322
+ * @since 20.0.0
323
+ */
324
+ requireHostHeader?: boolean | undefined;
325
+ /**
326
+ * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
327
+ * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
328
+ * @default false
329
+ * @since v16.5.0
330
+ */
331
+ keepAlive?: boolean | undefined;
332
+ /**
333
+ * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
334
+ * @default 0
335
+ * @since v16.5.0
336
+ */
337
+ keepAliveInitialDelay?: number | undefined;
338
+ /**
339
+ * A list of response headers that should be sent only once.
340
+ * If the header's value is an array, the items will be joined using `; `.
341
+ */
342
+ uniqueHeaders?: Array<string | string[]> | undefined;
343
+ /**
344
+ * If set to `true`, an error is thrown when writing to an HTTP response which does not have a body.
345
+ * @default false
346
+ * @since v18.17.0, v20.2.0
347
+ */
348
+ rejectNonStandardBodyWrites?: boolean | undefined;
349
+ }
350
+ type RequestListener<
351
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
352
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
353
+ > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
354
+ /**
355
+ * @since v0.1.17
356
+ */
357
+ class Server<
358
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
359
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
360
+ > extends NetServer {
361
+ constructor(requestListener?: RequestListener<Request, Response>);
362
+ constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
363
+ /**
364
+ * Sets the timeout value for sockets, and emits a `'timeout'` event on
365
+ * the Server object, passing the socket as an argument, if a timeout
366
+ * occurs.
367
+ *
368
+ * If there is a `'timeout'` event listener on the Server object, then it
369
+ * will be called with the timed-out socket as an argument.
370
+ *
371
+ * By default, the Server does not timeout sockets. However, if a callback
372
+ * is assigned to the Server's `'timeout'` event, timeouts must be handled
373
+ * explicitly.
374
+ * @since v0.9.12
375
+ * @param [msecs=0 (no timeout)]
376
+ */
377
+ setTimeout(msecs?: number, callback?: (socket: Socket) => void): this;
378
+ setTimeout(callback: (socket: Socket) => void): this;
379
+ /**
380
+ * Limits maximum incoming headers count. If set to 0, no limit will be applied.
381
+ * @since v0.7.0
382
+ */
383
+ maxHeadersCount: number | null;
384
+ /**
385
+ * The maximum number of requests socket can handle
386
+ * before closing keep alive connection.
387
+ *
388
+ * A value of `0` will disable the limit.
389
+ *
390
+ * When the limit is reached it will set the `Connection` header value to `close`,
391
+ * but will not actually close the connection, subsequent requests sent
392
+ * after the limit is reached will get `503 Service Unavailable` as a response.
393
+ * @since v16.10.0
394
+ */
395
+ maxRequestsPerSocket: number | null;
396
+ /**
397
+ * The number of milliseconds of inactivity before a socket is presumed
398
+ * to have timed out.
399
+ *
400
+ * A value of `0` will disable the timeout behavior on incoming connections.
401
+ *
402
+ * The socket timeout logic is set up on connection, so changing this
403
+ * value only affects new connections to the server, not any existing connections.
404
+ * @since v0.9.12
405
+ */
406
+ timeout: number;
407
+ /**
408
+ * Limit the amount of time the parser will wait to receive the complete HTTP
409
+ * headers.
410
+ *
411
+ * If the timeout expires, the server responds with status 408 without
412
+ * forwarding the request to the request listener and then closes the connection.
413
+ *
414
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
415
+ * potential Denial-of-Service attacks in case the server is deployed without a
416
+ * reverse proxy in front.
417
+ * @since v11.3.0, v10.14.0
418
+ */
419
+ headersTimeout: number;
420
+ /**
421
+ * The number of milliseconds of inactivity a server needs to wait for additional
422
+ * incoming data, after it has finished writing the last response, before a socket
423
+ * will be destroyed.
424
+ *
425
+ * This timeout value is combined with the
426
+ * `server.keepAliveTimeoutBuffer` option to determine the actual socket
427
+ * timeout, calculated as:
428
+ * socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
429
+ * If the server receives new data before the keep-alive timeout has fired, it
430
+ * will reset the regular inactivity timeout, i.e., `server.timeout`.
431
+ *
432
+ * A value of `0` will disable the keep-alive timeout behavior on incoming
433
+ * connections.
434
+ * A value of `0` makes the HTTP server behave similarly to Node.js versions prior
435
+ * to 8.0.0, which did not have a keep-alive timeout.
436
+ *
437
+ * The socket timeout logic is set up on connection, so changing this value only
438
+ * affects new connections to the server, not any existing connections.
439
+ * @since v8.0.0
440
+ */
441
+ keepAliveTimeout: number;
442
+ /**
443
+ * An additional buffer time added to the
444
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
445
+ *
446
+ * This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
447
+ * the socket timeout slightly beyond the advertised keep-alive timeout.
448
+ *
449
+ * This option applies only to new incoming connections.
450
+ * @since v22.19.0
451
+ * @default 1000
452
+ */
453
+ keepAliveTimeoutBuffer: number;
454
+ /**
455
+ * Sets the timeout value in milliseconds for receiving the entire request from
456
+ * the client.
457
+ *
458
+ * If the timeout expires, the server responds with status 408 without
459
+ * forwarding the request to the request listener and then closes the connection.
460
+ *
461
+ * It must be set to a non-zero value (e.g. 120 seconds) to protect against
462
+ * potential Denial-of-Service attacks in case the server is deployed without a
463
+ * reverse proxy in front.
464
+ * @since v14.11.0
465
+ */
466
+ requestTimeout: number;
467
+ /**
468
+ * Closes all connections connected to this server.
469
+ * @since v18.2.0
470
+ */
471
+ closeAllConnections(): void;
472
+ /**
473
+ * Closes all connections connected to this server which are not sending a request
474
+ * or waiting for a response.
475
+ * @since v18.2.0
476
+ */
477
+ closeIdleConnections(): void;
478
+ addListener(event: string, listener: (...args: any[]) => void): this;
479
+ addListener(event: "close", listener: () => void): this;
480
+ addListener(event: "connection", listener: (socket: Socket) => void): this;
481
+ addListener(event: "error", listener: (err: Error) => void): this;
482
+ addListener(event: "listening", listener: () => void): this;
483
+ addListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
484
+ addListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
485
+ addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
486
+ addListener(
487
+ event: "connect",
488
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
489
+ ): this;
490
+ addListener(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
491
+ addListener(event: "request", listener: RequestListener<Request, Response>): this;
492
+ addListener(
493
+ event: "upgrade",
494
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
495
+ ): this;
496
+ emit(event: string, ...args: any[]): boolean;
497
+ emit(event: "close"): boolean;
498
+ emit(event: "connection", socket: Socket): boolean;
499
+ emit(event: "error", err: Error): boolean;
500
+ emit(event: "listening"): boolean;
501
+ emit(
502
+ event: "checkContinue",
503
+ req: InstanceType<Request>,
504
+ res: InstanceType<Response> & { req: InstanceType<Request> },
505
+ ): boolean;
506
+ emit(
507
+ event: "checkExpectation",
508
+ req: InstanceType<Request>,
509
+ res: InstanceType<Response> & { req: InstanceType<Request> },
510
+ ): boolean;
511
+ emit(event: "clientError", err: Error, socket: stream.Duplex): boolean;
512
+ emit(event: "connect", req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer): boolean;
513
+ emit(event: "dropRequest", req: InstanceType<Request>, socket: stream.Duplex): boolean;
514
+ emit(
515
+ event: "request",
516
+ req: InstanceType<Request>,
517
+ res: InstanceType<Response> & { req: InstanceType<Request> },
518
+ ): boolean;
519
+ emit(event: "upgrade", req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer): boolean;
520
+ on(event: string, listener: (...args: any[]) => void): this;
521
+ on(event: "close", listener: () => void): this;
522
+ on(event: "connection", listener: (socket: Socket) => void): this;
523
+ on(event: "error", listener: (err: Error) => void): this;
524
+ on(event: "listening", listener: () => void): this;
525
+ on(event: "checkContinue", listener: RequestListener<Request, Response>): this;
526
+ on(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
527
+ on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
528
+ on(
529
+ event: "connect",
530
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
531
+ ): this;
532
+ on(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
533
+ on(event: "request", listener: RequestListener<Request, Response>): this;
534
+ on(
535
+ event: "upgrade",
536
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
537
+ ): this;
538
+ once(event: string, listener: (...args: any[]) => void): this;
539
+ once(event: "close", listener: () => void): this;
540
+ once(event: "connection", listener: (socket: Socket) => void): this;
541
+ once(event: "error", listener: (err: Error) => void): this;
542
+ once(event: "listening", listener: () => void): this;
543
+ once(event: "checkContinue", listener: RequestListener<Request, Response>): this;
544
+ once(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
545
+ once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
546
+ once(
547
+ event: "connect",
548
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
549
+ ): this;
550
+ once(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
551
+ once(event: "request", listener: RequestListener<Request, Response>): this;
552
+ once(
553
+ event: "upgrade",
554
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
555
+ ): this;
556
+ prependListener(event: string, listener: (...args: any[]) => void): this;
557
+ prependListener(event: "close", listener: () => void): this;
558
+ prependListener(event: "connection", listener: (socket: Socket) => void): this;
559
+ prependListener(event: "error", listener: (err: Error) => void): this;
560
+ prependListener(event: "listening", listener: () => void): this;
561
+ prependListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
562
+ prependListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
563
+ prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
564
+ prependListener(
565
+ event: "connect",
566
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
567
+ ): this;
568
+ prependListener(
569
+ event: "dropRequest",
570
+ listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
571
+ ): this;
572
+ prependListener(event: "request", listener: RequestListener<Request, Response>): this;
573
+ prependListener(
574
+ event: "upgrade",
575
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
576
+ ): this;
577
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
578
+ prependOnceListener(event: "close", listener: () => void): this;
579
+ prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
580
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
581
+ prependOnceListener(event: "listening", listener: () => void): this;
582
+ prependOnceListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
583
+ prependOnceListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
584
+ prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
585
+ prependOnceListener(
586
+ event: "connect",
587
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
588
+ ): this;
589
+ prependOnceListener(
590
+ event: "dropRequest",
591
+ listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
592
+ ): this;
593
+ prependOnceListener(event: "request", listener: RequestListener<Request, Response>): this;
594
+ prependOnceListener(
595
+ event: "upgrade",
596
+ listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
597
+ ): this;
598
+ }
599
+ /**
600
+ * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
601
+ * the perspective of the participants of an HTTP transaction.
602
+ * @since v0.1.17
603
+ */
604
+ class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
605
+ readonly req: Request;
606
+ chunkedEncoding: boolean;
607
+ shouldKeepAlive: boolean;
608
+ useChunkedEncodingByDefault: boolean;
609
+ sendDate: boolean;
610
+ /**
611
+ * @deprecated Use `writableEnded` instead.
612
+ */
613
+ finished: boolean;
614
+ /**
615
+ * Read-only. `true` if the headers were sent, otherwise `false`.
616
+ * @since v0.9.3
617
+ */
618
+ readonly headersSent: boolean;
619
+ /**
620
+ * Alias of `outgoingMessage.socket`.
621
+ * @since v0.3.0
622
+ * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
623
+ */
624
+ readonly connection: Socket | null;
625
+ /**
626
+ * Reference to the underlying socket. Usually, users will not want to access
627
+ * this property.
628
+ *
629
+ * After calling `outgoingMessage.end()`, this property will be nulled.
630
+ * @since v0.3.0
631
+ */
632
+ readonly socket: Socket | null;
633
+ constructor();
634
+ /**
635
+ * Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter.
636
+ * @since v0.9.12
637
+ * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
638
+ */
639
+ setTimeout(msecs: number, callback?: () => void): this;
640
+ /**
641
+ * Sets a single header value. If the header already exists in the to-be-sent
642
+ * headers, its value will be replaced. Use an array of strings to send multiple
643
+ * headers with the same name.
644
+ * @since v0.4.0
645
+ * @param name Header name
646
+ * @param value Header value
647
+ */
648
+ setHeader(name: string, value: number | string | readonly string[]): this;
649
+ /**
650
+ * Sets multiple header values for implicit headers. headers must be an instance of
651
+ * `Headers` or `Map`, if a header already exists in the to-be-sent headers, its
652
+ * value will be replaced.
653
+ *
654
+ * ```js
655
+ * const headers = new Headers({ foo: 'bar' });
656
+ * outgoingMessage.setHeaders(headers);
657
+ * ```
658
+ *
659
+ * or
660
+ *
661
+ * ```js
662
+ * const headers = new Map([['foo', 'bar']]);
663
+ * outgoingMessage.setHeaders(headers);
664
+ * ```
665
+ *
666
+ * When headers have been set with `outgoingMessage.setHeaders()`, they will be
667
+ * merged with any headers passed to `response.writeHead()`, with the headers passed
668
+ * to `response.writeHead()` given precedence.
669
+ *
670
+ * ```js
671
+ * // Returns content-type = text/plain
672
+ * const server = http.createServer((req, res) => {
673
+ * const headers = new Headers({ 'Content-Type': 'text/html' });
674
+ * res.setHeaders(headers);
675
+ * res.writeHead(200, { 'Content-Type': 'text/plain' });
676
+ * res.end('ok');
677
+ * });
678
+ * ```
679
+ *
680
+ * @since v19.6.0, v18.15.0
681
+ * @param name Header name
682
+ * @param value Header value
683
+ */
684
+ setHeaders(headers: Headers | Map<string, number | string | readonly string[]>): this;
685
+ /**
686
+ * Append a single header value to the header object.
687
+ *
688
+ * If the value is an array, this is equivalent to calling this method multiple
689
+ * times.
690
+ *
691
+ * If there were no previous values for the header, this is equivalent to calling `outgoingMessage.setHeader(name, value)`.
692
+ *
693
+ * Depending of the value of `options.uniqueHeaders` when the client request or the
694
+ * server were created, this will end up in the header being sent multiple times or
695
+ * a single time with values joined using `; `.
696
+ * @since v18.3.0, v16.17.0
697
+ * @param name Header name
698
+ * @param value Header value
699
+ */
700
+ appendHeader(name: string, value: string | readonly string[]): this;
701
+ /**
702
+ * Gets the value of the HTTP header with the given name. If that header is not
703
+ * set, the returned value will be `undefined`.
704
+ * @since v0.4.0
705
+ * @param name Name of header
706
+ */
707
+ getHeader(name: string): number | string | string[] | undefined;
708
+ /**
709
+ * Returns a shallow copy of the current outgoing headers. Since a shallow
710
+ * copy is used, array values may be mutated without additional calls to
711
+ * various header-related HTTP module methods. The keys of the returned
712
+ * object are the header names and the values are the respective header
713
+ * values. All header names are lowercase.
714
+ *
715
+ * The object returned by the `outgoingMessage.getHeaders()` method does
716
+ * not prototypically inherit from the JavaScript `Object`. This means that
717
+ * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`,
718
+ * and others are not defined and will not work.
719
+ *
720
+ * ```js
721
+ * outgoingMessage.setHeader('Foo', 'bar');
722
+ * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
723
+ *
724
+ * const headers = outgoingMessage.getHeaders();
725
+ * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
726
+ * ```
727
+ * @since v7.7.0
728
+ */
729
+ getHeaders(): OutgoingHttpHeaders;
730
+ /**
731
+ * Returns an array containing the unique names of the current outgoing headers.
732
+ * All names are lowercase.
733
+ * @since v7.7.0
734
+ */
735
+ getHeaderNames(): string[];
736
+ /**
737
+ * Returns `true` if the header identified by `name` is currently set in the
738
+ * outgoing headers. The header name is case-insensitive.
739
+ *
740
+ * ```js
741
+ * const hasContentType = outgoingMessage.hasHeader('content-type');
742
+ * ```
743
+ * @since v7.7.0
744
+ */
745
+ hasHeader(name: string): boolean;
746
+ /**
747
+ * Removes a header that is queued for implicit sending.
748
+ *
749
+ * ```js
750
+ * outgoingMessage.removeHeader('Content-Encoding');
751
+ * ```
752
+ * @since v0.4.0
753
+ * @param name Header name
754
+ */
755
+ removeHeader(name: string): void;
756
+ /**
757
+ * Adds HTTP trailers (headers but at the end of the message) to the message.
758
+ *
759
+ * Trailers will **only** be emitted if the message is chunked encoded. If not,
760
+ * the trailers will be silently discarded.
761
+ *
762
+ * HTTP requires the `Trailer` header to be sent to emit trailers,
763
+ * with a list of header field names in its value, e.g.
764
+ *
765
+ * ```js
766
+ * message.writeHead(200, { 'Content-Type': 'text/plain',
767
+ * 'Trailer': 'Content-MD5' });
768
+ * message.write(fileData);
769
+ * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
770
+ * message.end();
771
+ * ```
772
+ *
773
+ * Attempting to set a header field name or value that contains invalid characters
774
+ * will result in a `TypeError` being thrown.
775
+ * @since v0.3.0
776
+ */
777
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
778
+ /**
779
+ * Flushes the message headers.
780
+ *
781
+ * For efficiency reason, Node.js normally buffers the message headers
782
+ * until `outgoingMessage.end()` is called or the first chunk of message data
783
+ * is written. It then tries to pack the headers and data into a single TCP
784
+ * packet.
785
+ *
786
+ * It is usually desired (it saves a TCP round-trip), but not when the first
787
+ * data is not sent until possibly much later. `outgoingMessage.flushHeaders()` bypasses the optimization and kickstarts the message.
788
+ * @since v1.6.0
789
+ */
790
+ flushHeaders(): void;
791
+ }
792
+ /**
793
+ * This object is created internally by an HTTP server, not by the user. It is
794
+ * passed as the second parameter to the `'request'` event.
795
+ * @since v0.1.17
796
+ */
797
+ class ServerResponse<Request extends IncomingMessage = IncomingMessage> extends OutgoingMessage<Request> {
798
+ /**
799
+ * When using implicit headers (not calling `response.writeHead()` explicitly),
800
+ * this property controls the status code that will be sent to the client when
801
+ * the headers get flushed.
802
+ *
803
+ * ```js
804
+ * response.statusCode = 404;
805
+ * ```
806
+ *
807
+ * After response header was sent to the client, this property indicates the
808
+ * status code which was sent out.
809
+ * @since v0.4.0
810
+ */
811
+ statusCode: number;
812
+ /**
813
+ * When using implicit headers (not calling `response.writeHead()` explicitly),
814
+ * this property controls the status message that will be sent to the client when
815
+ * the headers get flushed. If this is left as `undefined` then the standard
816
+ * message for the status code will be used.
817
+ *
818
+ * ```js
819
+ * response.statusMessage = 'Not found';
820
+ * ```
821
+ *
822
+ * After response header was sent to the client, this property indicates the
823
+ * status message which was sent out.
824
+ * @since v0.11.8
825
+ */
826
+ statusMessage: string;
827
+ /**
828
+ * If set to `true`, Node.js will check whether the `Content-Length` header value and the size of the body, in bytes, are equal.
829
+ * Mismatching the `Content-Length` header value will result
830
+ * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
831
+ * @since v18.10.0, v16.18.0
832
+ */
833
+ strictContentLength: boolean;
834
+ constructor(req: Request);
835
+ assignSocket(socket: Socket): void;
836
+ detachSocket(socket: Socket): void;
837
+ /**
838
+ * Sends an HTTP/1.1 100 Continue message to the client, indicating that
839
+ * the request body should be sent. See the `'checkContinue'` event on `Server`.
840
+ * @since v0.3.0
841
+ */
842
+ writeContinue(callback?: () => void): void;
843
+ /**
844
+ * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,
845
+ * indicating that the user agent can preload/preconnect the linked resources.
846
+ * The `hints` is an object containing the values of headers to be sent with
847
+ * early hints message. The optional `callback` argument will be called when
848
+ * the response message has been written.
849
+ *
850
+ * **Example**
851
+ *
852
+ * ```js
853
+ * const earlyHintsLink = '</styles.css>; rel=preload; as=style';
854
+ * response.writeEarlyHints({
855
+ * 'link': earlyHintsLink,
856
+ * });
857
+ *
858
+ * const earlyHintsLinks = [
859
+ * '</styles.css>; rel=preload; as=style',
860
+ * '</scripts.js>; rel=preload; as=script',
861
+ * ];
862
+ * response.writeEarlyHints({
863
+ * 'link': earlyHintsLinks,
864
+ * 'x-trace-id': 'id for diagnostics',
865
+ * });
866
+ *
867
+ * const earlyHintsCallback = () => console.log('early hints message sent');
868
+ * response.writeEarlyHints({
869
+ * 'link': earlyHintsLinks,
870
+ * }, earlyHintsCallback);
871
+ * ```
872
+ * @since v18.11.0
873
+ * @param hints An object containing the values of headers
874
+ * @param callback Will be called when the response message has been written
875
+ */
876
+ writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
877
+ /**
878
+ * Sends a response header to the request. The status code is a 3-digit HTTP
879
+ * status code, like `404`. The last argument, `headers`, are the response headers.
880
+ * Optionally one can give a human-readable `statusMessage` as the second
881
+ * argument.
882
+ *
883
+ * `headers` may be an `Array` where the keys and values are in the same list.
884
+ * It is _not_ a list of tuples. So, the even-numbered offsets are key values,
885
+ * and the odd-numbered offsets are the associated values. The array is in the same
886
+ * format as `request.rawHeaders`.
887
+ *
888
+ * Returns a reference to the `ServerResponse`, so that calls can be chained.
889
+ *
890
+ * ```js
891
+ * const body = 'hello world';
892
+ * response
893
+ * .writeHead(200, {
894
+ * 'Content-Length': Buffer.byteLength(body),
895
+ * 'Content-Type': 'text/plain',
896
+ * })
897
+ * .end(body);
898
+ * ```
899
+ *
900
+ * This method must only be called once on a message and it must
901
+ * be called before `response.end()` is called.
902
+ *
903
+ * If `response.write()` or `response.end()` are called before calling
904
+ * this, the implicit/mutable headers will be calculated and call this function.
905
+ *
906
+ * When headers have been set with `response.setHeader()`, they will be merged
907
+ * with any headers passed to `response.writeHead()`, with the headers passed
908
+ * to `response.writeHead()` given precedence.
909
+ *
910
+ * If this method is called and `response.setHeader()` has not been called,
911
+ * it will directly write the supplied header values onto the network channel
912
+ * without caching internally, and the `response.getHeader()` on the header
913
+ * will not yield the expected result. If progressive population of headers is
914
+ * desired with potential future retrieval and modification, use `response.setHeader()` instead.
915
+ *
916
+ * ```js
917
+ * // Returns content-type = text/plain
918
+ * const server = http.createServer((req, res) => {
919
+ * res.setHeader('Content-Type', 'text/html');
920
+ * res.setHeader('X-Foo', 'bar');
921
+ * res.writeHead(200, { 'Content-Type': 'text/plain' });
922
+ * res.end('ok');
923
+ * });
924
+ * ```
925
+ *
926
+ * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
927
+ * will check whether `Content-Length` and the length of the body which has
928
+ * been transmitted are equal or not.
929
+ *
930
+ * Attempting to set a header field name or value that contains invalid characters
931
+ * will result in a \[`Error`\]\[\] being thrown.
932
+ * @since v0.1.30
933
+ */
934
+ writeHead(
935
+ statusCode: number,
936
+ statusMessage?: string,
937
+ headers?: OutgoingHttpHeaders | OutgoingHttpHeader[],
938
+ ): this;
939
+ writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
940
+ /**
941
+ * Sends a HTTP/1.1 102 Processing message to the client, indicating that
942
+ * the request body should be sent.
943
+ * @since v10.0.0
944
+ */
945
+ writeProcessing(callback?: () => void): void;
946
+ }
947
+ interface InformationEvent {
948
+ statusCode: number;
949
+ statusMessage: string;
950
+ httpVersion: string;
951
+ httpVersionMajor: number;
952
+ httpVersionMinor: number;
953
+ headers: IncomingHttpHeaders;
954
+ rawHeaders: string[];
955
+ }
956
+ /**
957
+ * This object is created internally and returned from {@link request}. It
958
+ * represents an _in-progress_ request whose header has already been queued. The
959
+ * header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, `removeHeader(name)` API. The actual header will
960
+ * be sent along with the first data chunk or when calling `request.end()`.
961
+ *
962
+ * To get the response, add a listener for `'response'` to the request object. `'response'` will be emitted from the request object when the response
963
+ * headers have been received. The `'response'` event is executed with one
964
+ * argument which is an instance of {@link IncomingMessage}.
965
+ *
966
+ * During the `'response'` event, one can add listeners to the
967
+ * response object; particularly to listen for the `'data'` event.
968
+ *
969
+ * If no `'response'` handler is added, then the response will be
970
+ * entirely discarded. However, if a `'response'` event handler is added,
971
+ * then the data from the response object **must** be consumed, either by
972
+ * calling `response.read()` whenever there is a `'readable'` event, or
973
+ * by adding a `'data'` handler, or by calling the `.resume()` method.
974
+ * Until the data is consumed, the `'end'` event will not fire. Also, until
975
+ * the data is read it will consume memory that can eventually lead to a
976
+ * 'process out of memory' error.
977
+ *
978
+ * For backward compatibility, `res` will only emit `'error'` if there is an `'error'` listener registered.
979
+ *
980
+ * Set `Content-Length` header to limit the response body size.
981
+ * If `response.strictContentLength` is set to `true`, mismatching the `Content-Length` header value will result in an `Error` being thrown,
982
+ * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
983
+ *
984
+ * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes.
985
+ * @since v0.1.17
986
+ */
987
+ class ClientRequest extends OutgoingMessage {
988
+ /**
989
+ * The `request.aborted` property will be `true` if the request has
990
+ * been aborted.
991
+ * @since v0.11.14
992
+ * @deprecated Since v17.0.0, v16.12.0 - Check `destroyed` instead.
993
+ */
994
+ aborted: boolean;
995
+ /**
996
+ * The request host.
997
+ * @since v14.5.0, v12.19.0
998
+ */
999
+ host: string;
1000
+ /**
1001
+ * The request protocol.
1002
+ * @since v14.5.0, v12.19.0
1003
+ */
1004
+ protocol: string;
1005
+ /**
1006
+ * When sending request through a keep-alive enabled agent, the underlying socket
1007
+ * might be reused. But if server closes connection at unfortunate time, client
1008
+ * may run into a 'ECONNRESET' error.
1009
+ *
1010
+ * ```js
1011
+ * import http from 'node:http';
1012
+ *
1013
+ * // Server has a 5 seconds keep-alive timeout by default
1014
+ * http
1015
+ * .createServer((req, res) => {
1016
+ * res.write('hello\n');
1017
+ * res.end();
1018
+ * })
1019
+ * .listen(3000);
1020
+ *
1021
+ * setInterval(() => {
1022
+ * // Adapting a keep-alive agent
1023
+ * http.get('http://localhost:3000', { agent }, (res) => {
1024
+ * res.on('data', (data) => {
1025
+ * // Do nothing
1026
+ * });
1027
+ * });
1028
+ * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout
1029
+ * ```
1030
+ *
1031
+ * By marking a request whether it reused socket or not, we can do
1032
+ * automatic error retry base on it.
1033
+ *
1034
+ * ```js
1035
+ * import http from 'node:http';
1036
+ * const agent = new http.Agent({ keepAlive: true });
1037
+ *
1038
+ * function retriableRequest() {
1039
+ * const req = http
1040
+ * .get('http://localhost:3000', { agent }, (res) => {
1041
+ * // ...
1042
+ * })
1043
+ * .on('error', (err) => {
1044
+ * // Check if retry is needed
1045
+ * if (req.reusedSocket &#x26;&#x26; err.code === 'ECONNRESET') {
1046
+ * retriableRequest();
1047
+ * }
1048
+ * });
1049
+ * }
1050
+ *
1051
+ * retriableRequest();
1052
+ * ```
1053
+ * @since v13.0.0, v12.16.0
1054
+ */
1055
+ reusedSocket: boolean;
1056
+ /**
1057
+ * Limits maximum response headers count. If set to 0, no limit will be applied.
1058
+ */
1059
+ maxHeadersCount: number;
1060
+ constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
1061
+ /**
1062
+ * The request method.
1063
+ * @since v0.1.97
1064
+ */
1065
+ method: string;
1066
+ /**
1067
+ * The request path.
1068
+ * @since v0.4.0
1069
+ */
1070
+ path: string;
1071
+ /**
1072
+ * Marks the request as aborting. Calling this will cause remaining data
1073
+ * in the response to be dropped and the socket to be destroyed.
1074
+ * @since v0.3.8
1075
+ * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
1076
+ */
1077
+ abort(): void;
1078
+ onSocket(socket: Socket): void;
1079
+ /**
1080
+ * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
1081
+ * @since v0.5.9
1082
+ * @param timeout Milliseconds before a request times out.
1083
+ * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event.
1084
+ */
1085
+ setTimeout(timeout: number, callback?: () => void): this;
1086
+ /**
1087
+ * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called.
1088
+ * @since v0.5.9
1089
+ */
1090
+ setNoDelay(noDelay?: boolean): void;
1091
+ /**
1092
+ * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called.
1093
+ * @since v0.5.9
1094
+ */
1095
+ setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
1096
+ /**
1097
+ * Returns an array containing the unique names of the current outgoing raw
1098
+ * headers. Header names are returned with their exact casing being set.
1099
+ *
1100
+ * ```js
1101
+ * request.setHeader('Foo', 'bar');
1102
+ * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
1103
+ *
1104
+ * const headerNames = request.getRawHeaderNames();
1105
+ * // headerNames === ['Foo', 'Set-Cookie']
1106
+ * ```
1107
+ * @since v15.13.0, v14.17.0
1108
+ */
1109
+ getRawHeaderNames(): string[];
1110
+ /**
1111
+ * @deprecated
1112
+ */
1113
+ addListener(event: "abort", listener: () => void): this;
1114
+ addListener(
1115
+ event: "connect",
1116
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1117
+ ): this;
1118
+ addListener(event: "continue", listener: () => void): this;
1119
+ addListener(event: "information", listener: (info: InformationEvent) => void): this;
1120
+ addListener(event: "response", listener: (response: IncomingMessage) => void): this;
1121
+ addListener(event: "socket", listener: (socket: Socket) => void): this;
1122
+ addListener(event: "timeout", listener: () => void): this;
1123
+ addListener(
1124
+ event: "upgrade",
1125
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1126
+ ): this;
1127
+ addListener(event: "close", listener: () => void): this;
1128
+ addListener(event: "drain", listener: () => void): this;
1129
+ addListener(event: "error", listener: (err: Error) => void): this;
1130
+ addListener(event: "finish", listener: () => void): this;
1131
+ addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
1132
+ addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
1133
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1134
+ /**
1135
+ * @deprecated
1136
+ */
1137
+ on(event: "abort", listener: () => void): this;
1138
+ on(
1139
+ event: "connect",
1140
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1141
+ ): this;
1142
+ on(event: "continue", listener: () => void): this;
1143
+ on(event: "information", listener: (info: InformationEvent) => void): this;
1144
+ on(event: "response", listener: (response: IncomingMessage) => void): this;
1145
+ on(event: "socket", listener: (socket: Socket) => void): this;
1146
+ on(event: "timeout", listener: () => void): this;
1147
+ on(
1148
+ event: "upgrade",
1149
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1150
+ ): this;
1151
+ on(event: "close", listener: () => void): this;
1152
+ on(event: "drain", listener: () => void): this;
1153
+ on(event: "error", listener: (err: Error) => void): this;
1154
+ on(event: "finish", listener: () => void): this;
1155
+ on(event: "pipe", listener: (src: stream.Readable) => void): this;
1156
+ on(event: "unpipe", listener: (src: stream.Readable) => void): this;
1157
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
1158
+ /**
1159
+ * @deprecated
1160
+ */
1161
+ once(event: "abort", listener: () => void): this;
1162
+ once(
1163
+ event: "connect",
1164
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1165
+ ): this;
1166
+ once(event: "continue", listener: () => void): this;
1167
+ once(event: "information", listener: (info: InformationEvent) => void): this;
1168
+ once(event: "response", listener: (response: IncomingMessage) => void): this;
1169
+ once(event: "socket", listener: (socket: Socket) => void): this;
1170
+ once(event: "timeout", listener: () => void): this;
1171
+ once(
1172
+ event: "upgrade",
1173
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1174
+ ): this;
1175
+ once(event: "close", listener: () => void): this;
1176
+ once(event: "drain", listener: () => void): this;
1177
+ once(event: "error", listener: (err: Error) => void): this;
1178
+ once(event: "finish", listener: () => void): this;
1179
+ once(event: "pipe", listener: (src: stream.Readable) => void): this;
1180
+ once(event: "unpipe", listener: (src: stream.Readable) => void): this;
1181
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
1182
+ /**
1183
+ * @deprecated
1184
+ */
1185
+ prependListener(event: "abort", listener: () => void): this;
1186
+ prependListener(
1187
+ event: "connect",
1188
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1189
+ ): this;
1190
+ prependListener(event: "continue", listener: () => void): this;
1191
+ prependListener(event: "information", listener: (info: InformationEvent) => void): this;
1192
+ prependListener(event: "response", listener: (response: IncomingMessage) => void): this;
1193
+ prependListener(event: "socket", listener: (socket: Socket) => void): this;
1194
+ prependListener(event: "timeout", listener: () => void): this;
1195
+ prependListener(
1196
+ event: "upgrade",
1197
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1198
+ ): this;
1199
+ prependListener(event: "close", listener: () => void): this;
1200
+ prependListener(event: "drain", listener: () => void): this;
1201
+ prependListener(event: "error", listener: (err: Error) => void): this;
1202
+ prependListener(event: "finish", listener: () => void): this;
1203
+ prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
1204
+ prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
1205
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1206
+ /**
1207
+ * @deprecated
1208
+ */
1209
+ prependOnceListener(event: "abort", listener: () => void): this;
1210
+ prependOnceListener(
1211
+ event: "connect",
1212
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1213
+ ): this;
1214
+ prependOnceListener(event: "continue", listener: () => void): this;
1215
+ prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this;
1216
+ prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this;
1217
+ prependOnceListener(event: "socket", listener: (socket: Socket) => void): this;
1218
+ prependOnceListener(event: "timeout", listener: () => void): this;
1219
+ prependOnceListener(
1220
+ event: "upgrade",
1221
+ listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
1222
+ ): this;
1223
+ prependOnceListener(event: "close", listener: () => void): this;
1224
+ prependOnceListener(event: "drain", listener: () => void): this;
1225
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
1226
+ prependOnceListener(event: "finish", listener: () => void): this;
1227
+ prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
1228
+ prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
1229
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1230
+ }
1231
+ /**
1232
+ * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to
1233
+ * access response
1234
+ * status, headers, and data.
1235
+ *
1236
+ * Different from its `socket` value which is a subclass of `stream.Duplex`, the `IncomingMessage` itself extends `stream.Readable` and is created separately to
1237
+ * parse and emit the incoming HTTP headers and payload, as the underlying socket
1238
+ * may be reused multiple times in case of keep-alive.
1239
+ * @since v0.1.17
1240
+ */
1241
+ class IncomingMessage extends stream.Readable {
1242
+ constructor(socket: Socket);
1243
+ /**
1244
+ * The `message.aborted` property will be `true` if the request has
1245
+ * been aborted.
1246
+ * @since v10.1.0
1247
+ * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from <a href="stream.html#class-streamreadable" class="type">stream.Readable</a>.
1248
+ */
1249
+ aborted: boolean;
1250
+ /**
1251
+ * In case of server request, the HTTP version sent by the client. In the case of
1252
+ * client response, the HTTP version of the connected-to server.
1253
+ * Probably either `'1.1'` or `'1.0'`.
1254
+ *
1255
+ * Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
1256
+ * @since v0.1.1
1257
+ */
1258
+ httpVersion: string;
1259
+ httpVersionMajor: number;
1260
+ httpVersionMinor: number;
1261
+ /**
1262
+ * The `message.complete` property will be `true` if a complete HTTP message has
1263
+ * been received and successfully parsed.
1264
+ *
1265
+ * This property is particularly useful as a means of determining if a client or
1266
+ * server fully transmitted a message before a connection was terminated:
1267
+ *
1268
+ * ```js
1269
+ * const req = http.request({
1270
+ * host: '127.0.0.1',
1271
+ * port: 8080,
1272
+ * method: 'POST',
1273
+ * }, (res) => {
1274
+ * res.resume();
1275
+ * res.on('end', () => {
1276
+ * if (!res.complete)
1277
+ * console.error(
1278
+ * 'The connection was terminated while the message was still being sent');
1279
+ * });
1280
+ * });
1281
+ * ```
1282
+ * @since v0.3.0
1283
+ */
1284
+ complete: boolean;
1285
+ /**
1286
+ * Alias for `message.socket`.
1287
+ * @since v0.1.90
1288
+ * @deprecated Since v16.0.0 - Use `socket`.
1289
+ */
1290
+ connection: Socket;
1291
+ /**
1292
+ * The `net.Socket` object associated with the connection.
1293
+ *
1294
+ * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the
1295
+ * client's authentication details.
1296
+ *
1297
+ * This property is guaranteed to be an instance of the `net.Socket` class,
1298
+ * a subclass of `stream.Duplex`, unless the user specified a socket
1299
+ * type other than `net.Socket` or internally nulled.
1300
+ * @since v0.3.0
1301
+ */
1302
+ socket: Socket;
1303
+ /**
1304
+ * The request/response headers object.
1305
+ *
1306
+ * Key-value pairs of header names and values. Header names are lower-cased.
1307
+ *
1308
+ * ```js
1309
+ * // Prints something like:
1310
+ * //
1311
+ * // { 'user-agent': 'curl/7.22.0',
1312
+ * // host: '127.0.0.1:8000',
1313
+ * // accept: '*' }
1314
+ * console.log(request.headers);
1315
+ * ```
1316
+ *
1317
+ * Duplicates in raw headers are handled in the following ways, depending on the
1318
+ * header name:
1319
+ *
1320
+ * * Duplicates of `age`, `authorization`, `content-length`, `content-type`, `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,
1321
+ * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`, or `user-agent` are discarded.
1322
+ * To allow duplicate values of the headers listed above to be joined,
1323
+ * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more
1324
+ * information.
1325
+ * * `set-cookie` is always an array. Duplicates are added to the array.
1326
+ * * For duplicate `cookie` headers, the values are joined together with `; `.
1327
+ * * For all other headers, the values are joined together with `, `.
1328
+ * @since v0.1.5
1329
+ */
1330
+ headers: IncomingHttpHeaders;
1331
+ /**
1332
+ * Similar to `message.headers`, but there is no join logic and the values are
1333
+ * always arrays of strings, even for headers received just once.
1334
+ *
1335
+ * ```js
1336
+ * // Prints something like:
1337
+ * //
1338
+ * // { 'user-agent': ['curl/7.22.0'],
1339
+ * // host: ['127.0.0.1:8000'],
1340
+ * // accept: ['*'] }
1341
+ * console.log(request.headersDistinct);
1342
+ * ```
1343
+ * @since v18.3.0, v16.17.0
1344
+ */
1345
+ headersDistinct: NodeJS.Dict<string[]>;
1346
+ /**
1347
+ * The raw request/response headers list exactly as they were received.
1348
+ *
1349
+ * The keys and values are in the same list. It is _not_ a
1350
+ * list of tuples. So, the even-numbered offsets are key values, and the
1351
+ * odd-numbered offsets are the associated values.
1352
+ *
1353
+ * Header names are not lowercased, and duplicates are not merged.
1354
+ *
1355
+ * ```js
1356
+ * // Prints something like:
1357
+ * //
1358
+ * // [ 'user-agent',
1359
+ * // 'this is invalid because there can be only one',
1360
+ * // 'User-Agent',
1361
+ * // 'curl/7.22.0',
1362
+ * // 'Host',
1363
+ * // '127.0.0.1:8000',
1364
+ * // 'ACCEPT',
1365
+ * // '*' ]
1366
+ * console.log(request.rawHeaders);
1367
+ * ```
1368
+ * @since v0.11.6
1369
+ */
1370
+ rawHeaders: string[];
1371
+ /**
1372
+ * The request/response trailers object. Only populated at the `'end'` event.
1373
+ * @since v0.3.0
1374
+ */
1375
+ trailers: NodeJS.Dict<string>;
1376
+ /**
1377
+ * Similar to `message.trailers`, but there is no join logic and the values are
1378
+ * always arrays of strings, even for headers received just once.
1379
+ * Only populated at the `'end'` event.
1380
+ * @since v18.3.0, v16.17.0
1381
+ */
1382
+ trailersDistinct: NodeJS.Dict<string[]>;
1383
+ /**
1384
+ * The raw request/response trailer keys and values exactly as they were
1385
+ * received. Only populated at the `'end'` event.
1386
+ * @since v0.11.6
1387
+ */
1388
+ rawTrailers: string[];
1389
+ /**
1390
+ * Calls `message.socket.setTimeout(msecs, callback)`.
1391
+ * @since v0.5.9
1392
+ */
1393
+ setTimeout(msecs: number, callback?: () => void): this;
1394
+ /**
1395
+ * **Only valid for request obtained from {@link Server}.**
1396
+ *
1397
+ * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`.
1398
+ * @since v0.1.1
1399
+ */
1400
+ method?: string | undefined;
1401
+ /**
1402
+ * **Only valid for request obtained from {@link Server}.**
1403
+ *
1404
+ * Request URL string. This contains only the URL that is present in the actual
1405
+ * HTTP request. Take the following request:
1406
+ *
1407
+ * ```http
1408
+ * GET /status?name=ryan HTTP/1.1
1409
+ * Accept: text/plain
1410
+ * ```
1411
+ *
1412
+ * To parse the URL into its parts:
1413
+ *
1414
+ * ```js
1415
+ * new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);
1416
+ * ```
1417
+ *
1418
+ * When `request.url` is `'/status?name=ryan'` and `process.env.HOST` is undefined:
1419
+ *
1420
+ * ```console
1421
+ * $ node
1422
+ * > new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);
1423
+ * URL {
1424
+ * href: 'http://localhost/status?name=ryan',
1425
+ * origin: 'http://localhost',
1426
+ * protocol: 'http:',
1427
+ * username: '',
1428
+ * password: '',
1429
+ * host: 'localhost',
1430
+ * hostname: 'localhost',
1431
+ * port: '',
1432
+ * pathname: '/status',
1433
+ * search: '?name=ryan',
1434
+ * searchParams: URLSearchParams { 'name' => 'ryan' },
1435
+ * hash: ''
1436
+ * }
1437
+ * ```
1438
+ *
1439
+ * Ensure that you set `process.env.HOST` to the server's host name, or consider replacing this part entirely. If using `req.headers.host`, ensure proper
1440
+ * validation is used, as clients may specify a custom `Host` header.
1441
+ * @since v0.1.90
1442
+ */
1443
+ url?: string | undefined;
1444
+ /**
1445
+ * **Only valid for response obtained from {@link ClientRequest}.**
1446
+ *
1447
+ * The 3-digit HTTP response status code. E.G. `404`.
1448
+ * @since v0.1.1
1449
+ */
1450
+ statusCode?: number | undefined;
1451
+ /**
1452
+ * **Only valid for response obtained from {@link ClientRequest}.**
1453
+ *
1454
+ * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`.
1455
+ * @since v0.11.10
1456
+ */
1457
+ statusMessage?: string | undefined;
1458
+ /**
1459
+ * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error` is provided, an `'error'` event is emitted on the socket and `error` is passed
1460
+ * as an argument to any listeners on the event.
1461
+ * @since v0.3.0
1462
+ */
1463
+ destroy(error?: Error): this;
1464
+ }
1465
+ interface AgentOptions extends NodeJS.PartialOptions<TcpSocketConnectOpts> {
1466
+ /**
1467
+ * Keep sockets around in a pool to be used by other requests in the future. Default = false
1468
+ */
1469
+ keepAlive?: boolean | undefined;
1470
+ /**
1471
+ * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
1472
+ * Only relevant if keepAlive is set to true.
1473
+ */
1474
+ keepAliveMsecs?: number | undefined;
1475
+ /**
1476
+ * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
1477
+ */
1478
+ maxSockets?: number | undefined;
1479
+ /**
1480
+ * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
1481
+ */
1482
+ maxTotalSockets?: number | undefined;
1483
+ /**
1484
+ * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
1485
+ */
1486
+ maxFreeSockets?: number | undefined;
1487
+ /**
1488
+ * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
1489
+ */
1490
+ timeout?: number | undefined;
1491
+ /**
1492
+ * Scheduling strategy to apply when picking the next free socket to use.
1493
+ * @default `lifo`
1494
+ */
1495
+ scheduling?: "fifo" | "lifo" | undefined;
1496
+ }
1497
+ /**
1498
+ * An `Agent` is responsible for managing connection persistence
1499
+ * and reuse for HTTP clients. It maintains a queue of pending requests
1500
+ * for a given host and port, reusing a single socket connection for each
1501
+ * until the queue is empty, at which time the socket is either destroyed
1502
+ * or put into a pool where it is kept to be used again for requests to the
1503
+ * same host and port. Whether it is destroyed or pooled depends on the `keepAlive` `option`.
1504
+ *
1505
+ * Pooled connections have TCP Keep-Alive enabled for them, but servers may
1506
+ * still close idle connections, in which case they will be removed from the
1507
+ * pool and a new connection will be made when a new HTTP request is made for
1508
+ * that host and port. Servers may also refuse to allow multiple requests
1509
+ * over the same connection, in which case the connection will have to be
1510
+ * remade for every request and cannot be pooled. The `Agent` will still make
1511
+ * the requests to that server, but each one will occur over a new connection.
1512
+ *
1513
+ * When a connection is closed by the client or the server, it is removed
1514
+ * from the pool. Any unused sockets in the pool will be unrefed so as not
1515
+ * to keep the Node.js process running when there are no outstanding requests.
1516
+ * (see `socket.unref()`).
1517
+ *
1518
+ * It is good practice, to `destroy()` an `Agent` instance when it is no
1519
+ * longer in use, because unused sockets consume OS resources.
1520
+ *
1521
+ * Sockets are removed from an agent when the socket emits either
1522
+ * a `'close'` event or an `'agentRemove'` event. When intending to keep one
1523
+ * HTTP request open for a long time without keeping it in the agent, something
1524
+ * like the following may be done:
1525
+ *
1526
+ * ```js
1527
+ * http.get(options, (res) => {
1528
+ * // Do stuff
1529
+ * }).on('socket', (socket) => {
1530
+ * socket.emit('agentRemove');
1531
+ * });
1532
+ * ```
1533
+ *
1534
+ * An agent may also be used for an individual request. By providing `{agent: false}` as an option to the `http.get()` or `http.request()` functions, a one-time use `Agent` with default options
1535
+ * will be used
1536
+ * for the client connection.
1537
+ *
1538
+ * `agent:false`:
1539
+ *
1540
+ * ```js
1541
+ * http.get({
1542
+ * hostname: 'localhost',
1543
+ * port: 80,
1544
+ * path: '/',
1545
+ * agent: false, // Create a new agent just for this one request
1546
+ * }, (res) => {
1547
+ * // Do stuff with response
1548
+ * });
1549
+ * ```
1550
+ *
1551
+ * `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v22.x/api/net.html#socketconnectoptions-connectlistener) are also supported.
1552
+ *
1553
+ * To configure any of them, a custom {@link Agent} instance must be created.
1554
+ *
1555
+ * ```js
1556
+ * import http from 'node:http';
1557
+ * const keepAliveAgent = new http.Agent({ keepAlive: true });
1558
+ * options.agent = keepAliveAgent;
1559
+ * http.request(options, onResponseCallback)
1560
+ * ```
1561
+ * @since v0.3.4
1562
+ */
1563
+ class Agent extends EventEmitter {
1564
+ /**
1565
+ * By default set to 256. For agents with `keepAlive` enabled, this
1566
+ * sets the maximum number of sockets that will be left open in the free
1567
+ * state.
1568
+ * @since v0.11.7
1569
+ */
1570
+ maxFreeSockets: number;
1571
+ /**
1572
+ * By default set to `Infinity`. Determines how many concurrent sockets the agent
1573
+ * can have open per origin. Origin is the returned value of `agent.getName()`.
1574
+ * @since v0.3.6
1575
+ */
1576
+ maxSockets: number;
1577
+ /**
1578
+ * By default set to `Infinity`. Determines how many concurrent sockets the agent
1579
+ * can have open. Unlike `maxSockets`, this parameter applies across all origins.
1580
+ * @since v14.5.0, v12.19.0
1581
+ */
1582
+ maxTotalSockets: number;
1583
+ /**
1584
+ * An object which contains arrays of sockets currently awaiting use by
1585
+ * the agent when `keepAlive` is enabled. Do not modify.
1586
+ *
1587
+ * Sockets in the `freeSockets` list will be automatically destroyed and
1588
+ * removed from the array on `'timeout'`.
1589
+ * @since v0.11.4
1590
+ */
1591
+ readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
1592
+ /**
1593
+ * An object which contains arrays of sockets currently in use by the
1594
+ * agent. Do not modify.
1595
+ * @since v0.3.6
1596
+ */
1597
+ readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
1598
+ /**
1599
+ * An object which contains queues of requests that have not yet been assigned to
1600
+ * sockets. Do not modify.
1601
+ * @since v0.5.9
1602
+ */
1603
+ readonly requests: NodeJS.ReadOnlyDict<ClientRequest[]>;
1604
+ constructor(opts?: AgentOptions);
1605
+ /**
1606
+ * Destroy any sockets that are currently in use by the agent.
1607
+ *
1608
+ * It is usually not necessary to do this. However, if using an
1609
+ * agent with `keepAlive` enabled, then it is best to explicitly shut down
1610
+ * the agent when it is no longer needed. Otherwise,
1611
+ * sockets might stay open for quite a long time before the server
1612
+ * terminates them.
1613
+ * @since v0.11.4
1614
+ */
1615
+ destroy(): void;
1616
+ /**
1617
+ * Produces a socket/stream to be used for HTTP requests.
1618
+ *
1619
+ * By default, this function is the same as `net.createConnection()`. However,
1620
+ * custom agents may override this method in case greater flexibility is desired.
1621
+ *
1622
+ * A socket/stream can be supplied in one of two ways: by returning the
1623
+ * socket/stream from this function, or by passing the socket/stream to `callback`.
1624
+ *
1625
+ * This method is guaranteed to return an instance of the `net.Socket` class,
1626
+ * a subclass of `stream.Duplex`, unless the user specifies a socket
1627
+ * type other than `net.Socket`.
1628
+ *
1629
+ * `callback` has a signature of `(err, stream)`.
1630
+ * @since v0.11.4
1631
+ * @param options Options containing connection details. Check `createConnection` for the format of the options
1632
+ * @param callback Callback function that receives the created socket
1633
+ */
1634
+ createConnection(
1635
+ options: ClientRequestArgs,
1636
+ callback?: (err: Error | null, stream: stream.Duplex) => void,
1637
+ ): stream.Duplex | null | undefined;
1638
+ /**
1639
+ * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1640
+ *
1641
+ * ```js
1642
+ * socket.setKeepAlive(true, this.keepAliveMsecs);
1643
+ * socket.unref();
1644
+ * return true;
1645
+ * ```
1646
+ *
1647
+ * This method can be overridden by a particular `Agent` subclass. If this
1648
+ * method returns a falsy value, the socket will be destroyed instead of persisting
1649
+ * it for use with the next request.
1650
+ *
1651
+ * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
1652
+ * @since v8.1.0
1653
+ */
1654
+ keepSocketAlive(socket: stream.Duplex): void;
1655
+ /**
1656
+ * Called when `socket` is attached to `request` after being persisted because of
1657
+ * the keep-alive options. Default behavior is to:
1658
+ *
1659
+ * ```js
1660
+ * socket.ref();
1661
+ * ```
1662
+ *
1663
+ * This method can be overridden by a particular `Agent` subclass.
1664
+ *
1665
+ * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
1666
+ * @since v8.1.0
1667
+ */
1668
+ reuseSocket(socket: stream.Duplex, request: ClientRequest): void;
1669
+ /**
1670
+ * Get a unique name for a set of request options, to determine whether a
1671
+ * connection can be reused. For an HTTP agent, this returns`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent,
1672
+ * the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options
1673
+ * that determine socket reusability.
1674
+ * @since v0.11.4
1675
+ * @param options A set of options providing information for name generation
1676
+ */
1677
+ getName(options?: ClientRequestArgs): string;
1678
+ }
1679
+ const METHODS: string[];
1680
+ const STATUS_CODES: {
1681
+ [errorCode: number]: string | undefined;
1682
+ [errorCode: string]: string | undefined;
1683
+ };
1684
+ /**
1685
+ * Returns a new instance of {@link Server}.
1686
+ *
1687
+ * The `requestListener` is a function which is automatically
1688
+ * added to the `'request'` event.
1689
+ *
1690
+ * ```js
1691
+ * import http from 'node:http';
1692
+ *
1693
+ * // Create a local server to receive data from
1694
+ * const server = http.createServer((req, res) => {
1695
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
1696
+ * res.end(JSON.stringify({
1697
+ * data: 'Hello World!',
1698
+ * }));
1699
+ * });
1700
+ *
1701
+ * server.listen(8000);
1702
+ * ```
1703
+ *
1704
+ * ```js
1705
+ * import http from 'node:http';
1706
+ *
1707
+ * // Create a local server to receive data from
1708
+ * const server = http.createServer();
1709
+ *
1710
+ * // Listen to the request event
1711
+ * server.on('request', (request, res) => {
1712
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
1713
+ * res.end(JSON.stringify({
1714
+ * data: 'Hello World!',
1715
+ * }));
1716
+ * });
1717
+ *
1718
+ * server.listen(8000);
1719
+ * ```
1720
+ * @since v0.1.13
1721
+ */
1722
+ function createServer<
1723
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
1724
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
1725
+ >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1726
+ function createServer<
1727
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
1728
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
1729
+ >(
1730
+ options: ServerOptions<Request, Response>,
1731
+ requestListener?: RequestListener<Request, Response>,
1732
+ ): Server<Request, Response>;
1733
+ // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
1734
+ // create interface RequestOptions would make the naming more clear to developers
1735
+ interface RequestOptions extends ClientRequestArgs {}
1736
+ /**
1737
+ * `options` in `socket.connect()` are also supported.
1738
+ *
1739
+ * Node.js maintains several connections per server to make HTTP requests.
1740
+ * This function allows one to transparently issue requests.
1741
+ *
1742
+ * `url` can be a string or a `URL` object. If `url` is a
1743
+ * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
1744
+ *
1745
+ * If both `url` and `options` are specified, the objects are merged, with the `options` properties taking precedence.
1746
+ *
1747
+ * The optional `callback` parameter will be added as a one-time listener for
1748
+ * the `'response'` event.
1749
+ *
1750
+ * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to
1751
+ * upload a file with a POST request, then write to the `ClientRequest` object.
1752
+ *
1753
+ * ```js
1754
+ * import http from 'node:http';
1755
+ * import { Buffer } from 'node:buffer';
1756
+ *
1757
+ * const postData = JSON.stringify({
1758
+ * 'msg': 'Hello World!',
1759
+ * });
1760
+ *
1761
+ * const options = {
1762
+ * hostname: 'www.google.com',
1763
+ * port: 80,
1764
+ * path: '/upload',
1765
+ * method: 'POST',
1766
+ * headers: {
1767
+ * 'Content-Type': 'application/json',
1768
+ * 'Content-Length': Buffer.byteLength(postData),
1769
+ * },
1770
+ * };
1771
+ *
1772
+ * const req = http.request(options, (res) => {
1773
+ * console.log(`STATUS: ${res.statusCode}`);
1774
+ * console.log(`HEADERS: ${JSON.stringify(res.headers)}`);
1775
+ * res.setEncoding('utf8');
1776
+ * res.on('data', (chunk) => {
1777
+ * console.log(`BODY: ${chunk}`);
1778
+ * });
1779
+ * res.on('end', () => {
1780
+ * console.log('No more data in response.');
1781
+ * });
1782
+ * });
1783
+ *
1784
+ * req.on('error', (e) => {
1785
+ * console.error(`problem with request: ${e.message}`);
1786
+ * });
1787
+ *
1788
+ * // Write data to request body
1789
+ * req.write(postData);
1790
+ * req.end();
1791
+ * ```
1792
+ *
1793
+ * In the example `req.end()` was called. With `http.request()` one
1794
+ * must always call `req.end()` to signify the end of the request -
1795
+ * even if there is no data being written to the request body.
1796
+ *
1797
+ * If any error is encountered during the request (be that with DNS resolution,
1798
+ * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted
1799
+ * on the returned request object. As with all `'error'` events, if no listeners
1800
+ * are registered the error will be thrown.
1801
+ *
1802
+ * There are a few special headers that should be noted.
1803
+ *
1804
+ * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to
1805
+ * the server should be persisted until the next request.
1806
+ * * Sending a 'Content-Length' header will disable the default chunked encoding.
1807
+ * * Sending an 'Expect' header will immediately send the request headers.
1808
+ * Usually, when sending 'Expect: 100-continue', both a timeout and a listener
1809
+ * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more
1810
+ * information.
1811
+ * * Sending an Authorization header will override using the `auth` option
1812
+ * to compute basic authentication.
1813
+ *
1814
+ * Example using a `URL` as `options`:
1815
+ *
1816
+ * ```js
1817
+ * const options = new URL('http://abc:xyz@example.com');
1818
+ *
1819
+ * const req = http.request(options, (res) => {
1820
+ * // ...
1821
+ * });
1822
+ * ```
1823
+ *
1824
+ * In a successful request, the following events will be emitted in the following
1825
+ * order:
1826
+ *
1827
+ * * `'socket'`
1828
+ * * `'response'`
1829
+ * * `'data'` any number of times, on the `res` object
1830
+ * (`'data'` will not be emitted at all if the response body is empty, for
1831
+ * instance, in most redirects)
1832
+ * * `'end'` on the `res` object
1833
+ * * `'close'`
1834
+ *
1835
+ * In the case of a connection error, the following events will be emitted:
1836
+ *
1837
+ * * `'socket'`
1838
+ * * `'error'`
1839
+ * * `'close'`
1840
+ *
1841
+ * In the case of a premature connection close before the response is received,
1842
+ * the following events will be emitted in the following order:
1843
+ *
1844
+ * * `'socket'`
1845
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`
1846
+ * * `'close'`
1847
+ *
1848
+ * In the case of a premature connection close after the response is received,
1849
+ * the following events will be emitted in the following order:
1850
+ *
1851
+ * * `'socket'`
1852
+ * * `'response'`
1853
+ * * `'data'` any number of times, on the `res` object
1854
+ * * (connection closed here)
1855
+ * * `'aborted'` on the `res` object
1856
+ * * `'close'`
1857
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`
1858
+ * * `'close'` on the `res` object
1859
+ *
1860
+ * If `req.destroy()` is called before a socket is assigned, the following
1861
+ * events will be emitted in the following order:
1862
+ *
1863
+ * * (`req.destroy()` called here)
1864
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1865
+ * * `'close'`
1866
+ *
1867
+ * If `req.destroy()` is called before the connection succeeds, the following
1868
+ * events will be emitted in the following order:
1869
+ *
1870
+ * * `'socket'`
1871
+ * * (`req.destroy()` called here)
1872
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1873
+ * * `'close'`
1874
+ *
1875
+ * If `req.destroy()` is called after the response is received, the following
1876
+ * events will be emitted in the following order:
1877
+ *
1878
+ * * `'socket'`
1879
+ * * `'response'`
1880
+ * * `'data'` any number of times, on the `res` object
1881
+ * * (`req.destroy()` called here)
1882
+ * * `'aborted'` on the `res` object
1883
+ * * `'close'`
1884
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
1885
+ * * `'close'` on the `res` object
1886
+ *
1887
+ * If `req.abort()` is called before a socket is assigned, the following
1888
+ * events will be emitted in the following order:
1889
+ *
1890
+ * * (`req.abort()` called here)
1891
+ * * `'abort'`
1892
+ * * `'close'`
1893
+ *
1894
+ * If `req.abort()` is called before the connection succeeds, the following
1895
+ * events will be emitted in the following order:
1896
+ *
1897
+ * * `'socket'`
1898
+ * * (`req.abort()` called here)
1899
+ * * `'abort'`
1900
+ * * `'error'` with an error with message `'Error: socket hang up'` and code `'ECONNRESET'`
1901
+ * * `'close'`
1902
+ *
1903
+ * If `req.abort()` is called after the response is received, the following
1904
+ * events will be emitted in the following order:
1905
+ *
1906
+ * * `'socket'`
1907
+ * * `'response'`
1908
+ * * `'data'` any number of times, on the `res` object
1909
+ * * (`req.abort()` called here)
1910
+ * * `'abort'`
1911
+ * * `'aborted'` on the `res` object
1912
+ * * `'error'` on the `res` object with an error with message `'Error: aborted'` and code `'ECONNRESET'`.
1913
+ * * `'close'`
1914
+ * * `'close'` on the `res` object
1915
+ *
1916
+ * Setting the `timeout` option or using the `setTimeout()` function will
1917
+ * not abort the request or do anything besides add a `'timeout'` event.
1918
+ *
1919
+ * Passing an `AbortSignal` and then calling `abort()` on the corresponding `AbortController` will behave the same way as calling `.destroy()` on the
1920
+ * request. Specifically, the `'error'` event will be emitted with an error with
1921
+ * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'` and the `cause`, if one was provided.
1922
+ * @since v0.3.6
1923
+ */
1924
+ function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1925
+ function request(
1926
+ url: string | URL,
1927
+ options: RequestOptions,
1928
+ callback?: (res: IncomingMessage) => void,
1929
+ ): ClientRequest;
1930
+ /**
1931
+ * Since most requests are GET requests without bodies, Node.js provides this
1932
+ * convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()` automatically. The callback must take care to
1933
+ * consume the response
1934
+ * data for reasons stated in {@link ClientRequest} section.
1935
+ *
1936
+ * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}.
1937
+ *
1938
+ * JSON fetching example:
1939
+ *
1940
+ * ```js
1941
+ * http.get('http://localhost:8000/', (res) => {
1942
+ * const { statusCode } = res;
1943
+ * const contentType = res.headers['content-type'];
1944
+ *
1945
+ * let error;
1946
+ * // Any 2xx status code signals a successful response but
1947
+ * // here we're only checking for 200.
1948
+ * if (statusCode !== 200) {
1949
+ * error = new Error('Request Failed.\n' +
1950
+ * `Status Code: ${statusCode}`);
1951
+ * } else if (!/^application\/json/.test(contentType)) {
1952
+ * error = new Error('Invalid content-type.\n' +
1953
+ * `Expected application/json but received ${contentType}`);
1954
+ * }
1955
+ * if (error) {
1956
+ * console.error(error.message);
1957
+ * // Consume response data to free up memory
1958
+ * res.resume();
1959
+ * return;
1960
+ * }
1961
+ *
1962
+ * res.setEncoding('utf8');
1963
+ * let rawData = '';
1964
+ * res.on('data', (chunk) => { rawData += chunk; });
1965
+ * res.on('end', () => {
1966
+ * try {
1967
+ * const parsedData = JSON.parse(rawData);
1968
+ * console.log(parsedData);
1969
+ * } catch (e) {
1970
+ * console.error(e.message);
1971
+ * }
1972
+ * });
1973
+ * }).on('error', (e) => {
1974
+ * console.error(`Got error: ${e.message}`);
1975
+ * });
1976
+ *
1977
+ * // Create a local server to receive data from
1978
+ * const server = http.createServer((req, res) => {
1979
+ * res.writeHead(200, { 'Content-Type': 'application/json' });
1980
+ * res.end(JSON.stringify({
1981
+ * data: 'Hello World!',
1982
+ * }));
1983
+ * });
1984
+ *
1985
+ * server.listen(8000);
1986
+ * ```
1987
+ * @since v0.3.6
1988
+ * @param options Accepts the same `options` as {@link request}, with the method set to GET by default.
1989
+ */
1990
+ function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
1991
+ function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
1992
+ /**
1993
+ * Performs the low-level validations on the provided `name` that are done when `res.setHeader(name, value)` is called.
1994
+ *
1995
+ * Passing illegal value as `name` will result in a `TypeError` being thrown,
1996
+ * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
1997
+ *
1998
+ * It is not necessary to use this method before passing headers to an HTTP request
1999
+ * or response. The HTTP module will automatically validate such headers.
2000
+ *
2001
+ * Example:
2002
+ *
2003
+ * ```js
2004
+ * import { validateHeaderName } from 'node:http';
2005
+ *
2006
+ * try {
2007
+ * validateHeaderName('');
2008
+ * } catch (err) {
2009
+ * console.error(err instanceof TypeError); // --> true
2010
+ * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'
2011
+ * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]'
2012
+ * }
2013
+ * ```
2014
+ * @since v14.3.0
2015
+ * @param [label='Header name'] Label for error message.
2016
+ */
2017
+ function validateHeaderName(name: string): void;
2018
+ /**
2019
+ * Performs the low-level validations on the provided `value` that are done when `res.setHeader(name, value)` is called.
2020
+ *
2021
+ * Passing illegal value as `value` will result in a `TypeError` being thrown.
2022
+ *
2023
+ * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
2024
+ * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
2025
+ *
2026
+ * It is not necessary to use this method before passing headers to an HTTP request
2027
+ * or response. The HTTP module will automatically validate such headers.
2028
+ *
2029
+ * Examples:
2030
+ *
2031
+ * ```js
2032
+ * import { validateHeaderValue } from 'node:http';
2033
+ *
2034
+ * try {
2035
+ * validateHeaderValue('x-my-header', undefined);
2036
+ * } catch (err) {
2037
+ * console.error(err instanceof TypeError); // --> true
2038
+ * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true
2039
+ * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"'
2040
+ * }
2041
+ *
2042
+ * try {
2043
+ * validateHeaderValue('x-my-header', 'oʊmɪɡə');
2044
+ * } catch (err) {
2045
+ * console.error(err instanceof TypeError); // --> true
2046
+ * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true
2047
+ * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]'
2048
+ * }
2049
+ * ```
2050
+ * @since v14.3.0
2051
+ * @param name Header name
2052
+ * @param value Header value
2053
+ */
2054
+ function validateHeaderValue(name: string, value: string): void;
2055
+ /**
2056
+ * Set the maximum number of idle HTTP parsers.
2057
+ * @since v18.8.0, v16.18.0
2058
+ * @param [max=1000]
2059
+ */
2060
+ function setMaxIdleHTTPParsers(max: number): void;
2061
+ /**
2062
+ * Global instance of `Agent` which is used as the default for all HTTP client
2063
+ * requests. Diverges from a default `Agent` configuration by having `keepAlive`
2064
+ * enabled and a `timeout` of 5 seconds.
2065
+ * @since v0.5.9
2066
+ */
2067
+ let globalAgent: Agent;
2068
+ /**
2069
+ * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
2070
+ * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
2071
+ */
2072
+ const maxHeaderSize: number;
2073
+ /**
2074
+ * A browser-compatible implementation of `WebSocket`.
2075
+ * @since v22.5.0
2076
+ */
2077
+ const WebSocket: typeof import("undici-types").WebSocket;
2078
+ /**
2079
+ * @since v22.5.0
2080
+ */
2081
+ const CloseEvent: typeof import("undici-types").CloseEvent;
2082
+ /**
2083
+ * @since v22.5.0
2084
+ */
2085
+ const MessageEvent: typeof import("undici-types").MessageEvent;
2086
+ }
2087
+ declare module "node:http" {
2088
+ export * from "http";
2089
+ }