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 1.0.3 to 1.0.4-alpha.0

1

lib/constant.js

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

'exception-filter',
'plugin-config',
'plugin-meta',

@@ -55,0 +54,0 @@ 'framework-config',

9

lib/loader/impl/config.js

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

const config_file_meta_1 = require("../utils/config_file_meta");
const plugin_1 = require("../../plugin");
let ConfigLoader = class ConfigLoader {

@@ -24,3 +25,2 @@ constructor(container) {

return (this.isConfigDir(opts) &&
!(0, utils_1.isMatch)(opts.filename, constant_1.PLUGIN_CONFIG_PATTERN) &&
!(0, utils_1.isMatch)(opts.filename, constant_1.FRAMEWORK_PATTERN));

@@ -35,4 +35,9 @@ }

let configObj = await this.loadConfigFile(item);
if (namespace) {
if (namespace === 'plugin') {
configObj = {
plugin: await plugin_1.PluginFactory.formatPluginConfig(configObj, item),
};
}
else if (namespace) {
configObj = {
[namespace]: configObj,

@@ -39,0 +44,0 @@ };

@@ -7,5 +7,4 @@ import ModuleLoader from './module';

import PluginMetaLoader from './plugin_meta';
import PluginConfigLoader from './plugin_config';
import FrameworkConfigLoader from './framework_config';
import PackageLoader from './package';
export { ModuleLoader, ConfigLoader, ExceptionLoader, ExceptionFilterLoader, LifecycleLoader, PluginMetaLoader, PluginConfigLoader, FrameworkConfigLoader, PackageLoader, };
export { ModuleLoader, ConfigLoader, ExceptionLoader, ExceptionFilterLoader, LifecycleLoader, PluginMetaLoader, FrameworkConfigLoader, PackageLoader, };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PackageLoader = exports.FrameworkConfigLoader = exports.PluginConfigLoader = exports.PluginMetaLoader = exports.LifecycleLoader = exports.ExceptionFilterLoader = exports.ExceptionLoader = exports.ConfigLoader = exports.ModuleLoader = void 0;
exports.PackageLoader = exports.FrameworkConfigLoader = exports.PluginMetaLoader = exports.LifecycleLoader = exports.ExceptionFilterLoader = exports.ExceptionLoader = exports.ConfigLoader = exports.ModuleLoader = void 0;
const tslib_1 = require("tslib");

@@ -17,4 +17,2 @@ const module_1 = tslib_1.__importDefault(require("./module"));

exports.PluginMetaLoader = plugin_meta_1.default;
const plugin_config_1 = tslib_1.__importDefault(require("./plugin_config"));
exports.PluginConfigLoader = plugin_config_1.default;
const framework_config_1 = tslib_1.__importDefault(require("./framework_config"));

@@ -21,0 +19,0 @@ exports.FrameworkConfigLoader = framework_config_1.default;

import { PluginType } from './types';
export declare function topologicalSort(pluginInstanceMap: Map<string, PluginType>, pluginDepEdgeList: [string, string][]): string[];
export declare function getPackagePath(packageName: string, paths?: string[]): string;
export declare function getInlinePackageEntryPath(packagePath: string): Promise<string>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPackagePath = exports.topologicalSort = void 0;
exports.getInlinePackageEntryPath = exports.getPackagePath = exports.topologicalSort = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const compatible_require_1 = tslib_1.__importDefault(require("../utils/compatible_require"));
// A utils function that toplogical sort plugins

@@ -42,1 +43,23 @@ function topologicalSort(pluginInstanceMap, pluginDepEdgeList) {

exports.getPackagePath = getPackagePath;
async function getInlinePackageEntryPath(packagePath) {
var _a;
const pkgJson = await (0, compatible_require_1.default)(`${packagePath}/package.json`);
let entryFilePath = '';
if (pkgJson.exports) {
if (Array.isArray(pkgJson.exports)) {
throw new Error(`inline package multi exports is not supported`);
}
else if (typeof pkgJson.exports === 'string') {
entryFilePath = pkgJson.exports;
}
else if ((_a = pkgJson.exports) === null || _a === void 0 ? void 0 : _a['.']) {
entryFilePath = pkgJson.exports['.'];
}
}
if (!entryFilePath && pkgJson.main) {
entryFilePath = pkgJson.main;
}
// will use package root path if no entry file found
return entryFilePath ? path_1.default.resolve(packagePath, entryFilePath, '..') : packagePath;
}
exports.getInlinePackageEntryPath = getInlinePackageEntryPath;

@@ -0,1 +1,2 @@

import { ManifestItem } from '../loader';
import { PluginConfigItem, PluginCreateOptions, PluginType } from './types';

@@ -5,2 +6,3 @@ export declare class PluginFactory {

static createFromConfig(config: Record<string, PluginConfigItem>, opts?: PluginCreateOptions): Promise<PluginType[]>;
static formatPluginConfig(config: Record<string, PluginConfigItem>, manifestItem?: ManifestItem): Promise<Record<string, PluginConfigItem>>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginFactory = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const common_1 = require("./common");
const impl_1 = require("./impl");
const fs_1 = require("../utils/fs");
class PluginFactory {

@@ -33,3 +36,25 @@ static async create(name, item, opts) {

}
static async formatPluginConfig(config, manifestItem) {
var _a;
const newConfig = {};
const loaderState = manifestItem === null || manifestItem === void 0 ? void 0 : manifestItem.loaderState;
for (const pluginName of Object.keys(config)) {
const pluginConfigItem = config[pluginName];
if (pluginConfigItem.package) {
// convert package to path when load plugin config
if (pluginConfigItem.path) {
throw new Error(`Plugin ${pluginName} config can't have both package and path at ${(_a = manifestItem === null || manifestItem === void 0 ? void 0 : manifestItem.path) !== null && _a !== void 0 ? _a : 'UNKNOWN_PATH'}`);
}
pluginConfigItem.path = (0, common_1.getPackagePath)(pluginConfigItem.package, [loaderState === null || loaderState === void 0 ? void 0 : loaderState.baseDir]);
delete pluginConfigItem.package;
}
else if (pluginConfigItem.path && await (0, fs_1.exists)(path_1.default.resolve(pluginConfigItem.path, 'package.json'))) {
// plugin path is a npm package, need resolve main file
pluginConfigItem.path = await (0, common_1.getInlinePackageEntryPath)(pluginConfigItem.path);
}
newConfig[pluginName] = pluginConfigItem;
}
return newConfig;
}
}
exports.PluginFactory = PluginFactory;

@@ -229,6 +229,2 @@ "use strict";

return items.filter(item => {
// remove PluginConfig to avoid re-merge on application running
if (item.loader === 'plugin-config') {
return false;
}
// remove other env config

@@ -235,0 +231,0 @@ if (item.loader === 'config' || item.loader === 'framework-config') {

{
"name": "@artus/core",
"version": "1.0.3",
"version": "1.0.4-alpha.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