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.
- package/README.md +134 -0
- package/bin/jopib.js +4 -0
- package/bin/jopin.js +4 -0
- package/dist/@bundler/_logs.d.ts +2 -0
- package/dist/@bundler/_logs.js +4 -0
- package/dist/@bundler/_logs.js.map +1 -0
- package/dist/@bundler/core.d.ts +1 -0
- package/dist/@bundler/core.js +34 -0
- package/dist/@bundler/core.js.map +1 -0
- package/dist/@bundler/esbuild.d.ts +6 -0
- package/dist/@bundler/esbuild.js +111 -0
- package/dist/@bundler/esbuild.js.map +1 -0
- package/dist/@bundler/index.d.ts +2 -0
- package/dist/@bundler/index.js +3 -0
- package/dist/@bundler/index.js.map +1 -0
- package/dist/@bundler/plugins.d.ts +13 -0
- package/dist/@bundler/plugins.js +145 -0
- package/dist/@bundler/plugins.js.map +1 -0
- package/dist/@bundler/tailwind.d.ts +3 -0
- package/dist/@bundler/tailwind.js +119 -0
- package/dist/@bundler/tailwind.js.map +1 -0
- package/dist/@core/PageComponent.d.ts +6 -0
- package/dist/@core/PageComponent.js +10 -0
- package/dist/@core/PageComponent.js.map +1 -0
- package/dist/@core/_logs.d.ts +7 -0
- package/dist/@core/_logs.js +9 -0
- package/dist/@core/_logs.js.map +1 -0
- package/dist/@core/automaticStartStop.d.ts +25 -0
- package/dist/@core/automaticStartStop.js +106 -0
- package/dist/@core/automaticStartStop.js.map +1 -0
- package/dist/@core/browserCacheControl.d.ts +21 -0
- package/dist/@core/browserCacheControl.js +17 -0
- package/dist/@core/browserCacheControl.js.map +1 -0
- package/dist/@core/bundler/bundler.d.ts +22 -0
- package/dist/@core/bundler/bundler.js +90 -0
- package/dist/@core/bundler/bundler.js.map +1 -0
- package/dist/@core/bundler/common.d.ts +2 -0
- package/dist/@core/bundler/common.js +17 -0
- package/dist/@core/bundler/common.js.map +1 -0
- package/dist/@core/bundler/config.d.ts +20 -0
- package/dist/@core/bundler/config.js +11 -0
- package/dist/@core/bundler/config.js.map +1 -0
- package/dist/@core/bundler/extraContent.d.ts +6 -0
- package/dist/@core/bundler/extraContent.js +27 -0
- package/dist/@core/bundler/extraContent.js.map +1 -0
- package/dist/@core/bundler/pagesGenerator.d.ts +1 -0
- package/dist/@core/bundler/pagesGenerator.js +173 -0
- package/dist/@core/bundler/pagesGenerator.js.map +1 -0
- package/dist/@core/bundler/server.d.ts +8 -0
- package/dist/@core/bundler/server.js +35 -0
- package/dist/@core/bundler/server.js.map +1 -0
- package/dist/@core/caches/InMemoryCache.d.ts +35 -0
- package/dist/@core/caches/InMemoryCache.js +353 -0
- package/dist/@core/caches/InMemoryCache.js.map +1 -0
- package/dist/@core/caches/SimpleFileCache.d.ts +18 -0
- package/dist/@core/caches/SimpleFileCache.js +171 -0
- package/dist/@core/caches/SimpleFileCache.js.map +1 -0
- package/dist/@core/caches/cache.d.ts +36 -0
- package/dist/@core/caches/cache.js +33 -0
- package/dist/@core/caches/cache.js.map +1 -0
- package/dist/@core/caches/webSiteMirrorCache.d.ts +16 -0
- package/dist/@core/caches/webSiteMirrorCache.js +81 -0
- package/dist/@core/caches/webSiteMirrorCache.js.map +1 -0
- package/dist/@core/gzip.d.ts +4 -0
- package/dist/@core/gzip.js +31 -0
- package/dist/@core/gzip.js.map +1 -0
- package/dist/@core/index.d.ts +18 -0
- package/dist/@core/index.js +19 -0
- package/dist/@core/index.js.map +1 -0
- package/dist/@core/internalTools.d.ts +14 -0
- package/dist/@core/internalTools.js +79 -0
- package/dist/@core/internalTools.js.map +1 -0
- package/dist/@core/jQuery.d.ts +5 -0
- package/dist/@core/jQuery.js +18 -0
- package/dist/@core/jQuery.js.map +1 -0
- package/dist/@core/jopiEasy.d.ts +287 -0
- package/dist/@core/jopiEasy.js +983 -0
- package/dist/@core/jopiEasy.js.map +1 -0
- package/dist/@core/jopiRequest.d.ts +269 -0
- package/dist/@core/jopiRequest.js +1060 -0
- package/dist/@core/jopiRequest.js.map +1 -0
- package/dist/@core/jopiServer.d.ts +77 -0
- package/dist/@core/jopiServer.js +100 -0
- package/dist/@core/jopiServer.js.map +1 -0
- package/dist/@core/jopiWebSite.d.ts +319 -0
- package/dist/@core/jopiWebSite.js +653 -0
- package/dist/@core/jopiWebSite.js.map +1 -0
- package/dist/@core/letsEncrypt.d.ts +25 -0
- package/dist/@core/letsEncrypt.js +189 -0
- package/dist/@core/letsEncrypt.js.map +1 -0
- package/dist/@core/linker.d.ts +4 -0
- package/dist/@core/linker.js +37 -0
- package/dist/@core/linker.js.map +1 -0
- package/dist/@core/loadBalancing.d.ts +18 -0
- package/dist/@core/loadBalancing.js +126 -0
- package/dist/@core/loadBalancing.js.map +1 -0
- package/dist/@core/middlewares/CorsMiddleware.d.ts +5 -0
- package/dist/@core/middlewares/CorsMiddleware.js +15 -0
- package/dist/@core/middlewares/CorsMiddleware.js.map +1 -0
- package/dist/@core/middlewares/DdosProtection.d.ts +42 -0
- package/dist/@core/middlewares/DdosProtection.js +62 -0
- package/dist/@core/middlewares/DdosProtection.js.map +1 -0
- package/dist/@core/middlewares/index.d.ts +10 -0
- package/dist/@core/middlewares/index.js +14 -0
- package/dist/@core/middlewares/index.js.map +1 -0
- package/dist/@core/publicTools.d.ts +8 -0
- package/dist/@core/publicTools.js +11 -0
- package/dist/@core/publicTools.js.map +1 -0
- package/dist/@core/routeConfig.d.ts +48 -0
- package/dist/@core/routeConfig.js +102 -0
- package/dist/@core/routeConfig.js.map +1 -0
- package/dist/@core/searchParamFilter.d.ts +70 -0
- package/dist/@core/searchParamFilter.js +212 -0
- package/dist/@core/searchParamFilter.js.map +1 -0
- package/dist/@core/serverFetch.d.ts +122 -0
- package/dist/@core/serverFetch.js +312 -0
- package/dist/@core/serverFetch.js.map +1 -0
- package/dist/@core/serverImpl/server_bunjs.d.ts +29 -0
- package/dist/@core/serverImpl/server_bunjs.js +180 -0
- package/dist/@core/serverImpl/server_bunjs.js.map +1 -0
- package/dist/@core/serverImpl/server_nodejs.d.ts +22 -0
- package/dist/@core/serverImpl/server_nodejs.js +235 -0
- package/dist/@core/serverImpl/server_nodejs.js.map +1 -0
- package/dist/@core/serverInstanceBuilder.d.ts +17 -0
- package/dist/@core/serverInstanceBuilder.js +14 -0
- package/dist/@core/serverInstanceBuilder.js.map +1 -0
- package/dist/@core/userStores.d.ts +13 -0
- package/dist/@core/userStores.js +20 -0
- package/dist/@core/userStores.js.map +1 -0
- package/dist/@crawler/common.d.ts +203 -0
- package/dist/@crawler/common.js +68 -0
- package/dist/@crawler/common.js.map +1 -0
- package/dist/@crawler/core.d.ts +87 -0
- package/dist/@crawler/core.js +586 -0
- package/dist/@crawler/core.js.map +1 -0
- package/dist/@crawler/directFileCache.d.ts +10 -0
- package/dist/@crawler/directFileCache.js +60 -0
- package/dist/@crawler/directFileCache.js.map +1 -0
- package/dist/@crawler/index.d.ts +4 -0
- package/dist/@crawler/index.js +5 -0
- package/dist/@crawler/index.js.map +1 -0
- package/dist/@crawler/urlMapping.d.ts +21 -0
- package/dist/@crawler/urlMapping.js +52 -0
- package/dist/@crawler/urlMapping.js.map +1 -0
- package/dist/@crawler/utils.d.ts +6 -0
- package/dist/@crawler/utils.js +13 -0
- package/dist/@crawler/utils.js.map +1 -0
- package/dist/@generated/index.d.ts +29 -0
- package/dist/@generated/index.js +93 -0
- package/dist/@generated/index.js.map +1 -0
- package/dist/@linker/arobaseTypes.d.ts +50 -0
- package/dist/@linker/arobaseTypes.js +235 -0
- package/dist/@linker/arobaseTypes.js.map +1 -0
- package/dist/@linker/changeProof.d.ts +5 -0
- package/dist/@linker/changeProof.js +50 -0
- package/dist/@linker/changeProof.js.map +1 -0
- package/dist/@linker/config.d.ts +2 -0
- package/dist/@linker/config.js +40 -0
- package/dist/@linker/config.js.map +1 -0
- package/dist/@linker/engine.d.ts +156 -0
- package/dist/@linker/engine.js +665 -0
- package/dist/@linker/engine.js.map +1 -0
- package/dist/@linker/index.d.ts +3 -0
- package/dist/@linker/index.js +4 -0
- package/dist/@linker/index.js.map +1 -0
- package/dist/@linker/install.d.ts +4 -0
- package/dist/@linker/install.js +42 -0
- package/dist/@linker/install.js.map +1 -0
- package/dist/@linker/modInstaller.d.ts +10 -0
- package/dist/@linker/modInstaller.js +38 -0
- package/dist/@linker/modInstaller.js.map +1 -0
- package/dist/@linker/typeEvents.d.ts +9 -0
- package/dist/@linker/typeEvents.js +48 -0
- package/dist/@linker/typeEvents.js.map +1 -0
- package/dist/@linker/typeRoutes.d.ts +23 -0
- package/dist/@linker/typeRoutes.js +197 -0
- package/dist/@linker/typeRoutes.js.map +1 -0
- package/dist/@linker/typeUiComposite.d.ts +6 -0
- package/dist/@linker/typeUiComposite.js +16 -0
- package/dist/@linker/typeUiComposite.js.map +1 -0
- package/dist/@loader/index.d.ts +1 -0
- package/dist/@loader/index.js +17 -0
- package/dist/@loader/index.js.map +1 -0
- package/dist/@loader/nodeJsLoader.d.ts +2 -0
- package/dist/@loader/nodeJsLoader.js +19 -0
- package/dist/@loader/nodeJsLoader.js.map +1 -0
- package/dist/@loader-client/index.d.ts +33 -0
- package/dist/@loader-client/index.js +98 -0
- package/dist/@loader-client/index.js.map +1 -0
- package/dist/@loader-tools/bunJsLoader.d.ts +1 -0
- package/dist/@loader-tools/bunJsLoader.js +28 -0
- package/dist/@loader-tools/bunJsLoader.js.map +1 -0
- package/dist/@loader-tools/config.d.ts +49 -0
- package/dist/@loader-tools/config.js +79 -0
- package/dist/@loader-tools/config.js.map +1 -0
- package/dist/@loader-tools/cssModuleCompiler.d.ts +5 -0
- package/dist/@loader-tools/cssModuleCompiler.js +65 -0
- package/dist/@loader-tools/cssModuleCompiler.js.map +1 -0
- package/dist/@loader-tools/esBuildPlugin.d.ts +5 -0
- package/dist/@loader-tools/esBuildPlugin.js +113 -0
- package/dist/@loader-tools/esBuildPlugin.js.map +1 -0
- package/dist/@loader-tools/index.d.ts +9 -0
- package/dist/@loader-tools/index.js +10 -0
- package/dist/@loader-tools/index.js.map +1 -0
- package/dist/@loader-tools/jopin.d.ts +10 -0
- package/dist/@loader-tools/jopin.js +331 -0
- package/dist/@loader-tools/jopin.js.map +1 -0
- package/dist/@loader-tools/nodeJsLoader.d.ts +13 -0
- package/dist/@loader-tools/nodeJsLoader.js +101 -0
- package/dist/@loader-tools/nodeJsLoader.js.map +1 -0
- package/dist/@loader-tools/nodeJsResolver.d.ts +2 -0
- package/dist/@loader-tools/nodeJsResolver.js +117 -0
- package/dist/@loader-tools/nodeJsResolver.js.map +1 -0
- package/dist/@loader-tools/rules.d.ts +3 -0
- package/dist/@loader-tools/rules.js +33 -0
- package/dist/@loader-tools/rules.js.map +1 -0
- package/dist/@loader-tools/sourceChangesWatcher.d.ts +39 -0
- package/dist/@loader-tools/sourceChangesWatcher.js +182 -0
- package/dist/@loader-tools/sourceChangesWatcher.js.map +1 -0
- package/dist/@loader-tools/tools.d.ts +21 -0
- package/dist/@loader-tools/tools.js +113 -0
- package/dist/@loader-tools/tools.js.map +1 -0
- package/dist/@loader-tools/transform.d.ts +5 -0
- package/dist/@loader-tools/transform.js +114 -0
- package/dist/@loader-tools/transform.js.map +1 -0
- package/dist/@loader-tools/virtualUrl.d.ts +9 -0
- package/dist/@loader-tools/virtualUrl.js +40 -0
- package/dist/@loader-tools/virtualUrl.js.map +1 -0
- package/dist/@tool-jopinb/index.d.ts +1 -0
- package/dist/@tool-jopinb/index.js +9 -0
- package/dist/@tool-jopinb/index.js.map +1 -0
- package/dist/@ui/components.d.ts +27 -0
- package/dist/@ui/components.js +42 -0
- package/dist/@ui/components.js.map +1 -0
- package/dist/@ui/cssModules.d.ts +11 -0
- package/dist/@ui/cssModules.js +17 -0
- package/dist/@ui/cssModules.js.map +1 -0
- package/dist/@ui/hooks.d.ts +31 -0
- package/dist/@ui/hooks.js +71 -0
- package/dist/@ui/hooks.js.map +1 -0
- package/dist/@ui/index.d.ts +9 -0
- package/dist/@ui/index.js +11 -0
- package/dist/@ui/index.js.map +1 -0
- package/dist/@ui/internal.d.ts +4 -0
- package/dist/@ui/internal.js +10 -0
- package/dist/@ui/internal.js.map +1 -0
- package/dist/@ui/modules.d.ts +41 -0
- package/dist/@ui/modules.js +74 -0
- package/dist/@ui/modules.js.map +1 -0
- package/dist/@ui/objectRegistry.d.ts +12 -0
- package/dist/@ui/objectRegistry.js +35 -0
- package/dist/@ui/objectRegistry.js.map +1 -0
- package/dist/@ui/pageController.d.ts +61 -0
- package/dist/@ui/pageController.js +166 -0
- package/dist/@ui/pageController.js.map +1 -0
- package/dist/@ui/tools.d.ts +24 -0
- package/dist/@ui/tools.js +78 -0
- package/dist/@ui/tools.js.map +1 -0
- package/dist/@uikit/core/UiKitModule.d.ts +6 -0
- package/dist/@uikit/core/UiKitModule.js +18 -0
- package/dist/@uikit/core/UiKitModule.js.map +1 -0
- package/dist/@uikit/core/index.d.ts +1 -0
- package/dist/@uikit/core/index.js +4 -0
- package/dist/@uikit/core/index.js.map +1 -0
- package/dist/@uikit/core/jBundler_ifBrowser.d.ts +1 -0
- package/dist/@uikit/core/jBundler_ifBrowser.js +5 -0
- package/dist/@uikit/core/jBundler_ifBrowser.js.map +1 -0
- package/dist/@uikit/core/jBundler_ifServer.d.ts +6 -0
- package/dist/@uikit/core/jBundler_ifServer.js +17 -0
- package/dist/@uikit/core/jBundler_ifServer.js.map +1 -0
- package/dist/@uikit/forms/components.d.ts +18 -0
- package/dist/@uikit/forms/components.js +69 -0
- package/dist/@uikit/forms/components.js.map +1 -0
- package/dist/@uikit/forms/hooks.d.ts +4 -0
- package/dist/@uikit/forms/hooks.js +31 -0
- package/dist/@uikit/forms/hooks.js.map +1 -0
- package/dist/@uikit/forms/index.d.ts +3 -0
- package/dist/@uikit/forms/index.js +4 -0
- package/dist/@uikit/forms/index.js.map +1 -0
- package/dist/@uikit/forms/interfaces.d.ts +101 -0
- package/dist/@uikit/forms/interfaces.js +4 -0
- package/dist/@uikit/forms/interfaces.js.map +1 -0
- package/dist/@uikit/forms/private.d.ts +40 -0
- package/dist/@uikit/forms/private.js +307 -0
- package/dist/@uikit/forms/private.js.map +1 -0
- package/dist/@uikit/helpers/hooks.d.ts +33 -0
- package/dist/@uikit/helpers/hooks.js +107 -0
- package/dist/@uikit/helpers/hooks.js.map +1 -0
- package/dist/@uikit/helpers/index.d.ts +2 -0
- package/dist/@uikit/helpers/index.js +3 -0
- package/dist/@uikit/helpers/index.js.map +1 -0
- package/dist/@uikit/helpers/tools.d.ts +8 -0
- package/dist/@uikit/helpers/tools.js +35 -0
- package/dist/@uikit/helpers/tools.js.map +1 -0
- package/dist/@uikit/index.d.ts +10 -0
- package/dist/@uikit/index.js +13 -0
- package/dist/@uikit/index.js.map +1 -0
- package/dist/@uikit/menu/core.d.ts +21 -0
- package/dist/@uikit/menu/core.js +191 -0
- package/dist/@uikit/menu/core.js.map +1 -0
- package/dist/@uikit/menu/hooks.d.ts +5 -0
- package/dist/@uikit/menu/hooks.js +24 -0
- package/dist/@uikit/menu/hooks.js.map +1 -0
- package/dist/@uikit/menu/index.d.ts +3 -0
- package/dist/@uikit/menu/index.js +4 -0
- package/dist/@uikit/menu/index.js.map +1 -0
- package/dist/@uikit/menu/interfaces.d.ts +20 -0
- package/dist/@uikit/menu/interfaces.js +8 -0
- package/dist/@uikit/menu/interfaces.js.map +1 -0
- package/dist/@uikit/menu/internal.d.ts +40 -0
- package/dist/@uikit/menu/internal.js +191 -0
- package/dist/@uikit/menu/internal.js.map +1 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.d.ts +18 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.js +40 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.js.map +1 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.d.ts +28 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.js +35 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.js.map +1 -0
- package/dist/@uikit/reactRouter/index.d.ts +1 -0
- package/dist/@uikit/reactRouter/index.js +2 -0
- package/dist/@uikit/reactRouter/index.js.map +1 -0
- package/dist/@uikit/users/hooks.d.ts +10 -0
- package/dist/@uikit/users/hooks.js +39 -0
- package/dist/@uikit/users/hooks.js.map +1 -0
- package/dist/@uikit/users/index.d.ts +1 -0
- package/dist/@uikit/users/index.js +2 -0
- package/dist/@uikit/users/index.js.map +1 -0
- package/dist/@uikit/variants/index.d.ts +7 -0
- package/dist/@uikit/variants/index.js +16 -0
- package/dist/@uikit/variants/index.js.map +1 -0
- package/package.json +115 -0
- package/src/@bundler/README.md +1 -0
- package/src/@bundler/_logs.ts +4 -0
- package/src/@bundler/core.ts +41 -0
- package/src/@bundler/esbuild.ts +141 -0
- package/src/@bundler/index.ts +3 -0
- package/src/@bundler/plugins.ts +163 -0
- package/src/@bundler/tailwind.ts +139 -0
- package/src/@core/PageComponent.tsx +25 -0
- package/src/@core/README.md +1 -0
- package/src/@core/_logs.ts +11 -0
- package/src/@core/automaticStartStop.ts +132 -0
- package/src/@core/browserCacheControl.ts +40 -0
- package/src/@core/bundler/bundler.ts +128 -0
- package/src/@core/bundler/common.ts +18 -0
- package/src/@core/bundler/config.ts +37 -0
- package/src/@core/bundler/extraContent.ts +30 -0
- package/src/@core/bundler/pagesGenerator.ts +194 -0
- package/src/@core/bundler/server.ts +41 -0
- package/src/@core/caches/InMemoryCache.ts +483 -0
- package/src/@core/caches/SimpleFileCache.ts +205 -0
- package/src/@core/caches/cache.ts +77 -0
- package/src/@core/caches/webSiteMirrorCache.ts +90 -0
- package/src/@core/cheerio.d.ts +332 -0
- package/src/@core/gzip.ts +33 -0
- package/src/@core/index.ts +23 -0
- package/src/@core/internalTools.ts +95 -0
- package/src/@core/jQuery.ts +22 -0
- package/src/@core/jopiEasy.ts +1285 -0
- package/src/@core/jopiRequest.tsx +1279 -0
- package/src/@core/jopiServer.ts +188 -0
- package/src/@core/jopiWebSite.tsx +1027 -0
- package/src/@core/letsEncrypt.ts +243 -0
- package/src/@core/linker.ts +42 -0
- package/src/@core/loadBalancing.ts +152 -0
- package/src/@core/middlewares/CorsMiddleware.ts +23 -0
- package/src/@core/middlewares/DdosProtection.ts +120 -0
- package/src/@core/middlewares/index.ts +16 -0
- package/src/@core/publicTools.ts +14 -0
- package/src/@core/routeConfig.ts +104 -0
- package/src/@core/searchParamFilter.ts +315 -0
- package/src/@core/serverFetch.ts +454 -0
- package/src/@core/serverImpl/server_bunjs.tsx +230 -0
- package/src/@core/serverImpl/server_nodejs.ts +312 -0
- package/src/@core/serverInstanceBuilder.ts +36 -0
- package/src/@core/userStores.ts +34 -0
- package/src/@crawler/README.md +1 -0
- package/src/@crawler/common.ts +275 -0
- package/src/@crawler/core.ts +678 -0
- package/src/@crawler/directFileCache.ts +69 -0
- package/src/@crawler/index.ts +4 -0
- package/src/@crawler/urlMapping.ts +67 -0
- package/src/@crawler/utils.ts +13 -0
- package/src/@generated/index.ts +134 -0
- package/src/@linker/arobaseTypes.ts +325 -0
- package/src/@linker/changeProof.ts +53 -0
- package/src/@linker/config.ts +46 -0
- package/src/@linker/engine.ts +865 -0
- package/src/@linker/index.ts +3 -0
- package/src/@linker/install.ts +39 -0
- package/src/@linker/modInstaller.ts +50 -0
- package/src/@linker/typeEvents.ts +58 -0
- package/src/@linker/typeRoutes.ts +255 -0
- package/src/@linker/typeUiComposite.ts +19 -0
- package/src/@loader/README.md +4 -0
- package/src/@loader/bunHtmlCompiler.mjs +27 -0
- package/src/@loader/index.ts +19 -0
- package/src/@loader/loader.mjs +7 -0
- package/src/@loader/nodeJsLoader.ts +21 -0
- package/src/@loader-client/README.md +2 -0
- package/src/@loader-client/index.ts +108 -0
- package/src/@loader-tools/README.md +6 -0
- package/src/@loader-tools/bunJsLoader.ts +33 -0
- package/src/@loader-tools/config.ts +142 -0
- package/src/@loader-tools/cssModuleCompiler.ts +76 -0
- package/src/@loader-tools/esBuildPlugin.ts +142 -0
- package/src/@loader-tools/index.ts +11 -0
- package/src/@loader-tools/jopin.ts +403 -0
- package/src/@loader-tools/nodeJsLoader.ts +119 -0
- package/src/@loader-tools/nodeJsResolver.ts +140 -0
- package/src/@loader-tools/rules.ts +45 -0
- package/src/@loader-tools/sourceChangesWatcher.ts +225 -0
- package/src/@loader-tools/tools.ts +139 -0
- package/src/@loader-tools/transform.ts +138 -0
- package/src/@loader-tools/virtualUrl.ts +57 -0
- package/src/@loader-types/README.md +15 -0
- package/src/@loader-types/extensions.d.ts +65 -0
- package/src/@tool-jopinb/README.md +1 -0
- package/src/@tool-jopinb/index.ts +11 -0
- package/src/@ui/README.md +3 -0
- package/src/@ui/components.tsx +49 -0
- package/src/@ui/cssModules.tsx +27 -0
- package/src/@ui/hooks.tsx +95 -0
- package/src/@ui/index.ts +13 -0
- package/src/@ui/internal.ts +12 -0
- package/src/@ui/modules.ts +100 -0
- package/src/@ui/objectRegistry.ts +50 -0
- package/src/@ui/pageController.ts +203 -0
- package/src/@ui/tools.ts +116 -0
- package/src/@uikit/README.md +1 -0
- package/src/@uikit/core/UiKitModule.ts +20 -0
- package/src/@uikit/core/index.ts +4 -0
- package/src/@uikit/core/jBundler_ifBrowser.ts +4 -0
- package/src/@uikit/core/jBundler_ifServer.ts +18 -0
- package/src/@uikit/forms/components.tsx +97 -0
- package/src/@uikit/forms/hooks.ts +38 -0
- package/src/@uikit/forms/index.ts +3 -0
- package/src/@uikit/forms/interfaces.ts +159 -0
- package/src/@uikit/forms/private.ts +365 -0
- package/src/@uikit/helpers/hooks.ts +133 -0
- package/src/@uikit/helpers/index.ts +2 -0
- package/src/@uikit/helpers/tools.ts +39 -0
- package/src/@uikit/index.ts +15 -0
- package/src/@uikit/menu/core.ts +227 -0
- package/src/@uikit/menu/hooks.ts +28 -0
- package/src/@uikit/menu/index.ts +3 -0
- package/src/@uikit/menu/interfaces.ts +26 -0
- package/src/@uikit/menu/internal.ts +218 -0
- package/src/@uikit/package.json +15 -0
- package/src/@uikit/reactRouter/hooks/jBundler_ifBrowser.tsx +59 -0
- package/src/@uikit/reactRouter/hooks/jBundler_ifServer.tsx +51 -0
- package/src/@uikit/reactRouter/index.ts +1 -0
- package/src/@uikit/users/hooks.ts +50 -0
- package/src/@uikit/users/index.ts +1 -0
- package/src/@uikit/variants/index.tsx +20 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import type {CrawlerCache} from "./common.ts";
|
|
4
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
5
|
+
|
|
6
|
+
export class DirectFileCache implements CrawlerCache {
|
|
7
|
+
public readonly rootDir: string;
|
|
8
|
+
|
|
9
|
+
constructor(rootDir: string) {
|
|
10
|
+
if (!rootDir) rootDir = ".";
|
|
11
|
+
if (!path.isAbsolute(rootDir)) rootDir = path.resolve(process.cwd(), rootDir);
|
|
12
|
+
this.rootDir = rootDir;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private calKey(url: string): string {
|
|
16
|
+
const url2 = new URL(url);
|
|
17
|
+
url2.hostname = "localhost";
|
|
18
|
+
url2.port = "";
|
|
19
|
+
url2.protocol = "file:";
|
|
20
|
+
|
|
21
|
+
const sURL = url2.toString();
|
|
22
|
+
return jk_fs.fileURLToPath(sURL);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private calcFilePath(url: string): string {
|
|
26
|
+
let fp = path.join(this.rootDir, this.calKey(url));
|
|
27
|
+
|
|
28
|
+
if (fp.endsWith("/")) {
|
|
29
|
+
fp += "index.html";
|
|
30
|
+
} else {
|
|
31
|
+
const ext = path.extname(fp);
|
|
32
|
+
if (!ext) fp += "/index.html";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return fp;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getKey(url: string): string {
|
|
39
|
+
return this.calcFilePath(url);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async addToCache(url: string, response: Response, _requestedByUrl: string): Promise<void> {
|
|
43
|
+
// We don't store 404 and others.
|
|
44
|
+
if (response.status !== 200) return;
|
|
45
|
+
|
|
46
|
+
const filePath = this.calcFilePath(url);
|
|
47
|
+
await fs.mkdir(path.dirname(filePath), {recursive: true});
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await jk_fs.writeResponseToFile(response, filePath);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
console.error(e);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async hasInCache(url: string): Promise<boolean> {
|
|
58
|
+
const filePath = this.calcFilePath(url);
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const stat = await jk_fs.getFileStat(filePath);
|
|
62
|
+
return (stat!==undefined) && stat.isFile();
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {addRoute, createRouter, findRoute} from "rou3";
|
|
2
|
+
|
|
3
|
+
export interface UrlResolver {
|
|
4
|
+
resolveURL(url: string): UrlMappingResult|undefined;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface UrlMappingResult {
|
|
8
|
+
url: string;
|
|
9
|
+
wakeUpServer?: ()=>Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Allows knowing how to map the url.
|
|
14
|
+
* This allows mixing more than one website.
|
|
15
|
+
*/
|
|
16
|
+
export class UrlMapping implements UrlResolver {
|
|
17
|
+
private readonly router = createRouter<UrlMappingResult>();
|
|
18
|
+
private readonly defaultTarget: string;
|
|
19
|
+
private readonly allOrigins: string[] = [];
|
|
20
|
+
|
|
21
|
+
constructor(defaultTarget: string) {
|
|
22
|
+
this.defaultTarget = this.cleanUpRoute(defaultTarget);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private cleanUpRoute(route: string): string {
|
|
26
|
+
if (route.endsWith("/*")) return route.slice(0, -2);
|
|
27
|
+
if (route.endsWith("/**")) return route.slice(0, -3);
|
|
28
|
+
if (route.endsWith("/")) return route.slice(0, -1);
|
|
29
|
+
return route;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public getKnownOrigins(): string[] {
|
|
33
|
+
return this.allOrigins;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public mapURL(route: string, mapTo: string, wakeUpServer?: ()=>Promise<void>): UrlMapping {
|
|
37
|
+
// Avoid errors.
|
|
38
|
+
mapTo = this.cleanUpRoute(mapTo);
|
|
39
|
+
route = this.cleanUpRoute(route) + "/**";
|
|
40
|
+
|
|
41
|
+
let mapToOrigin = new URL(mapTo).origin;
|
|
42
|
+
if (!this.allOrigins.includes(mapToOrigin)) this.allOrigins.push(mapToOrigin);
|
|
43
|
+
|
|
44
|
+
addRoute(this.router, "GET", route, {
|
|
45
|
+
url: mapTo,
|
|
46
|
+
wakeUpServer: wakeUpServer
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public resolveURL(url: string): UrlMappingResult|undefined {
|
|
53
|
+
const matched = findRoute(this.router, "GET", url);
|
|
54
|
+
let target: string;
|
|
55
|
+
|
|
56
|
+
let wakeUpServer: (()=>Promise<void>)|undefined;
|
|
57
|
+
|
|
58
|
+
if (!matched) {
|
|
59
|
+
target = this.defaultTarget;
|
|
60
|
+
} else {
|
|
61
|
+
target = matched.data.url;
|
|
62
|
+
wakeUpServer = matched.data.wakeUpServer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {url: target + url, wakeUpServer};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function applyDefaults<T>(source: T|undefined, defaults: T): T {
|
|
2
|
+
if (!source) source = {} as T;
|
|
3
|
+
return {...defaults, ...source};
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function tick(timeInMs: number): Promise<void> {
|
|
7
|
+
return new Promise(resolve => setTimeout(resolve, timeInMs));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ONE_SECOND = 1000;
|
|
11
|
+
export const ONE_MINUTE = ONE_SECOND * 60;
|
|
12
|
+
export const ONE_HOUR = ONE_MINUTE * 60;
|
|
13
|
+
export const ONE_DAY = ONE_HOUR * 24;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {type HttpMethod, JopiRequest, WebSiteImpl, type WebSiteRouteInfos} from "jopijs";
|
|
3
|
+
import * as jk_crypto from "jopi-toolkit/jk_crypto";
|
|
4
|
+
import * as jk_events from "jopi-toolkit/jk_events";
|
|
5
|
+
import {PriorityLevel} from "jopi-toolkit/jk_tools";
|
|
6
|
+
|
|
7
|
+
export interface RouteAttributs {
|
|
8
|
+
needRoles?: Record<string, string[]>;
|
|
9
|
+
disableCache?: boolean;
|
|
10
|
+
priority?: PriorityLevel;
|
|
11
|
+
configFile?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* When doing a catch-all, a slug can be set.
|
|
15
|
+
* Here we store this slug name.
|
|
16
|
+
*
|
|
17
|
+
* Catch-all: /my/route/[...]
|
|
18
|
+
* Catch-all with slug: /my/route/[...slugName]
|
|
19
|
+
*/
|
|
20
|
+
catchAllSlug?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type RouteHandler = (req: JopiRequest) => Promise<Response>;
|
|
24
|
+
|
|
25
|
+
function applyAttributes(infos: WebSiteRouteInfos, attributes: RouteAttributs, verb: string) {
|
|
26
|
+
if (attributes.needRoles) {
|
|
27
|
+
infos.requiredRoles = attributes.needRoles[verb];
|
|
28
|
+
|
|
29
|
+
let allRoles = attributes.needRoles["all"];
|
|
30
|
+
if (allRoles) infos.requiredRoles = infos.requiredRoles?.concat(allRoles);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface RouteBindPageParams {
|
|
35
|
+
route: string;
|
|
36
|
+
attributs: RouteAttributs;
|
|
37
|
+
filePath: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function routeBindPage(webSite: WebSiteImpl, reactComponent: React.FC<any>, params: RouteBindPageParams) {
|
|
41
|
+
const pageKey = "page_" + jk_crypto.fastHash(params.route);
|
|
42
|
+
let infos: WebSiteRouteInfos;
|
|
43
|
+
|
|
44
|
+
if (params.route.endsWith("*")) {
|
|
45
|
+
infos = webSite.onPage(params.route, pageKey, reactComponent);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
let specialPageHandler: (() => void) | undefined;
|
|
49
|
+
|
|
50
|
+
if (params.route.startsWith("/error")) {
|
|
51
|
+
switch (params.route) {
|
|
52
|
+
case "/error404":
|
|
53
|
+
specialPageHandler = () => {
|
|
54
|
+
webSite.on404_NotFound(async (req) => {
|
|
55
|
+
return req.react_fromPage(pageKey, reactComponent);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
break;
|
|
60
|
+
|
|
61
|
+
case "/error500":
|
|
62
|
+
specialPageHandler = () => {
|
|
63
|
+
webSite.on500_Error(async (req) => {
|
|
64
|
+
return req.react_fromPage(pageKey, reactComponent);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
break;
|
|
69
|
+
|
|
70
|
+
case "/error401":
|
|
71
|
+
specialPageHandler = () => {
|
|
72
|
+
webSite.on401_Unauthorized(async (req) => {
|
|
73
|
+
return req.react_fromPage(pageKey, reactComponent);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The page must not be visible if it's a special page.
|
|
82
|
+
//
|
|
83
|
+
if (!specialPageHandler) {
|
|
84
|
+
//const REDIRECT_CODE = 301; // definitive
|
|
85
|
+
const REDIRECT_CODE = 302; // temporary
|
|
86
|
+
|
|
87
|
+
if (params.route === "/") {
|
|
88
|
+
infos = webSite.onPage(params.route, pageKey, reactComponent);
|
|
89
|
+
} else {
|
|
90
|
+
if (webSite.mustRemoveTrailingSlashs) {
|
|
91
|
+
infos = webSite.onPage(params.route, pageKey, reactComponent);
|
|
92
|
+
|
|
93
|
+
// Note: with node.js, the router doesn't distinguish with and without /
|
|
94
|
+
// It's why the redirection is done internally.
|
|
95
|
+
//
|
|
96
|
+
webSite.onGET(params.route + "/", async (req) => {
|
|
97
|
+
req.urlInfos.pathname = req.urlInfos.pathname.slice(0, -1);
|
|
98
|
+
return Response.redirect(req.urlInfos.href, REDIRECT_CODE);
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
infos = webSite.onPage(params.route + "/", pageKey, reactComponent);
|
|
102
|
+
|
|
103
|
+
// Note: with node.js, the router doesn't distinguish with and without /
|
|
104
|
+
// It's why the redirection is done internally.
|
|
105
|
+
//
|
|
106
|
+
webSite.onGET(params.route, async (req) => {
|
|
107
|
+
req.urlInfos.pathname += "/";
|
|
108
|
+
return Response.redirect(req.urlInfos.href, REDIRECT_CODE);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
applyAttributes(infos, params.attributs, "PAGE");
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
specialPageHandler();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
await jk_events.sendAsyncEvent("@jopi.route.newPage", params);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface RouteBindVerbParams extends RouteBindPageParams {
|
|
123
|
+
verb: HttpMethod;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export async function routeBindVerb(webSite: WebSiteImpl, handler: RouteHandler, params: RouteBindVerbParams) {
|
|
127
|
+
let infos = webSite.onVerb(params.verb, params.route, handler);
|
|
128
|
+
applyAttributes(infos, params.attributs, params.verb);
|
|
129
|
+
|
|
130
|
+
if (params.route!=="/") {
|
|
131
|
+
infos = webSite.onVerb(params.verb, params.route + "/", handler);
|
|
132
|
+
applyAttributes(infos, params.attributs, params.verb);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
2
|
+
import * as jk_tools from "jopi-toolkit/jk_tools";
|
|
3
|
+
import * as jk_events from "jopi-toolkit/jk_events";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type ProcessDirItemParams,
|
|
7
|
+
getSortedDirItem,
|
|
8
|
+
type TransformItemParams,
|
|
9
|
+
PriorityLevel,
|
|
10
|
+
type RegistryItem,
|
|
11
|
+
ArobaseType,
|
|
12
|
+
CodeGenWriter
|
|
13
|
+
} from "./engine.ts";
|
|
14
|
+
|
|
15
|
+
// region ArobaseList
|
|
16
|
+
|
|
17
|
+
export interface ArobaseList extends RegistryItem {
|
|
18
|
+
listName: string;
|
|
19
|
+
allDirPath: string[];
|
|
20
|
+
items: ArobaseListItem[];
|
|
21
|
+
itemsType: string;
|
|
22
|
+
conditions?: Set<string>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ArobaseListItem {
|
|
26
|
+
ref?: string;
|
|
27
|
+
entryPoint?: string;
|
|
28
|
+
priority: PriorityLevel;
|
|
29
|
+
sortKey: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class Type_ArobaseList extends ArobaseType {
|
|
33
|
+
protected async onListItem(item: ArobaseListItem, list: ArobaseListItem[], _dirPath: string): Promise<void> {
|
|
34
|
+
list.push(item);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
protected mergeIntoList(list: ArobaseList, items: ArobaseListItem[]) {
|
|
38
|
+
let currentItems = list.items;
|
|
39
|
+
currentItems.push(...items);
|
|
40
|
+
currentItems.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
processDir(p: { moduleDir: string; arobaseDir: string; genDir: string; }) {
|
|
44
|
+
return this.processList(p.arobaseDir);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
protected async processList(listDirPath: string): Promise<void> {
|
|
48
|
+
await this.dir_recurseOnDir({
|
|
49
|
+
dirToScan: listDirPath,
|
|
50
|
+
expectFsType: "dir",
|
|
51
|
+
|
|
52
|
+
rules: {
|
|
53
|
+
nameConstraint: "canBeUid",
|
|
54
|
+
requireRefFile: false,
|
|
55
|
+
requirePriority: false,
|
|
56
|
+
allowConditions: false,
|
|
57
|
+
rootDirName: jk_fs.basename(listDirPath),
|
|
58
|
+
transform: (p) => this.processGroup(p)
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected async processGroup(p: TransformItemParams) {
|
|
64
|
+
let listId = this.typeName + "!" + p.itemName!;
|
|
65
|
+
const listName = p.itemName;
|
|
66
|
+
|
|
67
|
+
// > Extract the list items.
|
|
68
|
+
|
|
69
|
+
const dirItems = await getSortedDirItem(p.itemPath);
|
|
70
|
+
let listItems: ArobaseListItem[] = [];
|
|
71
|
+
|
|
72
|
+
const params: ProcessDirItemParams = {
|
|
73
|
+
rootDirName: p.parentDirName,
|
|
74
|
+
nameConstraint: "canBeUid",
|
|
75
|
+
requirePriority: false,
|
|
76
|
+
requireRefFile: false,
|
|
77
|
+
allowConditions: false,
|
|
78
|
+
|
|
79
|
+
filesToResolve: {
|
|
80
|
+
"entryPoint": ["index.tsx", "index.ts"]
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
transform: async (item) => {
|
|
84
|
+
const listItem: ArobaseListItem = {
|
|
85
|
+
priority: item.priority,
|
|
86
|
+
sortKey: item.itemName,
|
|
87
|
+
ref: item.refTarget,
|
|
88
|
+
entryPoint: item.resolved.entryPoint
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const eventData = {itemPath: item.itemPath, item: listItem, list: listItems, mustSkip: false};
|
|
92
|
+
await jk_events.sendAsyncEvent("@jopi.linker.onNewListItem." + this.typeName, eventData);
|
|
93
|
+
if (!eventData.mustSkip) await this.onListItem(listItem, listItems, item.itemPath);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
for (let dirItem of dirItems) {
|
|
98
|
+
if (!dirItem.isDirectory) continue;
|
|
99
|
+
|
|
100
|
+
if (dirItem.name === "_") {
|
|
101
|
+
let uid = jk_tools.generateUUIDv4();
|
|
102
|
+
let newPath = jk_fs.join(jk_fs.dirname(dirItem.fullPath), uid);
|
|
103
|
+
await jk_fs.rename(dirItem.fullPath, newPath);
|
|
104
|
+
|
|
105
|
+
dirItem.name = uid;
|
|
106
|
+
dirItem.fullPath = newPath;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if ((dirItem.name[0] === "_") || (dirItem.name[0] === ".")) continue;
|
|
110
|
+
|
|
111
|
+
await this.dir_processItem(dirItem, params);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// > Add the list.
|
|
115
|
+
|
|
116
|
+
let current = this.registry_getItem<ArobaseList>(listId, this);
|
|
117
|
+
|
|
118
|
+
if (!current) {
|
|
119
|
+
const newItem: ArobaseList = {
|
|
120
|
+
listName, conditions: p.conditions,
|
|
121
|
+
arobaseType: this, itemPath: p.itemPath,
|
|
122
|
+
items: listItems, itemsType: p.parentDirName, allDirPath: [p.itemPath]
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
this.registry_addItem(listId, newItem);
|
|
126
|
+
} else {
|
|
127
|
+
if (current.itemsType !== p.parentDirName) {
|
|
128
|
+
throw this.declareError(`The list ${listId} is already defined and has a different type: ${current.itemsType}`, p.itemPath);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Merge the items into the current one.
|
|
132
|
+
this.mergeIntoList(current, listItems);
|
|
133
|
+
|
|
134
|
+
// The list of event declaration locations.
|
|
135
|
+
current.allDirPath.push(p.itemPath);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
protected getGenOutputDir(_list: ArobaseList) {
|
|
140
|
+
return this.typeName;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
protected resolveEntryPointFor(list: ArobaseList, item: ArobaseListItem): string {
|
|
144
|
+
let entryPoint = item.entryPoint!;
|
|
145
|
+
|
|
146
|
+
if (!entryPoint) {
|
|
147
|
+
let d = this.registry_requireItem<ArobaseChunk>(item.ref!);
|
|
148
|
+
if (d.itemType!==list.itemsType) {
|
|
149
|
+
throw this.declareError(`Type mismatch. Expect ${list.itemsType}`, d.itemPath)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!d.entryPoint) {
|
|
153
|
+
throw this.declareError(`Item if missing index.ts/index.tsx file`, d.itemPath)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
entryPoint = d.entryPoint;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return entryPoint;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async generateCodeForItem(writer: CodeGenWriter, key: string, rItem: RegistryItem) {
|
|
163
|
+
function sortByPriority(items: ArobaseListItem[]): ArobaseListItem[] {
|
|
164
|
+
function addPriority(priority: PriorityLevel) {
|
|
165
|
+
let e = byPriority[priority];
|
|
166
|
+
if (e) items.push(...e);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const byPriority: any = {};
|
|
170
|
+
|
|
171
|
+
for (let item of items) {
|
|
172
|
+
if (!byPriority[item.priority]) byPriority[item.priority] = [];
|
|
173
|
+
byPriority[item.priority].push(item);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
items = [];
|
|
177
|
+
|
|
178
|
+
addPriority(PriorityLevel.veryHigh);
|
|
179
|
+
addPriority(PriorityLevel.high);
|
|
180
|
+
addPriority(PriorityLevel.default);
|
|
181
|
+
addPriority(PriorityLevel.low);
|
|
182
|
+
addPriority(PriorityLevel.veryLow);
|
|
183
|
+
|
|
184
|
+
return items;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const list = rItem as ArobaseList;
|
|
188
|
+
list.items = sortByPriority(list.items);
|
|
189
|
+
|
|
190
|
+
await this.generateCodeForList(writer, key, list);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
protected async generateCodeForList(writer: CodeGenWriter, key: string, list: ArobaseList): Promise<void> {
|
|
194
|
+
let count = 1;
|
|
195
|
+
let outDir_innerPath = this.getGenOutputDir(list);
|
|
196
|
+
let outDir_fullPath = jk_fs.join(writer.dir.output_src, outDir_innerPath);
|
|
197
|
+
|
|
198
|
+
let srcCode = writer.AI_INSTRUCTIONS + this.codeGen_generateImports();
|
|
199
|
+
let distCode = srcCode;
|
|
200
|
+
|
|
201
|
+
for (let item of list.items) {
|
|
202
|
+
let entryPoint = this.resolveEntryPointFor(list, item);
|
|
203
|
+
let relPath = jk_fs.getRelativePath(outDir_fullPath, entryPoint);
|
|
204
|
+
|
|
205
|
+
srcCode += `import I${count} from "${relPath}";\n`;
|
|
206
|
+
distCode += `import I${count} from "${writer.toJavascriptFileName(relPath)}";\n`;
|
|
207
|
+
|
|
208
|
+
count++;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let array = "";
|
|
212
|
+
let max = list.items.length;
|
|
213
|
+
for (let i = 1; i <= max; i++) array += `I${i},`;
|
|
214
|
+
|
|
215
|
+
let toAdd = "\n" + this.codeGen_generateExports("[" + array + "]", list.listName);
|
|
216
|
+
srcCode += toAdd;
|
|
217
|
+
distCode += toAdd;
|
|
218
|
+
|
|
219
|
+
let fileName = key.substring(key.indexOf("!") + 1);
|
|
220
|
+
|
|
221
|
+
await writer.writeCodeFile({
|
|
222
|
+
fileInnerPath: jk_fs.join(outDir_innerPath, fileName),
|
|
223
|
+
declarationFile: this.codeGen_createDeclarationTypes(),
|
|
224
|
+
srcFileContent: srcCode,
|
|
225
|
+
distFileContent: distCode,
|
|
226
|
+
useTypescriptForSource: true
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
protected codeGen_generateImports() {
|
|
231
|
+
return "";
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
protected codeGen_generateExports(listAsArray: string, listName: string) {
|
|
235
|
+
return "export default " + listAsArray + ";";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Allow creating content for the .d.ts file.
|
|
240
|
+
* @protected
|
|
241
|
+
*/
|
|
242
|
+
protected codeGen_createDeclarationTypes() {
|
|
243
|
+
return `const list: any[]; export default list;`
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
//endregion
|
|
248
|
+
|
|
249
|
+
//region ArobaseChunk
|
|
250
|
+
|
|
251
|
+
export interface ArobaseChunk extends RegistryItem {
|
|
252
|
+
entryPoint: string;
|
|
253
|
+
itemType: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export class Type_ArobaseChunk extends ArobaseType {
|
|
257
|
+
async onChunk(chunk: ArobaseChunk, key: string, _dirPath: string) {
|
|
258
|
+
this.registry_addItem(key, chunk);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async processDir(p: { moduleDir: string; arobaseDir: string; genDir: string; }) {
|
|
262
|
+
await this.dir_recurseOnDir({
|
|
263
|
+
dirToScan: p.arobaseDir,
|
|
264
|
+
expectFsType: "dir",
|
|
265
|
+
|
|
266
|
+
rules: {
|
|
267
|
+
rootDirName: jk_fs.basename(p.arobaseDir),
|
|
268
|
+
nameConstraint: "canBeUid",
|
|
269
|
+
requireRefFile: false,
|
|
270
|
+
requirePriority: true,
|
|
271
|
+
|
|
272
|
+
filesToResolve: {
|
|
273
|
+
"info": ["info.json"],
|
|
274
|
+
"entryPoint": ["index.tsx", "index.ts"]
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
transform: async (props) => {
|
|
278
|
+
if (!props.resolved?.entryPoint) {
|
|
279
|
+
throw this.declareError("No 'index.ts' or 'index.tsx' file found", props.itemPath);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const chunk: ArobaseChunk = {
|
|
283
|
+
arobaseType: this,
|
|
284
|
+
entryPoint: props.resolved.entryPoint,
|
|
285
|
+
itemType: props.parentDirName,
|
|
286
|
+
itemPath: props.itemPath,
|
|
287
|
+
priority: props.priority
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const key = this.typeName + "!" + props.itemName;
|
|
291
|
+
const eventData = {mustSkip: false, key, chunk, itemPath: props.itemPath};
|
|
292
|
+
await jk_events.sendAsyncEvent("@jopi.linker.onNewChunk." + this.typeName, eventData);
|
|
293
|
+
|
|
294
|
+
if (!eventData.mustSkip) {
|
|
295
|
+
await this.onChunk(chunk, key, props.itemPath);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async generateCodeForItem(writer: CodeGenWriter, key: string, rItem: RegistryItem) {
|
|
303
|
+
const item = rItem as ArobaseChunk;
|
|
304
|
+
|
|
305
|
+
let targetName = key.substring(key.indexOf("!") + 1);
|
|
306
|
+
let outDir = jk_fs.join(writer.dir.output_src, this.getGenOutputDir(item));
|
|
307
|
+
let entryPoint = jk_fs.getRelativePath(outDir, item.entryPoint);
|
|
308
|
+
|
|
309
|
+
let srcCode = writer.AI_INSTRUCTIONS + `import C from "${entryPoint}";\nexport default C;`;
|
|
310
|
+
let distCode = writer.AI_INSTRUCTIONS + `import C from "${writer.toJavascriptFileName(entryPoint)}";\nexport default C;`;
|
|
311
|
+
|
|
312
|
+
await writer.writeCodeFile({
|
|
313
|
+
fileInnerPath: jk_fs.join(this.getGenOutputDir(item), targetName),
|
|
314
|
+
srcFileContent: srcCode,
|
|
315
|
+
distFileContent: distCode,
|
|
316
|
+
useTypescriptForSource: true
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
protected getGenOutputDir(_chunk: ArobaseChunk) {
|
|
321
|
+
return this.typeName;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
//endregion
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as fss from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import * as jk_crypto from "jopi-toolkit/jk_crypto";
|
|
5
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Recursive internal function to collect file/folder information strings.
|
|
9
|
+
* All paths in the resulting strings are relative to 'basePath'.
|
|
10
|
+
*/
|
|
11
|
+
export async function calculateDirectoryProof(rootDir: string): Promise<string> {
|
|
12
|
+
async function collectProofString(currentPath: string): Promise<string> {
|
|
13
|
+
let dirItems: fss.Dirent[];
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
dirItems = await fs.readdir(currentPath, {withFileTypes: true});
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT' || (error as NodeJS.ErrnoException).code === 'EACCES') return "";
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dirItems.sort((a, b) => a.name.localeCompare(b.name));
|
|
23
|
+
|
|
24
|
+
let chunksString = "";
|
|
25
|
+
|
|
26
|
+
for (const dirItem of dirItems) {
|
|
27
|
+
const fullPath = path.join(currentPath, dirItem.name);
|
|
28
|
+
const relativePath = path.relative(rootDir, fullPath).replace(/\\/g, '/');
|
|
29
|
+
const stats = await fs.lstat(fullPath);
|
|
30
|
+
|
|
31
|
+
if (stats.isSymbolicLink()) {
|
|
32
|
+
let target = await fs.readlink(fullPath);
|
|
33
|
+
target = path.relative(rootDir, fullPath).replace(/\\/g, '/');
|
|
34
|
+
chunksString += `SYM_LINK:${relativePath}:${target}`;
|
|
35
|
+
} else if (dirItem.isDirectory()) {
|
|
36
|
+
chunksString += await collectProofString(fullPath);
|
|
37
|
+
} else if (dirItem.isFile()) {
|
|
38
|
+
try {
|
|
39
|
+
let md5 = jk_crypto.md5(await jk_fs.readTextFromFile(fullPath));
|
|
40
|
+
chunksString += `FILE:${relativePath}:${md5}`;
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
chunksString += `FILE:${relativePath}:???`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return chunksString;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const chunksString = await collectProofString(rootDir);
|
|
52
|
+
return jk_crypto.md5(chunksString);
|
|
53
|
+
}
|