@module-federation/storybook-addon 0.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1100 -21
- package/README.md +35 -39
- package/package.json +12 -20
- package/src/index.js +15 -2
- package/src/index.js.map +1 -1
- package/src/lib/storybook-addon.d.ts +1 -1
- package/src/lib/storybook-addon.js +52 -12
- package/src/lib/storybook-addon.js.map +1 -1
- package/src/utils/correctImportPath.d.ts +1 -0
- package/src/utils/correctImportPath.js +24 -0
- package/src/utils/correctImportPath.js.map +1 -0
- package/src/utils/with-module-federation.d.ts +1 -1
- package/src/utils/with-module-federation.js.map +1 -1
package/README.md
CHANGED
|
@@ -15,41 +15,42 @@ yarn add @module-federation/storybook-addon
|
|
|
15
15
|
## Configuration
|
|
16
16
|
|
|
17
17
|
In file `./storybook/main.js`:
|
|
18
|
+
|
|
18
19
|
```js
|
|
19
20
|
const moduleFederationConfig = {
|
|
20
|
-
|
|
21
|
+
// Module Federation config
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const storybookConfig = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
|
27
|
-
],
|
|
28
|
-
"addons": [
|
|
25
|
+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
26
|
+
addons: [
|
|
29
27
|
// other addons,
|
|
30
28
|
{
|
|
31
|
-
name:
|
|
29
|
+
name: '@module-federation/storybook-addon',
|
|
32
30
|
options: {
|
|
33
|
-
moduleFederationConfig
|
|
34
|
-
}
|
|
35
|
-
}
|
|
31
|
+
moduleFederationConfig,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
36
34
|
],
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
35
|
+
framework: '@storybook/react',
|
|
36
|
+
core: {
|
|
37
|
+
builder: '@storybook/builder-webpack5', // is required webpack 5 builder
|
|
38
|
+
},
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
module.exports = storybookConfig;
|
|
44
42
|
```
|
|
43
|
+
|
|
45
44
|
---
|
|
45
|
+
|
|
46
46
|
### For the [NX](https://nx.dev/getting-started/intro) projects:
|
|
47
47
|
|
|
48
48
|
Replace NX utils `withModuleFederation` in `webpack.config.js` with our utils `withModuleFederation`.
|
|
49
49
|
Example:
|
|
50
|
+
|
|
50
51
|
```javascript
|
|
51
|
-
const { composePlugins, withNx } = require('@
|
|
52
|
-
const { withReact } = require('@
|
|
52
|
+
const { composePlugins, withNx } = require('@nx/webpack');
|
|
53
|
+
const { withReact } = require('@nx/react');
|
|
53
54
|
const { withModuleFederation } = require('@module-federation/storybook-addon');
|
|
54
55
|
|
|
55
56
|
const baseConfig = require('./module-federation.config');
|
|
@@ -58,37 +59,31 @@ const config = {
|
|
|
58
59
|
...baseConfig,
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
module.exports = composePlugins(
|
|
62
|
-
withNx(),
|
|
63
|
-
withReact(),
|
|
64
|
-
withModuleFederation(config)
|
|
65
|
-
);
|
|
62
|
+
module.exports = composePlugins(withNx(), withReact(), withModuleFederation(config));
|
|
66
63
|
```
|
|
67
64
|
|
|
68
65
|
In file `./storybook/main.js`:
|
|
66
|
+
|
|
69
67
|
```js
|
|
70
68
|
const nxModuleFederationConfig = {
|
|
71
|
-
|
|
69
|
+
// Module Federation config
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
const storybookConfig = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
|
78
|
-
],
|
|
79
|
-
"addons": [
|
|
73
|
+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
74
|
+
addons: [
|
|
80
75
|
// other addons,
|
|
81
76
|
{
|
|
82
|
-
name:
|
|
77
|
+
name: '@module-federation/storybook-addon',
|
|
83
78
|
options: {
|
|
84
|
-
nxModuleFederationConfig
|
|
85
|
-
}
|
|
86
|
-
}
|
|
79
|
+
nxModuleFederationConfig,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
87
82
|
],
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
83
|
+
framework: '@storybook/react',
|
|
84
|
+
core: {
|
|
85
|
+
builder: '@storybook/builder-webpack5', // is required webpack 5 builder
|
|
86
|
+
},
|
|
92
87
|
};
|
|
93
88
|
|
|
94
89
|
module.exports = storybookConfig;
|
|
@@ -102,7 +97,9 @@ import React, { Suspense } from 'react';
|
|
|
102
97
|
const LazyButton = React.lazy(() => import('remote/Button'));
|
|
103
98
|
|
|
104
99
|
const Button = (props) => (
|
|
105
|
-
<Suspense fallback={<p>Please wait...</p>}
|
|
100
|
+
<Suspense fallback={<p>Please wait...</p>}>
|
|
101
|
+
<LazyButton {...props} />
|
|
102
|
+
</Suspense>
|
|
106
103
|
);
|
|
107
104
|
|
|
108
105
|
export default {
|
|
@@ -111,14 +108,14 @@ export default {
|
|
|
111
108
|
argTypes: {
|
|
112
109
|
variant: {
|
|
113
110
|
control: 'select',
|
|
114
|
-
options: ['primary', 'secondary']
|
|
111
|
+
options: ['primary', 'secondary'],
|
|
115
112
|
},
|
|
116
113
|
},
|
|
117
114
|
};
|
|
118
115
|
|
|
119
116
|
const Template = (args) => <Button {...args} />;
|
|
120
117
|
|
|
121
|
-
export const Primary = Template.bind({variant: 'primary'});
|
|
118
|
+
export const Primary = Template.bind({ variant: 'primary' });
|
|
122
119
|
Primary.args = {
|
|
123
120
|
variant: 'primary',
|
|
124
121
|
children: 'Button',
|
|
@@ -129,5 +126,4 @@ Secondary.args = {
|
|
|
129
126
|
variant: 'secondary',
|
|
130
127
|
children: 'Button',
|
|
131
128
|
};
|
|
132
|
-
|
|
133
129
|
```
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/storybook-addon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Storybook addon to consume remote module federated apps/components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/module-federation/universe/tree/main/packages/storybook-addon",
|
|
7
7
|
"publishConfig": {
|
|
8
|
-
"
|
|
8
|
+
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"module-federation",
|
|
@@ -15,27 +15,19 @@
|
|
|
15
15
|
],
|
|
16
16
|
"author": "Fiodorov Andrei <hello@fyodorovandrei.com> (https://github.com/fyodorovandrei)",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@storybook/
|
|
20
|
-
"
|
|
21
|
-
"webpack": "
|
|
22
|
-
"
|
|
18
|
+
"@storybook/core-common": "7.4.6",
|
|
19
|
+
"@storybook/node-logger": "7.4.6",
|
|
20
|
+
"webpack": "5.88.2",
|
|
21
|
+
"webpack-virtual-modules": "0.6.0",
|
|
22
|
+
"@module-federation/utilities": "3.0.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@storybook/
|
|
27
|
-
"@storybook/node-logger": "^6.5.16",
|
|
25
|
+
"@storybook/core-common": "^6.5.16 || ^7.0.0",
|
|
26
|
+
"@storybook/node-logger": "^6.5.16 || ^7.0.0",
|
|
28
27
|
"webpack": "^5.75.0",
|
|
29
|
-
"webpack-virtual-modules": "^0.5.0"
|
|
30
|
-
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@nrwl/devkit": "16.0.0",
|
|
33
|
-
"@nx/react": "16.0.0",
|
|
34
|
-
"next": "13.3.1",
|
|
35
|
-
"process": "0.11.10",
|
|
36
|
-
"react": "18.2.0",
|
|
37
|
-
"react-dom": "18.2.0"
|
|
28
|
+
"webpack-virtual-modules": "^0.5.0 || ^0.6.0",
|
|
29
|
+
"@module-federation/utilities": "3.0.0"
|
|
38
30
|
},
|
|
39
31
|
"main": "./src/index.js",
|
|
40
|
-
"
|
|
32
|
+
"type": "commonjs"
|
|
41
33
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./lib/storybook-addon"), exports);
|
|
17
|
+
__exportStar(require("./lib/storybook-addon"), exports);
|
|
5
18
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storybook-addon/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storybook-addon/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
2
|
import { ModuleFederationPluginOptions } from '@module-federation/utilities';
|
|
3
|
-
import
|
|
3
|
+
import { ModuleFederationConfig } from '@nx/webpack';
|
|
4
4
|
import withModuleFederation from '../utils/with-module-federation';
|
|
5
5
|
export type Preset = string | {
|
|
6
6
|
name: string;
|
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
29
|
exports.webpack = exports.withModuleFederation = void 0;
|
|
4
|
-
const
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
30
|
+
const fs_1 = __importDefault(require("fs"));
|
|
6
31
|
const path_1 = require("path");
|
|
7
|
-
const process =
|
|
8
|
-
const webpack_virtual_modules_1 =
|
|
32
|
+
const process = __importStar(require("process"));
|
|
33
|
+
const webpack_virtual_modules_1 = __importDefault(require("webpack-virtual-modules"));
|
|
9
34
|
const webpack_1 = require("webpack");
|
|
10
35
|
const node_logger_1 = require("@storybook/node-logger");
|
|
11
36
|
const core_common_1 = require("@storybook/core-common");
|
|
12
|
-
const
|
|
13
|
-
const with_module_federation_1 = tslib_1.__importDefault(require("../utils/with-module-federation"));
|
|
37
|
+
const with_module_federation_1 = __importDefault(require("../utils/with-module-federation"));
|
|
14
38
|
exports.withModuleFederation = with_module_federation_1.default;
|
|
39
|
+
const correctImportPath_1 = require("../utils/correctImportPath");
|
|
15
40
|
const { ModuleFederationPlugin } = webpack_1.container;
|
|
16
41
|
const webpack = async (webpackConfig, options) => {
|
|
17
42
|
const { plugins = [], context: webpackContext } = webpackConfig;
|
|
@@ -36,8 +61,10 @@ const webpack = async (webpackConfig, options) => {
|
|
|
36
61
|
plugins.push(new ModuleFederationPlugin(moduleFederationConfig));
|
|
37
62
|
}
|
|
38
63
|
const entries = await presets.apply('entries');
|
|
39
|
-
const bootstrap = entries.map((entryFile) => `import '${(0,
|
|
40
|
-
const index = plugins.findIndex(
|
|
64
|
+
const bootstrap = entries.map((entryFile) => `import '${(0, correctImportPath_1.correctImportPath)(context, entryFile)}';`);
|
|
65
|
+
const index = plugins.findIndex(
|
|
66
|
+
//@ts-ignore
|
|
67
|
+
(plugin) => plugin.constructor.name === 'VirtualModulesPlugin');
|
|
41
68
|
if (index !== -1) {
|
|
42
69
|
node_logger_1.logger.info(`=> [MF] Detected plugin VirtualModulesPlugin`);
|
|
43
70
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -55,8 +82,13 @@ const webpack = async (webpackConfig, options) => {
|
|
|
55
82
|
if (!filePathFromProjectRootDir.startsWith(nodeModulesPath)) {
|
|
56
83
|
finalPath = (0, path_1.join)(context, nodeModulesPath, '.cache', 'storybook', filePathFromProjectRootDir);
|
|
57
84
|
finalDir = (0, path_1.dirname)(finalPath);
|
|
58
|
-
// Fix storybook stories' path in virtual module
|
|
59
|
-
if (
|
|
85
|
+
// Fix storybook stories' path in virtual module
|
|
86
|
+
if (
|
|
87
|
+
// For storybook version before 7
|
|
88
|
+
filePathFromProjectRootDir === '/generated-stories-entry.cjs' ||
|
|
89
|
+
// For storybook version 7
|
|
90
|
+
filePathFromProjectRootDir === '/storybook-stories.js') {
|
|
91
|
+
const isStorybookVersion7 = filePathFromProjectRootDir === '/storybook-stories.js';
|
|
60
92
|
const nonNormalizedStories = await presets.apply('stories');
|
|
61
93
|
const stories = (0, core_common_1.normalizeStories)(nonNormalizedStories, {
|
|
62
94
|
configDir: options.configDir,
|
|
@@ -66,7 +98,15 @@ const webpack = async (webpackConfig, options) => {
|
|
|
66
98
|
stories.forEach((story) => {
|
|
67
99
|
// Go up 3 times because the file was moved in /node_modules/.cache/storybook
|
|
68
100
|
const newDirectory = (0, path_1.join)('..', '..', '..', story.directory);
|
|
69
|
-
|
|
101
|
+
// Adding trailing slash for story directory in storybook v7
|
|
102
|
+
const oldSrc = isStorybookVersion7
|
|
103
|
+
? `'${story.directory}/'`
|
|
104
|
+
: `'${story.directory}'`;
|
|
105
|
+
const newSrc = isStorybookVersion7
|
|
106
|
+
? `'${newDirectory}/'`
|
|
107
|
+
: `'${newDirectory}'`;
|
|
108
|
+
// Fix story directory
|
|
109
|
+
sourceCode = sourceCode.replace(oldSrc, newSrc);
|
|
70
110
|
});
|
|
71
111
|
}
|
|
72
112
|
}
|
|
@@ -74,7 +114,7 @@ const webpack = async (webpackConfig, options) => {
|
|
|
74
114
|
fs_1.default.mkdirSync(finalDir, { recursive: true });
|
|
75
115
|
}
|
|
76
116
|
fs_1.default.writeFileSync(finalPath, sourceCode);
|
|
77
|
-
bootstrap.push(`import '${(0,
|
|
117
|
+
bootstrap.push(`import '${(0, correctImportPath_1.correctImportPath)(context, finalPath)}';`);
|
|
78
118
|
}
|
|
79
119
|
}
|
|
80
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storybook-addon.js","sourceRoot":"","sources":["../../../../../packages/storybook-addon/src/lib/storybook-addon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storybook-addon.js","sourceRoot":"","sources":["../../../../../packages/storybook-addon/src/lib/storybook-addon.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAAqC;AACrC,iDAAmC;AACnC,sFAA2D;AAC3D,qCAAmD;AACnD,wDAAgD;AAChD,wDAA0D;AAI1D,6FAAmE;AAgB1D,+BAhBF,gCAAoB,CAgBE;AAf7B,kEAA+D;AAE/D,MAAM,EAAE,sBAAsB,EAAE,GAAG,mBAAS,CAAC;AAetC,MAAM,OAAO,GAAG,KAAK,EAC1B,aAA4B,EAC5B,OAAgB,EACQ,EAAE;IAC1B,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC;IAChE,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC;IAC9E,MAAM,OAAO,GAAG,cAAc,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAEhD,iIAAiI;IACjI,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC7D,oBAAM,CAAC,IAAI,CAAC,mBAAmB,cAAc,mBAAmB,CAAC,CAAC;IAElE,IAAI,cAAc,KAAK,GAAG,EAAE;QAC1B,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE,CAAC;KACH;IAED,IAAI,wBAAwB,EAAE;QAC5B,oBAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,MAAM,IAAA,gCAAoB,EAAC,wBAAwB,CAAC,CAA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M,EAAE,MAAM,CAAC,CAAC;oBAClD,CAAC,CAAC,CAAC;iBACJ;aACF;YAED,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;gBAC5B,YAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;aAC7C;YAED,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACxC,SAAS,CAAC,IAAI,CAAC,WAAW,IAAA,qCAAiB,EAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;SACtE;KACF;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;QAChB,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;KACnC;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC;QACrC,MAAM,GAAG,SAAS,CAAC;KACpB;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const correctImportPath: (context: string, entryFile: string) => any;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.correctImportPath = void 0;
|
|
4
|
+
const correctImportPath = (context, entryFile) => {
|
|
5
|
+
if (typeof process !== 'undefined') {
|
|
6
|
+
if (process?.platform !== 'win32') {
|
|
7
|
+
return entryFile;
|
|
8
|
+
}
|
|
9
|
+
if (entryFile.match(/^\.?\.\\/) || !entryFile.match(/^[A-Z]:\\\\/i)) {
|
|
10
|
+
return entryFile.replace(/\\/g, '/');
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const joint = path.win32.relative(context, entryFile);
|
|
15
|
+
const relative = joint.replace(/\\/g, '/');
|
|
16
|
+
if (relative.includes('node_modules/')) {
|
|
17
|
+
return relative.split('node_modules/')[1];
|
|
18
|
+
}
|
|
19
|
+
return `./${relative}`;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
exports.correctImportPath = correctImportPath;
|
|
24
|
+
//# sourceMappingURL=correctImportPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correctImportPath.js","sourceRoot":"","sources":["../../../../../packages/storybook-addon/src/utils/correctImportPath.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,SAAiB,EAAE,EAAE;IACtE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QAClC,IAAI,OAAO,EAAE,QAAQ,KAAK,OAAO,EAAE;YACjC,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YACnE,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SACtC;QAED,8DAA8D;QAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE3C,IAAI,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YACtC,OAAO,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3C;QAED,OAAO,KAAK,QAAQ,EAAE,CAAC;KACxB;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAtBW,QAAA,iBAAiB,qBAsB5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import
|
|
2
|
+
import { ModuleFederationConfig } from '@nx/webpack';
|
|
3
3
|
declare const withModuleFederation: (options: ModuleFederationConfig) => Promise<(config: Configuration) => Configuration>;
|
|
4
4
|
export default withModuleFederation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-module-federation.js","sourceRoot":"","sources":["../../../../../packages/storybook-addon/src/utils/with-module-federation.ts"],"names":[],"mappings":";;AAAA,iEAAkF;AAClF,qCAAmD;
|
|
1
|
+
{"version":3,"file":"with-module-federation.js","sourceRoot":"","sources":["../../../../../packages/storybook-addon/src/utils/with-module-federation.ts"],"names":[],"mappings":";;AAAA,iEAAkF;AAClF,qCAAmD;AAInD,MAAM,EAAE,sBAAsB,EAAE,GAAG,mBAAS,CAAC;AAE7C,MAAM,mBAAmB,GAAG,CAAC,OAA+B,EAAE,EAAE;IAC9D,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACnC,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,KAAK,EAAE,OAA+B,EAAE,EAAE;IACrE,MAAM,E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