@module-federation/storybook-addon 3.0.18 → 4.0.1
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/README.md
CHANGED
package/dist/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/storybook-addon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Storybook addon to consume remote module federated apps/components",
|
|
5
|
+
"type": "commonjs",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -25,18 +26,15 @@
|
|
|
25
26
|
],
|
|
26
27
|
"author": "Fiodorov Andrei <hello@fyodorovandrei.com> (https://github.com/fyodorovandrei)",
|
|
27
28
|
"main": "dist/src/index.js",
|
|
28
|
-
"module": "dist/src/index.js",
|
|
29
29
|
"types": "dist/src/index.d.ts",
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"types": "./dist/src/index.d.ts"
|
|
32
|
+
"types": "./dist/src/index.d.ts",
|
|
33
|
+
"default": "./dist/src/index.js"
|
|
35
34
|
},
|
|
36
35
|
"./preset": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"types": "./dist/preset.d.ts"
|
|
36
|
+
"types": "./dist/preset.d.ts",
|
|
37
|
+
"default": "./dist/preset.js"
|
|
40
38
|
},
|
|
41
39
|
"./*": "./*"
|
|
42
40
|
},
|
|
@@ -55,28 +53,30 @@
|
|
|
55
53
|
"@module-federation/sdk": "workspace:*"
|
|
56
54
|
},
|
|
57
55
|
"devDependencies": {
|
|
56
|
+
"jest-fixed-jsdom": "^0.0.9",
|
|
58
57
|
"@module-federation/utilities": "workspace:*",
|
|
59
58
|
"@rsbuild/core": "^1.0.19",
|
|
60
|
-
"@storybook/core-common": "7.6.20",
|
|
61
59
|
"@storybook/node-logger": "7.6.20",
|
|
60
|
+
"@storybook/core": "^8.4.6",
|
|
62
61
|
"webpack": "5.93.0",
|
|
63
62
|
"webpack-virtual-modules": "0.6.2"
|
|
64
63
|
},
|
|
65
64
|
"peerDependencies": {
|
|
66
65
|
"@rsbuild/core": "^1.0.1",
|
|
67
|
-
"@module-federation/utilities": "^3.1.
|
|
66
|
+
"@module-federation/utilities": "^3.1.40",
|
|
67
|
+
"@module-federation/sdk": "^0.8.9",
|
|
68
68
|
"@nx/react": ">= 16.0.0",
|
|
69
69
|
"@nx/webpack": ">= 16.0.0",
|
|
70
|
-
"@storybook/core
|
|
71
|
-
"@storybook/node-logger": "^6.5.16 || ^7.0.0 || ^
|
|
70
|
+
"@storybook/core": ">= 8.2.0",
|
|
71
|
+
"@storybook/node-logger": "^6.5.16 || ^7.0.0 || ^8.0.0",
|
|
72
72
|
"webpack": "^5.75.0",
|
|
73
|
-
"webpack-virtual-modules": "
|
|
73
|
+
"webpack-virtual-modules": "0.6.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"@rsbuild/core": {
|
|
77
77
|
"optional": true
|
|
78
78
|
},
|
|
79
|
-
"@module-federation/
|
|
79
|
+
"@module-federation/sdk": {
|
|
80
80
|
"optional": true
|
|
81
81
|
},
|
|
82
82
|
"@nx/react": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@nx/webpack": {
|
|
86
86
|
"optional": true
|
|
87
87
|
},
|
|
88
|
-
"@storybook/core
|
|
88
|
+
"@storybook/core": {
|
|
89
89
|
"optional": true
|
|
90
90
|
},
|
|
91
91
|
"@storybook/node-logger": {
|
|
@@ -97,6 +97,5 @@
|
|
|
97
97
|
"webpack-virtual-modules": {
|
|
98
98
|
"optional": true
|
|
99
99
|
}
|
|
100
|
-
}
|
|
101
|
-
"type": "commonjs"
|
|
100
|
+
}
|
|
102
101
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Configuration } from 'webpack';
|
|
2
|
-
import { ModuleFederationPluginOptions } from '@module-federation/utilities';
|
|
3
|
-
import { ModuleFederationConfig } from '@nx/webpack';
|
|
1
|
+
import { type Configuration } from 'webpack';
|
|
4
2
|
import withModuleFederation from '../utils/with-module-federation';
|
|
3
|
+
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
4
|
+
import type { ModuleFederationConfig } from '@nx/webpack';
|
|
5
5
|
export type Preset = string | {
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
8
|
type Options = {
|
|
9
|
-
moduleFederationConfig?: ModuleFederationPluginOptions;
|
|
9
|
+
moduleFederationConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
10
10
|
nxModuleFederationConfig?: ModuleFederationConfig;
|
|
11
11
|
presets: {
|
|
12
12
|
apply<T>(preset: Preset): Promise<T>;
|
|
@@ -33,10 +33,7 @@ const process = __importStar(require("process"));
|
|
|
33
33
|
const webpack_virtual_modules_1 = __importDefault(require("webpack-virtual-modules"));
|
|
34
34
|
const webpack_1 = require("webpack");
|
|
35
35
|
const node_logger_1 = require("@storybook/node-logger");
|
|
36
|
-
|
|
37
|
-
// from 'storybook/internal/common' or '@storybook/core'. Considering requires Storybook 8
|
|
38
|
-
// at least and change this in the next breaking change version.
|
|
39
|
-
const core_common_1 = require("@storybook/core-common");
|
|
36
|
+
const common_1 = require("@storybook/core/common");
|
|
40
37
|
const with_module_federation_1 = __importDefault(require("../utils/with-module-federation"));
|
|
41
38
|
exports.withModuleFederation = with_module_federation_1.default;
|
|
42
39
|
const correctImportPath_1 = require("../utils/correctImportPath");
|
|
@@ -66,14 +63,11 @@ const webpack = async (webpackConfig, options) => {
|
|
|
66
63
|
}
|
|
67
64
|
const entries = await presets.apply('entries');
|
|
68
65
|
const bootstrap = entries.map((entryFile) => `import '${(0, correctImportPath_1.correctImportPath)(context, entryFile)}';`);
|
|
69
|
-
const index = plugins.findIndex(
|
|
70
|
-
//@ts-ignore
|
|
71
|
-
(plugin) => plugin.constructor.name === 'VirtualModulesPlugin');
|
|
66
|
+
const index = plugins.findIndex((plugin) => plugin?.constructor.name === 'VirtualModulesPlugin');
|
|
72
67
|
if (index !== -1) {
|
|
73
68
|
node_logger_1.logger.info(`=> [MF] Detected plugin VirtualModulesPlugin`);
|
|
74
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
75
69
|
const plugin = plugins[index];
|
|
76
|
-
const virtualEntries = plugin.
|
|
70
|
+
const virtualEntries = plugin.getModuleList('static');
|
|
77
71
|
const virtualEntriesPaths = Object.keys(virtualEntries);
|
|
78
72
|
node_logger_1.logger.info(`=> [MF] Write files from VirtualModulesPlugin`);
|
|
79
73
|
for (const virtualEntryPath of virtualEntriesPaths) {
|
|
@@ -94,7 +88,7 @@ const webpack = async (webpackConfig, options) => {
|
|
|
94
88
|
filePathFromProjectRootDir === '/storybook-stories.js') {
|
|
95
89
|
const isStorybookVersion7 = filePathFromProjectRootDir === '/storybook-stories.js';
|
|
96
90
|
const nonNormalizedStories = await presets.apply('stories');
|
|
97
|
-
const stories = (0,
|
|
91
|
+
const stories = (0, common_1.normalizeStories)(nonNormalizedStories, {
|
|
98
92
|
configDir: options.configDir,
|
|
99
93
|
workingDir: context,
|
|
100
94
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storybook-addon.js","sourceRoot":"","sources":["../../../src/lib/storybook-addon.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAAqC;AACrC,iDAAmC;AACnC,sFAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"storybook-addon.js","sourceRoot":"","sources":["../../../src/lib/storybook-addon.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAAqC;AACrC,iDAAmC;AACnC,sFAA2D;AAC3D,qCAAwD;AACxD,wDAAgD;AAChD,mDAA0D;AAC1D,6FAAmE;AAmB1D,+BAnBF,gCAAoB,C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E,CAAC;IACH,CAAC;IAED;;;;SAIK;IACL,MAAM,mBAAmB,GAAG,IAAI,iCAAoB,CAAC;QACnD,cAAc,EAAE,6BAA6B;QAC7C,kBAAkB,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;KACzC,CAAC,CAAC;IAEH,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC;QACrC,MAAM,GAAG,SAAS,CAAC;IACrB,CAAC;IACD,oBAAM,CAAC,IAAI,CACT,WAAW,MAAM,uDAAuD,CACzE,CAAC;IAEF,OAAO;QACL,GAAG,aAAa;QAChB,KAAK,EAAE,CAAC,cAAc,CAAC;QACvB,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AA5IW,QAAA,OAAO,WA4IlB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/storybook-addon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Storybook addon to consume remote module federated apps/components",
|
|
5
|
+
"type": "commonjs",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -25,18 +26,15 @@
|
|
|
25
26
|
],
|
|
26
27
|
"author": "Fiodorov Andrei <hello@fyodorovandrei.com> (https://github.com/fyodorovandrei)",
|
|
27
28
|
"main": "dist/src/index.js",
|
|
28
|
-
"module": "dist/src/index.js",
|
|
29
29
|
"types": "dist/src/index.d.ts",
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"types": "./dist/src/index.d.ts"
|
|
32
|
+
"types": "./dist/src/index.d.ts",
|
|
33
|
+
"default": "./dist/src/index.js"
|
|
35
34
|
},
|
|
36
35
|
"./preset": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"types": "./dist/preset.d.ts"
|
|
36
|
+
"types": "./dist/preset.d.ts",
|
|
37
|
+
"default": "./dist/preset.js"
|
|
40
38
|
},
|
|
41
39
|
"./*": "./*"
|
|
42
40
|
},
|
|
@@ -51,32 +49,34 @@
|
|
|
51
49
|
}
|
|
52
50
|
},
|
|
53
51
|
"dependencies": {
|
|
54
|
-
"@module-federation/enhanced": "0.8.
|
|
55
|
-
"@module-federation/sdk": "0.8.
|
|
52
|
+
"@module-federation/enhanced": "0.8.9",
|
|
53
|
+
"@module-federation/sdk": "0.8.9"
|
|
56
54
|
},
|
|
57
55
|
"devDependencies": {
|
|
56
|
+
"jest-fixed-jsdom": "^0.0.9",
|
|
58
57
|
"@rsbuild/core": "^1.0.19",
|
|
59
|
-
"@storybook/core-common": "7.6.20",
|
|
60
58
|
"@storybook/node-logger": "7.6.20",
|
|
59
|
+
"@storybook/core": "^8.4.6",
|
|
61
60
|
"webpack": "5.93.0",
|
|
62
61
|
"webpack-virtual-modules": "0.6.2",
|
|
63
|
-
"@module-federation/utilities": "3.1.
|
|
62
|
+
"@module-federation/utilities": "3.1.40"
|
|
64
63
|
},
|
|
65
64
|
"peerDependencies": {
|
|
66
65
|
"@rsbuild/core": "^1.0.1",
|
|
67
|
-
"@module-federation/utilities": "^3.1.
|
|
66
|
+
"@module-federation/utilities": "^3.1.40",
|
|
67
|
+
"@module-federation/sdk": "^0.8.9",
|
|
68
68
|
"@nx/react": ">= 16.0.0",
|
|
69
69
|
"@nx/webpack": ">= 16.0.0",
|
|
70
|
-
"@storybook/core
|
|
71
|
-
"@storybook/node-logger": "^6.5.16 || ^7.0.0 || ^
|
|
70
|
+
"@storybook/core": ">= 8.2.0",
|
|
71
|
+
"@storybook/node-logger": "^6.5.16 || ^7.0.0 || ^8.0.0",
|
|
72
72
|
"webpack": "^5.75.0",
|
|
73
|
-
"webpack-virtual-modules": "
|
|
73
|
+
"webpack-virtual-modules": "0.6.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"@rsbuild/core": {
|
|
77
77
|
"optional": true
|
|
78
78
|
},
|
|
79
|
-
"@module-federation/
|
|
79
|
+
"@module-federation/sdk": {
|
|
80
80
|
"optional": true
|
|
81
81
|
},
|
|
82
82
|
"@nx/react": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@nx/webpack": {
|
|
86
86
|
"optional": true
|
|
87
87
|
},
|
|
88
|
-
"@storybook/core
|
|
88
|
+
"@storybook/core": {
|
|
89
89
|
"optional": true
|
|
90
90
|
},
|
|
91
91
|
"@storybook/node-logger": {
|