@buenojs/bueno 0.8.8 → 0.8.10
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 +1 -1
- package/dist/index.js +15 -12
- package/dist/modules/index.js +2 -2
- package/dist/template/index.js +13 -10
- package/dist/templates/index.js +13 -10
- package/llms.txt +1 -1
- package/package.json +2 -2
- package/src/cli/commands/new.ts +1 -1
- package/src/cli/templates/frontend/react.ts +1 -1
- package/src/cli/templates/frontend/solid.ts +1 -1
- package/src/cli/templates/frontend/svelte.ts +1 -1
- package/src/cli/templates/frontend/vue.ts +1 -1
- package/src/cli/templates/project/default.ts +1 -1
- package/src/cli/templates/project/website.ts +3 -3
- package/src/templates/loader.ts +1 -1
- package/src/templates/renderers/simple.ts +13 -10
- package/src/validation/index.ts +20 -21
- package/tsconfig.json +1 -1
- package/dist/cache/index.d.ts +0 -187
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cli/bin.d.ts +0 -8
- package/dist/cli/bin.d.ts.map +0 -1
- package/dist/cli/commands/add-frontend.d.ts +0 -7
- package/dist/cli/commands/add-frontend.d.ts.map +0 -1
- package/dist/cli/commands/build.d.ts +0 -7
- package/dist/cli/commands/build.d.ts.map +0 -1
- package/dist/cli/commands/dev.d.ts +0 -7
- package/dist/cli/commands/dev.d.ts.map +0 -1
- package/dist/cli/commands/generate.d.ts +0 -7
- package/dist/cli/commands/generate.d.ts.map +0 -1
- package/dist/cli/commands/help.d.ts +0 -7
- package/dist/cli/commands/help.d.ts.map +0 -1
- package/dist/cli/commands/index.d.ts +0 -59
- package/dist/cli/commands/index.d.ts.map +0 -1
- package/dist/cli/commands/migration.d.ts +0 -7
- package/dist/cli/commands/migration.d.ts.map +0 -1
- package/dist/cli/commands/new.d.ts +0 -7
- package/dist/cli/commands/new.d.ts.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -7
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/core/args.d.ts +0 -61
- package/dist/cli/core/args.d.ts.map +0 -1
- package/dist/cli/core/console.d.ts +0 -135
- package/dist/cli/core/console.d.ts.map +0 -1
- package/dist/cli/core/index.d.ts +0 -10
- package/dist/cli/core/index.d.ts.map +0 -1
- package/dist/cli/core/prompt.d.ts +0 -63
- package/dist/cli/core/prompt.d.ts.map +0 -1
- package/dist/cli/core/spinner.d.ts +0 -111
- package/dist/cli/core/spinner.d.ts.map +0 -1
- package/dist/cli/index.d.ts +0 -47
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/templates/database/index.d.ts +0 -24
- package/dist/cli/templates/database/index.d.ts.map +0 -1
- package/dist/cli/templates/database/mysql.d.ts +0 -6
- package/dist/cli/templates/database/mysql.d.ts.map +0 -1
- package/dist/cli/templates/database/none.d.ts +0 -8
- package/dist/cli/templates/database/none.d.ts.map +0 -1
- package/dist/cli/templates/database/postgresql.d.ts +0 -6
- package/dist/cli/templates/database/postgresql.d.ts.map +0 -1
- package/dist/cli/templates/database/sqlite.d.ts +0 -6
- package/dist/cli/templates/database/sqlite.d.ts.map +0 -1
- package/dist/cli/templates/deploy.d.ts +0 -41
- package/dist/cli/templates/deploy.d.ts.map +0 -1
- package/dist/cli/templates/docker.d.ts +0 -30
- package/dist/cli/templates/docker.d.ts.map +0 -1
- package/dist/cli/templates/frontend/index.d.ts +0 -25
- package/dist/cli/templates/frontend/index.d.ts.map +0 -1
- package/dist/cli/templates/frontend/none.d.ts +0 -8
- package/dist/cli/templates/frontend/none.d.ts.map +0 -1
- package/dist/cli/templates/frontend/react.d.ts +0 -6
- package/dist/cli/templates/frontend/react.d.ts.map +0 -1
- package/dist/cli/templates/frontend/solid.d.ts +0 -6
- package/dist/cli/templates/frontend/solid.d.ts.map +0 -1
- package/dist/cli/templates/frontend/svelte.d.ts +0 -6
- package/dist/cli/templates/frontend/svelte.d.ts.map +0 -1
- package/dist/cli/templates/frontend/vue.d.ts +0 -6
- package/dist/cli/templates/frontend/vue.d.ts.map +0 -1
- package/dist/cli/templates/generators/index.d.ts +0 -29
- package/dist/cli/templates/generators/index.d.ts.map +0 -1
- package/dist/cli/templates/generators/types.d.ts +0 -32
- package/dist/cli/templates/generators/types.d.ts.map +0 -1
- package/dist/cli/templates/index.d.ts +0 -12
- package/dist/cli/templates/index.d.ts.map +0 -1
- package/dist/cli/templates/project/api.d.ts +0 -6
- package/dist/cli/templates/project/api.d.ts.map +0 -1
- package/dist/cli/templates/project/default.d.ts +0 -6
- package/dist/cli/templates/project/default.d.ts.map +0 -1
- package/dist/cli/templates/project/fullstack.d.ts +0 -14
- package/dist/cli/templates/project/fullstack.d.ts.map +0 -1
- package/dist/cli/templates/project/index.d.ts +0 -26
- package/dist/cli/templates/project/index.d.ts.map +0 -1
- package/dist/cli/templates/project/minimal.d.ts +0 -6
- package/dist/cli/templates/project/minimal.d.ts.map +0 -1
- package/dist/cli/templates/project/types.d.ts +0 -80
- package/dist/cli/templates/project/types.d.ts.map +0 -1
- package/dist/cli/templates/project/website.d.ts +0 -8
- package/dist/cli/templates/project/website.d.ts.map +0 -1
- package/dist/cli/utils/fs.d.ts +0 -137
- package/dist/cli/utils/fs.d.ts.map +0 -1
- package/dist/cli/utils/index.d.ts +0 -9
- package/dist/cli/utils/index.d.ts.map +0 -1
- package/dist/cli/utils/strings.d.ts +0 -86
- package/dist/cli/utils/strings.d.ts.map +0 -1
- package/dist/cli/utils/version.d.ts +0 -15
- package/dist/cli/utils/version.d.ts.map +0 -1
- package/dist/config/env-validation.d.ts +0 -49
- package/dist/config/env-validation.d.ts.map +0 -1
- package/dist/config/env.d.ts +0 -167
- package/dist/config/env.d.ts.map +0 -1
- package/dist/config/index.d.ts +0 -168
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/loader.d.ts +0 -81
- package/dist/config/loader.d.ts.map +0 -1
- package/dist/config/merge.d.ts +0 -66
- package/dist/config/merge.d.ts.map +0 -1
- package/dist/config/types.d.ts +0 -322
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/validation.d.ts +0 -100
- package/dist/config/validation.d.ts.map +0 -1
- package/dist/container/forward-ref.d.ts +0 -116
- package/dist/container/forward-ref.d.ts.map +0 -1
- package/dist/container/index.d.ts +0 -95
- package/dist/container/index.d.ts.map +0 -1
- package/dist/context/index.d.ts +0 -143
- package/dist/context/index.d.ts.map +0 -1
- package/dist/database/index.d.ts +0 -219
- package/dist/database/index.d.ts.map +0 -1
- package/dist/database/migrations/index.d.ts +0 -146
- package/dist/database/migrations/index.d.ts.map +0 -1
- package/dist/database/orm/builder.d.ts +0 -122
- package/dist/database/orm/builder.d.ts.map +0 -1
- package/dist/database/orm/casts/index.d.ts +0 -16
- package/dist/database/orm/casts/index.d.ts.map +0 -1
- package/dist/database/orm/casts/types.d.ts +0 -16
- package/dist/database/orm/casts/types.d.ts.map +0 -1
- package/dist/database/orm/compiler.d.ts +0 -90
- package/dist/database/orm/compiler.d.ts.map +0 -1
- package/dist/database/orm/hooks/index.d.ts +0 -53
- package/dist/database/orm/hooks/index.d.ts.map +0 -1
- package/dist/database/orm/index.d.ts +0 -21
- package/dist/database/orm/index.d.ts.map +0 -1
- package/dist/database/orm/model-registry.d.ts +0 -33
- package/dist/database/orm/model-registry.d.ts.map +0 -1
- package/dist/database/orm/model.d.ts +0 -245
- package/dist/database/orm/model.d.ts.map +0 -1
- package/dist/database/orm/relationships/base.d.ts +0 -69
- package/dist/database/orm/relationships/base.d.ts.map +0 -1
- package/dist/database/orm/relationships/belongs-to-many.d.ts +0 -47
- package/dist/database/orm/relationships/belongs-to-many.d.ts.map +0 -1
- package/dist/database/orm/relationships/belongs-to.d.ts +0 -17
- package/dist/database/orm/relationships/belongs-to.d.ts.map +0 -1
- package/dist/database/orm/relationships/has-many.d.ts +0 -14
- package/dist/database/orm/relationships/has-many.d.ts.map +0 -1
- package/dist/database/orm/relationships/has-one.d.ts +0 -14
- package/dist/database/orm/relationships/has-one.d.ts.map +0 -1
- package/dist/database/orm/relationships/index.d.ts +0 -10
- package/dist/database/orm/relationships/index.d.ts.map +0 -1
- package/dist/database/orm/scopes/index.d.ts +0 -36
- package/dist/database/orm/scopes/index.d.ts.map +0 -1
- package/dist/database/schema/index.d.ts +0 -155
- package/dist/database/schema/index.d.ts.map +0 -1
- package/dist/events/__tests__/event-system.test.d.ts +0 -2
- package/dist/events/__tests__/event-system.test.d.ts.map +0 -1
- package/dist/events/config.d.ts +0 -16
- package/dist/events/config.d.ts.map +0 -1
- package/dist/events/example-usage.d.ts +0 -12
- package/dist/events/example-usage.d.ts.map +0 -1
- package/dist/events/index.d.ts +0 -27
- package/dist/events/index.d.ts.map +0 -1
- package/dist/events/manager.d.ts +0 -33
- package/dist/events/manager.d.ts.map +0 -1
- package/dist/events/registry.d.ts +0 -31
- package/dist/events/registry.d.ts.map +0 -1
- package/dist/events/types.d.ts +0 -105
- package/dist/events/types.d.ts.map +0 -1
- package/dist/frontend/api-routes.d.ts +0 -189
- package/dist/frontend/api-routes.d.ts.map +0 -1
- package/dist/frontend/bundler.d.ts +0 -99
- package/dist/frontend/bundler.d.ts.map +0 -1
- package/dist/frontend/console-client.d.ts +0 -11
- package/dist/frontend/console-client.d.ts.map +0 -1
- package/dist/frontend/console-stream.d.ts +0 -138
- package/dist/frontend/console-stream.d.ts.map +0 -1
- package/dist/frontend/dev-server.d.ts +0 -174
- package/dist/frontend/dev-server.d.ts.map +0 -1
- package/dist/frontend/file-router.d.ts +0 -170
- package/dist/frontend/file-router.d.ts.map +0 -1
- package/dist/frontend/frameworks/index.d.ts +0 -41
- package/dist/frontend/frameworks/index.d.ts.map +0 -1
- package/dist/frontend/frameworks/react.d.ts +0 -32
- package/dist/frontend/frameworks/react.d.ts.map +0 -1
- package/dist/frontend/frameworks/solid.d.ts +0 -42
- package/dist/frontend/frameworks/solid.d.ts.map +0 -1
- package/dist/frontend/frameworks/svelte.d.ts +0 -57
- package/dist/frontend/frameworks/svelte.d.ts.map +0 -1
- package/dist/frontend/frameworks/vue.d.ts +0 -36
- package/dist/frontend/frameworks/vue.d.ts.map +0 -1
- package/dist/frontend/hmr-client.d.ts +0 -22
- package/dist/frontend/hmr-client.d.ts.map +0 -1
- package/dist/frontend/hmr.d.ts +0 -185
- package/dist/frontend/hmr.d.ts.map +0 -1
- package/dist/frontend/index.d.ts +0 -34
- package/dist/frontend/index.d.ts.map +0 -1
- package/dist/frontend/islands.d.ts +0 -135
- package/dist/frontend/islands.d.ts.map +0 -1
- package/dist/frontend/isr.d.ts +0 -143
- package/dist/frontend/isr.d.ts.map +0 -1
- package/dist/frontend/layout.d.ts +0 -140
- package/dist/frontend/layout.d.ts.map +0 -1
- package/dist/frontend/ssr/react.d.ts +0 -118
- package/dist/frontend/ssr/react.d.ts.map +0 -1
- package/dist/frontend/ssr/solid.d.ts +0 -141
- package/dist/frontend/ssr/solid.d.ts.map +0 -1
- package/dist/frontend/ssr/svelte.d.ts +0 -158
- package/dist/frontend/ssr/svelte.d.ts.map +0 -1
- package/dist/frontend/ssr/vue.d.ts +0 -161
- package/dist/frontend/ssr/vue.d.ts.map +0 -1
- package/dist/frontend/ssr.d.ts +0 -147
- package/dist/frontend/ssr.d.ts.map +0 -1
- package/dist/frontend/types.d.ts +0 -1902
- package/dist/frontend/types.d.ts.map +0 -1
- package/dist/graphql/built-in-engine.d.ts +0 -36
- package/dist/graphql/built-in-engine.d.ts.map +0 -1
- package/dist/graphql/context-builder.d.ts +0 -44
- package/dist/graphql/context-builder.d.ts.map +0 -1
- package/dist/graphql/decorators.d.ts +0 -162
- package/dist/graphql/decorators.d.ts.map +0 -1
- package/dist/graphql/execution-pipeline.d.ts +0 -67
- package/dist/graphql/execution-pipeline.d.ts.map +0 -1
- package/dist/graphql/graphql-module.d.ts +0 -70
- package/dist/graphql/graphql-module.d.ts.map +0 -1
- package/dist/graphql/index.d.ts +0 -48
- package/dist/graphql/index.d.ts.map +0 -1
- package/dist/graphql/metadata.d.ts +0 -37
- package/dist/graphql/metadata.d.ts.map +0 -1
- package/dist/graphql/schema-builder.d.ts +0 -34
- package/dist/graphql/schema-builder.d.ts.map +0 -1
- package/dist/graphql/subscription-handler.d.ts +0 -47
- package/dist/graphql/subscription-handler.d.ts.map +0 -1
- package/dist/graphql/types.d.ts +0 -252
- package/dist/graphql/types.d.ts.map +0 -1
- package/dist/health/index.d.ts +0 -176
- package/dist/health/index.d.ts.map +0 -1
- package/dist/i18n/engine.d.ts +0 -105
- package/dist/i18n/engine.d.ts.map +0 -1
- package/dist/i18n/index.d.ts +0 -13
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/loader.d.ts +0 -79
- package/dist/i18n/loader.d.ts.map +0 -1
- package/dist/i18n/middleware.d.ts +0 -96
- package/dist/i18n/middleware.d.ts.map +0 -1
- package/dist/i18n/negotiator.d.ts +0 -84
- package/dist/i18n/negotiator.d.ts.map +0 -1
- package/dist/i18n/types.d.ts +0 -129
- package/dist/i18n/types.d.ts.map +0 -1
- package/dist/index.d.ts +0 -48
- package/dist/index.d.ts.map +0 -1
- package/dist/jobs/drivers/memory.d.ts +0 -38
- package/dist/jobs/drivers/memory.d.ts.map +0 -1
- package/dist/jobs/drivers/redis.d.ts +0 -34
- package/dist/jobs/drivers/redis.d.ts.map +0 -1
- package/dist/jobs/index.d.ts +0 -12
- package/dist/jobs/index.d.ts.map +0 -1
- package/dist/jobs/queue.d.ts +0 -93
- package/dist/jobs/queue.d.ts.map +0 -1
- package/dist/jobs/types.d.ts +0 -193
- package/dist/jobs/types.d.ts.map +0 -1
- package/dist/jobs/worker.d.ts +0 -91
- package/dist/jobs/worker.d.ts.map +0 -1
- package/dist/lock/index.d.ts +0 -141
- package/dist/lock/index.d.ts.map +0 -1
- package/dist/logger/index.d.ts +0 -156
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/logger/transports/index.d.ts +0 -371
- package/dist/logger/transports/index.d.ts.map +0 -1
- package/dist/metrics/index.d.ts +0 -163
- package/dist/metrics/index.d.ts.map +0 -1
- package/dist/middleware/built-in.d.ts +0 -50
- package/dist/middleware/built-in.d.ts.map +0 -1
- package/dist/middleware/index.d.ts +0 -40
- package/dist/middleware/index.d.ts.map +0 -1
- package/dist/migrations/index.d.ts +0 -10
- package/dist/migrations/index.d.ts.map +0 -1
- package/dist/modules/filters.d.ts +0 -150
- package/dist/modules/filters.d.ts.map +0 -1
- package/dist/modules/guards.d.ts +0 -188
- package/dist/modules/guards.d.ts.map +0 -1
- package/dist/modules/index.d.ts +0 -266
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/modules/interceptors.d.ts +0 -242
- package/dist/modules/interceptors.d.ts.map +0 -1
- package/dist/modules/lazy.d.ts +0 -187
- package/dist/modules/lazy.d.ts.map +0 -1
- package/dist/modules/lifecycle.d.ts +0 -221
- package/dist/modules/lifecycle.d.ts.map +0 -1
- package/dist/modules/metadata.d.ts +0 -32
- package/dist/modules/metadata.d.ts.map +0 -1
- package/dist/modules/pipes.d.ts +0 -287
- package/dist/modules/pipes.d.ts.map +0 -1
- package/dist/notification/channels/base.d.ts +0 -32
- package/dist/notification/channels/base.d.ts.map +0 -1
- package/dist/notification/channels/email.d.ts +0 -37
- package/dist/notification/channels/email.d.ts.map +0 -1
- package/dist/notification/channels/push.d.ts +0 -37
- package/dist/notification/channels/push.d.ts.map +0 -1
- package/dist/notification/channels/sms.d.ts +0 -37
- package/dist/notification/channels/sms.d.ts.map +0 -1
- package/dist/notification/channels/whatsapp.d.ts +0 -37
- package/dist/notification/channels/whatsapp.d.ts.map +0 -1
- package/dist/notification/index.d.ts +0 -15
- package/dist/notification/index.d.ts.map +0 -1
- package/dist/notification/service.d.ts +0 -100
- package/dist/notification/service.d.ts.map +0 -1
- package/dist/notification/types.d.ts +0 -253
- package/dist/notification/types.d.ts.map +0 -1
- package/dist/observability/__tests__/observability.test.d.ts +0 -2
- package/dist/observability/__tests__/observability.test.d.ts.map +0 -1
- package/dist/observability/breadcrumbs.d.ts +0 -48
- package/dist/observability/breadcrumbs.d.ts.map +0 -1
- package/dist/observability/index.d.ts +0 -95
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/interceptor.d.ts +0 -19
- package/dist/observability/interceptor.d.ts.map +0 -1
- package/dist/observability/service.d.ts +0 -101
- package/dist/observability/service.d.ts.map +0 -1
- package/dist/observability/trace.d.ts +0 -21
- package/dist/observability/trace.d.ts.map +0 -1
- package/dist/observability/types.d.ts +0 -172
- package/dist/observability/types.d.ts.map +0 -1
- package/dist/openapi/__tests__/decorators.test.d.ts +0 -2
- package/dist/openapi/__tests__/decorators.test.d.ts.map +0 -1
- package/dist/openapi/__tests__/document-builder.test.d.ts +0 -2
- package/dist/openapi/__tests__/document-builder.test.d.ts.map +0 -1
- package/dist/openapi/__tests__/route-scanner.test.d.ts +0 -2
- package/dist/openapi/__tests__/route-scanner.test.d.ts.map +0 -1
- package/dist/openapi/__tests__/schema-generator.test.d.ts +0 -2
- package/dist/openapi/__tests__/schema-generator.test.d.ts.map +0 -1
- package/dist/openapi/decorators.d.ts +0 -173
- package/dist/openapi/decorators.d.ts.map +0 -1
- package/dist/openapi/document-builder.d.ts +0 -82
- package/dist/openapi/document-builder.d.ts.map +0 -1
- package/dist/openapi/index.d.ts +0 -48
- package/dist/openapi/index.d.ts.map +0 -1
- package/dist/openapi/metadata.d.ts +0 -36
- package/dist/openapi/metadata.d.ts.map +0 -1
- package/dist/openapi/route-scanner.d.ts +0 -34
- package/dist/openapi/route-scanner.d.ts.map +0 -1
- package/dist/openapi/schema-generator.d.ts +0 -53
- package/dist/openapi/schema-generator.d.ts.map +0 -1
- package/dist/openapi/swagger-module.d.ts +0 -57
- package/dist/openapi/swagger-module.d.ts.map +0 -1
- package/dist/openapi/types.d.ts +0 -344
- package/dist/openapi/types.d.ts.map +0 -1
- package/dist/orm/index.d.ts +0 -10
- package/dist/orm/index.d.ts.map +0 -1
- package/dist/router/index.d.ts +0 -73
- package/dist/router/index.d.ts.map +0 -1
- package/dist/router/linear.d.ts +0 -54
- package/dist/router/linear.d.ts.map +0 -1
- package/dist/router/regex.d.ts +0 -49
- package/dist/router/regex.d.ts.map +0 -1
- package/dist/router/tree.d.ts +0 -112
- package/dist/router/tree.d.ts.map +0 -1
- package/dist/rpc/index.d.ts +0 -321
- package/dist/rpc/index.d.ts.map +0 -1
- package/dist/schema/index.d.ts +0 -10
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/security/index.d.ts +0 -126
- package/dist/security/index.d.ts.map +0 -1
- package/dist/ssg/index.d.ts +0 -73
- package/dist/ssg/index.d.ts.map +0 -1
- package/dist/storage/index.d.ts +0 -99
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/telemetry/index.d.ts +0 -376
- package/dist/telemetry/index.d.ts.map +0 -1
- package/dist/template/index.d.ts +0 -7
- package/dist/template/index.d.ts.map +0 -1
- package/dist/templates/engine.d.ts +0 -60
- package/dist/templates/engine.d.ts.map +0 -1
- package/dist/templates/index.d.ts +0 -9
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/loader.d.ts +0 -45
- package/dist/templates/loader.d.ts.map +0 -1
- package/dist/templates/renderers/markdown.d.ts +0 -46
- package/dist/templates/renderers/markdown.d.ts.map +0 -1
- package/dist/templates/renderers/simple.d.ts +0 -35
- package/dist/templates/renderers/simple.d.ts.map +0 -1
- package/dist/templates/types.d.ts +0 -138
- package/dist/templates/types.d.ts.map +0 -1
- package/dist/testing/index.d.ts +0 -539
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -116
- package/dist/types/index.d.ts.map +0 -1
- package/dist/validation/index.d.ts +0 -89
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/schemas.d.ts +0 -243
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/websocket/index.d.ts +0 -252
- package/dist/websocket/index.d.ts.map +0 -1
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Development Server Implementation
|
|
3
|
-
*
|
|
4
|
-
* Provides a development server with:
|
|
5
|
-
* - Static file serving using Bun.file()
|
|
6
|
-
* - Framework auto-detection
|
|
7
|
-
* - JSX/TSX transpilation using Bun's built-in capabilities
|
|
8
|
-
* - SPA fallback support
|
|
9
|
-
* - Integration with the Router for API routes
|
|
10
|
-
* - Graceful shutdown handling
|
|
11
|
-
*/
|
|
12
|
-
import type { Router } from "../router/index.js";
|
|
13
|
-
import { type ConsoleStreamManager } from "./console-stream.js";
|
|
14
|
-
import { type HMRManager } from "./hmr.js";
|
|
15
|
-
import { type SSRRenderer } from "./ssr.js";
|
|
16
|
-
import type { DevServerConfig, DevServerEventListener, DevServerMiddleware, DevServerState, FrontendFramework, PartialConsoleStreamConfig, PartialDevServerConfig, PartialSSRConfig } from "./types.js";
|
|
17
|
-
export declare class DevServer {
|
|
18
|
-
private config;
|
|
19
|
-
private state;
|
|
20
|
-
private logger;
|
|
21
|
-
private router;
|
|
22
|
-
private apiRouter;
|
|
23
|
-
private server;
|
|
24
|
-
private middlewares;
|
|
25
|
-
private eventListeners;
|
|
26
|
-
private hmrManager;
|
|
27
|
-
private consoleStreamManager;
|
|
28
|
-
private ssrRenderer;
|
|
29
|
-
private ssrEnabled;
|
|
30
|
-
constructor(config: PartialDevServerConfig);
|
|
31
|
-
/**
|
|
32
|
-
* Normalize partial config to full config with defaults
|
|
33
|
-
*/
|
|
34
|
-
private normalizeConfig;
|
|
35
|
-
/**
|
|
36
|
-
* Get current server state
|
|
37
|
-
*/
|
|
38
|
-
getState(): DevServerState;
|
|
39
|
-
/**
|
|
40
|
-
* Get server configuration
|
|
41
|
-
*/
|
|
42
|
-
getConfig(): DevServerConfig;
|
|
43
|
-
/**
|
|
44
|
-
* Get detected framework
|
|
45
|
-
*/
|
|
46
|
-
getFramework(): FrontendFramework;
|
|
47
|
-
/**
|
|
48
|
-
* Set the API router for handling API routes
|
|
49
|
-
*/
|
|
50
|
-
setApiRouter(router: Router): void;
|
|
51
|
-
/**
|
|
52
|
-
* Add middleware to the dev server
|
|
53
|
-
*/
|
|
54
|
-
use(middleware: DevServerMiddleware): void;
|
|
55
|
-
/**
|
|
56
|
-
* Add event listener
|
|
57
|
-
*/
|
|
58
|
-
onEvent(listener: DevServerEventListener): void;
|
|
59
|
-
/**
|
|
60
|
-
* Emit an event to all listeners
|
|
61
|
-
*/
|
|
62
|
-
private emitEvent;
|
|
63
|
-
/**
|
|
64
|
-
* Get content type for a file path
|
|
65
|
-
*/
|
|
66
|
-
private getContentType;
|
|
67
|
-
/**
|
|
68
|
-
* Resolve a request path to a file
|
|
69
|
-
*/
|
|
70
|
-
private resolveFile;
|
|
71
|
-
/**
|
|
72
|
-
* Transform a file based on its type
|
|
73
|
-
*/
|
|
74
|
-
private transformFile;
|
|
75
|
-
/**
|
|
76
|
-
* Handle static file requests
|
|
77
|
-
*/
|
|
78
|
-
private handleStaticFile;
|
|
79
|
-
/**
|
|
80
|
-
* Handle API route requests
|
|
81
|
-
*/
|
|
82
|
-
private handleApiRoute;
|
|
83
|
-
/**
|
|
84
|
-
* Apply middleware chain
|
|
85
|
-
*/
|
|
86
|
-
private applyMiddleware;
|
|
87
|
-
/**
|
|
88
|
-
* Main request handler
|
|
89
|
-
*/
|
|
90
|
-
private handleRequest;
|
|
91
|
-
/**
|
|
92
|
-
* Log a request
|
|
93
|
-
*/
|
|
94
|
-
private logRequest;
|
|
95
|
-
/**
|
|
96
|
-
* Start the development server
|
|
97
|
-
*/
|
|
98
|
-
start(): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Stop the development server
|
|
101
|
-
*/
|
|
102
|
-
stop(reason?: string): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Restart the development server
|
|
105
|
-
*/
|
|
106
|
-
restart(): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Check if the server is running
|
|
109
|
-
*/
|
|
110
|
-
isRunning(): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Get server URL
|
|
113
|
-
*/
|
|
114
|
-
getUrl(): string;
|
|
115
|
-
/**
|
|
116
|
-
* Get HMR manager
|
|
117
|
-
*/
|
|
118
|
-
getHMRManager(): HMRManager | null;
|
|
119
|
-
/**
|
|
120
|
-
* Check if HMR is enabled
|
|
121
|
-
*/
|
|
122
|
-
isHMREnabled(): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Get HMR WebSocket URL
|
|
125
|
-
*/
|
|
126
|
-
getHMRUrl(): string | null;
|
|
127
|
-
/**
|
|
128
|
-
* Get Console Stream manager
|
|
129
|
-
*/
|
|
130
|
-
getConsoleStreamManager(): ConsoleStreamManager | null;
|
|
131
|
-
/**
|
|
132
|
-
* Check if console streaming is enabled
|
|
133
|
-
*/
|
|
134
|
-
isConsoleStreamEnabled(): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Get Console Stream WebSocket URL
|
|
137
|
-
*/
|
|
138
|
-
getConsoleStreamUrl(): string | null;
|
|
139
|
-
/**
|
|
140
|
-
* Enable SSR with configuration
|
|
141
|
-
*/
|
|
142
|
-
enableSSR(config: PartialSSRConfig): void;
|
|
143
|
-
/**
|
|
144
|
-
* Disable SSR
|
|
145
|
-
*/
|
|
146
|
-
disableSSR(): void;
|
|
147
|
-
/**
|
|
148
|
-
* Check if SSR is enabled
|
|
149
|
-
*/
|
|
150
|
-
isSSREnabled(): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Get SSR renderer
|
|
153
|
-
*/
|
|
154
|
-
getSSRRenderer(): SSRRenderer | null;
|
|
155
|
-
/**
|
|
156
|
-
* Set SSR renderer directly
|
|
157
|
-
*/
|
|
158
|
-
setSSRRenderer(renderer: SSRRenderer): void;
|
|
159
|
-
/**
|
|
160
|
-
* Handle SSR request
|
|
161
|
-
*/
|
|
162
|
-
private handleSSRRequest;
|
|
163
|
-
/**
|
|
164
|
-
* Check if path is a static asset
|
|
165
|
-
*/
|
|
166
|
-
private isStaticAsset;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Create a development server
|
|
170
|
-
*/
|
|
171
|
-
export declare function createDevServer(config: PartialDevServerConfig & {
|
|
172
|
-
consoleStream?: PartialConsoleStreamConfig;
|
|
173
|
-
}): DevServer;
|
|
174
|
-
//# sourceMappingURL=dev-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/frontend/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAc,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAGX,eAAe,EAEf,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EAGd,iBAAiB,EAGjB,0BAA0B,EAC1B,sBAAsB,EACtB,gBAAgB,EAIhB,MAAM,YAAY,CAAC;AA8GpB,qBAAa,SAAS;IACrB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,cAAc,CAAgC;IACtD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,sBAAsB;IA2D1C;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACH,QAAQ,IAAI,cAAc;IAI1B;;OAEG;IACH,SAAS,IAAI,eAAe;IAI5B;;OAEG;IACH,YAAY,IAAI,iBAAiB;IAIjC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAKlC;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI;IAK1C;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAI/C;;OAEG;IACH,OAAO,CAAC,SAAS;IAUjB;;OAEG;IACH,OAAO,CAAC,cAAc;IAKtB;;OAEG;YACW,WAAW;IA2CzB;;OAEG;YACW,aAAa;IAwB3B;;OAEG;YACW,gBAAgB;IA+C9B;;OAEG;YACW,cAAc;IAmD5B;;OAEG;YACW,eAAe;IA2B7B;;OAEG;YACW,aAAa;IAiE3B;;OAEG;IACH,OAAO,CAAC,UAAU;IAYlB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA6C5B;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwC1C;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAM9B;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;OAEG;IACH,aAAa,IAAI,UAAU,GAAG,IAAI;IAIlC;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B;;OAEG;IACH,uBAAuB,IAAI,oBAAoB,GAAG,IAAI;IAItD;;OAEG;IACH,sBAAsB,IAAI,OAAO;IAOjC;;OAEG;IACH,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAQpC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAWzC;;OAEG;IACH,UAAU,IAAI,IAAI;IAMlB;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;IAM3C;;OAEG;YACW,gBAAgB;IA0C9B;;OAEG;IACH,OAAO,CAAC,aAAa;CA4BrB;AAID;;GAEG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,sBAAsB,GAAG;IAChC,aAAa,CAAC,EAAE,0BAA0B,CAAC;CAC3C,GACC,SAAS,CAEX"}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File-based Routing Implementation
|
|
3
|
-
*
|
|
4
|
-
* Provides Next.js-style file-based routing:
|
|
5
|
-
* - pages/ directory scanning
|
|
6
|
-
* - Dynamic routes: [id].tsx, [...slug].tsx
|
|
7
|
-
* - Route generation from file structure
|
|
8
|
-
* - Integration with existing Router
|
|
9
|
-
*/
|
|
10
|
-
import { Router } from "../router/index.js";
|
|
11
|
-
import type { DynamicRoute, FileRouterConfig, PartialFileRouterConfig, RouteDefinition, RouteMatch } from "./types.js";
|
|
12
|
-
/**
|
|
13
|
-
* File-based router that scans directories and generates routes
|
|
14
|
-
*
|
|
15
|
-
* Features:
|
|
16
|
-
* - Next.js-style file-based routing
|
|
17
|
-
* - Dynamic routes with [param] syntax
|
|
18
|
-
* - Catch-all routes with [...param] syntax
|
|
19
|
-
* - API routes in pages/api/
|
|
20
|
-
* - Hot reload support
|
|
21
|
-
*/
|
|
22
|
-
export declare class FileRouter {
|
|
23
|
-
private config;
|
|
24
|
-
private logger;
|
|
25
|
-
private routes;
|
|
26
|
-
private dynamicRoutes;
|
|
27
|
-
private router;
|
|
28
|
-
private pageModules;
|
|
29
|
-
private apiHandlers;
|
|
30
|
-
constructor(config?: PartialFileRouterConfig);
|
|
31
|
-
/**
|
|
32
|
-
* Normalize partial config to full config with defaults
|
|
33
|
-
*/
|
|
34
|
-
private normalizeConfig;
|
|
35
|
-
/**
|
|
36
|
-
* Initialize the file router by scanning the pages directory
|
|
37
|
-
*/
|
|
38
|
-
init(): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Scan the pages directory for route files
|
|
41
|
-
*/
|
|
42
|
-
private scanPagesDirectory;
|
|
43
|
-
/**
|
|
44
|
-
* Process a single route file
|
|
45
|
-
*/
|
|
46
|
-
private processRouteFile;
|
|
47
|
-
/**
|
|
48
|
-
* Convert file path to route path
|
|
49
|
-
*/
|
|
50
|
-
private filePathToRoute;
|
|
51
|
-
/**
|
|
52
|
-
* Determine route type from file path
|
|
53
|
-
*/
|
|
54
|
-
private getRouteType;
|
|
55
|
-
/**
|
|
56
|
-
* Parse route pattern and extract parameters
|
|
57
|
-
*/
|
|
58
|
-
private parseRoutePattern;
|
|
59
|
-
/**
|
|
60
|
-
* Convert route path to regex
|
|
61
|
-
*/
|
|
62
|
-
private routeToRegex;
|
|
63
|
-
/**
|
|
64
|
-
* Generate unique route ID
|
|
65
|
-
*/
|
|
66
|
-
private generateRouteId;
|
|
67
|
-
/**
|
|
68
|
-
* Build the router from collected routes
|
|
69
|
-
*/
|
|
70
|
-
private buildRouter;
|
|
71
|
-
/**
|
|
72
|
-
* Sort routes by specificity
|
|
73
|
-
* Static routes come before dynamic routes
|
|
74
|
-
*/
|
|
75
|
-
private sortRoutesBySpecificity;
|
|
76
|
-
/**
|
|
77
|
-
* Create page handler for a route
|
|
78
|
-
*/
|
|
79
|
-
private createPageHandler;
|
|
80
|
-
/**
|
|
81
|
-
* Register API route with all HTTP methods
|
|
82
|
-
*/
|
|
83
|
-
private registerApiRoute;
|
|
84
|
-
/**
|
|
85
|
-
* Create API handler for a route and method
|
|
86
|
-
*/
|
|
87
|
-
private createApiHandler;
|
|
88
|
-
/**
|
|
89
|
-
* Load page module dynamically
|
|
90
|
-
*/
|
|
91
|
-
private loadPageModule;
|
|
92
|
-
/**
|
|
93
|
-
* Load API module dynamically
|
|
94
|
-
*/
|
|
95
|
-
private loadApiModule;
|
|
96
|
-
/**
|
|
97
|
-
* Extract params from URL using route definition
|
|
98
|
-
*/
|
|
99
|
-
private extractParams;
|
|
100
|
-
/**
|
|
101
|
-
* Create context for request
|
|
102
|
-
*/
|
|
103
|
-
private createContext;
|
|
104
|
-
/**
|
|
105
|
-
* Match a request to a route
|
|
106
|
-
*/
|
|
107
|
-
match(method: string, pathname: string): RouteMatch | null;
|
|
108
|
-
/**
|
|
109
|
-
* Handle incoming request
|
|
110
|
-
*/
|
|
111
|
-
handle(request: Request): Promise<Response>;
|
|
112
|
-
/**
|
|
113
|
-
* Create handler for route
|
|
114
|
-
*/
|
|
115
|
-
private createHandler;
|
|
116
|
-
/**
|
|
117
|
-
* Get all routes
|
|
118
|
-
*/
|
|
119
|
-
getRoutes(): RouteDefinition[];
|
|
120
|
-
/**
|
|
121
|
-
* Get route by path
|
|
122
|
-
*/
|
|
123
|
-
getRoute(path: string): RouteDefinition | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Get dynamic routes
|
|
126
|
-
*/
|
|
127
|
-
getDynamicRoutes(): DynamicRoute[];
|
|
128
|
-
/**
|
|
129
|
-
* Generate URL for a route
|
|
130
|
-
*/
|
|
131
|
-
generateUrl(routeId: string, params?: Record<string, string>): string | null;
|
|
132
|
-
/**
|
|
133
|
-
* Reload routes (for hot reload)
|
|
134
|
-
*/
|
|
135
|
-
reload(): Promise<void>;
|
|
136
|
-
/**
|
|
137
|
-
* Get the underlying router
|
|
138
|
-
*/
|
|
139
|
-
getRouter(): Router;
|
|
140
|
-
/**
|
|
141
|
-
* Get configuration
|
|
142
|
-
*/
|
|
143
|
-
getConfig(): FileRouterConfig;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Create a file router
|
|
147
|
-
*/
|
|
148
|
-
export declare function createFileRouter(config?: PartialFileRouterConfig): FileRouter;
|
|
149
|
-
/**
|
|
150
|
-
* Check if a path is a dynamic route
|
|
151
|
-
*/
|
|
152
|
-
export declare function isDynamicRoute(path: string): boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Check if a path is a catch-all route
|
|
155
|
-
*/
|
|
156
|
-
export declare function isCatchAllRoute(path: string): boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Get parameter names from route path
|
|
159
|
-
*/
|
|
160
|
-
export declare function getRouteParams(path: string): string[];
|
|
161
|
-
/**
|
|
162
|
-
* Normalize route path
|
|
163
|
-
*/
|
|
164
|
-
export declare function normalizeRoutePath(path: string): string;
|
|
165
|
-
/**
|
|
166
|
-
* Compare route specificity
|
|
167
|
-
* Returns negative if a is more specific, positive if b is more specific
|
|
168
|
-
*/
|
|
169
|
-
export declare function compareRouteSpecificity(a: string, b: string): number;
|
|
170
|
-
//# sourceMappingURL=file-router.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-router.d.ts","sourceRoot":"","sources":["../../src/frontend/file-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,EACX,YAAY,EAEZ,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EAEf,UAAU,EAGV,MAAM,YAAY,CAAC;AAWpB;;;;;;;;;GASG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,WAAW,CAAwD;gBAE/D,MAAM,GAAE,uBAA4B;IAUhD;;OAEG;IACH,OAAO,CAAC,eAAe;IAWvB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B;;OAEG;YACW,kBAAkB;IAahC;;OAEG;YACW,gBAAgB;IAsC9B;;OAEG;IACH,OAAO,CAAC,eAAe;IAsBvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAyBzB;;OAEG;YACW,gBAAgB;IAuC9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;YACW,cAAc;IAe5B;;OAEG;YACW,aAAa;IAY3B;;OAEG;IACH,OAAO,CAAC,aAAa;IAgBrB;;OAEG;IACH,OAAO,CAAC,aAAa;IAoBrB;;OAEG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IA4B1D;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYjD;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,SAAS,IAAI,eAAe,EAAE;IAI9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAInD;;OAEG;IACH,gBAAgB,IAAI,YAAY,EAAE;IAIlC;;OAEG;IACH,WAAW,CACV,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,MAAM,GAAG,IAAI;IAchB;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,SAAS,IAAI,gBAAgB;CAG7B;AAID;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,GAAE,uBAA4B,GAClC,UAAU,CAEZ;AAID;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAcrD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBpE"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Framework Build Configurations
|
|
3
|
-
*
|
|
4
|
-
* Exports framework-specific build configurations for all supported frameworks.
|
|
5
|
-
* Each framework module provides configuration for JSX runtime, plugins, and defines.
|
|
6
|
-
*/
|
|
7
|
-
import type { FrameworkBuildConfig, FrontendFramework } from "../types.js";
|
|
8
|
-
export { getReactBuildConfig, isReactComponent, getReactRefreshPreamble, reactFrameworkMeta, } from "./react.js";
|
|
9
|
-
export { getVueBuildConfig, isVueComponent, isVueJsx, getVueBlockTypes, vueFrameworkMeta, } from "./vue.js";
|
|
10
|
-
export { getSvelteBuildConfig, isSvelteComponent, getSveltePreprocessConfig, getSvelteCompilerOptions, svelteFrameworkMeta, } from "./svelte.js";
|
|
11
|
-
export { getSolidBuildConfig, isSolidComponent, getSolidRefreshPreamble, getSolidTransformOptions, solidFrameworkMeta, } from "./solid.js";
|
|
12
|
-
export interface FrameworkMeta {
|
|
13
|
-
name: FrontendFramework;
|
|
14
|
-
displayName: string;
|
|
15
|
-
fileExtensions: string[];
|
|
16
|
-
componentExtensions: string[];
|
|
17
|
-
needsRefreshRuntime: boolean;
|
|
18
|
-
supportsHMR: boolean;
|
|
19
|
-
supportsSSR: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get framework build configuration by framework name
|
|
23
|
-
*/
|
|
24
|
-
export declare function getFrameworkConfig(framework: FrontendFramework): FrameworkBuildConfig;
|
|
25
|
-
/**
|
|
26
|
-
* Get framework metadata by framework name
|
|
27
|
-
*/
|
|
28
|
-
export declare function getFrameworkMeta(framework: FrontendFramework): FrameworkMeta;
|
|
29
|
-
/**
|
|
30
|
-
* Detect framework from file extension
|
|
31
|
-
*/
|
|
32
|
-
export declare function detectFrameworkFromExtension(filePath: string): FrontendFramework | null;
|
|
33
|
-
/**
|
|
34
|
-
* Get all supported file extensions
|
|
35
|
-
*/
|
|
36
|
-
export declare function getAllSupportedExtensions(): string[];
|
|
37
|
-
/**
|
|
38
|
-
* Check if a file extension is supported
|
|
39
|
-
*/
|
|
40
|
-
export declare function isSupportedExtension(filePath: string): boolean;
|
|
41
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frontend/frameworks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAS3E,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,iBAAiB,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,iBAAiB,GAC1B,oBAAoB,CActB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG,aAAa,CAa5E;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC3C,QAAQ,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAa1B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,EAAE,CAOpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG9D"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Framework Build Configuration
|
|
3
|
-
*
|
|
4
|
-
* Provides build configuration specific to React applications,
|
|
5
|
-
* including JSX runtime, automatic import handling, and React-specific defines.
|
|
6
|
-
*/
|
|
7
|
-
import type { FrameworkBuildConfig } from "../types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Get React framework build configuration
|
|
10
|
-
*/
|
|
11
|
-
export declare function getReactBuildConfig(): FrameworkBuildConfig;
|
|
12
|
-
/**
|
|
13
|
-
* Check if a file is a React component
|
|
14
|
-
*/
|
|
15
|
-
export declare function isReactComponent(filePath: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Get React refresh preamble for development
|
|
18
|
-
*/
|
|
19
|
-
export declare function getReactRefreshPreamble(): string;
|
|
20
|
-
/**
|
|
21
|
-
* React framework metadata
|
|
22
|
-
*/
|
|
23
|
-
export declare const reactFrameworkMeta: {
|
|
24
|
-
name: "react";
|
|
25
|
-
displayName: string;
|
|
26
|
-
fileExtensions: string[];
|
|
27
|
-
componentExtensions: string[];
|
|
28
|
-
needsRefreshRuntime: boolean;
|
|
29
|
-
supportsHMR: boolean;
|
|
30
|
-
supportsSSR: boolean;
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=react.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/frontend/frameworks/react.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAOrE;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,CA6B1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAOhD;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CASrB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Solid Framework Build Configuration
|
|
3
|
-
*
|
|
4
|
-
* Provides build configuration specific to Solid applications,
|
|
5
|
-
* including Solid JSX transforms and Solid-specific optimizations.
|
|
6
|
-
*/
|
|
7
|
-
import type { FrameworkBuildConfig } from "../types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Get Solid framework build configuration
|
|
10
|
-
*/
|
|
11
|
-
export declare function getSolidBuildConfig(): FrameworkBuildConfig;
|
|
12
|
-
/**
|
|
13
|
-
* Check if a file is a Solid component
|
|
14
|
-
*/
|
|
15
|
-
export declare function isSolidComponent(filePath: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Get Solid refresh preamble for development
|
|
18
|
-
* Solid uses a different HMR mechanism than React
|
|
19
|
-
*/
|
|
20
|
-
export declare function getSolidRefreshPreamble(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Solid babel-like transform options
|
|
23
|
-
* For use with custom build configurations
|
|
24
|
-
*/
|
|
25
|
-
export declare function getSolidTransformOptions(): {
|
|
26
|
-
generate: "dom";
|
|
27
|
-
hydratable: boolean;
|
|
28
|
-
runtime: "solid-js/web";
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Solid framework metadata
|
|
32
|
-
*/
|
|
33
|
-
export declare const solidFrameworkMeta: {
|
|
34
|
-
name: "solid";
|
|
35
|
-
displayName: string;
|
|
36
|
-
fileExtensions: string[];
|
|
37
|
-
componentExtensions: string[];
|
|
38
|
-
needsRefreshRuntime: boolean;
|
|
39
|
-
supportsHMR: boolean;
|
|
40
|
-
supportsSSR: boolean;
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=solid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solid.d.ts","sourceRoot":"","sources":["../../../src/frontend/frameworks/solid.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAOrE;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,CA+B1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAQhD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB;;;;EASvC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CASrB,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Svelte Framework Build Configuration
|
|
3
|
-
*
|
|
4
|
-
* Provides build configuration specific to Svelte applications,
|
|
5
|
-
* including Svelte SFC support and Svelte-specific preprocessing.
|
|
6
|
-
*/
|
|
7
|
-
import type { FrameworkBuildConfig } from "../types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Get Svelte framework build configuration
|
|
10
|
-
*/
|
|
11
|
-
export declare function getSvelteBuildConfig(): FrameworkBuildConfig;
|
|
12
|
-
/**
|
|
13
|
-
* Check if a file is a Svelte component
|
|
14
|
-
*/
|
|
15
|
-
export declare function isSvelteComponent(filePath: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Get Svelte preprocessor configuration
|
|
18
|
-
* Returns configuration for svelte-preprocess
|
|
19
|
-
*/
|
|
20
|
-
export declare function getSveltePreprocessConfig(): {
|
|
21
|
-
typescript: {
|
|
22
|
-
compilerOptions: {
|
|
23
|
-
allowJs: boolean;
|
|
24
|
-
checkJs: boolean;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
postcss: boolean;
|
|
28
|
-
scss: {
|
|
29
|
-
prependData: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Svelte compiler options
|
|
34
|
-
*/
|
|
35
|
-
export declare function getSvelteCompilerOptions(): {
|
|
36
|
-
cssHash: ({ hash, css, name, }: {
|
|
37
|
-
hash: (s: string) => string;
|
|
38
|
-
css: string;
|
|
39
|
-
name: string;
|
|
40
|
-
}) => string;
|
|
41
|
-
generate: "dom";
|
|
42
|
-
hydratable: boolean;
|
|
43
|
-
preserveWhitespace: boolean;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Svelte framework metadata
|
|
47
|
-
*/
|
|
48
|
-
export declare const svelteFrameworkMeta: {
|
|
49
|
-
name: "svelte";
|
|
50
|
-
displayName: string;
|
|
51
|
-
fileExtensions: string[];
|
|
52
|
-
componentExtensions: string[];
|
|
53
|
-
needsRefreshRuntime: boolean;
|
|
54
|
-
supportsHMR: boolean;
|
|
55
|
-
supportsSSR: boolean;
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../../../src/frontend/frameworks/svelte.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQrE;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,oBAAoB,CA2B3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB;;;;;;;;;;;EAcxC;AAED;;GAEG;AACH,wBAAgB,wBAAwB;oCAOnC;QAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;;EAU9D;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CASrB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue Framework Build Configuration
|
|
3
|
-
*
|
|
4
|
-
* Provides build configuration specific to Vue applications,
|
|
5
|
-
* including Vue SFC support, JSX configuration, and Vue-specific defines.
|
|
6
|
-
*/
|
|
7
|
-
import type { FrameworkBuildConfig } from "../types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Get Vue framework build configuration
|
|
10
|
-
*/
|
|
11
|
-
export declare function getVueBuildConfig(): FrameworkBuildConfig;
|
|
12
|
-
/**
|
|
13
|
-
* Check if a file is a Vue component
|
|
14
|
-
*/
|
|
15
|
-
export declare function isVueComponent(filePath: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Check if a file uses Vue JSX
|
|
18
|
-
*/
|
|
19
|
-
export declare function isVueJsx(filePath: string): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get Vue SFC block types
|
|
22
|
-
*/
|
|
23
|
-
export declare function getVueBlockTypes(): string[];
|
|
24
|
-
/**
|
|
25
|
-
* Vue framework metadata
|
|
26
|
-
*/
|
|
27
|
-
export declare const vueFrameworkMeta: {
|
|
28
|
-
name: "vue";
|
|
29
|
-
displayName: string;
|
|
30
|
-
fileExtensions: string[];
|
|
31
|
-
componentExtensions: string[];
|
|
32
|
-
needsRefreshRuntime: boolean;
|
|
33
|
-
supportsHMR: boolean;
|
|
34
|
-
supportsSSR: boolean;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../../src/frontend/frameworks/vue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQrE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,oBAAoB,CAiCxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CASrB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HMR Client Script
|
|
3
|
-
*
|
|
4
|
-
* This script is injected into HTML pages to enable Hot Module Replacement.
|
|
5
|
-
* It handles WebSocket communication, module updates, and framework-specific HMR.
|
|
6
|
-
*
|
|
7
|
-
* The script is kept minimal (< 5KB) for fast injection.
|
|
8
|
-
*
|
|
9
|
-
* @module frontend/hmr-client
|
|
10
|
-
*/
|
|
11
|
-
export declare const HMR_CLIENT_SCRIPT = "\n(function() {\n\t'use strict';\n\n\t// ============= Configuration =============\n\tconst HMR_CONFIG = {\n\t\treconnectInterval: 1000,\n\t\tmaxReconnectAttempts: 10,\n\t\theartbeatInterval: 30000,\n\t};\n\n\t// ============= State =============\n\tlet ws = null;\n\tlet clientId = null;\n\tlet reconnectAttempts = 0;\n\tlet reconnectTimer = null;\n\tlet heartbeatTimer = null;\n\tlet subscribedFiles = new Set();\n\tlet moduleCache = new Map();\n\tlet isConnecting = false;\n\n\t// ============= Framework Detection =============\n\tconst framework = detectFramework();\n\n\tfunction detectFramework() {\n\t\tif (typeof window === 'undefined') return 'unknown';\n\t\t\n\t\t// Check for React\n\t\tif (window.React || document.querySelector('[data-reactroot]') || \n\t\t\tdocument.querySelector('[data-reactid]')) {\n\t\t\treturn 'react';\n\t\t}\n\t\t\n\t\t// Check for Vue\n\t\tif (window.Vue || document.querySelector('[data-v-]') ||\n\t\t\tdocument.querySelector('[data-vue-app]')) {\n\t\t\treturn 'vue';\n\t\t}\n\t\t\n\t\t// Check for Svelte\n\t\tif (window.__SVELTE_HMR__ || document.querySelector('[data-svelte]')) {\n\t\t\treturn 'svelte';\n\t\t}\n\t\t\n\t\t// Check for Solid\n\t\tif (window.Solid$$ || document.querySelector('[data-solid]')) {\n\t\t\treturn 'solid';\n\t\t}\n\t\t\n\t\treturn 'unknown';\n\t}\n\n\t// ============= WebSocket Connection =============\n\tfunction connect() {\n\t\tif (isConnecting || (ws && ws.readyState === WebSocket.OPEN)) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tisConnecting = true;\n\t\t\n\t\t// Build WebSocket URL\n\t\tconst protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';\n\t\tconst host = window.location.hostname;\n\t\tconst port = getHMRPort();\n\t\tconst url = protocol + '//' + host + ':' + port + '/_hmr';\n\t\t\n\t\ttry {\n\t\t\tws = new WebSocket(url);\n\t\t\t\n\t\t\tws.onopen = handleOpen;\n\t\t\tws.onclose = handleClose;\n\t\t\tws.onerror = handleError;\n\t\t\tws.onmessage = handleMessage;\n\t\t} catch (e) {\n\t\t\tconsole.error('[HMR] Failed to create WebSocket:', e);\n\t\t\tisConnecting = false;\n\t\t\tscheduleReconnect();\n\t\t}\n\t}\n\n\tfunction getHMRPort() {\n\t\t// Try to get port from script tag or default to dev server port + 1\n\t\tconst scripts = document.querySelectorAll('script[data-hmr-port]');\n\t\tif (scripts.length > 0) {\n\t\t\treturn parseInt(scripts[0].getAttribute('data-hmr-port'), 10);\n\t\t}\n\t\treturn parseInt(window.location.port || '3000', 10) + 1;\n\t}\n\n\tfunction handleOpen() {\n\t\tisConnecting = false;\n\t\treconnectAttempts = 0;\n\t\tconsole.log('[HMR] Connected');\n\t\t\n\t\t// Start heartbeat\n\t\tstartHeartbeat();\n\t\t\n\t\t// Re-subscribe to files\n\t\tsubscribedFiles.forEach(function(fileId) {\n\t\t\tsendMessage({ type: 'subscribe', fileId: fileId });\n\t\t});\n\t}\n\n\tfunction handleClose(event) {\n\t\tisConnecting = false;\n\t\tstopHeartbeat();\n\t\t\n\t\tif (event.code !== 1000) {\n\t\t\tconsole.log('[HMR] Connection closed, attempting to reconnect...');\n\t\t\tscheduleReconnect();\n\t\t}\n\t}\n\n\tfunction handleError(error) {\n\t\tisConnecting = false;\n\t\tconsole.error('[HMR] WebSocket error:', error);\n\t}\n\n\tfunction scheduleReconnect() {\n\t\tif (reconnectTimer) {\n\t\t\tclearTimeout(reconnectTimer);\n\t\t}\n\t\t\n\t\tif (reconnectAttempts >= HMR_CONFIG.maxReconnectAttempts) {\n\t\t\tconsole.error('[HMR] Max reconnect attempts reached. Please refresh the page.');\n\t\t\tshowOverlay({\n\t\t\t\tmessage: 'HMR connection lost. Please refresh the page.',\n\t\t\t\ttype: 'error'\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\t\n\t\treconnectAttempts++;\n\t\tvar delay = HMR_CONFIG.reconnectInterval * reconnectAttempts;\n\t\t\n\t\treconnectTimer = setTimeout(function() {\n\t\t\tconsole.log('[HMR] Reconnecting... (attempt ' + reconnectAttempts + ')');\n\t\t\tconnect();\n\t\t}, delay);\n\t}\n\n\t// ============= Heartbeat =============\n\tfunction startHeartbeat() {\n\t\tstopHeartbeat();\n\t\theartbeatTimer = setInterval(function() {\n\t\t\tif (ws && ws.readyState === WebSocket.OPEN) {\n\t\t\t\tsendMessage({ type: 'ping' });\n\t\t\t}\n\t\t}, HMR_CONFIG.heartbeatInterval);\n\t}\n\n\tfunction stopHeartbeat() {\n\t\tif (heartbeatTimer) {\n\t\t\tclearInterval(heartbeatTimer);\n\t\t\theartbeatTimer = null;\n\t\t}\n\t}\n\n\t// ============= Message Handling =============\n\tfunction sendMessage(message) {\n\t\tif (ws && ws.readyState === WebSocket.OPEN) {\n\t\t\tws.send(JSON.stringify(message));\n\t\t}\n\t}\n\n\tfunction handleMessage(event) {\n\t\ttry {\n\t\t\tvar message = JSON.parse(event.data);\n\t\t\t\n\t\t\tswitch (message.type) {\n\t\t\t\tcase 'connected':\n\t\t\t\t\tclientId = message.clientId;\n\t\t\t\t\tconsole.log('[HMR] Client ID:', clientId);\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 'pong':\n\t\t\t\t\t// Heartbeat response\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 'update':\n\t\t\t\t\thandleUpdate(message);\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 'reload':\n\t\t\t\t\thandleReload(message);\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 'error':\n\t\t\t\t\thandleError(message);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error('[HMR] Failed to parse message:', e);\n\t\t}\n\t}\n\n\t// ============= Update Handling =============\n\tfunction handleUpdate(message) {\n\t\tconsole.log('[HMR] Update received:', message.fileId);\n\t\t\n\t\t// Hide any existing error overlay\n\t\thideOverlay();\n\t\t\n\t\tvar changes = message.changes || [];\n\t\tvar hasCSSUpdate = changes.some(function(file) {\n\t\t\treturn file.endsWith('.css') || file.endsWith('.scss') || \n\t\t\t\t file.endsWith('.sass') || file.endsWith('.less');\n\t\t});\n\t\t\n\t\tif (hasCSSUpdate) {\n\t\t\t// Handle CSS updates without flash\n\t\t\tupdateCSS(changes);\n\t\t}\n\t\t\n\t\t// Check if we can do hot update\n\t\tif (canHotUpdate(changes)) {\n\t\t\tperformHotUpdate(message);\n\t\t} else {\n\t\t\t// Fall back to full reload\n\t\t\tconsole.log('[HMR] Cannot hot update, reloading page...');\n\t\t\twindow.location.reload();\n\t\t}\n\t}\n\n\tfunction handleReload(message) {\n\t\tconsole.log('[HMR] Full reload requested');\n\t\thideOverlay();\n\t\twindow.location.reload();\n\t}\n\n\tfunction handleError(message) {\n\t\tconsole.error('[HMR] Error:', message.error);\n\t\tshowOverlay({\n\t\t\tmessage: message.error.message,\n\t\t\tstack: message.error.stack,\n\t\t\tfile: message.error.file,\n\t\t\tline: message.error.line,\n\t\t\tcolumn: message.error.column,\n\t\t\ttype: 'error'\n\t\t});\n\t}\n\n\t// ============= CSS Hot Update =============\n\tfunction updateCSS(changedFiles) {\n\t\tvar links = document.querySelectorAll('link[rel=\"stylesheet\"]');\n\t\t\n\t\tlinks.forEach(function(link) {\n\t\t\tvar href = link.getAttribute('href');\n\t\t\tif (!href) return;\n\t\t\t\n\t\t\t// Check if this stylesheet is affected\n\t\t\tvar isAffected = changedFiles.some(function(file) {\n\t\t\t\treturn href.includes(file.replace(/^.*\\//, '')) ||\n\t\t\t\t\t file.includes(href.replace(/^.*\\//, ''));\n\t\t\t});\n\t\t\t\n\t\t\tif (isAffected) {\n\t\t\t\t// Add timestamp to force reload\n\t\t\t\tvar newHref = href.split('?')[0] + '?v=' + Date.now();\n\t\t\t\t\n\t\t\t\t// Create new link and swap\n\t\t\t\tvar newLink = document.createElement('link');\n\t\t\t\tnewLink.rel = 'stylesheet';\n\t\t\t\tnewLink.href = newHref;\n\t\t\t\t\n\t\t\t\tnewLink.onload = function() {\n\t\t\t\t\tlink.remove();\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tnewLink.onerror = function() {\n\t\t\t\t\tconsole.error('[HMR] Failed to reload CSS:', newHref);\n\t\t\t\t\tlink.remove();\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tlink.parentNode.insertBefore(newLink, link);\n\t\t\t}\n\t\t});\n\t}\n\n\t// ============= Hot Update Logic =============\n\tfunction canHotUpdate(changes) {\n\t\t// Check if all changed files can be hot updated\n\t\treturn changes.every(function(file) {\n\t\t\tvar ext = file.split('.').pop().toLowerCase();\n\t\t\t\n\t\t\t// CSS files can always be hot updated\n\t\t\tif (ext === 'css' || ext === 'scss' || ext === 'sass' || ext === 'less') {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t\n\t\t\t// JS/TS files need HMR boundary\n\t\t\tif (ext === 'js' || ext === 'jsx' || ext === 'ts' || ext === 'tsx') {\n\t\t\t\treturn hasHMRBoundary(file);\n\t\t\t}\n\t\t\t\n\t\t\t// Framework-specific files\n\t\t\tif (ext === 'vue' || ext === 'svelte') {\n\t\t\t\treturn true; // Vue and Svelte have built-in HMR\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t});\n\t}\n\n\tfunction hasHMRBoundary(file) {\n\t\t// Check if the module accepts hot updates\n\t\t// This is a simplified check - in production, we'd track this from the server\n\t\treturn true; // For now, assume all modules can be hot updated\n\t}\n\n\tfunction performHotUpdate(message) {\n\t\tvar changes = message.changes || [];\n\t\t\n\t\t// Framework-specific update handling\n\t\tswitch (framework) {\n\t\t\tcase 'react':\n\t\t\t\tperformReactUpdate(message);\n\t\t\t\tbreak;\n\t\t\tcase 'vue':\n\t\t\t\tperformVueUpdate(message);\n\t\t\t\tbreak;\n\t\t\tcase 'svelte':\n\t\t\t\tperformSvelteUpdate(message);\n\t\t\t\tbreak;\n\t\t\tcase 'solid':\n\t\t\t\tperformSolidUpdate(message);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// Generic update - reload scripts\n\t\t\t\tperformGenericUpdate(message);\n\t\t}\n\t}\n\n\t// ============= React Fast Refresh =============\n\tfunction performReactUpdate(message) {\n\t\tif (!window.__HMR_REACT_REFRESH__) {\n\t\t\t// React Refresh not available, fall back to reload\n\t\t\twindow.location.reload();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tconsole.log('[HMR] Applying React Fast Refresh...');\n\t\t\n\t\t// Signal to React Refresh that an update is coming\n\t\tif (window.__REACT_REFRESH__) {\n\t\t\ttry {\n\t\t\t\tchanges.forEach(function(file) {\n\t\t\t\t\t// Invalidate the module\n\t\t\t\t\tinvalidateModule(file);\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t// Trigger React Refresh\n\t\t\t\twindow.__REACT_REFRESH__.performReactRefresh();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('[HMR] React Fast Refresh failed:', e);\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t} else {\n\t\t\t// Fallback: reload the page\n\t\t\twindow.location.reload();\n\t\t}\n\t}\n\n\t// ============= Vue HMR =============\n\tfunction performVueUpdate(message) {\n\t\tconsole.log('[HMR] Applying Vue HMR...');\n\t\t\n\t\t// Vue's HMR is handled by vue-loader and vue-hot-reload-api\n\t\tif (window.__VUE_HMR__) {\n\t\t\ttry {\n\t\t\t\tmessage.changes.forEach(function(file) {\n\t\t\t\t\tif (file.endsWith('.vue')) {\n\t\t\t\t\t\twindow.__VUE_HMR__.rerender(file);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('[HMR] Vue HMR failed:', e);\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t} else {\n\t\t\twindow.location.reload();\n\t\t}\n\t}\n\n\t// ============= Svelte HMR =============\n\tfunction performSvelteUpdate(message) {\n\t\tconsole.log('[HMR] Applying Svelte HMR...');\n\t\t\n\t\tif (window.__SVELTE_HMR__) {\n\t\t\ttry {\n\t\t\t\tmessage.changes.forEach(function(file) {\n\t\t\t\t\tif (file.endsWith('.svelte')) {\n\t\t\t\t\t\t// Svelte HMR preserves component state\n\t\t\t\t\t\twindow.__SVELTE_HMR__.update(file);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('[HMR] Svelte HMR failed:', e);\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t} else {\n\t\t\twindow.location.reload();\n\t\t}\n\t}\n\n\t// ============= Solid HMR =============\n\tfunction performSolidUpdate(message) {\n\t\tconsole.log('[HMR] Applying Solid HMR...');\n\t\t\n\t\tif (window.__SOLID_HMR__) {\n\t\t\ttry {\n\t\t\t\tmessage.changes.forEach(function(file) {\n\t\t\t\t\tinvalidateModule(file);\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\twindow.__SOLID_HMR__.update();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error('[HMR] Solid HMR failed:', e);\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t} else {\n\t\t\twindow.location.reload();\n\t\t}\n\t}\n\n\t// ============= Generic Update =============\n\tfunction performGenericUpdate(message) {\n\t\tconsole.log('[HMR] Performing generic update...');\n\t\t\n\t\t// For unknown frameworks, reload scripts\n\t\tmessage.changes.forEach(function(file) {\n\t\t\tinvalidateModule(file);\n\t\t});\n\t\t\n\t\t// Reload the page as a fallback\n\t\twindow.location.reload();\n\t}\n\n\t// ============= Module Management =============\n\tfunction invalidateModule(fileId) {\n\t\tmoduleCache.delete(fileId);\n\t\t\n\t\t// Find and reload script tags\n\t\tvar scripts = document.querySelectorAll('script[src]');\n\t\tscripts.forEach(function(script) {\n\t\t\tvar src = script.getAttribute('src');\n\t\t\tif (src && src.includes(fileId)) {\n\t\t\t\treloadScript(script);\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction reloadScript(oldScript) {\n\t\tvar src = oldScript.getAttribute('src');\n\t\tvar newSrc = src.split('?')[0] + '?v=' + Date.now();\n\t\t\n\t\tvar newScript = document.createElement('script');\n\t\tnewScript.src = newSrc;\n\t\tnewScript.type = oldScript.type || 'text/javascript';\n\t\tnewScript.async = false;\n\t\t\n\t\t// Copy attributes\n\t\tArray.from(oldScript.attributes).forEach(function(attr) {\n\t\t\tif (attr.name !== 'src') {\n\t\t\t\tnewScript.setAttribute(attr.name, attr.value);\n\t\t\t}\n\t\t});\n\t\t\n\t\toldScript.parentNode.replaceChild(newScript, oldScript);\n\t}\n\n\t// ============= Error Overlay =============\n\tfunction showOverlay(options) {\n\t\t// Remove existing overlay\n\t\thideOverlay();\n\t\t\n\t\tvar overlay = document.createElement('div');\n\t\toverlay.id = '__hmr-overlay__';\n\t\toverlay.style.cssText = [\n\t\t\t'position: fixed',\n\t\t\t'top: 0',\n\t\t\t'left: 0',\n\t\t\t'right: 0',\n\t\t\t'bottom: 0',\n\t\t\t'background: rgba(0, 0, 0, 0.85)',\n\t\t\t'z-index: 99999',\n\t\t\t'display: flex',\n\t\t\t'align-items: center',\n\t\t\t'justify-content: center',\n\t\t\t'font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n\t\t\t'color: white',\n\t\t\t'padding: 20px'\n\t\t].join(';');\n\t\t\n\t\tvar content = document.createElement('div');\n\t\tcontent.style.cssText = [\n\t\t\t'max-width: 800px',\n\t\t\t'max-height: 80vh',\n\t\t\t'overflow: auto',\n\t\t\t'background: #1a1a1a',\n\t\t\t'border-radius: 8px',\n\t\t\t'padding: 20px',\n\t\t\t'box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5)'\n\t\t].join(';');\n\t\t\n\t\tvar title = document.createElement('h2');\n\t\ttitle.style.cssText = 'color: #ff5555; margin: 0 0 15px 0; font-size: 18px;';\n\t\ttitle.textContent = 'HMR Error';\n\t\t\n\t\tvar message = document.createElement('pre');\n\t\tmessage.style.cssText = [\n\t\t\t'background: #282828',\n\t\t\t'padding: 15px',\n\t\t\t'border-radius: 4px',\n\t\t\t'overflow-x: auto',\n\t\t\t'font-size: 13px',\n\t\t\t'line-height: 1.5',\n\t\t\t'white-space: pre-wrap',\n\t\t\t'word-break: break-word'\n\t\t].join(';');\n\t\tmessage.textContent = options.message;\n\t\t\n\t\tcontent.appendChild(title);\n\t\tcontent.appendChild(message);\n\t\t\n\t\tif (options.stack) {\n\t\t\tvar stack = document.createElement('pre');\n\t\t\tstack.style.cssText = [\n\t\t\t\t'background: #282828',\n\t\t\t\t'padding: 15px',\n\t\t\t\t'border-radius: 4px',\n\t\t\t\t'margin-top: 10px',\n\t\t\t\t'font-size: 12px',\n\t\t\t\t'color: #888',\n\t\t\t\t'overflow-x: auto'\n\t\t\t].join(';');\n\t\t\tstack.textContent = options.stack;\n\t\t\tcontent.appendChild(stack);\n\t\t}\n\t\t\n\t\tif (options.file) {\n\t\t\tvar file = document.createElement('div');\n\t\t\tfile.style.cssText = 'margin-top: 15px; color: #888; font-size: 12px;';\n\t\t\tfile.textContent = 'File: ' + options.file + \n\t\t\t\t(options.line ? ':' + options.line + (options.column ? ':' + options.column : '') : '');\n\t\t\tcontent.appendChild(file);\n\t\t}\n\t\t\n\t\tvar closeBtn = document.createElement('button');\n\t\tcloseBtn.style.cssText = [\n\t\t\t'position: absolute',\n\t\t\t'top: 10px',\n\t\t\t'right: 10px',\n\t\t\t'background: transparent',\n\t\t\t'border: none',\n\t\t\t'color: #888',\n\t\t\t'font-size: 20px',\n\t\t\t'cursor: pointer',\n\t\t\t'padding: 5px'\n\t\t].join(';');\n\t\tcloseBtn.textContent = '\u00D7';\n\t\tcloseBtn.onclick = hideOverlay;\n\t\t\n\t\toverlay.style.position = 'relative';\n\t\toverlay.appendChild(closeBtn);\n\t\toverlay.appendChild(content);\n\t\t\n\t\tdocument.body.appendChild(overlay);\n\t}\n\n\tfunction hideOverlay() {\n\t\tvar overlay = document.getElementById('__hmr-overlay__');\n\t\tif (overlay) {\n\t\t\toverlay.remove();\n\t\t}\n\t}\n\n\t// ============= Subscription Management =============\n\tfunction subscribe(fileId) {\n\t\tsubscribedFiles.add(fileId);\n\t\tsendMessage({ type: 'subscribe', fileId: fileId });\n\t}\n\n\tfunction unsubscribe(fileId) {\n\t\tsubscribedFiles.delete(fileId);\n\t\tsendMessage({ type: 'unsubscribe', fileId: fileId });\n\t}\n\n\t// ============= Initialization =============\n\tfunction init() {\n\t\t// Connect to HMR server\n\t\tconnect();\n\t\t\n\t\t// Subscribe to current page\n\t\tvar currentFile = window.location.pathname;\n\t\tsubscribe(currentFile);\n\t\t\n\t\t// Expose HMR API\n\t\twindow.__HMR__ = {\n\t\t\tsubscribe: subscribe,\n\t\t\tunsubscribe: unsubscribe,\n\t\t\tconnect: connect,\n\t\t\tclientId: function() { return clientId; },\n\t\t\tframework: framework\n\t\t};\n\t\t\n\t\tconsole.log('[HMR] Client initialized (framework: ' + framework + ')');\n\t}\n\n\t// Start when DOM is ready\n\tif (document.readyState === 'complete') {\n\t\tinit();\n\t} else {\n\t\tdocument.addEventListener('DOMContentLoaded', init);\n\t}\n})();\n";
|
|
12
|
-
/**
|
|
13
|
-
* Get the HMR client script with optional configuration
|
|
14
|
-
*/
|
|
15
|
-
export declare function getHMRClientScript(options?: {
|
|
16
|
-
port?: number;
|
|
17
|
-
}): string;
|
|
18
|
-
/**
|
|
19
|
-
* Inject HMR client script into HTML content
|
|
20
|
-
*/
|
|
21
|
-
export declare function injectHMRScript(html: string, port?: number): string;
|
|
22
|
-
//# sourceMappingURL=hmr-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hmr-client.d.ts","sourceRoot":"","sources":["../../src/frontend/hmr-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,eAAO,MAAM,iBAAiB,m7hBAwmB7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAQT;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBnE"}
|