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,19 +1,11 @@
|
|
|
1
1
|
import { Compiler, RspackPluginInstance } from "@rspack/core";
|
|
2
2
|
//#region src/build/rspack/plugin.d.ts
|
|
3
|
-
interface
|
|
4
|
-
devConfigPath?: string;
|
|
5
|
-
port?: number;
|
|
6
|
-
pluginId?: string;
|
|
3
|
+
interface EveryPluginBuildOptions {
|
|
7
4
|
dts?: boolean;
|
|
8
5
|
}
|
|
9
|
-
interface AdditionalExport {
|
|
10
|
-
srcPath: string;
|
|
11
|
-
exportNames: string[];
|
|
12
|
-
}
|
|
13
6
|
interface PluginManifestEmitterOptions {
|
|
14
7
|
manifestFileName?: string;
|
|
15
8
|
contractFileName?: string;
|
|
16
|
-
additionalExports?: AdditionalExport[];
|
|
17
9
|
}
|
|
18
10
|
declare class EmitPluginManifest implements RspackPluginInstance {
|
|
19
11
|
private options;
|
|
@@ -21,15 +13,14 @@ declare class EmitPluginManifest implements RspackPluginInstance {
|
|
|
21
13
|
constructor(options?: PluginManifestEmitterOptions);
|
|
22
14
|
apply(compiler: Compiler): void;
|
|
23
15
|
}
|
|
24
|
-
declare class
|
|
16
|
+
declare class EveryPluginBuild implements RspackPluginInstance {
|
|
25
17
|
private options;
|
|
26
18
|
name: string;
|
|
27
|
-
constructor(options?:
|
|
19
|
+
constructor(options?: EveryPluginBuildOptions);
|
|
28
20
|
apply(compiler: Compiler): void;
|
|
29
21
|
private configureDefaults;
|
|
30
22
|
private ensureTypeScriptLoader;
|
|
31
|
-
private configureDevServer;
|
|
32
23
|
}
|
|
33
24
|
//#endregion
|
|
34
|
-
export {
|
|
25
|
+
export { EmitPluginManifest, EveryPluginBuild, EveryPluginBuildOptions, PluginManifestEmitterOptions };
|
|
35
26
|
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;UAiBiB;EACf;;UAGe;EACf;EACA;;cAGW,8BAA8B;UAGrB;EAFpB;EAEA,YAAoB,UAAS;EAE7B,MAAM,UAAU;;cAyFL,4BAA4B;UAGnB;EAFpB;EAEA,YAAoB,UAAS;EAE7B,MAAM,UAAU;UAgCR;UAsGA"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { DEV_ENTRY_FILENAME, findHashedEntry, isBuildInvocation, uiEntryFilename } from "../artifact-names.mjs";
|
|
3
|
+
import { BuildReportPlugin } from "./build-report-plugin.mjs";
|
|
4
|
+
import { CONTRACT_TYPES_FILE, generateContractTypes } from "../contract-types.mjs";
|
|
5
|
+
import { ChunkCompletenessPlugin } from "./chunk-completeness-plugin.mjs";
|
|
3
6
|
import { buildSharedDependencies } from "./module-federation.mjs";
|
|
4
|
-
import { getPluginInfo
|
|
7
|
+
import { getPluginInfo } from "./utils.mjs";
|
|
8
|
+
import crypto from "node:crypto";
|
|
5
9
|
import fs from "node:fs";
|
|
6
10
|
import path from "node:path";
|
|
7
|
-
import crypto from "node:crypto";
|
|
8
11
|
import { ModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
9
12
|
|
|
10
13
|
//#region src/build/rspack/plugin.ts
|
|
@@ -27,8 +30,17 @@ var EmitPluginManifest = class {
|
|
|
27
30
|
const pluginInfo = getPluginInfo(context);
|
|
28
31
|
const contractFileName = this.options.contractFileName ?? "contract.d.ts";
|
|
29
32
|
const manifestFileName = this.options.manifestFileName ?? "plugin.manifest.json";
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
let generationError = null;
|
|
34
|
+
try {
|
|
35
|
+
if (await generateContractTypes(context) === "generated") console.log(`[EmitPluginManifest] Contract types regenerated (${context}).`);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
generationError = error instanceof Error ? error.message : String(error);
|
|
38
|
+
}
|
|
39
|
+
if (generationError) {
|
|
40
|
+
console.warn(`[EmitPluginManifest] Skipping manifest generation — ${generationError}`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const sourceContractPath = path.join(context, CONTRACT_TYPES_FILE);
|
|
32
44
|
const tryReadFile = async (filePath) => {
|
|
33
45
|
if (!fs.existsSync(filePath)) return null;
|
|
34
46
|
if (!fs.statSync(filePath).isFile()) return null;
|
|
@@ -38,17 +50,13 @@ var EmitPluginManifest = class {
|
|
|
38
50
|
return null;
|
|
39
51
|
}
|
|
40
52
|
};
|
|
41
|
-
contractTypes = await tryReadFile(sourceContractPath) ?? "";
|
|
53
|
+
const contractTypes = await tryReadFile(sourceContractPath) ?? "";
|
|
42
54
|
if (!contractTypes) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
contractTypes = await tryReadFile(nestedPath) ?? "";
|
|
46
|
-
if (!contractTypes) {
|
|
47
|
-
console.warn(`[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. Skipping manifest generation.`);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
55
|
+
console.warn(`[EmitPluginManifest] No contract types at ${sourceContractPath} (no src/contract.ts in this workspace?). Skipping manifest generation.`);
|
|
56
|
+
return;
|
|
50
57
|
}
|
|
51
58
|
const contractSha256 = crypto.createHash("sha256").update(contractTypes).digest("hex");
|
|
59
|
+
const hashedEntry = findHashedEntry(Object.keys(compilation.assets), "remoteEntry");
|
|
52
60
|
const manifest = {
|
|
53
61
|
schemaVersion: 1,
|
|
54
62
|
kind: "every-plugin/manifest",
|
|
@@ -56,7 +64,7 @@ var EmitPluginManifest = class {
|
|
|
56
64
|
name: pluginInfo.name,
|
|
57
65
|
version: pluginInfo.version
|
|
58
66
|
},
|
|
59
|
-
runtime: { remoteEntry: "
|
|
67
|
+
runtime: { remoteEntry: `./${hashedEntry ?? "remoteEntry.js"}` },
|
|
60
68
|
contract: {
|
|
61
69
|
kind: "orpc",
|
|
62
70
|
types: {
|
|
@@ -67,26 +75,6 @@ var EmitPluginManifest = class {
|
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
77
|
};
|
|
70
|
-
const additionalExportsEntries = [];
|
|
71
|
-
if (this.options.additionalExports?.length) {
|
|
72
|
-
for (const additional of this.options.additionalExports) {
|
|
73
|
-
const sourcePath = path.join(context, "types", additional.srcPath);
|
|
74
|
-
const content = await tryReadFile(sourcePath);
|
|
75
|
-
if (!content) {
|
|
76
|
-
console.warn(`[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`);
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const sha256 = crypto.createHash("sha256").update(content).digest("hex");
|
|
80
|
-
const distPath = `./types/${additional.srcPath}`;
|
|
81
|
-
additionalExportsEntries.push({
|
|
82
|
-
path: distPath,
|
|
83
|
-
exports: additional.exportNames,
|
|
84
|
-
sha256
|
|
85
|
-
});
|
|
86
|
-
if (rawSource) compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));
|
|
87
|
-
}
|
|
88
|
-
if (additionalExportsEntries.length > 0) manifest.additionalExports = additionalExportsEntries;
|
|
89
|
-
}
|
|
90
78
|
if (rawSource) {
|
|
91
79
|
compilation.emitAsset(manifestFileName, new rawSource(`${JSON.stringify(manifest, null, 2)}\n`));
|
|
92
80
|
compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));
|
|
@@ -95,22 +83,18 @@ var EmitPluginManifest = class {
|
|
|
95
83
|
});
|
|
96
84
|
}
|
|
97
85
|
};
|
|
98
|
-
var
|
|
86
|
+
var EveryPluginBuild = class {
|
|
99
87
|
options;
|
|
100
|
-
name = "
|
|
88
|
+
name = "EveryPluginBuild";
|
|
101
89
|
constructor(options = {}) {
|
|
102
90
|
this.options = options;
|
|
103
91
|
}
|
|
104
92
|
apply(compiler) {
|
|
105
93
|
const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());
|
|
106
|
-
const devConfig = loadDevConfig(this.options.devConfigPath || "./plugin.dev.ts");
|
|
107
|
-
const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;
|
|
108
94
|
this.configureDefaults(compiler, pluginInfo);
|
|
109
|
-
if (!compiler.options.devServer) compiler.options.devServer = {};
|
|
110
|
-
this.configureDevServer(compiler, pluginInfo, devConfig, port);
|
|
111
95
|
new ModuleFederationPlugin({
|
|
112
96
|
name: pluginInfo.normalizedName,
|
|
113
|
-
filename:
|
|
97
|
+
filename: uiEntryFilename({ isBuild: isBuildInvocation() }),
|
|
114
98
|
dts: this.options.dts !== false,
|
|
115
99
|
manifest: {},
|
|
116
100
|
runtimePlugins: [__require.resolve("@module-federation/node/runtimePlugin")],
|
|
@@ -119,6 +103,8 @@ var EveryPluginDevServer = class {
|
|
|
119
103
|
shared: buildSharedDependencies(pluginInfo),
|
|
120
104
|
shareStrategy: "version-first"
|
|
121
105
|
}).apply(compiler);
|
|
106
|
+
new BuildReportPlugin().apply(compiler);
|
|
107
|
+
new ChunkCompletenessPlugin().apply(compiler);
|
|
122
108
|
if (this.options.dts === false) compiler.options.plugins = (compiler.options.plugins ?? []).filter((p) => !p || typeof p !== "object" || p.name !== "MFDevPlugin" && p.name !== "ModuleFederationDtsPlugin");
|
|
123
109
|
}
|
|
124
110
|
configureDefaults(compiler, pluginInfo) {
|
|
@@ -127,20 +113,25 @@ var EveryPluginDevServer = class {
|
|
|
127
113
|
compiler.options.output.uniqueName = pluginInfo.normalizedName;
|
|
128
114
|
compiler.options.output.publicPath = "auto";
|
|
129
115
|
compiler.options.output.path = path.resolve(context, "dist");
|
|
130
|
-
compiler.options.output.clean =
|
|
116
|
+
compiler.options.output.clean = !compiler.options.watch;
|
|
131
117
|
compiler.options.output.library = { type: "commonjs-module" };
|
|
132
118
|
if (!compiler.options.target) compiler.options.target = "async-node";
|
|
133
119
|
if (!compiler.options.mode) compiler.options.mode = process.env.NODE_ENV === "development" ? "development" : "production";
|
|
134
120
|
if (compiler.options.devtool === void 0) compiler.options.devtool = "source-map";
|
|
135
121
|
if (!compiler.options.infrastructureLogging) compiler.options.infrastructureLogging = { level: "warn" };
|
|
136
122
|
this.ensureTypeScriptLoader(compiler);
|
|
123
|
+
if (!compiler.options.optimization) compiler.options.optimization = {};
|
|
124
|
+
compiler.options.optimization.splitChunks = false;
|
|
125
|
+
compiler.options.optimization.moduleIds = "named";
|
|
137
126
|
if (!compiler.options.resolve) compiler.options.resolve = {};
|
|
138
127
|
compiler.options.resolve.extensions = [
|
|
139
128
|
"...",
|
|
140
129
|
".tsx",
|
|
141
130
|
".ts"
|
|
142
131
|
];
|
|
132
|
+
const sourceFirst = process.env.DEPLOY !== "true";
|
|
143
133
|
compiler.options.resolve.conditionNames = [
|
|
134
|
+
...sourceFirst ? ["development"] : [],
|
|
144
135
|
"webpack",
|
|
145
136
|
"import",
|
|
146
137
|
"module",
|
|
@@ -148,7 +139,12 @@ var EveryPluginDevServer = class {
|
|
|
148
139
|
"node",
|
|
149
140
|
"default"
|
|
150
141
|
];
|
|
151
|
-
if (compiler.options.resolve.
|
|
142
|
+
if (sourceFirst) compiler.options.resolve.extensionAlias = { ".js": [
|
|
143
|
+
".js",
|
|
144
|
+
".ts",
|
|
145
|
+
".tsx"
|
|
146
|
+
] };
|
|
147
|
+
if (!sourceFirst && compiler.options.resolve.byDependency) for (const depType of Object.keys(compiler.options.resolve.byDependency)) {
|
|
152
148
|
const depConfig = compiler.options.resolve.byDependency[depType];
|
|
153
149
|
if (depConfig?.conditionNames) depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== "development");
|
|
154
150
|
}
|
|
@@ -161,39 +157,18 @@ var EveryPluginDevServer = class {
|
|
|
161
157
|
ensureTypeScriptLoader(compiler) {
|
|
162
158
|
if (!compiler.options.module) compiler.options.module = { rules: [] };
|
|
163
159
|
if (!compiler.options.module.rules) compiler.options.module.rules = [];
|
|
160
|
+
if (!compiler.options.module.rules.some((rule) => typeof rule === "object" && rule !== null && "test" in rule && rule.test instanceof RegExp && rule.test.test(".json"))) compiler.options.module.rules.push({
|
|
161
|
+
test: /\.json$/,
|
|
162
|
+
type: "json"
|
|
163
|
+
});
|
|
164
164
|
if (!compiler.options.module.rules.some((rule) => typeof rule === "object" && rule !== null && "test" in rule && rule.test instanceof RegExp && rule.test.test(".ts"))) compiler.options.module.rules.push({
|
|
165
165
|
test: /\.tsx?$/,
|
|
166
166
|
use: "builtin:swc-loader",
|
|
167
167
|
exclude: /node_modules/
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
configureDevServer(compiler, pluginInfo, devConfig, port) {
|
|
171
|
-
if (!compiler.options.devServer) return;
|
|
172
|
-
const context = compiler.options.context || process.cwd();
|
|
173
|
-
const originalSetup = compiler.options.devServer.setupMiddlewares;
|
|
174
|
-
compiler.options.devServer.port = port;
|
|
175
|
-
compiler.options.devServer.static = path.join(context, "dist");
|
|
176
|
-
compiler.options.devServer.hot = true;
|
|
177
|
-
compiler.options.devServer.devMiddleware = { writeToDisk: true };
|
|
178
|
-
compiler.options.devServer.headers = {
|
|
179
|
-
"Access-Control-Allow-Origin": "*",
|
|
180
|
-
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
|
181
|
-
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
|
182
|
-
};
|
|
183
|
-
compiler.options.devServer.client = {
|
|
184
|
-
logging: "warn",
|
|
185
|
-
overlay: {
|
|
186
|
-
warnings: false,
|
|
187
|
-
errors: true
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {
|
|
191
|
-
setupPluginMiddleware(devServer, pluginInfo, devConfig, port);
|
|
192
|
-
return originalSetup ? originalSetup(middlewares, devServer) : middlewares;
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
170
|
};
|
|
196
171
|
|
|
197
172
|
//#endregion
|
|
198
|
-
export { EmitPluginManifest,
|
|
173
|
+
export { EmitPluginManifest, EveryPluginBuild };
|
|
199
174
|
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n };\n\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAG1C;CAFpB,OAAO;CAEP,YAAY,AAAQ,UAAwC,CAAC,GAAG;EAA5C;CAA6C;CAEjE,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;GAAM,GAAG,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;IACxD,MAAM,aAAa,cAAc,OAAO;IACxC,MAAM,mBAAmB,KAAK,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WAAW,YAAY,WAAW,IAAI;GAC5D,OAAO,gBAAgB,cAAc,aAAa,SAAS,IAAI;EACjE;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport {\n DEV_ENTRY_FILENAME,\n findHashedEntry,\n isBuildInvocation,\n uiEntryFilename,\n} from \"../artifact-names\";\nimport { CONTRACT_TYPES_FILE, generateContractTypes } from \"../contract-types\";\nimport { BuildReportPlugin } from \"./build-report-plugin\";\nimport { ChunkCompletenessPlugin } from \"./chunk-completeness-plugin\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo } from \"./utils\";\n\nexport interface EveryPluginBuildOptions {\n dts?: boolean;\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n let generationError: string | null = null;\n try {\n const status = await generateContractTypes(context);\n if (status === \"generated\") {\n console.log(`[EmitPluginManifest] Contract types regenerated (${context}).`);\n }\n } catch (error) {\n generationError = error instanceof Error ? error.message : String(error);\n }\n\n if (generationError) {\n console.warn(`[EmitPluginManifest] Skipping manifest generation — ${generationError}`);\n return;\n }\n\n const sourceContractPath = path.join(context, CONTRACT_TYPES_FILE);\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n const contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] No contract types at ${sourceContractPath} ` +\n `(no src/contract.ts in this workspace?). Skipping manifest generation.`,\n );\n return;\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const hashedEntry = findHashedEntry(Object.keys(compilation.assets), \"remoteEntry\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: `./${hashedEntry ?? DEV_ENTRY_FILENAME}`,\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginBuild implements RspackPluginInstance {\n name = \"EveryPluginBuild\";\n\n constructor(private options: EveryPluginBuildOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n\n this.configureDefaults(compiler, pluginInfo);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: uiEntryFilename({ isBuild: isBuildInvocation() }),\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n new BuildReportPlugin().apply(compiler);\n new ChunkCompletenessPlugin().apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n // Watch rebuilds must not wipe dist: the dev serve static handler serves\n // this directory, and a clean on every rebuild opens a window where\n // remoteEntry.js 404s for any consumer that loads mid-rebuild.\n compiler.options.output.clean = !compiler.options.watch;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.optimization) {\n compiler.options.optimization = {};\n }\n // rspack 2.x splitChunks re-ids the final chunk graph while the federation\n // get-factory codegen keeps pre-split ids — the entry then references\n // chunks that were never emitted (ChunkCompletenessPlugin's exact failure\n // mode). Splitting off keeps the emitted bundle self-consistent.\n compiler.options.optimization.splitChunks = false;\n // The default deterministic module ids hash module identifiers that embed\n // absolute resource paths, so the same source builds to different id\n // spaces on different machines (host deploy train vs the image's\n // dist-builder stage). A mixed-generation load — CDN-pinned entry +\n // staged chunks — then splices two incompatible id spaces and fails with\n // \"__webpack_modules__[r] is not a function\". Named ids derive from\n // context-relative requests, keeping builds machine-independent and the\n // two generations semantically identical.\n compiler.options.optimization.moduleIds = \"named\";\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n // Source-first for local flows: resolve framework packages through the\n // `development` export condition (TS source) unless DEPLOY=true — the\n // manual dist-first switch deploy-identical builds opt into. (NODE_ENV\n // is unusable as the gate here: the rspack CLI defaults it to\n // \"production\" for every `build` invocation, including local dev watch.)\n // byDependency entries inherit the root conditions via \"...\", so\n // dropping the strip lets esm/cjs deps pick up `development` too.\n const sourceFirst = process.env.DEPLOY !== \"true\";\n compiler.options.resolve.conditionNames = [\n ...(sourceFirst ? [\"development\"] : []),\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (sourceFirst) {\n // Source-resolved TS packages (e.g. better-near-auth) use node-style\n // `.js` specifiers for their own relative imports; map them to the\n // on-disk `.ts` sources. `.js` stays first in the expansion: the alias\n // picks the first target that exists on disk, and .ts-first made\n // packages that also ship index.ts (e.g. @scure/base) resolve their\n // TypeScript over their real JavaScript entry.\n compiler.options.resolve.extensionAlias = {\n \".js\": [\".js\", \".ts\", \".tsx\"],\n };\n }\n if (!sourceFirst && compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n // Source-first resolution pulls every-plugin src into the graph, which\n // imports package.json (runtime/mf-config.ts). The MF shared chunks\n // must emit it as a json module, not parse it as JavaScript.\n const hasJsonRule = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".json\"),\n );\n\n if (!hasJsonRule) {\n compiler.options.module.rules.push({\n test: /\\.json$/,\n type: \"json\",\n } as any);\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAa,qBAAb,MAAgE;CAG1C;CAFpB,OAAO;CAEP,YAAY,AAAQ,UAAwC,CAAC,GAAG;EAA5C;CAA6C;CAEjE,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;GAAM,GAAG,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;IACxD,MAAM,aAAa,cAAc,OAAO;IACxC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,IAAI,kBAAiC;IACrC,IAAI;KAEF,IAAI,MADiB,sBAAsB,OAA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AAS,QAAQ,OAAO,QAAQ,CAAC;EAenC,IAAI,CATgB,SAAS,QAAQ,OAAO,MAAM,MAC/C,SACC,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,OAAO,CAGX,GACb,SAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,MAAM;EACR,CAAQ;EAYV,IAAI,CATgB,SAAS,QAAQ,OAAO,MAAM,MAC/C,SACC,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,KAAK,CAGT,GACb,SAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,KAAK;GACL,SAAS;EACX,CAAC;CAEL;AACF"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_identity = require('../../identity.cjs');
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
5
|
+
let node_module = require("node:module");
|
|
5
6
|
let node_path = require("node:path");
|
|
6
7
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
7
8
|
|
|
8
9
|
//#region src/build/rspack/utils.ts
|
|
10
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
9
11
|
function getPluginInfo(context) {
|
|
10
12
|
const pkgPath = node_path.default.join(context, "package.json");
|
|
11
13
|
const pkg = JSON.parse(node_fs.default.readFileSync(pkgPath, "utf-8"));
|
|
12
14
|
return {
|
|
13
15
|
name: pkg.name,
|
|
14
16
|
version: pkg.version,
|
|
15
|
-
normalizedName:
|
|
17
|
+
normalizedName: require_identity.remoteName(pkg.name),
|
|
16
18
|
dependencies: pkg.dependencies || {},
|
|
17
19
|
peerDependencies: pkg.peerDependencies || {}
|
|
18
20
|
};
|
|
@@ -23,11 +25,11 @@ function loadDevConfig(devConfigPath) {
|
|
|
23
25
|
try {
|
|
24
26
|
const fullPath = node_path.default.resolve(devConfigPath);
|
|
25
27
|
if (loadedModules.has(fullPath)) {
|
|
26
|
-
delete require.cache[fullPath];
|
|
28
|
+
delete require$1.cache[fullPath];
|
|
27
29
|
const dirPath = node_path.default.dirname(fullPath);
|
|
28
|
-
for (const key of Object.keys(require.cache)) if (key.startsWith(dirPath) && key !== fullPath) delete require.cache[key];
|
|
30
|
+
for (const key of Object.keys(require$1.cache)) if (key.startsWith(dirPath) && key !== fullPath) delete require$1.cache[key];
|
|
29
31
|
}
|
|
30
|
-
const module = require(fullPath).default;
|
|
32
|
+
const module = require$1(fullPath).default;
|
|
31
33
|
loadedModules.add(fullPath);
|
|
32
34
|
return module;
|
|
33
35
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["path","fs","
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["require","createRequire","path","fs","remoteName"],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { remoteName } from \"../../identity\";\n\n// Bare `require` only exists under bun's ESM; node ESM needs an explicit\n// binding. tsx patches the module loader, so this require still loads the\n// plugin.dev.ts source.\nconst require = createRequire(import.meta.url);\n\nexport interface PluginInfo {\n name: string;\n version: string;\n normalizedName: string;\n dependencies: Record<string, string>;\n peerDependencies: Record<string, string>;\n}\n\nexport function getPluginInfo(context: string): PluginInfo {\n const pkgPath = path.join(context, \"package.json\");\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n\n return {\n name: pkg.name,\n version: pkg.version,\n normalizedName: remoteName(pkg.name),\n dependencies: pkg.dependencies || {},\n peerDependencies: pkg.peerDependencies || {},\n };\n}\n\nconst loadedModules = new Set<string>();\n\nexport function loadDevConfig(devConfigPath: string) {\n if (process.env.DEPLOY === \"true\") {\n return null;\n }\n\n try {\n const fullPath = path.resolve(devConfigPath);\n\n if (loadedModules.has(fullPath)) {\n delete require.cache[fullPath];\n const dirPath = path.dirname(fullPath);\n for (const key of Object.keys(require.cache)) {\n if (key.startsWith(dirPath) && key !== fullPath) {\n delete require.cache[key];\n }\n }\n }\n\n const module = require(fullPath).default;\n loadedModules.add(fullPath);\n return module;\n } catch (error) {\n console.warn(`Could not load dev config from ${devConfigPath}:`, (error as Error).message);\n return null;\n }\n}\n\nexport function cleanupDevConfig() {\n for (const modulePath of loadedModules) {\n delete require.cache[modulePath];\n }\n loadedModules.clear();\n}\n"],"mappings":";;;;;;;;;AAQA,MAAMA,gBAAUC,wEAA6B;AAU7C,SAAgB,cAAc,SAA6B;CACzD,MAAM,UAAUC,kBAAK,KAAK,SAAS,cAAc;CACjD,MAAM,MAAM,KAAK,MAAMC,gBAAG,aAAa,SAAS,OAAO,CAAC;CAExD,OAAO;EACL,MAAM,IAAI;EACV,SAAS,IAAI;EACb,gBAAgBC,4BAAW,IAAI,IAAI;EACnC,cAAc,IAAI,gBAAgB,CAAC;EACnC,kBAAkB,IAAI,oBAAoB,CAAC;CAC7C;AACF;AAEA,MAAM,gCAAgB,IAAI,IAAY;AAEtC,SAAgB,cAAc,eAAuB;CACnD,IAAI,QAAQ,IAAI,WAAW,QACzB,OAAO;CAGT,IAAI;EACF,MAAM,WAAWF,kBAAK,QAAQ,aAAa;EAE3C,IAAI,cAAc,IAAI,QAAQ,GAAG;GAC/B,OAAOF,UAAQ,MAAM;GACrB,MAAM,UAAUE,kBAAK,QAAQ,QAAQ;GACrC,KAAK,MAAM,OAAO,OAAO,KAAKF,UAAQ,KAAK,GACzC,IAAI,IAAI,WAAW,OAAO,KAAK,QAAQ,UACrC,OAAOA,UAAQ,MAAM;EAG3B;EAEA,MAAM,SAASA,UAAQ,QAAQ,CAAC,CAAC;EACjC,cAAc,IAAI,QAAQ;EAC1B,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,KAAK,kCAAkC,cAAc,IAAK,MAAgB,OAAO;EACzF,OAAO;CACT;AACF"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { remoteName } from "../../identity.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
//#region src/build/rspack/utils.ts
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
7
8
|
function getPluginInfo(context) {
|
|
8
9
|
const pkgPath = path.join(context, "package.json");
|
|
9
10
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
10
11
|
return {
|
|
11
12
|
name: pkg.name,
|
|
12
13
|
version: pkg.version,
|
|
13
|
-
normalizedName:
|
|
14
|
+
normalizedName: remoteName(pkg.name),
|
|
14
15
|
dependencies: pkg.dependencies || {},
|
|
15
16
|
peerDependencies: pkg.peerDependencies || {}
|
|
16
17
|
};
|
|
@@ -21,11 +22,11 @@ function loadDevConfig(devConfigPath) {
|
|
|
21
22
|
try {
|
|
22
23
|
const fullPath = path.resolve(devConfigPath);
|
|
23
24
|
if (loadedModules.has(fullPath)) {
|
|
24
|
-
delete
|
|
25
|
+
delete require.cache[fullPath];
|
|
25
26
|
const dirPath = path.dirname(fullPath);
|
|
26
|
-
for (const key of Object.keys(
|
|
27
|
+
for (const key of Object.keys(require.cache)) if (key.startsWith(dirPath) && key !== fullPath) delete require.cache[key];
|
|
27
28
|
}
|
|
28
|
-
const module =
|
|
29
|
+
const module = require(fullPath).default;
|
|
29
30
|
loadedModules.add(fullPath);
|
|
30
31
|
return module;
|
|
31
32
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport {
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/build/rspack/utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { remoteName } from \"../../identity\";\n\n// Bare `require` only exists under bun's ESM; node ESM needs an explicit\n// binding. tsx patches the module loader, so this require still loads the\n// plugin.dev.ts source.\nconst require = createRequire(import.meta.url);\n\nexport interface PluginInfo {\n name: string;\n version: string;\n normalizedName: string;\n dependencies: Record<string, string>;\n peerDependencies: Record<string, string>;\n}\n\nexport function getPluginInfo(context: string): PluginInfo {\n const pkgPath = path.join(context, \"package.json\");\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n\n return {\n name: pkg.name,\n version: pkg.version,\n normalizedName: remoteName(pkg.name),\n dependencies: pkg.dependencies || {},\n peerDependencies: pkg.peerDependencies || {},\n };\n}\n\nconst loadedModules = new Set<string>();\n\nexport function loadDevConfig(devConfigPath: string) {\n if (process.env.DEPLOY === \"true\") {\n return null;\n }\n\n try {\n const fullPath = path.resolve(devConfigPath);\n\n if (loadedModules.has(fullPath)) {\n delete require.cache[fullPath];\n const dirPath = path.dirname(fullPath);\n for (const key of Object.keys(require.cache)) {\n if (key.startsWith(dirPath) && key !== fullPath) {\n delete require.cache[key];\n }\n }\n }\n\n const module = require(fullPath).default;\n loadedModules.add(fullPath);\n return module;\n } catch (error) {\n console.warn(`Could not load dev config from ${devConfigPath}:`, (error as Error).message);\n return null;\n }\n}\n\nexport function cleanupDevConfig() {\n for (const modulePath of loadedModules) {\n delete require.cache[modulePath];\n }\n loadedModules.clear();\n}\n"],"mappings":";;;;;;AAQA,MAAM,UAAU,cAAc,YAAY,GAAG;AAU7C,SAAgB,cAAc,SAA6B;CACzD,MAAM,UAAU,KAAK,KAAK,SAAS,cAAc;CACjD,MAAM,MAAM,KAAK,MAAM,GAAG,aAAa,SAAS,OAAO,CAAC;CAExD,OAAO;EACL,MAAM,IAAI;EACV,SAAS,IAAI;EACb,gBAAgB,WAAW,IAAI,IAAI;EACnC,cAAc,IAAI,gBAAgB,CAAC;EACnC,kBAAkB,IAAI,oBAAoB,CAAC;CAC7C;AACF;AAEA,MAAM,gCAAgB,IAAI,IAAY;AAEtC,SAAgB,cAAc,eAAuB;CACnD,IAAI,QAAQ,IAAI,WAAW,QACzB,OAAO;CAGT,IAAI;EACF,MAAM,WAAW,KAAK,QAAQ,aAAa;EAE3C,IAAI,cAAc,IAAI,QAAQ,GAAG;GAC/B,OAAO,QAAQ,MAAM;GACrB,MAAM,UAAU,KAAK,QAAQ,QAAQ;GACrC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,KAAK,GACzC,IAAI,IAAI,WAAW,OAAO,KAAK,QAAQ,UACrC,OAAO,QAAQ,MAAM;EAG3B;EAEA,MAAM,SAAS,QAAQ,QAAQ,CAAC,CAAC;EACjC,cAAc,IAAI,QAAQ;EAC1B,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,KAAK,kCAAkC,cAAc,IAAK,MAAgB,OAAO;EACzF,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_ui_manifest_contract = require('../../ui/manifest/contract.cjs');
|
|
3
|
+
const require_rsbuild_config = require('./rsbuild-config.cjs');
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
8
|
+
|
|
9
|
+
//#region src/build/ui/factory.ts
|
|
10
|
+
/**
|
|
11
|
+
* The core ui's rsbuild factory — the workspace-form counterpart of
|
|
12
|
+
* `createUiRsbuildConfig` (folder-form plugin uis). The config object the
|
|
13
|
+
* generated `.every-plugin/ui.rsbuild.config.generated.mjs` materializes:
|
|
14
|
+
* the APP_NAME/APP_ACCOUNT defines come from the authored config through
|
|
15
|
+
* `readAuthoredConfigInput` (everything-dev/config), which the generated
|
|
16
|
+
* file loads in the workspace's own module graph.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The platform skill family ships inside the framework packages' npm tarballs
|
|
20
|
+
* (`files: ["skills"]`), so resolving them from `node_modules` gives the core
|
|
21
|
+
* ui the same copies in the parent workspace (pnpm symlinks) and every
|
|
22
|
+
* generated child repo (published tarball). Served at `/skills/<pkg>/<skill>`.
|
|
23
|
+
*/
|
|
24
|
+
const SKILL_PACKAGES = [
|
|
25
|
+
"everything-dev",
|
|
26
|
+
"every-plugin",
|
|
27
|
+
"better-near-auth"
|
|
28
|
+
];
|
|
29
|
+
function platformSkillCopies(workspaceRoot) {
|
|
30
|
+
return SKILL_PACKAGES.flatMap((name) => {
|
|
31
|
+
const from = node_path.default.join(workspaceRoot, "node_modules", name, "skills");
|
|
32
|
+
return node_fs.default.existsSync(from) ? [{
|
|
33
|
+
from,
|
|
34
|
+
to: `./skills/${name}`,
|
|
35
|
+
globOptions: { ignore: ["**/_artifacts/**"] }
|
|
36
|
+
}] : [];
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The core ui's MF build surface — entry points and the declared exposes
|
|
41
|
+
* (ADR 0008 §2). Entries and the bootstrap exposes resolve to GENERATED
|
|
42
|
+
* stubs (ADR 0023); only surfaces with consumers are declared: the browser
|
|
43
|
+
* bootstrap, the shared component barrel, the SSR router module, the
|
|
44
|
+
* composition engine, and the generated route config.
|
|
45
|
+
*/
|
|
46
|
+
const CORE_UI_WEB_ENTRY = "./src/entry.gen.ts";
|
|
47
|
+
const CORE_UI_WEB_EXPOSES = {
|
|
48
|
+
"./Hydrate": "./src/hydrate.gen.tsx",
|
|
49
|
+
"./components": "./src/components/index.ts"
|
|
50
|
+
};
|
|
51
|
+
const CORE_UI_NODE_ENTRY = "./src/router.server.gen.tsx";
|
|
52
|
+
const CORE_UI_NODE_EXPOSES = {
|
|
53
|
+
"./Router": "./src/router.server.gen.tsx",
|
|
54
|
+
"./compose": "./src/compose.gen.ts",
|
|
55
|
+
"./routeConfig": "./src/routeConfig.gen.ts"
|
|
56
|
+
};
|
|
57
|
+
function createCoreUiRsbuildConfig({ domain, account } = {}) {
|
|
58
|
+
const workspaceRoot = process.cwd();
|
|
59
|
+
const pkg = JSON.parse(node_fs.default.readFileSync(node_path.default.join(workspaceRoot, "package.json"), "utf-8"));
|
|
60
|
+
return require_rsbuild_config.createUiRsbuildConfig({
|
|
61
|
+
workspaceRoot,
|
|
62
|
+
pkg,
|
|
63
|
+
role: "provider",
|
|
64
|
+
manifestName: "ui",
|
|
65
|
+
devPort: 3003,
|
|
66
|
+
webEntry: CORE_UI_WEB_ENTRY,
|
|
67
|
+
webExposes: CORE_UI_WEB_EXPOSES,
|
|
68
|
+
nodeEntry: CORE_UI_NODE_ENTRY,
|
|
69
|
+
nodeExposes: CORE_UI_NODE_EXPOSES,
|
|
70
|
+
copy: [{
|
|
71
|
+
from: node_path.default.join(workspaceRoot, "public"),
|
|
72
|
+
to: "./"
|
|
73
|
+
}, ...platformSkillCopies(workspaceRoot)],
|
|
74
|
+
define: {
|
|
75
|
+
"import.meta.env.APP_NAME": JSON.stringify(domain),
|
|
76
|
+
"import.meta.env.APP_ACCOUNT": JSON.stringify(account)
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.CORE_UI_NODE_ENTRY = CORE_UI_NODE_ENTRY;
|
|
83
|
+
exports.CORE_UI_NODE_EXPOSES = CORE_UI_NODE_EXPOSES;
|
|
84
|
+
exports.CORE_UI_WEB_ENTRY = CORE_UI_WEB_ENTRY;
|
|
85
|
+
exports.CORE_UI_WEB_EXPOSES = CORE_UI_WEB_EXPOSES;
|
|
86
|
+
exports.createCoreUiRsbuildConfig = createCoreUiRsbuildConfig;
|
|
87
|
+
exports.platformSkillCopies = platformSkillCopies;
|
|
88
|
+
//# sourceMappingURL=factory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.cjs","names":["path","fs","createUiRsbuildConfig"],"sources":["../../../src/build/ui/factory.ts"],"sourcesContent":["/**\n * The core ui's rsbuild factory — the workspace-form counterpart of\n * `createUiRsbuildConfig` (folder-form plugin uis). The config object the\n * generated `.every-plugin/ui.rsbuild.config.generated.mjs` materializes:\n * the APP_NAME/APP_ACCOUNT defines come from the authored config through\n * `readAuthoredConfigInput` (everything-dev/config), which the generated\n * file loads in the workspace's own module graph.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { CORE_UI_PLUGIN_KEY } from \"../../ui/manifest/contract\";\nimport { createUiRsbuildConfig } from \"./rsbuild-config\";\n\n/**\n * The platform skill family ships inside the framework packages' npm tarballs\n * (`files: [\"skills\"]`), so resolving them from `node_modules` gives the core\n * ui the same copies in the parent workspace (pnpm symlinks) and every\n * generated child repo (published tarball). Served at `/skills/<pkg>/<skill>`.\n */\nconst SKILL_PACKAGES = [\"everything-dev\", \"every-plugin\", \"better-near-auth\"] as const;\n\nexport function platformSkillCopies(workspaceRoot: string): Array<{\n from: string;\n to: string;\n globOptions: { ignore: string[] };\n}> {\n return SKILL_PACKAGES.flatMap((name) => {\n const from = path.join(workspaceRoot, \"node_modules\", name, \"skills\");\n return fs.existsSync(from)\n ? [\n {\n from,\n to: `./skills/${name}`,\n globOptions: { ignore: [\"**/_artifacts/**\"] },\n },\n ]\n : [];\n });\n}\n\nexport interface CoreUiRsbuildConfigInput {\n /** Authored config domain — stamped as `import.meta.env.APP_NAME`. */\n domain?: string;\n /** Authored config account — stamped as `import.meta.env.APP_ACCOUNT`. */\n account?: string;\n}\n\n/**\n * The core ui's MF build surface — entry points and the declared exposes\n * (ADR 0008 §2). Entries and the bootstrap exposes resolve to GENERATED\n * stubs (ADR 0023); only surfaces with consumers are declared: the browser\n * bootstrap, the shared component barrel, the SSR router module, the\n * composition engine, and the generated route config.\n */\nexport const CORE_UI_WEB_ENTRY = \"./src/entry.gen.ts\";\n\nexport const CORE_UI_WEB_EXPOSES: Record<string, string> = {\n \"./Hydrate\": \"./src/hydrate.gen.tsx\",\n \"./components\": \"./src/components/index.ts\",\n};\n\nexport const CORE_UI_NODE_ENTRY = \"./src/router.server.gen.tsx\";\n\nexport const CORE_UI_NODE_EXPOSES: Record<string, string> = {\n \"./Router\": \"./src/router.server.gen.tsx\",\n \"./compose\": \"./src/compose.gen.ts\",\n \"./routeConfig\": \"./src/routeConfig.gen.ts\",\n};\n\nexport function createCoreUiRsbuildConfig({ domain, account }: CoreUiRsbuildConfigInput = {}) {\n const workspaceRoot = process.cwd();\n const pkg = JSON.parse(fs.readFileSync(path.join(workspaceRoot, \"package.json\"), \"utf-8\")) as {\n name: string;\n };\n\n return createUiRsbuildConfig({\n workspaceRoot,\n pkg,\n role: \"provider\",\n manifestName: CORE_UI_PLUGIN_KEY,\n devPort: 3003,\n webEntry: CORE_UI_WEB_ENTRY,\n webExposes: CORE_UI_WEB_EXPOSES,\n nodeEntry: CORE_UI_NODE_ENTRY,\n nodeExposes: CORE_UI_NODE_EXPOSES,\n copy: [\n { from: path.join(workspaceRoot, \"public\"), to: \"./\" },\n ...platformSkillCopies(workspaceRoot),\n ],\n define: {\n \"import.meta.env.APP_NAME\": JSON.stringify(domain),\n \"import.meta.env.APP_ACCOUNT\": JSON.stringify(account),\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAiB;CAAC;CAAkB;CAAgB;AAAkB;AAE5E,SAAgB,oBAAoB,eAIjC;CACD,OAAO,eAAe,SAAS,SAAS;EACtC,MAAM,OAAOA,kBAAK,KAAK,eAAe,gBAAgB,MAAM,QAAQ;EACpE,OAAOC,gBAAG,WAAW,IAAI,IACrB,CACE;GACE;GACA,IAAI,YAAY;GAChB,aAAa,EAAE,QAAQ,CAAC,kBAAkB,EAAE;EAC9C,CACF,IACA,CAAC;CACP,CAAC;AACH;;;;;;;;AAgBA,MAAa,oBAAoB;AAEjC,MAAa,sBAA8C;CACzD,aAAa;CACb,gBAAgB;AAClB;AAEA,MAAa,qBAAqB;AAElC,MAAa,uBAA+C;CAC1D,YAAY;CACZ,aAAa;CACb,iBAAiB;AACnB;AAEA,SAAgB,0BAA0B,EAAE,QAAQ,YAAsC,CAAC,GAAG;CAC5F,MAAM,gBAAgB,QAAQ,IAAI;CAClC,MAAM,MAAM,KAAK,MAAMA,gBAAG,aAAaD,kBAAK,KAAK,eAAe,cAAc,GAAG,OAAO,CAAC;CAIzF,OAAOE,6CAAsB;EAC3B;EACA;EACA,MAAM;EACN;EACA,SAAS;EACT,UAAU;EACV,YAAY;EACZ,WAAW;EACX,aAAa;EACb,MAAM,CACJ;GAAE,MAAMF,kBAAK,KAAK,eAAe,QAAQ;GAAG,IAAI;EAAK,GACrD,GAAG,oBAAoB,aAAa,CACtC;EACA,QAAQ;GACN,4BAA4B,KAAK,UAAU,MAAM;GACjD,+BAA+B,KAAK,UAAU,OAAO;EACvD;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/build/ui/factory.d.ts
|
|
2
|
+
interface CoreUiRsbuildConfigInput {
|
|
3
|
+
/** Authored config domain — stamped as `import.meta.env.APP_NAME`. */
|
|
4
|
+
domain?: string;
|
|
5
|
+
/** Authored config account — stamped as `import.meta.env.APP_ACCOUNT`. */
|
|
6
|
+
account?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function createCoreUiRsbuildConfig({ domain, account }?: CoreUiRsbuildConfigInput): import("@rsbuild/core").RsbuildConfig;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CoreUiRsbuildConfigInput, createCoreUiRsbuildConfig };
|
|
11
|
+
//# sourceMappingURL=factory.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.cts","names":[],"sources":["../../../src/build/ui/factory.ts"],"mappings":";UAyCiB;;EAEf;;EAEA;;iBAyBc,4BAA4B,QAAQ,YAAW,mDAA6B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/build/ui/factory.d.ts
|
|
2
|
+
interface CoreUiRsbuildConfigInput {
|
|
3
|
+
/** Authored config domain — stamped as `import.meta.env.APP_NAME`. */
|
|
4
|
+
domain?: string;
|
|
5
|
+
/** Authored config account — stamped as `import.meta.env.APP_ACCOUNT`. */
|
|
6
|
+
account?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function createCoreUiRsbuildConfig({ domain, account }?: CoreUiRsbuildConfigInput): import("@rsbuild/core").RsbuildConfig;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CoreUiRsbuildConfigInput, createCoreUiRsbuildConfig };
|
|
11
|
+
//# sourceMappingURL=factory.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.mts","names":[],"sources":["../../../src/build/ui/factory.ts"],"mappings":";UAyCiB;;EAEf;;EAEA;;iBAyBc,4BAA4B,QAAQ,YAAW,mDAA6B"}
|