@module-federation/sdk
Advanced tools
Comparing version 0.0.0-next-20241212123451 to 0.0.0-next-20241213035213
@@ -425,3 +425,3 @@ 'use strict'; | ||
let needAttach = true; | ||
let timeout = 60000; | ||
let timeout = 20000; | ||
let timeoutId; | ||
@@ -474,10 +474,4 @@ const scripts = document.getElementsByTagName('script'); | ||
event)=>{ | ||
var _info_cb; | ||
clearTimeout(timeoutId); | ||
const onScriptCompleteCallback = ()=>{ | ||
if (event.type === 'error') { | ||
(info == null ? void 0 : info.onErrorCallback) && (info == null ? void 0 : info.onErrorCallback(event)); | ||
} else { | ||
(info == null ? void 0 : info.cb) && (info == null ? void 0 : info.cb()); | ||
} | ||
}; | ||
// Prevent memory leaks in IE. | ||
@@ -494,13 +488,15 @@ if (script) { | ||
if (prev && typeof prev === 'function') { | ||
var _info_cb1; | ||
const result = prev(event); | ||
if (result instanceof Promise) { | ||
var _info_cb2; | ||
const res = await result; | ||
onScriptCompleteCallback(); | ||
info == null ? void 0 : (_info_cb2 = info.cb) == null ? void 0 : _info_cb2.call(info); | ||
return res; | ||
} | ||
onScriptCompleteCallback(); | ||
info == null ? void 0 : (_info_cb1 = info.cb) == null ? void 0 : _info_cb1.call(info); | ||
return result; | ||
} | ||
} | ||
onScriptCompleteCallback(); | ||
info == null ? void 0 : (_info_cb = info.cb) == null ? void 0 : _info_cb.call(info); | ||
}; | ||
@@ -554,9 +550,2 @@ script.onerror = onScriptComplete.bind(null, script.onerror); | ||
event)=>{ | ||
const onLinkCompleteCallback = ()=>{ | ||
if (event.type === 'error') { | ||
(info == null ? void 0 : info.onErrorCallback) && (info == null ? void 0 : info.onErrorCallback(event)); | ||
} else { | ||
(info == null ? void 0 : info.cb) && (info == null ? void 0 : info.cb()); | ||
} | ||
}; | ||
// Prevent memory leaks in IE. | ||
@@ -575,7 +564,7 @@ if (link) { | ||
const res = prev(event); | ||
onLinkCompleteCallback(); | ||
info.cb(); | ||
return res; | ||
} | ||
} | ||
onLinkCompleteCallback(); | ||
info.cb(); | ||
}; | ||
@@ -591,7 +580,6 @@ link.onerror = onLinkComplete.bind(null, link.onerror); | ||
const { attrs = {}, createScriptHook } = info; | ||
return new Promise((resolve, reject)=>{ | ||
return new Promise((resolve, _reject)=>{ | ||
const { script, needAttach } = createScript({ | ||
url, | ||
cb: resolve, | ||
onErrorCallback: reject, | ||
attrs: polyfills._extends({ | ||
@@ -598,0 +586,0 @@ fetchpriority: 'high' |
@@ -7,3 +7,2 @@ import { CreateScriptHookDom } from './types'; | ||
cb?: (value: void | PromiseLike<void>) => void; | ||
onErrorCallback?: (error: Error) => void; | ||
attrs?: Record<string, any>; | ||
@@ -18,4 +17,3 @@ needDeleteScript?: boolean; | ||
url: string; | ||
cb?: (value: void | PromiseLike<void>) => void; | ||
onErrorCallback?: (error: Error) => void; | ||
cb: (value: void | PromiseLike<void>) => void; | ||
attrs: Record<string, string>; | ||
@@ -22,0 +20,0 @@ needDeleteLink?: boolean; |
{ | ||
"name": "@module-federation/sdk", | ||
"version": "0.0.0-next-20241212123451", | ||
"version": "0.0.0-next-20241213035213", | ||
"license": "MIT", | ||
@@ -14,2 +14,7 @@ "description": "A sdk for support module federation", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/module-federation/core/", | ||
"directory": "packages/sdk" | ||
}, | ||
"publishConfig": { | ||
@@ -16,0 +21,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
16
103348
2611