@module-federation/sdk 0.1.19 → 0.1.20

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
@@ -256,6 +256,12 @@ var parseEntry = function(str, devVerOrUrl) {
256
256
  // Check if the string starts with a type
257
257
  if (strSplit.length >= 2) {
258
258
  var _strSplit = _to_array(strSplit), name = _strSplit[0], versionOrEntryArr = _strSplit.slice(1);
259
+ if (str.startsWith(separator)) {
260
+ versionOrEntryArr = [
261
+ devVersionOrUrl || strSplit.slice(-1)[0]
262
+ ];
263
+ name = strSplit.slice(0, -1).join(separator);
264
+ }
259
265
  var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator);
260
266
  if (isEntry(versionOrEntry)) {
261
267
  return {
@@ -630,6 +636,10 @@ function _object_spread$1(target) {
630
636
  }
631
637
  return target;
632
638
  }
639
+ function _type_of$2(obj) {
640
+ "@swc/helpers - typeof";
641
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
642
+ }
633
643
  function _ts_generator$1(thisArg, body) {
634
644
  var f, y, t, g, _ = {
635
645
  label: 0,
@@ -798,7 +808,7 @@ function createScript(info) {
798
808
  var createScriptRes = info.createScriptHook(info.url);
799
809
  if (_instanceof(createScriptRes, HTMLScriptElement)) {
800
810
  script = createScriptRes;
801
- } else if (typeof createScriptRes === 'object') {
811
+ } else if ((typeof createScriptRes === "undefined" ? "undefined" : _type_of$2(createScriptRes)) === 'object') {
802
812
  if (createScriptRes.script) script = createScriptRes.script;
803
813
  if (createScriptRes.timeout) timeout = createScriptRes.timeout;
804
814
  }
@@ -809,7 +819,8 @@ function createScript(info) {
809
819
  if (script) {
810
820
  if (name === 'async' || name === 'defer') {
811
821
  script[name] = attrs[name];
812
- } else {
822
+ // Attributes that do not exist are considered overridden
823
+ } else if (!script.getAttribute(name)) {
813
824
  script.setAttribute(name, attrs[name]);
814
825
  }
815
826
  }
@@ -878,7 +889,7 @@ function createLink(info) {
878
889
  var attrs = info.attrs;
879
890
  if (attrs) {
880
891
  Object.keys(attrs).forEach(function(name) {
881
- if (link) {
892
+ if (link && !link.getAttribute(name)) {
882
893
  link.setAttribute(name, attrs[name]);
883
894
  }
884
895
  });
@@ -996,6 +1007,10 @@ function _non_iterable_rest() {
996
1007
  function _sliced_to_array(arr, i) {
997
1008
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
998
1009
  }
1010
+ function _type_of$1(obj) {
1011
+ "@swc/helpers - typeof";
1012
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1013
+ }
999
1014
  function _unsupported_iterable_to_array(o, minLen) {
1000
1015
  if (!o) return;
1001
1016
  if (typeof o === "string") return _array_like_to_array(o, minLen);
@@ -1114,7 +1129,7 @@ function importNodeModule(name) {
1114
1129
  function createScriptNode(url, cb, attrs, createScriptHook) {
1115
1130
  if (createScriptHook) {
1116
1131
  var hookResult = createScriptHook(url);
1117
- if (hookResult && typeof hookResult === 'object' && 'url' in hookResult) {
1132
+ if (hookResult && (typeof hookResult === "undefined" ? "undefined" : _type_of$1(hookResult)) === 'object' && 'url' in hookResult) {
1118
1133
  url = hookResult.url;
1119
1134
  }
1120
1135
  }
@@ -1286,7 +1301,7 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
1286
1301
  if (options === true) {
1287
1302
  return defaultOptions;
1288
1303
  }
1289
- if (options && typeof options === 'object') {
1304
+ if (options && (typeof options === "undefined" ? "undefined" : _type_of(options)) === 'object') {
1290
1305
  return _object_spread({}, defaultOptions, options);
1291
1306
  }
1292
1307
  throw new Error("Unexpected type for `".concat(key, "`, expect boolean/undefined/object, got: ").concat(typeof options === "undefined" ? "undefined" : _type_of(options)));
package/dist/index.esm.js CHANGED
@@ -252,6 +252,12 @@ var parseEntry = function(str, devVerOrUrl) {
252
252
  // Check if the string starts with a type
253
253
  if (strSplit.length >= 2) {
254
254
  var _strSplit = _to_array(strSplit), name = _strSplit[0], versionOrEntryArr = _strSplit.slice(1);
255
+ if (str.startsWith(separator)) {
256
+ versionOrEntryArr = [
257
+ devVersionOrUrl || strSplit.slice(-1)[0]
258
+ ];
259
+ name = strSplit.slice(0, -1).join(separator);
260
+ }
255
261
  var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator);
256
262
  if (isEntry(versionOrEntry)) {
257
263
  return {
@@ -626,6 +632,10 @@ function _object_spread$1(target) {
626
632
  }
627
633
  return target;
628
634
  }
635
+ function _type_of$2(obj) {
636
+ "@swc/helpers - typeof";
637
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
638
+ }
629
639
  function _ts_generator$1(thisArg, body) {
630
640
  var f, y, t, g, _ = {
631
641
  label: 0,
@@ -794,7 +804,7 @@ function createScript(info) {
794
804
  var createScriptRes = info.createScriptHook(info.url);
795
805
  if (_instanceof(createScriptRes, HTMLScriptElement)) {
796
806
  script = createScriptRes;
797
- } else if (typeof createScriptRes === 'object') {
807
+ } else if ((typeof createScriptRes === "undefined" ? "undefined" : _type_of$2(createScriptRes)) === 'object') {
798
808
  if (createScriptRes.script) script = createScriptRes.script;
799
809
  if (createScriptRes.timeout) timeout = createScriptRes.timeout;
800
810
  }
@@ -805,7 +815,8 @@ function createScript(info) {
805
815
  if (script) {
806
816
  if (name === 'async' || name === 'defer') {
807
817
  script[name] = attrs[name];
808
- } else {
818
+ // Attributes that do not exist are considered overridden
819
+ } else if (!script.getAttribute(name)) {
809
820
  script.setAttribute(name, attrs[name]);
810
821
  }
811
822
  }
@@ -874,7 +885,7 @@ function createLink(info) {
874
885
  var attrs = info.attrs;
875
886
  if (attrs) {
876
887
  Object.keys(attrs).forEach(function(name) {
877
- if (link) {
888
+ if (link && !link.getAttribute(name)) {
878
889
  link.setAttribute(name, attrs[name]);
879
890
  }
880
891
  });
@@ -992,6 +1003,10 @@ function _non_iterable_rest() {
992
1003
  function _sliced_to_array(arr, i) {
993
1004
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
994
1005
  }
1006
+ function _type_of$1(obj) {
1007
+ "@swc/helpers - typeof";
1008
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1009
+ }
995
1010
  function _unsupported_iterable_to_array(o, minLen) {
996
1011
  if (!o) return;
997
1012
  if (typeof o === "string") return _array_like_to_array(o, minLen);
@@ -1110,7 +1125,7 @@ function importNodeModule(name) {
1110
1125
  function createScriptNode(url, cb, attrs, createScriptHook) {
1111
1126
  if (createScriptHook) {
1112
1127
  var hookResult = createScriptHook(url);
1113
- if (hookResult && typeof hookResult === 'object' && 'url' in hookResult) {
1128
+ if (hookResult && (typeof hookResult === "undefined" ? "undefined" : _type_of$1(hookResult)) === 'object' && 'url' in hookResult) {
1114
1129
  url = hookResult.url;
1115
1130
  }
1116
1131
  }
@@ -1282,7 +1297,7 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
1282
1297
  if (options === true) {
1283
1298
  return defaultOptions;
1284
1299
  }
1285
- if (options && typeof options === 'object') {
1300
+ if (options && (typeof options === "undefined" ? "undefined" : _type_of(options)) === 'object') {
1286
1301
  return _object_spread({}, defaultOptions, options);
1287
1302
  }
1288
1303
  throw new Error("Unexpected type for `".concat(key, "`, expect boolean/undefined/object, got: ").concat(typeof options === "undefined" ? "undefined" : _type_of(options)));
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
@@ -82,6 +82,7 @@ export interface PluginManifestOptions {
82
82
  export interface PluginDevOptions {
83
83
  disableLiveReload?: boolean;
84
84
  disableHotTypesReload?: boolean;
85
+ disableDynamicRemoteTypeHints?: boolean;
85
86
  }
86
87
  export interface DtsHostOptions {
87
88
  typesFolder?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [