@module-federation/runtime 0.0.0-next-20240812084439 → 0.0.0-next-20240812114132

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
@@ -642,18 +642,20 @@ useLinkPreload = true) {
642
642
  }
643
643
  });
644
644
  if (useLinkPreload) {
645
+ const defaultAttrs = {
646
+ rel: 'preload',
647
+ as: 'style',
648
+ crossorigin: 'anonymous'
649
+ };
645
650
  cssAssets.forEach((cssUrl)=>{
646
651
  const { link: cssEl, needAttach } = sdk.createLink({
647
652
  url: cssUrl,
648
653
  cb: ()=>{},
649
- attrs: {
650
- rel: 'preload',
651
- as: 'style',
652
- crossorigin: 'anonymous'
653
- },
654
- createLinkHook: (url)=>{
654
+ attrs: defaultAttrs,
655
+ createLinkHook: (url, attrs)=>{
655
656
  const res = host.loaderHook.lifecycle.createLink.emit({
656
- url
657
+ url,
658
+ attrs
657
659
  });
658
660
  if (res instanceof HTMLLinkElement) {
659
661
  return res;
@@ -664,17 +666,19 @@ useLinkPreload = true) {
664
666
  needAttach && document.head.appendChild(cssEl);
665
667
  });
666
668
  } else {
669
+ const defaultAttrs = {
670
+ rel: 'stylesheet',
671
+ type: 'text/css'
672
+ };
667
673
  cssAssets.forEach((cssUrl)=>{
668
674
  const { link: cssEl, needAttach } = sdk.createLink({
669
675
  url: cssUrl,
670
676
  cb: ()=>{},
671
- attrs: {
672
- rel: 'stylesheet',
673
- type: 'text/css'
674
- },
675
- createLinkHook: (url)=>{
677
+ attrs: defaultAttrs,
678
+ createLinkHook: (url, attrs)=>{
676
679
  const res = host.loaderHook.lifecycle.createLink.emit({
677
- url
680
+ url,
681
+ attrs
678
682
  });
679
683
  if (res instanceof HTMLLinkElement) {
680
684
  return res;
@@ -687,18 +691,20 @@ useLinkPreload = true) {
687
691
  });
688
692
  }
689
693
  if (useLinkPreload) {
694
+ const defaultAttrs = {
695
+ rel: 'preload',
696
+ as: 'script',
697
+ crossorigin: 'anonymous'
698
+ };
690
699
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
691
700
  const { link: linkEl, needAttach } = sdk.createLink({
692
701
  url: jsUrl,
693
702
  cb: ()=>{},
694
- attrs: {
695
- rel: 'preload',
696
- as: 'script',
697
- crossorigin: 'anonymous'
698
- },
699
- createLinkHook: (url)=>{
703
+ attrs: defaultAttrs,
704
+ createLinkHook: (url, attrs)=>{
700
705
  const res = host.loaderHook.lifecycle.createLink.emit({
701
- url
706
+ url,
707
+ attrs
702
708
  });
703
709
  if (res instanceof HTMLLinkElement) {
704
710
  return res;
@@ -709,14 +715,15 @@ useLinkPreload = true) {
709
715
  needAttach && document.head.appendChild(linkEl);
710
716
  });
711
717
  } else {
718
+ const defaultAttrs = {
719
+ fetchpriority: 'high',
720
+ type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
721
+ };
712
722
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
713
723
  const { script: scriptEl, needAttach } = sdk.createScript({
714
724
  url: jsUrl,
715
725
  cb: ()=>{},
716
- attrs: {
717
- fetchpriority: 'high',
718
- type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
719
- },
726
+ attrs: defaultAttrs,
720
727
  createScriptHook: (url, attrs)=>{
721
728
  const res = host.loaderHook.lifecycle.createScript.emit({
722
729
  url,
package/dist/index.esm.js CHANGED
@@ -640,18 +640,20 @@ useLinkPreload = true) {
640
640
  }
641
641
  });
642
642
  if (useLinkPreload) {
643
+ const defaultAttrs = {
644
+ rel: 'preload',
645
+ as: 'style',
646
+ crossorigin: 'anonymous'
647
+ };
643
648
  cssAssets.forEach((cssUrl)=>{
644
649
  const { link: cssEl, needAttach } = createLink({
645
650
  url: cssUrl,
646
651
  cb: ()=>{},
647
- attrs: {
648
- rel: 'preload',
649
- as: 'style',
650
- crossorigin: 'anonymous'
651
- },
652
- createLinkHook: (url)=>{
652
+ attrs: defaultAttrs,
653
+ createLinkHook: (url, attrs)=>{
653
654
  const res = host.loaderHook.lifecycle.createLink.emit({
654
- url
655
+ url,
656
+ attrs
655
657
  });
656
658
  if (res instanceof HTMLLinkElement) {
657
659
  return res;
@@ -662,17 +664,19 @@ useLinkPreload = true) {
662
664
  needAttach && document.head.appendChild(cssEl);
663
665
  });
664
666
  } else {
667
+ const defaultAttrs = {
668
+ rel: 'stylesheet',
669
+ type: 'text/css'
670
+ };
665
671
  cssAssets.forEach((cssUrl)=>{
666
672
  const { link: cssEl, needAttach } = createLink({
667
673
  url: cssUrl,
668
674
  cb: ()=>{},
669
- attrs: {
670
- rel: 'stylesheet',
671
- type: 'text/css'
672
- },
673
- createLinkHook: (url)=>{
675
+ attrs: defaultAttrs,
676
+ createLinkHook: (url, attrs)=>{
674
677
  const res = host.loaderHook.lifecycle.createLink.emit({
675
- url
678
+ url,
679
+ attrs
676
680
  });
677
681
  if (res instanceof HTMLLinkElement) {
678
682
  return res;
@@ -685,18 +689,20 @@ useLinkPreload = true) {
685
689
  });
686
690
  }
687
691
  if (useLinkPreload) {
692
+ const defaultAttrs = {
693
+ rel: 'preload',
694
+ as: 'script',
695
+ crossorigin: 'anonymous'
696
+ };
688
697
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
689
698
  const { link: linkEl, needAttach } = createLink({
690
699
  url: jsUrl,
691
700
  cb: ()=>{},
692
- attrs: {
693
- rel: 'preload',
694
- as: 'script',
695
- crossorigin: 'anonymous'
696
- },
697
- createLinkHook: (url)=>{
701
+ attrs: defaultAttrs,
702
+ createLinkHook: (url, attrs)=>{
698
703
  const res = host.loaderHook.lifecycle.createLink.emit({
699
- url
704
+ url,
705
+ attrs
700
706
  });
701
707
  if (res instanceof HTMLLinkElement) {
702
708
  return res;
@@ -707,14 +713,15 @@ useLinkPreload = true) {
707
713
  needAttach && document.head.appendChild(linkEl);
708
714
  });
709
715
  } else {
716
+ const defaultAttrs = {
717
+ fetchpriority: 'high',
718
+ type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
719
+ };
710
720
  jsAssetsWithoutEntry.forEach((jsUrl)=>{
711
721
  const { script: scriptEl, needAttach } = createScript({
712
722
  url: jsUrl,
713
723
  cb: ()=>{},
714
- attrs: {
715
- fetchpriority: 'high',
716
- type: (remoteInfo == null ? void 0 : remoteInfo.type) === 'module' ? 'module' : 'text/javascript'
717
- },
724
+ attrs: defaultAttrs,
718
725
  createScriptHook: (url, attrs)=>{
719
726
  const res = host.loaderHook.lifecycle.createScript.emit({
720
727
  url,
@@ -55,6 +55,7 @@ export declare class FederationHost {
55
55
  }], CreateScriptHookReturn>;
56
56
  createLink: SyncHook<[{
57
57
  url: string;
58
+ attrs?: Record<string, any>;
58
59
  }], void | HTMLLinkElement>;
59
60
  fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
60
61
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20240812084439",
3
+ "version": "0.0.0-next-20240812114132",
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.0.0-next-20240812084439"
48
+ "@module-federation/sdk": "0.0.0-next-20240812114132"
49
49
  }
50
50
  }