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,183 @@
|
|
|
1
|
+
import { HookStage } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create an analytics plugin.
|
|
4
|
+
*/
|
|
5
|
+
export function createAnalyticsPlugin(config) {
|
|
6
|
+
const events = [];
|
|
7
|
+
return {
|
|
8
|
+
name: "jen-analytics",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
description: "Track pageviews and events with analytics provider",
|
|
11
|
+
async init(pluginContext) {
|
|
12
|
+
console.log(
|
|
13
|
+
`[Analytics Plugin] Initialized with provider: ${config.provider}`,
|
|
14
|
+
);
|
|
15
|
+
},
|
|
16
|
+
hooks: {
|
|
17
|
+
// Track pageviews
|
|
18
|
+
[HookStage.BEFORE_REQUEST]: async (context) => {
|
|
19
|
+
const path = context.request?.req?.url || "/";
|
|
20
|
+
const event = {
|
|
21
|
+
type: "pageview",
|
|
22
|
+
path,
|
|
23
|
+
timestamp: Date.now(),
|
|
24
|
+
};
|
|
25
|
+
events.push(event);
|
|
26
|
+
// Send to analytics provider
|
|
27
|
+
await trackEvent(event, config);
|
|
28
|
+
},
|
|
29
|
+
// Inject analytics script into rendered pages
|
|
30
|
+
[HookStage.AFTER_RENDER]: async (context) => {
|
|
31
|
+
const analyticsScript = generateAnalyticsScript(config);
|
|
32
|
+
let html = context.data?.html;
|
|
33
|
+
if (html) {
|
|
34
|
+
// Inject before closing body tag
|
|
35
|
+
html = html.replace("</body>", `${analyticsScript}</body>`);
|
|
36
|
+
if (context.mutate) {
|
|
37
|
+
context.mutate("html", html);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
// Flush events before build
|
|
42
|
+
[HookStage.BEFORE_BUILD]: async (context) => {
|
|
43
|
+
console.log(`[Analytics Plugin] Flushing ${events.length} events...`);
|
|
44
|
+
for (const event of events) {
|
|
45
|
+
await trackEvent(event, config);
|
|
46
|
+
}
|
|
47
|
+
events.length = 0;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Track an analytics event.
|
|
54
|
+
*/
|
|
55
|
+
async function trackEvent(event, config) {
|
|
56
|
+
switch (config.provider) {
|
|
57
|
+
case "google-analytics":
|
|
58
|
+
await trackGoogleAnalytics(event, config);
|
|
59
|
+
break;
|
|
60
|
+
case "segment":
|
|
61
|
+
await trackSegment(event, config);
|
|
62
|
+
break;
|
|
63
|
+
case "mixpanel":
|
|
64
|
+
await trackMixpanel(event, config);
|
|
65
|
+
break;
|
|
66
|
+
case "custom":
|
|
67
|
+
if (config.customTrackerFn) {
|
|
68
|
+
await config.customTrackerFn(event);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Track event in Google Analytics.
|
|
75
|
+
*/
|
|
76
|
+
async function trackGoogleAnalytics(event, config) {
|
|
77
|
+
// Mock implementation - in production, use the GA SDK
|
|
78
|
+
const trackingId = config.trackingId || "UA-XXXXXXXXX-X";
|
|
79
|
+
const params = new URLSearchParams({
|
|
80
|
+
v: "1", // API version
|
|
81
|
+
tid: trackingId,
|
|
82
|
+
cid: generateClientId(),
|
|
83
|
+
t: event.type === "pageview" ? "pageview" : "event",
|
|
84
|
+
});
|
|
85
|
+
if (event.type === "pageview" && event.path) {
|
|
86
|
+
params.append("dp", event.path);
|
|
87
|
+
}
|
|
88
|
+
if (event.type === "event" && event.eventName) {
|
|
89
|
+
params.append("ec", "engagement");
|
|
90
|
+
params.append("ea", event.eventName);
|
|
91
|
+
}
|
|
92
|
+
if (config.anonymizeIp) {
|
|
93
|
+
params.append("aip", "1");
|
|
94
|
+
}
|
|
95
|
+
console.log(
|
|
96
|
+
`[Analytics] GA: ${event.type} → ${event.path || event.eventName}`,
|
|
97
|
+
);
|
|
98
|
+
// In production: fetch("https://www.google-analytics.com/collect", { method: "POST", body: params });
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Track event in Segment.
|
|
102
|
+
*/
|
|
103
|
+
async function trackSegment(event, config) {
|
|
104
|
+
// Mock implementation - in production, use the Segment SDK
|
|
105
|
+
const apiKey = config.apiKey || "YOUR_SEGMENT_API_KEY";
|
|
106
|
+
const payload = {
|
|
107
|
+
type: event.type === "pageview" ? "page" : "track",
|
|
108
|
+
userId: generateClientId(),
|
|
109
|
+
timestamp: new Date(event.timestamp).toISOString(),
|
|
110
|
+
context: {
|
|
111
|
+
library: { name: "jen.js" },
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
if (event.type === "pageview" && event.path) {
|
|
115
|
+
Object.assign(payload, {
|
|
116
|
+
name: "Page Viewed",
|
|
117
|
+
properties: { path: event.path },
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (event.type === "event" && event.eventName) {
|
|
121
|
+
Object.assign(payload, {
|
|
122
|
+
event: event.eventName,
|
|
123
|
+
properties: event.properties,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
console.log(`[Analytics] Segment: ${event.type}`);
|
|
127
|
+
// In production: fetch("https://api.segment.io/v1/track", { method: "POST", body: JSON.stringify(payload) });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Track event in Mixpanel.
|
|
131
|
+
*/
|
|
132
|
+
async function trackMixpanel(event, config) {
|
|
133
|
+
// Mock implementation - in production, use the Mixpanel SDK
|
|
134
|
+
const token = config.apiKey || "YOUR_MIXPANEL_TOKEN";
|
|
135
|
+
const payload = {
|
|
136
|
+
event: event.type === "pageview" ? "Page View" : event.eventName || "Event",
|
|
137
|
+
properties: {
|
|
138
|
+
token,
|
|
139
|
+
distinct_id: generateClientId(),
|
|
140
|
+
time: event.timestamp,
|
|
141
|
+
...(event.type === "pageview" && event.path ? { page: event.path } : {}),
|
|
142
|
+
...event.properties,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
console.log(`[Analytics] Mixpanel: ${payload.event}`);
|
|
146
|
+
// In production: fetch("https://api.mixpanel.com/track", { method: "POST", body: JSON.stringify([payload]) });
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Generate analytics script to inject into HTML.
|
|
150
|
+
*/
|
|
151
|
+
function generateAnalyticsScript(config) {
|
|
152
|
+
switch (config.provider) {
|
|
153
|
+
case "google-analytics":
|
|
154
|
+
return `
|
|
155
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=${config.trackingId || "UA-XXXXXXXXX-X"}"></script>
|
|
156
|
+
<script>
|
|
157
|
+
window.dataLayer = window.dataLayer || [];
|
|
158
|
+
function gtag(){dataLayer.push(arguments);}
|
|
159
|
+
gtag('js', new Date());
|
|
160
|
+
gtag('config', '${config.trackingId || "UA-XXXXXXXXX-X"}');
|
|
161
|
+
</script>`;
|
|
162
|
+
case "segment":
|
|
163
|
+
return `
|
|
164
|
+
<script>
|
|
165
|
+
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var t=analytics.methods[e];analytics[t]=analytics.factory(t)}analytics.load=function(e,t){var n=document.createElement("script");n.type="text/javascript";n.async=!0;n.src="https://cdn.segment.com/analytics.js/v1/"+e+"/analytics.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a);analytics._loadOptions=t};analytics.SNIPPET_VERSION="4.4.0";analytics.load("${config.apiKey || "YOUR_SEGMENT_API_KEY"}");analytics.page();}}();
|
|
166
|
+
</script>`;
|
|
167
|
+
case "mixpanel":
|
|
168
|
+
return `
|
|
169
|
+
<script async src="//cdn.mxpnl.com/libs/mixpanel-latest.min.js"></script>
|
|
170
|
+
<script>
|
|
171
|
+
mixpanel.init("${config.apiKey || "YOUR_MIXPANEL_TOKEN"}");
|
|
172
|
+
mixpanel.track("Page Viewed");
|
|
173
|
+
</script>`;
|
|
174
|
+
default:
|
|
175
|
+
return "";
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generate a unique client ID.
|
|
180
|
+
*/
|
|
181
|
+
function generateClientId() {
|
|
182
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
183
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { HookStage } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a CDN upload plugin.
|
|
4
|
+
*/
|
|
5
|
+
export function createCDNUploadPlugin(config) {
|
|
6
|
+
return {
|
|
7
|
+
name: "jen-cdn-upload",
|
|
8
|
+
version: "1.0.0",
|
|
9
|
+
description: "Upload optimized assets to CDN after build",
|
|
10
|
+
async init(pluginContext) {
|
|
11
|
+
console.log(`[CDN Plugin] Initialized with provider: ${config.provider}`);
|
|
12
|
+
},
|
|
13
|
+
hooks: {
|
|
14
|
+
// Hook after build completes to upload assets
|
|
15
|
+
[HookStage.AFTER_BUILD]: async (context) => {
|
|
16
|
+
console.log("[CDN Plugin] Build completed, uploading assets...");
|
|
17
|
+
// Get the list of optimized assets from the build context
|
|
18
|
+
const { distDir } = context.config;
|
|
19
|
+
const assets = context.data?.assets || [];
|
|
20
|
+
for (const asset of assets) {
|
|
21
|
+
try {
|
|
22
|
+
const cdnUrl = await uploadAsset(asset, config);
|
|
23
|
+
console.log(`[CDN Plugin] Uploaded: ${asset.path} → ${cdnUrl}`);
|
|
24
|
+
// Update the asset URL in the manifest
|
|
25
|
+
if (!context.data?.assetUrls) {
|
|
26
|
+
context.data = { ...context.data, assetUrls: {} };
|
|
27
|
+
}
|
|
28
|
+
context.data.assetUrls[asset.path] = cdnUrl;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error(
|
|
31
|
+
`[CDN Plugin] Failed to upload ${asset.path}:`,
|
|
32
|
+
error,
|
|
33
|
+
);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
// Hook to inject CDN URLs into HTML
|
|
39
|
+
[HookStage.AFTER_RENDER]: async (context) => {
|
|
40
|
+
const assetUrls = context.data?.assetUrls || {};
|
|
41
|
+
if (Object.keys(assetUrls).length > 0) {
|
|
42
|
+
// Update HTML with CDN URLs
|
|
43
|
+
let html = context.data?.html;
|
|
44
|
+
for (const [localPath, cdnUrl] of Object.entries(assetUrls)) {
|
|
45
|
+
html = html?.replace(new RegExp(localPath, "g"), cdnUrl);
|
|
46
|
+
}
|
|
47
|
+
if (context.mutate) {
|
|
48
|
+
context.mutate("html", html);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Upload a single asset to the configured CDN.
|
|
57
|
+
*/
|
|
58
|
+
async function uploadAsset(file, config) {
|
|
59
|
+
switch (config.provider) {
|
|
60
|
+
case "cloudinary":
|
|
61
|
+
return uploadToCloudinary(file, config);
|
|
62
|
+
case "aws-s3":
|
|
63
|
+
return uploadToS3(file, config);
|
|
64
|
+
case "custom":
|
|
65
|
+
if (config.customUploadFn) {
|
|
66
|
+
return config.customUploadFn(file);
|
|
67
|
+
}
|
|
68
|
+
throw new Error("Custom upload function not provided");
|
|
69
|
+
default:
|
|
70
|
+
throw new Error(`Unsupported CDN provider: ${config.provider}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Upload to Cloudinary.
|
|
75
|
+
*/
|
|
76
|
+
async function uploadToCloudinary(file, config) {
|
|
77
|
+
// This is a mock implementation
|
|
78
|
+
// In production, use the Cloudinary SDK
|
|
79
|
+
const cloudName = config.cloudName || "demo";
|
|
80
|
+
const filename = file.path.split("/").pop() || "asset";
|
|
81
|
+
// Mock response - in reality, call Cloudinary API
|
|
82
|
+
return `https://res.cloudinary.com/${cloudName}/image/upload/v1/${filename}`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Upload to AWS S3.
|
|
86
|
+
*/
|
|
87
|
+
async function uploadToS3(file, config) {
|
|
88
|
+
// This is a mock implementation
|
|
89
|
+
// In production, use the AWS SDK
|
|
90
|
+
const bucket = config.bucket || "my-assets";
|
|
91
|
+
const key = file.path;
|
|
92
|
+
// Mock response - in reality, call S3 API
|
|
93
|
+
return `https://${bucket}.s3.amazonaws.com/${key}`;
|
|
94
|
+
}
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Jen.js.
|
|
3
|
-
* Copyright (C) 2026 oopsio
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
1
|
// Plugin loader
|
|
19
2
|
// Migrated from Python src/python/plugins.py
|
|
20
3
|
import { readdirSync } from "node:fs";
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { log } from "../shared/log.js";
|
|
2
|
+
/**
|
|
3
|
+
* Central plugin manager for Jen.js framework.
|
|
4
|
+
*
|
|
5
|
+
* Manages plugin loading, hook registration, and execution.
|
|
6
|
+
* Plugins can hook into any stage of the build, dev, or request lifecycle.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const manager = new PluginManager(config, "development");
|
|
11
|
+
* await manager.loadPlugins([myPlugin]);
|
|
12
|
+
* await manager.emitHook("beforeBuild", { config, data: {} });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export class PluginManager {
|
|
16
|
+
plugins = [];
|
|
17
|
+
hooks = new Map();
|
|
18
|
+
config;
|
|
19
|
+
mode;
|
|
20
|
+
rootDir;
|
|
21
|
+
initialized = false;
|
|
22
|
+
constructor(config, rootDir, mode = "development") {
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.rootDir = rootDir;
|
|
25
|
+
this.mode = mode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load plugins from configuration or explicit list.
|
|
29
|
+
*/
|
|
30
|
+
async loadPlugins(plugins = []) {
|
|
31
|
+
try {
|
|
32
|
+
for (const plugin of plugins) {
|
|
33
|
+
const resolved =
|
|
34
|
+
typeof plugin === "string"
|
|
35
|
+
? await this.resolvePlugin(plugin)
|
|
36
|
+
: plugin;
|
|
37
|
+
this.plugins.push(resolved);
|
|
38
|
+
log.info(`[Plugin] Loaded: ${resolved.name}@${resolved.version}`);
|
|
39
|
+
}
|
|
40
|
+
this.initialized = true;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
log.error(
|
|
43
|
+
`[Plugin] Failed to load plugins: ${error instanceof Error ? error.message : String(error)}`,
|
|
44
|
+
);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve a plugin by name (from node_modules or path).
|
|
50
|
+
*/
|
|
51
|
+
async resolvePlugin(pluginName) {
|
|
52
|
+
try {
|
|
53
|
+
// Try to import from node_modules
|
|
54
|
+
const imported = await import(pluginName);
|
|
55
|
+
return imported.default || imported;
|
|
56
|
+
} catch {
|
|
57
|
+
// Try to import from relative path
|
|
58
|
+
const path = pluginName.startsWith("/")
|
|
59
|
+
? pluginName
|
|
60
|
+
: `${this.rootDir}/${pluginName}`;
|
|
61
|
+
const imported = await import(path);
|
|
62
|
+
return imported.default || imported;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Initialize all loaded plugins.
|
|
67
|
+
*/
|
|
68
|
+
async initialize() {
|
|
69
|
+
if (!this.initialized) {
|
|
70
|
+
throw new Error("Plugins must be loaded before initialization");
|
|
71
|
+
}
|
|
72
|
+
const context = {
|
|
73
|
+
config: this.config,
|
|
74
|
+
rootDir: this.rootDir,
|
|
75
|
+
mode: this.mode,
|
|
76
|
+
onHook: (stage, handler) => this.registerHook(stage, handler),
|
|
77
|
+
emitHook: (stage, context) => this.emitHook(stage, context),
|
|
78
|
+
};
|
|
79
|
+
for (const plugin of this.plugins) {
|
|
80
|
+
if (plugin.init) {
|
|
81
|
+
try {
|
|
82
|
+
await plugin.init(context);
|
|
83
|
+
log.info(`[Plugin] Initialized: ${plugin.name}`);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
log.error(
|
|
86
|
+
`[Plugin] Initialization failed for ${plugin.name}: ${error instanceof Error ? error.message : String(error)}`,
|
|
87
|
+
);
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Register plugin hooks
|
|
92
|
+
if (plugin.hooks) {
|
|
93
|
+
for (const [stage, handler] of Object.entries(plugin.hooks)) {
|
|
94
|
+
if (handler) {
|
|
95
|
+
this.registerHook(stage, handler);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Register a hook handler for a specific stage.
|
|
103
|
+
*/
|
|
104
|
+
registerHook(stage, handler) {
|
|
105
|
+
if (!this.hooks.has(stage)) {
|
|
106
|
+
this.hooks.set(stage, []);
|
|
107
|
+
}
|
|
108
|
+
this.hooks.get(stage).push(handler);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Emit a hook event, executing all registered handlers.
|
|
112
|
+
*/
|
|
113
|
+
async emitHook(stage, context) {
|
|
114
|
+
const handlers = this.hooks.get(stage) || [];
|
|
115
|
+
if (handlers.length === 0) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
// Execute hooks sequentially by default
|
|
120
|
+
for (const handler of handlers) {
|
|
121
|
+
try {
|
|
122
|
+
await handler(context);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
log.error(
|
|
125
|
+
`[Plugin Hook] Error in ${stage}: ${error instanceof Error ? error.message : String(error)}`,
|
|
126
|
+
);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
log.error(`[Plugin] Hook execution failed for stage: ${stage}`);
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get all registered plugins.
|
|
137
|
+
*/
|
|
138
|
+
getPlugins() {
|
|
139
|
+
return [...this.plugins];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get handlers for a specific hook stage.
|
|
143
|
+
*/
|
|
144
|
+
getHooks(stage) {
|
|
145
|
+
return this.hooks.get(stage) || [];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Check if a hook stage has handlers registered.
|
|
149
|
+
*/
|
|
150
|
+
hasHook(stage) {
|
|
151
|
+
return this.hooks.has(stage) && this.hooks.get(stage).length > 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Global plugin manager instance (singleton).
|
|
156
|
+
*/
|
|
157
|
+
let globalPluginManager = null;
|
|
158
|
+
/**
|
|
159
|
+
* Get or create the global plugin manager.
|
|
160
|
+
*/
|
|
161
|
+
export function getPluginManager(config, rootDir, mode) {
|
|
162
|
+
if (!globalPluginManager) {
|
|
163
|
+
if (!config || !rootDir) {
|
|
164
|
+
throw new Error(
|
|
165
|
+
"Plugin manager not initialized. Call getPluginManager with config and rootDir",
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
globalPluginManager = new PluginManager(config, rootDir, mode);
|
|
169
|
+
}
|
|
170
|
+
return globalPluginManager;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Reset the global plugin manager (for testing).
|
|
174
|
+
*/
|
|
175
|
+
export function resetPluginManager() {
|
|
176
|
+
globalPluginManager = null;
|
|
177
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin lifecycle and hook system.
|
|
3
|
+
* Plugins hook into key stages of build, dev, and request handling.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Hookable stages available to plugins.
|
|
7
|
+
*/
|
|
8
|
+
export var HookStage;
|
|
9
|
+
(function (HookStage) {
|
|
10
|
+
// Build lifecycle
|
|
11
|
+
HookStage["BEFORE_BUILD"] = "beforeBuild";
|
|
12
|
+
HookStage["AFTER_BUILD"] = "afterBuild";
|
|
13
|
+
HookStage["BEFORE_ASSET_OPTIMIZE"] = "beforeAssetOptimize";
|
|
14
|
+
HookStage["AFTER_ASSET_OPTIMIZE"] = "afterAssetOptimize";
|
|
15
|
+
HookStage["BEFORE_RENDER"] = "beforeRender";
|
|
16
|
+
HookStage["AFTER_RENDER"] = "afterRender";
|
|
17
|
+
// Request lifecycle
|
|
18
|
+
HookStage["BEFORE_REQUEST"] = "beforeRequest";
|
|
19
|
+
HookStage["AFTER_REQUEST"] = "afterRequest";
|
|
20
|
+
// Response generation
|
|
21
|
+
HookStage["BEFORE_RESPONSE"] = "beforeResponse";
|
|
22
|
+
HookStage["AFTER_RESPONSE"] = "afterResponse";
|
|
23
|
+
// Cache operations
|
|
24
|
+
HookStage["BEFORE_CACHE"] = "beforeCache";
|
|
25
|
+
HookStage["AFTER_CACHE"] = "afterCache";
|
|
26
|
+
// Custom stage (plugins can register their own)
|
|
27
|
+
HookStage["CUSTOM"] = "custom";
|
|
28
|
+
})(HookStage || (HookStage = {}));
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Jen.js.
|
|
3
|
-
* Copyright (C) 2026 oopsio
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
1
|
/**
|
|
19
2
|
* Retrieve framework data injected by the server into the page HTML.
|
|
20
3
|
* The server embeds loader result data, route params, and query parameters
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Jen.js.
|
|
3
|
-
* Copyright (C) 2026 oopsio
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
1
|
/**
|
|
19
2
|
* Client-side Hot Module Replacement (HMR) / Live Reload code.
|
|
20
3
|
* This script is injected into the browser during development mode.
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Jen.js.
|
|
3
|
-
* Copyright (C) 2026 oopsio
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
1
|
import { hydrate } from "preact";
|
|
19
2
|
import { h } from "preact";
|
|
20
3
|
import { getFrameworkData } from "./client-runtime.js";
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Jen.js.
|
|
3
|
-
* Copyright (C) 2026 oopsio
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
1
|
import { hydrate } from "preact";
|
|
19
2
|
import { h } from "preact";
|
|
20
3
|
/**
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of Jen.js.
|
|
3
|
-
* Copyright (C) 2026 oopsio
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
1
|
/**
|
|
19
2
|
* Mark a component as an interactive island for partial hydration.
|
|
20
3
|
* Islands are components that require client-side interactivity while the rest of the page
|