create-jen-app 1.2.3 → 1.2.4
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/dist/colors.js +0 -17
- package/dist/create.js +5 -17
- package/dist/generator.js +14 -31
- package/dist/index.js +6 -1
- package/package.json +1 -1
- package/templates/ssr-isr/README.md +77 -0
- package/templates/ssr-isr/build.js +118 -0
- package/templates/ssr-isr/jen.config.ts +109 -0
- package/templates/ssr-isr/jenjs.d.ts +22 -0
- package/templates/ssr-isr/lib/api/(hello).js +9 -0
- package/templates/ssr-isr/lib/auth/cookie-utils.js +79 -0
- package/templates/ssr-isr/lib/auth/index.js +2 -0
- package/templates/ssr-isr/lib/auth/jwt.js +57 -0
- package/templates/ssr-isr/lib/auth/session.js +92 -0
- package/templates/ssr-isr/lib/build/asset-hashing.d.ts +10 -0
- package/templates/ssr-isr/lib/build/asset-hashing.js +25 -0
- package/templates/ssr-isr/lib/build/asset-manifest.d.ts +11 -0
- package/templates/ssr-isr/lib/build/asset-manifest.js +21 -0
- package/templates/{static → ssr-isr}/lib/build/build.d.ts +1 -1
- package/templates/ssr-isr/lib/build/build.js +141 -0
- package/templates/{static → ssr-isr}/lib/build/island-hydration.d.ts +8 -5
- package/templates/ssr-isr/lib/build/island-hydration.js +44 -0
- package/templates/ssr-isr/lib/build/minifier.d.ts +20 -0
- package/templates/ssr-isr/lib/build/minifier.js +46 -0
- package/templates/ssr-isr/lib/build/page-renderer.d.ts +17 -0
- package/templates/ssr-isr/lib/build/page-renderer.js +28 -0
- package/templates/ssr-isr/lib/build/production-build.d.ts +10 -0
- package/templates/ssr-isr/lib/build/production-build.js +13 -0
- package/templates/ssr-isr/lib/build/ssg-pipeline.d.ts +15 -0
- package/templates/ssr-isr/lib/build/ssg-pipeline.js +113 -0
- package/templates/ssr-isr/lib/build-tools/build-site.js +36 -0
- package/templates/ssr-isr/lib/cache/index.js +10 -0
- package/templates/ssr-isr/lib/cache/memory.js +40 -0
- package/templates/ssr-isr/lib/cache/redis.js +61 -0
- package/templates/ssr-isr/lib/cli/banner.js +28 -0
- package/templates/ssr-isr/lib/cli/templates/ssg/jen.config.js +32 -0
- package/templates/ssr-isr/lib/cli/templates/ssg/site/index.js +9 -0
- package/templates/ssr-isr/lib/cli/templates/ssr/jen.config.js +32 -0
- package/templates/ssr-isr/lib/cli/templates/ssr/site/index.js +9 -0
- package/templates/ssr-isr/lib/compilers/esbuild-plugins.js +111 -0
- package/templates/ssr-isr/lib/compilers/svelte.js +44 -0
- package/templates/ssr-isr/lib/compilers/vue.js +90 -0
- package/templates/ssr-isr/lib/core/http.js +71 -0
- package/templates/ssr-isr/lib/core/middleware-hooks.js +97 -0
- package/templates/ssr-isr/lib/core/paths.js +39 -0
- package/templates/ssr-isr/lib/core/routes/match.js +47 -0
- package/templates/ssr-isr/lib/core/routes/scan.js +190 -0
- package/templates/ssr-isr/lib/core/types.js +1 -0
- package/templates/ssr-isr/lib/css/compiler.js +74 -0
- package/templates/ssr-isr/lib/db/connector.js +42 -0
- package/templates/ssr-isr/lib/db/drivers/jdb.js +44 -0
- package/templates/ssr-isr/lib/db/drivers/sql.js +182 -0
- package/templates/ssr-isr/lib/db/index.js +48 -0
- package/templates/ssr-isr/lib/db/types.js +1 -0
- package/templates/ssr-isr/lib/graphql/index.js +52 -0
- package/templates/ssr-isr/lib/graphql/resolvers.js +25 -0
- package/templates/ssr-isr/lib/graphql/schema.js +35 -0
- package/templates/ssr-isr/lib/i18n/en.json +4 -0
- package/templates/ssr-isr/lib/i18n/es.json +4 -0
- package/templates/ssr-isr/lib/i18n/index.js +15 -0
- package/templates/ssr-isr/lib/import/jen-import.js +161 -0
- package/templates/ssr-isr/lib/index.js +116 -0
- package/templates/ssr-isr/lib/jdb/engine.js +275 -0
- package/templates/ssr-isr/lib/jdb/index.js +34 -0
- package/templates/ssr-isr/lib/jdb/types.js +1 -0
- package/templates/ssr-isr/lib/jdb/utils.js +176 -0
- package/templates/{static → ssr-isr}/lib/middleware/builtins/body-parser.js +0 -17
- package/templates/ssr-isr/lib/middleware/builtins/cors.js +54 -0
- package/templates/{static → ssr-isr}/lib/middleware/builtins/logger.js +0 -17
- package/templates/{static → ssr-isr}/lib/middleware/builtins/rate-limit.js +0 -17
- package/templates/{static → ssr-isr}/lib/middleware/builtins/request-id.js +0 -17
- package/templates/{static → ssr-isr}/lib/middleware/builtins/security-headers.js +0 -17
- package/templates/ssr-isr/lib/middleware/context.js +124 -0
- package/templates/{static → ssr-isr}/lib/middleware/decorators.js +0 -17
- package/templates/{static → ssr-isr}/lib/middleware/errors/handler.js +0 -17
- package/templates/ssr-isr/lib/middleware/errors/http-error.js +10 -0
- package/templates/ssr-isr/lib/middleware/kernel.js +85 -0
- package/templates/ssr-isr/lib/middleware/pipeline.js +148 -0
- package/templates/ssr-isr/lib/middleware/registry.js +85 -0
- package/templates/ssr-isr/lib/middleware/response.js +107 -0
- package/templates/ssr-isr/lib/middleware/types.d.ts +1 -0
- package/templates/ssr-isr/lib/middleware/types.js +1 -0
- package/templates/ssr-isr/lib/middleware/utils/matcher.js +13 -0
- package/templates/{static → ssr-isr}/lib/native/bundle.js +0 -17
- package/templates/{static → ssr-isr}/lib/native/dev-server.js +0 -17
- package/templates/{static → ssr-isr}/lib/native/index.js +0 -17
- package/templates/{static → ssr-isr}/lib/native/optimizer.js +0 -17
- package/templates/ssr-isr/lib/native/style-compiler.js +19 -0
- package/templates/ssr-isr/lib/plugin/loader.js +36 -0
- package/templates/ssr-isr/lib/runtime/client-runtime.js +25 -0
- package/templates/ssr-isr/lib/runtime/hmr.js +59 -0
- package/templates/ssr-isr/lib/runtime/hydrate.js +55 -0
- package/templates/ssr-isr/lib/runtime/island-hydration-client.js +146 -0
- package/templates/ssr-isr/lib/runtime/islands.js +110 -0
- package/templates/ssr-isr/lib/runtime/render.js +244 -0
- package/templates/ssr-isr/lib/server/api-routes.js +237 -0
- package/templates/ssr-isr/lib/server/api.js +108 -0
- package/templates/ssr-isr/lib/server/app.js +438 -0
- package/templates/ssr-isr/lib/server/runtimeServe.js +169 -0
- package/templates/ssr-isr/lib/server/ssr.js +202 -0
- package/templates/ssr-isr/lib/shared/log.js +64 -0
- package/templates/ssr-isr/package.json +23 -0
- package/templates/ssr-isr/server.js +128 -0
- package/templates/ssr-isr/site/pages/(index).tsx +11 -0
- package/templates/ssr-isr/site/styles/global.scss +37 -0
- package/templates/ssr-isr/tsconfig.json +39 -0
- package/templates/static/build.js +30 -18
- package/templates/static/jen.config.ts +0 -18
- package/templates/static/jenjs.d.ts +0 -18
- package/templates/static/lib/api/(hello).js +0 -17
- package/templates/static/lib/api/examples/files/[...slug].js +22 -0
- package/templates/static/lib/api/examples/hello.js +11 -0
- package/templates/static/lib/api/examples/posts/[id].js +37 -0
- package/templates/static/lib/api/examples/posts.js +37 -0
- package/templates/static/lib/api/examples/search.js +23 -0
- package/templates/static/lib/api/index.js +41 -0
- package/templates/static/lib/api/loader.js +234 -0
- package/templates/static/lib/api/router.js +259 -0
- package/templates/static/lib/assets/types.js +1 -0
- package/templates/static/lib/auth/cookie-utils.js +3 -16
- package/templates/static/lib/auth/index.js +0 -17
- package/templates/static/lib/auth/jwt.js +0 -17
- package/templates/static/lib/auth/session.js +0 -17
- package/templates/static/lib/build/asset-hashing.js +44 -36
- package/templates/static/lib/build/asset-manifest.js +16 -33
- package/templates/static/lib/build/build.js +270 -125
- package/templates/static/lib/build/bundle-analyzer-ui.js +417 -0
- package/templates/static/lib/build/bundle-analyzer.js +945 -0
- package/templates/static/lib/build/code-splitter.js +194 -0
- package/templates/static/lib/build/feature-analyzer.js +190 -0
- package/templates/static/lib/build/feature-gate.js +257 -0
- package/templates/static/lib/build/island-hydration.js +17 -35
- package/templates/static/lib/build/lazy-loader.js +322 -0
- package/templates/static/lib/build/minifier.js +40 -59
- package/templates/static/lib/build/page-renderer.js +23 -40
- package/templates/static/lib/build/production-build.js +9 -26
- package/templates/static/lib/build/rust-hashing.js +71 -0
- package/templates/static/lib/build/script-optimizer.js +285 -0
- package/templates/static/lib/build/ssg-pipeline.js +100 -106
- package/templates/static/lib/build/vercel-output.js +298 -0
- package/templates/static/lib/build-tools/build-site.js +0 -17
- package/templates/static/lib/cache/index.js +0 -17
- package/templates/static/lib/cache/memory.js +0 -17
- package/templates/static/lib/cache/redis.js +0 -17
- package/templates/static/lib/cli/banner.js +0 -17
- package/templates/static/lib/cli/templates/ssg/jen.config.js +0 -17
- package/templates/static/lib/cli/templates/ssr/jen.config.js +0 -17
- package/templates/static/lib/client/Image.js +42 -0
- package/templates/static/lib/client/Link.js +190 -0
- package/templates/static/lib/client/PWA.js +46 -0
- package/templates/static/lib/client/Seo.js +97 -0
- package/templates/static/lib/client/index.js +9 -0
- package/templates/static/lib/client/useNavigation.js +25 -0
- package/templates/static/lib/client/useRouter.js +64 -0
- package/templates/static/lib/client-routing/Link.js +17 -0
- package/templates/static/lib/client-routing/index.js +19 -0
- package/templates/static/lib/client-routing/router.js +151 -0
- package/templates/static/lib/client-routing/signal.js +147 -0
- package/templates/static/lib/compilers/esbuild-plugins.js +0 -17
- package/templates/static/lib/compilers/svelte.js +0 -17
- package/templates/static/lib/compilers/vue.js +0 -17
- package/templates/static/lib/core/config.js +0 -17
- package/templates/static/lib/core/feature-guard.js +136 -0
- package/templates/static/lib/core/features.js +99 -0
- package/templates/static/lib/core/http.js +0 -17
- package/templates/static/lib/core/layouts/index.js +10 -0
- package/templates/static/lib/core/layouts/render.js +158 -0
- package/templates/static/lib/core/layouts/scan.js +112 -0
- package/templates/static/lib/core/layouts/types.js +1 -0
- package/templates/static/lib/core/lifecycle.js +129 -0
- package/templates/static/lib/core/loader-schema.js +81 -0
- package/templates/static/lib/core/middleware-hooks.js +0 -17
- package/templates/static/lib/core/paths.js +0 -17
- package/templates/static/lib/core/routes/advanced.js +114 -0
- package/templates/static/lib/core/routes/handlers.js +181 -0
- package/templates/static/lib/core/routes/match.js +89 -17
- package/templates/static/lib/core/routes/orchestrator.js +171 -0
- package/templates/static/lib/core/routes/rendering-config.js +131 -0
- package/templates/static/lib/core/routes/scan.js +0 -17
- package/templates/static/lib/core/types.js +0 -17
- package/templates/static/lib/css/compiler.js +1 -18
- package/templates/static/lib/data-fetching/cache.js +223 -0
- package/templates/static/lib/data-fetching/client.js +202 -0
- package/templates/static/lib/data-fetching/feature-guard.js +29 -0
- package/templates/static/lib/data-fetching/graphql.js +265 -0
- package/templates/static/lib/data-fetching/index.js +57 -0
- package/templates/static/lib/data-fetching/rest.js +256 -0
- package/templates/static/lib/data-fetching/server.js +182 -0
- package/templates/static/lib/data-fetching/types.js +5 -0
- package/templates/static/lib/db/connector.js +0 -17
- package/templates/static/lib/db/drivers/jdb.js +0 -17
- package/templates/static/lib/db/drivers/sql.js +0 -17
- package/templates/static/lib/db/index.js +0 -17
- package/templates/static/lib/db/types.js +0 -17
- package/templates/static/lib/devtools/component-tree.js +106 -0
- package/templates/static/lib/devtools/devtools.js +638 -0
- package/templates/static/lib/devtools/event-bus.js +29 -0
- package/templates/static/lib/devtools/event-logger.js +67 -0
- package/templates/static/lib/devtools/index.js +9 -0
- package/templates/static/lib/devtools/integration.js +149 -0
- package/templates/static/lib/devtools/performance.js +84 -0
- package/templates/static/lib/devtools/persistence.js +57 -0
- package/templates/static/lib/devtools/plugins.js +97 -0
- package/templates/static/lib/devtools/search.js +89 -0
- package/templates/static/lib/devtools/ui.js +769 -0
- package/templates/static/lib/features/api/handler.js +10 -0
- package/templates/static/lib/features/api/index.js +5 -0
- package/templates/static/lib/features/api/types.js +4 -0
- package/templates/static/lib/features/middleware/compiled.js +7 -0
- package/templates/static/lib/features/middleware/index.js +5 -0
- package/templates/static/lib/features/middleware/types.js +4 -0
- package/templates/static/lib/fonts/index.js +46 -0
- package/templates/static/lib/fonts/inject.js +125 -0
- package/templates/static/lib/fonts/loader.js +196 -0
- package/templates/static/lib/fonts/types.js +1 -0
- package/templates/static/lib/graphql/index.js +1 -18
- package/templates/static/lib/graphql/resolvers.js +20 -13
- package/templates/static/lib/graphql/schema.js +0 -17
- package/templates/static/lib/i18n/index.js +7 -19
- package/templates/static/lib/import/jen-import.js +1 -18
- package/templates/static/lib/index.js +79 -125
- package/templates/static/lib/jdb/engine.js +0 -17
- package/templates/static/lib/jdb/index.js +1 -18
- package/templates/static/lib/jdb/types.js +0 -17
- package/templates/static/lib/jdb/utils.js +0 -17
- package/templates/static/lib/middleware/builtins/cors.js +3 -16
- package/templates/static/lib/middleware/context.js +0 -17
- package/templates/static/lib/middleware/kernel.js +117 -25
- package/templates/static/lib/middleware/pipeline.js +0 -17
- package/templates/static/lib/middleware/registry.js +0 -17
- package/templates/static/lib/middleware/response.js +0 -17
- package/templates/static/lib/plugin/examples/analytics-plugin.js +183 -0
- package/templates/static/lib/plugin/examples/cdn-upload-plugin.js +94 -0
- package/templates/static/lib/plugin/loader.js +0 -17
- package/templates/static/lib/plugin/plugin-manager.js +177 -0
- package/templates/static/lib/plugin/types.js +28 -0
- package/templates/static/lib/runtime/client-runtime.js +0 -17
- package/templates/static/lib/runtime/hmr.js +0 -17
- package/templates/static/lib/runtime/hydrate.js +0 -17
- package/templates/static/lib/runtime/island-hydration-client.js +0 -17
- package/templates/static/lib/runtime/islands.js +0 -17
- package/templates/static/lib/runtime/render.js +208 -50
- package/templates/static/lib/security/security-config.js +60 -0
- package/templates/static/lib/security/security-middleware.js +229 -0
- package/templates/static/lib/server/api-routes.js +153 -43
- package/templates/static/lib/server/api.js +0 -17
- package/templates/static/lib/server/app.js +539 -223
- package/templates/static/lib/server/isr.js +365 -0
- package/templates/static/lib/server/runtimeServe.js +31 -24
- package/templates/static/lib/server/ssr.js +98 -22
- package/templates/static/lib/server-actions/handler.js +180 -0
- package/templates/static/lib/server-actions/index.js +19 -0
- package/templates/static/lib/server-actions/middleware.js +146 -0
- package/templates/static/lib/server-actions/scan.js +152 -0
- package/templates/static/lib/server-actions/types.js +1 -0
- package/templates/static/lib/server-actions/validators.js +156 -0
- package/templates/static/lib/shared/log.js +19 -20
- package/templates/static/lib/telemetry/api/rate-limiter.js +32 -0
- package/templates/static/lib/telemetry/api/validator.js +67 -0
- package/templates/static/lib/telemetry/client.js +121 -0
- package/templates/static/lib/telemetry/tests/rate-limiter.test.js +46 -0
- package/templates/static/lib/telemetry/tests/validator.test.js +62 -0
- package/templates/static/lib/vendor/glob/glob.js +4766 -0
- package/templates/static/lib/vendor/preact/LICENSE +21 -0
- package/templates/static/lib/vendor/preact/preact.module.js +797 -0
- package/templates/static/lib/vendor/sass/sass.node.mjs +212 -0
- package/templates/static/package.json +4 -0
- package/templates/static/server.js +22 -22
- package/templates/static/site/(home).tsx +0 -18
- package/templates/static/tsconfig.json +5 -1
- package/templates/static/.esbuild/jen.config.js +0 -19
- package/templates/static/lib/build/asset-hashing.d.ts +0 -10
- package/templates/static/lib/build/asset-manifest.d.ts +0 -11
- package/templates/static/lib/build/minifier.d.ts +0 -20
- package/templates/static/lib/build/page-renderer.d.ts +0 -17
- package/templates/static/lib/build/production-build.d.ts +0 -10
- package/templates/static/lib/build/ssg-pipeline.d.ts +0 -15
- package/templates/static/lib/middleware/errors/http-error.js +0 -27
- package/templates/static/lib/middleware/types.js +0 -18
- package/templates/static/lib/middleware/utils/matcher.js +0 -30
- package/templates/static/lib/native/style-compiler.js +0 -36
- /package/templates/{static → ssr-isr}/lib/api/(hello).d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/auth/cookie-utils.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/auth/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/auth/jwt.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/auth/session.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/build-tools/build-site.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cache/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cache/memory.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cache/redis.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cli/banner.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cli/templates/ssg/jen.config.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cli/templates/ssg/site/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cli/templates/ssr/jen.config.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/cli/templates/ssr/site/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/compilers/esbuild-plugins.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/compilers/svelte.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/compilers/vue.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/core/config.d.ts +0 -0
- /package/templates/{static/lib/middleware/types.d.ts → ssr-isr/lib/core/config.js} +0 -0
- /package/templates/{static → ssr-isr}/lib/core/http.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/core/middleware-hooks.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/core/paths.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/core/routes/match.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/core/routes/scan.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/core/types.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/css/compiler.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/db/connector.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/db/drivers/jdb.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/db/drivers/sql.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/db/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/db/types.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/graphql/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/graphql/resolvers.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/graphql/schema.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/i18n/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/import/jen-import.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/jdb/engine.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/jdb/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/jdb/types.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/jdb/utils.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/builtins/body-parser.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/builtins/cors.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/builtins/logger.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/builtins/rate-limit.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/builtins/request-id.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/builtins/security-headers.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/context.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/decorators.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/errors/handler.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/errors/http-error.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/kernel.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/pipeline.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/registry.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/response.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/middleware/utils/matcher.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/native/bundle.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/native/dev-server.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/native/index.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/native/optimizer.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/native/style-compiler.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/plugin/loader.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/runtime/client-runtime.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/runtime/hmr.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/runtime/hydrate.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/runtime/island-hydration-client.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/runtime/islands.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/runtime/render.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/server/api-routes.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/server/api.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/server/app.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/server/runtimeServe.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/server/ssr.d.ts +0 -0
- /package/templates/{static → ssr-isr}/lib/shared/log.d.ts +0 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
const styles = `
|
|
3
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
4
|
+
:root{--bg-primary:#0d1117;--bg-secondary:#161b22;--bg-tertiary:#21262d;--border:#30363d;--text-primary:#e6edf3;--text-secondary:#8b949e;--accent:#58a6ff;--accent-hover:#79c0ff;--danger:#f85149;--warning:#d29922;--success:#3fb950}
|
|
5
|
+
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:var(--bg-primary);color:var(--text-primary);min-height:100vh}
|
|
6
|
+
.header{background:var(--bg-secondary);border-bottom:1px solid var(--border);padding:16px 24px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px}
|
|
7
|
+
.header h1{font-size:20px;font-weight:600}
|
|
8
|
+
.header .badge{background:var(--accent);color:var(--bg-primary);padding:4px 12px;border-radius:12px;font-size:12px;font-weight:600}
|
|
9
|
+
.stats-bar{display:flex;gap:24px;padding:16px 24px;background:var(--bg-secondary);border-bottom:1px solid var(--border);flex-wrap:wrap}
|
|
10
|
+
.stat{display:flex;flex-direction:column;gap:4px}
|
|
11
|
+
.stat-label{font-size:12px;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.5px}
|
|
12
|
+
.stat-value{font-size:20px;font-weight:600}
|
|
13
|
+
.controls{display:flex;gap:12px;padding:16px 24px;border-bottom:1px solid var(--border);flex-wrap:wrap;align-items:center}
|
|
14
|
+
.search-box{flex:1;min-width:200px;max-width:400px;position:relative}
|
|
15
|
+
.search-box input{width:100%;padding:8px 12px 8px 36px;background:var(--bg-tertiary);border:1px solid var(--border);border-radius:6px;color:var(--text-primary);font-size:14px}
|
|
16
|
+
.search-box input:focus{outline:none;border-color:var(--accent)}
|
|
17
|
+
.btn{padding:8px 16px;background:var(--bg-tertiary);border:1px solid var(--border);border-radius:6px;color:var(--text-primary);font-size:13px;cursor:pointer;transition:all .15s}
|
|
18
|
+
.btn:hover{background:var(--border)}
|
|
19
|
+
.btn.active{background:var(--accent);border-color:var(--accent);color:var(--bg-primary)}
|
|
20
|
+
.toggle-group{display:flex;gap:4px;background:var(--bg-tertiary);border-radius:6px;padding:4px}
|
|
21
|
+
.treemap-container{background:var(--bg-secondary);margin:16px;border-radius:8px;border:1px solid var(--border);overflow:hidden;position:relative;flex:1;min-height:400px}
|
|
22
|
+
.treemap-header{padding:12px 16px;border-bottom:1px solid var(--border);font-weight:600;font-size:14px}
|
|
23
|
+
#treemap{width:100%;height:calc(100% - 45px);position:relative}
|
|
24
|
+
.treemap-cell{position:absolute;border:1px solid var(--bg-primary);overflow:hidden;cursor:pointer;transition:transform .1s,box-shadow .1s}
|
|
25
|
+
.treemap-cell:hover{z-index:10;box-shadow:0 4px 12px rgba(0,0,0,.5)}
|
|
26
|
+
.treemap-cell.large{background:linear-gradient(135deg,var(--danger) 0%,#ff6b6b 100%)}
|
|
27
|
+
.treemap-cell.medium{background:linear-gradient(135deg,var(--warning) 0%,#ffd43b 100%)}
|
|
28
|
+
.treemap-cell.small{background:linear-gradient(135deg,var(--accent) 0%,#79c0ff 100%)}
|
|
29
|
+
.treemap-cell.local{background:linear-gradient(135deg,var(--success) 0%,#56d364 100%)}
|
|
30
|
+
.treemap-cell-label{padding:4px;font-size:11px;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.5);word-break:break-all}
|
|
31
|
+
.module-list{background:var(--bg-secondary);margin:16px;margin-left:0;border-radius:8px;border:1px solid var(--border);display:flex;flex-direction:column;max-height:600px}
|
|
32
|
+
.module-table-wrapper{overflow:auto;flex:1}
|
|
33
|
+
.module-table{width:100%;border-collapse:collapse;font-size:13px}
|
|
34
|
+
.module-table th{position:sticky;top:0;background:var(--bg-tertiary);padding:10px 12px;text-align:left;font-weight:600;color:var(--text-secondary);cursor:pointer;white-space:nowrap}
|
|
35
|
+
.module-table th:hover{color:var(--text-primary)}
|
|
36
|
+
.module-table td{padding:8px 12px;border-bottom:1px solid var(--border)}
|
|
37
|
+
.module-table tr:hover td{background:var(--bg-tertiary)}
|
|
38
|
+
.module-name{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
39
|
+
.size-bar{height:4px;background:var(--bg-tertiary);border-radius:2px;overflow:hidden;margin-top:4px}
|
|
40
|
+
.size-bar-fill{height:100%;background:var(--accent);transition:width .3s}
|
|
41
|
+
.large-badge{background:var(--danger);color:#fff;padding:2px 6px;border-radius:4px;font-size:10px;font-weight:600;margin-left:8px}
|
|
42
|
+
.packages-list{display:flex;flex-direction:column;gap:8px}
|
|
43
|
+
.package-item{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:var(--bg-tertiary);border-radius:6px}
|
|
44
|
+
.detail-panel{position:fixed;right:-400px;top:0;width:400px;height:100vh;background:var(--bg-secondary);border-left:1px solid var(--border);transition:right .3s;z-index:100;display:flex;flex-direction:column}
|
|
45
|
+
.detail-panel.open{right:0}
|
|
46
|
+
.detail-header{padding:16px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center}
|
|
47
|
+
.detail-close{background:0;border:none;color:var(--text-secondary);font-size:20px;cursor:pointer}
|
|
48
|
+
.detail-content{padding:16px;overflow:auto;flex:1}
|
|
49
|
+
.detail-section{margin-bottom:20px}
|
|
50
|
+
.detail-section h4{font-size:12px;color:var(--text-secondary);text-transform:uppercase;margin-bottom:8px}
|
|
51
|
+
.detail-value{font-size:14px;word-break:break-all}
|
|
52
|
+
.zoom-controls{position:absolute;bottom:16px;right:16px;display:flex;gap:8px;z-index:20}
|
|
53
|
+
.zoom-btn{width:36px;height:36px;border-radius:50%;background:var(--bg-tertiary);border:1px solid var(--border);color:var(--text-primary);font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center}
|
|
54
|
+
.zoom-btn:hover{background:var(--border)}
|
|
55
|
+
.breadcrumb{padding:8px 16px;background:var(--bg-tertiary);font-size:13px;display:flex;gap:8px;align-items:center}
|
|
56
|
+
.breadcrumb-item{color:var(--text-secondary);cursor:pointer}
|
|
57
|
+
.breadcrumb-item:hover{color:var(--accent)}
|
|
58
|
+
.main-content{display:flex;gap:16px;padding:0 16px 16px 0}
|
|
59
|
+
`;
|
|
60
|
+
function formatBytes(bytes) {
|
|
61
|
+
if (bytes === 0) return "0 B";
|
|
62
|
+
const k = 1024;
|
|
63
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
64
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
65
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
66
|
+
}
|
|
67
|
+
function escapeHtml(str) {
|
|
68
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
69
|
+
}
|
|
70
|
+
function StatCard({ label, value }) {
|
|
71
|
+
return _jsxs("div", {
|
|
72
|
+
class: "stat",
|
|
73
|
+
children: [
|
|
74
|
+
_jsx("span", { class: "stat-label", children: label }),
|
|
75
|
+
_jsx("span", { class: "stat-value", children: value }),
|
|
76
|
+
],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function Header() {
|
|
80
|
+
return _jsxs("div", {
|
|
81
|
+
class: "header",
|
|
82
|
+
children: [
|
|
83
|
+
_jsx("h1", { children: "Bundle Analyzer" }),
|
|
84
|
+
_jsx("span", { class: "badge", children: "Jen.js" }),
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function StatsBar({ analysis }) {
|
|
89
|
+
return _jsxs("div", {
|
|
90
|
+
class: "stats-bar",
|
|
91
|
+
children: [
|
|
92
|
+
_jsx(StatCard, {
|
|
93
|
+
label: "Total Size",
|
|
94
|
+
value: formatBytes(analysis.totalSize),
|
|
95
|
+
}),
|
|
96
|
+
_jsx(StatCard, {
|
|
97
|
+
label: "Gzipped",
|
|
98
|
+
value: formatBytes(analysis.totalGzipSize),
|
|
99
|
+
}),
|
|
100
|
+
_jsx(StatCard, {
|
|
101
|
+
label: "Modules",
|
|
102
|
+
value: String(analysis.modules.length),
|
|
103
|
+
}),
|
|
104
|
+
_jsx(StatCard, {
|
|
105
|
+
label: "Packages",
|
|
106
|
+
value: String(analysis.packages.size),
|
|
107
|
+
}),
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function ModuleRow({ module, totalSize }) {
|
|
112
|
+
const pct = totalSize > 0 ? (module.size / totalSize) * 100 : 0;
|
|
113
|
+
return _jsxs("tr", {
|
|
114
|
+
"data-path": module.path,
|
|
115
|
+
children: [
|
|
116
|
+
_jsxs("td", {
|
|
117
|
+
class: "module-name",
|
|
118
|
+
children: [
|
|
119
|
+
escapeHtml(module.name),
|
|
120
|
+
module.isLarge &&
|
|
121
|
+
_jsx("span", { class: "large-badge", children: "LARGE" }),
|
|
122
|
+
],
|
|
123
|
+
}),
|
|
124
|
+
_jsxs("td", {
|
|
125
|
+
children: [
|
|
126
|
+
formatBytes(module.size),
|
|
127
|
+
_jsx("div", {
|
|
128
|
+
class: "size-bar",
|
|
129
|
+
children: _jsx("div", {
|
|
130
|
+
class: "size-bar-fill",
|
|
131
|
+
style: { width: `${Math.min(pct * 10, 100)}%` },
|
|
132
|
+
}),
|
|
133
|
+
}),
|
|
134
|
+
],
|
|
135
|
+
}),
|
|
136
|
+
_jsx("td", { children: formatBytes(module.gzipSize) }),
|
|
137
|
+
_jsxs("td", { children: [pct.toFixed(2), "%"] }),
|
|
138
|
+
],
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function ModuleTable({ modules, totalSize }) {
|
|
142
|
+
const sorted = [...modules].sort((a, b) => b.size - a.size);
|
|
143
|
+
return _jsxs("div", {
|
|
144
|
+
class: "module-list",
|
|
145
|
+
style: { flex: 1, maxHeight: "none", margin: "16px 16px 16px 0" },
|
|
146
|
+
children: [
|
|
147
|
+
_jsx("div", { class: "treemap-header", children: "All Modules" }),
|
|
148
|
+
_jsx("div", {
|
|
149
|
+
class: "module-table-wrapper",
|
|
150
|
+
children: _jsxs("table", {
|
|
151
|
+
class: "module-table",
|
|
152
|
+
children: [
|
|
153
|
+
_jsx("thead", {
|
|
154
|
+
children: _jsxs("tr", {
|
|
155
|
+
children: [
|
|
156
|
+
_jsx("th", { children: "Module" }),
|
|
157
|
+
_jsx("th", { children: "Size" }),
|
|
158
|
+
_jsx("th", { children: "Gzip" }),
|
|
159
|
+
_jsx("th", { children: "%" }),
|
|
160
|
+
],
|
|
161
|
+
}),
|
|
162
|
+
}),
|
|
163
|
+
_jsx("tbody", {
|
|
164
|
+
children: sorted.map((m) =>
|
|
165
|
+
_jsx(ModuleRow, { module: m, totalSize: totalSize }),
|
|
166
|
+
),
|
|
167
|
+
}),
|
|
168
|
+
],
|
|
169
|
+
}),
|
|
170
|
+
}),
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function PackageItem({ name, size, totalSize }) {
|
|
175
|
+
const pct = totalSize > 0 ? (size / totalSize) * 100 : 0;
|
|
176
|
+
return _jsxs("div", {
|
|
177
|
+
class: "package-item",
|
|
178
|
+
children: [
|
|
179
|
+
_jsx("span", { children: escapeHtml(name) }),
|
|
180
|
+
_jsxs("span", {
|
|
181
|
+
children: [formatBytes(size), " (", pct.toFixed(1), "%)"],
|
|
182
|
+
}),
|
|
183
|
+
],
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function PackagesView({ packages, totalSize }) {
|
|
187
|
+
const sorted = [...packages.entries()].sort((a, b) => b[1].size - a[1].size);
|
|
188
|
+
return _jsxs("div", {
|
|
189
|
+
class: "module-list",
|
|
190
|
+
style: { flex: 1, maxHeight: "none", margin: "16px 16px 16px 0" },
|
|
191
|
+
children: [
|
|
192
|
+
_jsx("div", { class: "treemap-header", children: "Bundle by Package" }),
|
|
193
|
+
_jsx("div", {
|
|
194
|
+
class: "module-table-wrapper",
|
|
195
|
+
children: _jsx("div", {
|
|
196
|
+
class: "packages-list",
|
|
197
|
+
children: sorted.map(([name, data]) =>
|
|
198
|
+
_jsx(PackageItem, {
|
|
199
|
+
name: name,
|
|
200
|
+
size: data.size,
|
|
201
|
+
totalSize: totalSize,
|
|
202
|
+
}),
|
|
203
|
+
),
|
|
204
|
+
}),
|
|
205
|
+
}),
|
|
206
|
+
],
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
export function BundleReport({ analysis, treemap }) {
|
|
210
|
+
return _jsxs("html", {
|
|
211
|
+
lang: "en",
|
|
212
|
+
children: [
|
|
213
|
+
_jsxs("head", {
|
|
214
|
+
children: [
|
|
215
|
+
_jsx("meta", { charset: "UTF-8" }),
|
|
216
|
+
_jsx("meta", {
|
|
217
|
+
name: "viewport",
|
|
218
|
+
content: "width=device-width, initial-scale=1.0",
|
|
219
|
+
}),
|
|
220
|
+
_jsx("title", { children: "Bundle Analyzer - Jen.js" }),
|
|
221
|
+
_jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
|
|
222
|
+
],
|
|
223
|
+
}),
|
|
224
|
+
_jsxs("body", {
|
|
225
|
+
children: [
|
|
226
|
+
_jsx(Header, {}),
|
|
227
|
+
_jsx(StatsBar, { analysis: analysis }),
|
|
228
|
+
_jsxs("div", {
|
|
229
|
+
class: "main-content",
|
|
230
|
+
children: [
|
|
231
|
+
_jsxs("div", {
|
|
232
|
+
class: "treemap-container",
|
|
233
|
+
children: [
|
|
234
|
+
_jsx("div", {
|
|
235
|
+
class: "treemap-header",
|
|
236
|
+
children: "Bundle Treemap",
|
|
237
|
+
}),
|
|
238
|
+
_jsx("div", {
|
|
239
|
+
id: "treemap",
|
|
240
|
+
"data-treemap": JSON.stringify(treemap),
|
|
241
|
+
}),
|
|
242
|
+
_jsxs("div", {
|
|
243
|
+
class: "zoom-controls",
|
|
244
|
+
children: [
|
|
245
|
+
_jsx("button", {
|
|
246
|
+
class: "zoom-btn",
|
|
247
|
+
"data-action": "zoomIn",
|
|
248
|
+
children: "+",
|
|
249
|
+
}),
|
|
250
|
+
_jsx("button", {
|
|
251
|
+
class: "zoom-btn",
|
|
252
|
+
"data-action": "zoomOut",
|
|
253
|
+
children: "\u2212",
|
|
254
|
+
}),
|
|
255
|
+
_jsx("button", {
|
|
256
|
+
class: "zoom-btn",
|
|
257
|
+
"data-action": "zoomReset",
|
|
258
|
+
children: "\u21BA",
|
|
259
|
+
}),
|
|
260
|
+
],
|
|
261
|
+
}),
|
|
262
|
+
],
|
|
263
|
+
}),
|
|
264
|
+
_jsx(ModuleTable, {
|
|
265
|
+
modules: analysis.modules,
|
|
266
|
+
totalSize: analysis.totalSize,
|
|
267
|
+
}),
|
|
268
|
+
],
|
|
269
|
+
}),
|
|
270
|
+
_jsxs("div", {
|
|
271
|
+
class: "detail-panel",
|
|
272
|
+
id: "detailPanel",
|
|
273
|
+
children: [
|
|
274
|
+
_jsxs("div", {
|
|
275
|
+
class: "detail-header",
|
|
276
|
+
children: [
|
|
277
|
+
_jsx("h3", { children: "Module Details" }),
|
|
278
|
+
_jsx("button", {
|
|
279
|
+
class: "detail-close",
|
|
280
|
+
id: "detailClose",
|
|
281
|
+
children: "\u00D7",
|
|
282
|
+
}),
|
|
283
|
+
],
|
|
284
|
+
}),
|
|
285
|
+
_jsxs("div", {
|
|
286
|
+
class: "detail-content",
|
|
287
|
+
children: [
|
|
288
|
+
_jsxs("div", {
|
|
289
|
+
class: "detail-section",
|
|
290
|
+
children: [
|
|
291
|
+
_jsx("h4", { children: "Path" }),
|
|
292
|
+
_jsx("div", { class: "detail-value", id: "detailPath" }),
|
|
293
|
+
],
|
|
294
|
+
}),
|
|
295
|
+
_jsxs("div", {
|
|
296
|
+
class: "detail-section",
|
|
297
|
+
children: [
|
|
298
|
+
_jsx("h4", { children: "Size" }),
|
|
299
|
+
_jsx("div", { class: "detail-value", id: "detailSize" }),
|
|
300
|
+
],
|
|
301
|
+
}),
|
|
302
|
+
_jsxs("div", {
|
|
303
|
+
class: "detail-section",
|
|
304
|
+
children: [
|
|
305
|
+
_jsx("h4", { children: "Gzipped" }),
|
|
306
|
+
_jsx("div", { class: "detail-value", id: "detailGzip" }),
|
|
307
|
+
],
|
|
308
|
+
}),
|
|
309
|
+
_jsxs("div", {
|
|
310
|
+
class: "detail-section",
|
|
311
|
+
children: [
|
|
312
|
+
_jsx("h4", { children: "Percentage" }),
|
|
313
|
+
_jsx("div", {
|
|
314
|
+
class: "detail-value",
|
|
315
|
+
id: "detailPercentage",
|
|
316
|
+
}),
|
|
317
|
+
],
|
|
318
|
+
}),
|
|
319
|
+
_jsxs("div", {
|
|
320
|
+
class: "detail-section",
|
|
321
|
+
children: [
|
|
322
|
+
_jsx("h4", { children: "Package" }),
|
|
323
|
+
_jsx("div", {
|
|
324
|
+
class: "detail-value",
|
|
325
|
+
id: "detailPackage",
|
|
326
|
+
}),
|
|
327
|
+
],
|
|
328
|
+
}),
|
|
329
|
+
],
|
|
330
|
+
}),
|
|
331
|
+
],
|
|
332
|
+
}),
|
|
333
|
+
_jsx("script", {
|
|
334
|
+
dangerouslySetInnerHTML: {
|
|
335
|
+
__html: `
|
|
336
|
+
const modules=${JSON.stringify(analysis.modules)};
|
|
337
|
+
const treemapData=${JSON.stringify(treemap)};
|
|
338
|
+
let currentSize='raw';
|
|
339
|
+
let treemapZoom=1;
|
|
340
|
+
let currentNode=treemapData;
|
|
341
|
+
let history=[treemapData];
|
|
342
|
+
|
|
343
|
+
function getSize(m){return currentSize==='gzip'?m.gzipSize:m.size}
|
|
344
|
+
|
|
345
|
+
function renderTreemap(node){
|
|
346
|
+
const container=document.getElementById('treemap');
|
|
347
|
+
const rect=container.getBoundingClientRect();
|
|
348
|
+
const w=rect.width,h=rect.height;
|
|
349
|
+
container.innerHTML='';
|
|
350
|
+
if(!node.children||node.children.length===0)return;
|
|
351
|
+
const total=node.children.reduce((s,c)=>s+getSize(c),0);
|
|
352
|
+
const rows=[];
|
|
353
|
+
let row=[],rowH=0;
|
|
354
|
+
for(const child of node.children){
|
|
355
|
+
const sz=getSize(child);
|
|
356
|
+
const ch=(sz/total)*h;
|
|
357
|
+
if(ch>50||rowH<50){if(row.length>0&&Math.abs(ch-rowH)>rowH*.5){rows.push(row);row=[];}
|
|
358
|
+
row.push(child);rowH=ch;
|
|
359
|
+
}else{row.push(ch);}
|
|
360
|
+
}
|
|
361
|
+
if(row.length>0)rows.push(row);
|
|
362
|
+
let y=0;
|
|
363
|
+
rows.forEach(r=>{
|
|
364
|
+
const rt=r.reduce((s,c)=>s+getSize(c),0);
|
|
365
|
+
const rh=Math.max(30,(rt/total)*h*.9);
|
|
366
|
+
let x=0;
|
|
367
|
+
r.forEach(c=>{
|
|
368
|
+
const sz=getSize(c);
|
|
369
|
+
const cw=(sz/rt)*w,ch=rh;
|
|
370
|
+
const el=document.createElement('div');
|
|
371
|
+
el.className='treemap-cell '+(c.isLarge||c.value>50000?'large':c.value>20000?'medium':'small');
|
|
372
|
+
if(c.package==='local'||!c.path.includes('node_modules'))el.className='treemap-cell local';
|
|
373
|
+
el.style.left=x+'px';
|
|
374
|
+
el.style.top=y+'px';
|
|
375
|
+
el.style.width=(cw-2)+'px';
|
|
376
|
+
el.style.height=(ch-2)+'px';
|
|
377
|
+
el.innerHTML='<div class="treemap-cell-label">'+(c.name.length>15?c.name.slice(0,12)+'...':c.name)+'</div>';
|
|
378
|
+
el.onclick=()=>{if(c.children&&c.children.length>0){history.push(c);currentNode=c;renderTreemap(c);}else showDetail(c.path);};
|
|
379
|
+
container.appendChild(el);
|
|
380
|
+
x+=cw;
|
|
381
|
+
});
|
|
382
|
+
y+=rh;
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function showDetail(p){
|
|
387
|
+
const m=modules.find(x=>x.path===p);
|
|
388
|
+
if(!m)return;
|
|
389
|
+
document.getElementById('detailPath').textContent=m.path;
|
|
390
|
+
document.getElementById('detailSize').textContent=formatBytes(m.size);
|
|
391
|
+
document.getElementById('detailGzip').textContent=formatBytes(m.gzipSize);
|
|
392
|
+
document.getElementById('detailPercentage').textContent=m.percentage.toFixed(2)+'%';
|
|
393
|
+
document.getElementById('detailPackage').textContent=m.package||'unknown';
|
|
394
|
+
document.getElementById('detailPanel').classList.add('open');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function formatBytes(b){if(b===0)return'0 B';const k=1024,s=['B','KB','MB','GB'];return parseFloat((b/Math.pow(k,Math.floor(Math.log(b)/Math.log(k)))).toFixed(2))+' '+s[Math.floor(Math.log(b)/Math.log(k))];}
|
|
398
|
+
|
|
399
|
+
document.getElementById('detailClose').onclick=()=>document.getElementById('detailPanel').classList.remove('open');
|
|
400
|
+
document.querySelectorAll('.zoom-btn').forEach(b=>{
|
|
401
|
+
b.onclick=()=>{
|
|
402
|
+
if(b.dataset.action==='zoomIn')treemapZoom=Math.min(treemapZoom*1.2,5);
|
|
403
|
+
if(b.dataset.action==='zoomOut')treemapZoom=Math.max(treemapZoom/1.2,.5);
|
|
404
|
+
if(b.dataset.action==='zoomReset'){treemapZoom=1;currentNode=treemapData;history=[treemapData];}
|
|
405
|
+
renderTreemap(currentNode);
|
|
406
|
+
};
|
|
407
|
+
});
|
|
408
|
+
document.querySelectorAll('.module-table tr[data-path]').forEach(r=>r.onclick=()=>showDetail(r.dataset.path));
|
|
409
|
+
renderTreemap(treemapData);
|
|
410
|
+
`,
|
|
411
|
+
},
|
|
412
|
+
}),
|
|
413
|
+
],
|
|
414
|
+
}),
|
|
415
|
+
],
|
|
416
|
+
});
|
|
417
|
+
}
|