every-plugin 2.10.1 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/every-plugin-serve.mjs +12 -0
- package/bin/every-plugin.mjs +59 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/build/artifact-names.cjs +119 -0
- package/dist/build/artifact-names.cjs.map +1 -0
- package/dist/build/artifact-names.d.cts +68 -0
- package/dist/build/artifact-names.d.cts.map +1 -0
- package/dist/build/artifact-names.d.mts +68 -0
- package/dist/build/artifact-names.d.mts.map +1 -0
- package/dist/build/artifact-names.mjs +102 -0
- package/dist/build/artifact-names.mjs.map +1 -0
- package/dist/build/contract-types.cjs +89 -0
- package/dist/build/contract-types.cjs.map +1 -0
- package/dist/build/contract-types.mjs +81 -0
- package/dist/build/contract-types.mjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.cjs +37 -0
- package/dist/build/rspack/build-report-plugin.cjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.cts +18 -0
- package/dist/build/rspack/build-report-plugin.d.cts.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.mts +18 -0
- package/dist/build/rspack/build-report-plugin.d.mts.map +1 -0
- package/dist/build/rspack/build-report-plugin.mjs +37 -0
- package/dist/build/rspack/build-report-plugin.mjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -0
- package/dist/build/rspack/compose.cjs +69 -0
- package/dist/build/rspack/compose.cjs.map +1 -0
- package/dist/build/rspack/compose.d.cts +20 -0
- package/dist/build/rspack/compose.d.cts.map +1 -0
- package/dist/build/rspack/compose.d.mts +20 -0
- package/dist/build/rspack/compose.d.mts.map +1 -0
- package/dist/build/rspack/compose.mjs +65 -0
- package/dist/build/rspack/compose.mjs.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +11 -11
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +11 -10
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/generated-config.cjs +35 -0
- package/dist/build/rspack/generated-config.cjs.map +1 -0
- package/dist/build/rspack/generated-config.mjs +32 -0
- package/dist/build/rspack/generated-config.mjs.map +1 -0
- package/dist/build/rspack/index.cjs +8 -5
- package/dist/build/rspack/index.d.cts +5 -3
- package/dist/build/rspack/index.d.mts +5 -3
- package/dist/build/rspack/index.mjs +5 -3
- package/dist/build/rspack/module-federation.cjs +2 -2
- package/dist/build/rspack/module-federation.cjs.map +1 -1
- package/dist/build/rspack/module-federation.mjs +1 -1
- package/dist/build/rspack/module-federation.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs +44 -69
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +4 -13
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +4 -13
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +44 -69
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/rspack/utils.cjs +7 -5
- package/dist/build/rspack/utils.cjs.map +1 -1
- package/dist/build/rspack/utils.mjs +7 -6
- package/dist/build/rspack/utils.mjs.map +1 -1
- package/dist/build/ui/factory.cjs +88 -0
- package/dist/build/ui/factory.cjs.map +1 -0
- package/dist/build/ui/factory.d.cts +11 -0
- package/dist/build/ui/factory.d.cts.map +1 -0
- package/dist/build/ui/factory.d.mts +11 -0
- package/dist/build/ui/factory.d.mts.map +1 -0
- package/dist/build/ui/factory.mjs +80 -0
- package/dist/build/ui/factory.mjs.map +1 -0
- package/dist/build/ui/generated-config.cjs +118 -0
- package/dist/build/ui/generated-config.cjs.map +1 -0
- package/dist/build/ui/generated-config.d.cts +33 -0
- package/dist/build/ui/generated-config.d.cts.map +1 -0
- package/dist/build/ui/generated-config.d.mts +33 -0
- package/dist/build/ui/generated-config.d.mts.map +1 -0
- package/dist/build/ui/generated-config.mjs +111 -0
- package/dist/build/ui/generated-config.mjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs +61 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs +58 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs.map +1 -0
- package/dist/build/ui/index.cjs +90 -0
- package/dist/build/ui/index.cjs.map +1 -0
- package/dist/build/ui/index.d.cts +29 -0
- package/dist/build/ui/index.d.cts.map +1 -0
- package/dist/build/ui/index.d.mts +29 -0
- package/dist/build/ui/index.d.mts.map +1 -0
- package/dist/build/ui/index.mjs +68 -0
- package/dist/build/ui/index.mjs.map +1 -0
- package/dist/build/ui/manifest-plugin.cjs +37 -0
- package/dist/build/ui/manifest-plugin.cjs.map +1 -0
- package/dist/build/ui/manifest-plugin.d.cts +19 -0
- package/dist/build/ui/manifest-plugin.d.cts.map +1 -0
- package/dist/build/ui/manifest-plugin.d.mts +19 -0
- package/dist/build/ui/manifest-plugin.d.mts.map +1 -0
- package/dist/build/ui/manifest-plugin.mjs +37 -0
- package/dist/build/ui/manifest-plugin.mjs.map +1 -0
- package/dist/build/ui/rsbuild-config.cjs +203 -0
- package/dist/build/ui/rsbuild-config.cjs.map +1 -0
- package/dist/build/ui/rsbuild-config.d.cts +45 -0
- package/dist/build/ui/rsbuild-config.d.cts.map +1 -0
- package/dist/build/ui/rsbuild-config.d.mts +45 -0
- package/dist/build/ui/rsbuild-config.d.mts.map +1 -0
- package/dist/build/ui/rsbuild-config.mjs +200 -0
- package/dist/build/ui/rsbuild-config.mjs.map +1 -0
- package/dist/build/ui/stubs.cjs +107 -0
- package/dist/build/ui/stubs.cjs.map +1 -0
- package/dist/build/ui/stubs.d.cts +25 -0
- package/dist/build/ui/stubs.d.cts.map +1 -0
- package/dist/build/ui/stubs.d.mts +25 -0
- package/dist/build/ui/stubs.d.mts.map +1 -0
- package/dist/build/ui/stubs.mjs +106 -0
- package/dist/build/ui/stubs.mjs.map +1 -0
- package/dist/cli.cjs +83 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +6 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +6 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +82 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/dev/serve.cjs +390 -0
- package/dist/dev/serve.cjs.map +1 -0
- package/dist/dev/serve.d.cts +23 -0
- package/dist/dev/serve.d.cts.map +1 -0
- package/dist/dev/serve.d.mts +23 -0
- package/dist/dev/serve.d.mts.map +1 -0
- package/dist/dev/serve.mjs +384 -0
- package/dist/dev/serve.mjs.map +1 -0
- package/dist/dev/watch-kill.cjs +39 -0
- package/dist/dev/watch-kill.cjs.map +1 -0
- package/dist/dev/watch-kill.mjs +38 -0
- package/dist/dev/watch-kill.mjs.map +1 -0
- package/dist/effect-helpers.cjs +23 -0
- package/dist/effect-helpers.cjs.map +1 -0
- package/dist/effect-helpers.d.cts +20 -0
- package/dist/effect-helpers.d.cts.map +1 -0
- package/dist/effect-helpers.d.mts +20 -0
- package/dist/effect-helpers.d.mts.map +1 -0
- package/dist/effect-helpers.mjs +22 -0
- package/dist/effect-helpers.mjs.map +1 -0
- package/dist/errors.cjs +49 -69
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +13 -96
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +13 -96
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +16 -34
- package/dist/errors.mjs.map +1 -1
- package/dist/identity.cjs +19 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +33 -0
- package/dist/identity.d.cts.map +1 -0
- package/dist/identity.d.mts +33 -0
- package/dist/identity.d.mts.map +1 -0
- package/dist/identity.mjs +16 -0
- package/dist/identity.mjs.map +1 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +8 -6
- package/dist/index.d.mts +8 -6
- package/dist/index.mjs +6 -4
- package/dist/plugin.cjs +12 -26
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +44 -25
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +45 -26
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +15 -29
- package/dist/plugin.mjs.map +1 -1
- package/dist/remote-entry.cjs +103 -0
- package/dist/remote-entry.cjs.map +1 -0
- package/dist/remote-entry.d.cts +53 -0
- package/dist/remote-entry.d.cts.map +1 -0
- package/dist/remote-entry.d.mts +53 -0
- package/dist/remote-entry.d.mts.map +1 -0
- package/dist/remote-entry.mjs +98 -0
- package/dist/remote-entry.mjs.map +1 -0
- package/dist/runtime/errors.cjs +140 -34
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +42 -7
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +42 -7
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +136 -31
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +95 -23
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +16 -0
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +16 -0
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +98 -26
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +3 -78
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts +3 -49
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts +3 -49
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +5 -78
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +63 -12
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts +4 -13
- package/dist/runtime/services/module-federation.service.d.mts +4 -13
- package/dist/runtime/services/module-federation.service.mjs +63 -14
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/normalize.cjs +2 -22
- package/dist/runtime/services/normalize.d.cts +2 -21
- package/dist/runtime/services/normalize.d.mts +2 -21
- package/dist/runtime/services/normalize.mjs +2 -21
- package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +30 -29
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
- package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
- package/dist/runtime/services/plugin-loader.service.mjs +29 -30
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +10 -12
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts +14 -36
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts +14 -36
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs +14 -18
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +12 -12
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.d.cts +3 -15
- package/dist/runtime/services/secrets.service.d.mts +3 -15
- package/dist/runtime/services/secrets.service.mjs +12 -13
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/runtime/services/shared-identity.cjs +40 -0
- package/dist/runtime/services/shared-identity.cjs.map +1 -0
- package/dist/runtime/services/shared-identity.mjs +38 -0
- package/dist/runtime/services/shared-identity.mjs.map +1 -0
- package/dist/runtime/validation.cjs +2 -2
- package/dist/runtime/validation.cjs.map +1 -1
- package/dist/runtime/validation.mjs +2 -2
- package/dist/runtime/validation.mjs.map +1 -1
- package/dist/shared-deps-spec.cjs +384 -0
- package/dist/shared-deps-spec.cjs.map +1 -0
- package/dist/shared-deps-spec.d.cts +182 -0
- package/dist/shared-deps-spec.d.cts.map +1 -0
- package/dist/shared-deps-spec.d.mts +182 -0
- package/dist/shared-deps-spec.d.mts.map +1 -0
- package/dist/shared-deps-spec.mjs +368 -0
- package/dist/shared-deps-spec.mjs.map +1 -0
- package/dist/types.d.cts +22 -41
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +22 -41
- package/dist/types.d.mts.map +1 -1
- package/dist/ui/manifest/construct.cjs +268 -0
- package/dist/ui/manifest/construct.cjs.map +1 -0
- package/dist/ui/manifest/construct.d.cts +48 -0
- package/dist/ui/manifest/construct.d.cts.map +1 -0
- package/dist/ui/manifest/construct.d.mts +48 -0
- package/dist/ui/manifest/construct.d.mts.map +1 -0
- package/dist/ui/manifest/construct.mjs +268 -0
- package/dist/ui/manifest/construct.mjs.map +1 -0
- package/dist/ui/manifest/contract.cjs +34 -0
- package/dist/ui/manifest/contract.cjs.map +1 -0
- package/dist/ui/manifest/contract.d.cts +26 -0
- package/dist/ui/manifest/contract.d.cts.map +1 -0
- package/dist/ui/manifest/contract.d.mts +26 -0
- package/dist/ui/manifest/contract.d.mts.map +1 -0
- package/dist/ui/manifest/contract.mjs +26 -0
- package/dist/ui/manifest/contract.mjs.map +1 -0
- package/dist/ui/manifest/descriptor.cjs +64 -0
- package/dist/ui/manifest/descriptor.cjs.map +1 -0
- package/dist/ui/manifest/descriptor.d.cts +60 -0
- package/dist/ui/manifest/descriptor.d.cts.map +1 -0
- package/dist/ui/manifest/descriptor.d.mts +60 -0
- package/dist/ui/manifest/descriptor.d.mts.map +1 -0
- package/dist/ui/manifest/descriptor.mjs +61 -0
- package/dist/ui/manifest/descriptor.mjs.map +1 -0
- package/dist/ui/manifest/generator.cjs +128 -0
- package/dist/ui/manifest/generator.cjs.map +1 -0
- package/dist/ui/manifest/generator.d.cts +41 -0
- package/dist/ui/manifest/generator.d.cts.map +1 -0
- package/dist/ui/manifest/generator.d.mts +41 -0
- package/dist/ui/manifest/generator.d.mts.map +1 -0
- package/dist/ui/manifest/generator.mjs +125 -0
- package/dist/ui/manifest/generator.mjs.map +1 -0
- package/dist/ui/manifest/index.cjs +35 -0
- package/dist/ui/manifest/index.d.cts +9 -0
- package/dist/ui/manifest/index.d.mts +9 -0
- package/dist/ui/manifest/index.mjs +9 -0
- package/dist/ui/manifest/manifest-schema.cjs +97 -0
- package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.cts +132 -0
- package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.mts +132 -0
- package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
- package/dist/ui/manifest/manifest-schema.mjs +90 -0
- package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
- package/dist/ui/manifest/mount-registry.cjs +52 -0
- package/dist/ui/manifest/mount-registry.cjs.map +1 -0
- package/dist/ui/manifest/mount-registry.d.cts +61 -0
- package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
- package/dist/ui/manifest/mount-registry.d.mts +61 -0
- package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
- package/dist/ui/manifest/mount-registry.mjs +48 -0
- package/dist/ui/manifest/mount-registry.mjs.map +1 -0
- package/dist/ui/manifest/nav.cjs +13 -0
- package/dist/ui/manifest/nav.cjs.map +1 -0
- package/dist/ui/manifest/nav.d.cts +34 -0
- package/dist/ui/manifest/nav.d.cts.map +1 -0
- package/dist/ui/manifest/nav.d.mts +34 -0
- package/dist/ui/manifest/nav.d.mts.map +1 -0
- package/dist/ui/manifest/nav.mjs +13 -0
- package/dist/ui/manifest/nav.mjs.map +1 -0
- package/dist/ui/manifest/route-config.cjs +33 -0
- package/dist/ui/manifest/route-config.cjs.map +1 -0
- package/dist/ui/manifest/route-config.d.cts +40 -0
- package/dist/ui/manifest/route-config.d.cts.map +1 -0
- package/dist/ui/manifest/route-config.d.mts +40 -0
- package/dist/ui/manifest/route-config.d.mts.map +1 -0
- package/dist/ui/manifest/route-config.mjs +33 -0
- package/dist/ui/manifest/route-config.mjs.map +1 -0
- package/dist/version-manifest.cjs +65 -0
- package/dist/version-manifest.cjs.map +1 -0
- package/dist/version-manifest.d.cts +52 -0
- package/dist/version-manifest.d.cts.map +1 -0
- package/dist/version-manifest.d.mts +52 -0
- package/dist/version-manifest.d.mts.map +1 -0
- package/dist/version-manifest.mjs +63 -0
- package/dist/version-manifest.mjs.map +1 -0
- package/package.json +165 -68
- package/skills/plugin-client/SKILL.md +24 -5
- package/skills/plugin-development/SKILL.md +79 -47
- package/skills/plugin-testing/SKILL.md +41 -12
- package/src/build/artifact-names.ts +117 -0
- package/src/build/contract-types.ts +101 -0
- package/src/build/rspack/build-report-plugin.ts +34 -0
- package/src/build/rspack/chunk-completeness-plugin.ts +57 -0
- package/src/build/rspack/compose.ts +87 -0
- package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
- package/src/build/rspack/generated-config.ts +35 -0
- package/src/build/rspack/index.ts +10 -5
- package/src/build/rspack/module-federation.ts +1 -1
- package/src/build/rspack/plugin.ts +103 -105
- package/src/build/rspack/utils.ts +8 -2
- package/src/build/ui/factory.ts +96 -0
- package/src/build/ui/generated-config.ts +133 -0
- package/src/build/ui/hash-artifacts-plugin.ts +79 -0
- package/src/build/ui/index.ts +98 -0
- package/src/build/ui/manifest-plugin.ts +54 -0
- package/src/build/ui/rsbuild-config.ts +256 -0
- package/src/build/ui/stubs.ts +103 -0
- package/src/cli.ts +100 -0
- package/src/dev/serve.ts +477 -0
- package/src/dev/watch-kill.ts +58 -0
- package/src/effect-helpers.ts +25 -0
- package/src/errors.ts +16 -18
- package/src/identity.ts +36 -0
- package/src/index.ts +4 -0
- package/src/plugin.ts +70 -92
- package/src/remote-entry.ts +171 -0
- package/src/runtime/errors.ts +186 -27
- package/src/runtime/index.ts +132 -43
- package/src/runtime/mf-config.ts +12 -107
- package/src/runtime/services/module-federation.service.ts +221 -117
- package/src/runtime/services/normalize.ts +1 -18
- package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
- package/src/runtime/services/plugin-loader.service.ts +239 -212
- package/src/runtime/services/plugin.service.ts +61 -43
- package/src/runtime/services/secrets.service.ts +20 -15
- package/src/runtime/services/shared-identity.ts +68 -0
- package/src/runtime/validation.ts +5 -7
- package/src/shared-deps-spec.ts +478 -0
- package/src/types.ts +22 -48
- package/src/ui/manifest/construct.ts +403 -0
- package/src/ui/manifest/contract.ts +33 -0
- package/src/ui/manifest/descriptor.ts +96 -0
- package/src/ui/manifest/generator.ts +238 -0
- package/src/ui/manifest/index.ts +55 -0
- package/src/ui/manifest/manifest-schema.ts +107 -0
- package/src/ui/manifest/mount-registry.ts +50 -0
- package/src/ui/manifest/nav.ts +43 -0
- package/src/ui/manifest/route-config.ts +82 -0
- package/src/version-manifest.ts +88 -0
- package/dist/build/rspack/dev-server-middleware.cjs +0 -248
- package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
- package/dist/build/rspack/dev-server-middleware.mjs +0 -247
- package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
- package/dist/build/shared-deps.cjs +0 -83
- package/dist/build/shared-deps.cjs.map +0 -1
- package/dist/build/shared-deps.d.cts +0 -67
- package/dist/build/shared-deps.d.cts.map +0 -1
- package/dist/build/shared-deps.d.mts +0 -67
- package/dist/build/shared-deps.d.mts.map +0 -1
- package/dist/build/shared-deps.mjs +0 -79
- package/dist/build/shared-deps.mjs.map +0 -1
- package/dist/effect.cjs +0 -9
- package/dist/effect.d.cts +0 -1
- package/dist/effect.d.mts +0 -1
- package/dist/effect.mjs +0 -3
- package/dist/orpc-openapi.cjs +0 -17
- package/dist/orpc-openapi.d.cts +0 -2
- package/dist/orpc-openapi.d.mts +0 -2
- package/dist/orpc-openapi.mjs +0 -5
- package/dist/orpc.cjs +0 -46
- package/dist/orpc.d.cts +0 -7
- package/dist/orpc.d.mts +0 -7
- package/dist/orpc.mjs +0 -11
- package/dist/package.cjs +0 -23
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -17
- package/dist/package.mjs.map +0 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
- package/dist/runtime/services/normalize.cjs.map +0 -1
- package/dist/runtime/services/normalize.d.cts.map +0 -1
- package/dist/runtime/services/normalize.d.mts.map +0 -1
- package/dist/runtime/services/normalize.mjs.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
- package/dist/runtime/services/secrets.service.d.cts.map +0 -1
- package/dist/runtime/services/secrets.service.d.mts.map +0 -1
- package/dist/testing/index.cjs +0 -57
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -54
- package/dist/testing/index.d.cts.map +0 -1
- package/dist/testing/index.d.mts +0 -54
- package/dist/testing/index.d.mts.map +0 -1
- package/dist/testing/index.mjs +0 -55
- package/dist/testing/index.mjs.map +0 -1
- package/dist/zod-core.cjs +0 -9
- package/dist/zod-core.d.cts +0 -1
- package/dist/zod-core.d.mts +0 -1
- package/dist/zod-core.mjs +0 -3
- package/dist/zod.cjs +0 -11
- package/dist/zod.d.cts +0 -2
- package/dist/zod.d.mts +0 -2
- package/dist/zod.mjs +0 -3
- package/src/build/rspack/dev-server-middleware.ts +0 -324
- package/src/build/shared-deps.ts +0 -102
- package/src/effect.ts +0 -1
- package/src/orpc-openapi.ts +0 -2
- package/src/orpc.ts +0 -9
- package/src/testing/index.ts +0 -87
- package/src/testing/mocks/module-federation.service.ts +0 -41
- package/src/zod-core.ts +0 -1
- package/src/zod.ts +0 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_errors = require('../errors.cjs');
|
|
2
1
|
let effect = require("effect");
|
|
3
2
|
|
|
4
3
|
//#region src/runtime/services/plugin-lifecycle.service.ts
|
|
5
|
-
var PluginLifecycleService = class extends effect.
|
|
4
|
+
var PluginLifecycleService = class extends effect.Context.Service()("PluginLifecycleService") {};
|
|
5
|
+
const PluginLifecycleServiceDefault = effect.Layer.effect(PluginLifecycleService, effect.Effect.gen(function* () {
|
|
6
6
|
const activePlugins = yield* effect.Ref.make(/* @__PURE__ */ new Set());
|
|
7
7
|
return {
|
|
8
8
|
register: (plugin) => effect.Ref.update(activePlugins, (plugins) => new Set(plugins).add(plugin)),
|
|
@@ -17,20 +17,18 @@ var PluginLifecycleService = class extends effect.Effect.Service()("PluginLifecy
|
|
|
17
17
|
newSet.delete(plugin);
|
|
18
18
|
return newSet;
|
|
19
19
|
});
|
|
20
|
-
yield*
|
|
20
|
+
yield* effect.Scope.close(plugin.scope, effect.Exit.succeed(void 0)).pipe(effect.Effect.catchCause((cause) => effect.Effect.logWarning(`Failed to close scope for plugin ${plugin.plugin.id}`, cause)));
|
|
21
21
|
}),
|
|
22
|
-
cleanup:
|
|
22
|
+
cleanup: effect.Effect.gen(function* () {
|
|
23
23
|
const plugins = yield* effect.Ref.get(activePlugins);
|
|
24
|
-
if (
|
|
25
|
-
yield* effect.Effect.forEach(plugins, (plugin) => effect.Effect.
|
|
26
|
-
yield* plugin.plugin.shutdown().pipe(effect.Effect.catchAll((error) => effect.Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, error)));
|
|
27
|
-
yield* effect.Scope.close(plugin.scope, effect.Exit.succeed(void 0)).pipe(effect.Effect.catchAll((error) => effect.Effect.logWarning(`Failed to close scope for plugin ${plugin.plugin.id}`, error)));
|
|
28
|
-
}), { concurrency: "unbounded" });
|
|
24
|
+
if ((yield* effect.Config.String("EVERY_PLUGIN_DEBUG_SCOPES").pipe(effect.Config.withDefault(""), effect.Effect.orElseSucceed(() => ""))) === "1") yield* effect.Effect.logWarning(`[PluginLifecycle] cleaning up ${plugins.size} active plugin(s)`);
|
|
25
|
+
yield* effect.Effect.forEach(plugins, (plugin) => effect.Scope.close(plugin.scope, effect.Exit.succeed(void 0)).pipe(effect.Effect.catchCause((cause) => effect.Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, cause))), { concurrency: "unbounded" });
|
|
29
26
|
yield* effect.Ref.set(activePlugins, /* @__PURE__ */ new Set());
|
|
30
|
-
}).pipe(effect.Effect.
|
|
27
|
+
}).pipe(effect.Effect.catchCause((cause) => effect.Effect.logWarning("Plugin cleanup failed", cause)))
|
|
31
28
|
};
|
|
32
|
-
})
|
|
29
|
+
}));
|
|
33
30
|
|
|
34
31
|
//#endregion
|
|
35
32
|
exports.PluginLifecycleService = PluginLifecycleService;
|
|
33
|
+
exports.PluginLifecycleServiceDefault = PluginLifecycleServiceDefault;
|
|
36
34
|
//# sourceMappingURL=plugin-lifecycle.service.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-lifecycle.service.cjs","names":["
|
|
1
|
+
{"version":3,"file":"plugin-lifecycle.service.cjs","names":["Context","Layer","Effect","Ref","Scope","Exit","Config"],"sources":["../../../src/runtime/services/plugin-lifecycle.service.ts"],"sourcesContent":["import { Config, Context, Effect, Exit, Layer, Ref, Scope } from \"effect\";\nimport type { AnyPlugin, InitializedPlugin } from \"../../types\";\nimport type { PluginRuntimeError } from \"../errors\";\n\nexport interface PluginLifecycleServiceShape {\n register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) => Effect.Effect<void>;\n unregister: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void>;\n shutdown: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, PluginRuntimeError>;\n cleanup: Effect.Effect<void>;\n}\n\nexport class PluginLifecycleService extends Context.Service<\n PluginLifecycleService,\n PluginLifecycleServiceShape\n>()(\"PluginLifecycleService\") {}\n\nexport const PluginLifecycleServiceDefault = Layer.effect(\n PluginLifecycleService,\n Effect.gen(function* () {\n const activePlugins = yield* Ref.make(new Set<InitializedPlugin<AnyPlugin>>());\n\n return {\n register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) =>\n Ref.update(activePlugins, (plugins) =>\n new Set(plugins).add(plugin as InitializedPlugin<AnyPlugin>),\n ),\n\n unregister: (plugin: InitializedPlugin<AnyPlugin>) =>\n Ref.update(activePlugins, (plugins) => {\n const newSet = new Set(plugins);\n newSet.delete(plugin);\n return newSet;\n }),\n\n shutdown: (plugin: InitializedPlugin<AnyPlugin>) =>\n Effect.gen(function* () {\n yield* Ref.update(activePlugins, (plugins) => {\n const newSet = new Set(plugins);\n newSet.delete(plugin);\n return newSet;\n });\n\n yield* Scope.close(plugin.scope, Exit.succeed(undefined)).pipe(\n Effect.catchCause((cause) =>\n Effect.logWarning(`Failed to close scope for plugin ${plugin.plugin.id}`, cause),\n ),\n );\n }),\n\n cleanup: Effect.gen(function* () {\n const plugins = yield* Ref.get(activePlugins);\n const debugScopes = yield* Config.String(\"EVERY_PLUGIN_DEBUG_SCOPES\").pipe(\n Config.withDefault(\"\"),\n Effect.orElseSucceed(() => \"\"),\n );\n if (debugScopes === \"1\") {\n yield* Effect.logWarning(\n `[PluginLifecycle] cleaning up ${plugins.size} active plugin(s)`,\n );\n }\n\n yield* Effect.forEach(\n plugins,\n (plugin) =>\n Scope.close(plugin.scope, Exit.succeed(undefined)).pipe(\n Effect.catchCause((cause) =>\n Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, cause),\n ),\n ),\n { concurrency: \"unbounded\" },\n );\n\n yield* Ref.set(activePlugins, new Set());\n }).pipe(Effect.catchCause((cause) => Effect.logWarning(\"Plugin cleanup failed\", cause))),\n };\n }),\n);\n"],"mappings":";;;AAWA,IAAa,yBAAb,cAA4CA,eAAQ,QAGlD,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAE/B,MAAa,gCAAgCC,aAAM,OACjD,wBACAC,cAAO,IAAI,aAAa;CACtB,MAAM,gBAAgB,OAAOC,WAAI,qBAAK,IAAI,IAAkC,CAAC;CAE7E,OAAO;EACL,WAAgC,WAC9BA,WAAI,OAAO,gBAAgB,YACzB,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,MAAsC,CAC7D;EAEF,aAAa,WACXA,WAAI,OAAO,gBAAgB,YAAY;GACrC,MAAM,SAAS,IAAI,IAAI,OAAO;GAC9B,OAAO,OAAO,MAAM;GACpB,OAAO;EACT,CAAC;EAEH,WAAW,WACTD,cAAO,IAAI,aAAa;GACtB,OAAOC,WAAI,OAAO,gBAAgB,YAAY;IAC5C,MAAM,SAAS,IAAI,IAAI,OAAO;IAC9B,OAAO,OAAO,MAAM;IACpB,OAAO;GACT,CAAC;GAED,OAAOC,aAAM,MAAM,OAAO,OAAOC,YAAK,QAAQ,MAAS,CAAC,CAAC,CAAC,KACxDH,cAAO,YAAY,UACjBA,cAAO,WAAW,oCAAoC,OAAO,OAAO,MAAM,KAAK,CACjF,CACF;EACF,CAAC;EAEH,SAASA,cAAO,IAAI,aAAa;GAC/B,MAAM,UAAU,OAAOC,WAAI,IAAI,aAAa;GAK5C,KAAI,OAJuBG,cAAO,OAAO,2BAA2B,CAAC,CAAC,KACpEA,cAAO,YAAY,EAAE,GACrBJ,cAAO,oBAAoB,EAAE,CAC/B,OACoB,KAClB,OAAOA,cAAO,WACZ,iCAAiC,QAAQ,KAAK,kBAChD;GAGF,OAAOA,cAAO,QACZ,UACC,WACCE,aAAM,MAAM,OAAO,OAAOC,YAAK,QAAQ,MAAS,CAAC,CAAC,CAAC,KACjDH,cAAO,YAAY,UACjBA,cAAO,WAAW,6BAA6B,OAAO,OAAO,MAAM,KAAK,CAC1E,CACF,GACF,EAAE,aAAa,YAAY,CAC7B;GAEA,OAAOC,WAAI,IAAI,+BAAe,IAAI,IAAI,CAAC;EACzC,CAAC,CAAC,CAAC,KAAKD,cAAO,YAAY,UAAUA,cAAO,WAAW,yBAAyB,KAAK,CAAC,CAAC;CACzF;AACF,CAAC,CACH"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
//#region src/runtime/services/plugin-lifecycle.service.d.ts
|
|
5
|
-
declare const PluginLifecycleService_base: Effect.Service.Class<PluginLifecycleService, "PluginLifecycleService", {
|
|
6
|
-
readonly effect: Effect.Effect<{
|
|
7
|
-
register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) => Effect.Effect<void, never, never>;
|
|
8
|
-
unregister: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, never, never>;
|
|
9
|
-
shutdown: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, PluginRuntimeError, never>;
|
|
10
|
-
cleanup: () => Effect.Effect<void, never, never>;
|
|
11
|
-
}, never, never>;
|
|
12
|
-
}>;
|
|
13
|
-
declare class PluginLifecycleService extends PluginLifecycleService_base {}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { PluginLifecycleService };
|
|
16
|
-
//# sourceMappingURL=plugin-lifecycle.service.d.cts.map
|
|
1
|
+
import "../errors.cjs";
|
|
2
|
+
import "../../types.cjs";
|
|
3
|
+
import { Context, Effect, Layer } from "effect";
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
//#region src/runtime/services/plugin-lifecycle.service.d.ts
|
|
5
|
-
declare const PluginLifecycleService_base: Effect.Service.Class<PluginLifecycleService, "PluginLifecycleService", {
|
|
6
|
-
readonly effect: Effect.Effect<{
|
|
7
|
-
register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) => Effect.Effect<void, never, never>;
|
|
8
|
-
unregister: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, never, never>;
|
|
9
|
-
shutdown: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, PluginRuntimeError, never>;
|
|
10
|
-
cleanup: () => Effect.Effect<void, never, never>;
|
|
11
|
-
}, never, never>;
|
|
12
|
-
}>;
|
|
13
|
-
declare class PluginLifecycleService extends PluginLifecycleService_base {}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { PluginLifecycleService };
|
|
16
|
-
//# sourceMappingURL=plugin-lifecycle.service.d.mts.map
|
|
1
|
+
import "../errors.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
3
|
+
import { Context, Effect, Layer } from "effect";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Effect, Exit, Ref, Scope } from "effect";
|
|
1
|
+
import { Config, Context, Effect, Exit, Layer, Ref, Scope } from "effect";
|
|
3
2
|
|
|
4
3
|
//#region src/runtime/services/plugin-lifecycle.service.ts
|
|
5
|
-
var PluginLifecycleService = class extends
|
|
4
|
+
var PluginLifecycleService = class extends Context.Service()("PluginLifecycleService") {};
|
|
5
|
+
const PluginLifecycleServiceDefault = Layer.effect(PluginLifecycleService, Effect.gen(function* () {
|
|
6
6
|
const activePlugins = yield* Ref.make(/* @__PURE__ */ new Set());
|
|
7
7
|
return {
|
|
8
8
|
register: (plugin) => Ref.update(activePlugins, (plugins) => new Set(plugins).add(plugin)),
|
|
@@ -17,20 +17,17 @@ var PluginLifecycleService = class extends Effect.Service()("PluginLifecycleServ
|
|
|
17
17
|
newSet.delete(plugin);
|
|
18
18
|
return newSet;
|
|
19
19
|
});
|
|
20
|
-
yield*
|
|
20
|
+
yield* Scope.close(plugin.scope, Exit.succeed(void 0)).pipe(Effect.catchCause((cause) => Effect.logWarning(`Failed to close scope for plugin ${plugin.plugin.id}`, cause)));
|
|
21
21
|
}),
|
|
22
|
-
cleanup:
|
|
22
|
+
cleanup: Effect.gen(function* () {
|
|
23
23
|
const plugins = yield* Ref.get(activePlugins);
|
|
24
|
-
if (
|
|
25
|
-
yield* Effect.forEach(plugins, (plugin) => Effect.
|
|
26
|
-
yield* plugin.plugin.shutdown().pipe(Effect.catchAll((error) => Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, error)));
|
|
27
|
-
yield* Scope.close(plugin.scope, Exit.succeed(void 0)).pipe(Effect.catchAll((error) => Effect.logWarning(`Failed to close scope for plugin ${plugin.plugin.id}`, error)));
|
|
28
|
-
}), { concurrency: "unbounded" });
|
|
24
|
+
if ((yield* Config.String("EVERY_PLUGIN_DEBUG_SCOPES").pipe(Config.withDefault(""), Effect.orElseSucceed(() => ""))) === "1") yield* Effect.logWarning(`[PluginLifecycle] cleaning up ${plugins.size} active plugin(s)`);
|
|
25
|
+
yield* Effect.forEach(plugins, (plugin) => Scope.close(plugin.scope, Exit.succeed(void 0)).pipe(Effect.catchCause((cause) => Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, cause))), { concurrency: "unbounded" });
|
|
29
26
|
yield* Ref.set(activePlugins, /* @__PURE__ */ new Set());
|
|
30
|
-
}).pipe(Effect.
|
|
27
|
+
}).pipe(Effect.catchCause((cause) => Effect.logWarning("Plugin cleanup failed", cause)))
|
|
31
28
|
};
|
|
32
|
-
})
|
|
29
|
+
}));
|
|
33
30
|
|
|
34
31
|
//#endregion
|
|
35
|
-
export { PluginLifecycleService };
|
|
32
|
+
export { PluginLifecycleService, PluginLifecycleServiceDefault };
|
|
36
33
|
//# sourceMappingURL=plugin-lifecycle.service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-lifecycle.service.mjs","names":[],"sources":["../../../src/runtime/services/plugin-lifecycle.service.ts"],"sourcesContent":["import { Effect, Exit, Ref, Scope } from \"effect\";\nimport type { AnyPlugin, InitializedPlugin } from \"../../types\";\nimport {
|
|
1
|
+
{"version":3,"file":"plugin-lifecycle.service.mjs","names":[],"sources":["../../../src/runtime/services/plugin-lifecycle.service.ts"],"sourcesContent":["import { Config, Context, Effect, Exit, Layer, Ref, Scope } from \"effect\";\nimport type { AnyPlugin, InitializedPlugin } from \"../../types\";\nimport type { PluginRuntimeError } from \"../errors\";\n\nexport interface PluginLifecycleServiceShape {\n register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) => Effect.Effect<void>;\n unregister: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void>;\n shutdown: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, PluginRuntimeError>;\n cleanup: Effect.Effect<void>;\n}\n\nexport class PluginLifecycleService extends Context.Service<\n PluginLifecycleService,\n PluginLifecycleServiceShape\n>()(\"PluginLifecycleService\") {}\n\nexport const PluginLifecycleServiceDefault = Layer.effect(\n PluginLifecycleService,\n Effect.gen(function* () {\n const activePlugins = yield* Ref.make(new Set<InitializedPlugin<AnyPlugin>>());\n\n return {\n register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) =>\n Ref.update(activePlugins, (plugins) =>\n new Set(plugins).add(plugin as InitializedPlugin<AnyPlugin>),\n ),\n\n unregister: (plugin: InitializedPlugin<AnyPlugin>) =>\n Ref.update(activePlugins, (plugins) => {\n const newSet = new Set(plugins);\n newSet.delete(plugin);\n return newSet;\n }),\n\n shutdown: (plugin: InitializedPlugin<AnyPlugin>) =>\n Effect.gen(function* () {\n yield* Ref.update(activePlugins, (plugins) => {\n const newSet = new Set(plugins);\n newSet.delete(plugin);\n return newSet;\n });\n\n yield* Scope.close(plugin.scope, Exit.succeed(undefined)).pipe(\n Effect.catchCause((cause) =>\n Effect.logWarning(`Failed to close scope for plugin ${plugin.plugin.id}`, cause),\n ),\n );\n }),\n\n cleanup: Effect.gen(function* () {\n const plugins = yield* Ref.get(activePlugins);\n const debugScopes = yield* Config.String(\"EVERY_PLUGIN_DEBUG_SCOPES\").pipe(\n Config.withDefault(\"\"),\n Effect.orElseSucceed(() => \"\"),\n );\n if (debugScopes === \"1\") {\n yield* Effect.logWarning(\n `[PluginLifecycle] cleaning up ${plugins.size} active plugin(s)`,\n );\n }\n\n yield* Effect.forEach(\n plugins,\n (plugin) =>\n Scope.close(plugin.scope, Exit.succeed(undefined)).pipe(\n Effect.catchCause((cause) =>\n Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, cause),\n ),\n ),\n { concurrency: \"unbounded\" },\n );\n\n yield* Ref.set(activePlugins, new Set());\n }).pipe(Effect.catchCause((cause) => Effect.logWarning(\"Plugin cleanup failed\", cause))),\n };\n }),\n);\n"],"mappings":";;;AAWA,IAAa,yBAAb,cAA4C,QAAQ,QAGlD,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAE/B,MAAa,gCAAgC,MAAM,OACjD,wBACA,OAAO,IAAI,aAAa;CACtB,MAAM,gBAAgB,OAAO,IAAI,qBAAK,IAAI,IAAkC,CAAC;CAE7E,OAAO;EACL,WAAgC,WAC9B,IAAI,OAAO,gBAAgB,YACzB,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,MAAsC,CAC7D;EAEF,aAAa,WACX,IAAI,OAAO,gBAAgB,YAAY;GACrC,MAAM,SAAS,IAAI,IAAI,OAAO;GAC9B,OAAO,OAAO,MAAM;GACpB,OAAO;EACT,CAAC;EAEH,WAAW,WACT,OAAO,IAAI,aAAa;GACtB,OAAO,IAAI,OAAO,gBAAgB,YAAY;IAC5C,MAAM,SAAS,IAAI,IAAI,OAAO;IAC9B,OAAO,OAAO,MAAM;IACpB,OAAO;GACT,CAAC;GAED,OAAO,MAAM,MAAM,OAAO,OAAO,KAAK,QAAQ,MAAS,CAAC,CAAC,CAAC,KACxD,OAAO,YAAY,UACjB,OAAO,WAAW,oCAAoC,OAAO,OAAO,MAAM,KAAK,CACjF,CACF;EACF,CAAC;EAEH,SAAS,OAAO,IAAI,aAAa;GAC/B,MAAM,UAAU,OAAO,IAAI,IAAI,aAAa;GAK5C,KAAI,OAJuB,OAAO,OAAO,2BAA2B,CAAC,CAAC,KACpE,OAAO,YAAY,EAAE,GACrB,OAAO,oBAAoB,EAAE,CAC/B,OACoB,KAClB,OAAO,OAAO,WACZ,iCAAiC,QAAQ,KAAK,kBAChD;GAGF,OAAO,OAAO,QACZ,UACC,WACC,MAAM,MAAM,OAAO,OAAO,KAAK,QAAQ,MAAS,CAAC,CAAC,CAAC,KACjD,OAAO,YAAY,UACjB,OAAO,WAAW,6BAA6B,OAAO,OAAO,MAAM,KAAK,CAC1E,CACF,GACF,EAAE,aAAa,YAAY,CAC7B;GAEA,OAAO,IAAI,IAAI,+BAAe,IAAI,IAAI,CAAC;EACzC,CAAC,CAAC,CAAC,KAAK,OAAO,YAAY,UAAU,OAAO,WAAW,yBAAyB,KAAK,CAAC,CAAC;CACzF;AACF,CAAC,CACH"}
|
|
@@ -6,20 +6,20 @@ const require_secrets_service = require('./secrets.service.cjs');
|
|
|
6
6
|
let effect = require("effect");
|
|
7
7
|
|
|
8
8
|
//#region src/runtime/services/plugin-loader.service.ts
|
|
9
|
-
var PluginRegistryTag = class extends effect.Context.
|
|
10
|
-
var PluginMapTag = class extends effect.Context.
|
|
11
|
-
var RegistryService = class extends effect.
|
|
9
|
+
var PluginRegistryTag = class extends effect.Context.Service()("PluginRegistry") {};
|
|
10
|
+
var PluginMapTag = class extends effect.Context.Service()("PluginMap") {};
|
|
11
|
+
var RegistryService = class extends effect.Context.Service()("RegistryService") {};
|
|
12
|
+
const RegistryServiceDefault = effect.Layer.effect(RegistryService, effect.Effect.gen(function* () {
|
|
12
13
|
const registry = yield* PluginRegistryTag;
|
|
13
14
|
const pluginMap = yield* PluginMapTag;
|
|
14
15
|
return {
|
|
15
16
|
get: (pluginId) => effect.Effect.gen(function* () {
|
|
16
17
|
const entry = registry[pluginId];
|
|
17
|
-
if (!entry) return yield*
|
|
18
|
+
if (!entry) return yield* new require_errors.PluginRuntimeError({
|
|
18
19
|
pluginId,
|
|
19
20
|
operation: "validate-plugin-id",
|
|
20
|
-
cause: /* @__PURE__ */ new Error(`Plugin ${pluginId} not found in registry`)
|
|
21
|
-
|
|
22
|
-
}));
|
|
21
|
+
cause: /* @__PURE__ */ new Error(`Plugin ${pluginId} not found in registry`)
|
|
22
|
+
});
|
|
23
23
|
if ("module" in entry) return {
|
|
24
24
|
constructor: entry.module,
|
|
25
25
|
metadata: {
|
|
@@ -39,8 +39,9 @@ var RegistryService = class extends effect.Effect.Service()("RegistryService", {
|
|
|
39
39
|
}),
|
|
40
40
|
getModule: (pluginId) => effect.Effect.succeed(pluginMap[pluginId] || null)
|
|
41
41
|
};
|
|
42
|
-
})
|
|
43
|
-
var PluginLoaderService = class extends effect.
|
|
42
|
+
}));
|
|
43
|
+
var PluginLoaderService = class extends effect.Context.Service()("PluginLoaderService") {};
|
|
44
|
+
const PluginLoaderServiceDefault = effect.Layer.effect(PluginLoaderService, effect.Effect.gen(function* () {
|
|
44
45
|
const moduleFederationService = yield* require_module_federation_service.ModuleFederationService;
|
|
45
46
|
const secretsService = yield* require_secrets_service.SecretsService;
|
|
46
47
|
const registryService = yield* RegistryService;
|
|
@@ -56,25 +57,24 @@ var PluginLoaderService = class extends effect.Effect.Service()("PluginLoaderSer
|
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
const url = entry.metadata.remoteUrl;
|
|
59
|
-
if (!url) return yield*
|
|
60
|
+
if (!url) return yield* new require_errors.PluginRuntimeError({
|
|
60
61
|
pluginId,
|
|
61
62
|
operation: "load-plugin",
|
|
62
|
-
cause: /* @__PURE__ */ new Error(`Plugin ${pluginId} has no module or remote URL configured`)
|
|
63
|
-
|
|
64
|
-
}));
|
|
63
|
+
cause: /* @__PURE__ */ new Error(`Plugin ${pluginId} has no module or remote URL configured`)
|
|
64
|
+
});
|
|
65
65
|
const resolvedUrl = resolveUrl(url);
|
|
66
|
-
yield* moduleFederationService.registerRemote(pluginId, resolvedUrl).pipe(effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${pluginId} failed during register-remote: ${error}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, pluginId, void 0, "register-remote"
|
|
66
|
+
yield* moduleFederationService.registerRemote(pluginId, resolvedUrl).pipe(effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${pluginId} failed during register-remote: ${String(error)}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, pluginId, void 0, "register-remote")));
|
|
67
67
|
yield* effect.Effect.logDebug("Loading plugin from remote", {
|
|
68
68
|
pluginId,
|
|
69
69
|
url: resolvedUrl
|
|
70
70
|
});
|
|
71
71
|
return {
|
|
72
|
-
ctor: yield* moduleFederationService.loadRemoteConstructor(pluginId, resolvedUrl).pipe(effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${pluginId} failed during load-remote: ${error}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, pluginId, void 0, "load-remote"
|
|
72
|
+
ctor: yield* moduleFederationService.loadRemoteConstructor(pluginId, resolvedUrl).pipe(effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${pluginId} failed during load-remote: ${String(error)}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, pluginId, void 0, "load-remote"))),
|
|
73
73
|
metadata: entry.metadata
|
|
74
74
|
};
|
|
75
75
|
}),
|
|
76
76
|
instantiatePlugin: (pluginId, loadedPlugin) => effect.Effect.gen(function* () {
|
|
77
|
-
const instance = yield* effect.Effect.try(() => new loadedPlugin.ctor()).pipe(effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${pluginId} failed during instantiate-plugin: ${error}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, pluginId, void 0, "instantiate-plugin"
|
|
77
|
+
const instance = yield* effect.Effect.try(() => new loadedPlugin.ctor()).pipe(effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${pluginId} failed during instantiate-plugin: ${error}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, pluginId, void 0, "instantiate-plugin")));
|
|
78
78
|
instance.id = pluginId;
|
|
79
79
|
return {
|
|
80
80
|
plugin: instance,
|
|
@@ -86,14 +86,12 @@ var PluginLoaderService = class extends effect.Effect.Service()("PluginLoaderSer
|
|
|
86
86
|
const validatedVariables = yield* require_validation.validate(plugin.configSchema.variables, config.variables, plugin.id, "config").pipe(effect.Effect.mapError((validationError) => new require_errors.PluginRuntimeError({
|
|
87
87
|
pluginId: plugin.id,
|
|
88
88
|
operation: "validate-config",
|
|
89
|
-
cause: validationError.zodError
|
|
90
|
-
retryable: false
|
|
89
|
+
cause: validationError.zodError
|
|
91
90
|
})));
|
|
92
91
|
const validatedSecrets = yield* require_validation.validate(plugin.configSchema.secrets, config.secrets, plugin.id, "config").pipe(effect.Effect.mapError((validationError) => new require_errors.PluginRuntimeError({
|
|
93
92
|
pluginId: plugin.id,
|
|
94
93
|
operation: "validate-secrets",
|
|
95
|
-
cause: validationError.zodError
|
|
96
|
-
retryable: false
|
|
94
|
+
cause: validationError.zodError
|
|
97
95
|
})));
|
|
98
96
|
const hydratedConfig = yield* secretsService.hydrateSecrets({
|
|
99
97
|
variables: validatedVariables,
|
|
@@ -102,15 +100,16 @@ var PluginLoaderService = class extends effect.Effect.Service()("PluginLoaderSer
|
|
|
102
100
|
const _variables = yield* require_validation.validate(plugin.configSchema.variables, hydratedConfig.variables, plugin.id, "config").pipe(effect.Effect.mapError((validationError) => new require_errors.PluginRuntimeError({
|
|
103
101
|
pluginId: plugin.id,
|
|
104
102
|
operation: "validate-hydrated-config",
|
|
105
|
-
cause: validationError.zodError
|
|
106
|
-
retryable: false
|
|
103
|
+
cause: validationError.zodError
|
|
107
104
|
})));
|
|
108
105
|
const scope = yield* effect.Scope.make();
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
const effectContext = yield* effect.Effect.gen(function* () {
|
|
107
|
+
const layer = yield* plugin.initialize({
|
|
108
|
+
variables: _variables,
|
|
109
|
+
secrets: hydratedConfig.secrets
|
|
110
|
+
}, plugins ?? {}).pipe(effect.Effect.provideService(require_plugin.PluginIdTag, plugin.id), effect.Effect.provideService(effect.Scope.Scope, scope));
|
|
111
|
+
return yield* effect.Layer.buildWithScope(layer, scope).pipe(effect.Effect.provideService(require_plugin.PluginIdTag, plugin.id), effect.Effect.provideService(effect.Scope.Scope, scope), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, plugin.id, void 0, "initialize-layer")));
|
|
112
|
+
}).pipe(effect.Effect.onExit((exit) => effect.Exit.isSuccess(exit) ? effect.Effect.void : effect.Scope.close(scope, exit).pipe(effect.Effect.catchCause((closeCause) => effect.Effect.logWarning(`Failed to close scope for plugin ${plugin.id} after initialize error`, closeCause)))), effect.Effect.tapError((error) => effect.Effect.logError(`Plugin ${plugin.id} failed during initialize-plugin: ${String(error)}`)), effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, plugin.id, void 0, "initialize-plugin")));
|
|
114
113
|
return {
|
|
115
114
|
plugin,
|
|
116
115
|
metadata: pluginInstance.metadata,
|
|
@@ -118,16 +117,18 @@ var PluginLoaderService = class extends effect.Effect.Service()("PluginLoaderSer
|
|
|
118
117
|
variables: _variables,
|
|
119
118
|
secrets: hydratedConfig.secrets
|
|
120
119
|
},
|
|
121
|
-
|
|
120
|
+
effectContext,
|
|
122
121
|
scope
|
|
123
122
|
};
|
|
124
123
|
})
|
|
125
124
|
};
|
|
126
|
-
})
|
|
125
|
+
}));
|
|
127
126
|
|
|
128
127
|
//#endregion
|
|
129
128
|
exports.PluginLoaderService = PluginLoaderService;
|
|
129
|
+
exports.PluginLoaderServiceDefault = PluginLoaderServiceDefault;
|
|
130
130
|
exports.PluginMapTag = PluginMapTag;
|
|
131
131
|
exports.PluginRegistryTag = PluginRegistryTag;
|
|
132
132
|
exports.RegistryService = RegistryService;
|
|
133
|
+
exports.RegistryServiceDefault = RegistryServiceDefault;
|
|
133
134
|
//# sourceMappingURL=plugin-loader.service.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.service.cjs","names":["Context","Effect","PluginRuntimeError","ModuleFederationService","SecretsService","toPluginRuntimeError","validate","Scope","Layer","EffectContext","PluginIdTag","Exit"],"sources":["../../../src/runtime/services/plugin-loader.service.ts"],"sourcesContent":["import type { InferSchemaInput, InferSchemaOutput } from \"@orpc/contract\";\nimport { Context, Effect, Context as EffectContext, Exit, Layer, Scope } from \"effect\";\nimport type { z } from \"zod\";\nimport { PluginIdTag, type PluginServicesTools } from \"../../plugin\";\nimport type {\n AnyPlugin,\n AnyPluginConstructor,\n InitializedPlugin,\n LoadedPlugin,\n PluginInstance,\n PluginMetadata,\n PluginRegistry,\n} from \"../../types\";\nimport { PluginRuntimeError, toPluginRuntimeError } from \"../errors\";\nimport { validate } from \"../validation\";\nimport { ModuleFederationService } from \"./module-federation.service\";\nimport { SecretsService } from \"./secrets.service\";\n\nexport class PluginRegistryTag extends Context.Tag(\"PluginRegistry\")<\n PluginRegistryTag,\n PluginRegistry\n>() {}\n\nexport class PluginMapTag extends Context.Tag(\"PluginMap\")<\n PluginMapTag,\n Record<string, AnyPluginConstructor>\n>() {}\n\nexport class RegistryService extends Effect.Service<RegistryService>()(\"RegistryService\", {\n effect: Effect.gen(function* () {\n const registry = yield* PluginRegistryTag;\n const pluginMap = yield* PluginMapTag;\n\n return {\n get: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = registry[pluginId];\n\n if (!entry) {\n return yield* Effect.fail(\n new PluginRuntimeError({\n pluginId,\n operation: \"validate-plugin-id\",\n cause: new Error(`Plugin ${pluginId} not found in registry`),\n retryable: false,\n }),\n );\n }\n\n if (\"module\" in entry) {\n return {\n constructor: entry.module,\n metadata: {\n remoteUrl: entry.remote || \"\",\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }\n\n return {\n constructor: null,\n metadata: {\n remoteUrl: entry.remote,\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }),\n\n getModule: (pluginId: string) => Effect.succeed(pluginMap[pluginId] || null),\n };\n }),\n}) {}\n\nexport class PluginLoaderService extends Effect.Service<PluginLoaderService>()(\n \"PluginLoaderService\",\n {\n effect: Effect.gen(function* () {\n const moduleFederationService = yield* ModuleFederationService;\n const secretsService = yield* SecretsService;\n const registryService = yield* RegistryService;\n\n const resolveUrl = (baseUrl: string, version?: string): string =>\n version && version !== \"latest\" ? baseUrl.replace(\"@latest\", `@${version}`) : baseUrl;\n\n return {\n loadPlugin: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = yield* registryService.get(pluginId);\n\n if (entry.constructor) {\n yield* Effect.logDebug(\"Loading plugin from direct module\", { pluginId });\n\n return {\n ctor: entry.constructor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }\n\n const url = entry.metadata.remoteUrl;\n if (!url) {\n return yield* Effect.fail(\n new PluginRuntimeError({\n pluginId,\n operation: \"load-plugin\",\n cause: new Error(`Plugin ${pluginId} has no module or remote URL configured`),\n retryable: false,\n }),\n );\n }\n\n const resolvedUrl = resolveUrl(url);\n\n yield* moduleFederationService.registerRemote(pluginId, resolvedUrl).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during register-remote: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"register-remote\", true),\n ),\n );\n\n yield* Effect.logDebug(\"Loading plugin from remote\", { pluginId, url: resolvedUrl });\n\n const ctor = yield* moduleFederationService\n .loadRemoteConstructor(pluginId, resolvedUrl)\n .pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during load-remote: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"load-remote\", false),\n ),\n );\n\n return {\n ctor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }),\n\n instantiatePlugin: <T extends AnyPlugin>(pluginId: string, loadedPlugin: LoadedPlugin<T>) =>\n Effect.gen(function* () {\n const instance = yield* Effect.try(() => new loadedPlugin.ctor()).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during instantiate-plugin: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"instantiate-plugin\", false),\n ),\n );\n\n (instance.id as string) = pluginId;\n\n return {\n plugin: instance,\n metadata: loadedPlugin.metadata,\n } satisfies PluginInstance<T>;\n }),\n\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) =>\n Effect.gen(function* () {\n const { plugin } = pluginInstance;\n\n // Validate and hydrate config\n const validatedVariables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n config.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-config\",\n cause: validationError.zodError,\n retryable: false,\n }),\n ),\n );\n\n // Validate secrets\n const validatedSecrets = yield* validate(\n plugin.configSchema.secrets as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"secrets\"]>\n >,\n config.secrets,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-secrets\",\n cause: validationError.zodError,\n retryable: false,\n }),\n ),\n );\n\n // Hydrate secrets in variables\n const hydratedConfig = yield* secretsService.hydrateSecrets({\n variables: validatedVariables,\n secrets: validatedSecrets,\n });\n\n const _variables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n hydratedConfig.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-hydrated-config\",\n cause: validationError.zodError,\n retryable: false,\n }),\n ),\n );\n\n // Create a long-lived scope for this plugin instance\n const scope = yield* Scope.make();\n\n // Create a per-plugin MemoMap so tool-built layers are memoized\n const memoMap = yield* Layer.makeMemoMap;\n\n const tools: PluginServicesTools = {\n buildService: (tag: any, layer: any) =>\n (Layer.buildWithMemoMap(layer, memoMap, scope) as any).pipe(\n Effect.map((ctx: any) => EffectContext.get(ctx, tag)) as any,\n ),\n };\n\n // Initialize plugin within the scope.\n // If initialize fails, close the scope immediately so scoped\n // resources (DB pools, caches) are released — otherwise every\n // failed initialization leaks until the process exits.\n const context = yield* plugin\n .initialize(\n { variables: _variables, secrets: hydratedConfig.secrets },\n plugins ?? {},\n tools,\n )\n .pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n Effect.tapError(() =>\n Scope.close(scope, Exit.succeed(undefined)).pipe(\n Effect.catchAll((closeError) =>\n Effect.logWarning(\n `Failed to close scope for plugin ${plugin.id} after initialize error`,\n closeError,\n ),\n ),\n ),\n ),\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${plugin.id} failed during initialize-plugin: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-plugin\", false),\n ),\n );\n\n return {\n plugin,\n metadata: pluginInstance.metadata,\n config: { variables: _variables, secrets: hydratedConfig.secrets },\n context,\n scope,\n } satisfies InitializedPlugin<T>;\n }),\n };\n }),\n },\n) {}\n"],"mappings":";;;;;;;;AAkBA,IAAa,oBAAb,cAAuCA,eAAQ,IAAI,gBAAgB,CAAC,CAGlE,CAAC,CAAC,CAAC;AAEL,IAAa,eAAb,cAAkCA,eAAQ,IAAI,WAAW,CAAC,CAGxD,CAAC,CAAC,CAAC;AAEL,IAAa,kBAAb,cAAqCC,cAAO,QAAyB,CAAC,CAAC,mBAAmB,EACxF,QAAQA,cAAO,IAAI,aAAa;CAC9B,MAAM,WAAW,OAAO;CACxB,MAAM,YAAY,OAAO;CAEzB,OAAO;EACL,MAAM,aACJA,cAAO,IAAI,aAAa;GACtB,MAAM,QAAQ,SAAS;GAEvB,IAAI,CAAC,OACH,OAAO,OAAOA,cAAO,KACnB,IAAIC,kCAAmB;IACrB;IACA,WAAW;IACX,uBAAO,IAAI,MAAM,UAAU,SAAS,uBAAuB;IAC3D,WAAW;GACb,CAAC,CACH;GAGF,IAAI,YAAY,OACd,OAAO;IACL,aAAa,MAAM;IACnB,UAAU;KACR,WAAW,MAAM,UAAU;KAC3B,SAAS,MAAM;KACf,aAAa,MAAM;IACrB;GACF;GAGF,OAAO;IACL,aAAa;IACb,UAAU;KACR,WAAW,MAAM;KACjB,SAAS,MAAM;KACf,aAAa,MAAM;IACrB;GACF;EACF,CAAC;EAEH,YAAY,aAAqBD,cAAO,QAAQ,UAAU,aAAa,IAAI;CAC7E;AACF,CAAC,EACH,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,sBAAb,cAAyCA,cAAO,QAA6B,CAAC,CAC5E,uBACA,EACE,QAAQA,cAAO,IAAI,aAAa;CAC9B,MAAM,0BAA0B,OAAOE;CACvC,MAAM,iBAAiB,OAAOC;CAC9B,MAAM,kBAAkB,OAAO;CAE/B,MAAM,cAAc,SAAi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I,CACN,CAAC,CACA,KACCR,cAAO,eAAeS,4BAAa,OAAO,EAAE,GAC5CT,cAAO,eAAeM,aAAM,OAAO,KAAK,GACxCN,cAAO,eACLM,aAAM,MAAM,OAAOI,YAAK,QAAQ,MAAS,CAAC,CAAC,CAAC,KAC1CV,cAAO,UAAU,eACfA,cAAO,WACL,oCAAoC,OAAO,GAAG,0BAC9C,UACF,CACF,CACF,CACF,GACAA,cAAO,UAAU,UACfA,cAAO,SAAS,UAAU,OAAO,GAAG,oCAAoC,OAAO,CACjF,GACAA,cAAO,UAAU,UACfI,oCAAqB,OAAO,OAAO,IAAI,QAAW,qBAAqB,KAAK,CAC9E,CACF;GAEF,OAAO;IACL;IACA,UAAU,eAAe;IACzB,QAAQ;KAAE,WAAW;KAAY,SAAS,eAAe;IAAQ;IACjE;IACA;GACF;EACF,CAAC;CACL;AACF,CAAC,EACH,CACF,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"plugin-loader.service.cjs","names":["Context","Layer","Effect","PluginRuntimeError","ModuleFederationService","SecretsService","toPluginRuntimeError","validate","Scope","PluginIdTag","Exit"],"sources":["../../../src/runtime/services/plugin-loader.service.ts"],"sourcesContent":["import type { InferSchemaInput, InferSchemaOutput } from \"@orpc/contract\";\nimport { Context, Effect, Exit, Layer, Scope } from \"effect\";\nimport type { z } from \"zod\";\nimport { PluginIdTag } from \"../../plugin\";\nimport type {\n AnyPlugin,\n AnyPluginConstructor,\n InitializedPlugin,\n LoadedPlugin,\n PluginInstance,\n PluginMetadata,\n PluginRegistry,\n} from \"../../types\";\nimport { PluginRuntimeError, toPluginRuntimeError } from \"../errors\";\nimport { validate } from \"../validation\";\nimport { ModuleFederationService } from \"./module-federation.service\";\nimport { SecretsService } from \"./secrets.service\";\n\nexport class PluginRegistryTag extends Context.Service<PluginRegistryTag, PluginRegistry>()(\n \"PluginRegistry\",\n) {}\n\nexport class PluginMapTag extends Context.Service<\n PluginMapTag,\n Record<string, AnyPluginConstructor>\n>()(\"PluginMap\") {}\n\nexport interface RegistryServiceShape {\n get: (\n pluginId: string,\n ) => Effect.Effect<\n { constructor: (new () => AnyPlugin) | null; metadata: PluginMetadata },\n PluginRuntimeError\n >;\n getModule: (pluginId: string) => Effect.Effect<AnyPluginConstructor | null>;\n}\n\nexport class RegistryService extends Context.Service<RegistryService, RegistryServiceShape>()(\n \"RegistryService\",\n) {}\n\nexport const RegistryServiceDefault = Layer.effect(\n RegistryService,\n Effect.gen(function* () {\n const registry = yield* PluginRegistryTag;\n const pluginMap = yield* PluginMapTag;\n\n return {\n get: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = registry[pluginId];\n\n if (!entry) {\n return yield* new PluginRuntimeError({\n pluginId,\n operation: \"validate-plugin-id\",\n cause: new Error(`Plugin ${pluginId} not found in registry`),\n });\n }\n\n if (\"module\" in entry) {\n return {\n constructor: entry.module,\n metadata: {\n remoteUrl: entry.remote || \"\",\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }\n\n return {\n constructor: null,\n metadata: {\n remoteUrl: entry.remote,\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }),\n\n getModule: (pluginId: string) => Effect.succeed(pluginMap[pluginId] || null),\n };\n }),\n);\n\nexport interface PluginLoaderServiceShape {\n loadPlugin: (pluginId: string) => Effect.Effect<LoadedPlugin, PluginRuntimeError>;\n instantiatePlugin: <T extends AnyPlugin>(\n pluginId: string,\n loadedPlugin: LoadedPlugin<T>,\n ) => Effect.Effect<PluginInstance<T>, PluginRuntimeError>;\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) => Effect.Effect<InitializedPlugin<T>, PluginRuntimeError>;\n}\n\nexport class PluginLoaderService extends Context.Service<\n PluginLoaderService,\n PluginLoaderServiceShape\n>()(\"PluginLoaderService\") {}\n\nexport const PluginLoaderServiceDefault = Layer.effect(\n PluginLoaderService,\n Effect.gen(function* () {\n const moduleFederationService = yield* ModuleFederationService;\n const secretsService = yield* SecretsService;\n const registryService = yield* RegistryService;\n\n const resolveUrl = (baseUrl: string, version?: string): string =>\n version && version !== \"latest\" ? baseUrl.replace(\"@latest\", `@${version}`) : baseUrl;\n\n return {\n loadPlugin: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = yield* registryService.get(pluginId);\n\n if (entry.constructor) {\n yield* Effect.logDebug(\"Loading plugin from direct module\", { pluginId });\n\n return {\n ctor: entry.constructor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }\n\n const url = entry.metadata.remoteUrl;\n if (!url) {\n return yield* new PluginRuntimeError({\n pluginId,\n operation: \"load-plugin\",\n cause: new Error(`Plugin ${pluginId} has no module or remote URL configured`),\n });\n }\n\n const resolvedUrl = resolveUrl(url);\n\n yield* moduleFederationService.registerRemote(pluginId, resolvedUrl).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during register-remote: ${String(error)}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"register-remote\"),\n ),\n );\n\n yield* Effect.logDebug(\"Loading plugin from remote\", { pluginId, url: resolvedUrl });\n\n const ctor = yield* moduleFederationService\n .loadRemoteConstructor(pluginId, resolvedUrl)\n .pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during load-remote: ${String(error)}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"load-remote\"),\n ),\n );\n\n return {\n ctor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }),\n\n instantiatePlugin: <T extends AnyPlugin>(pluginId: string, loadedPlugin: LoadedPlugin<T>) =>\n Effect.gen(function* () {\n const instance = yield* Effect.try(() => new loadedPlugin.ctor()).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during instantiate-plugin: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"instantiate-plugin\"),\n ),\n );\n\n (instance.id as string) = pluginId;\n\n return {\n plugin: instance,\n metadata: loadedPlugin.metadata,\n } satisfies PluginInstance<T>;\n }),\n\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) =>\n Effect.gen(function* () {\n const { plugin } = pluginInstance;\n\n // Validate and hydrate config\n const validatedVariables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n config.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-config\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Validate secrets\n const validatedSecrets = yield* validate(\n plugin.configSchema.secrets as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"secrets\"]>\n >,\n config.secrets,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-secrets\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Hydrate secrets in variables\n const hydratedConfig = yield* secretsService.hydrateSecrets({\n variables: validatedVariables,\n secrets: validatedSecrets,\n });\n\n const _variables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n hydratedConfig.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-hydrated-config\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Create a long-lived scope for this plugin instance. Initialize\n // returns a Layer which is built against this scope, so scoped\n // resources (DB pools, caches) release on plugin shutdown.\n const scope = yield* Scope.make();\n\n // Build the plugin's Layer within the scope.\n // On failure, close the scope immediately so scoped resources\n // (DB pools, caches) are released — otherwise every failed\n // initialization leaks until the process exits.\n const effectContext = yield* Effect.gen(function* () {\n const layer = yield* plugin\n .initialize({ variables: _variables, secrets: hydratedConfig.secrets }, plugins ?? {})\n .pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n );\n\n return yield* Layer.buildWithScope(layer, scope).pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-layer\"),\n ),\n );\n }).pipe(\n Effect.onExit((exit) =>\n Exit.isSuccess(exit)\n ? Effect.void\n : Scope.close(scope, exit).pipe(\n Effect.catchCause((closeCause) =>\n Effect.logWarning(\n `Failed to close scope for plugin ${plugin.id} after initialize error`,\n closeCause,\n ),\n ),\n ),\n ),\n Effect.tapError((error) =>\n Effect.logError(\n `Plugin ${plugin.id} failed during initialize-plugin: ${String(error)}`,\n ),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-plugin\"),\n ),\n );\n\n return {\n plugin,\n metadata: pluginInstance.metadata,\n config: { variables: _variables, secrets: hydratedConfig.secrets },\n effectContext,\n scope,\n } satisfies InitializedPlugin<T>;\n }),\n };\n }),\n);\n"],"mappings":";;;;;;;;AAkBA,IAAa,oBAAb,cAAuCA,eAAQ,QAA2C,CAAC,CACzF,gBACF,CAAC,CAAC,CAAC;AAEH,IAAa,eAAb,cAAkCA,eAAQ,QAGxC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAYlB,IAAa,kBAAb,cAAqCA,eAAQ,QAA+C,CAAC,CAC3F,iBACF,CAAC,CAAC,CAAC;AAEH,MAAa,yBAAyBC,aAAM,OAC1C,iBACAC,cAAO,IAAI,aAAa;CAC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AAO,UAAU,UACfI,oCAAqB,OAAO,OAAO,IAAI,QAAW,mBAAmB,CACvE,CACF;GAEA,OAAO;IACL;IACA,UAAU,eAAe;IACzB,QAAQ;KAAE,WAAW;KAAY,SAAS,eAAe;IAAQ;IACjE;IACA;GACF;EACF,CAAC;CACL;AACF,CAAC,CACH"}
|
|
@@ -1,53 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Context, Effect,
|
|
6
|
-
import { InferSchemaInput
|
|
7
|
-
//#region src/runtime/services/plugin-loader.service.d.ts
|
|
8
|
-
declare const PluginRegistryTag_base: Context.TagClass<PluginRegistryTag, "PluginRegistry", PluginRegistry>;
|
|
9
|
-
declare class PluginRegistryTag extends PluginRegistryTag_base {}
|
|
10
|
-
declare const PluginMapTag_base: Context.TagClass<PluginMapTag, "PluginMap", Record<string, AnyPluginConstructor>>;
|
|
11
|
-
declare class PluginMapTag extends PluginMapTag_base {}
|
|
12
|
-
declare const RegistryService_base: Effect.Service.Class<RegistryService, "RegistryService", {
|
|
13
|
-
readonly effect: Effect.Effect<{
|
|
14
|
-
get: (pluginId: string) => Effect.Effect<{
|
|
15
|
-
constructor: AnyPluginConstructor;
|
|
16
|
-
metadata: PluginMetadata;
|
|
17
|
-
} | {
|
|
18
|
-
constructor: null;
|
|
19
|
-
metadata: PluginMetadata;
|
|
20
|
-
}, PluginRuntimeError, never>;
|
|
21
|
-
getModule: (pluginId: string) => Effect.Effect<AnyPluginConstructor | null, never, never>;
|
|
22
|
-
}, never, PluginRegistryTag | PluginMapTag>;
|
|
23
|
-
}>;
|
|
24
|
-
declare class RegistryService extends RegistryService_base {}
|
|
25
|
-
declare const PluginLoaderService_base: Effect.Service.Class<PluginLoaderService, "PluginLoaderService", {
|
|
26
|
-
readonly effect: Effect.Effect<{
|
|
27
|
-
loadPlugin: (pluginId: string) => Effect.Effect<{
|
|
28
|
-
ctor: any;
|
|
29
|
-
metadata: PluginMetadata;
|
|
30
|
-
}, PluginRuntimeError, never>;
|
|
31
|
-
instantiatePlugin: <T extends AnyPlugin>(pluginId: string, loadedPlugin: LoadedPlugin<T>) => Effect.Effect<{
|
|
32
|
-
plugin: T;
|
|
33
|
-
metadata: PluginMetadata;
|
|
34
|
-
}, PluginRuntimeError, never>;
|
|
35
|
-
initializePlugin: <T extends AnyPlugin>(pluginInstance: PluginInstance<T>, config: {
|
|
36
|
-
variables: InferSchemaInput<T["configSchema"]["variables"]>;
|
|
37
|
-
secrets: InferSchemaInput<T["configSchema"]["secrets"]>;
|
|
38
|
-
}, plugins?: Record<string, unknown>) => Effect.Effect<{
|
|
39
|
-
plugin: T;
|
|
40
|
-
metadata: PluginMetadata;
|
|
41
|
-
config: {
|
|
42
|
-
variables: InferSchemaOutput<T["configSchema"]["variables"]>;
|
|
43
|
-
secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
|
|
44
|
-
};
|
|
45
|
-
context: any;
|
|
46
|
-
scope: Scope.CloseableScope;
|
|
47
|
-
}, PluginRuntimeError, never>;
|
|
48
|
-
}, never, ModuleFederationService | SecretsService | RegistryService>;
|
|
49
|
-
}>;
|
|
50
|
-
declare class PluginLoaderService extends PluginLoaderService_base {}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { PluginLoaderService, PluginMapTag, PluginRegistryTag, RegistryService };
|
|
53
|
-
//# sourceMappingURL=plugin-loader.service.d.cts.map
|
|
1
|
+
import "../errors.cjs";
|
|
2
|
+
import "../../types.cjs";
|
|
3
|
+
import "./module-federation.service.cjs";
|
|
4
|
+
import "./secrets.service.cjs";
|
|
5
|
+
import { Context, Effect, Layer } from "effect";
|
|
6
|
+
import { InferSchemaInput } from "@orpc/contract";
|
|
@@ -1,53 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
//#region src/runtime/services/plugin-loader.service.d.ts
|
|
8
|
-
declare const PluginRegistryTag_base: Context.TagClass<PluginRegistryTag, "PluginRegistry", PluginRegistry>;
|
|
9
|
-
declare class PluginRegistryTag extends PluginRegistryTag_base {}
|
|
10
|
-
declare const PluginMapTag_base: Context.TagClass<PluginMapTag, "PluginMap", Record<string, AnyPluginConstructor>>;
|
|
11
|
-
declare class PluginMapTag extends PluginMapTag_base {}
|
|
12
|
-
declare const RegistryService_base: Effect.Service.Class<RegistryService, "RegistryService", {
|
|
13
|
-
readonly effect: Effect.Effect<{
|
|
14
|
-
get: (pluginId: string) => Effect.Effect<{
|
|
15
|
-
constructor: AnyPluginConstructor;
|
|
16
|
-
metadata: PluginMetadata;
|
|
17
|
-
} | {
|
|
18
|
-
constructor: null;
|
|
19
|
-
metadata: PluginMetadata;
|
|
20
|
-
}, PluginRuntimeError, never>;
|
|
21
|
-
getModule: (pluginId: string) => Effect.Effect<AnyPluginConstructor | null, never, never>;
|
|
22
|
-
}, never, PluginRegistryTag | PluginMapTag>;
|
|
23
|
-
}>;
|
|
24
|
-
declare class RegistryService extends RegistryService_base {}
|
|
25
|
-
declare const PluginLoaderService_base: Effect.Service.Class<PluginLoaderService, "PluginLoaderService", {
|
|
26
|
-
readonly effect: Effect.Effect<{
|
|
27
|
-
loadPlugin: (pluginId: string) => Effect.Effect<{
|
|
28
|
-
ctor: any;
|
|
29
|
-
metadata: PluginMetadata;
|
|
30
|
-
}, PluginRuntimeError, never>;
|
|
31
|
-
instantiatePlugin: <T extends AnyPlugin>(pluginId: string, loadedPlugin: LoadedPlugin<T>) => Effect.Effect<{
|
|
32
|
-
plugin: T;
|
|
33
|
-
metadata: PluginMetadata;
|
|
34
|
-
}, PluginRuntimeError, never>;
|
|
35
|
-
initializePlugin: <T extends AnyPlugin>(pluginInstance: PluginInstance<T>, config: {
|
|
36
|
-
variables: InferSchemaInput<T["configSchema"]["variables"]>;
|
|
37
|
-
secrets: InferSchemaInput<T["configSchema"]["secrets"]>;
|
|
38
|
-
}, plugins?: Record<string, unknown>) => Effect.Effect<{
|
|
39
|
-
plugin: T;
|
|
40
|
-
metadata: PluginMetadata;
|
|
41
|
-
config: {
|
|
42
|
-
variables: InferSchemaOutput<T["configSchema"]["variables"]>;
|
|
43
|
-
secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
|
|
44
|
-
};
|
|
45
|
-
context: any;
|
|
46
|
-
scope: Scope.CloseableScope;
|
|
47
|
-
}, PluginRuntimeError, never>;
|
|
48
|
-
}, never, ModuleFederationService | SecretsService | RegistryService>;
|
|
49
|
-
}>;
|
|
50
|
-
declare class PluginLoaderService extends PluginLoaderService_base {}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { PluginLoaderService, PluginMapTag, PluginRegistryTag, RegistryService };
|
|
53
|
-
//# sourceMappingURL=plugin-loader.service.d.mts.map
|
|
1
|
+
import "../errors.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
3
|
+
import "./module-federation.service.mjs";
|
|
4
|
+
import "./secrets.service.mjs";
|
|
5
|
+
import { Context, Effect, Layer } from "effect";
|
|
6
|
+
import { InferSchemaInput } from "@orpc/contract";
|