@module-federation/runtime 0.1.17 → 0.1.18

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.
@@ -1,4 +1,4 @@
1
- import { o as getRegisteredShare, y as getGlobalShareScope, G as Global, J as nativeGlobal, K as resetFederationGlobalInfo, E as getGlobalFederationInstance, H as setGlobalFederationInstance, F as getGlobalFederationConstructor, C as setGlobalFederationConstructor, l as getInfoWithoutType, u as getGlobalSnapshot, L as getTargetSnapshotInfoByModuleInfo, q as getGlobalSnapshotInfoByModuleInfo, t as setGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, c as getRemoteEntryExports, I as registerGlobalPlugins, g as getGlobalHostPlugins, m as getPreloaded, n as setPreloaded } from './share.esm.js';
1
+ import { p as getRegisteredShare, z as getGlobalShareScope, G as Global, J as nativeGlobal, K as resetFederationGlobalInfo, E as getGlobalFederationInstance, H as setGlobalFederationInstance, F as getGlobalFederationConstructor, C as setGlobalFederationConstructor, m as getInfoWithoutType, v as getGlobalSnapshot, L as getTargetSnapshotInfoByModuleInfo, r as getGlobalSnapshotInfoByModuleInfo, u as setGlobalSnapshotInfoByModuleInfo, t as addGlobalSnapshot, c as getRemoteEntryExports, I as registerGlobalPlugins, g as getGlobalHostPlugins, n as getPreloaded, o as setPreloaded } from './share.esm.js';
2
2
 
3
3
  const ShareUtils = {
4
4
  getRegisteredShare,
package/dist/index.cjs.js CHANGED
@@ -142,7 +142,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
142
142
  `);
143
143
  return entryExports;
144
144
  }).catch((e)=>{
145
- return e;
145
+ throw e;
146
146
  });
147
147
  }
148
148
  return sdk.loadScript(entry, {
@@ -158,7 +158,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
158
158
  `);
159
159
  return entryExports;
160
160
  }).catch((e)=>{
161
- return e;
161
+ throw e;
162
162
  });
163
163
  }
164
164
  function getRemoteEntryUniqueKey(remoteInfo) {
@@ -172,7 +172,10 @@ async function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook
172
172
  return remoteEntryExports;
173
173
  }
174
174
  if (!share.globalLoading[uniqueKey]) {
175
- if (type === 'esm') {
175
+ if ([
176
+ 'esm',
177
+ 'module'
178
+ ].includes(type)) {
176
179
  share.globalLoading[uniqueKey] = loadEsmEntry({
177
180
  entry,
178
181
  remoteEntryExports
@@ -668,7 +671,10 @@ function assignRemoteInfo(remoteInfo, remoteSnapshot) {
668
671
  share.error(`The attribute remoteEntry of ${name} must not be undefined.`);
669
672
  }
670
673
  const { remoteEntry } = remoteSnapshot;
671
- const entryUrl = sdk.getResourceUrl(remoteSnapshot, remoteEntry);
674
+ let entryUrl = sdk.getResourceUrl(remoteSnapshot, remoteEntry);
675
+ if (!share.isBrowserEnv() && !entryUrl.startsWith('http')) {
676
+ entryUrl = `https:${entryUrl}`;
677
+ }
672
678
  remoteInfo.type = remoteSnapshot.remoteEntryType;
673
679
  remoteInfo.entryGlobalName = remoteSnapshot.globalName;
674
680
  remoteInfo.entry = entryUrl;
@@ -1907,7 +1913,7 @@ class FederationHost {
1907
1913
  // maybe will change, temporarily for internal use only
1908
1914
  initContainer: new AsyncWaterfallHook('initContainer')
1909
1915
  });
1910
- this.version = "0.1.17";
1916
+ this.version = "0.1.18";
1911
1917
  this.moduleCache = new Map();
1912
1918
  this.loaderHook = new PluginSystem({
1913
1919
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, c as getRemoteEntryExports, d as assert, s as safeToString, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getInfoWithoutType, m as getPreloaded, n as setPreloaded, o as getRegisteredShare, p as arrayOptions, q as getGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, t as setGlobalSnapshotInfoByModuleInfo, u as getGlobalSnapshot, G as Global, v as formatShareConfigs, x as getTargetSharedOptions, y as getGlobalShareScope, z as addUniqueItem, A as getBuilderId, B as isBrowserEnv$1, C as setGlobalFederationConstructor, E as getGlobalFederationInstance, F as getGlobalFederationConstructor, H as setGlobalFederationInstance } from './share.esm.js';
1
+ import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, c as getRemoteEntryExports, d as assert, s as safeToString, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as isBrowserEnv, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getRegisteredShare, q as arrayOptions, r as getGlobalSnapshotInfoByModuleInfo, t as addGlobalSnapshot, u as setGlobalSnapshotInfoByModuleInfo, v as getGlobalSnapshot, G as Global, x as formatShareConfigs, y as getTargetSharedOptions, z as getGlobalShareScope, A as addUniqueItem, B as getBuilderId, C as setGlobalFederationConstructor, E as getGlobalFederationInstance, F as getGlobalFederationConstructor, H as setGlobalFederationInstance } from './share.esm.js';
2
2
  export { I as registerGlobalPlugins } from './share.esm.js';
3
- import { loadScriptNode, loadScript, composeKeyWithSeparator, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1, isBrowserEnv } from '@module-federation/sdk';
3
+ import { loadScriptNode, loadScript, composeKeyWithSeparator, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1, isBrowserEnv as isBrowserEnv$1 } from '@module-federation/sdk';
4
4
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
5
5
 
6
6
  // Function to match a remote with its name and expose
@@ -140,7 +140,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
140
140
  `);
141
141
  return entryExports;
142
142
  }).catch((e)=>{
143
- return e;
143
+ throw e;
144
144
  });
145
145
  }
146
146
  return loadScript(entry, {
@@ -156,7 +156,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
156
156
  `);
157
157
  return entryExports;
158
158
  }).catch((e)=>{
159
- return e;
159
+ throw e;
160
160
  });
161
161
  }
162
162
  function getRemoteEntryUniqueKey(remoteInfo) {
@@ -170,7 +170,10 @@ async function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook
170
170
  return remoteEntryExports;
171
171
  }
172
172
  if (!globalLoading[uniqueKey]) {
173
- if (type === 'esm') {
173
+ if ([
174
+ 'esm',
175
+ 'module'
176
+ ].includes(type)) {
174
177
  globalLoading[uniqueKey] = loadEsmEntry({
175
178
  entry,
176
179
  remoteEntryExports
@@ -666,7 +669,10 @@ function assignRemoteInfo(remoteInfo, remoteSnapshot) {
666
669
  error(`The attribute remoteEntry of ${name} must not be undefined.`);
667
670
  }
668
671
  const { remoteEntry } = remoteSnapshot;
669
- const entryUrl = getResourceUrl(remoteSnapshot, remoteEntry);
672
+ let entryUrl = getResourceUrl(remoteSnapshot, remoteEntry);
673
+ if (!isBrowserEnv() && !entryUrl.startsWith('http')) {
674
+ entryUrl = `https:${entryUrl}`;
675
+ }
670
676
  remoteInfo.type = remoteSnapshot.remoteEntryType;
671
677
  remoteInfo.entryGlobalName = remoteSnapshot.globalName;
672
678
  remoteInfo.entry = entryUrl;
@@ -1664,7 +1670,7 @@ class RemoteHandler {
1664
1670
  }
1665
1671
  // Set the remote entry to a complete path
1666
1672
  if ('entry' in remote) {
1667
- if (isBrowserEnv() && !remote.entry.startsWith('http')) {
1673
+ if (isBrowserEnv$1() && !remote.entry.startsWith('http')) {
1668
1674
  remote.entry = new URL(remote.entry, window.location.origin).href;
1669
1675
  }
1670
1676
  }
@@ -1905,7 +1911,7 @@ class FederationHost {
1905
1911
  // maybe will change, temporarily for internal use only
1906
1912
  initContainer: new AsyncWaterfallHook('initContainer')
1907
1913
  });
1908
- this.version = "0.1.17";
1914
+ this.version = "0.1.18";
1909
1915
  this.moduleCache = new Map();
1910
1916
  this.loaderHook = new PluginSystem({
1911
1917
  // FIXME: may not be suitable , not open to the public yet
@@ -1926,7 +1932,7 @@ class FederationHost {
1926
1932
  ],
1927
1933
  remotes: [],
1928
1934
  shared: {},
1929
- inBrowser: isBrowserEnv$1()
1935
+ inBrowser: isBrowserEnv()
1930
1936
  };
1931
1937
  this.name = userOptions.name;
1932
1938
  this.options = defaultOptions;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
package/dist/share.cjs.js CHANGED
@@ -190,7 +190,7 @@ function getGlobalFederationConstructor() {
190
190
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
191
191
  if (isDebug) {
192
192
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
193
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.17";
193
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.18";
194
194
  }
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-types
package/dist/share.esm.js CHANGED
@@ -188,7 +188,7 @@ function getGlobalFederationConstructor() {
188
188
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
189
189
  if (isDebug) {
190
190
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
191
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.17";
191
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.18";
192
192
  }
193
193
  }
194
194
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -870,4 +870,4 @@ function getTargetSharedOptions(options) {
870
870
  return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
871
871
  }
872
872
 
873
- export { getBuilderId as A, isBrowserEnv as B, setGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationInstance as E, getGlobalFederationConstructor as F, Global as G, setGlobalFederationInstance as H, registerGlobalPlugins as I, nativeGlobal as J, resetFederationGlobalInfo as K, getTargetSnapshotInfoByModuleInfo as L, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getInfoWithoutType as l, getPreloaded as m, setPreloaded as n, getRegisteredShare as o, arrayOptions as p, getGlobalSnapshotInfoByModuleInfo as q, addGlobalSnapshot as r, safeToString as s, setGlobalSnapshotInfoByModuleInfo as t, getGlobalSnapshot as u, formatShareConfigs as v, warn as w, getTargetSharedOptions as x, getGlobalShareScope as y, addUniqueItem as z };
873
+ export { addUniqueItem as A, getBuilderId as B, setGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationInstance as E, getGlobalFederationConstructor as F, Global as G, setGlobalFederationInstance as H, registerGlobalPlugins as I, nativeGlobal as J, resetFederationGlobalInfo as K, getTargetSnapshotInfoByModuleInfo as L, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, isBrowserEnv as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getRegisteredShare as p, arrayOptions as q, getGlobalSnapshotInfoByModuleInfo as r, safeToString as s, addGlobalSnapshot as t, setGlobalSnapshotInfoByModuleInfo as u, getGlobalSnapshot as v, warn as w, formatShareConfigs as x, getTargetSharedOptions as y, getGlobalShareScope as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -45,6 +45,6 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@module-federation/sdk": "0.1.17"
48
+ "@module-federation/sdk": "0.1.18"
49
49
  }
50
50
  }