silgi 0.43.28 → 0.50.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 +103 -1
- package/dist/_virtual/_rolldown/runtime.mjs +5 -0
- package/dist/adapters/_fetch-adapter.d.mts +18 -0
- package/dist/adapters/_fetch-adapter.mjs +53 -0
- package/dist/adapters/astro.d.mts +15 -0
- package/dist/adapters/astro.mjs +31 -0
- package/dist/adapters/aws-lambda.d.mts +42 -0
- package/dist/adapters/aws-lambda.mjs +92 -0
- package/dist/adapters/express.d.mts +16 -0
- package/dist/adapters/express.mjs +110 -0
- package/dist/adapters/message-port.d.mts +42 -0
- package/dist/adapters/message-port.mjs +132 -0
- package/dist/adapters/nestjs.d.mts +25 -0
- package/dist/adapters/nestjs.mjs +83 -0
- package/dist/adapters/nextjs.d.mts +14 -0
- package/dist/adapters/nextjs.mjs +29 -0
- package/dist/adapters/peer.d.mts +27 -0
- package/dist/adapters/peer.mjs +36 -0
- package/dist/adapters/remix.d.mts +15 -0
- package/dist/adapters/remix.mjs +30 -0
- package/dist/adapters/solidstart.d.mts +12 -0
- package/dist/adapters/solidstart.mjs +29 -0
- package/dist/adapters/sveltekit.d.mts +14 -0
- package/dist/adapters/sveltekit.mjs +30 -0
- package/dist/broker/index.d.mts +62 -0
- package/dist/broker/index.mjs +153 -0
- package/dist/broker/nats.d.mts +33 -0
- package/dist/broker/nats.mjs +31 -0
- package/dist/broker/redis.d.mts +51 -0
- package/dist/broker/redis.mjs +92 -0
- package/dist/builder.d.mts +55 -0
- package/dist/builder.mjs +70 -0
- package/dist/callable.d.mts +19 -0
- package/dist/callable.mjs +42 -0
- package/dist/caller.mjs +90 -0
- package/dist/client/adapters/fetch/index.d.mts +15 -0
- package/dist/client/adapters/fetch/index.mjs +57 -0
- package/dist/client/adapters/ofetch/index.d.mts +55 -0
- package/dist/client/adapters/ofetch/index.mjs +91 -0
- package/dist/client/adapters/websocket/index.d.mts +20 -0
- package/dist/client/adapters/websocket/index.mjs +101 -0
- package/dist/client/client.d.mts +37 -0
- package/dist/client/client.mjs +80 -0
- package/dist/client/consume.d.mts +50 -0
- package/dist/client/consume.mjs +66 -0
- package/dist/client/dynamic-link.d.mts +16 -0
- package/dist/client/dynamic-link.mjs +19 -0
- package/dist/client/index.d.mts +6 -0
- package/dist/client/index.mjs +5 -0
- package/dist/client/interceptor.d.mts +31 -0
- package/dist/client/interceptor.mjs +34 -0
- package/dist/client/openapi.d.mts +29 -0
- package/dist/client/openapi.mjs +89 -0
- package/dist/client/plugins/batch.d.mts +26 -0
- package/dist/client/plugins/batch.mjs +64 -0
- package/dist/client/plugins/circuit-breaker.d.mts +24 -0
- package/dist/client/plugins/circuit-breaker.mjs +60 -0
- package/dist/client/plugins/csrf.d.mts +13 -0
- package/dist/client/plugins/csrf.mjs +20 -0
- package/dist/client/plugins/dedupe.d.mts +10 -0
- package/dist/client/plugins/dedupe.mjs +28 -0
- package/dist/client/plugins/index.d.mts +8 -0
- package/dist/client/plugins/index.mjs +8 -0
- package/dist/client/plugins/otel.d.mts +12 -0
- package/dist/client/plugins/otel.mjs +27 -0
- package/dist/client/plugins/retry.d.mts +34 -0
- package/dist/client/plugins/retry.mjs +79 -0
- package/dist/client/plugins/timeout.d.mts +10 -0
- package/dist/client/plugins/timeout.mjs +14 -0
- package/dist/client/server.d.mts +16 -0
- package/dist/client/server.mjs +59 -0
- package/dist/client/types.d.mts +29 -0
- package/dist/codec/devalue.d.mts +21 -0
- package/dist/codec/devalue.mjs +33 -0
- package/dist/codec/msgpack.d.mts +18 -0
- package/dist/codec/msgpack.mjs +45 -0
- package/dist/codec/sanitize.mjs +38 -0
- package/dist/codegen/emitters.d.mts +51 -0
- package/dist/codegen/emitters.mjs +143 -0
- package/dist/codegen/generate.d.mts +25 -0
- package/dist/codegen/generate.mjs +224 -0
- package/dist/codegen/index.d.mts +44 -0
- package/dist/codegen/index.mjs +103 -0
- package/dist/codegen/parse.d.mts +124 -0
- package/dist/codegen/parse.mjs +135 -0
- package/dist/codegen/preserve.d.mts +21 -0
- package/dist/codegen/preserve.mjs +62 -0
- package/dist/codegen/schema-to-code.d.mts +57 -0
- package/dist/codegen/schema-to-code.mjs +167 -0
- package/dist/compile.d.mts +46 -0
- package/dist/compile.mjs +332 -0
- package/dist/core/codec.mjs +67 -0
- package/dist/core/context-bridge.mjs +11 -0
- package/dist/core/dispatch.mjs +62 -0
- package/dist/core/error.d.mts +99 -60
- package/dist/core/error.mjs +125 -92
- package/dist/core/handler.d.mts +6 -0
- package/dist/core/handler.mjs +153 -0
- package/dist/core/input.mjs +49 -0
- package/dist/core/iterator.d.mts +17 -0
- package/dist/core/iterator.mjs +79 -0
- package/dist/core/router-utils.mjs +22 -0
- package/dist/core/schema.d.mts +20 -0
- package/dist/core/schema.mjs +33 -0
- package/dist/core/serve.d.mts +51 -0
- package/dist/core/serve.mjs +76 -0
- package/dist/core/sse.d.mts +18 -0
- package/dist/core/sse.mjs +110 -0
- package/dist/core/storage.d.mts +17 -4
- package/dist/core/storage.mjs +60 -13
- package/dist/core/task.d.mts +62 -0
- package/dist/core/task.mjs +165 -0
- package/dist/core/trace-map.d.mts +13 -0
- package/dist/core/trace-map.mjs +13 -0
- package/dist/core/url.mjs +28 -0
- package/dist/core/utils.mjs +24 -0
- package/dist/index.d.mts +17 -21
- package/dist/index.mjs +14 -22
- package/dist/integrations/ai/index.d.mts +25 -0
- package/dist/integrations/ai/index.mjs +117 -0
- package/dist/integrations/better-auth/index.d.mts +41 -0
- package/dist/integrations/better-auth/index.mjs +331 -0
- package/dist/integrations/drizzle/index.d.mts +27 -0
- package/dist/integrations/drizzle/index.mjs +285 -0
- package/dist/integrations/hey-api/index.d.mts +2 -0
- package/dist/integrations/hey-api/index.mjs +2 -0
- package/dist/integrations/hey-api/to-client.d.mts +20 -0
- package/dist/integrations/hey-api/to-client.mjs +39 -0
- package/dist/integrations/pinia-colada/general-utils.d.mts +13 -0
- package/dist/integrations/pinia-colada/general-utils.mjs +9 -0
- package/dist/integrations/pinia-colada/index.d.mts +6 -0
- package/dist/integrations/pinia-colada/index.mjs +5 -0
- package/dist/integrations/pinia-colada/key.d.mts +11 -0
- package/dist/integrations/pinia-colada/key.mjs +11 -0
- package/dist/integrations/pinia-colada/procedure-utils.d.mts +25 -0
- package/dist/integrations/pinia-colada/procedure-utils.mjs +33 -0
- package/dist/integrations/pinia-colada/router-utils.d.mts +17 -0
- package/dist/integrations/pinia-colada/router-utils.mjs +30 -0
- package/dist/integrations/pinia-colada/types.d.mts +25 -0
- package/dist/integrations/react/index.d.mts +83 -0
- package/dist/integrations/react/index.mjs +196 -0
- package/dist/integrations/tanstack-query/index.d.mts +120 -0
- package/dist/integrations/tanstack-query/index.mjs +100 -0
- package/dist/integrations/tanstack-query/ssr.d.mts +60 -0
- package/dist/integrations/tanstack-query/ssr.mjs +102 -0
- package/dist/integrations/zod/converter.d.mts +75 -0
- package/dist/integrations/zod/converter.mjs +345 -0
- package/dist/integrations/zod/index.d.mts +2 -0
- package/dist/integrations/zod/index.mjs +2 -0
- package/dist/lazy.d.mts +22 -0
- package/dist/lazy.mjs +34 -0
- package/dist/lifecycle.d.mts +36 -0
- package/dist/lifecycle.mjs +46 -0
- package/dist/map-input.d.mts +17 -0
- package/dist/map-input.mjs +47 -0
- package/dist/plugins/analytics/accumulator.d.mts +24 -0
- package/dist/plugins/analytics/accumulator.mjs +91 -0
- package/dist/plugins/analytics/alerts.d.mts +59 -0
- package/dist/plugins/analytics/alerts.mjs +140 -0
- package/dist/plugins/analytics/collector.d.mts +38 -0
- package/dist/plugins/analytics/collector.mjs +275 -0
- package/dist/plugins/analytics/cost.d.mts +61 -0
- package/dist/plugins/analytics/cost.mjs +97 -0
- package/dist/plugins/analytics/export.d.mts +7 -0
- package/dist/plugins/analytics/export.mjs +86 -0
- package/dist/plugins/analytics/normalize.mjs +144 -0
- package/dist/plugins/analytics/query.mjs +164 -0
- package/dist/plugins/analytics/request-id.mjs +34 -0
- package/dist/plugins/analytics/routes.d.mts +11 -0
- package/dist/plugins/analytics/routes.mjs +211 -0
- package/dist/plugins/analytics/sse.d.mts +31 -0
- package/dist/plugins/analytics/sse.mjs +74 -0
- package/dist/plugins/analytics/store.mjs +103 -0
- package/dist/plugins/analytics/timeseries.d.mts +50 -0
- package/dist/plugins/analytics/timeseries.mjs +169 -0
- package/dist/plugins/analytics/trace.d.mts +48 -0
- package/dist/plugins/analytics/trace.mjs +83 -0
- package/dist/plugins/analytics/types.d.mts +145 -0
- package/dist/plugins/analytics/types.mjs +40 -0
- package/dist/plugins/analytics/utils.d.mts +4 -0
- package/dist/plugins/analytics/utils.mjs +56 -0
- package/dist/plugins/analytics.d.mts +18 -0
- package/dist/plugins/analytics.mjs +188 -0
- package/dist/plugins/batch-server.d.mts +20 -0
- package/dist/plugins/batch-server.mjs +91 -0
- package/dist/plugins/body-limit.d.mts +19 -0
- package/dist/plugins/body-limit.mjs +49 -0
- package/dist/plugins/cache.d.mts +170 -0
- package/dist/plugins/cache.mjs +212 -0
- package/dist/plugins/coerce.d.mts +24 -0
- package/dist/plugins/coerce.mjs +70 -0
- package/dist/plugins/cookies.d.mts +14 -0
- package/dist/plugins/cookies.mjs +48 -0
- package/dist/plugins/cors.d.mts +43 -0
- package/dist/plugins/cors.mjs +62 -0
- package/dist/plugins/file-upload.d.mts +38 -0
- package/dist/plugins/file-upload.mjs +102 -0
- package/dist/plugins/index.d.mts +18 -0
- package/dist/plugins/index.mjs +17 -0
- package/dist/plugins/otel.d.mts +35 -0
- package/dist/plugins/otel.mjs +40 -0
- package/dist/plugins/pino.d.mts +60 -0
- package/dist/plugins/pino.mjs +42 -0
- package/dist/plugins/pubsub.d.mts +50 -0
- package/dist/plugins/pubsub.mjs +53 -0
- package/dist/plugins/ratelimit.d.mts +53 -0
- package/dist/plugins/ratelimit.mjs +92 -0
- package/dist/plugins/signing.d.mts +41 -0
- package/dist/plugins/signing.mjs +118 -0
- package/dist/plugins/strict-get.d.mts +10 -0
- package/dist/plugins/strict-get.mjs +33 -0
- package/dist/scalar.d.mts +49 -0
- package/dist/scalar.mjs +311 -0
- package/dist/silgi.d.mts +144 -0
- package/dist/silgi.mjs +164 -0
- package/dist/trpc-interop.d.mts +22 -0
- package/dist/trpc-interop.mjs +68 -0
- package/dist/types.d.mts +108 -0
- package/dist/ws.d.mts +88 -0
- package/dist/ws.mjs +205 -0
- package/lib/dashboard/index.html +120 -0
- package/lib/ocache.d.mts +1 -0
- package/lib/ocache.mjs +1 -0
- package/lib/ofetch.d.mts +1 -0
- package/lib/ofetch.mjs +1 -0
- package/lib/srvx.d.mts +1 -0
- package/lib/srvx.mjs +1 -0
- package/lib/unstorage.d.mts +1 -0
- package/lib/unstorage.mjs +1 -0
- package/package.json +314 -150
- package/dist/build.d.mts +0 -3
- package/dist/build.mjs +0 -4
- package/dist/cli/build/build.mjs +0 -15
- package/dist/cli/build/dev.d.mts +0 -10
- package/dist/cli/build/dev.mjs +0 -91
- package/dist/cli/build/prepare.d.mts +0 -6
- package/dist/cli/build/prepare.mjs +0 -15
- package/dist/cli/commands/commands.mjs +0 -90
- package/dist/cli/commands/env.mjs +0 -53
- package/dist/cli/commands/init.mjs +0 -84
- package/dist/cli/commands/install.mjs +0 -52
- package/dist/cli/commands/prepare.mjs +0 -65
- package/dist/cli/commands/reset.mjs +0 -46
- package/dist/cli/commands/run.mjs +0 -31
- package/dist/cli/commands/watch.mjs +0 -153
- package/dist/cli/config/defaults.mjs +0 -117
- package/dist/cli/config/index.d.mts +0 -3
- package/dist/cli/config/index.mjs +0 -4
- package/dist/cli/config/loader.d.mts +0 -6
- package/dist/cli/config/loader.mjs +0 -71
- package/dist/cli/config/resolvers/compatibility.mjs +0 -71
- package/dist/cli/config/resolvers/imports.mjs +0 -35
- package/dist/cli/config/resolvers/paths.mjs +0 -98
- package/dist/cli/config/resolvers/storage.mjs +0 -23
- package/dist/cli/config/resolvers/url.mjs +0 -9
- package/dist/cli/config/types.d.mts +0 -14
- package/dist/cli/config/types.mjs +0 -147
- package/dist/cli/core/apiful.mjs +0 -36
- package/dist/cli/core/devServer.mjs +0 -10
- package/dist/cli/core/env.mjs +0 -68
- package/dist/cli/core/installPackage.mjs +0 -60
- package/dist/cli/core/runtimeConfig.mjs +0 -70
- package/dist/cli/core/scan.mjs +0 -35
- package/dist/cli/core/silgi.mjs +0 -111
- package/dist/cli/framework/emptyFramework.mjs +0 -7
- package/dist/cli/framework/h3.mjs +0 -55
- package/dist/cli/framework/index.mjs +0 -15
- package/dist/cli/framework/nitro.mjs +0 -24
- package/dist/cli/framework/nuxt.mjs +0 -10
- package/dist/cli/index.d.mts +0 -1
- package/dist/cli/index.mjs +0 -29
- package/dist/cli/module/exportScan.mjs +0 -180
- package/dist/cli/module/install.mjs +0 -49
- package/dist/cli/module/scan.mjs +0 -193
- package/dist/cli/scan/prepareCommands.mjs +0 -40
- package/dist/cli/scan/prepareConfigs.mjs +0 -33
- package/dist/cli/scan/prepareCoreFile.mjs +0 -118
- package/dist/cli/scan/prepareScanFile.mjs +0 -59
- package/dist/cli/scan/prepareSchema.mjs +0 -128
- package/dist/cli/scan/scanExportFile.mjs +0 -288
- package/dist/cli/scan/writeCoreFile.mjs +0 -22
- package/dist/cli/scan/writeTypesAndFiles.mjs +0 -72
- package/dist/cli/utils/cancel.mjs +0 -14
- package/dist/cli/utils/common.mjs +0 -15
- package/dist/cli/utils/compatibility.mjs +0 -33
- package/dist/cli/utils/debug.mjs +0 -11
- package/dist/cli/utils/ignore.mjs +0 -56
- package/dist/cli/utils/processManager.mjs +0 -170
- package/dist/cli/utils/readScanFile.mjs +0 -58
- package/dist/cli/utils/storage.mjs +0 -23
- package/dist/core/context.d.mts +0 -30
- package/dist/core/context.mjs +0 -32
- package/dist/core/createSilgi.d.mts +0 -6
- package/dist/core/createSilgi.mjs +0 -153
- package/dist/core/event.d.mts +0 -26
- package/dist/core/event.mjs +0 -44
- package/dist/core/index.d.mts +0 -25
- package/dist/core/index.mjs +0 -30
- package/dist/core/orchestrate.mjs +0 -115
- package/dist/core/response.d.mts +0 -20
- package/dist/core/response.mjs +0 -105
- package/dist/core/silgi.d.mts +0 -19
- package/dist/core/silgi.mjs +0 -141
- package/dist/core/silgiApp.d.mts +0 -9
- package/dist/core/silgiApp.mjs +0 -23
- package/dist/core/unctx.d.mts +0 -21
- package/dist/core/unctx.mjs +0 -35
- package/dist/core/utils/event-stream.d.mts +0 -53
- package/dist/core/utils/event-stream.mjs +0 -38
- package/dist/core/utils/event.d.mts +0 -8
- package/dist/core/utils/event.mjs +0 -12
- package/dist/core/utils/internal/event-stream.d.mts +0 -45
- package/dist/core/utils/internal/event-stream.mjs +0 -137
- package/dist/core/utils/internal/obj.mjs +0 -9
- package/dist/core/utils/internal/object.mjs +0 -29
- package/dist/core/utils/internal/query.mjs +0 -73
- package/dist/core/utils/internal/req.mjs +0 -35
- package/dist/core/utils/merge.d.mts +0 -14
- package/dist/core/utils/merge.mjs +0 -27
- package/dist/core/utils/middleware.d.mts +0 -14
- package/dist/core/utils/middleware.mjs +0 -12
- package/dist/core/utils/request.mjs +0 -35
- package/dist/core/utils/resolver.d.mts +0 -7
- package/dist/core/utils/resolver.mjs +0 -29
- package/dist/core/utils/runtime.d.mts +0 -7
- package/dist/core/utils/runtime.mjs +0 -20
- package/dist/core/utils/sanitize.mjs +0 -22
- package/dist/core/utils/schema.d.mts +0 -34
- package/dist/core/utils/schema.mjs +0 -33
- package/dist/core/utils/service.d.mts +0 -13
- package/dist/core/utils/service.mjs +0 -19
- package/dist/core/utils/shared.d.mts +0 -6
- package/dist/core/utils/shared.mjs +0 -7
- package/dist/core/utils/storage.d.mts +0 -24
- package/dist/core/utils/storage.mjs +0 -54
- package/dist/kit/add/add-commands.d.mts +0 -6
- package/dist/kit/add/add-commands.mjs +0 -12
- package/dist/kit/add/add-core-file.d.mts +0 -9
- package/dist/kit/add/add-core-file.mjs +0 -11
- package/dist/kit/add/add-imports.d.mts +0 -14
- package/dist/kit/add/add-imports.mjs +0 -56
- package/dist/kit/add/add-npm.d.mts +0 -14
- package/dist/kit/add/add-npm.mjs +0 -23
- package/dist/kit/define.d.mts +0 -28
- package/dist/kit/define.mjs +0 -25
- package/dist/kit/errors.d.mts +0 -6
- package/dist/kit/errors.mjs +0 -11
- package/dist/kit/esm.d.mts +0 -11
- package/dist/kit/esm.mjs +0 -21
- package/dist/kit/fs.d.mts +0 -4
- package/dist/kit/fs.mjs +0 -13
- package/dist/kit/function-utils.d.mts +0 -27
- package/dist/kit/function-utils.mjs +0 -75
- package/dist/kit/gen.d.mts +0 -5
- package/dist/kit/gen.mjs +0 -26
- package/dist/kit/hash.d.mts +0 -4
- package/dist/kit/hash.mjs +0 -10
- package/dist/kit/index.d.mts +0 -22
- package/dist/kit/index.mjs +0 -23
- package/dist/kit/isFramework.d.mts +0 -6
- package/dist/kit/isFramework.mjs +0 -21
- package/dist/kit/logger.d.mts +0 -6
- package/dist/kit/logger.mjs +0 -10
- package/dist/kit/migration.d.mts +0 -113
- package/dist/kit/migration.mjs +0 -301
- package/dist/kit/module.d.mts +0 -14
- package/dist/kit/module.mjs +0 -53
- package/dist/kit/path.d.mts +0 -7
- package/dist/kit/path.mjs +0 -26
- package/dist/kit/preset.d.mts +0 -8
- package/dist/kit/preset.mjs +0 -11
- package/dist/kit/resolve.d.mts +0 -37
- package/dist/kit/resolve.mjs +0 -82
- package/dist/kit/template.d.mts +0 -19
- package/dist/kit/template.mjs +0 -91
- package/dist/kit/useRequest.d.mts +0 -19
- package/dist/kit/useRequest.mjs +0 -63
- package/dist/kit/utils.d.mts +0 -34
- package/dist/kit/utils.mjs +0 -91
- package/dist/package.mjs +0 -176
- package/dist/presets/_all.gen.d.mts +0 -6
- package/dist/presets/_all.gen.mjs +0 -18
- package/dist/presets/_resolve.d.mts +0 -12
- package/dist/presets/_resolve.mjs +0 -57
- package/dist/presets/_types.gen.d.mts +0 -8
- package/dist/presets/_types.gen.mjs +0 -5
- package/dist/presets/h3/preset.d.mts +0 -6
- package/dist/presets/h3/preset.mjs +0 -35
- package/dist/presets/hono/preset.d.mts +0 -6
- package/dist/presets/hono/preset.mjs +0 -30
- package/dist/presets/index.d.mts +0 -3
- package/dist/presets/index.mjs +0 -3
- package/dist/presets/nitro/preset.d.mts +0 -6
- package/dist/presets/nitro/preset.mjs +0 -37
- package/dist/presets/npmpackage/preset.d.mts +0 -6
- package/dist/presets/npmpackage/preset.mjs +0 -29
- package/dist/presets/nuxt/preset.d.mts +0 -6
- package/dist/presets/nuxt/preset.mjs +0 -41
- package/dist/runtime/index.d.mts +0 -4
- package/dist/runtime/index.mjs +0 -5
- package/dist/runtime/internal/config.d.mts +0 -11
- package/dist/runtime/internal/config.mjs +0 -97
- package/dist/runtime/internal/debug.d.mts +0 -6
- package/dist/runtime/internal/debug.mjs +0 -11
- package/dist/runtime/internal/defu.d.mts +0 -4
- package/dist/runtime/internal/defu.mjs +0 -9
- package/dist/runtime/internal/index.d.mts +0 -7
- package/dist/runtime/internal/index.mjs +0 -8
- package/dist/runtime/internal/nitro.d.mts +0 -6
- package/dist/runtime/internal/nitro.mjs +0 -36
- package/dist/runtime/internal/nuxt.d.mts +0 -12
- package/dist/runtime/internal/nuxt.mjs +0 -16
- package/dist/runtime/internal/ofetch.d.mts +0 -8
- package/dist/runtime/internal/ofetch.mjs +0 -39
- package/dist/runtime/internal/plugin.d.mts +0 -7
- package/dist/runtime/internal/plugin.mjs +0 -8
- package/dist/types/cliConfig.d.mts +0 -288
- package/dist/types/cliConfig.mjs +0 -0
- package/dist/types/cliHooks.d.mts +0 -142
- package/dist/types/cliHooks.mjs +0 -0
- package/dist/types/compatibility.d.mts +0 -13
- package/dist/types/compatibility.mjs +0 -0
- package/dist/types/config.d.mts +0 -46
- package/dist/types/config.mjs +0 -0
- package/dist/types/dotenv.d.mts +0 -29
- package/dist/types/dotenv.mjs +0 -0
- package/dist/types/event.d.mts +0 -63
- package/dist/types/event.mjs +0 -0
- package/dist/types/global.d.mts +0 -24
- package/dist/types/global.mjs +0 -0
- package/dist/types/helper.d.mts +0 -25
- package/dist/types/helper.mjs +0 -0
- package/dist/types/hooks.d.mts +0 -37
- package/dist/types/hooks.mjs +0 -0
- package/dist/types/index.d.mts +0 -26
- package/dist/types/index.mjs +0 -0
- package/dist/types/kits.d.mts +0 -32
- package/dist/types/kits.mjs +0 -0
- package/dist/types/middleware.d.mts +0 -31
- package/dist/types/middleware.mjs +0 -0
- package/dist/types/module.d.mts +0 -102
- package/dist/types/module.mjs +0 -0
- package/dist/types/preset.d.mts +0 -20
- package/dist/types/preset.mjs +0 -0
- package/dist/types/route.d.mts +0 -59
- package/dist/types/route.mjs +0 -0
- package/dist/types/runtime/index.d.mts +0 -5
- package/dist/types/runtime/index.mjs +0 -0
- package/dist/types/runtime/nuxt.d.mts +0 -13
- package/dist/types/runtime/nuxt.mjs +0 -0
- package/dist/types/runtime/ofetch.d.mts +0 -14
- package/dist/types/runtime/ofetch.mjs +0 -0
- package/dist/types/runtime/plugin.d.mts +0 -8
- package/dist/types/runtime/plugin.mjs +0 -0
- package/dist/types/runtime/silgi.d.mts +0 -11
- package/dist/types/runtime/silgi.mjs +0 -0
- package/dist/types/schema.d.mts +0 -86
- package/dist/types/schema.mjs +0 -0
- package/dist/types/service.d.mts +0 -102
- package/dist/types/service.mjs +0 -0
- package/dist/types/shared.d.mts +0 -19
- package/dist/types/shared.mjs +0 -0
- package/dist/types/silgi.d.mts +0 -71
- package/dist/types/silgi.mjs +0 -0
- package/dist/types/silgiCLI.d.mts +0 -118
- package/dist/types/silgiCLI.mjs +0 -0
- package/dist/types/standard-schema.d.mts +0 -61
- package/dist/types/standard-schema.mjs +0 -0
- package/dist/types/storage.d.mts +0 -30
- package/dist/types/storage.mjs +0 -0
- package/dist/types/tree-kill.d.mts +0 -18
- package/dist/types/tree-kill.mjs +0 -0
- package/lib/config.d.mts +0 -7
- package/lib/config.mjs +0 -5
- package/lib/meta.d.mts +0 -4
- package/lib/meta.mjs +0 -6
- package/lib/runtime-meta.d.mts +0 -4
- package/lib/runtime-meta.mjs +0 -32
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { isDebug, isTest } from "std-env";
|
|
2
|
-
|
|
3
|
-
//#region src/cli/config/defaults.ts
|
|
4
|
-
const SilgiCLIDefaults = {
|
|
5
|
-
debug: isDebug === true ? true : void 0,
|
|
6
|
-
schemaVendor: "zod",
|
|
7
|
-
logLevel: isTest ? 1 : 3,
|
|
8
|
-
appConfig: {},
|
|
9
|
-
appConfigFiles: [],
|
|
10
|
-
commandType: "prepare",
|
|
11
|
-
commands: [],
|
|
12
|
-
runtimeConfig: { silgi: {} },
|
|
13
|
-
storages: [],
|
|
14
|
-
devServer: { watch: [] },
|
|
15
|
-
package: {
|
|
16
|
-
name: "",
|
|
17
|
-
present: "npm-package"
|
|
18
|
-
},
|
|
19
|
-
scanDirs: [],
|
|
20
|
-
build: {
|
|
21
|
-
dir: ".silgi",
|
|
22
|
-
typesDir: "{{ build.dir }}/types",
|
|
23
|
-
templates: []
|
|
24
|
-
},
|
|
25
|
-
output: {
|
|
26
|
-
dir: "{{ rootDir }}/.output",
|
|
27
|
-
serverDir: "{{ output.dir }}/server",
|
|
28
|
-
publicDir: "{{ output.dir }}/public"
|
|
29
|
-
},
|
|
30
|
-
serverDir: "{{ rootDir }}/server",
|
|
31
|
-
clientDir: "{{ rootDir }}/client",
|
|
32
|
-
migrationDir: "{{ rootDir }}/migration",
|
|
33
|
-
silgi: {
|
|
34
|
-
serverDir: "{{ serverDir }}/silgi",
|
|
35
|
-
clientDir: "{{ clientDir }}/silgi",
|
|
36
|
-
publicDir: "{{ silgi.serverDir }}/public",
|
|
37
|
-
utilsDir: "{{ silgi.serverDir }}/utils",
|
|
38
|
-
vfsDir: "{{ silgi.serverDir }}/vfs",
|
|
39
|
-
typesDir: "{{ silgi.serverDir }}/types"
|
|
40
|
-
},
|
|
41
|
-
codegen: { env: { safeList: [["silgi", "version"]] } },
|
|
42
|
-
_modules: [],
|
|
43
|
-
modules: [],
|
|
44
|
-
future: {},
|
|
45
|
-
storage: {},
|
|
46
|
-
devStorage: {},
|
|
47
|
-
stub: false,
|
|
48
|
-
plugins: [],
|
|
49
|
-
imports: {
|
|
50
|
-
exclude: [],
|
|
51
|
-
dirs: [],
|
|
52
|
-
presets: [],
|
|
53
|
-
virtualImports: ["#silgiImports"]
|
|
54
|
-
},
|
|
55
|
-
ignore: [
|
|
56
|
-
"**/*.stories.{js,cts,mts,ts,jsx,tsx}",
|
|
57
|
-
"**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}",
|
|
58
|
-
"**/*.d.{cts,mts,ts}",
|
|
59
|
-
"**/.{pnpm-store,vercel,netlify,output,git,cache,data}",
|
|
60
|
-
".silgi",
|
|
61
|
-
"**/-*.*"
|
|
62
|
-
],
|
|
63
|
-
dev: false,
|
|
64
|
-
watchOptions: {
|
|
65
|
-
ignoreInitial: true,
|
|
66
|
-
ignored: [
|
|
67
|
-
"**/node_modules/**",
|
|
68
|
-
"**/.git/**",
|
|
69
|
-
"**/.silgi/**",
|
|
70
|
-
"**/.output/**",
|
|
71
|
-
"**/.vscode/**",
|
|
72
|
-
"**/.idea/**",
|
|
73
|
-
"**/.nuxt/**",
|
|
74
|
-
"**/.gitignore",
|
|
75
|
-
"**/.gitattributes",
|
|
76
|
-
"**/assets/**",
|
|
77
|
-
"**/dist/**",
|
|
78
|
-
"**/build/**",
|
|
79
|
-
"**/coverage/**",
|
|
80
|
-
"**/test/**",
|
|
81
|
-
"**/tests/**",
|
|
82
|
-
"**/tmp/**"
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
typescript: {
|
|
86
|
-
generateTsConfig: true,
|
|
87
|
-
tsconfigPath: ".silgi/types/silgi.tsconfig.json",
|
|
88
|
-
tsConfig: {},
|
|
89
|
-
customConditions: [],
|
|
90
|
-
generateRuntimeConfigTypes: true,
|
|
91
|
-
removeFileExtension: false
|
|
92
|
-
},
|
|
93
|
-
conditions: [],
|
|
94
|
-
nodeModulesDirs: [],
|
|
95
|
-
hooks: {},
|
|
96
|
-
framework: {
|
|
97
|
-
name: "h3",
|
|
98
|
-
version: ""
|
|
99
|
-
},
|
|
100
|
-
extensions: [
|
|
101
|
-
".js",
|
|
102
|
-
".jsx",
|
|
103
|
-
".mjs",
|
|
104
|
-
".ts",
|
|
105
|
-
".tsx",
|
|
106
|
-
".vue"
|
|
107
|
-
],
|
|
108
|
-
ignoreOptions: void 0,
|
|
109
|
-
apiFul: {},
|
|
110
|
-
installPackages: {
|
|
111
|
-
dependencies: {},
|
|
112
|
-
devDependencies: {}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
//#endregion
|
|
117
|
-
export { SilgiCLIDefaults };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LoadConfigOptions, SilgiCLIConfig, SilgiCLIOptions } from "silgi/types";
|
|
2
|
-
|
|
3
|
-
//#region src/cli/config/loader.d.ts
|
|
4
|
-
declare function loadOptions(configOverrides?: SilgiCLIConfig, opts?: LoadConfigOptions): Promise<SilgiCLIOptions>;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { loadOptions as loadOptions$1 };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { SilgiCLIDefaults } from "./defaults.mjs";
|
|
2
|
-
import { fallbackCompatibilityDate, resolveCompatibilityOptions } from "./resolvers/compatibility.mjs";
|
|
3
|
-
import { resolveImportsOptions } from "./resolvers/imports.mjs";
|
|
4
|
-
import { resolvePathOptions } from "./resolvers/paths.mjs";
|
|
5
|
-
import { resolveStorageOptions } from "./resolvers/storage.mjs";
|
|
6
|
-
import { resolveURLOptions } from "./resolvers/url.mjs";
|
|
7
|
-
import { loadConfig, watchConfig } from "c12";
|
|
8
|
-
import { resolveCompatibilityDates } from "compatx";
|
|
9
|
-
import { klona } from "klona/full";
|
|
10
|
-
|
|
11
|
-
//#region src/cli/config/loader.ts
|
|
12
|
-
const configResolvers = [
|
|
13
|
-
resolveCompatibilityOptions,
|
|
14
|
-
resolvePathOptions,
|
|
15
|
-
resolveImportsOptions,
|
|
16
|
-
resolveURLOptions,
|
|
17
|
-
resolveStorageOptions
|
|
18
|
-
];
|
|
19
|
-
async function loadOptions(configOverrides = {}, opts = {}) {
|
|
20
|
-
const options = await _loadUserConfig(configOverrides, opts);
|
|
21
|
-
for (const resolver of configResolvers) await resolver(options);
|
|
22
|
-
return options;
|
|
23
|
-
}
|
|
24
|
-
async function _loadUserConfig(configOverrides = {}, opts = {}) {
|
|
25
|
-
const presetOverride = configOverrides.preset || process.env.SILGI_PRESET;
|
|
26
|
-
if (configOverrides.dev) {}
|
|
27
|
-
configOverrides = klona(configOverrides);
|
|
28
|
-
globalThis.defineSilgiConfig = globalThis.defineSilgiConfig || ((c) => c);
|
|
29
|
-
let compatibilityDate = configOverrides.compatibilityDate || opts.compatibilityDate || process.env.SILGI_COMPATIBILITY_DATE || process.env.SERVER_COMPATIBILITY_DATE || process.env.COMPATIBILITY_DATE;
|
|
30
|
-
const { resolvePreset } = await import("silgi/presets");
|
|
31
|
-
const loadedConfig = await (opts.watch ? watchConfig : loadConfig)({
|
|
32
|
-
name: "silgi",
|
|
33
|
-
cwd: configOverrides.rootDir,
|
|
34
|
-
dotenv: configOverrides.dev,
|
|
35
|
-
extend: { extendKey: ["extends", "preset"] },
|
|
36
|
-
overrides: {
|
|
37
|
-
...configOverrides,
|
|
38
|
-
preset: presetOverride
|
|
39
|
-
},
|
|
40
|
-
async defaultConfig({ configs }) {
|
|
41
|
-
const getConf = (key) => configs.main?.[key] ?? configs.rc?.[key] ?? configs.packageJson?.[key];
|
|
42
|
-
if (!compatibilityDate) compatibilityDate = getConf("compatibilityDate");
|
|
43
|
-
return { preset: presetOverride || (await resolvePreset("", {
|
|
44
|
-
static: getConf("static"),
|
|
45
|
-
compatibilityDate: compatibilityDate || fallbackCompatibilityDate
|
|
46
|
-
}))?._meta?.name };
|
|
47
|
-
},
|
|
48
|
-
defaults: SilgiCLIDefaults,
|
|
49
|
-
jitiOptions: { alias: { "silgi/config": "silgi/config" } },
|
|
50
|
-
async resolve(id) {
|
|
51
|
-
const preset = await resolvePreset(id, {
|
|
52
|
-
static: configOverrides.static,
|
|
53
|
-
compatibilityDate: compatibilityDate || fallbackCompatibilityDate
|
|
54
|
-
});
|
|
55
|
-
if (preset) return { config: klona(preset) };
|
|
56
|
-
},
|
|
57
|
-
...opts.c12
|
|
58
|
-
});
|
|
59
|
-
delete globalThis.defineSilgiConfig;
|
|
60
|
-
const options = klona(loadedConfig.config);
|
|
61
|
-
options._config = configOverrides;
|
|
62
|
-
options._c12 = loadedConfig;
|
|
63
|
-
const _presetName = (loadedConfig.layers || []).find((l) => l.config?._meta?.name)?.config?._meta?.name || presetOverride;
|
|
64
|
-
options.preset = _presetName;
|
|
65
|
-
options.package.present = _presetName;
|
|
66
|
-
options.compatibilityDate = resolveCompatibilityDates(compatibilityDate, options.compatibilityDate);
|
|
67
|
-
return options;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { loadOptions };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import consola from "consola";
|
|
2
|
-
import { relative } from "pathe";
|
|
3
|
-
import { formatDate, resolveCompatibilityDatesFromEnv } from "compatx";
|
|
4
|
-
import { colors } from "consola/utils";
|
|
5
|
-
|
|
6
|
-
//#region src/cli/config/resolvers/compatibility.ts
|
|
7
|
-
const fallbackCompatibilityDate = "2025-02-04";
|
|
8
|
-
async function resolveCompatibilityOptions(options) {
|
|
9
|
-
options.compatibilityDate = resolveCompatibilityDatesFromEnv(options.compatibilityDate);
|
|
10
|
-
if (!options.compatibilityDate.default) options.compatibilityDate.default = await _resolveDefault(options);
|
|
11
|
-
}
|
|
12
|
-
let _fallbackInfoShown = false;
|
|
13
|
-
let _promptedUserToUpdate = false;
|
|
14
|
-
async function _resolveDefault(options) {
|
|
15
|
-
const _todayDate = formatDate(new Date());
|
|
16
|
-
const consola$2 = consola.withTag("silgi");
|
|
17
|
-
consola$2.warn(`No valid compatibility date is specified.`);
|
|
18
|
-
const onFallback = () => {
|
|
19
|
-
if (!_fallbackInfoShown) {
|
|
20
|
-
consola$2.info([
|
|
21
|
-
`Using \`${fallbackCompatibilityDate}\` as fallback.`,
|
|
22
|
-
` Please specify compatibility date to avoid unwanted behavior changes:`,
|
|
23
|
-
` - Add \`compatibilityDate: '${_todayDate}'\` to the config file.`,
|
|
24
|
-
` - Or set \`COMPATIBILITY_DATE=${_todayDate}\` environment variable.`,
|
|
25
|
-
``
|
|
26
|
-
].join("\n"));
|
|
27
|
-
_fallbackInfoShown = true;
|
|
28
|
-
}
|
|
29
|
-
return fallbackCompatibilityDate;
|
|
30
|
-
};
|
|
31
|
-
const shallUpdate = !_promptedUserToUpdate && await consola$2.prompt(`Do you want to auto update config file to set ${colors.cyan(`compatibilityDate: '${_todayDate}'`)}?`, {
|
|
32
|
-
type: "confirm",
|
|
33
|
-
default: true
|
|
34
|
-
});
|
|
35
|
-
_promptedUserToUpdate = true;
|
|
36
|
-
if (!shallUpdate) return onFallback();
|
|
37
|
-
const { updateConfig } = await import("c12/update");
|
|
38
|
-
const updateResult = await updateConfig({
|
|
39
|
-
configFile: "silgi.config",
|
|
40
|
-
cwd: options.rootDir,
|
|
41
|
-
async onCreate({ configFile }) {
|
|
42
|
-
const shallCreate = await consola$2.prompt(`Do you want to initialize a new config in ${colors.cyan(relative(".", configFile))}?`, {
|
|
43
|
-
type: "confirm",
|
|
44
|
-
default: true
|
|
45
|
-
});
|
|
46
|
-
if (shallCreate !== true) return false;
|
|
47
|
-
return _getDefaultNitroConfig();
|
|
48
|
-
},
|
|
49
|
-
async onUpdate(config) {
|
|
50
|
-
config.compatibilityDate = _todayDate;
|
|
51
|
-
}
|
|
52
|
-
}).catch((error) => {
|
|
53
|
-
consola$2.error(`Failed to update config: ${error.message}`);
|
|
54
|
-
return null;
|
|
55
|
-
});
|
|
56
|
-
if (updateResult?.configFile) {
|
|
57
|
-
consola$2.success(`Compatibility date set to \`${_todayDate}\` in \`${relative(".", updateResult.configFile)}\``);
|
|
58
|
-
return _todayDate;
|
|
59
|
-
}
|
|
60
|
-
return onFallback();
|
|
61
|
-
}
|
|
62
|
-
function _getDefaultNitroConfig() {
|
|
63
|
-
return `
|
|
64
|
-
import { defineSilgiConfig } from 'silgi/config'
|
|
65
|
-
|
|
66
|
-
export default defineSilgiConfig({})
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { fallbackCompatibilityDate, resolveCompatibilityOptions };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { join } from "pathe";
|
|
2
|
-
import escapeRE from "escape-string-regexp";
|
|
3
|
-
import { resolveModuleExportNames } from "mlly";
|
|
4
|
-
|
|
5
|
-
//#region src/cli/config/resolvers/imports.ts
|
|
6
|
-
async function resolveImportsOptions(options) {
|
|
7
|
-
if (options.imports === false) return;
|
|
8
|
-
options.imports.presets ??= [];
|
|
9
|
-
options.imports.presets.push(...getSilgiImportsPreset());
|
|
10
|
-
if (options.preset === "h3") {
|
|
11
|
-
const h3Exports = await resolveModuleExportNames("h3", { url: import.meta.url });
|
|
12
|
-
options.imports.presets ??= [];
|
|
13
|
-
options.imports.presets.push({
|
|
14
|
-
from: "h3",
|
|
15
|
-
imports: h3Exports.filter((n) => !/^[A-Z]/.test(n) && n !== "use")
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
options.imports.dirs ??= [];
|
|
19
|
-
options.imports.dirs.push(...options.scanDirs.map((dir) => join(dir, "utils/**/*")));
|
|
20
|
-
if (Array.isArray(options.imports.exclude) && options.imports.exclude.length === 0) {
|
|
21
|
-
options.imports.exclude.push(/[/\\]\.git[/\\]/);
|
|
22
|
-
options.imports.exclude.push(options.build.dir);
|
|
23
|
-
const scanDirsInNodeModules = options.scanDirs.map((dir) => dir.match(/(?<=\/)node_modules\/(.+)$/)?.[1]).filter(Boolean);
|
|
24
|
-
options.imports.exclude.push(scanDirsInNodeModules.length > 0 ? new RegExp(`node_modules\\/(?!${scanDirsInNodeModules.map((dir) => escapeRE(dir)).join("|")})`) : /[/\\]node_modules[/\\]/);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getSilgiImportsPreset() {
|
|
28
|
-
return [{
|
|
29
|
-
from: "silgi",
|
|
30
|
-
imports: ["useSilgiStorage"]
|
|
31
|
-
}];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { resolveImportsOptions };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { SilgiCLIDefaults } from "../defaults.mjs";
|
|
2
|
-
import { join, resolve } from "pathe";
|
|
3
|
-
import { resolveSilgiPath } from "silgi/kit";
|
|
4
|
-
import { pkgDir, runtimeDir } from "silgi/runtime/meta";
|
|
5
|
-
import { existsSync } from "node:fs";
|
|
6
|
-
import { findWorkspaceDir, readPackageJSON } from "pkg-types";
|
|
7
|
-
|
|
8
|
-
//#region src/cli/config/resolvers/paths.ts
|
|
9
|
-
async function resolvePathOptions(options) {
|
|
10
|
-
options.rootDir = resolve(options.rootDir || ".");
|
|
11
|
-
options.workspaceDir = await findWorkspaceDir(options.rootDir).catch(() => options.rootDir);
|
|
12
|
-
options.srcDir = resolve(options.srcDir || options.rootDir);
|
|
13
|
-
for (const key of ["srcDir"]) options[key] = resolve(options.rootDir, options[key]);
|
|
14
|
-
options.build.dir = resolve(options.rootDir, options.build.dir);
|
|
15
|
-
options.build.typesDir = resolveSilgiPath(options.build.typesDir || SilgiCLIDefaults.build.typesDir, options, options.rootDir);
|
|
16
|
-
if (options.preset === "npm-package") {
|
|
17
|
-
const packageJsonPath = resolve(options.rootDir, "package.json");
|
|
18
|
-
const packageJson = await readPackageJSON(packageJsonPath);
|
|
19
|
-
if (packageJson.name === void 0) throw new Error("Package name is undefined");
|
|
20
|
-
options.alias ||= {};
|
|
21
|
-
options.alias[packageJson.name] = join(options.rootDir, "src/module");
|
|
22
|
-
options.alias[`${packageJson.name}/runtime`] = join(options.rootDir, "src/runtime");
|
|
23
|
-
options.alias[`${packageJson.name}/data`] = join(options.rootDir, "src/data");
|
|
24
|
-
options.alias[`${packageJson.name}/data/*`] = join(options.rootDir, "src/data/*");
|
|
25
|
-
options.alias[`${packageJson.name}/runtime/*`] = join(options.rootDir, "src/runtime/*");
|
|
26
|
-
options.alias[`${packageJson.name}/types`] = join(options.rootDir, "src/types");
|
|
27
|
-
}
|
|
28
|
-
if (options.stub) options.alias = {
|
|
29
|
-
...options.alias,
|
|
30
|
-
"silgi/runtime": join(runtimeDir),
|
|
31
|
-
"silgi/runtime/*": join(runtimeDir, "*")
|
|
32
|
-
};
|
|
33
|
-
options.alias = {
|
|
34
|
-
...options.alias,
|
|
35
|
-
"#server/*": join(options.silgi.serverDir, "/*"),
|
|
36
|
-
"#silgi/*": join(options.build.dir, "/*"),
|
|
37
|
-
"#types/*": join(options.build.typesDir, "/*")
|
|
38
|
-
};
|
|
39
|
-
if (options.preset === "npm-package") options.alias = { ...options.alias };
|
|
40
|
-
if (options.alias && typeof options.alias === "object") {
|
|
41
|
-
((options.typescript.tsConfig ??= {}).compilerOptions ??= {}).paths ??= {};
|
|
42
|
-
const paths = options.typescript.tsConfig.compilerOptions.paths;
|
|
43
|
-
for (const [key, value] of Object.entries(options.alias)) if (typeof paths === "object") paths[key] = [value];
|
|
44
|
-
}
|
|
45
|
-
if (options.typescript.tsConfig.compilerOptions?.paths && typeof options.typescript.tsConfig.compilerOptions.paths === "object") {
|
|
46
|
-
((options.typescript.tsConfig ??= {}).compilerOptions ??= {}).paths ??= {};
|
|
47
|
-
const paths = options.typescript.tsConfig.compilerOptions.paths;
|
|
48
|
-
for (const [key, value] of Object.entries(options.alias)) if (typeof paths === "object") paths[key] = [value];
|
|
49
|
-
}
|
|
50
|
-
options.modulesDir = [resolve(options.rootDir, "node_modules")];
|
|
51
|
-
options.output.dir = resolveSilgiPath(options.output.dir || SilgiCLIDefaults.output.dir, options, options.rootDir);
|
|
52
|
-
options.output.publicDir = resolveSilgiPath(options.output.publicDir || SilgiCLIDefaults.output.publicDir, options, options.rootDir);
|
|
53
|
-
options.output.serverDir = resolveSilgiPath(options.output.serverDir || SilgiCLIDefaults.output.serverDir, options, options.rootDir);
|
|
54
|
-
options.serverDir = resolveSilgiPath(options.serverDir || SilgiCLIDefaults.serverDir, options, options.rootDir);
|
|
55
|
-
options.clientDir = resolveSilgiPath(options.clientDir || SilgiCLIDefaults.clientDir, options, options.rootDir);
|
|
56
|
-
options.silgi.serverDir = resolveSilgiPath(options.silgi.serverDir || SilgiCLIDefaults.silgi.serverDir, options, options.rootDir);
|
|
57
|
-
options.silgi.clientDir = resolveSilgiPath(options.silgi.clientDir || SilgiCLIDefaults.silgi.clientDir, options, options.rootDir);
|
|
58
|
-
options.silgi.publicDir = resolveSilgiPath(options.silgi.publicDir || SilgiCLIDefaults.silgi.publicDir, options, options.rootDir);
|
|
59
|
-
options.silgi.utilsDir = resolveSilgiPath(options.silgi.utilsDir || SilgiCLIDefaults.silgi.utilsDir, options, options.rootDir);
|
|
60
|
-
options.silgi.vfsDir = resolveSilgiPath(options.silgi.vfsDir || SilgiCLIDefaults.silgi.vfsDir, options, options.rootDir);
|
|
61
|
-
options.silgi.typesDir = resolveSilgiPath(options.silgi.typesDir || SilgiCLIDefaults.silgi.typesDir, options, options.rootDir);
|
|
62
|
-
options.nodeModulesDirs.push(resolve(options.workspaceDir, "node_modules"));
|
|
63
|
-
options.nodeModulesDirs.push(resolve(options.rootDir, "node_modules"));
|
|
64
|
-
options.nodeModulesDirs.push(resolve(pkgDir, "node_modules"));
|
|
65
|
-
options.nodeModulesDirs.push(resolve(pkgDir, ".."));
|
|
66
|
-
options.nodeModulesDirs = [...new Set(options.nodeModulesDirs.map((dir) => resolve(options.rootDir, dir)))];
|
|
67
|
-
options.scanDirs.unshift(options.srcDir);
|
|
68
|
-
options.scanDirs = options.scanDirs.map((dir) => resolve(options.srcDir, dir));
|
|
69
|
-
options.scanDirs = [...new Set(options.scanDirs)];
|
|
70
|
-
options.appConfigFiles ??= [];
|
|
71
|
-
options.appConfigFiles = options.appConfigFiles.map((file) => _tryResolve(resolveSilgiPath(file, options))).filter(Boolean);
|
|
72
|
-
for (const dir of options.scanDirs) {
|
|
73
|
-
const configFile = _tryResolve("app.config", dir);
|
|
74
|
-
if (configFile && !options.appConfigFiles.includes(configFile)) options.appConfigFiles.push(configFile);
|
|
75
|
-
}
|
|
76
|
-
options.watchOptions.ignored ??= [];
|
|
77
|
-
options.watchOptions.ignoreInitial = true;
|
|
78
|
-
if (Array.isArray(options.watchOptions.ignored)) options.watchOptions.ignored.push(`!${join(options.silgi.serverDir, "config")}`, `${join(options.silgi.serverDir, "permission.ts")}`, `${join(options.silgi.serverDir, "core.ts")}`, `${join(options.silgi.serverDir, "meta.ts")}`, `${join(options.silgi.serverDir, "configs.ts")}`, `${join(options.silgi.serverDir, "vfs")}`, `${join(options.silgi.serverDir, "scan.ts")}`);
|
|
79
|
-
options.devServer.watch.push(join(options.serverDir, "services"), join(options.serverDir, "schemas"), join(options.serverDir, "shared"), join(options.serverDir, "utils"), join(options.serverDir, "types"), join(options.silgi.serverDir, "config"), join(options.silgi.serverDir, "modules"), join(options.rootDir, "silgi.config.ts"));
|
|
80
|
-
}
|
|
81
|
-
function _tryResolve(path, base = ".", extensions = [
|
|
82
|
-
"",
|
|
83
|
-
".js",
|
|
84
|
-
".ts",
|
|
85
|
-
".mjs",
|
|
86
|
-
".cjs",
|
|
87
|
-
".json"
|
|
88
|
-
]) {
|
|
89
|
-
path = resolve(base, path);
|
|
90
|
-
if (existsSync(path)) return path;
|
|
91
|
-
for (const ext of extensions) {
|
|
92
|
-
const p = path + ext;
|
|
93
|
-
if (existsSync(p)) return p;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
export { resolvePathOptions };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { resolve } from "pathe";
|
|
2
|
-
|
|
3
|
-
//#region src/cli/config/resolvers/storage.ts
|
|
4
|
-
async function resolveStorageOptions(options) {
|
|
5
|
-
const fsMounts = {
|
|
6
|
-
root: resolve(options.rootDir),
|
|
7
|
-
src: resolve(options.srcDir),
|
|
8
|
-
build: resolve(options.build.dir),
|
|
9
|
-
cache: resolve(options.build.dir, "cache")
|
|
10
|
-
};
|
|
11
|
-
for (const p in fsMounts) options.devStorage[p] = options.devStorage[p] || {
|
|
12
|
-
driver: "fs",
|
|
13
|
-
readOnly: p === "root" || p === "src",
|
|
14
|
-
base: fsMounts[p]
|
|
15
|
-
};
|
|
16
|
-
if (options.dev && options.storage.data === void 0 && options.devStorage.data === void 0) options.devStorage.data = {
|
|
17
|
-
driver: "fs",
|
|
18
|
-
base: resolve(options.rootDir, ".data/kv")
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
export { resolveStorageOptions };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { withLeadingSlash, withTrailingSlash } from "ufo";
|
|
2
|
-
|
|
3
|
-
//#region src/cli/config/resolvers/url.ts
|
|
4
|
-
async function resolveURLOptions(options) {
|
|
5
|
-
options.baseURL = withLeadingSlash(withTrailingSlash(options.baseURL));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { resolveURLOptions };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TSConfig } from "pkg-types";
|
|
2
|
-
import { SilgiCLI } from "silgi/types";
|
|
3
|
-
|
|
4
|
-
//#region src/cli/config/types.d.ts
|
|
5
|
-
|
|
6
|
-
// const EXTENSION_RE = /\b\.\w+$/g
|
|
7
|
-
// Exclude bridge alias types to support Volar
|
|
8
|
-
// const excludedAlias = [/^@vue\/.*$/, /^#internal\/nuxt/]
|
|
9
|
-
declare function silgiGenerateType(silgi: SilgiCLI): Promise<{
|
|
10
|
-
declarations: string[];
|
|
11
|
-
tsConfig: TSConfig;
|
|
12
|
-
}>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { silgiGenerateType as silgiGenerateType$1 };
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { dirname, isAbsolute, join, relative, resolve } from "pathe";
|
|
2
|
-
import { isPresents, relativeWithDot, resolveSilgiModule } from "silgi/kit";
|
|
3
|
-
import { existsSync, lstatSync, promises } from "node:fs";
|
|
4
|
-
import { readPackageJSON } from "pkg-types";
|
|
5
|
-
import { withTrailingSlash } from "ufo";
|
|
6
|
-
import { defu } from "defu";
|
|
7
|
-
|
|
8
|
-
//#region src/cli/config/types.ts
|
|
9
|
-
function getDirectory(p) {
|
|
10
|
-
try {
|
|
11
|
-
return isAbsolute(p) && lstatSync(p).isFile() ? dirname(p) : p;
|
|
12
|
-
} catch {}
|
|
13
|
-
return p;
|
|
14
|
-
}
|
|
15
|
-
function renderAttrs(obj) {
|
|
16
|
-
const attrs = [];
|
|
17
|
-
for (const key in obj) attrs.push(renderAttr(key, obj[key]));
|
|
18
|
-
return attrs.join(" ");
|
|
19
|
-
}
|
|
20
|
-
function renderAttr(key, value) {
|
|
21
|
-
return value ? `${key}="${value}"` : "";
|
|
22
|
-
}
|
|
23
|
-
async function silgiGenerateType(silgi) {
|
|
24
|
-
const rootDirWithSlash = withTrailingSlash(silgi.options.rootDir);
|
|
25
|
-
const tsConfigPath = resolve(silgi.options.rootDir, silgi.options.typescript.tsconfigPath);
|
|
26
|
-
const tsconfigDir = dirname(tsConfigPath);
|
|
27
|
-
const include = new Set([
|
|
28
|
-
relativeWithDot(tsconfigDir, join(silgi.options.build.typesDir, "silgi-config.d.ts")).replace(/^(?=[^.])/, "./"),
|
|
29
|
-
join(relativeWithDot(tsconfigDir, silgi.options.rootDir), "**/*"),
|
|
30
|
-
...silgi.options.srcDir === silgi.options.rootDir ? [] : [join(relativeWithDot(tsconfigDir, silgi.options.srcDir), "**/*")]
|
|
31
|
-
]);
|
|
32
|
-
const exclude = new Set([relativeWithDot(tsconfigDir, "node_modules"), relativeWithDot(tsconfigDir, "dist")]);
|
|
33
|
-
for (const dir of silgi.options.modulesDir) exclude.add(relativeWithDot(silgi.options.build.dir, dir));
|
|
34
|
-
const moduleEntryPaths = [];
|
|
35
|
-
for (const m of silgi.scanModules) if (m.entryPath) moduleEntryPaths.push(getDirectory(m.entryPath));
|
|
36
|
-
const modulePaths = await resolveSilgiModule(rootDirWithSlash, moduleEntryPaths);
|
|
37
|
-
for (const path of modulePaths) {
|
|
38
|
-
const relative$1 = relativeWithDot(tsconfigDir, path);
|
|
39
|
-
include.add(join(relative$1, "runtime"));
|
|
40
|
-
exclude.add(join(relative$1, "runtime/server"));
|
|
41
|
-
include.add(join(relative$1, "dist/runtime"));
|
|
42
|
-
exclude.add(join(relative$1, "dist/runtime/server"));
|
|
43
|
-
}
|
|
44
|
-
let tsConfig = silgi.options.typescript?.tsConfig || {};
|
|
45
|
-
const defaultConfig = defu(tsConfig, {
|
|
46
|
-
compilerOptions: {
|
|
47
|
-
esModuleInterop: true,
|
|
48
|
-
allowSyntheticDefaultImports: true,
|
|
49
|
-
skipLibCheck: true,
|
|
50
|
-
allowImportingTsExtensions: true,
|
|
51
|
-
target: "ESNext",
|
|
52
|
-
allowJs: true,
|
|
53
|
-
resolveJsonModule: true,
|
|
54
|
-
moduleDetection: "force",
|
|
55
|
-
isolatedModules: true,
|
|
56
|
-
verbatimModuleSyntax: true,
|
|
57
|
-
strict: true,
|
|
58
|
-
noUncheckedIndexedAccess: true,
|
|
59
|
-
noImplicitOverride: true,
|
|
60
|
-
forceConsistentCasingInFileNames: true,
|
|
61
|
-
noEmit: true,
|
|
62
|
-
module: "Preserve",
|
|
63
|
-
moduleResolution: "bundler",
|
|
64
|
-
useDefineForClassFields: true,
|
|
65
|
-
noImplicitThis: true,
|
|
66
|
-
jsx: "preserve",
|
|
67
|
-
customConditions: silgi.options.typescript.customConditions,
|
|
68
|
-
paths: {}
|
|
69
|
-
},
|
|
70
|
-
include: [...include],
|
|
71
|
-
exclude: [...exclude]
|
|
72
|
-
});
|
|
73
|
-
tsConfig = defaultConfig;
|
|
74
|
-
if (isPresents(["hono"])) tsConfig = defu(defaultConfig, { compilerOptions: {
|
|
75
|
-
jsx: "react-jsx",
|
|
76
|
-
jsxImportSource: "hono/jsx"
|
|
77
|
-
} });
|
|
78
|
-
if (isPresents(["npm-package"])) tsConfig = defu(tsConfig, {
|
|
79
|
-
compilerOptions: {
|
|
80
|
-
target: "es2022",
|
|
81
|
-
lib: [
|
|
82
|
-
"es2022",
|
|
83
|
-
"webworker",
|
|
84
|
-
"dom.iterable"
|
|
85
|
-
],
|
|
86
|
-
moduleDetection: "force",
|
|
87
|
-
module: "preserve",
|
|
88
|
-
paths: {},
|
|
89
|
-
resolveJsonModule: true,
|
|
90
|
-
allowJs: true,
|
|
91
|
-
strict: true,
|
|
92
|
-
noImplicitOverride: true,
|
|
93
|
-
noEmit: true,
|
|
94
|
-
allowSyntheticDefaultImports: true,
|
|
95
|
-
esModuleInterop: false,
|
|
96
|
-
forceConsistentCasingInFileNames: true,
|
|
97
|
-
isolatedModules: true,
|
|
98
|
-
verbatimModuleSyntax: true,
|
|
99
|
-
skipLibCheck: true
|
|
100
|
-
},
|
|
101
|
-
include: [...include],
|
|
102
|
-
exclude: [...exclude]
|
|
103
|
-
});
|
|
104
|
-
tsConfig.compilerOptions ||= {};
|
|
105
|
-
tsConfig.compilerOptions.paths ||= {};
|
|
106
|
-
tsConfig.include ||= [];
|
|
107
|
-
for (const alias in tsConfig.compilerOptions.paths) {
|
|
108
|
-
const paths = tsConfig.compilerOptions.paths[alias];
|
|
109
|
-
tsConfig.compilerOptions.paths[alias] = await Promise.all(paths.map(async (path) => {
|
|
110
|
-
if (!isAbsolute(path)) return path;
|
|
111
|
-
const stats = await promises.stat(path).catch(() => null);
|
|
112
|
-
return relativeWithDot(tsconfigDir, stats?.isFile() ? path.replace(/\b\.\w+$/g, "") : path);
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
const references = [];
|
|
116
|
-
await Promise.all([...silgi.options.modules, ...silgi.options._modules].map(async (id) => {
|
|
117
|
-
if (typeof id !== "string") return;
|
|
118
|
-
if (id === "./src" && silgi.options.preset === "npm-package") id = resolve(silgi.options.rootDir);
|
|
119
|
-
const pkg = await readPackageJSON(id, { url: silgi.options.rootDir }).catch(() => null);
|
|
120
|
-
references.push({ types: pkg?.name || id });
|
|
121
|
-
}));
|
|
122
|
-
const declarations = [];
|
|
123
|
-
await silgi.callHook("prepare:types", {
|
|
124
|
-
references,
|
|
125
|
-
declarations,
|
|
126
|
-
tsConfig
|
|
127
|
-
});
|
|
128
|
-
tsConfig.include = [...new Set(tsConfig.include.map((p) => isAbsolute(p) ? relativeWithDot(tsconfigDir, p) : p))];
|
|
129
|
-
tsConfig.exclude = [...new Set(tsConfig.exclude.map((p) => isAbsolute(p) ? relativeWithDot(tsconfigDir, p) : p))];
|
|
130
|
-
const _declarations = [
|
|
131
|
-
...references.map((ref) => {
|
|
132
|
-
if ("path" in ref && isAbsolute(ref.path)) ref.path = relative(silgi.options.build.dir, ref.path);
|
|
133
|
-
return `/// <reference ${renderAttrs(ref)} />`;
|
|
134
|
-
}),
|
|
135
|
-
...declarations,
|
|
136
|
-
"",
|
|
137
|
-
"export {}",
|
|
138
|
-
""
|
|
139
|
-
];
|
|
140
|
-
return {
|
|
141
|
-
declarations: _declarations,
|
|
142
|
-
tsConfig
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
//#endregion
|
|
147
|
-
export { silgiGenerateType };
|
package/dist/cli/core/apiful.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { consola as consola$1 } from "consola";
|
|
2
|
-
import { join, resolve } from "pathe";
|
|
3
|
-
import { hasSilgiModule, writeTemplate } from "silgi/kit";
|
|
4
|
-
import { generateDTS } from "apiful/openapi";
|
|
5
|
-
|
|
6
|
-
//#region src/cli/core/apiful.ts
|
|
7
|
-
async function generateApiFul(silgi) {
|
|
8
|
-
const config = silgi.options.apiFul;
|
|
9
|
-
if (!hasSilgiModule("openapi")) {
|
|
10
|
-
silgi.options.dev || silgi.logger.info("Silgi OpenAPI module not found, if you want to use it, please install it @silgi/openapi");
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (!config.services || hasSilgiModule("openapi")) {
|
|
14
|
-
config.services ??= {};
|
|
15
|
-
config.services.silgi = { schema: join(silgi.options.build.dir, "openapi.json") };
|
|
16
|
-
}
|
|
17
|
-
const resolvedOpenAPIServices = Object.fromEntries(Object.entries(config?.services ?? {}).filter(([, service]) => Boolean(service.schema)));
|
|
18
|
-
if (Object.keys(resolvedOpenAPIServices).length === 0) {
|
|
19
|
-
consola$1.info("No OpenAPI schemas found, skipping generation");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
for (const service of Object.values(resolvedOpenAPIServices)) if (typeof service.schema === "string" && !service.schema.startsWith("http")) service.schema = resolve(silgi.options.rootDir, service.schema);
|
|
23
|
-
const types = await generateDTS(resolvedOpenAPIServices);
|
|
24
|
-
silgi.hook("prepare:types", (opts) => {
|
|
25
|
-
opts.references.push({ path: "./apiful.d.ts" });
|
|
26
|
-
});
|
|
27
|
-
writeTemplate({
|
|
28
|
-
filename: "types/apiful.d.ts",
|
|
29
|
-
where: ".silgi",
|
|
30
|
-
write: true,
|
|
31
|
-
getContents: () => types
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { generateApiFul };
|