Socket
Socket
Sign inDemoInstall

@pagedip/util-resolve

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pagedip/util-resolve - npm Package Compare versions

Comparing version 1.0.0-rc.3 to 1.0.0-rc.4

86

index.js

@@ -13,2 +13,12 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var asyncGenerator = function () {

@@ -158,3 +168,3 @@ function AwaitValue(value) {

let loadLerna = (() => {
var loadLerna = function () {
var _ref = asyncToGenerator(function* () {

@@ -170,3 +180,3 @@ if (lernapkgs != null) return lernapkgs;

const lernafile = yield findUp("lerna.json", { cwd: __dirname });
var lernafile = yield findUp("lerna.json", { cwd: __dirname });
if (!lernafile) return lernapkgs = false;

@@ -187,5 +197,5 @@

};
})();
}();
let resolve$1 = (() => {
var resolve$1 = function () {
var _ref2 = asyncToGenerator(function* (name, opts) {

@@ -208,11 +218,11 @@ if (typeof name !== "string" || !name) return;

};
})();
}();
let lerna;
let lernapkgs;
var lerna = void 0;
var lernapkgs = void 0;
exports.isPath = `^\\.{1,2}\\${path.sep}?$|^\\.{1,2}\\${path.sep}|^\\${path.sep}`;
if (path.sep === "\\") exports.isPath += `|^[a-z]:\\${path.sep}`;
exports.isPath = "^\\.{1,2}\\" + path.sep + "?$|^\\.{1,2}\\" + path.sep + "|^\\" + path.sep;
if (path.sep === "\\") exports.isPath += "|^[a-z]:\\" + path.sep;
exports.isPath = new RegExp(exports.isPath, "i");
var index = (() => {
var index = (function () {
var _ref3 = asyncToGenerator(function* (name, opts) {

@@ -222,25 +232,27 @@ if (typeof name !== "string" || !name) return;

opts = opts || {};
const logger = Logger.default(opts.logger, "resolve");
const leads = opts.leads || [""];
const isFilePath = exports.isPath.test(name);
var logger = Logger.default(opts.logger, "resolve");
var leads = opts.leads || [""];
var isFilePath = exports.isPath.test(name);
logger.debug("resolving '%s'", name);
const ls = yield loadLerna();
var ls = yield loadLerna();
for (let i = 0; i < leads.length; i++) {
var _loop = function* _loop(i) {
// don't try leads on file paths
if (leads[i] && isFilePath) continue;
const fullname = leads[i] + name;
if (leads[i] && isFilePath) return "continue";
var fullname = leads[i] + name;
// load local lerna module
if (ls) {
let pkg;
var pkg = void 0;
if (isFilePath) {
const fullPath = path.resolve(ls.repository.rootPath, fullname);
pkg = ls.packages.find(function ({ location }) {
var fullPath = path.resolve(ls.repository.rootPath, fullname);
pkg = ls.packages.find(function (_ref4) {
var location = _ref4.location;
return location === fullPath;
});
} else {
pkg = ls.packages.find(function ({ name: n }) {
pkg = ls.packages.find(function (_ref5) {
var n = _ref5.name;
return n === fullname;

@@ -251,4 +263,6 @@ });

if (pkg) {
const module = yield resolve$1(pkg.location, opts);
if (module) return module;
var _module = yield resolve$1(pkg.location, opts);
if (_module) return {
v: _module
};
}

@@ -259,4 +273,6 @@ }

logger.debug("looking for local module '%s'", fullname);
const module = yield resolve$1(fullname, opts);
if (module) return module;
var module = yield resolve$1(fullname, opts);
if (module) return {
v: module
};

@@ -266,6 +282,20 @@ // test as a global module on non-relative files

logger.debug("looking for global module '%s'", fullname);
const fullPath = path.resolve(globalModules, fullname);
const globalPath = yield resolve$1(fullPath, opts);
if (globalPath) return globalPath;
var _fullPath = path.resolve(globalModules, fullname);
var globalPath = yield resolve$1(_fullPath, opts);
if (globalPath) return {
v: globalPath
};
}
};
for (var i = 0; i < leads.length; i++) {
var _ret = yield* _loop(i);
switch (_ret) {
case "continue":
continue;
default:
if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
}
}

@@ -272,0 +302,0 @@ });

{
"name": "@pagedip/util-resolve",
"version": "1.0.0-rc.3",
"version": "1.0.0-rc.4",
"author": "Tyler Johnson <tyler@beneaththeink.com>",

@@ -19,3 +19,3 @@ "repository": {

"dependencies": {
"@pagedip/util-logger": "^1.0.0-rc.3",
"@pagedip/util-logger": "^1.0.0-rc.4",
"find-up": "^2.1.0",

@@ -33,3 +33,3 @@ "global-modules": "^1.0.0",

],
"gitHead": "5f9462413e50a8f6396637db57e689a387bd25c4"
"gitHead": "151350bdfba417751d1846c635202db636c1de86"
}
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