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
package/src/runtime/mf-config.ts
CHANGED
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import pkg from "../../package.json";
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { buildMfCoreSharedDependencies, type CoreSharedDepName } from "../shared-deps-spec";
|
|
5
3
|
|
|
6
|
-
const require = createRequire(import.meta.url);
|
|
7
4
|
declare const __EVERY_PLUGIN_VERSION__: string | undefined;
|
|
8
5
|
|
|
9
6
|
function readPackageVersion(): string {
|
|
10
7
|
try {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function getInstalledPackageVersion(packageName: string, fallbackRange: string): string {
|
|
18
|
-
try {
|
|
19
|
-
let currentDir = dirname(require.resolve(packageName));
|
|
20
|
-
for (let i = 0; i < 5; i += 1) {
|
|
21
|
-
const packageJsonPath = join(currentDir, "package.json");
|
|
22
|
-
if (existsSync(packageJsonPath)) {
|
|
23
|
-
return (JSON.parse(readFileSync(packageJsonPath, "utf-8")) as { version: string }).version;
|
|
8
|
+
// Not createRequire(import.meta.url): under tsx the require's resolution
|
|
9
|
+
// base can come up empty in spawned child processes ("Cannot find module
|
|
10
|
+
// from ''"), reading 0.0.0 and tripping the shared-identity check.
|
|
11
|
+
return (
|
|
12
|
+
JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf-8")) as {
|
|
13
|
+
version: string;
|
|
24
14
|
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
throw new Error(`Could not resolve installed version for ${packageName}`);
|
|
15
|
+
).version;
|
|
29
16
|
} catch {
|
|
30
|
-
|
|
31
|
-
return match ? match[0] : fallbackRange.replace(/^[\^~>=<\s]+/, "");
|
|
17
|
+
return "0.0.0";
|
|
32
18
|
}
|
|
33
19
|
}
|
|
34
20
|
|
|
@@ -42,87 +28,6 @@ export interface SharedConfig {
|
|
|
42
28
|
eager: boolean;
|
|
43
29
|
}
|
|
44
30
|
|
|
45
|
-
export const
|
|
46
|
-
singleton: true,
|
|
47
|
-
requiredVersion: false,
|
|
48
|
-
strictVersion: false,
|
|
49
|
-
eager: false,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const MF_CORE_SHARED_DEPS = {
|
|
53
|
-
"every-plugin": {
|
|
54
|
-
version: PLUGIN_VERSION,
|
|
55
|
-
shareScope: "default",
|
|
56
|
-
shareConfig: SHARE_CONFIG,
|
|
57
|
-
},
|
|
58
|
-
effect: {
|
|
59
|
-
version: getInstalledPackageVersion("effect", pkg.peerDependencies.effect),
|
|
60
|
-
shareScope: "default",
|
|
61
|
-
shareConfig: SHARE_CONFIG,
|
|
62
|
-
},
|
|
63
|
-
zod: {
|
|
64
|
-
version: getInstalledPackageVersion("zod", pkg.peerDependencies.zod),
|
|
65
|
-
shareScope: "default",
|
|
66
|
-
shareConfig: SHARE_CONFIG,
|
|
67
|
-
},
|
|
68
|
-
"@orpc/contract": {
|
|
69
|
-
version: getInstalledPackageVersion("@orpc/contract", pkg.peerDependencies["@orpc/contract"]),
|
|
70
|
-
shareScope: "default",
|
|
71
|
-
shareConfig: SHARE_CONFIG,
|
|
72
|
-
},
|
|
73
|
-
"@orpc/client": {
|
|
74
|
-
version: getInstalledPackageVersion("@orpc/client", pkg.peerDependencies["@orpc/client"]),
|
|
75
|
-
shareScope: "default",
|
|
76
|
-
shareConfig: SHARE_CONFIG,
|
|
77
|
-
},
|
|
78
|
-
"@orpc/server": {
|
|
79
|
-
version: getInstalledPackageVersion("@orpc/server", pkg.peerDependencies["@orpc/server"]),
|
|
80
|
-
shareScope: "default",
|
|
81
|
-
shareConfig: SHARE_CONFIG,
|
|
82
|
-
},
|
|
83
|
-
} as const;
|
|
84
|
-
|
|
85
|
-
export type CoreSharedDepName = keyof typeof MF_CORE_SHARED_DEPS;
|
|
31
|
+
export const MF_CORE_SHARED_DEPS = buildMfCoreSharedDependencies({ ownVersion: PLUGIN_VERSION });
|
|
86
32
|
|
|
87
|
-
export
|
|
88
|
-
version: string;
|
|
89
|
-
requiredVersion?: string | false;
|
|
90
|
-
singleton?: boolean;
|
|
91
|
-
strictVersion?: boolean;
|
|
92
|
-
eager?: boolean;
|
|
93
|
-
shareScope?: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export type AppSharedDeps = Record<string, AppSharedDepConfig>;
|
|
97
|
-
|
|
98
|
-
export function buildMergedSharedDeps(
|
|
99
|
-
appShared?: AppSharedDeps,
|
|
100
|
-
): Record<string, { version: string; shareScope: string; shareConfig: SharedConfig }> {
|
|
101
|
-
const merged: Record<string, { version: string; shareScope: string; shareConfig: SharedConfig }> =
|
|
102
|
-
{};
|
|
103
|
-
|
|
104
|
-
for (const [name, config] of Object.entries(MF_CORE_SHARED_DEPS)) {
|
|
105
|
-
merged[name] = {
|
|
106
|
-
version: config.version,
|
|
107
|
-
shareScope: config.shareScope,
|
|
108
|
-
shareConfig: config.shareConfig,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (appShared) {
|
|
113
|
-
for (const [name, config] of Object.entries(appShared)) {
|
|
114
|
-
merged[name] = {
|
|
115
|
-
version: config.version,
|
|
116
|
-
shareScope: config.shareScope ?? "default",
|
|
117
|
-
shareConfig: {
|
|
118
|
-
singleton: config.singleton ?? false,
|
|
119
|
-
requiredVersion: config.requiredVersion ?? false,
|
|
120
|
-
strictVersion: config.strictVersion ?? false,
|
|
121
|
-
eager: config.eager ?? false,
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return merged;
|
|
128
|
-
}
|
|
33
|
+
export type { CoreSharedDepName };
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import { createInstance, getInstance } from "@module-federation/enhanced/runtime";
|
|
2
2
|
import { setGlobalFederationInstance } from "@module-federation/runtime-core";
|
|
3
|
-
import { Effect } from "effect";
|
|
3
|
+
import { Context, Effect, Layer } from "effect";
|
|
4
|
+
import { DEV_ENTRY_FILENAME } from "../../build/artifact-names";
|
|
4
5
|
import type { AnyPlugin } from "../../types";
|
|
5
6
|
import { ModuleFederationError } from "../errors";
|
|
6
7
|
import { type CoreSharedDepName, MF_CORE_SHARED_DEPS } from "../mf-config";
|
|
7
8
|
import { getNormalizedRemoteName } from "./normalize";
|
|
9
|
+
import {
|
|
10
|
+
compareSharedIdentity,
|
|
11
|
+
describeSharedIdentityMismatch,
|
|
12
|
+
fetchRemoteIdentityManifest,
|
|
13
|
+
} from "./shared-identity";
|
|
14
|
+
|
|
15
|
+
function expectedSharedIdentity(): Map<string, string> {
|
|
16
|
+
return new Map(
|
|
17
|
+
Object.entries(MF_CORE_SHARED_DEPS).map(([name, config]) => [name, config.version]),
|
|
18
|
+
);
|
|
19
|
+
}
|
|
8
20
|
|
|
9
21
|
type RemoteModule = (new () => AnyPlugin) | { default: new () => AnyPlugin };
|
|
10
22
|
|
|
23
|
+
export const loadEveryPluginSharedModule = () => import("../../index");
|
|
24
|
+
|
|
11
25
|
const coreModuleLoaders: Record<CoreSharedDepName, () => Promise<unknown>> = {
|
|
12
|
-
|
|
26
|
+
// Keep the host-provided framework share on the same source graph as the
|
|
27
|
+
// runtime. A package self-import can resolve the published entry when a
|
|
28
|
+
// workspace script is launched through its package manager shim.
|
|
29
|
+
"every-plugin": loadEveryPluginSharedModule,
|
|
13
30
|
effect: () => import("effect"),
|
|
14
31
|
zod: () => import("zod"),
|
|
15
32
|
"@orpc/contract": () => import("@orpc/contract"),
|
|
@@ -72,129 +89,213 @@ const createModuleFederationInstance = Effect.cached(
|
|
|
72
89
|
|
|
73
90
|
return instance;
|
|
74
91
|
} catch (error) {
|
|
75
|
-
throw new Error(`Failed to initialize Module Federation: ${error}`);
|
|
92
|
+
throw new Error(`Failed to initialize Module Federation: ${String(error)}`);
|
|
76
93
|
}
|
|
77
94
|
}),
|
|
78
95
|
);
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const remoteName = getNormalizedRemoteName(pluginId);
|
|
92
|
-
const type = url.endsWith("/mf-manifest.json")
|
|
93
|
-
? ("manifest" as const)
|
|
94
|
-
: url.endsWith("/remoteEntry.js")
|
|
95
|
-
? ("script" as const)
|
|
96
|
-
: undefined;
|
|
97
|
-
|
|
98
|
-
yield* Effect.try({
|
|
99
|
-
try: () =>
|
|
100
|
-
mf.registerRemotes([
|
|
101
|
-
{
|
|
102
|
-
name: remoteName,
|
|
103
|
-
entry: url,
|
|
104
|
-
...(type ? { type } : {}),
|
|
105
|
-
},
|
|
106
|
-
]),
|
|
107
|
-
catch: (error): ModuleFederationError =>
|
|
108
|
-
new ModuleFederationError({
|
|
109
|
-
pluginId,
|
|
110
|
-
remoteUrl: url,
|
|
111
|
-
cause: error instanceof Error ? error : new Error(String(error)),
|
|
112
|
-
}),
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
yield* Effect.logInfo(`[MF] ✅ Registered ${pluginId}`);
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
loadRemoteConstructor: (pluginId: string, url: string) =>
|
|
119
|
-
Effect.gen(function* () {
|
|
120
|
-
const remoteName = getNormalizedRemoteName(pluginId);
|
|
121
|
-
yield* Effect.logDebug(`[MF] Loading remote ${remoteName}`);
|
|
122
|
-
const modulePath = `${remoteName}/plugin`;
|
|
123
|
-
|
|
124
|
-
const pluginConstructor = yield* Effect.tryPromise({
|
|
125
|
-
try: async () => {
|
|
126
|
-
const container = await mf.loadRemote<RemoteModule>(modulePath);
|
|
127
|
-
if (!container) {
|
|
128
|
-
throw new Error(`No container returned for ${modulePath}`);
|
|
129
|
-
}
|
|
97
|
+
// A built container's runtime code looks up its own chunks through the node
|
|
98
|
+
// runtime's entry-URL fallback keyed by the container's SELF name
|
|
99
|
+
// (`mf-manifest.json` metaData.name — the composition key, e.g.
|
|
100
|
+
// "everything-dev_registry-plugin"), while the host registers the remote
|
|
101
|
+
// under the plugin id ("registry"). When those differ, the fallback misses,
|
|
102
|
+
// resolveUrl returns null, and the node runtime hands back an empty chunk as
|
|
103
|
+
// if it had loaded — the exposed module then requires ids nothing registered
|
|
104
|
+
// ("__webpack_modules__[r] is not a function"). Registering and loading the
|
|
105
|
+
// remote under the container's own name keeps that lookup a hit.
|
|
106
|
+
const remoteSelfNames = new Map<string, string>();
|
|
130
107
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Constructor = container;
|
|
137
|
-
} else if (container.default) {
|
|
138
|
-
// Default export
|
|
139
|
-
Constructor = container.default;
|
|
140
|
-
} else {
|
|
141
|
-
// Named export fallback - prioritize exports with 'binding' property (plugin classes)
|
|
142
|
-
Constructor = Object.values(container).find(
|
|
143
|
-
(exp) => typeof exp === "function" && (exp as any).binding !== undefined,
|
|
144
|
-
);
|
|
108
|
+
const resolveRemoteSelfName = (pluginId: string, url: string) =>
|
|
109
|
+
Effect.gen(function* () {
|
|
110
|
+
const memoKey = `${pluginId}@${url}`;
|
|
111
|
+
const memo = remoteSelfNames.get(memoKey);
|
|
112
|
+
if (memo) return memo;
|
|
145
113
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
114
|
+
const manifest = yield* Effect.tryPromise(() => fetchRemoteIdentityManifest(url)).pipe(
|
|
115
|
+
Effect.orElseSucceed(() => null),
|
|
116
|
+
);
|
|
117
|
+
const selfName = manifest?.metaData?.name?.trim() || null;
|
|
153
118
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
119
|
+
const resolved = selfName ?? getNormalizedRemoteName(pluginId);
|
|
120
|
+
remoteSelfNames.set(memoKey, resolved);
|
|
121
|
+
return resolved;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export interface ModuleFederationServiceShape {
|
|
125
|
+
registerRemote: (pluginId: string, url: string) => Effect.Effect<void, ModuleFederationError>;
|
|
126
|
+
loadRemoteConstructor: (
|
|
127
|
+
pluginId: string,
|
|
128
|
+
url: string,
|
|
129
|
+
) => Effect.Effect<new () => AnyPlugin, ModuleFederationError>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class ModuleFederationService extends Context.Service<
|
|
133
|
+
ModuleFederationService,
|
|
134
|
+
ModuleFederationServiceShape
|
|
135
|
+
>()("ModuleFederationService") {}
|
|
136
|
+
|
|
137
|
+
export const ModuleFederationServiceDefault = Layer.effect(
|
|
138
|
+
ModuleFederationService,
|
|
139
|
+
Effect.gen(function* () {
|
|
140
|
+
const mf = yield* Effect.flatten(createModuleFederationInstance);
|
|
141
|
+
const expectedIdentity = expectedSharedIdentity();
|
|
142
|
+
|
|
143
|
+
const buildSharedIdentityError = async (
|
|
144
|
+
pluginId: string,
|
|
145
|
+
url: string,
|
|
146
|
+
): Promise<ModuleFederationError | null> => {
|
|
147
|
+
let manifest: Awaited<ReturnType<typeof fetchRemoteIdentityManifest>> | null = null;
|
|
148
|
+
try {
|
|
149
|
+
manifest = await fetchRemoteIdentityManifest(url);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.warn(
|
|
152
|
+
`[SharedIdentity] Could not fetch mf-manifest.json for plugin "${pluginId}" at ${url} (${error instanceof Error ? error.message : String(error)}); proceeding without identity verification`,
|
|
153
|
+
);
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (!manifest) return null;
|
|
157
|
+
const mismatches = compareSharedIdentity(manifest.shared, expectedIdentity);
|
|
158
|
+
if (mismatches.length === 0) return null;
|
|
159
|
+
const warnOnly = process.env.BOS_MF_IDENTITY === "warn";
|
|
160
|
+
if (warnOnly) {
|
|
161
|
+
console.warn(
|
|
162
|
+
`${describeSharedIdentityMismatch(pluginId, mismatches, "this runtime")} (BOS_MF_IDENTITY=warn: loading anyway)`,
|
|
163
|
+
);
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
return new ModuleFederationError({
|
|
167
|
+
pluginId,
|
|
168
|
+
remoteUrl: url,
|
|
169
|
+
cause: new Error(describeSharedIdentityMismatch(pluginId, mismatches, "this runtime")),
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
registerRemote: (pluginId: string, url: string) =>
|
|
175
|
+
Effect.gen(function* () {
|
|
176
|
+
const remoteName = yield* resolveRemoteSelfName(pluginId, url);
|
|
177
|
+
yield* Effect.logDebug(`[MF][${pluginId}] Registering as "${remoteName}"`);
|
|
168
178
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
const type = url.endsWith("/mf-manifest.json")
|
|
180
|
+
? ("manifest" as const)
|
|
181
|
+
: url.endsWith(`/${DEV_ENTRY_FILENAME}`)
|
|
182
|
+
? ("script" as const)
|
|
183
|
+
: undefined;
|
|
184
|
+
|
|
185
|
+
yield* Effect.try({
|
|
186
|
+
try: () =>
|
|
187
|
+
mf.registerRemotes([
|
|
188
|
+
{
|
|
189
|
+
name: remoteName,
|
|
190
|
+
entry: url,
|
|
191
|
+
...(type ? { type } : {}),
|
|
192
|
+
},
|
|
193
|
+
]),
|
|
194
|
+
catch: (error): ModuleFederationError =>
|
|
195
|
+
new ModuleFederationError({
|
|
196
|
+
pluginId,
|
|
197
|
+
remoteUrl: url,
|
|
198
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
199
|
+
}),
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
yield* Effect.logInfo(`[MF][${pluginId}] ✅ Registered`);
|
|
203
|
+
}),
|
|
204
|
+
|
|
205
|
+
loadRemoteConstructor: (pluginId: string, url: string) =>
|
|
206
|
+
Effect.gen(function* () {
|
|
207
|
+
const remoteName = yield* resolveRemoteSelfName(pluginId, url);
|
|
208
|
+
yield* Effect.logDebug(`[MF][${pluginId}] Loading remote ${remoteName}`);
|
|
209
|
+
|
|
210
|
+
const identityError = yield* Effect.promise(() =>
|
|
211
|
+
buildSharedIdentityError(pluginId, url),
|
|
212
|
+
);
|
|
213
|
+
if (identityError) {
|
|
214
|
+
yield* Effect.logError(
|
|
215
|
+
`[MF][${pluginId}] ❌ shared identity mismatch: ${
|
|
216
|
+
identityError.cause instanceof Error
|
|
217
|
+
? identityError.cause.message
|
|
218
|
+
: String(identityError.cause ?? "shared identity mismatch")
|
|
219
|
+
}`,
|
|
220
|
+
);
|
|
221
|
+
return yield* identityError;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const modulePath = `${remoteName}/plugin`;
|
|
225
|
+
|
|
226
|
+
const pluginConstructor = yield* Effect.tryPromise({
|
|
227
|
+
try: async () => {
|
|
228
|
+
const container = await mf.loadRemote<RemoteModule>(modulePath);
|
|
229
|
+
if (!container) {
|
|
230
|
+
throw new Error(`No container returned for ${modulePath}`);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Support multiple export patterns: direct function, default export, named exports
|
|
234
|
+
let Constructor: any;
|
|
235
|
+
|
|
236
|
+
if (typeof container === "function") {
|
|
237
|
+
// Direct function export
|
|
238
|
+
Constructor = container;
|
|
239
|
+
} else if (container.default) {
|
|
240
|
+
// Default export
|
|
241
|
+
Constructor = container.default;
|
|
242
|
+
} else {
|
|
243
|
+
// Named export fallback - prioritize exports with 'binding' property (plugin classes)
|
|
244
|
+
Constructor = Object.values(container).find(
|
|
245
|
+
(exp) => typeof exp === "function" && (exp as any).binding !== undefined,
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
// Fallback to any function export if no binding found
|
|
249
|
+
if (!Constructor) {
|
|
250
|
+
Constructor = Object.values(container).find(
|
|
251
|
+
(exp) => typeof exp === "function" && exp.prototype?.constructor === exp,
|
|
181
252
|
);
|
|
182
253
|
}
|
|
254
|
+
}
|
|
183
255
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
) {
|
|
256
|
+
if (!Constructor || typeof Constructor !== "function") {
|
|
257
|
+
const containerInfo =
|
|
258
|
+
typeof container === "object"
|
|
259
|
+
? `Available exports: ${Object.keys(container).join(", ")}`
|
|
260
|
+
: `Container type: ${typeof container}`;
|
|
261
|
+
|
|
262
|
+
throw new Error(
|
|
263
|
+
`No valid plugin constructor found for '${pluginId}'.\n` +
|
|
264
|
+
`Supported patterns:\n` +
|
|
265
|
+
` - export const YourPlugin = createPlugin({...})\n` +
|
|
266
|
+
` - export default createPlugin({...})\n` +
|
|
267
|
+
`${containerInfo}`,
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Validate it looks like a plugin constructor (has binding property)
|
|
272
|
+
if (!(Constructor as any).binding) {
|
|
273
|
+
const containerInfo =
|
|
274
|
+
typeof container === "object"
|
|
275
|
+
? `Found exports: ${Object.keys(container).join(", ")}`
|
|
276
|
+
: `Container type: ${typeof container}`;
|
|
277
|
+
|
|
278
|
+
throw new Error(
|
|
279
|
+
`Invalid plugin constructor for '${pluginId}'. ` +
|
|
280
|
+
`The exported value must be created with createPlugin(). ` +
|
|
281
|
+
`Found a function but it's missing the required 'binding' property.\n` +
|
|
282
|
+
`${containerInfo}`,
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return Constructor;
|
|
287
|
+
},
|
|
288
|
+
catch: (error): ModuleFederationError =>
|
|
289
|
+
new ModuleFederationError({
|
|
290
|
+
pluginId,
|
|
291
|
+
remoteUrl: url,
|
|
292
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
293
|
+
}),
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
yield* Effect.logInfo(`[MF][${pluginId}] ✅ Loaded constructor`);
|
|
297
|
+
return pluginConstructor;
|
|
298
|
+
}),
|
|
299
|
+
};
|
|
300
|
+
}),
|
|
301
|
+
);
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Normalizes a package name into the module federation remote name.
|
|
3
|
-
* This function must produce identical results in both runtime and build contexts.
|
|
4
|
-
*
|
|
5
|
-
* Normalization rules:
|
|
6
|
-
* - Convert to lowercase
|
|
7
|
-
* - Strip a single leading '@' symbol
|
|
8
|
-
* - Replace '/' with '_'
|
|
9
|
-
* - Preserve hyphens and other characters
|
|
10
|
-
*
|
|
11
|
-
* Examples:
|
|
12
|
-
* - "@scope/my-plugin" → "scope_my-plugin"
|
|
13
|
-
* - "@SCOPE/Foo/Bar" → "scope_foo_bar"
|
|
14
|
-
* - "foo/bar" → "foo_bar"
|
|
15
|
-
* - "simple-plugin" → "simple-plugin"
|
|
16
|
-
*/
|
|
17
|
-
export const getNormalizedRemoteName = (name: string): string =>
|
|
18
|
-
name.toLowerCase().replace(/^@/, "").replace(/\//g, "_");
|
|
1
|
+
export { remoteName as getNormalizedRemoteName } from "../../identity";
|