every-plugin 2.10.1 → 3.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/bin/every-plugin-serve.mjs +12 -0
- package/bin/every-plugin.mjs +59 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/build/artifact-names.cjs +119 -0
- package/dist/build/artifact-names.cjs.map +1 -0
- package/dist/build/artifact-names.d.cts +68 -0
- package/dist/build/artifact-names.d.cts.map +1 -0
- package/dist/build/artifact-names.d.mts +68 -0
- package/dist/build/artifact-names.d.mts.map +1 -0
- package/dist/build/artifact-names.mjs +102 -0
- package/dist/build/artifact-names.mjs.map +1 -0
- package/dist/build/contract-types.cjs +89 -0
- package/dist/build/contract-types.cjs.map +1 -0
- package/dist/build/contract-types.mjs +81 -0
- package/dist/build/contract-types.mjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.cjs +37 -0
- package/dist/build/rspack/build-report-plugin.cjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.cts +18 -0
- package/dist/build/rspack/build-report-plugin.d.cts.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.mts +18 -0
- package/dist/build/rspack/build-report-plugin.d.mts.map +1 -0
- package/dist/build/rspack/build-report-plugin.mjs +37 -0
- package/dist/build/rspack/build-report-plugin.mjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -0
- package/dist/build/rspack/compose.cjs +69 -0
- package/dist/build/rspack/compose.cjs.map +1 -0
- package/dist/build/rspack/compose.d.cts +20 -0
- package/dist/build/rspack/compose.d.cts.map +1 -0
- package/dist/build/rspack/compose.d.mts +20 -0
- package/dist/build/rspack/compose.d.mts.map +1 -0
- package/dist/build/rspack/compose.mjs +65 -0
- package/dist/build/rspack/compose.mjs.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +11 -11
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +11 -10
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/generated-config.cjs +35 -0
- package/dist/build/rspack/generated-config.cjs.map +1 -0
- package/dist/build/rspack/generated-config.mjs +32 -0
- package/dist/build/rspack/generated-config.mjs.map +1 -0
- package/dist/build/rspack/index.cjs +8 -5
- package/dist/build/rspack/index.d.cts +5 -3
- package/dist/build/rspack/index.d.mts +5 -3
- package/dist/build/rspack/index.mjs +5 -3
- package/dist/build/rspack/module-federation.cjs +2 -2
- package/dist/build/rspack/module-federation.cjs.map +1 -1
- package/dist/build/rspack/module-federation.mjs +1 -1
- package/dist/build/rspack/module-federation.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs +44 -69
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +4 -13
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +4 -13
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +44 -69
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/rspack/utils.cjs +7 -5
- package/dist/build/rspack/utils.cjs.map +1 -1
- package/dist/build/rspack/utils.mjs +7 -6
- package/dist/build/rspack/utils.mjs.map +1 -1
- package/dist/build/ui/factory.cjs +88 -0
- package/dist/build/ui/factory.cjs.map +1 -0
- package/dist/build/ui/factory.d.cts +11 -0
- package/dist/build/ui/factory.d.cts.map +1 -0
- package/dist/build/ui/factory.d.mts +11 -0
- package/dist/build/ui/factory.d.mts.map +1 -0
- package/dist/build/ui/factory.mjs +80 -0
- package/dist/build/ui/factory.mjs.map +1 -0
- package/dist/build/ui/generated-config.cjs +118 -0
- package/dist/build/ui/generated-config.cjs.map +1 -0
- package/dist/build/ui/generated-config.d.cts +33 -0
- package/dist/build/ui/generated-config.d.cts.map +1 -0
- package/dist/build/ui/generated-config.d.mts +33 -0
- package/dist/build/ui/generated-config.d.mts.map +1 -0
- package/dist/build/ui/generated-config.mjs +111 -0
- package/dist/build/ui/generated-config.mjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs +61 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs +58 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs.map +1 -0
- package/dist/build/ui/index.cjs +90 -0
- package/dist/build/ui/index.cjs.map +1 -0
- package/dist/build/ui/index.d.cts +29 -0
- package/dist/build/ui/index.d.cts.map +1 -0
- package/dist/build/ui/index.d.mts +29 -0
- package/dist/build/ui/index.d.mts.map +1 -0
- package/dist/build/ui/index.mjs +68 -0
- package/dist/build/ui/index.mjs.map +1 -0
- package/dist/build/ui/manifest-plugin.cjs +37 -0
- package/dist/build/ui/manifest-plugin.cjs.map +1 -0
- package/dist/build/ui/manifest-plugin.d.cts +19 -0
- package/dist/build/ui/manifest-plugin.d.cts.map +1 -0
- package/dist/build/ui/manifest-plugin.d.mts +19 -0
- package/dist/build/ui/manifest-plugin.d.mts.map +1 -0
- package/dist/build/ui/manifest-plugin.mjs +37 -0
- package/dist/build/ui/manifest-plugin.mjs.map +1 -0
- package/dist/build/ui/rsbuild-config.cjs +203 -0
- package/dist/build/ui/rsbuild-config.cjs.map +1 -0
- package/dist/build/ui/rsbuild-config.d.cts +45 -0
- package/dist/build/ui/rsbuild-config.d.cts.map +1 -0
- package/dist/build/ui/rsbuild-config.d.mts +45 -0
- package/dist/build/ui/rsbuild-config.d.mts.map +1 -0
- package/dist/build/ui/rsbuild-config.mjs +200 -0
- package/dist/build/ui/rsbuild-config.mjs.map +1 -0
- package/dist/build/ui/stubs.cjs +107 -0
- package/dist/build/ui/stubs.cjs.map +1 -0
- package/dist/build/ui/stubs.d.cts +25 -0
- package/dist/build/ui/stubs.d.cts.map +1 -0
- package/dist/build/ui/stubs.d.mts +25 -0
- package/dist/build/ui/stubs.d.mts.map +1 -0
- package/dist/build/ui/stubs.mjs +106 -0
- package/dist/build/ui/stubs.mjs.map +1 -0
- package/dist/cli.cjs +83 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +6 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +6 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +82 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/dev/serve.cjs +390 -0
- package/dist/dev/serve.cjs.map +1 -0
- package/dist/dev/serve.d.cts +23 -0
- package/dist/dev/serve.d.cts.map +1 -0
- package/dist/dev/serve.d.mts +23 -0
- package/dist/dev/serve.d.mts.map +1 -0
- package/dist/dev/serve.mjs +384 -0
- package/dist/dev/serve.mjs.map +1 -0
- package/dist/dev/watch-kill.cjs +39 -0
- package/dist/dev/watch-kill.cjs.map +1 -0
- package/dist/dev/watch-kill.mjs +38 -0
- package/dist/dev/watch-kill.mjs.map +1 -0
- package/dist/effect-helpers.cjs +23 -0
- package/dist/effect-helpers.cjs.map +1 -0
- package/dist/effect-helpers.d.cts +20 -0
- package/dist/effect-helpers.d.cts.map +1 -0
- package/dist/effect-helpers.d.mts +20 -0
- package/dist/effect-helpers.d.mts.map +1 -0
- package/dist/effect-helpers.mjs +22 -0
- package/dist/effect-helpers.mjs.map +1 -0
- package/dist/errors.cjs +49 -69
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +13 -96
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +13 -96
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +16 -34
- package/dist/errors.mjs.map +1 -1
- package/dist/identity.cjs +19 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +33 -0
- package/dist/identity.d.cts.map +1 -0
- package/dist/identity.d.mts +33 -0
- package/dist/identity.d.mts.map +1 -0
- package/dist/identity.mjs +16 -0
- package/dist/identity.mjs.map +1 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +8 -6
- package/dist/index.d.mts +8 -6
- package/dist/index.mjs +6 -4
- package/dist/plugin.cjs +12 -26
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +44 -25
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +45 -26
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +15 -29
- package/dist/plugin.mjs.map +1 -1
- package/dist/remote-entry.cjs +103 -0
- package/dist/remote-entry.cjs.map +1 -0
- package/dist/remote-entry.d.cts +53 -0
- package/dist/remote-entry.d.cts.map +1 -0
- package/dist/remote-entry.d.mts +53 -0
- package/dist/remote-entry.d.mts.map +1 -0
- package/dist/remote-entry.mjs +98 -0
- package/dist/remote-entry.mjs.map +1 -0
- package/dist/runtime/errors.cjs +140 -34
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +42 -7
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +42 -7
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +136 -31
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +95 -23
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +16 -0
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +16 -0
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +98 -26
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +3 -78
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts +3 -49
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts +3 -49
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +5 -78
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +63 -12
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts +4 -13
- package/dist/runtime/services/module-federation.service.d.mts +4 -13
- package/dist/runtime/services/module-federation.service.mjs +63 -14
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/normalize.cjs +2 -22
- package/dist/runtime/services/normalize.d.cts +2 -21
- package/dist/runtime/services/normalize.d.mts +2 -21
- package/dist/runtime/services/normalize.mjs +2 -21
- package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +30 -29
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
- package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
- package/dist/runtime/services/plugin-loader.service.mjs +29 -30
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +10 -12
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts +14 -36
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts +14 -36
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs +14 -18
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +12 -12
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.d.cts +3 -15
- package/dist/runtime/services/secrets.service.d.mts +3 -15
- package/dist/runtime/services/secrets.service.mjs +12 -13
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/runtime/services/shared-identity.cjs +40 -0
- package/dist/runtime/services/shared-identity.cjs.map +1 -0
- package/dist/runtime/services/shared-identity.mjs +38 -0
- package/dist/runtime/services/shared-identity.mjs.map +1 -0
- package/dist/runtime/validation.cjs +2 -2
- package/dist/runtime/validation.cjs.map +1 -1
- package/dist/runtime/validation.mjs +2 -2
- package/dist/runtime/validation.mjs.map +1 -1
- package/dist/shared-deps-spec.cjs +384 -0
- package/dist/shared-deps-spec.cjs.map +1 -0
- package/dist/shared-deps-spec.d.cts +182 -0
- package/dist/shared-deps-spec.d.cts.map +1 -0
- package/dist/shared-deps-spec.d.mts +182 -0
- package/dist/shared-deps-spec.d.mts.map +1 -0
- package/dist/shared-deps-spec.mjs +368 -0
- package/dist/shared-deps-spec.mjs.map +1 -0
- package/dist/types.d.cts +22 -41
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +22 -41
- package/dist/types.d.mts.map +1 -1
- package/dist/ui/manifest/construct.cjs +268 -0
- package/dist/ui/manifest/construct.cjs.map +1 -0
- package/dist/ui/manifest/construct.d.cts +48 -0
- package/dist/ui/manifest/construct.d.cts.map +1 -0
- package/dist/ui/manifest/construct.d.mts +48 -0
- package/dist/ui/manifest/construct.d.mts.map +1 -0
- package/dist/ui/manifest/construct.mjs +268 -0
- package/dist/ui/manifest/construct.mjs.map +1 -0
- package/dist/ui/manifest/contract.cjs +34 -0
- package/dist/ui/manifest/contract.cjs.map +1 -0
- package/dist/ui/manifest/contract.d.cts +26 -0
- package/dist/ui/manifest/contract.d.cts.map +1 -0
- package/dist/ui/manifest/contract.d.mts +26 -0
- package/dist/ui/manifest/contract.d.mts.map +1 -0
- package/dist/ui/manifest/contract.mjs +26 -0
- package/dist/ui/manifest/contract.mjs.map +1 -0
- package/dist/ui/manifest/descriptor.cjs +64 -0
- package/dist/ui/manifest/descriptor.cjs.map +1 -0
- package/dist/ui/manifest/descriptor.d.cts +60 -0
- package/dist/ui/manifest/descriptor.d.cts.map +1 -0
- package/dist/ui/manifest/descriptor.d.mts +60 -0
- package/dist/ui/manifest/descriptor.d.mts.map +1 -0
- package/dist/ui/manifest/descriptor.mjs +61 -0
- package/dist/ui/manifest/descriptor.mjs.map +1 -0
- package/dist/ui/manifest/generator.cjs +128 -0
- package/dist/ui/manifest/generator.cjs.map +1 -0
- package/dist/ui/manifest/generator.d.cts +41 -0
- package/dist/ui/manifest/generator.d.cts.map +1 -0
- package/dist/ui/manifest/generator.d.mts +41 -0
- package/dist/ui/manifest/generator.d.mts.map +1 -0
- package/dist/ui/manifest/generator.mjs +125 -0
- package/dist/ui/manifest/generator.mjs.map +1 -0
- package/dist/ui/manifest/index.cjs +35 -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 +9 -0
- package/dist/ui/manifest/manifest-schema.cjs +97 -0
- package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.cts +132 -0
- package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.mts +132 -0
- package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
- package/dist/ui/manifest/manifest-schema.mjs +90 -0
- package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
- package/dist/ui/manifest/mount-registry.cjs +52 -0
- package/dist/ui/manifest/mount-registry.cjs.map +1 -0
- package/dist/ui/manifest/mount-registry.d.cts +61 -0
- package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
- package/dist/ui/manifest/mount-registry.d.mts +61 -0
- package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
- package/dist/ui/manifest/mount-registry.mjs +48 -0
- package/dist/ui/manifest/mount-registry.mjs.map +1 -0
- package/dist/ui/manifest/nav.cjs +13 -0
- package/dist/ui/manifest/nav.cjs.map +1 -0
- package/dist/ui/manifest/nav.d.cts +34 -0
- package/dist/ui/manifest/nav.d.cts.map +1 -0
- package/dist/ui/manifest/nav.d.mts +34 -0
- package/dist/ui/manifest/nav.d.mts.map +1 -0
- package/dist/ui/manifest/nav.mjs +13 -0
- package/dist/ui/manifest/nav.mjs.map +1 -0
- package/dist/ui/manifest/route-config.cjs +33 -0
- package/dist/ui/manifest/route-config.cjs.map +1 -0
- package/dist/ui/manifest/route-config.d.cts +40 -0
- package/dist/ui/manifest/route-config.d.cts.map +1 -0
- package/dist/ui/manifest/route-config.d.mts +40 -0
- package/dist/ui/manifest/route-config.d.mts.map +1 -0
- package/dist/ui/manifest/route-config.mjs +33 -0
- package/dist/ui/manifest/route-config.mjs.map +1 -0
- package/dist/version-manifest.cjs +65 -0
- package/dist/version-manifest.cjs.map +1 -0
- package/dist/version-manifest.d.cts +52 -0
- package/dist/version-manifest.d.cts.map +1 -0
- package/dist/version-manifest.d.mts +52 -0
- package/dist/version-manifest.d.mts.map +1 -0
- package/dist/version-manifest.mjs +63 -0
- package/dist/version-manifest.mjs.map +1 -0
- package/package.json +165 -68
- package/skills/plugin-client/SKILL.md +24 -5
- package/skills/plugin-development/SKILL.md +79 -47
- package/skills/plugin-testing/SKILL.md +41 -12
- package/src/build/artifact-names.ts +117 -0
- package/src/build/contract-types.ts +101 -0
- package/src/build/rspack/build-report-plugin.ts +34 -0
- package/src/build/rspack/chunk-completeness-plugin.ts +57 -0
- package/src/build/rspack/compose.ts +87 -0
- package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
- package/src/build/rspack/generated-config.ts +35 -0
- package/src/build/rspack/index.ts +10 -5
- package/src/build/rspack/module-federation.ts +1 -1
- package/src/build/rspack/plugin.ts +103 -105
- package/src/build/rspack/utils.ts +8 -2
- package/src/build/ui/factory.ts +96 -0
- package/src/build/ui/generated-config.ts +133 -0
- package/src/build/ui/hash-artifacts-plugin.ts +79 -0
- package/src/build/ui/index.ts +98 -0
- package/src/build/ui/manifest-plugin.ts +54 -0
- package/src/build/ui/rsbuild-config.ts +256 -0
- package/src/build/ui/stubs.ts +103 -0
- package/src/cli.ts +100 -0
- package/src/dev/serve.ts +477 -0
- package/src/dev/watch-kill.ts +58 -0
- package/src/effect-helpers.ts +25 -0
- package/src/errors.ts +16 -18
- package/src/identity.ts +36 -0
- package/src/index.ts +4 -0
- package/src/plugin.ts +70 -92
- package/src/remote-entry.ts +171 -0
- package/src/runtime/errors.ts +186 -27
- package/src/runtime/index.ts +132 -43
- package/src/runtime/mf-config.ts +12 -107
- package/src/runtime/services/module-federation.service.ts +221 -117
- package/src/runtime/services/normalize.ts +1 -18
- package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
- package/src/runtime/services/plugin-loader.service.ts +239 -212
- package/src/runtime/services/plugin.service.ts +61 -43
- package/src/runtime/services/secrets.service.ts +20 -15
- package/src/runtime/services/shared-identity.ts +68 -0
- package/src/runtime/validation.ts +5 -7
- package/src/shared-deps-spec.ts +478 -0
- package/src/types.ts +22 -48
- package/src/ui/manifest/construct.ts +403 -0
- package/src/ui/manifest/contract.ts +33 -0
- package/src/ui/manifest/descriptor.ts +96 -0
- package/src/ui/manifest/generator.ts +238 -0
- package/src/ui/manifest/index.ts +55 -0
- package/src/ui/manifest/manifest-schema.ts +107 -0
- package/src/ui/manifest/mount-registry.ts +50 -0
- package/src/ui/manifest/nav.ts +43 -0
- package/src/ui/manifest/route-config.ts +82 -0
- package/src/version-manifest.ts +88 -0
- package/dist/build/rspack/dev-server-middleware.cjs +0 -248
- package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
- package/dist/build/rspack/dev-server-middleware.mjs +0 -247
- package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
- package/dist/build/shared-deps.cjs +0 -83
- package/dist/build/shared-deps.cjs.map +0 -1
- package/dist/build/shared-deps.d.cts +0 -67
- package/dist/build/shared-deps.d.cts.map +0 -1
- package/dist/build/shared-deps.d.mts +0 -67
- package/dist/build/shared-deps.d.mts.map +0 -1
- package/dist/build/shared-deps.mjs +0 -79
- package/dist/build/shared-deps.mjs.map +0 -1
- package/dist/effect.cjs +0 -9
- package/dist/effect.d.cts +0 -1
- package/dist/effect.d.mts +0 -1
- package/dist/effect.mjs +0 -3
- package/dist/orpc-openapi.cjs +0 -17
- package/dist/orpc-openapi.d.cts +0 -2
- package/dist/orpc-openapi.d.mts +0 -2
- package/dist/orpc-openapi.mjs +0 -5
- package/dist/orpc.cjs +0 -46
- package/dist/orpc.d.cts +0 -7
- package/dist/orpc.d.mts +0 -7
- package/dist/orpc.mjs +0 -11
- package/dist/package.cjs +0 -23
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -17
- package/dist/package.mjs.map +0 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
- package/dist/runtime/services/normalize.cjs.map +0 -1
- package/dist/runtime/services/normalize.d.cts.map +0 -1
- package/dist/runtime/services/normalize.d.mts.map +0 -1
- package/dist/runtime/services/normalize.mjs.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
- package/dist/runtime/services/secrets.service.d.cts.map +0 -1
- package/dist/runtime/services/secrets.service.d.mts.map +0 -1
- package/dist/testing/index.cjs +0 -57
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -54
- package/dist/testing/index.d.cts.map +0 -1
- package/dist/testing/index.d.mts +0 -54
- package/dist/testing/index.d.mts.map +0 -1
- package/dist/testing/index.mjs +0 -55
- package/dist/testing/index.mjs.map +0 -1
- package/dist/zod-core.cjs +0 -9
- package/dist/zod-core.d.cts +0 -1
- package/dist/zod-core.d.mts +0 -1
- package/dist/zod-core.mjs +0 -3
- package/dist/zod.cjs +0 -11
- package/dist/zod.d.cts +0 -2
- package/dist/zod.d.mts +0 -2
- package/dist/zod.mjs +0 -3
- package/src/build/rspack/dev-server-middleware.ts +0 -324
- package/src/build/shared-deps.ts +0 -102
- package/src/effect.ts +0 -1
- package/src/orpc-openapi.ts +0 -2
- package/src/orpc.ts +0 -9
- package/src/testing/index.ts +0 -87
- package/src/testing/mocks/module-federation.service.ts +0 -41
- package/src/zod-core.ts +0 -1
- package/src/zod.ts +0 -3
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin } from "./plugin.mjs";
|
|
2
|
+
import { Context, Scope } from "effect";
|
|
3
|
+
import { ContractedRouter, RouterClient } from "@orpc/server";
|
|
2
4
|
import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
|
|
3
|
-
import { Scope } from "effect";
|
|
4
|
-
import { Router, RouterClient } from "@orpc/server";
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Registry bindings interface - populated via module augmentation
|
|
@@ -19,7 +19,7 @@ interface RegisteredPlugins {}
|
|
|
19
19
|
/**
|
|
20
20
|
* Base type for any plugin instance.
|
|
21
21
|
*/
|
|
22
|
-
type AnyPlugin = Plugin<AnyContractRouter, AnySchema, AnySchema, AnySchema | undefined
|
|
22
|
+
type AnyPlugin = Plugin<AnyContractRouter, AnySchema, AnySchema, AnySchema | undefined>;
|
|
23
23
|
/**
|
|
24
24
|
* Loaded plugin constructor with binding information
|
|
25
25
|
*/
|
|
@@ -93,11 +93,20 @@ type PluginContext<T> = T extends {
|
|
|
93
93
|
* Extract router type from plugin binding
|
|
94
94
|
* Uses 'any' for context to support nested router compositions
|
|
95
95
|
*/
|
|
96
|
-
type PluginRouterType<T> =
|
|
96
|
+
type PluginRouterType<T> = ContractedRouter<PluginContract<T>, any>;
|
|
97
97
|
/**
|
|
98
98
|
* Extract client type from plugin binding
|
|
99
99
|
*/
|
|
100
100
|
type PluginClientType<T> = RouterClient<PluginRouterType<T>>;
|
|
101
|
+
/**
|
|
102
|
+
* Sibling plugin entry passed to `initialize` and `createRouter`.
|
|
103
|
+
* `client` creates a typed in-process client for the plugin's router;
|
|
104
|
+
* `router` is the raw implemented router for cross-plugin merging.
|
|
105
|
+
*/
|
|
106
|
+
type PluginServicesEntry<T = any> = {
|
|
107
|
+
client: (context?: PluginContextInput<T>) => PluginClientType<T>;
|
|
108
|
+
router: PluginRouterType<T>;
|
|
109
|
+
};
|
|
101
110
|
/**
|
|
102
111
|
* Extract plugin type from registered plugins by key
|
|
103
112
|
* @param K - The plugin key
|
|
@@ -110,11 +119,7 @@ type RegisteredPlugin<K extends keyof R, R = RegisteredPlugins> = R[K] extends {
|
|
|
110
119
|
variables: infer V extends AnySchema;
|
|
111
120
|
secrets: infer S extends AnySchema;
|
|
112
121
|
context: infer TRequestContext extends AnySchema | undefined;
|
|
113
|
-
} ? Plugin<C, V, S, TRequestContext
|
|
114
|
-
/**
|
|
115
|
-
* Extract plugin constructor type from registry entry
|
|
116
|
-
*/
|
|
117
|
-
type PluginConstructor<K extends keyof R, R = RegisteredPlugins> = RegisteredPlugin<K, R>;
|
|
122
|
+
} ? Plugin<C, V, S, TRequestContext> : never : never;
|
|
118
123
|
/**
|
|
119
124
|
* Extract context input type from plugin binding (for client creation)
|
|
120
125
|
*/
|
|
@@ -126,10 +131,6 @@ type PluginConfigInput<T> = {
|
|
|
126
131
|
variables: InferSchemaInput<PluginVariables<T>>;
|
|
127
132
|
secrets: InferSchemaInput<PluginSecrets<T>>;
|
|
128
133
|
};
|
|
129
|
-
/**
|
|
130
|
-
* Extract deps context type from plugin instance (used for initialization)
|
|
131
|
-
*/
|
|
132
|
-
type ContextOf<T extends AnyPlugin> = T extends Plugin<AnyContractRouter, AnySchema, AnySchema, AnySchema | undefined, infer TDeps> ? TDeps : never;
|
|
133
134
|
/**
|
|
134
135
|
* Plugin metadata for remote loading
|
|
135
136
|
*/
|
|
@@ -142,10 +143,6 @@ type PluginMetadata = {
|
|
|
142
143
|
* Runtime registry configuration supporting both module and remote entries
|
|
143
144
|
*/
|
|
144
145
|
type PluginRegistry = Record<string, PluginRegistryEntry>;
|
|
145
|
-
/**
|
|
146
|
-
* Legacy metadata-only registry (for backwards compatibility)
|
|
147
|
-
*/
|
|
148
|
-
type PluginMetadataRegistry = Record<string, PluginMetadata>;
|
|
149
146
|
/**
|
|
150
147
|
* Configuration for secrets injection.
|
|
151
148
|
* Secrets are hydrated into plugin configs using template replacement.
|
|
@@ -177,8 +174,13 @@ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
|
|
|
177
174
|
variables: InferSchemaOutput<T["configSchema"]["variables"]>;
|
|
178
175
|
secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
|
|
179
176
|
};
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Built Effect context from the plugin's initialize Layer. Provided to
|
|
179
|
+
* handlers as `effect/context` — `.effect()` handlers `yield* Tag`,
|
|
180
|
+
* plain handlers use `Context.get(context["effect/context"], Tag)`.
|
|
181
|
+
*/
|
|
182
|
+
readonly effectContext: Context.Context<any>;
|
|
183
|
+
readonly scope: Scope.Closeable;
|
|
182
184
|
}
|
|
183
185
|
/**
|
|
184
186
|
* Helper type to detect type errors when looking up RegisteredPlugins
|
|
@@ -202,17 +204,6 @@ type UsePluginResult<K extends keyof R, R = RegisteredPlugins> = VerifyPluginBin
|
|
|
202
204
|
readonly metadata: PluginMetadata;
|
|
203
205
|
readonly initialized: InitializedPlugin<RegisteredPlugin<K, R>>;
|
|
204
206
|
} : VerifyPluginBinding<K, R>;
|
|
205
|
-
/**
|
|
206
|
-
* Runtime options
|
|
207
|
-
*/
|
|
208
|
-
interface RuntimeOptions {
|
|
209
|
-
isolation?: "strict" | "shared" | "none";
|
|
210
|
-
memoryLimit?: string;
|
|
211
|
-
concurrency?: number;
|
|
212
|
-
resourceTimeout?: string;
|
|
213
|
-
debug?: boolean;
|
|
214
|
-
metrics?: boolean;
|
|
215
|
-
}
|
|
216
207
|
/**
|
|
217
208
|
* Extract registry type from runtime instance or use type directly
|
|
218
209
|
* This allows EveryPlugin.Infer to work with both:
|
|
@@ -251,17 +242,7 @@ declare namespace EveryPlugin {
|
|
|
251
242
|
interface PluginRuntimeConfig<R extends Record<string, PluginRegistryEntry> = Record<string, PluginRegistryEntry>> {
|
|
252
243
|
registry: R;
|
|
253
244
|
secrets?: SecretsConfig;
|
|
254
|
-
options?: RuntimeOptions;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Legacy plugin runtime configuration (metadata-only registry)
|
|
258
|
-
* @deprecated Use PluginRuntimeConfig with module/remote entries instead
|
|
259
|
-
*/
|
|
260
|
-
interface LegacyPluginRuntimeConfig {
|
|
261
|
-
registry: PluginMetadataRegistry;
|
|
262
|
-
secrets?: SecretsConfig;
|
|
263
|
-
options?: RuntimeOptions;
|
|
264
245
|
}
|
|
265
246
|
//#endregion
|
|
266
|
-
export { AnyPlugin, AnyPluginConstructor,
|
|
247
|
+
export { AnyPlugin, AnyPluginConstructor, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContextInput, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginVariables, RegisteredPlugin, RegisteredPlugins, SecretsConfig, UsePluginResult };
|
|
267
248
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;;;;UAuBiB;;;;KAKL,YAAY,OAAO,mBAAmB,WAAW,WAAW;;;;KAK5D;UACF;EACR;IACE,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;;;;;;KAOD;EACN,QAAQ;EAAsB;EAAiB;EAAkB;;EACjE;EAAgB;EAAkB;;;;;KAK5B,kBAAkB,KAAK;EAAY,cAAc;IAAM;;;;KAKvD,yBAAyB,UAAU,eAAe,2BAC3D,WAAW,IAAI,EAAE;EAAa,cAAc;IACzC,IACA,gBAAgB,oBACd,kBAAkB;;;;KAOd,eAAe,KAAK;EAC9B;IAAW,gBAAgB,UAAU;;IAEnC;;;;KAMQ,gBAAgB,KAAK;EAAY;IAAW,iBAAiB,UAAU;;IAC/E;;;;KAMQ,cAAc,KAAK;EAAY;IAAW,eAAe,UAAU;;IAC3E;;;;KAMQ,cAAc,KAAK;EAC7B;IAAW,eAAe,UAAU;;IAElC;;;;;KAOQ,iBAAiB,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;;;;UAuBiB;;;;KAKL,YAAY,OAAO,mBAAmB,WAAW,WAAW;;;;KAK5D;UACF;EACR;IACE,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;;;;;;KAOD;EACN,QAAQ;EAAsB;EAAiB;EAAkB;;EACjE;EAAgB;EAAkB;;;;;KAK5B,kBAAkB,KAAK;EAAY,cAAc;IAAM;;;;KAKvD,yBAAyB,UAAU,eAAe,2BAC3D,WAAW,IAAI,EAAE;EAAa,cAAc;IACzC,IACA,gBAAgB,oBACd,kBAAkB;;;;KAOd,eAAe,KAAK;EAC9B;IAAW,gBAAgB,UAAU;;IAEnC;;;;KAMQ,gBAAgB,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iB,EAAE;WAC3B,UAAU;WACV,aAAa,kBAAkB,iBAAiB,GAAG;IAE9D,oBAAoB,GAAG;;;;;;;KAQxB,WAAW,KAAK;EAAY,uBAAuB;IAAM,IAAI;;;;kBAKjD;;;;;;;;;;;;;;;;;;OAkBH,MACV,kBACA,SAAS,qBACP,gBAAgB,WAAW,UAAU,gBAAgB,GAAG,WAAW;;;;;UAMxD,oBACf,UAAU,eAAe,uBAAuB,eAAe;EAE/D,UAAU;EACV,UAAU"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
const require_mount_registry = require('./mount-registry.cjs');
|
|
2
|
+
const require_descriptor = require('./descriptor.cjs');
|
|
3
|
+
const require_nav = require('./nav.cjs');
|
|
4
|
+
const require_route_config = require('./route-config.cjs');
|
|
5
|
+
let _tanstack_react_router = require("@tanstack/react-router");
|
|
6
|
+
|
|
7
|
+
//#region src/ui/manifest/construct.ts
|
|
8
|
+
/**
|
|
9
|
+
* Host-side route-graph construction (ADR 0008 §1): manifests + route
|
|
10
|
+
* configs in → host-built tree out. The host constructs ITS OWN Route
|
|
11
|
+
* objects from validated manifest data via public `createRoute` APIs; no
|
|
12
|
+
* foreign route object is ever mutated. Gates are attached HOST-side from
|
|
13
|
+
* the mount registry — plugins cannot ship a route that escapes its
|
|
14
|
+
* mount's gate because plugins never construct route objects.
|
|
15
|
+
*
|
|
16
|
+
* Mounts are the ONLY cross-source parenting points: a root-level
|
|
17
|
+
* pathless layout file (`_public.tsx`) declares the mount for the whole
|
|
18
|
+
* composition (exactly one declaring source per mount); every other
|
|
19
|
+
* source's routes live under the same `_mount/` directory prefix and
|
|
20
|
+
* parent onto the shared mount route. This module executes inside the
|
|
21
|
+
* core ui's module graph (production MF expose `./compose`, dev source
|
|
22
|
+
* import) so constructed routes are minted by the same react/router
|
|
23
|
+
* instance that renders them.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* TanStack's Route generics are intentionally invariant — routes built from
|
|
27
|
+
* manifest data can't satisfy them structurally. One named boundary for
|
|
28
|
+
* handing a constructed route to the tree-building APIs.
|
|
29
|
+
*/
|
|
30
|
+
function toAnyRoute(route) {
|
|
31
|
+
return route;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gate redirects are absolute: gates attach to root-level mount routes, and
|
|
35
|
+
* relatives would silently shift if a mount ever moved deeper in the tree.
|
|
36
|
+
* The login surface is plugin-owned, never core-known.
|
|
37
|
+
*/
|
|
38
|
+
const LOGIN_TO = "/login";
|
|
39
|
+
const HOME_TO = "/";
|
|
40
|
+
/**
|
|
41
|
+
* Gate implementations by mount gate kind. Only `session` and `admin` are
|
|
42
|
+
* implemented (ADR 0008 §3); unimplemented mounts are rejected during mount
|
|
43
|
+
* declaration before any gate lookup, and gates are optional by type — a
|
|
44
|
+
* mount without an entry (or `none`) renders ungated.
|
|
45
|
+
*/
|
|
46
|
+
const GATES = {
|
|
47
|
+
session: ({ context, location }) => {
|
|
48
|
+
if (!userOf(context)) throw (0, _tanstack_react_router.redirect)({
|
|
49
|
+
to: LOGIN_TO,
|
|
50
|
+
search: { redirect: location.pathname + location.searchStr }
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
admin: ({ context }) => {
|
|
54
|
+
const user = userOf(context);
|
|
55
|
+
if (!user) throw (0, _tanstack_react_router.redirect)({ to: LOGIN_TO });
|
|
56
|
+
if (user.role !== "admin") throw (0, _tanstack_react_router.redirect)({ to: HOME_TO });
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const userOf = (context) => context?.user ?? context?.session?.user;
|
|
60
|
+
function joinPath(a, b) {
|
|
61
|
+
const left = a && a !== "/" ? a.replace(/\/+$/, "") : "";
|
|
62
|
+
const right = b && b !== "/" ? b.replace(/^\/+/, "") : "";
|
|
63
|
+
if (!left) return right ? `/${right}` : "/";
|
|
64
|
+
if (!right) return left;
|
|
65
|
+
return `${left}/${right}`;
|
|
66
|
+
}
|
|
67
|
+
const navOf = (options) => {
|
|
68
|
+
const nav = options.staticData?.nav;
|
|
69
|
+
if (nav && typeof nav === "object" && typeof nav.label === "string") return nav;
|
|
70
|
+
};
|
|
71
|
+
/** Layout routes (mount or pathless) pass their authored options through,
|
|
72
|
+
* like every other route kind. On mount routes the registry gate composes
|
|
73
|
+
* BEFORE the declaration's own beforeLoad so a source can never escape its
|
|
74
|
+
* mount's gate (ADR 0008 §3), while the declaration's return value still
|
|
75
|
+
* flows to children as route context. */
|
|
76
|
+
function layoutBeforeLoad(gate, declared) {
|
|
77
|
+
if (!gate) return declared;
|
|
78
|
+
return (args) => {
|
|
79
|
+
gate(args);
|
|
80
|
+
return declared?.(args);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const AUTHORED_OPTION_KEYS = require_route_config.ROUTE_OPTION_KEYS.filter((key) => key !== "beforeLoad" && key !== "component");
|
|
84
|
+
function authoredOptions(options) {
|
|
85
|
+
const authored = {};
|
|
86
|
+
for (const key of AUTHORED_OPTION_KEYS) if (options[key] !== void 0) authored[key] = options[key];
|
|
87
|
+
return authored;
|
|
88
|
+
}
|
|
89
|
+
function rootAuthoredOptions(options) {
|
|
90
|
+
const { params: _params, ...authored } = authoredOptions(options);
|
|
91
|
+
return authored;
|
|
92
|
+
}
|
|
93
|
+
async function constructTree(input) {
|
|
94
|
+
const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));
|
|
95
|
+
const resolved = [];
|
|
96
|
+
for (const ref of refs) resolved.push(await input.resolve(ref));
|
|
97
|
+
const optionsByPlugin = /* @__PURE__ */ new Map();
|
|
98
|
+
for (const plugin of resolved) {
|
|
99
|
+
const optionsById = /* @__PURE__ */ new Map();
|
|
100
|
+
await Promise.all(plugin.manifest.routes.map(async (record) => {
|
|
101
|
+
const loader = plugin.routeConfig.routeConfigLoaders[record.id];
|
|
102
|
+
if (!loader) throw new Error(`routeConfig for "${plugin.key}" has no loader for route "${record.id}"`);
|
|
103
|
+
optionsById.set(record.id, await loader());
|
|
104
|
+
}));
|
|
105
|
+
optionsByPlugin.set(plugin.key, optionsById);
|
|
106
|
+
}
|
|
107
|
+
const declarations = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const plugin of resolved) for (const record of plugin.manifest.routes) {
|
|
109
|
+
if (!record.mount) continue;
|
|
110
|
+
const mountId = record.mount;
|
|
111
|
+
if (!require_mount_registry.MOUNT_REGISTRY[mountId].implemented) throw new Error(`mount "${record.mount}" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by "${plugin.key}"`);
|
|
112
|
+
const existing = declarations.get(mountId);
|
|
113
|
+
if (existing) throw new Error(`mount "${mountId}" declared by multiple sources: "${existing.key}" (${existing.record.file}) and "${plugin.key}" (${record.file})`);
|
|
114
|
+
declarations.set(mountId, {
|
|
115
|
+
key: plugin.key,
|
|
116
|
+
record,
|
|
117
|
+
options: optionsByPlugin.get(plugin.key).get(record.id)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const rootRoute = toAnyRoute((0, _tanstack_react_router.createRootRoute)({
|
|
121
|
+
...input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {},
|
|
122
|
+
component: input.rootOptions?.component ?? _tanstack_react_router.Outlet,
|
|
123
|
+
...input.rootOptions?.beforeLoad ? { beforeLoad: input.rootOptions.beforeLoad } : {}
|
|
124
|
+
}));
|
|
125
|
+
const mountRoutes = /* @__PURE__ */ new Map();
|
|
126
|
+
for (const mountId of Object.keys(require_mount_registry.MOUNT_REGISTRY)) {
|
|
127
|
+
const declaration = declarations.get(mountId);
|
|
128
|
+
if (!declaration) continue;
|
|
129
|
+
const def = require_mount_registry.MOUNT_REGISTRY[mountId];
|
|
130
|
+
const gate = GATES[def.gate];
|
|
131
|
+
const options = declaration.options;
|
|
132
|
+
const route = (0, _tanstack_react_router.createRoute)({
|
|
133
|
+
id: `__mount_${mountId}`,
|
|
134
|
+
getParentRoute: () => rootRoute,
|
|
135
|
+
...gate || options.beforeLoad ? { beforeLoad: layoutBeforeLoad(gate, options.beforeLoad) } : {},
|
|
136
|
+
...authoredOptions(options),
|
|
137
|
+
component: options.component ?? _tanstack_react_router.Outlet
|
|
138
|
+
});
|
|
139
|
+
mountRoutes.set(mountId, toAnyRoute(route));
|
|
140
|
+
}
|
|
141
|
+
const mountByLayoutId = /* @__PURE__ */ new Map();
|
|
142
|
+
for (const [mountId, declaration] of declarations) mountByLayoutId.set(declaration.record.id, mountId);
|
|
143
|
+
const nav = [];
|
|
144
|
+
const mountCounts = {};
|
|
145
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
146
|
+
/** cross-plugin path-collision guard: claimed paths per parent route */
|
|
147
|
+
const claimedPathsByParent = /* @__PURE__ */ new Map();
|
|
148
|
+
const attach = (parent, child) => {
|
|
149
|
+
const list = childrenByParent.get(parent) ?? [];
|
|
150
|
+
list.push(child);
|
|
151
|
+
childrenByParent.set(parent, list);
|
|
152
|
+
};
|
|
153
|
+
for (const plugin of resolved) {
|
|
154
|
+
const optionsById = optionsByPlugin.get(plugin.key);
|
|
155
|
+
const fullPathById = /* @__PURE__ */ new Map();
|
|
156
|
+
const mountById = /* @__PURE__ */ new Map();
|
|
157
|
+
const byId = /* @__PURE__ */ new Map();
|
|
158
|
+
const parentFor = (record) => {
|
|
159
|
+
if (record.parentId) {
|
|
160
|
+
const local = byId.get(record.parentId);
|
|
161
|
+
if (local) return {
|
|
162
|
+
route: local.route,
|
|
163
|
+
fullPath: fullPathById.get(record.parentId),
|
|
164
|
+
mount: mountById.get(record.parentId)
|
|
165
|
+
};
|
|
166
|
+
const mount = mountByLayoutId.get(record.parentId);
|
|
167
|
+
if (mount) return {
|
|
168
|
+
route: mountRoutes.get(mount),
|
|
169
|
+
fullPath: "",
|
|
170
|
+
mount
|
|
171
|
+
};
|
|
172
|
+
throw new Error(`unresolvable parent "${record.parentId}" for "${record.id}" in "${plugin.key}" — mounts are the only cross-source parenting points`);
|
|
173
|
+
}
|
|
174
|
+
const firstSegment = record.id.split("/")[0] ?? "";
|
|
175
|
+
if (firstSegment.startsWith("_")) {
|
|
176
|
+
const mount = require_mount_registry.resolveMountSegment(firstSegment.slice(1));
|
|
177
|
+
if (mount && mountRoutes.has(mount)) return {
|
|
178
|
+
route: mountRoutes.get(mount),
|
|
179
|
+
fullPath: "",
|
|
180
|
+
mount
|
|
181
|
+
};
|
|
182
|
+
if (mount) throw new Error(`mount "${mount}" is not declared by any source (route "${record.id}" in "${plugin.key}")`);
|
|
183
|
+
throw new Error(`unknown mount "_${firstSegment.slice(1)}" (route "${record.id}" in "${plugin.key}")`);
|
|
184
|
+
}
|
|
185
|
+
throw new Error(`route "${record.id}" in "${plugin.key}" must live under a mount`);
|
|
186
|
+
};
|
|
187
|
+
const pending = plugin.manifest.routes.filter((record) => !record.mount);
|
|
188
|
+
let progressed = true;
|
|
189
|
+
while (pending.length > 0 && progressed) {
|
|
190
|
+
progressed = false;
|
|
191
|
+
for (let i = 0; i < pending.length; i += 1) {
|
|
192
|
+
const record = pending[i];
|
|
193
|
+
if (record.parentId && !byId.has(record.parentId) && !mountByLayoutId.has(record.parentId)) continue;
|
|
194
|
+
pending.splice(i, 1);
|
|
195
|
+
progressed = true;
|
|
196
|
+
const options = optionsById.get(record.id);
|
|
197
|
+
const parent = parentFor(record);
|
|
198
|
+
const routePath = record.path;
|
|
199
|
+
const isLayoutRoute = record.type === "layout" || routePath === void 0;
|
|
200
|
+
if (!isLayoutRoute) {
|
|
201
|
+
const siblings = claimedPathsByParent.get(parent.route) ?? /* @__PURE__ */ new Map();
|
|
202
|
+
const claimant = siblings.get(routePath);
|
|
203
|
+
if (claimant) throw new Error(`path collision: "${plugin.key}" route "${record.id}" declares "${routePath}" which is already claimed by "${claimant}" under the same parent`);
|
|
204
|
+
siblings.set(routePath, `${plugin.key}:${record.id}`);
|
|
205
|
+
claimedPathsByParent.set(parent.route, siblings);
|
|
206
|
+
}
|
|
207
|
+
const fullPath = joinPath(parent.fullPath, routePath);
|
|
208
|
+
let route;
|
|
209
|
+
if (isLayoutRoute) route = (0, _tanstack_react_router.createRoute)({
|
|
210
|
+
id: `${plugin.key}__${record.id}`,
|
|
211
|
+
getParentRoute: () => parent.route,
|
|
212
|
+
...authoredOptions(options),
|
|
213
|
+
...options.beforeLoad ? { beforeLoad: options.beforeLoad } : {},
|
|
214
|
+
component: options.component ?? _tanstack_react_router.Outlet
|
|
215
|
+
});
|
|
216
|
+
else route = (0, _tanstack_react_router.createRoute)({
|
|
217
|
+
path: routePath,
|
|
218
|
+
getParentRoute: () => parent.route,
|
|
219
|
+
...authoredOptions(options),
|
|
220
|
+
...options.beforeLoad ? { beforeLoad: options.beforeLoad } : {},
|
|
221
|
+
component: options.component ?? _tanstack_react_router.Outlet
|
|
222
|
+
});
|
|
223
|
+
byId.set(record.id, {
|
|
224
|
+
record,
|
|
225
|
+
route: toAnyRoute(route)
|
|
226
|
+
});
|
|
227
|
+
fullPathById.set(record.id, fullPath);
|
|
228
|
+
mountById.set(record.id, parent.mount);
|
|
229
|
+
attach(parent.route, toAnyRoute(route));
|
|
230
|
+
mountCounts[parent.mount] = (mountCounts[parent.mount] ?? 0) + 1;
|
|
231
|
+
const navDeclaration = navOf(options);
|
|
232
|
+
if (navDeclaration && navDeclaration.hidden !== true) nav.push({
|
|
233
|
+
id: `${plugin.key}:${record.id}`,
|
|
234
|
+
label: navDeclaration.label,
|
|
235
|
+
...typeof navDeclaration.icon === "string" ? { icon: navDeclaration.icon } : {},
|
|
236
|
+
...typeof navDeclaration.group === "string" ? { group: navDeclaration.group } : {},
|
|
237
|
+
...typeof navDeclaration.order === "number" ? { order: navDeclaration.order } : {},
|
|
238
|
+
to: navDeclaration.to ?? fullPath,
|
|
239
|
+
plugin: plugin.key,
|
|
240
|
+
mount: parent.mount
|
|
241
|
+
});
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (pending.length > 0) throw new Error(`unresolvable parentage in "${plugin.key}": ${pending.map((record) => record.id).join(", ")}`);
|
|
246
|
+
}
|
|
247
|
+
for (const [parent, children] of childrenByParent) parent.addChildren(children);
|
|
248
|
+
rootRoute.addChildren([...mountRoutes.values()]);
|
|
249
|
+
nav.sort(require_nav.compareNavItems);
|
|
250
|
+
return {
|
|
251
|
+
rootRoute,
|
|
252
|
+
routeTree: rootRoute,
|
|
253
|
+
digest: await require_descriptor.digestOf({
|
|
254
|
+
plugins: refs.map((ref) => ({
|
|
255
|
+
key: ref.key,
|
|
256
|
+
mfName: ref.mfName
|
|
257
|
+
})),
|
|
258
|
+
manifests: resolved.map((plugin) => plugin.manifest)
|
|
259
|
+
}),
|
|
260
|
+
manifests: resolved.map((plugin) => plugin.manifest),
|
|
261
|
+
nav: { items: nav },
|
|
262
|
+
mountCounts
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
//#endregion
|
|
267
|
+
exports.constructTree = constructTree;
|
|
268
|
+
//# sourceMappingURL=construct.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct.cjs","names":["redirect","ROUTE_OPTION_KEYS","MOUNT_REGISTRY","createRootRoute","Outlet","createRoute","resolveMountSegment","compareNavItems","digestOf"],"sources":["../../../src/ui/manifest/construct.ts"],"sourcesContent":["import type { AnyRoute } from \"@tanstack/react-router\";\nimport { createRootRoute, createRoute, Outlet, redirect } from \"@tanstack/react-router\";\nimport { digestOf } from \"./descriptor\";\nimport type { PluginManifest, RouteRecord } from \"./manifest-schema\";\nimport { MOUNT_REGISTRY, type MountDef, type MountId, resolveMountSegment } from \"./mount-registry\";\nimport { compareNavItems, type NavDeclaration, type NavItem, type NavManifest } from \"./nav\";\nimport { ROUTE_OPTION_KEYS, type RouteConfigModule, type RouteOptionsBundle } from \"./route-config\";\n\n/**\n * Host-side route-graph construction (ADR 0008 §1): manifests + route\n * configs in → host-built tree out. The host constructs ITS OWN Route\n * objects from validated manifest data via public `createRoute` APIs; no\n * foreign route object is ever mutated. Gates are attached HOST-side from\n * the mount registry — plugins cannot ship a route that escapes its\n * mount's gate because plugins never construct route objects.\n *\n * Mounts are the ONLY cross-source parenting points: a root-level\n * pathless layout file (`_public.tsx`) declares the mount for the whole\n * composition (exactly one declaring source per mount); every other\n * source's routes live under the same `_mount/` directory prefix and\n * parent onto the shared mount route. This module executes inside the\n * core ui's module graph (production MF expose `./compose`, dev source\n * import) so constructed routes are minted by the same react/router\n * instance that renders them.\n */\n\n/**\n * TanStack's Route generics are intentionally invariant — routes built from\n * manifest data can't satisfy them structurally. One named boundary for\n * handing a constructed route to the tree-building APIs.\n */\nfunction toAnyRoute(route: unknown): AnyRoute {\n return route as AnyRoute;\n}\n\nexport interface GateUser {\n id: string;\n name?: string;\n /** Better Auth user role — \"admin\" gates the admin mount. */\n role?: string;\n}\n\nexport interface HostContext {\n user?: GateUser;\n session?: { user?: GateUser };\n}\n\ntype GateFn = (args: {\n context: HostContext;\n location: { pathname: string; searchStr: string };\n}) => void;\n\n/**\n * Gate redirects are absolute: gates attach to root-level mount routes, and\n * relatives would silently shift if a mount ever moved deeper in the tree.\n * The login surface is plugin-owned, never core-known.\n */\nconst LOGIN_TO: string = \"/login\";\nconst HOME_TO: string = \"/\";\n\n/**\n * Gate implementations by mount gate kind. Only `session` and `admin` are\n * implemented (ADR 0008 §3); unimplemented mounts are rejected during mount\n * declaration before any gate lookup, and gates are optional by type — a\n * mount without an entry (or `none`) renders ungated.\n */\nconst GATES: Partial<Record<MountDef[\"gate\"], GateFn>> = {\n session: ({ context, location }) => {\n const user = userOf(context);\n if (!user) {\n throw redirect({\n to: LOGIN_TO,\n search: { redirect: location.pathname + location.searchStr } as never,\n });\n }\n },\n admin: ({ context }) => {\n const user = userOf(context);\n if (!user) throw redirect({ to: LOGIN_TO });\n if (user.role !== \"admin\") throw redirect({ to: HOME_TO });\n },\n};\n\nconst userOf = (context: HostContext | undefined): GateUser | undefined =>\n context?.user ?? context?.session?.user;\n\nexport interface ConstructPluginRef {\n /** composition identity — plugin key; participates in the digest */\n key: string;\n /** deployment identity — the MF container name loadRemote targets */\n mfName: string;\n}\n\nexport interface ResolvedPlugin {\n key: string;\n manifest: PluginManifest;\n routeConfig: RouteConfigModule;\n}\n\nexport interface ConstructInput {\n name: string;\n plugins: ReadonlyArray<ConstructPluginRef>;\n resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;\n /** core ui `__root` options — component/error/notFound + head baseline */\n rootOptions?: RouteOptionsBundle;\n}\n\nexport interface ConstructedTree {\n rootRoute: AnyRoute;\n routeTree: AnyRoute;\n digest: string;\n manifests: PluginManifest[];\n nav: NavManifest;\n /** constructed route count per mount id */\n mountCounts: Record<string, number>;\n}\n\ninterface MountDeclaration {\n key: string;\n record: RouteRecord;\n options: RouteOptionsBundle;\n}\n\nfunction joinPath(a: string | undefined, b: string | undefined): string {\n const left = a && a !== \"/\" ? a.replace(/\\/+$/, \"\") : \"\";\n const right = b && b !== \"/\" ? b.replace(/^\\/+/, \"\") : \"\";\n if (!left) return right ? `/${right}` : \"/\";\n if (!right) return left;\n return `${left}/${right}`;\n}\n\nconst navOf = (options: RouteOptionsBundle): NavDeclaration | undefined => {\n const nav = options.staticData?.nav;\n if (nav && typeof nav === \"object\" && typeof (nav as NavDeclaration).label === \"string\") {\n return nav as NavDeclaration;\n }\n return undefined;\n};\n\n/** Layout routes (mount or pathless) pass their authored options through,\n * like every other route kind. On mount routes the registry gate composes\n * BEFORE the declaration's own beforeLoad so a source can never escape its\n * mount's gate (ADR 0008 §3), while the declaration's return value still\n * flows to children as route context. */\nfunction layoutBeforeLoad(\n gate: GateFn | undefined,\n declared: RouteOptionsBundle[\"beforeLoad\"],\n): RouteOptionsBundle[\"beforeLoad\"] {\n if (!gate) return declared;\n return (args) => {\n gate(args);\n return declared?.(args);\n };\n}\n\nconst AUTHORED_OPTION_KEYS = ROUTE_OPTION_KEYS.filter(\n (key) => key !== \"beforeLoad\" && key !== \"component\",\n);\n\nfunction authoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const authored: Partial<Record<keyof RouteOptionsBundle, unknown>> = {};\n for (const key of AUTHORED_OPTION_KEYS) {\n if (options[key] !== undefined) authored[key] = options[key];\n }\n return authored as Partial<RouteOptionsBundle>;\n}\n\nfunction rootAuthoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const { params: _params, ...authored } = authoredOptions(options);\n return authored;\n}\n\nexport async function constructTree(input: ConstructInput): Promise<ConstructedTree> {\n const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));\n const resolved: ResolvedPlugin[] = [];\n for (const ref of refs) {\n resolved.push(await input.resolve(ref));\n }\n\n const optionsByPlugin = new Map<string, Map<string, RouteOptionsBundle>>();\n for (const plugin of resolved) {\n const optionsById = new Map<string, RouteOptionsBundle>();\n await Promise.all(\n plugin.manifest.routes.map(async (record) => {\n const loader = plugin.routeConfig.routeConfigLoaders[record.id];\n if (!loader) {\n throw new Error(`routeConfig for \"${plugin.key}\" has no loader for route \"${record.id}\"`);\n }\n optionsById.set(record.id, await loader());\n }),\n );\n optionsByPlugin.set(plugin.key, optionsById);\n }\n\n const declarations = new Map<MountId, MountDeclaration>();\n for (const plugin of resolved) {\n for (const record of plugin.manifest.routes) {\n if (!record.mount) continue;\n const mountId = record.mount as MountId;\n const def = MOUNT_REGISTRY[mountId];\n if (!def.implemented) {\n throw new Error(\n `mount \"${record.mount}\" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by \"${plugin.key}\"`,\n );\n }\n const existing = declarations.get(mountId);\n if (existing) {\n throw new Error(\n `mount \"${mountId}\" declared by multiple sources: \"${existing.key}\" (${existing.record.file}) and \"${plugin.key}\" (${record.file})`,\n );\n }\n declarations.set(mountId, {\n key: plugin.key,\n record,\n options: optionsByPlugin.get(plugin.key)!.get(record.id)!,\n });\n }\n }\n\n const rootRoute = toAnyRoute(\n createRootRoute({\n ...(input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {}),\n component: input.rootOptions?.component ?? Outlet,\n ...(input.rootOptions?.beforeLoad ? { beforeLoad: input.rootOptions.beforeLoad } : {}),\n }),\n );\n\n const mountRoutes = new Map<MountId, AnyRoute>();\n for (const mountId of Object.keys(MOUNT_REGISTRY) as MountId[]) {\n const declaration = declarations.get(mountId);\n if (!declaration) continue;\n const def = MOUNT_REGISTRY[mountId]!;\n const gate = GATES[def.gate];\n const options = declaration.options;\n const route = createRoute({\n id: `__mount_${mountId}`,\n getParentRoute: () => rootRoute,\n ...(gate || options.beforeLoad\n ? { beforeLoad: layoutBeforeLoad(gate, options.beforeLoad) }\n : {}),\n ...authoredOptions(options),\n component: options.component ?? Outlet,\n });\n mountRoutes.set(mountId, toAnyRoute(route));\n }\n\n const mountByLayoutId = new Map<string, MountId>();\n for (const [mountId, declaration] of declarations) {\n mountByLayoutId.set(declaration.record.id, mountId);\n }\n\n const nav: NavItem[] = [];\n const mountCounts: Record<string, number> = {};\n const childrenByParent = new Map<AnyRoute, AnyRoute[]>();\n /** cross-plugin path-collision guard: claimed paths per parent route */\n const claimedPathsByParent = new Map<AnyRoute, Map<string, string>>();\n const attach = (parent: AnyRoute, child: AnyRoute) => {\n const list = childrenByParent.get(parent) ?? [];\n list.push(child);\n childrenByParent.set(parent, list);\n };\n\n for (const plugin of resolved) {\n const optionsById = optionsByPlugin.get(plugin.key)!;\n const fullPathById = new Map<string, string>();\n const mountById = new Map<string, MountId>();\n const byId = new Map<string, { record: RouteRecord; route: AnyRoute }>();\n\n const parentFor = (\n record: RouteRecord,\n ): { route: AnyRoute; fullPath: string; mount: MountId } => {\n if (record.parentId) {\n const local = byId.get(record.parentId);\n if (local) {\n return {\n route: local.route,\n fullPath: fullPathById.get(record.parentId)!,\n mount: mountById.get(record.parentId)!,\n };\n }\n const mount = mountByLayoutId.get(record.parentId);\n if (mount) return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n throw new Error(\n `unresolvable parent \"${record.parentId}\" for \"${record.id}\" in \"${plugin.key}\" — mounts are the only cross-source parenting points`,\n );\n }\n const firstSegment = record.id.split(\"/\")[0] ?? \"\";\n if (firstSegment.startsWith(\"_\")) {\n const mount = resolveMountSegment(firstSegment.slice(1));\n if (mount && mountRoutes.has(mount))\n return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n if (mount) {\n throw new Error(\n `mount \"${mount}\" is not declared by any source (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(\n `unknown mount \"_${firstSegment.slice(1)}\" (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(`route \"${record.id}\" in \"${plugin.key}\" must live under a mount`);\n };\n\n const pending = plugin.manifest.routes.filter((record) => !record.mount);\n let progressed = true;\n while (pending.length > 0 && progressed) {\n progressed = false;\n for (let i = 0; i < pending.length; i += 1) {\n const record = pending[i]!;\n if (\n record.parentId &&\n !byId.has(record.parentId) &&\n !mountByLayoutId.has(record.parentId)\n ) {\n continue;\n }\n pending.splice(i, 1);\n progressed = true;\n\n const options = optionsById.get(record.id)!;\n const parent = parentFor(record);\n const routePath = record.path;\n const isLayoutRoute = record.type === \"layout\" || routePath === undefined;\n if (!isLayoutRoute) {\n const siblings = claimedPathsByParent.get(parent.route) ?? new Map<string, string>();\n const claimant = siblings.get(routePath);\n if (claimant) {\n throw new Error(\n `path collision: \"${plugin.key}\" route \"${record.id}\" declares \"${routePath}\" which is already claimed by \"${claimant}\" under the same parent`,\n );\n }\n siblings.set(routePath, `${plugin.key}:${record.id}`);\n claimedPathsByParent.set(parent.route, siblings);\n }\n const fullPath = joinPath(parent.fullPath, routePath);\n let route: AnyRoute;\n if (isLayoutRoute) {\n route = createRoute({\n id: `${plugin.key}__${record.id}`,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n } else {\n route = createRoute({\n path: routePath,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n }\n\n byId.set(record.id, { record, route: toAnyRoute(route) });\n fullPathById.set(record.id, fullPath);\n mountById.set(record.id, parent.mount);\n attach(parent.route, toAnyRoute(route));\n mountCounts[parent.mount] = (mountCounts[parent.mount] ?? 0) + 1;\n\n const navDeclaration = navOf(options);\n if (navDeclaration && navDeclaration.hidden !== true) {\n nav.push({\n id: `${plugin.key}:${record.id}`,\n label: navDeclaration.label,\n ...(typeof navDeclaration.icon === \"string\" ? { icon: navDeclaration.icon } : {}),\n ...(typeof navDeclaration.group === \"string\" ? { group: navDeclaration.group } : {}),\n ...(typeof navDeclaration.order === \"number\" ? { order: navDeclaration.order } : {}),\n to: navDeclaration.to ?? fullPath,\n plugin: plugin.key,\n mount: parent.mount,\n });\n }\n break;\n }\n }\n if (pending.length > 0) {\n throw new Error(\n `unresolvable parentage in \"${plugin.key}\": ${pending.map((record) => record.id).join(\", \")}`,\n );\n }\n }\n\n for (const [parent, children] of childrenByParent) {\n (parent as { addChildren: (children: AnyRoute[]) => void }).addChildren(children);\n }\n rootRoute.addChildren([...mountRoutes.values()] as AnyRoute[]);\n nav.sort(compareNavItems);\n\n const digest = await digestOf({\n plugins: refs.map((ref) => ({ key: ref.key, mfName: ref.mfName })),\n manifests: resolved.map((plugin) => plugin.manifest),\n });\n\n return {\n rootRoute,\n routeTree: rootRoute,\n digest,\n manifests: resolved.map((plugin) => plugin.manifest),\n nav: { items: nav },\n mountCounts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAS,WAAW,OAA0B;CAC5C,OAAO;AACT;;;;;;AAwBA,MAAM,WAAmB;AACzB,MAAM,UAAkB;;;;;;;AAQxB,MAAM,QAAmD;CACvD,UAAU,EAAE,SAAS,eAAe;EAElC,IAAI,CADS,OAAO,OACZ,GACN,UAAMA,iCAAS;GACb,IAAI;GACJ,QAAQ,EAAE,UAAU,SAAS,WAAW,SAAS,UAAU;EAC7D,CAAC;CAEL;CACA,QAAQ,EAAE,cAAc;EACtB,MAAM,OAAO,OAAO,OAAO;EAC3B,IAA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;KAC5B,OAAO,eAAe;KACtB,GAAI,OAAO,eAAe,SAAS,WAAW,EAAE,MAAM,eAAe,KAAK,IAAI,CAAC;KAC/E,GAAI,OAAO,eAAe,UAAU,WAAW,EAAE,OAAO,eAAe,MAAM,IAAI,CAAC;KAClF,GAAI,OAAO,eAAe,UAAU,WAAW,EAAE,OAAO,eAAe,MAAM,IAAI,CAAC;KAClF,IAAI,eAAe,MAAM;KACzB,QAAQ,OAAO;KACf,OAAO,OAAO;IAChB,CAAC;IAEH;GACF;EACF;EACA,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MACR,8BAA8B,OAAO,IAAI,KAAK,QAAQ,KAAK,WAAW,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,GAC5F;CAEJ;CAEA,KAAK,MAAM,CAAC,QAAQ,aAAa,kBAC/B,AAAC,OAA2D,YAAY,QAAQ;CAElF,UAAU,YAAY,CAAC,GAAG,YAAY,OAAO,CAAC,CAAe;CAC7D,IAAI,KAAKG,2BAAe;CAOxB,OAAO;EACL;EACA,WAAW;EACX,cARmBC,4BAAS;GAC5B,SAAS,KAAK,KAAK,SAAS;IAAE,KAAK,IAAI;IAAK,QAAQ,IAAI;GAAO,EAAE;GACjE,WAAW,SAAS,KAAK,WAAW,OAAO,QAAQ;EACrD,CAAC;EAMC,WAAW,SAAS,KAAK,WAAW,OAAO,QAAQ;EACnD,KAAK,EAAE,OAAO,IAAI;EAClB;CACF;AACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { PluginManifest } from "./manifest-schema.cjs";
|
|
2
|
+
import { NavManifest } from "./nav.cjs";
|
|
3
|
+
import { RouteConfigModule, RouteOptionsBundle } from "./route-config.cjs";
|
|
4
|
+
import { AnyRoute } from "@tanstack/react-router";
|
|
5
|
+
//#region src/ui/manifest/construct.d.ts
|
|
6
|
+
interface GateUser {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Better Auth user role — "admin" gates the admin mount. */
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
12
|
+
interface HostContext {
|
|
13
|
+
user?: GateUser;
|
|
14
|
+
session?: {
|
|
15
|
+
user?: GateUser;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface ConstructPluginRef {
|
|
19
|
+
/** composition identity — plugin key; participates in the digest */
|
|
20
|
+
key: string;
|
|
21
|
+
/** deployment identity — the MF container name loadRemote targets */
|
|
22
|
+
mfName: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResolvedPlugin {
|
|
25
|
+
key: string;
|
|
26
|
+
manifest: PluginManifest;
|
|
27
|
+
routeConfig: RouteConfigModule;
|
|
28
|
+
}
|
|
29
|
+
interface ConstructInput {
|
|
30
|
+
name: string;
|
|
31
|
+
plugins: ReadonlyArray<ConstructPluginRef>;
|
|
32
|
+
resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;
|
|
33
|
+
/** core ui `__root` options — component/error/notFound + head baseline */
|
|
34
|
+
rootOptions?: RouteOptionsBundle;
|
|
35
|
+
}
|
|
36
|
+
interface ConstructedTree {
|
|
37
|
+
rootRoute: AnyRoute;
|
|
38
|
+
routeTree: AnyRoute;
|
|
39
|
+
digest: string;
|
|
40
|
+
manifests: PluginManifest[];
|
|
41
|
+
nav: NavManifest;
|
|
42
|
+
/** constructed route count per mount id */
|
|
43
|
+
mountCounts: Record<string, number>;
|
|
44
|
+
}
|
|
45
|
+
declare function constructTree(input: ConstructInput): Promise<ConstructedTree>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { ConstructInput, ConstructPluginRef, ConstructedTree, GateUser, HostContext, ResolvedPlugin, constructTree };
|
|
48
|
+
//# sourceMappingURL=construct.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct.d.cts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAmCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { PluginManifest } from "./manifest-schema.mjs";
|
|
2
|
+
import { NavManifest } from "./nav.mjs";
|
|
3
|
+
import { RouteConfigModule, RouteOptionsBundle } from "./route-config.mjs";
|
|
4
|
+
import { AnyRoute } from "@tanstack/react-router";
|
|
5
|
+
//#region src/ui/manifest/construct.d.ts
|
|
6
|
+
interface GateUser {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Better Auth user role — "admin" gates the admin mount. */
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
12
|
+
interface HostContext {
|
|
13
|
+
user?: GateUser;
|
|
14
|
+
session?: {
|
|
15
|
+
user?: GateUser;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface ConstructPluginRef {
|
|
19
|
+
/** composition identity — plugin key; participates in the digest */
|
|
20
|
+
key: string;
|
|
21
|
+
/** deployment identity — the MF container name loadRemote targets */
|
|
22
|
+
mfName: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResolvedPlugin {
|
|
25
|
+
key: string;
|
|
26
|
+
manifest: PluginManifest;
|
|
27
|
+
routeConfig: RouteConfigModule;
|
|
28
|
+
}
|
|
29
|
+
interface ConstructInput {
|
|
30
|
+
name: string;
|
|
31
|
+
plugins: ReadonlyArray<ConstructPluginRef>;
|
|
32
|
+
resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;
|
|
33
|
+
/** core ui `__root` options — component/error/notFound + head baseline */
|
|
34
|
+
rootOptions?: RouteOptionsBundle;
|
|
35
|
+
}
|
|
36
|
+
interface ConstructedTree {
|
|
37
|
+
rootRoute: AnyRoute;
|
|
38
|
+
routeTree: AnyRoute;
|
|
39
|
+
digest: string;
|
|
40
|
+
manifests: PluginManifest[];
|
|
41
|
+
nav: NavManifest;
|
|
42
|
+
/** constructed route count per mount id */
|
|
43
|
+
mountCounts: Record<string, number>;
|
|
44
|
+
}
|
|
45
|
+
declare function constructTree(input: ConstructInput): Promise<ConstructedTree>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { ConstructInput, ConstructPluginRef, ConstructedTree, GateUser, HostContext, ResolvedPlugin, constructTree };
|
|
48
|
+
//# sourceMappingURL=construct.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct.d.mts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAmCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}
|