@wrikka/solid-framework 0.0.0-stage → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -3
- package/dist/vite.d.ts +661 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +10 -0
- package/dist/vite.js.map +1 -0
- package/package.json +247 -5
- package/src/actions/index.ts +5 -0
- package/src/actions/modules/action/adapters/http/handler.ts +80 -0
- package/src/actions/modules/action/application/index.ts +1 -0
- package/src/actions/modules/action/application/usecases/create-action.ts +92 -0
- package/src/actions/modules/action/application/usecases/index.ts +2 -0
- package/src/actions/modules/action/application/usecases/registry.ts +20 -0
- package/src/actions/modules/action/index.ts +2 -0
- package/src/actions/presentation/index.ts +1 -0
- package/src/actions/presentation/useSubmission.ts +46 -0
- package/src/actions/types/index.ts +35 -0
- package/src/app/index.ts +126 -0
- package/src/app/modules/ai/domain/operations/handler.ts +46 -0
- package/src/app/modules/ai/domain/operations/llms.ts +54 -0
- package/src/app/modules/ai/domain/operations/mcp.ts +134 -0
- package/src/app/modules/ai/index.ts +3 -0
- package/src/app/modules/api-docs/domain/operations/openapi.ts +113 -0
- package/src/app/modules/api-docs/index.ts +1 -0
- package/src/app/modules/app-def/index.ts +225 -0
- package/src/app/modules/auth/application/usecases/auth.ts +161 -0
- package/src/app/modules/auth/application/usecases/oauth.ts +105 -0
- package/src/app/modules/auth/index.ts +2 -0
- package/src/app/modules/cache/adapters/edge-kv.ts +55 -0
- package/src/app/modules/cache/adapters/fs.ts +58 -0
- package/src/app/modules/cache/adapters/memory.ts +13 -0
- package/src/app/modules/cache/domain/operations/tags.ts +114 -0
- package/src/app/modules/cache/index.ts +7 -0
- package/src/app/modules/cache/ports/store.ts +14 -0
- package/src/app/modules/config/domain/index.ts +1 -0
- package/src/app/modules/config/domain/models/config.ts +72 -0
- package/src/app/modules/config/domain/models/index.ts +1 -0
- package/src/app/modules/config/index.ts +1 -0
- package/src/app/modules/content/domain/operations/collection.ts +109 -0
- package/src/app/modules/content/index.ts +8 -0
- package/src/app/modules/content/presentation/Markdown.tsx +78 -0
- package/src/app/modules/conventions/domain/index.ts +1 -0
- package/src/app/modules/conventions/domain/operations/index.ts +1 -0
- package/src/app/modules/conventions/domain/operations/scan.ts +73 -0
- package/src/app/modules/conventions/index.ts +1 -0
- package/src/app/modules/db/application/usecases/db.ts +49 -0
- package/src/app/modules/db/index.ts +1 -0
- package/src/app/modules/deploy/adapters/aws-lambda.ts +54 -0
- package/src/app/modules/deploy/adapters/bun.ts +15 -0
- package/src/app/modules/deploy/adapters/cloudflare.ts +15 -0
- package/src/app/modules/deploy/adapters/deno.ts +15 -0
- package/src/app/modules/deploy/adapters/netlify.ts +18 -0
- package/src/app/modules/deploy/adapters/node.ts +63 -0
- package/src/app/modules/deploy/adapters/vercel.ts +22 -0
- package/src/app/modules/deploy/domain/models/preset.ts +38 -0
- package/src/app/modules/deploy/domain/operations/presets.ts +92 -0
- package/src/app/modules/deploy/index.ts +9 -0
- package/src/app/modules/draft/domain/operations/draft-mode.ts +125 -0
- package/src/app/modules/draft/index.ts +1 -0
- package/src/app/modules/env/domain/operations/create-env.ts +156 -0
- package/src/app/modules/env/index.ts +1 -0
- package/src/app/modules/file-routes/application/usecases/api-client.ts +120 -0
- package/src/app/modules/file-routes/domain/errors.ts +61 -0
- package/src/app/modules/file-routes/domain/index.ts +63 -0
- package/src/app/modules/file-routes/domain/models/index.ts +1 -0
- package/src/app/modules/file-routes/domain/models/route.ts +38 -0
- package/src/app/modules/file-routes/domain/operations/actions.ts +107 -0
- package/src/app/modules/file-routes/domain/operations/api.ts +87 -0
- package/src/app/modules/file-routes/domain/operations/codegen.ts +76 -0
- package/src/app/modules/file-routes/domain/operations/content.ts +61 -0
- package/src/app/modules/file-routes/domain/operations/defer.ts +245 -0
- package/src/app/modules/file-routes/domain/operations/index.ts +65 -0
- package/src/app/modules/file-routes/domain/operations/loader.ts +138 -0
- package/src/app/modules/file-routes/domain/operations/manifest.ts +229 -0
- package/src/app/modules/file-routes/domain/operations/match.ts +75 -0
- package/src/app/modules/file-routes/domain/operations/static-params.ts +58 -0
- package/src/app/modules/file-routes/domain/operations/typed.ts +127 -0
- package/src/app/modules/file-routes/index.ts +143 -0
- package/src/app/modules/file-routes/presentation/DevtoolsOverlay.tsx +234 -0
- package/src/app/modules/file-routes/presentation/FileRoutes.ts +254 -0
- package/src/app/modules/file-routes/presentation/Form.tsx +122 -0
- package/src/app/modules/file-routes/presentation/Link.tsx +132 -0
- package/src/app/modules/file-routes/presentation/ServerComponent.tsx +100 -0
- package/src/app/modules/file-routes/presentation/content-page.tsx +26 -0
- package/src/app/modules/file-routes/presentation/dev-events.ts +112 -0
- package/src/app/modules/file-routes/presentation/index.ts +98 -0
- package/src/app/modules/file-routes/presentation/loader-cache.ts +96 -0
- package/src/app/modules/file-routes/presentation/loader-data.ts +207 -0
- package/src/app/modules/file-routes/presentation/location.ts +217 -0
- package/src/app/modules/file-routes/presentation/normalize-route.ts +155 -0
- package/src/app/modules/file-routes/presentation/page-tree.ts +211 -0
- package/src/app/modules/file-routes/presentation/route-contexts.ts +89 -0
- package/src/app/modules/file-routes/presentation/route-def.ts +154 -0
- package/src/app/modules/file-routes/presentation/route-fallbacks.ts +66 -0
- package/src/app/modules/file-routes/presentation/route-modules.ts +138 -0
- package/src/app/modules/file-routes/presentation/slot.tsx +43 -0
- package/src/app/modules/file-routes/presentation/status.ts +13 -0
- package/src/app/modules/file-routes/presentation/use-action.ts +81 -0
- package/src/app/modules/file-routes/presentation/use-optimistic.ts +50 -0
- package/src/app/modules/file-routes/presentation/use-preload.ts +38 -0
- package/src/app/modules/file-routes/presentation/use-route.ts +254 -0
- package/src/app/modules/flash/domain/operations/flash.ts +70 -0
- package/src/app/modules/flash/index.ts +1 -0
- package/src/app/modules/fonts/domain/operations/font.ts +91 -0
- package/src/app/modules/fonts/index.ts +1 -0
- package/src/app/modules/i18n/domain/operations/i18n-middleware.ts +76 -0
- package/src/app/modules/i18n/domain/operations/locale.ts +39 -0
- package/src/app/modules/i18n/index.ts +3 -0
- package/src/app/modules/i18n/presentation/use-locale.ts +16 -0
- package/src/app/modules/middleware/domain/operations/request-id.ts +33 -0
- package/src/app/modules/middleware/domain/operations/run.ts +29 -0
- package/src/app/modules/middleware/index.ts +7 -0
- package/src/app/modules/route-rules/domain/index.ts +1 -0
- package/src/app/modules/route-rules/domain/operations/ab-variant.ts +58 -0
- package/src/app/modules/route-rules/domain/operations/index.ts +4 -0
- package/src/app/modules/route-rules/domain/operations/match.ts +51 -0
- package/src/app/modules/route-rules/domain/operations/rate-limit.ts +63 -0
- package/src/app/modules/route-rules/domain/operations/security.ts +67 -0
- package/src/app/modules/route-rules/index.ts +1 -0
- package/src/app/modules/runtime-config/application/index.ts +1 -0
- package/src/app/modules/runtime-config/application/usecases/index.ts +1 -0
- package/src/app/modules/runtime-config/application/usecases/runtime-config.ts +42 -0
- package/src/app/modules/runtime-config/index.ts +1 -0
- package/src/app/modules/seo/domain/operations/og.ts +66 -0
- package/src/app/modules/seo/domain/operations/site.ts +106 -0
- package/src/app/modules/seo/index.ts +2 -0
- package/src/app/modules/server-entry/application/index.ts +1 -0
- package/src/app/modules/server-entry/application/usecases/create-app-server.ts +205 -0
- package/src/app/modules/server-entry/application/usecases/devtools-handler.ts +31 -0
- package/src/app/modules/server-entry/application/usecases/image-handler.ts +38 -0
- package/src/app/modules/server-entry/application/usecases/index.ts +3 -0
- package/src/app/modules/server-entry/application/usecases/ops-handler.ts +55 -0
- package/src/app/modules/server-entry/application/usecases/prerender-cache.ts +59 -0
- package/src/app/modules/server-entry/application/usecases/route-render.ts +276 -0
- package/src/app/modules/server-entry/application/usecases/routed-entry.ts +194 -0
- package/src/app/modules/server-entry/application/usecases/static-handler.ts +20 -0
- package/src/app/modules/server-entry/application/usecases/zone-handler.ts +37 -0
- package/src/app/modules/server-entry/index.ts +1 -0
- package/src/app/modules/session/index.ts +77 -0
- package/src/app/modules/static/domain/operations/serve.ts +88 -0
- package/src/app/modules/static/index.ts +1 -0
- package/src/app/presentation/App.tsx +34 -0
- package/src/app/presentation/define-config.ts +11 -0
- package/src/app/presentation/index.ts +3 -0
- package/src/app/presentation/providers.ts +80 -0
- package/src/app/types/index.ts +273 -0
- package/src/assets/adapters/sharp.ts +83 -0
- package/src/assets/index.ts +6 -0
- package/src/assets/modules/assets/domain/index.ts +1 -0
- package/src/assets/modules/assets/domain/operations/image.ts +67 -0
- package/src/assets/modules/assets/domain/operations/index.ts +2 -0
- package/src/assets/modules/assets/domain/operations/manifest.ts +29 -0
- package/src/assets/modules/assets/index.ts +1 -0
- package/src/assets/presentation/Image.tsx +90 -0
- package/src/assets/presentation/index.ts +1 -0
- package/src/assets/types/index.ts +21 -0
- package/src/cli/bin.ts +8 -0
- package/src/cli/commands.ts +145 -0
- package/src/cli/doctor.ts +111 -0
- package/src/cli/index.ts +3 -0
- package/src/cli/infra.ts +38 -0
- package/src/cli/migrate.ts +119 -0
- package/src/cli/nav.ts +164 -0
- package/src/cli/ops.ts +135 -0
- package/src/cli/routes.ts +240 -0
- package/src/cli/scaffold.ts +217 -0
- package/src/devtools/App.tsx +14 -0
- package/src/devtools/adapters/connector.ts +23 -0
- package/src/devtools/adapters/index.ts +4 -0
- package/src/devtools/index.ts +26 -0
- package/src/devtools/modules/component-inspector/application/index.ts +4 -0
- package/src/devtools/modules/component-inspector/application/usecases/component-inspector.ts +67 -0
- package/src/devtools/modules/component-inspector/application/usecases/index.ts +5 -0
- package/src/devtools/modules/component-inspector/application/usecases/useComponentInspector.ts +52 -0
- package/src/devtools/modules/component-inspector/domain/events/component-events.ts +37 -0
- package/src/devtools/modules/component-inspector/domain/events/index.ts +4 -0
- package/src/devtools/modules/component-inspector/domain/index.ts +7 -0
- package/src/devtools/modules/component-inspector/domain/models/component-node.ts +30 -0
- package/src/devtools/modules/component-inspector/domain/models/component-tree.ts +20 -0
- package/src/devtools/modules/component-inspector/domain/models/index.ts +5 -0
- package/src/devtools/modules/component-inspector/domain/operations/component-operations.ts +63 -0
- package/src/devtools/modules/component-inspector/domain/operations/index.ts +4 -0
- package/src/devtools/modules/component-inspector/index.ts +7 -0
- package/src/devtools/modules/devtools/application/index.ts +4 -0
- package/src/devtools/modules/devtools/application/usecases/devtools.ts +60 -0
- package/src/devtools/modules/devtools/application/usecases/index.ts +5 -0
- package/src/devtools/modules/devtools/application/usecases/useDevtools.ts +47 -0
- package/src/devtools/modules/devtools/domain/events/devtools-events.ts +56 -0
- package/src/devtools/modules/devtools/domain/events/index.ts +4 -0
- package/src/devtools/modules/devtools/domain/index.ts +8 -0
- package/src/devtools/modules/devtools/domain/models/devtools-state.ts +15 -0
- package/src/devtools/modules/devtools/domain/models/index.ts +4 -0
- package/src/devtools/modules/devtools/domain/operations/devtools-operations.ts +27 -0
- package/src/devtools/modules/devtools/domain/operations/index.ts +4 -0
- package/src/devtools/modules/devtools/domain/validators/devtools-validators.ts +36 -0
- package/src/devtools/modules/devtools/domain/validators/index.ts +4 -0
- package/src/devtools/modules/devtools/index.ts +7 -0
- package/src/devtools/modules/devtools/ports/connector.ts +10 -0
- package/src/devtools/modules/devtools/ports/index.ts +4 -0
- package/src/devtools/modules/timeline/application/index.ts +4 -0
- package/src/devtools/modules/timeline/application/usecases/index.ts +5 -0
- package/src/devtools/modules/timeline/application/usecases/timeline.ts +61 -0
- package/src/devtools/modules/timeline/application/usecases/useTimeline.ts +37 -0
- package/src/devtools/modules/timeline/domain/events/index.ts +4 -0
- package/src/devtools/modules/timeline/domain/events/timeline-events.ts +34 -0
- package/src/devtools/modules/timeline/domain/index.ts +7 -0
- package/src/devtools/modules/timeline/domain/models/index.ts +4 -0
- package/src/devtools/modules/timeline/domain/models/timeline-event.ts +27 -0
- package/src/devtools/modules/timeline/domain/operations/index.ts +4 -0
- package/src/devtools/modules/timeline/domain/operations/timeline-operations.ts +28 -0
- package/src/devtools/modules/timeline/index.ts +7 -0
- package/src/devtools/presentation/DevtoolsPanel.tsx +80 -0
- package/src/devtools/presentation/components/ComponentTreeView.tsx +79 -0
- package/src/devtools/presentation/components/StateInspector.tsx +70 -0
- package/src/devtools/presentation/components/TimelineView.tsx +52 -0
- package/src/devtools/presentation/components/index.ts +7 -0
- package/src/devtools/presentation/composables/index.ts +7 -0
- package/src/devtools/presentation/composables/useComponentInspector.ts +52 -0
- package/src/devtools/presentation/index.ts +5 -0
- package/src/devtools/shared/errors/index.ts +23 -0
- package/src/devtools/shared/index.ts +7 -0
- package/src/devtools/shared/types/index.ts +6 -0
- package/src/devtools/shared/types/option.ts +58 -0
- package/src/devtools/shared/types/result.ts +53 -0
- package/src/devtools/shared/utils/index.ts +32 -0
- package/src/devtools/style.css +2 -0
- package/src/head/index.ts +5 -0
- package/src/head/modules/head/application/index.ts +1 -0
- package/src/head/modules/head/application/usecases/head-manager.ts +68 -0
- package/src/head/modules/head/application/usecases/index.ts +1 -0
- package/src/head/modules/head/domain/index.ts +3 -0
- package/src/head/modules/head/domain/models/head-tag.ts +73 -0
- package/src/head/modules/head/domain/models/index.ts +1 -0
- package/src/head/modules/head/domain/operations/dedupe.ts +18 -0
- package/src/head/modules/head/domain/operations/index.ts +2 -0
- package/src/head/modules/head/domain/operations/render-tags.ts +43 -0
- package/src/head/modules/head/domain/validators/index.ts +12 -0
- package/src/head/modules/head/index.ts +3 -0
- package/src/head/modules/head/ports/index.ts +11 -0
- package/src/head/presentation/HeadProvider.tsx +42 -0
- package/src/head/presentation/Tags.tsx +90 -0
- package/src/head/presentation/head-context.ts +11 -0
- package/src/head/presentation/index.ts +3 -0
- package/src/head/presentation/useHead.ts +77 -0
- package/src/head/shared/index.ts +1 -0
- package/src/head/shared/types/index.ts +5 -0
- package/src/head/types/index.ts +47 -0
- package/src/hooks/adapters/config/constants.ts +12 -0
- package/src/hooks/adapters/config/index.ts +48 -0
- package/src/hooks/adapters/index.ts +13 -0
- package/src/hooks/adapters/monaco/index.ts +96 -0
- package/src/hooks/adapters/qr/index.ts +65 -0
- package/src/hooks/index.ts +21 -0
- package/src/hooks/modules/array/application/index.ts +2 -0
- package/src/hooks/modules/array/application/usecases/index.ts +123 -0
- package/src/hooks/modules/array/domain/events/index.ts +5 -0
- package/src/hooks/modules/array/domain/index.ts +3 -0
- package/src/hooks/modules/array/domain/models/index.ts +2 -0
- package/src/hooks/modules/array/domain/operations/create.ts +10 -0
- package/src/hooks/modules/array/domain/operations/index.ts +31 -0
- package/src/hooks/modules/array/domain/operations/modify.ts +61 -0
- package/src/hooks/modules/array/domain/operations/query.ts +36 -0
- package/src/hooks/modules/array/domain/validators/index.ts +5 -0
- package/src/hooks/modules/array/index.ts +5 -0
- package/src/hooks/modules/array/types/index.ts +9 -0
- package/src/hooks/modules/counter/application/index.ts +12 -0
- package/src/hooks/modules/counter/application/usecases/index.ts +156 -0
- package/src/hooks/modules/counter/domain/events/index.ts +6 -0
- package/src/hooks/modules/counter/domain/index.ts +21 -0
- package/src/hooks/modules/counter/domain/models/index.ts +2 -0
- package/src/hooks/modules/counter/domain/operations/calculate.ts +22 -0
- package/src/hooks/modules/counter/domain/operations/create.ts +22 -0
- package/src/hooks/modules/counter/domain/operations/index.ts +25 -0
- package/src/hooks/modules/counter/domain/operations/modify.ts +78 -0
- package/src/hooks/modules/counter/domain/operations/query.ts +38 -0
- package/src/hooks/modules/counter/domain/operations/validate.ts +58 -0
- package/src/hooks/modules/counter/domain/validators/counter-validators.ts +19 -0
- package/src/hooks/modules/counter/domain/validators/index.ts +2 -0
- package/src/hooks/modules/counter/index.ts +6 -0
- package/src/hooks/modules/counter/ports/index.ts +7 -0
- package/src/hooks/modules/counter/types/index.ts +13 -0
- package/src/hooks/modules/editor/application/index.ts +6 -0
- package/src/hooks/modules/editor/application/useCodeEditor.ts +81 -0
- package/src/hooks/modules/editor/domain/events/editor-events.ts +16 -0
- package/src/hooks/modules/editor/domain/events/index.ts +6 -0
- package/src/hooks/modules/editor/domain/index.ts +7 -0
- package/src/hooks/modules/editor/domain/models/editor.ts +16 -0
- package/src/hooks/modules/editor/domain/models/index.ts +6 -0
- package/src/hooks/modules/editor/domain/validators/index.ts +34 -0
- package/src/hooks/modules/editor/index.ts +8 -0
- package/src/hooks/modules/editor/types/index.ts +34 -0
- package/src/hooks/modules/sensor/application/index.ts +2 -0
- package/src/hooks/modules/sensor/application/usecases/index.ts +25 -0
- package/src/hooks/modules/sensor/domain/events/index.ts +12 -0
- package/src/hooks/modules/sensor/domain/index.ts +10 -0
- package/src/hooks/modules/sensor/domain/models/index.ts +7 -0
- package/src/hooks/modules/sensor/domain/operations/gamepad.ts +16 -0
- package/src/hooks/modules/sensor/domain/operations/index.ts +12 -0
- package/src/hooks/modules/sensor/domain/operations/motion.ts +10 -0
- package/src/hooks/modules/sensor/domain/operations/orientation.ts +10 -0
- package/src/hooks/modules/sensor/domain/validators/index.ts +2 -0
- package/src/hooks/modules/sensor/index.ts +10 -0
- package/src/hooks/modules/sensor/ports/index.ts +8 -0
- package/src/hooks/modules/sensor/types/index.ts +29 -0
- package/src/hooks/modules/storage/application/index.ts +2 -0
- package/src/hooks/modules/storage/application/usecases/index.ts +18 -0
- package/src/hooks/modules/storage/domain/events/index.ts +5 -0
- package/src/hooks/modules/storage/domain/index.ts +6 -0
- package/src/hooks/modules/storage/domain/models/index.ts +6 -0
- package/src/hooks/modules/storage/domain/models/storage.ts +11 -0
- package/src/hooks/modules/storage/domain/operations/index.ts +8 -0
- package/src/hooks/modules/storage/domain/operations/serialize.ts +22 -0
- package/src/hooks/modules/storage/domain/operations/validate.ts +7 -0
- package/src/hooks/modules/storage/domain/validators/index.ts +2 -0
- package/src/hooks/modules/storage/index.ts +6 -0
- package/src/hooks/modules/storage/ports/index.ts +7 -0
- package/src/hooks/modules/storage/types/index.ts +6 -0
- package/src/hooks/modules/time/application/index.ts +2 -0
- package/src/hooks/modules/time/application/usecases/index.ts +5 -0
- package/src/hooks/modules/time/application/usecases/use-debounce.ts +10 -0
- package/src/hooks/modules/time/application/usecases/use-interval.ts +10 -0
- package/src/hooks/modules/time/application/usecases/use-throttle.ts +10 -0
- package/src/hooks/modules/time/application/usecases/use-timeout.ts +10 -0
- package/src/hooks/modules/time/domain/events/index.ts +6 -0
- package/src/hooks/modules/time/domain/index.ts +12 -0
- package/src/hooks/modules/time/domain/models/index.ts +6 -0
- package/src/hooks/modules/time/domain/models/time.ts +16 -0
- package/src/hooks/modules/time/domain/operations/calculate.ts +8 -0
- package/src/hooks/modules/time/domain/operations/index.ts +11 -0
- package/src/hooks/modules/time/domain/operations/validate.ts +11 -0
- package/src/hooks/modules/time/domain/validators/index.ts +2 -0
- package/src/hooks/modules/time/index.ts +5 -0
- package/src/hooks/modules/time/ports/index.ts +9 -0
- package/src/hooks/modules/time/types/index.ts +18 -0
- package/src/hooks/modules/toggle/application/index.ts +2 -0
- package/src/hooks/modules/toggle/application/usecases/index.ts +48 -0
- package/src/hooks/modules/toggle/domain/events/index.ts +4 -0
- package/src/hooks/modules/toggle/domain/index.ts +11 -0
- package/src/hooks/modules/toggle/domain/models/index.ts +7 -0
- package/src/hooks/modules/toggle/domain/operations/create.ts +11 -0
- package/src/hooks/modules/toggle/domain/operations/index.ts +12 -0
- package/src/hooks/modules/toggle/domain/operations/modify.ts +18 -0
- package/src/hooks/modules/toggle/domain/operations/query.ts +9 -0
- package/src/hooks/modules/toggle/domain/validators/index.ts +2 -0
- package/src/hooks/modules/toggle/index.ts +6 -0
- package/src/hooks/modules/toggle/ports/index.ts +5 -0
- package/src/hooks/modules/toggle/types/index.ts +9 -0
- package/src/hooks/presentation/index.ts +2 -0
- package/src/hooks/presentation/solid/animation/index.ts +11 -0
- package/src/hooks/presentation/solid/animation/useElapsedTime.ts +75 -0
- package/src/hooks/presentation/solid/animation/useInterval.ts +68 -0
- package/src/hooks/presentation/solid/animation/useIntervalFn.ts +54 -0
- package/src/hooks/presentation/solid/animation/useNow.ts +57 -0
- package/src/hooks/presentation/solid/animation/useRafFn.ts +57 -0
- package/src/hooks/presentation/solid/animation/useTimeout.ts +55 -0
- package/src/hooks/presentation/solid/animation/useTimeoutFn.ts +55 -0
- package/src/hooks/presentation/solid/animation/useTimestamp.ts +61 -0
- package/src/hooks/presentation/solid/animation/useTransition.ts +87 -0
- package/src/hooks/presentation/solid/array/index.ts +14 -0
- package/src/hooks/presentation/solid/array/useArrayConcat.ts +18 -0
- package/src/hooks/presentation/solid/array/useArrayEvery.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayFilter.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayFind.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayIncludes.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayMap.ts +8 -0
- package/src/hooks/presentation/solid/array/useArrayPop.ts +18 -0
- package/src/hooks/presentation/solid/array/useArrayPush.ts +15 -0
- package/src/hooks/presentation/solid/array/useArrayReduce.ts +9 -0
- package/src/hooks/presentation/solid/array/useArrayShift.ts +18 -0
- package/src/hooks/presentation/solid/array/useArraySome.ts +8 -0
- package/src/hooks/presentation/solid/array/useArraySort.ts +12 -0
- package/src/hooks/presentation/solid/browser/index.ts +35 -0
- package/src/hooks/presentation/solid/browser/useBarcode.ts +15 -0
- package/src/hooks/presentation/solid/browser/useBattery.ts +37 -0
- package/src/hooks/presentation/solid/browser/useBeacon.ts +4 -0
- package/src/hooks/presentation/solid/browser/useBluetooth.ts +15 -0
- package/src/hooks/presentation/solid/browser/useClipboard.ts +17 -0
- package/src/hooks/presentation/solid/browser/useClipboardAdvanced.ts +54 -0
- package/src/hooks/presentation/solid/browser/useConnection.ts +22 -0
- package/src/hooks/presentation/solid/browser/useCredential.ts +18 -0
- package/src/hooks/presentation/solid/browser/useDisplayMedia.ts +24 -0
- package/src/hooks/presentation/solid/browser/useFaceDetection.ts +20 -0
- package/src/hooks/presentation/solid/browser/useFullscreen.ts +33 -0
- package/src/hooks/presentation/solid/browser/useGeolocation.ts +64 -0
- package/src/hooks/presentation/solid/browser/useLocalStorage.ts +11 -0
- package/src/hooks/presentation/solid/browser/useMediaDevices.ts +24 -0
- package/src/hooks/presentation/solid/browser/useMemory.ts +9 -0
- package/src/hooks/presentation/solid/browser/useNetwork.ts +43 -0
- package/src/hooks/presentation/solid/browser/useNotification.ts +21 -0
- package/src/hooks/presentation/solid/browser/usePayment.ts +17 -0
- package/src/hooks/presentation/solid/browser/usePerformance.ts +13 -0
- package/src/hooks/presentation/solid/browser/usePush.ts +12 -0
- package/src/hooks/presentation/solid/browser/useQrCode.ts +11 -0
- package/src/hooks/presentation/solid/browser/useScreenOrientation.ts +37 -0
- package/src/hooks/presentation/solid/browser/useServiceWorker.ts +29 -0
- package/src/hooks/presentation/solid/browser/useSessionStorage.ts +11 -0
- package/src/hooks/presentation/solid/browser/useShare.ts +12 -0
- package/src/hooks/presentation/solid/browser/useSpeechRecognition.ts +71 -0
- package/src/hooks/presentation/solid/browser/useSpeechSynthesis.ts +54 -0
- package/src/hooks/presentation/solid/browser/useStorage.ts +22 -0
- package/src/hooks/presentation/solid/browser/useTextDetection.ts +20 -0
- package/src/hooks/presentation/solid/browser/useUsb.ts +15 -0
- package/src/hooks/presentation/solid/browser/useUserMedia.ts +24 -0
- package/src/hooks/presentation/solid/browser/useVibration.ts +12 -0
- package/src/hooks/presentation/solid/browser/useWakeLock.ts +29 -0
- package/src/hooks/presentation/solid/browser/useWebAuthn.ts +35 -0
- package/src/hooks/presentation/solid/elements/index.ts +51 -0
- package/src/hooks/presentation/solid/elements/useActive.ts +33 -0
- package/src/hooks/presentation/solid/elements/useAudio.ts +82 -0
- package/src/hooks/presentation/solid/elements/useBreakpoints.ts +56 -0
- package/src/hooks/presentation/solid/elements/useCanvas.ts +43 -0
- package/src/hooks/presentation/solid/elements/useClick.ts +49 -0
- package/src/hooks/presentation/solid/elements/useDrag.ts +56 -0
- package/src/hooks/presentation/solid/elements/useDraggable.ts +57 -0
- package/src/hooks/presentation/solid/elements/useDraggableHandle.ts +92 -0
- package/src/hooks/presentation/solid/elements/useDrop.ts +54 -0
- package/src/hooks/presentation/solid/elements/useDropZone.ts +67 -0
- package/src/hooks/presentation/solid/elements/useElementBounding.ts +52 -0
- package/src/hooks/presentation/solid/elements/useElementSize.ts +30 -0
- package/src/hooks/presentation/solid/elements/useElementVisibility.ts +33 -0
- package/src/hooks/presentation/solid/elements/useFileDialog.ts +33 -0
- package/src/hooks/presentation/solid/elements/useFileInput.ts +20 -0
- package/src/hooks/presentation/solid/elements/useFocus.ts +49 -0
- package/src/hooks/presentation/solid/elements/useHover.ts +33 -0
- package/src/hooks/presentation/solid/elements/useImagePreview.ts +27 -0
- package/src/hooks/presentation/solid/elements/useImageUpload.ts +66 -0
- package/src/hooks/presentation/solid/elements/useInfiniteScroll.ts +52 -0
- package/src/hooks/presentation/solid/elements/useIntersectionAdvanced.ts +43 -0
- package/src/hooks/presentation/solid/elements/useIntersectionObserver.ts +40 -0
- package/src/hooks/presentation/solid/elements/useLayout.ts +47 -0
- package/src/hooks/presentation/solid/elements/useLongPress.ts +54 -0
- package/src/hooks/presentation/solid/elements/useMagicKeys.ts +60 -0
- package/src/hooks/presentation/solid/elements/useMediaQuery.ts +24 -0
- package/src/hooks/presentation/solid/elements/useModal.ts +24 -0
- package/src/hooks/presentation/solid/elements/useMouse.ts +51 -0
- package/src/hooks/presentation/solid/elements/useMutationObserver.ts +38 -0
- package/src/hooks/presentation/solid/elements/useOnClickOutside.ts +25 -0
- package/src/hooks/presentation/solid/elements/useOnKeyStroke.ts +33 -0
- package/src/hooks/presentation/solid/elements/useParallax.ts +34 -0
- package/src/hooks/presentation/solid/elements/usePerformanceObserver.ts +30 -0
- package/src/hooks/presentation/solid/elements/usePinch.ts +61 -0
- package/src/hooks/presentation/solid/elements/usePopover.ts +54 -0
- package/src/hooks/presentation/solid/elements/useResize.ts +34 -0
- package/src/hooks/presentation/solid/elements/useResizeObserver.ts +42 -0
- package/src/hooks/presentation/solid/elements/useRotate.ts +42 -0
- package/src/hooks/presentation/solid/elements/useScroll.ts +97 -0
- package/src/hooks/presentation/solid/elements/useScrollTo.ts +30 -0
- package/src/hooks/presentation/solid/elements/useSortable.ts +22 -0
- package/src/hooks/presentation/solid/elements/useSplitter.ts +61 -0
- package/src/hooks/presentation/solid/elements/useSticky.ts +33 -0
- package/src/hooks/presentation/solid/elements/useSvg.ts +31 -0
- package/src/hooks/presentation/solid/elements/useSwipe.ts +87 -0
- package/src/hooks/presentation/solid/elements/useTabs.ts +44 -0
- package/src/hooks/presentation/solid/elements/useTooltip.ts +57 -0
- package/src/hooks/presentation/solid/elements/useVideo.ts +83 -0
- package/src/hooks/presentation/solid/elements/useVirtualList.ts +43 -0
- package/src/hooks/presentation/solid/elements/useWebgl.ts +36 -0
- package/src/hooks/presentation/solid/index.ts +11 -0
- package/src/hooks/presentation/solid/math/index.ts +10 -0
- package/src/hooks/presentation/solid/math/useAbs.ts +9 -0
- package/src/hooks/presentation/solid/math/useCeil.ts +9 -0
- package/src/hooks/presentation/solid/math/useClamp.ts +24 -0
- package/src/hooks/presentation/solid/math/useExp.ts +9 -0
- package/src/hooks/presentation/solid/math/useFloor.ts +9 -0
- package/src/hooks/presentation/solid/math/useLog.ts +21 -0
- package/src/hooks/presentation/solid/math/useMath.ts +3 -0
- package/src/hooks/presentation/solid/math/useOffset.ts +20 -0
- package/src/hooks/presentation/solid/math/usePow.ts +16 -0
- package/src/hooks/presentation/solid/math/useRound.ts +24 -0
- package/src/hooks/presentation/solid/math/useSign.ts +9 -0
- package/src/hooks/presentation/solid/math/useSqrt.ts +9 -0
- package/src/hooks/presentation/solid/network/index.ts +5 -0
- package/src/hooks/presentation/solid/network/useEventSource.ts +87 -0
- package/src/hooks/presentation/solid/network/useFetch.ts +187 -0
- package/src/hooks/presentation/solid/network/useWebSocket.ts +120 -0
- package/src/hooks/presentation/solid/sensors/index.ts +21 -0
- package/src/hooks/presentation/solid/sensors/useAbsoluteOrientation.ts +41 -0
- package/src/hooks/presentation/solid/sensors/useAccelerometer.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useAmbientLight.ts +35 -0
- package/src/hooks/presentation/solid/sensors/useDeviceMotion.ts +50 -0
- package/src/hooks/presentation/solid/sensors/useDeviceOrientation.ts +38 -0
- package/src/hooks/presentation/solid/sensors/useGamepad.ts +52 -0
- package/src/hooks/presentation/solid/sensors/useGamepadRumble.ts +28 -0
- package/src/hooks/presentation/solid/sensors/useGravity.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useGyroscope.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useHID.ts +19 -0
- package/src/hooks/presentation/solid/sensors/useLinearAcceleration.ts +41 -0
- package/src/hooks/presentation/solid/sensors/useMagnetometer.ts +39 -0
- package/src/hooks/presentation/solid/sensors/useMotion.ts +31 -0
- package/src/hooks/presentation/solid/sensors/useNFC.ts +19 -0
- package/src/hooks/presentation/solid/sensors/usePressure.ts +35 -0
- package/src/hooks/presentation/solid/sensors/useProximity.ts +38 -0
- package/src/hooks/presentation/solid/sensors/useRelativeOrientation.ts +41 -0
- package/src/hooks/presentation/solid/sensors/useSerial.ts +18 -0
- package/src/hooks/presentation/solid/sensors/useShake.ts +54 -0
- package/src/hooks/presentation/solid/sensors/useTilt.ts +31 -0
- package/src/hooks/presentation/solid/state/createSharedComposable.ts +24 -0
- package/src/hooks/presentation/solid/state/index.ts +14 -0
- package/src/hooks/presentation/solid/state/reactivity.ts +43 -0
- package/src/hooks/presentation/solid/state/refDebounced.ts +27 -0
- package/src/hooks/presentation/solid/state/refThrottled.ts +39 -0
- package/src/hooks/presentation/solid/state/syncRef.ts +24 -0
- package/src/hooks/presentation/solid/state/toRef.ts +18 -0
- package/src/hooks/presentation/solid/state/useArray.ts +55 -0
- package/src/hooks/presentation/solid/state/useCounter.ts +24 -0
- package/src/hooks/presentation/solid/state/useToggle.ts +20 -0
- package/src/hooks/presentation/solid/time/index.ts +6 -0
- package/src/hooks/presentation/solid/time/useDebounceFn.ts +18 -0
- package/src/hooks/presentation/solid/time/useInterval.ts +44 -0
- package/src/hooks/presentation/solid/time/useThrottleFn.ts +30 -0
- package/src/hooks/presentation/solid/time/useTimeout.ts +37 -0
- package/src/hooks/presentation/solid/time/watchDebounced.ts +19 -0
- package/src/hooks/presentation/solid/time/watchPausable.ts +29 -0
- package/src/hooks/presentation/solid/time/whenever.ts +13 -0
- package/src/hooks/presentation/solid/utilities/index.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayEvery.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayFilter.ts +11 -0
- package/src/hooks/presentation/solid/utilities/useArrayFind.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayIncludes.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayMap.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArrayReduce.ts +9 -0
- package/src/hooks/presentation/solid/utilities/useArraySome.ts +8 -0
- package/src/hooks/presentation/solid/utilities/useArraySort.ts +12 -0
- package/src/hooks/presentation/solid/utilities/useClamp.ts +24 -0
- package/src/hooks/presentation/solid/utilities/useDebounce.ts +32 -0
- package/src/hooks/presentation/solid/utilities/useEventBus.ts +57 -0
- package/src/hooks/presentation/solid/utilities/useMemoize.ts +15 -0
- package/src/hooks/presentation/solid/utilities/useOffset.ts +20 -0
- package/src/hooks/presentation/solid/utilities/useRound.ts +24 -0
- package/src/hooks/presentation/solid/utilities/useSorted.ts +12 -0
- package/src/hooks/presentation/solid/utilities/useThrottle.ts +44 -0
- package/src/hooks/presentation/solid/utilities/useToNumber.ts +11 -0
- package/src/hooks/presentation/solid/utilities/useToString.ts +10 -0
- package/src/hooks/realtime/use-sse.ts +70 -0
- package/src/hooks/shared/constants/index.ts +4 -0
- package/src/hooks/shared/errors/index.ts +1 -0
- package/src/hooks/shared/errors/validation-error.ts +28 -0
- package/src/hooks/shared/index.ts +8 -0
- package/src/hooks/shared/types/index.ts +17 -0
- package/src/hooks/shared/types/option.ts +17 -0
- package/src/hooks/shared/types/result.ts +34 -0
- package/src/hooks/shared/types/utilities.ts +102 -0
- package/src/hooks/shared/utils/identity.ts +2 -0
- package/src/hooks/shared/utils/index.ts +4 -0
- package/src/hooks/shared/utils/logger.ts +69 -0
- package/src/hooks/shared/utils/pipe.ts +5 -0
- package/src/hooks/shared/utils/result.ts +9 -0
- package/src/hooks/test/counter.test.ts +25 -0
- package/src/index.ts +16 -0
- package/src/internal.ts +61 -0
- package/src/query/adapters/devtools/index.ts +29 -0
- package/src/query/adapters/persistence/index.ts +62 -0
- package/src/query/adapters/solid/index.ts +10 -0
- package/src/query/adapters/solid/solid-query-context.ts +29 -0
- package/src/query/adapters/solid/solid-query-empty-result.ts +34 -0
- package/src/query/adapters/solid/solid-query-options.ts +52 -0
- package/src/query/adapters/solid/solid-query-use-infinite.ts +228 -0
- package/src/query/adapters/solid/solid-query-use-mutation.ts +54 -0
- package/src/query/adapters/solid/solid-query-use-query.ts +75 -0
- package/src/query/adapters/solid/solid.test.ts +53 -0
- package/src/query/adapters/validation/index.ts +20 -0
- package/src/query/index.test.ts +203 -0
- package/src/query/index.ts +4 -0
- package/src/query/modules/query/application/usecases/query-client-data.ts +29 -0
- package/src/query/modules/query/application/usecases/query-client-helpers.ts +49 -0
- package/src/query/modules/query/application/usecases/query-client-infinite.ts +39 -0
- package/src/query/modules/query/application/usecases/query-client.ts +251 -0
- package/src/query/modules/query/domain/models/mutation-cache.ts +115 -0
- package/src/query/modules/query/domain/models/mutation.ts +207 -0
- package/src/query/modules/query/domain/models/query-cache.ts +119 -0
- package/src/query/modules/query/domain/models/query-environment.ts +16 -0
- package/src/query/modules/query/domain/models/query-observer.ts +162 -0
- package/src/query/modules/query/domain/models/query-operations.ts +76 -0
- package/src/query/modules/query/domain/models/query.ts +239 -0
- package/src/query/modules/query/domain/operations/index.ts +76 -0
- package/src/query/modules/query/index.ts +9 -0
- package/src/query/modules/query/ports/index.ts +53 -0
- package/src/query/modules/query/types/index.ts +239 -0
- package/src/query/shared/index.ts +48 -0
- package/src/render/adapters/index.ts +1 -0
- package/src/render/adapters/solid-web/hydration.ts +35 -0
- package/src/render/adapters/solid-web/index.ts +3 -0
- package/src/render/adapters/solid-web/renderer.ts +20 -0
- package/src/render/index.ts +7 -0
- package/src/render/modules/render/application/index.ts +1 -0
- package/src/render/modules/render/application/usecases/index.ts +4 -0
- package/src/render/modules/render/application/usecases/remote-island.ts +46 -0
- package/src/render/modules/render/application/usecases/render-page.ts +86 -0
- package/src/render/modules/render/application/usecases/render-shell.ts +56 -0
- package/src/render/modules/render/application/usecases/stream-page.ts +159 -0
- package/src/render/modules/render/domain/index.ts +3 -0
- package/src/render/modules/render/domain/models/context.ts +34 -0
- package/src/render/modules/render/domain/models/document.ts +26 -0
- package/src/render/modules/render/domain/models/index.ts +2 -0
- package/src/render/modules/render/domain/operations/document.ts +58 -0
- package/src/render/modules/render/domain/operations/hydration.ts +58 -0
- package/src/render/modules/render/domain/operations/index.ts +3 -0
- package/src/render/modules/render/domain/operations/rsc.ts +53 -0
- package/src/render/modules/render/domain/validators/index.ts +11 -0
- package/src/render/modules/render/index.ts +3 -0
- package/src/render/modules/render/ports/index.ts +17 -0
- package/src/render/presentation/ClientComponent.tsx +42 -0
- package/src/render/presentation/Document.tsx +45 -0
- package/src/render/presentation/Island.tsx +146 -0
- package/src/render/presentation/RemoteIsland.tsx +68 -0
- package/src/render/presentation/entries.ts +83 -0
- package/src/render/presentation/index.ts +5 -0
- package/src/render/shared/index.ts +2 -0
- package/src/render/shared/types/index.ts +9 -0
- package/src/render/shared/utils/index.ts +1 -0
- package/src/render/shared/utils/result.ts +30 -0
- package/src/render/types/index.ts +58 -0
- package/src/router/adapters/index.ts +1 -0
- package/src/router/adapters/solid-start/index.ts +42 -0
- package/src/router/cli/bundle-analyzer.ts +142 -0
- package/src/router/cli/index.ts +3 -0
- package/src/router/cli/migration-cli.ts +217 -0
- package/src/router/cli/route-generator-config.ts +109 -0
- package/src/router/cli/route-generator-templates.ts +117 -0
- package/src/router/cli/route-generator-types.ts +9 -0
- package/src/router/cli/route-generator-utils.ts +40 -0
- package/src/router/cli/route-generator.ts +64 -0
- package/src/router/index.test.ts +7 -0
- package/src/router/index.ts +21 -0
- package/src/router/modules/navigation/application/index.ts +1 -0
- package/src/router/modules/navigation/application/usecases.ts +42 -0
- package/src/router/modules/navigation/domain/index.ts +2 -0
- package/src/router/modules/navigation/domain/models.ts +44 -0
- package/src/router/modules/navigation/domain/operations.ts +28 -0
- package/src/router/modules/navigation/index.ts +3 -0
- package/src/router/modules/navigation/types/index.ts +15 -0
- package/src/router/modules/route-cache/application/usecases/index.ts +74 -0
- package/src/router/modules/route-cache/domain/models/index.ts +63 -0
- package/src/router/modules/route-cache/domain/operations/cache-evict.ts +104 -0
- package/src/router/modules/route-cache/domain/operations/cache-invalidate.ts +101 -0
- package/src/router/modules/route-cache/domain/operations/cache-read.ts +74 -0
- package/src/router/modules/route-cache/domain/operations/cache-write.ts +62 -0
- package/src/router/modules/route-cache/domain/operations/index.ts +4 -0
- package/src/router/modules/route-cache/domain/validators/index.ts +25 -0
- package/src/router/modules/route-cache/index.ts +8 -0
- package/src/router/modules/route-cache/ports/index.ts +20 -0
- package/src/router/modules/route-cache/types/index.ts +8 -0
- package/src/router/modules/route-error-tracking/application/usecases/index.ts +182 -0
- package/src/router/modules/route-error-tracking/domain/index.ts +5 -0
- package/src/router/modules/route-error-tracking/domain/models/index.ts +130 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-cleanup.ts +50 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-queries.ts +103 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-recording.ts +112 -0
- package/src/router/modules/route-error-tracking/domain/operations/error-reporting.ts +55 -0
- package/src/router/modules/route-error-tracking/domain/operations/index.ts +4 -0
- package/src/router/modules/route-error-tracking/domain/validators/index.ts +46 -0
- package/src/router/modules/route-error-tracking/index.ts +8 -0
- package/src/router/modules/route-error-tracking/ports/index.ts +20 -0
- package/src/router/modules/route-error-tracking/types/index.ts +6 -0
- package/src/router/modules/route-feature-flags/application/usecases/index.ts +159 -0
- package/src/router/modules/route-feature-flags/domain/index.ts +5 -0
- package/src/router/modules/route-feature-flags/domain/models/index.ts +102 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-audit.ts +37 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-conditions.ts +52 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-flags.ts +205 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-routes.ts +54 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-segments.ts +22 -0
- package/src/router/modules/route-feature-flags/domain/operations/feature-flag-statistics.ts +22 -0
- package/src/router/modules/route-feature-flags/domain/operations/index.ts +6 -0
- package/src/router/modules/route-feature-flags/domain/validators/index.ts +40 -0
- package/src/router/modules/route-feature-flags/index.ts +8 -0
- package/src/router/modules/route-feature-flags/ports/index.ts +23 -0
- package/src/router/modules/route-feature-flags/types/index.ts +7 -0
- package/src/router/modules/route-i18n/application/usecases/index.ts +81 -0
- package/src/router/modules/route-i18n/domain/models/index.ts +85 -0
- package/src/router/modules/route-i18n/domain/operations/index.ts +201 -0
- package/src/router/modules/route-i18n/domain/validators/index.ts +43 -0
- package/src/router/modules/route-i18n/index.ts +8 -0
- package/src/router/modules/route-i18n/ports/index.ts +20 -0
- package/src/router/modules/route-i18n/types/index.ts +7 -0
- package/src/router/modules/route-navigation-timeline/application/usecases/index.ts +182 -0
- package/src/router/modules/route-navigation-timeline/domain/index.ts +5 -0
- package/src/router/modules/route-navigation-timeline/domain/models/index.ts +143 -0
- package/src/router/modules/route-navigation-timeline/domain/operations/index.ts +177 -0
- package/src/router/modules/route-navigation-timeline/domain/validators/index.ts +19 -0
- package/src/router/modules/route-navigation-timeline/index.ts +8 -0
- package/src/router/modules/route-navigation-timeline/ports/index.ts +30 -0
- package/src/router/modules/route-navigation-timeline/types/index.ts +5 -0
- package/src/router/modules/route-performance/application/usecases/index.ts +166 -0
- package/src/router/modules/route-performance/domain/models/index.ts +96 -0
- package/src/router/modules/route-performance/domain/operations/index.ts +5 -0
- package/src/router/modules/route-performance/domain/operations/performance-cleanup.ts +29 -0
- package/src/router/modules/route-performance/domain/operations/performance-queries.ts +91 -0
- package/src/router/modules/route-performance/domain/operations/performance-recording.ts +151 -0
- package/src/router/modules/route-performance/domain/operations/performance-reporting.ts +32 -0
- package/src/router/modules/route-performance/domain/operations/performance-tracking.ts +75 -0
- package/src/router/modules/route-performance/domain/validators/index.ts +55 -0
- package/src/router/modules/route-performance/index.ts +8 -0
- package/src/router/modules/route-performance/ports/index.ts +25 -0
- package/src/router/modules/route-performance/types/index.ts +6 -0
- package/src/router/modules/route-security/application/usecases/index.ts +153 -0
- package/src/router/modules/route-security/domain/models/index.ts +216 -0
- package/src/router/modules/route-security/domain/operations/index.ts +165 -0
- package/src/router/modules/route-security/domain/validators/index.ts +32 -0
- package/src/router/modules/route-security/index.ts +8 -0
- package/src/router/modules/route-security/ports/index.ts +31 -0
- package/src/router/modules/route-security/types/index.ts +11 -0
- package/src/router/modules/route-testing/application/usecases/index.ts +131 -0
- package/src/router/modules/route-testing/domain/models/index.ts +217 -0
- package/src/router/modules/route-testing/domain/operations/contract-testing-operations.ts +239 -0
- package/src/router/modules/route-testing/domain/operations/e2e-testing-operations.ts +167 -0
- package/src/router/modules/route-testing/domain/operations/index.ts +3 -0
- package/src/router/modules/route-testing/domain/operations/route-testing-core.ts +48 -0
- package/src/router/modules/route-testing/domain/validators/index.ts +34 -0
- package/src/router/modules/route-testing/index.ts +8 -0
- package/src/router/modules/route-testing/ports/index.ts +21 -0
- package/src/router/modules/route-testing/types/index.ts +13 -0
- package/src/router/modules/routing/application/index.ts +7 -0
- package/src/router/modules/routing/application/usecases.ts +49 -0
- package/src/router/modules/routing/domain/ab-testing.ts +86 -0
- package/src/router/modules/routing/domain/analytics.ts +88 -0
- package/src/router/modules/routing/domain/caching-evict.ts +104 -0
- package/src/router/modules/routing/domain/caching-invalidate.ts +101 -0
- package/src/router/modules/routing/domain/caching-read.ts +74 -0
- package/src/router/modules/routing/domain/caching-state.ts +38 -0
- package/src/router/modules/routing/domain/caching-types.ts +38 -0
- package/src/router/modules/routing/domain/caching-write.ts +62 -0
- package/src/router/modules/routing/domain/caching.ts +6 -0
- package/src/router/modules/routing/domain/code-splitting.ts +226 -0
- package/src/router/modules/routing/domain/contract-factory.ts +37 -0
- package/src/router/modules/routing/domain/contract-testing.ts +13 -0
- package/src/router/modules/routing/domain/contract-types.ts +32 -0
- package/src/router/modules/routing/domain/contract-validator.ts +246 -0
- package/src/router/modules/routing/domain/dynamic-imports.ts +67 -0
- package/src/router/modules/routing/domain/e2e-testing.ts +267 -0
- package/src/router/modules/routing/domain/error-boundaries.ts +54 -0
- package/src/router/modules/routing/domain/error-tracking.ts +277 -0
- package/src/router/modules/routing/domain/feature-flags.ts +255 -0
- package/src/router/modules/routing/domain/guards.ts +104 -0
- package/src/router/modules/routing/domain/i18n.ts +230 -0
- package/src/router/modules/routing/domain/index.ts +30 -0
- package/src/router/modules/routing/domain/interactive-docs-advanced-sections.ts +164 -0
- package/src/router/modules/routing/domain/interactive-docs-core-sections.ts +198 -0
- package/src/router/modules/routing/domain/interactive-docs.ts +154 -0
- package/src/router/modules/routing/domain/isr.ts +35 -0
- package/src/router/modules/routing/domain/middleware.ts +79 -0
- package/src/router/modules/routing/domain/models.ts +95 -0
- package/src/router/modules/routing/domain/navigation-timeline.ts +243 -0
- package/src/router/modules/routing/domain/operations.ts +36 -0
- package/src/router/modules/routing/domain/optimized-matcher.ts +75 -0
- package/src/router/modules/routing/domain/performance-alert-manager.ts +28 -0
- package/src/router/modules/routing/domain/performance-monitoring.ts +287 -0
- package/src/router/modules/routing/domain/performance-report.ts +29 -0
- package/src/router/modules/routing/domain/performance-types.ts +19 -0
- package/src/router/modules/routing/domain/predictive-preloading.ts +296 -0
- package/src/router/modules/routing/domain/rbac.ts +219 -0
- package/src/router/modules/routing/domain/resource-routes.ts +64 -0
- package/src/router/modules/routing/domain/route-autocomplete.ts +176 -0
- package/src/router/modules/routing/domain/route-groups.ts +63 -0
- package/src/router/modules/routing/domain/security-scanner.ts +225 -0
- package/src/router/modules/routing/domain/server-actions.ts +71 -0
- package/src/router/modules/routing/domain/testing.ts +80 -0
- package/src/router/modules/routing/domain/type-safe-links.ts +72 -0
- package/src/router/modules/routing/domain/validators.ts +23 -0
- package/src/router/modules/routing/index.ts +4 -0
- package/src/router/modules/routing/ports/index.ts +1 -0
- package/src/router/modules/routing/ports/router-port.ts +15 -0
- package/src/router/modules/routing/types/index.ts +14 -0
- package/src/router/modules/routing-core/application/usecases/index.ts +49 -0
- package/src/router/modules/routing-core/domain/models/index.ts +95 -0
- package/src/router/modules/routing-core/domain/operations/index.ts +36 -0
- package/src/router/modules/routing-core/domain/validators/index.ts +28 -0
- package/src/router/modules/routing-core/index.ts +8 -0
- package/src/router/modules/routing-core/ports/index.ts +16 -0
- package/src/router/modules/routing-core/types/index.ts +25 -0
- package/src/router/presentation/index.ts +1 -0
- package/src/router/presentation/solid/components/index.ts +1 -0
- package/src/router/presentation/solid/components/route-visualizer-details.tsx +37 -0
- package/src/router/presentation/solid/components/route-visualizer-helpers.ts +56 -0
- package/src/router/presentation/solid/components/route-visualizer-tree.tsx +99 -0
- package/src/router/presentation/solid/components/route-visualizer-types.ts +41 -0
- package/src/router/presentation/solid/components/route-visualizer.tsx +110 -0
- package/src/router/presentation/solid/components/router.ts +82 -0
- package/src/router/presentation/solid/devtools/index.ts +2 -0
- package/src/router/presentation/solid/devtools/router-devtools-panel.tsx +141 -0
- package/src/router/presentation/solid/devtools/router-inspector.ts +54 -0
- package/src/router/presentation/solid/hmr.ts +77 -0
- package/src/router/presentation/solid/index.ts +7 -0
- package/src/router/presentation/solid/lazy-loading.ts +111 -0
- package/src/router/presentation/solid/preloading.ts +81 -0
- package/src/router/presentation/solid/route-state.ts +58 -0
- package/src/router/presentation/solid/signals/index.ts +2 -0
- package/src/router/presentation/solid/signals/route-state.ts +39 -0
- package/src/router/presentation/solid/signals/search-params.ts +31 -0
- package/src/router/shared/constants/index.ts +6 -0
- package/src/router/shared/errors/enhanced-errors.ts +94 -0
- package/src/router/shared/errors/index.ts +30 -0
- package/src/router/shared/index.ts +4 -0
- package/src/router/shared/types/either.ts +55 -0
- package/src/router/shared/types/index.ts +5 -0
- package/src/router/shared/types/option.ts +20 -0
- package/src/router/shared/types/result.ts +34 -0
- package/src/router/shared/types/route-inference.ts +49 -0
- package/src/router/shared/types/routing.ts +31 -0
- package/src/router/shared/utils/index.ts +3 -0
- package/src/router/shared/utils/path.ts +43 -0
- package/src/router/shared/utils/result.ts +5 -0
- package/src/router/shared/utils/time-condition.ts +53 -0
- package/src/router/vite-plugin/index.ts +2 -0
- package/src/router/vite-plugin/vite-plugin-core.ts +79 -0
- package/src/router/vite-plugin/vite-plugin-options-advanced.ts +127 -0
- package/src/router/vite-plugin/vite-plugin-options-features.ts +117 -0
- package/src/router/vite-plugin/vite-plugin-options-routing.ts +70 -0
- package/src/router/vite-plugin/vite-plugin-options.ts +23 -0
- package/src/server/adapters/index.ts +2 -0
- package/src/server/adapters/platforms.ts +79 -0
- package/src/server/adapters/web-server/index.ts +281 -0
- package/src/server/index.ts +13 -0
- package/src/server/modules/http/domain/operations/cookies.ts +151 -0
- package/src/server/modules/http/domain/operations/metrics.ts +103 -0
- package/src/server/modules/http/domain/operations/request-context.ts +36 -0
- package/src/server/modules/http/domain/operations/session-store.ts +98 -0
- package/src/server/modules/http/index.ts +15 -0
- package/src/server/modules/loaders/application/index.ts +1 -0
- package/src/server/modules/loaders/application/usecases/create-route-loader.ts +88 -0
- package/src/server/modules/loaders/application/usecases/dehydrate.ts +21 -0
- package/src/server/modules/loaders/application/usecases/index.ts +2 -0
- package/src/server/modules/loaders/index.ts +1 -0
- package/src/server/modules/realtime/domain/operations/channels.ts +241 -0
- package/src/server/modules/realtime/domain/operations/sse.ts +63 -0
- package/src/server/modules/realtime/index.ts +2 -0
- package/src/server/modules/server-functions/adapters/http/handler.ts +128 -0
- package/src/server/modules/server-functions/application/index.ts +1 -0
- package/src/server/modules/server-functions/application/usecases/batch.ts +135 -0
- package/src/server/modules/server-functions/application/usecases/create-server-fn.ts +272 -0
- package/src/server/modules/server-functions/application/usecases/csrf.ts +67 -0
- package/src/server/modules/server-functions/application/usecases/index.ts +6 -0
- package/src/server/modules/server-functions/application/usecases/live.ts +172 -0
- package/src/server/modules/server-functions/application/usecases/registry.ts +22 -0
- package/src/server/modules/server-functions/application/usecases/scheduler.ts +115 -0
- package/src/server/modules/server-functions/domain/index.ts +24 -0
- package/src/server/modules/server-functions/domain/models/execution-result.ts +18 -0
- package/src/server/modules/server-functions/domain/models/index.ts +1 -0
- package/src/server/modules/server-functions/domain/operations/result.ts +61 -0
- package/src/server/modules/server-functions/domain/operations/serialize.ts +134 -0
- package/src/server/modules/server-functions/domain/operations/stream.ts +107 -0
- package/src/server/modules/server-functions/index.ts +3 -0
- package/src/server/modules/server-only/index.ts +30 -0
- package/src/server/node.ts +10 -0
- package/src/server/shared/errors/index.ts +1 -0
- package/src/server/shared/errors/server-fn-error.ts +27 -0
- package/src/server/shared/index.ts +2 -0
- package/src/server/shared/types/index.ts +5 -0
- package/src/server/types/index.ts +65 -0
- package/src/stores/adapters/analytics/index.ts +5 -0
- package/src/stores/adapters/analytics/monitoring.ts +164 -0
- package/src/stores/adapters/devtools/index.ts +80 -0
- package/src/stores/adapters/persistence/index.ts +5 -0
- package/src/stores/adapters/persistence/versioning.ts +142 -0
- package/src/stores/adapters/router/index.ts +144 -0
- package/src/stores/adapters/storage/index.ts +6 -0
- package/src/stores/adapters/storage/indexed-db.ts +83 -0
- package/src/stores/adapters/storage/local-storage.ts +44 -0
- package/src/stores/adapters/storage/session-storage.ts +44 -0
- package/src/stores/adapters/sync/index.ts +5 -0
- package/src/stores/adapters/sync/tab-sync.ts +148 -0
- package/src/stores/adapters/validation/arktype-validator.ts +32 -0
- package/src/stores/adapters/validation/error-handling.ts +27 -0
- package/src/stores/adapters/validation/index.ts +61 -0
- package/src/stores/adapters/validation/schemas/api-schemas.ts +30 -0
- package/src/stores/adapters/validation/schemas/common-schemas.ts +32 -0
- package/src/stores/adapters/validation/schemas/config-schemas.ts +22 -0
- package/src/stores/adapters/validation/schemas/constraint-schemas.ts +34 -0
- package/src/stores/adapters/validation/schemas/ecommerce-schemas.ts +43 -0
- package/src/stores/adapters/validation/schemas/form-schemas.ts +27 -0
- package/src/stores/adapters/validation/schemas/primitive-schemas.ts +9 -0
- package/src/stores/adapters/validation/schemas/store-schemas.ts +52 -0
- package/src/stores/adapters/validation/schemas.ts +11 -0
- package/src/stores/index.ts +13 -0
- package/src/stores/modules/query/index.ts +24 -0
- package/src/stores/modules/query/mutation-state.ts +33 -0
- package/src/stores/modules/query/mutation-store.ts +59 -0
- package/src/stores/modules/query/query-builder.ts +25 -0
- package/src/stores/modules/query/query-cache.ts +65 -0
- package/src/stores/modules/query/query-manager.ts +103 -0
- package/src/stores/modules/query/query-state.ts +39 -0
- package/src/stores/modules/query/query-store.ts +81 -0
- package/src/stores/modules/store/application/usecases/index.ts +217 -0
- package/src/stores/modules/store/domain/models/index.ts +38 -0
- package/src/stores/modules/store/domain/operations/actions.ts +120 -0
- package/src/stores/modules/store/domain/operations/composition.ts +205 -0
- package/src/stores/modules/store/domain/operations/derived-operations.ts +21 -0
- package/src/stores/modules/store/domain/operations/diffing.ts +272 -0
- package/src/stores/modules/store/domain/operations/event-bus.ts +255 -0
- package/src/stores/modules/store/domain/operations/history-operations.ts +101 -0
- package/src/stores/modules/store/domain/operations/hydration.ts +159 -0
- package/src/stores/modules/store/domain/operations/immutable.ts +173 -0
- package/src/stores/modules/store/domain/operations/index.ts +21 -0
- package/src/stores/modules/store/domain/operations/middleware.ts +193 -0
- package/src/stores/modules/store/domain/operations/mutations.ts +14 -0
- package/src/stores/modules/store/domain/operations/normalization.ts +195 -0
- package/src/stores/modules/store/domain/operations/optimistic.ts +171 -0
- package/src/stores/modules/store/domain/operations/persistence-operations.ts +26 -0
- package/src/stores/modules/store/domain/operations/queries.ts +296 -0
- package/src/stores/modules/store/domain/operations/selectors.ts +112 -0
- package/src/stores/modules/store/domain/operations/store-operations.ts +52 -0
- package/src/stores/modules/store/domain/operations/time-machine.ts +240 -0
- package/src/stores/modules/store/domain/operations/transactions.ts +198 -0
- package/src/stores/modules/store/domain/validators/action-validators.ts +20 -0
- package/src/stores/modules/store/domain/validators/history-validators.ts +19 -0
- package/src/stores/modules/store/domain/validators/index.ts +7 -0
- package/src/stores/modules/store/domain/validators/persistence-validators.ts +23 -0
- package/src/stores/modules/store/domain/validators/store-validators.ts +41 -0
- package/src/stores/modules/store/index.ts +9 -0
- package/src/stores/modules/store/ports/index.ts +104 -0
- package/src/stores/modules/store/types/index.ts +35 -0
- package/src/stores/shared/constants/index.ts +50 -0
- package/src/stores/shared/errors/index.ts +122 -0
- package/src/stores/shared/index.ts +7 -0
- package/src/stores/shared/schema-generator.ts +262 -0
- package/src/stores/shared/types/index.ts +147 -0
- package/src/testing/index.ts +90 -0
- package/src/vite/auto-imports.ts +65 -0
- package/src/vite/client.d.ts +25 -0
- package/src/vite/dev-middleware.ts +142 -0
- package/src/vite/index.ts +9 -0
- package/src/vite/plugin.ts +277 -0
- package/src/vite/prerender.ts +72 -0
- package/src/vite/server-fn-ids.ts +52 -0
- package/src/vite/types/index.ts +24 -0
- package/src/vite/virtual-modules.ts +68 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev SSR Middleware
|
|
3
|
+
* Runs the app server entry inside the Vite dev server
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
7
|
+
import type { ViteDevServer } from "vite";
|
|
8
|
+
import type { SolidFrameworkConfig } from "#app/types";
|
|
9
|
+
|
|
10
|
+
interface ServerEntryModule {
|
|
11
|
+
default?: (request: Request) => Promise<Response>;
|
|
12
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
13
|
+
handler?: (request: Request) => Promise<Response>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const toWebRequest = async (req: IncomingMessage): Promise<Request> => {
|
|
17
|
+
const host = req.headers.host ?? "localhost";
|
|
18
|
+
const url = `http://${host}${req.url ?? "/"}`;
|
|
19
|
+
const method = req.method ?? "GET";
|
|
20
|
+
|
|
21
|
+
const headers = new Headers();
|
|
22
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
23
|
+
if (value === undefined) continue;
|
|
24
|
+
headers.set(key, Array.isArray(value) ? value.join(", ") : value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (method === "GET" || method === "HEAD") {
|
|
28
|
+
return new Request(url, { method, headers });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const chunks: Buffer[] = [];
|
|
32
|
+
for await (const chunk of req) chunks.push(chunk as Buffer);
|
|
33
|
+
return new Request(url, {
|
|
34
|
+
method,
|
|
35
|
+
headers,
|
|
36
|
+
body: Buffer.concat(chunks),
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const escapeHtml = (text: string): string =>
|
|
41
|
+
text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Dev error overlay — styled page with the SSR stack, mirroring the
|
|
45
|
+
* vite error overlay experience for render-time failures
|
|
46
|
+
*/
|
|
47
|
+
const errorOverlayHtml = (error: Error): string =>
|
|
48
|
+
`<!doctype html><html><head><meta charset="utf-8"><title>SSR Error</title>` +
|
|
49
|
+
`<style>body{margin:0;font:14px/1.5 ui-monospace,monospace;background:#1a0505;color:#fca5a5}` +
|
|
50
|
+
`.wrap{padding:2rem;max-width:960px;margin:auto}h1{color:#ef4444;font-size:1.25rem}` +
|
|
51
|
+
`pre{background:#2a0a0a;border:1px solid #7f1d1d;border-radius:8px;padding:1rem;overflow:auto;white-space:pre-wrap}</style>` +
|
|
52
|
+
`</head><body><div class="wrap"><h1>[solid-framework] SSR render error</h1>` +
|
|
53
|
+
`<pre>${escapeHtml(error.stack ?? error.message)}</pre></div></body></html>`;
|
|
54
|
+
|
|
55
|
+
const writeResponse = async (
|
|
56
|
+
res: ServerResponse,
|
|
57
|
+
response: Response,
|
|
58
|
+
): Promise<void> => {
|
|
59
|
+
res.statusCode = response.status;
|
|
60
|
+
response.headers.forEach((value, key) => {
|
|
61
|
+
res.setHeader(key, value);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (!response.body) {
|
|
65
|
+
res.end();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const reader = response.body.getReader();
|
|
70
|
+
try {
|
|
71
|
+
for (;;) {
|
|
72
|
+
const { done, value } = await reader.read();
|
|
73
|
+
if (done) break;
|
|
74
|
+
res.write(Buffer.from(value));
|
|
75
|
+
}
|
|
76
|
+
} finally {
|
|
77
|
+
res.end();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Vite middleware factory — SSRs page requests through the app server entry
|
|
83
|
+
*/
|
|
84
|
+
export const createSsrMiddleware = (
|
|
85
|
+
server: ViteDevServer,
|
|
86
|
+
config: SolidFrameworkConfig,
|
|
87
|
+
): ((
|
|
88
|
+
req: IncomingMessage,
|
|
89
|
+
res: ServerResponse,
|
|
90
|
+
next: (err?: unknown) => void,
|
|
91
|
+
) => void) => {
|
|
92
|
+
return (req, res, next) => {
|
|
93
|
+
const pathname = req.url?.split("?")[0] ?? "/";
|
|
94
|
+
|
|
95
|
+
// Framework endpoints carry dots too (sitemap.xml, openapi.json)
|
|
96
|
+
// — they must reach the server entry, not Vite's static fallback
|
|
97
|
+
const frameworkPath =
|
|
98
|
+
pathname === "/sitemap.xml" ||
|
|
99
|
+
pathname === "/robots.txt" ||
|
|
100
|
+
pathname === "/favicon.ico" ||
|
|
101
|
+
pathname.startsWith("/_server/") ||
|
|
102
|
+
pathname.startsWith("/_docs/") ||
|
|
103
|
+
pathname === "/_og" ||
|
|
104
|
+
pathname === "/_image";
|
|
105
|
+
|
|
106
|
+
// Let Vite internals and static assets pass through — everything
|
|
107
|
+
// else (pages, api prefixes, server fns, actions) goes to the entry
|
|
108
|
+
if (
|
|
109
|
+
!frameworkPath &&
|
|
110
|
+
(pathname.startsWith("/@") ||
|
|
111
|
+
pathname.startsWith("/node_modules/") ||
|
|
112
|
+
pathname.startsWith("/src/") ||
|
|
113
|
+
(pathname.includes(".") && !pathname.endsWith("/")))
|
|
114
|
+
) {
|
|
115
|
+
next();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
void (async () => {
|
|
120
|
+
try {
|
|
121
|
+
const mod = (await server.ssrLoadModule(
|
|
122
|
+
`/${config.entries.server}`,
|
|
123
|
+
)) as ServerEntryModule;
|
|
124
|
+
const handler = mod.default ?? mod.fetch ?? mod.handler;
|
|
125
|
+
if (!handler) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`[solid-framework] ${config.entries.server} must export a fetch handler (default, fetch, or handler)`,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const request = await toWebRequest(req);
|
|
132
|
+
const response = await handler(request);
|
|
133
|
+
await writeResponse(res, response);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
server.ssrFixStacktrace(error as Error);
|
|
136
|
+
res.statusCode = 500;
|
|
137
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
138
|
+
res.end(errorOverlayHtml(error as Error));
|
|
139
|
+
}
|
|
140
|
+
})();
|
|
141
|
+
};
|
|
142
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Public API - @wrikka/solid-framework/vite
|
|
2
|
+
|
|
3
|
+
export * from "./auto-imports";
|
|
4
|
+
export * from "./dev-middleware";
|
|
5
|
+
export * from "./plugin";
|
|
6
|
+
export * from "./prerender";
|
|
7
|
+
export * from "./server-fn-ids";
|
|
8
|
+
export * from "./types";
|
|
9
|
+
export * from "./virtual-modules";
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* solidFramework Vite Plugin
|
|
3
|
+
* Single orchestrating plugin — router codegen, virtual modules,
|
|
4
|
+
* server-module boundary, auto-imports and the dev SSR middleware
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
8
|
+
import { basename, join, sep } from "node:path";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
import type { Plugin } from "vite";
|
|
11
|
+
import { resolveConfig } from "#app/modules/config";
|
|
12
|
+
import { buildRouteManifest } from "#app/modules/file-routes";
|
|
13
|
+
import { solidRouterPlugin } from "#router/vite-plugin";
|
|
14
|
+
import { FRAMEWORK_AUTO_IMPORTS, injectAutoImports } from "./auto-imports";
|
|
15
|
+
import { createSsrMiddleware } from "./dev-middleware";
|
|
16
|
+
import { prerenderToDisk } from "./prerender";
|
|
17
|
+
import { injectServerFnIds } from "./server-fn-ids";
|
|
18
|
+
import type { SolidFrameworkPluginOptions } from "./types";
|
|
19
|
+
import { VIRTUAL_CONFIG, VIRTUAL_ROUTES, VIRTUAL_SERVER_FNS } from "./types";
|
|
20
|
+
import {
|
|
21
|
+
configModuleCode,
|
|
22
|
+
isServerModuleId,
|
|
23
|
+
routesModuleCode,
|
|
24
|
+
serverFnsModuleCode,
|
|
25
|
+
serverStubCode,
|
|
26
|
+
} from "./virtual-modules";
|
|
27
|
+
|
|
28
|
+
const RESOLVED_PREFIX = "\0";
|
|
29
|
+
|
|
30
|
+
const resolveVirtualId = (id: string): string => `${RESOLVED_PREFIX}${id}`;
|
|
31
|
+
|
|
32
|
+
export const solidFramework = (
|
|
33
|
+
options: SolidFrameworkPluginOptions = {},
|
|
34
|
+
): Plugin[] => {
|
|
35
|
+
const config = resolveConfig(options.config);
|
|
36
|
+
|
|
37
|
+
const autoImportMap =
|
|
38
|
+
options.autoImports === false
|
|
39
|
+
? null
|
|
40
|
+
: {
|
|
41
|
+
...FRAMEWORK_AUTO_IMPORTS,
|
|
42
|
+
...(typeof options.autoImports === "object"
|
|
43
|
+
? options.autoImports
|
|
44
|
+
: {}),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
let rootDir = "";
|
|
48
|
+
let ssrOutDir = "dist/server";
|
|
49
|
+
// `instrumentation.ts` convention — discovered at project/src root
|
|
50
|
+
let instrumentationPath: string | undefined;
|
|
51
|
+
|
|
52
|
+
const core: Plugin = {
|
|
53
|
+
name: "solid-framework",
|
|
54
|
+
enforce: "pre",
|
|
55
|
+
|
|
56
|
+
configResolved(resolved) {
|
|
57
|
+
rootDir = resolved.root;
|
|
58
|
+
if (process.env.SOLID_SSR_BUILD === "1") {
|
|
59
|
+
ssrOutDir = resolved.build.outDir;
|
|
60
|
+
}
|
|
61
|
+
// instrumentation.ts convention — first match wins
|
|
62
|
+
for (const dir of [resolved.root, join(resolved.root, "src")]) {
|
|
63
|
+
for (const ext of ["ts", "tsx"]) {
|
|
64
|
+
const candidate = join(dir, `instrumentation.${ext}`);
|
|
65
|
+
if (existsSync(candidate)) {
|
|
66
|
+
instrumentationPath = candidate.split(sep).join("/");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
config(_userConfig, env) {
|
|
73
|
+
return {
|
|
74
|
+
ssr: {
|
|
75
|
+
noExternal: ["@wrikka/solid-framework"],
|
|
76
|
+
},
|
|
77
|
+
// @wrikka/web-server-toolkit is a runtime (bun) dependency — keep it
|
|
78
|
+
// external in SSR builds so rolldown never opens its dist bundle
|
|
79
|
+
...(env.isSsrBuild === true
|
|
80
|
+
? {
|
|
81
|
+
build: {
|
|
82
|
+
rollupOptions: {
|
|
83
|
+
external: ["@wrikka/web-server-toolkit", /^bun(:|$)/],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
: {}),
|
|
88
|
+
server: {
|
|
89
|
+
watch: { ignored: ["**/dist/**"] },
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
resolveId(id, _importer, resolveOptions) {
|
|
95
|
+
if (
|
|
96
|
+
id === VIRTUAL_CONFIG ||
|
|
97
|
+
id === VIRTUAL_ROUTES ||
|
|
98
|
+
id === VIRTUAL_SERVER_FNS
|
|
99
|
+
) {
|
|
100
|
+
return resolveVirtualId(id);
|
|
101
|
+
}
|
|
102
|
+
// @wrikka/web-server-toolkit is server-only — stub it out of client bundles
|
|
103
|
+
if (id === "@wrikka/web-server-toolkit" && resolveOptions?.ssr !== true) {
|
|
104
|
+
return `${RESOLVED_PREFIX}web-server`;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
load(id, loadOptions) {
|
|
110
|
+
if (id.startsWith(RESOLVED_PREFIX)) {
|
|
111
|
+
const virtual = id.slice(RESOLVED_PREFIX.length);
|
|
112
|
+
if (virtual === VIRTUAL_CONFIG)
|
|
113
|
+
// instrumentation hooks are server-only — merge only in SSR builds
|
|
114
|
+
return configModuleCode(
|
|
115
|
+
config,
|
|
116
|
+
loadOptions?.ssr === true ? instrumentationPath : undefined,
|
|
117
|
+
);
|
|
118
|
+
if (virtual === VIRTUAL_ROUTES)
|
|
119
|
+
return routesModuleCode(config.routesDir);
|
|
120
|
+
if (virtual === VIRTUAL_SERVER_FNS) return serverFnsModuleCode();
|
|
121
|
+
if (virtual === "web-server") {
|
|
122
|
+
return `const fail = () => { throw new Error("[solid-framework] @wrikka/web-server-toolkit is server-only and cannot run on the client"); };\nexport const createRequestHandler = fail;\nexport default fail;\n`;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// .server.ts boundary — stub server-only modules outside SSR builds
|
|
128
|
+
if (isServerModuleId(id) && loadOptions?.ssr !== true) {
|
|
129
|
+
return serverStubCode(id);
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
transform(code, id) {
|
|
135
|
+
if (!/\.[jt]sx?$/.test(id) || id.includes("node_modules")) return null;
|
|
136
|
+
if (isServerModuleId(id)) return null;
|
|
137
|
+
|
|
138
|
+
let next = autoImportMap ? injectAutoImports(code, autoImportMap) : null;
|
|
139
|
+
let current = next ?? code;
|
|
140
|
+
const withIds = injectServerFnIds(current, id);
|
|
141
|
+
if (withIds !== current) {
|
|
142
|
+
current = withIds;
|
|
143
|
+
next = current;
|
|
144
|
+
}
|
|
145
|
+
for (const plugin of config.plugins ?? []) {
|
|
146
|
+
const out = plugin.transform?.(current, id);
|
|
147
|
+
if (out != null) {
|
|
148
|
+
current = out;
|
|
149
|
+
next = out;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return next === null ? null : { code: current, map: null };
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
buildStart() {
|
|
156
|
+
// Notify plugins of the resolved route manifest — scan runs on
|
|
157
|
+
// the node side so build/dev share one source of truth
|
|
158
|
+
if (!existsSync(config.routesDir)) return;
|
|
159
|
+
const files: string[] = [];
|
|
160
|
+
const walk = (dir: string) => {
|
|
161
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
162
|
+
const full = join(dir, entry.name);
|
|
163
|
+
if (entry.isDirectory()) walk(full);
|
|
164
|
+
else files.push(full.split(sep).join("/"));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
walk(config.routesDir);
|
|
168
|
+
const manifest = buildRouteManifest(files, config.routesDir);
|
|
169
|
+
for (const plugin of config.plugins ?? []) {
|
|
170
|
+
plugin.routesResolved?.(manifest);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
handleHotUpdate({ file, server }) {
|
|
175
|
+
// Route file edits trigger a full reload — the manifest and
|
|
176
|
+
// convention wiring (layouts/boundaries) can change shape
|
|
177
|
+
const routesRoot = `${config.routesDir.split("/").join(sep)}${sep}`;
|
|
178
|
+
if (file.split("/").join(sep).startsWith(routesRoot)) {
|
|
179
|
+
server.ws.send({ type: "full-reload" });
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
configureServer(server) {
|
|
184
|
+
if (options.ssrMiddleware === false) return;
|
|
185
|
+
server.middlewares.use(createSsrMiddleware(server, config));
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
generateBundle(_options, bundle) {
|
|
189
|
+
if (process.env.SOLID_SSR_BUILD === "1") return;
|
|
190
|
+
// Preload manifest — entry chunks + css for head hints
|
|
191
|
+
const entries = Object.values(bundle)
|
|
192
|
+
.filter(
|
|
193
|
+
(o) =>
|
|
194
|
+
(o.type === "chunk" && o.isEntry) || o.fileName.endsWith(".css"),
|
|
195
|
+
)
|
|
196
|
+
.map((o) => `/${o.fileName}`);
|
|
197
|
+
if (entries.length) {
|
|
198
|
+
this.emitFile({
|
|
199
|
+
type: "asset",
|
|
200
|
+
fileName: "preload-manifest.json",
|
|
201
|
+
source: JSON.stringify({ preloads: entries }),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
// PWA — emit sw.js + manifest.webmanifest into the client build
|
|
205
|
+
if (!config.pwa) return;
|
|
206
|
+
const pwa = config.pwa;
|
|
207
|
+
const precache = [
|
|
208
|
+
"/",
|
|
209
|
+
...(pwa.precache ?? []),
|
|
210
|
+
...(pwa.manifest ? ["/manifest.webmanifest"] : []),
|
|
211
|
+
];
|
|
212
|
+
this.emitFile({
|
|
213
|
+
type: "asset",
|
|
214
|
+
fileName: "sw.js",
|
|
215
|
+
source: `const CACHE="sf-v1";const PRECACHE=${JSON.stringify(precache)};self.addEventListener("install",e=>{e.waitUntil(caches.open(CACHE).then(c=>c.addAll(PRECACHE)).then(()=>self.skipWaiting()))});self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())});self.addEventListener("fetch",e=>{if(e.request.method!=="GET")return;const nav=e.request.mode==="navigate"||(e.request.headers.get("accept")||"").includes("text/html");if(nav){e.respondWith(fetch(e.request).then(res=>{const copy=res.clone();caches.open(CACHE).then(c=>c.put(e.request,copy));return res}).catch(()=>caches.match(e.request).then(r=>r||caches.match("/"))));return}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request).then(res=>{const copy=res.clone();caches.open(CACHE).then(c=>c.put(e.request,copy));return res})))});`,
|
|
216
|
+
});
|
|
217
|
+
if (pwa.manifest) {
|
|
218
|
+
this.emitFile({
|
|
219
|
+
type: "asset",
|
|
220
|
+
fileName: "manifest.webmanifest",
|
|
221
|
+
source: JSON.stringify({
|
|
222
|
+
name: pwa.manifest.name ?? "app",
|
|
223
|
+
short_name: pwa.manifest.shortName ?? pwa.manifest.name ?? "app",
|
|
224
|
+
start_url: pwa.manifest.startUrl ?? "/",
|
|
225
|
+
display: pwa.manifest.display ?? "standalone",
|
|
226
|
+
background_color: pwa.manifest.background ?? "#ffffff",
|
|
227
|
+
theme_color: pwa.manifest.theme ?? "#000000",
|
|
228
|
+
icons: pwa.manifest.icons ?? [],
|
|
229
|
+
}),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
async closeBundle() {
|
|
235
|
+
// Build-time prerender — after the SSR bundle is written, load
|
|
236
|
+
// the built server entry and render configured routes to disk
|
|
237
|
+
if (process.env.SOLID_SSR_BUILD !== "1" || !config.prerender) return;
|
|
238
|
+
const pre = config.prerender;
|
|
239
|
+
if (!pre.routes?.length && !pre.crawlLinks) return;
|
|
240
|
+
|
|
241
|
+
const entryFile = join(
|
|
242
|
+
rootDir || ".",
|
|
243
|
+
ssrOutDir,
|
|
244
|
+
basename(config.entries.server).replace(/\.[jt]sx?$/, ".js"),
|
|
245
|
+
);
|
|
246
|
+
const mod = (await import(pathToFileURL(entryFile).href)) as {
|
|
247
|
+
default?: (request: Request) => Promise<Response>;
|
|
248
|
+
};
|
|
249
|
+
const handler = mod.default;
|
|
250
|
+
if (typeof handler !== "function") {
|
|
251
|
+
console.warn(
|
|
252
|
+
"[solid-framework] prerender skipped — server entry has no default fetch handler",
|
|
253
|
+
);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const written = await prerenderToDisk(handler, {
|
|
258
|
+
routes: pre.routes,
|
|
259
|
+
crawlLinks: pre.crawlLinks,
|
|
260
|
+
outDir: pre.outDir ?? join(rootDir || ".", "dist"),
|
|
261
|
+
});
|
|
262
|
+
console.log(
|
|
263
|
+
`[solid-framework] prerendered ${written.length} route(s): ${written
|
|
264
|
+
.map((w) => w.path)
|
|
265
|
+
.join(", ")}`,
|
|
266
|
+
);
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const plugins: Plugin[] = [core];
|
|
271
|
+
|
|
272
|
+
if (options.router !== false) {
|
|
273
|
+
plugins.push(solidRouterPlugin(options.router ?? {}));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return plugins;
|
|
277
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build-time Prerender
|
|
3
|
+
* Renders routes through the built server entry and writes static
|
|
4
|
+
* HTML to outDir — the SSG equivalent of Nitro's prerender, with
|
|
5
|
+
* crawlLinks discovering pages from rendered anchors
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
|
|
11
|
+
/** Same-origin links found in rendered HTML — `href="/path"` */
|
|
12
|
+
export const extractLinks = (html: string): string[] => {
|
|
13
|
+
const links = new Set<string>();
|
|
14
|
+
for (const match of html.matchAll(/href="(\/[^"#]*)"/g)) {
|
|
15
|
+
const path = (match[1] ?? "").split("?")[0];
|
|
16
|
+
if (path && !path.startsWith("//")) links.add(path);
|
|
17
|
+
}
|
|
18
|
+
return [...links];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export interface PrerenderResult {
|
|
22
|
+
path: string;
|
|
23
|
+
file: string;
|
|
24
|
+
status: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const outFile = (outDir: string, path: string): string =>
|
|
28
|
+
join(
|
|
29
|
+
outDir,
|
|
30
|
+
path === "/"
|
|
31
|
+
? "index.html"
|
|
32
|
+
: `${path.replace(/^\/+|\/+$/g, "")}/index.html`,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const prerenderToDisk = async (
|
|
36
|
+
handler: (request: Request) => Promise<Response>,
|
|
37
|
+
options: {
|
|
38
|
+
routes?: string[];
|
|
39
|
+
crawlLinks?: boolean;
|
|
40
|
+
outDir: string;
|
|
41
|
+
/** Base origin for constructed requests — default http://localhost */
|
|
42
|
+
base?: string;
|
|
43
|
+
},
|
|
44
|
+
): Promise<PrerenderResult[]> => {
|
|
45
|
+
const base = options.base ?? "http://localhost";
|
|
46
|
+
const queue = [...(options.routes ?? ["/"])];
|
|
47
|
+
const seen = new Set<string>();
|
|
48
|
+
const written: PrerenderResult[] = [];
|
|
49
|
+
|
|
50
|
+
while (queue.length > 0) {
|
|
51
|
+
const path = queue.shift() as string;
|
|
52
|
+
if (seen.has(path)) continue;
|
|
53
|
+
seen.add(path);
|
|
54
|
+
|
|
55
|
+
const response = await handler(new Request(`${base}${path}`));
|
|
56
|
+
if (!response.ok) continue;
|
|
57
|
+
|
|
58
|
+
const html = await response.text();
|
|
59
|
+
const file = outFile(options.outDir, path);
|
|
60
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
61
|
+
writeFileSync(file, html);
|
|
62
|
+
written.push({ path, file, status: response.status });
|
|
63
|
+
|
|
64
|
+
if (options.crawlLinks) {
|
|
65
|
+
for (const link of extractLinks(html)) {
|
|
66
|
+
if (!seen.has(link)) queue.push(link);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return written;
|
|
72
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Fn Id Transform
|
|
3
|
+
* Injects stable ids into `createServerFn({ ... })` calls that omit
|
|
4
|
+
* `id` — the hash derives from file path + call index so the client
|
|
5
|
+
* and server bundles agree without a runtime handshake
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
|
|
10
|
+
const stableId = (fileId: string, index: number): string =>
|
|
11
|
+
`sf_${createHash("sha256").update(`${fileId}#${index}`).digest("hex").slice(0, 12)}`;
|
|
12
|
+
|
|
13
|
+
/** Find the closing brace for an object literal starting at `open` */
|
|
14
|
+
const matchingBrace = (code: string, open: number): number => {
|
|
15
|
+
let depth = 0;
|
|
16
|
+
for (let i = open; i < code.length; i++) {
|
|
17
|
+
const ch = code[i];
|
|
18
|
+
if (ch === "{") depth++;
|
|
19
|
+
else if (ch === "}") {
|
|
20
|
+
depth--;
|
|
21
|
+
if (depth === 0) return i;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return -1;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const injectServerFnIds = (code: string, fileId: string): string => {
|
|
28
|
+
if (!code.includes("createServerFn(")) return code;
|
|
29
|
+
|
|
30
|
+
const pattern = /createServerFn\s*\(\s*\{/g;
|
|
31
|
+
let out = "";
|
|
32
|
+
let cursor = 0;
|
|
33
|
+
let index = 0;
|
|
34
|
+
let match: RegExpExecArray | null;
|
|
35
|
+
|
|
36
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: classic exec loop
|
|
37
|
+
while ((match = pattern.exec(code)) !== null) {
|
|
38
|
+
const open = match.index + match[0].length - 1; // position of "{"
|
|
39
|
+
const close = matchingBrace(code, open);
|
|
40
|
+
if (close === -1) break;
|
|
41
|
+
const body = code.slice(open + 1, close);
|
|
42
|
+
index++;
|
|
43
|
+
|
|
44
|
+
if (/(^|[\s,}])id\s*:/.test(body)) continue; // explicit id kept
|
|
45
|
+
|
|
46
|
+
out += code.slice(cursor, open + 1);
|
|
47
|
+
out += `id: "${stableId(fileId, index)}",`;
|
|
48
|
+
cursor = open + 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return cursor > 0 ? out + code.slice(cursor) : code;
|
|
52
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite Plugin Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { SolidFrameworkConfig } from "#app/types";
|
|
6
|
+
import type { SolidRouterPluginOptions } from "#router/vite-plugin";
|
|
7
|
+
|
|
8
|
+
export interface SolidFrameworkPluginOptions {
|
|
9
|
+
/** Framework config (also emitted to virtual:solid-framework/config) */
|
|
10
|
+
config?: Partial<SolidFrameworkConfig>;
|
|
11
|
+
/** Router plugin options — pass false to disable route codegen plugin */
|
|
12
|
+
router?: SolidRouterPluginOptions | false;
|
|
13
|
+
/**
|
|
14
|
+
* Auto-import map: export name → module specifier.
|
|
15
|
+
* true = framework defaults; false = disabled; object = merged with defaults
|
|
16
|
+
*/
|
|
17
|
+
autoImports?: Record<string, string | string[]> | boolean;
|
|
18
|
+
/** Serve SSR through the dev middleware — default true */
|
|
19
|
+
ssrMiddleware?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const VIRTUAL_CONFIG = "virtual:solid-framework/config";
|
|
23
|
+
export const VIRTUAL_ROUTES = "virtual:solid-framework/routes";
|
|
24
|
+
export const VIRTUAL_SERVER_FNS = "virtual:solid-framework/server-fns";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Virtual Modules
|
|
3
|
+
* Code emitted for framework virtual imports
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { SolidFrameworkConfig } from "#app/types";
|
|
7
|
+
|
|
8
|
+
export const configModuleCode = (
|
|
9
|
+
config: SolidFrameworkConfig,
|
|
10
|
+
instrumentationPath?: string,
|
|
11
|
+
): string =>
|
|
12
|
+
instrumentationPath
|
|
13
|
+
? [
|
|
14
|
+
`import * as _instr from ${JSON.stringify(instrumentationPath)};`,
|
|
15
|
+
`export default Object.assign(${JSON.stringify(config)}, {`,
|
|
16
|
+
" instrumentation: {",
|
|
17
|
+
" register: _instr.register,",
|
|
18
|
+
" onRequest: _instr.onRequest,",
|
|
19
|
+
" onError: _instr.onError,",
|
|
20
|
+
" },",
|
|
21
|
+
"});",
|
|
22
|
+
].join("\n")
|
|
23
|
+
: `export default ${JSON.stringify(config)};`;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Route manifest — Vite glob import over the routes directory, plus a
|
|
27
|
+
* prebuilt RouteManifest for <FileRoutes>. Convention files
|
|
28
|
+
* (error/loading/not-found/layout) are included in the modules map.
|
|
29
|
+
*/
|
|
30
|
+
export const routesModuleCode = (routesDir: string): string =>
|
|
31
|
+
[
|
|
32
|
+
'import { buildRouteManifest, preloadFileRoute } from "@wrikka/solid-framework/internal";',
|
|
33
|
+
`const modules = import.meta.glob("/${routesDir}/**/*.{tsx,ts,jsx,js}");`,
|
|
34
|
+
`export const routeFiles = Object.keys(modules).map((file) => file.slice(1));`,
|
|
35
|
+
`export const routeModules = Object.fromEntries(Object.entries(modules).map(([k, v]) => [k.slice(1), v]));`,
|
|
36
|
+
`export const manifest = buildRouteManifest(routeFiles, ${JSON.stringify(routesDir)});`,
|
|
37
|
+
"export const preloadRoute = (path) => preloadFileRoute(path, manifest, routeModules);",
|
|
38
|
+
"export default manifest;",
|
|
39
|
+
].join("\n");
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Server function registry — eager glob of server modules so every
|
|
43
|
+
* createServerFn descriptor registers itself on the server bundle.
|
|
44
|
+
* Conventions:
|
|
45
|
+
* *.server.ts — server-only code (stubbed out of client bundles)
|
|
46
|
+
* *.fn.ts — isomorphic createServerFn definitions (client ships the
|
|
47
|
+
* remote caller only; handler executes server-side)
|
|
48
|
+
*/
|
|
49
|
+
export const serverFnsModuleCode = (): string =>
|
|
50
|
+
[
|
|
51
|
+
'const modules = import.meta.glob("/src/**/*.{server,fn}.{ts,tsx}", { eager: true });',
|
|
52
|
+
"export const serverModules = modules;",
|
|
53
|
+
"export default modules;",
|
|
54
|
+
].join("\n");
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Stub emitted when a .server module leaks into the client bundle
|
|
58
|
+
*/
|
|
59
|
+
export const serverStubCode = (id: string): string =>
|
|
60
|
+
[
|
|
61
|
+
`throw new Error(`,
|
|
62
|
+
` "[solid-framework] \\"${id}\\" is a .server module and cannot be imported from the client. ` +
|
|
63
|
+
`Move the import into a loader, createServerFn handler, or .server.ts file."`,
|
|
64
|
+
`);`,
|
|
65
|
+
].join("\n");
|
|
66
|
+
|
|
67
|
+
export const isServerModuleId = (id: string): boolean =>
|
|
68
|
+
/\.server\.(ts|tsx|js|jsx|mts|cts)$/.test(id.split("?")[0] ?? id);
|