@module-federation/storybook-addon 3.0.16 → 3.0.17
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/dist/package.json +5 -2
- package/dist/preset.d.ts +2 -1
- package/dist/preset.js +3 -0
- package/dist/preset.js.map +1 -1
- package/dist/src/utils/with-module-federation-enhanced-rsbuild.d.ts +2 -1
- package/dist/src/utils/with-module-federation-enhanced-rsbuild.js +23 -26
- package/dist/src/utils/with-module-federation-enhanced-rsbuild.js.map +1 -1
- package/package.json +8 -5
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/storybook-addon",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "Storybook addon to consume remote module federated apps/components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
"*": {
|
|
45
45
|
".": [
|
|
46
46
|
"./dist/index.d.ts"
|
|
47
|
+
],
|
|
48
|
+
"preset": [
|
|
49
|
+
"./dist/preset.d.ts"
|
|
47
50
|
]
|
|
48
51
|
}
|
|
49
52
|
},
|
|
@@ -61,7 +64,7 @@
|
|
|
61
64
|
},
|
|
62
65
|
"peerDependencies": {
|
|
63
66
|
"@rsbuild/core": "^1.0.1",
|
|
64
|
-
"@module-federation/utilities": "^3.1.
|
|
67
|
+
"@module-federation/utilities": "^3.1.37",
|
|
65
68
|
"@nx/react": ">= 16.0.0",
|
|
66
69
|
"@nx/webpack": ">= 16.0.0",
|
|
67
70
|
"@storybook/core-common": "^6.5.16 || ^7.0.0 || ^ 8.0.0",
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
2
2
|
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
3
|
declare const _default: {
|
|
4
|
-
rsbuildFinal: (config: RsbuildConfig, options: moduleFederationPlugin.ModuleFederationPluginOptions) =>
|
|
4
|
+
rsbuildFinal: (config: RsbuildConfig, options: moduleFederationPlugin.ModuleFederationPluginOptions) => RsbuildConfig;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
7
|
+
export { PLUGIN_NAME } from './src/utils/with-module-federation-enhanced-rsbuild';
|
package/dist/preset.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLUGIN_NAME = void 0;
|
|
3
4
|
const with_module_federation_enhanced_rsbuild_1 = require("./src/utils/with-module-federation-enhanced-rsbuild");
|
|
4
5
|
exports.default = {
|
|
5
6
|
rsbuildFinal: (config, options) => {
|
|
@@ -12,4 +13,6 @@ exports.default = {
|
|
|
12
13
|
});
|
|
13
14
|
},
|
|
14
15
|
};
|
|
16
|
+
var with_module_federation_enhanced_rsbuild_2 = require("./src/utils/with-module-federation-enhanced-rsbuild");
|
|
17
|
+
Object.defineProperty(exports, "PLUGIN_NAME", { enumerable: true, get: function () { return with_module_federation_enhanced_rsbuild_2.PLUGIN_NAME; } });
|
|
15
18
|
//# sourceMappingURL=preset.js.map
|
package/dist/preset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../preset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../preset.ts"],"names":[],"mappings":";;;AAAA,iHAA2F;AAK3F,kBAAe;IACb,YAAY,EAAE,CACZ,MAAqB,EACrB,OAA6D,EAC7D,EAAE;QACF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;QAEzD,OAAO,IAAA,8DAAoB,EAAC,MAAM,EAAE;YAClC,IAAI;YACJ,OAAO;YACP,MAAM;YACN,aAAa;SACd,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AACF,+GAAkF;AAAzE,sIAAA,WAAW,OAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
2
2
|
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const PLUGIN_NAME = "module-federation-storybook-addon";
|
|
4
|
+
export declare const withModuleFederation: (rsbuildConfig: RsbuildConfig, options: moduleFederationPlugin.ModuleFederationPluginOptions) => RsbuildConfig;
|
|
4
5
|
export default withModuleFederation;
|
|
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.withModuleFederation = void 0;
|
|
6
|
+
exports.withModuleFederation = exports.PLUGIN_NAME = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const rspack_1 = require("@module-federation/enhanced/rspack");
|
|
10
10
|
const sdk_1 = require("@module-federation/sdk");
|
|
11
11
|
const correctImportPath_1 = require("./correctImportPath");
|
|
12
12
|
const tempDirPath = node_path_1.default.resolve(process.cwd(), `node_modules/${sdk_1.TEMP_DIR}`);
|
|
13
|
+
exports.PLUGIN_NAME = 'module-federation-storybook-addon';
|
|
13
14
|
// add bootstrap for host project
|
|
14
15
|
const bootstrapPath = node_path_1.default.resolve(process.cwd(), `node_modules/${sdk_1.TEMP_DIR}/storybook-bootstrap.js`);
|
|
15
16
|
const generateBootstrap = (context, entryPath) => {
|
|
@@ -24,7 +25,7 @@ const writeBootstrap = (context, entryPath) => {
|
|
|
24
25
|
}
|
|
25
26
|
node_fs_1.default.writeFileSync(bootstrapPath, generateBootstrap(context, entryPath));
|
|
26
27
|
};
|
|
27
|
-
const withModuleFederation =
|
|
28
|
+
const withModuleFederation = (rsbuildConfig, options) => {
|
|
28
29
|
rsbuildConfig.plugins ??= [];
|
|
29
30
|
rsbuildConfig.source ??= {};
|
|
30
31
|
rsbuildConfig.source.entry ??= {};
|
|
@@ -45,33 +46,29 @@ const withModuleFederation = async (rsbuildConfig, options) => {
|
|
|
45
46
|
// remoteEntry already includes one hmr runtime, and an additional one is not necessary.
|
|
46
47
|
hmr: false,
|
|
47
48
|
},
|
|
48
|
-
tools: {
|
|
49
|
-
rspack: (config) => {
|
|
50
|
-
config.output ??= {};
|
|
51
|
-
config.output.chunkLoadingGlobal =
|
|
52
|
-
'module-federation-storybook-addon';
|
|
53
|
-
config.plugins?.push(new rspack_1.ModuleFederationPlugin({
|
|
54
|
-
name: options.name || 'module-federation-storybook-addon',
|
|
55
|
-
shared: {
|
|
56
|
-
react: {
|
|
57
|
-
singleton: true,
|
|
58
|
-
},
|
|
59
|
-
'react-dom': {
|
|
60
|
-
singleton: true,
|
|
61
|
-
},
|
|
62
|
-
...options.shared,
|
|
63
|
-
},
|
|
64
|
-
remotes: {
|
|
65
|
-
...options.remotes,
|
|
66
|
-
},
|
|
67
|
-
shareStrategy: options.shareStrategy,
|
|
68
|
-
}));
|
|
69
|
-
return config;
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
49
|
};
|
|
73
50
|
return mergeRsbuildConfig(config, mfConfig);
|
|
74
51
|
});
|
|
52
|
+
api.modifyBundlerChain(async (chain) => {
|
|
53
|
+
chain.plugin(exports.PLUGIN_NAME).use(rspack_1.ModuleFederationPlugin, [
|
|
54
|
+
{
|
|
55
|
+
name: options.name || exports.PLUGIN_NAME,
|
|
56
|
+
shared: {
|
|
57
|
+
react: {
|
|
58
|
+
singleton: true,
|
|
59
|
+
},
|
|
60
|
+
'react-dom': {
|
|
61
|
+
singleton: true,
|
|
62
|
+
},
|
|
63
|
+
...options.shared,
|
|
64
|
+
},
|
|
65
|
+
remotes: {
|
|
66
|
+
...options.remotes,
|
|
67
|
+
},
|
|
68
|
+
shareStrategy: options.shareStrategy,
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
});
|
|
75
72
|
},
|
|
76
73
|
};
|
|
77
74
|
rsbuildConfig.plugins.push(rsbuildPlugin);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-module-federation-enhanced-rsbuild.js","sourceRoot":"","sources":["../../../src/utils/with-module-federation-enhanced-rsbuild.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAC7B,+DAA4E;AAC5E,gDAAkD;AAElD,2DAAwD;AAKxD,MAAM,WAAW,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,cAAQ,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"with-module-federation-enhanced-rsbuild.js","sourceRoot":"","sources":["../../../src/utils/with-module-federation-enhanced-rsbuild.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAC7B,+DAA4E;AAC5E,gDAAkD;AAElD,2DAAwD;AAKxD,MAAM,WAAW,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,cAAQ,EAAE,CAAC,CAAC;AAC/D,QAAA,WAAW,GAAG,mCAAmC,CAAC;AAC/D,iCAAiC;AACjC,MAAM,aAAa,GAAG,mBAAI,CAAC,OAAO,CAChC,OAAO,CAAC,GAAG,EAAE,EACb,gBAAgB,cAAQ,yBAAyB,CAClD,CAAC;AACF,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,SAAiB,EAAE,EAAE;IAC/D,OAAO,WAAW,IAAA,qCAAiB,EAAC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC;AAC/D,CAAC,CAAC;AACF,MAAM,cAAc,GAAG,CAAC,OAAe,EAAE,SAAiB,EAAE,EAAE;IAC5D,IAAI,CAAC,iBAAE,CAAC,UAAU,CA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C;gBACF,OAAO,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACrC,KAAK,CAAC,MAAM,CAAC,mBAAW,CAAC,CAAC,GAAG,CAAC,+BAAsB,EAAE;oBACpD;wBACE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,mBAAW;wBACjC,MAAM,EAAE;4BACN,KAAK,EAAE;gCACL,SAAS,EAAE,IAAI;6BAChB;4BACD,WAAW,EAAE;gCACX,SAAS,EAAE,IAAI;6BAChB;4BACD,GAAG,OAAO,CAAC,MAAM;yBAClB;wBACD,OAAO,EAAE;4BACP,GAAG,OAAO,CAAC,OAAO;yBACnB;wBACD,aAAa,EAAE,OAAO,CAAC,aAAa;qBACrC;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1C,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAtDW,QAAA,oBAAoB,wBAsD/B;AAEF,kBAAe,4BAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/storybook-addon",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "Storybook addon to consume remote module federated apps/components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,12 +44,15 @@
|
|
|
44
44
|
"*": {
|
|
45
45
|
".": [
|
|
46
46
|
"./dist/index.d.ts"
|
|
47
|
+
],
|
|
48
|
+
"preset": [
|
|
49
|
+
"./dist/preset.d.ts"
|
|
47
50
|
]
|
|
48
51
|
}
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@module-federation/
|
|
52
|
-
"@module-federation/
|
|
54
|
+
"@module-federation/enhanced": "0.8.6",
|
|
55
|
+
"@module-federation/sdk": "0.8.6"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
58
|
"@rsbuild/core": "^1.0.19",
|
|
@@ -57,11 +60,11 @@
|
|
|
57
60
|
"@storybook/node-logger": "7.6.20",
|
|
58
61
|
"webpack": "5.93.0",
|
|
59
62
|
"webpack-virtual-modules": "0.6.2",
|
|
60
|
-
"@module-federation/utilities": "3.1.
|
|
63
|
+
"@module-federation/utilities": "3.1.37"
|
|
61
64
|
},
|
|
62
65
|
"peerDependencies": {
|
|
63
66
|
"@rsbuild/core": "^1.0.1",
|
|
64
|
-
"@module-federation/utilities": "^3.1.
|
|
67
|
+
"@module-federation/utilities": "^3.1.37",
|
|
65
68
|
"@nx/react": ">= 16.0.0",
|
|
66
69
|
"@nx/webpack": ">= 16.0.0",
|
|
67
70
|
"@storybook/core-common": "^6.5.16 || ^7.0.0 || ^ 8.0.0",
|