@module-federation/sdk 0.0.0-next-20240305014714 → 0.0.0-next-20240306064226

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
@@ -767,7 +767,8 @@ function createScript(url, cb, attrs, createScriptHook) {
767
767
  needAttach: needAttach
768
768
  };
769
769
  }
770
- function createLink(url, cb, attrs, createLinkHook) {
770
+ function createLink(url, cb) {
771
+ var attrs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, createLinkHook = arguments.length > 3 ? arguments[3] : void 0;
771
772
  // <link rel="preload" href="script.js" as="script">
772
773
  // Retrieve the existing script element by its src attribute
773
774
  var link = null;
@@ -776,7 +777,8 @@ function createLink(url, cb, attrs, createLinkHook) {
776
777
  for(var i = 0; i < links.length; i++){
777
778
  var l = links[i];
778
779
  var linkHref = l.getAttribute("href");
779
- if (linkHref && isStaticResourcesEqual(linkHref, url)) {
780
+ var linkRef = l.getAttribute("ref");
781
+ if (linkHref && isStaticResourcesEqual(linkHref, url) && linkRef === attrs["ref"]) {
780
782
  link = l;
781
783
  needAttach = false;
782
784
  break;
package/dist/index.esm.js CHANGED
@@ -763,7 +763,8 @@ function createScript(url, cb, attrs, createScriptHook) {
763
763
  needAttach: needAttach
764
764
  };
765
765
  }
766
- function createLink(url, cb, attrs, createLinkHook) {
766
+ function createLink(url, cb) {
767
+ var attrs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, createLinkHook = arguments.length > 3 ? arguments[3] : void 0;
767
768
  // <link rel="preload" href="script.js" as="script">
768
769
  // Retrieve the existing script element by its src attribute
769
770
  var link = null;
@@ -772,7 +773,8 @@ function createLink(url, cb, attrs, createLinkHook) {
772
773
  for(var i = 0; i < links.length; i++){
773
774
  var l = links[i];
774
775
  var linkHref = l.getAttribute("href");
775
- if (linkHref && isStaticResourcesEqual(linkHref, url)) {
776
+ var linkRef = l.getAttribute("ref");
777
+ if (linkHref && isStaticResourcesEqual(linkHref, url) && linkRef === attrs["ref"]) {
776
778
  link = l;
777
779
  needAttach = false;
778
780
  break;
package/dist/src/dom.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare function createScript(url: string, cb: (value: void | PromiseLike
4
4
  script: HTMLScriptElement;
5
5
  needAttach: boolean;
6
6
  };
7
- export declare function createLink(url: string, cb: (value: void | PromiseLike<void>) => void, attrs?: Record<string, any>, createLinkHook?: (url: string) => HTMLLinkElement | void): {
7
+ export declare function createLink(url: string, cb: (value: void | PromiseLike<void>) => void, attrs?: Record<string, string>, createLinkHook?: (url: string) => HTMLLinkElement | void): {
8
8
  link: HTMLLinkElement;
9
9
  needAttach: boolean;
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.0-next-20240305014714",
3
+ "version": "0.0.0-next-20240306064226",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [