@module-federation/sdk 0.2.5 → 0.2.6

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 CHANGED
@@ -569,7 +569,7 @@ function importNodeModule(name) {
569
569
  throw new Error('import specifier is required');
570
570
  }
571
571
  const importModule = new Function('name', `return import(name)`);
572
- return importModule(name).then((res)=>res.default).catch((error)=>{
572
+ return importModule(name).then((res)=>res).catch((error)=>{
573
573
  console.error(`Error importing module ${name}:`, error);
574
574
  throw error;
575
575
  });
@@ -623,6 +623,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
623
623
  };
624
624
  const handleScriptFetch = async (f, urlObj)=>{
625
625
  try {
626
+ var _vm_constants;
626
627
  const res = await f(urlObj.href);
627
628
  const data = await res.text();
628
629
  const [path, vm] = await Promise.all([
@@ -637,7 +638,11 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
637
638
  };
638
639
  const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
639
640
  const filename = path.basename(urlObj.pathname);
640
- const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, filename);
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
+ });
641
646
  script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
642
647
  const exportedInterface = scriptContext.module.exports || scriptContext.exports;
643
648
  if (attrs && exportedInterface && attrs['globalName']) {
package/dist/index.esm.js CHANGED
@@ -565,7 +565,7 @@ function importNodeModule(name) {
565
565
  throw new Error('import specifier is required');
566
566
  }
567
567
  const importModule = new Function('name', `return import(name)`);
568
- return importModule(name).then((res)=>res.default).catch((error)=>{
568
+ return importModule(name).then((res)=>res).catch((error)=>{
569
569
  console.error(`Error importing module ${name}:`, error);
570
570
  throw error;
571
571
  });
@@ -619,6 +619,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
619
619
  };
620
620
  const handleScriptFetch = async (f, urlObj)=>{
621
621
  try {
622
+ var _vm_constants;
622
623
  const res = await f(urlObj.href);
623
624
  const data = await res.text();
624
625
  const [path, vm] = await Promise.all([
@@ -633,7 +634,11 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
633
634
  };
634
635
  const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/');
635
636
  const filename = path.basename(urlObj.pathname);
636
- const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}\n})`, filename);
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
+ });
637
642
  script.runInThisContext()(scriptContext.exports, scriptContext.module, eval('require'), urlDirname, filename);
638
643
  const exportedInterface = scriptContext.module.exports || scriptContext.exports;
639
644
  if (attrs && exportedInterface && attrs['globalName']) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [