Socket
Socket
Sign inDemoInstall

@module-federation/node

Package Overview
Dependencies
Maintainers
8
Versions
585
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/node - npm Package Compare versions

Comparing version 0.0.0-next-20240723095610 to 0.0.0-next-20240724103050

dist/src/recordDynamicRemoteEntryHashPlugin.d.ts

32

dist/package.json
{
"public": true,
"name": "@module-federation/node",
"version": "2.4.0",
"version": "2.5.1",
"type": "commonjs",

@@ -14,2 +14,3 @@ "main": "./src/index.js",

"./runtimePlugin": "./dist/src/runtimePlugin.js",
"./record-dynamic-remote-entry-hash-plugin": "./dist/src/recordDynamicRemoteEntryHashPlugin.js",
"./utils": {

@@ -23,2 +24,18 @@ "import": "./dist/src/utils/index.js",

},
"typesVersions": {
"*": {
".": [
"./dist/src/index.d.ts"
],
"runtimePlugin": [
"./dist/src/runtimePlugin.d.ts"
],
"utils": [
"./dist/src/utils/index.d.ts"
],
"record-dynamic-remote-entry-hash-plugin": [
"./dist/src/record-dynamic-remote-entry-hash-plugin.d.ts"
]
}
},
"files": [

@@ -55,2 +72,3 @@ "dist/",

"@types/ws": "8.5.10",
"@vue/tsconfig": "0.5.1",
"adm-zip": "0.5.14",

@@ -76,10 +94,12 @@ "ansi-colors": "4.1.3",

"url": "0.11.3",
"util": "0.12.5",
"vite-plugin-dts": "3.9.1",
"vue": "3.4.30",
"webpack-sources": "3.2.3",
"ws": "8.17.1",
"@module-federation/dts-plugin": "0.2.6",
"@module-federation/managers": "0.2.6",
"@module-federation/manifest": "0.2.6",
"@module-federation/rspack": "0.2.6",
"@module-federation/third-party-dts-extractor": "0.2.6"
"@module-federation/dts-plugin": "0.3.1",
"@module-federation/managers": "0.3.1",
"@module-federation/manifest": "0.3.1",
"@module-federation/rspack": "0.3.1",
"@module-federation/third-party-dts-extractor": "0.3.1"
},

@@ -86,0 +106,0 @@ "peerDependencies": {

@@ -6,1 +6,2 @@ export { default as StreamingTargetPlugin } from './plugins/StreamingTargetPlugin';

export { default as RemotePublicPathPlugin } from './plugins/RemotePublicPathRuntimeModule';
export { default as EntryChunkTrackerPlugin } from './plugins/EntryChunkTrackerPlugin';

4

dist/src/index.js

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.RemotePublicPathPlugin = exports.ChunkCorrelationPlugin = exports.UniversalFederationPlugin = exports.NodeFederationPlugin = exports.StreamingTargetPlugin = void 0;
exports.EntryChunkTrackerPlugin = exports.RemotePublicPathPlugin = exports.ChunkCorrelationPlugin = exports.UniversalFederationPlugin = exports.NodeFederationPlugin = exports.StreamingTargetPlugin = void 0;
var StreamingTargetPlugin_1 = require("./plugins/StreamingTargetPlugin");

@@ -18,2 +18,4 @@ Object.defineProperty(exports, "StreamingTargetPlugin", { enumerable: true, get: function () { return __importDefault(StreamingTargetPlugin_1).default; } });

Object.defineProperty(exports, "RemotePublicPathPlugin", { enumerable: true, get: function () { return __importDefault(RemotePublicPathRuntimeModule_1).default; } });
var EntryChunkTrackerPlugin_1 = require("./plugins/EntryChunkTrackerPlugin");
Object.defineProperty(exports, "EntryChunkTrackerPlugin", { enumerable: true, get: function () { return __importDefault(EntryChunkTrackerPlugin_1).default; } });
//# sourceMappingURL=index.js.map

@@ -29,6 +29,6 @@ "use strict";

globalThis.entryChunkCache = globalThis.entryChunkCache || new Set();
globalThis.entryChunkCache.add(module.filename);
module.filename && globalThis.entryChunkCache.add(module.filename);
if(module.children) {
module.children.forEach(function(c) {
globalThis.entryChunkCache.add(c.filename);
c.filename && globalThis.entryChunkCache.add(c.filename);
})

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

@@ -63,5 +63,10 @@ "use strict";

return Object.keys(__webpack_share_scopes__.default).reduce((acc, key) => {
// @ts-ignore
const shareMap = __webpack_share_scopes__.default[key];
// shareScope may equal undefined or null if it has unexpected value
if (!shareMap || typeof shareMap !== 'object') {
return acc;
}
// Get the loaded modules for the current key
// @ts-ignore
const loadedModules = Object.values(__webpack_share_scopes__.default[key])
const loadedModules = Object.values(shareMap)
// Filter out the modules that are not loaded

@@ -68,0 +73,0 @@ // @ts-ignore

@@ -0,1 +1,4 @@

declare global {
var mfHashMap: Record<string, string> | undefined;
}
export declare const performReload: (shouldReload: any) => Promise<boolean>;

@@ -5,4 +8,5 @@ export declare const checkUnreachableRemote: (remoteScope: any) => boolean;

export declare const checkFakeRemote: (remoteScope: any) => boolean;
export declare const createFetcher: (url: string, fetchModule: any, name: string, cb: (hash: string) => void) => any;
export declare const fetchRemote: (remoteScope: any, fetchModule: any) => Promise<boolean>;
export declare const revalidate: (fetchModule?: any, force?: boolean) => Promise<boolean>;
export declare function getFetchModule(): any;

@@ -6,7 +6,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.revalidate = exports.fetchRemote = exports.checkFakeRemote = exports.checkMedusaConfigChange = exports.checkUnreachableRemote = exports.performReload = void 0;
exports.revalidate = exports.fetchRemote = exports.createFetcher = exports.checkFakeRemote = exports.checkMedusaConfigChange = exports.checkUnreachableRemote = exports.performReload = void 0;
exports.getFetchModule = getFetchModule;
const flush_chunks_1 = require("./flush-chunks");
const hashmap = {};
const crypto_1 = __importDefault(require("crypto"));
const hashmap = globalThis.mfHashMap || {};
const requireCacheRegex = /(remote|server|hot-reload|react-loadable-manifest|runtime|styled-jsx)/;

@@ -17,3 +17,2 @@ const performReload = async (shouldReload) => {

}
const remotesFromAPI = (0, flush_chunks_1.getAllKnownRemotes)();
let req;

@@ -41,7 +40,11 @@ //@ts-ignore

}
//@ts-ignore
__webpack_require__.federation.instance.moduleCache.clear();
gs.__GLOBAL_LOADING_REMOTE_ENTRY__ = {};
//@ts-ignore
gs.__FEDERATION__.__INSTANCES__.map((i) => {
//@ts-ignore
i.moduleCache.forEach((mc) => {
if (mc.remoteInfo && mc.remoteInfo.entryGlobalName) {
delete gs[mc.remoteInfo.entryGlobalName];
}
});
i.moduleCache.clear();

@@ -52,2 +55,4 @@ if (gs[i.name]) {

});
//@ts-ignore
__webpack_require__.federation.instance.moduleCache.clear();
gs.__FEDERATION__.__INSTANCES__ = [];

@@ -113,2 +118,19 @@ for (const entry of entries) {

exports.checkFakeRemote = checkFakeRemote;
const createFetcher = (url, fetchModule, name, cb) => {
return fetchModule(url)
.then((re) => {
if (!re.ok) {
throw new Error(`Error loading remote: status: ${re.status}, content-type: ${re.headers.get('content-type')}`);
}
return re.text();
})
.then((contents) => {
const hash = crypto_1.default.createHash('md5').update(contents).digest('hex');
cb(hash);
})
.catch((e) => {
console.error('Remote', name, url, 'Failed to load or is not online', e);
});
};
exports.createFetcher = createFetcher;
const fetchRemote = (remoteScope, fetchModule) => {

@@ -121,11 +143,3 @@ const fetches = [];

const url = container.entry;
const fetcher = fetchModule(url)
.then((re) => {
if (!re.ok) {
throw new Error(`Error loading remote: status: ${re.status}, content-type: ${re.headers.get('content-type')}`);
}
return re.text();
})
.then((contents) => {
const hash = crypto_1.default.createHash('md5').update(contents).digest('hex');
const fetcher = (0, exports.createFetcher)(url, fetchModule, name, (hash) => {
if (hashmap[name]) {

@@ -136,3 +150,2 @@ if (hashmap[name] !== hash) {

console.log(name, 'hash is different - must hot reload server');
return true;
}

@@ -143,5 +156,2 @@ }

}
})
.catch((e) => {
console.error('Remote', name, url, 'Failed to load or is not online', e);
});

@@ -148,0 +158,0 @@ fetches.push(fetcher);

{
"public": true,
"name": "@module-federation/node",
"version": "0.0.0-next-20240723095610",
"version": "0.0.0-next-20240724103050",
"type": "commonjs",

@@ -14,2 +14,3 @@ "main": "./dist/src/index.js",

"./runtimePlugin": "./dist/src/runtimePlugin.js",
"./record-dynamic-remote-entry-hash-plugin": "./dist/src/recordDynamicRemoteEntryHashPlugin.js",
"./utils": {

@@ -23,2 +24,18 @@ "import": "./dist/src/utils/index.js",

},
"typesVersions": {
"*": {
".": [
"./dist/src/index.d.ts"
],
"runtimePlugin": [
"./dist/src/runtimePlugin.d.ts"
],
"utils": [
"./dist/src/utils/index.d.ts"
],
"record-dynamic-remote-entry-hash-plugin": [
"./dist/src/record-dynamic-remote-entry-hash-plugin.d.ts"
]
}
},
"files": [

@@ -47,6 +64,6 @@ "dist/",

"node-fetch": "2.7.0",
"@module-federation/enhanced": "0.0.0-next-20240723095610",
"@module-federation/sdk": "0.0.0-next-20240723095610",
"@module-federation/utilities": "0.0.0-next-20240723095610",
"@module-federation/runtime": "0.0.0-next-20240723095610"
"@module-federation/enhanced": "0.0.0-next-20240724103050",
"@module-federation/sdk": "0.0.0-next-20240724103050",
"@module-federation/utilities": "0.0.0-next-20240724103050",
"@module-federation/runtime": "0.0.0-next-20240724103050"
},

@@ -53,0 +70,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc