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,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Jen.js.
|
|
3
|
+
* Copyright (C) 2026 oopsio
|
|
4
|
+
*/
|
|
5
|
+
export class EventLogger {
|
|
6
|
+
logs = [];
|
|
7
|
+
maxLogs = 1000;
|
|
8
|
+
log(source, type, data) {
|
|
9
|
+
const entry = {
|
|
10
|
+
id: Math.random().toString(36).substr(2, 9),
|
|
11
|
+
timestamp: Date.now(),
|
|
12
|
+
source,
|
|
13
|
+
type: type,
|
|
14
|
+
message: this.serializeMessage(data),
|
|
15
|
+
data,
|
|
16
|
+
};
|
|
17
|
+
this.logs.push(entry);
|
|
18
|
+
// Keep only the last N logs
|
|
19
|
+
if (this.logs.length > this.maxLogs) {
|
|
20
|
+
this.logs.shift();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
getLogs() {
|
|
24
|
+
return [...this.logs];
|
|
25
|
+
}
|
|
26
|
+
getLogsSince(timestamp) {
|
|
27
|
+
return this.logs.filter((log) => log.timestamp >= timestamp);
|
|
28
|
+
}
|
|
29
|
+
getLogsBySource(source) {
|
|
30
|
+
return this.logs.filter((log) => log.source === source);
|
|
31
|
+
}
|
|
32
|
+
getLogsByType(type) {
|
|
33
|
+
return this.logs.filter((log) => log.type === type);
|
|
34
|
+
}
|
|
35
|
+
clear() {
|
|
36
|
+
this.logs = [];
|
|
37
|
+
}
|
|
38
|
+
search(query) {
|
|
39
|
+
const lowerQuery = query.toLowerCase();
|
|
40
|
+
return this.logs.filter(
|
|
41
|
+
(log) =>
|
|
42
|
+
log.source.toLowerCase().includes(lowerQuery) ||
|
|
43
|
+
log.message.toLowerCase().includes(lowerQuery),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
serializeMessage(data) {
|
|
47
|
+
if (Array.isArray(data)) {
|
|
48
|
+
return data.map((d) => this.serializeValue(d)).join(" ");
|
|
49
|
+
}
|
|
50
|
+
return this.serializeValue(data);
|
|
51
|
+
}
|
|
52
|
+
serializeValue(value) {
|
|
53
|
+
if (value === null) return "null";
|
|
54
|
+
if (value === undefined) return "undefined";
|
|
55
|
+
if (typeof value === "string") return value;
|
|
56
|
+
if (typeof value === "number") return String(value);
|
|
57
|
+
if (typeof value === "boolean") return String(value);
|
|
58
|
+
if (typeof value === "object") {
|
|
59
|
+
try {
|
|
60
|
+
return JSON.stringify(value);
|
|
61
|
+
} catch {
|
|
62
|
+
return "[Object]";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return String(value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { DevTools, initDevTools, getDevTools } from "./devtools.js";
|
|
2
|
+
export { getHTML, getStyles, injectStyles } from "./ui.js";
|
|
3
|
+
export { createEventBus } from "./event-bus.js";
|
|
4
|
+
export { PersistenceManager } from "./persistence.js";
|
|
5
|
+
export { ComponentTreeManager } from "./component-tree.js";
|
|
6
|
+
export { EventLogger } from "./event-logger.js";
|
|
7
|
+
export { PerformanceMonitor } from "./performance.js";
|
|
8
|
+
export { SearchManager } from "./search.js";
|
|
9
|
+
export { PluginSystem, createPlugin } from "./plugins.js";
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Jen.js.
|
|
3
|
+
* Copyright (C) 2026 oopsio
|
|
4
|
+
*/
|
|
5
|
+
import { injectStyles } from "./ui.js";
|
|
6
|
+
/**
|
|
7
|
+
* Enhanced component wrapper that automatically registers with DevTools
|
|
8
|
+
*/
|
|
9
|
+
export function withDevTools(Component, devtools) {
|
|
10
|
+
return function WrappedComponent(props) {
|
|
11
|
+
const id = `${Component.name}-${Math.random().toString(36).substr(2, 9)}`;
|
|
12
|
+
// Get the rendered element ref
|
|
13
|
+
let el = null;
|
|
14
|
+
// Register component with DevTools
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
const element = document.querySelector(`[data-component-id="${id}"]`);
|
|
17
|
+
if (element) {
|
|
18
|
+
el = element;
|
|
19
|
+
devtools.registerComponent(
|
|
20
|
+
id,
|
|
21
|
+
Component.name || "Anonymous",
|
|
22
|
+
el,
|
|
23
|
+
props,
|
|
24
|
+
{},
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}, 0);
|
|
28
|
+
// Render original component with tracking div
|
|
29
|
+
return {
|
|
30
|
+
vnode: Component(props),
|
|
31
|
+
wrapper: id,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Hook for tracking state updates in components
|
|
37
|
+
*/
|
|
38
|
+
export function useDevToolsIntegration(componentName, devtools) {
|
|
39
|
+
const id = `${componentName}-${Math.random().toString(36).substr(2, 9)}`;
|
|
40
|
+
return {
|
|
41
|
+
componentId: id,
|
|
42
|
+
trackState: (state) => {
|
|
43
|
+
devtools.updateComponentState(id, state);
|
|
44
|
+
},
|
|
45
|
+
trackEvent: (eventName, data) => {
|
|
46
|
+
devtools.logEvent(id, eventName, data);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Auto-initialize DevTools on the page
|
|
52
|
+
*/
|
|
53
|
+
export function autoInitDevTools(options) {
|
|
54
|
+
// Only enable in development
|
|
55
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "production") {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
// Inject styles
|
|
59
|
+
injectStyles();
|
|
60
|
+
// Dynamic import to avoid circular dependencies
|
|
61
|
+
return import("./devtools.js").then(({ initDevTools }) => {
|
|
62
|
+
return initDevTools({
|
|
63
|
+
enabled: options?.enabled ?? true,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a monitored event listener
|
|
69
|
+
*/
|
|
70
|
+
export function createMonitoredListener(
|
|
71
|
+
devtools,
|
|
72
|
+
componentId,
|
|
73
|
+
eventName,
|
|
74
|
+
handler,
|
|
75
|
+
) {
|
|
76
|
+
return (event) => {
|
|
77
|
+
devtools.logEvent(componentId, eventName, {
|
|
78
|
+
type: event.type,
|
|
79
|
+
target: event.target?.tagName,
|
|
80
|
+
timestamp: Date.now(),
|
|
81
|
+
});
|
|
82
|
+
handler(event);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Monitor DOM mutations for a component
|
|
87
|
+
*/
|
|
88
|
+
export function monitorDOMChanges(devtools, componentId, element) {
|
|
89
|
+
const observer = new MutationObserver((mutations) => {
|
|
90
|
+
mutations.forEach((mutation) => {
|
|
91
|
+
devtools.logEvent(componentId, "dom-mutation", {
|
|
92
|
+
type: mutation.type,
|
|
93
|
+
target:
|
|
94
|
+
mutation.target instanceof HTMLElement
|
|
95
|
+
? mutation.target.tagName
|
|
96
|
+
: "unknown",
|
|
97
|
+
addedNodes: mutation.addedNodes.length,
|
|
98
|
+
removedNodes: mutation.removedNodes.length,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
observer.observe(element, {
|
|
103
|
+
attributes: true,
|
|
104
|
+
childList: true,
|
|
105
|
+
subtree: true,
|
|
106
|
+
characterData: true,
|
|
107
|
+
});
|
|
108
|
+
return observer;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create a devtools-aware logging function
|
|
112
|
+
*/
|
|
113
|
+
export function createLogger(devtools, componentId) {
|
|
114
|
+
return {
|
|
115
|
+
log: (...args) => {
|
|
116
|
+
console.log(...args);
|
|
117
|
+
devtools.logEvent(componentId, "console:log", args);
|
|
118
|
+
},
|
|
119
|
+
error: (...args) => {
|
|
120
|
+
console.error(...args);
|
|
121
|
+
devtools.logEvent(componentId, "console:error", args);
|
|
122
|
+
},
|
|
123
|
+
warn: (...args) => {
|
|
124
|
+
console.warn(...args);
|
|
125
|
+
devtools.logEvent(componentId, "console:warn", args);
|
|
126
|
+
},
|
|
127
|
+
debug: (...args) => {
|
|
128
|
+
console.debug?.(...args);
|
|
129
|
+
devtools.logEvent(componentId, "console:debug", args);
|
|
130
|
+
},
|
|
131
|
+
info: (...args) => {
|
|
132
|
+
console.info?.(...args);
|
|
133
|
+
devtools.logEvent(componentId, "console:info", args);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Monitor performance of a component render
|
|
139
|
+
*/
|
|
140
|
+
export function measureComponentRender(devtools, componentName, renderFn) {
|
|
141
|
+
const start = performance.now();
|
|
142
|
+
const result = renderFn();
|
|
143
|
+
const duration = performance.now() - start;
|
|
144
|
+
devtools.logEvent(componentName, "render", {
|
|
145
|
+
duration,
|
|
146
|
+
timestamp: Date.now(),
|
|
147
|
+
});
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Jen.js.
|
|
3
|
+
* Copyright (C) 2026 oopsio
|
|
4
|
+
*/
|
|
5
|
+
export class PerformanceMonitor {
|
|
6
|
+
fps = [];
|
|
7
|
+
renderTimes = [];
|
|
8
|
+
updateCount = 0;
|
|
9
|
+
startTime = performance.now();
|
|
10
|
+
maxMetrics = 60; // Keep 60 data points
|
|
11
|
+
start() {
|
|
12
|
+
// Monitor performance periodically
|
|
13
|
+
setInterval(() => {
|
|
14
|
+
this.recordMetrics();
|
|
15
|
+
}, 1000);
|
|
16
|
+
}
|
|
17
|
+
recordFPS(fps) {
|
|
18
|
+
this.fps.push(fps);
|
|
19
|
+
if (this.fps.length > this.maxMetrics) {
|
|
20
|
+
this.fps.shift();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
recordRenderTime(duration) {
|
|
24
|
+
this.renderTimes.push(duration);
|
|
25
|
+
if (this.renderTimes.length > this.maxMetrics) {
|
|
26
|
+
this.renderTimes.shift();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
recordUpdate() {
|
|
30
|
+
this.updateCount++;
|
|
31
|
+
}
|
|
32
|
+
recordMetrics() {
|
|
33
|
+
// Record memory usage if available
|
|
34
|
+
const memory = performance.memory;
|
|
35
|
+
if (memory) {
|
|
36
|
+
// Memory is in bytes, convert to MB
|
|
37
|
+
const memoryMb = Math.round(memory.usedJSHeapSize / 1024 / 1024);
|
|
38
|
+
return {
|
|
39
|
+
fps: [...this.fps],
|
|
40
|
+
renderTime: [...this.renderTimes],
|
|
41
|
+
updateCount: this.updateCount,
|
|
42
|
+
memoryUsage: memoryMb,
|
|
43
|
+
timestamp: performance.now() - this.startTime,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
getMetrics() {
|
|
48
|
+
const memory = performance.memory;
|
|
49
|
+
const memoryMb = memory
|
|
50
|
+
? Math.round(memory.usedJSHeapSize / 1024 / 1024)
|
|
51
|
+
: 0;
|
|
52
|
+
return {
|
|
53
|
+
fps: [...this.fps],
|
|
54
|
+
renderTime: [...this.renderTimes],
|
|
55
|
+
updateCount: this.updateCount,
|
|
56
|
+
memoryUsage: memoryMb,
|
|
57
|
+
timestamp: performance.now() - this.startTime,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
getAverageFPS() {
|
|
61
|
+
if (this.fps.length === 0) return 0;
|
|
62
|
+
return Math.round(this.fps.reduce((a, b) => a + b, 0) / this.fps.length);
|
|
63
|
+
}
|
|
64
|
+
getAverageRenderTime() {
|
|
65
|
+
if (this.renderTimes.length === 0) return 0;
|
|
66
|
+
return Math.round(
|
|
67
|
+
this.renderTimes.reduce((a, b) => a + b, 0) / this.renderTimes.length,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
getLastFPS() {
|
|
71
|
+
return this.fps.length > 0 ? this.fps[this.fps.length - 1] : 0;
|
|
72
|
+
}
|
|
73
|
+
getLastRenderTime() {
|
|
74
|
+
return this.renderTimes.length > 0
|
|
75
|
+
? this.renderTimes[this.renderTimes.length - 1]
|
|
76
|
+
: 0;
|
|
77
|
+
}
|
|
78
|
+
reset() {
|
|
79
|
+
this.fps = [];
|
|
80
|
+
this.renderTimes = [];
|
|
81
|
+
this.updateCount = 0;
|
|
82
|
+
this.startTime = performance.now();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Jen.js.
|
|
3
|
+
* Copyright (C) 2026 oopsio
|
|
4
|
+
*/
|
|
5
|
+
const STORAGE_KEY = "__jen_devtools_config__";
|
|
6
|
+
export class PersistenceManager {
|
|
7
|
+
loadConfig() {
|
|
8
|
+
try {
|
|
9
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
10
|
+
return stored ? JSON.parse(stored) : {};
|
|
11
|
+
} catch {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
saveConfig(config) {
|
|
16
|
+
try {
|
|
17
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.error("Failed to save DevTools config:", e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
loadComponentState(componentId) {
|
|
23
|
+
try {
|
|
24
|
+
const stored = localStorage.getItem(`__jen_component_${componentId}__`);
|
|
25
|
+
return stored ? JSON.parse(stored) : null;
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
saveComponentState(componentId, state) {
|
|
31
|
+
try {
|
|
32
|
+
localStorage.setItem(
|
|
33
|
+
`__jen_component_${componentId}__`,
|
|
34
|
+
JSON.stringify(state),
|
|
35
|
+
);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error("Failed to save component state:", e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
clearComponentState(componentId) {
|
|
41
|
+
try {
|
|
42
|
+
localStorage.removeItem(`__jen_component_${componentId}__`);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.error("Failed to clear component state:", e);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
clearAll() {
|
|
48
|
+
try {
|
|
49
|
+
const keys = Object.keys(localStorage).filter((k) =>
|
|
50
|
+
k.startsWith("__jen_"),
|
|
51
|
+
);
|
|
52
|
+
keys.forEach((key) => localStorage.removeItem(key));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error("Failed to clear storage:", e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Jen.js.
|
|
3
|
+
* Copyright (C) 2026 oopsio
|
|
4
|
+
*/
|
|
5
|
+
export class PluginSystem {
|
|
6
|
+
plugins = new Map();
|
|
7
|
+
factories = new Map();
|
|
8
|
+
eventBus;
|
|
9
|
+
constructor(eventBus) {
|
|
10
|
+
this.eventBus = eventBus;
|
|
11
|
+
}
|
|
12
|
+
register(name, factory) {
|
|
13
|
+
if (this.plugins.has(name)) {
|
|
14
|
+
console.warn(`Plugin "${name}" is already registered`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.factories.set(name, factory);
|
|
18
|
+
this.eventBus.emit("plugin:registered", { name });
|
|
19
|
+
}
|
|
20
|
+
load(name, devtools) {
|
|
21
|
+
if (this.plugins.has(name)) {
|
|
22
|
+
console.warn(`Plugin "${name}" is already loaded`);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const factory = this.factories.get(name);
|
|
26
|
+
if (!factory) {
|
|
27
|
+
console.error(`Plugin "${name}" not found`);
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const plugin = factory(devtools);
|
|
32
|
+
plugin.setup();
|
|
33
|
+
this.plugins.set(name, plugin);
|
|
34
|
+
this.eventBus.emit("plugin:loaded", { name });
|
|
35
|
+
return true;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error(`Failed to load plugin "${name}":`, e);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
unload(name) {
|
|
42
|
+
const plugin = this.plugins.get(name);
|
|
43
|
+
if (!plugin) {
|
|
44
|
+
console.warn(`Plugin "${name}" is not loaded`);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
if (plugin.teardown) {
|
|
49
|
+
plugin.teardown();
|
|
50
|
+
}
|
|
51
|
+
this.plugins.delete(name);
|
|
52
|
+
this.eventBus.emit("plugin:unloaded", { name });
|
|
53
|
+
return true;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.error(`Failed to unload plugin "${name}":`, e);
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
get(name) {
|
|
60
|
+
return this.plugins.get(name);
|
|
61
|
+
}
|
|
62
|
+
getAll() {
|
|
63
|
+
return Array.from(this.plugins.values());
|
|
64
|
+
}
|
|
65
|
+
getRegistered() {
|
|
66
|
+
return Array.from(this.factories.keys());
|
|
67
|
+
}
|
|
68
|
+
loadAll(devtools) {
|
|
69
|
+
let allSuccess = true;
|
|
70
|
+
for (const name of this.factories.keys()) {
|
|
71
|
+
if (!this.load(name, devtools)) {
|
|
72
|
+
allSuccess = false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return allSuccess;
|
|
76
|
+
}
|
|
77
|
+
unloadAll() {
|
|
78
|
+
let allSuccess = true;
|
|
79
|
+
for (const name of Array.from(this.plugins.keys())) {
|
|
80
|
+
if (!this.unload(name)) {
|
|
81
|
+
allSuccess = false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return allSuccess;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a custom plugin easily
|
|
89
|
+
*/
|
|
90
|
+
export function createPlugin(config) {
|
|
91
|
+
return () => ({
|
|
92
|
+
name: config.name,
|
|
93
|
+
version: config.version,
|
|
94
|
+
setup: config.setup,
|
|
95
|
+
teardown: config.teardown,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Jen.js.
|
|
3
|
+
* Copyright (C) 2026 oopsio
|
|
4
|
+
*/
|
|
5
|
+
export class SearchManager {
|
|
6
|
+
tree;
|
|
7
|
+
constructor(tree) {
|
|
8
|
+
this.tree = tree;
|
|
9
|
+
}
|
|
10
|
+
search(query) {
|
|
11
|
+
if (!query || query.length === 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const lowerQuery = query.toLowerCase();
|
|
15
|
+
const allComponents = this.tree.getAllComponents();
|
|
16
|
+
return allComponents.filter((component) => {
|
|
17
|
+
// Search by component name
|
|
18
|
+
if (component.name.toLowerCase().includes(lowerQuery)) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
// Search by component type
|
|
22
|
+
if (component.type.toLowerCase().includes(lowerQuery)) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
// Search by props
|
|
26
|
+
for (const [key, value] of Object.entries(component.props)) {
|
|
27
|
+
if (
|
|
28
|
+
key.toLowerCase().includes(lowerQuery) ||
|
|
29
|
+
this.valueMatches(value, lowerQuery)
|
|
30
|
+
) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Search by state
|
|
35
|
+
for (const [key, value] of Object.entries(component.state)) {
|
|
36
|
+
if (
|
|
37
|
+
key.toLowerCase().includes(lowerQuery) ||
|
|
38
|
+
this.valueMatches(value, lowerQuery)
|
|
39
|
+
) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
valueMatches(value, query) {
|
|
47
|
+
if (value === null || value === undefined) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (typeof value === "string") {
|
|
51
|
+
return value.toLowerCase().includes(query);
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
54
|
+
return String(value).toLowerCase().includes(query);
|
|
55
|
+
}
|
|
56
|
+
if (typeof value === "object") {
|
|
57
|
+
try {
|
|
58
|
+
const json = JSON.stringify(value).toLowerCase();
|
|
59
|
+
return json.includes(query);
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
searchByName(name) {
|
|
67
|
+
const lowerName = name.toLowerCase();
|
|
68
|
+
return this.tree
|
|
69
|
+
.getAllComponents()
|
|
70
|
+
.filter((c) => c.name.toLowerCase().includes(lowerName));
|
|
71
|
+
}
|
|
72
|
+
searchByType(type) {
|
|
73
|
+
const lowerType = type.toLowerCase();
|
|
74
|
+
return this.tree
|
|
75
|
+
.getAllComponents()
|
|
76
|
+
.filter((c) => c.type.toLowerCase().includes(lowerType));
|
|
77
|
+
}
|
|
78
|
+
searchByProp(propName, propValue) {
|
|
79
|
+
return this.tree.getAllComponents().filter((c) => {
|
|
80
|
+
if (!(propName in c.props)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (propValue === undefined) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return c.props[propName] === propValue;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|