@softarc/native-federation 1.0.0 → 1.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
|
@@ -20,6 +20,8 @@ While this core library can be used with any framework and build tool, there is
|
|
|
20
20
|
|
|
21
21
|
> Please find the [Angular-based version here](https://www.npmjs.com/package/@angular-architects/native-federation).
|
|
22
22
|
|
|
23
|
+
> Please find the [vite plugin here](https://www.npmjs.com/package/@gioboa/vite-module-federation).
|
|
24
|
+
|
|
23
25
|
Also, other higher level abstractions on top of this core library are possible.
|
|
24
26
|
|
|
25
27
|
## About the Mental Model
|
|
@@ -37,6 +39,10 @@ For this, the mental model introduces several concepts:
|
|
|
37
39
|
|
|
38
40
|
- [VanillaJS example](https://github.com/manfredsteyer/native-federation-core-microfrontend).
|
|
39
41
|
- [React example](https://github.com/manfredsteyer/native-federation-react-example)
|
|
42
|
+
- This example also shows the **watch mode** for compiling a federated application
|
|
43
|
+
- [Vite + Svelte example](https://github.com/gioboa/svelte-microfrontend-demo)
|
|
44
|
+
- [Vite + Angular example powered by AnalogJS](https://github.com/manfredsteyer/native-federation-vite-angular-demo)
|
|
45
|
+
- **Your Example:** If you have an example with aspects not covered here, let us know. We are happy to link it here.
|
|
40
46
|
|
|
41
47
|
## Credits
|
|
42
48
|
|
|
@@ -48,6 +54,7 @@ Big thanks to:
|
|
|
48
54
|
- [The Nx Team](https://twitter.com/NxDevTools), esp. [Colum Ferry](https://twitter.com/FerryColum), who seamlessly integrated webpack Module Federation into Nx and hence helped to spread the word about it (Nx + Module Federation === ❤️)
|
|
49
55
|
- [Michael Egger-Zikes](https://twitter.com/MikeZks) for contributing to our Module Federation efforts and brining in valuable feedback
|
|
50
56
|
- The Angular CLI-Team, esp. [Alan Agius](https://twitter.com/AlanAgius4) and [Charles Lyding](https://twitter.com/charleslyding), for working on the experimental esbuild builder for Angular
|
|
57
|
+
- [Giorgio Boa](https://twitter.com/giorgio_boa) for implementing the awesome vite plugin for module federation.
|
|
51
58
|
|
|
52
59
|
## Using this Library
|
|
53
60
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softarc/native-federation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"json5": "^2.2.0",
|
|
7
7
|
"npmlog": "^6.0.2",
|
|
8
|
-
"@softarc/native-federation-runtime": "1.0.
|
|
8
|
+
"@softarc/native-federation-runtime": "1.0.1"
|
|
9
9
|
},
|
|
10
10
|
"main": "./src/index.js",
|
|
11
11
|
"typings": "./src/index.d.ts"
|
|
@@ -6,7 +6,7 @@ const fs = tslib_1.__importStar(require("fs"));
|
|
|
6
6
|
const path = tslib_1.__importStar(require("path"));
|
|
7
7
|
const logger_1 = require("./logger");
|
|
8
8
|
function getPackageInfo(packageName, workspaceRoot) {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
10
|
const projectRoot = workspaceRoot;
|
|
11
11
|
const mainPkgName = getPkgFolder(packageName);
|
|
12
12
|
const mainPkgPath = path.join(projectRoot, 'node_modules', mainPkgName);
|
|
@@ -33,7 +33,16 @@ function getPackageInfo(packageName, workspaceRoot) {
|
|
|
33
33
|
else {
|
|
34
34
|
relSecondaryPath = './' + relSecondaryPath.replace(/\\/g, '/');
|
|
35
35
|
}
|
|
36
|
-
let cand = (
|
|
36
|
+
let cand = (_a = mainPkgJson === null || mainPkgJson === void 0 ? void 0 : mainPkgJson.exports) === null || _a === void 0 ? void 0 : _a[relSecondaryPath];
|
|
37
|
+
if (typeof cand === 'string') {
|
|
38
|
+
return {
|
|
39
|
+
entryPoint: path.join(mainPkgPath, cand),
|
|
40
|
+
packageName,
|
|
41
|
+
version,
|
|
42
|
+
esm,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
cand = (_c = (_b = mainPkgJson === null || mainPkgJson === void 0 ? void 0 : mainPkgJson.exports) === null || _b === void 0 ? void 0 : _b[relSecondaryPath]) === null || _c === void 0 ? void 0 : _c.import;
|
|
37
46
|
if (typeof cand === 'object') {
|
|
38
47
|
if (cand.module) {
|
|
39
48
|
cand = cand.module;
|
|
@@ -53,7 +62,7 @@ function getPackageInfo(packageName, workspaceRoot) {
|
|
|
53
62
|
esm,
|
|
54
63
|
};
|
|
55
64
|
}
|
|
56
|
-
cand = (
|
|
65
|
+
cand = (_e = (_d = mainPkgJson === null || mainPkgJson === void 0 ? void 0 : mainPkgJson.exports) === null || _d === void 0 ? void 0 : _d[relSecondaryPath]) === null || _e === void 0 ? void 0 : _e.default;
|
|
57
66
|
if (cand) {
|
|
58
67
|
return {
|
|
59
68
|
entryPoint: path.join(mainPkgPath, cand),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-info.js","sourceRoot":"","sources":["../../../../../../libs/native-federation-core/src/lib/utils/package-info.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,qCAAkC;AAclC,SAAgB,cAAc,CAC5B,WAAmB,EACnB,aAAqB;;IAErB,MAAM,WAAW,GAAG,aAAa,CAAC;IAClC,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;IACxE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAE/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC/B,mBAAmB;QACnB,mEAAmE;QACnE,eAAM,CAAC,IAAI,CAAC,4BAA4B,GAAG,WAAW,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,WAAW,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;IAE9C,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,CAAW,CAAC;IACjD,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC;IAE7C,IAAI,CAAC,OAAO,EAAE;QACZ,mBAAmB;QACnB,8DAA8D;QAC9D,eAAM,CAAC,IAAI,CAAC,uBAAuB,GAAG,WAAW,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC/D,IAAI,CAAC,gBAAgB,EAAE;QACrB,gBAAgB,GAAG,GAAG,CAAC;KACxB;SAAM;QACL,gBAAgB,GAAG,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;KAChE;IAED,IAAI,IAAI,GAAG,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,0CAAG,gBAAgB,CAAC,0CAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"package-info.js","sourceRoot":"","sources":["../../../../../../libs/native-federation-core/src/lib/utils/package-info.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,qCAAkC;AAclC,SAAgB,cAAc,CAC5B,WAAmB,EACnB,aAAqB;;IAErB,MAAM,WAAW,GAAG,aAAa,CAAC;IAClC,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;IACxE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAE/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC/B,mBAAmB;QACnB,mEAAmE;QACnE,eAAM,CAAC,IAAI,CAAC,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