every-plugin 2.10.1 → 3.0.0-rc.3
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 +50 -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 +9 -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 +13 -26
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +57 -24
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +58 -25
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +16 -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 +159 -33
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +64 -7
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +64 -7
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +154 -30
- 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 +57 -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 +57 -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 +56 -30
- 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 +55 -31
- 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 +25 -41
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +25 -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 +17 -18
- package/src/identity.ts +36 -0
- package/src/index.ts +4 -0
- package/src/plugin.ts +88 -91
- package/src/remote-entry.ts +171 -0
- package/src/runtime/errors.ts +229 -26
- package/src/runtime/index.ts +132 -43
- package/src/runtime/mf-config.ts +12 -107
- package/src/runtime/services/module-federation.service.ts +218 -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 +271 -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 +25 -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, Effect } from "effect";
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import type { SecretsConfig } from "../../types";
|
|
4
4
|
import { PluginRuntimeError } from "../errors";
|
|
@@ -9,13 +9,21 @@ const configSchema = z
|
|
|
9
9
|
})
|
|
10
10
|
.passthrough();
|
|
11
11
|
|
|
12
|
-
export class SecretsConfigTag extends Context.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
>() {}
|
|
12
|
+
export class SecretsConfigTag extends Context.Service<SecretsConfigTag, SecretsConfig>()(
|
|
13
|
+
"SecretsConfig",
|
|
14
|
+
) {}
|
|
16
15
|
|
|
17
|
-
export
|
|
18
|
-
|
|
16
|
+
export interface SecretsServiceShape {
|
|
17
|
+
hydrateSecrets: <T>(config: T) => Effect.Effect<T, PluginRuntimeError>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class SecretsService extends Context.Service<SecretsService, SecretsServiceShape>()(
|
|
21
|
+
"SecretsService",
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
export const SecretsServiceDefault = Layer.effect(
|
|
25
|
+
SecretsService,
|
|
26
|
+
Effect.gen(function* () {
|
|
19
27
|
const secrets = yield* SecretsConfigTag;
|
|
20
28
|
|
|
21
29
|
const hydrateValue = (value: unknown): unknown => {
|
|
@@ -57,18 +65,15 @@ export class SecretsService extends Effect.Service<SecretsService>()("SecretsSer
|
|
|
57
65
|
hydrateSecrets: <T>(config: T) =>
|
|
58
66
|
Effect.gen(function* () {
|
|
59
67
|
const parseResult = configSchema.parse(config);
|
|
60
|
-
try
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return yield* Effect.fail(
|
|
68
|
+
return yield* Effect.try({
|
|
69
|
+
try: () => hydrateValue(parseResult) as T,
|
|
70
|
+
catch: (error) =>
|
|
64
71
|
new PluginRuntimeError({
|
|
65
72
|
operation: "hydrate-secrets",
|
|
66
73
|
cause: error instanceof Error ? error : new Error(String(error)),
|
|
67
|
-
retryable: false,
|
|
68
74
|
}),
|
|
69
|
-
|
|
70
|
-
}
|
|
75
|
+
});
|
|
71
76
|
}),
|
|
72
77
|
};
|
|
73
78
|
}),
|
|
74
|
-
|
|
79
|
+
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isEffectCriticalSharedDep } from "../../shared-deps-spec";
|
|
2
|
+
|
|
3
|
+
interface IdentityManifest {
|
|
4
|
+
metaData?: { pluginVersion?: string; name?: string };
|
|
5
|
+
shared?: Array<{ name: string; version?: string }>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SharedIdentityMismatch {
|
|
9
|
+
name: string;
|
|
10
|
+
expected: string;
|
|
11
|
+
actual: string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const MANIFEST_TIMEOUT_MS = 15_000;
|
|
15
|
+
|
|
16
|
+
function manifestUrl(remoteUrl: string): string {
|
|
17
|
+
return remoteUrl.endsWith("/") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function normalizeBaseUrl(remoteUrl: string): string {
|
|
21
|
+
const withoutHash = remoteUrl.split("#")[0] ?? remoteUrl;
|
|
22
|
+
return withoutHash.replace(/\/(mf-manifest\.json|remoteEntry(?:\.[^/]+)?\.js)$/i, "");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function compareSharedIdentity(
|
|
26
|
+
remoteShared: Array<{ name: string; version?: string }> | undefined,
|
|
27
|
+
expectedVersions: Map<string, string>,
|
|
28
|
+
): SharedIdentityMismatch[] {
|
|
29
|
+
const mismatches: SharedIdentityMismatch[] = [];
|
|
30
|
+
const remoteByName = new Map((remoteShared ?? []).map((s) => [s.name, s]));
|
|
31
|
+
|
|
32
|
+
for (const [name, expected] of expectedVersions.entries()) {
|
|
33
|
+
if (!isEffectCriticalSharedDep(name)) continue;
|
|
34
|
+
const remoteEntry = remoteByName.get(name);
|
|
35
|
+
if (!remoteEntry) continue;
|
|
36
|
+
if (remoteEntry.version && remoteEntry.version !== expected) {
|
|
37
|
+
mismatches.push({ name, expected, actual: remoteEntry.version });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return mismatches;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function describeSharedIdentityMismatch(
|
|
45
|
+
pluginId: string,
|
|
46
|
+
mismatches: SharedIdentityMismatch[],
|
|
47
|
+
hostExpectation: string,
|
|
48
|
+
): string {
|
|
49
|
+
const lines = mismatches.map(
|
|
50
|
+
(m) =>
|
|
51
|
+
` ${m.name}: expected ${m.expected} (from ${hostExpectation}), got ${m.actual ?? "missing"}`,
|
|
52
|
+
);
|
|
53
|
+
return (
|
|
54
|
+
`[SharedIdentity] Refusing to load plugin "${pluginId}": shared dependency version skew.\n` +
|
|
55
|
+
`${lines.join("\n")}\n` +
|
|
56
|
+
`Run "bos mf check" for the full report. Fix: rebuild and redeploy the host and this plugin together (single release train, e.g. "bos publish --deploy --packages local").`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function fetchRemoteIdentityManifest(
|
|
61
|
+
remoteUrl: string,
|
|
62
|
+
): Promise<IdentityManifest | null> {
|
|
63
|
+
const base = normalizeBaseUrl(remoteUrl);
|
|
64
|
+
const url = manifestUrl(base);
|
|
65
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });
|
|
66
|
+
if (!res.ok) return null;
|
|
67
|
+
return (await res.json()) as IdentityManifest;
|
|
68
|
+
}
|
|
@@ -13,11 +13,9 @@ export const validate = <T>(
|
|
|
13
13
|
if (result.success) {
|
|
14
14
|
return result.data;
|
|
15
15
|
}
|
|
16
|
-
return yield*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
16
|
+
return yield* new ValidationError({
|
|
17
|
+
pluginId,
|
|
18
|
+
stage,
|
|
19
|
+
zodError: result.error,
|
|
20
|
+
});
|
|
23
21
|
});
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SharedDependencySpec: the one module owning shared-dependency names,
|
|
3
|
+
* criticality, version resolution, and fallback policy across the Module
|
|
4
|
+
* Federation graph. Four consumers derive from it — the rspack config
|
|
5
|
+
* factory (plugin builds), the rsbuild config factory (ui remotes), the
|
|
6
|
+
* runtime mf-config (the every-plugin MF instance), and the host's shared
|
|
7
|
+
* pre-registration — so a name or criticality can never disagree between
|
|
8
|
+
* them, and an unresolved version fails the build loudly instead of
|
|
9
|
+
* silently degrading to "*"/"latest" (which disables the strict-singleton
|
|
10
|
+
* guard).
|
|
11
|
+
*
|
|
12
|
+
* Lists:
|
|
13
|
+
* - core: shared by the host and server-side plugin remotes (every-plugin,
|
|
14
|
+
* effect, zod, @orpc/*). Effect-critical entries pin the exact installed
|
|
15
|
+
* version (strictVersion) — the version-check machinery in
|
|
16
|
+
* runtime/services/shared-identity.ts relies on it.
|
|
17
|
+
* - ui: shared by the core ui provider and ui remotes (react, react-dom,
|
|
18
|
+
* @orpc/client, @orpc/contract, TanStack, lingui, the everything-dev
|
|
19
|
+
* session/i18n subpath modules). All strict singletons; consumers add
|
|
20
|
+
* `import: false`.
|
|
21
|
+
*/
|
|
22
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
23
|
+
import { createRequire } from "node:module";
|
|
24
|
+
import { dirname, join, resolve } from "node:path";
|
|
25
|
+
import { fileURLToPath } from "node:url";
|
|
26
|
+
import { Data } from "effect";
|
|
27
|
+
|
|
28
|
+
const require = createRequire(import.meta.url);
|
|
29
|
+
|
|
30
|
+
export class SharedDependencyResolutionError extends Data.TaggedError(
|
|
31
|
+
"SharedDependencyResolutionError",
|
|
32
|
+
)<{
|
|
33
|
+
readonly packageName: string;
|
|
34
|
+
readonly searched: string[];
|
|
35
|
+
}> {
|
|
36
|
+
constructor(packageName: string, searched: string[]) {
|
|
37
|
+
super({
|
|
38
|
+
packageName,
|
|
39
|
+
searched,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override get message() {
|
|
44
|
+
return (
|
|
45
|
+
`Could not resolve shared dependency "${this.packageName}". Looked in:\n` +
|
|
46
|
+
this.searched.map((location) => ` - ${location}`).join("\n") +
|
|
47
|
+
`\nUnresolved shared dependencies fail loudly (no "*", no "latest" fallback) — ` +
|
|
48
|
+
`install the package in the resolving workspace or pin a resolvable version.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type SharedDependencyResolution = "self" | "package" | "subpath";
|
|
54
|
+
|
|
55
|
+
export interface SharedDependencySpec {
|
|
56
|
+
name: string;
|
|
57
|
+
singleton: true;
|
|
58
|
+
/** exact-version pin (requiredVersion = resolved version, strictVersion = true) */
|
|
59
|
+
critical: boolean;
|
|
60
|
+
resolution: SharedDependencyResolution;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const CORE_SHARED_DEPS = [
|
|
64
|
+
{ name: "every-plugin", singleton: true, critical: true, resolution: "self" },
|
|
65
|
+
{ name: "effect", singleton: true, critical: true, resolution: "package" },
|
|
66
|
+
{ name: "zod", singleton: true, critical: false, resolution: "package" },
|
|
67
|
+
{ name: "@orpc/contract", singleton: true, critical: true, resolution: "package" },
|
|
68
|
+
{ name: "@orpc/client", singleton: true, critical: true, resolution: "package" },
|
|
69
|
+
{ name: "@orpc/server", singleton: true, critical: true, resolution: "package" },
|
|
70
|
+
// v1's proven sharing set, restored: @orpc/openapi, @orpc/experimental-effect,
|
|
71
|
+
// and @orpc/publisher joined this list in the v2 fleet-spec pass and their
|
|
72
|
+
// share-scope consumption broke plugin loading at runtime
|
|
73
|
+
// (__webpack_modules__[r] is not a function — the runtime's import()-based
|
|
74
|
+
// provides hand the consumer an ESM namespace where a module factory is
|
|
75
|
+
// expected). They stay declared in each workspace's package.json and are
|
|
76
|
+
// bundled per workspace instead.
|
|
77
|
+
] as const satisfies readonly SharedDependencySpec[];
|
|
78
|
+
|
|
79
|
+
export type CoreSharedDepName = (typeof CORE_SHARED_DEPS)[number]["name"];
|
|
80
|
+
|
|
81
|
+
const coreCriticalNames = CORE_SHARED_DEPS.flatMap((spec) => (spec.critical ? [spec.name] : []));
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Effect-critical shared names, derived from the core list's `critical: true`
|
|
85
|
+
* entries — the one source of criticality (`strictVersion` pinning in the
|
|
86
|
+
* runtime's version-check machinery keys off this list).
|
|
87
|
+
*/
|
|
88
|
+
export const EFFECT_CRITICAL_SHARED_DEPS: readonly EffectCriticalSharedDepName[] =
|
|
89
|
+
coreCriticalNames;
|
|
90
|
+
|
|
91
|
+
export type EffectCriticalSharedDepName = (typeof coreCriticalNames)[number];
|
|
92
|
+
|
|
93
|
+
export const isEffectCriticalSharedDep = (name: string): boolean =>
|
|
94
|
+
(EFFECT_CRITICAL_SHARED_DEPS as readonly string[]).includes(name);
|
|
95
|
+
|
|
96
|
+
export const UI_SHARED_DEPS = [
|
|
97
|
+
{ name: "react", singleton: true, critical: true, resolution: "package" },
|
|
98
|
+
{ name: "react-dom", singleton: true, critical: true, resolution: "package" },
|
|
99
|
+
{ name: "@orpc/client", singleton: true, critical: true, resolution: "package" },
|
|
100
|
+
{ name: "@orpc/contract", singleton: true, critical: true, resolution: "package" },
|
|
101
|
+
{ name: "@tanstack/react-query", singleton: true, critical: true, resolution: "package" },
|
|
102
|
+
{ name: "@tanstack/react-router", singleton: true, critical: true, resolution: "package" },
|
|
103
|
+
{ name: "@lingui/core", singleton: true, critical: true, resolution: "package" },
|
|
104
|
+
{ name: "@lingui/react", singleton: true, critical: true, resolution: "package" },
|
|
105
|
+
{
|
|
106
|
+
name: "everything-dev/ui/auth",
|
|
107
|
+
singleton: true,
|
|
108
|
+
critical: true,
|
|
109
|
+
resolution: "subpath",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "everything-dev/ui/i18n",
|
|
113
|
+
singleton: true,
|
|
114
|
+
critical: true,
|
|
115
|
+
resolution: "subpath",
|
|
116
|
+
},
|
|
117
|
+
] as const satisfies readonly SharedDependencySpec[];
|
|
118
|
+
|
|
119
|
+
export const SHARED_DEP_SPECS: readonly SharedDependencySpec[] = (() => {
|
|
120
|
+
const byName = new Map<string, SharedDependencySpec>();
|
|
121
|
+
for (const spec of [...CORE_SHARED_DEPS, ...UI_SHARED_DEPS]) {
|
|
122
|
+
const existing = byName.get(spec.name);
|
|
123
|
+
if (existing) {
|
|
124
|
+
if (existing.critical !== spec.critical) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
`Shared dependency spec conflict for "${spec.name}": criticality disagrees between the core and ui lists`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
byName.set(spec.name, spec);
|
|
132
|
+
}
|
|
133
|
+
return [...byName.values()];
|
|
134
|
+
})();
|
|
135
|
+
|
|
136
|
+
export interface SharedDependencyConfig {
|
|
137
|
+
version: string;
|
|
138
|
+
requiredVersion: string | false;
|
|
139
|
+
singleton: boolean;
|
|
140
|
+
strictVersion: boolean;
|
|
141
|
+
eager: boolean;
|
|
142
|
+
shareScope: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type SharedDependencies = Record<string, SharedDependencyConfig>;
|
|
146
|
+
|
|
147
|
+
export type SharedConfigInput = {
|
|
148
|
+
version: string;
|
|
149
|
+
requiredVersion?: string | false;
|
|
150
|
+
singleton?: boolean;
|
|
151
|
+
strictVersion?: boolean;
|
|
152
|
+
eager?: boolean;
|
|
153
|
+
shareScope?: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export interface SharedDependencyResolutionOptions {
|
|
157
|
+
/** the building workspace to resolve from; default is this module's own location */
|
|
158
|
+
workspaceRoot?: string;
|
|
159
|
+
resolution?: "package" | "subpath";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function searchedNote(target: string): string {
|
|
163
|
+
return `require.resolve("${target}")`;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function findPackageJsonVersion(startDir: string, searched: string[]): string | null {
|
|
167
|
+
let currentDir = startDir;
|
|
168
|
+
for (let i = 0; i < 5; i += 1) {
|
|
169
|
+
const packageJsonPath = join(currentDir, "package.json");
|
|
170
|
+
searched.push(packageJsonPath);
|
|
171
|
+
if (existsSync(packageJsonPath)) {
|
|
172
|
+
try {
|
|
173
|
+
const version = (JSON.parse(readFileSync(packageJsonPath, "utf8")) as { version?: string })
|
|
174
|
+
.version;
|
|
175
|
+
if (version) return version;
|
|
176
|
+
} catch {}
|
|
177
|
+
}
|
|
178
|
+
const parent = dirname(currentDir);
|
|
179
|
+
if (parent === currentDir) break;
|
|
180
|
+
currentDir = parent;
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function resolveSubpathVersion(
|
|
186
|
+
request: string,
|
|
187
|
+
workspaceRoot: string | undefined,
|
|
188
|
+
searched: string[],
|
|
189
|
+
): string | null {
|
|
190
|
+
if (request.startsWith("@")) {
|
|
191
|
+
throw new Error(
|
|
192
|
+
`Scoped-package subpath "${request}" is not supported — subpath version resolution ` +
|
|
193
|
+
`handles unscoped specifiers only (the known subpath specs, everything-dev/ui/*, are unscoped).`,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
const packageName = request.split("/")[0] ?? request;
|
|
197
|
+
const subpath = request.split("/").slice(1).join("/");
|
|
198
|
+
const candidates: string[] = [];
|
|
199
|
+
if (workspaceRoot) {
|
|
200
|
+
candidates.push(join(workspaceRoot, "node_modules", packageName, "package.json"));
|
|
201
|
+
}
|
|
202
|
+
const resolveRequests: Array<{ request: string; paths?: string[] }> = [
|
|
203
|
+
{ request: `${packageName}/${subpath}`, ...(workspaceRoot ? { paths: [workspaceRoot] } : {}) },
|
|
204
|
+
{ request: `${packageName}/${subpath}` },
|
|
205
|
+
{
|
|
206
|
+
request: `${packageName}/package.json`,
|
|
207
|
+
...(workspaceRoot ? { paths: [workspaceRoot] } : {}),
|
|
208
|
+
},
|
|
209
|
+
{ request: `${packageName}/package.json` },
|
|
210
|
+
];
|
|
211
|
+
for (const { request: target, paths } of resolveRequests) {
|
|
212
|
+
try {
|
|
213
|
+
const resolved = require.resolve(target, paths ? { paths } : undefined);
|
|
214
|
+
searched.push(resolved);
|
|
215
|
+
candidates.push(
|
|
216
|
+
resolved.endsWith("package.json")
|
|
217
|
+
? resolved
|
|
218
|
+
: resolve(dirname(resolved), "..", "..", "package.json"),
|
|
219
|
+
);
|
|
220
|
+
} catch {
|
|
221
|
+
searched.push(searchedNote(target));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
for (const candidate of candidates) {
|
|
225
|
+
if (!existsSync(candidate)) continue;
|
|
226
|
+
try {
|
|
227
|
+
const version = (JSON.parse(readFileSync(candidate, "utf8")) as { version?: string }).version;
|
|
228
|
+
if (version) return version;
|
|
229
|
+
} catch {}
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function resolveSharedVersion(
|
|
235
|
+
name: string,
|
|
236
|
+
options: SharedDependencyResolutionOptions = {},
|
|
237
|
+
): string {
|
|
238
|
+
const searched: string[] = [];
|
|
239
|
+
const { workspaceRoot, resolution = "package" } = options;
|
|
240
|
+
|
|
241
|
+
if (resolution === "subpath") {
|
|
242
|
+
const version = resolveSubpathVersion(name, workspaceRoot, searched);
|
|
243
|
+
if (version) return version;
|
|
244
|
+
throw new SharedDependencyResolutionError(name, searched);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const roots: Array<string | undefined> = workspaceRoot ? [workspaceRoot, undefined] : [undefined];
|
|
248
|
+
for (const root of roots) {
|
|
249
|
+
try {
|
|
250
|
+
const resolved = root ? require.resolve(name, { paths: [root] }) : require.resolve(name);
|
|
251
|
+
searched.push(resolved);
|
|
252
|
+
const version = findPackageJsonVersion(dirname(resolved), searched);
|
|
253
|
+
if (version) return version;
|
|
254
|
+
} catch {
|
|
255
|
+
searched.push(searchedNote(name));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
throw new SharedDependencyResolutionError(name, searched);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function resolveOwnVersion(searched: string[]): string {
|
|
262
|
+
const localPackageJson = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
263
|
+
searched.push(localPackageJson);
|
|
264
|
+
if (existsSync(localPackageJson)) {
|
|
265
|
+
try {
|
|
266
|
+
const version = (JSON.parse(readFileSync(localPackageJson, "utf8")) as { version?: string })
|
|
267
|
+
.version;
|
|
268
|
+
if (version) return version;
|
|
269
|
+
} catch {}
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
const resolved = require.resolve("every-plugin/package.json");
|
|
273
|
+
searched.push(resolved);
|
|
274
|
+
const version = (JSON.parse(readFileSync(resolved, "utf8")) as { version?: string }).version;
|
|
275
|
+
if (version) return version;
|
|
276
|
+
} catch {
|
|
277
|
+
searched.push(searchedNote("every-plugin/package.json"));
|
|
278
|
+
}
|
|
279
|
+
throw new SharedDependencyResolutionError("every-plugin", searched);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function shareConfigFor(
|
|
283
|
+
spec: SharedDependencySpec,
|
|
284
|
+
version: string,
|
|
285
|
+
): Omit<SharedDependencyConfig, "version"> {
|
|
286
|
+
return spec.critical
|
|
287
|
+
? {
|
|
288
|
+
requiredVersion: version,
|
|
289
|
+
singleton: true,
|
|
290
|
+
strictVersion: true,
|
|
291
|
+
eager: false,
|
|
292
|
+
shareScope: "default",
|
|
293
|
+
}
|
|
294
|
+
: {
|
|
295
|
+
requiredVersion: false,
|
|
296
|
+
singleton: true,
|
|
297
|
+
strictVersion: false,
|
|
298
|
+
eager: false,
|
|
299
|
+
shareScope: "default",
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface SharedDepsBuildOptions {
|
|
304
|
+
/** the every-plugin share version; default resolves the installed package.json */
|
|
305
|
+
ownVersion?: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function specVersion(spec: SharedDependencySpec, options: SharedDepsBuildOptions): string {
|
|
309
|
+
if (spec.resolution === "self") {
|
|
310
|
+
return options.ownVersion ?? resolveOwnVersion([`own package.json of "${spec.name}"`]);
|
|
311
|
+
}
|
|
312
|
+
return resolveSharedVersion(spec.name, {
|
|
313
|
+
resolution: spec.resolution === "subpath" ? "subpath" : "package",
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export function getPluginSharedDependencies(
|
|
318
|
+
options: SharedDepsBuildOptions = {},
|
|
319
|
+
): SharedDependencies {
|
|
320
|
+
return Object.fromEntries(
|
|
321
|
+
CORE_SHARED_DEPS.map((spec) => {
|
|
322
|
+
const version = specVersion(spec, options);
|
|
323
|
+
return [spec.name, { version, ...shareConfigFor(spec, version) }];
|
|
324
|
+
}),
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface HostSharedEntry {
|
|
329
|
+
version: string;
|
|
330
|
+
shareScope: string;
|
|
331
|
+
shareConfig: {
|
|
332
|
+
singleton: boolean;
|
|
333
|
+
requiredVersion: string | false;
|
|
334
|
+
strictVersion: boolean;
|
|
335
|
+
eager: boolean;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function toHostSharedEntry(name: string, config: SharedConfigInput): HostSharedEntry {
|
|
340
|
+
const normalized = normalizeSharedConfig(config, name);
|
|
341
|
+
return {
|
|
342
|
+
version: normalized.version,
|
|
343
|
+
shareScope: normalized.shareScope,
|
|
344
|
+
shareConfig: {
|
|
345
|
+
singleton: normalized.singleton,
|
|
346
|
+
requiredVersion: normalized.requiredVersion,
|
|
347
|
+
strictVersion: normalized.strictVersion,
|
|
348
|
+
eager: normalized.eager,
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* The runtime mf-config's core shared map: the same entries
|
|
355
|
+
* `getPluginSharedDependencies` assembles, shaped through the one host mapper
|
|
356
|
+
* (`toHostSharedEntry`) so both consumers derive from a single entry type.
|
|
357
|
+
*/
|
|
358
|
+
export function buildMfCoreSharedDependencies(
|
|
359
|
+
options: SharedDepsBuildOptions = {},
|
|
360
|
+
): Record<string, HostSharedEntry> {
|
|
361
|
+
return Object.fromEntries(
|
|
362
|
+
Object.entries(getPluginSharedDependencies(options)).map(([name, config]) => [
|
|
363
|
+
name,
|
|
364
|
+
toHostSharedEntry(name, config),
|
|
365
|
+
]),
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface UiSharedDepEntry {
|
|
370
|
+
version: string;
|
|
371
|
+
requiredVersion: string | false;
|
|
372
|
+
singleton: true;
|
|
373
|
+
strictVersion: boolean;
|
|
374
|
+
eager: false;
|
|
375
|
+
shareScope: "default";
|
|
376
|
+
/** consumer role only: no bundled fallback copy — the provider provides */
|
|
377
|
+
import?: false;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface UiSharedDepsOptions {
|
|
381
|
+
/** explicit core-shell parity opt-out; default is the strict singleton */
|
|
382
|
+
strictVersion?: boolean;
|
|
383
|
+
role?: "provider" | "consumer";
|
|
384
|
+
workspaceRoot?: string;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export function createUiSharedDeps(
|
|
388
|
+
options: UiSharedDepsOptions = {},
|
|
389
|
+
): Record<string, UiSharedDepEntry> {
|
|
390
|
+
const deps: Record<string, UiSharedDepEntry> = {};
|
|
391
|
+
for (const spec of UI_SHARED_DEPS) {
|
|
392
|
+
const version = resolveSharedVersion(spec.name, {
|
|
393
|
+
workspaceRoot: options.workspaceRoot,
|
|
394
|
+
resolution: spec.resolution === "subpath" ? "subpath" : "package",
|
|
395
|
+
});
|
|
396
|
+
const strict = options.strictVersion !== false;
|
|
397
|
+
deps[spec.name] = {
|
|
398
|
+
version,
|
|
399
|
+
requiredVersion: strict ? version : false,
|
|
400
|
+
singleton: true,
|
|
401
|
+
strictVersion: strict,
|
|
402
|
+
eager: false,
|
|
403
|
+
shareScope: "default",
|
|
404
|
+
...(options.role === "consumer" ? { import: false as const } : {}),
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
return deps;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const UNRESOLVED_VERSIONS = new Set(["*", "latest", ""]);
|
|
411
|
+
|
|
412
|
+
export function assertResolvedSharedVersion(name: string, version: unknown): string {
|
|
413
|
+
if (typeof version !== "string" || UNRESOLVED_VERSIONS.has(version.trim())) {
|
|
414
|
+
throw new SharedDependencyResolutionError(name, [
|
|
415
|
+
`declared version ${JSON.stringify(version ?? null)} is not resolvable — "*", "latest", and empty fail loudly instead of disabling the strict-singleton guard`,
|
|
416
|
+
]);
|
|
417
|
+
}
|
|
418
|
+
return version;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export function normalizeSharedConfig(
|
|
422
|
+
config: SharedConfigInput,
|
|
423
|
+
name: string,
|
|
424
|
+
): SharedDependencyConfig {
|
|
425
|
+
const version = assertResolvedSharedVersion(name, config.version);
|
|
426
|
+
return {
|
|
427
|
+
version,
|
|
428
|
+
requiredVersion: config.requiredVersion ?? false,
|
|
429
|
+
singleton: config.singleton ?? false,
|
|
430
|
+
strictVersion: config.strictVersion ?? false,
|
|
431
|
+
eager: config.eager ?? false,
|
|
432
|
+
shareScope: config.shareScope ?? "default",
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function comparableSharedConfig(config: SharedConfigInput) {
|
|
437
|
+
return {
|
|
438
|
+
version: config.version,
|
|
439
|
+
requiredVersion: config.requiredVersion ?? false,
|
|
440
|
+
singleton: config.singleton ?? false,
|
|
441
|
+
strictVersion: config.strictVersion ?? false,
|
|
442
|
+
eager: config.eager ?? false,
|
|
443
|
+
shareScope: config.shareScope ?? "default",
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export function isSameSharedConfig(a: SharedConfigInput, b: SharedConfigInput): boolean {
|
|
448
|
+
const left = comparableSharedConfig(a);
|
|
449
|
+
const right = comparableSharedConfig(b);
|
|
450
|
+
return (
|
|
451
|
+
left.version === right.version &&
|
|
452
|
+
left.requiredVersion === right.requiredVersion &&
|
|
453
|
+
left.singleton === right.singleton &&
|
|
454
|
+
left.strictVersion === right.strictVersion &&
|
|
455
|
+
left.eager === right.eager &&
|
|
456
|
+
left.shareScope === right.shareScope
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export function mergeSharedMaps(
|
|
461
|
+
...maps: Array<Record<string, SharedConfigInput> | undefined>
|
|
462
|
+
): Record<string, SharedDependencyConfig> {
|
|
463
|
+
const merged: Record<string, SharedDependencyConfig> = {};
|
|
464
|
+
for (const map of maps) {
|
|
465
|
+
if (!map) continue;
|
|
466
|
+
for (const [name, config] of Object.entries(map)) {
|
|
467
|
+
const normalized = normalizeSharedConfig(config, name);
|
|
468
|
+
const existing = merged[name];
|
|
469
|
+
if (existing && !isSameSharedConfig(existing, normalized)) {
|
|
470
|
+
throw new Error(
|
|
471
|
+
`Conflicting shared dependency "${name}" in shared dependency configuration`,
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
merged[name] = normalized;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return merged;
|
|
478
|
+
}
|