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.0.0-beta.2 to 2.0.0

1

lib/loader/types.d.ts

@@ -6,2 +6,3 @@ import { Container } from '@artus/injection';

export interface RefMapItem {
relativedPath?: string;
packageVersion?: string;

@@ -8,0 +9,0 @@ pluginMetadata?: PluginMetadata;

26

lib/scanner/impl.js

@@ -9,3 +9,2 @@ "use strict";

const task_1 = require("./task");
const application_1 = require("../application");
class ArtusScanner {

@@ -20,3 +19,2 @@ constructor(options = {}) {

async scan(root) {
var _a;
// make sure the root path is absolute

@@ -26,22 +24,6 @@ if (!path_1.default.isAbsolute(root)) {

}
// Init scan-task queue with a root task
const taskQueue = [];
// Init scan-task scanner
const app = (_a = this.options.app) !== null && _a !== void 0 ? _a : new application_1.ArtusApplication();
const taskRunner = new task_1.ScanTaskRunner(root, app, taskQueue, this.options);
// Add Task of options.plugin
if (this.options.plugin) {
await taskRunner.handlePluginConfig(this.options.plugin, root);
}
// Add Root Task(make it as top/start)
taskQueue.unshift({
curPath: '.',
refName: constant_1.DEFAULT_APP_REF,
isPackage: false,
});
// Run task queue
while (taskQueue.length > 0) {
const taskItem = taskQueue.shift();
await taskRunner.run(taskItem);
}
const taskRunner = new task_1.ScanTaskRunner(root, this.options);
// Start scan
await taskRunner.runAll();
// Dump manifest

@@ -56,4 +38,2 @@ const manifestResult = taskRunner.dump();

}
// Clean up
app.configurationHandler.clearStore();
return manifestResult;

@@ -60,0 +40,0 @@ }

import { ScannerOptions, ScanTaskItem } from './types';
import { Manifest } from '../loader';
import { PluginConfig } from '../plugin';
import { Application } from '../types';
export declare class ScanTaskRunner {
private root;
private app;
private taskQueue;
private options;

@@ -14,3 +11,5 @@ private waitingTaskMap;

private refMap;
constructor(root: string, app: Application, taskQueue: ScanTaskItem[], options: ScannerOptions);
private taskQueue;
private app;
constructor(root: string, options: ScannerOptions);
private walk;

@@ -22,3 +21,4 @@ handlePluginConfig(pluginConfig: PluginConfig, basePath: string, env?: string): Promise<void>;

run(taskItem: ScanTaskItem): Promise<void>;
runAll(): Promise<void>;
dump(): Manifest;
}

@@ -12,7 +12,7 @@ "use strict";

const constant_1 = require("../constant");
const application_1 = require("../application");
class ScanTaskRunner {
constructor(root, app, taskQueue, options) {
constructor(root, options) {
var _a;
this.root = root;
this.app = app;
this.taskQueue = taskQueue;
this.options = options;

@@ -23,2 +23,4 @@ this.waitingTaskMap = new Map(); // Key is pluginName, waiting to detect enabled

this.refMap = {};
this.taskQueue = [];
this.app = (_a = options.app) !== null && _a !== void 0 ? _a : new application_1.ArtusApplication();
}

@@ -148,4 +150,7 @@ /*

if (!path_1.default.isAbsolute(basePath)) {
// basePath must be absolute path
basePath = path_1.default.resolve(this.root, curPath);
}
// pre-scan check for multi-version package
const relativedPath = path_1.default.relative(this.root, basePath);
const packageVersion = await (0, utils_1.getPackageVersion)((refName === constant_1.DEFAULT_APP_REF || !isPackage)

@@ -156,9 +161,15 @@ ? basePath

// Already scanned
if (refName === constant_1.DEFAULT_APP_REF) {
// No need to check app level
return;
}
const refItem = this.refMap[refName];
if (refItem.packageVersion) {
if (packageVersion && packageVersion !== refItem.packageVersion) {
// Do NOT allow multi-version of plugin package
throw new Error(`${refName} has multi version of ${packageVersion}, ${refItem.packageVersion}`);
}
if (refItem.packageVersion && packageVersion && packageVersion !== refItem.packageVersion) {
// Do NOT allow multi-version of plugin package by different version number
throw new Error(`${refName} has multi version of ${packageVersion}, ${refItem.packageVersion}`);
}
if (refItem.relativedPath && relativedPath && relativedPath !== refItem.relativedPath) {
// Do NOT allow multi-version of plugin package by different path
throw new Error(`${refName} has multi path with same version in ${relativedPath} and ${refItem.relativedPath}`);
}
return;

@@ -176,2 +187,3 @@ }

const refItem = {
relativedPath,
packageVersion,

@@ -203,2 +215,21 @@ items: [],

}
async runAll() {
// Add Task of options.plugin
if (this.options.plugin) {
await this.handlePluginConfig(this.options.plugin, this.root);
}
// Add Root Task(make it as top/start)
this.taskQueue.unshift({
curPath: '.',
refName: constant_1.DEFAULT_APP_REF,
isPackage: false,
});
// Run task queue
while (this.taskQueue.length > 0) {
const taskItem = this.taskQueue.shift();
await this.run(taskItem);
}
// Clean up
this.app.configurationHandler.clearStore();
}
dump() {

@@ -205,0 +236,0 @@ return {

{
"name": "@artus/core",
"version": "2.0.0-beta.2",
"version": "2.0.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