happy-dom 8.9.0 → 9.0.1

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.

Potentially problematic release.


This version of happy-dom might be problematic. Click here for more details.

Files changed (360) hide show
  1. package/README.md +2 -2
  2. package/lib/cookie/CookieJar.js +1 -1
  3. package/lib/cookie/CookieJar.js.map +1 -1
  4. package/lib/dom-token-list/DOMTokenList.js +24 -20
  5. package/lib/dom-token-list/DOMTokenList.js.map +1 -1
  6. package/lib/event/EventTarget.js +6 -3
  7. package/lib/event/EventTarget.js.map +1 -1
  8. package/lib/exception/DOMExceptionNameEnum.d.ts +5 -1
  9. package/lib/exception/DOMExceptionNameEnum.js +4 -0
  10. package/lib/exception/DOMExceptionNameEnum.js.map +1 -1
  11. package/lib/fetch/AbortController.d.ts +19 -0
  12. package/lib/fetch/AbortController.js +30 -0
  13. package/lib/fetch/AbortController.js.map +1 -0
  14. package/lib/fetch/AbortSignal.d.ts +25 -0
  15. package/lib/fetch/AbortSignal.js +51 -0
  16. package/lib/fetch/AbortSignal.js.map +1 -0
  17. package/lib/fetch/Fetch.d.ts +117 -0
  18. package/lib/fetch/Fetch.js +530 -0
  19. package/lib/fetch/Fetch.js.map +1 -0
  20. package/lib/fetch/Headers.d.ts +81 -3
  21. package/lib/fetch/Headers.js +139 -24
  22. package/lib/fetch/Headers.js.map +1 -1
  23. package/lib/fetch/Request.d.ts +56 -32
  24. package/lib/fetch/Request.js +165 -110
  25. package/lib/fetch/Request.js.map +1 -1
  26. package/lib/fetch/{ResourceFetchHandler.d.ts → ResourceFetch.d.ts} +1 -1
  27. package/lib/fetch/{ResourceFetchHandler.js → ResourceFetch.js} +5 -5
  28. package/lib/fetch/ResourceFetch.js.map +1 -0
  29. package/lib/fetch/Response.d.ts +60 -26
  30. package/lib/fetch/Response.js +196 -104
  31. package/lib/fetch/Response.js.map +1 -1
  32. package/lib/fetch/data-uri/DataURIParser.d.ts +20 -0
  33. package/lib/fetch/data-uri/DataURIParser.js +60 -0
  34. package/lib/fetch/data-uri/DataURIParser.js.map +1 -0
  35. package/lib/fetch/multipart/MultipartFormDataParser.d.ts +40 -0
  36. package/lib/fetch/multipart/MultipartFormDataParser.js +81 -0
  37. package/lib/fetch/multipart/MultipartFormDataParser.js.map +1 -0
  38. package/lib/fetch/multipart/MultipartReader.d.ts +49 -0
  39. package/lib/fetch/multipart/MultipartReader.js +178 -0
  40. package/lib/fetch/multipart/MultipartReader.js.map +1 -0
  41. package/lib/fetch/types/IHeaders.d.ts +71 -0
  42. package/lib/fetch/{IHeaders.js.map → types/IHeaders.js.map} +1 -1
  43. package/lib/fetch/types/IHeadersInit.js.map +1 -0
  44. package/lib/fetch/types/IRequest.d.ts +60 -0
  45. package/lib/fetch/{IRequest.js.map → types/IRequest.js.map} +1 -1
  46. package/lib/fetch/types/IRequestBody.d.ts +7 -0
  47. package/lib/fetch/{IBody.js → types/IRequestBody.js} +1 -1
  48. package/lib/fetch/types/IRequestBody.js.map +1 -0
  49. package/lib/fetch/types/IRequestCredentials.d.ts +2 -0
  50. package/lib/fetch/types/IRequestCredentials.js +3 -0
  51. package/lib/fetch/types/IRequestCredentials.js.map +1 -0
  52. package/lib/fetch/{RequestInfo.d.ts → types/IRequestInfo.d.ts} +2 -2
  53. package/lib/fetch/types/IRequestInfo.js +3 -0
  54. package/lib/fetch/types/IRequestInfo.js.map +1 -0
  55. package/lib/fetch/types/IRequestInit.d.ts +21 -0
  56. package/lib/fetch/types/IRequestInit.js.map +1 -0
  57. package/lib/fetch/types/IRequestRedirect.d.ts +2 -0
  58. package/lib/fetch/types/IRequestRedirect.js +3 -0
  59. package/lib/fetch/types/IRequestRedirect.js.map +1 -0
  60. package/lib/fetch/types/IRequestReferrerPolicy.d.ts +2 -0
  61. package/lib/fetch/types/IRequestReferrerPolicy.js +3 -0
  62. package/lib/fetch/types/IRequestReferrerPolicy.js.map +1 -0
  63. package/lib/fetch/types/IResponse.d.ts +27 -0
  64. package/lib/fetch/{IResponse.js.map → types/IResponse.js.map} +1 -1
  65. package/lib/fetch/types/IResponseBody.d.ts +7 -0
  66. package/lib/fetch/types/IResponseBody.js +3 -0
  67. package/lib/fetch/types/IResponseBody.js.map +1 -0
  68. package/lib/fetch/types/IResponseInit.d.ts +9 -0
  69. package/lib/fetch/types/IResponseInit.js.map +1 -0
  70. package/lib/fetch/utilities/FetchBodyUtility.d.ts +44 -0
  71. package/lib/fetch/utilities/FetchBodyUtility.js +156 -0
  72. package/lib/fetch/utilities/FetchBodyUtility.js.map +1 -0
  73. package/lib/fetch/utilities/FetchCORSUtility.d.ts +12 -0
  74. package/lib/fetch/utilities/FetchCORSUtility.js +20 -0
  75. package/lib/fetch/utilities/FetchCORSUtility.js.map +1 -0
  76. package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts +12 -0
  77. package/lib/fetch/utilities/FetchRequestHeaderUtility.js +45 -0
  78. package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -0
  79. package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts +55 -0
  80. package/lib/fetch/utilities/FetchRequestReferrerUtility.js +194 -0
  81. package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -0
  82. package/lib/fetch/utilities/FetchRequestValidationUtility.d.ts +38 -0
  83. package/lib/fetch/utilities/FetchRequestValidationUtility.js +70 -0
  84. package/lib/fetch/utilities/FetchRequestValidationUtility.js.map +1 -0
  85. package/lib/file/Blob.d.ts +2 -2
  86. package/lib/file/Blob.js +1 -1
  87. package/lib/file/Blob.js.map +1 -1
  88. package/lib/file/File.d.ts +2 -1
  89. package/lib/file/File.js.map +1 -1
  90. package/lib/form-data/FormData.d.ts +98 -0
  91. package/lib/form-data/FormData.js +212 -0
  92. package/lib/form-data/FormData.js.map +1 -0
  93. package/lib/index.d.ts +14 -1
  94. package/lib/index.js +20 -2
  95. package/lib/index.js.map +1 -1
  96. package/lib/nodes/document/Document.d.ts +5 -17
  97. package/lib/nodes/document/Document.js +11 -54
  98. package/lib/nodes/document/Document.js.map +1 -1
  99. package/lib/nodes/document/IDocument.d.ts +1 -1
  100. package/lib/nodes/document-fragment/DocumentFragment.d.ts +3 -14
  101. package/lib/nodes/document-fragment/DocumentFragment.js +7 -51
  102. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  103. package/lib/nodes/document-fragment/IDocumentFragment.d.ts +2 -1
  104. package/lib/nodes/element/Element.d.ts +8 -8
  105. package/lib/nodes/element/Element.js +28 -45
  106. package/lib/nodes/element/Element.js.map +1 -1
  107. package/lib/nodes/element/ElementUtility.d.ts +32 -0
  108. package/lib/nodes/element/ElementUtility.js +105 -0
  109. package/lib/nodes/element/ElementUtility.js.map +1 -0
  110. package/lib/nodes/element/HTMLCollection.d.ts +26 -3
  111. package/lib/nodes/element/HTMLCollection.js +51 -0
  112. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  113. package/lib/nodes/element/IHTMLCollection.d.ts +9 -2
  114. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +24 -24
  115. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
  116. package/lib/nodes/html-base-element/HTMLBaseElement.js +4 -4
  117. package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
  118. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +84 -3
  119. package/lib/nodes/html-button-element/HTMLButtonElement.js +183 -10
  120. package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
  121. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +28 -2
  122. package/lib/nodes/html-dialog-element/HTMLDialogElement.js +3 -3
  123. package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
  124. package/lib/nodes/html-element/HTMLElement.js +12 -12
  125. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  126. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts +32 -0
  127. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +58 -0
  128. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -0
  129. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +37 -17
  130. package/lib/nodes/html-form-element/HTMLFormElement.js +128 -37
  131. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  132. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.d.ts +25 -0
  133. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js +3 -0
  134. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js.map +1 -0
  135. package/lib/nodes/html-form-element/IHTMLFormElement.d.ts +16 -6
  136. package/lib/nodes/html-form-element/IRadioNodeList.d.ts +15 -0
  137. package/lib/nodes/html-form-element/IRadioNodeList.js +3 -0
  138. package/lib/nodes/html-form-element/IRadioNodeList.js.map +1 -0
  139. package/lib/nodes/html-form-element/RadioNodeList.d.ts +16 -0
  140. package/lib/nodes/html-form-element/RadioNodeList.js +28 -0
  141. package/lib/nodes/html-form-element/RadioNodeList.js.map +1 -0
  142. package/lib/nodes/html-image-element/HTMLImageElement.js +19 -19
  143. package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
  144. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +43 -19
  145. package/lib/nodes/html-input-element/HTMLInputElement.js +206 -111
  146. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  147. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +14 -1
  148. package/lib/nodes/html-label-element/HTMLLabelElement.js +3 -7
  149. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  150. package/lib/nodes/html-link-element/HTMLLinkElement.js +21 -21
  151. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  152. package/lib/nodes/html-media-element/HTMLMediaElement.js +21 -21
  153. package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
  154. package/lib/nodes/html-meta-element/HTMLMetaElement.js +8 -8
  155. package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
  156. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +6 -6
  157. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -1
  158. package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +3 -4
  159. package/lib/nodes/html-option-element/HTMLOptionElement.js +26 -29
  160. package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -1
  161. package/lib/nodes/html-script-element/HTMLScriptElement.js +16 -16
  162. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  163. package/lib/nodes/html-script-element/ScriptUtility.js +5 -5
  164. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  165. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.d.ts +5 -6
  166. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js.map +1 -1
  167. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +42 -41
  168. package/lib/nodes/html-select-element/HTMLSelectElement.js +134 -138
  169. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  170. package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.d.ts +4 -5
  171. package/lib/nodes/html-select-element/IHTMLOptionsCollection.js.map +1 -0
  172. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +22 -2
  173. package/lib/nodes/html-slot-element/HTMLSlotElement.js +2 -2
  174. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  175. package/lib/nodes/html-style-element/HTMLStyleElement.js +7 -7
  176. package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
  177. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +55 -2
  178. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +150 -40
  179. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  180. package/lib/nodes/html-text-area-element/IHTMLTextAreaElement.d.ts +16 -0
  181. package/lib/nodes/node/Node.d.ts +12 -1
  182. package/lib/nodes/node/Node.js +50 -4
  183. package/lib/nodes/node/Node.js.map +1 -1
  184. package/lib/nodes/node/NodeList.d.ts +2 -3
  185. package/lib/nodes/node/NodeList.js.map +1 -1
  186. package/lib/nodes/parent-node/IParentNode.d.ts +4 -4
  187. package/lib/nodes/parent-node/ParentNodeUtility.d.ts +3 -3
  188. package/lib/nodes/parent-node/ParentNodeUtility.js +13 -11
  189. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  190. package/lib/nodes/text/Text.d.ts +13 -0
  191. package/lib/nodes/text/Text.js +30 -0
  192. package/lib/nodes/text/Text.js.map +1 -1
  193. package/lib/query-selector/QuerySelector.js +2 -2
  194. package/lib/query-selector/QuerySelector.js.map +1 -1
  195. package/lib/query-selector/SelectorItem.js +2 -0
  196. package/lib/query-selector/SelectorItem.js.map +1 -1
  197. package/lib/validity-state/ValidityState.d.ts +87 -0
  198. package/lib/validity-state/ValidityState.js +171 -0
  199. package/lib/validity-state/ValidityState.js.map +1 -0
  200. package/lib/window/GlobalWindow.d.ts +0 -8
  201. package/lib/window/GlobalWindow.js +0 -2
  202. package/lib/window/GlobalWindow.js.map +1 -1
  203. package/lib/window/INodeJSGlobal.d.ts +71 -0
  204. package/lib/window/INodeJSGlobal.js +2 -0
  205. package/lib/window/INodeJSGlobal.js.map +1 -0
  206. package/lib/window/IWindow.d.ts +30 -10
  207. package/lib/window/Window.d.ts +36 -20
  208. package/lib/window/Window.js +16 -9
  209. package/lib/window/Window.js.map +1 -1
  210. package/lib/xml-http-request/XMLHttpRequest.js +20 -12
  211. package/lib/xml-http-request/XMLHttpRequest.js.map +1 -1
  212. package/lib/xml-parser/XMLParser.js +1 -1
  213. package/lib/xml-parser/XMLParser.js.map +1 -1
  214. package/package.json +2 -3
  215. package/src/cookie/CookieJar.ts +1 -1
  216. package/src/dom-token-list/DOMTokenList.ts +24 -20
  217. package/src/event/EventTarget.ts +7 -3
  218. package/src/exception/DOMExceptionNameEnum.ts +5 -1
  219. package/src/fetch/AbortController.ts +26 -0
  220. package/src/fetch/AbortSignal.ts +44 -0
  221. package/src/fetch/Fetch.ts +666 -0
  222. package/src/fetch/Headers.ts +151 -3
  223. package/src/fetch/Request.ts +226 -94
  224. package/src/fetch/{ResourceFetchHandler.ts → ResourceFetch.ts} +3 -3
  225. package/src/fetch/Response.ts +252 -89
  226. package/src/fetch/data-uri/DataURIParser.ts +66 -0
  227. package/src/fetch/multipart/MultipartFormDataParser.ts +113 -0
  228. package/src/fetch/multipart/MultipartReader.ts +217 -0
  229. package/src/fetch/types/IHeaders.ts +80 -0
  230. package/src/fetch/types/IRequest.ts +65 -0
  231. package/src/fetch/types/IRequestBody.ts +15 -0
  232. package/src/fetch/types/IRequestCredentials.ts +2 -0
  233. package/src/fetch/types/IRequestInfo.ts +6 -0
  234. package/src/fetch/types/IRequestInit.ts +21 -0
  235. package/src/fetch/types/IRequestRedirect.ts +3 -0
  236. package/src/fetch/types/IRequestReferrerPolicy.ts +11 -0
  237. package/src/fetch/types/IResponse.ts +27 -0
  238. package/src/fetch/types/IResponseBody.ts +15 -0
  239. package/src/fetch/types/IResponseInit.ts +10 -0
  240. package/src/fetch/utilities/FetchBodyUtility.ts +175 -0
  241. package/src/fetch/utilities/FetchCORSUtility.ts +18 -0
  242. package/src/fetch/utilities/FetchRequestHeaderUtility.ts +47 -0
  243. package/src/fetch/utilities/FetchRequestReferrerUtility.ts +241 -0
  244. package/src/fetch/utilities/FetchRequestValidationUtility.ts +82 -0
  245. package/src/file/Blob.ts +2 -2
  246. package/src/file/File.ts +5 -1
  247. package/src/form-data/FormData.ts +237 -0
  248. package/src/index.ts +27 -1
  249. package/src/nodes/document/Document.ts +23 -64
  250. package/src/nodes/document/IDocument.ts +1 -1
  251. package/src/nodes/document-fragment/DocumentFragment.ts +9 -59
  252. package/src/nodes/document-fragment/IDocumentFragment.ts +2 -1
  253. package/src/nodes/element/Element.ts +43 -56
  254. package/src/nodes/element/ElementUtility.ts +137 -0
  255. package/src/nodes/element/HTMLCollection.ts +60 -3
  256. package/src/nodes/element/IHTMLCollection.ts +10 -2
  257. package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +24 -24
  258. package/src/nodes/html-base-element/HTMLBaseElement.ts +4 -4
  259. package/src/nodes/html-button-element/HTMLButtonElement.ts +213 -10
  260. package/src/nodes/html-button-element/IHTMLButtonElement.ts +31 -2
  261. package/src/nodes/html-dialog-element/HTMLDialogElement.ts +3 -3
  262. package/src/nodes/html-element/HTMLElement.ts +12 -12
  263. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +76 -0
  264. package/src/nodes/html-form-element/HTMLFormElement.ts +147 -41
  265. package/src/nodes/html-form-element/IHTMLFormControlsCollection.ts +45 -0
  266. package/src/nodes/html-form-element/IHTMLFormElement.ts +17 -6
  267. package/src/nodes/html-form-element/IRadioNodeList.ts +16 -0
  268. package/src/nodes/html-form-element/RadioNodeList.ts +24 -0
  269. package/src/nodes/html-image-element/HTMLImageElement.ts +19 -19
  270. package/src/nodes/html-input-element/HTMLInputElement.ts +232 -113
  271. package/src/nodes/html-input-element/IHTMLInputElement.ts +20 -1
  272. package/src/nodes/html-label-element/HTMLLabelElement.ts +3 -7
  273. package/src/nodes/html-link-element/HTMLLinkElement.ts +21 -21
  274. package/src/nodes/html-media-element/HTMLMediaElement.ts +21 -21
  275. package/src/nodes/html-meta-element/HTMLMetaElement.ts +8 -8
  276. package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +6 -6
  277. package/src/nodes/html-option-element/HTMLOptionElement.ts +29 -30
  278. package/src/nodes/html-script-element/HTMLScriptElement.ts +16 -16
  279. package/src/nodes/html-script-element/ScriptUtility.ts +5 -5
  280. package/src/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.ts +5 -9
  281. package/src/nodes/html-select-element/HTMLSelectElement.ts +159 -170
  282. package/src/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.ts +4 -8
  283. package/src/nodes/html-select-element/IHTMLSelectElement.ts +25 -2
  284. package/src/nodes/html-slot-element/HTMLSlotElement.ts +2 -2
  285. package/src/nodes/html-style-element/HTMLStyleElement.ts +7 -7
  286. package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +174 -41
  287. package/src/nodes/html-text-area-element/IHTMLTextAreaElement.ts +18 -0
  288. package/src/nodes/node/Node.ts +61 -6
  289. package/src/nodes/node/NodeList.ts +2 -3
  290. package/src/nodes/parent-node/IParentNode.ts +7 -4
  291. package/src/nodes/parent-node/ParentNodeUtility.ts +25 -15
  292. package/src/nodes/text/Text.ts +38 -0
  293. package/src/query-selector/QuerySelector.ts +2 -2
  294. package/src/query-selector/SelectorItem.ts +3 -0
  295. package/src/validity-state/ValidityState.ts +211 -0
  296. package/src/window/GlobalWindow.ts +0 -2
  297. package/src/window/INodeJSGlobal.ts +70 -0
  298. package/src/window/IWindow.ts +32 -10
  299. package/src/window/Window.ts +37 -20
  300. package/src/xml-http-request/XMLHttpRequest.ts +27 -26
  301. package/src/xml-parser/XMLParser.ts +1 -1
  302. package/lib/fetch/FetchHandler.d.ts +0 -18
  303. package/lib/fetch/FetchHandler.js +0 -83
  304. package/lib/fetch/FetchHandler.js.map +0 -1
  305. package/lib/fetch/IAbortSignal.d.ts +0 -16
  306. package/lib/fetch/IAbortSignal.js +0 -4
  307. package/lib/fetch/IAbortSignal.js.map +0 -1
  308. package/lib/fetch/IBody.d.ts +0 -17
  309. package/lib/fetch/IBody.js.map +0 -1
  310. package/lib/fetch/IHeaders.d.ts +0 -18
  311. package/lib/fetch/IHeadersInit.js.map +0 -1
  312. package/lib/fetch/IRequest.d.ts +0 -18
  313. package/lib/fetch/IRequestInit.d.ts +0 -16
  314. package/lib/fetch/IRequestInit.js.map +0 -1
  315. package/lib/fetch/IResponse.d.ts +0 -20
  316. package/lib/fetch/IResponseInit.d.ts +0 -9
  317. package/lib/fetch/IResponseInit.js.map +0 -1
  318. package/lib/fetch/RequestInfo.js +0 -3
  319. package/lib/fetch/RequestInfo.js.map +0 -1
  320. package/lib/fetch/ResourceFetchHandler.js.map +0 -1
  321. package/lib/form-data/IFormData.d.ts +0 -32
  322. package/lib/form-data/IFormData.js +0 -3
  323. package/lib/form-data/IFormData.js.map +0 -1
  324. package/lib/location/RelativeURL.d.ts +0 -15
  325. package/lib/location/RelativeURL.js +0 -19
  326. package/lib/location/RelativeURL.js.map +0 -1
  327. package/lib/nodes/element/HTMLCollectionFactory.d.ts +0 -21
  328. package/lib/nodes/element/HTMLCollectionFactory.js +0 -31
  329. package/lib/nodes/element/HTMLCollectionFactory.js.map +0 -1
  330. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +0 -1
  331. package/lib/nodes/node/NodeListFactory.d.ts +0 -21
  332. package/lib/nodes/node/NodeListFactory.js +0 -31
  333. package/lib/nodes/node/NodeListFactory.js.map +0 -1
  334. package/lib/nodes/validity-state/ValidityState.d.ts +0 -52
  335. package/lib/nodes/validity-state/ValidityState.js +0 -81
  336. package/lib/nodes/validity-state/ValidityState.js.map +0 -1
  337. package/src/fetch/FetchHandler.ts +0 -90
  338. package/src/fetch/IAbortSignal.ts +0 -34
  339. package/src/fetch/IBody.ts +0 -18
  340. package/src/fetch/IHeaders.ts +0 -18
  341. package/src/fetch/IRequest.ts +0 -59
  342. package/src/fetch/IRequestInit.ts +0 -41
  343. package/src/fetch/IResponse.ts +0 -22
  344. package/src/fetch/IResponseInit.ts +0 -10
  345. package/src/fetch/RequestInfo.ts +0 -6
  346. package/src/form-data/IFormData.ts +0 -33
  347. package/src/location/RelativeURL.ts +0 -17
  348. package/src/nodes/element/HTMLCollectionFactory.ts +0 -31
  349. package/src/nodes/node/NodeListFactory.ts +0 -31
  350. package/src/nodes/validity-state/ValidityState.ts +0 -84
  351. /package/lib/fetch/{IHeaders.js → types/IHeaders.js} +0 -0
  352. /package/lib/fetch/{IHeadersInit.d.ts → types/IHeadersInit.d.ts} +0 -0
  353. /package/lib/fetch/{IHeadersInit.js → types/IHeadersInit.js} +0 -0
  354. /package/lib/fetch/{IRequest.js → types/IRequest.js} +0 -0
  355. /package/lib/fetch/{IRequestInit.js → types/IRequestInit.js} +0 -0
  356. /package/lib/fetch/{IResponse.js → types/IResponse.js} +0 -0
  357. /package/lib/fetch/{IResponseInit.js → types/IResponseInit.js} +0 -0
  358. /package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js +0 -0
  359. /package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.js +0 -0
  360. /package/src/fetch/{IHeadersInit.ts → types/IHeadersInit.ts} +0 -0
@@ -70,6 +70,7 @@ import CSSKeyframeRule from '../css/rules/CSSKeyframeRule';
70
70
  import CSSKeyframesRule from '../css/rules/CSSKeyframesRule';
71
71
  import CSSMediaRule from '../css/rules/CSSMediaRule';
72
72
  import CSSStyleRule from '../css/rules/CSSStyleRule';
73
+ import CSSSupportsRule from '../css/rules/CSSSupportsRule';
73
74
  import MouseEvent from '../event/events/MouseEvent';
74
75
  import PointerEvent from '../event/events/PointerEvent';
75
76
  import FocusEvent from '../event/events/FocusEvent';
@@ -83,18 +84,19 @@ import ErrorEvent from '../event/events/ErrorEvent';
83
84
  import StorageEvent from '../event/events/StorageEvent';
84
85
  import Screen from '../screen/Screen';
85
86
  import AsyncTaskManager from '../async-task-manager/AsyncTaskManager';
86
- import IResponse from '../fetch/IResponse';
87
- import IResponseInit from '../fetch/IResponseInit';
88
- import IRequest from '../fetch/IRequest';
89
- import IRequestInit from '../fetch/IRequestInit';
90
- import IHeaders from '../fetch/IHeaders';
91
- import IHeadersInit from '../fetch/IHeadersInit';
87
+ import IResponse from '../fetch/types/IResponse';
88
+ import IResponseInit from '../fetch/types/IResponseInit';
89
+ import IRequest from '../fetch/types/IRequest';
90
+ import IRequestInit from '../fetch/types/IRequestInit';
91
+ import IHeaders from '../fetch/types/IHeaders';
92
+ import IHeadersInit from '../fetch/types/IHeadersInit';
92
93
  import Headers from '../fetch/Headers';
93
94
  import { default as RequestImplementation } from '../fetch/Request';
94
95
  import { default as ResponseImplementation } from '../fetch/Response';
95
96
  import Storage from '../storage/Storage';
96
97
  import IWindow from './IWindow';
97
98
  import HTMLCollection from '../nodes/element/HTMLCollection';
99
+ import HTMLFormControlsCollection from '../nodes/html-form-element/HTMLFormControlsCollection';
98
100
  import NodeList from '../nodes/node/NodeList';
99
101
  import MediaQueryList from '../match-media/MediaQueryList';
100
102
  import Selection from '../selection/Selection';
@@ -103,7 +105,7 @@ import MimeType from '../navigator/MimeType';
103
105
  import MimeTypeArray from '../navigator/MimeTypeArray';
104
106
  import Plugin from '../navigator/Plugin';
105
107
  import PluginArray from '../navigator/PluginArray';
106
- import FetchHandler from '../fetch/FetchHandler';
108
+ import Fetch from '../fetch/Fetch';
107
109
  import { default as RangeImplementation } from '../range/Range';
108
110
  import DOMRect from '../nodes/element/DOMRect';
109
111
  import VMGlobalPropertyScript from './VMGlobalPropertyScript';
@@ -119,10 +121,18 @@ import Attr from '../nodes/attr/Attr';
119
121
  import NamedNodeMap from '../named-node-map/NamedNodeMap';
120
122
  import IElement from '../nodes/element/IElement';
121
123
  import ProcessingInstruction from '../nodes/processing-instruction/ProcessingInstruction';
122
- import RequestInfo from '../fetch/RequestInfo';
124
+ import RequestInfo from '../fetch/types/IRequestInfo';
123
125
  import FileList from '../nodes/html-input-element/FileList';
126
+ import Stream from 'stream';
127
+ import FormData from '../form-data/FormData';
128
+ import AbortController from '../fetch/AbortController';
129
+ import AbortSignal from '../fetch/AbortSignal';
130
+ import IResponseBody from '../fetch/types/IResponseBody';
131
+ import IRequestInfo from '../fetch/types/IRequestInfo';
124
132
  import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
125
133
  import IHappyDOMOptions from './IHappyDOMOptions';
134
+ import RadioNodeList from '../nodes/html-form-element/RadioNodeList';
135
+ import ValidityState from '../validity-state/ValidityState';
126
136
 
127
137
  const ORIGINAL_SET_TIMEOUT = setTimeout;
128
138
  const ORIGINAL_CLEAR_TIMEOUT = clearTimeout;
@@ -245,6 +255,7 @@ export default class Window extends EventTarget implements IWindow {
245
255
  public readonly Storage = Storage;
246
256
  public readonly URLSearchParams = URLSearchParams;
247
257
  public readonly HTMLCollection = HTMLCollection;
258
+ public readonly HTMLFormControlsCollection = HTMLFormControlsCollection;
248
259
  public readonly NodeList = NodeList;
249
260
  public readonly CSSUnitValue = CSSUnitValue;
250
261
  public readonly CSSRule = CSSRule;
@@ -254,6 +265,7 @@ export default class Window extends EventTarget implements IWindow {
254
265
  public readonly CSSKeyframesRule = CSSKeyframesRule;
255
266
  public readonly CSSMediaRule = CSSMediaRule;
256
267
  public readonly CSSStyleRule = CSSStyleRule;
268
+ public readonly CSSSupportsRule = CSSSupportsRule;
257
269
  public readonly Selection = Selection;
258
270
  public readonly Navigator = Navigator;
259
271
  public readonly MimeType = MimeType;
@@ -263,14 +275,22 @@ export default class Window extends EventTarget implements IWindow {
263
275
  public readonly FileList = FileList;
264
276
  public readonly Headers: { new (init?: IHeadersInit): IHeaders } = Headers;
265
277
  public readonly DOMRect: typeof DOMRect;
278
+ public readonly RadioNodeList: typeof RadioNodeList;
279
+ public readonly ValidityState: typeof ValidityState;
266
280
  public readonly Request: {
267
- new (input: string | { href: string } | IRequest, init?: IRequestInit): IRequest;
281
+ new (input: IRequestInfo, init?: IRequestInit): IRequest;
268
282
  };
269
283
  public readonly Response: {
270
- new (body?: NodeJS.ReadableStream | null, init?: IResponseInit): IResponse;
284
+ new (body?: IResponseBody, init?: IResponseInit): IResponse;
271
285
  };
272
286
  public readonly XMLHttpRequestUpload = XMLHttpRequestUpload;
273
287
  public readonly XMLHttpRequestEventTarget = XMLHttpRequestEventTarget;
288
+ public readonly ReadableStream = Stream.Readable;
289
+ public readonly WritableStream = Stream.Writable;
290
+ public readonly TransformStream = Stream.Transform;
291
+ public readonly AbortController = AbortController;
292
+ public readonly AbortSignal = AbortSignal;
293
+ public readonly FormData = FormData;
274
294
  public readonly XMLHttpRequest;
275
295
  public readonly DOMParser;
276
296
  public readonly Range;
@@ -345,6 +365,9 @@ export default class Window extends EventTarget implements IWindow {
345
365
  public decodeURIComponent;
346
366
  public encodeURI;
347
367
  public encodeURIComponent;
368
+ /**
369
+ * @deprecated
370
+ */
348
371
  public escape;
349
372
  public global;
350
373
  public isFinite;
@@ -356,11 +379,12 @@ export default class Window extends EventTarget implements IWindow {
356
379
  public setImmediate;
357
380
  public queueMicrotask;
358
381
  public undefined;
382
+ /**
383
+ * @deprecated
384
+ */
359
385
  public unescape;
360
386
  public gc;
361
387
  public v8debug;
362
- public AbortController;
363
- public AbortSignal;
364
388
  public Array;
365
389
  public Object;
366
390
  public Function;
@@ -629,7 +653,6 @@ export default class Window extends EventTarget implements IWindow {
629
653
  /**
630
654
  * Sets a timer which executes a function once the timer expires.
631
655
  *
632
- * @override
633
656
  * @param callback Function to be executed.
634
657
  * @param [delay=0] Delay in ms.
635
658
  * @param args Arguments passed to the callback function.
@@ -647,7 +670,6 @@ export default class Window extends EventTarget implements IWindow {
647
670
  /**
648
671
  * Cancels a timeout previously established by calling setTimeout().
649
672
  *
650
- * @override
651
673
  * @param id ID of the timeout.
652
674
  */
653
675
  public clearTimeout(id: NodeJS.Timeout): void {
@@ -658,7 +680,6 @@ export default class Window extends EventTarget implements IWindow {
658
680
  /**
659
681
  * Calls a function with a fixed time delay between each call.
660
682
  *
661
- * @override
662
683
  * @param callback Function to be executed.
663
684
  * @param [delay=0] Delay in ms.
664
685
  * @param args Arguments passed to the callback function.
@@ -673,7 +694,6 @@ export default class Window extends EventTarget implements IWindow {
673
694
  /**
674
695
  * Cancels a timed repeating action which was previously established by a call to setInterval().
675
696
  *
676
- * @override
677
697
  * @param id ID of the interval.
678
698
  */
679
699
  public clearInterval(id: NodeJS.Timeout): void {
@@ -684,7 +704,6 @@ export default class Window extends EventTarget implements IWindow {
684
704
  /**
685
705
  * Mock animation frames with timeouts.
686
706
  *
687
- * @override
688
707
  * @param callback Callback.
689
708
  * @returns Timeout ID.
690
709
  */
@@ -697,7 +716,6 @@ export default class Window extends EventTarget implements IWindow {
697
716
  /**
698
717
  * Mock animation frames with timeouts.
699
718
  *
700
- * @override
701
719
  * @param id Timeout ID.
702
720
  */
703
721
  public cancelAnimationFrame(id: NodeJS.Timeout): void {
@@ -707,13 +725,12 @@ export default class Window extends EventTarget implements IWindow {
707
725
  /**
708
726
  * This method provides an easy, logical way to fetch resources asynchronously across the network.
709
727
  *
710
- * @override
711
728
  * @param url URL.
712
729
  * @param [init] Init.
713
730
  * @returns Promise.
714
731
  */
715
732
  public async fetch(url: RequestInfo, init?: IRequestInit): Promise<IResponse> {
716
- return await FetchHandler.fetch(this.document, url, init);
733
+ return await new Fetch({ ownerDocument: this.document, url, init }).send();
717
734
  }
718
735
 
719
736
  /**
@@ -7,11 +7,10 @@ import XMLHttpRequestReadyStateEnum from './XMLHttpRequestReadyStateEnum';
7
7
  import Event from '../event/Event';
8
8
  import IDocument from '../nodes/document/IDocument';
9
9
  import Blob from '../file/Blob';
10
- import RelativeURL from '../location/RelativeURL';
11
10
  import XMLHttpRequestUpload from './XMLHttpRequestUpload';
12
11
  import DOMException from '../exception/DOMException';
13
12
  import DOMExceptionNameEnum from '../exception/DOMExceptionNameEnum';
14
- import { UrlObject } from 'url';
13
+ import { URL, UrlObject } from 'url';
15
14
  import XMLHttpRequestURLUtility from './utilities/XMLHttpRequestURLUtility';
16
15
  import ProgressEvent from '../event/events/ProgressEvent';
17
16
  import XMLHttpResponseTypeEnum from './XMLHttpResponseTypeEnum';
@@ -375,7 +374,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
375
374
 
376
375
  const { location } = this._ownerDocument.defaultView;
377
376
 
378
- const url = RelativeURL.getAbsoluteURL(location, this._settings.url);
377
+ const url = new URL(this._settings.url, location);
379
378
 
380
379
  // Security check.
381
380
  if (url.protocol === 'http:' && location.protocol === 'https:') {
@@ -559,7 +558,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
559
558
  accept: '*/*',
560
559
  referer: location.href,
561
560
  'user-agent': navigator.userAgent,
562
- cookie: document._cookie.getCookiesString(location, false)
561
+ cookie: document.cookie
563
562
  };
564
563
  }
565
564
 
@@ -588,9 +587,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
588
587
 
589
588
  if (error) {
590
589
  this._onError(error);
591
- }
592
-
593
- if (response) {
590
+ } else if (response) {
594
591
  this._state.incommingMessage = {
595
592
  statusCode: response.statusCode,
596
593
  headers: response.headers
@@ -601,9 +598,9 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
601
598
  this._state.response = this._decodeResponseText(Buffer.from(response.data, 'base64'));
602
599
  this._state.responseText = this._state.response;
603
600
  this._state.responseXML = null;
604
- this._state.responseURL = RelativeURL.getAbsoluteURL(
605
- this._ownerDocument.defaultView.location,
606
- this._settings.url
601
+ this._state.responseURL = new URL(
602
+ this._settings.url,
603
+ this._ownerDocument.defaultView.location
607
604
  ).href;
608
605
  // Set Cookies.
609
606
  this._setCookies(this._state.incommingMessage.headers);
@@ -614,9 +611,9 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
614
611
  this._state.incommingMessage.statusCode === 303 ||
615
612
  this._state.incommingMessage.statusCode === 307
616
613
  ) {
617
- const redirectUrl = RelativeURL.getAbsoluteURL(
618
- this._ownerDocument.defaultView.location,
619
- this._state.incommingMessage.headers['location']
614
+ const redirectUrl = new URL(
615
+ this._state.incommingMessage.headers['location'],
616
+ this._ownerDocument.defaultView.location
620
617
  );
621
618
  ssl = redirectUrl.protocol === 'https:';
622
619
  this._settings.url = redirectUrl.href;
@@ -681,7 +678,8 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
681
678
  this._state.asyncTaskID
682
679
  );
683
680
  }
684
- ).on('error', (error: Error) => {
681
+ );
682
+ this._state.asyncRequest.on('error', (error: Error) => {
685
683
  this._onError(error);
686
684
  resolve();
687
685
 
@@ -735,10 +733,7 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
735
733
  // Change URL to the redirect location
736
734
  this._settings.url = this._state.incommingMessage.headers.location;
737
735
  // Parse the new URL.
738
- const redirectUrl = RelativeURL.getAbsoluteURL(
739
- this._ownerDocument.defaultView.location,
740
- this._settings.url
741
- );
736
+ const redirectUrl = new URL(this._settings.url, this._ownerDocument.defaultView.location);
742
737
  this._settings.url = redirectUrl.href;
743
738
  ssl = redirectUrl.protocol === 'https:';
744
739
  // Issue the new request
@@ -796,9 +791,9 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
796
791
  this._state.response = response;
797
792
  this._state.responseXML = responseXML;
798
793
  this._state.responseText = responseText;
799
- this._state.responseURL = RelativeURL.getAbsoluteURL(
800
- this._ownerDocument.defaultView.location,
801
- this._settings.url
794
+ this._state.responseURL = new URL(
795
+ this._settings.url,
796
+ this._ownerDocument.defaultView.location
802
797
  ).href;
803
798
  // Discard the 'end' event if the connection has been aborted
804
799
  this._setState(XMLHttpRequestReadyStateEnum.done);
@@ -882,9 +877,9 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
882
877
  this._state.response = response;
883
878
  this._state.responseXML = responseXML;
884
879
  this._state.responseText = responseText;
885
- this._state.responseURL = RelativeURL.getAbsoluteURL(
886
- this._ownerDocument.defaultView.location,
887
- this._settings.url
880
+ this._state.responseURL = new URL(
881
+ this._settings.url,
882
+ this._ownerDocument.defaultView.location
888
883
  ).href;
889
884
 
890
885
  this._setState(XMLHttpRequestReadyStateEnum.done);
@@ -978,8 +973,14 @@ export default class XMLHttpRequest extends XMLHttpRequestEventTarget {
978
973
  * @param headers String array.
979
974
  */
980
975
  private _setCookies(headers: string[] | HTTP.IncomingHttpHeaders): void {
981
- for (const cookie of [...(headers['set-cookie'] ?? []), ...(headers['set-cookie2'] ?? [])]) {
982
- this._ownerDocument.defaultView.document._cookie.setCookiesString(cookie);
976
+ for (const header of ['set-cookie', 'set-cookie2']) {
977
+ if (Array.isArray(headers[header])) {
978
+ for (const cookie of headers[header]) {
979
+ this._ownerDocument.defaultView.document._cookie.setCookiesString(cookie);
980
+ }
981
+ } else if (headers[header]) {
982
+ this._ownerDocument.defaultView.document._cookie.setCookiesString(headers[header]);
983
+ }
983
984
  }
984
985
  }
985
986
 
@@ -260,7 +260,7 @@ export default class XMLParser {
260
260
  // Attributes with no value
261
261
  for (const name of attributes.replace(ATTRIBUTE_REGEXP, '').trim().split(' ')) {
262
262
  if (name) {
263
- element.setAttributeNS(null, this._getAttributeName(element.namespaceURI, name), '');
263
+ element.setAttribute(this._getAttributeName(element.namespaceURI, name), '');
264
264
  }
265
265
  }
266
266
  }
@@ -1,18 +0,0 @@
1
- import IRequestInit from './IRequestInit';
2
- import IDocument from '../nodes/document/IDocument';
3
- import IResponse from './IResponse';
4
- import RequestInfo from './RequestInfo';
5
- /**
6
- * Helper class for performing fetch.
7
- */
8
- export default class FetchHandler {
9
- /**
10
- * Returns resource data asynchronously.
11
- *
12
- * @param document Document.
13
- * @param url URL to resource.
14
- * @param [init] Init.
15
- * @returns Response.
16
- */
17
- static fetch(document: IDocument, url: RequestInfo, init?: IRequestInit): Promise<IResponse>;
18
- }
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const RelativeURL_1 = __importDefault(require("../location/RelativeURL"));
7
- const Response_1 = __importDefault(require("./Response"));
8
- const node_fetch_1 = __importDefault(require("node-fetch"));
9
- const Request_1 = __importDefault(require("./Request"));
10
- const url_1 = require("url");
11
- /**
12
- * Helper class for performing fetch.
13
- */
14
- class FetchHandler {
15
- /**
16
- * Returns resource data asynchronously.
17
- *
18
- * @param document Document.
19
- * @param url URL to resource.
20
- * @param [init] Init.
21
- * @returns Response.
22
- */
23
- static fetch(document, url, init) {
24
- const taskManager = document.defaultView.happyDOM.asyncTaskManager;
25
- const requestInit = { ...init, headers: { ...init?.headers } };
26
- const cookie = document.defaultView.document.cookie;
27
- const referer = document.defaultView.location.origin;
28
- requestInit.headers['user-agent'] = document.defaultView.navigator.userAgent;
29
- // We need set referer to solve anti-hotlinking.
30
- // And the browser will set the referer to the origin of the page.
31
- // Referer is "null" when the URL is set to "about:blank".
32
- // This is also how the browser behaves.
33
- if (referer !== 'null') {
34
- requestInit.headers['referer'] = referer;
35
- }
36
- if (cookie) {
37
- requestInit.headers['set-cookie'] = cookie;
38
- }
39
- let request;
40
- if (typeof url === 'string') {
41
- request = new Request_1.default(RelativeURL_1.default.getAbsoluteURL(document.defaultView.location, url));
42
- }
43
- else if (url instanceof url_1.URL) {
44
- // URLs are always absolute, no need for getAbsoluteURL.
45
- request = new Request_1.default(url);
46
- }
47
- else {
48
- request = new Request_1.default(RelativeURL_1.default.getAbsoluteURL(document.defaultView.location, url.url), {
49
- ...url
50
- });
51
- }
52
- return new Promise((resolve, reject) => {
53
- const taskID = taskManager.startTask();
54
- (0, node_fetch_1.default)(request, requestInit)
55
- .then((response) => {
56
- if (taskManager.getTaskCount() === 0) {
57
- reject(new Error('Failed to complete fetch request. Task was canceled.'));
58
- }
59
- else {
60
- response.constructor['_ownerDocument'] = document;
61
- for (const key of Object.keys(Response_1.default.prototype)) {
62
- if (Response_1.default.prototype.hasOwnProperty(key) && key !== 'constructor') {
63
- if (typeof Response_1.default.prototype[key] === 'function') {
64
- response[key] = Response_1.default.prototype[key].bind(response);
65
- }
66
- else {
67
- response[key] = Response_1.default.prototype[key];
68
- }
69
- }
70
- }
71
- taskManager.endTask(taskID);
72
- resolve(response);
73
- }
74
- })
75
- .catch((error) => {
76
- reject(error);
77
- taskManager.cancelAll(error);
78
- });
79
- });
80
- }
81
- }
82
- exports.default = FetchHandler;
83
- //# sourceMappingURL=FetchHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FetchHandler.js","sourceRoot":"","sources":["../../src/fetch/FetchHandler.ts"],"names":[],"mappings":"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"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Abort signal.
3
- */
4
- export default interface IAbortSignal {
5
- aborted: boolean;
6
- addEventListener: (type: 'abort', listener: (this: IAbortSignal, event: any) => any, options?: boolean | {
7
- capture?: boolean | undefined;
8
- once?: boolean | undefined;
9
- passive?: boolean | undefined;
10
- }) => void;
11
- removeEventListener: (type: 'abort', listener: (this: IAbortSignal, event: any) => any, options?: boolean | {
12
- capture?: boolean | undefined;
13
- }) => void;
14
- dispatchEvent: (event: any) => boolean;
15
- onabort: null | ((this: IAbortSignal, event: any) => void);
16
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=IAbortSignal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IAbortSignal.js","sourceRoot":"","sources":["../../src/fetch/IAbortSignal.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -1,17 +0,0 @@
1
- /// <reference types="node" />
2
- import IBlob from '../file/IBlob';
3
- /**
4
- * Fetch response.
5
- */
6
- export default interface IBody {
7
- readonly body: NodeJS.ReadableStream;
8
- readonly bodyUsed: boolean;
9
- readonly size: number;
10
- readonly timeout: number;
11
- arrayBuffer(): Promise<ArrayBuffer>;
12
- blob(): Promise<IBlob>;
13
- buffer(): Promise<Buffer>;
14
- json(): Promise<unknown>;
15
- text(): Promise<string>;
16
- textConverted(): Promise<string>;
17
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"IBody.js","sourceRoot":"","sources":["../../src/fetch/IBody.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- /**
2
- * Fetch headers.
3
- */
4
- export default interface IHeaders extends Iterable<[string, string]> {
5
- forEach(callback: (value: string, name: string) => void): void;
6
- append(name: string, value: string): void;
7
- delete(name: string): void;
8
- get(name: string): string | null;
9
- has(name: string): boolean;
10
- raw(): {
11
- [k: string]: string[];
12
- };
13
- set(name: string, value: string): void;
14
- entries(): IterableIterator<[string, string]>;
15
- keys(): IterableIterator<string>;
16
- values(): IterableIterator<string>;
17
- [Symbol.iterator](): Iterator<[string, string]>;
18
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"IHeadersInit.js","sourceRoot":"","sources":["../../src/fetch/IHeadersInit.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- import IHeaders from './IHeaders';
2
- import IBody from './IBody';
3
- /**
4
- * Fetch request.
5
- */
6
- export default interface IRequest extends IBody {
7
- readonly headers: IHeaders;
8
- readonly method: string;
9
- readonly redirect: 'error' | 'follow' | 'manual';
10
- readonly referrer: string;
11
- readonly url: string;
12
- /**
13
- * Returns a clone.
14
- *
15
- * @returns Clone.
16
- */
17
- clone(): IRequest;
18
- }
@@ -1,16 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import IHeadersInit from './IHeadersInit';
4
- import IAbortSignal from './IAbortSignal';
5
- import { URLSearchParams } from 'url';
6
- import IFormData from '../form-data/IFormData';
7
- /**
8
- * Fetch request init.
9
- */
10
- export default interface IRequestInit {
11
- body?: ArrayBuffer | ArrayBufferView | NodeJS.ReadableStream | string | URLSearchParams | IFormData | null;
12
- headers?: IHeadersInit;
13
- method?: string;
14
- redirect?: 'error' | 'manual' | 'follow';
15
- signal?: IAbortSignal | null;
16
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"IRequestInit.js","sourceRoot":"","sources":["../../src/fetch/IRequestInit.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import IHeaders from './IHeaders';
2
- import IBody from './IBody';
3
- /**
4
- * Fetch response.
5
- */
6
- export default interface IResponse extends IBody {
7
- readonly headers: IHeaders;
8
- readonly ok: boolean;
9
- readonly redirected: boolean;
10
- readonly status: number;
11
- readonly statusText: string;
12
- readonly type: 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
13
- readonly url: string;
14
- /**
15
- * Returns a clone.
16
- *
17
- * @returns Clone.
18
- */
19
- clone(): IResponse;
20
- }
@@ -1,9 +0,0 @@
1
- import IHeaders from './IHeaders';
2
- /**
3
- * Response init.
4
- */
5
- export default interface IResponseInit {
6
- headers?: IHeaders | string[][] | Record<string, string>;
7
- status?: number;
8
- statusText?: string;
9
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"IResponseInit.js","sourceRoot":"","sources":["../../src/fetch/IResponseInit.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=RequestInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RequestInfo.js","sourceRoot":"","sources":["../../src/fetch/RequestInfo.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResourceFetchHandler.js","sourceRoot":"","sources":["../../src/fetch/ResourceFetchHandler.ts"],"names":[],"mappings":";;;;;AAAA,0EAAkD;AAClD,6EAAqD;AAGrD;;GAEG;AACH,MAAqB,oBAAoB;IACxC;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAmB,EAAE,GAAW;QACzD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YACjB,MAAM,IAAI,sBAAY,CACrB,iCAAiC,GAAG,mBAAmB,QAAQ,CAAC,MAAM,EAAE,CACxE,CAAC;SACF;QACD,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,SAAS,CAAC,QAAmB,EAAE,GAAW;QACvD,sIAAsI;QACtI,MAAM,WAAW,GAAG,qBAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QAExF,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QACpC,GAAG,CAAC,IAAI,EAAE,CAAC;QAEX,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;YACvB,MAAM,IAAI,sBAAY,CACrB,iCAAiC,WAAW,mBAAmB,GAAG,CAAC,MAAM,EAAE,CAC3E,CAAC;SACF;QAED,OAAO,GAAG,CAAC,YAAY,CAAC;IACzB,CAAC;CACD;AAzCD,uCAyCC"}
@@ -1,32 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import Stream from 'stream';
5
- import HTTP from 'http';
6
- interface IHeaders {
7
- [key: string]: unknown;
8
- }
9
- interface IAppendOptions {
10
- header?: string | IHeaders;
11
- knownLength?: number;
12
- filename?: string;
13
- filepath?: string;
14
- contentType?: string;
15
- }
16
- interface ISubmitOptions extends HTTP.RequestOptions {
17
- protocol?: 'https:' | 'http:';
18
- }
19
- export default interface IFormData extends Stream.Readable {
20
- append(key: string, value: unknown, options?: IAppendOptions | string): void;
21
- getHeaders(userHeaders?: IHeaders): {
22
- [key: string]: IHeaders;
23
- };
24
- submit(params: string | ISubmitOptions, callback?: (error: Error | null, response: HTTP.IncomingMessage) => void): HTTP.ClientRequest;
25
- getBuffer(): Buffer;
26
- setBoundary(boundary: string): void;
27
- getBoundary(): string;
28
- getLength(callback: (err: Error | null, length: number) => void): void;
29
- getLengthSync(): number;
30
- hasKnownLength(): boolean;
31
- }
32
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IFormData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IFormData.js","sourceRoot":"","sources":["../../src/form-data/IFormData.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- /// <reference types="node" />
2
- import Location from './Location';
3
- import { URL } from 'url';
4
- /**
5
- * Helper class for getting the URL relative to a Location object.
6
- */
7
- export default class RelativeURL {
8
- /**
9
- * Returns a URL relative to the given Location object.
10
- *
11
- * @param location Location.
12
- * @param url URL.
13
- */
14
- static getAbsoluteURL(location: Location, url: string): URL;
15
- }