@module-federation/sdk 0.0.0-next-20240814104132 → 0.0.0-next-20240815094326
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 +5 -7
- package/dist/index.esm.js +5 -7
- package/dist/package.json +1 -1
- package/dist/src/dom.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -435,9 +435,8 @@ function createScript(info) {
|
|
|
435
435
|
script = document.createElement('script');
|
|
436
436
|
script.type = 'text/javascript';
|
|
437
437
|
script.src = info.url;
|
|
438
|
-
let createScriptRes = undefined;
|
|
439
438
|
if (info.createScriptHook) {
|
|
440
|
-
createScriptRes = info.createScriptHook(info.url, info.attrs);
|
|
439
|
+
const createScriptRes = info.createScriptHook(info.url, info.attrs);
|
|
441
440
|
if (createScriptRes instanceof HTMLScriptElement) {
|
|
442
441
|
script = createScriptRes;
|
|
443
442
|
} else if (typeof createScriptRes === 'object') {
|
|
@@ -446,7 +445,7 @@ function createScript(info) {
|
|
|
446
445
|
}
|
|
447
446
|
}
|
|
448
447
|
const attrs = info.attrs;
|
|
449
|
-
if (attrs
|
|
448
|
+
if (attrs) {
|
|
450
449
|
Object.keys(attrs).forEach((name)=>{
|
|
451
450
|
if (script) {
|
|
452
451
|
if (name === 'async' || name === 'defer') {
|
|
@@ -512,15 +511,14 @@ function createLink(info) {
|
|
|
512
511
|
if (!link) {
|
|
513
512
|
link = document.createElement('link');
|
|
514
513
|
link.setAttribute('href', info.url);
|
|
515
|
-
let createLinkRes = undefined;
|
|
516
|
-
const attrs = info.attrs;
|
|
517
514
|
if (info.createLinkHook) {
|
|
518
|
-
createLinkRes = info.createLinkHook(info.url
|
|
515
|
+
const createLinkRes = info.createLinkHook(info.url);
|
|
519
516
|
if (createLinkRes instanceof HTMLLinkElement) {
|
|
520
517
|
link = createLinkRes;
|
|
521
518
|
}
|
|
522
519
|
}
|
|
523
|
-
|
|
520
|
+
const attrs = info.attrs;
|
|
521
|
+
if (attrs) {
|
|
524
522
|
Object.keys(attrs).forEach((name)=>{
|
|
525
523
|
if (link && !link.getAttribute(name)) {
|
|
526
524
|
link.setAttribute(name, attrs[name]);
|
package/dist/index.esm.js
CHANGED
|
@@ -431,9 +431,8 @@ function createScript(info) {
|
|
|
431
431
|
script = document.createElement('script');
|
|
432
432
|
script.type = 'text/javascript';
|
|
433
433
|
script.src = info.url;
|
|
434
|
-
let createScriptRes = undefined;
|
|
435
434
|
if (info.createScriptHook) {
|
|
436
|
-
createScriptRes = info.createScriptHook(info.url, info.attrs);
|
|
435
|
+
const createScriptRes = info.createScriptHook(info.url, info.attrs);
|
|
437
436
|
if (createScriptRes instanceof HTMLScriptElement) {
|
|
438
437
|
script = createScriptRes;
|
|
439
438
|
} else if (typeof createScriptRes === 'object') {
|
|
@@ -442,7 +441,7 @@ function createScript(info) {
|
|
|
442
441
|
}
|
|
443
442
|
}
|
|
444
443
|
const attrs = info.attrs;
|
|
445
|
-
if (attrs
|
|
444
|
+
if (attrs) {
|
|
446
445
|
Object.keys(attrs).forEach((name)=>{
|
|
447
446
|
if (script) {
|
|
448
447
|
if (name === 'async' || name === 'defer') {
|
|
@@ -508,15 +507,14 @@ function createLink(info) {
|
|
|
508
507
|
if (!link) {
|
|
509
508
|
link = document.createElement('link');
|
|
510
509
|
link.setAttribute('href', info.url);
|
|
511
|
-
let createLinkRes = undefined;
|
|
512
|
-
const attrs = info.attrs;
|
|
513
510
|
if (info.createLinkHook) {
|
|
514
|
-
createLinkRes = info.createLinkHook(info.url
|
|
511
|
+
const createLinkRes = info.createLinkHook(info.url);
|
|
515
512
|
if (createLinkRes instanceof HTMLLinkElement) {
|
|
516
513
|
link = createLinkRes;
|
|
517
514
|
}
|
|
518
515
|
}
|
|
519
|
-
|
|
516
|
+
const attrs = info.attrs;
|
|
517
|
+
if (attrs) {
|
|
520
518
|
Object.keys(attrs).forEach((name)=>{
|
|
521
519
|
if (link && !link.getAttribute(name)) {
|
|
522
520
|
link.setAttribute(name, attrs[name]);
|
package/dist/package.json
CHANGED
package/dist/src/dom.d.ts
CHANGED
|
@@ -19,12 +19,12 @@ export declare function createLink(info: {
|
|
|
19
19
|
cb: (value: void | PromiseLike<void>) => void;
|
|
20
20
|
attrs: Record<string, string>;
|
|
21
21
|
needDeleteLink?: boolean;
|
|
22
|
-
createLinkHook?: (url: string
|
|
22
|
+
createLinkHook?: (url: string) => HTMLLinkElement | void;
|
|
23
23
|
}): {
|
|
24
24
|
link: HTMLLinkElement;
|
|
25
25
|
needAttach: boolean;
|
|
26
26
|
};
|
|
27
27
|
export declare function loadScript(url: string, info: {
|
|
28
28
|
attrs?: Record<string, any>;
|
|
29
|
-
createScriptHook?: (url: string, attrs?: Record<string, any>) => CreateScriptHookReturn;
|
|
29
|
+
createScriptHook?: (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturn;
|
|
30
30
|
}): Promise<void>;
|