@yarn-tool/resolve-package
Advanced tools
Comparing version 1.0.35 to 1.0.36
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.0.36](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/resolve-package@1.0.35...@yarn-tool/resolve-package@1.0.36) (2021-11-03) | ||
### 📦 Code Refactoring | ||
* avoid https://github.com/ezolenko/rollup-plugin-typescript2/issues/286 ([627d0cc](https://github.com/bluelovers/ws-yarn-workspaces/commit/627d0cc2a183a6be43a9d05c1ae6da3d8edd5e2e)) | ||
## [1.0.35](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/resolve-package@1.0.34...@yarn-tool/resolve-package@1.0.35) (2021-09-15) | ||
@@ -8,0 +19,0 @@ |
import type { IPackageJson } from '@ts-type/package-dts'; | ||
export declare function resolvePackage(name: string, options?: { | ||
/** | ||
* @see RequireResolve | ||
*/ | ||
paths?: string[]; | ||
@@ -8,3 +11,6 @@ }): { | ||
pkg: IPackageJson<any>; | ||
pkgConfigLocation: string; | ||
entryPointLocation: string; | ||
resolveLocation(path: string, ...paths: string[]): string; | ||
}; | ||
export default resolvePackage; |
12
index.js
@@ -5,8 +5,16 @@ "use strict"; | ||
const upath2_1 = require("upath2"); | ||
const pkg_dir_1 = require("pkg-dir"); | ||
function resolvePackage(name, options) { | ||
let pkgRoot = (0, upath2_1.dirname)(require.resolve(`${name}/package.json`, options)); | ||
const entryPointLocation = require.resolve(name, options); | ||
const pkgRoot = (0, pkg_dir_1.sync)(entryPointLocation); | ||
const pkgConfigLocation = (0, upath2_1.resolve)(pkgRoot, 'package.json'); | ||
return { | ||
name, | ||
pkgRoot, | ||
pkg: require(`${pkgRoot}/package.json`), | ||
pkg: require(pkgConfigLocation), | ||
pkgConfigLocation, | ||
entryPointLocation, | ||
resolveLocation(path, ...paths) { | ||
return (0, upath2_1.resolve)(pkgRoot, path, ...paths); | ||
}, | ||
}; | ||
@@ -13,0 +21,0 @@ } |
{ | ||
"name": "@yarn-tool/resolve-package", | ||
"version": "1.0.35", | ||
"description": "", | ||
"version": "1.0.36", | ||
"description": "resolve package root and package.json paths", | ||
"keywords": [ | ||
"resolve", | ||
"package", | ||
"json", | ||
"root", | ||
"npm", | ||
"entry", | ||
"find", | ||
"up", | ||
"find-up", | ||
"findup", | ||
"look-up", | ||
"look", | ||
"file", | ||
"search", | ||
"match", | ||
"parent", | ||
"parents", | ||
"folder", | ||
"directory", | ||
"walk", | ||
"walking", | ||
"path" | ||
], | ||
"homepage": "https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/resolve-package#readme", | ||
@@ -33,2 +57,3 @@ "bugs": { | ||
"@ts-type/package-dts": "^1.0.51", | ||
"pkg-dir": "< 6 >= 5", | ||
"tslib": "^2.3.1", | ||
@@ -40,3 +65,3 @@ "upath2": "^3.1.10" | ||
}, | ||
"gitHead": "b1b0c39dafdf127bc25233ad34c44ab6fc0da40b" | ||
"gitHead": "dbf64ed0b8593237aee787074124264e2138ba7e" | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
14626
37
4
+ Addedpkg-dir@< 6 >= 5
+ Addedfind-up@5.0.0(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpkg-dir@5.0.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)