@pnpm/lockfile-file
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -8,3 +8,3 @@ "use strict"; | ||
const normalize_path_1 = __importDefault(require("normalize-path")); | ||
exports.default = (lockfileDir, prefix) => normalize_path_1.default(path_1.default.relative(lockfileDir, prefix)) || '.'; | ||
exports.default = (lockfileDir, prefix) => (0, normalize_path_1.default)(path_1.default.relative(lockfileDir, prefix)) || '.'; | ||
//# sourceMappingURL=getLockfileImporterId.js.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
const { ours, theirs } = parseMergeFile(fileContent); | ||
return merge_lockfile_changes_1.default(js_yaml_1.default.load(ours), js_yaml_1.default.load(theirs)); | ||
return (0, merge_lockfile_changes_1.default)(js_yaml_1.default.load(ours), js_yaml_1.default.load(theirs)); | ||
} | ||
@@ -18,0 +18,0 @@ exports.autofixMergeConflicts = autofixMergeConflicts; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const logger_1 = __importDefault(require("@pnpm/logger")); | ||
exports.default = logger_1.default('lockfile'); | ||
exports.default = (0, logger_1.default)('lockfile'); | ||
//# sourceMappingURL=logger.js.map |
@@ -38,5 +38,5 @@ "use strict"; | ||
try { | ||
lockfileRawContent = strip_bom_1.default(await fs_1.promises.readFile(lockfilePath, 'utf8')); | ||
lockfileRawContent = (0, strip_bom_1.default)(await fs_1.promises.readFile(lockfilePath, 'utf8')); | ||
} | ||
catch (err) { | ||
catch (err) { // eslint-disable-line | ||
if (err.code !== 'ENOENT') { | ||
@@ -56,8 +56,8 @@ throw err; | ||
} | ||
catch (err) { | ||
if (!opts.autofixMergeConflicts || !gitMergeFile_1.isDiff(lockfileRawContent)) { | ||
catch (err) { // eslint-disable-line | ||
if (!opts.autofixMergeConflicts || !(0, gitMergeFile_1.isDiff)(lockfileRawContent)) { | ||
throw new error_1.default('BROKEN_LOCKFILE', `The lockfile at "${lockfilePath}" is broken: ${err.message}`); | ||
} | ||
hadConflicts = true; | ||
lockfile = gitMergeFile_1.autofixMergeConflicts(lockfileRawContent); | ||
lockfile = (0, gitMergeFile_1.autofixMergeConflicts)(lockfileRawContent); | ||
logger_1.default.info({ | ||
@@ -84,6 +84,6 @@ message: `Merge conflict detected in ${constants_1.WANTED_LOCKFILE} and successfully merged`, | ||
if (lockfile) { | ||
const lockfileSemver = comver_to_semver_1.default(((_a = lockfile.lockfileVersion) !== null && _a !== void 0 ? _a : 0).toString()); | ||
const lockfileSemver = (0, comver_to_semver_1.default)(((_a = lockfile.lockfileVersion) !== null && _a !== void 0 ? _a : 0).toString()); | ||
/* eslint-enable @typescript-eslint/dot-notation */ | ||
if (typeof opts.wantedVersion !== 'number' || semver_1.default.major(lockfileSemver) === semver_1.default.major(comver_to_semver_1.default(opts.wantedVersion.toString()))) { | ||
if (typeof opts.wantedVersion === 'number' && semver_1.default.gt(lockfileSemver, comver_to_semver_1.default(opts.wantedVersion.toString()))) { | ||
if (typeof opts.wantedVersion !== 'number' || semver_1.default.major(lockfileSemver) === semver_1.default.major((0, comver_to_semver_1.default)(opts.wantedVersion.toString()))) { | ||
if (typeof opts.wantedVersion === 'number' && semver_1.default.gt(lockfileSemver, (0, comver_to_semver_1.default)(opts.wantedVersion.toString()))) { | ||
logger_1.default.warn({ | ||
@@ -90,0 +90,0 @@ message: `Your ${constants_1.WANTED_LOCKFILE} was generated by a newer version of pnpm. ` + |
@@ -55,5 +55,5 @@ "use strict"; | ||
if (lockfile.importers != null) { | ||
lockfile.importers = sort_keys_1.default(lockfile.importers); | ||
lockfile.importers = (0, sort_keys_1.default)(lockfile.importers); | ||
for (const importerId of Object.keys(lockfile.importers)) { | ||
lockfile.importers[importerId] = sort_keys_1.default(lockfile.importers[importerId], { | ||
lockfile.importers[importerId] = (0, sort_keys_1.default)(lockfile.importers[importerId], { | ||
compare: compareRootKeys, | ||
@@ -65,5 +65,5 @@ deep: true, | ||
if (lockfile.packages != null) { | ||
lockfile.packages = sort_keys_1.default(lockfile.packages); | ||
lockfile.packages = (0, sort_keys_1.default)(lockfile.packages); | ||
for (const pkgId of Object.keys(lockfile.packages)) { | ||
lockfile.packages[pkgId] = sort_keys_1.default(lockfile.packages[pkgId], { | ||
lockfile.packages[pkgId] = (0, sort_keys_1.default)(lockfile.packages[pkgId], { | ||
compare: compareWithPriority.bind(null, ORDERED_KEYS), | ||
@@ -77,7 +77,7 @@ deep: true, | ||
continue; | ||
lockfile[key] = sort_keys_1.default(lockfile[key]); | ||
lockfile[key] = (0, sort_keys_1.default)(lockfile[key]); | ||
} | ||
return sort_keys_1.default(lockfile, { compare: compareRootKeys }); | ||
return (0, sort_keys_1.default)(lockfile, { compare: compareRootKeys }); | ||
} | ||
exports.sortLockfileKeys = sortLockfileKeys; | ||
//# sourceMappingURL=sortLockfileKeys.js.map |
@@ -19,3 +19,3 @@ "use strict"; | ||
async function writeFileAtomic(filename, data) { | ||
return new Promise((resolve, reject) => write_file_atomic_1.default(filename, data, {}, (err) => (err != null) ? reject(err) : resolve())); | ||
return new Promise((resolve, reject) => (0, write_file_atomic_1.default)(filename, data, {}, (err) => (err != null) ? reject(err) : resolve())); | ||
} | ||
@@ -42,3 +42,3 @@ const LOCKFILE_YAML_FORMAT = { | ||
if (isEmptyLockfile(wantedLockfile)) { | ||
return rimraf_1.default(lockfilePath); | ||
return (0, rimraf_1.default)(lockfilePath); | ||
} | ||
@@ -50,11 +50,11 @@ const yamlDoc = yamlStringify(wantedLockfile, (opts === null || opts === void 0 ? void 0 : opts.forceSharedFormat) === true); | ||
let normalizedLockfile = normalizeLockfile(lockfile, forceSharedFormat); | ||
normalizedLockfile = sortLockfileKeys_1.sortLockfileKeys(normalizedLockfile); | ||
normalizedLockfile = (0, sortLockfileKeys_1.sortLockfileKeys)(normalizedLockfile); | ||
return js_yaml_1.default.dump(normalizedLockfile, LOCKFILE_YAML_FORMAT); | ||
} | ||
function isEmptyLockfile(lockfile) { | ||
return Object.values(lockfile.importers).every((importer) => { var _a, _b; return isEmpty_1.default((_a = importer.specifiers) !== null && _a !== void 0 ? _a : {}) && isEmpty_1.default((_b = importer.dependencies) !== null && _b !== void 0 ? _b : {}); }); | ||
return Object.values(lockfile.importers).every((importer) => { var _a, _b; return (0, isEmpty_1.default)((_a = importer.specifiers) !== null && _a !== void 0 ? _a : {}) && (0, isEmpty_1.default)((_b = importer.dependencies) !== null && _b !== void 0 ? _b : {}); }); | ||
} | ||
function normalizeLockfile(lockfile, forceSharedFormat) { | ||
let lockfileToSave; | ||
if (!forceSharedFormat && equals_1.default(Object.keys(lockfile.importers), ['.'])) { | ||
if (!forceSharedFormat && (0, equals_1.default)(Object.keys(lockfile.importers), ['.'])) { | ||
lockfileToSave = { | ||
@@ -66,7 +66,7 @@ ...lockfile, | ||
for (const depType of types_1.DEPENDENCIES_FIELDS) { | ||
if (isEmpty_1.default(lockfileToSave[depType])) { | ||
if ((0, isEmpty_1.default)(lockfileToSave[depType])) { | ||
delete lockfileToSave[depType]; | ||
} | ||
} | ||
if (isEmpty_1.default(lockfileToSave.packages) || (lockfileToSave.packages == null)) { | ||
if ((0, isEmpty_1.default)(lockfileToSave.packages) || (lockfileToSave.packages == null)) { | ||
delete lockfileToSave.packages; | ||
@@ -84,4 +84,7 @@ } | ||
}; | ||
if (importer.dependenciesMeta != null && !(0, isEmpty_1.default)(importer.dependenciesMeta)) { | ||
normalizedImporter['dependenciesMeta'] = importer.dependenciesMeta; | ||
} | ||
for (const depType of types_1.DEPENDENCIES_FIELDS) { | ||
if (!isEmpty_1.default((_b = importer[depType]) !== null && _b !== void 0 ? _b : {})) { | ||
if (!(0, isEmpty_1.default)((_b = importer[depType]) !== null && _b !== void 0 ? _b : {})) { | ||
normalizedImporter[depType] = importer[depType]; | ||
@@ -94,11 +97,11 @@ } | ||
}; | ||
if (isEmpty_1.default(lockfileToSave.packages) || (lockfileToSave.packages == null)) { | ||
if ((0, isEmpty_1.default)(lockfileToSave.packages) || (lockfileToSave.packages == null)) { | ||
delete lockfileToSave.packages; | ||
} | ||
} | ||
if ((lockfileToSave.overrides != null) && isEmpty_1.default(lockfileToSave.overrides)) { | ||
if ((lockfileToSave.overrides != null) && (0, isEmpty_1.default)(lockfileToSave.overrides)) { | ||
delete lockfileToSave.overrides; | ||
} | ||
if (lockfileToSave.neverBuiltDependencies != null) { | ||
if (isEmpty_1.default(lockfileToSave.neverBuiltDependencies)) { | ||
if ((0, isEmpty_1.default)(lockfileToSave.neverBuiltDependencies)) { | ||
delete lockfileToSave.neverBuiltDependencies; | ||
@@ -122,4 +125,4 @@ } | ||
await Promise.all([ | ||
rimraf_1.default(wantedLockfilePath), | ||
rimraf_1.default(currentLockfilePath), | ||
(0, rimraf_1.default)(wantedLockfilePath), | ||
(0, rimraf_1.default)(currentLockfilePath), | ||
]); | ||
@@ -126,0 +129,0 @@ return; |
{ | ||
"name": "@pnpm/lockfile-file", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"description": "Read/write pnpm-lock.yaml files", | ||
@@ -16,2 +16,3 @@ "main": "lib/index.js", | ||
"keywords": [ | ||
"pnpm6", | ||
"pnpm", | ||
@@ -42,5 +43,5 @@ "shrinkwrap", | ||
"@pnpm/error": "2.0.0", | ||
"@pnpm/lockfile-types": "3.0.0", | ||
"@pnpm/merge-lockfile-changes": "2.0.1", | ||
"@pnpm/types": "7.4.0", | ||
"@pnpm/lockfile-types": "3.1.0", | ||
"@pnpm/merge-lockfile-changes": "2.0.2", | ||
"@pnpm/types": "7.5.0", | ||
"@zkochan/rimraf": "^2.1.1", | ||
@@ -58,3 +59,3 @@ "comver-to-semver": "^1.0.0", | ||
"scripts": { | ||
"lint": "eslint -c ../../eslint.json src/**/*.ts test/**/*.ts", | ||
"lint": "eslint src/**/*.ts test/**/*.ts", | ||
"_test": "jest", | ||
@@ -61,0 +62,0 @@ "test": "pnpm run compile && pnpm run _test", |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
43802
558
1
+ Added@pnpm/lockfile-types@3.1.0(transitive)
+ Added@pnpm/merge-lockfile-changes@2.0.2(transitive)
+ Added@pnpm/types@7.5.0(transitive)
- Removed@pnpm/lockfile-types@3.0.0(transitive)
- Removed@pnpm/merge-lockfile-changes@2.0.1(transitive)
- Removed@pnpm/types@7.4.0(transitive)
Updated@pnpm/lockfile-types@3.1.0
Updated@pnpm/types@7.5.0