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,3 @@
1
+ export * from "./engine.ts";
2
+ export * from "./install.ts";
3
+ export * from "./config.ts";
@@ -0,0 +1,39 @@
1
+ import * as jk_fs from "jopi-toolkit/jk_fs";
2
+ import * as jk_events from "jopi-toolkit/jk_events";
3
+ import {getBrowserInstallScript, getServerInstallScript} from "./engine.ts";
4
+ import {JopiEasyWebSite, type WebSite} from "jopijs";
5
+
6
+ export type InstallFunction<T> = (registry: T) => void;
7
+
8
+ export async function loadServerInstall(webSite: JopiEasyWebSite, onWebSiteCreate: (h: (webSite: WebSite) => void|Promise<void>) => void) {
9
+ let installFilePath = getServerInstallScript();
10
+ if (!await jk_fs.isFile(installFilePath)) return;
11
+
12
+ try {
13
+ let v = await import(installFilePath);
14
+ if (!v.default) return;
15
+
16
+ await v.default(webSite, onWebSiteCreate);
17
+
18
+ onWebSiteCreate(webSite => {
19
+ jk_events.sendEvent("jopi.server.install.done", webSite);
20
+ });
21
+ }
22
+ catch (error) {
23
+ throw error;
24
+ }
25
+ }
26
+
27
+ export async function getBrowserInstallFunction<T>(): Promise<InstallFunction<T>> {
28
+ let installFilePath = getBrowserInstallScript();
29
+ if (!await jk_fs.isFile(installFilePath)) return gVoidFunction;
30
+
31
+ let v = await import(installFilePath);
32
+ if (!v.default) return gVoidFunction;
33
+
34
+ return function(registry: T) {
35
+ v.default(registry);
36
+ }
37
+ }
38
+
39
+ const gVoidFunction = () => {};
@@ -0,0 +1,50 @@
1
+ import {
2
+ CodeGenWriter,
3
+ FilePart,
4
+ InstallFileType,
5
+ ModuleDirProcessor,
6
+ resolveFile
7
+ } from "./engine.ts";
8
+ import * as jk_fs from "jopi-toolkit/jk_fs";
9
+
10
+ /**
11
+ * Search the uiInstall.ts and serverInstall.ts files
12
+ */
13
+ export default class ModInstaller extends ModuleDirProcessor {
14
+ private uiInitFiles: string[] = [];
15
+ private serverInitFiles: string[] = [];
16
+
17
+ override async onBeginModuleProcessing(_writer: CodeGenWriter, moduleDir: string): Promise<void> {
18
+ let uiInitFile = await resolveFile(moduleDir, ["uiInit.tsx", "uiInit.ts"]);
19
+ if (uiInitFile) this.uiInitFiles.push(uiInitFile);
20
+
21
+ let serverInitFile = await resolveFile(moduleDir, ["serverInit.tsx", "serverInit.ts"]);
22
+ if (serverInitFile) this.serverInitFiles.push(serverInitFile);
23
+ }
24
+
25
+ override async generateCode(writer: CodeGenWriter): Promise<void> {
26
+ let i = 0;
27
+
28
+ for (let uiInitFile of this.uiInitFiles) {
29
+ i++;
30
+
31
+ let relPath = writer.makePathRelativeToOutput(uiInitFile);
32
+ if (!writer.isTypeScriptOnly) relPath = writer.toJavascriptFileName(relPath);
33
+
34
+ writer.genAddToInstallFile(InstallFileType.browser, FilePart.imports, `\nimport modUiInit${i} from "${relPath}";`);
35
+ writer.genAddToInstallFile(InstallFileType.browser, FilePart.footer, `\n modUiInit${i}(registry);`)
36
+ }
37
+
38
+ i = 0;
39
+
40
+ for (let serverInitFile of this.serverInitFiles) {
41
+ i++;
42
+
43
+ let relPath = writer.makePathRelativeToOutput(serverInitFile);
44
+ if (!writer.isTypeScriptOnly) relPath = writer.toJavascriptFileName(relPath);
45
+
46
+ writer.genAddToInstallFile(InstallFileType.server, FilePart.imports, `\nimport modServerInit${i} from "${relPath}";`);
47
+ writer.genAddToInstallFile(InstallFileType.server, FilePart.body, `\n await modServerInit${i}(registry);`)
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,58 @@
1
+ import {type ArobaseList, Type_ArobaseList} from "./arobaseTypes.ts";
2
+ import {CodeGenWriter, FilePart, InstallFileType, type RegistryItem} from "./engine.ts";
3
+
4
+ export default class TypeEvents extends Type_ArobaseList {
5
+ async endGeneratingCode(writer: CodeGenWriter, items: RegistryItem[]): Promise<void> {
6
+ let count = 0;
7
+
8
+ // Here items are individual event listeners.
9
+ // There are not sorted, an item can be bound to an event A and another item to another event.
10
+ //
11
+ for (let item of items) {
12
+ count++;
13
+
14
+ let list = item as ArobaseList;
15
+
16
+ // Note: inside installServer.js : use the global event handler.
17
+ // inside installBrowser.js: use the event handler local to the request.
18
+ //
19
+ let jsSources = ` registry.events.addProvider("${list.listName}", async () => { const R = await import("@/events/${list.listName}"); return R.list; });`;
20
+ writer.genAddToInstallFile(InstallFileType.both, FilePart.body, jsSources);
21
+ }
22
+ }
23
+
24
+ protected codeGen_generateImports() {
25
+ return `import {createStaticEvent} from "jopi-toolkit/jk_events";\n`;
26
+ }
27
+
28
+ protected codeGen_generateExports(array: string, eventName: string) {
29
+ return `export const list = ${array};
30
+ export const event = createStaticEvent(${JSON.stringify(eventName)}, list);
31
+ export default event;`;
32
+ }
33
+
34
+ protected codeGen_createDeclarationTypes() {
35
+ return `import type { SyncEventListener, StaticEvent } from "jopi-toolkit/jk_events";
36
+ export declare const list: SyncEventListener[];
37
+ export declare const event: StaticEvent;
38
+ export default event;`
39
+ }
40
+
41
+ protected normalizeConditionName(condName: string): string|undefined {
42
+ if (condName.startsWith("if")) {
43
+ condName = condName.substring(2);
44
+ }
45
+
46
+ condName = condName.replace("-", "");
47
+ condName = condName.replace("_", "");
48
+
49
+ if (condName==="browser") {
50
+ return "if_browser";
51
+ }
52
+ else if (condName==="server") {
53
+ return "if_server";
54
+ }
55
+
56
+ return undefined;
57
+ }
58
+ }
@@ -0,0 +1,255 @@
1
+ import {
2
+ ArobaseType,
3
+ CodeGenWriter,
4
+ FilePart,
5
+ getWriter,
6
+ InstallFileType,
7
+ PriorityLevel,
8
+ resolveFile, writeTextToFileIfMismatch
9
+ } from "./engine.ts";
10
+ import * as jk_fs from "jopi-toolkit/jk_fs";
11
+ import * as jk_app from "jopi-toolkit/jk_app";
12
+ import type {RouteAttributs} from "jopijs/generated";
13
+
14
+ export default class TypeRoutes extends ArobaseType {
15
+ private sourceCode_header = `import {routeBindPage, routeBindVerb} from "jopijs/generated";`;
16
+ private sourceCode_body = "";
17
+ private outputDir: string = "";
18
+ private cwdDir: string = process.cwd();
19
+ private routeCount: number = 1;
20
+
21
+ private registry: Record<string, RegistryItem> = {};
22
+ private routeConfig: Record<string, string> = {};
23
+
24
+ async beginGeneratingCode(writer: CodeGenWriter): Promise<void> {
25
+ for (let item of Object.values(this.registry)) {
26
+ if (item.verb==="PAGE") {
27
+ this.bindPage(item.route, item.filePath, item.attributs);
28
+ } else {
29
+ this.bindVerb(item.verb, item.route, item.filePath, item.attributs);
30
+ }
31
+ }
32
+
33
+ if (Object.keys(this.routeConfig).length>0) {
34
+ this.sourceCode_header += `\nimport {RouteConfig} from "jopijs";`;
35
+
36
+ let count = 1;
37
+
38
+ for (let route of Object.keys(this.routeConfig)) {
39
+ let configFile = this.routeConfig[route];
40
+ let relPath = jk_fs.getRelativePath(writer.dir.output_dir, configFile);
41
+
42
+ this.sourceCode_header += `\nimport routeConfig${count} from "${relPath}";`;
43
+ this.sourceCode_body += `\n await routeConfig${count}(new RouteConfig(webSite, ${JSON.stringify(route)}));`;
44
+
45
+ count++;
46
+ }
47
+ }
48
+
49
+ this.sourceCode_body = `\n\nexport default async function(webSite) {${this.sourceCode_body}\n}`;
50
+
51
+ let filePath = jk_fs.join(writer.dir.output_dir, "declareServerRoutes.js");
52
+ await writeTextToFileIfMismatch(filePath, writer.AI_INSTRUCTIONS + this.sourceCode_header + this.sourceCode_body);
53
+
54
+ writer.genAddToInstallFile(InstallFileType.server, FilePart.imports, `\nimport declareRoutes from "./declareServerRoutes.js";`);
55
+ writer.genAddToInstallFile(InstallFileType.server, FilePart.footer, "\n onWebSiteCreated((webSite) => declareRoutes(webSite));");
56
+ }
57
+
58
+ async processDir(p: { moduleDir: string; arobaseDir: string; genDir: string; }) {
59
+ this.outputDir = getWriter().dir.output_dir;
60
+
61
+ let dirAttributes = await this.scanAttributes(p.arobaseDir);
62
+ //
63
+ if (dirAttributes.configFile) {
64
+ this.routeConfig["/"] = dirAttributes.configFile;
65
+ }
66
+
67
+ await this.scanDir(p.arobaseDir, "/", dirAttributes);
68
+ }
69
+
70
+ private bindPage(route: string, filePath: string, attributs: RouteAttributs) {
71
+ let routeId = "r" + (this.routeCount++);
72
+ let srcFilePath = jk_fs.getRelativePath(this.cwdDir, filePath);
73
+
74
+ filePath = jk_app.getCompiledFilePathFor(filePath);
75
+ let distFilePath = jk_fs.getRelativePath(this.outputDir, filePath);
76
+
77
+ let routeBindingParams = {route, attributs, filePath: srcFilePath};
78
+
79
+ this.sourceCode_header += `\nimport c_${routeId} from "${distFilePath}";`;
80
+ this.sourceCode_body += `\n await routeBindPage(webSite, c_${routeId}, ${JSON.stringify(routeBindingParams)});`
81
+ }
82
+
83
+ private bindVerb(verb: string, route: string, filePath: string, attributs: RouteAttributs) {
84
+ let routeId = "r" + (this.routeCount++);
85
+ let relPath = jk_fs.getRelativePath(this.outputDir, filePath);
86
+
87
+ let routeBindingParams = {verb, route, attributs, filePath};
88
+ this.sourceCode_header += `\nimport f_${routeId} from "${relPath}";`;
89
+ this.sourceCode_body += `\n await routeBindVerb(webSite, f_${routeId}, ${JSON.stringify(routeBindingParams)});`
90
+ }
91
+
92
+ protected normalizeFeatureName(feature: string): string|undefined {
93
+ if (feature==="cache") {
94
+ return "cache";
95
+ }
96
+
97
+ feature = feature.replaceAll("-", "");
98
+ feature = feature.replaceAll("_", "");
99
+
100
+ if (feature==="autocache") {
101
+ return "cache";
102
+ }
103
+
104
+ return undefined;
105
+ }
106
+
107
+ protected normalizeConditionName(condName: string, ctx: any|undefined): string|undefined {
108
+ let needRoleIdx = condName.toLowerCase().indexOf("needrole");
109
+ if (needRoleIdx===-1) return undefined;
110
+
111
+ let target = condName.substring(0, needRoleIdx).toUpperCase();
112
+ let role = condName.substring(needRoleIdx + 8).toLowerCase();
113
+ if ((role[0]==='_')||(role[0]==='-')) role = role.substring(1);
114
+
115
+ if (!ctx[target]) ctx[target] = [role];
116
+ else ctx[target].push(role);
117
+
118
+ target = target.toLowerCase();
119
+ return target + "NeedRole_" + role;
120
+ }
121
+
122
+ private async scanAttributes(dirPath: string): Promise<RouteAttributs> {
123
+ const res: RouteAttributs = {needRoles: {}};
124
+
125
+ const infos = await this.dir_extractInfos(dirPath, {
126
+ allowConditions: true,
127
+ requirePriority: true,
128
+ requireRefFile: false,
129
+ conditionCheckingContext: res.needRoles
130
+ });
131
+
132
+ res.configFile = await resolveFile(dirPath, ["config.tsx", "config.ts"]);
133
+
134
+ res.disableCache = (infos.features?.["cache"] === true) ? true : undefined;
135
+ res.priority = infos.priority;
136
+
137
+ if (!Object.values(res.needRoles!).length) {
138
+ res.needRoles = undefined;
139
+ }
140
+
141
+ return res;
142
+ }
143
+
144
+ private addToRegistry(item: RegistryItem) {
145
+ const key = item.route + ' ' + item.verb;
146
+ let current = this.registry[key];
147
+
148
+ if (!current) {
149
+ this.registry[key] = item;
150
+ return;
151
+ }
152
+
153
+ let newPriority = item.attributs.priority || PriorityLevel.default;
154
+ let currentPriority = current.attributs.priority || PriorityLevel.default;
155
+
156
+ if (newPriority>currentPriority) {
157
+ this.registry[key] = item;
158
+ }
159
+ }
160
+
161
+ private async scanDir(dir: string, route: string, attributes: RouteAttributs) {
162
+ let dirItems = await jk_fs.listDir(dir);
163
+
164
+ for (let dirItem of dirItems) {
165
+ if (dirItem.name[0] === '.') continue;
166
+
167
+ // Ignore if starts with '_'.
168
+ if (dirItem.name[0] === '_') continue;
169
+
170
+ if (dirItem.isDirectory) {
171
+ let segmentInfos = convertRouteSegment(dirItem.name);
172
+ let newRoute = route==="/" ? route + segmentInfos.routePart : route + "/" + segmentInfos.routePart;
173
+ let dirAttributs = await this.scanAttributes(dirItem.fullPath);
174
+
175
+ if (segmentInfos.isCatchAll && segmentInfos.name) {
176
+ dirAttributs.catchAllSlug = segmentInfos.name;
177
+ }
178
+
179
+ if (dirAttributs.configFile) {
180
+ this.routeConfig[newRoute] = dirAttributs.configFile;
181
+ }
182
+
183
+ await this.scanDir(dirItem.fullPath, newRoute, dirAttributs);
184
+ } else if (dirItem.isFile) {
185
+ let name = dirItem.name;
186
+
187
+ if (name.endsWith(".tsx") || name.endsWith(".ts")) {
188
+ let idx = name.lastIndexOf(".");
189
+ name = name.substring(0, idx);
190
+
191
+ switch (name) {
192
+ case "page":
193
+ this.addToRegistry({verb: "PAGE", route, filePath: dirItem.fullPath, attributs: attributes});
194
+ break;
195
+ case "onGET":
196
+ this.addToRegistry({verb: "GET", route, filePath: dirItem.fullPath, attributs: attributes});
197
+ break;
198
+ case "onPOST":
199
+ this.addToRegistry({verb: "POST", route, filePath: dirItem.fullPath, attributs: attributes});
200
+ break;
201
+ case "onPUT":
202
+ this.addToRegistry({verb: "PUT", route, filePath: dirItem.fullPath, attributs: attributes});
203
+ break;
204
+ case "onDELETE":
205
+ this.addToRegistry({verb: "DELETE", route, filePath: dirItem.fullPath, attributs: attributes});
206
+ break;
207
+ case "onHEAD":
208
+ this.addToRegistry({verb: "HEAD", route, filePath: dirItem.fullPath, attributs: attributes});
209
+ break;
210
+ case "onPATCH":
211
+ this.addToRegistry({verb: "PATCH", route, filePath: dirItem.fullPath, attributs: attributes});
212
+ break;
213
+ case "onOPTIONS":
214
+ this.addToRegistry({verb: "OPTIONS", route, filePath: dirItem.fullPath, attributs: attributes});
215
+ break;
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ }
222
+
223
+ interface RegistryItem {
224
+ verb: string;
225
+ route: string;
226
+ filePath: string;
227
+ attributs: RouteAttributs;
228
+ }
229
+
230
+ function convertRouteSegment(segment: string): {routePart: string, isCatchAll?: boolean, name?: string} {
231
+ if (segment.startsWith("[") && segment.endsWith("]")) {
232
+ segment = segment.substring(1, segment.length - 1);
233
+
234
+ if (segment.startsWith("..")) {
235
+ segment = segment.substring(2);
236
+ while (segment[0]===".") segment=segment.substring(1);
237
+
238
+ return {
239
+ routePart: "**",
240
+ isCatchAll: true,
241
+ name: segment.length ? segment : undefined
242
+ };
243
+ }
244
+
245
+ return {
246
+ routePart: ":" + segment,
247
+ isCatchAll: false,
248
+ name: segment
249
+ };
250
+ }
251
+
252
+ return {
253
+ routePart: segment
254
+ };
255
+ }
@@ -0,0 +1,19 @@
1
+ import {Type_ArobaseList} from "./arobaseTypes.ts";
2
+
3
+ export default class TypeUiComposite extends Type_ArobaseList {
4
+ protected codeGen_generateExports(listAsArray: string) {
5
+ let array = listAsArray.slice(1, -2).split(",");
6
+ listAsArray = array.map(e => ` _jsx(${e}, {})`).join(", \n");
7
+ let fct = `function p() {\n return _jsxs(_Fragment, { children: [\n${listAsArray}\n ]});\n}`;
8
+
9
+ return "export default " + fct + ";";
10
+ }
11
+
12
+ protected codeGen_generateImports() {
13
+ return `import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";\n`;
14
+ }
15
+
16
+ protected codeGen_createDeclarationTypes() {
17
+ return `export default function p(): import("react/jsx-runtime").JSX.Element;`
18
+ }
19
+ }
@@ -0,0 +1,4 @@
1
+ It's the entry point for the loader functionalities allowing to extension Node.js and Bun.js
2
+ capacities to do custom import.
3
+
4
+ This lib is automatically referenced by the `jopin` tool (and jopib).
@@ -0,0 +1,27 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ //import {compile, getDefaultLinkerConfig} from "../@linker/index.ts";
4
+
5
+ const myPlugin = {
6
+ name: "jopi-replace-text",
7
+
8
+ setup(build) {
9
+ build.onLoad({filter: /\.(tsx|ts|js|jsx)$/}, async ({path: p2}) => {
10
+ const oldContent = await fs.readFile(p2, 'utf8');
11
+ let newContent = oldContent.replace("jBundler_ifServer", "jBundler_ifBrowser");
12
+ const loader = path.extname(p2).toLowerCase().substring(1);
13
+ return {contents: newContent, loader: loader};
14
+ });
15
+
16
+ // Note: this is not working since it's executed only once at the first start
17
+ // and not after each rebuild.
18
+
19
+ /*build.onStart(async () => {
20
+ //console.log("Jopi - Bun static compiler loader - beforeRebuild");
21
+ //await timer(3000);
22
+ //await compile(import.meta, getDefaultLinkerConfig());
23
+ });*/
24
+ }
25
+ }
26
+
27
+ export default myPlugin;
@@ -0,0 +1,19 @@
1
+ import * as NodeModule from 'node:module';
2
+
3
+ import {isNodeJS, isBunJS} from "jopi-toolkit/jk_what";
4
+ import {installBunJsLoader} from "jopijs/loader-tools";
5
+
6
+ // Guard to avoid recursive self-registration when using Module.register(import.meta.url)
7
+ const __JOPI_LOADER_REGISTERED__ = Symbol.for('jopi-loader:registered');
8
+ const __g: any = globalThis as any;
9
+
10
+ if (!__g[__JOPI_LOADER_REGISTERED__]) {
11
+ __g[__JOPI_LOADER_REGISTERED__] = true;
12
+
13
+ if (isNodeJS) {
14
+ // "register" allow async.
15
+ NodeModule.register(new URL('./nodeJsLoader.js', import.meta.url));
16
+ } else if (isBunJS) {
17
+ installBunJsLoader();
18
+ }
19
+ }
@@ -0,0 +1,7 @@
1
+ import {resolveNodeJsAlias} from "jopijs/loader-tools"
2
+
3
+ //console.log('⚠️🎉🌟🔥🛑⚠️🚫 loader');
4
+
5
+ export async function resolve(specifier, context, nextResolve) {
6
+ return resolveNodeJsAlias(specifier, context, nextResolve);
7
+ }
@@ -0,0 +1,21 @@
1
+ import {doNodeJsLoad, doNodeJsResolve} from "jopijs/loader-tools";
2
+
3
+ // Guard to avoid recursive self-registration when using Module.register(import.meta.url)
4
+ /*const __JOPI_LOADER_REGISTERED__ = Symbol.for('jopi-loader:registered');
5
+ const __g: any = globalThis as any;
6
+
7
+ if (!__g[__JOPI_LOADER_REGISTERED__]) {
8
+ __g[__JOPI_LOADER_REGISTERED__] = true;
9
+
10
+ // "register" allow async.
11
+ NodeModule.register(import.meta.url as unknown as string);
12
+ }*/
13
+
14
+ export async function resolve(specifier: string, context: any, nextResolve: any) {
15
+ return doNodeJsResolve(specifier, context, nextResolve);
16
+ }
17
+
18
+ // noinspection JSUnusedGlobalSymbols
19
+ export async function load(url: string, context: any, nextLoad: any) {
20
+ return doNodeJsLoad(url, context, nextLoad);
21
+ }
@@ -0,0 +1,2 @@
1
+ It's tools used from the application launched from the loader when using `jopin`.
2
+ It allows communication with the host in case where the watching / browser refresh is in place.
@@ -0,0 +1,108 @@
1
+ import process from 'node:process';
2
+ import type {WebSite} from "../@core";
3
+ import * as jk_events from "jopi-toolkit/jk_events";
4
+ import {isBunJS} from "jopi-toolkit/jk_what";
5
+ import {DontCallBeforeElapsed} from "jopi-toolkit/jk_tools";
6
+
7
+ export function isBrowserRefreshEnabled(): boolean {
8
+ return hasJopiDevFlag() || hasJopiDevUiFlag();
9
+ }
10
+
11
+ /**
12
+ * JOPI_DEV: on source change, restart the server and refresh the browser.
13
+ * It's slower than JOPI_DEV_UI but allows testing server changes.
14
+ */
15
+ export function hasJopiDevFlag() {
16
+ return process.env.JOPI_DEV === "1";
17
+ }
18
+
19
+ /**
20
+ * JOPI_DEV_UI: on source change, don't restart the server
21
+ * but rebuild the UI pages and refresh the browser.
22
+ * (with bun: it uses React HMR, which is a special case)
23
+ *
24
+ * -> It's way faster than JOPI_DEV but can have some inconsistency
25
+ * when modifying the @alias directory content.
26
+ */
27
+ export function hasJopiDevUiFlag() {
28
+ return process.env.JOPI_DEV_UI === "1";
29
+ }
30
+
31
+ /**
32
+ * Single page mode is when the internal bundle compiles the pages one by one.
33
+ * It's used for development to have a fast starting time.
34
+ *
35
+ * The opposite (when not single-page mode) is to compile all the pages in one go.
36
+ * This produces an optimized bundle, without duplicates, but can be slow to start.
37
+ */
38
+ export function isSinglePageMode() {
39
+ if (gSinglePageMode===undefined) {
40
+ if (isReactHMR()) gSinglePageMode = false;
41
+ else gSinglePageMode = hasJopiDevFlag() || hasJopiDevUiFlag();
42
+ }
43
+
44
+ return gSinglePageMode;
45
+ }
46
+ //
47
+ let gSinglePageMode: boolean|undefined;
48
+
49
+ /**
50
+ * React HMR is when the browser automatically refreshes his content
51
+ * but without a full refresh. It does a clever refresh by removing old
52
+ * JavaScript and injecting the new-one, before re-rendering the React components
53
+ * without losing their previous state.
54
+ */
55
+ export function isReactHMR() {
56
+ return hasJopiDevUiFlag() && isBunJS;
57
+ }
58
+
59
+ function sse_onChange() {
60
+ const event = new EventSource('/_jopirw_/bundler');
61
+ let isFirstConnection = true;
62
+
63
+ // This allows refreshing the browser when
64
+ // the connection is lost, and the browser connects again.
65
+ //
66
+ event.addEventListener('open', () => {
67
+ if (isFirstConnection) isFirstConnection = false;
68
+ else window.location.reload();
69
+ });
70
+
71
+ // This allows refreshing the browser when
72
+ // the server sends a signal to the browser.
73
+ //
74
+ event.addEventListener("change", () => {
75
+ console.log("SSE Event [/_jopirw_/bundler] : Refreshing browser");
76
+ window.location.reload();
77
+ });
78
+ }
79
+ //
80
+ let g_sse_onChange: string|undefined;
81
+
82
+ export function getBrowserRefreshScript() {
83
+ if (!g_sse_onChange) {
84
+ g_sse_onChange = sse_onChange.toString();
85
+ }
86
+
87
+ return `(${g_sse_onChange})()`;
88
+ }
89
+
90
+ export function installBrowserRefreshSseEvent(webSite: WebSite) {
91
+ webSite.addSseEVent("/_jopirw_/bundler", {
92
+ getWelcomeMessage() {
93
+ return "Jopi Rewrite - Browser refresh";
94
+ },
95
+
96
+ handler(controller) {
97
+ jk_events.addListener("@jopi.bundler.watch.afterRebuild", () => {
98
+ // Can occur multi times with single-page mode.
99
+ if (!gLimitBrowserRefresh.check()) return;
100
+
101
+ console.log("🔥 JopiN - UI change detected: refreshing browser");
102
+ controller.send("change", "updated");
103
+ });
104
+ }
105
+ });
106
+ }
107
+
108
+ const gLimitBrowserRefresh = new DontCallBeforeElapsed(2000);
@@ -0,0 +1,6 @@
1
+ Contains tools related to pre-processing your source-code.
2
+ Mainly for manager the `import` in order to allows Node.js to mimick Vite.js import capacities:
3
+
4
+ * Importing images / json / ...
5
+ * Supporting alias `import "@/shared/myItems.ts` where `@/shared` point to a special location.
6
+ * Supporting `?raw` and `?inline` modifiers. Ex: `import asDataUrl from "./myImage.png?inline"`.
@@ -0,0 +1,33 @@
1
+ import {supportedExtensionsRegExp} from "./rules.ts";
2
+ import {transformFile} from "./transform.ts";
3
+ import {installEsBuildPlugins} from "./esBuildPlugin.js";
4
+
5
+ // https://bun.com/docs/runtime/plugins
6
+
7
+ export function installBunJsLoader() {
8
+ Bun.plugin({
9
+ name: "jopi-loader",
10
+ setup(build) {
11
+ // For module.css and imports with ?inline and ?raw
12
+ installEsBuildPlugins(build);
13
+
14
+ // For .css/.scss/.png/.txt/...
15
+ build.onLoad({filter: supportedExtensionsRegExp}, async ({path}) => {
16
+ let idx = path.indexOf("?");
17
+ let options = "";
18
+
19
+ if (idx !== -1) {
20
+ options = path.substring(idx + 1);
21
+ path = path.substring(0, idx);
22
+ }
23
+
24
+ const res = await transformFile(path, options);
25
+
26
+ return {
27
+ contents: res.text,
28
+ loader: "js",
29
+ };
30
+ });
31
+ }
32
+ });
33
+ }