@pnpm/lockfile-file
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ interface existsNonEmptyWantedLockfileOptions { | ||
} | ||
export declare function existsNonEmptyWantedLockfile(pkgPath: string, opts?: existsNonEmptyWantedLockfileOptions): Promise<unknown>; | ||
export declare function existsNonEmptyWantedLockfile(pkgPath: string, opts?: existsNonEmptyWantedLockfileOptions): Promise<boolean>; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { type Lockfile, type LockfileFile, type LockfileFileV7 } from '@pnpm/lockfile-types'; | ||
import { type Lockfile, type LockfileFile, type LockfileFileV9 } from '@pnpm/lockfile-types'; | ||
export interface NormalizeLockfileOpts { | ||
@@ -6,3 +6,3 @@ forceSharedFormat: boolean; | ||
export declare function convertToLockfileFile(lockfile: Lockfile, opts: NormalizeLockfileOpts): LockfileFile; | ||
export declare function convertToLockfileObject(lockfile: LockfileFile | LockfileFileV7): Lockfile; | ||
export declare function convertLockfileV9ToLockfileObject(lockfile: LockfileFileV7): Lockfile; | ||
export declare function convertToLockfileObject(lockfile: LockfileFile | LockfileFileV9): Lockfile; | ||
export declare function convertLockfileV9ToLockfileObject(lockfile: LockfileFileV9): Lockfile; |
@@ -15,2 +15,3 @@ "use strict"; | ||
const pick_1 = __importDefault(require("ramda/src/pick")); | ||
const constants_1 = require("@pnpm/constants"); | ||
function convertToLockfileFile(lockfile, opts) { | ||
@@ -24,3 +25,2 @@ const packages = {}; | ||
'transitivePeerDependencies', | ||
'dev', | ||
'optional', | ||
@@ -32,3 +32,2 @@ 'id', | ||
packages[pkgId] = (0, pick_1.default)([ | ||
'bundleDependencies', | ||
'bundledDependencies', | ||
@@ -53,3 +52,3 @@ 'cpu', | ||
packages, | ||
lockfileVersion: lockfile.lockfileVersion.toString(), | ||
lockfileVersion: constants_1.LOCKFILE_VERSION, | ||
importers: mapValues(lockfile.importers, convertProjectSnapshotToInlineSpecifiersFormat), | ||
@@ -193,5 +192,6 @@ }; | ||
if (pkg.name) { | ||
let newId; | ||
const { id, peersSuffix } = (0, dependency_path_1.parseDepPath)(pkgId); | ||
let newId = `${pkg.name}@`; | ||
if ('tarball' in pkg.resolution) { | ||
newId = pkg.resolution.tarball; | ||
newId += pkg.resolution.tarball; | ||
if (pkg.resolution.path) { | ||
@@ -202,3 +202,3 @@ newId += `#path:${pkg.resolution.path}`; | ||
else if ('repo' in pkg.resolution) { | ||
newId = `${pkg.resolution.repo.startsWith('git+') ? '' : 'git+'}${pkg.resolution.repo}#${pkg.resolution.commit}`; | ||
newId += `${pkg.resolution.repo.startsWith('git+') ? '' : 'git+'}${pkg.resolution.repo}#${pkg.resolution.commit}`; | ||
if (pkg.resolution.path) { | ||
@@ -208,6 +208,8 @@ newId += `&path:${pkg.resolution.path}`; | ||
} | ||
else if ('directory' in pkg.resolution) { | ||
newId += id; | ||
} | ||
else { | ||
continue; | ||
} | ||
const { id, peersSuffix } = (0, dependency_path_1.parseDepPath)(pkgId); | ||
oldIdToNewId[pkgId] = `${newId}${peersSuffix}`; | ||
@@ -241,3 +243,8 @@ if (id !== pkgId) { | ||
if (oldIdToNewId[depPath]) { | ||
pkg[depType][alias] = oldIdToNewId[depPath]; | ||
if (oldIdToNewId[depPath].startsWith(`${alias}@`)) { | ||
pkg[depType][alias] = oldIdToNewId[depPath].substring(alias.length + 1); | ||
} | ||
else { | ||
pkg[depType][alias] = oldIdToNewId[depPath]; | ||
} | ||
} | ||
@@ -252,3 +259,8 @@ } | ||
if (oldIdToNewId[version]) { | ||
importer[depType][alias].version = oldIdToNewId[version]; | ||
if (oldIdToNewId[version].startsWith(`${alias}@`)) { | ||
importer[depType][alias].version = oldIdToNewId[version].substring(alias.length + 1); | ||
} | ||
else { | ||
importer[depType][alias].version = oldIdToNewId[version]; | ||
} | ||
} | ||
@@ -255,0 +267,0 @@ } |
@@ -22,5 +22,5 @@ import { type Lockfile } from '@pnpm/lockfile-types'; | ||
export declare function createLockfileObject(importerIds: string[], opts: { | ||
lockfileVersion: number | string; | ||
lockfileVersion: string; | ||
autoInstallPeers: boolean; | ||
excludeLinksFromLockfile: boolean; | ||
}): Lockfile; |
@@ -1,2 +0,2 @@ | ||
import { type LockfileFileV7 } from '@pnpm/lockfile-types'; | ||
export declare function sortLockfileKeys(lockfile: LockfileFileV7): LockfileFileV7; | ||
import { type LockfileFileV9 } from '@pnpm/lockfile-types'; | ||
export declare function sortLockfileKeys(lockfile: LockfileFileV9): LockfileFileV9; |
{ | ||
"name": "@pnpm/lockfile-file", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"description": "Read/write pnpm-lock.yaml files", | ||
@@ -32,3 +32,3 @@ "main": "lib/index.js", | ||
"@types/normalize-path": "^3.0.2", | ||
"@types/ramda": "0.28.20", | ||
"@types/ramda": "0.29.12", | ||
"@types/semver": "7.5.3", | ||
@@ -39,6 +39,6 @@ "@types/write-file-atomic": "^4.0.3", | ||
"yaml-tag": "1.1.0", | ||
"@pnpm/lockfile-file": "9.0.0" | ||
"@pnpm/lockfile-file": "9.0.1" | ||
}, | ||
"dependencies": { | ||
"@pnpm/util.lex-comparator": "1.0.0", | ||
"@pnpm/util.lex-comparator": "3.0.0", | ||
"@zkochan/rimraf": "^2.1.3", | ||
@@ -56,4 +56,4 @@ "comver-to-semver": "^1.0.0", | ||
"@pnpm/git-utils": "2.0.0", | ||
"@pnpm/lockfile-types": "6.0.0", | ||
"@pnpm/error": "6.0.0", | ||
"@pnpm/lockfile-types": "6.0.0", | ||
"@pnpm/lockfile-utils": "10.0.0", | ||
@@ -60,0 +60,0 @@ "@pnpm/merge-lockfile-changes": "6.0.0", |
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
75752
-21.79%42
-12.5%967
-21.7%+ Added
- Removed