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

@module-federation/runtime

Package Overview
Dependencies
Maintainers
7
Versions
616
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/runtime - npm Package Compare versions

Comparing version 1.0.0-canary.1 to 1.0.0-canary.2

4

package.json
{
"name": "@module-federation/runtime",
"version": "1.0.0-canary.1",
"version": "1.0.0-canary.2",
"author": "zhouxiao <codingzx@gmail.com>",

@@ -32,3 +32,3 @@ "type": "commonjs",

"type": [
"./types.cjs.d.ts"
"./type.cjs.d.ts"
]

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

@@ -100,6 +100,6 @@ 'use strict';

const REG_EXP = /^(https?:)?\/\//i;
// Convert both url1 and url2 to relative paths
// Transform url1 and url2 into relative paths
const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\/$/, '');
const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\/$/, '');
// Determines whether relative paths are equal
// Check if the relative paths are identical
return relativeUrl1 === relativeUrl2;

@@ -111,5 +111,5 @@ }

const nativeGlobal = new Function('return this')();
// Avoid being windowed by some microfront end frameworks, but sandbox escapes due to reuse policies
// The sandbox in the microfront does not copy the value of configurable
// If no loading content exists on the global object, the loading object is defined
// This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
// The sandbox in the microfrontend does not replicate the value of 'configurable'.
// If there is no loading content on the global object, this section defines the loading object.
if (!Object.hasOwnProperty.call(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {

@@ -189,3 +189,3 @@ Object.defineProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {

Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.1';
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '1.0.0-canary.1';
}

@@ -195,14 +195,6 @@ }

function getInfoWithoutType(target, key, getModuleInfoHook) {
let res;
if (target[key]) {
res = {
value: target[key],
key: key
};
} else {
res = {
value: undefined,
key: key
};
}
let res = {
value: target[key],
key: key
};
if (getModuleInfoHook) {

@@ -216,6 +208,6 @@ const hookRes = getModuleInfoHook(target, key);

const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{
// remote include in hostSnapshot
// Check if the remote is included in the hostSnapshot
const moduleKey = getFMId(moduleInfo);
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey, getModuleInfoHook).value;
// remoteSnapshot may don't include version
// The remoteSnapshot might not include a version
if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) {

@@ -227,4 +219,3 @@ getModuleInfo.version = moduleInfo['version'];

}
// remote don't include in hostSnapshot
// deploy micro app snapshot
// If the remote is not included in the hostSnapshot, deploy a micro app snapshot
if ('version' in moduleInfo && moduleInfo['version']) {

@@ -251,5 +242,6 @@ const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [

return ()=>{
Object.keys(moduleInfos).forEach((key)=>{
const keys = Object.keys(moduleInfos);
for (const key of keys){
delete Global.__FEDERATION__.moduleInfo[key];
});
}
};

@@ -265,3 +257,6 @@ };

};
// global hooks
// This function is used to register global plugins.
// It iterates over the provided plugins and checks if they are already registered.
// If a plugin is not registered, it is added to the global plugins.
// If a plugin is already registered, a warning message is logged.
const registerGlobalPlugins = (plugins)=>{

@@ -707,4 +702,4 @@ const { __GLOBAL_PLUGIN__ } = Global.__FEDERATION__;

}
// Information about sharing
// TODO: Add strictVersion for consistency with mf.
// Details about shared resources
// TODO: Implement strictVersion for alignment with module federation.
function getGlobalShare(pkgName, shareInfo) {

@@ -724,3 +719,3 @@ const globalShares = Global.__FEDERATION__.__SHARE__;

if (typeof requiredVersion === 'string' && !satisfy(singletonVersion, requiredVersion)) {
warn(`Unsatisfied version ${singletonVersion} from ${singletonVersion && globalShares[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} (${shareInfo.from} required ${requiredVersion})`);
warn(`Version ${singletonVersion} from ${singletonVersion && globalShares[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
}

@@ -727,0 +722,0 @@ return globalShares[sc][pkgName][singletonVersion];

@@ -98,6 +98,6 @@ function _extends() {

const REG_EXP = /^(https?:)?\/\//i;
// Convert both url1 and url2 to relative paths
// Transform url1 and url2 into relative paths
const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\/$/, '');
const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\/$/, '');
// Determines whether relative paths are equal
// Check if the relative paths are identical
return relativeUrl1 === relativeUrl2;

@@ -109,5 +109,5 @@ }

const nativeGlobal = new Function('return this')();
// Avoid being windowed by some microfront end frameworks, but sandbox escapes due to reuse policies
// The sandbox in the microfront does not copy the value of configurable
// If no loading content exists on the global object, the loading object is defined
// This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
// The sandbox in the microfrontend does not replicate the value of 'configurable'.
// If there is no loading content on the global object, this section defines the loading object.
if (!Object.hasOwnProperty.call(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {

@@ -187,3 +187,3 @@ Object.defineProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {

Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.1';
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '1.0.0-canary.1';
}

@@ -193,14 +193,6 @@ }

function getInfoWithoutType(target, key, getModuleInfoHook) {
let res;
if (target[key]) {
res = {
value: target[key],
key: key
};
} else {
res = {
value: undefined,
key: key
};
}
let res = {
value: target[key],
key: key
};
if (getModuleInfoHook) {

@@ -214,6 +206,6 @@ const hookRes = getModuleInfoHook(target, key);

const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{
// remote include in hostSnapshot
// Check if the remote is included in the hostSnapshot
const moduleKey = getFMId(moduleInfo);
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey, getModuleInfoHook).value;
// remoteSnapshot may don't include version
// The remoteSnapshot might not include a version
if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) {

@@ -225,4 +217,3 @@ getModuleInfo.version = moduleInfo['version'];

}
// remote don't include in hostSnapshot
// deploy micro app snapshot
// If the remote is not included in the hostSnapshot, deploy a micro app snapshot
if ('version' in moduleInfo && moduleInfo['version']) {

@@ -249,5 +240,6 @@ const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [

return ()=>{
Object.keys(moduleInfos).forEach((key)=>{
const keys = Object.keys(moduleInfos);
for (const key of keys){
delete Global.__FEDERATION__.moduleInfo[key];
});
}
};

@@ -263,3 +255,6 @@ };

};
// global hooks
// This function is used to register global plugins.
// It iterates over the provided plugins and checks if they are already registered.
// If a plugin is not registered, it is added to the global plugins.
// If a plugin is already registered, a warning message is logged.
const registerGlobalPlugins = (plugins)=>{

@@ -705,4 +700,4 @@ const { __GLOBAL_PLUGIN__ } = Global.__FEDERATION__;

}
// Information about sharing
// TODO: Add strictVersion for consistency with mf.
// Details about shared resources
// TODO: Implement strictVersion for alignment with module federation.
function getGlobalShare(pkgName, shareInfo) {

@@ -722,3 +717,3 @@ const globalShares = Global.__FEDERATION__.__SHARE__;

if (typeof requiredVersion === 'string' && !satisfy(singletonVersion, requiredVersion)) {
warn(`Unsatisfied version ${singletonVersion} from ${singletonVersion && globalShares[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} (${shareInfo.from} required ${requiredVersion})`);
warn(`Version ${singletonVersion} from ${singletonVersion && globalShares[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
}

@@ -725,0 +720,0 @@ return globalShares[sc][pkgName][singletonVersion];

@@ -104,5 +104,5 @@ import type { ModuleInfo, GlobalModuleInfo } from '@module-federation/sdk';

/**
* The sharing init sequence function (only runs once per share scope).
* Has one argument, the name of the share scope.
* Creates a share scope if not existing
* This function initializes the sharing sequence (executed only once per share scope).
* It accepts one argument, the name of the share scope.
* If the share scope does not exist, it creates one.
*/

@@ -109,0 +109,0 @@ initializeSharing(shareScopeName?: string): boolean | Promise<boolean>;

import { SyncHook } from './syncHook';
export declare function checkReturnData(originData: any, returnData: any): boolean;
export declare function checkReturnData(originalData: any, returnedData: any): boolean;
export declare class SyncWaterfallHook<T extends Record<string, any>> extends SyncHook<[

@@ -4,0 +4,0 @@ T

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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