@module-federation/sdk 0.0.0-next-20240707094936 → 0.0.0-next-20240709063914
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/index.cjs.js +7 -5
- package/dist/index.esm.js +8 -5
- package/dist/package.json +1 -1
- package/dist/src/constant.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -30,7 +30,6 @@ const MFModuleType = {
|
|
|
30
30
|
};
|
|
31
31
|
const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
32
32
|
const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
33
|
-
const TEMP_DIR = '.federation';
|
|
34
33
|
|
|
35
34
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
36
35
|
__proto__: null
|
|
@@ -556,7 +555,6 @@ function loadScript(url, info) {
|
|
|
556
555
|
url,
|
|
557
556
|
cb: resolve,
|
|
558
557
|
attrs: _extends({
|
|
559
|
-
crossorigin: 'anonymous',
|
|
560
558
|
fetchpriority: 'high'
|
|
561
559
|
}, attrs),
|
|
562
560
|
createScriptHook,
|
|
@@ -571,7 +569,7 @@ function importNodeModule(name) {
|
|
|
571
569
|
throw new Error('import specifier is required');
|
|
572
570
|
}
|
|
573
571
|
const importModule = new Function('name', `return import(name)`);
|
|
574
|
-
return importModule(name).then((res)=>res
|
|
572
|
+
return importModule(name).then((res)=>res).catch((error)=>{
|
|
575
573
|
console.error(`Error importing module ${name}:`, error);
|
|
576
574
|
throw error;
|
|
577
575
|
});
|
|
@@ -625,6 +623,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
625
623
|
};
|
|
626
624
|
const handleScriptFetch = async (f, urlObj)=>{
|
|
627
625
|
try {
|
|
626
|
+
var _vm_constants;
|
|
628
627
|
const res = await f(urlObj.href);
|
|
629
628
|
const data = await res.text();
|
|
630
629
|
const [path, vm] = await Promise.all([
|
|
@@ -639,7 +638,11 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
639
638
|
};
|
|
640
639
|
const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
|
|
641
640
|
const filename = path.basename(urlObj.pathname);
|
|
642
|
-
|
|
641
|
+
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
642
|
+
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
|
|
643
|
+
filename,
|
|
644
|
+
importModuleDynamically: (_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER = (_vm_constants = vm.constants) == null ? void 0 : _vm_constants.USE_MAIN_CONTEXT_DEFAULT_LOADER) != null ? _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER : importNodeModule
|
|
645
|
+
});
|
|
643
646
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
|
|
644
647
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
645
648
|
if (attrs && exportedInterface && attrs['globalName']) {
|
|
@@ -707,7 +710,6 @@ exports.NameTransformMap = NameTransformMap;
|
|
|
707
710
|
exports.NameTransformSymbol = NameTransformSymbol;
|
|
708
711
|
exports.SEPARATOR = SEPARATOR;
|
|
709
712
|
exports.StatsFileName = StatsFileName;
|
|
710
|
-
exports.TEMP_DIR = TEMP_DIR;
|
|
711
713
|
exports.assert = assert;
|
|
712
714
|
exports.composeKeyWithSeparator = composeKeyWithSeparator;
|
|
713
715
|
exports.containerPlugin = ContainerPlugin;
|
package/dist/index.esm.js
CHANGED
|
@@ -26,7 +26,6 @@ const MFModuleType = {
|
|
|
26
26
|
};
|
|
27
27
|
const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
|
|
28
28
|
const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
|
|
29
|
-
const TEMP_DIR = '.federation';
|
|
30
29
|
|
|
31
30
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
32
31
|
__proto__: null
|
|
@@ -552,7 +551,6 @@ function loadScript(url, info) {
|
|
|
552
551
|
url,
|
|
553
552
|
cb: resolve,
|
|
554
553
|
attrs: _extends({
|
|
555
|
-
crossorigin: 'anonymous',
|
|
556
554
|
fetchpriority: 'high'
|
|
557
555
|
}, attrs),
|
|
558
556
|
createScriptHook,
|
|
@@ -567,7 +565,7 @@ function importNodeModule(name) {
|
|
|
567
565
|
throw new Error('import specifier is required');
|
|
568
566
|
}
|
|
569
567
|
const importModule = new Function('name', `return import(name)`);
|
|
570
|
-
return importModule(name).then((res)=>res
|
|
568
|
+
return importModule(name).then((res)=>res).catch((error)=>{
|
|
571
569
|
console.error(`Error importing module ${name}:`, error);
|
|
572
570
|
throw error;
|
|
573
571
|
});
|
|
@@ -621,6 +619,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
621
619
|
};
|
|
622
620
|
const handleScriptFetch = async (f, urlObj)=>{
|
|
623
621
|
try {
|
|
622
|
+
var _vm_constants;
|
|
624
623
|
const res = await f(urlObj.href);
|
|
625
624
|
const data = await res.text();
|
|
626
625
|
const [path, vm] = await Promise.all([
|
|
@@ -635,7 +634,11 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
635
634
|
};
|
|
636
635
|
const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
|
|
637
636
|
const filename = path.basename(urlObj.pathname);
|
|
638
|
-
|
|
637
|
+
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
638
|
+
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
|
|
639
|
+
filename,
|
|
640
|
+
importModuleDynamically: (_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER = (_vm_constants = vm.constants) == null ? void 0 : _vm_constants.USE_MAIN_CONTEXT_DEFAULT_LOADER) != null ? _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER : importNodeModule
|
|
641
|
+
});
|
|
639
642
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
|
|
640
643
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
641
644
|
if (attrs && exportedInterface && attrs['globalName']) {
|
|
@@ -689,4 +692,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
689
692
|
};
|
|
690
693
|
}
|
|
691
694
|
|
|
692
|
-
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName,
|
|
695
|
+
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, inferAutoPublicPath, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
|
package/dist/package.json
CHANGED
package/dist/src/constant.d.ts
CHANGED