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

@artus/core

Package Overview
Dependencies
Maintainers
8
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@artus/core - npm Package Compare versions

Comparing version 2.1.0-alpha.0 to 2.1.0

4

lib/plugin/common.d.ts

@@ -1,5 +0,5 @@

import { PluginType } from './types';
import { LoggerType } from '../logger';
import { PluginType } from "./types";
import { LoggerType } from "../logger";
export declare function sortPlugins(pluginInstanceMap: Map<string, PluginType>, logger: LoggerType): PluginType[];
export declare function getPackagePath(packageName: string, paths?: string[]): string;
export declare function getInlinePackageEntryPath(packagePath: string): Promise<string>;

@@ -8,12 +8,14 @@ "use strict";

function sortPlugins(pluginInstanceMap, logger) {
var _a;
const sortedPlugins = [];
const visited = {};
while (sortedPlugins.length < pluginInstanceMap.size) {
let added = false;
for (const [pluginName, plugin] of pluginInstanceMap) {
if (visited[pluginName]) {
continue;
}
let depsSatisfied = true;
const visit = (pluginName, depChain = []) => {
var _a;
if (depChain.includes(pluginName)) {
throw new Error(`Circular dependency found in plugins: ${depChain.join(", ")}`);
}
if (visited[pluginName])
return;
visited[pluginName] = true;
const plugin = pluginInstanceMap.get(pluginName);
if (plugin) {
for (const dep of (_a = plugin.metadata.dependencies) !== null && _a !== void 0 ? _a : []) {

@@ -29,22 +31,12 @@ const depPlugin = pluginInstanceMap.get(dep.name);

}
else if (!visited[dep.name]) { // Plugin exist and enabled, need check visited
depsSatisfied = false;
else {
// Plugin exist and enabled, need visit
visit(dep.name, depChain.concat(pluginName));
}
}
if (depsSatisfied) {
sortedPlugins.push(plugin);
visited[plugin.name] = true;
added = true;
}
sortedPlugins.push(plugin);
}
if (!added) {
const cyclePluginNames = [];
const sortedPluginSet = new Set(sortedPlugins.map(p => p.name));
for (const pluginName of pluginInstanceMap.keys()) {
if (!sortedPluginSet.has(pluginName)) {
cyclePluginNames.push(pluginName);
}
}
throw new Error(`Circular dependency found in plugins: ${cyclePluginNames.join(', ')}`);
}
};
for (const pluginName of pluginInstanceMap.keys()) {
visit(pluginName);
}

@@ -65,3 +57,3 @@ return sortedPlugins;

const pkgJson = await (0, compatible_require_1.default)(`${packagePath}/package.json`);
let entryFilePath = '';
let entryFilePath = "";
if (pkgJson.exports) {

@@ -71,7 +63,7 @@ if (Array.isArray(pkgJson.exports)) {

}
else if (typeof pkgJson.exports === 'string') {
else if (typeof pkgJson.exports === "string") {
entryFilePath = pkgJson.exports;
}
else if ((_a = pkgJson.exports) === null || _a === void 0 ? void 0 : _a['.']) {
entryFilePath = pkgJson.exports['.'];
else if ((_a = pkgJson.exports) === null || _a === void 0 ? void 0 : _a["."]) {
entryFilePath = pkgJson.exports["."];
}

@@ -83,4 +75,6 @@ }

// will use package root path if no entry file found
return entryFilePath ? path_1.default.resolve(packagePath, entryFilePath, '..') : packagePath;
return entryFilePath
? path_1.default.resolve(packagePath, entryFilePath, "..")
: packagePath;
}
exports.getInlinePackageEntryPath = getInlinePackageEntryPath;
{
"name": "@artus/core",
"version": "2.1.0-alpha.0",
"version": "2.1.0",
"description": "Core package of Artus",

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

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