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

dist/index.esm.d.ts

63

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

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

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

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

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

@@ -167,3 +172,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) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

};
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
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)=>{
cb(err);

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

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

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

@@ -70,2 +70,9 @@ 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() {

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

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

@@ -163,3 +170,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) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

};
getFetch().then((f)=>handleScriptFetch(f, urlObj)).catch((err)=>{
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)=>{
cb(err);

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

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

@@ -701,0 +740,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 = {

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

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

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

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

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

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