@alauda/dynamic-plugin-pack 0.1.0-next.20260723.1784797265 → 0.1.0-next.20260728.1785220064
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/index.d.ts +8 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -46,6 +46,14 @@ export declare const shared: {
|
|
|
46
46
|
readonly singleton: true;
|
|
47
47
|
readonly requiredVersion: false;
|
|
48
48
|
};
|
|
49
|
+
'@alauda/core-plugin-sdk/alauda': {
|
|
50
|
+
readonly singleton: true;
|
|
51
|
+
readonly requiredVersion: false;
|
|
52
|
+
};
|
|
53
|
+
'@alauda/core-plugin-sdk/graphql': {
|
|
54
|
+
readonly singleton: true;
|
|
55
|
+
readonly requiredVersion: false;
|
|
56
|
+
};
|
|
49
57
|
'@alauda/core-plugin-sdk/k8s': {
|
|
50
58
|
readonly singleton: true;
|
|
51
59
|
readonly requiredVersion: false;
|
package/index.js
CHANGED
|
@@ -10,6 +10,8 @@ const shared = {
|
|
|
10
10
|
"react-dom": singleton,
|
|
11
11
|
"react-router-dom": singleton,
|
|
12
12
|
"@alauda/core-plugin-sdk": singleton,
|
|
13
|
+
"@alauda/core-plugin-sdk/alauda": singleton,
|
|
14
|
+
"@alauda/core-plugin-sdk/graphql": singleton,
|
|
13
15
|
"@alauda/core-plugin-sdk/k8s": singleton,
|
|
14
16
|
"@reduxjs/toolkit": singleton,
|
|
15
17
|
"react-redux": singleton,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/shared.ts","../../src/compose.ts","../../src/mfe.ts"],"sourcesContent":["/*\n * Module Federation `shared` config for ACP Console hosts and remotes.\n *\n * These identity-critical packages MUST resolve to a single shared instance so\n * the host recognises a remote's plugin (its `$$type` brand), agrees on the\n * same ApiRef identities, and uses one React/router/style runtime.\n */\nconst singleton = { singleton: true, requiredVersion: false } as const;\n\nexport const shared = {\n react: singleton,\n 'react-dom': singleton,\n 'react-router-dom': singleton,\n '@alauda/core-plugin-sdk': singleton,\n '@alauda/core-plugin-sdk/k8s': singleton,\n '@reduxjs/toolkit': singleton,\n 'react-redux': singleton,\n '@mui/material': singleton,\n '@emotion/react': singleton,\n '@emotion/styled': singleton,\n};\n","import type { RsbuildConfig } from '@rsbuild/core';\n\n/** A composable Rsbuild config transform: takes a config and returns it merged. */\nexport type ConfigTransform = (config: RsbuildConfig) => RsbuildConfig;\n\n/**\n * Compose config transforms right-to-left, like the console SDK's `compose`:\n * `compose(withMfe, withBase)` applies `withBase` first (the base), then layers\n * `withMfe` on top. Start from `{}` (or a partial config) to build the final\n * Rsbuild config.\n */\nexport function compose(...transforms: ConfigTransform[]): ConfigTransform {\n return config =>\n transforms.reduceRight((acc, transform) => transform(acc), config);\n}\n\n/** Shallow-merge two Rsbuild configs, concatenating `plugins` and merging the\n * common nested sections so transforms layer cleanly. */\nexport function mergeConfig(\n base: RsbuildConfig,\n extra: RsbuildConfig,\n): RsbuildConfig {\n return {\n ...base,\n ...extra,\n plugins: [...(base.plugins ?? []), ...(extra.plugins ?? [])],\n source: { ...base.source, ...extra.source },\n server: { ...base.server, ...extra.server },\n dev: { ...base.dev, ...extra.dev },\n output: { ...base.output, ...extra.output },\n html: { ...base.html, ...extra.html },\n };\n}\n","/*\n * Rsbuild config transforms for Module Federation hosts and remotes — the\n * Rsbuild analogue of the console SDK's `withHostMfeConfig` / `withRemoteMfeConfig`\n * / `withBaseConfig`. Compose them with `compose(...)` (see ./compose).\n */\nimport { pluginReact } from '@rsbuild/plugin-react';\nimport { pluginModuleFederation } from '@module-federation/rsbuild-plugin';\nimport { ConfigTransform, mergeConfig } from './compose';\n\n/** The Module Federation options a host/remote declares (see its\n * `module-federation.config`). Matches the rsbuild MF plugin's option shape. */\nexport type MfeConfig = Parameters<typeof pluginModuleFederation>[0];\n\nexport interface RemoteOptions {\n /** Dev server port; also used to derive the asset prefix. */\n port: number;\n /** Standalone dev entry (the local harness, not the federated surface). */\n devEntry?: string;\n /** Override the asset prefix (defaults to `http://localhost:<port>`). */\n assetPrefix?: string;\n}\n\n/** Common base: the React plugin (and any future shared defaults). */\nexport function withBaseConfig(): ConfigTransform {\n return config =>\n mergeConfig(config, {\n plugins: [pluginReact()],\n tools: {\n rspack: {\n // monaco-editor's `editorSimpleWorker` has an AMD `require([id])` in a\n // dead `if (!isESM)` branch the bundler can't statically analyse,\n // producing a benign \"Critical dependency\" warning. That branch never\n // runs in the bundled ESM build, so silence just this warning.\n ignoreWarnings: [\n (warning: { message?: string }) =>\n /Critical dependency: require function is used/.test(\n String(warning?.message),\n ),\n ],\n },\n },\n });\n}\n\n/**\n * A remote (a plugin built as an MF remote): exposes its surface and serves the\n * remote entry cross-origin so the host can load it. `dts` is disabled — the\n * host consumes the plugin via its runtime brand, not types.\n */\nexport function withRemoteMfeConfig(\n mfe: MfeConfig,\n options: RemoteOptions,\n): ConfigTransform {\n const assetPrefix =\n options.assetPrefix ?? `http://localhost:${options.port}`;\n return config =>\n mergeConfig(config, {\n plugins: [pluginModuleFederation({ ...mfe, dts: false })],\n ...(options.devEntry\n ? { source: { entry: { index: options.devEntry } } }\n : {}),\n server: { port: options.port },\n // `lazyCompilation: false` is required for Module Federation: rsbuild's\n // on-demand dev compilation serves a proxy for dynamically-imported\n // modules and compiles them only when requested, but that round-trip\n // cannot complete across the host↔remote MF boundary — a lazily-imported\n // remote page would hang on its proxy and only ever show a spinner.\n dev: { assetPrefix, lazyCompilation: false },\n output: { assetPrefix },\n });\n}\n\n/**\n * A host: consumes remotes (registered at runtime, so none are declared here)\n * and shares the same singletons. `dts` is disabled to avoid the MF type server.\n */\nexport function withHostMfeConfig(mfe: MfeConfig): ConfigTransform {\n return config =>\n mergeConfig(config, {\n plugins: [pluginModuleFederation({ ...mfe, dts: false })],\n });\n}\n"],"mappings":";;;AAOA,MAAM,YAAY;CAAE,WAAW;CAAM,iBAAiB;AAAM;AAE5D,MAAa,SAAS;CACpB,OAAO;CACP,aAAa;CACb,oBAAoB;CACpB,2BAA2B;CAC3B,+BAA+B;CAC/B,oBAAoB;CACpB,eAAe;CACf,iBAAiB;CACjB,kBAAkB;CAClB,mBAAmB;AACrB;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/shared.ts","../../src/compose.ts","../../src/mfe.ts"],"sourcesContent":["/*\n * Module Federation `shared` config for ACP Console hosts and remotes.\n *\n * These identity-critical packages MUST resolve to a single shared instance so\n * the host recognises a remote's plugin (its `$$type` brand), agrees on the\n * same ApiRef identities, and uses one React/router/style runtime.\n */\nconst singleton = { singleton: true, requiredVersion: false } as const;\n\nexport const shared = {\n react: singleton,\n 'react-dom': singleton,\n 'react-router-dom': singleton,\n '@alauda/core-plugin-sdk': singleton,\n '@alauda/core-plugin-sdk/alauda': singleton,\n '@alauda/core-plugin-sdk/graphql': singleton,\n '@alauda/core-plugin-sdk/k8s': singleton,\n '@reduxjs/toolkit': singleton,\n 'react-redux': singleton,\n '@mui/material': singleton,\n '@emotion/react': singleton,\n '@emotion/styled': singleton,\n};\n","import type { RsbuildConfig } from '@rsbuild/core';\n\n/** A composable Rsbuild config transform: takes a config and returns it merged. */\nexport type ConfigTransform = (config: RsbuildConfig) => RsbuildConfig;\n\n/**\n * Compose config transforms right-to-left, like the console SDK's `compose`:\n * `compose(withMfe, withBase)` applies `withBase` first (the base), then layers\n * `withMfe` on top. Start from `{}` (or a partial config) to build the final\n * Rsbuild config.\n */\nexport function compose(...transforms: ConfigTransform[]): ConfigTransform {\n return config =>\n transforms.reduceRight((acc, transform) => transform(acc), config);\n}\n\n/** Shallow-merge two Rsbuild configs, concatenating `plugins` and merging the\n * common nested sections so transforms layer cleanly. */\nexport function mergeConfig(\n base: RsbuildConfig,\n extra: RsbuildConfig,\n): RsbuildConfig {\n return {\n ...base,\n ...extra,\n plugins: [...(base.plugins ?? []), ...(extra.plugins ?? [])],\n source: { ...base.source, ...extra.source },\n server: { ...base.server, ...extra.server },\n dev: { ...base.dev, ...extra.dev },\n output: { ...base.output, ...extra.output },\n html: { ...base.html, ...extra.html },\n };\n}\n","/*\n * Rsbuild config transforms for Module Federation hosts and remotes — the\n * Rsbuild analogue of the console SDK's `withHostMfeConfig` / `withRemoteMfeConfig`\n * / `withBaseConfig`. Compose them with `compose(...)` (see ./compose).\n */\nimport { pluginReact } from '@rsbuild/plugin-react';\nimport { pluginModuleFederation } from '@module-federation/rsbuild-plugin';\nimport { ConfigTransform, mergeConfig } from './compose';\n\n/** The Module Federation options a host/remote declares (see its\n * `module-federation.config`). Matches the rsbuild MF plugin's option shape. */\nexport type MfeConfig = Parameters<typeof pluginModuleFederation>[0];\n\nexport interface RemoteOptions {\n /** Dev server port; also used to derive the asset prefix. */\n port: number;\n /** Standalone dev entry (the local harness, not the federated surface). */\n devEntry?: string;\n /** Override the asset prefix (defaults to `http://localhost:<port>`). */\n assetPrefix?: string;\n}\n\n/** Common base: the React plugin (and any future shared defaults). */\nexport function withBaseConfig(): ConfigTransform {\n return config =>\n mergeConfig(config, {\n plugins: [pluginReact()],\n tools: {\n rspack: {\n // monaco-editor's `editorSimpleWorker` has an AMD `require([id])` in a\n // dead `if (!isESM)` branch the bundler can't statically analyse,\n // producing a benign \"Critical dependency\" warning. That branch never\n // runs in the bundled ESM build, so silence just this warning.\n ignoreWarnings: [\n (warning: { message?: string }) =>\n /Critical dependency: require function is used/.test(\n String(warning?.message),\n ),\n ],\n },\n },\n });\n}\n\n/**\n * A remote (a plugin built as an MF remote): exposes its surface and serves the\n * remote entry cross-origin so the host can load it. `dts` is disabled — the\n * host consumes the plugin via its runtime brand, not types.\n */\nexport function withRemoteMfeConfig(\n mfe: MfeConfig,\n options: RemoteOptions,\n): ConfigTransform {\n const assetPrefix =\n options.assetPrefix ?? `http://localhost:${options.port}`;\n return config =>\n mergeConfig(config, {\n plugins: [pluginModuleFederation({ ...mfe, dts: false })],\n ...(options.devEntry\n ? { source: { entry: { index: options.devEntry } } }\n : {}),\n server: { port: options.port },\n // `lazyCompilation: false` is required for Module Federation: rsbuild's\n // on-demand dev compilation serves a proxy for dynamically-imported\n // modules and compiles them only when requested, but that round-trip\n // cannot complete across the host↔remote MF boundary — a lazily-imported\n // remote page would hang on its proxy and only ever show a spinner.\n dev: { assetPrefix, lazyCompilation: false },\n output: { assetPrefix },\n });\n}\n\n/**\n * A host: consumes remotes (registered at runtime, so none are declared here)\n * and shares the same singletons. `dts` is disabled to avoid the MF type server.\n */\nexport function withHostMfeConfig(mfe: MfeConfig): ConfigTransform {\n return config =>\n mergeConfig(config, {\n plugins: [pluginModuleFederation({ ...mfe, dts: false })],\n });\n}\n"],"mappings":";;;AAOA,MAAM,YAAY;CAAE,WAAW;CAAM,iBAAiB;AAAM;AAE5D,MAAa,SAAS;CACpB,OAAO;CACP,aAAa;CACb,oBAAoB;CACpB,2BAA2B;CAC3B,kCAAkC;CAClC,mCAAmC;CACnC,+BAA+B;CAC/B,oBAAoB;CACpB,eAAe;CACf,iBAAiB;CACjB,kBAAkB;CAClB,mBAAmB;AACrB;;;;;;;;;ACXA,SAAgB,QAAQ,GAAG,YAAgD;CACzE,QAAO,WACL,WAAW,aAAa,KAAK,cAAc,UAAU,GAAG,GAAG,MAAM;AACrE;;;AAIA,SAAgB,YACd,MACA,OACe;CACf,OAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS,CAAC,GAAI,KAAK,WAAW,CAAC,GAAI,GAAI,MAAM,WAAW,CAAC,CAAE;EAC3D,QAAQ;GAAE,GAAG,KAAK;GAAQ,GAAG,MAAM;EAAO;EAC1C,QAAQ;GAAE,GAAG,KAAK;GAAQ,GAAG,MAAM;EAAO;EAC1C,KAAK;GAAE,GAAG,KAAK;GAAK,GAAG,MAAM;EAAI;EACjC,QAAQ;GAAE,GAAG,KAAK;GAAQ,GAAG,MAAM;EAAO;EAC1C,MAAM;GAAE,GAAG,KAAK;GAAM,GAAG,MAAM;EAAK;CACtC;AACF;;;;ACTA,SAAgB,iBAAkC;CAChD,QAAO,WACL,YAAY,QAAQ;EAClB,SAAS,CAAC,YAAY,CAAC;EACvB,OAAO,EACL,QAAQ,EAKN,gBAAgB,EACb,YACC,gDAAgD,KAC9C,OAAO,SAAS,OAAO,CACzB,CACJ,EACF,EACF;CACF,CAAC;AACL;;;;;;AAOA,SAAgB,oBACd,KACA,SACiB;CACjB,MAAM,cACJ,QAAQ,eAAe,oBAAoB,QAAQ;CACrD,QAAO,WACL,YAAY,QAAQ;EAClB,SAAS,CAAC,uBAAuB;GAAE,GAAG;GAAK,KAAK;EAAM,CAAC,CAAC;EACxD,GAAI,QAAQ,WACR,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,QAAQ,SAAS,EAAE,EAAE,IACjD,CAAC;EACL,QAAQ,EAAE,MAAM,QAAQ,KAAK;EAM7B,KAAK;GAAE;GAAa,iBAAiB;EAAM;EAC3C,QAAQ,EAAE,YAAY;CACxB,CAAC;AACL;;;;;AAMA,SAAgB,kBAAkB,KAAiC;CACjE,QAAO,WACL,YAAY,QAAQ,EAClB,SAAS,CAAC,uBAAuB;EAAE,GAAG;EAAK,KAAK;CAAM,CAAC,CAAC,EAC1D,CAAC;AACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/dynamic-plugin-pack",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.20260728.1785220064",
|
|
4
4
|
"description": "Build helpers for ACP Console Module Federation plugins.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|