Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/sdk

Package Overview
Dependencies
Maintainers
8
Versions
714
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/sdk - npm Package Compare versions

Comparing version 0.0.0-next-20240205081245 to 0.0.0-next-20240205095446

58

dist/index.cjs.js

@@ -760,2 +760,59 @@ 'use strict';

}
function createLink(url, cb, attrs, createLinkHook) {
// <link rel="preload" href="script.js" as="script">
// Retrieve the existing script element by its src attribute
var link = null;
var needAttach = true;
var links = document.getElementsByTagName("link");
for(var i = 0; i < links.length; i++){
var l = links[i];
var linkHref = l.getAttribute("href");
if (linkHref && isStaticResourcesEqual(linkHref, url)) {
link = l;
needAttach = false;
break;
}
}
if (!link) {
link = document.createElement("link");
link.setAttribute("href", url);
if (createLinkHook) {
var createLinkRes = createLinkHook(url);
if (_instanceof(createLinkRes, HTMLLinkElement)) {
link = createLinkRes;
}
}
}
if (attrs) {
Object.keys(attrs).forEach(function(name) {
if (link) {
link.setAttribute(name, attrs[name]);
}
});
}
var onLinkComplete = function(prev, // eslint-disable-next-line @typescript-eslint/no-explicit-any
event) {
// Prevent memory leaks in IE.
if (link) {
link.onerror = null;
link.onload = null;
safeWrapper(function() {
(link === null || link === void 0 ? void 0 : link.parentNode) && link.parentNode.removeChild(link);
});
if (prev) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var res = prev(event);
cb();
return res;
}
}
cb();
};
link.onerror = onLinkComplete.bind(null, link.onerror);
link.onload = onLinkComplete.bind(null, link.onload);
return {
link: link,
needAttach: needAttach
};
}
function loadScript(url, info) {

@@ -1092,2 +1149,3 @@ var attrs = info.attrs, createScriptHook = info.createScriptHook;

exports.composeKeyWithSeparator = composeKeyWithSeparator;
exports.createLink = createLink;
exports.createScript = createScript;

@@ -1094,0 +1152,0 @@ exports.createScriptNode = createScriptNode;

59

dist/index.esm.js

@@ -756,2 +756,59 @@ function _define_property$2(obj, key, value) {

}
function createLink(url, cb, attrs, createLinkHook) {
// <link rel="preload" href="script.js" as="script">
// Retrieve the existing script element by its src attribute
var link = null;
var needAttach = true;
var links = document.getElementsByTagName("link");
for(var i = 0; i < links.length; i++){
var l = links[i];
var linkHref = l.getAttribute("href");
if (linkHref && isStaticResourcesEqual(linkHref, url)) {
link = l;
needAttach = false;
break;
}
}
if (!link) {
link = document.createElement("link");
link.setAttribute("href", url);
if (createLinkHook) {
var createLinkRes = createLinkHook(url);
if (_instanceof(createLinkRes, HTMLLinkElement)) {
link = createLinkRes;
}
}
}
if (attrs) {
Object.keys(attrs).forEach(function(name) {
if (link) {
link.setAttribute(name, attrs[name]);
}
});
}
var onLinkComplete = function(prev, // eslint-disable-next-line @typescript-eslint/no-explicit-any
event) {
// Prevent memory leaks in IE.
if (link) {
link.onerror = null;
link.onload = null;
safeWrapper(function() {
(link === null || link === void 0 ? void 0 : link.parentNode) && link.parentNode.removeChild(link);
});
if (prev) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var res = prev(event);
cb();
return res;
}
}
cb();
};
link.onerror = onLinkComplete.bind(null, link.onerror);
link.onload = onLinkComplete.bind(null, link.onload);
return {
link: link,
needAttach: needAttach
};
}
function loadScript(url, info) {

@@ -1077,2 +1134,2 @@ var attrs = info.attrs, createScriptHook = info.createScriptHook;

export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, NameTransformMap, NameTransformSymbol, SEPARATOR, assert, composeKeyWithSeparator, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, parseEntry, safeWrapper, simpleJoinRemoteEntry, warn };
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, NameTransformMap, NameTransformSymbol, SEPARATOR, assert, composeKeyWithSeparator, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, parseEntry, safeWrapper, simpleJoinRemoteEntry, warn };

@@ -7,2 +7,6 @@ export declare function safeWrapper<T extends (...args: Array<any>) => any>(callback: T, disableWarn?: boolean): Promise<ReturnType<T> | undefined>;

};
export declare function createLink(url: string, cb: (value: void | PromiseLike<void>) => void, attrs?: Record<string, any>, createLinkHook?: (url: string) => HTMLLinkElement | void): {
link: HTMLLinkElement;
needAttach: boolean;
};
export declare function loadScript(url: string, info: {

@@ -9,0 +13,0 @@ attrs?: Record<string, any>;

2

package.json
{
"name": "@module-federation/sdk",
"version": "0.0.0-next-20240205081245",
"version": "0.0.0-next-20240205095446",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A sdk for support module federation",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc