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
630
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-20240930063850 to 0.0.0-next-20240930091801

63

dist/index.cjs.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var polyfills = require('./polyfills.cjs.js');

@@ -72,9 +74,2 @@

const DEBUG_LOG = '[ FEDERATION DEBUG ]';
function safeToString$1(info) {
try {
return JSON.stringify(info, null, 2);
} catch (e) {
return '';
}
}
function safeGetLocalStorageItem() {

@@ -93,3 +88,3 @@ try {

if (this.enable) {
const argsToString = safeToString$1(info) || '';
const argsToString = safeToString(info) || '';
if (isBrowserEnv()) {

@@ -172,3 +167,3 @@ console.info(`%c ${this.identifier}: ${msg} ${argsToString}`, 'color:#3300CC');

const logger = new Logger();
const composeKeyWithSeparator = function(...args) {
const composeKeyWithSeparator = function(...args) {
if (!args.length) {

@@ -187,3 +182,3 @@ return '';

};
const encodeName = function(name, prefix = '', withExt = false) {
const encodeName = function(name, prefix = '', withExt = false) {
try {

@@ -196,3 +191,3 @@ const ext = withExt ? '.js' : '';

};
const decodeName = function(name, prefix, withExt) {
const decodeName = function(name, prefix, withExt) {
try {

@@ -215,3 +210,3 @@ let decodedName = name;

};
const generateExposeFilename = (exposeName, withExt)=>{
const generateExposeFilename = (exposeName, withExt)=>{
if (!exposeName) {

@@ -229,3 +224,3 @@ return '';

};
const generateShareFilename = (pkgName, withExt)=>{
const generateShareFilename = (pkgName, withExt)=>{
if (!pkgName) {

@@ -398,3 +393,3 @@ return '';

remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
remoteSnapshot.ssrRemoteEntryType = ssrRemoteEntry.type || 'commonjs-module';
remoteSnapshot.ssrRemoteEntryType = 'commonjs-module';
}

@@ -446,5 +441,4 @@ return remoteSnapshot;

if (!script) {
const attrs = info.attrs;
script = document.createElement('script');
script.type = (attrs == null ? void 0 : attrs['type']) === 'module' ? 'module' : 'text/javascript';
script.type = 'text/javascript';
script.src = info.url;

@@ -465,2 +459,3 @@ let createScriptRes = undefined;

}
const attrs = info.attrs;
if (attrs && !createScriptRes) {

@@ -656,4 +651,3 @@ Object.keys(attrs).forEach((name)=>{

try {
var //@ts-ignore
_vm_constants;
var _vm_constants;
const res = await f(urlObj.href);

@@ -690,16 +684,3 @@ const data = await res.text();

};
getFetch().then(async (f)=>{
if ((attrs == null ? void 0 : attrs['type']) === 'esm' || (attrs == null ? void 0 : attrs['type']) === 'module') {
return loadModule(urlObj.href, {
fetch: f,
vm: await importNodeModule('vm')
}).then(async (module)=>{
await module.evaluate();
cb(undefined, module.namespace);
}).catch((e)=>{
cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
});
}
handleScriptFetch(f, urlObj);
}).catch((err)=>{
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
cb(err);

@@ -722,20 +703,2 @@ });

}
async function loadModule(url, options) {
const { fetch: fetch1, vm } = options;
const response = await fetch1(url);
const code = await response.text();
const module = new vm.SourceTextModule(code, {
// @ts-ignore
importModuleDynamically: async (specifier, script)=>{
const resolvedUrl = new URL(specifier, url).href;
return loadModule(resolvedUrl, options);
}
});
await module.link(async (specifier)=>{
const resolvedUrl = new URL(specifier, url).href;
const module = await loadModule(resolvedUrl, options);
return module;
});
return module;
}

@@ -742,0 +705,0 @@ function normalizeOptions(enableDefault, defaultOptions, key) {

@@ -70,9 +70,2 @@ import { _ as _extends } from './polyfills.esm.js';

const DEBUG_LOG = '[ FEDERATION DEBUG ]';
function safeToString$1(info) {
try {
return JSON.stringify(info, null, 2);
} catch (e) {
return '';
}
}
function safeGetLocalStorageItem() {

@@ -91,3 +84,3 @@ try {

if (this.enable) {
const argsToString = safeToString$1(info) || '';
const argsToString = safeToString(info) || '';
if (isBrowserEnv()) {

@@ -170,3 +163,3 @@ console.info(`%c ${this.identifier}: ${msg} ${argsToString}`, 'color:#3300CC');

const logger = new Logger();
const composeKeyWithSeparator = function(...args) {
const composeKeyWithSeparator = function(...args) {
if (!args.length) {

@@ -185,3 +178,3 @@ return '';

};
const encodeName = function(name, prefix = '', withExt = false) {
const encodeName = function(name, prefix = '', withExt = false) {
try {

@@ -194,3 +187,3 @@ const ext = withExt ? '.js' : '';

};
const decodeName = function(name, prefix, withExt) {
const decodeName = function(name, prefix, withExt) {
try {

@@ -213,3 +206,3 @@ let decodedName = name;

};
const generateExposeFilename = (exposeName, withExt)=>{
const generateExposeFilename = (exposeName, withExt)=>{
if (!exposeName) {

@@ -227,3 +220,3 @@ return '';

};
const generateShareFilename = (pkgName, withExt)=>{
const generateShareFilename = (pkgName, withExt)=>{
if (!pkgName) {

@@ -396,3 +389,3 @@ return '';

remoteSnapshot.ssrRemoteEntry = fullSSRRemoteEntry;
remoteSnapshot.ssrRemoteEntryType = ssrRemoteEntry.type || 'commonjs-module';
remoteSnapshot.ssrRemoteEntryType = 'commonjs-module';
}

@@ -444,5 +437,4 @@ return remoteSnapshot;

if (!script) {
const attrs = info.attrs;
script = document.createElement('script');
script.type = (attrs == null ? void 0 : attrs['type']) === 'module' ? 'module' : 'text/javascript';
script.type = 'text/javascript';
script.src = info.url;

@@ -463,2 +455,3 @@ let createScriptRes = undefined;

}
const attrs = info.attrs;
if (attrs && !createScriptRes) {

@@ -654,4 +647,3 @@ Object.keys(attrs).forEach((name)=>{

try {
var //@ts-ignore
_vm_constants;
var _vm_constants;
const res = await f(urlObj.href);

@@ -688,16 +680,3 @@ const data = await res.text();

};
getFetch().then(async (f)=>{
if ((attrs == null ? void 0 : attrs['type']) === 'esm' || (attrs == null ? void 0 : attrs['type']) === 'module') {
return loadModule(urlObj.href, {
fetch: f,
vm: await importNodeModule('vm')
}).then(async (module)=>{
await module.evaluate();
cb(undefined, module.namespace);
}).catch((e)=>{
cb(e instanceof Error ? e : new Error(`Script execution error: ${e}`));
});
}
handleScriptFetch(f, urlObj);
}).catch((err)=>{
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
cb(err);

@@ -720,20 +699,2 @@ });

}
async function loadModule(url, options) {
const { fetch: fetch1, vm } = options;
const response = await fetch1(url);
const code = await response.text();
const module = new vm.SourceTextModule(code, {
// @ts-ignore
importModuleDynamically: async (specifier, script)=>{
const resolvedUrl = new URL(specifier, url).href;
return loadModule(resolvedUrl, options);
}
});
await module.link(async (specifier)=>{
const resolvedUrl = new URL(specifier, url).href;
const module = await loadModule(resolvedUrl, options);
return module;
});
return module;
}

@@ -740,0 +701,0 @@ function normalizeOptions(enableDefault, defaultOptions, key) {

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var path = require('path');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
function getWebpackPath(compiler, options = {

@@ -36,3 +42,3 @@ framework: 'other'

if (process.env['FEDERATION_WEBPACK_PATH']) {
return path.resolve(process.env['FEDERATION_WEBPACK_PATH'], fullPath.replace('webpack', '../../'));
return path__default["default"].resolve(process.env['FEDERATION_WEBPACK_PATH'], fullPath.replace('webpack', '../../'));
}

@@ -39,0 +45,0 @@ return fullPath;

{
"name": "@module-federation/sdk",
"version": "0.6.7",
"version": "0.6.6",
"license": "MIT",

@@ -44,2 +44,2 @@ "description": "A sdk for support module federation",

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