everything-dev 1.53.1 → 2.0.0-rc.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 +2 -11
- package/dist/_virtual/_rolldown/runtime.cjs +17 -2
- package/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/api/auth-middleware.cjs +161 -0
- package/dist/api/auth-middleware.cjs.map +1 -0
- package/dist/api/auth-middleware.d.cts +69 -0
- package/dist/api/auth-middleware.d.mts +69 -0
- package/dist/api/auth-middleware.mjs +160 -0
- package/dist/api/auth-middleware.mjs.map +1 -0
- package/dist/api-contract.cjs +250 -62
- package/dist/api-contract.cjs.map +1 -1
- package/dist/api-contract.mjs +246 -65
- package/dist/api-contract.mjs.map +1 -1
- package/dist/app.cjs +99 -26
- package/dist/app.cjs.map +1 -1
- package/dist/app.d.cts +3 -0
- package/dist/app.d.mts +3 -0
- package/dist/app.mjs +100 -27
- package/dist/app.mjs.map +1 -1
- package/dist/auth-login.cjs +163 -0
- package/dist/auth-login.cjs.map +1 -0
- package/dist/auth-login.mjs +162 -0
- package/dist/auth-login.mjs.map +1 -0
- package/dist/auth-session.cjs +64 -0
- package/dist/auth-session.cjs.map +1 -0
- package/dist/auth-session.mjs +58 -0
- package/dist/auth-session.mjs.map +1 -0
- package/dist/auth-types-gen.cjs +0 -1
- package/dist/auth-types-gen.cjs.map +1 -1
- package/dist/build.cjs +37 -173
- package/dist/build.cjs.map +1 -1
- package/dist/build.mjs +37 -171
- package/dist/build.mjs.map +1 -1
- package/dist/bundle-cache.cjs +74 -0
- package/dist/bundle-cache.cjs.map +1 -0
- package/dist/bundle-cache.d.cts +27 -0
- package/dist/bundle-cache.d.mts +27 -0
- package/dist/bundle-cache.mjs +68 -0
- package/dist/bundle-cache.mjs.map +1 -0
- package/dist/bundle-fs-resolve.cjs +209 -0
- package/dist/bundle-fs-resolve.cjs.map +1 -0
- package/dist/bundle-fs-resolve.d.cts +76 -0
- package/dist/bundle-fs-resolve.d.mts +76 -0
- package/dist/bundle-fs-resolve.mjs +202 -0
- package/dist/bundle-fs-resolve.mjs.map +1 -0
- package/dist/cdn-deploy.cjs +126 -0
- package/dist/cdn-deploy.cjs.map +1 -0
- package/dist/cdn-deploy.mjs +124 -0
- package/dist/cdn-deploy.mjs.map +1 -0
- package/dist/cli/db-doctor.cjs +19 -19
- package/dist/cli/db-doctor.cjs.map +1 -1
- package/dist/cli/db-doctor.mjs +18 -18
- package/dist/cli/db-doctor.mjs.map +1 -1
- package/dist/cli/db-repair.cjs +9 -32
- package/dist/cli/db-repair.cjs.map +1 -1
- package/dist/cli/db-repair.mjs +9 -32
- package/dist/cli/db-repair.mjs.map +1 -1
- package/dist/cli/framework-version.cjs +7 -3
- package/dist/cli/framework-version.cjs.map +1 -1
- package/dist/cli/framework-version.mjs +7 -3
- package/dist/cli/framework-version.mjs.map +1 -1
- package/dist/cli/infra.cjs +159 -251
- package/dist/cli/infra.cjs.map +1 -1
- package/dist/cli/infra.mjs +154 -242
- package/dist/cli/infra.mjs.map +1 -1
- package/dist/cli/init.cjs +624 -196
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +61 -8
- package/dist/cli/init.d.mts +61 -8
- package/dist/cli/init.mjs +613 -194
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/parse.cjs +8 -7
- package/dist/cli/parse.cjs.map +1 -1
- package/dist/cli/parse.mjs +9 -7
- package/dist/cli/parse.mjs.map +1 -1
- package/dist/cli/prompts.cjs +14 -1
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +14 -1
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/prune.cjs +220 -0
- package/dist/cli/prune.cjs.map +1 -0
- package/dist/cli/prune.mjs +220 -0
- package/dist/cli/prune.mjs.map +1 -0
- package/dist/cli/snapshot.cjs +2 -1
- package/dist/cli/snapshot.cjs.map +1 -1
- package/dist/cli/snapshot.mjs +2 -1
- package/dist/cli/snapshot.mjs.map +1 -1
- package/dist/cli/status.cjs +5 -4
- package/dist/cli/status.cjs.map +1 -1
- package/dist/cli/status.mjs +6 -5
- package/dist/cli/status.mjs.map +1 -1
- package/dist/cli/sync.cjs +156 -58
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +158 -63
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/timing.cjs +0 -1
- package/dist/cli/timing.cjs.map +1 -1
- package/dist/cli/upgrade.cjs +95 -69
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +97 -72
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli/utils/helpers.cjs.map +1 -1
- package/dist/cli.cjs +320 -72
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +316 -68
- package/dist/cli.mjs.map +1 -1
- package/dist/code-artifacts.cjs +76 -8
- package/dist/code-artifacts.cjs.map +1 -1
- package/dist/code-artifacts.mjs +76 -10
- package/dist/code-artifacts.mjs.map +1 -1
- package/dist/commands/build.cjs +65 -0
- package/dist/commands/build.cjs.map +1 -0
- package/dist/commands/build.mjs +65 -0
- package/dist/commands/build.mjs.map +1 -0
- package/dist/commands/config.cjs +77 -0
- package/dist/commands/config.cjs.map +1 -0
- package/dist/commands/config.d.cts +8 -0
- package/dist/commands/config.d.mts +8 -0
- package/dist/commands/config.mjs +74 -0
- package/dist/commands/config.mjs.map +1 -0
- package/dist/commands/db.cjs +107 -0
- package/dist/commands/db.cjs.map +1 -0
- package/dist/commands/db.mjs +107 -0
- package/dist/commands/db.mjs.map +1 -0
- package/dist/commands/deploy.cjs +336 -0
- package/dist/commands/deploy.cjs.map +1 -0
- package/dist/commands/deploy.mjs +334 -0
- package/dist/commands/deploy.mjs.map +1 -0
- package/dist/commands/dev.cjs +75 -0
- package/dist/commands/dev.cjs.map +1 -0
- package/dist/commands/dev.mjs +73 -0
- package/dist/commands/dev.mjs.map +1 -0
- package/dist/commands/init.cjs +234 -0
- package/dist/commands/init.cjs.map +1 -0
- package/dist/commands/init.mjs +231 -0
- package/dist/commands/init.mjs.map +1 -0
- package/dist/commands/keys.cjs +255 -0
- package/dist/commands/keys.cjs.map +1 -0
- package/dist/commands/keys.mjs +253 -0
- package/dist/commands/keys.mjs.map +1 -0
- package/dist/commands/ops.cjs +199 -0
- package/dist/commands/ops.cjs.map +1 -0
- package/dist/commands/ops.mjs +197 -0
- package/dist/commands/ops.mjs.map +1 -0
- package/dist/commands/plugins.cjs +211 -0
- package/dist/commands/plugins.cjs.map +1 -0
- package/dist/commands/plugins.mjs +211 -0
- package/dist/commands/plugins.mjs.map +1 -0
- package/dist/commands/shared.cjs +8 -0
- package/dist/commands/shared.cjs.map +1 -0
- package/dist/commands/shared.d.cts +6 -0
- package/dist/commands/shared.d.mts +6 -0
- package/dist/commands/shared.mjs +8 -0
- package/dist/commands/shared.mjs.map +1 -0
- package/dist/commands/upgrade.cjs +325 -0
- package/dist/commands/upgrade.cjs.map +1 -0
- package/dist/commands/upgrade.mjs +323 -0
- package/dist/commands/upgrade.mjs.map +1 -0
- package/dist/components/dev-render.cjs +340 -0
- package/dist/components/dev-render.cjs.map +1 -0
- package/dist/components/dev-render.mjs +332 -0
- package/dist/components/dev-render.mjs.map +1 -0
- package/dist/config.cjs +460 -221
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +491 -48
- package/dist/config.d.mts +491 -48
- package/dist/config.mjs +439 -212
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +327 -50
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +1951 -1062
- package/dist/contract.d.mts +1951 -1062
- package/dist/contract.meta.cjs +107 -12
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +166 -8
- package/dist/contract.meta.d.mts +166 -8
- package/dist/contract.meta.mjs +107 -11
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +580 -327
- package/dist/contract.mjs.map +1 -1
- package/dist/dag.cjs +5 -3
- package/dist/dag.cjs.map +1 -1
- package/dist/dag.mjs +6 -3
- package/dist/dag.mjs.map +1 -1
- package/dist/db/binding.cjs +80 -0
- package/dist/db/binding.cjs.map +1 -0
- package/dist/db/binding.d.cts +39 -0
- package/dist/db/binding.d.mts +39 -0
- package/dist/db/binding.mjs +78 -0
- package/dist/db/binding.mjs.map +1 -0
- package/dist/db/bindings.cjs +78 -0
- package/dist/db/bindings.cjs.map +1 -0
- package/dist/db/bindings.d.cts +34 -0
- package/dist/db/bindings.d.mts +34 -0
- package/dist/db/bindings.mjs +76 -0
- package/dist/db/bindings.mjs.map +1 -0
- package/dist/db/core.cjs +204 -0
- package/dist/db/core.cjs.map +1 -0
- package/dist/db/core.d.cts +69 -0
- package/dist/db/core.d.mts +69 -0
- package/dist/db/core.mjs +192 -0
- package/dist/db/core.mjs.map +1 -0
- package/dist/db/driver.cjs +167 -0
- package/dist/db/driver.cjs.map +1 -0
- package/dist/db/driver.d.cts +50 -0
- package/dist/db/driver.d.mts +50 -0
- package/dist/db/driver.mjs +165 -0
- package/dist/db/driver.mjs.map +1 -0
- package/dist/db/drizzle-kit.cjs +177 -0
- package/dist/db/drizzle-kit.cjs.map +1 -0
- package/dist/db/drizzle-kit.d.cts +25 -0
- package/dist/db/drizzle-kit.d.mts +25 -0
- package/dist/db/drizzle-kit.mjs +175 -0
- package/dist/db/drizzle-kit.mjs.map +1 -0
- package/dist/db/errors.cjs +27 -0
- package/dist/db/errors.cjs.map +1 -0
- package/dist/db/errors.d.cts +16 -0
- package/dist/db/errors.d.mts +16 -0
- package/dist/db/errors.mjs +26 -0
- package/dist/db/errors.mjs.map +1 -0
- package/dist/db/identity.cjs +55 -0
- package/dist/db/identity.cjs.map +1 -0
- package/dist/db/identity.d.cts +40 -0
- package/dist/db/identity.d.mts +40 -0
- package/dist/db/identity.mjs +53 -0
- package/dist/db/identity.mjs.map +1 -0
- package/dist/db/index.cjs +43 -0
- package/dist/db/index.d.cts +9 -0
- package/dist/db/index.d.mts +9 -0
- package/dist/db/index.mjs +10 -0
- package/dist/db/run-migrations.cjs +343 -0
- package/dist/db/run-migrations.cjs.map +1 -0
- package/dist/db/run-migrations.d.cts +87 -0
- package/dist/db/run-migrations.d.mts +87 -0
- package/dist/db/run-migrations.mjs +341 -0
- package/dist/db/run-migrations.mjs.map +1 -0
- package/dist/delegate-signer.cjs +85 -0
- package/dist/delegate-signer.cjs.map +1 -0
- package/dist/delegate-signer.mjs +84 -0
- package/dist/delegate-signer.mjs.map +1 -0
- package/dist/deploy-diff.cjs +119 -0
- package/dist/deploy-diff.cjs.map +1 -0
- package/dist/deploy-diff.mjs +109 -0
- package/dist/deploy-diff.mjs.map +1 -0
- package/dist/descriptor/constructors.cjs +49 -0
- package/dist/descriptor/constructors.cjs.map +1 -0
- package/dist/descriptor/constructors.d.cts +27 -0
- package/dist/descriptor/constructors.d.mts +27 -0
- package/dist/descriptor/constructors.mjs +45 -0
- package/dist/descriptor/constructors.mjs.map +1 -0
- package/dist/descriptor/index.cjs +24 -0
- package/dist/descriptor/index.d.cts +5 -0
- package/dist/descriptor/index.d.mts +5 -0
- package/dist/descriptor/index.mjs +6 -0
- package/dist/descriptor/resolve.cjs +258 -0
- package/dist/descriptor/resolve.cjs.map +1 -0
- package/dist/descriptor/resolve.d.cts +50 -0
- package/dist/descriptor/resolve.d.mts +50 -0
- package/dist/descriptor/resolve.mjs +252 -0
- package/dist/descriptor/resolve.mjs.map +1 -0
- package/dist/descriptor/schema.cjs +109 -0
- package/dist/descriptor/schema.cjs.map +1 -0
- package/dist/descriptor/schema.d.cts +217 -0
- package/dist/descriptor/schema.d.mts +217 -0
- package/dist/descriptor/schema.mjs +102 -0
- package/dist/descriptor/schema.mjs.map +1 -0
- package/dist/descriptor/serialize.cjs +45 -0
- package/dist/descriptor/serialize.cjs.map +1 -0
- package/dist/descriptor/serialize.d.cts +7 -0
- package/dist/descriptor/serialize.d.mts +7 -0
- package/dist/descriptor/serialize.mjs +45 -0
- package/dist/descriptor/serialize.mjs.map +1 -0
- package/dist/dev-log-pipeline.cjs +273 -0
- package/dist/dev-log-pipeline.cjs.map +1 -0
- package/dist/dev-log-pipeline.mjs +267 -0
- package/dist/dev-log-pipeline.mjs.map +1 -0
- package/dist/dev-logs.cjs +39 -8
- package/dist/dev-logs.cjs.map +1 -1
- package/dist/dev-logs.mjs +37 -9
- package/dist/dev-logs.mjs.map +1 -1
- package/dist/dev-program.cjs +405 -0
- package/dist/dev-program.cjs.map +1 -0
- package/dist/dev-program.d.cts +10 -0
- package/dist/dev-program.d.mts +10 -0
- package/dist/dev-program.mjs +395 -0
- package/dist/dev-program.mjs.map +1 -0
- package/dist/dev-session-data.d.cts +27 -0
- package/dist/dev-session-data.d.mts +27 -0
- package/dist/dev-session.cjs +178 -105
- package/dist/dev-session.cjs.map +1 -1
- package/dist/dev-session.mjs +180 -105
- package/dist/dev-session.mjs.map +1 -1
- package/dist/env/process-env.cjs +16 -0
- package/dist/env/process-env.cjs.map +1 -0
- package/dist/env/process-env.mjs +13 -0
- package/dist/env/process-env.mjs.map +1 -0
- package/dist/env/project-env.cjs +144 -0
- package/dist/env/project-env.cjs.map +1 -0
- package/dist/env/project-env.d.cts +1 -0
- package/dist/env/project-env.d.mts +1 -0
- package/dist/env/project-env.mjs +132 -0
- package/dist/env/project-env.mjs.map +1 -0
- package/dist/fastkv.cjs +59 -12
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.d.cts +42 -6
- package/dist/fastkv.d.mts +42 -6
- package/dist/fastkv.mjs +58 -13
- package/dist/fastkv.mjs.map +1 -1
- package/dist/fingerprint.cjs +57 -0
- package/dist/fingerprint.cjs.map +1 -0
- package/dist/fingerprint.d.cts +14 -0
- package/dist/fingerprint.d.mts +14 -0
- package/dist/fingerprint.mjs +55 -0
- package/dist/fingerprint.mjs.map +1 -0
- package/dist/http-client.cjs +17 -17
- package/dist/http-client.cjs.map +1 -1
- package/dist/http-client.mjs +17 -17
- package/dist/http-client.mjs.map +1 -1
- package/dist/image-deploy.cjs +186 -0
- package/dist/image-deploy.cjs.map +1 -0
- package/dist/image-deploy.mjs +182 -0
- package/dist/image-deploy.mjs.map +1 -0
- package/dist/index.cjs +66 -18
- package/dist/index.d.cts +8 -7
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +6 -5
- package/dist/infra/docker.cjs +77 -0
- package/dist/infra/docker.cjs.map +1 -0
- package/dist/infra/docker.d.cts +10 -0
- package/dist/infra/docker.d.mts +10 -0
- package/dist/infra/docker.mjs +69 -0
- package/dist/infra/docker.mjs.map +1 -0
- package/dist/infra/materializer.cjs +74 -0
- package/dist/infra/materializer.cjs.map +1 -0
- package/dist/infra/materializer.mjs +70 -0
- package/dist/infra/materializer.mjs.map +1 -0
- package/dist/infra/planner.cjs +135 -103
- package/dist/infra/planner.cjs.map +1 -1
- package/dist/infra/planner.mjs +137 -104
- package/dist/infra/planner.mjs.map +1 -1
- package/dist/infra/port-ownership.cjs +57 -0
- package/dist/infra/port-ownership.cjs.map +1 -0
- package/dist/infra/port-ownership.mjs +57 -0
- package/dist/infra/port-ownership.mjs.map +1 -0
- package/dist/infra/preflight.cjs +45 -33
- package/dist/infra/preflight.cjs.map +1 -1
- package/dist/infra/preflight.d.cts +1 -0
- package/dist/infra/preflight.d.mts +1 -0
- package/dist/infra/preflight.mjs +46 -34
- package/dist/infra/preflight.mjs.map +1 -1
- package/dist/infra/types.cjs.map +1 -1
- package/dist/infra/types.d.cts +2 -0
- package/dist/infra/types.d.mts +2 -0
- package/dist/infra/types.mjs.map +1 -1
- package/dist/integrity.cjs +50 -61
- package/dist/integrity.cjs.map +1 -1
- package/dist/integrity.d.cts +16 -10
- package/dist/integrity.d.mts +16 -10
- package/dist/integrity.mjs +50 -59
- package/dist/integrity.mjs.map +1 -1
- package/dist/internal/manifest-normalizer.cjs +8 -2
- package/dist/internal/manifest-normalizer.cjs.map +1 -1
- package/dist/internal/manifest-normalizer.mjs +9 -3
- package/dist/internal/manifest-normalizer.mjs.map +1 -1
- package/dist/merge.cjs +19 -1
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.d.cts +1 -1
- package/dist/merge.d.mts +1 -1
- package/dist/merge.mjs +19 -2
- package/dist/merge.mjs.map +1 -1
- package/dist/mf.cjs +190 -3
- package/dist/mf.cjs.map +1 -1
- package/dist/mf.d.cts +24 -2
- package/dist/mf.d.mts +24 -2
- package/dist/mf.mjs +189 -4
- package/dist/mf.mjs.map +1 -1
- package/dist/near-cli.cjs +59 -91
- package/dist/near-cli.cjs.map +1 -1
- package/dist/near-cli.mjs +58 -90
- package/dist/near-cli.mjs.map +1 -1
- package/dist/near-signer.cjs +73 -0
- package/dist/near-signer.cjs.map +1 -0
- package/dist/near-signer.mjs +70 -0
- package/dist/near-signer.mjs.map +1 -0
- package/dist/network.cjs +0 -1
- package/dist/network.cjs.map +1 -1
- package/dist/orchestrator.cjs +256 -87
- package/dist/orchestrator.cjs.map +1 -1
- package/dist/orchestrator.mjs +248 -87
- package/dist/orchestrator.mjs.map +1 -1
- package/dist/platform-deploy.cjs +81 -0
- package/dist/platform-deploy.cjs.map +1 -0
- package/dist/platform-deploy.mjs +80 -0
- package/dist/platform-deploy.mjs.map +1 -0
- package/dist/plugin.cjs +54 -1389
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +6 -896
- package/dist/plugin.d.mts +6 -896
- package/dist/plugin.mjs +53 -1387
- package/dist/plugin.mjs.map +1 -1
- package/dist/process-kill.cjs +44 -0
- package/dist/process-kill.cjs.map +1 -0
- package/dist/process-kill.mjs +43 -0
- package/dist/process-kill.mjs.map +1 -0
- package/dist/process-registry.cjs +64 -9
- package/dist/process-registry.cjs.map +1 -1
- package/dist/process-registry.mjs +61 -10
- package/dist/process-registry.mjs.map +1 -1
- package/dist/progress.cjs +45 -0
- package/dist/progress.cjs.map +1 -0
- package/dist/progress.d.cts +13 -0
- package/dist/progress.d.mts +13 -0
- package/dist/progress.mjs +42 -0
- package/dist/progress.mjs.map +1 -0
- package/dist/publish.cjs +513 -79
- package/dist/publish.cjs.map +1 -1
- package/dist/publish.mjs +515 -82
- package/dist/publish.mjs.map +1 -1
- package/dist/registry-use.cjs +41 -0
- package/dist/registry-use.cjs.map +1 -0
- package/dist/registry-use.mjs +40 -0
- package/dist/registry-use.mjs.map +1 -0
- package/dist/resolution/session.cjs +335 -0
- package/dist/resolution/session.cjs.map +1 -0
- package/dist/resolution/session.d.cts +105 -0
- package/dist/resolution/session.d.mts +105 -0
- package/dist/resolution/session.mjs +331 -0
- package/dist/resolution/session.mjs.map +1 -0
- package/dist/rollback.cjs +131 -0
- package/dist/rollback.cjs.map +1 -0
- package/dist/rollback.mjs +128 -0
- package/dist/rollback.mjs.map +1 -0
- package/dist/sdk.cjs +7 -7
- package/dist/sdk.d.cts +3 -3
- package/dist/sdk.d.mts +3 -3
- package/dist/sdk.mjs +2 -2
- package/dist/service-descriptor.cjs +67 -34
- package/dist/service-descriptor.cjs.map +1 -1
- package/dist/service-descriptor.d.cts +4 -1
- package/dist/service-descriptor.d.mts +3 -0
- package/dist/service-descriptor.mjs +63 -35
- package/dist/service-descriptor.mjs.map +1 -1
- package/dist/shared-deps.cjs +17 -16
- package/dist/shared-deps.cjs.map +1 -1
- package/dist/shared-deps.mjs +17 -16
- package/dist/shared-deps.mjs.map +1 -1
- package/dist/start-config-source.cjs +24 -0
- package/dist/start-config-source.cjs.map +1 -0
- package/dist/start-config-source.d.cts +29 -0
- package/dist/start-config-source.d.mts +29 -0
- package/dist/start-config-source.mjs +22 -0
- package/dist/start-config-source.mjs.map +1 -0
- package/dist/storage-upload.cjs +145 -0
- package/dist/storage-upload.cjs.map +1 -0
- package/dist/storage-upload.mjs +143 -0
- package/dist/storage-upload.mjs.map +1 -0
- package/dist/types.cjs +126 -20
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +867 -585
- package/dist/types.d.mts +867 -585
- package/dist/types.mjs +307 -208
- package/dist/types.mjs.map +1 -1
- package/dist/ui/api.cjs +105 -0
- package/dist/ui/api.cjs.map +1 -0
- package/dist/ui/api.d.cts +31 -0
- package/dist/ui/api.d.mts +31 -0
- package/dist/ui/api.mjs +99 -0
- package/dist/ui/api.mjs.map +1 -0
- package/dist/ui/auth-guards.cjs +50 -0
- package/dist/ui/auth-guards.cjs.map +1 -0
- package/dist/ui/auth-guards.d.cts +39 -0
- package/dist/ui/auth-guards.d.mts +39 -0
- package/dist/ui/auth-guards.mjs +48 -0
- package/dist/ui/auth-guards.mjs.map +1 -0
- package/dist/ui/auth.cjs +197 -0
- package/dist/ui/auth.cjs.map +1 -0
- package/dist/ui/auth.d.cts +56 -0
- package/dist/ui/auth.d.mts +56 -0
- package/dist/ui/auth.mjs +179 -0
- package/dist/ui/auth.mjs.map +1 -0
- package/dist/ui/entry.cjs +16 -0
- package/dist/ui/entry.cjs.map +1 -0
- package/dist/ui/entry.d.cts +12 -0
- package/dist/ui/entry.d.mts +12 -0
- package/dist/ui/entry.mjs +15 -0
- package/dist/ui/entry.mjs.map +1 -0
- package/dist/ui/head.cjs +14 -7
- package/dist/ui/head.cjs.map +1 -1
- package/dist/ui/head.mjs +15 -7
- package/dist/ui/head.mjs.map +1 -1
- package/dist/ui/hydrate.cjs +265 -0
- package/dist/ui/hydrate.cjs.map +1 -0
- package/dist/ui/hydrate.d.cts +48 -0
- package/dist/ui/hydrate.d.mts +48 -0
- package/dist/ui/hydrate.mjs +263 -0
- package/dist/ui/hydrate.mjs.map +1 -0
- package/dist/ui/i18n.cjs +153 -0
- package/dist/ui/i18n.cjs.map +1 -0
- package/dist/ui/i18n.d.cts +29 -0
- package/dist/ui/i18n.d.mts +29 -0
- package/dist/ui/i18n.mjs +140 -0
- package/dist/ui/i18n.mjs.map +1 -0
- package/dist/ui/index.cjs +19 -1
- package/dist/ui/index.d.cts +6 -3
- package/dist/ui/index.d.mts +6 -3
- package/dist/ui/index.mjs +5 -2
- package/dist/ui/locale.cjs +53 -0
- package/dist/ui/locale.cjs.map +1 -0
- package/dist/ui/locale.d.cts +18 -0
- package/dist/ui/locale.d.mts +18 -0
- package/dist/ui/locale.mjs +49 -0
- package/dist/ui/locale.mjs.map +1 -0
- package/dist/ui/manifest/index.cjs +25 -0
- package/dist/ui/manifest/index.cjs.map +1 -0
- package/dist/ui/manifest/index.d.cts +9 -0
- package/dist/ui/manifest/index.d.mts +9 -0
- package/dist/ui/manifest/index.mjs +13 -0
- package/dist/ui/manifest/index.mjs.map +1 -0
- package/dist/ui/manifest-generator.cjs +8 -0
- package/dist/ui/manifest-generator.d.cts +1 -0
- package/dist/ui/manifest-generator.d.mts +1 -0
- package/dist/ui/manifest-generator.mjs +3 -0
- package/dist/ui/message-catalogs.cjs +8 -0
- package/dist/ui/message-catalogs.cjs.map +1 -0
- package/dist/ui/message-catalogs.d.cts +5 -0
- package/dist/ui/message-catalogs.d.mts +5 -0
- package/dist/ui/message-catalogs.mjs +8 -0
- package/dist/ui/message-catalogs.mjs.map +1 -0
- package/dist/ui/metadata.cjs +0 -1
- package/dist/ui/metadata.cjs.map +1 -1
- package/dist/ui/metadata.d.cts +1 -1
- package/dist/ui/metadata.d.mts +1 -1
- package/dist/ui/plugin-path.cjs +37 -0
- package/dist/ui/plugin-path.cjs.map +1 -0
- package/dist/ui/plugin-path.d.cts +25 -0
- package/dist/ui/plugin-path.d.mts +25 -0
- package/dist/ui/plugin-path.mjs +35 -0
- package/dist/ui/plugin-path.mjs.map +1 -0
- package/dist/ui/router-client.cjs +61 -0
- package/dist/ui/router-client.cjs.map +1 -0
- package/dist/ui/router-client.d.cts +20 -0
- package/dist/ui/router-client.d.mts +20 -0
- package/dist/ui/router-client.mjs +60 -0
- package/dist/ui/router-client.mjs.map +1 -0
- package/dist/ui/router-defaults.cjs +48 -0
- package/dist/ui/router-defaults.cjs.map +1 -0
- package/dist/ui/router-defaults.d.cts +8 -0
- package/dist/ui/router-defaults.d.mts +8 -0
- package/dist/ui/router-defaults.mjs +45 -0
- package/dist/ui/router-defaults.mjs.map +1 -0
- package/dist/ui/router-error.cjs +70 -0
- package/dist/ui/router-error.cjs.map +1 -0
- package/dist/ui/router-error.d.cts +19 -0
- package/dist/ui/router-error.d.mts +19 -0
- package/dist/ui/router-error.mjs +69 -0
- package/dist/ui/router-error.mjs.map +1 -0
- package/dist/ui/router-server.cjs +153 -0
- package/dist/ui/router-server.cjs.map +1 -0
- package/dist/ui/router-server.d.cts +38 -0
- package/dist/ui/router-server.d.mts +38 -0
- package/dist/ui/router-server.mjs +152 -0
- package/dist/ui/router-server.mjs.map +1 -0
- package/dist/ui/router.cjs +4 -16
- package/dist/ui/router.cjs.map +1 -1
- package/dist/ui/router.mjs +4 -15
- package/dist/ui/router.mjs.map +1 -1
- package/dist/ui/runtime.cjs +5 -1
- package/dist/ui/runtime.cjs.map +1 -1
- package/dist/ui/runtime.d.cts +2 -1
- package/dist/ui/runtime.d.mts +2 -1
- package/dist/ui/runtime.mjs +5 -1
- package/dist/ui/runtime.mjs.map +1 -1
- package/dist/ui/slot.cjs +34 -0
- package/dist/ui/slot.cjs.map +1 -0
- package/dist/ui/slot.d.cts +43 -0
- package/dist/ui/slot.d.mts +43 -0
- package/dist/ui/slot.mjs +34 -0
- package/dist/ui/slot.mjs.map +1 -0
- package/dist/ui/tenant.cjs +300 -0
- package/dist/ui/tenant.cjs.map +1 -0
- package/dist/ui/tenant.d.cts +122 -0
- package/dist/ui/tenant.d.mts +122 -0
- package/dist/ui/tenant.mjs +279 -0
- package/dist/ui/tenant.mjs.map +1 -0
- package/dist/ui/types.d.cts +32 -2
- package/dist/ui/types.d.mts +32 -2
- package/dist/ui/version-check.cjs +47 -0
- package/dist/ui/version-check.cjs.map +1 -0
- package/dist/ui/version-check.d.cts +23 -0
- package/dist/ui/version-check.d.mts +23 -0
- package/dist/ui/version-check.mjs +46 -0
- package/dist/ui/version-check.mjs.map +1 -0
- package/dist/utils/banner.cjs +2 -2
- package/dist/utils/banner.cjs.map +1 -1
- package/dist/utils/banner.mjs +2 -2
- package/dist/utils/banner.mjs.map +1 -1
- package/dist/utils/linkify.cjs +1 -1
- package/dist/utils/linkify.cjs.map +1 -1
- package/dist/utils/linkify.mjs +1 -0
- package/dist/utils/linkify.mjs.map +1 -1
- package/dist/utils/run.cjs +6 -6
- package/dist/utils/run.cjs.map +1 -1
- package/dist/utils/run.mjs +6 -6
- package/dist/utils/run.mjs.map +1 -1
- package/dist/utils/save-config.cjs +12 -0
- package/dist/utils/save-config.cjs.map +1 -1
- package/dist/utils/save-config.mjs +12 -0
- package/dist/utils/save-config.mjs.map +1 -1
- package/dist/utils/snapshot-hash.cjs +10 -0
- package/dist/utils/snapshot-hash.cjs.map +1 -0
- package/dist/utils/snapshot-hash.mjs +10 -0
- package/dist/utils/snapshot-hash.mjs.map +1 -0
- package/dist/utils/string.cjs +0 -1
- package/dist/utils/string.cjs.map +1 -1
- package/dist/utils/theme.cjs +30 -12
- package/dist/utils/theme.cjs.map +1 -1
- package/dist/utils/theme.mjs +30 -11
- package/dist/utils/theme.mjs.map +1 -1
- package/dist/version-manifest-deploy.cjs +50 -0
- package/dist/version-manifest-deploy.cjs.map +1 -0
- package/dist/version-manifest-deploy.mjs +49 -0
- package/dist/version-manifest-deploy.mjs.map +1 -0
- package/dist/version-manifest-resolve.cjs +42 -0
- package/dist/version-manifest-resolve.cjs.map +1 -0
- package/dist/version-manifest-resolve.d.cts +38 -0
- package/dist/version-manifest-resolve.d.mts +38 -0
- package/dist/version-manifest-resolve.mjs +40 -0
- package/dist/version-manifest-resolve.mjs.map +1 -0
- package/dist/version-status.cjs +18 -0
- package/dist/version-status.cjs.map +1 -0
- package/dist/version-status.d.cts +22 -0
- package/dist/version-status.d.mts +22 -0
- package/dist/version-status.mjs +17 -0
- package/dist/version-status.mjs.map +1 -0
- package/dist/workspace-catalog.cjs +53 -0
- package/dist/workspace-catalog.cjs.map +1 -0
- package/dist/workspace-catalog.mjs +51 -0
- package/dist/workspace-catalog.mjs.map +1 -0
- package/dist/workspace.cjs +237 -0
- package/dist/workspace.cjs.map +1 -0
- package/dist/workspace.mjs +233 -0
- package/dist/workspace.mjs.map +1 -0
- package/package.json +179 -27
- package/skills/add-a-route/SKILL.md +132 -0
- package/skills/api-and-auth/SKILL.md +87 -21
- package/skills/api-and-auth/references/middleware.md +1 -1
- package/skills/cli-reference/SKILL.md +48 -21
- package/skills/code-style/SKILL.md +8 -0
- package/skills/dev-workflow/SKILL.md +50 -26
- package/skills/extends-config/SKILL.md +31 -19
- package/skills/init-upgrade/SKILL.md +29 -16
- package/skills/plugin-development/SKILL.md +46 -112
- package/skills/plugin-development/references/database.md +82 -0
- package/skills/plugin-development/references/request-context.md +67 -0
- package/skills/publish-sync/SKILL.md +99 -22
- package/skills/registry/SKILL.md +82 -0
- package/skills/super-app/SKILL.md +25 -15
- package/skills/talk-to-the-app/SKILL.md +138 -0
- package/skills/ui-integration/SKILL.md +93 -11
- package/dist/cli/db-studio.cjs +0 -131
- package/dist/cli/db-studio.cjs.map +0 -1
- package/dist/cli/db-studio.mjs +0 -127
- package/dist/cli/db-studio.mjs.map +0 -1
- package/dist/cli/init.d.cts.map +0 -1
- package/dist/cli/init.d.mts.map +0 -1
- package/dist/components/dev-view.cjs +0 -309
- package/dist/components/dev-view.cjs.map +0 -1
- package/dist/components/dev-view.mjs +0 -309
- package/dist/components/dev-view.mjs.map +0 -1
- package/dist/components/streaming-view.cjs +0 -134
- package/dist/components/streaming-view.cjs.map +0 -1
- package/dist/components/streaming-view.mjs +0 -132
- package/dist/components/streaming-view.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/contract.d.cts.map +0 -1
- package/dist/contract.d.mts.map +0 -1
- package/dist/contract.meta.d.cts.map +0 -1
- package/dist/contract.meta.d.mts.map +0 -1
- package/dist/dag.d.cts.map +0 -1
- package/dist/dag.d.mts.map +0 -1
- package/dist/db.cjs +0 -81
- package/dist/db.cjs.map +0 -1
- package/dist/db.d.cts +0 -30
- package/dist/db.d.cts.map +0 -1
- package/dist/db.d.mts +0 -30
- package/dist/db.d.mts.map +0 -1
- package/dist/db.mjs +0 -75
- package/dist/db.mjs.map +0 -1
- package/dist/fastkv.d.cts.map +0 -1
- package/dist/fastkv.d.mts.map +0 -1
- package/dist/integrity.d.cts.map +0 -1
- package/dist/integrity.d.mts.map +0 -1
- package/dist/merge.d.cts.map +0 -1
- package/dist/merge.d.mts.map +0 -1
- package/dist/mf.d.cts.map +0 -1
- package/dist/mf.d.mts.map +0 -1
- package/dist/plugin.d.cts.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/service-descriptor.d.cts.map +0 -1
- package/dist/service-descriptor.d.mts.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/ui/head.d.cts.map +0 -1
- package/dist/ui/head.d.mts.map +0 -1
- package/dist/ui/metadata.d.cts.map +0 -1
- package/dist/ui/metadata.d.mts.map +0 -1
- package/dist/ui/router.d.cts.map +0 -1
- package/dist/ui/router.d.mts.map +0 -1
- package/dist/ui/runtime.d.cts.map +0 -1
- package/dist/ui/runtime.d.mts.map +0 -1
- package/dist/ui/types.d.cts.map +0 -1
- package/dist/ui/types.d.mts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.cjs","names":["Context","BosDepsTag","MISSING_CONFIG_MESSAGE","saveBosConfig","generateCodeArtifacts","existsSync","join","publishToFastKv","openResolution","fetchRemotePluginManifest","basename","getPluginRef"],"sources":["../../src/commands/plugins.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport { Context } from \"effect\";\nimport { getPluginRef } from \"../build\";\nimport { generateCodeArtifacts } from \"../code-artifacts\";\nimport { MISSING_CONFIG_MESSAGE } from \"../config\";\nimport type { PluginListResult } from \"../contract\";\nimport { fetchRemotePluginManifest } from \"../fastkv\";\nimport { publishToFastKv } from \"../publish\";\nimport { openResolution } from \"../resolution/session\";\nimport type { BosConfig } from \"../types\";\nimport { saveBosConfig } from \"../utils/save-config\";\nimport { type BosBuilder, BosDepsTag } from \"./shared\";\n\nexport function registerPlugins(builder: BosBuilder) {\n return {\n pluginAdd: builder.pluginAdd.handler(async ({ input, context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const session = deps.session;\n if (!session?.config) {\n return {\n status: \"error\" as const,\n key: \"\",\n error: MISSING_CONFIG_MESSAGE,\n };\n }\n\n const isBosRef = input.source.startsWith(\"bos://\");\n const isLocal = input.source.startsWith(\"local:\");\n const key = sanitizePluginKey(\n input.as ??\n (isBosRef ? (input.source.split(\"/\").pop() ?? \"plugin\") : defaultPluginKey(input.source)),\n );\n const existing = session.config.plugins?.[key];\n const existingEntry = existing && typeof existing === \"object\" ? existing : {};\n // Adding a source is a switch, not an additive patch: a remote URL (or\n // bos:// ref) replaces a conflicting local development ref. Dual-mode\n // (local in dev, production URL in prod) remains expressible by\n // hand-editing the authored config.\n const applyEntryDelta = (base: Record<string, unknown>): Record<string, unknown> => {\n if (isBosRef) {\n const { development: _dropped, ...rest } = base;\n return { ...rest, extends: input.source };\n }\n if (isLocal) {\n const { extends: _dropped, ...rest } = base;\n return { ...rest, development: input.source };\n }\n const { development: _dropped, ...rest } = base;\n return { ...rest, production: input.production ?? input.source };\n };\n const nextPlugins = { ...session.config.plugins };\n nextPlugins[key] = applyEntryDelta(existingEntry);\n\n const nextConfig: BosConfig = {\n ...session.config,\n plugins: nextPlugins,\n };\n\n const authored = session.rawConfig;\n if (authored) {\n // Authoring-surface save: the authored leaf input + delta, never the\n // resolved config (which would bake inherited values into the file).\n const authoredExisting = authored.plugins?.[key];\n const authoredBase: Record<string, unknown> =\n typeof authoredExisting === \"string\"\n ? { extends: authoredExisting }\n : authoredExisting && typeof authoredExisting === \"object\"\n ? (authoredExisting as Record<string, unknown>)\n : {};\n await saveBosConfig(session.root, {\n ...authored,\n plugins: {\n ...(authored.plugins ?? {}),\n [key]: applyEntryDelta(authoredBase),\n },\n });\n } else {\n await saveBosConfig(session.root, nextConfig);\n }\n await generateCodeArtifacts(session.root, nextConfig);\n\n const stored = nextConfig.plugins?.[key];\n const storedObj = stored && typeof stored === \"object\" ? stored : {};\n\n return {\n status: \"added\" as const,\n key,\n development: storedObj.development,\n production: storedObj.production,\n integrity: storedObj.integrity,\n version: storedObj.version,\n };\n }),\n\n pluginRemove: builder.pluginRemove.handler(async ({ input, context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const session = deps.session;\n if (!session?.config) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: MISSING_CONFIG_MESSAGE,\n };\n }\n\n if (!session.config.plugins?.[input.key]) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `Plugin '${input.key}' is not configured`,\n };\n }\n\n const nextPlugins = { ...session.config.plugins };\n delete nextPlugins[input.key];\n const nextConfig: BosConfig = {\n ...session.config,\n plugins: Object.keys(nextPlugins).length > 0 ? nextPlugins : undefined,\n };\n\n const authored = session.rawConfig;\n if (authored) {\n const authoredPlugins: Record<string, unknown> = { ...(authored.plugins ?? {}) };\n if (authoredPlugins[input.key] === undefined) {\n // Inherited from the parent runtime. JSON-form children can express\n // removal with a null sentinel (dropped by the extends merge); the\n // TS descriptor schema cannot, so only those error out.\n if (existsSync(join(session.root, \"bos.app.ts\"))) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `'${input.key}' is inherited from the parent runtime — remove it in the parent config or override it there (the authored descriptor cannot express removal)`,\n };\n }\n authoredPlugins[input.key] = null;\n } else {\n delete authoredPlugins[input.key];\n }\n await saveBosConfig(session.root, {\n ...authored,\n plugins: Object.keys(authoredPlugins).length > 0 ? authoredPlugins : undefined,\n });\n } else {\n await saveBosConfig(session.root, nextConfig);\n }\n await generateCodeArtifacts(session.root, nextConfig);\n\n return {\n status: \"removed\" as const,\n key: input.key,\n };\n }),\n\n pluginList: builder.pluginList.handler(async ({ context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const plugins: PluginListResult[\"plugins\"] = listPluginAttachments(\n deps.session?.config ?? null,\n );\n return {\n status: \"listed\" as const,\n plugins,\n };\n }),\n\n pluginPublish: builder.pluginPublish.handler(async ({ input, context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const session = deps.session;\n if (!session?.config) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: MISSING_CONFIG_MESSAGE,\n };\n }\n\n const attachment = session.config?.plugins?.[input.key];\n if (!attachment) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `Plugin '${input.key}' is not configured`,\n };\n }\n\n const localPath = pluginLocalPath(session.root, attachment);\n if (!localPath) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `Plugin '${input.key}' does not have a local development path`,\n };\n }\n\n const result = await publishToFastKv({\n bosConfig: session.config,\n runtimeConfig: session.runtime,\n configDir: session.root,\n env: \"production\",\n build: true,\n dryRun: false,\n verbose: false,\n packages: input.key,\n });\n if (result.status === \"error\") {\n return {\n status: \"error\" as const,\n key: input.key,\n error: result.error,\n };\n }\n\n const nextSession = (await openResolution({ cwd: session.root })) ?? session;\n const production = (\n nextSession.config?.plugins?.[input.key] as\n | {\n production?: string;\n }\n | undefined\n )?.production;\n\n const manifest = production ? await fetchRemotePluginManifest(production) : null;\n if (production && nextSession.config) {\n await generateCodeArtifacts(session.root, nextSession.config);\n }\n\n return {\n status: \"published\" as const,\n key: input.key,\n path: localPath,\n production,\n fingerprint: result.fingerprint,\n version: manifest?.plugin.version,\n };\n }),\n };\n}\n\ntype PluginAttachmentConfig = NonNullable<BosConfig[\"plugins\"]>[string];\n\nfunction sanitizePluginKey(value: string): string {\n return value\n .replace(/[^A-Za-z0-9/_-]/g, \"-\")\n .replace(/\\/+/g, \"/\")\n .split(\"/\")\n .filter(Boolean)\n .map((segment) => segment.replace(/[^A-Za-z0-9_-]/g, \"-\"))\n .join(\"/\")\n .replace(/^\\/+|\\/+$/g, \"\");\n}\n\nfunction defaultPluginKey(source: string): string {\n const normalized = source.replace(/^local:/, \"\").replace(/\\/$/, \"\");\n if (source.startsWith(\"local:\")) {\n return sanitizePluginKey(basename(normalized)) || \"plugin\";\n }\n\n try {\n const url = new URL(source);\n return sanitizePluginKey(basename(url.pathname) || url.hostname) || \"plugin\";\n } catch {\n return sanitizePluginKey(source) || \"plugin\";\n }\n}\n\nfunction pluginLocalPath(configDir: string, attachment: PluginAttachmentConfig): string | null {\n const ref = getPluginRef(attachment);\n const source = ref?.development ?? ref?.production;\n if (!source?.startsWith(\"local:\")) {\n return null;\n }\n\n return join(configDir, source.slice(\"local:\".length));\n}\n\nfunction listPluginAttachments(config: BosConfig | null) {\n return (Object.entries(config?.plugins ?? {}) as Array<[string, PluginAttachmentConfig]>)\n .map(([key, attachment]) => {\n const ref = getPluginRef(attachment);\n return {\n key,\n development: ref?.development,\n production: ref?.production,\n localPath: ref?.development?.startsWith(\"local:\")\n ? ref.development.slice(\"local:\".length)\n : undefined,\n source: ref?.development?.startsWith(\"local:\") ? (\"local\" as const) : (\"remote\" as const),\n integrity: ref?.integrity,\n version: ref?.version,\n name: ref?.name,\n };\n })\n .sort((a, b) => a.key.localeCompare(b.key));\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,SAAqB;CACnD,OAAO;EACL,WAAW,QAAQ,UAAU,QAAQ,OAAO,EAAE,OAAO,cAAc;GAEjE,MAAM,UADOA,eAAQ,IAAI,QAAQ,mBAAmBC,yBACjC,CAAC,CAAC;GACrB,IAAI,CAAC,SAAS,QACZ,OAAO;IACL,QAAQ;IACR,KAAK;IACL,OAAOC;GACT;GAGF,MAAM,WAAW,MAAM,OAAO,WAAW,QAAQ;GACjD,MAAM,UAAU,MAAM,OAAO,WAAW,QAAQ;GAChD,MAAM,MAAM,kBACV,MAAM,OACH,WAAY,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,WAAY,iBAAiB,MAAM,MAAM,EAC3F;GACA,MAAM,WAAW,QAAQ,OAAO,UAAU;GAC1C,MAAM,gBAAgB,YAAY,OAAO,aAAa,WAAW,WAAW,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"../config.mjs";
|
|
3
|
+
import { saveBosConfig } from "../utils/save-config.mjs";
|
|
4
|
+
import { openResolution } from "../resolution/session.mjs";
|
|
5
|
+
import { getPluginRef } from "../build.mjs";
|
|
6
|
+
import { generateCodeArtifacts } from "../code-artifacts.mjs";
|
|
7
|
+
import { BosDepsTag } from "./shared.mjs";
|
|
8
|
+
import { publishToFastKv } from "../publish.mjs";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { basename, join } from "node:path";
|
|
11
|
+
import { Context } from "effect";
|
|
12
|
+
|
|
13
|
+
//#region src/commands/plugins.ts
|
|
14
|
+
function registerPlugins(builder) {
|
|
15
|
+
return {
|
|
16
|
+
pluginAdd: builder.pluginAdd.handler(async ({ input, context }) => {
|
|
17
|
+
const session = Context.get(context["effect/context"], BosDepsTag).session;
|
|
18
|
+
if (!session?.config) return {
|
|
19
|
+
status: "error",
|
|
20
|
+
key: "",
|
|
21
|
+
error: MISSING_CONFIG_MESSAGE
|
|
22
|
+
};
|
|
23
|
+
const isBosRef = input.source.startsWith("bos://");
|
|
24
|
+
const isLocal = input.source.startsWith("local:");
|
|
25
|
+
const key = sanitizePluginKey(input.as ?? (isBosRef ? input.source.split("/").pop() ?? "plugin" : defaultPluginKey(input.source)));
|
|
26
|
+
const existing = session.config.plugins?.[key];
|
|
27
|
+
const existingEntry = existing && typeof existing === "object" ? existing : {};
|
|
28
|
+
const applyEntryDelta = (base) => {
|
|
29
|
+
if (isBosRef) {
|
|
30
|
+
const { development: _dropped, ...rest } = base;
|
|
31
|
+
return {
|
|
32
|
+
...rest,
|
|
33
|
+
extends: input.source
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (isLocal) {
|
|
37
|
+
const { extends: _dropped, ...rest } = base;
|
|
38
|
+
return {
|
|
39
|
+
...rest,
|
|
40
|
+
development: input.source
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const { development: _dropped, ...rest } = base;
|
|
44
|
+
return {
|
|
45
|
+
...rest,
|
|
46
|
+
production: input.production ?? input.source
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const nextPlugins = { ...session.config.plugins };
|
|
50
|
+
nextPlugins[key] = applyEntryDelta(existingEntry);
|
|
51
|
+
const nextConfig = {
|
|
52
|
+
...session.config,
|
|
53
|
+
plugins: nextPlugins
|
|
54
|
+
};
|
|
55
|
+
const authored = session.rawConfig;
|
|
56
|
+
if (authored) {
|
|
57
|
+
const authoredExisting = authored.plugins?.[key];
|
|
58
|
+
const authoredBase = typeof authoredExisting === "string" ? { extends: authoredExisting } : authoredExisting && typeof authoredExisting === "object" ? authoredExisting : {};
|
|
59
|
+
await saveBosConfig(session.root, {
|
|
60
|
+
...authored,
|
|
61
|
+
plugins: {
|
|
62
|
+
...authored.plugins ?? {},
|
|
63
|
+
[key]: applyEntryDelta(authoredBase)
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
} else await saveBosConfig(session.root, nextConfig);
|
|
67
|
+
await generateCodeArtifacts(session.root, nextConfig);
|
|
68
|
+
const stored = nextConfig.plugins?.[key];
|
|
69
|
+
const storedObj = stored && typeof stored === "object" ? stored : {};
|
|
70
|
+
return {
|
|
71
|
+
status: "added",
|
|
72
|
+
key,
|
|
73
|
+
development: storedObj.development,
|
|
74
|
+
production: storedObj.production,
|
|
75
|
+
integrity: storedObj.integrity,
|
|
76
|
+
version: storedObj.version
|
|
77
|
+
};
|
|
78
|
+
}),
|
|
79
|
+
pluginRemove: builder.pluginRemove.handler(async ({ input, context }) => {
|
|
80
|
+
const session = Context.get(context["effect/context"], BosDepsTag).session;
|
|
81
|
+
if (!session?.config) return {
|
|
82
|
+
status: "error",
|
|
83
|
+
key: input.key,
|
|
84
|
+
error: MISSING_CONFIG_MESSAGE
|
|
85
|
+
};
|
|
86
|
+
if (!session.config.plugins?.[input.key]) return {
|
|
87
|
+
status: "error",
|
|
88
|
+
key: input.key,
|
|
89
|
+
error: `Plugin '${input.key}' is not configured`
|
|
90
|
+
};
|
|
91
|
+
const nextPlugins = { ...session.config.plugins };
|
|
92
|
+
delete nextPlugins[input.key];
|
|
93
|
+
const nextConfig = {
|
|
94
|
+
...session.config,
|
|
95
|
+
plugins: Object.keys(nextPlugins).length > 0 ? nextPlugins : void 0
|
|
96
|
+
};
|
|
97
|
+
const authored = session.rawConfig;
|
|
98
|
+
if (authored) {
|
|
99
|
+
const authoredPlugins = { ...authored.plugins ?? {} };
|
|
100
|
+
if (authoredPlugins[input.key] === void 0) {
|
|
101
|
+
if (existsSync(join(session.root, "bos.app.ts"))) return {
|
|
102
|
+
status: "error",
|
|
103
|
+
key: input.key,
|
|
104
|
+
error: `'${input.key}' is inherited from the parent runtime — remove it in the parent config or override it there (the authored descriptor cannot express removal)`
|
|
105
|
+
};
|
|
106
|
+
authoredPlugins[input.key] = null;
|
|
107
|
+
} else delete authoredPlugins[input.key];
|
|
108
|
+
await saveBosConfig(session.root, {
|
|
109
|
+
...authored,
|
|
110
|
+
plugins: Object.keys(authoredPlugins).length > 0 ? authoredPlugins : void 0
|
|
111
|
+
});
|
|
112
|
+
} else await saveBosConfig(session.root, nextConfig);
|
|
113
|
+
await generateCodeArtifacts(session.root, nextConfig);
|
|
114
|
+
return {
|
|
115
|
+
status: "removed",
|
|
116
|
+
key: input.key
|
|
117
|
+
};
|
|
118
|
+
}),
|
|
119
|
+
pluginList: builder.pluginList.handler(async ({ context }) => {
|
|
120
|
+
return {
|
|
121
|
+
status: "listed",
|
|
122
|
+
plugins: listPluginAttachments(Context.get(context["effect/context"], BosDepsTag).session?.config ?? null)
|
|
123
|
+
};
|
|
124
|
+
}),
|
|
125
|
+
pluginPublish: builder.pluginPublish.handler(async ({ input, context }) => {
|
|
126
|
+
const session = Context.get(context["effect/context"], BosDepsTag).session;
|
|
127
|
+
if (!session?.config) return {
|
|
128
|
+
status: "error",
|
|
129
|
+
key: input.key,
|
|
130
|
+
error: MISSING_CONFIG_MESSAGE
|
|
131
|
+
};
|
|
132
|
+
const attachment = session.config?.plugins?.[input.key];
|
|
133
|
+
if (!attachment) return {
|
|
134
|
+
status: "error",
|
|
135
|
+
key: input.key,
|
|
136
|
+
error: `Plugin '${input.key}' is not configured`
|
|
137
|
+
};
|
|
138
|
+
const localPath = pluginLocalPath(session.root, attachment);
|
|
139
|
+
if (!localPath) return {
|
|
140
|
+
status: "error",
|
|
141
|
+
key: input.key,
|
|
142
|
+
error: `Plugin '${input.key}' does not have a local development path`
|
|
143
|
+
};
|
|
144
|
+
const result = await publishToFastKv({
|
|
145
|
+
bosConfig: session.config,
|
|
146
|
+
runtimeConfig: session.runtime,
|
|
147
|
+
configDir: session.root,
|
|
148
|
+
env: "production",
|
|
149
|
+
build: true,
|
|
150
|
+
dryRun: false,
|
|
151
|
+
verbose: false,
|
|
152
|
+
packages: input.key
|
|
153
|
+
});
|
|
154
|
+
if (result.status === "error") return {
|
|
155
|
+
status: "error",
|
|
156
|
+
key: input.key,
|
|
157
|
+
error: result.error
|
|
158
|
+
};
|
|
159
|
+
const nextSession = await openResolution({ cwd: session.root }) ?? session;
|
|
160
|
+
const production = (nextSession.config?.plugins?.[input.key])?.production;
|
|
161
|
+
const manifest = production ? await fetchRemotePluginManifest(production) : null;
|
|
162
|
+
if (production && nextSession.config) await generateCodeArtifacts(session.root, nextSession.config);
|
|
163
|
+
return {
|
|
164
|
+
status: "published",
|
|
165
|
+
key: input.key,
|
|
166
|
+
path: localPath,
|
|
167
|
+
production,
|
|
168
|
+
fingerprint: result.fingerprint,
|
|
169
|
+
version: manifest?.plugin.version
|
|
170
|
+
};
|
|
171
|
+
})
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function sanitizePluginKey(value) {
|
|
175
|
+
return value.replace(/[^A-Za-z0-9/_-]/g, "-").replace(/\/+/g, "/").split("/").filter(Boolean).map((segment) => segment.replace(/[^A-Za-z0-9_-]/g, "-")).join("/").replace(/^\/+|\/+$/g, "");
|
|
176
|
+
}
|
|
177
|
+
function defaultPluginKey(source) {
|
|
178
|
+
const normalized = source.replace(/^local:/, "").replace(/\/$/, "");
|
|
179
|
+
if (source.startsWith("local:")) return sanitizePluginKey(basename(normalized)) || "plugin";
|
|
180
|
+
try {
|
|
181
|
+
const url = new URL(source);
|
|
182
|
+
return sanitizePluginKey(basename(url.pathname) || url.hostname) || "plugin";
|
|
183
|
+
} catch {
|
|
184
|
+
return sanitizePluginKey(source) || "plugin";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function pluginLocalPath(configDir, attachment) {
|
|
188
|
+
const ref = getPluginRef(attachment);
|
|
189
|
+
const source = ref?.development ?? ref?.production;
|
|
190
|
+
if (!source?.startsWith("local:")) return null;
|
|
191
|
+
return join(configDir, source.slice(6));
|
|
192
|
+
}
|
|
193
|
+
function listPluginAttachments(config) {
|
|
194
|
+
return Object.entries(config?.plugins ?? {}).map(([key, attachment]) => {
|
|
195
|
+
const ref = getPluginRef(attachment);
|
|
196
|
+
return {
|
|
197
|
+
key,
|
|
198
|
+
development: ref?.development,
|
|
199
|
+
production: ref?.production,
|
|
200
|
+
localPath: ref?.development?.startsWith("local:") ? ref.development.slice(6) : void 0,
|
|
201
|
+
source: ref?.development?.startsWith("local:") ? "local" : "remote",
|
|
202
|
+
integrity: ref?.integrity,
|
|
203
|
+
version: ref?.version,
|
|
204
|
+
name: ref?.name
|
|
205
|
+
};
|
|
206
|
+
}).sort((a, b) => a.key.localeCompare(b.key));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
//#endregion
|
|
210
|
+
export { registerPlugins };
|
|
211
|
+
//# sourceMappingURL=plugins.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/commands/plugins.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport { Context } from \"effect\";\nimport { getPluginRef } from \"../build\";\nimport { generateCodeArtifacts } from \"../code-artifacts\";\nimport { MISSING_CONFIG_MESSAGE } from \"../config\";\nimport type { PluginListResult } from \"../contract\";\nimport { fetchRemotePluginManifest } from \"../fastkv\";\nimport { publishToFastKv } from \"../publish\";\nimport { openResolution } from \"../resolution/session\";\nimport type { BosConfig } from \"../types\";\nimport { saveBosConfig } from \"../utils/save-config\";\nimport { type BosBuilder, BosDepsTag } from \"./shared\";\n\nexport function registerPlugins(builder: BosBuilder) {\n return {\n pluginAdd: builder.pluginAdd.handler(async ({ input, context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const session = deps.session;\n if (!session?.config) {\n return {\n status: \"error\" as const,\n key: \"\",\n error: MISSING_CONFIG_MESSAGE,\n };\n }\n\n const isBosRef = input.source.startsWith(\"bos://\");\n const isLocal = input.source.startsWith(\"local:\");\n const key = sanitizePluginKey(\n input.as ??\n (isBosRef ? (input.source.split(\"/\").pop() ?? \"plugin\") : defaultPluginKey(input.source)),\n );\n const existing = session.config.plugins?.[key];\n const existingEntry = existing && typeof existing === \"object\" ? existing : {};\n // Adding a source is a switch, not an additive patch: a remote URL (or\n // bos:// ref) replaces a conflicting local development ref. Dual-mode\n // (local in dev, production URL in prod) remains expressible by\n // hand-editing the authored config.\n const applyEntryDelta = (base: Record<string, unknown>): Record<string, unknown> => {\n if (isBosRef) {\n const { development: _dropped, ...rest } = base;\n return { ...rest, extends: input.source };\n }\n if (isLocal) {\n const { extends: _dropped, ...rest } = base;\n return { ...rest, development: input.source };\n }\n const { development: _dropped, ...rest } = base;\n return { ...rest, production: input.production ?? input.source };\n };\n const nextPlugins = { ...session.config.plugins };\n nextPlugins[key] = applyEntryDelta(existingEntry);\n\n const nextConfig: BosConfig = {\n ...session.config,\n plugins: nextPlugins,\n };\n\n const authored = session.rawConfig;\n if (authored) {\n // Authoring-surface save: the authored leaf input + delta, never the\n // resolved config (which would bake inherited values into the file).\n const authoredExisting = authored.plugins?.[key];\n const authoredBase: Record<string, unknown> =\n typeof authoredExisting === \"string\"\n ? { extends: authoredExisting }\n : authoredExisting && typeof authoredExisting === \"object\"\n ? (authoredExisting as Record<string, unknown>)\n : {};\n await saveBosConfig(session.root, {\n ...authored,\n plugins: {\n ...(authored.plugins ?? {}),\n [key]: applyEntryDelta(authoredBase),\n },\n });\n } else {\n await saveBosConfig(session.root, nextConfig);\n }\n await generateCodeArtifacts(session.root, nextConfig);\n\n const stored = nextConfig.plugins?.[key];\n const storedObj = stored && typeof stored === \"object\" ? stored : {};\n\n return {\n status: \"added\" as const,\n key,\n development: storedObj.development,\n production: storedObj.production,\n integrity: storedObj.integrity,\n version: storedObj.version,\n };\n }),\n\n pluginRemove: builder.pluginRemove.handler(async ({ input, context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const session = deps.session;\n if (!session?.config) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: MISSING_CONFIG_MESSAGE,\n };\n }\n\n if (!session.config.plugins?.[input.key]) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `Plugin '${input.key}' is not configured`,\n };\n }\n\n const nextPlugins = { ...session.config.plugins };\n delete nextPlugins[input.key];\n const nextConfig: BosConfig = {\n ...session.config,\n plugins: Object.keys(nextPlugins).length > 0 ? nextPlugins : undefined,\n };\n\n const authored = session.rawConfig;\n if (authored) {\n const authoredPlugins: Record<string, unknown> = { ...(authored.plugins ?? {}) };\n if (authoredPlugins[input.key] === undefined) {\n // Inherited from the parent runtime. JSON-form children can express\n // removal with a null sentinel (dropped by the extends merge); the\n // TS descriptor schema cannot, so only those error out.\n if (existsSync(join(session.root, \"bos.app.ts\"))) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `'${input.key}' is inherited from the parent runtime — remove it in the parent config or override it there (the authored descriptor cannot express removal)`,\n };\n }\n authoredPlugins[input.key] = null;\n } else {\n delete authoredPlugins[input.key];\n }\n await saveBosConfig(session.root, {\n ...authored,\n plugins: Object.keys(authoredPlugins).length > 0 ? authoredPlugins : undefined,\n });\n } else {\n await saveBosConfig(session.root, nextConfig);\n }\n await generateCodeArtifacts(session.root, nextConfig);\n\n return {\n status: \"removed\" as const,\n key: input.key,\n };\n }),\n\n pluginList: builder.pluginList.handler(async ({ context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const plugins: PluginListResult[\"plugins\"] = listPluginAttachments(\n deps.session?.config ?? null,\n );\n return {\n status: \"listed\" as const,\n plugins,\n };\n }),\n\n pluginPublish: builder.pluginPublish.handler(async ({ input, context }) => {\n const deps = Context.get(context[\"effect/context\"], BosDepsTag);\n const session = deps.session;\n if (!session?.config) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: MISSING_CONFIG_MESSAGE,\n };\n }\n\n const attachment = session.config?.plugins?.[input.key];\n if (!attachment) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `Plugin '${input.key}' is not configured`,\n };\n }\n\n const localPath = pluginLocalPath(session.root, attachment);\n if (!localPath) {\n return {\n status: \"error\" as const,\n key: input.key,\n error: `Plugin '${input.key}' does not have a local development path`,\n };\n }\n\n const result = await publishToFastKv({\n bosConfig: session.config,\n runtimeConfig: session.runtime,\n configDir: session.root,\n env: \"production\",\n build: true,\n dryRun: false,\n verbose: false,\n packages: input.key,\n });\n if (result.status === \"error\") {\n return {\n status: \"error\" as const,\n key: input.key,\n error: result.error,\n };\n }\n\n const nextSession = (await openResolution({ cwd: session.root })) ?? session;\n const production = (\n nextSession.config?.plugins?.[input.key] as\n | {\n production?: string;\n }\n | undefined\n )?.production;\n\n const manifest = production ? await fetchRemotePluginManifest(production) : null;\n if (production && nextSession.config) {\n await generateCodeArtifacts(session.root, nextSession.config);\n }\n\n return {\n status: \"published\" as const,\n key: input.key,\n path: localPath,\n production,\n fingerprint: result.fingerprint,\n version: manifest?.plugin.version,\n };\n }),\n };\n}\n\ntype PluginAttachmentConfig = NonNullable<BosConfig[\"plugins\"]>[string];\n\nfunction sanitizePluginKey(value: string): string {\n return value\n .replace(/[^A-Za-z0-9/_-]/g, \"-\")\n .replace(/\\/+/g, \"/\")\n .split(\"/\")\n .filter(Boolean)\n .map((segment) => segment.replace(/[^A-Za-z0-9_-]/g, \"-\"))\n .join(\"/\")\n .replace(/^\\/+|\\/+$/g, \"\");\n}\n\nfunction defaultPluginKey(source: string): string {\n const normalized = source.replace(/^local:/, \"\").replace(/\\/$/, \"\");\n if (source.startsWith(\"local:\")) {\n return sanitizePluginKey(basename(normalized)) || \"plugin\";\n }\n\n try {\n const url = new URL(source);\n return sanitizePluginKey(basename(url.pathname) || url.hostname) || \"plugin\";\n } catch {\n return sanitizePluginKey(source) || \"plugin\";\n }\n}\n\nfunction pluginLocalPath(configDir: string, attachment: PluginAttachmentConfig): string | null {\n const ref = getPluginRef(attachment);\n const source = ref?.development ?? ref?.production;\n if (!source?.startsWith(\"local:\")) {\n return null;\n }\n\n return join(configDir, source.slice(\"local:\".length));\n}\n\nfunction listPluginAttachments(config: BosConfig | null) {\n return (Object.entries(config?.plugins ?? {}) as Array<[string, PluginAttachmentConfig]>)\n .map(([key, attachment]) => {\n const ref = getPluginRef(attachment);\n return {\n key,\n development: ref?.development,\n production: ref?.production,\n localPath: ref?.development?.startsWith(\"local:\")\n ? ref.development.slice(\"local:\".length)\n : undefined,\n source: ref?.development?.startsWith(\"local:\") ? (\"local\" as const) : (\"remote\" as const),\n integrity: ref?.integrity,\n version: ref?.version,\n name: ref?.name,\n };\n })\n .sort((a, b) => a.key.localeCompare(b.key));\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,SAAqB;CACnD,OAAO;EACL,WAAW,QAAQ,UAAU,QAAQ,OAAO,EAAE,OAAO,cAAc;GAEjE,MAAM,UADO,QAAQ,IAAI,QAAQ,mBAAmB,UACjC,CAAC,CAAC;GACrB,IAAI,CAAC,SAAS,QACZ,OAAO;IACL,QAAQ;IACR,KAAK;IACL,OAAO;GACT;GAGF,MAAM,WAAW,MAAM,OAAO,WAAW,QAAQ;GACjD,MAAM,UAAU,MAAM,OAAO,WAAW,QAAQ;GAChD,MAAM,MAAM,kBACV,MAAM,OACH,WAAY,MAAM,OAAO,MAA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@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.cjs","names":["Context"],"sources":["../../src/commands/shared.ts"],"sourcesContent":["import type { WithEffectContext } from \"@orpc/experimental-effect\";\nimport type { Implementer } from \"@orpc/server\";\nimport { Context } from \"effect\";\nimport type { bosContract } from \"../contract\";\nimport type { DatabaseBindingsService, DrizzleKitService } from \"../db\";\nimport type { ResolutionSession } from \"../resolution/session\";\n\nexport type BosDeps = {\n readonly session: ResolutionSession | null;\n databaseBindings: DatabaseBindingsService;\n drizzleKit: DrizzleKitService;\n};\n\nexport class BosDepsTag extends Context.Service<BosDepsTag, BosDeps>()(\"bos/BosDeps\") {}\n\nexport type BosBuilder = Implementer<\n typeof bosContract,\n Record<string, never> & WithEffectContext<any>\n>;\n"],"mappings":";;;AAaA,IAAa,aAAb,cAAgCA,eAAQ,QAA6B,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.mjs","names":[],"sources":["../../src/commands/shared.ts"],"sourcesContent":["import type { WithEffectContext } from \"@orpc/experimental-effect\";\nimport type { Implementer } from \"@orpc/server\";\nimport { Context } from \"effect\";\nimport type { bosContract } from \"../contract\";\nimport type { DatabaseBindingsService, DrizzleKitService } from \"../db\";\nimport type { ResolutionSession } from \"../resolution/session\";\n\nexport type BosDeps = {\n readonly session: ResolutionSession | null;\n databaseBindings: DatabaseBindingsService;\n drizzleKit: DrizzleKitService;\n};\n\nexport class BosDepsTag extends Context.Service<BosDepsTag, BosDeps>()(\"bos/BosDeps\") {}\n\nexport type BosBuilder = Implementer<\n typeof bosContract,\n Record<string, never> & WithEffectContext<any>\n>;\n"],"mappings":";;;AAaA,IAAa,aAAb,cAAgC,QAAQ,QAA6B,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_config = require('../config.cjs');
|
|
3
|
+
const require_resolution_session = require('../resolution/session.cjs');
|
|
4
|
+
const require_mf = require('../mf.cjs');
|
|
5
|
+
const require_theme = require('../utils/theme.cjs');
|
|
6
|
+
const require_build = require('../build.cjs');
|
|
7
|
+
const require_code_artifacts = require('../code-artifacts.cjs');
|
|
8
|
+
const require_sync = require('../cli/sync.cjs');
|
|
9
|
+
const require_upgrade = require('../cli/upgrade.cjs');
|
|
10
|
+
let node_fs = require("node:fs");
|
|
11
|
+
let node_path = require("node:path");
|
|
12
|
+
let node_process = require("node:process");
|
|
13
|
+
node_process = require_runtime.__toESM(node_process, 1);
|
|
14
|
+
let node_child_process = require("node:child_process");
|
|
15
|
+
|
|
16
|
+
//#region src/commands/upgrade.ts
|
|
17
|
+
function registerUpgrade(builder) {
|
|
18
|
+
return {
|
|
19
|
+
sync: builder.sync.handler(async ({ input }) => {
|
|
20
|
+
try {
|
|
21
|
+
const configPath = require_config.findConfigPath();
|
|
22
|
+
if (!configPath) return {
|
|
23
|
+
status: "error",
|
|
24
|
+
updated: [],
|
|
25
|
+
skipped: [],
|
|
26
|
+
added: [],
|
|
27
|
+
error: `${require_config.MISSING_CONFIG_MESSAGE} in current directory`
|
|
28
|
+
};
|
|
29
|
+
const projectDir = (0, node_path.resolve)((0, node_path.dirname)(configPath));
|
|
30
|
+
const result = await require_sync.syncTemplate(projectDir, input);
|
|
31
|
+
if (result.status === "synced" || result.status === "dry-run") {
|
|
32
|
+
const syncedConfig = await require_resolution_session.openResolution({ cwd: projectDir });
|
|
33
|
+
if (syncedConfig?.config) await require_code_artifacts.generateCodeArtifacts(projectDir, syncedConfig.config);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return {
|
|
38
|
+
status: "error",
|
|
39
|
+
updated: [],
|
|
40
|
+
skipped: [],
|
|
41
|
+
added: [],
|
|
42
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
upgrade: builder.upgrade.handler(async ({ input }) => {
|
|
47
|
+
try {
|
|
48
|
+
const configPath = require_config.findConfigPath();
|
|
49
|
+
if (!configPath) return {
|
|
50
|
+
status: "error",
|
|
51
|
+
packages: [],
|
|
52
|
+
error: `${require_config.MISSING_CONFIG_MESSAGE} in current directory`
|
|
53
|
+
};
|
|
54
|
+
const projectDir = (0, node_path.resolve)((0, node_path.dirname)(configPath));
|
|
55
|
+
return await require_upgrade.upgradeTemplate(projectDir, input);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return {
|
|
58
|
+
status: "error",
|
|
59
|
+
packages: [],
|
|
60
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
typesGen: builder.typesGen.handler(async ({ input }) => {
|
|
65
|
+
try {
|
|
66
|
+
const configPath = require_config.findConfigPath();
|
|
67
|
+
if (!configPath) return {
|
|
68
|
+
status: "error",
|
|
69
|
+
generated: [],
|
|
70
|
+
fetched: [],
|
|
71
|
+
skipped: [],
|
|
72
|
+
failed: [],
|
|
73
|
+
error: `${require_config.MISSING_CONFIG_MESSAGE} in current directory`
|
|
74
|
+
};
|
|
75
|
+
const projectDir = (0, node_path.resolve)((0, node_path.dirname)(configPath));
|
|
76
|
+
const env = input.env ?? (node_process.default.env.NODE_ENV === "production" ? "production" : "development");
|
|
77
|
+
const refreshed = await require_resolution_session.openResolution({
|
|
78
|
+
cwd: projectDir,
|
|
79
|
+
env,
|
|
80
|
+
remotePlugins: input.remotePlugins
|
|
81
|
+
});
|
|
82
|
+
if (!refreshed?.config || !refreshed.runtime) return {
|
|
83
|
+
status: "error",
|
|
84
|
+
generated: [],
|
|
85
|
+
fetched: [],
|
|
86
|
+
skipped: [],
|
|
87
|
+
failed: [],
|
|
88
|
+
error: "Failed to load the authored config"
|
|
89
|
+
};
|
|
90
|
+
const runtime = refreshed.runtime;
|
|
91
|
+
const resolvedConfig = refreshed.config;
|
|
92
|
+
if (input.dryRun) {
|
|
93
|
+
const pluginEntries = Object.entries(runtime.plugins ?? {});
|
|
94
|
+
const fetched = [];
|
|
95
|
+
const skipped = [];
|
|
96
|
+
const hasLocalApiWorkspace = (0, node_fs.existsSync)((0, node_path.join)(projectDir, "api", "src"));
|
|
97
|
+
if (runtime.api.source !== "local") fetched.push(`api remote (${runtime.api.url})`);
|
|
98
|
+
else {
|
|
99
|
+
const path = runtime.api.localPath ? ` (${(0, node_path.relative)(projectDir, runtime.api.localPath)})` : "";
|
|
100
|
+
skipped.push(`api local${path}`);
|
|
101
|
+
}
|
|
102
|
+
if (runtime.auth) {
|
|
103
|
+
if (runtime.auth.source !== "local") fetched.push(`auth remote (${runtime.auth.url})`);
|
|
104
|
+
else {
|
|
105
|
+
const path = runtime.auth.localPath ? ` (${(0, node_path.relative)(projectDir, runtime.auth.localPath)})` : "";
|
|
106
|
+
skipped.push(`auth local${path}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const [key, plugin] of pluginEntries) if (plugin.url && plugin.source !== "local") fetched.push(`${key} remote (${plugin.url})`);
|
|
110
|
+
else if (plugin.localPath) skipped.push(`${key} local (${(0, node_path.relative)(projectDir, plugin.localPath)})`);
|
|
111
|
+
else skipped.push(`${key} no URL resolved`);
|
|
112
|
+
const generated = ["ui/src/lib/api-types.gen.ts", "ui/src/lib/auth-types.gen.ts"];
|
|
113
|
+
if (hasLocalApiWorkspace) generated.push("api/src/lib/plugins-types.gen.ts", "api/src/lib/auth-types.gen.ts");
|
|
114
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(projectDir, "host", "src"))) generated.push("host/src/lib/auth-types.gen.ts");
|
|
115
|
+
for (const [_key, plugin] of pluginEntries) {
|
|
116
|
+
const localPath = plugin.localPath;
|
|
117
|
+
if (!localPath) continue;
|
|
118
|
+
const pluginSrc = (0, node_path.join)(localPath, "src", "lib", "plugins-client.gen.ts");
|
|
119
|
+
if ((0, node_fs.existsSync)(pluginSrc)) generated.push((0, node_path.relative)(projectDir, pluginSrc));
|
|
120
|
+
}
|
|
121
|
+
if (runtime.auth?.localPath) {
|
|
122
|
+
const authSrc = (0, node_path.join)(runtime.auth.localPath, "src", "lib", "plugins-client.gen.ts");
|
|
123
|
+
if ((0, node_fs.existsSync)(authSrc)) generated.push((0, node_path.relative)(projectDir, authSrc));
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
status: "success",
|
|
127
|
+
generated,
|
|
128
|
+
fetched,
|
|
129
|
+
skipped,
|
|
130
|
+
failed: []
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const artifacts = await require_code_artifacts.generateCodeArtifacts(projectDir, resolvedConfig, { runtimeConfig: runtime });
|
|
134
|
+
const hasLocalApiWorkspace = (0, node_fs.existsSync)((0, node_path.join)(projectDir, "api", "src"));
|
|
135
|
+
const generated = ["ui/src/lib/api-types.gen.ts"];
|
|
136
|
+
if (hasLocalApiWorkspace) generated.push("api/src/lib/plugins-types.gen.ts", "api/src/lib/auth-types.gen.ts");
|
|
137
|
+
if (runtime.auth && (runtime.auth.source !== "local" || runtime.auth.localPath)) generated.push("ui/src/lib/auth-types.gen.ts");
|
|
138
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(projectDir, "host", "src"))) generated.push("host/src/lib/auth-types.gen.ts");
|
|
139
|
+
for (const [_key, plugin] of Object.entries(runtime.plugins ?? {})) {
|
|
140
|
+
const localPath = plugin.localPath;
|
|
141
|
+
if (!localPath) continue;
|
|
142
|
+
const pluginSrc = (0, node_path.join)(localPath, "src", "lib", "plugins-client.gen.ts");
|
|
143
|
+
if ((0, node_fs.existsSync)(pluginSrc)) generated.push((0, node_path.relative)(projectDir, pluginSrc));
|
|
144
|
+
}
|
|
145
|
+
if (runtime.auth?.localPath) {
|
|
146
|
+
const authSrc = (0, node_path.join)(runtime.auth.localPath, "src", "lib", "plugins-client.gen.ts");
|
|
147
|
+
if ((0, node_fs.existsSync)(authSrc)) generated.push((0, node_path.relative)(projectDir, authSrc));
|
|
148
|
+
}
|
|
149
|
+
const contractStatus = artifacts?.contractStatus ?? [];
|
|
150
|
+
const fetched = [];
|
|
151
|
+
const skipped = [];
|
|
152
|
+
const failed = [];
|
|
153
|
+
for (const entry of contractStatus) if (entry.source === "remote") fetched.push(entry.url ? `${entry.key} remote (${entry.url})` : entry.key);
|
|
154
|
+
else if (entry.source === "local") {
|
|
155
|
+
const path = entry.localPath ? ` (${(0, node_path.relative)(projectDir, entry.localPath)})` : "";
|
|
156
|
+
skipped.push(`${entry.key} local${path}`);
|
|
157
|
+
} else if (entry.source === "skipped") skipped.push(`${entry.key} no URL resolved`);
|
|
158
|
+
else if (entry.source === "failed") {
|
|
159
|
+
const detail = entry.error ? `: ${entry.error}` : "";
|
|
160
|
+
failed.push(`${entry.key}${detail}`);
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
status: "success",
|
|
164
|
+
generated,
|
|
165
|
+
fetched,
|
|
166
|
+
skipped,
|
|
167
|
+
failed
|
|
168
|
+
};
|
|
169
|
+
} catch (error) {
|
|
170
|
+
return {
|
|
171
|
+
status: "error",
|
|
172
|
+
generated: [],
|
|
173
|
+
fetched: [],
|
|
174
|
+
skipped: [],
|
|
175
|
+
failed: [],
|
|
176
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
180
|
+
typecheck: builder.typecheck.handler(async ({ input }) => {
|
|
181
|
+
try {
|
|
182
|
+
const configPath = require_config.findConfigPath();
|
|
183
|
+
if (!configPath) return {
|
|
184
|
+
status: "error",
|
|
185
|
+
checked: [],
|
|
186
|
+
skipped: [],
|
|
187
|
+
results: [],
|
|
188
|
+
error: `${require_config.MISSING_CONFIG_MESSAGE} in current directory`
|
|
189
|
+
};
|
|
190
|
+
const projectDir = (0, node_path.resolve)((0, node_path.dirname)(configPath));
|
|
191
|
+
const refreshed = await require_resolution_session.openResolution({ cwd: projectDir });
|
|
192
|
+
if (!refreshed?.config || !refreshed.runtime) return {
|
|
193
|
+
status: "error",
|
|
194
|
+
checked: [],
|
|
195
|
+
skipped: [],
|
|
196
|
+
results: [],
|
|
197
|
+
error: "Failed to load the authored config"
|
|
198
|
+
};
|
|
199
|
+
const runtime = refreshed.runtime;
|
|
200
|
+
const resolvedConfig = refreshed.config;
|
|
201
|
+
await require_code_artifacts.generateCodeArtifacts(projectDir, resolvedConfig, { runtimeConfig: runtime });
|
|
202
|
+
const workspaceEntries = [];
|
|
203
|
+
const skipped = [];
|
|
204
|
+
const appTargets = [
|
|
205
|
+
{
|
|
206
|
+
key: "host",
|
|
207
|
+
label: "host",
|
|
208
|
+
target: runtime.host
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
key: "ui",
|
|
212
|
+
label: "ui",
|
|
213
|
+
target: runtime.ui
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
key: "api",
|
|
217
|
+
label: "api",
|
|
218
|
+
target: runtime.api
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
if (runtime.auth) appTargets.push({
|
|
222
|
+
key: "auth",
|
|
223
|
+
label: "auth",
|
|
224
|
+
target: runtime.auth
|
|
225
|
+
});
|
|
226
|
+
for (const entry of appTargets) if (entry.target?.source === "local" && entry.target.localPath && (0, node_fs.existsSync)((0, node_path.join)(entry.target.localPath, "tsconfig.json"))) workspaceEntries.push({
|
|
227
|
+
key: entry.key,
|
|
228
|
+
label: entry.label,
|
|
229
|
+
dir: entry.target.localPath
|
|
230
|
+
});
|
|
231
|
+
else skipped.push({
|
|
232
|
+
key: entry.key,
|
|
233
|
+
label: entry.label
|
|
234
|
+
});
|
|
235
|
+
for (const [key, plugin] of Object.entries(runtime.plugins ?? {})) {
|
|
236
|
+
const label = `plugins/${key}`;
|
|
237
|
+
if (plugin.source === "local" && plugin.localPath && (0, node_fs.existsSync)((0, node_path.join)(plugin.localPath, "tsconfig.json"))) workspaceEntries.push({
|
|
238
|
+
key,
|
|
239
|
+
label,
|
|
240
|
+
dir: plugin.localPath
|
|
241
|
+
});
|
|
242
|
+
else skipped.push({
|
|
243
|
+
key,
|
|
244
|
+
label
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const selected = require_build.selectWorkspaceTargets(input.packages, resolvedConfig);
|
|
248
|
+
const targets = input.packages === "all" ? workspaceEntries : workspaceEntries.filter((entry) => selected.includes(entry.key));
|
|
249
|
+
const skippedEntries = input.packages === "all" ? skipped : skipped.filter((entry) => selected.includes(entry.key));
|
|
250
|
+
const checked = [];
|
|
251
|
+
const results = [];
|
|
252
|
+
for (const entry of targets) {
|
|
253
|
+
const packageJsonPath = (0, node_path.join)(entry.dir, "package.json");
|
|
254
|
+
let args = [
|
|
255
|
+
"exec",
|
|
256
|
+
"tsc",
|
|
257
|
+
"--noEmit"
|
|
258
|
+
];
|
|
259
|
+
if ((0, node_fs.existsSync)(packageJsonPath)) try {
|
|
260
|
+
if (JSON.parse((0, node_fs.readFileSync)(packageJsonPath, "utf-8")).scripts?.typecheck) args = ["run", "typecheck"];
|
|
261
|
+
} catch {}
|
|
262
|
+
console.log(`\n ${require_theme.colors.dim("Checking")} ${require_theme.colors.cyan(entry.label)}`);
|
|
263
|
+
const child = (0, node_child_process.spawnSync)("pnpm", args, {
|
|
264
|
+
cwd: entry.dir,
|
|
265
|
+
stdio: "inherit"
|
|
266
|
+
});
|
|
267
|
+
const passed = child.status === 0;
|
|
268
|
+
checked.push(entry.label);
|
|
269
|
+
results.push({
|
|
270
|
+
workspace: entry.label,
|
|
271
|
+
passed,
|
|
272
|
+
error: passed ? void 0 : `typecheck failed (exit code ${child.status ?? "n/a"})`
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
status: "success",
|
|
277
|
+
checked,
|
|
278
|
+
skipped: skippedEntries.map((entry) => entry.label),
|
|
279
|
+
results
|
|
280
|
+
};
|
|
281
|
+
} catch (error) {
|
|
282
|
+
return {
|
|
283
|
+
status: "error",
|
|
284
|
+
checked: [],
|
|
285
|
+
skipped: [],
|
|
286
|
+
results: [],
|
|
287
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}),
|
|
291
|
+
mfCheck: builder.mfCheck.handler(async ({ input }) => {
|
|
292
|
+
let authored = null;
|
|
293
|
+
try {
|
|
294
|
+
authored = await require_config.readAuthoredConfigInput();
|
|
295
|
+
} catch (e) {
|
|
296
|
+
return {
|
|
297
|
+
status: "fail",
|
|
298
|
+
hostVersion: null,
|
|
299
|
+
hostReachable: false,
|
|
300
|
+
hostReason: e instanceof Error ? e.message : String(e),
|
|
301
|
+
remotes: []
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (!authored) return {
|
|
305
|
+
status: "fail",
|
|
306
|
+
hostVersion: null,
|
|
307
|
+
hostReachable: false,
|
|
308
|
+
hostReason: require_config.MISSING_CONFIG_MESSAGE,
|
|
309
|
+
remotes: []
|
|
310
|
+
};
|
|
311
|
+
const report = await require_mf.checkFederationCompat(authored, { timeoutMs: input.timeoutMs });
|
|
312
|
+
return {
|
|
313
|
+
status: report.ok ? "ok" : "fail",
|
|
314
|
+
hostVersion: report.hostVersion,
|
|
315
|
+
hostReachable: report.hostReachable,
|
|
316
|
+
hostReason: report.hostReason,
|
|
317
|
+
remotes: report.remotes
|
|
318
|
+
};
|
|
319
|
+
})
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
//#endregion
|
|
324
|
+
exports.registerUpgrade = registerUpgrade;
|
|
325
|
+
//# sourceMappingURL=upgrade.cjs.map
|