every-plugin 2.10.0 → 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 -194
- package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
- package/dist/build/rspack/dev-server-middleware.mjs +0 -193
- 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 -250
- 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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { Generator, getConfig } from "@tanstack/router-generator";
|
|
4
|
+
import {
|
|
5
|
+
MANIFEST_FILENAME,
|
|
6
|
+
MANIFEST_VERSION,
|
|
7
|
+
type PluginManifest,
|
|
8
|
+
PluginManifestSchema,
|
|
9
|
+
ROUTE_CONFIG_FILENAME,
|
|
10
|
+
type RouteRecord,
|
|
11
|
+
resolveMountSegment,
|
|
12
|
+
} from "./index";
|
|
13
|
+
import { MOUNT_REGISTRY } from "./mount-registry";
|
|
14
|
+
import { ROUTE_OPTION_KEYS } from "./route-config";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The load-bearing generator step (ADR 0008 §2). Rides
|
|
18
|
+
* `@tanstack/router-generator`'s scan (Generator.run + getCrawlingResult)
|
|
19
|
+
* and emits, per ui source workspace:
|
|
20
|
+
*
|
|
21
|
+
* - src/routeTree.gen.ts via the stock generator run (plugin-local
|
|
22
|
+
* standalone DX — never consumed by the host)
|
|
23
|
+
* - src/manifest.gen.json pure data: ids, paths, nesting, mounts, files
|
|
24
|
+
* - src/routeConfig.gen.ts generated import map of per-route option
|
|
25
|
+
* bundles + lifted `__root` meta
|
|
26
|
+
*
|
|
27
|
+
* Nothing hand-maintained: the only inputs are the route files. Root-level
|
|
28
|
+
* pathless layouts derive mounts via the registry; unknown mounts, routes
|
|
29
|
+
* under a missing mount layout, and duplicate sibling paths are hard errors
|
|
30
|
+
* here (cross-plugin path collisions are enforced at construction time —
|
|
31
|
+
* see `constructTree`).
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export interface ManifestGeneratorOptions {
|
|
35
|
+
/** ui source workspace root (ui/ or plugins/<id>/ui/) */
|
|
36
|
+
workspaceRoot: string;
|
|
37
|
+
/** composition-identity plugin key written into the manifest */
|
|
38
|
+
pluginName: string;
|
|
39
|
+
routesDirectory?: string;
|
|
40
|
+
generatedRouteTree?: string;
|
|
41
|
+
srcDir?: string;
|
|
42
|
+
/** module specifier the generated routeConfig imports its types from */
|
|
43
|
+
typeImport?: string;
|
|
44
|
+
/**
|
|
45
|
+
* When false, the stock routeTree write is redirected to a scratch path —
|
|
46
|
+
* for builds where TanStackRouterRspack owns src/routeTree.gen.ts (its
|
|
47
|
+
* autoCodeSplitting options differ); only manifest + routeConfig persist.
|
|
48
|
+
*/
|
|
49
|
+
emitRouteTree?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface ScanNode {
|
|
53
|
+
routePath?: string;
|
|
54
|
+
cleanedPath?: string;
|
|
55
|
+
filePath?: string;
|
|
56
|
+
parent?: ScanNode | undefined;
|
|
57
|
+
_fsRouteType?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const idOf = (node: { routePath?: string }): string => (node.routePath ?? "").replace(/^\//, "");
|
|
61
|
+
|
|
62
|
+
function importPathOf(file: string): string {
|
|
63
|
+
return `./routes/${file.replace(/\.tsx$/, "").replace(/\.ts$/, "")}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function generateUiManifest(
|
|
67
|
+
options: ManifestGeneratorOptions,
|
|
68
|
+
): Promise<PluginManifest> {
|
|
69
|
+
const {
|
|
70
|
+
workspaceRoot,
|
|
71
|
+
pluginName,
|
|
72
|
+
routesDirectory = "./src/routes",
|
|
73
|
+
generatedRouteTree = "./src/routeTree.gen.ts",
|
|
74
|
+
srcDir = "./src",
|
|
75
|
+
typeImport = "everything-dev/ui/manifest",
|
|
76
|
+
emitRouteTree = true,
|
|
77
|
+
} = options;
|
|
78
|
+
|
|
79
|
+
const routeTreeTarget = emitRouteTree
|
|
80
|
+
? generatedRouteTree
|
|
81
|
+
: "./node_modules/.cache/manifest-compose/routeTree.gen.ts";
|
|
82
|
+
|
|
83
|
+
const generator = new Generator({
|
|
84
|
+
config: getConfig(
|
|
85
|
+
{
|
|
86
|
+
target: "react",
|
|
87
|
+
routesDirectory,
|
|
88
|
+
generatedRouteTree: routeTreeTarget,
|
|
89
|
+
routeFileIgnorePrefix: "-",
|
|
90
|
+
routeFileIgnorePattern: "\\.(test|spec)\\.(ts|tsx)$",
|
|
91
|
+
disableLogging: true,
|
|
92
|
+
},
|
|
93
|
+
workspaceRoot,
|
|
94
|
+
),
|
|
95
|
+
root: workspaceRoot,
|
|
96
|
+
});
|
|
97
|
+
await generator.run();
|
|
98
|
+
const crawling = await generator.getCrawlingResult();
|
|
99
|
+
if (!crawling) throw new Error(`scan produced no result for ${pluginName}`);
|
|
100
|
+
|
|
101
|
+
const { rootRouteNode, routeFileResult } = crawling;
|
|
102
|
+
if (!rootRouteNode) throw new Error(`no __root found for ${pluginName}`);
|
|
103
|
+
|
|
104
|
+
const routes: RouteRecord[] = [];
|
|
105
|
+
const errors: string[] = [];
|
|
106
|
+
|
|
107
|
+
for (const node of routeFileResult as ScanNode[]) {
|
|
108
|
+
const isRootLevel = node.parent === undefined || node.parent === rootRouteNode;
|
|
109
|
+
|
|
110
|
+
if (node._fsRouteType === "__root") {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (
|
|
115
|
+
isRootLevel &&
|
|
116
|
+
(node._fsRouteType === "pathless_layout" || node._fsRouteType === "layout")
|
|
117
|
+
) {
|
|
118
|
+
const id = idOf(node);
|
|
119
|
+
const segment = id.split("/").at(-1) ?? "";
|
|
120
|
+
if (!segment.startsWith("_")) continue;
|
|
121
|
+
const mount = resolveMountSegment(segment.slice(1));
|
|
122
|
+
if (!mount) {
|
|
123
|
+
errors.push(
|
|
124
|
+
`unknown mount "_${segment.slice(1)}" (${node.filePath}); known: ${Object.keys(MOUNT_REGISTRY).join(", ")}`,
|
|
125
|
+
);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
routes.push({ id, type: "layout", mount, file: node.filePath });
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const isIndex = node._fsRouteType === "static" && node.cleanedPath === "/";
|
|
133
|
+
routes.push({
|
|
134
|
+
id: idOf(node),
|
|
135
|
+
type: isIndex
|
|
136
|
+
? "index"
|
|
137
|
+
: node._fsRouteType === "pathless_layout" || node._fsRouteType === "layout"
|
|
138
|
+
? "layout"
|
|
139
|
+
: "route",
|
|
140
|
+
path: isIndex
|
|
141
|
+
? "/"
|
|
142
|
+
: node.cleanedPath === "/" || node.cleanedPath === ""
|
|
143
|
+
? undefined
|
|
144
|
+
: node.cleanedPath,
|
|
145
|
+
file: node.filePath,
|
|
146
|
+
parentId: node.parent && node.parent !== rootRouteNode ? idOf(node.parent) : undefined,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (const record of routes) {
|
|
151
|
+
if (record.type === "layout" && record.mount) continue;
|
|
152
|
+
if (record.parentId) continue;
|
|
153
|
+
const firstSegment = record.id.split("/")[0] ?? "";
|
|
154
|
+
if (firstSegment.startsWith("_")) {
|
|
155
|
+
const mount = resolveMountSegment(firstSegment.slice(1));
|
|
156
|
+
if (!mount) {
|
|
157
|
+
errors.push(
|
|
158
|
+
`unknown mount "_${firstSegment.slice(1)}" (${record.file}); known: ${Object.keys(MOUNT_REGISTRY).join(", ")}`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
errors.push(
|
|
163
|
+
`route "${record.id}" (${record.file}) must live under a mount — root-level pathed routes have no gate`,
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const siblingPathClaims = new Map<string, string>();
|
|
169
|
+
for (const record of routes) {
|
|
170
|
+
if (record.type === "layout" || record.path === undefined) continue;
|
|
171
|
+
const claimKey = `${record.parentId ?? ""}::${record.path}`;
|
|
172
|
+
const claimant = siblingPathClaims.get(claimKey);
|
|
173
|
+
if (claimant) {
|
|
174
|
+
errors.push(
|
|
175
|
+
`duplicate path "${record.path}" under "${record.parentId ?? "mount root"}": "${claimant}" and "${record.id}" (${record.file})`,
|
|
176
|
+
);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
siblingPathClaims.set(claimKey, record.id);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (errors.length > 0) {
|
|
183
|
+
throw new Error(`manifest generation failed for ${pluginName}:\n ${errors.join("\n ")}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const manifest: PluginManifest = PluginManifestSchema.parse({
|
|
187
|
+
name: pluginName,
|
|
188
|
+
manifestVersion: MANIFEST_VERSION,
|
|
189
|
+
routes,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const resolvedSrc = path.resolve(workspaceRoot, srcDir);
|
|
193
|
+
await mkdir(resolvedSrc, { recursive: true });
|
|
194
|
+
await writeIfChanged(
|
|
195
|
+
path.join(resolvedSrc, MANIFEST_FILENAME),
|
|
196
|
+
`${JSON.stringify(manifest, null, 2)}\n`,
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const loaderLines = routes
|
|
200
|
+
.filter((r) => r.file)
|
|
201
|
+
.map(
|
|
202
|
+
(r) =>
|
|
203
|
+
` ${JSON.stringify(r.id)}: () => import(${JSON.stringify(importPathOf(r.file!))}).then((m) => pick(m.Route.options)),`,
|
|
204
|
+
);
|
|
205
|
+
const rootImport = `import { Route as __rootRoute } from ${JSON.stringify(importPathOf(rootRouteNode.filePath ?? "__root"))};`;
|
|
206
|
+
|
|
207
|
+
const routeConfigSource = `// Generated by manifest-gen. DO NOT EDIT.
|
|
208
|
+
// Inputs: src/routes/** only.
|
|
209
|
+
import type { RouteConfigModule, RouteOptionsBundle } from ${JSON.stringify(typeImport)};
|
|
210
|
+
|
|
211
|
+
const pick = (o: any): RouteOptionsBundle => ({
|
|
212
|
+
${ROUTE_OPTION_KEYS.map((key) => ` ${key}: o?.${key},`).join("\n")}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
${rootImport}
|
|
216
|
+
|
|
217
|
+
export const routeConfigLoaders: RouteConfigModule["routeConfigLoaders"] = {
|
|
218
|
+
${loaderLines.join("\n")}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const rootMeta = pick(__rootRoute.options);
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
await writeIfChanged(path.join(resolvedSrc, ROUTE_CONFIG_FILENAME), routeConfigSource);
|
|
225
|
+
|
|
226
|
+
return manifest;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Identical content is never re-written: the dev watcher is timestamp-based,
|
|
231
|
+
* so an unconditional write re-triggers compilation — which runs this
|
|
232
|
+
* generator again — an infinite regen loop.
|
|
233
|
+
*/
|
|
234
|
+
async function writeIfChanged(file: string, contents: string): Promise<void> {
|
|
235
|
+
const existing = await readFile(file, "utf8").catch(() => undefined);
|
|
236
|
+
if (existing === contents) return;
|
|
237
|
+
await writeFile(file, contents);
|
|
238
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe composition surface — everything here loads in the web
|
|
3
|
+
* bundle (hydrate) and the host server. The GENERATOR is deliberately NOT
|
|
4
|
+
* re-exported here: it rides @tanstack/router-generator (node fs + babel)
|
|
5
|
+
* and is consumed only by build tooling via `./ui/manifest-generator`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
type ConstructedTree,
|
|
10
|
+
type ConstructInput,
|
|
11
|
+
type ConstructPluginRef,
|
|
12
|
+
constructTree,
|
|
13
|
+
type GateUser,
|
|
14
|
+
type HostContext,
|
|
15
|
+
type ResolvedPlugin,
|
|
16
|
+
} from "./construct";
|
|
17
|
+
export * from "./contract";
|
|
18
|
+
export {
|
|
19
|
+
App,
|
|
20
|
+
type AppInput,
|
|
21
|
+
type CompositionDigestInput,
|
|
22
|
+
digestOf,
|
|
23
|
+
type KnownPlugins,
|
|
24
|
+
Plugin,
|
|
25
|
+
type PluginRef,
|
|
26
|
+
type PluginRefInput,
|
|
27
|
+
type RemoteSource,
|
|
28
|
+
type ResolvedApp,
|
|
29
|
+
resolveApp,
|
|
30
|
+
} from "./descriptor";
|
|
31
|
+
export {
|
|
32
|
+
type ComposePayload,
|
|
33
|
+
ComposePayloadSchema,
|
|
34
|
+
type ComposeRemote,
|
|
35
|
+
MANIFEST_VERSION,
|
|
36
|
+
ManifestSchema,
|
|
37
|
+
type PluginManifest,
|
|
38
|
+
PluginManifestSchema,
|
|
39
|
+
parsePluginManifest,
|
|
40
|
+
type RouteRecord,
|
|
41
|
+
RouteRecordSchema,
|
|
42
|
+
SUPPORTED_MANIFEST_VERSION,
|
|
43
|
+
} from "./manifest-schema";
|
|
44
|
+
export {
|
|
45
|
+
MOUNT_ALIASES,
|
|
46
|
+
MOUNT_REGISTRY,
|
|
47
|
+
MOUNT_REGISTRY_VERSION,
|
|
48
|
+
MOUNTS,
|
|
49
|
+
type MountDef,
|
|
50
|
+
type MountId,
|
|
51
|
+
resolveMountSegment,
|
|
52
|
+
} from "./mount-registry";
|
|
53
|
+
export type { NavDeclaration, NavItem, NavManifest } from "./nav";
|
|
54
|
+
export { compareNavItems } from "./nav";
|
|
55
|
+
export type { RouteConfigModule, RouteConfigRef, RouteOptionsBundle } from "./route-config";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MOUNTS } from "./mount-registry";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* manifest.gen.json — pure data emitted by the generator from route files
|
|
6
|
+
* only (ADR 0008 §2). Nothing here is hand-maintained; this schema is the
|
|
7
|
+
* composition contract and the audit/marketplace surface. The host refuses
|
|
8
|
+
* unknown `manifestVersion` majors.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The manifest contract major this code speaks. Emitted by the generator and
|
|
13
|
+
* enforced at every load (the host parses through `parsePluginManifest`; the
|
|
14
|
+
* client parse of the compose payload checks it — a skewed major degrades to
|
|
15
|
+
* the core-only tree instead of silently mis-constructing).
|
|
16
|
+
*/
|
|
17
|
+
export const MANIFEST_VERSION = 2;
|
|
18
|
+
export const SUPPORTED_MANIFEST_VERSION = MANIFEST_VERSION;
|
|
19
|
+
|
|
20
|
+
export const RouteRecordSchema = z.object({
|
|
21
|
+
/** Full route id, root-relative, no leading slash. e.g. "_public/login" */
|
|
22
|
+
id: z.string(),
|
|
23
|
+
/** Node kind — the @tanstack/virtual-file-routes vocabulary. */
|
|
24
|
+
type: z.enum(["route", "layout", "index"]),
|
|
25
|
+
/** URL path relative to the parent; absent for pathless layouts. */
|
|
26
|
+
path: z.string().optional(),
|
|
27
|
+
/** id of the parent record within the same plugin; absent = mount-level. */
|
|
28
|
+
parentId: z.string().optional(),
|
|
29
|
+
/** Set on ROOT-level pathless layouts: the mount this subtree declares. */
|
|
30
|
+
mount: z.enum(MOUNTS as [string, ...string[]]).optional(),
|
|
31
|
+
/** Route file relative to the routes directory (options source). */
|
|
32
|
+
file: z.string().optional(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const PluginManifestSchema = z.object({
|
|
36
|
+
/** Plugin key — derived from the workspace/config key by the emitter. */
|
|
37
|
+
name: z.string(),
|
|
38
|
+
/** Contract version — enforced by `parsePluginManifest` / the payload check. */
|
|
39
|
+
manifestVersion: z.number().int(),
|
|
40
|
+
/** Lifted from the plugin's `__root` route options, if any. */
|
|
41
|
+
rootMeta: z
|
|
42
|
+
.object({
|
|
43
|
+
hasHead: z.boolean().optional(),
|
|
44
|
+
hasStaticData: z.boolean().optional(),
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
47
|
+
routes: z.array(RouteRecordSchema),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The load-time contract check — one diagnostic for a manifest from a
|
|
52
|
+
* different framework major. Every manifest load goes through this.
|
|
53
|
+
*/
|
|
54
|
+
export function parsePluginManifest(data: unknown): PluginManifest {
|
|
55
|
+
const parsed = PluginManifestSchema.parse(data);
|
|
56
|
+
if (parsed.manifestVersion !== SUPPORTED_MANIFEST_VERSION) {
|
|
57
|
+
throw new Error(manifestVersionIssue(parsed.name, parsed.manifestVersion));
|
|
58
|
+
}
|
|
59
|
+
return parsed;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const manifestVersionIssue = (name: string, found: number): string =>
|
|
63
|
+
`unsupported manifest version ${found} in "${name}" — this build speaks ${SUPPORTED_MANIFEST_VERSION}; regenerate manifest.gen.json with the installed framework`;
|
|
64
|
+
|
|
65
|
+
export const ManifestSchema = z.object({
|
|
66
|
+
manifestVersion: z.number().int(),
|
|
67
|
+
plugins: z.array(PluginManifestSchema),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type RouteRecord = z.infer<typeof RouteRecordSchema>;
|
|
71
|
+
export type PluginManifest = z.infer<typeof PluginManifestSchema>;
|
|
72
|
+
export type Manifest = z.infer<typeof ManifestSchema>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The client compose payload — the runtime-config `ui.compose` block the
|
|
76
|
+
* server embeds and the client reconstructs the tree from. Single home:
|
|
77
|
+
* everything-dev's client-config schema, the hydrate client, and the host's
|
|
78
|
+
* ui-compose all derive from this schema.
|
|
79
|
+
*/
|
|
80
|
+
export const ComposeRemoteSchema = z.object({
|
|
81
|
+
key: z.string(),
|
|
82
|
+
name: z.string(),
|
|
83
|
+
entry: z.string(),
|
|
84
|
+
/** the remote's (hashed) browser-manifest URL — preferred over deriving
|
|
85
|
+
* one from `entry` by stripping the legacy fixed entry name */
|
|
86
|
+
manifestUrl: z.string().optional(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const ComposePayloadSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
digest: z.string(),
|
|
92
|
+
remotes: z.array(ComposeRemoteSchema),
|
|
93
|
+
manifests: z.array(PluginManifestSchema),
|
|
94
|
+
})
|
|
95
|
+
.superRefine((payload, ctx) => {
|
|
96
|
+
for (const manifest of payload.manifests) {
|
|
97
|
+
if (manifest.manifestVersion !== SUPPORTED_MANIFEST_VERSION) {
|
|
98
|
+
ctx.addIssue({
|
|
99
|
+
code: "custom",
|
|
100
|
+
message: manifestVersionIssue(manifest.name, manifest.manifestVersion),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export type ComposeRemote = z.infer<typeof ComposeRemoteSchema>;
|
|
107
|
+
export type ComposePayload = z.infer<typeof ComposePayloadSchema>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mount registry v2 — gates only, shape-free (ADR 0008 §3).
|
|
3
|
+
*
|
|
4
|
+
* A mount is a gate + a host-owned pathless layout position. It carries no
|
|
5
|
+
* product semantics (no "dashboard", no shell, no chrome) — plugins bring
|
|
6
|
+
* their own layouts and route freely inside their subtree. A mount is
|
|
7
|
+
* declared by a ROOT-level pathless layout file whose `_`-prefixed segment
|
|
8
|
+
* names the mount (`_public.tsx` → `public`); the generator derives it and
|
|
9
|
+
* validates it against this registry; gates are attached HOST-side at
|
|
10
|
+
* construction, so a plugin cannot ship a route that escapes its mount's
|
|
11
|
+
* gate (plugins never construct route objects).
|
|
12
|
+
*
|
|
13
|
+
* `org`/`team` are declared vocabulary (parameterized membership gates) but
|
|
14
|
+
* unimplemented — construction rejects them until they land.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface MountDef {
|
|
18
|
+
label: string;
|
|
19
|
+
gate: "none" | "session" | "admin" | "organization" | "team";
|
|
20
|
+
parameterized?: boolean;
|
|
21
|
+
implemented: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const MOUNT_REGISTRY = {
|
|
25
|
+
public: { label: "public", gate: "none", implemented: true },
|
|
26
|
+
authenticated: { label: "authenticated", gate: "session", implemented: true },
|
|
27
|
+
admin: { label: "admin", gate: "admin", implemented: true },
|
|
28
|
+
org: { label: "org", gate: "organization", parameterized: true, implemented: false },
|
|
29
|
+
team: { label: "team", gate: "team", parameterized: true, implemented: false },
|
|
30
|
+
} satisfies Record<string, MountDef>;
|
|
31
|
+
|
|
32
|
+
export type MountId = Extract<keyof typeof MOUNT_REGISTRY, string>;
|
|
33
|
+
|
|
34
|
+
export const MOUNTS = Object.keys(MOUNT_REGISTRY) as MountId[];
|
|
35
|
+
|
|
36
|
+
/** Bump when the registry shape changes — invalidates all compose digests. */
|
|
37
|
+
export const MOUNT_REGISTRY_VERSION = 5;
|
|
38
|
+
|
|
39
|
+
/** Migration aliases: legacy `_`-segment names → canonical mounts. */
|
|
40
|
+
export const MOUNT_ALIASES: Record<string, MountId> = {
|
|
41
|
+
auth: "authenticated",
|
|
42
|
+
authed: "authenticated",
|
|
43
|
+
dashboard: "authenticated",
|
|
44
|
+
organization: "org",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function resolveMountSegment(segment: string): MountId | undefined {
|
|
48
|
+
if (segment in MOUNT_REGISTRY) return segment as MountId;
|
|
49
|
+
return MOUNT_ALIASES[segment];
|
|
50
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nav manifest derived at construction from composed routes' `staticData.nav`
|
|
3
|
+
* declarations (ADR 0008). Shape-compatible with the sidebar consumption
|
|
4
|
+
* surface (`ui/src/components/layout/nav-items.ts`).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface NavItem {
|
|
8
|
+
/** unique item id: `${pluginKey}:${routeId}` */
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
group?: string;
|
|
13
|
+
order?: number;
|
|
14
|
+
/** absolute URL path — literal `$param` segments preserved */
|
|
15
|
+
to: string;
|
|
16
|
+
plugin: string;
|
|
17
|
+
mount: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NavManifest {
|
|
21
|
+
items: NavItem[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NavDeclaration {
|
|
25
|
+
label: string;
|
|
26
|
+
icon?: string;
|
|
27
|
+
group?: string;
|
|
28
|
+
order?: number;
|
|
29
|
+
to?: string;
|
|
30
|
+
/** set true to expose the route as a page but omit it from the sidebar */
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function compareNavItems(a: NavItem, b: NavItem): number {
|
|
35
|
+
const groupOrder = (a.group ?? "").localeCompare(b.group ?? "");
|
|
36
|
+
if (groupOrder !== 0) return groupOrder;
|
|
37
|
+
if (a.order !== undefined || b.order !== undefined) {
|
|
38
|
+
return (a.order ?? Number.MAX_SAFE_INTEGER) - (b.order ?? Number.MAX_SAFE_INTEGER);
|
|
39
|
+
}
|
|
40
|
+
const labelOrder = a.label.localeCompare(b.label);
|
|
41
|
+
if (labelOrder !== 0) return labelOrder;
|
|
42
|
+
return a.id.localeCompare(b.id);
|
|
43
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* routeConfig.gen.ts contract — the generated import map (ADR 0008 §2).
|
|
3
|
+
*
|
|
4
|
+
* The generator emits one module per ui source exposing a loader per route
|
|
5
|
+
* record: a dynamic import of that route's file, destructured to the option
|
|
6
|
+
* bundle construction needs. Options and component live in the same route
|
|
7
|
+
* file (standard authoring), so both arrive via the same per-route chunk.
|
|
8
|
+
* The host consumes this module — source-resolved from disk in dev,
|
|
9
|
+
* MF-exposed (`./routeConfig`) in production.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ReactNode } from "react";
|
|
13
|
+
|
|
14
|
+
export interface RouteHeadData {
|
|
15
|
+
meta?: Array<Record<string, unknown>>;
|
|
16
|
+
links?: Array<Record<string, unknown>>;
|
|
17
|
+
scripts?: Array<Record<string, unknown>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface RouteOptionsBundle {
|
|
21
|
+
validateSearch?: any;
|
|
22
|
+
search?: { middlewares?: Array<(...args: Array<any>) => any> };
|
|
23
|
+
params?: any;
|
|
24
|
+
loaderDeps?: (...args: Array<any>) => any;
|
|
25
|
+
context?: (...args: Array<any>) => any;
|
|
26
|
+
ssr?: any;
|
|
27
|
+
staleTime?: number;
|
|
28
|
+
gcTime?: number;
|
|
29
|
+
preloadStaleTime?: number;
|
|
30
|
+
pendingMs?: number;
|
|
31
|
+
pendingMinMs?: number;
|
|
32
|
+
shouldReload?: boolean | ((...args: Array<any>) => any);
|
|
33
|
+
loader?: (...args: Array<any>) => any;
|
|
34
|
+
beforeLoad?: (...args: Array<any>) => any;
|
|
35
|
+
head?: (...args: Array<any>) => RouteHeadData;
|
|
36
|
+
staticData?: Record<string, unknown>;
|
|
37
|
+
component?: (props: any) => ReactNode;
|
|
38
|
+
errorComponent?: (props: any) => ReactNode;
|
|
39
|
+
pendingComponent?: (props: any) => ReactNode;
|
|
40
|
+
notFoundComponent?: (props: any) => ReactNode;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type RouteConfigRef = () => Promise<RouteOptionsBundle>;
|
|
44
|
+
|
|
45
|
+
export type RouteConfigModule = {
|
|
46
|
+
routeConfigLoaders: Record<string, RouteConfigRef>;
|
|
47
|
+
/** Lifted `__root` meta, when the source declares it. */
|
|
48
|
+
rootMeta?: RouteOptionsBundle;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Every authored route option carried from a route file onto its constructed
|
|
53
|
+
* route. The generated `pick` and `constructTree` both read this list, and
|
|
54
|
+
* the type check below fails when `RouteOptionsBundle` gains a key that is
|
|
55
|
+
* not listed here.
|
|
56
|
+
*/
|
|
57
|
+
export const ROUTE_OPTION_KEYS = [
|
|
58
|
+
"validateSearch",
|
|
59
|
+
"search",
|
|
60
|
+
"params",
|
|
61
|
+
"loaderDeps",
|
|
62
|
+
"context",
|
|
63
|
+
"ssr",
|
|
64
|
+
"staleTime",
|
|
65
|
+
"gcTime",
|
|
66
|
+
"preloadStaleTime",
|
|
67
|
+
"pendingMs",
|
|
68
|
+
"pendingMinMs",
|
|
69
|
+
"shouldReload",
|
|
70
|
+
"loader",
|
|
71
|
+
"beforeLoad",
|
|
72
|
+
"head",
|
|
73
|
+
"staticData",
|
|
74
|
+
"component",
|
|
75
|
+
"errorComponent",
|
|
76
|
+
"pendingComponent",
|
|
77
|
+
"notFoundComponent",
|
|
78
|
+
] as const satisfies ReadonlyArray<keyof RouteOptionsBundle>;
|
|
79
|
+
|
|
80
|
+
type UnlistedRouteOptionKey = Exclude<keyof RouteOptionsBundle, (typeof ROUTE_OPTION_KEYS)[number]>;
|
|
81
|
+
const everyRouteOptionKeyListed: [UnlistedRouteOptionKey] extends [never] ? true : never = true;
|
|
82
|
+
void everyRouteOptionKeyListed;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WorkspaceVersionManifest — the immutable per-deploy document at
|
|
6
|
+
* `bundles/<account>/<gateway>/<workspace>/versions/<version>.json`
|
|
7
|
+
* (ADR 0020, as amended; atomic-deploys MAP decision 1). The published
|
|
8
|
+
* config's slot pins this document via its `pin` (`manifest` + the
|
|
9
|
+
* manifest's own SRI); every artifact coordinate lives here, so the config
|
|
10
|
+
* stops growing with artifact kinds and old versions stay fully servable.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const SRI = z.string().regex(/^sha384-[A-Za-z0-9+/=]+$/);
|
|
14
|
+
|
|
15
|
+
export const WorkspaceVersionManifestSchema = z.object({
|
|
16
|
+
version: z.string().regex(/^[0-9a-f]{16}$/),
|
|
17
|
+
builtAt: z.string().optional(),
|
|
18
|
+
gitSha: z.string().optional(),
|
|
19
|
+
entry: z.string().min(1),
|
|
20
|
+
entryIntegrity: SRI,
|
|
21
|
+
ssr: z
|
|
22
|
+
.object({
|
|
23
|
+
entry: z.string().min(1),
|
|
24
|
+
integrity: SRI,
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
browserManifest: z
|
|
28
|
+
.object({
|
|
29
|
+
file: z.string().min(1),
|
|
30
|
+
integrity: SRI,
|
|
31
|
+
})
|
|
32
|
+
.optional(),
|
|
33
|
+
/** extra assets (css, icons) — logical name → served-object SRI */
|
|
34
|
+
assets: z.record(z.string(), SRI).optional(),
|
|
35
|
+
/** shared-dependency versions this build was built against */
|
|
36
|
+
shared: z.record(z.string(), z.string()).optional(),
|
|
37
|
+
/**
|
|
38
|
+
* Full per-file digest map of the dist (object path → served-object SRI).
|
|
39
|
+
* Written by `every-plugin`-based deploys so the next deploy can diff against
|
|
40
|
+
* it and skip re-uploading unchanged files; readers that predate the field
|
|
41
|
+
* ignore it (zod strips unknown keys). Participates in the version hash.
|
|
42
|
+
*/
|
|
43
|
+
files: z.record(z.string(), SRI).optional(),
|
|
44
|
+
});
|
|
45
|
+
export type WorkspaceVersionManifest = z.infer<typeof WorkspaceVersionManifestSchema>;
|
|
46
|
+
|
|
47
|
+
export interface VersionManifestInput {
|
|
48
|
+
/** Omit: a per-build timestamp makes the same version id map to different
|
|
49
|
+
* manifest bytes per machine, breaking the pin's SRI against the image's
|
|
50
|
+
* staged copy and the CDN's immutability for republished versions. */
|
|
51
|
+
builtAt?: string;
|
|
52
|
+
gitSha?: string;
|
|
53
|
+
entry: string;
|
|
54
|
+
entryIntegrity: string;
|
|
55
|
+
ssr?: { entry: string; integrity: string };
|
|
56
|
+
browserManifest?: { file: string; integrity: string };
|
|
57
|
+
assets?: Record<string, string>;
|
|
58
|
+
shared?: Record<string, string>;
|
|
59
|
+
files?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Compose the manifest with its `version` derived from the canonical content
|
|
64
|
+
* of the artifact coordinates alone (key-sorted, `builtAt` excluded) —
|
|
65
|
+
* identical bytes → identical version id regardless of when they were built,
|
|
66
|
+
* so republishing unchanged content is a pointer no-op. Any changed
|
|
67
|
+
* coordinate → a new version (and a new file).
|
|
68
|
+
*/
|
|
69
|
+
export function composeVersionManifest(input: VersionManifestInput): WorkspaceVersionManifest {
|
|
70
|
+
const { builtAt, ...hashedInputs } = input;
|
|
71
|
+
const version = createHash("sha256")
|
|
72
|
+
.update(stableStringify(hashedInputs))
|
|
73
|
+
.digest("hex")
|
|
74
|
+
.slice(0, 16);
|
|
75
|
+
return WorkspaceVersionManifestSchema.parse({ ...input, version });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function stableStringify(value: unknown): string {
|
|
79
|
+
if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
|
|
80
|
+
if (value && typeof value === "object") {
|
|
81
|
+
return `{${Object.entries(value)
|
|
82
|
+
.filter(([, v]) => v !== undefined)
|
|
83
|
+
.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`)
|
|
84
|
+
.sort()
|
|
85
|
+
.join(",")}}`;
|
|
86
|
+
}
|
|
87
|
+
return JSON.stringify(value) ?? "null";
|
|
88
|
+
}
|