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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { findBosConfigPath } from "../rspack/compose";
|
|
4
|
+
|
|
5
|
+
const UI_DIR = "ui";
|
|
6
|
+
const GENERATED_CONFIG_DIR = ".every-plugin";
|
|
7
|
+
const GENERATED_UI_CONFIG = "ui.rsbuild.config.generated.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Folder-form UI source: a `ui/` directory with route files but no own
|
|
11
|
+
* package.json — the plugin workspace owns the build (single-workspace
|
|
12
|
+
* plugin, one dev process, one deploy train). Workspace-form ui sources
|
|
13
|
+
* (own package.json + scripts) are NOT managed here.
|
|
14
|
+
*/
|
|
15
|
+
export function hasFolderFormUi(cwd: string): boolean {
|
|
16
|
+
const uiDir = path.join(cwd, UI_DIR);
|
|
17
|
+
return (
|
|
18
|
+
fs.existsSync(path.join(uiDir, "src", "routes")) &&
|
|
19
|
+
!fs.existsSync(path.join(uiDir, "package.json"))
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function generatedUiConfig(pluginId: string): string {
|
|
24
|
+
return `import path from "node:path";
|
|
25
|
+
import { createUiRsbuildConfig } from "every-plugin/build/ui";
|
|
26
|
+
import pkg from "../package.json";
|
|
27
|
+
|
|
28
|
+
const workspaceRoot = path.resolve(import.meta.dirname, "..", "ui");
|
|
29
|
+
|
|
30
|
+
export default createUiRsbuildConfig({
|
|
31
|
+
workspaceRoot,
|
|
32
|
+
pkg,
|
|
33
|
+
role: "consumer",
|
|
34
|
+
manifestName: ${JSON.stringify(pluginId)},
|
|
35
|
+
devPort: Number(process.env.BOS_UI_PORT) || 0,
|
|
36
|
+
webEntry: "./ui/src/routeConfig.gen.ts",
|
|
37
|
+
webExposes: { "./routeConfig": "./ui/src/routeConfig.gen.ts" },
|
|
38
|
+
nodeEntry: "./ui/src/routeConfig.gen.ts",
|
|
39
|
+
nodeExposes: { "./routeConfig": "./ui/src/routeConfig.gen.ts" },
|
|
40
|
+
routesDirectory: "./ui/src/routes",
|
|
41
|
+
});
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Canonical config-layout derivation: the composition key for a plugin
|
|
47
|
+
* workspace — the `<key>` of the `plugins/<key>` directory relative to the
|
|
48
|
+
* nearest `bos.config.json`. The dev server and the generated ui config
|
|
49
|
+
* both key off this; no consumer keeps a private copy.
|
|
50
|
+
*/
|
|
51
|
+
export function pluginLayoutKey(cwd: string): string | null {
|
|
52
|
+
const bosConfigPath = findBosConfigPath(cwd);
|
|
53
|
+
const relativeWorkspace = bosConfigPath
|
|
54
|
+
? path.relative(path.dirname(bosConfigPath), cwd)
|
|
55
|
+
: undefined;
|
|
56
|
+
const [workspaceGroup, layoutKey] = relativeWorkspace?.split(path.sep) ?? [];
|
|
57
|
+
return workspaceGroup === "plugins" && layoutKey ? layoutKey : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Synthesize the rsbuild config for a folder-form ui source (the plugin
|
|
62
|
+
* build contract, not per-plugin config — mirrors the rspack generated
|
|
63
|
+
* config). Returns the config file path, or null when the workspace has no
|
|
64
|
+
* folder-form ui source.
|
|
65
|
+
*/
|
|
66
|
+
export function ensureGeneratedUiRsbuildConfig(cwd: string): string | null {
|
|
67
|
+
if (!hasFolderFormUi(cwd)) return null;
|
|
68
|
+
// The manifest's name derives ONLY from the plugins/<key> layout key
|
|
69
|
+
// (ADR 0008 §2) — a non-derivable key fails the build loudly, never the
|
|
70
|
+
// container-name fallback that mis-keyed manifests.
|
|
71
|
+
const pluginId = pluginLayoutKey(cwd);
|
|
72
|
+
if (!pluginId) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`[every-plugin] cannot derive the ui's composition key from ${cwd} — no authored config (bos.app.ts / bos.config.json) found above a plugins/<key> directory. The manifest name is the layout key; the container name is never a fallback.`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
const outDir = path.join(cwd, GENERATED_CONFIG_DIR);
|
|
78
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
79
|
+
const outPath = path.join(outDir, GENERATED_UI_CONFIG);
|
|
80
|
+
const next = generatedUiConfig(pluginId);
|
|
81
|
+
if (!fs.existsSync(outPath) || fs.readFileSync(outPath, "utf8") !== next) {
|
|
82
|
+
fs.writeFileSync(outPath, next);
|
|
83
|
+
}
|
|
84
|
+
return outPath;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const CORE_UI_MARKERS = {
|
|
88
|
+
routes: "src/routes",
|
|
89
|
+
contract: "src/contract.ts",
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Workspace-form core ui: the workspace IS the ui (own package.json, route
|
|
94
|
+
* tree) and is not plugin-shaped — the /api counterpart of the plugin
|
|
95
|
+
* workspace form. The entry stub is NOT a marker: it is generated
|
|
96
|
+
* (ADR 0023), so a fresh clone has no bootstrap stubs until the first
|
|
97
|
+
* generation pass.
|
|
98
|
+
*/
|
|
99
|
+
export function hasCoreUiWorkspace(cwd: string = process.cwd()): boolean {
|
|
100
|
+
return (
|
|
101
|
+
fs.existsSync(path.join(cwd, CORE_UI_MARKERS.routes)) &&
|
|
102
|
+
!fs.existsSync(path.join(cwd, CORE_UI_MARKERS.contract)) &&
|
|
103
|
+
!fs.existsSync(path.join(cwd, "plugin.dev.ts"))
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function generatedCoreUiConfig(): string {
|
|
108
|
+
return `import { defineConfig } from "@rsbuild/core";
|
|
109
|
+
import { readAuthoredConfigInput } from "everything-dev/config";
|
|
110
|
+
import { createCoreUiRsbuildConfig } from "every-plugin/build/ui";
|
|
111
|
+
|
|
112
|
+
export default defineConfig(async () =>
|
|
113
|
+
createCoreUiRsbuildConfig(await readAuthoredConfigInput()),
|
|
114
|
+
);
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Synthesize the rsbuild config for a workspace-form core ui with no local
|
|
120
|
+
* `rsbuild.config.ts` — the /api generated-config model. A local file is an
|
|
121
|
+
* override and wins untouched. Returns the workspace-relative config path,
|
|
122
|
+
* or null when the workspace is not a core ui (or has a local config).
|
|
123
|
+
*/
|
|
124
|
+
export function ensureGeneratedCoreUiRsbuildConfig(cwd: string = process.cwd()): string | null {
|
|
125
|
+
if (!hasCoreUiWorkspace(cwd)) return null;
|
|
126
|
+
if (fs.existsSync(path.join(cwd, "rsbuild.config.ts"))) return null;
|
|
127
|
+
const outDir = path.join(cwd, GENERATED_CONFIG_DIR);
|
|
128
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
129
|
+
const outPath = path.join(outDir, GENERATED_UI_CONFIG);
|
|
130
|
+
fs.writeFileSync(outPath, generatedCoreUiConfig());
|
|
131
|
+
console.log("[every-plugin] rsbuild.config.ts not found — using the core ui build factory.");
|
|
132
|
+
return path.join(GENERATED_CONFIG_DIR, GENERATED_UI_CONFIG);
|
|
133
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import type { RsbuildPlugin } from "@rsbuild/core";
|
|
4
|
+
import {
|
|
5
|
+
BuildEntryReportSchema,
|
|
6
|
+
findHashedEntry,
|
|
7
|
+
MF_MANIFEST_FILENAME,
|
|
8
|
+
planArtifactCopies,
|
|
9
|
+
STYLE_FILENAME,
|
|
10
|
+
} from "../artifact-names";
|
|
11
|
+
|
|
12
|
+
export interface HashArtifactsPluginOptions {
|
|
13
|
+
/** The container entry's base name in this environment's dist root. */
|
|
14
|
+
entryBase: string;
|
|
15
|
+
/** Absolute dist root this environment wrote (web: `dist`, node: `dist/ssr`). */
|
|
16
|
+
distRoot: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function listFiles(dir: string, out: string[] = []): string[] {
|
|
20
|
+
for (const entry of fs
|
|
21
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
22
|
+
.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
23
|
+
const full = path.join(dir, entry.name);
|
|
24
|
+
if (entry.isDirectory()) listFiles(full, out);
|
|
25
|
+
else out.push(path.relative(dir, full).split(path.sep).join("/"));
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Emits the additive hashed copies for one environment's dist root (ticket:
|
|
32
|
+
* atomic-deploys 01). The entry itself is hashed by the build (filename
|
|
33
|
+
* template); this plugin adds immutable hashed copies of the fixed-name
|
|
34
|
+
* browser artifacts (mf-manifest.json at the root, style.css under
|
|
35
|
+
* static/css), and `build-report.json` for the deploy leg. Idempotent under
|
|
36
|
+
* watch: same bytes → same hashed names.
|
|
37
|
+
*/
|
|
38
|
+
export function hashArtifactsPlugin(options: HashArtifactsPluginOptions): RsbuildPlugin {
|
|
39
|
+
return {
|
|
40
|
+
name: "hash-artifacts",
|
|
41
|
+
setup(api) {
|
|
42
|
+
api.onAfterEnvironmentCompile(() => {
|
|
43
|
+
const distRoot = options.distRoot;
|
|
44
|
+
if (!fs.existsSync(distRoot)) return;
|
|
45
|
+
|
|
46
|
+
const resolveExisting = (name: string): string | null => {
|
|
47
|
+
const candidates = [
|
|
48
|
+
path.join(distRoot, name),
|
|
49
|
+
path.join(distRoot, "static", "css", name),
|
|
50
|
+
];
|
|
51
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) ?? null;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const assetNames = listFiles(distRoot);
|
|
55
|
+
const entry = findHashedEntry(assetNames, options.entryBase);
|
|
56
|
+
if (!entry) return;
|
|
57
|
+
|
|
58
|
+
const contents: Record<string, string> = {};
|
|
59
|
+
for (const fixedName of [MF_MANIFEST_FILENAME, STYLE_FILENAME]) {
|
|
60
|
+
const from = resolveExisting(fixedName);
|
|
61
|
+
if (from) contents[fixedName] = fs.readFileSync(from, "utf8");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const plan = planArtifactCopies({ assetNames, entryBase: options.entryBase, contents });
|
|
65
|
+
if (!plan) return;
|
|
66
|
+
|
|
67
|
+
for (const copy of plan.copies) {
|
|
68
|
+
const from = resolveExisting(copy.from);
|
|
69
|
+
if (!from) throw new Error(`[hash-artifacts] planned copy source missing: ${copy.from}`);
|
|
70
|
+
fs.copyFileSync(from, path.join(distRoot, copy.to));
|
|
71
|
+
}
|
|
72
|
+
fs.writeFileSync(
|
|
73
|
+
path.join(distRoot, "build-report.json"),
|
|
74
|
+
`${JSON.stringify(BuildEntryReportSchema.parse(plan.report), null, 2)}\n`,
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared build surface for ui plugins (dual MF targets).
|
|
3
|
+
*
|
|
4
|
+
* Shared dependencies (react, react-dom, the orpc client/contract pair, the
|
|
5
|
+
* TanStack query/router pair, lingui, and the everything-dev session/i18n
|
|
6
|
+
* subpath modules) come from the SharedDependencySpec — the canonical list in
|
|
7
|
+
* `every-plugin/shared-deps-spec` — resolved from the building workspace's
|
|
8
|
+
* installed versions so a mismatch fails the build instead of loading a
|
|
9
|
+
* second React. Consumers (plugin remotes) set `import: false` — no bundled
|
|
10
|
+
* fallback copy, the provider (core ui) provides through the share scope
|
|
11
|
+
* only.
|
|
12
|
+
*
|
|
13
|
+
* `CORE_UI_DEPLOY_FIELDS` names the bos.config.json fields the publish
|
|
14
|
+
* writes deploy URLs back to.
|
|
15
|
+
*
|
|
16
|
+
* A ui source's rsbuild.config.ts mirrors ui/rsbuild.config.ts with these
|
|
17
|
+
* helpers: the web target is an MF remote exposing `./routeConfig` (the
|
|
18
|
+
* generated import map); the node target is a commonjs container exposing
|
|
19
|
+
* `./routeConfig` with the `@module-federation/node` runtime plugin and
|
|
20
|
+
* `autoCodeSplitting` off.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import fs from "node:fs";
|
|
24
|
+
import path from "node:path";
|
|
25
|
+
import type { RsbuildPlugin } from "@rsbuild/core";
|
|
26
|
+
import { PLUGIN_UI_SHARED_EXPOSES } from "../../ui/manifest/contract";
|
|
27
|
+
import { type UiManifestGenPluginOptions, uiManifestGenPlugin } from "./manifest-plugin";
|
|
28
|
+
|
|
29
|
+
export { type CoreUiRsbuildConfigInput, createCoreUiRsbuildConfig } from "./factory";
|
|
30
|
+
export {
|
|
31
|
+
ensureGeneratedCoreUiRsbuildConfig,
|
|
32
|
+
ensureGeneratedUiRsbuildConfig,
|
|
33
|
+
hasCoreUiWorkspace,
|
|
34
|
+
hasFolderFormUi,
|
|
35
|
+
} from "./generated-config";
|
|
36
|
+
export {
|
|
37
|
+
type HashArtifactsPluginOptions,
|
|
38
|
+
hashArtifactsPlugin,
|
|
39
|
+
} from "./hash-artifacts-plugin";
|
|
40
|
+
export {
|
|
41
|
+
createUiRsbuildConfig,
|
|
42
|
+
sanitizeContainerName,
|
|
43
|
+
type UiRsbuildConfigOptions,
|
|
44
|
+
} from "./rsbuild-config";
|
|
45
|
+
export { CORE_UI_STUBS, emitCoreUiStubs } from "./stubs";
|
|
46
|
+
export type { UiManifestGenPluginOptions };
|
|
47
|
+
export { uiManifestGenPlugin };
|
|
48
|
+
|
|
49
|
+
export interface UiDeployFields {
|
|
50
|
+
urlField: string;
|
|
51
|
+
integrityField: string;
|
|
52
|
+
ssrUrlField?: string;
|
|
53
|
+
ssrIntegrityField?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Core shell field paths — unchanged from the v1 remote. */
|
|
57
|
+
export const CORE_UI_DEPLOY_FIELDS: UiDeployFields = {
|
|
58
|
+
urlField: "app.ui.production",
|
|
59
|
+
integrityField: "app.ui.integrity",
|
|
60
|
+
ssrUrlField: "app.ui.ssr",
|
|
61
|
+
ssrIntegrityField: "app.ui.ssrIntegrity",
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Canonical exposes every manifest-composed ui source ships. */
|
|
65
|
+
export { PLUGIN_UI_SHARED_EXPOSES };
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Part of the plugin build contract, not per-plugin config: container chunks
|
|
69
|
+
* must resolve against the origin that served the remote entry. rsbuild's MF
|
|
70
|
+
* manifest stamps an absolute dev-server publicPath into metaData — rewrite
|
|
71
|
+
* it to `auto` after the node environment compiles so runtime resolution
|
|
72
|
+
* stays origin-relative.
|
|
73
|
+
*/
|
|
74
|
+
export function restoreManifestPublicPath(distRoot: string): RsbuildPlugin {
|
|
75
|
+
return {
|
|
76
|
+
name: "restore-manifest-public-path",
|
|
77
|
+
setup(api) {
|
|
78
|
+
api.onAfterEnvironmentCompile(({ environment, stats }) => {
|
|
79
|
+
if (!stats || stats.hasErrors() || environment.name !== "node") return;
|
|
80
|
+
const manifestPath = path.resolve(distRoot, "mf-manifest.json");
|
|
81
|
+
if (!fs.existsSync(manifestPath)) return;
|
|
82
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
83
|
+
if (manifest.metaData?.publicPath && manifest.metaData.publicPath !== "auto") {
|
|
84
|
+
manifest.metaData.publicPath = "auto";
|
|
85
|
+
fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
CORE_UI_PLUGIN_KEY,
|
|
94
|
+
MANIFEST_FILENAME,
|
|
95
|
+
ROUTE_CONFIG_FILENAME,
|
|
96
|
+
UI_REMOTE_ENTRY_FILENAME,
|
|
97
|
+
UI_REMOTE_SERVER_ENTRY_FILENAME,
|
|
98
|
+
} from "../../ui/manifest/contract";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RsbuildPlugin } from "@rsbuild/core";
|
|
2
|
+
import { generateUiManifest } from "../../ui/manifest/generator";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Rsbuild plugin that keeps a ui source's generated artifacts fresh during
|
|
6
|
+
* builds and dev watch: manifest.gen.json + routeConfig.gen.ts are
|
|
7
|
+
* regenerated in plugin setup (before any environment compiles, so the
|
|
8
|
+
* `./routeConfig` MF expose resolves), and again on every build/dev-compile
|
|
9
|
+
* start. The stock routeTree write is redirected to a scratch path —
|
|
10
|
+
* TanStackRouterRspack owns src/routeTree.gen.ts (its autoCodeSplitting
|
|
11
|
+
* options differ from the manifest pass).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface UiManifestGenPluginOptions {
|
|
15
|
+
workspaceRoot: string;
|
|
16
|
+
pluginName: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const inFlight = new Map<string, Promise<unknown>>();
|
|
20
|
+
|
|
21
|
+
/** rsbuild builds environments in parallel and each setup runs the generator — concurrent runs share one pass. */
|
|
22
|
+
function runOnce(key: string, run: () => Promise<unknown>): Promise<unknown> {
|
|
23
|
+
const existing = inFlight.get(key);
|
|
24
|
+
if (existing) return existing;
|
|
25
|
+
const promise = run().finally(() => {
|
|
26
|
+
inFlight.delete(key);
|
|
27
|
+
});
|
|
28
|
+
inFlight.set(key, promise);
|
|
29
|
+
return promise;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function uiManifestGenPlugin(options: UiManifestGenPluginOptions): RsbuildPlugin {
|
|
33
|
+
const run = () =>
|
|
34
|
+
runOnce(`${options.workspaceRoot}::${options.pluginName}`, () =>
|
|
35
|
+
generateUiManifest({
|
|
36
|
+
workspaceRoot: options.workspaceRoot,
|
|
37
|
+
pluginName: options.pluginName,
|
|
38
|
+
emitRouteTree: false,
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
name: "ui-manifest-gen",
|
|
44
|
+
async setup(api) {
|
|
45
|
+
await run();
|
|
46
|
+
api.onBeforeBuild(async () => {
|
|
47
|
+
await run();
|
|
48
|
+
});
|
|
49
|
+
api.onBeforeDevCompile(async () => {
|
|
50
|
+
await run();
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { pluginModuleFederation } from "@module-federation/rsbuild-plugin";
|
|
3
|
+
import { defineConfig, type EnvironmentConfig, type RsbuildConfig, rspack } from "@rsbuild/core";
|
|
4
|
+
import { pluginReact } from "@rsbuild/plugin-react";
|
|
5
|
+
import { TanStackRouterRspack } from "@tanstack/router-plugin/rspack";
|
|
6
|
+
import { FixMfDataUriPlugin } from "../../build/rspack";
|
|
7
|
+
import { createUiSharedDeps } from "../../shared-deps-spec";
|
|
8
|
+
import { sanitizeContainerName } from "../../ui/manifest/contract";
|
|
9
|
+
import { isBuildInvocation, uiEntryFilename } from "../artifact-names";
|
|
10
|
+
import { hashArtifactsPlugin } from "./hash-artifacts-plugin";
|
|
11
|
+
import { MANIFEST_FILENAME, restoreManifestPublicPath } from "./index";
|
|
12
|
+
import { uiManifestGenPlugin } from "./manifest-plugin";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The full dual-environment rsbuild config for a manifest-composed ui source
|
|
16
|
+
* (ADR 0008 §7 — the plugin build contract, not per-plugin config). The core
|
|
17
|
+
* ui and every plugin ui source build from this one factory: `web` emits the
|
|
18
|
+
* browser remote, `node` the commonjs SSR container; shared deps are strict
|
|
19
|
+
* singletons in the given role.
|
|
20
|
+
*/
|
|
21
|
+
export interface UiRsbuildConfigOptions {
|
|
22
|
+
/** the ui source root — contains package.json, src/, and the routes dir */
|
|
23
|
+
workspaceRoot: string;
|
|
24
|
+
/** the ui workspace's package.json (shared-dep version resolution) */
|
|
25
|
+
pkg: {
|
|
26
|
+
name: string;
|
|
27
|
+
version?: string;
|
|
28
|
+
dependencies?: Record<string, string>;
|
|
29
|
+
devDependencies?: Record<string, string>;
|
|
30
|
+
};
|
|
31
|
+
/** core provides the shared singletons; plugin remotes consume (`import: false`) */
|
|
32
|
+
role: "provider" | "consumer";
|
|
33
|
+
/** the composition key written into manifest.gen.json (the config-side key) */
|
|
34
|
+
manifestName: string;
|
|
35
|
+
devPort: number;
|
|
36
|
+
webEntry: string;
|
|
37
|
+
webExposes: Record<string, string>;
|
|
38
|
+
nodeEntry: string;
|
|
39
|
+
nodeExposes: Record<string, string>;
|
|
40
|
+
copy?: Array<{
|
|
41
|
+
from: string;
|
|
42
|
+
to: string;
|
|
43
|
+
globOptions?: { ignore?: string[] };
|
|
44
|
+
}>;
|
|
45
|
+
define?: Record<string, string>;
|
|
46
|
+
/** routes dir relative to the rsbuild cwd — folder-form ui sources live at
|
|
47
|
+
* `ui/src/routes` while the build runs from the plugin root */
|
|
48
|
+
routesDirectory?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { sanitizeContainerName };
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The node environment never owns the routeTree write: the web env's
|
|
55
|
+
* generator produces identical content, and both environments resolve the
|
|
56
|
+
* same on-disk tree. Redirecting the node write to scratch removes the
|
|
57
|
+
* concurrent-writers race on src/routeTree.gen.ts (the generator's
|
|
58
|
+
* "Cannot overwrite" retry noise).
|
|
59
|
+
*/
|
|
60
|
+
const NODE_ROUTE_TREE_SCRATCH = "./node_modules/.cache/manifest-compose/routeTree.node.gen.ts";
|
|
61
|
+
|
|
62
|
+
export function createUiRsbuildConfig(options: UiRsbuildConfigOptions): RsbuildConfig {
|
|
63
|
+
const {
|
|
64
|
+
workspaceRoot,
|
|
65
|
+
pkg,
|
|
66
|
+
role,
|
|
67
|
+
manifestName,
|
|
68
|
+
devPort,
|
|
69
|
+
webEntry,
|
|
70
|
+
webExposes,
|
|
71
|
+
nodeEntry,
|
|
72
|
+
nodeExposes,
|
|
73
|
+
copy = [],
|
|
74
|
+
define,
|
|
75
|
+
routesDirectory,
|
|
76
|
+
} = options;
|
|
77
|
+
const workspaceRootAbsolute = path.resolve(workspaceRoot);
|
|
78
|
+
const normalizedName = sanitizeContainerName(pkg.name);
|
|
79
|
+
const manifestGen = () =>
|
|
80
|
+
uiManifestGenPlugin({ workspaceRoot: workspaceRootAbsolute, pluginName: manifestName });
|
|
81
|
+
const uiSharedDeps = createUiSharedDeps({ role, workspaceRoot: workspaceRootAbsolute });
|
|
82
|
+
|
|
83
|
+
const isBuild = isBuildInvocation();
|
|
84
|
+
|
|
85
|
+
const webEnvironment: EnvironmentConfig = {
|
|
86
|
+
plugins: [
|
|
87
|
+
pluginReact(),
|
|
88
|
+
manifestGen(),
|
|
89
|
+
pluginModuleFederation(
|
|
90
|
+
{
|
|
91
|
+
name: normalizedName,
|
|
92
|
+
filename: uiEntryFilename({ isBuild }),
|
|
93
|
+
dts: false,
|
|
94
|
+
exposes: webExposes,
|
|
95
|
+
shared: uiSharedDeps,
|
|
96
|
+
},
|
|
97
|
+
{ environment: "web" },
|
|
98
|
+
),
|
|
99
|
+
...(isBuild
|
|
100
|
+
? [
|
|
101
|
+
hashArtifactsPlugin({
|
|
102
|
+
entryBase: "remoteEntry",
|
|
103
|
+
distRoot: path.join(workspaceRootAbsolute, "dist"),
|
|
104
|
+
}),
|
|
105
|
+
]
|
|
106
|
+
: []),
|
|
107
|
+
],
|
|
108
|
+
source: { entry: { index: webEntry }, ...(define ? { define } : {}) },
|
|
109
|
+
resolve: { alias: { "@": path.join(workspaceRootAbsolute, "src") } },
|
|
110
|
+
tools: {
|
|
111
|
+
rspack: (config) => {
|
|
112
|
+
const cssPlugin = config.plugins?.find((p) => p instanceof rspack.CssExtractRspackPlugin) as
|
|
113
|
+
| { options?: Record<string, string> }
|
|
114
|
+
| undefined;
|
|
115
|
+
if (cssPlugin) {
|
|
116
|
+
cssPlugin.options ??= {};
|
|
117
|
+
cssPlugin.options.chunkFilename = "static/css/async/[name].[contenthash].css";
|
|
118
|
+
}
|
|
119
|
+
Object.assign(config, {
|
|
120
|
+
target: "web",
|
|
121
|
+
output: {
|
|
122
|
+
...config.output,
|
|
123
|
+
publicPath: "auto",
|
|
124
|
+
uniqueName: normalizedName,
|
|
125
|
+
chunkFilename: "static/js/async/[name].[contenthash].js",
|
|
126
|
+
crossOriginLoading: "anonymous",
|
|
127
|
+
},
|
|
128
|
+
resolve: {
|
|
129
|
+
...config.resolve,
|
|
130
|
+
fallback: { bufferutil: false, "utf-8-validate": false },
|
|
131
|
+
},
|
|
132
|
+
infrastructureLogging: { level: "error" },
|
|
133
|
+
stats: "errors-warnings",
|
|
134
|
+
plugins: [
|
|
135
|
+
...(config.plugins ?? []),
|
|
136
|
+
TanStackRouterRspack({
|
|
137
|
+
target: "react",
|
|
138
|
+
autoCodeSplitting: true,
|
|
139
|
+
routeFileIgnorePattern: "\\.(test|spec)\\.(ts|tsx)$",
|
|
140
|
+
...(routesDirectory ? { routesDirectory } : {}),
|
|
141
|
+
}),
|
|
142
|
+
new FixMfDataUriPlugin(),
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
return config;
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
output: {
|
|
149
|
+
// Absolute: the ui source root owns dist even when the build cwd is the
|
|
150
|
+
// parent plugin workspace (folder-form ui sources).
|
|
151
|
+
distPath: {
|
|
152
|
+
root: path.join(workspaceRootAbsolute, "dist"),
|
|
153
|
+
css: "static/css",
|
|
154
|
+
js: "static/js",
|
|
155
|
+
},
|
|
156
|
+
assetPrefix: "auto",
|
|
157
|
+
filename: { js: "[name].js", css: "style.css" },
|
|
158
|
+
copy: [
|
|
159
|
+
...copy,
|
|
160
|
+
{ from: path.join(workspaceRootAbsolute, "src", MANIFEST_FILENAME), to: "./" },
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Dev without SSR skips the node environment: it exists for the host's dev
|
|
166
|
+
// SSR container and nothing else. Builds always emit both.
|
|
167
|
+
const includeNodeEnv =
|
|
168
|
+
process.env.BOS_SSR === "1" ||
|
|
169
|
+
process.env.DEPLOY === "true" ||
|
|
170
|
+
process.env.NODE_ENV !== "development";
|
|
171
|
+
|
|
172
|
+
const nodeEnvironment: EnvironmentConfig = {
|
|
173
|
+
plugins: [
|
|
174
|
+
pluginReact(),
|
|
175
|
+
manifestGen(),
|
|
176
|
+
pluginModuleFederation(
|
|
177
|
+
{
|
|
178
|
+
name: normalizedName,
|
|
179
|
+
filename: uiEntryFilename({ isBuild, server: true }),
|
|
180
|
+
dts: false,
|
|
181
|
+
exposes: nodeExposes,
|
|
182
|
+
shared: uiSharedDeps,
|
|
183
|
+
},
|
|
184
|
+
{ target: "node", environment: "node" },
|
|
185
|
+
),
|
|
186
|
+
restoreManifestPublicPath(path.resolve(workspaceRootAbsolute, "dist", "ssr")),
|
|
187
|
+
...(isBuild
|
|
188
|
+
? [
|
|
189
|
+
hashArtifactsPlugin({
|
|
190
|
+
entryBase: "remoteEntry.server",
|
|
191
|
+
distRoot: path.resolve(workspaceRootAbsolute, "dist", "ssr"),
|
|
192
|
+
}),
|
|
193
|
+
]
|
|
194
|
+
: []),
|
|
195
|
+
],
|
|
196
|
+
source: { entry: { index: nodeEntry } },
|
|
197
|
+
resolve: {
|
|
198
|
+
alias: {
|
|
199
|
+
"@": path.join(workspaceRootAbsolute, "src"),
|
|
200
|
+
"@tanstack/react-devtools": false,
|
|
201
|
+
"@tanstack/react-router-devtools": false,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
tools: {
|
|
205
|
+
rspack: (config) => {
|
|
206
|
+
Object.assign(config, {
|
|
207
|
+
output: { ...config.output, uniqueName: `${normalizedName}_server` },
|
|
208
|
+
resolve: {
|
|
209
|
+
...config.resolve,
|
|
210
|
+
fallback: { bufferutil: false, "utf-8-validate": false },
|
|
211
|
+
},
|
|
212
|
+
externals: [/^node:/],
|
|
213
|
+
infrastructureLogging: { level: "error" },
|
|
214
|
+
stats: "errors-warnings",
|
|
215
|
+
plugins: [
|
|
216
|
+
...(config.plugins ?? []),
|
|
217
|
+
TanStackRouterRspack({
|
|
218
|
+
target: "react",
|
|
219
|
+
autoCodeSplitting: false,
|
|
220
|
+
routeFileIgnorePattern: "\\.(test|spec)\\.(ts|tsx)$",
|
|
221
|
+
generatedRouteTree: NODE_ROUTE_TREE_SCRATCH,
|
|
222
|
+
...(routesDirectory ? { routesDirectory } : {}),
|
|
223
|
+
}),
|
|
224
|
+
new FixMfDataUriPlugin(),
|
|
225
|
+
],
|
|
226
|
+
});
|
|
227
|
+
return config;
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
// Absolute, like the web dist above — the node container must land in the
|
|
231
|
+
// ui source root's dist/ssr where the host's local container server looks.
|
|
232
|
+
output: { distPath: { root: path.join(workspaceRootAbsolute, "dist", "ssr") } },
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return defineConfig({
|
|
236
|
+
environments: {
|
|
237
|
+
web: webEnvironment,
|
|
238
|
+
...(includeNodeEnv ? { node: nodeEnvironment } : {}),
|
|
239
|
+
},
|
|
240
|
+
dev: {
|
|
241
|
+
lazyCompilation: false,
|
|
242
|
+
progressBar: false,
|
|
243
|
+
writeToDisk: true,
|
|
244
|
+
client: { overlay: false },
|
|
245
|
+
},
|
|
246
|
+
server: {
|
|
247
|
+
port: Number(process.env.PORT) || devPort,
|
|
248
|
+
printUrls: ({ urls }) => urls.filter((url) => url.includes("localhost")),
|
|
249
|
+
headers: {
|
|
250
|
+
"Access-Control-Allow-Origin": "*",
|
|
251
|
+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
252
|
+
"Access-Control-Allow-Headers": "Content-Type",
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|