@module-federation/modern-js 0.21.5 → 0.22.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/dist/cjs/cli/configPlugin.js +301 -357
- package/dist/cjs/cli/index.js +103 -93
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +51 -41
- package/dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js +73 -75
- package/dist/cjs/cli/mfRuntimePlugins/shared-strategy.js +50 -40
- package/dist/cjs/cli/server/data-fetch-server-plugin.js +55 -44
- package/dist/cjs/cli/ssrPlugin.js +266 -298
- package/dist/cjs/cli/utils.js +84 -81
- package/dist/cjs/constant.js +37 -28
- package/dist/cjs/interfaces/bundler.js +17 -15
- package/dist/cjs/logger.js +37 -25
- package/dist/cjs/react/index.js +55 -19
- package/dist/cjs/react/plugin.js +62 -37
- package/dist/cjs/react/v18.js +55 -19
- package/dist/cjs/react/v19.js +55 -19
- package/dist/cjs/runtime/index.js +55 -19
- package/dist/cjs/server/fileCache.js +76 -76
- package/dist/cjs/server/index.js +65 -57
- package/dist/cjs/server/staticMiddleware.js +84 -84
- package/dist/cjs/ssr-runtime/SSRLiveReload.js +40 -34
- package/dist/cjs/ssr-runtime/devPlugin.js +63 -67
- package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +44 -36
- package/dist/cjs/types/index.js +17 -15
- package/dist/esm/cli/configPlugin.mjs +305 -0
- package/dist/esm/cli/index.mjs +83 -0
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs +12 -0
- package/dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.mjs +58 -0
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs +21 -0
- package/dist/esm/cli/server/data-fetch-server-plugin.mjs +17 -0
- package/dist/esm/cli/ssrPlugin.mjs +254 -0
- package/dist/esm/cli/utils.mjs +40 -0
- package/dist/esm/constant.mjs +3 -0
- package/dist/esm/logger.mjs +5 -0
- package/dist/esm/react/plugin.mjs +3 -0
- package/dist/esm/server/fileCache.mjs +90 -0
- package/dist/esm/server/index.mjs +36 -0
- package/dist/esm/server/staticMiddleware.mjs +87 -0
- package/dist/esm/ssr-runtime/SSRLiveReload.mjs +22 -0
- package/dist/esm/ssr-runtime/devPlugin.mjs +70 -0
- package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.mjs +34 -0
- package/dist/esm-node/cli/configPlugin.mjs +263 -0
- package/dist/esm-node/cli/index.mjs +67 -0
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.mjs +10 -0
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.mjs +46 -0
- package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.mjs +19 -0
- package/dist/esm-node/cli/server/data-fetch-server-plugin.mjs +15 -0
- package/dist/esm-node/cli/ssrPlugin.mjs +228 -0
- package/dist/esm-node/cli/utils.mjs +40 -0
- package/dist/esm-node/constant.mjs +3 -0
- package/dist/esm-node/logger.mjs +5 -0
- package/dist/esm-node/react/plugin.mjs +3 -0
- package/dist/esm-node/server/fileCache.mjs +37 -0
- package/dist/esm-node/server/index.mjs +34 -0
- package/dist/esm-node/server/staticMiddleware.mjs +42 -0
- package/dist/esm-node/ssr-runtime/SSRLiveReload.mjs +15 -0
- package/dist/esm-node/ssr-runtime/devPlugin.mjs +33 -0
- package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.mjs +14 -0
- package/package.json +32 -31
- package/dist/cjs/cli/configPlugin.spec.js +0 -112
- package/dist/cjs/server/fileCache.spec.js +0 -28
- package/dist/cjs/server/staticMiddleware.spec.js +0 -185
- package/dist/esm/cli/configPlugin.js +0 -395
- package/dist/esm/cli/configPlugin.spec.js +0 -108
- package/dist/esm/cli/index.js +0 -92
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js +0 -16
- package/dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js +0 -74
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.js +0 -25
- package/dist/esm/cli/server/data-fetch-server-plugin.js +0 -20
- package/dist/esm/cli/ssrPlugin.js +0 -305
- package/dist/esm/cli/utils.js +0 -53
- package/dist/esm/constant.js +0 -6
- package/dist/esm/logger.js +0 -7
- package/dist/esm/react/plugin.js +0 -5
- package/dist/esm/server/fileCache.js +0 -98
- package/dist/esm/server/fileCache.spec.js +0 -50
- package/dist/esm/server/index.js +0 -41
- package/dist/esm/server/staticMiddleware.js +0 -104
- package/dist/esm/server/staticMiddleware.spec.js +0 -328
- package/dist/esm/ssr-runtime/SSRLiveReload.js +0 -26
- package/dist/esm/ssr-runtime/devPlugin.js +0 -73
- package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -34
- package/dist/esm-node/cli/configPlugin.js +0 -347
- package/dist/esm-node/cli/configPlugin.spec.js +0 -89
- package/dist/esm-node/cli/index.js +0 -72
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.js +0 -14
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.js +0 -62
- package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.js +0 -23
- package/dist/esm-node/cli/server/data-fetch-server-plugin.js +0 -18
- package/dist/esm-node/cli/ssrPlugin.js +0 -280
- package/dist/esm-node/cli/utils.js +0 -53
- package/dist/esm-node/constant.js +0 -6
- package/dist/esm-node/logger.js +0 -7
- package/dist/esm-node/react/plugin.js +0 -5
- package/dist/esm-node/server/fileCache.js +0 -49
- package/dist/esm-node/server/fileCache.spec.js +0 -27
- package/dist/esm-node/server/index.js +0 -39
- package/dist/esm-node/server/staticMiddleware.js +0 -55
- package/dist/esm-node/server/staticMiddleware.spec.js +0 -162
- package/dist/esm-node/ssr-runtime/SSRLiveReload.js +0 -19
- package/dist/esm-node/ssr-runtime/devPlugin.js +0 -37
- package/dist/esm-node/ssr-runtime/injectDataFetchFunctionPlugin.js +0 -16
- /package/dist/esm/interfaces/{bundler.js → bundler.mjs} +0 -0
- /package/dist/esm/react/{index.js → index.mjs} +0 -0
- /package/dist/esm/react/{v18.js → v18.mjs} +0 -0
- /package/dist/esm/react/{v19.js → v19.mjs} +0 -0
- /package/dist/esm/runtime/{index.js → index.mjs} +0 -0
- /package/dist/esm/types/{index.js → index.mjs} +0 -0
- /package/dist/esm-node/interfaces/{bundler.js → bundler.mjs} +0 -0
- /package/dist/esm-node/react/{index.js → index.mjs} +0 -0
- /package/dist/esm-node/react/{v18.js → v18.mjs} +0 -0
- /package/dist/esm-node/react/{v19.js → v19.mjs} +0 -0
- /package/dist/esm-node/runtime/{index.js → index.mjs} +0 -0
- /package/dist/esm-node/types/{index.js → index.mjs} +0 -0
package/dist/cjs/cli/index.js
CHANGED
|
@@ -1,97 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cli_exports = {};
|
|
20
|
-
__export(cli_exports, {
|
|
21
|
-
createModuleFederationConfig: () => import_enhanced2.createModuleFederationConfig,
|
|
22
|
-
default: () => cli_default,
|
|
23
|
-
moduleFederationPlugin: () => moduleFederationPlugin
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(cli_exports);
|
|
26
|
-
var import_enhanced = require("@module-federation/enhanced");
|
|
27
|
-
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
28
|
-
var import_configPlugin = require("./configPlugin");
|
|
29
|
-
var import_ssrPlugin = require("./ssrPlugin");
|
|
30
|
-
var import_utils = require("./utils");
|
|
31
|
-
var import_enhanced2 = require("@module-federation/enhanced");
|
|
32
|
-
const moduleFederationPlugin = (userConfig = {}) => {
|
|
33
|
-
var _userConfig_fetchServerQuery;
|
|
34
|
-
const internalModernPluginOptions = {
|
|
35
|
-
csrConfig: void 0,
|
|
36
|
-
ssrConfig: void 0,
|
|
37
|
-
browserPlugin: void 0,
|
|
38
|
-
nodePlugin: void 0,
|
|
39
|
-
assetResources: {},
|
|
40
|
-
distOutputDir: "",
|
|
41
|
-
originPluginOptions: userConfig,
|
|
42
|
-
remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
|
|
43
|
-
userConfig: userConfig || {},
|
|
44
|
-
assetFileNames: {},
|
|
45
|
-
fetchServerQuery: (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) !== null && _userConfig_fetchServerQuery !== void 0 ? _userConfig_fetchServerQuery : void 0
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
name: "@modern-js/plugin-module-federation",
|
|
49
|
-
setup: async (api) => {
|
|
50
|
-
const modernjsConfig = api.getConfig();
|
|
51
|
-
api.modifyBundlerChain((chain) => {
|
|
52
|
-
const bundlerType = api.getAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
|
|
53
|
-
const browserPluginOptions = internalModernPluginOptions.csrConfig;
|
|
54
|
-
const MFPlugin = bundlerType === "webpack" ? import_enhanced.ModuleFederationPlugin : import_rspack.ModuleFederationPlugin;
|
|
55
|
-
if ((0, import_utils.isWebTarget)(chain.get("target"))) {
|
|
56
|
-
chain.plugin("plugin-module-federation").use(MFPlugin, [
|
|
57
|
-
browserPluginOptions
|
|
58
|
-
]).init((Plugin, args) => {
|
|
59
|
-
internalModernPluginOptions.browserPlugin = new Plugin(args[0]);
|
|
60
|
-
return internalModernPluginOptions.browserPlugin;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (bundlerType === "webpack") {
|
|
64
|
-
var _modernjsConfig_source;
|
|
65
|
-
const enableAsyncEntry = (_modernjsConfig_source = modernjsConfig.source) === null || _modernjsConfig_source === void 0 ? void 0 : _modernjsConfig_source.enableAsyncEntry;
|
|
66
|
-
if (!enableAsyncEntry && browserPluginOptions.async !== false) {
|
|
67
|
-
const asyncBoundaryPluginOptions = typeof browserPluginOptions.async === "object" ? browserPluginOptions.async : {
|
|
68
|
-
eager: (module2) => module2 && /\.federation/.test((module2 === null || module2 === void 0 ? void 0 : module2.request) || ""),
|
|
69
|
-
excludeChunk: (chunk) => chunk.name === browserPluginOptions.name
|
|
70
|
-
};
|
|
71
|
-
chain.plugin("async-boundary-plugin").use(import_enhanced.AsyncBoundaryPlugin, [
|
|
72
|
-
asyncBoundaryPluginOptions
|
|
73
|
-
]);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
api._internalServerPlugins(({ plugins }) => {
|
|
78
|
-
plugins.push({
|
|
79
|
-
name: "@module-federation/modern-js/server"
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
80
8
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
moduleFederationPlugin: ()=>moduleFederationPlugin,
|
|
28
|
+
createModuleFederationConfig: ()=>enhanced_namespaceObject.createModuleFederationConfig,
|
|
29
|
+
default: ()=>cli
|
|
30
|
+
});
|
|
31
|
+
const enhanced_namespaceObject = require("@module-federation/enhanced");
|
|
32
|
+
const rspack_namespaceObject = require("@module-federation/enhanced/rspack");
|
|
33
|
+
const external_configPlugin_js_namespaceObject = require("./configPlugin.js");
|
|
34
|
+
const external_ssrPlugin_js_namespaceObject = require("./ssrPlugin.js");
|
|
35
|
+
const external_utils_js_namespaceObject = require("./utils.js");
|
|
36
|
+
const moduleFederationPlugin = (userConfig = {})=>{
|
|
37
|
+
var _userConfig_fetchServerQuery;
|
|
38
|
+
const internalModernPluginOptions = {
|
|
39
|
+
csrConfig: void 0,
|
|
40
|
+
ssrConfig: void 0,
|
|
41
|
+
browserPlugin: void 0,
|
|
42
|
+
nodePlugin: void 0,
|
|
43
|
+
assetResources: {},
|
|
44
|
+
distOutputDir: '',
|
|
45
|
+
originPluginOptions: {
|
|
46
|
+
...userConfig
|
|
47
|
+
},
|
|
48
|
+
remoteIpStrategy: null == userConfig ? void 0 : userConfig.remoteIpStrategy,
|
|
49
|
+
userConfig: userConfig || {},
|
|
50
|
+
assetFileNames: {},
|
|
51
|
+
fetchServerQuery: null != (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) ? _userConfig_fetchServerQuery : void 0
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
name: '@modern-js/plugin-module-federation',
|
|
55
|
+
setup: async (api)=>{
|
|
56
|
+
const modernjsConfig = api.getConfig();
|
|
57
|
+
api.modifyBundlerChain((chain)=>{
|
|
58
|
+
const bundlerType = 'rspack' === api.getAppContext().bundlerType ? 'rspack' : 'webpack';
|
|
59
|
+
const browserPluginOptions = internalModernPluginOptions.csrConfig;
|
|
60
|
+
const MFPlugin = 'webpack' === bundlerType ? enhanced_namespaceObject.ModuleFederationPlugin : rspack_namespaceObject.ModuleFederationPlugin;
|
|
61
|
+
if ((0, external_utils_js_namespaceObject.isWebTarget)(chain.get('target'))) chain.plugin('plugin-module-federation').use(MFPlugin, [
|
|
62
|
+
browserPluginOptions
|
|
63
|
+
]).init((Plugin, args)=>{
|
|
64
|
+
internalModernPluginOptions.browserPlugin = new Plugin(args[0]);
|
|
65
|
+
return internalModernPluginOptions.browserPlugin;
|
|
66
|
+
});
|
|
67
|
+
if ('webpack' === bundlerType) {
|
|
68
|
+
var _modernjsConfig_source;
|
|
69
|
+
const enableAsyncEntry = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry;
|
|
70
|
+
if (!enableAsyncEntry && false !== browserPluginOptions.async) {
|
|
71
|
+
const asyncBoundaryPluginOptions = 'object' == typeof browserPluginOptions.async ? browserPluginOptions.async : {
|
|
72
|
+
eager: (module)=>module && /\.federation/.test((null == module ? void 0 : module.request) || ''),
|
|
73
|
+
excludeChunk: (chunk)=>chunk.name === browserPluginOptions.name
|
|
74
|
+
};
|
|
75
|
+
chain.plugin('async-boundary-plugin').use(enhanced_namespaceObject.AsyncBoundaryPlugin, [
|
|
76
|
+
asyncBoundaryPluginOptions
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
api._internalServerPlugins(({ plugins })=>{
|
|
82
|
+
plugins.push({
|
|
83
|
+
name: '@module-federation/modern-js/server'
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
plugins
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
usePlugins: [
|
|
91
|
+
(0, external_configPlugin_js_namespaceObject.moduleFederationConfigPlugin)(internalModernPluginOptions),
|
|
92
|
+
(0, external_ssrPlugin_js_namespaceObject.moduleFederationSSRPlugin)(internalModernPluginOptions)
|
|
93
|
+
]
|
|
94
|
+
};
|
|
91
95
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
const cli = moduleFederationPlugin;
|
|
97
|
+
exports.createModuleFederationConfig = __webpack_exports__.createModuleFederationConfig;
|
|
98
|
+
exports["default"] = __webpack_exports__["default"];
|
|
99
|
+
exports.moduleFederationPlugin = __webpack_exports__.moduleFederationPlugin;
|
|
100
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
101
|
+
"createModuleFederationConfig",
|
|
102
|
+
"default",
|
|
103
|
+
"moduleFederationPlugin"
|
|
104
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
105
|
+
Object.defineProperty(exports, '__esModule', {
|
|
106
|
+
value: true
|
|
97
107
|
});
|
|
@@ -1,44 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>inject_node_fetch
|
|
32
37
|
});
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
const injectNodeFetchPlugin = ()
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const external_node_fetch_namespaceObject = require("node-fetch");
|
|
39
|
+
var external_node_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_node_fetch_namespaceObject);
|
|
40
|
+
const injectNodeFetchPlugin = ()=>({
|
|
41
|
+
name: 'inject-node-fetch-plugin',
|
|
42
|
+
beforeInit (args) {
|
|
43
|
+
if (!globalThis.fetch) globalThis.fetch = external_node_fetch_default();
|
|
44
|
+
return args;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const inject_node_fetch = injectNodeFetchPlugin;
|
|
48
|
+
exports["default"] = __webpack_exports__["default"];
|
|
49
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
50
|
+
"default"
|
|
51
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
52
|
+
Object.defineProperty(exports, '__esModule', {
|
|
53
|
+
value: true
|
|
43
54
|
});
|
|
44
|
-
var inject_node_fetch_default = injectNodeFetchPlugin;
|
|
@@ -1,82 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
default: ()=>resolve_entry_ipv4
|
|
22
28
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const remoteIpStrategy = typeof REMOTE_IP_STRATEGY !== "undefined" ? REMOTE_IP_STRATEGY : "inherit";
|
|
29
|
+
const external_constant_js_namespaceObject = require("../../constant.js");
|
|
30
|
+
const ipv4 = "u" > typeof FEDERATION_IPV4 ? FEDERATION_IPV4 : '127.0.0.1';
|
|
31
|
+
const remoteIpStrategy = "u" > typeof REMOTE_IP_STRATEGY ? REMOTE_IP_STRATEGY : 'inherit';
|
|
27
32
|
function replaceObjectLocalhost(key, obj) {
|
|
28
|
-
|
|
29
|
-
return;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const remote = obj[key];
|
|
35
|
-
if (remote && typeof remote === "string" && remote.includes(import_constant.LOCALHOST)) {
|
|
36
|
-
obj[key] = replaceLocalhost(remote);
|
|
37
|
-
}
|
|
33
|
+
if ('ipv4' !== remoteIpStrategy) return;
|
|
34
|
+
if (!(key in obj)) return;
|
|
35
|
+
const remote = obj[key];
|
|
36
|
+
if (remote && 'string' == typeof remote && remote.includes(external_constant_js_namespaceObject.LOCALHOST)) obj[key] = replaceLocalhost(remote);
|
|
38
37
|
}
|
|
39
38
|
function replaceLocalhost(url) {
|
|
40
|
-
|
|
39
|
+
return url.replace(external_constant_js_namespaceObject.LOCALHOST, ipv4);
|
|
41
40
|
}
|
|
42
|
-
const resolveEntryIpv4Plugin = ()
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
41
|
+
const resolveEntryIpv4Plugin = ()=>({
|
|
42
|
+
name: 'resolve-entry-ipv4',
|
|
43
|
+
beforeRegisterRemote (args) {
|
|
44
|
+
const { remote } = args;
|
|
45
|
+
replaceObjectLocalhost('entry', remote);
|
|
46
|
+
return args;
|
|
47
|
+
},
|
|
48
|
+
async afterResolve (args) {
|
|
49
|
+
const { remoteInfo } = args;
|
|
50
|
+
replaceObjectLocalhost('entry', remoteInfo);
|
|
51
|
+
return args;
|
|
52
|
+
},
|
|
53
|
+
beforeLoadRemoteSnapshot (args) {
|
|
54
|
+
const { moduleInfo } = args;
|
|
55
|
+
if ('entry' in moduleInfo) {
|
|
56
|
+
replaceObjectLocalhost('entry', moduleInfo);
|
|
57
|
+
return args;
|
|
58
|
+
}
|
|
59
|
+
if ('version' in moduleInfo) replaceObjectLocalhost('version', moduleInfo);
|
|
60
|
+
return args;
|
|
61
|
+
},
|
|
62
|
+
loadRemoteSnapshot (args) {
|
|
63
|
+
const { remoteSnapshot } = args;
|
|
64
|
+
if ('publicPath' in remoteSnapshot) replaceObjectLocalhost('publicPath', remoteSnapshot);
|
|
65
|
+
if ('getPublicPath' in remoteSnapshot) replaceObjectLocalhost('getPublicPath', remoteSnapshot);
|
|
66
|
+
if (remoteSnapshot.remotesInfo) Object.keys(remoteSnapshot.remotesInfo).forEach((key)=>{
|
|
67
|
+
const remoteInfo = remoteSnapshot.remotesInfo[key];
|
|
68
|
+
replaceObjectLocalhost('matchedVersion', remoteInfo);
|
|
69
|
+
});
|
|
70
|
+
return args;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const resolve_entry_ipv4 = resolveEntryIpv4Plugin;
|
|
74
|
+
exports["default"] = __webpack_exports__["default"];
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"default"
|
|
77
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
+
Object.defineProperty(exports, '__esModule', {
|
|
79
|
+
value: true
|
|
81
80
|
});
|
|
82
|
-
var resolve_entry_ipv4_default = resolveEntryIpv4Plugin;
|
|
@@ -1,43 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var shared_strategy_exports = {};
|
|
20
|
-
__export(shared_strategy_exports, {
|
|
21
|
-
default: () => shared_strategy_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(shared_strategy_exports);
|
|
24
|
-
const sharedStrategy = () => ({
|
|
25
|
-
name: "shared-strategy-plugin",
|
|
26
|
-
beforeInit(args) {
|
|
27
|
-
const { userOptions } = args;
|
|
28
|
-
const shared = userOptions.shared;
|
|
29
|
-
if (shared) {
|
|
30
|
-
Object.keys(shared).forEach((sharedKey) => {
|
|
31
|
-
const sharedConfigs = shared[sharedKey];
|
|
32
|
-
const arraySharedConfigs = Array.isArray(sharedConfigs) ? sharedConfigs : [
|
|
33
|
-
sharedConfigs
|
|
34
|
-
];
|
|
35
|
-
arraySharedConfigs.forEach((s) => {
|
|
36
|
-
s.strategy = "loaded-first";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
37
18
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
default: ()=>__rspack_default_export
|
|
28
|
+
});
|
|
29
|
+
const sharedStrategy = ()=>({
|
|
30
|
+
name: 'shared-strategy-plugin',
|
|
31
|
+
beforeInit (args) {
|
|
32
|
+
const { userOptions } = args;
|
|
33
|
+
const shared = userOptions.shared;
|
|
34
|
+
if (shared) Object.keys(shared).forEach((sharedKey)=>{
|
|
35
|
+
const sharedConfigs = shared[sharedKey];
|
|
36
|
+
const arraySharedConfigs = Array.isArray(sharedConfigs) ? sharedConfigs : [
|
|
37
|
+
sharedConfigs
|
|
38
|
+
];
|
|
39
|
+
arraySharedConfigs.forEach((s)=>{
|
|
40
|
+
s.strategy = 'loaded-first';
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const __rspack_default_export = sharedStrategy;
|
|
47
|
+
exports["default"] = __webpack_exports__["default"];
|
|
48
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
|
+
"default"
|
|
50
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
42
53
|
});
|
|
43
|
-
var shared_strategy_default = sharedStrategy;
|