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