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

@originjs/vite-plugin-federation

Package Overview
Dependencies
Maintainers
5
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@originjs/vite-plugin-federation - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

24

dist/index.js

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

const federation_fn_import = "import { satisfy } from '__federation_fn_satisfy'\n\n// eslint-disable-next-line no-undef\nconst moduleMap = __rf_var__moduleMap\nconst moduleCache = Object.create(null)\nasync function importShared(name, shareScope = 'default') {\n return moduleCache[name]\n ? new Promise((r) => r(moduleCache[name]))\n : (await getSharedFromRuntime(name, shareScope)) || getSharedFromLocal(name)\n}\n// eslint-disable-next-line\nasync function __federation_import(name) {\n return import(name)\n}\nasync function getSharedFromRuntime(name, shareScope) {\n let module = null\n if (globalThis?.__federation_shared__?.[shareScope]?.[name]) {\n const versionObj = globalThis.__federation_shared__[shareScope][name]\n const versionKey = Object.keys(versionObj)[0]\n const versionValue = Object.values(versionObj)[0]\n if (moduleMap[name]?.requiredVersion) {\n // judge version satisfy\n if (satisfy(versionKey, moduleMap[name].requiredVersion)) {\n module = await (await versionValue.get())()\n } else {\n console.log(\n `provider support ${name}(${versionKey}) is not satisfied requiredVersion(\\${moduleMap[name].requiredVersion})`\n )\n }\n } else {\n module = await (await versionValue.get())()\n }\n }\n if (module) {\n if (module.default) module = module.default\n moduleCache[name] = module\n return module\n }\n}\nasync function getSharedFromLocal(name) {\n if (moduleMap[name]?.import) {\n let module = await (await moduleMap[name].get())()\n if (module.default) module = module.default\n moduleCache[name] = module\n return module\n } else {\n console.error(\n `consumer config import=false,so cant use callback shared module`\n )\n }\n}\nexport {\n importShared,\n getSharedFromRuntime as importSharedRuntime,\n getSharedFromLocal as importSharedLocal\n}\n";
const sharedFilePathReg = /__federation_shared_.+\.js$/;
const sharedFilePathReg = /__federation_shared_(.+)\.js$/;
function prodSharedPlugin(options) {

@@ -696,3 +696,3 @@ parsedOptions.prodShared = parseSharedOptions(options);

parsedOptions.prodShared.forEach(
(value) => shareName2Prop.set(value[0], value[1])
(value) => shareName2Prop.set(removeNonRegLetter(value[0], NAME_CHAR_REG), value[1])
);

@@ -714,3 +714,3 @@ let isHost;

(item) => {
return !shareName2Prop.has(item);
return !shareName2Prop.has(removeNonRegLetter(item, NAME_CHAR_REG));
}

@@ -828,2 +828,3 @@ );

generateBundle(options2, bundle) {
var _a;
if (!isRemote) {

@@ -836,5 +837,7 @@ return;

if (chunk.type === "chunk") {
const removeSharedChunk = !isHost && sharedFilePathReg.test(chunk.fileName) && shareName2Prop.has(chunk.name) && !shareName2Prop.get(chunk.name).generate;
if (removeSharedChunk) {
needRemoveShared.add(key);
if (!isHost) {
const regRst = sharedFilePathReg.exec(chunk.fileName);
if (regRst && ((_a = shareName2Prop.get(regRst[1])) == null ? void 0 : _a.generate) === false) {
needRemoveShared.add(key);
}
}

@@ -1342,7 +1345,2 @@ }

const port = serverConfiguration.port ?? 5173;
const regExp = new RegExp(
`${normalizePath(viteDevServer.config.root)}[/\\\\]`
);
let cacheDir = viteDevServer.config.cacheDir;
cacheDir = `${cacheDir === null || cacheDir === void 0 ? "node_modules/.vite" : normalizePath(cacheDir).split(regExp)[1]}`;
const res = [];

@@ -1365,3 +1363,3 @@ if (shared.length) {

const address = serverConfiguration.origin ?? `${protocol}://${resolveHost(serverConfiguration)}:${port}`;
const url = relativePath ? `'${address}${relativePath}'` : `'${address}/${cacheDir}/${sharedName}.js?'`;
const url = relativePath ? `'${address}${relativePath}'` : `'${address}/@fs/${moduleInfo.id}'`;
str += `get:()=> get(${url}, ${REMOTE_FROM_PARAMETER})`;

@@ -1445,3 +1443,3 @@ res.push(`'${sharedName}':{'${obj.version}':{${str}}}`);

var _a, _b;
options.mode = env.mode;
options.mode = options.mode ?? env.mode;
registerPlugins(options.mode, env.command);

@@ -1448,0 +1446,0 @@ registerCount++;

{
"name": "@originjs/vite-plugin-federation",
"version": "1.2.2",
"version": "1.2.3",
"description": "A Vite plugin which support Module Federation.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

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