@pnpm/local-resolver
Advanced tools
Comparing version 4.0.2 to 5.0.0
@@ -8,4 +8,4 @@ import { DirectoryResolution, ResolveResult, TarballResolution } from '@pnpm/resolver-base'; | ||
}, opts: { | ||
importerDir: string; | ||
lockfileDir?: string; | ||
projectDir: string; | ||
}): Promise<(ResolveResult & Required<Pick<ResolveResult, 'normalizedPref'>> & ({ | ||
@@ -12,0 +12,0 @@ resolution: TarballResolution; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const error_1 = require("@pnpm/error"); | ||
const read_importer_manifest_1 = require("@pnpm/read-importer-manifest"); | ||
const read_project_manifest_1 = require("@pnpm/read-project-manifest"); | ||
const fs = require("graceful-fs"); | ||
@@ -12,3 +12,4 @@ const ssri = require("ssri"); | ||
async function resolveLocal(wantedDependency, opts) { | ||
const spec = parsePref_1.default(wantedDependency.pref, opts.importerDir, opts.lockfileDir || opts.importerDir); | ||
var _a; | ||
const spec = parsePref_1.default(wantedDependency.pref, opts.projectDir, (_a = opts.lockfileDir, (_a !== null && _a !== void 0 ? _a : opts.projectDir))); | ||
if (!spec) | ||
@@ -29,3 +30,3 @@ return null; | ||
try { | ||
localDependencyManifest = await read_importer_manifest_1.readImporterManifestOnly(spec.fetchSpec); | ||
localDependencyManifest = await read_project_manifest_1.readProjectManifestOnly(spec.fetchSpec); | ||
} | ||
@@ -32,0 +33,0 @@ catch (internalErr) { |
@@ -8,2 +8,2 @@ export interface LocalPackageSpec { | ||
} | ||
export default function parsePref(pref: string, importerDir: string, lockfileDir: string): LocalPackageSpec | null; | ||
export default function parsePref(pref: string, projectDir: string, lockfileDir: string): LocalPackageSpec | null; |
@@ -12,5 +12,5 @@ "use strict"; | ||
const isAbsolutePath = /^[/]|^[A-Za-z]:/; | ||
function parsePref(pref, importerDir, lockfileDir) { | ||
function parsePref(pref, projectDir, lockfileDir) { | ||
if (pref.startsWith('link:')) { | ||
return fromLocal(pref, importerDir, lockfileDir, 'directory'); | ||
return fromLocal(pref, projectDir, lockfileDir, 'directory'); | ||
} | ||
@@ -24,3 +24,3 @@ if (pref.endsWith('.tgz') | ||
const type = isFilename.test(pref) ? 'file' : 'directory'; | ||
return fromLocal(pref, importerDir, lockfileDir, type); | ||
return fromLocal(pref, projectDir, lockfileDir, type); | ||
} | ||
@@ -39,3 +39,3 @@ if (pref.startsWith('path:')) { | ||
exports.default = parsePref; | ||
function fromLocal(pref, importerDir, lockfileDir, type) { | ||
function fromLocal(pref, projectDir, lockfileDir, type) { | ||
const spec = pref.replace(/\\/g, '/') | ||
@@ -53,3 +53,3 @@ .replace(/^(file|link):[/]*([A-Za-z]:)/, '$2') // drive name paths on windows | ||
else { | ||
fetchSpec = resolvePath(importerDir, spec); | ||
fetchSpec = resolvePath(projectDir, spec); | ||
if (isAbsolute(spec)) { | ||
@@ -59,7 +59,7 @@ normalizedPref = `${protocol}${spec}`; | ||
else { | ||
normalizedPref = `${protocol}${path.relative(importerDir, fetchSpec)}`; | ||
normalizedPref = `${protocol}${path.relative(projectDir, fetchSpec)}`; | ||
} | ||
} | ||
const dependencyPath = normalize(path.relative(importerDir, fetchSpec)); | ||
const id = type === 'directory' || importerDir === lockfileDir | ||
const dependencyPath = normalize(path.relative(projectDir, fetchSpec)); | ||
const id = type === 'directory' || projectDir === lockfileDir | ||
? `${protocol}${dependencyPath}` | ||
@@ -66,0 +66,0 @@ : `${protocol}${normalize(path.relative(lockfileDir, fetchSpec))}`; |
{ | ||
"name": "@pnpm/local-resolver", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"description": "Resolver for local packages", | ||
@@ -14,5 +14,5 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts", | ||
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts", | ||
"tsc": "tsc", | ||
"test": "pnpm run tsc && pnpm run lint && ts-node test --ts-node", | ||
"test": "pnpm run tsc && ts-node test --ts-node", | ||
"prepublishOnly": "pnpm run tsc", | ||
@@ -35,5 +35,5 @@ "fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix" | ||
"@pnpm/error": "1.0.0", | ||
"@pnpm/read-importer-manifest": "2.0.1", | ||
"@pnpm/resolver-base": "6.0.0", | ||
"@pnpm/types": "4.0.0", | ||
"@pnpm/read-project-manifest": "1.0.0", | ||
"@pnpm/resolver-base": "7.0.0", | ||
"@pnpm/types": "5.0.0", | ||
"graceful-fs": "4.2.1", | ||
@@ -47,5 +47,4 @@ "normalize-path": "3.0.0", | ||
"@types/normalize-path": "3.0.0", | ||
"@types/ssri": "^6.0.1", | ||
"tape": "4.11.0" | ||
"@types/ssri": "^6.0.1" | ||
} | ||
} |
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
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
9163
4
161
+ Added@pnpm/read-project-manifest@1.0.0(transitive)
+ Added@pnpm/resolver-base@7.0.0(transitive)
+ Added@pnpm/types@5.0.0(transitive)
+ Added@pnpm/write-project-manifest@1.0.0(transitive)
- Removed@pnpm/read-importer-manifest@2.0.1
- Removed@pnpm/read-importer-manifest@2.0.1(transitive)
- Removed@pnpm/resolver-base@6.0.0(transitive)
- Removed@pnpm/types@4.0.0(transitive)
- Removed@pnpm/write-importer-manifest@4.0.0(transitive)
Updated@pnpm/resolver-base@7.0.0
Updated@pnpm/types@5.0.0