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,865 @@
1
+ import * as jk_fs from "jopi-toolkit/jk_fs";
2
+ import * as jk_tools from "jopi-toolkit/jk_tools";
3
+ import * as jk_term from "jopi-toolkit/jk_term";
4
+ import * as jk_what from "jopi-toolkit/jk_what";
5
+ import * as jk_events from "jopi-toolkit/jk_events";
6
+ import {PriorityLevel} from "jopi-toolkit/jk_tools";
7
+
8
+ export {PriorityLevel} from "jopi-toolkit/jk_tools";
9
+
10
+ const LOG = false;
11
+
12
+ //region Helpers
13
+
14
+ export async function resolveFile(dirToSearch: string, fileNames: string[]): Promise<string|undefined> {
15
+ for (let fileName of fileNames) {
16
+ let filePath = jk_fs.join(dirToSearch, fileName);
17
+ if (await jk_fs.isFile(filePath)) return filePath;
18
+ }
19
+
20
+ return undefined;
21
+ }
22
+
23
+ export function declareLinkerError(message: string, filePath?: string): Error {
24
+ jk_term.logBgRed("⚠️ Jopi Linker Error -", message, "⚠️");
25
+ if (filePath) jk_term.logBlue("See:", jk_fs.pathToFileURL(filePath));
26
+ process.exit(1);
27
+ }
28
+
29
+ export async function getSortedDirItem(dirPath: string): Promise<jk_fs.DirItem[]> {
30
+ const items = await jk_fs.listDir(dirPath);
31
+ return items.sort((a, b) => a.name.localeCompare(b.name));
32
+ }
33
+
34
+ export async function useCanonicalFileName(fileFullPath: string, expectedFileName: string): Promise<string> {
35
+ let fileName = jk_fs.basename(fileFullPath);
36
+ let newFullPath = jk_fs.join(jk_fs.dirname(fileFullPath), expectedFileName);
37
+
38
+ if (fileName !== expectedFileName) {
39
+ await jk_fs.rename(fileFullPath, newFullPath);
40
+ }
41
+
42
+ return newFullPath;
43
+ }
44
+
45
+ export async function addNameIntoFile(filePath: string, name: string = jk_fs.basename(filePath)) {
46
+ await writeTextToFileIfMismatch(filePath, name);
47
+ }
48
+
49
+ /**
50
+ * Write the file content only if the file is missing or his content is not the same.
51
+ * Allows to avoid triggering a file change detection event.
52
+ */
53
+ export async function writeTextToFileIfMismatch(filePath: string, content: string) {
54
+ if (!await jk_fs.isFile(filePath)) {
55
+ await jk_fs.writeTextToFile(filePath, content);
56
+ return;
57
+ }
58
+
59
+ const currentContent = await jk_fs.readTextFromFile(filePath);
60
+ if (currentContent===content) return;
61
+
62
+ //console.log("writeTextToFileIfMismatch - Updating file " + filePath);
63
+ await jk_fs.writeTextToFile(filePath, content);
64
+ }
65
+
66
+ //endregion
67
+
68
+ //region Registry
69
+
70
+ export interface RegistryItem {
71
+ itemPath: string;
72
+ arobaseType: ArobaseType;
73
+ priority?: PriorityLevel;
74
+ }
75
+
76
+ let gRegistry: Record<string, RegistryItem> = {};
77
+
78
+ //endregion
79
+
80
+ //region Generating code
81
+
82
+ export enum FilePart {
83
+ imports = "imports",
84
+ body = "body",
85
+ footer = "footer",
86
+ }
87
+
88
+ export enum InstallFileType {server, browser, both}
89
+
90
+ async function generateAll() {
91
+ function applyTemplate(template: string, header: string, body: string, footer: string): string {
92
+ if (!header) header = "";
93
+ if (!footer) footer = "";
94
+ if (!body) body = "";
95
+
96
+ template = template.replace("__AI_INSTRUCTIONS", AI_INSTRUCTIONS);
97
+ template = template.replace("__HEADER", header);
98
+ template = template.replace("__BODY", body);
99
+ template = template.replace("__FOOTER", footer);
100
+
101
+ return template;
102
+ }
103
+
104
+ for (let arobaseType of Object.values(gArobaseHandler)) {
105
+ await arobaseType.beginGeneratingCode(gCodeGenWriter);
106
+
107
+ let items: RegistryItem[] = [];
108
+
109
+ for (let key in gRegistry) {
110
+ const item = gRegistry[key];
111
+
112
+ if (item.arobaseType === arobaseType) {
113
+ const eventData = {
114
+ codeWrite: gCodeGenWriter, key,
115
+ item, items, mustSkip: false
116
+ };
117
+
118
+ items.push(item);
119
+ await jk_events.sendAsyncEvent("@jopi.linker.generateCode." + arobaseType.typeName, eventData);
120
+
121
+ if (!eventData.mustSkip) {
122
+ await item.arobaseType.generateCodeForItem(gCodeGenWriter, key, item);
123
+ }
124
+ }
125
+ }
126
+
127
+ await arobaseType.endGeneratingCode(gCodeGenWriter, items);
128
+ }
129
+
130
+ for (let p of gModuleDirProcessors) {
131
+ await p.generateCode(gCodeGenWriter);
132
+ }
133
+
134
+ let installerFile = applyTemplate(gServerInstallFileTemplate, gServerInstallFile[FilePart.imports], gServerInstallFile[FilePart.body], gServerInstallFile[FilePart.footer]);
135
+ await writeTextToFileIfMismatch(getServerInstallScript(), installerFile);
136
+ gServerInstallFile = {};
137
+
138
+ installerFile = applyTemplate(gBrowserInstallFileTemplate, gBrowserInstallFile[FilePart.imports], gBrowserInstallFile[FilePart.body], gBrowserInstallFile[FilePart.footer]);
139
+ await writeTextToFileIfMismatch(getBrowserInstallScript(), installerFile);
140
+ gBrowserInstallFile = {};
141
+ }
142
+
143
+ interface WriteCodeFileParams {
144
+ fileInnerPath: string;
145
+ srcFileContent: string;
146
+ distFileContent: string;
147
+ declarationFile?: string;
148
+ useTypescriptForSource?: boolean;
149
+ }
150
+
151
+ export class CodeGenWriter {
152
+ public readonly isTypeScriptOnly = gIsTypeScriptOnly;
153
+
154
+ constructor(public readonly dir: Directories) {
155
+ }
156
+
157
+ toJavascriptFileName(filePath: string): string {
158
+ let idx = filePath.lastIndexOf(".");
159
+ if (idx!==-1) return filePath.substring(0, idx) + ".js";
160
+ return filePath;
161
+ }
162
+
163
+ makePathRelativeToOutput(path: string) {
164
+ return jk_fs.getRelativePath(this.dir.output_src, path);
165
+ }
166
+
167
+ async writeCodeFile(params: WriteCodeFileParams) {
168
+ // The file must:
169
+ // - Be a JavaScript file.
170
+ // - Be written into ./src/_jopiLinkerGen (for alias resolve)
171
+ // - Be written into ./dst/_jopiLinkerGen (for node.js TypeScript to js compilation)
172
+
173
+ const ext = params.useTypescriptForSource ? ".ts" : ".js";
174
+
175
+ await writeTextToFileIfMismatch(jk_fs.join(gDir_outputSrc, params.fileInnerPath + ext), params.srcFileContent);
176
+
177
+ if (!gIsTypeScriptOnly) {
178
+ await writeTextToFileIfMismatch(jk_fs.join(gDir_outputDst, params.fileInnerPath + ".js"), params.distFileContent);
179
+ }
180
+
181
+ if (params.declarationFile) {
182
+ if (!params.useTypescriptForSource) {
183
+ await writeTextToFileIfMismatch(jk_fs.join(gDir_outputSrc, params.fileInnerPath + ".d.ts"), params.declarationFile);
184
+ }
185
+
186
+ if (!gIsTypeScriptOnly) {
187
+ await writeTextToFileIfMismatch(jk_fs.join(gDir_outputDst, params.fileInnerPath + ".d.ts"), params.declarationFile);
188
+ }
189
+ }
190
+ }
191
+
192
+ genAddToInstallFile(who: InstallFileType, where: FilePart, javascriptContent: string) {
193
+ function addTo(group: Record<string, string>) {
194
+ let part = group[where] || "";
195
+ group[where] = part + javascriptContent;
196
+ }
197
+
198
+ if (who===InstallFileType.both) {
199
+ addTo(gServerInstallFile);
200
+ addTo(gBrowserInstallFile);
201
+ } else if (who===InstallFileType.server) {
202
+ addTo(gServerInstallFile);
203
+ } else if (who===InstallFileType.browser) {
204
+ addTo(gBrowserInstallFile);
205
+ }
206
+ }
207
+
208
+ public readonly AI_INSTRUCTIONS = AI_INSTRUCTIONS;
209
+ }
210
+
211
+ let gCodeGenWriter: CodeGenWriter;
212
+
213
+ let gServerInstallFile: Record<string, string> = {};
214
+
215
+ // Here it's ASYNC.
216
+ let gServerInstallFileTemplate = `__AI_INSTRUCTIONS
217
+ __HEADER
218
+
219
+ export default async function(registry) {
220
+ __BODY__FOOTER
221
+ }`;
222
+
223
+ let gBrowserInstallFile: Record<string, string> = {};
224
+
225
+ // Here it's not async.
226
+ let gBrowserInstallFileTemplate = `__AI_INSTRUCTIONS
227
+ __HEADER
228
+
229
+ export default function(registry) {
230
+ __BODY__FOOTER
231
+ }`;
232
+
233
+ //endregion
234
+
235
+ //region Processing project
236
+
237
+ async function processProject() {
238
+ await processModules();
239
+ await generateAll();
240
+ }
241
+
242
+ async function processModules() {
243
+ let modules = await jk_fs.listDir(gDir_ProjectSrc);
244
+
245
+ for (let module of modules) {
246
+ if (!module.isDirectory) continue;
247
+ if (!module.name.startsWith("mod_")) continue;
248
+
249
+ for (let p of gModuleDirProcessors) {
250
+ await p.onBeginModuleProcessing(gCodeGenWriter, module.fullPath);
251
+ await jk_events.sendAsyncEvent("@jopi.linker.onModule", { codeWrite: gCodeGenWriter, moduleDir: module.fullPath});
252
+ }
253
+
254
+ await processModule(module.fullPath);
255
+
256
+ for (let p of gModuleDirProcessors) {
257
+ await p.onEndModuleProcessing(gCodeGenWriter, module.fullPath);
258
+ }
259
+ }
260
+ }
261
+
262
+ async function processModule(moduleDir: string) {
263
+ let dirItems = await jk_fs.listDir(moduleDir);
264
+ let arobaseDir: jk_fs.DirItem|undefined;
265
+
266
+ for (let dirItem of dirItems) {
267
+ if (!dirItem.isDirectory) continue;
268
+ if (dirItem.name[0] !== "@") continue;
269
+ if (dirItem.name == "@alias") { arobaseDir = dirItem; continue; }
270
+
271
+ let name = dirItem.name.substring(1);
272
+ let arobaseType = gArobaseHandler[name];
273
+ if (!arobaseType) throw declareLinkerError("Unknown arobase type: " + name, dirItem.fullPath);
274
+
275
+ if (arobaseType.position !== "root") continue;
276
+ await arobaseType.processDir({moduleDir, arobaseDir: dirItem.fullPath, genDir: gDir_outputSrc});
277
+ }
278
+
279
+ if (arobaseDir) {
280
+ dirItems = await jk_fs.listDir(arobaseDir.fullPath);
281
+
282
+ for (let dirItem of dirItems) {
283
+ if (!dirItem.isDirectory) continue;
284
+
285
+ let name = dirItem.name;
286
+ let arobaseType = gArobaseHandler[name];
287
+ if (!arobaseType) throw declareLinkerError("Unknown arobase type: " + name, dirItem.fullPath);
288
+
289
+ if (arobaseType.position === "root") continue;
290
+ await arobaseType.processDir({moduleDir, arobaseDir: dirItem.fullPath, genDir: gDir_outputSrc});
291
+ }
292
+ }
293
+ }
294
+
295
+ //endregion
296
+
297
+ //region Extensions
298
+
299
+ export abstract class ArobaseType {
300
+ constructor(public readonly typeName: string, public readonly position?: "root"|undefined) {
301
+ this.initialize();
302
+ }
303
+
304
+ protected initialize() {
305
+ }
306
+
307
+ abstract processDir(p: { moduleDir: string; arobaseDir: string; genDir: string; }): Promise<void>;
308
+
309
+ declareError(message: string, filePath?: string): Error {
310
+ return declareLinkerError(message, filePath);
311
+ }
312
+
313
+ //region Codegen
314
+
315
+ generateCodeForItem(writer: CodeGenWriter, key: string, rItem: RegistryItem): Promise<void> {
316
+ return Promise.resolve();
317
+ }
318
+
319
+ beginGeneratingCode(writer: CodeGenWriter): Promise<void> {
320
+ return Promise.resolve();
321
+ }
322
+
323
+ endGeneratingCode(writer: CodeGenWriter, items: RegistryItem[]): Promise<void> {
324
+ return Promise.resolve();
325
+ }
326
+
327
+ //endregion
328
+
329
+ //region Processing dir
330
+
331
+ /**
332
+ * Process a directory containing item to process.
333
+ *
334
+ * ruleDir/itemType/newItem1
335
+ * /newItem2
336
+ * ^- we will iterate it
337
+ * ^-- we are here
338
+ */
339
+ async dir_recurseOnDir(p: ScanDirItemsParams) {
340
+ const dirItems = await jk_fs.listDir(p.dirToScan);
341
+
342
+ for (let entry of dirItems) {
343
+ if ((entry.name[0] === ".") || (entry.name[0] === "_")) continue;
344
+
345
+ if (p.expectFsType === "file") {
346
+ if (entry.isFile) {
347
+ if (p.handler) await p.handler(entry, p.rules);
348
+ else if (p.rules) await this.dir_processItem(entry, p.rules);
349
+ }
350
+ } else if (p.expectFsType === "dir") {
351
+ if (entry.isDirectory) {
352
+ if (p.handler) await p.handler(entry, p.rules);
353
+ else if (p.rules) await this.dir_processItem(entry, p.rules);
354
+ }
355
+ } else if (p.expectFsType === "fileOrDir") {
356
+ if (p.handler) await p.handler(entry, p.rules);
357
+ else if (p.rules) await this.dir_processItem(entry, p.rules);
358
+ }
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Process an item to process.
364
+ * Will analyze it and extract common informations.
365
+ *
366
+ * ruleDir/itemType/newItem/...
367
+ * ^-- we are here
368
+ */
369
+ async dir_processItem(dirItem: jk_fs.DirItem, p: ProcessDirItemParams) {
370
+ const thisIsFile = dirItem.isFile;
371
+ const thisFullPath = dirItem.fullPath;
372
+ const thisName = dirItem.name;
373
+ let thisNameAsUID: string|undefined;
374
+
375
+ // The file / folder-name is a UUID4?
376
+ let thisIsUUID = jk_tools.isUUIDv4(thisName);
377
+
378
+ if (thisIsUUID) {
379
+ if (p.nameConstraint==="mustNotBeUid") {
380
+ throw declareLinkerError("The name must NOT be an UID", thisFullPath);
381
+ }
382
+
383
+ thisNameAsUID = thisName;
384
+ } else {
385
+ if (p.nameConstraint==="mustBeUid") {
386
+ throw declareLinkerError("The name MUST be an UID", thisFullPath);
387
+ }
388
+ }
389
+
390
+ // It's a file?
391
+ if (thisIsFile) {
392
+ // Process it now.
393
+ await p.transform({
394
+ itemName: thisName,
395
+ uid: thisIsUUID ? thisName : undefined,
396
+ priority: PriorityLevel.default,
397
+
398
+ itemPath: thisFullPath, isFile: thisIsFile,
399
+ parentDirName: p.rootDirName,
400
+
401
+ resolved: {}
402
+ });
403
+
404
+ return;
405
+ }
406
+
407
+ // Will search references to config.json / index.tsx / ...
408
+ //
409
+ let resolved: Record<string, string | undefined> = {};
410
+ //
411
+ if (p.filesToResolve) {
412
+ for (let key in p.filesToResolve) {
413
+ resolved[key] = await resolveFile(thisFullPath, p.filesToResolve[key]);
414
+ }
415
+ }
416
+
417
+ // Search the "uid.myuid" file, which allows knowing the uid of the item.
418
+ //
419
+ const result = await this.dir_extractInfos(thisFullPath, p);
420
+
421
+ const myUid = result.myUid;
422
+ const refTarget = result.refTarget;
423
+ const conditions = result.conditionsFound;
424
+ let priority = result.priority!;
425
+
426
+ if (!priority) {
427
+ priority = PriorityLevel.default;
428
+
429
+ if (p.requirePriority) {
430
+ await addNameIntoFile(jk_fs.join(thisFullPath, "default.priority"), "default.priority");
431
+ }
432
+ }
433
+
434
+ if (myUid) {
435
+ // If itemUid already defined, then must match myUidFile.
436
+ if (thisNameAsUID && (thisNameAsUID!==myUid)) {
437
+ throw declareLinkerError("The UID in the .myuid file is NOT the same as the UID in the folder name", thisFullPath);
438
+ }
439
+
440
+ thisNameAsUID = myUid;
441
+ }
442
+
443
+ await p.transform({
444
+ itemName: thisName, uid: thisNameAsUID, refTarget,
445
+ itemPath: thisFullPath, isFile: thisIsFile, resolved, priority,
446
+ parentDirName: p.rootDirName,
447
+ conditions
448
+ });
449
+ }
450
+
451
+ /**
452
+ * Analyse the content of a dir, extract information and check rules.
453
+ * @param dirPath
454
+ * @param rules
455
+ * @param useThisUid
456
+ */
457
+ protected async dir_extractInfos(dirPath: string, rules: DirAnalyzingRules, useThisUid?: string | undefined): Promise<ExtractDirectoryInfosResult> {
458
+ const decodeFeature = async (dirItem: jk_fs.DirItem, ext: string): Promise<string> => {
459
+ let featureName = dirItem.name.toLowerCase();
460
+ featureName = featureName.slice(0, -ext.length);
461
+
462
+ let canonicalName = this.normalizeFeatureName(featureName, rules.featureCheckingContext);
463
+
464
+ if (!canonicalName) {
465
+ throw declareLinkerError("Unknown feature name: " + featureName, dirItem.fullPath);
466
+ }
467
+
468
+ dirItem.name = canonicalName + ext;
469
+ dirItem.fullPath = await useCanonicalFileName(dirItem.fullPath, dirItem.name);
470
+
471
+ return canonicalName;
472
+ }
473
+
474
+ const decodeCond = async (dirItem: jk_fs.DirItem): Promise<string> => {
475
+ let condName = dirItem.name.toLowerCase();
476
+ // Remove .cond
477
+ condName = condName.slice(0, -5);
478
+
479
+ let canonicalName = this.normalizeConditionName(condName, rules.conditionCheckingContext);
480
+
481
+ if (!canonicalName) {
482
+ throw declareLinkerError("Unknown condition name: " + condName, dirItem.fullPath);
483
+ }
484
+
485
+ dirItem.name = canonicalName + ".cond";
486
+ dirItem.fullPath = await useCanonicalFileName(dirItem.fullPath, dirItem.name);
487
+
488
+ return canonicalName;
489
+ }
490
+
491
+ async function decodePriority(priorityName: string, itemFullPath: string): Promise<PriorityLevel> {
492
+ priorityName = priorityName.toLowerCase();
493
+ priorityName = priorityName.replace("-", "");
494
+ priorityName = priorityName.replace("_", "");
495
+
496
+ switch (priorityName) {
497
+ case "default.priority":
498
+ await useCanonicalFileName(itemFullPath, priorityName)
499
+ return PriorityLevel.default;
500
+ case "veryhigh.priority":
501
+ await useCanonicalFileName(itemFullPath, "very_high.priority")
502
+ return PriorityLevel.veryHigh;
503
+ case "high.priority":
504
+ await useCanonicalFileName(itemFullPath, priorityName)
505
+ return PriorityLevel.high;
506
+ case "low.priority":
507
+ await useCanonicalFileName(itemFullPath, priorityName)
508
+ return PriorityLevel.low;
509
+ case "verylow.priority":
510
+ await useCanonicalFileName(itemFullPath, "very_low.priority")
511
+ return PriorityLevel.veryLow;
512
+ }
513
+
514
+ throw declareLinkerError("Unknown priority name: " + jk_fs.basename(itemFullPath, ".priority"), itemFullPath);
515
+ }
516
+
517
+ async function checkDirItem(entry: jk_fs.DirItem) {
518
+ if (entry.isSymbolicLink) return false;
519
+ if (entry.name[0] === ".") return false;
520
+
521
+ if (entry.isDirectory) {
522
+ if (entry.name==="_") {
523
+ let uid = useThisUid || jk_tools.generateUUIDv4();
524
+ let newPath = jk_fs.join(jk_fs.dirname(entry.fullPath), uid);
525
+ await jk_fs.rename(entry.fullPath, newPath);
526
+
527
+ entry.name = uid;
528
+ entry.fullPath = newPath;
529
+ }
530
+
531
+ if (entry.name[0]== "_") return false;
532
+ }
533
+ else {
534
+ if (entry.name === "_.myuid") {
535
+ let uid = useThisUid || jk_tools.generateUUIDv4();
536
+ await jk_fs.unlink(entry.fullPath);
537
+ entry.fullPath = jk_fs.join(jk_fs.dirname(entry.fullPath), uid + ".myuid");
538
+ entry.name = uid + ".myuid";
539
+
540
+ await writeTextToFileIfMismatch(entry.fullPath, uid);
541
+ }
542
+
543
+ if (entry.name[0]== "_") return false;
544
+
545
+ if (entry.name.endsWith(".myuid")) {
546
+ if (result.myUid) {
547
+ throw declareLinkerError("More than one .myuid file found here", entry.fullPath);
548
+ }
549
+
550
+ result.myUid = entry.name.slice(0, -6);
551
+ await addNameIntoFile(entry.fullPath);
552
+ }
553
+ else if (entry.name.endsWith(".priority")) {
554
+ if (result.priority) {
555
+ throw declareLinkerError("More than one .priority file found here", entry.fullPath);
556
+ }
557
+
558
+ if (rules.requirePriority===false) {
559
+ throw declareLinkerError("A .priority file is NOT expected here", entry.fullPath);
560
+ }
561
+
562
+ await addNameIntoFile(entry.fullPath);
563
+ result.priority = await decodePriority(entry.name, entry.fullPath);
564
+ }
565
+ else if (entry.name.endsWith(".cond")) {
566
+ if (rules.allowConditions===false) {
567
+ throw declareLinkerError("A .cond file is NOT expected here", entry.fullPath);
568
+ }
569
+
570
+ if (!result.conditionsFound) result.conditionsFound = new Set<string>();
571
+ result.conditionsFound.add(await decodeCond(entry));
572
+
573
+ await addNameIntoFile(entry.fullPath);
574
+ }
575
+ else if (entry.name.endsWith(".ref")) {
576
+ if (result.refTarget) {
577
+ throw declareLinkerError("More than one .ref file found here", entry.fullPath);
578
+ }
579
+
580
+ if (rules.requireRefFile === false) {
581
+ throw declareLinkerError("A .ref file is NOT expected here", entry.fullPath);
582
+ }
583
+
584
+ result.refTarget = entry.name.slice(0, -4);
585
+
586
+ await addNameIntoFile(entry.fullPath);
587
+ }
588
+ else if (entry.name.endsWith(".disable")) {
589
+ if (rules.allowFeatures===false) {
590
+ throw declareLinkerError("A .disable file is NOT expected here", entry.fullPath);
591
+ }
592
+
593
+ if (!result.features) result.features = {};
594
+
595
+ let canonicalName = await decodeFeature(entry, ".disable");
596
+ result.features[canonicalName] = false;
597
+
598
+ entry.name = canonicalName + ".disable";
599
+ entry.fullPath = await useCanonicalFileName(entry.fullPath, entry.name);
600
+ await addNameIntoFile(entry.fullPath);
601
+ }
602
+ else if (entry.name.endsWith(".enable")) {
603
+ if (rules.allowFeatures===false) {
604
+ throw declareLinkerError("A .disable file is NOT expected here", entry.fullPath);
605
+ }
606
+
607
+ if (!result.features) result.features = {};
608
+
609
+ let canonicalName = await decodeFeature(entry, ".enable");
610
+ result.features[canonicalName] = true;
611
+
612
+ entry.name = canonicalName + ".enable";
613
+ entry.fullPath = await useCanonicalFileName(entry.fullPath, entry.name);
614
+ await addNameIntoFile(entry.fullPath);
615
+ }
616
+
617
+ return true;
618
+ }
619
+ }
620
+
621
+ let result: ExtractDirectoryInfosResult = { dirItems: [] };
622
+
623
+ const items = await getSortedDirItem(dirPath);
624
+
625
+ for (let item of items) {
626
+ if (!await checkDirItem(item)) continue;
627
+ result.dirItems.push(item);
628
+ }
629
+
630
+ return result;
631
+ }
632
+
633
+ protected normalizeConditionName(condName: string, ctx: any|undefined): string|undefined {
634
+ return undefined;
635
+ }
636
+
637
+ protected normalizeFeatureName(featureName: string, ctx: any|undefined): string|undefined {
638
+ return undefined;
639
+ }
640
+
641
+ //endregion
642
+
643
+ //region Registry
644
+
645
+ registry_addItem<T extends RegistryItem>(itemId: string, item: T) {
646
+ // If already exists, then keep the one with greater priority.
647
+ //
648
+ if (gRegistry[itemId]) {
649
+ let currentPriority = gRegistry[itemId]?.priority || PriorityLevel.default;
650
+ let itemPriority = item.priority || PriorityLevel.default;
651
+ if (currentPriority > itemPriority) return;
652
+ }
653
+
654
+ gRegistry[itemId] = item;
655
+
656
+ if (LOG) {
657
+ const relPath = jk_fs.getRelativePath(gDir_ProjectSrc, item.itemPath);
658
+ console.log(`Add ${itemId} to registry. Path: ${relPath}`);
659
+ }
660
+ }
661
+
662
+ registry_getItem<T extends RegistryItem>(key: string, requireType?: ArobaseType): T|undefined {
663
+ const entry = gRegistry[key];
664
+ if (requireType && entry && (entry.arobaseType !== requireType)) throw declareLinkerError("The item " + key + " is not of the expected type @" + requireType.typeName);
665
+ return entry as T;
666
+ }
667
+
668
+ registry_requireItem<T extends RegistryItem>(key: string, requireType?: ArobaseType): T {
669
+ const entry = gRegistry[key];
670
+ if (!entry) throw declareLinkerError("The item " + key + " is required but not defined");
671
+ if (requireType && (entry.arobaseType !== requireType)) throw declareLinkerError("The item " + key + " is not of the expected type @" + requireType.typeName);
672
+ return entry as T;
673
+ }
674
+
675
+ //endregion
676
+ }
677
+
678
+ export interface DirAnalyzingRules {
679
+ requireRefFile?: boolean;
680
+ allowConditions?: boolean;
681
+ requirePriority?: boolean;
682
+ allowFeatures?: boolean;
683
+ conditionCheckingContext?: any;
684
+ featureCheckingContext?: any;
685
+ }
686
+
687
+ export interface ScanDirItemsParams {
688
+ dirToScan: string;
689
+ expectFsType: "file"|"dir"|"fileOrDir";
690
+
691
+ /**
692
+ * If defined, then will be called for each validated entry.
693
+ */
694
+ handler?: (item: jk_fs.DirItem, rules: ProcessDirItemParams|undefined) => Promise<void>;
695
+
696
+ rules?: ProcessDirItemParams;
697
+ }
698
+
699
+ export interface ProcessDirItemParams extends DirAnalyzingRules {
700
+ rootDirName: string;
701
+ filesToResolve?: Record<string, string[]>;
702
+ nameConstraint: "canBeUid"|"mustNotBeUid"|"mustBeUid";
703
+
704
+ transform: (props: TransformItemParams) => Promise<void>;
705
+ }
706
+
707
+ export interface TransformItemParams {
708
+ itemName: string;
709
+ itemPath: string;
710
+ isFile: boolean;
711
+
712
+ uid?: string;
713
+ refTarget?: string;
714
+ conditions?: Set<string>;
715
+
716
+ parentDirName: string;
717
+ priority: PriorityLevel;
718
+
719
+ resolved: Record<string, string|undefined>;
720
+ }
721
+
722
+ export interface ExtractDirectoryInfosResult {
723
+ dirItems: jk_fs.DirItem[];
724
+
725
+ myUid?: string;
726
+ priority?: PriorityLevel;
727
+ refTarget?: string;
728
+ conditionsFound?: Set<string>;
729
+ features?: Record<string, boolean>;
730
+ }
731
+
732
+ export class ModuleDirProcessor {
733
+ onBeginModuleProcessing(writer: CodeGenWriter, moduleDir: string): Promise<void> {
734
+ return Promise.resolve();
735
+ }
736
+
737
+ onEndModuleProcessing(writer: CodeGenWriter, moduleDir: string): Promise<void> {
738
+ return Promise.resolve();
739
+ }
740
+
741
+ generateCode(writer: CodeGenWriter): Promise<void> {
742
+ return Promise.resolve();
743
+ }
744
+ }
745
+
746
+ let gArobaseHandler: Record<string, ArobaseType> = {};
747
+ let gModuleDirProcessors: ModuleDirProcessor[] = [];
748
+
749
+ //endregion
750
+
751
+ //region Bootstrap
752
+
753
+ let gDir_ProjectRoot: string;
754
+ let gDir_ProjectSrc: string;
755
+ let gDir_ProjectDist: string;
756
+ let gDir_outputSrc: string;
757
+ let gDir_outputDst: string;
758
+
759
+ export function getWriter(): CodeGenWriter {
760
+ return gCodeGenWriter;
761
+ }
762
+
763
+ export function getBrowserInstallScript() {
764
+ if (gIsTypeScriptOnly) return jk_fs.join(gDir_outputSrc, "installBrowser.js");
765
+ return jk_fs.join(gDir_outputDst, "installBrowser.js");
766
+ }
767
+
768
+ export function getServerInstallScript() {
769
+ if (gIsTypeScriptOnly) return jk_fs.join(gDir_outputSrc, "installServer.js");
770
+ return jk_fs.join(gDir_outputDst, "installServer.js");
771
+ }
772
+
773
+ export interface Directories {
774
+ project: string;
775
+ project_src: string;
776
+ project_dst: string;
777
+
778
+ output_dir: string;
779
+ output_src: string;
780
+ output_dist: string;
781
+ }
782
+
783
+ let gIsTypeScriptOnly: boolean;
784
+
785
+ export async function compile(importMeta: any, config: LinkerConfig, isRefresh = false): Promise<void> {
786
+ async function searchLinkerScript(): Promise<string|undefined> {
787
+ let jopiLinkerScript = jk_fs.join(gDir_ProjectRoot, "dist", "jopi-linker.js");
788
+ if (await jk_fs.isFile(jopiLinkerScript)) return jopiLinkerScript;
789
+
790
+ if (jk_what.isBunJS) {
791
+ jopiLinkerScript = jk_fs.join(gDir_ProjectSrc, "jopi-linker.ts");
792
+ if (await jk_fs.isFile(jopiLinkerScript)) return jopiLinkerScript;
793
+ }
794
+
795
+ return undefined;
796
+ }
797
+
798
+ // Reset the registry in case of a second call to compile.
799
+ gRegistry = {};
800
+
801
+ gDir_ProjectRoot = config.projectRootDir;
802
+ gDir_ProjectSrc = jk_fs.join(gDir_ProjectRoot, "src");
803
+ gDir_ProjectDist = jk_fs.join(gDir_ProjectRoot, "dist");
804
+
805
+ gDir_outputSrc = jk_fs.join(gDir_ProjectSrc, "_jopiLinkerGen");
806
+ gDir_outputDst = jk_fs.join(gDir_ProjectDist, "_jopiLinkerGen");
807
+
808
+ gIsTypeScriptOnly = !importMeta.filename.endsWith(".js");
809
+
810
+ gCodeGenWriter = new CodeGenWriter({
811
+ project: gDir_ProjectRoot,
812
+ project_src: gDir_ProjectSrc,
813
+ project_dst: gDir_ProjectDist,
814
+
815
+ output_src: gDir_outputSrc,
816
+ output_dist: gDir_outputDst,
817
+
818
+ output_dir: gIsTypeScriptOnly ? gDir_outputSrc : gDir_outputDst
819
+ });
820
+
821
+ let jopiLinkerScript = await searchLinkerScript();
822
+ if (jopiLinkerScript) await import(jopiLinkerScript);
823
+
824
+ gServerInstallFileTemplate = config.templateForServer;
825
+ gBrowserInstallFileTemplate = config.templateForBrowser;
826
+
827
+ gArobaseHandler = {};
828
+
829
+ for (let aType of config.arobaseTypes) {
830
+ gArobaseHandler[aType.typeName] = aType;
831
+ }
832
+
833
+ gModuleDirProcessors = [];
834
+
835
+ for (let p of config.modulesProcess) {
836
+ gModuleDirProcessors.push(p);
837
+ }
838
+
839
+ // Avoid deleting the directory if it's a refresh.
840
+ // Why? Because resource can be requested while the
841
+ // refresh is occuring.
842
+ //
843
+ if (!isRefresh) {
844
+ // Note: here we don't destroy the dist dir.
845
+ await jk_fs.rmDir(gDir_outputSrc);
846
+ }
847
+
848
+ await processProject();
849
+ }
850
+
851
+ export interface LinkerConfig {
852
+ projectRootDir: string;
853
+ templateForBrowser: string;
854
+ templateForServer: string;
855
+ arobaseTypes: ArobaseType[];
856
+ modulesProcess: ModuleDirProcessor[];
857
+ }
858
+
859
+ //endregion
860
+
861
+ export const AI_INSTRUCTIONS = `/*
862
+ This file is generated by JopiRewrite. Do not modify it.
863
+ See file ARCHITECTURE.md at the root of the project for instructions.
864
+ */
865
+ `;