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,225 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {spawn, ChildProcess} from "node:child_process";
|
|
3
|
+
import chokidar from "chokidar";
|
|
4
|
+
import * as jk_timer from "jopi-toolkit/jk_timer";
|
|
5
|
+
|
|
6
|
+
export interface SourceChangesWatcherParams {
|
|
7
|
+
watchDirs: string[];
|
|
8
|
+
excludeDir: string[];
|
|
9
|
+
env?: Record<string, string>;
|
|
10
|
+
cmd?: string;
|
|
11
|
+
args?: string[];
|
|
12
|
+
isDev: boolean;
|
|
13
|
+
mustLog: boolean;
|
|
14
|
+
jsEngine: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Watches source directories for changes and restarts a server process automatically.
|
|
19
|
+
* - Add directories to watch (recursively).
|
|
20
|
+
* - Configurable delay (debounce) before restarting.
|
|
21
|
+
* - Includes a helper to auto-detect the source directory when using TypeScript.
|
|
22
|
+
*/
|
|
23
|
+
export class SourceChangesWatcher {
|
|
24
|
+
private readonly _fileWatchingDelay: number;
|
|
25
|
+
private readonly _restartDelay: number;
|
|
26
|
+
|
|
27
|
+
private _areSignalCatch = false;
|
|
28
|
+
|
|
29
|
+
private restarting = false;
|
|
30
|
+
private _isStarted = false;
|
|
31
|
+
|
|
32
|
+
private _enableLogs: boolean = false;
|
|
33
|
+
|
|
34
|
+
private readonly watchDirs: string[];
|
|
35
|
+
private readonly excludeDir: string[];
|
|
36
|
+
private readonly env: Record<string, string>;
|
|
37
|
+
|
|
38
|
+
private readonly _cmd: string;
|
|
39
|
+
private readonly _args: string[];
|
|
40
|
+
|
|
41
|
+
private _timerId: number = 0;
|
|
42
|
+
private readonly _isDev: boolean;
|
|
43
|
+
private readonly _mustLog: boolean;
|
|
44
|
+
|
|
45
|
+
constructor(params: SourceChangesWatcherParams) {
|
|
46
|
+
const isNodeJS = params.jsEngine === "node";
|
|
47
|
+
|
|
48
|
+
this._fileWatchingDelay = isNodeJS ? 1000 : 500;
|
|
49
|
+
this._restartDelay = isNodeJS ? 500 : 10;
|
|
50
|
+
|
|
51
|
+
this.watchDirs = params.watchDirs;
|
|
52
|
+
this.excludeDir = params.excludeDir;
|
|
53
|
+
|
|
54
|
+
if (params.env) this.env = params.env;
|
|
55
|
+
else this.env = process.env as Record<string, string>;
|
|
56
|
+
|
|
57
|
+
this._cmd = params.cmd || process.argv0;
|
|
58
|
+
this._args = params.args || [];
|
|
59
|
+
|
|
60
|
+
this._isDev = params.isDev;
|
|
61
|
+
this._mustLog = params.mustLog;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async start() {
|
|
65
|
+
if (this._isStarted) return;
|
|
66
|
+
this._isStarted = true;
|
|
67
|
+
|
|
68
|
+
for (const dir of this.watchDirs) {
|
|
69
|
+
await this.watchDirectoryRecursive(dir);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Create the first child.
|
|
73
|
+
await this.spawnChild(true);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private async askToRestart(filePath: string) {
|
|
77
|
+
if (this.excludeDir) {
|
|
78
|
+
let isExcluded = this.excludeDir.find(p => filePath.startsWith(p))
|
|
79
|
+
if (isExcluded) return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Avoid it if inside a hidden directory (start by .).
|
|
83
|
+
let pathParts = filePath.split(path.sep);
|
|
84
|
+
let hiddenPart = pathParts.find(e => e[0] === '.')
|
|
85
|
+
if (hiddenPart) return;
|
|
86
|
+
|
|
87
|
+
// Avoid it if inside a node module. Reason: some tools used it as a temp.
|
|
88
|
+
let nodeModule = pathParts.find(e => e === 'node_modules');
|
|
89
|
+
if (nodeModule) return;
|
|
90
|
+
|
|
91
|
+
// Allow avoiding restart until stability is found.
|
|
92
|
+
if (this._timerId) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
this._timerId = setTimeout(async () => {
|
|
98
|
+
this._timerId = 0;
|
|
99
|
+
|
|
100
|
+
if (this.restarting) return;
|
|
101
|
+
this.restarting = true;
|
|
102
|
+
|
|
103
|
+
//console.clear();
|
|
104
|
+
|
|
105
|
+
if (this._enableLogs) {
|
|
106
|
+
console.log("File change watcher - RESTART for:", filePath);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
await this.spawnChild();
|
|
111
|
+
} finally {
|
|
112
|
+
this.restarting = false;
|
|
113
|
+
}
|
|
114
|
+
}, this._restartDelay);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private async watchDirectoryRecursive(dir: string) {
|
|
118
|
+
const watcher = chokidar.watch(dir, {
|
|
119
|
+
persistent: true,
|
|
120
|
+
ignoreInitial: true,
|
|
121
|
+
|
|
122
|
+
// Ignore common heavy/irrelevant directories
|
|
123
|
+
ignored: (watchedPath: string) => {
|
|
124
|
+
const b = path.basename(watchedPath);
|
|
125
|
+
return b === 'node_modules' || b === '.git' || b === '.idea' || b === '.vscode';
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
awaitWriteFinish: {
|
|
129
|
+
stabilityThreshold: this._fileWatchingDelay,
|
|
130
|
+
pollInterval: Math.min(100, this._fileWatchingDelay)
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
watcher.on('all', async (_event, paths) => {
|
|
135
|
+
await this.askToRestart(paths)
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
watcher.on('error', () => { /* swallow watcher errors to keep running */
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private killAll() {
|
|
143
|
+
if (this._isDev) {
|
|
144
|
+
// > Do a fast hard kill.
|
|
145
|
+
if (gChild && !gChild.killed) gChild.kill('SIGKILL');
|
|
146
|
+
process.exit(0);
|
|
147
|
+
} else {
|
|
148
|
+
// > Do a soft kill.
|
|
149
|
+
if (gChild) {
|
|
150
|
+
const child = gChild;
|
|
151
|
+
child.kill('SIGTERM');
|
|
152
|
+
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
if (!child.killed) {
|
|
155
|
+
child.kill('SIGKILL');
|
|
156
|
+
}
|
|
157
|
+
}, 3000);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public async spawnChild(ignoreSpawnEvent = false) {
|
|
163
|
+
if (gChild) {
|
|
164
|
+
if (!gChild.killed) {
|
|
165
|
+
// Do a hard kill.
|
|
166
|
+
// Not a problem since we are in dev mode.
|
|
167
|
+
gChild.kill("SIGKILL");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
gChild = undefined;
|
|
171
|
+
await jk_timer.tick(100);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
let useShell = this._cmd.endsWith('.cmd') || this._cmd.endsWith('.bat') || this._cmd.endsWith('.sh');
|
|
175
|
+
|
|
176
|
+
if (!this._areSignalCatch) {
|
|
177
|
+
this._areSignalCatch = true;
|
|
178
|
+
|
|
179
|
+
process.on('SIGTERM', () => this.killAll());
|
|
180
|
+
process.on('SIGINT', () => this.killAll());
|
|
181
|
+
process.on('SIGHUP', () => this.killAll());
|
|
182
|
+
process.on('exit', () => this.killAll());
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (this._mustLog) {
|
|
186
|
+
console.log("spawning", {cmd: this._cmd, args: this._args, cwd: process.cwd(), useShell})
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const child = spawn(this._cmd, this._args, {
|
|
190
|
+
stdio: "inherit", shell: useShell,
|
|
191
|
+
cwd: process.cwd(),
|
|
192
|
+
env: this.env
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
gChild = child;
|
|
196
|
+
|
|
197
|
+
child.on('exit', (code, signal) => {
|
|
198
|
+
// The current instance has stopped?
|
|
199
|
+
if (gChild===child) {
|
|
200
|
+
if (signal) process.kill(process.pid, signal);
|
|
201
|
+
else process.exit(code ?? 0);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
child.on('error', (err) => {
|
|
206
|
+
// The current instance is in error?
|
|
207
|
+
if (gChild===child) {
|
|
208
|
+
console.error(err.message || String(err));
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
if (!ignoreSpawnEvent) {
|
|
214
|
+
child.on("spawn", () => {
|
|
215
|
+
this.onSpawned();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
onSpawned() {
|
|
221
|
+
// To override.
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
let gChild: ChildProcess|undefined;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import * as jk_app from "jopi-toolkit/jk_app";
|
|
3
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
4
|
+
|
|
5
|
+
import fss from "node:fs";
|
|
6
|
+
import stripJsonComments from "strip-json-comments";
|
|
7
|
+
import {resolve as resolvePath} from "path";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Search the entry point of the current package (ex: ./dist/index.json)
|
|
11
|
+
* @param nodePackageDir - The path of the current module.
|
|
12
|
+
* @returns Returns the full path of the script.
|
|
13
|
+
*/
|
|
14
|
+
export function findNodePackageEntryPoint(nodePackageDir: string): string {
|
|
15
|
+
const packageJsonPath = path.join(nodePackageDir, 'package.json');
|
|
16
|
+
|
|
17
|
+
// >>> Try to take the "main" information inside the package.json.
|
|
18
|
+
|
|
19
|
+
if (fss.existsSync(packageJsonPath)) {
|
|
20
|
+
try {
|
|
21
|
+
const packageJson = JSON.parse(fss.readFileSync(packageJsonPath, 'utf8'));
|
|
22
|
+
|
|
23
|
+
if (packageJson.main) {
|
|
24
|
+
const mainPath = path.join(nodePackageDir, packageJson.main);
|
|
25
|
+
if (fss.existsSync(mainPath)) return mainPath;
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
// Ignore JSON parse errors
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// >>> "main" not set? Try all common path.
|
|
33
|
+
|
|
34
|
+
const commonPaths = [
|
|
35
|
+
path.join('dist', 'index.js'),
|
|
36
|
+
path.join('lib', 'index.js'),
|
|
37
|
+
path.join('src', 'index.js'),
|
|
38
|
+
'index.js'
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
for (const commonPath of commonPaths) {
|
|
42
|
+
const fullPath = path.join(nodePackageDir, commonPath);
|
|
43
|
+
if (fss.existsSync(fullPath)) return fullPath;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Default to dist/index.js
|
|
47
|
+
return path.join(nodePackageDir, 'dist', 'index.js');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Searches for the directory of a specified module.
|
|
52
|
+
*
|
|
53
|
+
* @param packageName - The name of the module to find.
|
|
54
|
+
* @return The path to the module directory if found, or null if not found.
|
|
55
|
+
*/
|
|
56
|
+
export function findNodePackageDir(packageName: string): string|null {
|
|
57
|
+
let currentDir = process.cwd();
|
|
58
|
+
|
|
59
|
+
while (true) {
|
|
60
|
+
const packagePath = path.join(currentDir, 'node_modules', packageName);
|
|
61
|
+
|
|
62
|
+
if (fss.existsSync(packagePath)) {
|
|
63
|
+
return packagePath;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const parentDir = path.dirname(currentDir);
|
|
67
|
+
|
|
68
|
+
// Reached root directory
|
|
69
|
+
if (parentDir === currentDir) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
currentDir = parentDir;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let gCache_getPathAliasInfo: PathAliasInfo|undefined;
|
|
80
|
+
|
|
81
|
+
export interface PathAliasInfo {
|
|
82
|
+
rootDir: string;
|
|
83
|
+
alias: Record<string, string>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Return a dictionary of path alias (ex: import "@/ui/myComponent")
|
|
88
|
+
*/
|
|
89
|
+
export async function getPathAliasInfo(): Promise<PathAliasInfo> {
|
|
90
|
+
if (gCache_getPathAliasInfo) return gCache_getPathAliasInfo;
|
|
91
|
+
|
|
92
|
+
let pkgJsonFile = jk_app.findPackageJson();
|
|
93
|
+
if (!pkgJsonFile) throw new Error("Package.json not found");
|
|
94
|
+
|
|
95
|
+
const rootDir = path.dirname(pkgJsonFile);
|
|
96
|
+
|
|
97
|
+
let tsconfigJsonPath = path.join(rootDir, "tsconfig.json");
|
|
98
|
+
|
|
99
|
+
if (!await jk_fs.isFile(tsconfigJsonPath)) {
|
|
100
|
+
throw new Error(`tsconfig.json not found at ${tsconfigJsonPath}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let asText = await jk_fs.readTextFromFile(tsconfigJsonPath);
|
|
104
|
+
let asJson = JSON.parse(stripJsonComments(asText));
|
|
105
|
+
|
|
106
|
+
let compilerOptions = asJson.compilerOptions;
|
|
107
|
+
let declaredAliases: Record<string, string> = {};
|
|
108
|
+
|
|
109
|
+
if (compilerOptions) {
|
|
110
|
+
let paths = compilerOptions.paths;
|
|
111
|
+
|
|
112
|
+
/** Exemple
|
|
113
|
+
* "paths": {
|
|
114
|
+
* "@/*": ["./src/shadcn/*"],
|
|
115
|
+
* "@/lib/*": ["./src/shadcn/lib/*"],
|
|
116
|
+
* "@/components/*": ["./src/shadcn/components/*"]
|
|
117
|
+
* }
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
for (let alias in paths) {
|
|
121
|
+
let pathAlias = paths[alias].pop() as string;
|
|
122
|
+
if (!pathAlias) continue;
|
|
123
|
+
|
|
124
|
+
if (alias.endsWith("*")) alias = alias.substring(0, alias.length - 1);
|
|
125
|
+
if (pathAlias.endsWith("*")) pathAlias = pathAlias.substring(0, pathAlias.length - 1);
|
|
126
|
+
|
|
127
|
+
if (!path.isAbsolute(pathAlias)) {
|
|
128
|
+
pathAlias = resolvePath(rootDir, pathAlias);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!alias.endsWith("/")) alias += "/";
|
|
132
|
+
if (!pathAlias.endsWith("/")) pathAlias += "/";
|
|
133
|
+
|
|
134
|
+
declaredAliases[alias] = pathAlias;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return gCache_getPathAliasInfo = {rootDir, alias: declaredAliases};
|
|
139
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import cssModuleCompiler from "./cssModuleCompiler.ts";
|
|
2
|
+
import {supportedExtensionToType} from "./rules.ts";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
|
|
6
|
+
import * as jk_fs from "jopi-toolkit/jk_fs";
|
|
7
|
+
import {getPackageJsonConfig, INLINE_MAX_SIZE_KO} from "./config.ts";
|
|
8
|
+
import {getVirtualUrlForFile} from "./virtualUrl.ts";
|
|
9
|
+
|
|
10
|
+
export interface TransformResult {
|
|
11
|
+
text: string;
|
|
12
|
+
type: "js"|"text"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function transformFile(filePath: string, options: string): Promise<TransformResult> {
|
|
16
|
+
let text: string;
|
|
17
|
+
|
|
18
|
+
if (filePath.endsWith(".json")) {
|
|
19
|
+
// .json must be ignored with bun.js since some libraries use require and not import.
|
|
20
|
+
// The matter is that the generated code can't be compatible with import and require
|
|
21
|
+
// at the same time.
|
|
22
|
+
//
|
|
23
|
+
// Moreover, bun.js natif implementation seems way faster.
|
|
24
|
+
//
|
|
25
|
+
text = await transform_json(filePath);
|
|
26
|
+
}
|
|
27
|
+
else if (options=="raw") {
|
|
28
|
+
text = await transform_raw(filePath);
|
|
29
|
+
}
|
|
30
|
+
else if (options==="inline") {
|
|
31
|
+
text = await transform_inline(filePath);
|
|
32
|
+
}
|
|
33
|
+
else if (filePath.endsWith(".module.css") || (filePath.endsWith(".module.scss"))) {
|
|
34
|
+
text = await transform_cssModule(filePath);
|
|
35
|
+
}
|
|
36
|
+
else if (filePath.endsWith(".css") || (filePath.endsWith(".scss"))) {
|
|
37
|
+
text = await transform_css(filePath);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
text = await transform_filePath(filePath);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {text, type: "js"};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function transform_cssModule(sourceFilePath: string) {
|
|
47
|
+
return await cssModuleCompiler(sourceFilePath);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Allow getting the file path of the CSS.
|
|
52
|
+
* Here we mimic Bun.js behaviors.
|
|
53
|
+
*
|
|
54
|
+
* To know: Bun.js doesn't allow catching .css file anymore.
|
|
55
|
+
* It's why here we are node.js only.
|
|
56
|
+
*/
|
|
57
|
+
async function transform_css(sourceFilePath: string) {
|
|
58
|
+
sourceFilePath = jk_fs.resolve(sourceFilePath);
|
|
59
|
+
return `export default ${JSON.stringify(sourceFilePath)};`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function transform_filePath(sourceFilePath: string) {
|
|
63
|
+
let virtualUrl = getVirtualUrlForFile(sourceFilePath);
|
|
64
|
+
|
|
65
|
+
if (!virtualUrl?.url) {
|
|
66
|
+
return `const __PATH__ = ${JSON.stringify(virtualUrl?.sourceFile)}; export default __PATH__;`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (process.env.JOPI_BUNLDER_ESBUILD) {
|
|
70
|
+
return `const __URL__ = ${JSON.stringify(virtualUrl.url)}; export default __URL__;`
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return `const __URL__ = ${JSON.stringify(virtualUrl.url)};
|
|
74
|
+
if (typeof(global)!=="undefined") {
|
|
75
|
+
if (global.jopiAddVirtualUrl) global.jopiAddVirtualUrl(${JSON.stringify(virtualUrl)}, false);
|
|
76
|
+
} else {
|
|
77
|
+
if (window.jopiAddVirtualUrl) window.jopiAddVirtualUrl(${JSON.stringify(virtualUrl)}, false);
|
|
78
|
+
}
|
|
79
|
+
export default __URL__;`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function transform_json(filePath: string) {
|
|
83
|
+
const resText = await jk_fs.readTextFromFile(filePath);
|
|
84
|
+
return `export default ${resText};`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function transform_raw(filePath: string) {
|
|
88
|
+
let ext = path.extname(filePath);
|
|
89
|
+
let type = supportedExtensionToType[ext];
|
|
90
|
+
if (!type) type = "text";
|
|
91
|
+
|
|
92
|
+
let resText: string;
|
|
93
|
+
|
|
94
|
+
if ((type==="text")||(type==="css")) {
|
|
95
|
+
resText = await jk_fs.readTextFromFile(filePath);
|
|
96
|
+
} else {
|
|
97
|
+
const buffer: Buffer = await fs.readFile(filePath);
|
|
98
|
+
|
|
99
|
+
// Here there is no the prefix "data:image/jpeg;base64".
|
|
100
|
+
// It's the difference with the "?inline" option.
|
|
101
|
+
//
|
|
102
|
+
resText = buffer.toString('base64');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return `export default ${JSON.stringify(resText)};`
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function transform_inline(filePath: string) {
|
|
109
|
+
let ext = path.extname(filePath);
|
|
110
|
+
let type = supportedExtensionToType[ext];
|
|
111
|
+
if (!type) type = "text";
|
|
112
|
+
|
|
113
|
+
let resText: string;
|
|
114
|
+
|
|
115
|
+
if ((type==="text")||(type==="css")) {
|
|
116
|
+
resText = await jk_fs.readTextFromFile(filePath);
|
|
117
|
+
} else {
|
|
118
|
+
const config = getPackageJsonConfig();
|
|
119
|
+
let maxSize = config ? config.inlineMaxSize_ko : INLINE_MAX_SIZE_KO;
|
|
120
|
+
|
|
121
|
+
let fileSize = Math.trunc(await jk_fs.getFileSize(filePath) / 1024);
|
|
122
|
+
|
|
123
|
+
if (fileSize > maxSize) {
|
|
124
|
+
return transform_filePath(filePath);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const buffer: Buffer = await fs.readFile(filePath);
|
|
128
|
+
const mimeType = jk_fs.getMimeTypeFromName(filePath);
|
|
129
|
+
|
|
130
|
+
// Here there is no the prefix "data:image/jpeg;base64".
|
|
131
|
+
// It's the difference with the "?inline" option.
|
|
132
|
+
//
|
|
133
|
+
resText = buffer.toString('base64');
|
|
134
|
+
resText = `data:${mimeType};base64,${resText}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return `export default ${JSON.stringify(resText)};`
|
|
138
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {getPackageJsonConfig} from "./config.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import * as jk_events from "jopi-toolkit/jk_events";
|
|
4
|
+
import * as jk_crypto from "jopi-toolkit/jk_crypto";
|
|
5
|
+
|
|
6
|
+
export interface VirtualUrlEntry {
|
|
7
|
+
url: string;
|
|
8
|
+
route: string;
|
|
9
|
+
sourceFile: string;
|
|
10
|
+
bundleFile?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const gVirtualUrlMap: VirtualUrlEntry[] = [];
|
|
14
|
+
|
|
15
|
+
export function getVirtualUrlMap() {
|
|
16
|
+
return gVirtualUrlMap;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function addVirtualUrlEntry(entry: VirtualUrlEntry) {
|
|
20
|
+
gVirtualUrlMap.push(entry);
|
|
21
|
+
jk_events.sendEvent("jopi.virtualUrl.added", entry);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getVirtualUrlForFile(filePath: string): VirtualUrlEntry|undefined {
|
|
25
|
+
// Avoid creating a second entry if already exist.
|
|
26
|
+
const existing = gVirtualUrlMap.find(e => e.sourceFile === filePath);
|
|
27
|
+
//
|
|
28
|
+
if (existing) {
|
|
29
|
+
return existing;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const config = getPackageJsonConfig();
|
|
33
|
+
|
|
34
|
+
let route = path.relative(process.cwd(), filePath);
|
|
35
|
+
route = config.webResourcesRoot_SSR + jk_crypto.md5(route) + path.extname(filePath);
|
|
36
|
+
|
|
37
|
+
const entry: VirtualUrlEntry = {
|
|
38
|
+
// Use an url relative to the url base path.
|
|
39
|
+
url: "/" + route,
|
|
40
|
+
|
|
41
|
+
route: "/" + route,
|
|
42
|
+
sourceFile: filePath
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
addVirtualUrlEntry(entry);
|
|
46
|
+
return entry;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
global.jopiAddVirtualUrl = (e: VirtualUrlEntry) => {
|
|
51
|
+
addVirtualUrlEntry(e);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
global.jopiAddVirtualUrlFor = (filePath: string) => {
|
|
56
|
+
getVirtualUrlForFile(filePath);
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
It contains type declaration for TypesScript `tsconfig.json` which allows support for custom imports.
|
|
2
|
+
|
|
3
|
+
If you do `import imgUrl from "./myImage.png"` then TypeScript send an error (with node.js) because he don't know
|
|
4
|
+
how to transform this import.
|
|
5
|
+
|
|
6
|
+
To resolve that, add a `types` section into your `tsconfig.json`.
|
|
7
|
+
|
|
8
|
+
**Sample**
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"compilerOptions": {
|
|
12
|
+
"types": ["jopijs/types"]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
declare module "*.module.scss" {
|
|
2
|
+
const styles: { readonly [className: string]: string; };
|
|
3
|
+
export default styles;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module "*.module.css" {
|
|
7
|
+
const styles: { readonly [className: string]: string; };
|
|
8
|
+
export default styles;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module "*.css" {const asString: string; export default asString;}
|
|
12
|
+
declare module "*.css?inline" {const asString: string; export default asString;}
|
|
13
|
+
declare module "*.css?raw" {const asString: string; export default asString;}
|
|
14
|
+
|
|
15
|
+
declare module "*.scss" {const asString: string; export default asString;}
|
|
16
|
+
declare module "*.scss?inline" {const asString: string; export default asString;}
|
|
17
|
+
declare module "*.scss?raw" {const asString: string; export default asString;}
|
|
18
|
+
|
|
19
|
+
declare module "*.png" {const asString: string; export default asString;}
|
|
20
|
+
declare module "*.png?inline" {const asString: string; export default asString;}
|
|
21
|
+
declare module "*.png?raw" {const asString: string; export default asString;}
|
|
22
|
+
|
|
23
|
+
declare module "*.gif" {const asString: string; export default asString;}
|
|
24
|
+
declare module "*.gif?inline" {const asString: string; export default asString;}
|
|
25
|
+
declare module "*.gif?raw" {const asString: string; export default asString;}
|
|
26
|
+
|
|
27
|
+
declare module "*.jpg" {const asString: string; export default asString;}
|
|
28
|
+
declare module "*.jpg?inline" {const asString: string; export default asString;}
|
|
29
|
+
declare module "*.jpg?raw" {const asString: string; export default asString;}
|
|
30
|
+
|
|
31
|
+
declare module "*.jpeg" {const asString: string; export default asString;}
|
|
32
|
+
declare module "*.jpeg?inline" {const asString: string; export default asString;}
|
|
33
|
+
declare module "*.jpeg?raw" {const asString: string; export default asString;}
|
|
34
|
+
|
|
35
|
+
declare module "*.webp" {const asString: string; export default asString;}
|
|
36
|
+
declare module "*.webp?inline" {const asString: string; export default asString;}
|
|
37
|
+
declare module "*.webp?raw" {const asString: string; export default asString;}
|
|
38
|
+
|
|
39
|
+
declare module "*.avif" {const asString: string; export default asString;}
|
|
40
|
+
declare module "*.avif?inline" {const asString: string; export default asString;}
|
|
41
|
+
declare module "*.avif?raw" {const asString: string; export default asString;}
|
|
42
|
+
|
|
43
|
+
declare module "*.ico" {const asString: string; export default asString;}
|
|
44
|
+
declare module "*.ico?inline" {const asString: string; export default asString;}
|
|
45
|
+
declare module "*.ico?raw" {const asString: string; export default asString;}
|
|
46
|
+
|
|
47
|
+
declare module "*.woff" {const asString: string; export default asString;}
|
|
48
|
+
declare module "*.woff?inline" {const asString: string; export default asString;}
|
|
49
|
+
declare module "*.woff?raw" {const asString: string; export default asString;}
|
|
50
|
+
|
|
51
|
+
declare module "*.woff2" {const asString: string; export default asString;}
|
|
52
|
+
declare module "*.woff2?inline" {const asString: string; export default asString;}
|
|
53
|
+
declare module "*.woff2?raw" {const asString: string; export default asString;}
|
|
54
|
+
|
|
55
|
+
declare module "*.ttf" {const asString: string; export default asString;}
|
|
56
|
+
declare module "*.ttf?inline" {const asString: string; export default asString;}
|
|
57
|
+
declare module "*.ttf?raw" {const asString: string; export default asString;}
|
|
58
|
+
|
|
59
|
+
declare module "*.txt" {const asString: string; export default asString;}
|
|
60
|
+
declare module "*.txt?inline" {const asString: string; export default asString;}
|
|
61
|
+
declare module "*.txt?raw" {const asString: string; export default asString;}
|
|
62
|
+
|
|
63
|
+
declare module "*.json" {const asObject: any; export default asObject;}
|
|
64
|
+
declare module "*.json?inline" {const asString: any; export default asString;}
|
|
65
|
+
declare module "*.json?raw" {const asString: any; export default asString;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
It's the implementation for tools `jopin` and `jopib`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {jopiLauncherTool} from "jopijs/loader-tools";
|
|
2
|
+
|
|
3
|
+
const VERSION = "2.0.0";
|
|
4
|
+
|
|
5
|
+
export function useEngine(engine: string) {
|
|
6
|
+
if (process.env.JOPI_LOG==="1") {
|
|
7
|
+
console.log("JopiN - Loader Version" + VERSION + " - engine=" + engine);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
jopiLauncherTool(engine).then();
|
|
11
|
+
}
|