jopijs 0.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.
Files changed (455) hide show
  1. package/README.md +134 -0
  2. package/bin/jopib.js +4 -0
  3. package/bin/jopin.js +4 -0
  4. package/dist/@bundler/_logs.d.ts +2 -0
  5. package/dist/@bundler/_logs.js +4 -0
  6. package/dist/@bundler/_logs.js.map +1 -0
  7. package/dist/@bundler/core.d.ts +1 -0
  8. package/dist/@bundler/core.js +34 -0
  9. package/dist/@bundler/core.js.map +1 -0
  10. package/dist/@bundler/esbuild.d.ts +6 -0
  11. package/dist/@bundler/esbuild.js +111 -0
  12. package/dist/@bundler/esbuild.js.map +1 -0
  13. package/dist/@bundler/index.d.ts +2 -0
  14. package/dist/@bundler/index.js +3 -0
  15. package/dist/@bundler/index.js.map +1 -0
  16. package/dist/@bundler/plugins.d.ts +13 -0
  17. package/dist/@bundler/plugins.js +145 -0
  18. package/dist/@bundler/plugins.js.map +1 -0
  19. package/dist/@bundler/tailwind.d.ts +3 -0
  20. package/dist/@bundler/tailwind.js +119 -0
  21. package/dist/@bundler/tailwind.js.map +1 -0
  22. package/dist/@core/PageComponent.d.ts +6 -0
  23. package/dist/@core/PageComponent.js +10 -0
  24. package/dist/@core/PageComponent.js.map +1 -0
  25. package/dist/@core/_logs.d.ts +7 -0
  26. package/dist/@core/_logs.js +9 -0
  27. package/dist/@core/_logs.js.map +1 -0
  28. package/dist/@core/automaticStartStop.d.ts +25 -0
  29. package/dist/@core/automaticStartStop.js +106 -0
  30. package/dist/@core/automaticStartStop.js.map +1 -0
  31. package/dist/@core/browserCacheControl.d.ts +21 -0
  32. package/dist/@core/browserCacheControl.js +17 -0
  33. package/dist/@core/browserCacheControl.js.map +1 -0
  34. package/dist/@core/bundler/bundler.d.ts +22 -0
  35. package/dist/@core/bundler/bundler.js +90 -0
  36. package/dist/@core/bundler/bundler.js.map +1 -0
  37. package/dist/@core/bundler/common.d.ts +2 -0
  38. package/dist/@core/bundler/common.js +17 -0
  39. package/dist/@core/bundler/common.js.map +1 -0
  40. package/dist/@core/bundler/config.d.ts +20 -0
  41. package/dist/@core/bundler/config.js +11 -0
  42. package/dist/@core/bundler/config.js.map +1 -0
  43. package/dist/@core/bundler/extraContent.d.ts +6 -0
  44. package/dist/@core/bundler/extraContent.js +27 -0
  45. package/dist/@core/bundler/extraContent.js.map +1 -0
  46. package/dist/@core/bundler/pagesGenerator.d.ts +1 -0
  47. package/dist/@core/bundler/pagesGenerator.js +173 -0
  48. package/dist/@core/bundler/pagesGenerator.js.map +1 -0
  49. package/dist/@core/bundler/server.d.ts +8 -0
  50. package/dist/@core/bundler/server.js +35 -0
  51. package/dist/@core/bundler/server.js.map +1 -0
  52. package/dist/@core/caches/InMemoryCache.d.ts +35 -0
  53. package/dist/@core/caches/InMemoryCache.js +353 -0
  54. package/dist/@core/caches/InMemoryCache.js.map +1 -0
  55. package/dist/@core/caches/SimpleFileCache.d.ts +18 -0
  56. package/dist/@core/caches/SimpleFileCache.js +171 -0
  57. package/dist/@core/caches/SimpleFileCache.js.map +1 -0
  58. package/dist/@core/caches/cache.d.ts +36 -0
  59. package/dist/@core/caches/cache.js +33 -0
  60. package/dist/@core/caches/cache.js.map +1 -0
  61. package/dist/@core/caches/webSiteMirrorCache.d.ts +16 -0
  62. package/dist/@core/caches/webSiteMirrorCache.js +81 -0
  63. package/dist/@core/caches/webSiteMirrorCache.js.map +1 -0
  64. package/dist/@core/gzip.d.ts +4 -0
  65. package/dist/@core/gzip.js +31 -0
  66. package/dist/@core/gzip.js.map +1 -0
  67. package/dist/@core/index.d.ts +18 -0
  68. package/dist/@core/index.js +19 -0
  69. package/dist/@core/index.js.map +1 -0
  70. package/dist/@core/internalTools.d.ts +14 -0
  71. package/dist/@core/internalTools.js +79 -0
  72. package/dist/@core/internalTools.js.map +1 -0
  73. package/dist/@core/jQuery.d.ts +5 -0
  74. package/dist/@core/jQuery.js +18 -0
  75. package/dist/@core/jQuery.js.map +1 -0
  76. package/dist/@core/jopiEasy.d.ts +287 -0
  77. package/dist/@core/jopiEasy.js +983 -0
  78. package/dist/@core/jopiEasy.js.map +1 -0
  79. package/dist/@core/jopiRequest.d.ts +269 -0
  80. package/dist/@core/jopiRequest.js +1060 -0
  81. package/dist/@core/jopiRequest.js.map +1 -0
  82. package/dist/@core/jopiServer.d.ts +77 -0
  83. package/dist/@core/jopiServer.js +100 -0
  84. package/dist/@core/jopiServer.js.map +1 -0
  85. package/dist/@core/jopiWebSite.d.ts +319 -0
  86. package/dist/@core/jopiWebSite.js +653 -0
  87. package/dist/@core/jopiWebSite.js.map +1 -0
  88. package/dist/@core/letsEncrypt.d.ts +25 -0
  89. package/dist/@core/letsEncrypt.js +189 -0
  90. package/dist/@core/letsEncrypt.js.map +1 -0
  91. package/dist/@core/linker.d.ts +4 -0
  92. package/dist/@core/linker.js +37 -0
  93. package/dist/@core/linker.js.map +1 -0
  94. package/dist/@core/loadBalancing.d.ts +18 -0
  95. package/dist/@core/loadBalancing.js +126 -0
  96. package/dist/@core/loadBalancing.js.map +1 -0
  97. package/dist/@core/middlewares/CorsMiddleware.d.ts +5 -0
  98. package/dist/@core/middlewares/CorsMiddleware.js +15 -0
  99. package/dist/@core/middlewares/CorsMiddleware.js.map +1 -0
  100. package/dist/@core/middlewares/DdosProtection.d.ts +42 -0
  101. package/dist/@core/middlewares/DdosProtection.js +62 -0
  102. package/dist/@core/middlewares/DdosProtection.js.map +1 -0
  103. package/dist/@core/middlewares/index.d.ts +10 -0
  104. package/dist/@core/middlewares/index.js +14 -0
  105. package/dist/@core/middlewares/index.js.map +1 -0
  106. package/dist/@core/publicTools.d.ts +8 -0
  107. package/dist/@core/publicTools.js +11 -0
  108. package/dist/@core/publicTools.js.map +1 -0
  109. package/dist/@core/routeConfig.d.ts +48 -0
  110. package/dist/@core/routeConfig.js +102 -0
  111. package/dist/@core/routeConfig.js.map +1 -0
  112. package/dist/@core/searchParamFilter.d.ts +70 -0
  113. package/dist/@core/searchParamFilter.js +212 -0
  114. package/dist/@core/searchParamFilter.js.map +1 -0
  115. package/dist/@core/serverFetch.d.ts +122 -0
  116. package/dist/@core/serverFetch.js +312 -0
  117. package/dist/@core/serverFetch.js.map +1 -0
  118. package/dist/@core/serverImpl/server_bunjs.d.ts +29 -0
  119. package/dist/@core/serverImpl/server_bunjs.js +180 -0
  120. package/dist/@core/serverImpl/server_bunjs.js.map +1 -0
  121. package/dist/@core/serverImpl/server_nodejs.d.ts +22 -0
  122. package/dist/@core/serverImpl/server_nodejs.js +235 -0
  123. package/dist/@core/serverImpl/server_nodejs.js.map +1 -0
  124. package/dist/@core/serverInstanceBuilder.d.ts +17 -0
  125. package/dist/@core/serverInstanceBuilder.js +14 -0
  126. package/dist/@core/serverInstanceBuilder.js.map +1 -0
  127. package/dist/@core/userStores.d.ts +13 -0
  128. package/dist/@core/userStores.js +20 -0
  129. package/dist/@core/userStores.js.map +1 -0
  130. package/dist/@crawler/common.d.ts +203 -0
  131. package/dist/@crawler/common.js +68 -0
  132. package/dist/@crawler/common.js.map +1 -0
  133. package/dist/@crawler/core.d.ts +87 -0
  134. package/dist/@crawler/core.js +586 -0
  135. package/dist/@crawler/core.js.map +1 -0
  136. package/dist/@crawler/directFileCache.d.ts +10 -0
  137. package/dist/@crawler/directFileCache.js +60 -0
  138. package/dist/@crawler/directFileCache.js.map +1 -0
  139. package/dist/@crawler/index.d.ts +4 -0
  140. package/dist/@crawler/index.js +5 -0
  141. package/dist/@crawler/index.js.map +1 -0
  142. package/dist/@crawler/urlMapping.d.ts +21 -0
  143. package/dist/@crawler/urlMapping.js +52 -0
  144. package/dist/@crawler/urlMapping.js.map +1 -0
  145. package/dist/@crawler/utils.d.ts +6 -0
  146. package/dist/@crawler/utils.js +13 -0
  147. package/dist/@crawler/utils.js.map +1 -0
  148. package/dist/@generated/index.d.ts +29 -0
  149. package/dist/@generated/index.js +93 -0
  150. package/dist/@generated/index.js.map +1 -0
  151. package/dist/@linker/arobaseTypes.d.ts +50 -0
  152. package/dist/@linker/arobaseTypes.js +235 -0
  153. package/dist/@linker/arobaseTypes.js.map +1 -0
  154. package/dist/@linker/changeProof.d.ts +5 -0
  155. package/dist/@linker/changeProof.js +50 -0
  156. package/dist/@linker/changeProof.js.map +1 -0
  157. package/dist/@linker/config.d.ts +2 -0
  158. package/dist/@linker/config.js +40 -0
  159. package/dist/@linker/config.js.map +1 -0
  160. package/dist/@linker/engine.d.ts +156 -0
  161. package/dist/@linker/engine.js +665 -0
  162. package/dist/@linker/engine.js.map +1 -0
  163. package/dist/@linker/index.d.ts +3 -0
  164. package/dist/@linker/index.js +4 -0
  165. package/dist/@linker/index.js.map +1 -0
  166. package/dist/@linker/install.d.ts +4 -0
  167. package/dist/@linker/install.js +42 -0
  168. package/dist/@linker/install.js.map +1 -0
  169. package/dist/@linker/modInstaller.d.ts +10 -0
  170. package/dist/@linker/modInstaller.js +38 -0
  171. package/dist/@linker/modInstaller.js.map +1 -0
  172. package/dist/@linker/typeEvents.d.ts +9 -0
  173. package/dist/@linker/typeEvents.js +48 -0
  174. package/dist/@linker/typeEvents.js.map +1 -0
  175. package/dist/@linker/typeRoutes.d.ts +23 -0
  176. package/dist/@linker/typeRoutes.js +197 -0
  177. package/dist/@linker/typeRoutes.js.map +1 -0
  178. package/dist/@linker/typeUiComposite.d.ts +6 -0
  179. package/dist/@linker/typeUiComposite.js +16 -0
  180. package/dist/@linker/typeUiComposite.js.map +1 -0
  181. package/dist/@loader/index.d.ts +1 -0
  182. package/dist/@loader/index.js +17 -0
  183. package/dist/@loader/index.js.map +1 -0
  184. package/dist/@loader/nodeJsLoader.d.ts +2 -0
  185. package/dist/@loader/nodeJsLoader.js +19 -0
  186. package/dist/@loader/nodeJsLoader.js.map +1 -0
  187. package/dist/@loader-client/index.d.ts +33 -0
  188. package/dist/@loader-client/index.js +98 -0
  189. package/dist/@loader-client/index.js.map +1 -0
  190. package/dist/@loader-tools/bunJsLoader.d.ts +1 -0
  191. package/dist/@loader-tools/bunJsLoader.js +28 -0
  192. package/dist/@loader-tools/bunJsLoader.js.map +1 -0
  193. package/dist/@loader-tools/config.d.ts +49 -0
  194. package/dist/@loader-tools/config.js +79 -0
  195. package/dist/@loader-tools/config.js.map +1 -0
  196. package/dist/@loader-tools/cssModuleCompiler.d.ts +5 -0
  197. package/dist/@loader-tools/cssModuleCompiler.js +65 -0
  198. package/dist/@loader-tools/cssModuleCompiler.js.map +1 -0
  199. package/dist/@loader-tools/esBuildPlugin.d.ts +5 -0
  200. package/dist/@loader-tools/esBuildPlugin.js +113 -0
  201. package/dist/@loader-tools/esBuildPlugin.js.map +1 -0
  202. package/dist/@loader-tools/index.d.ts +9 -0
  203. package/dist/@loader-tools/index.js +10 -0
  204. package/dist/@loader-tools/index.js.map +1 -0
  205. package/dist/@loader-tools/jopin.d.ts +10 -0
  206. package/dist/@loader-tools/jopin.js +331 -0
  207. package/dist/@loader-tools/jopin.js.map +1 -0
  208. package/dist/@loader-tools/nodeJsLoader.d.ts +13 -0
  209. package/dist/@loader-tools/nodeJsLoader.js +101 -0
  210. package/dist/@loader-tools/nodeJsLoader.js.map +1 -0
  211. package/dist/@loader-tools/nodeJsResolver.d.ts +2 -0
  212. package/dist/@loader-tools/nodeJsResolver.js +117 -0
  213. package/dist/@loader-tools/nodeJsResolver.js.map +1 -0
  214. package/dist/@loader-tools/rules.d.ts +3 -0
  215. package/dist/@loader-tools/rules.js +33 -0
  216. package/dist/@loader-tools/rules.js.map +1 -0
  217. package/dist/@loader-tools/sourceChangesWatcher.d.ts +39 -0
  218. package/dist/@loader-tools/sourceChangesWatcher.js +182 -0
  219. package/dist/@loader-tools/sourceChangesWatcher.js.map +1 -0
  220. package/dist/@loader-tools/tools.d.ts +21 -0
  221. package/dist/@loader-tools/tools.js +113 -0
  222. package/dist/@loader-tools/tools.js.map +1 -0
  223. package/dist/@loader-tools/transform.d.ts +5 -0
  224. package/dist/@loader-tools/transform.js +114 -0
  225. package/dist/@loader-tools/transform.js.map +1 -0
  226. package/dist/@loader-tools/virtualUrl.d.ts +9 -0
  227. package/dist/@loader-tools/virtualUrl.js +40 -0
  228. package/dist/@loader-tools/virtualUrl.js.map +1 -0
  229. package/dist/@tool-jopinb/index.d.ts +1 -0
  230. package/dist/@tool-jopinb/index.js +9 -0
  231. package/dist/@tool-jopinb/index.js.map +1 -0
  232. package/dist/@ui/components.d.ts +27 -0
  233. package/dist/@ui/components.js +42 -0
  234. package/dist/@ui/components.js.map +1 -0
  235. package/dist/@ui/cssModules.d.ts +11 -0
  236. package/dist/@ui/cssModules.js +17 -0
  237. package/dist/@ui/cssModules.js.map +1 -0
  238. package/dist/@ui/hooks.d.ts +31 -0
  239. package/dist/@ui/hooks.js +71 -0
  240. package/dist/@ui/hooks.js.map +1 -0
  241. package/dist/@ui/index.d.ts +9 -0
  242. package/dist/@ui/index.js +11 -0
  243. package/dist/@ui/index.js.map +1 -0
  244. package/dist/@ui/internal.d.ts +4 -0
  245. package/dist/@ui/internal.js +10 -0
  246. package/dist/@ui/internal.js.map +1 -0
  247. package/dist/@ui/modules.d.ts +41 -0
  248. package/dist/@ui/modules.js +74 -0
  249. package/dist/@ui/modules.js.map +1 -0
  250. package/dist/@ui/objectRegistry.d.ts +12 -0
  251. package/dist/@ui/objectRegistry.js +35 -0
  252. package/dist/@ui/objectRegistry.js.map +1 -0
  253. package/dist/@ui/pageController.d.ts +61 -0
  254. package/dist/@ui/pageController.js +166 -0
  255. package/dist/@ui/pageController.js.map +1 -0
  256. package/dist/@ui/tools.d.ts +24 -0
  257. package/dist/@ui/tools.js +78 -0
  258. package/dist/@ui/tools.js.map +1 -0
  259. package/dist/@uikit/core/UiKitModule.d.ts +6 -0
  260. package/dist/@uikit/core/UiKitModule.js +18 -0
  261. package/dist/@uikit/core/UiKitModule.js.map +1 -0
  262. package/dist/@uikit/core/index.d.ts +1 -0
  263. package/dist/@uikit/core/index.js +4 -0
  264. package/dist/@uikit/core/index.js.map +1 -0
  265. package/dist/@uikit/core/jBundler_ifBrowser.d.ts +1 -0
  266. package/dist/@uikit/core/jBundler_ifBrowser.js +5 -0
  267. package/dist/@uikit/core/jBundler_ifBrowser.js.map +1 -0
  268. package/dist/@uikit/core/jBundler_ifServer.d.ts +6 -0
  269. package/dist/@uikit/core/jBundler_ifServer.js +17 -0
  270. package/dist/@uikit/core/jBundler_ifServer.js.map +1 -0
  271. package/dist/@uikit/forms/components.d.ts +18 -0
  272. package/dist/@uikit/forms/components.js +69 -0
  273. package/dist/@uikit/forms/components.js.map +1 -0
  274. package/dist/@uikit/forms/hooks.d.ts +4 -0
  275. package/dist/@uikit/forms/hooks.js +31 -0
  276. package/dist/@uikit/forms/hooks.js.map +1 -0
  277. package/dist/@uikit/forms/index.d.ts +3 -0
  278. package/dist/@uikit/forms/index.js +4 -0
  279. package/dist/@uikit/forms/index.js.map +1 -0
  280. package/dist/@uikit/forms/interfaces.d.ts +101 -0
  281. package/dist/@uikit/forms/interfaces.js +4 -0
  282. package/dist/@uikit/forms/interfaces.js.map +1 -0
  283. package/dist/@uikit/forms/private.d.ts +40 -0
  284. package/dist/@uikit/forms/private.js +307 -0
  285. package/dist/@uikit/forms/private.js.map +1 -0
  286. package/dist/@uikit/helpers/hooks.d.ts +33 -0
  287. package/dist/@uikit/helpers/hooks.js +107 -0
  288. package/dist/@uikit/helpers/hooks.js.map +1 -0
  289. package/dist/@uikit/helpers/index.d.ts +2 -0
  290. package/dist/@uikit/helpers/index.js +3 -0
  291. package/dist/@uikit/helpers/index.js.map +1 -0
  292. package/dist/@uikit/helpers/tools.d.ts +8 -0
  293. package/dist/@uikit/helpers/tools.js +35 -0
  294. package/dist/@uikit/helpers/tools.js.map +1 -0
  295. package/dist/@uikit/index.d.ts +10 -0
  296. package/dist/@uikit/index.js +13 -0
  297. package/dist/@uikit/index.js.map +1 -0
  298. package/dist/@uikit/menu/core.d.ts +21 -0
  299. package/dist/@uikit/menu/core.js +191 -0
  300. package/dist/@uikit/menu/core.js.map +1 -0
  301. package/dist/@uikit/menu/hooks.d.ts +5 -0
  302. package/dist/@uikit/menu/hooks.js +24 -0
  303. package/dist/@uikit/menu/hooks.js.map +1 -0
  304. package/dist/@uikit/menu/index.d.ts +3 -0
  305. package/dist/@uikit/menu/index.js +4 -0
  306. package/dist/@uikit/menu/index.js.map +1 -0
  307. package/dist/@uikit/menu/interfaces.d.ts +20 -0
  308. package/dist/@uikit/menu/interfaces.js +8 -0
  309. package/dist/@uikit/menu/interfaces.js.map +1 -0
  310. package/dist/@uikit/menu/internal.d.ts +40 -0
  311. package/dist/@uikit/menu/internal.js +191 -0
  312. package/dist/@uikit/menu/internal.js.map +1 -0
  313. package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.d.ts +18 -0
  314. package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.js +40 -0
  315. package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.js.map +1 -0
  316. package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.d.ts +28 -0
  317. package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.js +35 -0
  318. package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.js.map +1 -0
  319. package/dist/@uikit/reactRouter/index.d.ts +1 -0
  320. package/dist/@uikit/reactRouter/index.js +2 -0
  321. package/dist/@uikit/reactRouter/index.js.map +1 -0
  322. package/dist/@uikit/users/hooks.d.ts +10 -0
  323. package/dist/@uikit/users/hooks.js +39 -0
  324. package/dist/@uikit/users/hooks.js.map +1 -0
  325. package/dist/@uikit/users/index.d.ts +1 -0
  326. package/dist/@uikit/users/index.js +2 -0
  327. package/dist/@uikit/users/index.js.map +1 -0
  328. package/dist/@uikit/variants/index.d.ts +7 -0
  329. package/dist/@uikit/variants/index.js +16 -0
  330. package/dist/@uikit/variants/index.js.map +1 -0
  331. package/package.json +115 -0
  332. package/src/@bundler/README.md +1 -0
  333. package/src/@bundler/_logs.ts +4 -0
  334. package/src/@bundler/core.ts +41 -0
  335. package/src/@bundler/esbuild.ts +141 -0
  336. package/src/@bundler/index.ts +3 -0
  337. package/src/@bundler/plugins.ts +163 -0
  338. package/src/@bundler/tailwind.ts +139 -0
  339. package/src/@core/PageComponent.tsx +25 -0
  340. package/src/@core/README.md +1 -0
  341. package/src/@core/_logs.ts +11 -0
  342. package/src/@core/automaticStartStop.ts +132 -0
  343. package/src/@core/browserCacheControl.ts +40 -0
  344. package/src/@core/bundler/bundler.ts +128 -0
  345. package/src/@core/bundler/common.ts +18 -0
  346. package/src/@core/bundler/config.ts +37 -0
  347. package/src/@core/bundler/extraContent.ts +30 -0
  348. package/src/@core/bundler/pagesGenerator.ts +194 -0
  349. package/src/@core/bundler/server.ts +41 -0
  350. package/src/@core/caches/InMemoryCache.ts +483 -0
  351. package/src/@core/caches/SimpleFileCache.ts +205 -0
  352. package/src/@core/caches/cache.ts +77 -0
  353. package/src/@core/caches/webSiteMirrorCache.ts +90 -0
  354. package/src/@core/cheerio.d.ts +332 -0
  355. package/src/@core/gzip.ts +33 -0
  356. package/src/@core/index.ts +23 -0
  357. package/src/@core/internalTools.ts +95 -0
  358. package/src/@core/jQuery.ts +22 -0
  359. package/src/@core/jopiEasy.ts +1285 -0
  360. package/src/@core/jopiRequest.tsx +1279 -0
  361. package/src/@core/jopiServer.ts +188 -0
  362. package/src/@core/jopiWebSite.tsx +1027 -0
  363. package/src/@core/letsEncrypt.ts +243 -0
  364. package/src/@core/linker.ts +42 -0
  365. package/src/@core/loadBalancing.ts +152 -0
  366. package/src/@core/middlewares/CorsMiddleware.ts +23 -0
  367. package/src/@core/middlewares/DdosProtection.ts +120 -0
  368. package/src/@core/middlewares/index.ts +16 -0
  369. package/src/@core/publicTools.ts +14 -0
  370. package/src/@core/routeConfig.ts +104 -0
  371. package/src/@core/searchParamFilter.ts +315 -0
  372. package/src/@core/serverFetch.ts +454 -0
  373. package/src/@core/serverImpl/server_bunjs.tsx +230 -0
  374. package/src/@core/serverImpl/server_nodejs.ts +312 -0
  375. package/src/@core/serverInstanceBuilder.ts +36 -0
  376. package/src/@core/userStores.ts +34 -0
  377. package/src/@crawler/README.md +1 -0
  378. package/src/@crawler/common.ts +275 -0
  379. package/src/@crawler/core.ts +678 -0
  380. package/src/@crawler/directFileCache.ts +69 -0
  381. package/src/@crawler/index.ts +4 -0
  382. package/src/@crawler/urlMapping.ts +67 -0
  383. package/src/@crawler/utils.ts +13 -0
  384. package/src/@generated/index.ts +134 -0
  385. package/src/@linker/arobaseTypes.ts +325 -0
  386. package/src/@linker/changeProof.ts +53 -0
  387. package/src/@linker/config.ts +46 -0
  388. package/src/@linker/engine.ts +865 -0
  389. package/src/@linker/index.ts +3 -0
  390. package/src/@linker/install.ts +39 -0
  391. package/src/@linker/modInstaller.ts +50 -0
  392. package/src/@linker/typeEvents.ts +58 -0
  393. package/src/@linker/typeRoutes.ts +255 -0
  394. package/src/@linker/typeUiComposite.ts +19 -0
  395. package/src/@loader/README.md +4 -0
  396. package/src/@loader/bunHtmlCompiler.mjs +27 -0
  397. package/src/@loader/index.ts +19 -0
  398. package/src/@loader/loader.mjs +7 -0
  399. package/src/@loader/nodeJsLoader.ts +21 -0
  400. package/src/@loader-client/README.md +2 -0
  401. package/src/@loader-client/index.ts +108 -0
  402. package/src/@loader-tools/README.md +6 -0
  403. package/src/@loader-tools/bunJsLoader.ts +33 -0
  404. package/src/@loader-tools/config.ts +142 -0
  405. package/src/@loader-tools/cssModuleCompiler.ts +76 -0
  406. package/src/@loader-tools/esBuildPlugin.ts +142 -0
  407. package/src/@loader-tools/index.ts +11 -0
  408. package/src/@loader-tools/jopin.ts +403 -0
  409. package/src/@loader-tools/nodeJsLoader.ts +119 -0
  410. package/src/@loader-tools/nodeJsResolver.ts +140 -0
  411. package/src/@loader-tools/rules.ts +45 -0
  412. package/src/@loader-tools/sourceChangesWatcher.ts +225 -0
  413. package/src/@loader-tools/tools.ts +139 -0
  414. package/src/@loader-tools/transform.ts +138 -0
  415. package/src/@loader-tools/virtualUrl.ts +57 -0
  416. package/src/@loader-types/README.md +15 -0
  417. package/src/@loader-types/extensions.d.ts +65 -0
  418. package/src/@tool-jopinb/README.md +1 -0
  419. package/src/@tool-jopinb/index.ts +11 -0
  420. package/src/@ui/README.md +3 -0
  421. package/src/@ui/components.tsx +49 -0
  422. package/src/@ui/cssModules.tsx +27 -0
  423. package/src/@ui/hooks.tsx +95 -0
  424. package/src/@ui/index.ts +13 -0
  425. package/src/@ui/internal.ts +12 -0
  426. package/src/@ui/modules.ts +100 -0
  427. package/src/@ui/objectRegistry.ts +50 -0
  428. package/src/@ui/pageController.ts +203 -0
  429. package/src/@ui/tools.ts +116 -0
  430. package/src/@uikit/README.md +1 -0
  431. package/src/@uikit/core/UiKitModule.ts +20 -0
  432. package/src/@uikit/core/index.ts +4 -0
  433. package/src/@uikit/core/jBundler_ifBrowser.ts +4 -0
  434. package/src/@uikit/core/jBundler_ifServer.ts +18 -0
  435. package/src/@uikit/forms/components.tsx +97 -0
  436. package/src/@uikit/forms/hooks.ts +38 -0
  437. package/src/@uikit/forms/index.ts +3 -0
  438. package/src/@uikit/forms/interfaces.ts +159 -0
  439. package/src/@uikit/forms/private.ts +365 -0
  440. package/src/@uikit/helpers/hooks.ts +133 -0
  441. package/src/@uikit/helpers/index.ts +2 -0
  442. package/src/@uikit/helpers/tools.ts +39 -0
  443. package/src/@uikit/index.ts +15 -0
  444. package/src/@uikit/menu/core.ts +227 -0
  445. package/src/@uikit/menu/hooks.ts +28 -0
  446. package/src/@uikit/menu/index.ts +3 -0
  447. package/src/@uikit/menu/interfaces.ts +26 -0
  448. package/src/@uikit/menu/internal.ts +218 -0
  449. package/src/@uikit/package.json +15 -0
  450. package/src/@uikit/reactRouter/hooks/jBundler_ifBrowser.tsx +59 -0
  451. package/src/@uikit/reactRouter/hooks/jBundler_ifServer.tsx +51 -0
  452. package/src/@uikit/reactRouter/index.ts +1 -0
  453. package/src/@uikit/users/hooks.ts +50 -0
  454. package/src/@uikit/users/index.ts +1 -0
  455. package/src/@uikit/variants/index.tsx +20 -0
@@ -0,0 +1,87 @@
1
+ import { type OnCrawlingFinishedInfos, type WebSiteCrawlerOptions } from "./common.ts";
2
+ export declare class WebSiteCrawler {
3
+ private readonly urlDone;
4
+ private readonly newWebSite_basePath;
5
+ private readonly newWebSite_lcBasePath;
6
+ private readonly newWebSite_urlInfos;
7
+ private readonly requiredPrefix;
8
+ private readonly requiredPrefix2;
9
+ private isStarted;
10
+ private readonly options;
11
+ private readonly cache?;
12
+ private currentGroup;
13
+ private readonly groupStack;
14
+ private urlCount;
15
+ /**
16
+ * Create a new crawler instance.
17
+ *
18
+ * @param sourceWebSite
19
+ * The url of the website to crawl.
20
+ * @param options
21
+ * Options for complex cases.
22
+ */
23
+ constructor(sourceWebSite: string, options?: WebSiteCrawlerOptions);
24
+ /**
25
+ * Start the processing
26
+ */
27
+ start(entryPoint?: string): Promise<OnCrawlingFinishedInfos>;
28
+ /**
29
+ * Take an url and clean this url.
30
+ * - Resolve relative url.
31
+ * - Exclude special url ("mailto:", "tel:", ...)
32
+ * - Exclude anchor url (starts with #).
33
+ */
34
+ private _cleanUpUrl;
35
+ /**
36
+ * Is like cleanUpUrl but with a special case for CSS.
37
+ *
38
+ * Url in CSS is related to the dir of the CSS file.
39
+ * If I have "myImage.jpg" then it's https//my/css/dir/myImage.jpg.
40
+ */
41
+ private cleanUpCssUrl;
42
+ private cleanUpUrlAux;
43
+ /**
44
+ * Is called when we want to add an url to the processing queue.
45
+ * A call to cleanUpUrl must have been done before.
46
+ */
47
+ private pushUrl;
48
+ private processStack;
49
+ /**
50
+ * Will fetch an url and process the result.
51
+ * If the result is HTML, it will be analyzed.
52
+ * Also, if it's CSS.
53
+ */
54
+ private processGroup;
55
+ private isResource;
56
+ private processUrl;
57
+ /**
58
+ * Process an HTML file, which consiste:
59
+ * - Extracting the url.
60
+ * - Replacing this url inside the HTML to convert them.
61
+ */
62
+ private processHtml;
63
+ /**
64
+ * Allow rewriting the url from a source site (where we take our pages)
65
+ * to transform this url to a local url (our website).
66
+ */
67
+ rewriteSourceSiteUrl(url: string): string;
68
+ /**
69
+ * Allow transforming an url found by the HTML parser.
70
+ */
71
+ transformFoundUrl(url: string, enableRelocatable?: boolean): string;
72
+ /**
73
+ * Clean up the url to make it compatible with the file-system.
74
+ * Will remove the query-string and the anchors part.
75
+ * And make url relatif (with "../.." as a prefix).
76
+ *
77
+ * Why does relatif url are required?
78
+ * For example, I have a HTML page: file://folderA/webSiteRoot/myPage/index.html
79
+ * And now a css: /my/css/folder/style.css
80
+ * Here the final url will be: file://folderA/webSiteRoot/myPage/my/css/folder/style.css
81
+ * and not: file://folderA/webSiteRoot/my/css/folder/style.css
82
+ * It's why my/css/folder/style.css
83
+ * must be transformed as ../my/css/folder/style.css
84
+ * (only inside this page)
85
+ */
86
+ urlTool_buildFileSystemUrl(url: string): string;
87
+ }
@@ -0,0 +1,586 @@
1
+ /// <reference path="../@core/cheerio.d.ts" />
2
+ import { DirectFileCache } from "./directFileCache.js";
3
+ import { UrlMapping } from "./urlMapping.js";
4
+ import * as cheerio from 'cheerio';
5
+ import { getErrorMessage } from "jopi-toolkit/jk_tools";
6
+ // @ts-ignore no ts definition
7
+ import parseCssUrls from "css-url-parser";
8
+ import { applyDefaults, tick } from "./utils.js";
9
+ import { ProcessUrlResult, UrlSortTools } from "./common.js";
10
+ export class WebSiteCrawler {
11
+ urlDone = [];
12
+ newWebSite_basePath;
13
+ newWebSite_lcBasePath;
14
+ newWebSite_urlInfos;
15
+ requiredPrefix;
16
+ requiredPrefix2;
17
+ isStarted = false;
18
+ options;
19
+ cache;
20
+ currentGroup = { url: "", stack: [] };
21
+ groupStack = [];
22
+ urlCount = 1;
23
+ /**
24
+ * Create a new crawler instance.
25
+ *
26
+ * @param sourceWebSite
27
+ * The url of the website to crawl.
28
+ * @param options
29
+ * Options for complex cases.
30
+ */
31
+ constructor(sourceWebSite, options) {
32
+ options = applyDefaults(options, {
33
+ requireRelocatableUrl: true,
34
+ });
35
+ options = this.options = { ...options };
36
+ let newWebSiteUrl = new URL(options.newWebSiteUrl || sourceWebSite).origin;
37
+ this.newWebSite_basePath = newWebSiteUrl;
38
+ this.newWebSite_lcBasePath = newWebSiteUrl.toLowerCase();
39
+ const urlInfos = new URL(newWebSiteUrl);
40
+ this.newWebSite_urlInfos = urlInfos;
41
+ this.requiredPrefix = urlInfos.origin + "/";
42
+ this.requiredPrefix2 = "//" + urlInfos.hostname;
43
+ let sourceWebSiteOrigin = new URL(sourceWebSite).origin;
44
+ if (sourceWebSiteOrigin !== newWebSiteUrl) {
45
+ if (!options.rewriteThisUrls)
46
+ options.rewriteThisUrls = [];
47
+ // Allow rewriting the url.
48
+ if (!options.rewriteThisUrls.includes(sourceWebSiteOrigin)) {
49
+ options.rewriteThisUrls.push(sourceWebSiteOrigin);
50
+ }
51
+ }
52
+ if (!options.urlMapping) {
53
+ options.urlMapping = new UrlMapping(sourceWebSite);
54
+ }
55
+ else {
56
+ if (!options.rewriteThisUrls)
57
+ options.rewriteThisUrls = [];
58
+ const knownOrigin = options.urlMapping.getKnownOrigins();
59
+ knownOrigin.forEach(origin => {
60
+ if (!options.rewriteThisUrls.includes(origin)) {
61
+ options.rewriteThisUrls.push(origin);
62
+ }
63
+ });
64
+ }
65
+ if (options.cache) {
66
+ this.cache = options.cache;
67
+ }
68
+ else if (options.outputDir) {
69
+ this.cache = new DirectFileCache(options.outputDir);
70
+ }
71
+ }
72
+ /**
73
+ * Start the processing
74
+ */
75
+ async start(entryPoint) {
76
+ if (!entryPoint) {
77
+ entryPoint = this.newWebSite_basePath;
78
+ }
79
+ const newGroup = { url: entryPoint, stack: [] };
80
+ this.groupStack.push(newGroup);
81
+ this.currentGroup = newGroup;
82
+ if (this.options.scanThisUrls) {
83
+ for (let i = 0; i < this.options.scanThisUrls.length; i++) {
84
+ this.pushUrl(this.options.scanThisUrls[i]);
85
+ }
86
+ }
87
+ await this.processStack();
88
+ const finishedInfos = {
89
+ remainingStack: this.groupStack.map(g => g.url)
90
+ };
91
+ if (this.options.onFinished) {
92
+ this.options.onFinished(finishedInfos);
93
+ }
94
+ return finishedInfos;
95
+ }
96
+ /**
97
+ * Take an url and clean this url.
98
+ * - Resolve relative url.
99
+ * - Exclude special url ("mailto:", "tel:", ...)
100
+ * - Exclude anchor url (starts with #).
101
+ */
102
+ _cleanUpUrl(url) {
103
+ return this.cleanUpUrlAux(url, false);
104
+ }
105
+ /**
106
+ * Is like cleanUpUrl but with a special case for CSS.
107
+ *
108
+ * Url in CSS is related to the dir of the CSS file.
109
+ * If I have "myImage.jpg" then it's https//my/css/dir/myImage.jpg.
110
+ */
111
+ cleanUpCssUrl(url, baseUrl) {
112
+ return this.cleanUpUrlAux(url, true, baseUrl);
113
+ }
114
+ cleanUpUrlAux(url, isCss, currentUrl) {
115
+ if (!url)
116
+ return null;
117
+ url = url.trim();
118
+ if (!url)
119
+ return null;
120
+ if (url[0] === '#')
121
+ return null;
122
+ // Convert to an absolute url.
123
+ if (!url.includes("://")) {
124
+ if (url[0] === "?") {
125
+ let currentUrl = this.currentGroup.url;
126
+ let idx = currentUrl.indexOf("?");
127
+ if (idx !== -1)
128
+ currentUrl = currentUrl.substring(0, idx);
129
+ url = currentUrl + url;
130
+ }
131
+ else if (url.includes(":")) {
132
+ if (url.startsWith("data:"))
133
+ return null;
134
+ if (url.startsWith("javascript:"))
135
+ return null;
136
+ if (url.startsWith("mailto:"))
137
+ return null;
138
+ if (url.startsWith("tel:"))
139
+ return null;
140
+ if (url.startsWith("sms:"))
141
+ return null;
142
+ if (url.startsWith("ftp:"))
143
+ return null;
144
+ }
145
+ if (url.startsWith("//")) {
146
+ if (!url.toLowerCase().startsWith(this.requiredPrefix2))
147
+ return null;
148
+ url = this.newWebSite_urlInfos.protocol + url;
149
+ }
150
+ else if (url[0] === "/") {
151
+ url = resolveRelativeUrl(url, this.newWebSite_urlInfos);
152
+ }
153
+ else {
154
+ if (isCss) {
155
+ url = resolveRelativeUrl(url, new URL(currentUrl));
156
+ }
157
+ else {
158
+ url = resolveRelativeUrl(url, this.newWebSite_urlInfos);
159
+ }
160
+ }
161
+ }
162
+ else {
163
+ url = this.rewriteSourceSiteUrl(url);
164
+ }
165
+ if (!url.toLowerCase().startsWith(this.requiredPrefix)) {
166
+ return null;
167
+ }
168
+ return url.trim();
169
+ }
170
+ /**
171
+ * Is called when we want to add an url to the processing queue.
172
+ * A call to cleanUpUrl must have been done before.
173
+ */
174
+ pushUrl(url) {
175
+ if (!url)
176
+ return "";
177
+ url = this._cleanUpUrl(url);
178
+ if (!url)
179
+ return "";
180
+ if (this.urlDone.includes(url))
181
+ return url;
182
+ this.urlDone.push(url);
183
+ if (this.options.canDownload) {
184
+ if (!this.options.canDownload(url.substring(this.requiredPrefix.length), this.isResource(url))) {
185
+ return url;
186
+ }
187
+ }
188
+ if (!this.currentGroup.stack)
189
+ this.currentGroup.stack = [];
190
+ this.currentGroup.stack.push(url);
191
+ return url;
192
+ }
193
+ async processStack() {
194
+ if (this.isStarted)
195
+ return;
196
+ this.isStarted = true;
197
+ while (true) {
198
+ const group = this.groupStack.shift();
199
+ if (!group)
200
+ break;
201
+ if (!await this.processGroup(group))
202
+ break;
203
+ }
204
+ this.isStarted = false;
205
+ }
206
+ /**
207
+ * Will fetch an url and process the result.
208
+ * If the result is HTML, it will be analyzed.
209
+ * Also, if it's CSS.
210
+ */
211
+ async processGroup(group) {
212
+ this.currentGroup = group;
213
+ // Process the group main url.
214
+ const processResponse = await this.processUrl(group.url);
215
+ // Process the resource inside the group.
216
+ if (group.stack) {
217
+ let isResource;
218
+ let isNotResource;
219
+ group.stack.forEach(url => {
220
+ if (this.isResource(url)) {
221
+ if (!isResource)
222
+ isResource = [];
223
+ isResource.push(url);
224
+ }
225
+ else {
226
+ if (!isNotResource)
227
+ isNotResource = [];
228
+ isNotResource.push(url);
229
+ }
230
+ });
231
+ group.stack = undefined;
232
+ // Stack the pages coming from the resources.
233
+ if (isNotResource) {
234
+ if ((isNotResource.length > 1) && this.options.sortPagesToDownload) {
235
+ const sortTools = new UrlSortTools(isNotResource);
236
+ this.options.sortPagesToDownload(sortTools);
237
+ isNotResource = sortTools.result();
238
+ }
239
+ isNotResource.forEach(url => {
240
+ this.groupStack.push({ url });
241
+ });
242
+ }
243
+ // Process the resources now.
244
+ // Allow the page to be completely loaded.
245
+ //
246
+ while (isResource) {
247
+ const resources = isResource;
248
+ isResource = undefined;
249
+ for (let i = 0; i < resources.length; i++) {
250
+ const resUrl = resources[i];
251
+ const resState = await this.processUrl(resUrl);
252
+ if (this.options.onResourceDownloaded) {
253
+ this.options.onResourceDownloaded(resUrl, resState);
254
+ }
255
+ }
256
+ // Come from CSS.
257
+ if (group.stack) {
258
+ isResource = group.stack;
259
+ group.stack = undefined;
260
+ }
261
+ }
262
+ }
263
+ if (this.options.onPageFullyDownloaded) {
264
+ const res = this.options.onPageFullyDownloaded(group.url, processResponse);
265
+ if (res instanceof Promise)
266
+ await res;
267
+ if (res === false)
268
+ return false;
269
+ }
270
+ return true;
271
+ }
272
+ isResource(u) {
273
+ const url = new URL(u);
274
+ u = url.pathname;
275
+ let idx = u.lastIndexOf(".");
276
+ if (idx === -1)
277
+ return false;
278
+ let ext = u.substring(idx);
279
+ return gExtensionForResourceType.includes(ext);
280
+ }
281
+ async processUrl(sourceUrl) {
282
+ const sendSignal = (state) => {
283
+ if (this.options.onUrlProcessed) {
284
+ const date = Date.now();
285
+ const elapsed = date - now;
286
+ const cacheKey = this.cache?.getKey(transformedUrl);
287
+ this.options.onUrlProcessed({
288
+ sourceUrl, requestedByUrl,
289
+ state, retryCount,
290
+ transformedUrl,
291
+ localUrl,
292
+ cacheKey,
293
+ urlCount: this.urlCount,
294
+ date, elapsed
295
+ });
296
+ }
297
+ return state;
298
+ };
299
+ let retryCount = 0;
300
+ const localUrl = sourceUrl.substring(this.newWebSite_basePath.length);
301
+ const now = Date.now();
302
+ const partialUrl = sourceUrl.substring(this.newWebSite_basePath.length);
303
+ const requestedByUrl = this.currentGroup.url;
304
+ const mappingResult = this.options.urlMapping.resolveURL(partialUrl);
305
+ if (!mappingResult)
306
+ return ProcessUrlResult.IGNORED;
307
+ let transformedUrl = sourceUrl;
308
+ if (this.cache) {
309
+ transformedUrl = this.transformFoundUrl(sourceUrl, false);
310
+ }
311
+ if (this.cache && this.options.canIgnoreIfAlreadyCrawled) {
312
+ const isInCache = await this.cache.hasInCache(transformedUrl, requestedByUrl);
313
+ if (isInCache && this.options.canIgnoreIfAlreadyCrawled(sourceUrl.substring(this.newWebSite_basePath.length), { sourceUrl: mappingResult.url })) {
314
+ return sendSignal(ProcessUrlResult.IGNORED);
315
+ }
316
+ }
317
+ if (mappingResult.wakeUpServer) {
318
+ await mappingResult.wakeUpServer();
319
+ }
320
+ this.urlCount++;
321
+ if (this.options.pauseDuration_ms) {
322
+ await tick(this.options.pauseDuration_ms);
323
+ }
324
+ while (true) {
325
+ try {
326
+ let res;
327
+ if (this.options.doFetch) {
328
+ res = await this.options.doFetch(this, mappingResult.url, requestedByUrl);
329
+ }
330
+ else {
331
+ // noinspection JSUnusedGlobalSymbols
332
+ res = await fetch(mappingResult.url, {
333
+ // > This option allows avoiding SSL certificate check.
334
+ // @ts-ignore
335
+ rejectUnauthorized: false,
336
+ requestCert: false,
337
+ tls: {
338
+ rejectUnauthorized: false,
339
+ checkServerIdentity: () => { return undefined; }
340
+ },
341
+ // Allow avoiding automatic redirections.
342
+ // @ts-ignore
343
+ redirect: 'manual',
344
+ headers: {
345
+ "referer": requestedByUrl
346
+ }
347
+ //verbose: true
348
+ });
349
+ }
350
+ if (res.status !== 200) {
351
+ if (res.status >= 300 && res.status < 400) {
352
+ const location = res.headers.get("Location");
353
+ if (location)
354
+ this.pushUrl(location);
355
+ return sendSignal(ProcessUrlResult.REDIRECTED);
356
+ }
357
+ else {
358
+ let canContinue = false;
359
+ if (this.options.onInvalidResponseCodeFound) {
360
+ let what = this.options.onInvalidResponseCodeFound(sourceUrl, retryCount, res);
361
+ if (what instanceof Promise)
362
+ what = await what;
363
+ canContinue = what;
364
+ }
365
+ else if (retryCount < 3) {
366
+ // Retry 3 times, with a longer pause each time.
367
+ await tick(1000 * retryCount);
368
+ canContinue = true;
369
+ }
370
+ if (!canContinue) {
371
+ return sendSignal(ProcessUrlResult.ERROR);
372
+ }
373
+ retryCount++;
374
+ // Will retry automatically.
375
+ continue;
376
+ }
377
+ }
378
+ const contentType = res.headers.get("content-type");
379
+ if (contentType) {
380
+ if (contentType.startsWith("text/html")) {
381
+ let html = await res.text();
382
+ if (this.options.rewriteHtmlBeforeProcessing) {
383
+ let res = this.options.rewriteHtmlBeforeProcessing(html, sourceUrl.substring(this.newWebSite_basePath.length), mappingResult.url);
384
+ if (res instanceof Promise)
385
+ res = await res;
386
+ html = res;
387
+ }
388
+ html = await this.processHtml(html);
389
+ if (this.options.rewriteHtmlBeforeStoring) {
390
+ let res = this.options.rewriteHtmlBeforeStoring(html, sourceUrl.substring(this.newWebSite_basePath.length), mappingResult.url);
391
+ if (res instanceof Promise)
392
+ res = await res;
393
+ html = res;
394
+ }
395
+ res = new Response(html, { status: 200, headers: res.headers });
396
+ }
397
+ else if (contentType.startsWith("text/css")) {
398
+ const content = await res.text();
399
+ const cssUrls = parseCssUrls(content);
400
+ if (cssUrls.length) {
401
+ cssUrls.forEach(u => {
402
+ const cleanedUrl = this.cleanUpCssUrl(u, sourceUrl);
403
+ if (cleanedUrl)
404
+ this.pushUrl(cleanedUrl);
405
+ });
406
+ }
407
+ res = new Response(content, { status: 200, headers: res.headers });
408
+ }
409
+ }
410
+ if (this.cache) {
411
+ let hRes = new Response(res.body, { status: res.status, headers: res.headers });
412
+ await this.cache.addToCache(transformedUrl, hRes, requestedByUrl);
413
+ }
414
+ return sendSignal(ProcessUrlResult.OK);
415
+ }
416
+ catch (e) {
417
+ console.error("Crawler - Error while fetching:", sourceUrl);
418
+ console.error("|--> Message:", getErrorMessage(e));
419
+ console.log(e);
420
+ return sendSignal(ProcessUrlResult.ERROR);
421
+ }
422
+ }
423
+ }
424
+ /**
425
+ * Process an HTML file, which consiste:
426
+ * - Extracting the url.
427
+ * - Replacing this url inside the HTML to convert them.
428
+ */
429
+ async processHtml(html) {
430
+ // Extract all url and rewrite them inside the html.
431
+ // Will emit calls to addUrl for each url found.
432
+ const $ = cheerio.load(html);
433
+ $("img, script, iframe, source").each((_i, node) => {
434
+ let url = node.attribs["src"];
435
+ if (url) {
436
+ url = this.pushUrl(url);
437
+ if (url.length)
438
+ node.attribs["src"] = this.transformFoundUrl(url);
439
+ }
440
+ });
441
+ $("a, link").each((_i, node) => {
442
+ let url = node.attribs["href"];
443
+ if (url) {
444
+ url = this.pushUrl(url);
445
+ if (url.length) {
446
+ node.attribs["href"] = this.transformFoundUrl(url);
447
+ }
448
+ }
449
+ });
450
+ $("img").each((_i, node) => {
451
+ let srcset = node.attribs["srcset"];
452
+ if (!srcset)
453
+ return;
454
+ const parts = srcset.split(",");
455
+ let newSrcset = "";
456
+ parts.forEach(p => {
457
+ p = p.trim();
458
+ const idx = p.indexOf(" ");
459
+ if (idx === -1)
460
+ return;
461
+ let url = p.substring(0, idx);
462
+ const size = p.substring(idx + 1);
463
+ let newUrl = this.pushUrl(url);
464
+ if (url.length)
465
+ url = newUrl;
466
+ url = this.transformFoundUrl(url);
467
+ newSrcset += "," + url + " " + size;
468
+ });
469
+ node.attribs["srcset"] = newSrcset.substring(1);
470
+ });
471
+ html = $.html();
472
+ // Security for residual urls.
473
+ if (html.includes(this.newWebSite_basePath + "/"))
474
+ html = html.replaceAll(this.newWebSite_basePath, "");
475
+ if (html.includes(this.newWebSite_basePath))
476
+ html = html.replaceAll(this.newWebSite_basePath, "/");
477
+ return html;
478
+ }
479
+ /**
480
+ * Allow rewriting the url from a source site (where we take our pages)
481
+ * to transform this url to a local url (our website).
482
+ */
483
+ rewriteSourceSiteUrl(url) {
484
+ if (this.options.rewriteThisUrls) {
485
+ for (let i = 0; i < this.options.rewriteThisUrls.length; i++) {
486
+ const prefix = this.options.rewriteThisUrls[i];
487
+ if (url.startsWith(prefix)) {
488
+ url = this.newWebSite_basePath + url.substring(prefix.length);
489
+ return url;
490
+ }
491
+ }
492
+ }
493
+ return url;
494
+ }
495
+ /**
496
+ * Allow transforming an url found by the HTML parser.
497
+ */
498
+ transformFoundUrl(url, enableRelocatable = true) {
499
+ if (this.options.transformUrl) {
500
+ url = this.options.transformUrl(url, {
501
+ crawler: this,
502
+ comeFromPage: this.currentGroup.url,
503
+ requireRelocatableUrl: this.options.requireRelocatableUrl
504
+ });
505
+ }
506
+ if (enableRelocatable && this.options.requireRelocatableUrl) {
507
+ url = this.urlTool_buildFileSystemUrl(url);
508
+ }
509
+ return url;
510
+ }
511
+ /**
512
+ * Clean up the url to make it compatible with the file-system.
513
+ * Will remove the query-string and the anchors part.
514
+ * And make url relatif (with "../.." as a prefix).
515
+ *
516
+ * Why does relatif url are required?
517
+ * For example, I have a HTML page: file://folderA/webSiteRoot/myPage/index.html
518
+ * And now a css: /my/css/folder/style.css
519
+ * Here the final url will be: file://folderA/webSiteRoot/myPage/my/css/folder/style.css
520
+ * and not: file://folderA/webSiteRoot/my/css/folder/style.css
521
+ * It's why my/css/folder/style.css
522
+ * must be transformed as ../my/css/folder/style.css
523
+ * (only inside this page)
524
+ */
525
+ urlTool_buildFileSystemUrl(url) {
526
+ // Allow to not always check.
527
+ if (!this.options.requireRelocatableUrl)
528
+ return url;
529
+ let idx = url.indexOf("?");
530
+ if (idx !== -1)
531
+ url = url.substring(0, idx);
532
+ idx = url.indexOf("#");
533
+ if (idx !== -1)
534
+ url = url.substring(0, idx);
535
+ // > If not a file, then it a directory.
536
+ // Transform it to be a /index.html file.
537
+ if (url.endsWith("/")) {
538
+ url += "index.html";
539
+ }
540
+ else {
541
+ const lastSlash = url.lastIndexOf("/");
542
+ const lastSegment = lastSlash === -1 ? url : url.substring(lastSlash + 1);
543
+ if (!lastSegment.includes(".")) {
544
+ url += "/index.html";
545
+ }
546
+ }
547
+ // Make the url relatif.
548
+ //
549
+ if (url.startsWith(this.newWebSite_lcBasePath)) {
550
+ url = url.substring(this.newWebSite_lcBasePath.length + 1);
551
+ let currentUrl = this.currentGroup.url.substring(this.newWebSite_lcBasePath.length + 1);
552
+ if (!currentUrl)
553
+ return url;
554
+ if (url === currentUrl)
555
+ return url;
556
+ let backCount = currentUrl.split("/").length;
557
+ if (currentUrl.endsWith("/"))
558
+ backCount--;
559
+ for (let i = 0; i < backCount; i++)
560
+ url = "../" + url;
561
+ }
562
+ return url;
563
+ }
564
+ }
565
+ function resolveRelativeUrl(url, baseUrl) {
566
+ if (url[0] === "/") {
567
+ if (url[1] === "/") {
568
+ const urlInfos = new URL(url);
569
+ urlInfos.protocol = baseUrl.protocol;
570
+ urlInfos.port = baseUrl.port;
571
+ return urlInfos.toString();
572
+ }
573
+ else {
574
+ return baseUrl.toString() + url.substring(1);
575
+ }
576
+ }
577
+ else if (url[0] === ".") {
578
+ return new URL(url, baseUrl).toString();
579
+ }
580
+ return url;
581
+ }
582
+ const gExtensionForResourceType = [
583
+ ".css", ".js", ".jpg", ".png", ".jpeg", ".gif", ".svg", ".webp",
584
+ ".woff", ".woff2", ".ttf", ".txt", ".avif", ".ico"
585
+ ];
586
+ //# sourceMappingURL=core.js.map