every-plugin 2.10.1 → 3.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/every-plugin-serve.mjs +12 -0
- package/bin/every-plugin.mjs +59 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/build/artifact-names.cjs +119 -0
- package/dist/build/artifact-names.cjs.map +1 -0
- package/dist/build/artifact-names.d.cts +68 -0
- package/dist/build/artifact-names.d.cts.map +1 -0
- package/dist/build/artifact-names.d.mts +68 -0
- package/dist/build/artifact-names.d.mts.map +1 -0
- package/dist/build/artifact-names.mjs +102 -0
- package/dist/build/artifact-names.mjs.map +1 -0
- package/dist/build/contract-types.cjs +89 -0
- package/dist/build/contract-types.cjs.map +1 -0
- package/dist/build/contract-types.mjs +81 -0
- package/dist/build/contract-types.mjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.cjs +37 -0
- package/dist/build/rspack/build-report-plugin.cjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.cts +18 -0
- package/dist/build/rspack/build-report-plugin.d.cts.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.mts +18 -0
- package/dist/build/rspack/build-report-plugin.d.mts.map +1 -0
- package/dist/build/rspack/build-report-plugin.mjs +37 -0
- package/dist/build/rspack/build-report-plugin.mjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -0
- package/dist/build/rspack/compose.cjs +69 -0
- package/dist/build/rspack/compose.cjs.map +1 -0
- package/dist/build/rspack/compose.d.cts +20 -0
- package/dist/build/rspack/compose.d.cts.map +1 -0
- package/dist/build/rspack/compose.d.mts +20 -0
- package/dist/build/rspack/compose.d.mts.map +1 -0
- package/dist/build/rspack/compose.mjs +65 -0
- package/dist/build/rspack/compose.mjs.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +11 -11
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +11 -10
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/generated-config.cjs +35 -0
- package/dist/build/rspack/generated-config.cjs.map +1 -0
- package/dist/build/rspack/generated-config.mjs +32 -0
- package/dist/build/rspack/generated-config.mjs.map +1 -0
- package/dist/build/rspack/index.cjs +8 -5
- package/dist/build/rspack/index.d.cts +5 -3
- package/dist/build/rspack/index.d.mts +5 -3
- package/dist/build/rspack/index.mjs +5 -3
- package/dist/build/rspack/module-federation.cjs +2 -2
- package/dist/build/rspack/module-federation.cjs.map +1 -1
- package/dist/build/rspack/module-federation.mjs +1 -1
- package/dist/build/rspack/module-federation.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs +44 -69
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +4 -13
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +4 -13
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +44 -69
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/rspack/utils.cjs +7 -5
- package/dist/build/rspack/utils.cjs.map +1 -1
- package/dist/build/rspack/utils.mjs +7 -6
- package/dist/build/rspack/utils.mjs.map +1 -1
- package/dist/build/ui/factory.cjs +88 -0
- package/dist/build/ui/factory.cjs.map +1 -0
- package/dist/build/ui/factory.d.cts +11 -0
- package/dist/build/ui/factory.d.cts.map +1 -0
- package/dist/build/ui/factory.d.mts +11 -0
- package/dist/build/ui/factory.d.mts.map +1 -0
- package/dist/build/ui/factory.mjs +80 -0
- package/dist/build/ui/factory.mjs.map +1 -0
- package/dist/build/ui/generated-config.cjs +118 -0
- package/dist/build/ui/generated-config.cjs.map +1 -0
- package/dist/build/ui/generated-config.d.cts +33 -0
- package/dist/build/ui/generated-config.d.cts.map +1 -0
- package/dist/build/ui/generated-config.d.mts +33 -0
- package/dist/build/ui/generated-config.d.mts.map +1 -0
- package/dist/build/ui/generated-config.mjs +111 -0
- package/dist/build/ui/generated-config.mjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs +61 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs +58 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs.map +1 -0
- package/dist/build/ui/index.cjs +90 -0
- package/dist/build/ui/index.cjs.map +1 -0
- package/dist/build/ui/index.d.cts +29 -0
- package/dist/build/ui/index.d.cts.map +1 -0
- package/dist/build/ui/index.d.mts +29 -0
- package/dist/build/ui/index.d.mts.map +1 -0
- package/dist/build/ui/index.mjs +68 -0
- package/dist/build/ui/index.mjs.map +1 -0
- package/dist/build/ui/manifest-plugin.cjs +37 -0
- package/dist/build/ui/manifest-plugin.cjs.map +1 -0
- package/dist/build/ui/manifest-plugin.d.cts +19 -0
- package/dist/build/ui/manifest-plugin.d.cts.map +1 -0
- package/dist/build/ui/manifest-plugin.d.mts +19 -0
- package/dist/build/ui/manifest-plugin.d.mts.map +1 -0
- package/dist/build/ui/manifest-plugin.mjs +37 -0
- package/dist/build/ui/manifest-plugin.mjs.map +1 -0
- package/dist/build/ui/rsbuild-config.cjs +203 -0
- package/dist/build/ui/rsbuild-config.cjs.map +1 -0
- package/dist/build/ui/rsbuild-config.d.cts +45 -0
- package/dist/build/ui/rsbuild-config.d.cts.map +1 -0
- package/dist/build/ui/rsbuild-config.d.mts +45 -0
- package/dist/build/ui/rsbuild-config.d.mts.map +1 -0
- package/dist/build/ui/rsbuild-config.mjs +200 -0
- package/dist/build/ui/rsbuild-config.mjs.map +1 -0
- package/dist/build/ui/stubs.cjs +107 -0
- package/dist/build/ui/stubs.cjs.map +1 -0
- package/dist/build/ui/stubs.d.cts +25 -0
- package/dist/build/ui/stubs.d.cts.map +1 -0
- package/dist/build/ui/stubs.d.mts +25 -0
- package/dist/build/ui/stubs.d.mts.map +1 -0
- package/dist/build/ui/stubs.mjs +106 -0
- package/dist/build/ui/stubs.mjs.map +1 -0
- package/dist/cli.cjs +83 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +6 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +6 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +82 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/dev/serve.cjs +390 -0
- package/dist/dev/serve.cjs.map +1 -0
- package/dist/dev/serve.d.cts +23 -0
- package/dist/dev/serve.d.cts.map +1 -0
- package/dist/dev/serve.d.mts +23 -0
- package/dist/dev/serve.d.mts.map +1 -0
- package/dist/dev/serve.mjs +384 -0
- package/dist/dev/serve.mjs.map +1 -0
- package/dist/dev/watch-kill.cjs +39 -0
- package/dist/dev/watch-kill.cjs.map +1 -0
- package/dist/dev/watch-kill.mjs +38 -0
- package/dist/dev/watch-kill.mjs.map +1 -0
- package/dist/effect-helpers.cjs +23 -0
- package/dist/effect-helpers.cjs.map +1 -0
- package/dist/effect-helpers.d.cts +20 -0
- package/dist/effect-helpers.d.cts.map +1 -0
- package/dist/effect-helpers.d.mts +20 -0
- package/dist/effect-helpers.d.mts.map +1 -0
- package/dist/effect-helpers.mjs +22 -0
- package/dist/effect-helpers.mjs.map +1 -0
- package/dist/errors.cjs +50 -69
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +13 -96
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +13 -96
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +16 -34
- package/dist/errors.mjs.map +1 -1
- package/dist/identity.cjs +19 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +33 -0
- package/dist/identity.d.cts.map +1 -0
- package/dist/identity.d.mts +33 -0
- package/dist/identity.d.mts.map +1 -0
- package/dist/identity.mjs +16 -0
- package/dist/identity.mjs.map +1 -0
- package/dist/index.cjs +9 -5
- package/dist/index.d.cts +8 -6
- package/dist/index.d.mts +8 -6
- package/dist/index.mjs +6 -4
- package/dist/plugin.cjs +13 -26
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +57 -24
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +58 -25
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +16 -29
- package/dist/plugin.mjs.map +1 -1
- package/dist/remote-entry.cjs +103 -0
- package/dist/remote-entry.cjs.map +1 -0
- package/dist/remote-entry.d.cts +53 -0
- package/dist/remote-entry.d.cts.map +1 -0
- package/dist/remote-entry.d.mts +53 -0
- package/dist/remote-entry.d.mts.map +1 -0
- package/dist/remote-entry.mjs +98 -0
- package/dist/remote-entry.mjs.map +1 -0
- package/dist/runtime/errors.cjs +159 -33
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +64 -7
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +64 -7
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +154 -30
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +95 -23
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +16 -0
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +16 -0
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +98 -26
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +3 -78
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts +3 -49
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts +3 -49
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +5 -78
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +57 -12
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts +4 -13
- package/dist/runtime/services/module-federation.service.d.mts +4 -13
- package/dist/runtime/services/module-federation.service.mjs +57 -14
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/normalize.cjs +2 -22
- package/dist/runtime/services/normalize.d.cts +2 -21
- package/dist/runtime/services/normalize.d.mts +2 -21
- package/dist/runtime/services/normalize.mjs +2 -21
- package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +56 -30
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
- package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
- package/dist/runtime/services/plugin-loader.service.mjs +55 -31
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +10 -12
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts +14 -36
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts +14 -36
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs +14 -18
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +12 -12
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.d.cts +3 -15
- package/dist/runtime/services/secrets.service.d.mts +3 -15
- package/dist/runtime/services/secrets.service.mjs +12 -13
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/runtime/services/shared-identity.cjs +40 -0
- package/dist/runtime/services/shared-identity.cjs.map +1 -0
- package/dist/runtime/services/shared-identity.mjs +38 -0
- package/dist/runtime/services/shared-identity.mjs.map +1 -0
- package/dist/runtime/validation.cjs +2 -2
- package/dist/runtime/validation.cjs.map +1 -1
- package/dist/runtime/validation.mjs +2 -2
- package/dist/runtime/validation.mjs.map +1 -1
- package/dist/shared-deps-spec.cjs +384 -0
- package/dist/shared-deps-spec.cjs.map +1 -0
- package/dist/shared-deps-spec.d.cts +182 -0
- package/dist/shared-deps-spec.d.cts.map +1 -0
- package/dist/shared-deps-spec.d.mts +182 -0
- package/dist/shared-deps-spec.d.mts.map +1 -0
- package/dist/shared-deps-spec.mjs +368 -0
- package/dist/shared-deps-spec.mjs.map +1 -0
- package/dist/types.d.cts +25 -41
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +25 -41
- package/dist/types.d.mts.map +1 -1
- package/dist/ui/manifest/construct.cjs +268 -0
- package/dist/ui/manifest/construct.cjs.map +1 -0
- package/dist/ui/manifest/construct.d.cts +48 -0
- package/dist/ui/manifest/construct.d.cts.map +1 -0
- package/dist/ui/manifest/construct.d.mts +48 -0
- package/dist/ui/manifest/construct.d.mts.map +1 -0
- package/dist/ui/manifest/construct.mjs +268 -0
- package/dist/ui/manifest/construct.mjs.map +1 -0
- package/dist/ui/manifest/contract.cjs +34 -0
- package/dist/ui/manifest/contract.cjs.map +1 -0
- package/dist/ui/manifest/contract.d.cts +26 -0
- package/dist/ui/manifest/contract.d.cts.map +1 -0
- package/dist/ui/manifest/contract.d.mts +26 -0
- package/dist/ui/manifest/contract.d.mts.map +1 -0
- package/dist/ui/manifest/contract.mjs +26 -0
- package/dist/ui/manifest/contract.mjs.map +1 -0
- package/dist/ui/manifest/descriptor.cjs +64 -0
- package/dist/ui/manifest/descriptor.cjs.map +1 -0
- package/dist/ui/manifest/descriptor.d.cts +60 -0
- package/dist/ui/manifest/descriptor.d.cts.map +1 -0
- package/dist/ui/manifest/descriptor.d.mts +60 -0
- package/dist/ui/manifest/descriptor.d.mts.map +1 -0
- package/dist/ui/manifest/descriptor.mjs +61 -0
- package/dist/ui/manifest/descriptor.mjs.map +1 -0
- package/dist/ui/manifest/generator.cjs +128 -0
- package/dist/ui/manifest/generator.cjs.map +1 -0
- package/dist/ui/manifest/generator.d.cts +41 -0
- package/dist/ui/manifest/generator.d.cts.map +1 -0
- package/dist/ui/manifest/generator.d.mts +41 -0
- package/dist/ui/manifest/generator.d.mts.map +1 -0
- package/dist/ui/manifest/generator.mjs +125 -0
- package/dist/ui/manifest/generator.mjs.map +1 -0
- package/dist/ui/manifest/index.cjs +35 -0
- package/dist/ui/manifest/index.d.cts +9 -0
- package/dist/ui/manifest/index.d.mts +9 -0
- package/dist/ui/manifest/index.mjs +9 -0
- package/dist/ui/manifest/manifest-schema.cjs +97 -0
- package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.cts +132 -0
- package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.mts +132 -0
- package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
- package/dist/ui/manifest/manifest-schema.mjs +90 -0
- package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
- package/dist/ui/manifest/mount-registry.cjs +52 -0
- package/dist/ui/manifest/mount-registry.cjs.map +1 -0
- package/dist/ui/manifest/mount-registry.d.cts +61 -0
- package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
- package/dist/ui/manifest/mount-registry.d.mts +61 -0
- package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
- package/dist/ui/manifest/mount-registry.mjs +48 -0
- package/dist/ui/manifest/mount-registry.mjs.map +1 -0
- package/dist/ui/manifest/nav.cjs +13 -0
- package/dist/ui/manifest/nav.cjs.map +1 -0
- package/dist/ui/manifest/nav.d.cts +34 -0
- package/dist/ui/manifest/nav.d.cts.map +1 -0
- package/dist/ui/manifest/nav.d.mts +34 -0
- package/dist/ui/manifest/nav.d.mts.map +1 -0
- package/dist/ui/manifest/nav.mjs +13 -0
- package/dist/ui/manifest/nav.mjs.map +1 -0
- package/dist/ui/manifest/route-config.cjs +33 -0
- package/dist/ui/manifest/route-config.cjs.map +1 -0
- package/dist/ui/manifest/route-config.d.cts +40 -0
- package/dist/ui/manifest/route-config.d.cts.map +1 -0
- package/dist/ui/manifest/route-config.d.mts +40 -0
- package/dist/ui/manifest/route-config.d.mts.map +1 -0
- package/dist/ui/manifest/route-config.mjs +33 -0
- package/dist/ui/manifest/route-config.mjs.map +1 -0
- package/dist/version-manifest.cjs +65 -0
- package/dist/version-manifest.cjs.map +1 -0
- package/dist/version-manifest.d.cts +52 -0
- package/dist/version-manifest.d.cts.map +1 -0
- package/dist/version-manifest.d.mts +52 -0
- package/dist/version-manifest.d.mts.map +1 -0
- package/dist/version-manifest.mjs +63 -0
- package/dist/version-manifest.mjs.map +1 -0
- package/package.json +165 -68
- package/skills/plugin-client/SKILL.md +24 -5
- package/skills/plugin-development/SKILL.md +79 -47
- package/skills/plugin-testing/SKILL.md +41 -12
- package/src/build/artifact-names.ts +117 -0
- package/src/build/contract-types.ts +101 -0
- package/src/build/rspack/build-report-plugin.ts +34 -0
- package/src/build/rspack/chunk-completeness-plugin.ts +57 -0
- package/src/build/rspack/compose.ts +87 -0
- package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
- package/src/build/rspack/generated-config.ts +35 -0
- package/src/build/rspack/index.ts +10 -5
- package/src/build/rspack/module-federation.ts +1 -1
- package/src/build/rspack/plugin.ts +103 -105
- package/src/build/rspack/utils.ts +8 -2
- package/src/build/ui/factory.ts +96 -0
- package/src/build/ui/generated-config.ts +133 -0
- package/src/build/ui/hash-artifacts-plugin.ts +79 -0
- package/src/build/ui/index.ts +98 -0
- package/src/build/ui/manifest-plugin.ts +54 -0
- package/src/build/ui/rsbuild-config.ts +256 -0
- package/src/build/ui/stubs.ts +103 -0
- package/src/cli.ts +100 -0
- package/src/dev/serve.ts +477 -0
- package/src/dev/watch-kill.ts +58 -0
- package/src/effect-helpers.ts +25 -0
- package/src/errors.ts +17 -18
- package/src/identity.ts +36 -0
- package/src/index.ts +4 -0
- package/src/plugin.ts +88 -91
- package/src/remote-entry.ts +171 -0
- package/src/runtime/errors.ts +229 -26
- package/src/runtime/index.ts +132 -43
- package/src/runtime/mf-config.ts +12 -107
- package/src/runtime/services/module-federation.service.ts +218 -117
- package/src/runtime/services/normalize.ts +1 -18
- package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
- package/src/runtime/services/plugin-loader.service.ts +271 -212
- package/src/runtime/services/plugin.service.ts +61 -43
- package/src/runtime/services/secrets.service.ts +20 -15
- package/src/runtime/services/shared-identity.ts +68 -0
- package/src/runtime/validation.ts +5 -7
- package/src/shared-deps-spec.ts +478 -0
- package/src/types.ts +25 -48
- package/src/ui/manifest/construct.ts +403 -0
- package/src/ui/manifest/contract.ts +33 -0
- package/src/ui/manifest/descriptor.ts +96 -0
- package/src/ui/manifest/generator.ts +238 -0
- package/src/ui/manifest/index.ts +55 -0
- package/src/ui/manifest/manifest-schema.ts +107 -0
- package/src/ui/manifest/mount-registry.ts +50 -0
- package/src/ui/manifest/nav.ts +43 -0
- package/src/ui/manifest/route-config.ts +82 -0
- package/src/version-manifest.ts +88 -0
- package/dist/build/rspack/dev-server-middleware.cjs +0 -248
- package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
- package/dist/build/rspack/dev-server-middleware.mjs +0 -247
- package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
- package/dist/build/shared-deps.cjs +0 -83
- package/dist/build/shared-deps.cjs.map +0 -1
- package/dist/build/shared-deps.d.cts +0 -67
- package/dist/build/shared-deps.d.cts.map +0 -1
- package/dist/build/shared-deps.d.mts +0 -67
- package/dist/build/shared-deps.d.mts.map +0 -1
- package/dist/build/shared-deps.mjs +0 -79
- package/dist/build/shared-deps.mjs.map +0 -1
- package/dist/effect.cjs +0 -9
- package/dist/effect.d.cts +0 -1
- package/dist/effect.d.mts +0 -1
- package/dist/effect.mjs +0 -3
- package/dist/orpc-openapi.cjs +0 -17
- package/dist/orpc-openapi.d.cts +0 -2
- package/dist/orpc-openapi.d.mts +0 -2
- package/dist/orpc-openapi.mjs +0 -5
- package/dist/orpc.cjs +0 -46
- package/dist/orpc.d.cts +0 -7
- package/dist/orpc.d.mts +0 -7
- package/dist/orpc.mjs +0 -11
- package/dist/package.cjs +0 -23
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -17
- package/dist/package.mjs.map +0 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
- package/dist/runtime/services/normalize.cjs.map +0 -1
- package/dist/runtime/services/normalize.d.cts.map +0 -1
- package/dist/runtime/services/normalize.d.mts.map +0 -1
- package/dist/runtime/services/normalize.mjs.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
- package/dist/runtime/services/secrets.service.d.cts.map +0 -1
- package/dist/runtime/services/secrets.service.d.mts.map +0 -1
- package/dist/testing/index.cjs +0 -57
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -54
- package/dist/testing/index.d.cts.map +0 -1
- package/dist/testing/index.d.mts +0 -54
- package/dist/testing/index.d.mts.map +0 -1
- package/dist/testing/index.mjs +0 -55
- package/dist/testing/index.mjs.map +0 -1
- package/dist/zod-core.cjs +0 -9
- package/dist/zod-core.d.cts +0 -1
- package/dist/zod-core.d.mts +0 -1
- package/dist/zod-core.mjs +0 -3
- package/dist/zod.cjs +0 -11
- package/dist/zod.d.cts +0 -2
- package/dist/zod.d.mts +0 -2
- package/dist/zod.mjs +0 -3
- package/src/build/rspack/dev-server-middleware.ts +0 -324
- package/src/build/shared-deps.ts +0 -102
- package/src/effect.ts +0 -1
- package/src/orpc-openapi.ts +0 -2
- package/src/orpc.ts +0 -9
- package/src/testing/index.ts +0 -87
- package/src/testing/mocks/module-federation.service.ts +0 -41
- package/src/zod-core.ts +0 -1
- package/src/zod.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAKa,8BAA8B;EACzC;;UAGQ;EAER,MAAM,UAAU;UAgBR"}
|
|
@@ -2,6 +2,8 @@ import { Compiler, RspackPluginInstance } from "@rspack/core";
|
|
|
2
2
|
//#region src/build/rspack/fix-mf-data-uri-plugin.d.ts
|
|
3
3
|
declare class FixMfDataUriPlugin implements RspackPluginInstance {
|
|
4
4
|
name: string;
|
|
5
|
+
/** Bare specifier → on-disk absolute path, learned while rewriting. */
|
|
6
|
+
private redirects;
|
|
5
7
|
apply(compiler: Compiler): void;
|
|
6
8
|
private reencodeDataUri;
|
|
7
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAKa,8BAA8B;EACzC;;UAGQ;EAER,MAAM,UAAU;UAgBR"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
//#region src/build/rspack/fix-mf-data-uri-plugin.ts
|
|
2
2
|
const MF_DATA_URI_MARKER = "data:text/javascript,";
|
|
3
|
+
const NODE_MODULES_IMPORT_RE = /(["'])\/[^"']*?\/node_modules\/([^"']*)\1/g;
|
|
3
4
|
var FixMfDataUriPlugin = class {
|
|
4
5
|
name = "FixMfDataUriPlugin";
|
|
6
|
+
/** Bare specifier → on-disk absolute path, learned while rewriting. */
|
|
7
|
+
redirects = /* @__PURE__ */ new Map();
|
|
5
8
|
apply(compiler) {
|
|
6
9
|
compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {
|
|
7
10
|
normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {
|
|
@@ -9,6 +12,10 @@ var FixMfDataUriPlugin = class {
|
|
|
9
12
|
if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;
|
|
10
13
|
this.reencodeDataUri(resolveData);
|
|
11
14
|
});
|
|
15
|
+
normalModuleFactory.hooks.resolve.tap(this.name, (resolveData) => {
|
|
16
|
+
const target = this.redirects.get(resolveData?.request ?? "");
|
|
17
|
+
if (target) resolveData.request = target;
|
|
18
|
+
});
|
|
12
19
|
});
|
|
13
20
|
}
|
|
14
21
|
reencodeDataUri(resolveData) {
|
|
@@ -17,19 +24,13 @@ var FixMfDataUriPlugin = class {
|
|
|
17
24
|
if (idx === -1) return;
|
|
18
25
|
const contentStart = idx + 21;
|
|
19
26
|
const prefix = request.substring(0, contentStart);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
const decoded = safeDecode(request.substring(contentStart)).replace(NODE_MODULES_IMPORT_RE, (match, _quote, rest) => {
|
|
28
|
+
this.redirects.set(rest, match.slice(1, -1));
|
|
29
|
+
return _quote + rest + _quote;
|
|
30
|
+
});
|
|
23
31
|
resolveData.request = prefix + encodeURIComponent(decoded);
|
|
24
32
|
}
|
|
25
33
|
};
|
|
26
|
-
function isAlreadyEncoded(content) {
|
|
27
|
-
try {
|
|
28
|
-
return decodeURIComponent(content) !== content;
|
|
29
|
-
} catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
34
|
function safeDecode(content) {
|
|
34
35
|
try {
|
|
35
36
|
return decodeURIComponent(content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-mf-data-uri-plugin.mjs","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\n\nconst MF_DATA_URI_MARKER = \"data:text/javascript,\";\n\nexport class FixMfDataUriPlugin implements RspackPluginInstance {\n name = \"FixMfDataUriPlugin\";\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {\n normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {\n if (!resolveData?.request) return;\n if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;\n this.reencodeDataUri(resolveData);\n });\n });\n }\n\n private reencodeDataUri(resolveData: { request: string }) {\n const { request } = resolveData;\n const idx = request.indexOf(MF_DATA_URI_MARKER);\n if (idx === -1) return;\n\n const contentStart = idx + MF_DATA_URI_MARKER.length;\n const prefix = request.substring(0, contentStart);\n const rawContent = request.substring(contentStart);\n\n
|
|
1
|
+
{"version":3,"file":"fix-mf-data-uri-plugin.mjs","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\n\nconst MF_DATA_URI_MARKER = \"data:text/javascript,\";\nconst NODE_MODULES_IMPORT_RE = /([\"'])\\/[^\"']*?\\/node_modules\\/([^\"']*)\\1/g;\n\nexport class FixMfDataUriPlugin implements RspackPluginInstance {\n name = \"FixMfDataUriPlugin\";\n\n /** Bare specifier → on-disk absolute path, learned while rewriting. */\n private redirects = new Map<string, string>();\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {\n normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {\n if (!resolveData?.request) return;\n if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;\n this.reencodeDataUri(resolveData);\n });\n normalModuleFactory.hooks.resolve.tap(this.name, (resolveData) => {\n const target = this.redirects.get(resolveData?.request ?? \"\");\n if (target) {\n resolveData.request = target;\n }\n });\n });\n }\n\n private reencodeDataUri(resolveData: { request: string }) {\n const { request } = resolveData;\n const idx = request.indexOf(MF_DATA_URI_MARKER);\n if (idx === -1) return;\n\n const contentStart = idx + MF_DATA_URI_MARKER.length;\n const prefix = request.substring(0, contentStart);\n const rawContent = request.substring(contentStart);\n\n // The MF runtime's and rsbuild's generated data-URI modules import their\n // runtime pieces by absolute node_modules paths (`require.resolve` output),\n // which differ per machine. Rewriting them to bare specifiers keeps the\n // module — and therefore the module id space — machine-independent; the\n // recorded redirects resolve those specifiers back to this machine's\n // on-disk copies while the request (and thus the module id) stays bare.\n const decoded = safeDecode(rawContent).replace(\n NODE_MODULES_IMPORT_RE,\n (match, _quote: string, rest: string) => {\n this.redirects.set(rest, match.slice(1, -1));\n return _quote + rest + _quote;\n },\n );\n resolveData.request = prefix + encodeURIComponent(decoded);\n }\n}\n\nfunction safeDecode(content: string): string {\n try {\n return decodeURIComponent(content);\n } catch {\n return content.replace(/%(?![0-9A-Fa-f]{2})/g, \"%25\");\n }\n}\n"],"mappings":";AAEA,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAE/B,IAAa,qBAAb,MAAgE;CAC9D,OAAO;;CAGP,AAAQ,4BAAY,IAAI,IAAoB;CAE5C,MAAM,UAAoB;EACxB,SAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;GACnF,oBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;IACtE,IAAI,CAAC,aAAa,SAAS;IAC3B,IAAI,CAAC,YAAY,QAAQ,SAAS,kBAAkB,GAAG;IACvD,KAAK,gBAAgB,WAAW;GAClC,CAAC;GACD,oBAAoB,MAAM,QAAQ,IAAI,KAAK,OAAO,gBAAgB;IAChE,MAAM,SAAS,KAAK,UAAU,IAAI,aAAa,WAAW,EAAE;IAC5D,IAAI,QACF,YAAY,UAAU;GAE1B,CAAC;EACH,CAAC;CACH;CAEA,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,kBAAkB;EAC9C,IAAI,QAAQ,IAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,YAAY;EAShD,MAAM,UAAU,WARG,QAAQ,UAAU,YAQD,CAAC,CAAC,CAAC,QACrC,yBACC,OAAO,QAAgB,SAAiB;GACvC,KAAK,UAAU,IAAI,MAAM,MAAM,MAAM,GAAG,EAAE,CAAC;GAC3C,OAAO,SAAS,OAAO;EACzB,CACF;EACA,YAAY,UAAU,SAAS,mBAAmB,OAAO;CAC3D;AACF;AAEA,SAAS,WAAW,SAAyB;CAC3C,IAAI;EACF,OAAO,mBAAmB,OAAO;CACnC,QAAQ;EACN,OAAO,QAAQ,QAAQ,wBAAwB,KAAK;CACtD;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_compose = require('./compose.cjs');
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
7
|
+
|
|
8
|
+
//#region src/build/rspack/generated-config.ts
|
|
9
|
+
function generatedRspackConfig(hasOverrides) {
|
|
10
|
+
return `import { createPluginBaseConfig } from "every-plugin/build/rspack";
|
|
11
|
+
${hasOverrides ? `import buildOverrides from "../build.config.ts";\n` : ""}
|
|
12
|
+
export default createPluginBaseConfig(${hasOverrides ? "buildOverrides" : "{}"});
|
|
13
|
+
`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Ensures the synthesized rspack config exists for workspaces that no longer
|
|
17
|
+
* ship their own `rspack.config.js`. Returns the workspace-relative config
|
|
18
|
+
* path to pass via `--config`, or `null` when the workspace has its own
|
|
19
|
+
* `rspack.config.js` and bare `rspack build` should be used.
|
|
20
|
+
*/
|
|
21
|
+
function ensureGeneratedRspackConfig(cwd = process.cwd()) {
|
|
22
|
+
if (node_fs.default.existsSync(node_path.default.join(cwd, "rspack.config.js"))) return null;
|
|
23
|
+
const overridesPath = node_path.default.resolve(cwd, "build.config.ts");
|
|
24
|
+
const hasOverrides = node_fs.default.existsSync(overridesPath);
|
|
25
|
+
const generatedDir = node_path.default.join(cwd, ".every-plugin");
|
|
26
|
+
const generatedConfig = node_path.default.join(generatedDir, "rspack.config.generated.mjs");
|
|
27
|
+
node_fs.default.mkdirSync(generatedDir, { recursive: true });
|
|
28
|
+
node_fs.default.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));
|
|
29
|
+
console.log("[every-plugin] rspack.config.js not found — using the every-plugin build composition.");
|
|
30
|
+
return node_path.default.join(".every-plugin", "rspack.config.generated.mjs");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.ensureGeneratedRspackConfig = ensureGeneratedRspackConfig;
|
|
35
|
+
//# sourceMappingURL=generated-config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-config.cjs","names":["fs","path"],"sources":["../../../src/build/rspack/generated-config.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findBosConfigPath } from \"./compose\";\n\nexport { findBosConfigPath };\n\nfunction generatedRspackConfig(hasOverrides: boolean): string {\n return `import { createPluginBaseConfig } from \"every-plugin/build/rspack\";\n${hasOverrides ? `import buildOverrides from \"../build.config.ts\";\\n` : \"\"}\nexport default createPluginBaseConfig(${hasOverrides ? \"buildOverrides\" : \"{}\"});\n`;\n}\n\n/**\n * Ensures the synthesized rspack config exists for workspaces that no longer\n * ship their own `rspack.config.js`. Returns the workspace-relative config\n * path to pass via `--config`, or `null` when the workspace has its own\n * `rspack.config.js` and bare `rspack build` should be used.\n */\nexport function ensureGeneratedRspackConfig(cwd: string = process.cwd()): string | null {\n if (fs.existsSync(path.join(cwd, \"rspack.config.js\"))) return null;\n\n const overridesPath = path.resolve(cwd, \"build.config.ts\");\n const hasOverrides = fs.existsSync(overridesPath);\n const generatedDir = path.join(cwd, \".every-plugin\");\n const generatedConfig = path.join(generatedDir, \"rspack.config.generated.mjs\");\n fs.mkdirSync(generatedDir, { recursive: true });\n fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));\n\n console.log(\n \"[every-plugin] rspack.config.js not found — using the every-plugin build composition.\",\n );\n return path.join(\".every-plugin\", \"rspack.config.generated.mjs\");\n}\n"],"mappings":";;;;;;;;AAOA,SAAS,sBAAsB,cAA+B;CAC5D,OAAO;EACP,eAAe,uDAAuD,GAAG;wCACnC,eAAe,mBAAmB,KAAK;;AAE/E;;;;;;;AAQA,SAAgB,4BAA4B,MAAc,QAAQ,IAAI,GAAkB;CACtF,IAAIA,gBAAG,WAAWC,kBAAK,KAAK,KAAK,kBAAkB,CAAC,GAAG,OAAO;CAE9D,MAAM,gBAAgBA,kBAAK,QAAQ,KAAK,iBAAiB;CACzD,MAAM,eAAeD,gBAAG,WAAW,aAAa;CAChD,MAAM,eAAeC,kBAAK,KAAK,KAAK,eAAe;CACnD,MAAM,kBAAkBA,kBAAK,KAAK,cAAc,6BAA6B;CAC7E,gBAAG,UAAU,cAAc,EAAE,WAAW,KAAK,CAAC;CAC9C,gBAAG,cAAc,iBAAiB,sBAAsB,YAAY,CAAC;CAErE,QAAQ,IACN,uFACF;CACA,OAAOA,kBAAK,KAAK,iBAAiB,6BAA6B;AACjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { findBosConfigPath } from "./compose.mjs";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/build/rspack/generated-config.ts
|
|
6
|
+
function generatedRspackConfig(hasOverrides) {
|
|
7
|
+
return `import { createPluginBaseConfig } from "every-plugin/build/rspack";
|
|
8
|
+
${hasOverrides ? `import buildOverrides from "../build.config.ts";\n` : ""}
|
|
9
|
+
export default createPluginBaseConfig(${hasOverrides ? "buildOverrides" : "{}"});
|
|
10
|
+
`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Ensures the synthesized rspack config exists for workspaces that no longer
|
|
14
|
+
* ship their own `rspack.config.js`. Returns the workspace-relative config
|
|
15
|
+
* path to pass via `--config`, or `null` when the workspace has its own
|
|
16
|
+
* `rspack.config.js` and bare `rspack build` should be used.
|
|
17
|
+
*/
|
|
18
|
+
function ensureGeneratedRspackConfig(cwd = process.cwd()) {
|
|
19
|
+
if (fs.existsSync(path.join(cwd, "rspack.config.js"))) return null;
|
|
20
|
+
const overridesPath = path.resolve(cwd, "build.config.ts");
|
|
21
|
+
const hasOverrides = fs.existsSync(overridesPath);
|
|
22
|
+
const generatedDir = path.join(cwd, ".every-plugin");
|
|
23
|
+
const generatedConfig = path.join(generatedDir, "rspack.config.generated.mjs");
|
|
24
|
+
fs.mkdirSync(generatedDir, { recursive: true });
|
|
25
|
+
fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));
|
|
26
|
+
console.log("[every-plugin] rspack.config.js not found — using the every-plugin build composition.");
|
|
27
|
+
return path.join(".every-plugin", "rspack.config.generated.mjs");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ensureGeneratedRspackConfig };
|
|
32
|
+
//# sourceMappingURL=generated-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-config.mjs","names":[],"sources":["../../../src/build/rspack/generated-config.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findBosConfigPath } from \"./compose\";\n\nexport { findBosConfigPath };\n\nfunction generatedRspackConfig(hasOverrides: boolean): string {\n return `import { createPluginBaseConfig } from \"every-plugin/build/rspack\";\n${hasOverrides ? `import buildOverrides from \"../build.config.ts\";\\n` : \"\"}\nexport default createPluginBaseConfig(${hasOverrides ? \"buildOverrides\" : \"{}\"});\n`;\n}\n\n/**\n * Ensures the synthesized rspack config exists for workspaces that no longer\n * ship their own `rspack.config.js`. Returns the workspace-relative config\n * path to pass via `--config`, or `null` when the workspace has its own\n * `rspack.config.js` and bare `rspack build` should be used.\n */\nexport function ensureGeneratedRspackConfig(cwd: string = process.cwd()): string | null {\n if (fs.existsSync(path.join(cwd, \"rspack.config.js\"))) return null;\n\n const overridesPath = path.resolve(cwd, \"build.config.ts\");\n const hasOverrides = fs.existsSync(overridesPath);\n const generatedDir = path.join(cwd, \".every-plugin\");\n const generatedConfig = path.join(generatedDir, \"rspack.config.generated.mjs\");\n fs.mkdirSync(generatedDir, { recursive: true });\n fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));\n\n console.log(\n \"[every-plugin] rspack.config.js not found — using the every-plugin build composition.\",\n );\n return path.join(\".every-plugin\", \"rspack.config.generated.mjs\");\n}\n"],"mappings":";;;;;AAOA,SAAS,sBAAsB,cAA+B;CAC5D,OAAO;EACP,eAAe,uDAAuD,GAAG;wCACnC,eAAe,mBAAmB,KAAK;;AAE/E;;;;;;;AAQA,SAAgB,4BAA4B,MAAc,QAAQ,IAAI,GAAkB;CACtF,IAAI,GAAG,WAAW,KAAK,KAAK,KAAK,kBAAkB,CAAC,GAAG,OAAO;CAE9D,MAAM,gBAAgB,KAAK,QAAQ,KAAK,iBAAiB;CACzD,MAAM,eAAe,GAAG,WAAW,aAAa;CAChD,MAAM,eAAe,KAAK,KAAK,KAAK,eAAe;CACnD,MAAM,kBAAkB,KAAK,KAAK,cAAc,6BAA6B;CAC7E,GAAG,UAAU,cAAc,EAAE,WAAW,KAAK,CAAC;CAC9C,GAAG,cAAc,iBAAiB,sBAAsB,YAAY,CAAC;CAErE,QAAQ,IACN,uFACF;CACA,OAAO,KAAK,KAAK,iBAAiB,6BAA6B;AACjE"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_shared_deps_spec = require('../../shared-deps-spec.cjs');
|
|
3
|
+
const require_build_report_plugin = require('./build-report-plugin.cjs');
|
|
3
4
|
const require_fix_mf_data_uri_plugin = require('./fix-mf-data-uri-plugin.cjs');
|
|
4
5
|
const require_plugin = require('./plugin.cjs');
|
|
6
|
+
const require_compose = require('./compose.cjs');
|
|
5
7
|
|
|
8
|
+
exports.BuildReportPlugin = require_build_report_plugin.BuildReportPlugin;
|
|
6
9
|
exports.EmitPluginManifest = require_plugin.EmitPluginManifest;
|
|
7
|
-
exports.
|
|
10
|
+
exports.EveryPluginBuild = require_plugin.EveryPluginBuild;
|
|
8
11
|
exports.FixMfDataUriPlugin = require_fix_mf_data_uri_plugin.FixMfDataUriPlugin;
|
|
9
|
-
exports.
|
|
10
|
-
exports.getPluginSharedDependencies =
|
|
11
|
-
exports.
|
|
12
|
+
exports.createPluginBaseConfig = require_compose.createPluginBaseConfig;
|
|
13
|
+
exports.getPluginSharedDependencies = require_shared_deps_spec.getPluginSharedDependencies;
|
|
14
|
+
exports.isEffectCriticalSharedDep = require_shared_deps_spec.isEffectCriticalSharedDep;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { SharedDependencies, SharedDependencyConfig,
|
|
1
|
+
import { SharedDependencies, SharedDependencyConfig, getPluginSharedDependencies, isEffectCriticalSharedDep } from "../../shared-deps-spec.cjs";
|
|
2
|
+
import { BuildReportPlugin } from "./build-report-plugin.cjs";
|
|
3
|
+
import { PluginBaseConfig, PluginBaseConfigOptions, createPluginBaseConfig } from "./compose.cjs";
|
|
2
4
|
import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.cjs";
|
|
3
|
-
import { EmitPluginManifest,
|
|
4
|
-
export { EmitPluginManifest,
|
|
5
|
+
import { EmitPluginManifest, EveryPluginBuild, EveryPluginBuildOptions, PluginManifestEmitterOptions } from "./plugin.cjs";
|
|
6
|
+
export { BuildReportPlugin, EmitPluginManifest, EveryPluginBuild, type EveryPluginBuildOptions, FixMfDataUriPlugin, type PluginBaseConfig, type PluginBaseConfigOptions, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, createPluginBaseConfig, getPluginSharedDependencies, isEffectCriticalSharedDep };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { SharedDependencies, SharedDependencyConfig,
|
|
1
|
+
import { SharedDependencies, SharedDependencyConfig, getPluginSharedDependencies, isEffectCriticalSharedDep } from "../../shared-deps-spec.mjs";
|
|
2
|
+
import { BuildReportPlugin } from "./build-report-plugin.mjs";
|
|
3
|
+
import { PluginBaseConfig, PluginBaseConfigOptions, createPluginBaseConfig } from "./compose.mjs";
|
|
2
4
|
import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
|
|
3
|
-
import { EmitPluginManifest,
|
|
4
|
-
export { EmitPluginManifest,
|
|
5
|
+
import { EmitPluginManifest, EveryPluginBuild, EveryPluginBuildOptions, PluginManifestEmitterOptions } from "./plugin.mjs";
|
|
6
|
+
export { BuildReportPlugin, EmitPluginManifest, EveryPluginBuild, type EveryPluginBuildOptions, FixMfDataUriPlugin, type PluginBaseConfig, type PluginBaseConfigOptions, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, createPluginBaseConfig, getPluginSharedDependencies, isEffectCriticalSharedDep };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPluginSharedDependencies, isEffectCriticalSharedDep } from "../../shared-deps-spec.mjs";
|
|
2
|
+
import { BuildReportPlugin } from "./build-report-plugin.mjs";
|
|
2
3
|
import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
|
|
3
|
-
import { EmitPluginManifest,
|
|
4
|
+
import { EmitPluginManifest, EveryPluginBuild } from "./plugin.mjs";
|
|
5
|
+
import { createPluginBaseConfig } from "./compose.mjs";
|
|
4
6
|
|
|
5
|
-
export { EmitPluginManifest,
|
|
7
|
+
export { BuildReportPlugin, EmitPluginManifest, EveryPluginBuild, FixMfDataUriPlugin, createPluginBaseConfig, getPluginSharedDependencies, isEffectCriticalSharedDep };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_shared_deps_spec = require('../../shared-deps-spec.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/build/rspack/module-federation.ts
|
|
4
4
|
function buildSharedDependencies(_pluginInfo) {
|
|
5
|
-
return
|
|
5
|
+
return require_shared_deps_spec.getPluginSharedDependencies();
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"
|
|
1
|
+
{"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../../shared-deps-spec\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAOA,qDAA4B;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"
|
|
1
|
+
{"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../../shared-deps-spec\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAO,4BAA4B;AACrC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_build_artifact_names = require('../artifact-names.cjs');
|
|
3
|
+
const require_build_report_plugin = require('./build-report-plugin.cjs');
|
|
4
|
+
const require_contract_types = require('../contract-types.cjs');
|
|
5
|
+
const require_chunk_completeness_plugin = require('./chunk-completeness-plugin.cjs');
|
|
3
6
|
const require_module_federation = require('./module-federation.cjs');
|
|
4
7
|
const require_utils = require('./utils.cjs');
|
|
8
|
+
let node_crypto = require("node:crypto");
|
|
9
|
+
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
5
10
|
let node_fs = require("node:fs");
|
|
6
11
|
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
7
12
|
let node_path = require("node:path");
|
|
8
13
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
9
|
-
let node_crypto = require("node:crypto");
|
|
10
|
-
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
11
14
|
let _module_federation_enhanced_rspack = require("@module-federation/enhanced/rspack");
|
|
12
15
|
|
|
13
16
|
//#region src/build/rspack/plugin.ts
|
|
@@ -30,8 +33,17 @@ var EmitPluginManifest = class {
|
|
|
30
33
|
const pluginInfo = require_utils.getPluginInfo(context);
|
|
31
34
|
const contractFileName = this.options.contractFileName ?? "contract.d.ts";
|
|
32
35
|
const manifestFileName = this.options.manifestFileName ?? "plugin.manifest.json";
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
let generationError = null;
|
|
37
|
+
try {
|
|
38
|
+
if (await require_contract_types.generateContractTypes(context) === "generated") console.log(`[EmitPluginManifest] Contract types regenerated (${context}).`);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
generationError = error instanceof Error ? error.message : String(error);
|
|
41
|
+
}
|
|
42
|
+
if (generationError) {
|
|
43
|
+
console.warn(`[EmitPluginManifest] Skipping manifest generation — ${generationError}`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const sourceContractPath = node_path.default.join(context, require_contract_types.CONTRACT_TYPES_FILE);
|
|
35
47
|
const tryReadFile = async (filePath) => {
|
|
36
48
|
if (!node_fs.default.existsSync(filePath)) return null;
|
|
37
49
|
if (!node_fs.default.statSync(filePath).isFile()) return null;
|
|
@@ -41,17 +53,13 @@ var EmitPluginManifest = class {
|
|
|
41
53
|
return null;
|
|
42
54
|
}
|
|
43
55
|
};
|
|
44
|
-
contractTypes = await tryReadFile(sourceContractPath) ?? "";
|
|
56
|
+
const contractTypes = await tryReadFile(sourceContractPath) ?? "";
|
|
45
57
|
if (!contractTypes) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
contractTypes = await tryReadFile(nestedPath) ?? "";
|
|
49
|
-
if (!contractTypes) {
|
|
50
|
-
console.warn(`[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. Skipping manifest generation.`);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
58
|
+
console.warn(`[EmitPluginManifest] No contract types at ${sourceContractPath} (no src/contract.ts in this workspace?). Skipping manifest generation.`);
|
|
59
|
+
return;
|
|
53
60
|
}
|
|
54
61
|
const contractSha256 = node_crypto.default.createHash("sha256").update(contractTypes).digest("hex");
|
|
62
|
+
const hashedEntry = require_build_artifact_names.findHashedEntry(Object.keys(compilation.assets), "remoteEntry");
|
|
55
63
|
const manifest = {
|
|
56
64
|
schemaVersion: 1,
|
|
57
65
|
kind: "every-plugin/manifest",
|
|
@@ -59,7 +67,7 @@ var EmitPluginManifest = class {
|
|
|
59
67
|
name: pluginInfo.name,
|
|
60
68
|
version: pluginInfo.version
|
|
61
69
|
},
|
|
62
|
-
runtime: { remoteEntry: "
|
|
70
|
+
runtime: { remoteEntry: `./${hashedEntry ?? "remoteEntry.js"}` },
|
|
63
71
|
contract: {
|
|
64
72
|
kind: "orpc",
|
|
65
73
|
types: {
|
|
@@ -70,26 +78,6 @@ var EmitPluginManifest = class {
|
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
};
|
|
73
|
-
const additionalExportsEntries = [];
|
|
74
|
-
if (this.options.additionalExports?.length) {
|
|
75
|
-
for (const additional of this.options.additionalExports) {
|
|
76
|
-
const sourcePath = node_path.default.join(context, "types", additional.srcPath);
|
|
77
|
-
const content = await tryReadFile(sourcePath);
|
|
78
|
-
if (!content) {
|
|
79
|
-
console.warn(`[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`);
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const sha256 = node_crypto.default.createHash("sha256").update(content).digest("hex");
|
|
83
|
-
const distPath = `./types/${additional.srcPath}`;
|
|
84
|
-
additionalExportsEntries.push({
|
|
85
|
-
path: distPath,
|
|
86
|
-
exports: additional.exportNames,
|
|
87
|
-
sha256
|
|
88
|
-
});
|
|
89
|
-
if (rawSource) compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));
|
|
90
|
-
}
|
|
91
|
-
if (additionalExportsEntries.length > 0) manifest.additionalExports = additionalExportsEntries;
|
|
92
|
-
}
|
|
93
81
|
if (rawSource) {
|
|
94
82
|
compilation.emitAsset(manifestFileName, new rawSource(`${JSON.stringify(manifest, null, 2)}\n`));
|
|
95
83
|
compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));
|
|
@@ -98,22 +86,18 @@ var EmitPluginManifest = class {
|
|
|
98
86
|
});
|
|
99
87
|
}
|
|
100
88
|
};
|
|
101
|
-
var
|
|
89
|
+
var EveryPluginBuild = class {
|
|
102
90
|
options;
|
|
103
|
-
name = "
|
|
91
|
+
name = "EveryPluginBuild";
|
|
104
92
|
constructor(options = {}) {
|
|
105
93
|
this.options = options;
|
|
106
94
|
}
|
|
107
95
|
apply(compiler) {
|
|
108
96
|
const pluginInfo = require_utils.getPluginInfo(compiler.options.context || process.cwd());
|
|
109
|
-
const devConfig = require_utils.loadDevConfig(this.options.devConfigPath || "./plugin.dev.ts");
|
|
110
|
-
const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;
|
|
111
97
|
this.configureDefaults(compiler, pluginInfo);
|
|
112
|
-
if (!compiler.options.devServer) compiler.options.devServer = {};
|
|
113
|
-
this.configureDevServer(compiler, pluginInfo, devConfig, port);
|
|
114
98
|
new _module_federation_enhanced_rspack.ModuleFederationPlugin({
|
|
115
99
|
name: pluginInfo.normalizedName,
|
|
116
|
-
filename:
|
|
100
|
+
filename: require_build_artifact_names.uiEntryFilename({ isBuild: require_build_artifact_names.isBuildInvocation() }),
|
|
117
101
|
dts: this.options.dts !== false,
|
|
118
102
|
manifest: {},
|
|
119
103
|
runtimePlugins: [require.resolve("@module-federation/node/runtimePlugin")],
|
|
@@ -122,6 +106,8 @@ var EveryPluginDevServer = class {
|
|
|
122
106
|
shared: require_module_federation.buildSharedDependencies(pluginInfo),
|
|
123
107
|
shareStrategy: "version-first"
|
|
124
108
|
}).apply(compiler);
|
|
109
|
+
new require_build_report_plugin.BuildReportPlugin().apply(compiler);
|
|
110
|
+
new require_chunk_completeness_plugin.ChunkCompletenessPlugin().apply(compiler);
|
|
125
111
|
if (this.options.dts === false) compiler.options.plugins = (compiler.options.plugins ?? []).filter((p) => !p || typeof p !== "object" || p.name !== "MFDevPlugin" && p.name !== "ModuleFederationDtsPlugin");
|
|
126
112
|
}
|
|
127
113
|
configureDefaults(compiler, pluginInfo) {
|
|
@@ -130,20 +116,25 @@ var EveryPluginDevServer = class {
|
|
|
130
116
|
compiler.options.output.uniqueName = pluginInfo.normalizedName;
|
|
131
117
|
compiler.options.output.publicPath = "auto";
|
|
132
118
|
compiler.options.output.path = node_path.default.resolve(context, "dist");
|
|
133
|
-
compiler.options.output.clean =
|
|
119
|
+
compiler.options.output.clean = !compiler.options.watch;
|
|
134
120
|
compiler.options.output.library = { type: "commonjs-module" };
|
|
135
121
|
if (!compiler.options.target) compiler.options.target = "async-node";
|
|
136
122
|
if (!compiler.options.mode) compiler.options.mode = process.env.NODE_ENV === "development" ? "development" : "production";
|
|
137
123
|
if (compiler.options.devtool === void 0) compiler.options.devtool = "source-map";
|
|
138
124
|
if (!compiler.options.infrastructureLogging) compiler.options.infrastructureLogging = { level: "warn" };
|
|
139
125
|
this.ensureTypeScriptLoader(compiler);
|
|
126
|
+
if (!compiler.options.optimization) compiler.options.optimization = {};
|
|
127
|
+
compiler.options.optimization.splitChunks = false;
|
|
128
|
+
compiler.options.optimization.moduleIds = "named";
|
|
140
129
|
if (!compiler.options.resolve) compiler.options.resolve = {};
|
|
141
130
|
compiler.options.resolve.extensions = [
|
|
142
131
|
"...",
|
|
143
132
|
".tsx",
|
|
144
133
|
".ts"
|
|
145
134
|
];
|
|
135
|
+
const sourceFirst = process.env.DEPLOY !== "true";
|
|
146
136
|
compiler.options.resolve.conditionNames = [
|
|
137
|
+
...sourceFirst ? ["development"] : [],
|
|
147
138
|
"webpack",
|
|
148
139
|
"import",
|
|
149
140
|
"module",
|
|
@@ -151,7 +142,12 @@ var EveryPluginDevServer = class {
|
|
|
151
142
|
"node",
|
|
152
143
|
"default"
|
|
153
144
|
];
|
|
154
|
-
if (compiler.options.resolve.
|
|
145
|
+
if (sourceFirst) compiler.options.resolve.extensionAlias = { ".js": [
|
|
146
|
+
".js",
|
|
147
|
+
".ts",
|
|
148
|
+
".tsx"
|
|
149
|
+
] };
|
|
150
|
+
if (!sourceFirst && compiler.options.resolve.byDependency) for (const depType of Object.keys(compiler.options.resolve.byDependency)) {
|
|
155
151
|
const depConfig = compiler.options.resolve.byDependency[depType];
|
|
156
152
|
if (depConfig?.conditionNames) depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== "development");
|
|
157
153
|
}
|
|
@@ -164,40 +160,19 @@ var EveryPluginDevServer = class {
|
|
|
164
160
|
ensureTypeScriptLoader(compiler) {
|
|
165
161
|
if (!compiler.options.module) compiler.options.module = { rules: [] };
|
|
166
162
|
if (!compiler.options.module.rules) compiler.options.module.rules = [];
|
|
163
|
+
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({
|
|
164
|
+
test: /\.json$/,
|
|
165
|
+
type: "json"
|
|
166
|
+
});
|
|
167
167
|
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({
|
|
168
168
|
test: /\.tsx?$/,
|
|
169
169
|
use: "builtin:swc-loader",
|
|
170
170
|
exclude: /node_modules/
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
configureDevServer(compiler, pluginInfo, devConfig, port) {
|
|
174
|
-
if (!compiler.options.devServer) return;
|
|
175
|
-
const context = compiler.options.context || process.cwd();
|
|
176
|
-
const originalSetup = compiler.options.devServer.setupMiddlewares;
|
|
177
|
-
compiler.options.devServer.port = port;
|
|
178
|
-
compiler.options.devServer.static = node_path.default.join(context, "dist");
|
|
179
|
-
compiler.options.devServer.hot = true;
|
|
180
|
-
compiler.options.devServer.devMiddleware = { writeToDisk: true };
|
|
181
|
-
compiler.options.devServer.headers = {
|
|
182
|
-
"Access-Control-Allow-Origin": "*",
|
|
183
|
-
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
|
184
|
-
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
|
185
|
-
};
|
|
186
|
-
compiler.options.devServer.client = {
|
|
187
|
-
logging: "warn",
|
|
188
|
-
overlay: {
|
|
189
|
-
warnings: false,
|
|
190
|
-
errors: true
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {
|
|
194
|
-
require_dev_server_middleware.setupPluginMiddleware(devServer, pluginInfo, devConfig, port);
|
|
195
|
-
return originalSetup ? originalSetup(middlewares, devServer) : middlewares;
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
173
|
};
|
|
199
174
|
|
|
200
175
|
//#endregion
|
|
201
176
|
exports.EmitPluginManifest = EmitPluginManifest;
|
|
202
|
-
exports.
|
|
177
|
+
exports.EveryPluginBuild = EveryPluginBuild;
|
|
203
178
|
//# sourceMappingURL=plugin.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["getPluginInfo","path","fs","crypto","loadDevConfig","ModuleFederationPlugin","buildSharedDependencies"],"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,aAAaA,4BAAc,OAAO;IACxC,MAAM,mBAAmB,KAAK,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BAAoB,aAAa,cAAc;GACxE,oDAAsB,WAAW,YAAY,WAAW,IAAI;GAC5D,OAAO,gBAAgB,cAAc,aAAa,SAAS,IAAI;EACjE;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":["getPluginInfo","generateContractTypes","path","CONTRACT_TYPES_FILE","fs","crypto","findHashedEntry","ModuleFederationPlugin","uiEntryFilename","isBuildInvocation","buildSharedDependencies","BuildReportPlugin","ChunkCompletenessPlugin"],"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,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Q,QAAQ;GAC5B,YAAY;GACZ,kBAAkB;EACpB;CACF;CAEA,AAAQ,uBAAuB,UAAoB;EACjD,IAAI,CAAC,SAAS,QAAQ,QACpB,SAAS,QAAQ,SAAS,EAAE,OAAO,CAAC,EAAE;EAGxC,IAAI,CAAC,SAAS,QAAQ,OAAO,OAC3B,SAAS,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,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.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","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"}
|