@pkgr/utils
Advanced tools
Comparing version 0.4.5 to 0.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.5.0](https://github.com/rx-ts/pkgr/compare/@pkgr/utils@0.4.5...@pkgr/utils@0.5.0) (2021-02-19) | ||
### Features | ||
* bump (dev)Dependencies expect @rollup/plugin-typescript ([d49518b](https://github.com/rx-ts/pkgr/commit/d49518bfea6f7ee58f05a39a1162e95defe57f81)) | ||
## [0.4.5](https://github.com/rx-ts/pkgr/compare/@pkgr/utils@0.4.4...@pkgr/utils@0.4.5) (2020-07-30) | ||
@@ -8,0 +19,0 @@ |
@@ -86,3 +86,3 @@ "use strict"; | ||
if (typeof browser === 'string' && args.length > 0) { | ||
browser = [browser].concat(args); | ||
browser = tslib_1.__spreadArrays([browser], args); | ||
} | ||
@@ -89,0 +89,0 @@ // Fallback to open |
@@ -5,2 +5,3 @@ "use strict"; | ||
exports.EXTENSIONS = exports.CWD = exports.NODE_MODULES_REG = exports.__PROD__ = exports.__DEV__ = exports.NODE_ENV = exports.PROD = exports.DEV = void 0; | ||
var tslib_1 = require("tslib"); | ||
exports.DEV = 'development'; | ||
@@ -13,5 +14,4 @@ exports.PROD = 'production'; | ||
exports.CWD = process.cwd(); | ||
exports.EXTENSIONS = ['.ts', '.tsx'].concat( | ||
// eslint-disable-next-line node/no-deprecated-api | ||
Object.keys(require.extensions)); | ||
exports.EXTENSIONS = tslib_1.__spreadArrays(['.ts', '.tsx'], Object.keys(require.extensions)); | ||
//# sourceMappingURL=constants.js.map |
@@ -6,7 +6,7 @@ "use strict"; | ||
var fs_1 = tslib_1.__importDefault(require("fs")); | ||
var path_1 = tslib_1.__importStar(require("path")); | ||
var path_1 = tslib_1.__importDefault(require("path")); | ||
var is_glob_1 = tslib_1.__importDefault(require("is-glob")); | ||
var sync_1 = tslib_1.__importDefault(require("tiny-glob/sync")); | ||
var constants_1 = require("./constants"); | ||
exports.tryPkg = function (pkg) { | ||
var tryPkg = function (pkg) { | ||
try { | ||
@@ -17,3 +17,4 @@ return require.resolve(pkg); | ||
}; | ||
exports.tryRequirePkg = function (pkg) { | ||
exports.tryPkg = tryPkg; | ||
var tryRequirePkg = function (pkg) { | ||
try { | ||
@@ -25,3 +26,5 @@ // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return | ||
}; | ||
exports.isPkgAvailable = function (pkg) { return !!exports.tryPkg(pkg); }; | ||
exports.tryRequirePkg = tryRequirePkg; | ||
var isPkgAvailable = function (pkg) { return !!exports.tryPkg(pkg); }; | ||
exports.isPkgAvailable = isPkgAvailable; | ||
exports.isTsAvailable = exports.isPkgAvailable('typescript'); | ||
@@ -33,3 +36,3 @@ exports.isAngularAvailable = exports.isPkgAvailable('@angular/core'); | ||
exports.isVueAvailable = exports.isPkgAvailable('vue'); | ||
exports.tryFile = function (filePath, includeDir) { | ||
var tryFile = function (filePath, includeDir) { | ||
if (includeDir === void 0) { includeDir = false; } | ||
@@ -50,13 +53,14 @@ if (typeof filePath === 'string') { | ||
}; | ||
exports.tryExtensions = function (filepath, extensions) { | ||
exports.tryFile = tryFile; | ||
var tryExtensions = function (filepath, extensions) { | ||
if (extensions === void 0) { extensions = constants_1.EXTENSIONS; } | ||
var ext = extensions.concat('').find(function (ext) { return exports.tryFile(filepath + ext); }); | ||
var ext = tslib_1.__spreadArrays(extensions, ['']).find(function (ext) { return exports.tryFile(filepath + ext); }); | ||
return ext == null ? '' : filepath + ext; | ||
}; | ||
exports.tryGlob = function (paths, options) { | ||
exports.tryExtensions = tryExtensions; | ||
var tryGlob = function (paths, options) { | ||
if (options === void 0) { options = {}; } | ||
var _a = typeof options === 'string' ? { baseDir: options } : options, _b = _a.absolute, absolute = _b === void 0 ? true : _b, _c = _a.baseDir, baseDir = _c === void 0 ? constants_1.CWD : _c; | ||
return paths.reduce(function (acc, pkg) { | ||
return acc | ||
.concat(is_glob_1.default(pkg) | ||
return tslib_1.__spreadArrays(acc, (is_glob_1.default(pkg) | ||
? sync_1.default(pkg, { | ||
@@ -66,8 +70,9 @@ absolute: absolute, | ||
}) | ||
: exports.tryFile(path_1.resolve(baseDir, pkg), true)) | ||
.filter(Boolean); | ||
: [exports.tryFile(path_1.default.resolve(baseDir, pkg), true)])).filter(Boolean); | ||
}, []); | ||
}; | ||
exports.identify = function (_) { return !!_; }; | ||
exports.findUp = function (searchEntry, searchFile) { | ||
exports.tryGlob = tryGlob; | ||
var identify = function (_) { return !!_; }; | ||
exports.identify = identify; | ||
var findUp = function (searchEntry, searchFile) { | ||
if (searchFile === void 0) { searchFile = 'package.json'; } | ||
@@ -91,3 +96,4 @@ console.assert(path_1.default.isAbsolute(searchEntry)); | ||
}; | ||
exports.arrayify = function () { | ||
exports.findUp = findUp; | ||
var arrayify = function () { | ||
var args = []; | ||
@@ -102,2 +108,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
}; | ||
exports.arrayify = arrayify; | ||
//# sourceMappingURL=helpers.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.monorepoPkgs = exports.isMonorepo = void 0; | ||
var path_1 = require("path"); | ||
var tslib_1 = require("tslib"); | ||
var path_1 = tslib_1.__importDefault(require("path")); | ||
var helpers_1 = require("./helpers"); | ||
var pkg = helpers_1.tryRequirePkg(path_1.resolve('package.json')) || {}; | ||
var lernaConfig = helpers_1.tryRequirePkg(path_1.resolve('lerna.json')) || {}; | ||
var pkg = helpers_1.tryRequirePkg(path_1.default.resolve('package.json')) || {}; | ||
var lernaConfig = helpers_1.tryRequirePkg(path_1.default.resolve('lerna.json')) || {}; | ||
var pkgsPath = lernaConfig.packages || pkg.workspaces || []; | ||
exports.isMonorepo = Array.isArray(pkgsPath) && !!pkgsPath.length; | ||
exports.isMonorepo = Array.isArray(pkgsPath) && pkgsPath.length > 0; | ||
exports.monorepoPkgs = exports.isMonorepo ? helpers_1.tryGlob(pkgsPath) : []; | ||
//# sourceMappingURL=monorepo.js.map |
{ | ||
"name": "@pkgr/utils", | ||
"version": "0.4.5", | ||
"version": "0.5.0", | ||
"description": "Shared utils for `@pkgr` packages or any package else", | ||
@@ -9,2 +9,5 @@ "repository": "git+https://github.com/rx-ts/pkgr.git", | ||
"license": "MIT", | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"main": "lib", | ||
@@ -28,3 +31,3 @@ "types": "lib", | ||
"sideEffects": false, | ||
"gitHead": "46396a18fbacdc07a3c78ac23e0e5b7fecfb9a46" | ||
"gitHead": "57cd2d0507774b84834993efbba24662782a519b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32154
290
8