New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/sdk

Package Overview
Dependencies
Maintainers
8
Versions
721
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-20240205220829 to 0.0.0-next-20240223065734

dist/src/types/plugins/ContainerPlugin.d.ts

96

dist/index.cjs.js

@@ -32,3 +32,26 @@ 'use strict';

var SEPARATOR = ":";
var ManifestFileName = "mf-manifest.json";
var StatsFileName = "mf-stats.json";
exports.ModuleType = void 0;
(function(ModuleType) {
ModuleType["NPM"] = "npm";
ModuleType["APP"] = "app";
})(exports.ModuleType || (exports.ModuleType = {}));
var ContainerPlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
var ContainerReferencePlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
var ModuleFederationPlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
var SharePlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
function isBrowserEnv() {

@@ -494,6 +517,7 @@ return typeof window !== "undefined";

};
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchInterface) {
var prefetchInterface = manifest.metaData.prefetchInterface;
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchEntry) {
var _manifest_metaData_prefetchEntry = manifest.metaData.prefetchEntry, path = _manifest_metaData_prefetchEntry.path, name = _manifest_metaData_prefetchEntry.name, type = _manifest_metaData_prefetchEntry.type;
basicRemoteSnapshot = _object_spread_props(_object_spread({}, basicRemoteSnapshot), {
prefetchInterface: prefetchInterface
prefetchEntry: simpleJoinRemoteEntry(path, name),
prefetchEntryType: type
});

@@ -761,2 +785,59 @@ }

}
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) {

@@ -1041,3 +1122,3 @@ var attrs = info.attrs, createScriptHook = info.createScriptHook;

if (attrs && exportedInterface && attrs["globalName"]) {
container = exportedInterface[attrs["globalName"]];
container = exportedInterface[attrs["globalName"]] || exportedInterface;
cb(undefined, container);

@@ -1089,7 +1170,12 @@ return [

exports.MANIFEST_EXT = MANIFEST_EXT;
exports.ManifestFileName = ManifestFileName;
exports.NameTransformMap = NameTransformMap;
exports.NameTransformSymbol = NameTransformSymbol;
exports.SEPARATOR = SEPARATOR;
exports.StatsFileName = StatsFileName;
exports.assert = assert;
exports.composeKeyWithSeparator = composeKeyWithSeparator;
exports.containerPlugin = ContainerPlugin;
exports.containerReferencePlugin = ContainerReferencePlugin;
exports.createLink = createLink;
exports.createScript = createScript;

@@ -1112,5 +1198,7 @@ exports.createScriptNode = createScriptNode;

exports.logger = logger;
exports.moduleFederationPlugin = ModuleFederationPlugin;
exports.parseEntry = parseEntry;
exports.safeWrapper = safeWrapper;
exports.sharePlugin = SharePlugin;
exports.simpleJoinRemoteEntry = simpleJoinRemoteEntry;
exports.warn = warn;

@@ -28,3 +28,26 @@ function _define_property$2(obj, key, value) {

var SEPARATOR = ":";
var ManifestFileName = "mf-manifest.json";
var StatsFileName = "mf-stats.json";
var ModuleType;
(function(ModuleType) {
ModuleType["NPM"] = "npm";
ModuleType["APP"] = "app";
})(ModuleType || (ModuleType = {}));
var ContainerPlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
var ContainerReferencePlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
var ModuleFederationPlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
var SharePlugin = /*#__PURE__*/Object.freeze({
__proto__: null
});
function isBrowserEnv() {

@@ -490,6 +513,7 @@ return typeof window !== "undefined";

};
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchInterface) {
var prefetchInterface = manifest.metaData.prefetchInterface;
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchEntry) {
var _manifest_metaData_prefetchEntry = manifest.metaData.prefetchEntry, path = _manifest_metaData_prefetchEntry.path, name = _manifest_metaData_prefetchEntry.name, type = _manifest_metaData_prefetchEntry.type;
basicRemoteSnapshot = _object_spread_props(_object_spread({}, basicRemoteSnapshot), {
prefetchInterface: prefetchInterface
prefetchEntry: simpleJoinRemoteEntry(path, name),
prefetchEntryType: type
});

@@ -757,2 +781,59 @@ }

}
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) {

@@ -1037,3 +1118,3 @@ var attrs = info.attrs, createScriptHook = info.createScriptHook;

if (attrs && exportedInterface && attrs["globalName"]) {
container = exportedInterface[attrs["globalName"]];
container = exportedInterface[attrs["globalName"]] || exportedInterface;
cb(undefined, container);

@@ -1079,2 +1160,2 @@ return [

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, ManifestFileName, ModuleType, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };

2

dist/package.json
{
"name": "@module-federation/sdk",
"version": "0.0.10",
"version": "0.0.13",
"license": "MIT",

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

@@ -17,1 +17,7 @@ export declare const FederationModuleManifest = "federation-manifest.json";

export declare const SEPARATOR = ":";
export declare const ManifestFileName = "mf-manifest.json";
export declare const StatsFileName = "mf-stats.json";
export declare enum ModuleType {
NPM = "npm",
APP = "app"
}

@@ -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>;

@@ -5,1 +5,2 @@ export * from './common';

export * from './snapshot';
export * from './plugins';

@@ -30,3 +30,4 @@ import { RemoteEntryType, StatsAssets } from './stats';

}>;
prefetchInterface?: boolean;
prefetchEntry?: string;
prefetchEntryType?: RemoteEntryType;
}

@@ -33,0 +34,0 @@ interface BasicProviderModuleInfoWithPublicPath extends BasicProviderModuleInfo {

@@ -0,1 +1,2 @@

import { ModuleType } from '../constant';
import type { RemoteWithEntry, RemoteWithVersion } from './common';

@@ -17,4 +18,6 @@ export type RemoteEntryType = 'esm' | 'global';

remoteEntry: ResourceInfo;
prefetchInterface: boolean;
prefetchEntry?: ResourceInfo;
types: Omit<ResourceInfo, 'type'>;
type: ModuleType;
pluginVersion: string;
}

@@ -59,3 +62,3 @@ type StatsMetaDataWithGetPublicPath<T = BasicStatsMetaData> = T & {

name: string;
file: string;
file: string[];
}

@@ -62,0 +65,0 @@ export interface ManifestModuleInfos {

{
"name": "@module-federation/sdk",
"version": "0.0.0-next-20240205220829",
"version": "0.0.0-next-20240223065734",
"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