@eskea/super-app-sdk 1.0.6 → 1.0.7
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/lib/sharedDeps.js +58 -16
- package/package.json +1 -1
package/lib/sharedDeps.js
CHANGED
|
@@ -1,25 +1,67 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
// /**
|
|
2
|
+
// * Collect shared dependencies from the SDK and expose them
|
|
3
|
+
// * for the ModuleFederationPluginV1.
|
|
4
|
+
// *
|
|
5
|
+
// * @param {{ eager: boolean }} options Options for the shared dependencies. Use eager: false if using in a mini-app.
|
|
6
|
+
// * @returns Shared dependencies object.
|
|
7
|
+
// */
|
|
8
|
+
// const getSharedDependencies = ({ eager = true }) => {
|
|
9
|
+
// const dependencies = require("./dependencies.json");
|
|
10
|
+
|
|
11
|
+
// const shared = Object.entries(dependencies)
|
|
12
|
+
// .filter(([dep, props]) => props.shared !== false)
|
|
13
|
+
// .map(([dep, { version }]) => {
|
|
14
|
+
// // Special handling for react-native to ensure strict singleton
|
|
15
|
+
// console.log(version);
|
|
16
|
+
// if (dep === "react-native" || dep === "react") {
|
|
17
|
+
// return [
|
|
18
|
+
// dep,
|
|
19
|
+
// {
|
|
20
|
+
// singleton: true,
|
|
21
|
+
// eager,
|
|
22
|
+
// requiredVersion: version,
|
|
23
|
+
// strictVersion: true,
|
|
24
|
+
// },
|
|
25
|
+
// ];
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
// if (dep === "@react-navigation/native") {
|
|
29
|
+
// return [
|
|
30
|
+
// dep,
|
|
31
|
+
// {
|
|
32
|
+
// singleton: true,
|
|
33
|
+
// eager,
|
|
34
|
+
// requiredVersion: "7.1.28",
|
|
35
|
+
// strictVersion: true,
|
|
36
|
+
// },
|
|
37
|
+
// ];
|
|
38
|
+
// }
|
|
39
|
+
// return [dep, { singleton: true, eager, requiredVersion: version }];
|
|
40
|
+
// });
|
|
41
|
+
// return Object.fromEntries(shared);
|
|
42
|
+
// };
|
|
43
|
+
|
|
44
|
+
// module.exports = getSharedDependencies;
|
|
45
|
+
|
|
8
46
|
const getSharedDependencies = ({ eager = true }) => {
|
|
9
47
|
const dependencies = require("./dependencies.json");
|
|
10
48
|
|
|
11
49
|
const shared = Object.entries(dependencies)
|
|
12
50
|
.filter(([dep, props]) => props.shared !== false)
|
|
13
51
|
.map(([dep, { version }]) => {
|
|
14
|
-
//
|
|
15
|
-
|
|
52
|
+
// Base config for all shared modules
|
|
53
|
+
const config = {
|
|
54
|
+
singleton: true,
|
|
55
|
+
eager,
|
|
56
|
+
requiredVersion: version,
|
|
57
|
+
version: version, // <--- ADD THIS LINE
|
|
58
|
+
};
|
|
59
|
+
|
|
16
60
|
if (dep === "react-native" || dep === "react") {
|
|
17
61
|
return [
|
|
18
62
|
dep,
|
|
19
63
|
{
|
|
20
|
-
|
|
21
|
-
eager,
|
|
22
|
-
requiredVersion: version,
|
|
64
|
+
...config,
|
|
23
65
|
strictVersion: true,
|
|
24
66
|
},
|
|
25
67
|
];
|
|
@@ -29,15 +71,15 @@ const getSharedDependencies = ({ eager = true }) => {
|
|
|
29
71
|
return [
|
|
30
72
|
dep,
|
|
31
73
|
{
|
|
32
|
-
|
|
33
|
-
eager,
|
|
34
|
-
requiredVersion: "7.1.28",
|
|
74
|
+
...config,
|
|
35
75
|
strictVersion: true,
|
|
36
76
|
},
|
|
37
77
|
];
|
|
38
78
|
}
|
|
39
|
-
|
|
79
|
+
|
|
80
|
+
return [dep, config];
|
|
40
81
|
});
|
|
82
|
+
|
|
41
83
|
return Object.fromEntries(shared);
|
|
42
84
|
};
|
|
43
85
|
|