@module-federation/modern-js 0.0.0-next-20240920074009 → 0.0.0-next-20240920075140
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/cjs/cli/dataLoader/plugin.js +12 -1
- package/dist/cjs/cli/server/dataLoaderPlugin.js +0 -4
- package/dist/cjs/runtime/dataLoader/plugin.js +0 -2
- package/dist/esm/cli/dataLoader/plugin.js +15 -2
- package/dist/esm/cli/server/dataLoaderPlugin.js +0 -4
- package/dist/esm/runtime/dataLoader/plugin.js +0 -2
- package/dist/esm-node/cli/dataLoader/plugin.js +12 -1
- package/dist/esm-node/cli/server/dataLoaderPlugin.js +0 -4
- package/dist/esm-node/runtime/dataLoader/plugin.js +0 -2
- package/package.json +5 -5
|
@@ -98,8 +98,15 @@ const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) =
|
|
|
98
98
|
dataLoaderRemotes,
|
|
99
99
|
ssrByRouteIdsMap
|
|
100
100
|
};
|
|
101
|
+
const hasDataLoaderRemotes = () => Boolean(serverPluginOptions.dataLoaderRemotes.length);
|
|
101
102
|
return {
|
|
102
103
|
_internalRuntimePlugins: ({ entrypoint, plugins }) => {
|
|
104
|
+
if (!hasDataLoaderRemotes()) {
|
|
105
|
+
return {
|
|
106
|
+
entrypoint,
|
|
107
|
+
plugins
|
|
108
|
+
};
|
|
109
|
+
}
|
|
103
110
|
plugins.push({
|
|
104
111
|
name: "ssrDataLoader",
|
|
105
112
|
path: "@module-federation/modern-js/data-loader",
|
|
@@ -122,6 +129,11 @@ const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) =
|
|
|
122
129
|
};
|
|
123
130
|
},
|
|
124
131
|
_internalServerPlugins({ plugins }) {
|
|
132
|
+
if (!hasDataLoaderRemotes()) {
|
|
133
|
+
return {
|
|
134
|
+
plugins
|
|
135
|
+
};
|
|
136
|
+
}
|
|
125
137
|
plugins.push({
|
|
126
138
|
name: serverPlugin,
|
|
127
139
|
options: serverPluginOptions
|
|
@@ -195,7 +207,6 @@ const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) =
|
|
|
195
207
|
},
|
|
196
208
|
async afterDev() {
|
|
197
209
|
(0, import_clearMFCache.clearMFCache)();
|
|
198
|
-
console.log("afterDev", globalThis.__VMOK__);
|
|
199
210
|
}
|
|
200
211
|
};
|
|
201
212
|
}
|
|
@@ -33,10 +33,6 @@ var dataLoaderPlugin_default = ({ runtimeOptions, dataLoaderRemotes, ssrByRouteI
|
|
|
33
33
|
],
|
|
34
34
|
setup(api) {
|
|
35
35
|
const { remotes, name } = runtimeOptions;
|
|
36
|
-
console.log("server ", dataLoaderRemotes);
|
|
37
|
-
if (!dataLoaderRemotes.length) {
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
36
|
let isHandled = false;
|
|
41
37
|
return {
|
|
42
38
|
prepare() {
|
|
@@ -35,13 +35,11 @@ const ssrDataLoaderPlugin = ({ metaName, dataLoaderRemotes }) => {
|
|
|
35
35
|
const remoteRoutesMap = {};
|
|
36
36
|
return {
|
|
37
37
|
async beforeRender() {
|
|
38
|
-
console.log("init ", dataLoaderRemotes);
|
|
39
38
|
if (Object.keys(remoteRoutesMap).length) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
41
|
const instance = (0, import_runtime.getInstance)();
|
|
43
42
|
if (!instance) {
|
|
44
|
-
console.log("no instance!");
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
47
45
|
if (!instance.options.remotes.length) {
|
|
@@ -40,7 +40,7 @@ var moduleFederationDataLoaderPlugin = function(enable, internalOptions, userCon
|
|
|
40
40
|
],
|
|
41
41
|
setup: function() {
|
|
42
42
|
var _ref = _async_to_generator(function(param) {
|
|
43
|
-
var useAppContext, _userConfig_serverPlugin, serverPlugin, transformRuntimeOptions, appContext, name, _internalOptions_metaName, metaName, internalDirectory, transformRuntimeFn, entries, remotePathMap, ssrByRouteIdsMap, csrConfig, _ref2, scanEntries, scanRemotePathMap, dataLoaderRemotes, serverPluginOptions;
|
|
43
|
+
var useAppContext, _userConfig_serverPlugin, serverPlugin, transformRuntimeOptions, appContext, name, _internalOptions_metaName, metaName, internalDirectory, transformRuntimeFn, entries, remotePathMap, ssrByRouteIdsMap, csrConfig, _ref2, scanEntries, scanRemotePathMap, dataLoaderRemotes, serverPluginOptions, hasDataLoaderRemotes;
|
|
44
44
|
return _ts_generator(this, function(_state) {
|
|
45
45
|
switch (_state.label) {
|
|
46
46
|
case 0:
|
|
@@ -93,11 +93,20 @@ var moduleFederationDataLoaderPlugin = function(enable, internalOptions, userCon
|
|
|
93
93
|
dataLoaderRemotes,
|
|
94
94
|
ssrByRouteIdsMap
|
|
95
95
|
};
|
|
96
|
+
hasDataLoaderRemotes = function() {
|
|
97
|
+
return Boolean(serverPluginOptions.dataLoaderRemotes.length);
|
|
98
|
+
};
|
|
96
99
|
return [
|
|
97
100
|
2,
|
|
98
101
|
{
|
|
99
102
|
_internalRuntimePlugins: function(param2) {
|
|
100
103
|
var entrypoint = param2.entrypoint, plugins = param2.plugins;
|
|
104
|
+
if (!hasDataLoaderRemotes()) {
|
|
105
|
+
return {
|
|
106
|
+
entrypoint,
|
|
107
|
+
plugins
|
|
108
|
+
};
|
|
109
|
+
}
|
|
101
110
|
plugins.push({
|
|
102
111
|
name: "ssrDataLoader",
|
|
103
112
|
path: "@module-federation/modern-js/data-loader",
|
|
@@ -121,6 +130,11 @@ var moduleFederationDataLoaderPlugin = function(enable, internalOptions, userCon
|
|
|
121
130
|
},
|
|
122
131
|
_internalServerPlugins: function _internalServerPlugins(param2) {
|
|
123
132
|
var plugins = param2.plugins;
|
|
133
|
+
if (!hasDataLoaderRemotes()) {
|
|
134
|
+
return {
|
|
135
|
+
plugins
|
|
136
|
+
};
|
|
137
|
+
}
|
|
124
138
|
plugins.push({
|
|
125
139
|
name: serverPlugin,
|
|
126
140
|
options: serverPluginOptions
|
|
@@ -302,7 +316,6 @@ var moduleFederationDataLoaderPlugin = function(enable, internalOptions, userCon
|
|
|
302
316
|
return _async_to_generator(function() {
|
|
303
317
|
return _ts_generator(this, function(_state2) {
|
|
304
318
|
clearMFCache();
|
|
305
|
-
console.log("afterDev", globalThis.__VMOK__);
|
|
306
319
|
return [
|
|
307
320
|
2
|
|
308
321
|
];
|
|
@@ -15,10 +15,6 @@ function dataLoaderPlugin_default(param) {
|
|
|
15
15
|
],
|
|
16
16
|
setup: function setup(api) {
|
|
17
17
|
var remotes = runtimeOptions.remotes, name = runtimeOptions.name;
|
|
18
|
-
console.log("server ", dataLoaderRemotes);
|
|
19
|
-
if (!dataLoaderRemotes.length) {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
18
|
var isHandled = false;
|
|
23
19
|
return {
|
|
24
20
|
prepare: function prepare() {
|
|
@@ -20,7 +20,6 @@ var ssrDataLoaderPlugin = function(param) {
|
|
|
20
20
|
return _ts_generator(this, function(_state) {
|
|
21
21
|
switch (_state.label) {
|
|
22
22
|
case 0:
|
|
23
|
-
console.log("init ", dataLoaderRemotes);
|
|
24
23
|
if (Object.keys(remoteRoutesMap).length) {
|
|
25
24
|
return [
|
|
26
25
|
2
|
|
@@ -28,7 +27,6 @@ var ssrDataLoaderPlugin = function(param) {
|
|
|
28
27
|
}
|
|
29
28
|
instance = getInstance();
|
|
30
29
|
if (!instance) {
|
|
31
|
-
console.log("no instance!");
|
|
32
30
|
return [
|
|
33
31
|
2
|
|
34
32
|
];
|
|
@@ -63,8 +63,15 @@ const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) =
|
|
|
63
63
|
dataLoaderRemotes,
|
|
64
64
|
ssrByRouteIdsMap
|
|
65
65
|
};
|
|
66
|
+
const hasDataLoaderRemotes = () => Boolean(serverPluginOptions.dataLoaderRemotes.length);
|
|
66
67
|
return {
|
|
67
68
|
_internalRuntimePlugins: ({ entrypoint, plugins }) => {
|
|
69
|
+
if (!hasDataLoaderRemotes()) {
|
|
70
|
+
return {
|
|
71
|
+
entrypoint,
|
|
72
|
+
plugins
|
|
73
|
+
};
|
|
74
|
+
}
|
|
68
75
|
plugins.push({
|
|
69
76
|
name: "ssrDataLoader",
|
|
70
77
|
path: "@module-federation/modern-js/data-loader",
|
|
@@ -87,6 +94,11 @@ const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) =
|
|
|
87
94
|
};
|
|
88
95
|
},
|
|
89
96
|
_internalServerPlugins({ plugins }) {
|
|
97
|
+
if (!hasDataLoaderRemotes()) {
|
|
98
|
+
return {
|
|
99
|
+
plugins
|
|
100
|
+
};
|
|
101
|
+
}
|
|
90
102
|
plugins.push({
|
|
91
103
|
name: serverPlugin,
|
|
92
104
|
options: serverPluginOptions
|
|
@@ -160,7 +172,6 @@ const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) =
|
|
|
160
172
|
},
|
|
161
173
|
async afterDev() {
|
|
162
174
|
clearMFCache();
|
|
163
|
-
console.log("afterDev", globalThis.__VMOK__);
|
|
164
175
|
}
|
|
165
176
|
};
|
|
166
177
|
}
|
|
@@ -10,10 +10,6 @@ var dataLoaderPlugin_default = ({ runtimeOptions, dataLoaderRemotes, ssrByRouteI
|
|
|
10
10
|
],
|
|
11
11
|
setup(api) {
|
|
12
12
|
const { remotes, name } = runtimeOptions;
|
|
13
|
-
console.log("server ", dataLoaderRemotes);
|
|
14
|
-
if (!dataLoaderRemotes.length) {
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
13
|
let isHandled = false;
|
|
18
14
|
return {
|
|
19
15
|
prepare() {
|
|
@@ -12,13 +12,11 @@ const ssrDataLoaderPlugin = ({ metaName, dataLoaderRemotes }) => {
|
|
|
12
12
|
const remoteRoutesMap = {};
|
|
13
13
|
return {
|
|
14
14
|
async beforeRender() {
|
|
15
|
-
console.log("init ", dataLoaderRemotes);
|
|
16
15
|
if (Object.keys(remoteRoutesMap).length) {
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
const instance = getInstance();
|
|
20
19
|
if (!instance) {
|
|
21
|
-
console.log("no instance!");
|
|
22
20
|
return;
|
|
23
21
|
}
|
|
24
22
|
if (!instance.options.remotes.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240920075140",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"@babel/parser": "7.25.3",
|
|
95
95
|
"@babel/traverse": "7.25.3",
|
|
96
96
|
"@babel/types": "7.25.2",
|
|
97
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
98
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
99
|
-
"@module-federation/node": "0.0.0-next-
|
|
97
|
+
"@module-federation/sdk": "0.0.0-next-20240920075140",
|
|
98
|
+
"@module-federation/enhanced": "0.0.0-next-20240920075140",
|
|
99
|
+
"@module-federation/node": "0.0.0-next-20240920075140"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@types/babel__traverse": "7.20.6",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@modern-js/runtime": "^2.59.0",
|
|
109
109
|
"@modern-js/module-tools": "^2.59.0",
|
|
110
110
|
"@modern-js/tsconfig": "^2.59.0",
|
|
111
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
111
|
+
"@module-federation/manifest": "0.0.0-next-20240920075140"
|
|
112
112
|
},
|
|
113
113
|
"peerDependencies": {
|
|
114
114
|
"@modern-js/runtime": "^2.59.0",
|