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
618
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-20241105061413 to 0.0.0-next-20241105074545

dist/index.esm.mjs

27

dist/index.cjs.js

@@ -603,5 +603,7 @@ 'use strict';

};
const lazyLoaderHookFetch = async (input, init, loaderHook)=>{
const lazyLoaderHookFetch = async (input, init)=>{
// @ts-ignore
const loaderHooks = __webpack_require__.federation.instance.loaderHook;
const hook = (url, init)=>{
return loaderHook.lifecycle.fetch.emit(url, init);
return loaderHooks.lifecycle.fetch.emit(url, init);
};

@@ -615,5 +617,5 @@ const res = await hook(input, init || {});

};
function createScriptNode(url, cb, attrs, loaderHook) {
if (loaderHook == null ? void 0 : loaderHook.createScriptHook) {
const hookResult = loaderHook.createScriptHook(url);
function createScriptNode(url, cb, attrs, createScriptHook) {
if (createScriptHook) {
const hookResult = createScriptHook(url);
if (hookResult && typeof hookResult === 'object' && 'url' in hookResult) {

@@ -632,4 +634,13 @@ url = hookResult.url;

const getFetch = async ()=>{
if (loaderHook == null ? void 0 : loaderHook.fetch) {
return (input, init)=>lazyLoaderHookFetch(input, init, loaderHook);
//@ts-ignore
if (typeof __webpack_require__ !== 'undefined') {
try {
//@ts-ignore
const loaderHooks = __webpack_require__.federation.instance.loaderHook;
if (loaderHooks.lifecycle.fetch) {
return lazyLoaderHookFetch;
}
} catch (e) {
console.warn('federation.instance.loaderHook.lifecycle.fetch failed:', e);
}
}

@@ -701,3 +712,3 @@ return typeof fetch === 'undefined' ? loadNodeFetch() : fetch;

}
}, info.attrs, info.loaderHook);
}, info.attrs, info.createScriptHook);
});

@@ -704,0 +715,0 @@ }

@@ -25,3 +25,3 @@ {

"types": "./dist/index.cjs.d.ts",
"import": "./dist/index.esm.js",
"import": "./dist/index.esm.mjs",
"require": "./dist/index.cjs.js"

@@ -31,3 +31,3 @@ },

"types": "./dist/normalize-webpack-path.cjs.d.ts",
"import": "./dist/normalize-webpack-path.esm.js",
"import": "./dist/normalize-webpack-path.esm.mjs",
"require": "./dist/normalize-webpack-path.cjs.js"

@@ -34,0 +34,0 @@ }

@@ -1,11 +0,6 @@

import { CreateScriptHookNode, FetchHook } from './types';
export declare function createScriptNode(url: string, cb: (error?: Error, scriptContext?: any) => void, attrs?: Record<string, any>, loaderHook?: {
createScriptHook?: CreateScriptHookNode;
fetch?: FetchHook;
}): void;
import { CreateScriptHookNode } from './types';
export declare function createScriptNode(url: string, cb: (error?: Error, scriptContext?: any) => void, attrs?: Record<string, any>, createScriptHook?: CreateScriptHookNode): void;
export declare function loadScriptNode(url: string, info: {
attrs?: Record<string, any>;
loaderHook?: {
createScriptHook?: CreateScriptHookNode;
};
createScriptHook?: CreateScriptHookNode;
}): Promise<void>;

@@ -12,2 +12,1 @@ export type CreateScriptHookReturnNode = {

export type CreateScriptHook = (url: string, attrs?: Record<string, any> | undefined) => CreateScriptHookReturn;
export type FetchHook = (args: [string, RequestInit]) => Promise<Response> | void | false;
{
"name": "@module-federation/sdk",
"version": "0.0.0-next-20241105061413",
"version": "0.0.0-next-20241105074545",
"license": "MIT",

@@ -20,3 +20,3 @@ "description": "A sdk for support module federation",

"main": "./dist/index.cjs.js",
"module": "./dist/index.esm.js",
"module": "./dist/index.esm.mjs",
"types": "./dist/index.cjs.d.ts",

@@ -26,3 +26,3 @@ "exports": {

"types": "./dist/index.cjs.d.ts",
"import": "./dist/index.esm.js",
"import": "./dist/index.esm.mjs",
"require": "./dist/index.cjs.js"

@@ -32,3 +32,3 @@ },

"types": "./dist/normalize-webpack-path.cjs.d.ts",
"import": "./dist/normalize-webpack-path.esm.js",
"import": "./dist/normalize-webpack-path.esm.mjs",
"require": "./dist/normalize-webpack-path.cjs.js"

@@ -35,0 +35,0 @@ }

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