@shopify/ui-extensions-server-kit 5.2.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 (367) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +74 -0
  3. package/dist/ExtensionServerClient/ExtensionServerClient.cjs.js +1 -0
  4. package/dist/ExtensionServerClient/ExtensionServerClient.d.ts +28 -0
  5. package/dist/ExtensionServerClient/ExtensionServerClient.es.js +133 -0
  6. package/dist/ExtensionServerClient/ExtensionServerClient.test.d.ts +1 -0
  7. package/dist/ExtensionServerClient/index.d.ts +2 -0
  8. package/dist/ExtensionServerClient/types.cjs.js +1 -0
  9. package/dist/ExtensionServerClient/types.d.ts +124 -0
  10. package/dist/ExtensionServerClient/types.es.js +4 -0
  11. package/dist/context/ExtensionServerProvider.cjs.js +1 -0
  12. package/dist/context/ExtensionServerProvider.d.ts +2 -0
  13. package/dist/context/ExtensionServerProvider.es.js +29 -0
  14. package/dist/context/ExtensionServerProvider.test.d.ts +1 -0
  15. package/dist/context/constants.cjs.js +1 -0
  16. package/dist/context/constants.d.ts +3 -0
  17. package/dist/context/constants.es.js +14 -0
  18. package/dist/context/index.d.ts +3 -0
  19. package/dist/context/types.d.ts +11 -0
  20. package/dist/hooks/index.d.ts +5 -0
  21. package/dist/hooks/useExtensionClient.cjs.js +1 -0
  22. package/dist/hooks/useExtensionClient.d.ts +1 -0
  23. package/dist/hooks/useExtensionClient.es.js +8 -0
  24. package/dist/hooks/useExtensionServerContext.cjs.js +1 -0
  25. package/dist/hooks/useExtensionServerContext.d.ts +1 -0
  26. package/dist/hooks/useExtensionServerContext.es.js +6 -0
  27. package/dist/hooks/useExtensionServerEvent.cjs.js +1 -0
  28. package/dist/hooks/useExtensionServerEvent.d.ts +1 -0
  29. package/dist/hooks/useExtensionServerEvent.es.js +9 -0
  30. package/dist/hooks/useExtensionServerState.cjs.js +1 -0
  31. package/dist/hooks/useExtensionServerState.d.ts +1 -0
  32. package/dist/hooks/useExtensionServerState.es.js +9 -0
  33. package/dist/hooks/useIsomorphicLayoutEffect.cjs.js +1 -0
  34. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
  35. package/dist/hooks/useIsomorphicLayoutEffect.es.js +5 -0
  36. package/dist/i18n.cjs.js +1 -0
  37. package/dist/i18n.d.ts +93 -0
  38. package/dist/i18n.es.js +61 -0
  39. package/dist/i18n.test.d.ts +1 -0
  40. package/dist/index.cjs.js +1 -0
  41. package/dist/index.cjs2.js +1 -0
  42. package/dist/index.d.ts +7 -0
  43. package/dist/index.es.js +54 -0
  44. package/dist/index.es2.js +8 -0
  45. package/dist/state/actions/actions.cjs.js +1 -0
  46. package/dist/state/actions/actions.d.ts +6 -0
  47. package/dist/state/actions/actions.es.js +37 -0
  48. package/dist/state/actions/index.d.ts +2 -0
  49. package/dist/state/actions/types.d.ts +21 -0
  50. package/dist/state/index.d.ts +2 -0
  51. package/dist/state/reducers/constants.cjs.js +1 -0
  52. package/dist/state/reducers/constants.d.ts +2 -0
  53. package/dist/state/reducers/constants.es.js +7 -0
  54. package/dist/state/reducers/extensionServerReducer.cjs.js +1 -0
  55. package/dist/state/reducers/extensionServerReducer.d.ts +3 -0
  56. package/dist/state/reducers/extensionServerReducer.es.js +57 -0
  57. package/dist/state/reducers/extensionServerReducer.test.d.ts +1 -0
  58. package/dist/state/reducers/index.d.ts +3 -0
  59. package/dist/state/reducers/types.d.ts +6 -0
  60. package/dist/testing/MockExtensionServerProvider.cjs.js +1 -0
  61. package/dist/testing/MockExtensionServerProvider.d.ts +7 -0
  62. package/dist/testing/MockExtensionServerProvider.es.js +24 -0
  63. package/dist/testing/app.cjs.js +1 -0
  64. package/dist/testing/app.d.ts +2 -0
  65. package/dist/testing/app.es.js +16 -0
  66. package/dist/testing/extensions.cjs.js +1 -0
  67. package/dist/testing/extensions.d.ts +6 -0
  68. package/dist/testing/extensions.es.js +65 -0
  69. package/dist/testing/index.d.ts +3 -0
  70. package/dist/types.cjs.js +1 -0
  71. package/dist/types.d.ts +169 -0
  72. package/dist/types.es.js +4 -0
  73. package/dist/utilities/assetToString.cjs.js +1 -0
  74. package/dist/utilities/assetToString.d.ts +2 -0
  75. package/dist/utilities/assetToString.es.js +7 -0
  76. package/dist/utilities/assetToString.test.d.ts +1 -0
  77. package/dist/utilities/groupByKey.cjs.js +1 -0
  78. package/dist/utilities/groupByKey.d.ts +3 -0
  79. package/dist/utilities/groupByKey.es.js +6 -0
  80. package/dist/utilities/index.d.ts +7 -0
  81. package/dist/utilities/isUIExtension.cjs.js +1 -0
  82. package/dist/utilities/isUIExtension.d.ts +1 -0
  83. package/dist/utilities/isUIExtension.es.js +6 -0
  84. package/dist/utilities/isValidSurface.cjs.js +1 -0
  85. package/dist/utilities/isValidSurface.d.ts +2 -0
  86. package/dist/utilities/isValidSurface.es.js +7 -0
  87. package/dist/utilities/noop.cjs.js +1 -0
  88. package/dist/utilities/noop.d.ts +1 -0
  89. package/dist/utilities/noop.es.js +5 -0
  90. package/dist/utilities/replaceUpdated.cjs.js +1 -0
  91. package/dist/utilities/replaceUpdated.d.ts +1 -0
  92. package/dist/utilities/replaceUpdated.es.js +14 -0
  93. package/dist/utilities/replaceUpdated.test.d.ts +1 -0
  94. package/dist/utilities/set.cjs.js +1 -0
  95. package/dist/utilities/set.d.ts +4 -0
  96. package/dist/utilities/set.es.js +18 -0
  97. package/dist/utilities/set.test.d.ts +1 -0
  98. package/index.d.ts +1 -0
  99. package/index.js +1 -0
  100. package/index.mjs +1 -0
  101. package/node_modules/@shopify/react-testing/LICENSE.md +21 -0
  102. package/node_modules/@shopify/react-testing/README.md +711 -0
  103. package/node_modules/@shopify/react-testing/build/cjs/TestWrapper.js +52 -0
  104. package/node_modules/@shopify/react-testing/build/cjs/_virtual/_rollupPluginBabelHelpers.js +47 -0
  105. package/node_modules/@shopify/react-testing/build/cjs/compat.js +14 -0
  106. package/node_modules/@shopify/react-testing/build/cjs/destroy.js +13 -0
  107. package/node_modules/@shopify/react-testing/build/cjs/element.js +225 -0
  108. package/node_modules/@shopify/react-testing/build/cjs/index.js +21 -0
  109. package/node_modules/@shopify/react-testing/build/cjs/matchers/components.js +46 -0
  110. package/node_modules/@shopify/react-testing/build/cjs/matchers/context.js +25 -0
  111. package/node_modules/@shopify/react-testing/build/cjs/matchers/index.js +16 -0
  112. package/node_modules/@shopify/react-testing/build/cjs/matchers/props.js +38 -0
  113. package/node_modules/@shopify/react-testing/build/cjs/matchers/strings.js +42 -0
  114. package/node_modules/@shopify/react-testing/build/cjs/matchers/utilities.js +110 -0
  115. package/node_modules/@shopify/react-testing/build/cjs/mount.js +76 -0
  116. package/node_modules/@shopify/react-testing/build/cjs/root.js +284 -0
  117. package/node_modules/@shopify/react-testing/build/cjs/toReactString.js +86 -0
  118. package/node_modules/@shopify/react-testing/build/cjs/types.js +28 -0
  119. package/node_modules/@shopify/react-testing/build/esm/TestWrapper.mjs +44 -0
  120. package/node_modules/@shopify/react-testing/build/esm/_virtual/_rollupPluginBabelHelpers.mjs +42 -0
  121. package/node_modules/@shopify/react-testing/build/esm/compat.mjs +10 -0
  122. package/node_modules/@shopify/react-testing/build/esm/destroy.mjs +9 -0
  123. package/node_modules/@shopify/react-testing/build/esm/element.mjs +221 -0
  124. package/node_modules/@shopify/react-testing/build/esm/index.mjs +5 -0
  125. package/node_modules/@shopify/react-testing/build/esm/matchers/components.mjs +41 -0
  126. package/node_modules/@shopify/react-testing/build/esm/matchers/context.mjs +21 -0
  127. package/node_modules/@shopify/react-testing/build/esm/matchers/index.mjs +14 -0
  128. package/node_modules/@shopify/react-testing/build/esm/matchers/props.mjs +33 -0
  129. package/node_modules/@shopify/react-testing/build/esm/matchers/strings.mjs +37 -0
  130. package/node_modules/@shopify/react-testing/build/esm/matchers/utilities.mjs +101 -0
  131. package/node_modules/@shopify/react-testing/build/esm/mount.mjs +70 -0
  132. package/node_modules/@shopify/react-testing/build/esm/root.mjs +275 -0
  133. package/node_modules/@shopify/react-testing/build/esm/toReactString.mjs +80 -0
  134. package/node_modules/@shopify/react-testing/build/esm/types.mjs +26 -0
  135. package/node_modules/@shopify/react-testing/build/esnext/TestWrapper.esnext +44 -0
  136. package/node_modules/@shopify/react-testing/build/esnext/compat.esnext +10 -0
  137. package/node_modules/@shopify/react-testing/build/esnext/destroy.esnext +9 -0
  138. package/node_modules/@shopify/react-testing/build/esnext/element.esnext +221 -0
  139. package/node_modules/@shopify/react-testing/build/esnext/index.esnext +5 -0
  140. package/node_modules/@shopify/react-testing/build/esnext/matchers/components.esnext +41 -0
  141. package/node_modules/@shopify/react-testing/build/esnext/matchers/context.esnext +21 -0
  142. package/node_modules/@shopify/react-testing/build/esnext/matchers/index.esnext +14 -0
  143. package/node_modules/@shopify/react-testing/build/esnext/matchers/props.esnext +33 -0
  144. package/node_modules/@shopify/react-testing/build/esnext/matchers/strings.esnext +37 -0
  145. package/node_modules/@shopify/react-testing/build/esnext/matchers/utilities.esnext +99 -0
  146. package/node_modules/@shopify/react-testing/build/esnext/mount.esnext +71 -0
  147. package/node_modules/@shopify/react-testing/build/esnext/root.esnext +275 -0
  148. package/node_modules/@shopify/react-testing/build/esnext/toReactString.esnext +80 -0
  149. package/node_modules/@shopify/react-testing/build/esnext/types.esnext +26 -0
  150. package/node_modules/@shopify/react-testing/build/ts/TestWrapper.d.ts +17 -0
  151. package/node_modules/@shopify/react-testing/build/ts/TestWrapper.d.ts.map +1 -0
  152. package/node_modules/@shopify/react-testing/build/ts/compat.d.ts +3 -0
  153. package/node_modules/@shopify/react-testing/build/ts/compat.d.ts.map +1 -0
  154. package/node_modules/@shopify/react-testing/build/ts/destroy.d.ts +2 -0
  155. package/node_modules/@shopify/react-testing/build/ts/destroy.d.ts.map +1 -0
  156. package/node_modules/@shopify/react-testing/build/ts/element.d.ts +42 -0
  157. package/node_modules/@shopify/react-testing/build/ts/element.d.ts.map +1 -0
  158. package/node_modules/@shopify/react-testing/build/ts/index.d.ts +7 -0
  159. package/node_modules/@shopify/react-testing/build/ts/index.d.ts.map +1 -0
  160. package/node_modules/@shopify/react-testing/build/ts/matchers/components.d.ts +12 -0
  161. package/node_modules/@shopify/react-testing/build/ts/matchers/components.d.ts.map +1 -0
  162. package/node_modules/@shopify/react-testing/build/ts/matchers/context.d.ts +8 -0
  163. package/node_modules/@shopify/react-testing/build/ts/matchers/context.d.ts.map +1 -0
  164. package/node_modules/@shopify/react-testing/build/ts/matchers/index.d.ts +20 -0
  165. package/node_modules/@shopify/react-testing/build/ts/matchers/index.d.ts.map +1 -0
  166. package/node_modules/@shopify/react-testing/build/ts/matchers/props.d.ts +10 -0
  167. package/node_modules/@shopify/react-testing/build/ts/matchers/props.d.ts.map +1 -0
  168. package/node_modules/@shopify/react-testing/build/ts/matchers/strings.d.ts +11 -0
  169. package/node_modules/@shopify/react-testing/build/ts/matchers/strings.d.ts.map +1 -0
  170. package/node_modules/@shopify/react-testing/build/ts/matchers/utilities.d.ts +17 -0
  171. package/node_modules/@shopify/react-testing/build/ts/matchers/utilities.d.ts.map +1 -0
  172. package/node_modules/@shopify/react-testing/build/ts/mount.d.ts +39 -0
  173. package/node_modules/@shopify/react-testing/build/ts/mount.d.ts.map +1 -0
  174. package/node_modules/@shopify/react-testing/build/ts/root.d.ts +55 -0
  175. package/node_modules/@shopify/react-testing/build/ts/root.d.ts.map +1 -0
  176. package/node_modules/@shopify/react-testing/build/ts/toReactString.d.ts +5 -0
  177. package/node_modules/@shopify/react-testing/build/ts/toReactString.d.ts.map +1 -0
  178. package/node_modules/@shopify/react-testing/build/ts/types.d.ts +89 -0
  179. package/node_modules/@shopify/react-testing/build/ts/types.d.ts.map +1 -0
  180. package/node_modules/@shopify/react-testing/index.esnext +1 -0
  181. package/node_modules/@shopify/react-testing/index.js +1 -0
  182. package/node_modules/@shopify/react-testing/index.mjs +1 -0
  183. package/node_modules/@shopify/react-testing/matchers.esnext +1 -0
  184. package/node_modules/@shopify/react-testing/matchers.js +1 -0
  185. package/node_modules/@shopify/react-testing/matchers.mjs +1 -0
  186. package/node_modules/@shopify/react-testing/package.json +69 -0
  187. package/node_modules/@shopify/ui-extensions-test-utils/CHANGELOG.md +66 -0
  188. package/node_modules/@shopify/ui-extensions-test-utils/dist/index.js +3 -0
  189. package/node_modules/@shopify/ui-extensions-test-utils/dist/render.js +5 -0
  190. package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.js +20 -0
  191. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.js +6 -0
  192. package/node_modules/@shopify/ui-extensions-test-utils/package.json +41 -0
  193. package/node_modules/@shopify/ui-extensions-test-utils/project.json +39 -0
  194. package/node_modules/@types/node/LICENSE +21 -0
  195. package/node_modules/@types/node/README.md +15 -0
  196. package/node_modules/@types/node/assert/strict.d.ts +8 -0
  197. package/node_modules/@types/node/assert.d.ts +985 -0
  198. package/node_modules/@types/node/async_hooks.d.ts +522 -0
  199. package/node_modules/@types/node/buffer.d.ts +2321 -0
  200. package/node_modules/@types/node/child_process.d.ts +1544 -0
  201. package/node_modules/@types/node/cluster.d.ts +432 -0
  202. package/node_modules/@types/node/console.d.ts +412 -0
  203. package/node_modules/@types/node/constants.d.ts +19 -0
  204. package/node_modules/@types/node/crypto.d.ts +4451 -0
  205. package/node_modules/@types/node/dgram.d.ts +586 -0
  206. package/node_modules/@types/node/diagnostics_channel.d.ts +192 -0
  207. package/node_modules/@types/node/dns/promises.d.ts +381 -0
  208. package/node_modules/@types/node/dns.d.ts +809 -0
  209. package/node_modules/@types/node/dom-events.d.ts +122 -0
  210. package/node_modules/@types/node/domain.d.ts +170 -0
  211. package/node_modules/@types/node/events.d.ts +803 -0
  212. package/node_modules/@types/node/fs/promises.d.ts +1205 -0
  213. package/node_modules/@types/node/fs.d.ts +4211 -0
  214. package/node_modules/@types/node/globals.d.ts +377 -0
  215. package/node_modules/@types/node/globals.global.d.ts +1 -0
  216. package/node_modules/@types/node/http.d.ts +1801 -0
  217. package/node_modules/@types/node/http2.d.ts +2386 -0
  218. package/node_modules/@types/node/https.d.ts +544 -0
  219. package/node_modules/@types/node/index.d.ts +88 -0
  220. package/node_modules/@types/node/inspector.d.ts +2739 -0
  221. package/node_modules/@types/node/module.d.ts +298 -0
  222. package/node_modules/@types/node/net.d.ts +913 -0
  223. package/node_modules/@types/node/os.d.ts +473 -0
  224. package/node_modules/@types/node/package.json +235 -0
  225. package/node_modules/@types/node/path.d.ts +191 -0
  226. package/node_modules/@types/node/perf_hooks.d.ts +626 -0
  227. package/node_modules/@types/node/process.d.ts +1531 -0
  228. package/node_modules/@types/node/punycode.d.ts +117 -0
  229. package/node_modules/@types/node/querystring.d.ts +141 -0
  230. package/node_modules/@types/node/readline/promises.d.ts +143 -0
  231. package/node_modules/@types/node/readline.d.ts +666 -0
  232. package/node_modules/@types/node/repl.d.ts +430 -0
  233. package/node_modules/@types/node/stream/consumers.d.ts +12 -0
  234. package/node_modules/@types/node/stream/promises.d.ts +83 -0
  235. package/node_modules/@types/node/stream/web.d.ts +336 -0
  236. package/node_modules/@types/node/stream.d.ts +1731 -0
  237. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  238. package/node_modules/@types/node/test.d.ts +1113 -0
  239. package/node_modules/@types/node/timers/promises.d.ts +93 -0
  240. package/node_modules/@types/node/timers.d.ts +126 -0
  241. package/node_modules/@types/node/tls.d.ts +1203 -0
  242. package/node_modules/@types/node/trace_events.d.ts +171 -0
  243. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  244. package/node_modules/@types/node/ts4.8/assert.d.ts +985 -0
  245. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +522 -0
  246. package/node_modules/@types/node/ts4.8/buffer.d.ts +2321 -0
  247. package/node_modules/@types/node/ts4.8/child_process.d.ts +1544 -0
  248. package/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
  249. package/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  250. package/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
  251. package/node_modules/@types/node/ts4.8/crypto.d.ts +4450 -0
  252. package/node_modules/@types/node/ts4.8/dgram.d.ts +586 -0
  253. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +192 -0
  254. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +381 -0
  255. package/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
  256. package/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
  257. package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  258. package/node_modules/@types/node/ts4.8/events.d.ts +754 -0
  259. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1205 -0
  260. package/node_modules/@types/node/ts4.8/fs.d.ts +4211 -0
  261. package/node_modules/@types/node/ts4.8/globals.d.ts +377 -0
  262. package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  263. package/node_modules/@types/node/ts4.8/http.d.ts +1801 -0
  264. package/node_modules/@types/node/ts4.8/http2.d.ts +2386 -0
  265. package/node_modules/@types/node/ts4.8/https.d.ts +544 -0
  266. package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  267. package/node_modules/@types/node/ts4.8/inspector.d.ts +2739 -0
  268. package/node_modules/@types/node/ts4.8/module.d.ts +298 -0
  269. package/node_modules/@types/node/ts4.8/net.d.ts +913 -0
  270. package/node_modules/@types/node/ts4.8/os.d.ts +473 -0
  271. package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  272. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +626 -0
  273. package/node_modules/@types/node/ts4.8/process.d.ts +1531 -0
  274. package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  275. package/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
  276. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
  277. package/node_modules/@types/node/ts4.8/readline.d.ts +666 -0
  278. package/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
  279. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  280. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
  281. package/node_modules/@types/node/ts4.8/stream/web.d.ts +336 -0
  282. package/node_modules/@types/node/ts4.8/stream.d.ts +1731 -0
  283. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  284. package/node_modules/@types/node/ts4.8/test.d.ts +1113 -0
  285. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  286. package/node_modules/@types/node/ts4.8/timers.d.ts +126 -0
  287. package/node_modules/@types/node/ts4.8/tls.d.ts +1203 -0
  288. package/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
  289. package/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
  290. package/node_modules/@types/node/ts4.8/url.d.ts +937 -0
  291. package/node_modules/@types/node/ts4.8/util.d.ts +2075 -0
  292. package/node_modules/@types/node/ts4.8/v8.d.ts +541 -0
  293. package/node_modules/@types/node/ts4.8/vm.d.ts +667 -0
  294. package/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  295. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +692 -0
  296. package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  297. package/node_modules/@types/node/tty.d.ts +206 -0
  298. package/node_modules/@types/node/url.d.ts +937 -0
  299. package/node_modules/@types/node/util.d.ts +2075 -0
  300. package/node_modules/@types/node/v8.d.ts +541 -0
  301. package/node_modules/@types/node/vm.d.ts +667 -0
  302. package/node_modules/@types/node/wasi.d.ts +158 -0
  303. package/node_modules/@types/node/worker_threads.d.ts +692 -0
  304. package/node_modules/@types/node/zlib.d.ts +517 -0
  305. package/node_modules/@types/react/LICENSE +21 -0
  306. package/node_modules/@types/react/README.md +16 -0
  307. package/node_modules/@types/react/experimental.d.ts +192 -0
  308. package/node_modules/@types/react/global.d.ts +151 -0
  309. package/node_modules/@types/react/index.d.ts +3175 -0
  310. package/node_modules/@types/react/jsx-dev-runtime.d.ts +2 -0
  311. package/node_modules/@types/react/jsx-runtime.d.ts +2 -0
  312. package/node_modules/@types/react/package.json +149 -0
  313. package/node_modules/@vitejs/plugin-react-refresh/LICENSE +21 -0
  314. package/node_modules/@vitejs/plugin-react-refresh/README.md +73 -0
  315. package/node_modules/@vitejs/plugin-react-refresh/index.d.ts +14 -0
  316. package/node_modules/@vitejs/plugin-react-refresh/index.js +239 -0
  317. package/node_modules/@vitejs/plugin-react-refresh/package.json +35 -0
  318. package/package.json +65 -0
  319. package/project.json +74 -0
  320. package/scripts/create-entry-files.ts +44 -0
  321. package/src/ExtensionServerClient/ExtensionServerClient.test.ts +730 -0
  322. package/src/ExtensionServerClient/ExtensionServerClient.ts +310 -0
  323. package/src/ExtensionServerClient/index.ts +2 -0
  324. package/src/ExtensionServerClient/types.ts +159 -0
  325. package/src/context/ExtensionServerProvider.test.tsx +173 -0
  326. package/src/context/ExtensionServerProvider.tsx +46 -0
  327. package/src/context/constants.ts +15 -0
  328. package/src/context/index.ts +3 -0
  329. package/src/context/types.ts +13 -0
  330. package/src/hooks/index.ts +5 -0
  331. package/src/hooks/useExtensionClient.ts +6 -0
  332. package/src/hooks/useExtensionServerContext.ts +4 -0
  333. package/src/hooks/useExtensionServerEvent.ts +11 -0
  334. package/src/hooks/useExtensionServerState.ts +6 -0
  335. package/src/hooks/useIsomorphicLayoutEffect.ts +6 -0
  336. package/src/i18n.test.ts +417 -0
  337. package/src/i18n.ts +208 -0
  338. package/src/index.ts +7 -0
  339. package/src/state/actions/actions.ts +36 -0
  340. package/src/state/actions/index.ts +2 -0
  341. package/src/state/actions/types.ts +26 -0
  342. package/src/state/index.ts +2 -0
  343. package/src/state/reducers/constants.ts +6 -0
  344. package/src/state/reducers/extensionServerReducer.test.ts +160 -0
  345. package/src/state/reducers/extensionServerReducer.ts +87 -0
  346. package/src/state/reducers/index.ts +3 -0
  347. package/src/state/reducers/types.ts +7 -0
  348. package/src/testing/MockExtensionServerProvider.tsx +36 -0
  349. package/src/testing/app.ts +15 -0
  350. package/src/testing/extensions.ts +70 -0
  351. package/src/testing/index.ts +3 -0
  352. package/src/types.ts +172 -0
  353. package/src/utilities/assetToString.test.ts +16 -0
  354. package/src/utilities/assetToString.ts +8 -0
  355. package/src/utilities/groupByKey.ts +3 -0
  356. package/src/utilities/index.ts +7 -0
  357. package/src/utilities/isUIExtension.ts +7 -0
  358. package/src/utilities/isValidSurface.ts +7 -0
  359. package/src/utilities/noop.ts +1 -0
  360. package/src/utilities/replaceUpdated.test.ts +26 -0
  361. package/src/utilities/replaceUpdated.ts +16 -0
  362. package/src/utilities/set.test.ts +19 -0
  363. package/src/utilities/set.ts +29 -0
  364. package/testing.d.ts +1 -0
  365. package/testing.js +1 -0
  366. package/testing.mjs +1 -0
  367. package/tests/setup.ts +6 -0
@@ -0,0 +1,937 @@
1
+ /**
2
+ * The `url` module provides utilities for URL resolution and parsing. It can be
3
+ * accessed using:
4
+ *
5
+ * ```js
6
+ * import url from 'url';
7
+ * ```
8
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/url.js)
9
+ */
10
+ declare module "url" {
11
+ import { Blob as NodeBlob } from "node:buffer";
12
+ import { ClientRequestArgs } from "node:http";
13
+ import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring";
14
+ // Input to `url.format`
15
+ interface UrlObject {
16
+ auth?: string | null | undefined;
17
+ hash?: string | null | undefined;
18
+ host?: string | null | undefined;
19
+ hostname?: string | null | undefined;
20
+ href?: string | null | undefined;
21
+ pathname?: string | null | undefined;
22
+ protocol?: string | null | undefined;
23
+ search?: string | null | undefined;
24
+ slashes?: boolean | null | undefined;
25
+ port?: string | number | null | undefined;
26
+ query?: string | null | ParsedUrlQueryInput | undefined;
27
+ }
28
+ // Output of `url.parse`
29
+ interface Url {
30
+ auth: string | null;
31
+ hash: string | null;
32
+ host: string | null;
33
+ hostname: string | null;
34
+ href: string;
35
+ path: string | null;
36
+ pathname: string | null;
37
+ protocol: string | null;
38
+ search: string | null;
39
+ slashes: boolean | null;
40
+ port: string | null;
41
+ query: string | null | ParsedUrlQuery;
42
+ }
43
+ interface UrlWithParsedQuery extends Url {
44
+ query: ParsedUrlQuery;
45
+ }
46
+ interface UrlWithStringQuery extends Url {
47
+ query: string | null;
48
+ }
49
+ /**
50
+ * The `url.parse()` method takes a URL string, parses it, and returns a URL
51
+ * object.
52
+ *
53
+ * A `TypeError` is thrown if `urlString` is not a string.
54
+ *
55
+ * A `URIError` is thrown if the `auth` property is present but cannot be decoded.
56
+ *
57
+ * Use of the legacy `url.parse()` method is discouraged. Users should
58
+ * use the WHATWG `URL` API. Because the `url.parse()` method uses a
59
+ * lenient, non-standard algorithm for parsing URL strings, security
60
+ * issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
61
+ * incorrect handling of usernames and passwords have been identified.
62
+ *
63
+ * Deprecation of this API has been shelved for now primarily due to the the
64
+ * inability of the [WHATWG API to parse relative URLs](https://github.com/nodejs/node/issues/12682#issuecomment-1154492373).
65
+ * [Discussions are ongoing](https://github.com/whatwg/url/issues/531) for the best way to resolve this.
66
+ *
67
+ * @since v0.1.25
68
+ * @param urlString The URL string to parse.
69
+ * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
70
+ * on the returned URL object will be an unparsed, undecoded string.
71
+ * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the
72
+ * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
73
+ */
74
+ function parse(urlString: string): UrlWithStringQuery;
75
+ function parse(
76
+ urlString: string,
77
+ parseQueryString: false | undefined,
78
+ slashesDenoteHost?: boolean,
79
+ ): UrlWithStringQuery;
80
+ function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
81
+ function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
82
+ /**
83
+ * The `url.format()` method returns a formatted URL string derived from`urlObject`.
84
+ *
85
+ * ```js
86
+ * const url = require('url');
87
+ * url.format({
88
+ * protocol: 'https',
89
+ * hostname: 'example.com',
90
+ * pathname: '/some/path',
91
+ * query: {
92
+ * page: 1,
93
+ * format: 'json'
94
+ * }
95
+ * });
96
+ *
97
+ * // => 'https://example.com/some/path?page=1&format=json'
98
+ * ```
99
+ *
100
+ * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`.
101
+ *
102
+ * The formatting process operates as follows:
103
+ *
104
+ * * A new empty string `result` is created.
105
+ * * If `urlObject.protocol` is a string, it is appended as-is to `result`.
106
+ * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
107
+ * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
108
+ * colon (`:`) character, the literal string `:` will be appended to `result`.
109
+ * * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
110
+ * * `urlObject.slashes` property is true;
111
+ * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
112
+ * * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
113
+ * and appended to `result`followed by the literal string `@`.
114
+ * * If the `urlObject.host` property is `undefined` then:
115
+ * * If the `urlObject.hostname` is a string, it is appended to `result`.
116
+ * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
117
+ * an `Error` is thrown.
118
+ * * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
119
+ * * The literal string `:` is appended to `result`, and
120
+ * * The value of `urlObject.port` is coerced to a string and appended to`result`.
121
+ * * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
122
+ * * If the `urlObject.pathname` property is a string that is not an empty string:
123
+ * * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
124
+ * (`/`), then the literal string `'/'` is appended to `result`.
125
+ * * The value of `urlObject.pathname` is appended to `result`.
126
+ * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
127
+ * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
128
+ * `querystring` module's `stringify()`method passing the value of `urlObject.query`.
129
+ * * Otherwise, if `urlObject.search` is a string:
130
+ * * If the value of `urlObject.search`_does not start_ with the ASCII question
131
+ * mark (`?`) character, the literal string `?` is appended to `result`.
132
+ * * The value of `urlObject.search` is appended to `result`.
133
+ * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
134
+ * * If the `urlObject.hash` property is a string:
135
+ * * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
136
+ * character, the literal string `#` is appended to `result`.
137
+ * * The value of `urlObject.hash` is appended to `result`.
138
+ * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
139
+ * string, an `Error` is thrown.
140
+ * * `result` is returned.
141
+ * @since v0.1.25
142
+ * @legacy Use the WHATWG URL API instead.
143
+ * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
144
+ */
145
+ function format(urlObject: URL, options?: URLFormatOptions): string;
146
+ /**
147
+ * The `url.format()` method returns a formatted URL string derived from`urlObject`.
148
+ *
149
+ * ```js
150
+ * const url = require('url');
151
+ * url.format({
152
+ * protocol: 'https',
153
+ * hostname: 'example.com',
154
+ * pathname: '/some/path',
155
+ * query: {
156
+ * page: 1,
157
+ * format: 'json'
158
+ * }
159
+ * });
160
+ *
161
+ * // => 'https://example.com/some/path?page=1&format=json'
162
+ * ```
163
+ *
164
+ * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`.
165
+ *
166
+ * The formatting process operates as follows:
167
+ *
168
+ * * A new empty string `result` is created.
169
+ * * If `urlObject.protocol` is a string, it is appended as-is to `result`.
170
+ * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
171
+ * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
172
+ * colon (`:`) character, the literal string `:` will be appended to `result`.
173
+ * * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
174
+ * * `urlObject.slashes` property is true;
175
+ * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
176
+ * * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
177
+ * and appended to `result`followed by the literal string `@`.
178
+ * * If the `urlObject.host` property is `undefined` then:
179
+ * * If the `urlObject.hostname` is a string, it is appended to `result`.
180
+ * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
181
+ * an `Error` is thrown.
182
+ * * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
183
+ * * The literal string `:` is appended to `result`, and
184
+ * * The value of `urlObject.port` is coerced to a string and appended to`result`.
185
+ * * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
186
+ * * If the `urlObject.pathname` property is a string that is not an empty string:
187
+ * * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
188
+ * (`/`), then the literal string `'/'` is appended to `result`.
189
+ * * The value of `urlObject.pathname` is appended to `result`.
190
+ * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
191
+ * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
192
+ * `querystring` module's `stringify()`method passing the value of `urlObject.query`.
193
+ * * Otherwise, if `urlObject.search` is a string:
194
+ * * If the value of `urlObject.search`_does not start_ with the ASCII question
195
+ * mark (`?`) character, the literal string `?` is appended to `result`.
196
+ * * The value of `urlObject.search` is appended to `result`.
197
+ * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
198
+ * * If the `urlObject.hash` property is a string:
199
+ * * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
200
+ * character, the literal string `#` is appended to `result`.
201
+ * * The value of `urlObject.hash` is appended to `result`.
202
+ * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
203
+ * string, an `Error` is thrown.
204
+ * * `result` is returned.
205
+ * @since v0.1.25
206
+ * @legacy Use the WHATWG URL API instead.
207
+ * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
208
+ */
209
+ function format(urlObject: UrlObject | string): string;
210
+ /**
211
+ * The `url.resolve()` method resolves a target URL relative to a base URL in a
212
+ * manner similar to that of a web browser resolving an anchor tag.
213
+ *
214
+ * ```js
215
+ * const url = require('url');
216
+ * url.resolve('/one/two/three', 'four'); // '/one/two/four'
217
+ * url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
218
+ * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
219
+ * ```
220
+ *
221
+ * To achieve the same result using the WHATWG URL API:
222
+ *
223
+ * ```js
224
+ * function resolve(from, to) {
225
+ * const resolvedUrl = new URL(to, new URL(from, 'resolve://'));
226
+ * if (resolvedUrl.protocol === 'resolve:') {
227
+ * // `from` is a relative URL.
228
+ * const { pathname, search, hash } = resolvedUrl;
229
+ * return pathname + search + hash;
230
+ * }
231
+ * return resolvedUrl.toString();
232
+ * }
233
+ *
234
+ * resolve('/one/two/three', 'four'); // '/one/two/four'
235
+ * resolve('http://example.com/', '/one'); // 'http://example.com/one'
236
+ * resolve('http://example.com/one', '/two'); // 'http://example.com/two'
237
+ * ```
238
+ * @since v0.1.25
239
+ * @legacy Use the WHATWG URL API instead.
240
+ * @param from The base URL to use if `to` is a relative URL.
241
+ * @param to The target URL to resolve.
242
+ */
243
+ function resolve(from: string, to: string): string;
244
+ /**
245
+ * Returns the [Punycode](https://tools.ietf.org/html/rfc5891#section-4.4) ASCII serialization of the `domain`. If `domain` is an
246
+ * invalid domain, the empty string is returned.
247
+ *
248
+ * It performs the inverse operation to {@link domainToUnicode}.
249
+ *
250
+ * This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
251
+ *
252
+ * ```js
253
+ * import url from 'url';
254
+ *
255
+ * console.log(url.domainToASCII('español.com'));
256
+ * // Prints xn--espaol-zwa.com
257
+ * console.log(url.domainToASCII('中文.com'));
258
+ * // Prints xn--fiq228c.com
259
+ * console.log(url.domainToASCII('xn--iñvalid.com'));
260
+ * // Prints an empty string
261
+ * ```
262
+ * @since v7.4.0, v6.13.0
263
+ */
264
+ function domainToASCII(domain: string): string;
265
+ /**
266
+ * Returns the Unicode serialization of the `domain`. If `domain` is an invalid
267
+ * domain, the empty string is returned.
268
+ *
269
+ * It performs the inverse operation to {@link domainToASCII}.
270
+ *
271
+ * This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
272
+ *
273
+ * ```js
274
+ * import url from 'url';
275
+ *
276
+ * console.log(url.domainToUnicode('xn--espaol-zwa.com'));
277
+ * // Prints español.com
278
+ * console.log(url.domainToUnicode('xn--fiq228c.com'));
279
+ * // Prints 中文.com
280
+ * console.log(url.domainToUnicode('xn--iñvalid.com'));
281
+ * // Prints an empty string
282
+ * ```
283
+ * @since v7.4.0, v6.13.0
284
+ */
285
+ function domainToUnicode(domain: string): string;
286
+ /**
287
+ * This function ensures the correct decodings of percent-encoded characters as
288
+ * well as ensuring a cross-platform valid absolute path string.
289
+ *
290
+ * ```js
291
+ * import { fileURLToPath } from 'url';
292
+ *
293
+ * const __filename = fileURLToPath(import.meta.url);
294
+ *
295
+ * new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/
296
+ * fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows)
297
+ *
298
+ * new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt
299
+ * fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows)
300
+ *
301
+ * new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt
302
+ * fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX)
303
+ *
304
+ * new URL('file:///hello world').pathname; // Incorrect: /hello%20world
305
+ * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
306
+ * ```
307
+ * @since v10.12.0
308
+ * @param url The file URL string or URL object to convert to a path.
309
+ * @return The fully-resolved platform-specific Node.js file path.
310
+ */
311
+ function fileURLToPath(url: string | URL): string;
312
+ /**
313
+ * This function ensures that `path` is resolved absolutely, and that the URL
314
+ * control characters are correctly encoded when converting into a File URL.
315
+ *
316
+ * ```js
317
+ * import { pathToFileURL } from 'url';
318
+ *
319
+ * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
320
+ * pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
321
+ *
322
+ * new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c
323
+ * pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX)
324
+ * ```
325
+ * @since v10.12.0
326
+ * @param path The path to convert to a File URL.
327
+ * @return The file URL object.
328
+ */
329
+ function pathToFileURL(path: string): URL;
330
+ /**
331
+ * This utility function converts a URL object into an ordinary options object as
332
+ * expected by the `http.request()` and `https.request()` APIs.
333
+ *
334
+ * ```js
335
+ * import { urlToHttpOptions } from 'url';
336
+ * const myURL = new URL('https://a:b@測試?abc#foo');
337
+ *
338
+ * console.log(urlToHttpOptions(myURL));
339
+ * /*
340
+ * {
341
+ * protocol: 'https:',
342
+ * hostname: 'xn--g6w251d',
343
+ * hash: '#foo',
344
+ * search: '?abc',
345
+ * pathname: '/',
346
+ * path: '/?abc',
347
+ * href: 'https://a:b@xn--g6w251d/?abc#foo',
348
+ * auth: 'a:b'
349
+ * }
350
+ *
351
+ * ```
352
+ * @since v15.7.0, v14.18.0
353
+ * @param url The `WHATWG URL` object to convert to an options object.
354
+ * @return Options object
355
+ */
356
+ function urlToHttpOptions(url: URL): ClientRequestArgs;
357
+ interface URLFormatOptions {
358
+ auth?: boolean | undefined;
359
+ fragment?: boolean | undefined;
360
+ search?: boolean | undefined;
361
+ unicode?: boolean | undefined;
362
+ }
363
+ /**
364
+ * Browser-compatible `URL` class, implemented by following the WHATWG URL
365
+ * Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself.
366
+ * The `URL` class is also available on the global object.
367
+ *
368
+ * In accordance with browser conventions, all properties of `URL` objects
369
+ * are implemented as getters and setters on the class prototype, rather than as
370
+ * data properties on the object itself. Thus, unlike `legacy urlObject` s,
371
+ * using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
372
+ * return `true`.
373
+ * @since v7.0.0, v6.13.0
374
+ */
375
+ class URL {
376
+ /**
377
+ * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
378
+ *
379
+ * ```js
380
+ * const {
381
+ * Blob,
382
+ * resolveObjectURL,
383
+ * } = require('buffer');
384
+ *
385
+ * const blob = new Blob(['hello']);
386
+ * const id = URL.createObjectURL(blob);
387
+ *
388
+ * // later...
389
+ *
390
+ * const otherBlob = resolveObjectURL(id);
391
+ * console.log(otherBlob.size);
392
+ * ```
393
+ *
394
+ * The data stored by the registered `Blob` will be retained in memory until`URL.revokeObjectURL()` is called to remove it.
395
+ *
396
+ * `Blob` objects are registered within the current thread. If using Worker
397
+ * Threads, `Blob` objects registered within one Worker will not be available
398
+ * to other workers or the main thread.
399
+ * @since v16.7.0
400
+ * @experimental
401
+ */
402
+ static createObjectURL(blob: NodeBlob): string;
403
+ /**
404
+ * Removes the stored `Blob` identified by the given ID. Attempting to revoke a
405
+ * ID that isn’t registered will silently fail.
406
+ * @since v16.7.0
407
+ * @experimental
408
+ * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
409
+ */
410
+ static revokeObjectURL(objectUrl: string): void;
411
+ /**
412
+ * Checks if an `input` relative to the `base` can be parsed to a `URL`.
413
+ *
414
+ * ```js
415
+ * const isValid = URL.canParse('/foo', 'https://example.org/'); // true
416
+ *
417
+ * const isNotValid = URL.canParse('/foo'); // false
418
+ * ```
419
+ * @since v18.17.0
420
+ * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
421
+ * `converted to a string` first.
422
+ * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
423
+ */
424
+ static canParse(input: string, base?: string): boolean;
425
+ constructor(input: string, base?: string | URL);
426
+ /**
427
+ * Gets and sets the fragment portion of the URL.
428
+ *
429
+ * ```js
430
+ * const myURL = new URL('https://example.org/foo#bar');
431
+ * console.log(myURL.hash);
432
+ * // Prints #bar
433
+ *
434
+ * myURL.hash = 'baz';
435
+ * console.log(myURL.href);
436
+ * // Prints https://example.org/foo#baz
437
+ * ```
438
+ *
439
+ * Invalid URL characters included in the value assigned to the `hash` property
440
+ * are `percent-encoded`. The selection of which characters to
441
+ * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
442
+ */
443
+ hash: string;
444
+ /**
445
+ * Gets and sets the host portion of the URL.
446
+ *
447
+ * ```js
448
+ * const myURL = new URL('https://example.org:81/foo');
449
+ * console.log(myURL.host);
450
+ * // Prints example.org:81
451
+ *
452
+ * myURL.host = 'example.com:82';
453
+ * console.log(myURL.href);
454
+ * // Prints https://example.com:82/foo
455
+ * ```
456
+ *
457
+ * Invalid host values assigned to the `host` property are ignored.
458
+ */
459
+ host: string;
460
+ /**
461
+ * Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the
462
+ * port.
463
+ *
464
+ * ```js
465
+ * const myURL = new URL('https://example.org:81/foo');
466
+ * console.log(myURL.hostname);
467
+ * // Prints example.org
468
+ *
469
+ * // Setting the hostname does not change the port
470
+ * myURL.hostname = 'example.com:82';
471
+ * console.log(myURL.href);
472
+ * // Prints https://example.com:81/foo
473
+ *
474
+ * // Use myURL.host to change the hostname and port
475
+ * myURL.host = 'example.org:82';
476
+ * console.log(myURL.href);
477
+ * // Prints https://example.org:82/foo
478
+ * ```
479
+ *
480
+ * Invalid host name values assigned to the `hostname` property are ignored.
481
+ */
482
+ hostname: string;
483
+ /**
484
+ * Gets and sets the serialized URL.
485
+ *
486
+ * ```js
487
+ * const myURL = new URL('https://example.org/foo');
488
+ * console.log(myURL.href);
489
+ * // Prints https://example.org/foo
490
+ *
491
+ * myURL.href = 'https://example.com/bar';
492
+ * console.log(myURL.href);
493
+ * // Prints https://example.com/bar
494
+ * ```
495
+ *
496
+ * Getting the value of the `href` property is equivalent to calling {@link toString}.
497
+ *
498
+ * Setting the value of this property to a new value is equivalent to creating a
499
+ * new `URL` object using `new URL(value)`. Each of the `URL`object's properties will be modified.
500
+ *
501
+ * If the value assigned to the `href` property is not a valid URL, a `TypeError`will be thrown.
502
+ */
503
+ href: string;
504
+ /**
505
+ * Gets the read-only serialization of the URL's origin.
506
+ *
507
+ * ```js
508
+ * const myURL = new URL('https://example.org/foo/bar?baz');
509
+ * console.log(myURL.origin);
510
+ * // Prints https://example.org
511
+ * ```
512
+ *
513
+ * ```js
514
+ * const idnURL = new URL('https://測試');
515
+ * console.log(idnURL.origin);
516
+ * // Prints https://xn--g6w251d
517
+ *
518
+ * console.log(idnURL.hostname);
519
+ * // Prints xn--g6w251d
520
+ * ```
521
+ */
522
+ readonly origin: string;
523
+ /**
524
+ * Gets and sets the password portion of the URL.
525
+ *
526
+ * ```js
527
+ * const myURL = new URL('https://abc:xyz@example.com');
528
+ * console.log(myURL.password);
529
+ * // Prints xyz
530
+ *
531
+ * myURL.password = '123';
532
+ * console.log(myURL.href);
533
+ * // Prints https://abc:123@example.com
534
+ * ```
535
+ *
536
+ * Invalid URL characters included in the value assigned to the `password` property
537
+ * are `percent-encoded`. The selection of which characters to
538
+ * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
539
+ */
540
+ password: string;
541
+ /**
542
+ * Gets and sets the path portion of the URL.
543
+ *
544
+ * ```js
545
+ * const myURL = new URL('https://example.org/abc/xyz?123');
546
+ * console.log(myURL.pathname);
547
+ * // Prints /abc/xyz
548
+ *
549
+ * myURL.pathname = '/abcdef';
550
+ * console.log(myURL.href);
551
+ * // Prints https://example.org/abcdef?123
552
+ * ```
553
+ *
554
+ * Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters
555
+ * to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
556
+ */
557
+ pathname: string;
558
+ /**
559
+ * Gets and sets the port portion of the URL.
560
+ *
561
+ * The port value may be a number or a string containing a number in the range`0` to `65535` (inclusive). Setting the value to the default port of the`URL` objects given `protocol` will
562
+ * result in the `port` value becoming
563
+ * the empty string (`''`).
564
+ *
565
+ * The port value can be an empty string in which case the port depends on
566
+ * the protocol/scheme:
567
+ *
568
+ * <omitted>
569
+ *
570
+ * Upon assigning a value to the port, the value will first be converted to a
571
+ * string using `.toString()`.
572
+ *
573
+ * If that string is invalid but it begins with a number, the leading number is
574
+ * assigned to `port`.
575
+ * If the number lies outside the range denoted above, it is ignored.
576
+ *
577
+ * ```js
578
+ * const myURL = new URL('https://example.org:8888');
579
+ * console.log(myURL.port);
580
+ * // Prints 8888
581
+ *
582
+ * // Default ports are automatically transformed to the empty string
583
+ * // (HTTPS protocol's default port is 443)
584
+ * myURL.port = '443';
585
+ * console.log(myURL.port);
586
+ * // Prints the empty string
587
+ * console.log(myURL.href);
588
+ * // Prints https://example.org/
589
+ *
590
+ * myURL.port = 1234;
591
+ * console.log(myURL.port);
592
+ * // Prints 1234
593
+ * console.log(myURL.href);
594
+ * // Prints https://example.org:1234/
595
+ *
596
+ * // Completely invalid port strings are ignored
597
+ * myURL.port = 'abcd';
598
+ * console.log(myURL.port);
599
+ * // Prints 1234
600
+ *
601
+ * // Leading numbers are treated as a port number
602
+ * myURL.port = '5678abcd';
603
+ * console.log(myURL.port);
604
+ * // Prints 5678
605
+ *
606
+ * // Non-integers are truncated
607
+ * myURL.port = 1234.5678;
608
+ * console.log(myURL.port);
609
+ * // Prints 1234
610
+ *
611
+ * // Out-of-range numbers which are not represented in scientific notation
612
+ * // will be ignored.
613
+ * myURL.port = 1e10; // 10000000000, will be range-checked as described below
614
+ * console.log(myURL.port);
615
+ * // Prints 1234
616
+ * ```
617
+ *
618
+ * Numbers which contain a decimal point,
619
+ * such as floating-point numbers or numbers in scientific notation,
620
+ * are not an exception to this rule.
621
+ * Leading numbers up to the decimal point will be set as the URL's port,
622
+ * assuming they are valid:
623
+ *
624
+ * ```js
625
+ * myURL.port = 4.567e21;
626
+ * console.log(myURL.port);
627
+ * // Prints 4 (because it is the leading number in the string '4.567e21')
628
+ * ```
629
+ */
630
+ port: string;
631
+ /**
632
+ * Gets and sets the protocol portion of the URL.
633
+ *
634
+ * ```js
635
+ * const myURL = new URL('https://example.org');
636
+ * console.log(myURL.protocol);
637
+ * // Prints https:
638
+ *
639
+ * myURL.protocol = 'ftp';
640
+ * console.log(myURL.href);
641
+ * // Prints ftp://example.org/
642
+ * ```
643
+ *
644
+ * Invalid URL protocol values assigned to the `protocol` property are ignored.
645
+ */
646
+ protocol: string;
647
+ /**
648
+ * Gets and sets the serialized query portion of the URL.
649
+ *
650
+ * ```js
651
+ * const myURL = new URL('https://example.org/abc?123');
652
+ * console.log(myURL.search);
653
+ * // Prints ?123
654
+ *
655
+ * myURL.search = 'abc=xyz';
656
+ * console.log(myURL.href);
657
+ * // Prints https://example.org/abc?abc=xyz
658
+ * ```
659
+ *
660
+ * Any invalid URL characters appearing in the value assigned the `search`property will be `percent-encoded`. The selection of which
661
+ * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
662
+ */
663
+ search: string;
664
+ /**
665
+ * Gets the `URLSearchParams` object representing the query parameters of the
666
+ * URL. This property is read-only but the `URLSearchParams` object it provides
667
+ * can be used to mutate the URL instance; to replace the entirety of query
668
+ * parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details.
669
+ *
670
+ * Use care when using `.searchParams` to modify the `URL` because,
671
+ * per the WHATWG specification, the `URLSearchParams` object uses
672
+ * different rules to determine which characters to percent-encode. For
673
+ * instance, the `URL` object will not percent encode the ASCII tilde (`~`)
674
+ * character, while `URLSearchParams` will always encode it:
675
+ *
676
+ * ```js
677
+ * const myUrl = new URL('https://example.org/abc?foo=~bar');
678
+ *
679
+ * console.log(myUrl.search); // prints ?foo=~bar
680
+ *
681
+ * // Modify the URL via searchParams...
682
+ * myUrl.searchParams.sort();
683
+ *
684
+ * console.log(myUrl.search); // prints ?foo=%7Ebar
685
+ * ```
686
+ */
687
+ readonly searchParams: URLSearchParams;
688
+ /**
689
+ * Gets and sets the username portion of the URL.
690
+ *
691
+ * ```js
692
+ * const myURL = new URL('https://abc:xyz@example.com');
693
+ * console.log(myURL.username);
694
+ * // Prints abc
695
+ *
696
+ * myURL.username = '123';
697
+ * console.log(myURL.href);
698
+ * // Prints https://123:xyz@example.com/
699
+ * ```
700
+ *
701
+ * Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which
702
+ * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
703
+ */
704
+ username: string;
705
+ /**
706
+ * The `toString()` method on the `URL` object returns the serialized URL. The
707
+ * value returned is equivalent to that of {@link href} and {@link toJSON}.
708
+ */
709
+ toString(): string;
710
+ /**
711
+ * The `toJSON()` method on the `URL` object returns the serialized URL. The
712
+ * value returned is equivalent to that of {@link href} and {@link toString}.
713
+ *
714
+ * This method is automatically called when an `URL` object is serialized
715
+ * with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).
716
+ *
717
+ * ```js
718
+ * const myURLs = [
719
+ * new URL('https://www.example.com'),
720
+ * new URL('https://test.example.org'),
721
+ * ];
722
+ * console.log(JSON.stringify(myURLs));
723
+ * // Prints ["https://www.example.com/","https://test.example.org/"]
724
+ * ```
725
+ */
726
+ toJSON(): string;
727
+ }
728
+ /**
729
+ * The `URLSearchParams` API provides read and write access to the query of a`URL`. The `URLSearchParams` class can also be used standalone with one of the
730
+ * four following constructors.
731
+ * The `URLSearchParams` class is also available on the global object.
732
+ *
733
+ * The WHATWG `URLSearchParams` interface and the `querystring` module have
734
+ * similar purpose, but the purpose of the `querystring` module is more
735
+ * general, as it allows the customization of delimiter characters (`&#x26;` and `=`).
736
+ * On the other hand, this API is designed purely for URL query strings.
737
+ *
738
+ * ```js
739
+ * const myURL = new URL('https://example.org/?abc=123');
740
+ * console.log(myURL.searchParams.get('abc'));
741
+ * // Prints 123
742
+ *
743
+ * myURL.searchParams.append('abc', 'xyz');
744
+ * console.log(myURL.href);
745
+ * // Prints https://example.org/?abc=123&#x26;abc=xyz
746
+ *
747
+ * myURL.searchParams.delete('abc');
748
+ * myURL.searchParams.set('a', 'b');
749
+ * console.log(myURL.href);
750
+ * // Prints https://example.org/?a=b
751
+ *
752
+ * const newSearchParams = new URLSearchParams(myURL.searchParams);
753
+ * // The above is equivalent to
754
+ * // const newSearchParams = new URLSearchParams(myURL.search);
755
+ *
756
+ * newSearchParams.append('a', 'c');
757
+ * console.log(myURL.href);
758
+ * // Prints https://example.org/?a=b
759
+ * console.log(newSearchParams.toString());
760
+ * // Prints a=b&#x26;a=c
761
+ *
762
+ * // newSearchParams.toString() is implicitly called
763
+ * myURL.search = newSearchParams;
764
+ * console.log(myURL.href);
765
+ * // Prints https://example.org/?a=b&#x26;a=c
766
+ * newSearchParams.delete('a');
767
+ * console.log(myURL.href);
768
+ * // Prints https://example.org/?a=b&#x26;a=c
769
+ * ```
770
+ * @since v7.5.0, v6.13.0
771
+ */
772
+ class URLSearchParams implements Iterable<[string, string]> {
773
+ constructor(
774
+ init?:
775
+ | URLSearchParams
776
+ | string
777
+ | Record<string, string | readonly string[]>
778
+ | Iterable<[string, string]>
779
+ | ReadonlyArray<[string, string]>,
780
+ );
781
+ /**
782
+ * Append a new name-value pair to the query string.
783
+ */
784
+ append(name: string, value: string): void;
785
+ /**
786
+ * If `value` is provided, removes all name-value pairs
787
+ * where name is `name` and value is `value`..
788
+ *
789
+ * If `value` is not provided, removes all name-value pairs whose name is `name`.
790
+ */
791
+ delete(name: string, value?: string): void;
792
+ /**
793
+ * Returns an ES6 `Iterator` over each of the name-value pairs in the query.
794
+ * Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`.
795
+ *
796
+ * Alias for `urlSearchParams[@@iterator]()`.
797
+ */
798
+ entries(): IterableIterator<[string, string]>;
799
+ /**
800
+ * Iterates over each name-value pair in the query and invokes the given function.
801
+ *
802
+ * ```js
803
+ * const myURL = new URL('https://example.org/?a=b&#x26;c=d');
804
+ * myURL.searchParams.forEach((value, name, searchParams) => {
805
+ * console.log(name, value, myURL.searchParams === searchParams);
806
+ * });
807
+ * // Prints:
808
+ * // a b true
809
+ * // c d true
810
+ * ```
811
+ * @param fn Invoked for each name-value pair in the query
812
+ * @param thisArg To be used as `this` value for when `fn` is called
813
+ */
814
+ forEach<TThis = this>(
815
+ callback: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
816
+ thisArg?: TThis,
817
+ ): void;
818
+ /**
819
+ * Returns the value of the first name-value pair whose name is `name`. If there
820
+ * are no such pairs, `null` is returned.
821
+ * @return or `null` if there is no name-value pair with the given `name`.
822
+ */
823
+ get(name: string): string | null;
824
+ /**
825
+ * Returns the values of all name-value pairs whose name is `name`. If there are
826
+ * no such pairs, an empty array is returned.
827
+ */
828
+ getAll(name: string): string[];
829
+ /**
830
+ * Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument.
831
+ *
832
+ * If `value` is provided, returns `true` when name-value pair with
833
+ * same `name` and `value` exists.
834
+ *
835
+ * If `value` is not provided, returns `true` if there is at least one name-value
836
+ * pair whose name is `name`.
837
+ */
838
+ has(name: string, value?: string): boolean;
839
+ /**
840
+ * Returns an ES6 `Iterator` over the names of each name-value pair.
841
+ *
842
+ * ```js
843
+ * const params = new URLSearchParams('foo=bar&#x26;foo=baz');
844
+ * for (const name of params.keys()) {
845
+ * console.log(name);
846
+ * }
847
+ * // Prints:
848
+ * // foo
849
+ * // foo
850
+ * ```
851
+ */
852
+ keys(): IterableIterator<string>;
853
+ /**
854
+ * Sets the value in the `URLSearchParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`,
855
+ * set the first such pair's value to `value` and remove all others. If not,
856
+ * append the name-value pair to the query string.
857
+ *
858
+ * ```js
859
+ * const params = new URLSearchParams();
860
+ * params.append('foo', 'bar');
861
+ * params.append('foo', 'baz');
862
+ * params.append('abc', 'def');
863
+ * console.log(params.toString());
864
+ * // Prints foo=bar&#x26;foo=baz&#x26;abc=def
865
+ *
866
+ * params.set('foo', 'def');
867
+ * params.set('xyz', 'opq');
868
+ * console.log(params.toString());
869
+ * // Prints foo=def&#x26;abc=def&#x26;xyz=opq
870
+ * ```
871
+ */
872
+ set(name: string, value: string): void;
873
+ /**
874
+ * The total number of parameter entries.
875
+ * @since v18.16.0
876
+ */
877
+ readonly size: number;
878
+ /**
879
+ * Sort all existing name-value pairs in-place by their names. Sorting is done
880
+ * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs
881
+ * with the same name is preserved.
882
+ *
883
+ * This method can be used, in particular, to increase cache hits.
884
+ *
885
+ * ```js
886
+ * const params = new URLSearchParams('query[]=abc&#x26;type=search&#x26;query[]=123');
887
+ * params.sort();
888
+ * console.log(params.toString());
889
+ * // Prints query%5B%5D=abc&#x26;query%5B%5D=123&#x26;type=search
890
+ * ```
891
+ * @since v7.7.0, v6.13.0
892
+ */
893
+ sort(): void;
894
+ /**
895
+ * Returns the search parameters serialized as a string, with characters
896
+ * percent-encoded where necessary.
897
+ */
898
+ toString(): string;
899
+ /**
900
+ * Returns an ES6 `Iterator` over the values of each name-value pair.
901
+ */
902
+ values(): IterableIterator<string>;
903
+ [Symbol.iterator](): IterableIterator<[string, string]>;
904
+ }
905
+ import { URL as _URL, URLSearchParams as _URLSearchParams } from "url";
906
+ global {
907
+ interface URLSearchParams extends _URLSearchParams {}
908
+ interface URL extends _URL {}
909
+ interface Global {
910
+ URL: typeof _URL;
911
+ URLSearchParams: typeof _URLSearchParams;
912
+ }
913
+ /**
914
+ * `URL` class is a global reference for `require('url').URL`
915
+ * https://nodejs.org/api/url.html#the-whatwg-url-api
916
+ * @since v10.0.0
917
+ */
918
+ var URL: typeof globalThis extends {
919
+ onmessage: any;
920
+ URL: infer T;
921
+ } ? T
922
+ : typeof _URL;
923
+ /**
924
+ * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
925
+ * https://nodejs.org/api/url.html#class-urlsearchparams
926
+ * @since v10.0.0
927
+ */
928
+ var URLSearchParams: typeof globalThis extends {
929
+ onmessage: any;
930
+ URLSearchParams: infer T;
931
+ } ? T
932
+ : typeof _URLSearchParams;
933
+ }
934
+ }
935
+ declare module "node:url" {
936
+ export * from "url";
937
+ }