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

@oclif/config

Package Overview
Dependencies
Maintainers
8
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/config - npm Package Compare versions

Comparing version 1.18.1 to 1.18.2

44

lib/plugin.js

@@ -33,4 +33,22 @@ "use strict";

}
// eslint-disable-next-line valid-jsdoc
// essentially just "cd .."
function* up(from) {
while (path.dirname(from) !== from) {
yield from;
from = path.dirname(from);
}
yield from;
}
async function findSourcesRoot(root) {
for (const next of up(root)) {
const cur = path.join(next, 'package.json');
// eslint-disable-next-line no-await-in-loop
if (await util_2.exists(cur))
return path.dirname(cur);
}
}
/**
* @returns string
* @param name string
* @param root string
* find package root

@@ -40,13 +58,6 @@ * for packages installed into node_modules this will go up directories until

*
* This is needed because of the deduping npm does
* This is needed because some oclif plugins do not declare the `main` field in their package.json
* https://github.com/oclif/config/pull/289#issuecomment-983904051
*/
async function findRoot(name, root) {
// essentially just "cd .."
function* up(from) {
while (path.dirname(from) !== from) {
yield from;
from = path.dirname(from);
}
yield from;
}
async function findRootLegacy(name, root) {
for (const next of up(root)) {

@@ -75,2 +86,13 @@ let cur;

}
async function findRoot(name, root) {
if (name) {
let pkgPath;
try {
pkgPath = util_2.resolvePackage(name, { paths: [__dirname, root] });
}
catch (error) { }
return pkgPath ? findSourcesRoot(path.dirname(pkgPath)) : findRootLegacy(name, root);
}
return findSourcesRoot(root);
}
class Plugin {

@@ -77,0 +99,0 @@ // eslint-disable-next-line no-useless-constructor

@@ -8,4 +8,7 @@ export declare function flatMap<T, U>(arr: T[], fn: (i: T) => U[]): U[];

export declare function exists(path: string): Promise<boolean>;
export declare function resolvePackage(id: string, paths: {
paths: string[];
}): string;
export declare function loadJSON(path: string): Promise<any>;
export declare function compact<T>(a: (T | undefined)[]): T[];
export declare function uniq<T>(arr: T[]): T[];

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

exports.exists = exists;
function resolvePackage(id, paths) {
return require.resolve(id, paths);
}
exports.resolvePackage = resolvePackage;
function loadJSON(path) {

@@ -23,0 +27,0 @@ debug('loadJSON %s', path);

{
"name": "@oclif/config",
"description": "base config object and standard interfaces for oclif components",
"version": "1.18.1",
"version": "1.18.2",
"author": "Jeff Dickey @jdxcode",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/config/issues",

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