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

@oclif/core

Package Overview
Dependencies
Maintainers
2
Versions
416
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core - npm Package Compare versions

Comparing version 3.21.2 to 3.22.0

1

lib/config/config.js

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

force: opts?.force ?? false,
pluginAdditions: this.options.pluginAdditions,
rootPlugin: this.rootPlugin,

@@ -354,0 +355,0 @@ userPlugins: this.options.userPlugins,

@@ -13,2 +13,7 @@ import { PJSON } from '../interfaces';

userPlugins?: boolean;
pluginAdditions?: {
core?: string[];
dev?: string[];
path?: string;
};
};

@@ -15,0 +20,0 @@ type PluginsMap = Map<string, IPlugin>;

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

Object.defineProperty(exports, "__esModule", { value: true });
const minimatch_1 = require("minimatch");
const node_path_1 = require("node:path");

@@ -35,2 +36,5 @@ const performance_1 = require("../performance");

const debug = (0, util_2.Debug)();
function findMatchingDependencies(dependencies, patterns) {
return Object.keys(dependencies).filter((p) => patterns.some((w) => (0, minimatch_1.minimatch)(p, w)));
}
class PluginLoader {

@@ -80,5 +84,20 @@ options;

async loadCorePlugins(opts) {
if (opts.rootPlugin.pjson.oclif.plugins) {
await this.loadPlugins(opts.rootPlugin.root, 'core', opts.rootPlugin.pjson.oclif.plugins);
const { plugins: corePlugins } = opts.rootPlugin.pjson.oclif;
if (corePlugins) {
const plugins = findMatchingDependencies(opts.rootPlugin.pjson.dependencies ?? {}, corePlugins);
await this.loadPlugins(opts.rootPlugin.root, 'core', plugins);
}
const { core: pluginAdditionsCore, path } = opts.pluginAdditions ?? { core: [] };
if (pluginAdditionsCore) {
if (path) {
// If path is provided, load plugins from the path
const pjson = await (0, fs_1.readJson)((0, node_path_1.join)(path, 'package.json'));
const plugins = findMatchingDependencies(pjson.dependencies ?? {}, pluginAdditionsCore);
await this.loadPlugins(path, 'core', plugins);
}
else {
const plugins = findMatchingDependencies(opts.rootPlugin.pjson.dependencies ?? {}, pluginAdditionsCore);
await this.loadPlugins(opts.rootPlugin.root, 'core', plugins);
}
}
}

@@ -92,4 +111,22 @@ async loadDevPlugins(opts) {

const { devPlugins } = opts.rootPlugin.pjson.oclif;
if (devPlugins)
await this.loadPlugins(opts.rootPlugin.root, 'dev', devPlugins);
if (devPlugins) {
const allDeps = { ...opts.rootPlugin.pjson.dependencies, ...opts.rootPlugin.pjson.devDependencies };
const plugins = findMatchingDependencies(allDeps ?? {}, devPlugins);
await this.loadPlugins(opts.rootPlugin.root, 'dev', plugins);
}
const { dev: pluginAdditionsDev, path } = opts.pluginAdditions ?? { core: [] };
if (pluginAdditionsDev) {
if (path) {
// If path is provided, load plugins from the path
const pjson = await (0, fs_1.readJson)((0, node_path_1.join)(path, 'package.json'));
const allDeps = { ...pjson.dependencies, ...pjson.devDependencies };
const plugins = findMatchingDependencies(allDeps ?? {}, pluginAdditionsDev);
await this.loadPlugins(path, 'dev', plugins);
}
else {
const allDeps = { ...opts.rootPlugin.pjson.dependencies, ...opts.rootPlugin.pjson.devDependencies };
const plugins = findMatchingDependencies(allDeps ?? {}, pluginAdditionsDev);
await this.loadPlugins(opts.rootPlugin.root, 'dev', plugins);
}
}
}

@@ -143,3 +180,9 @@ catch (error) {

}
await this.loadPlugins(instance.root, type, instance.pjson.oclif.plugins || [], instance);
if (instance.pjson.oclif.plugins) {
const allDeps = type === 'dev'
? { ...instance.pjson.dependencies, ...instance.pjson.devDependencies }
: instance.pjson.dependencies;
const plugins = findMatchingDependencies(allDeps ?? {}, instance.pjson.oclif.plugins);
await this.loadPlugins(instance.root, type, plugins, instance);
}
}

@@ -146,0 +189,0 @@ catch (error) {

@@ -25,2 +25,7 @@ import { Command } from '../command';

pjson?: PJSON.Plugin;
pluginAdditions?: {
core?: string[];
dev?: string[];
path?: string;
};
plugins?: Map<string, Plugin>;

@@ -27,0 +32,0 @@ userPlugins?: boolean;

3

package.json
{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "3.21.2",
"version": "3.22.0",
"author": "Salesforce",

@@ -24,2 +24,3 @@ "bugs": "https://github.com/oclif/core/issues",

"js-yaml": "^3.14.1",
"minimatch": "^9.0.3",
"natural-orderby": "^2.0.3",

@@ -26,0 +27,0 @@ "object-treeify": "^1.1.33",

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