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,139 @@
|
|
|
1
|
+
import type {BundlerConfig, CreateBundleParams} from "jopijs";
|
|
2
|
+
import * as jk_app from "jopi-toolkit/jk_app";
|
|
3
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import fs from "node:fs/promises";
|
|
6
|
+
import postcss from "postcss";
|
|
7
|
+
import tailwindPostcss from "@tailwindcss/postcss";
|
|
8
|
+
|
|
9
|
+
export async function applyTailwindProcessor(params: CreateBundleParams): Promise<void> {
|
|
10
|
+
function append(text: string) {
|
|
11
|
+
return fs.appendFile(outFilePath, "\n" + text + "\n", "utf-8");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let sourceFiles = params.entryPoints;
|
|
15
|
+
let genDir = params.genDir;
|
|
16
|
+
|
|
17
|
+
// >>> Tailwind transform
|
|
18
|
+
|
|
19
|
+
if (params.singlePageMode) {
|
|
20
|
+
genDir = jk_fs.join(genDir, params.pageKey!);
|
|
21
|
+
sourceFiles = [genDir + ".jsx"];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const outFilePath = path.resolve(genDir, "tailwind.css");
|
|
25
|
+
|
|
26
|
+
if (await jk_fs.isFile(outFilePath)) {
|
|
27
|
+
await jk_fs.unlink(outFilePath);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Assure the file exists.
|
|
31
|
+
await jk_fs.writeTextToFile(outFilePath, "");
|
|
32
|
+
|
|
33
|
+
let postCss = await applyPostCss(params, sourceFiles);
|
|
34
|
+
if (postCss) await append(postCss);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Generate Tailwind CSS file a list of source files and returns the CSS or undefined.
|
|
39
|
+
*/
|
|
40
|
+
async function applyPostCss(params: CreateBundleParams, sourceFiles: string[]): Promise<string|undefined> {
|
|
41
|
+
if (!sourceFiles.length) return "";
|
|
42
|
+
|
|
43
|
+
const bundlerConfig = params.config;
|
|
44
|
+
|
|
45
|
+
let plugins: postcss.AcceptedPlugin[] = [];
|
|
46
|
+
|
|
47
|
+
let config = bundlerConfig.tailwind.config || {};
|
|
48
|
+
if (!config.content) config.content = sourceFiles;
|
|
49
|
+
else config.content = [...sourceFiles, ...(config.content as string[])];
|
|
50
|
+
|
|
51
|
+
if (bundlerConfig.tailwind.extraSourceFiles) {
|
|
52
|
+
if (!config.content) config.content = [];
|
|
53
|
+
config.content = [...config.content, ...bundlerConfig.tailwind.extraSourceFiles];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let tailwindPlugin = bundlerConfig.tailwind.disable ? undefined : tailwindPostcss({config} as any);
|
|
57
|
+
|
|
58
|
+
if (bundlerConfig.postCss.initializer) {
|
|
59
|
+
plugins = bundlerConfig.postCss.initializer(sourceFiles, tailwindPlugin);
|
|
60
|
+
} else if (tailwindPlugin) {
|
|
61
|
+
plugins = [tailwindPlugin];
|
|
62
|
+
} else {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!plugins.length) return undefined;
|
|
67
|
+
|
|
68
|
+
let globalCssContent = await getGlobalCssFileContent(bundlerConfig);
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
const processor = postcss(plugins);
|
|
72
|
+
|
|
73
|
+
const result = await processor.process(globalCssContent, {
|
|
74
|
+
// Setting 'from' allows resolving correctly the node_modules resolving.
|
|
75
|
+
from: params.outputDir
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return result.css;
|
|
79
|
+
}
|
|
80
|
+
catch (e: any) {
|
|
81
|
+
console.error("Error while compiling for Tailwind:", e);
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function getGlobalCssFileContent(config: BundlerConfig): Promise<string> {
|
|
87
|
+
if (config.tailwind.globalCssContent) {
|
|
88
|
+
return config.tailwind.globalCssContent;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (config.tailwind.globalCssFilePath) {
|
|
92
|
+
if (!await jk_fs.isFile(config.tailwind.globalCssFilePath)) {
|
|
93
|
+
throw new Error(`Tailwind - File not found where resolving 'global.css': ${config.tailwind.globalCssFilePath}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return jk_fs.readTextFromFile(config.tailwind.globalCssFilePath);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let found = await getTailwindTemplateFromShadCnConfig();
|
|
100
|
+
if (found) return found;
|
|
101
|
+
|
|
102
|
+
let rootDir = jk_fs.dirname(jk_app.findPackageJson());
|
|
103
|
+
|
|
104
|
+
if (await jk_fs.isFile(jk_fs.join(rootDir, "global.css"))) {
|
|
105
|
+
return jk_fs.readTextFromFile(jk_fs.join(rootDir, "global.css"));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return `@import "tailwindcss";`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get Tailwind template CSS file from Shadcn config file (components.json).
|
|
113
|
+
* See: https://ui.shadcn.com/docs/components-json
|
|
114
|
+
*/
|
|
115
|
+
async function getTailwindTemplateFromShadCnConfig() {
|
|
116
|
+
const pkgJsonPath = jk_app.findPackageJson();
|
|
117
|
+
if (!pkgJsonPath) return undefined;
|
|
118
|
+
|
|
119
|
+
let filePath = path.join(path.dirname(pkgJsonPath), "components.json");
|
|
120
|
+
if (!await jk_fs.isFile(filePath)) return undefined;
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
let asText = jk_fs.readTextFromFileSync(filePath);
|
|
124
|
+
let asJSON = JSON.parse(asText);
|
|
125
|
+
|
|
126
|
+
let tailwindConfig = asJSON.tailwind;
|
|
127
|
+
if (!tailwindConfig) return undefined;
|
|
128
|
+
|
|
129
|
+
let tailwindCssTemplate = tailwindConfig.css;
|
|
130
|
+
if (!tailwindCssTemplate) return undefined;
|
|
131
|
+
|
|
132
|
+
let fullPath = path.resolve(path.dirname(pkgJsonPath), tailwindCssTemplate);
|
|
133
|
+
return jk_fs.readTextFromFileSync(fullPath);
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
console.error("Error reading Shadcn config file:", e);
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {PageContext, PageController_ExposePrivate} from "jopijs/ui";
|
|
3
|
+
import * as ReactServer from "react-dom/server";
|
|
4
|
+
|
|
5
|
+
export default function({children, controller}: { children: React.ReactNode|React.ReactNode[], controller: PageController_ExposePrivate<unknown> }) {
|
|
6
|
+
const body = ReactServer.renderToStaticMarkup(
|
|
7
|
+
<PageContext.Provider value={controller}>
|
|
8
|
+
{children}
|
|
9
|
+
</PageContext.Provider>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const state = controller.getOptions();
|
|
13
|
+
|
|
14
|
+
return <html {...state.htmlProps}>
|
|
15
|
+
<head {...state.headProps}>
|
|
16
|
+
{state.head}
|
|
17
|
+
<title>{state.pageTitle}</title>
|
|
18
|
+
</head>
|
|
19
|
+
<body {...state.bodyProps}>
|
|
20
|
+
{state.bodyBegin}
|
|
21
|
+
<div dangerouslySetInnerHTML={{ __html: body }} />
|
|
22
|
+
{state.bodyEnd}
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The core of jopijs. Here it's mainly the server-side parts.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {getLogger} from "jopi-toolkit/jk_logs";
|
|
2
|
+
|
|
3
|
+
export const logServer = getLogger("jopi.server");
|
|
4
|
+
export const logServer_startApp = getLogger("startApp", logServer);
|
|
5
|
+
export const logServer_request = getLogger("request", logServer);
|
|
6
|
+
export const logServer_linker = getLogger("linker", logServer);
|
|
7
|
+
|
|
8
|
+
export const logBundler = getLogger("jopi.bundler");
|
|
9
|
+
|
|
10
|
+
export const logCache = getLogger("jopi.cache");
|
|
11
|
+
export const logCache_notInCache = getLogger("notInCache", logCache);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as jk_app from "jopi-toolkit/jk_app";
|
|
2
|
+
import * as jk_timer from "jopi-toolkit/jk_timer";
|
|
3
|
+
|
|
4
|
+
const ONE_MINUTE = jk_timer.ONE_MINUTE;
|
|
5
|
+
const newInterval = jk_timer.newInterval;
|
|
6
|
+
|
|
7
|
+
export enum AutomaticStartStopState { Stopped, Starting, Started, Stopping }
|
|
8
|
+
|
|
9
|
+
export interface AutomaticStartStopManagerParams {
|
|
10
|
+
onStart: (data: any)=>Promise<number>;
|
|
11
|
+
onStop?: (data: any)=>Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class AutomaticStartStop {
|
|
15
|
+
private _state = AutomaticStartStopState.Stopped;
|
|
16
|
+
private lastStartDate: number = 0;
|
|
17
|
+
|
|
18
|
+
private readonly startChangeListeners: (() => void)[] = [];
|
|
19
|
+
|
|
20
|
+
private readonly onStart: (data: any)=>Promise<number>;
|
|
21
|
+
private readonly onStop?: (data: any)=>Promise<void>;
|
|
22
|
+
|
|
23
|
+
public readonly data: any = {};
|
|
24
|
+
|
|
25
|
+
constructor(params: AutomaticStartStopManagerParams) {
|
|
26
|
+
this.onStop = params.onStop;
|
|
27
|
+
this.onStart = params.onStart;
|
|
28
|
+
|
|
29
|
+
jk_app.onAppExiting(this.stop.bind(this));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get state() {
|
|
33
|
+
return this._state;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private waitStateChange(): Promise<void> {
|
|
37
|
+
return new Promise<void>(resolve => {
|
|
38
|
+
this.startChangeListeners.push(resolve);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private setState(state: AutomaticStartStopState) {
|
|
43
|
+
if (this._state === state) return;
|
|
44
|
+
this._state = state;
|
|
45
|
+
|
|
46
|
+
if (this.startChangeListeners) {
|
|
47
|
+
this.startChangeListeners.forEach(l => l());
|
|
48
|
+
this.startChangeListeners.splice(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async start() {
|
|
53
|
+
if (this.state===AutomaticStartStopState.Started) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this.state===AutomaticStartStopState.Starting) {
|
|
58
|
+
await this.waitStateChange();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (this.state===AutomaticStartStopState.Stopping) {
|
|
63
|
+
await this.waitStateChange();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// If we are here, then it's in the state "stopped".
|
|
67
|
+
// But since it's async, state can have changed since.
|
|
68
|
+
//
|
|
69
|
+
if (this.state===AutomaticStartStopState.Stopped) {
|
|
70
|
+
this.setState(AutomaticStartStopState.Starting);
|
|
71
|
+
let toWait = await this.onStart(this.data);
|
|
72
|
+
|
|
73
|
+
this.lastStartDate = Date.now();
|
|
74
|
+
this.startTimer(toWait);
|
|
75
|
+
|
|
76
|
+
this.setState(AutomaticStartStopState.Started);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async stop() {
|
|
81
|
+
if (this.state===AutomaticStartStopState.Stopped) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.state===AutomaticStartStopState.Stopping) {
|
|
86
|
+
await this.waitStateChange();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (this.state===AutomaticStartStopState.Starting) {
|
|
91
|
+
await this.waitStateChange();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// If we are here, then it's in the state "started".
|
|
95
|
+
// But since it's async, state can have changed since.
|
|
96
|
+
//
|
|
97
|
+
if (this.state===AutomaticStartStopState.Started) {
|
|
98
|
+
this.setState(AutomaticStartStopState.Stopping);
|
|
99
|
+
|
|
100
|
+
if (this.onStop) {
|
|
101
|
+
await this.onStop(this.data);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.setState(AutomaticStartStopState.Stopped);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private startTimer(toWait_ms: number) {
|
|
109
|
+
const onTimer = async () => {
|
|
110
|
+
switch (this.state) {
|
|
111
|
+
case AutomaticStartStopState.Starting:
|
|
112
|
+
return true;
|
|
113
|
+
case AutomaticStartStopState.Stopping:
|
|
114
|
+
case AutomaticStartStopState.Stopped:
|
|
115
|
+
// false: stop the timer.
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let timeDiff = Date.now() - this.lastStartDate;
|
|
120
|
+
|
|
121
|
+
if (timeDiff>toWait_ms) {
|
|
122
|
+
await this.stop();
|
|
123
|
+
// false: stop the timer.
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
newInterval(ONE_MINUTE, onTimer);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type {JopiRequest} from "./jopiRequest.ts";
|
|
2
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
3
|
+
import * as jk_crypto from "jopi-toolkit/jk_crypto";
|
|
4
|
+
|
|
5
|
+
export type BrowserCacheValidationInfos = {
|
|
6
|
+
etag: string;
|
|
7
|
+
fileState: jk_fs.FileState;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface BrowserCacheStrategy {
|
|
11
|
+
cacheDuration?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ReqReturnFileParams extends BrowserCacheStrategy {
|
|
15
|
+
contentEncoding?: string;
|
|
16
|
+
cacheDuration?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface TryReturnFileParams extends ReqReturnFileParams {
|
|
20
|
+
req: JopiRequest;
|
|
21
|
+
filePath: string;
|
|
22
|
+
contentEncoding: string|undefined;
|
|
23
|
+
validationInfos: BrowserCacheValidationInfos;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function addBrowserCacheControlHeaders(headers: any, params: TryReturnFileParams) {
|
|
27
|
+
let stats = params.validationInfos.fileState;
|
|
28
|
+
headers["etag"] = params.validationInfos.etag;
|
|
29
|
+
headers["last-modified"] = new Date(stats.mtimeMs).toUTCString();
|
|
30
|
+
|
|
31
|
+
if (params.cacheDuration) {
|
|
32
|
+
headers["cache-control"] = `Cache-Control: public, max-age=${params.cacheDuration}, immutable`;
|
|
33
|
+
} else {
|
|
34
|
+
headers["cache-control"] = "public, max-age=0, must-revalidate";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function calcETagForText(text: string): string {
|
|
39
|
+
return jk_crypto.fastHash(text);
|
|
40
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {WebSiteImpl} from "../jopiWebSite.tsx";
|
|
2
|
+
import {serverInitChronos} from "../internalTools.ts";
|
|
3
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
4
|
+
import * as jk_events from "jopi-toolkit/jk_events";
|
|
5
|
+
import {getBundleDirPath} from "./common.ts";
|
|
6
|
+
import {type BundlerConfig, getBundlerConfig} from "./config.ts";
|
|
7
|
+
import {getExtraCssToBundle} from "./extraContent.ts";
|
|
8
|
+
import {configureServer} from "./server.ts";
|
|
9
|
+
import {getVirtualUrlMap, type VirtualUrlEntry} from "jopijs/loader-tools";
|
|
10
|
+
import "./pagesGenerator.ts";
|
|
11
|
+
import {isSinglePageMode} from "jopijs/loader-client";
|
|
12
|
+
import {logBundler} from "../_logs.ts";
|
|
13
|
+
|
|
14
|
+
export interface CreateBundleParams {
|
|
15
|
+
// Is enabled when JOPI_DEV or JOPI_DEV_UI
|
|
16
|
+
// If bun.js: bundler is never called when JOPI_DEV_UI.
|
|
17
|
+
// since it uses React HMR mode.
|
|
18
|
+
//
|
|
19
|
+
singlePageMode: boolean;
|
|
20
|
+
|
|
21
|
+
innerUrl: string;
|
|
22
|
+
|
|
23
|
+
entryPoints: string[];
|
|
24
|
+
outputDir: string;
|
|
25
|
+
genDir: string;
|
|
26
|
+
publicUrl: string;
|
|
27
|
+
webSite: WebSiteImpl;
|
|
28
|
+
config: BundlerConfig,
|
|
29
|
+
requireTailwind: boolean;
|
|
30
|
+
virtualUrlMap: VirtualUrlEntry[];
|
|
31
|
+
|
|
32
|
+
pageRoute?: string;
|
|
33
|
+
pageKey?: string;
|
|
34
|
+
pageScript?: string;
|
|
35
|
+
|
|
36
|
+
promise?: Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function createBundle(webSite: WebSiteImpl): Promise<void> {
|
|
40
|
+
serverInitChronos.start("createBrowserBundle", "Time for building browser bundler")
|
|
41
|
+
|
|
42
|
+
const genDir = getBundleDirPath(webSite);
|
|
43
|
+
const outputDir = jk_fs.join(genDir, "out");
|
|
44
|
+
|
|
45
|
+
// Reset the dir.
|
|
46
|
+
await jk_fs.rmDir(genDir);
|
|
47
|
+
await jk_fs.mkDir(genDir);
|
|
48
|
+
|
|
49
|
+
const innerUrl = "/_bundle/";
|
|
50
|
+
const publicUrl = webSite.welcomeUrl + innerUrl;
|
|
51
|
+
|
|
52
|
+
// noinspection PointlessBooleanExpressionJS
|
|
53
|
+
const requireTailwind: boolean = (getBundlerConfig().tailwind.disable) !== true;
|
|
54
|
+
|
|
55
|
+
const cssToImport = [...getExtraCssToBundle()];
|
|
56
|
+
|
|
57
|
+
if (requireTailwind) cssToImport.push("./tailwind.css");
|
|
58
|
+
|
|
59
|
+
// Bun has his own bundler system of development.
|
|
60
|
+
const config = getBundlerConfig();
|
|
61
|
+
|
|
62
|
+
gCreateBundleData = {
|
|
63
|
+
singlePageMode: isSinglePageMode(),
|
|
64
|
+
outputDir, genDir, publicUrl, innerUrl, webSite, requireTailwind,
|
|
65
|
+
config: getBundlerConfig(), entryPoints: [...config.entryPoints],
|
|
66
|
+
virtualUrlMap: getVirtualUrlMap()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
await executeBundler(gCreateBundleData);
|
|
70
|
+
|
|
71
|
+
configureServer(outputDir);
|
|
72
|
+
serverInitChronos.end();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let gCreateBundleData: CreateBundleParams|undefined;
|
|
76
|
+
|
|
77
|
+
let gPageBundlerIsOk: Record<string, boolean> = {};
|
|
78
|
+
|
|
79
|
+
export async function createBundleForPage(pageKey: string, route: string) {
|
|
80
|
+
// Allow knowing of this page is already compiled.
|
|
81
|
+
if (gPageBundlerIsOk[pageKey]) return;
|
|
82
|
+
gPageBundlerIsOk[pageKey] = true;
|
|
83
|
+
|
|
84
|
+
const endLog = logBundler.beginInfo((w) => w("Bundling page for route " + route));
|
|
85
|
+
|
|
86
|
+
let fileName = pageKey + ".jsx";
|
|
87
|
+
|
|
88
|
+
if (!gCreateBundleData) return;
|
|
89
|
+
|
|
90
|
+
let params = {...gCreateBundleData};
|
|
91
|
+
params.pageRoute = route;
|
|
92
|
+
params.pageKey = pageKey;
|
|
93
|
+
params.pageScript = jk_fs.join(params.genDir, fileName);
|
|
94
|
+
|
|
95
|
+
await jk_events.sendAsyncEvent("@jopi.bundler.beforeCreateBundleForPage", params);
|
|
96
|
+
await jk_events.sendAsyncEvent("@jopi.bundler.createBundleForPage", params);
|
|
97
|
+
|
|
98
|
+
endLog();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function executeBundler(params: CreateBundleParams) {
|
|
102
|
+
if (!gIsBundlerLoader) {
|
|
103
|
+
gIsBundlerLoader = true;
|
|
104
|
+
await import(FALLBACK_PACKAGE);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// createBundle is called when the event is triggered.
|
|
108
|
+
//
|
|
109
|
+
// Here we will compile all the pages in one go.
|
|
110
|
+
// It's why it's not enabled with single-page mode.
|
|
111
|
+
//
|
|
112
|
+
// When using React HMR, we don't use the same bundler.
|
|
113
|
+
// (internally it's an optimized single-page mode).
|
|
114
|
+
// So, we don't need to compile the full bundle.
|
|
115
|
+
|
|
116
|
+
if (!isSinglePageMode()) {
|
|
117
|
+
const endLog = logBundler.beginInfo("Bundling all pages");
|
|
118
|
+
|
|
119
|
+
// Will create the HTML pages.
|
|
120
|
+
await jk_events.sendAsyncEvent("@jopi.bundler.beforeCreateBundle", params);
|
|
121
|
+
await jk_events.sendAsyncEvent("@jopi.bundler.createBundle", params);
|
|
122
|
+
|
|
123
|
+
endLog();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//
|
|
127
|
+
const FALLBACK_PACKAGE = "jopijs/bundler";
|
|
128
|
+
let gIsBundlerLoader = false;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {type WebSite, WebSiteImpl} from "../jopiWebSite.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import * as jk_app from "jopi-toolkit/jk_app";
|
|
4
|
+
|
|
5
|
+
export function getBundleDirPath(webSite: WebSite) {
|
|
6
|
+
// To known: the loader uses jopi.webSiteUrl from "package.json".
|
|
7
|
+
// This can create a situation where we have 2 output directories for
|
|
8
|
+
// the same website.
|
|
9
|
+
//
|
|
10
|
+
let webSiteHost = (webSite as WebSiteImpl).host.replaceAll(".", "_").replaceAll(":", "_");
|
|
11
|
+
return path.join(gTempDirPath, webSiteHost);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Don't use node_modules because of a bug when using workspaces.
|
|
15
|
+
// This bug is doing that WebStorm doesn't resolve the file to his real location
|
|
16
|
+
// but to the workspace node_modules (and not the project inside the workspace).
|
|
17
|
+
//
|
|
18
|
+
let gTempDirPath = path.resolve(jk_app.getTempDir(), ".reactHydrateCache");
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type {Config as TailwindConfig} from 'tailwindcss';
|
|
2
|
+
import postcss from 'postcss';
|
|
3
|
+
|
|
4
|
+
export type PostCssInitializer = (sources: string[], tailwindPlugin: postcss.AcceptedPlugin|undefined) => postcss.AcceptedPlugin[];
|
|
5
|
+
|
|
6
|
+
export interface BundlerConfig {
|
|
7
|
+
tailwind: {
|
|
8
|
+
config?: TailwindConfig;
|
|
9
|
+
|
|
10
|
+
globalCssContent?: string;
|
|
11
|
+
globalCssFilePath?: string;
|
|
12
|
+
|
|
13
|
+
disable?: boolean;
|
|
14
|
+
extraSourceFiles?: string[];
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
postCss: {
|
|
18
|
+
initializer?: PostCssInitializer;
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
embed: {
|
|
22
|
+
dontEmbedThis?: string[];
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
entryPoints: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const gBundlerConfig: BundlerConfig = {
|
|
29
|
+
tailwind: {},
|
|
30
|
+
postCss: {},
|
|
31
|
+
embed: {},
|
|
32
|
+
entryPoints: []
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getBundlerConfig(): BundlerConfig {
|
|
36
|
+
return gBundlerConfig;
|
|
37
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {addVirtualUrlEntry, type VirtualUrlEntry} from "jopijs/loader-tools";
|
|
2
|
+
import * as jk_events from "jopi-toolkit/jk_events";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Add a CSS file which must be bundled with the page.
|
|
6
|
+
*/
|
|
7
|
+
export function addExtraCssToBundle(cssFilePath: string) {
|
|
8
|
+
gHasManuallyIncludedCss = true;
|
|
9
|
+
if (gAllCssFiles.includes(cssFilePath)) return;
|
|
10
|
+
gAllCssFiles.push(cssFilePath);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function hasExternalCssToBundle() {
|
|
14
|
+
return gHasManuallyIncludedCss;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getExtraCssToBundle(): string[] {
|
|
18
|
+
return gAllCssFiles;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
jk_events.addListener<VirtualUrlEntry>("jopi.virtualUrl.added", (v) => {
|
|
22
|
+
if (!v.url) debugger;
|
|
23
|
+
|
|
24
|
+
if (v.url && v.url.endsWith(".css") || v.url.endsWith(".scss")) {
|
|
25
|
+
addExtraCssToBundle(v.sourceFile);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
let gHasManuallyIncludedCss = false;
|
|
30
|
+
const gAllCssFiles: string[] = [];
|