@pnpm/lockfile-utils
Advanced tools
Comparing version 3.2.1 to 4.0.0
@@ -5,3 +5,2 @@ import { Lockfile } from '@pnpm/lockfile-types'; | ||
}>, lockfile: Lockfile, ctx: { | ||
lockfileDir: string; | ||
virtualStoreDir: string; | ||
@@ -8,0 +7,0 @@ pkgLocationByDepPath?: Record<string, string>; |
@@ -10,13 +10,11 @@ "use strict"; | ||
function extendProjectsWithTargetDirs(projects, lockfile, ctx) { | ||
var _a; | ||
const getLocalLocation = ctx.pkgLocationByDepPath != null | ||
? (depPath) => ctx.pkgLocationByDepPath[depPath] | ||
: (depPath, pkgName) => path_1.default.join(ctx.virtualStoreDir, (0, dependency_path_1.depPathToFilename)(depPath, ctx.lockfileDir), 'node_modules', pkgName); | ||
: (depPath, pkgName) => path_1.default.join(ctx.virtualStoreDir, (0, dependency_path_1.depPathToFilename)(depPath), 'node_modules', pkgName); | ||
const projectsById = (0, fromPairs_1.default)(projects.map((project) => [project.id, { ...project, targetDirs: [] }])); | ||
Object.entries((_a = lockfile.packages) !== null && _a !== void 0 ? _a : {}) | ||
Object.entries(lockfile.packages ?? {}) | ||
.forEach(([depPath, pkg]) => { | ||
var _a, _b; | ||
if (((_a = pkg.resolution) === null || _a === void 0 ? void 0 : _a['type']) !== 'directory') | ||
if (pkg.resolution?.['type'] !== 'directory') | ||
return; | ||
const pkgId = (_b = pkg.id) !== null && _b !== void 0 ? _b : depPath; | ||
const pkgId = pkg.id ?? depPath; | ||
const importerId = pkgId.replace(/^file:/, ''); | ||
@@ -23,0 +21,0 @@ if (projectsById[importerId] == null) |
@@ -28,7 +28,6 @@ "use strict"; | ||
exports.default = (depPath, pkgSnapshot, registries) => { | ||
var _a; | ||
if (pkgSnapshot.id) | ||
return pkgSnapshot.id; | ||
return (_a = dp.tryGetPackageId(registries, depPath)) !== null && _a !== void 0 ? _a : depPath; | ||
return dp.tryGetPackageId(registries, depPath) ?? depPath; | ||
}; | ||
//# sourceMappingURL=packageIdFromSnapshot.js.map |
@@ -34,5 +34,4 @@ "use strict"; | ||
exports.default = (depPath, pkgSnapshot, registries) => { | ||
var _a; | ||
/* eslint-disable @typescript-eslint/dot-notation */ | ||
if (pkgSnapshot.resolution['type'] || ((_a = pkgSnapshot.resolution['tarball']) === null || _a === void 0 ? void 0 : _a.startsWith('file:'))) { | ||
if (pkgSnapshot.resolution['type'] || pkgSnapshot.resolution['tarball']?.startsWith('file:')) { | ||
return pkgSnapshot.resolution; | ||
@@ -39,0 +38,0 @@ } |
@@ -9,3 +9,2 @@ "use strict"; | ||
exports.default = (lockfile, pkg, importerId) => { | ||
var _a, _b; | ||
const importer = lockfile.importers[importerId]; | ||
@@ -20,4 +19,4 @@ if (!importer) | ||
for (const depField of types_1.DEPENDENCIES_FIELDS) { | ||
const importerDeps = (_a = importer[depField]) !== null && _a !== void 0 ? _a : {}; | ||
const pkgDeps = (_b = pkg[depField]) !== null && _b !== void 0 ? _b : {}; | ||
const importerDeps = importer[depField] ?? {}; | ||
const pkgDeps = pkg[depField] ?? {}; | ||
let pkgDepNames; | ||
@@ -24,0 +23,0 @@ switch (depField) { |
{ | ||
"name": "@pnpm/lockfile-utils", | ||
"version": "3.2.1", | ||
"version": "4.0.0", | ||
"description": "Utils for dealing with pnpm-lock.yaml", | ||
@@ -8,3 +8,3 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=12.17" | ||
"node": ">=14.19" | ||
}, | ||
@@ -17,3 +17,3 @@ "files": [ | ||
"keywords": [ | ||
"pnpm6", | ||
"pnpm7", | ||
"pnpm", | ||
@@ -29,3 +29,3 @@ "shrinkwrap", | ||
"devDependencies": { | ||
"@pnpm/lockfile-utils": "3.2.1", | ||
"@pnpm/lockfile-utils": "4.0.0", | ||
"@types/js-yaml": "^4.0.0", | ||
@@ -38,6 +38,6 @@ "@types/ramda": "0.27.39", | ||
"dependencies": { | ||
"@pnpm/lockfile-types": "3.2.0", | ||
"@pnpm/resolver-base": "8.1.6", | ||
"@pnpm/types": "7.10.0", | ||
"dependency-path": "8.0.11", | ||
"@pnpm/lockfile-types": "4.0.0", | ||
"@pnpm/resolver-base": "9.0.0", | ||
"@pnpm/types": "8.0.0", | ||
"dependency-path": "9.0.0", | ||
"get-npm-tarball-url": "^2.0.3", | ||
@@ -47,2 +47,5 @@ "ramda": "^0.27.1" | ||
"funding": "https://opencollective.com/pnpm", | ||
"exports": { | ||
".": "./lib/index.js" | ||
}, | ||
"scripts": { | ||
@@ -49,0 +52,0 @@ "lint": "eslint src/**/*.ts test/**/*.ts", |
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
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
23300
297
+ Added@pnpm/lockfile-types@4.0.0(transitive)
+ Added@pnpm/resolver-base@9.0.0(transitive)
+ Added@pnpm/types@8.0.0(transitive)
+ Addeddependency-path@9.0.0(transitive)
- Removed@pnpm/lockfile-types@3.2.0(transitive)
- Removed@pnpm/resolver-base@8.1.6(transitive)
- Removed@pnpm/types@7.10.0(transitive)
- Removeddependency-path@8.0.11(transitive)
- Removednormalize-path@3.0.0(transitive)
Updated@pnpm/lockfile-types@4.0.0
Updated@pnpm/resolver-base@9.0.0
Updated@pnpm/types@8.0.0
Updateddependency-path@9.0.0