Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/lockfile-file

Package Overview
Dependencies
Maintainers
2
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/lockfile-file - npm Package Compare versions

Comparing version 7.0.6 to 8.0.0

2

lib/experiments/inlineSpecifiersLockfileConverters.d.ts
import type { Lockfile } from '@pnpm/lockfile-types';
import { InlineSpecifiersLockfile } from './InlineSpecifiersLockfile';
import { type InlineSpecifiersLockfile } from './InlineSpecifiersLockfile';
export declare function isExperimentalInlineSpecifiersFormat(lockfile: InlineSpecifiersLockfile | Lockfile): lockfile is InlineSpecifiersLockfile;

@@ -4,0 +4,0 @@ export declare function convertToInlineSpecifiersFormat(lockfile: Lockfile): InlineSpecifiersLockfile;

@@ -1,3 +0,3 @@

import { Lockfile } from '@pnpm/lockfile-types';
import { type Lockfile } from '@pnpm/lockfile-types';
export declare function autofixMergeConflicts(fileContent: string): Lockfile;
export declare function isDiff(fileContent: string): boolean;

@@ -1,2 +0,2 @@

export { writeLockfiles, writeCurrentLockfile, writeWantedLockfile, } from './write';
export { isEmptyLockfile, writeLockfiles, writeCurrentLockfile, writeWantedLockfile, } from './write';
export { existsWantedLockfile } from './existsWantedLockfile';

@@ -3,0 +3,0 @@ export { getLockfileImporterId } from './getLockfileImporterId';

@@ -17,4 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanGitBranchLockfiles = exports.getLockfileImporterId = exports.existsWantedLockfile = exports.writeWantedLockfile = exports.writeCurrentLockfile = exports.writeLockfiles = void 0;
exports.cleanGitBranchLockfiles = exports.getLockfileImporterId = exports.existsWantedLockfile = exports.writeWantedLockfile = exports.writeCurrentLockfile = exports.writeLockfiles = exports.isEmptyLockfile = void 0;
var write_1 = require("./write");
Object.defineProperty(exports, "isEmptyLockfile", { enumerable: true, get: function () { return write_1.isEmptyLockfile; } });
Object.defineProperty(exports, "writeLockfiles", { enumerable: true, get: function () { return write_1.writeLockfiles; } });

@@ -21,0 +22,0 @@ Object.defineProperty(exports, "writeCurrentLockfile", { enumerable: true, get: function () { return write_1.writeCurrentLockfile; } });

@@ -1,2 +0,2 @@

import { Lockfile } from '@pnpm/lockfile-types';
import { type Lockfile } from '@pnpm/lockfile-types';
export declare function readCurrentLockfile(virtualStoreDir: string, opts: {

@@ -3,0 +3,0 @@ wantedVersions?: string[];

@@ -1,2 +0,2 @@

import { LockfileFile } from './write';
import { type LockfileFile } from './write';
export declare function sortLockfileKeys(lockfile: LockfileFile): LockfileFile;

@@ -1,5 +0,4 @@

import { Lockfile, ProjectSnapshot } from '@pnpm/lockfile-types';
import { type Lockfile, type ProjectSnapshot } from '@pnpm/lockfile-types';
export declare function writeWantedLockfile(pkgPath: string, wantedLockfile: Lockfile, opts?: {
forceSharedFormat?: boolean;
useInlineSpecifiersFormat?: boolean;
useGitBranchLockfile?: boolean;

@@ -11,2 +10,3 @@ mergeGitBranchLockfiles?: boolean;

}): Promise<void>;
export declare function isEmptyLockfile(lockfile: Lockfile): boolean;
export type LockfileFile = Omit<Lockfile, 'importers'> & Partial<ProjectSnapshot> & Partial<Pick<Lockfile, 'importers'>>;

@@ -20,3 +20,2 @@ export interface NormalizeLockfileOpts {

forceSharedFormat?: boolean;
useInlineSpecifiersFormat?: boolean;
wantedLockfile: Lockfile;

@@ -23,0 +22,0 @@ wantedLockfileDir: string;

@@ -29,3 +29,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.writeLockfiles = exports.normalizeLockfile = exports.writeCurrentLockfile = exports.writeWantedLockfile = void 0;
exports.writeLockfiles = exports.normalizeLockfile = exports.isEmptyLockfile = exports.writeCurrentLockfile = exports.writeWantedLockfile = void 0;
const fs_1 = require("fs");

@@ -67,2 +67,7 @@ const path_1 = __importDefault(require("path"));

async function writeCurrentLockfile(virtualStoreDir, currentLockfile, opts) {
// empty lockfile is not saved
if (isEmptyLockfile(currentLockfile)) {
await (0, rimraf_1.default)(path_1.default.join(virtualStoreDir, 'lock.yaml'));
return;
}
await fs_1.promises.mkdir(virtualStoreDir, { recursive: true });

@@ -74,8 +79,4 @@ return writeLockfile('lock.yaml', virtualStoreDir, currentLockfile, opts);

const lockfilePath = path_1.default.join(pkgPath, lockfileFilename);
// empty lockfile is not saved
if (isEmptyLockfile(wantedLockfile)) {
return (0, rimraf_1.default)(lockfilePath);
}
const isLockfileV6 = wantedLockfile['lockfileVersion'].toString().startsWith('6.');
const lockfileToStringify = (Boolean(opts?.useInlineSpecifiersFormat) || isLockfileV6)
const lockfileToStringify = isLockfileV6
? (0, inlineSpecifiersLockfileConverters_1.convertToInlineSpecifiersFormat)(wantedLockfile)

@@ -85,3 +86,3 @@ : wantedLockfile;

forceSharedFormat: opts?.forceSharedFormat === true,
includeEmptySpecifiersField: !opts?.useInlineSpecifiersFormat && !isLockfileV6,
includeEmptySpecifiersField: !isLockfileV6,
});

@@ -98,2 +99,3 @@ return writeFileAtomic(lockfilePath, yamlDoc);

}
exports.isEmptyLockfile = isEmptyLockfile;
function normalizeLockfile(lockfile, opts) {

@@ -222,13 +224,5 @@ let lockfileToSave;

const currentLockfilePath = path_1.default.join(opts.currentLockfileDir, 'lock.yaml');
// empty lockfile is not saved
if (isEmptyLockfile(opts.wantedLockfile)) {
await Promise.all([
(0, rimraf_1.default)(wantedLockfilePath),
(0, rimraf_1.default)(currentLockfilePath),
]);
return;
}
const forceSharedFormat = opts?.forceSharedFormat === true;
const isLockfileV6 = opts.wantedLockfile.lockfileVersion.toString().startsWith('6.');
const wantedLockfileToStringify = (Boolean(opts.useInlineSpecifiersFormat) || isLockfileV6)
const wantedLockfileToStringify = isLockfileV6
? (0, inlineSpecifiersLockfileConverters_1.convertToInlineSpecifiersFormat)(opts.wantedLockfile)

@@ -238,3 +232,3 @@ : opts.wantedLockfile;

forceSharedFormat,
includeEmptySpecifiersField: !opts.useInlineSpecifiersFormat && !isLockfileV6,
includeEmptySpecifiersField: !isLockfileV6,
};

@@ -249,4 +243,9 @@ const yamlDoc = yamlStringify(wantedLockfileToStringify, normalizeOpts);

(async () => {
await fs_1.promises.mkdir(path_1.default.dirname(currentLockfilePath), { recursive: true });
await writeFileAtomic(currentLockfilePath, yamlDoc);
if (isEmptyLockfile(opts.wantedLockfile)) {
await (0, rimraf_1.default)(currentLockfilePath);
}
else {
await fs_1.promises.mkdir(path_1.default.dirname(currentLockfilePath), { recursive: true });
await writeFileAtomic(currentLockfilePath, yamlDoc);
}
})(),

@@ -260,3 +259,3 @@ ]);

});
const currentLockfileToStringify = (Boolean(opts.useInlineSpecifiersFormat) || opts.wantedLockfile.lockfileVersion.toString().startsWith('6.'))
const currentLockfileToStringify = opts.wantedLockfile.lockfileVersion.toString().startsWith('6.')
? (0, inlineSpecifiersLockfileConverters_1.convertToInlineSpecifiersFormat)(opts.currentLockfile)

@@ -268,4 +267,9 @@ : opts.currentLockfile;

(async () => {
await fs_1.promises.mkdir(path_1.default.dirname(currentLockfilePath), { recursive: true });
await writeFileAtomic(currentLockfilePath, currentYamlDoc);
if (isEmptyLockfile(opts.wantedLockfile)) {
await (0, rimraf_1.default)(currentLockfilePath);
}
else {
await fs_1.promises.mkdir(path_1.default.dirname(currentLockfilePath), { recursive: true });
await writeFileAtomic(currentLockfilePath, currentYamlDoc);
}
})(),

@@ -272,0 +276,0 @@ ]);

{
"name": "@pnpm/lockfile-file",
"version": "7.0.6",
"version": "8.0.0",
"description": "Read/write pnpm-lock.yaml files",

@@ -8,3 +8,3 @@ "main": "lib/index.js",

"engines": {
"node": ">=14.6"
"node": ">=16.14"
},

@@ -17,3 +17,3 @@ "files": [

"keywords": [
"pnpm7",
"pnpm8",
"pnpm",

@@ -40,3 +40,3 @@ "shrinkwrap",

"yaml-tag": "1.1.0",
"@pnpm/lockfile-file": "7.0.6"
"@pnpm/lockfile-file": "8.0.0"
},

@@ -54,9 +54,9 @@ "dependencies": {

"write-file-atomic": "^5.0.0",
"@pnpm/constants": "6.2.0",
"@pnpm/dependency-path": "1.1.3",
"@pnpm/error": "4.0.1",
"@pnpm/git-utils": "0.1.0",
"@pnpm/lockfile-types": "4.3.6",
"@pnpm/merge-lockfile-changes": "4.0.3",
"@pnpm/types": "8.10.0"
"@pnpm/constants": "7.0.0",
"@pnpm/dependency-path": "2.0.0",
"@pnpm/error": "5.0.0",
"@pnpm/git-utils": "1.0.0",
"@pnpm/lockfile-types": "5.0.0",
"@pnpm/merge-lockfile-changes": "5.0.0",
"@pnpm/types": "9.0.0"
},

@@ -63,0 +63,0 @@ "funding": "https://opencollective.com/pnpm",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc