@module-federation/sdk 0.2.5 → 0.2.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/dist/index.cjs.js +9 -2
- package/dist/index.esm.js +9 -3
- package/dist/package.json +1 -1
- package/dist/src/constant.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -30,6 +30,7 @@ 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';
|
|
33
34
|
|
|
34
35
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
35
36
|
__proto__: null
|
|
@@ -569,7 +570,7 @@ function importNodeModule(name) {
|
|
|
569
570
|
throw new Error('import specifier is required');
|
|
570
571
|
}
|
|
571
572
|
const importModule = new Function('name', `return import(name)`);
|
|
572
|
-
return importModule(name).then((res)=>res
|
|
573
|
+
return importModule(name).then((res)=>res).catch((error)=>{
|
|
573
574
|
console.error(`Error importing module ${name}:`, error);
|
|
574
575
|
throw error;
|
|
575
576
|
});
|
|
@@ -623,6 +624,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
623
624
|
};
|
|
624
625
|
const handleScriptFetch = async (f, urlObj)=>{
|
|
625
626
|
try {
|
|
627
|
+
var _vm_constants;
|
|
626
628
|
const res = await f(urlObj.href);
|
|
627
629
|
const data = await res.text();
|
|
628
630
|
const [path, vm] = await Promise.all([
|
|
@@ -637,7 +639,11 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
637
639
|
};
|
|
638
640
|
const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
|
|
639
641
|
const filename = path.basename(urlObj.pathname);
|
|
640
|
-
|
|
642
|
+
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
643
|
+
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
|
|
644
|
+
filename,
|
|
645
|
+
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
|
|
646
|
+
});
|
|
641
647
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
|
|
642
648
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
643
649
|
if (attrs && exportedInterface && attrs['globalName']) {
|
|
@@ -705,6 +711,7 @@ exports.NameTransformMap = NameTransformMap;
|
|
|
705
711
|
exports.NameTransformSymbol = NameTransformSymbol;
|
|
706
712
|
exports.SEPARATOR = SEPARATOR;
|
|
707
713
|
exports.StatsFileName = StatsFileName;
|
|
714
|
+
exports.TEMP_DIR = TEMP_DIR;
|
|
708
715
|
exports.assert = assert;
|
|
709
716
|
exports.composeKeyWithSeparator = composeKeyWithSeparator;
|
|
710
717
|
exports.containerPlugin = ContainerPlugin;
|
package/dist/index.esm.js
CHANGED
|
@@ -26,6 +26,7 @@ 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';
|
|
29
30
|
|
|
30
31
|
var ContainerPlugin = /*#__PURE__*/Object.freeze({
|
|
31
32
|
__proto__: null
|
|
@@ -565,7 +566,7 @@ function importNodeModule(name) {
|
|
|
565
566
|
throw new Error('import specifier is required');
|
|
566
567
|
}
|
|
567
568
|
const importModule = new Function('name', `return import(name)`);
|
|
568
|
-
return importModule(name).then((res)=>res
|
|
569
|
+
return importModule(name).then((res)=>res).catch((error)=>{
|
|
569
570
|
console.error(`Error importing module ${name}:`, error);
|
|
570
571
|
throw error;
|
|
571
572
|
});
|
|
@@ -619,6 +620,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
619
620
|
};
|
|
620
621
|
const handleScriptFetch = async (f, urlObj)=>{
|
|
621
622
|
try {
|
|
623
|
+
var _vm_constants;
|
|
622
624
|
const res = await f(urlObj.href);
|
|
623
625
|
const data = await res.text();
|
|
624
626
|
const [path, vm] = await Promise.all([
|
|
@@ -633,7 +635,11 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
|
|
|
633
635
|
};
|
|
634
636
|
const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
|
|
635
637
|
const filename = path.basename(urlObj.pathname);
|
|
636
|
-
|
|
638
|
+
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
639
|
+
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, {
|
|
640
|
+
filename,
|
|
641
|
+
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
|
|
642
|
+
});
|
|
637
643
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
|
|
638
644
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
639
645
|
if (attrs && exportedInterface && attrs['globalName']) {
|
|
@@ -687,4 +693,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
687
693
|
};
|
|
688
694
|
}
|
|
689
695
|
|
|
690
|
-
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 };
|
|
696
|
+
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, 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