@pnpm/cafs
Advanced tools
Comparing version 3.0.7 to 3.0.8
@@ -11,3 +11,3 @@ "use strict"; | ||
const parseJson_1 = require("./parseJson"); | ||
const limit = p_limit_1.default(20); | ||
const limit = (0, p_limit_1.default)(20); | ||
const MAX_BULK_SIZE = 1 * 1024 * 1024; // 1MB | ||
@@ -35,3 +35,3 @@ async function default_1(cafs, dirname, manifest) { | ||
const buffer = await graceful_fs_1.default.readFile(fullPath); | ||
parseJson_1.parseJsonBuffer(buffer, deferredManifest); | ||
(0, parseJson_1.parseJsonBuffer)(buffer, deferredManifest); | ||
return cafs.addBuffer(buffer, stat.mode); | ||
@@ -53,3 +53,3 @@ } | ||
} | ||
catch (err) { | ||
catch (err) { // eslint-disable-line | ||
if (err.code !== 'ENOENT') { | ||
@@ -56,0 +56,0 @@ throw err; |
@@ -27,3 +27,3 @@ "use strict"; | ||
if (filename === 'package.json' && (manifest != null)) { | ||
parseJson_1.parseJsonStream(fileStream, manifest); | ||
(0, parseJson_1.parseJsonStream)(fileStream, manifest); | ||
} | ||
@@ -44,3 +44,3 @@ const writeResult = addStreamToCafs(fileStream, header.mode); | ||
.on('error', reject) | ||
.pipe(decompress_maybe_1.default()) | ||
.pipe((0, decompress_maybe_1.default)()) | ||
.on('error', reject).pipe(extract); | ||
@@ -47,0 +47,0 @@ }); |
@@ -14,3 +14,3 @@ "use strict"; | ||
const parseJson_1 = require("./parseJson"); | ||
const limit = p_limit_1.default(20); | ||
const limit = (0, p_limit_1.default)(20); | ||
const MAX_BULK_SIZE = 1 * 1024 * 1024; // 1MB | ||
@@ -25,3 +25,3 @@ async function default_1(cafsDir, pkgIndex, manifest) { | ||
} | ||
if (!await verifyFile(getFilePathInCafs_1.getFilePathByModeInCafs(cafsDir, fstat.integrity, fstat.mode), fstat, f === 'package.json' ? manifest : undefined)) { | ||
if (!await verifyFile((0, getFilePathInCafs_1.getFilePathByModeInCafs)(cafsDir, fstat.integrity, fstat.mode), fstat, f === 'package.json' ? manifest : undefined)) { | ||
verified = false; | ||
@@ -39,3 +39,3 @@ } | ||
if (currentFile.size !== fstat.size) { | ||
await rimraf_1.default(filename); | ||
await (0, rimraf_1.default)(filename); | ||
return false; | ||
@@ -46,3 +46,3 @@ } | ||
if (deferredManifest != null) { | ||
parseJson_1.parseJsonBuffer(await graceful_fs_1.default.readFile(filename), deferredManifest); | ||
(0, parseJson_1.parseJsonBuffer)(await graceful_fs_1.default.readFile(filename), deferredManifest); | ||
} | ||
@@ -58,3 +58,3 @@ // If a file was not edited, we are skipping integrity check. | ||
if (!ok) { | ||
await rimraf_1.default(filename); | ||
await (0, rimraf_1.default)(filename); | ||
} | ||
@@ -66,10 +66,10 @@ return ok; | ||
if (!ok) { | ||
await rimraf_1.default(filename); | ||
await (0, rimraf_1.default)(filename); | ||
} | ||
else if (deferredManifest != null) { | ||
parseJson_1.parseJsonBuffer(data, deferredManifest); | ||
(0, parseJson_1.parseJsonBuffer)(data, deferredManifest); | ||
} | ||
return ok; | ||
} | ||
catch (err) { | ||
catch (err) { // eslint-disable-line | ||
switch (err.code) { | ||
@@ -79,3 +79,3 @@ case 'ENOENT': return false; | ||
// Broken files are removed from the store | ||
await rimraf_1.default(filename); | ||
await (0, rimraf_1.default)(filename); | ||
return false; | ||
@@ -96,3 +96,3 @@ } | ||
} | ||
catch (err) { | ||
catch (err) { // eslint-disable-line | ||
if (err.code === 'ENOENT') | ||
@@ -99,0 +99,0 @@ return null; |
@@ -12,3 +12,3 @@ "use strict"; | ||
function getFilePathByModeInCafs(cafsDir, integrity, mode) { | ||
const fileType = exports.modeIsExecutable(mode) ? 'exec' : 'nonexec'; | ||
const fileType = (0, exports.modeIsExecutable)(mode) ? 'exec' : 'nonexec'; | ||
return path_1.default.join(cafsDir, contentPathFromIntegrity(integrity, fileType)); | ||
@@ -15,0 +15,0 @@ } |
@@ -57,4 +57,4 @@ "use strict"; | ||
const integrity = ssri_1.default.fromData(buffer); | ||
const isExecutable = getFilePathInCafs_1.modeIsExecutable(mode); | ||
const fileDest = getFilePathInCafs_1.contentPathFromHex(isExecutable ? 'exec' : 'nonexec', integrity.hexDigest()); | ||
const isExecutable = (0, getFilePathInCafs_1.modeIsExecutable)(mode); | ||
const fileDest = (0, getFilePathInCafs_1.contentPathFromHex)(isExecutable ? 'exec' : 'nonexec', integrity.hexDigest()); | ||
const checkedAt = await writeBufferToCafs(buffer, fileDest, isExecutable ? 0o755 : undefined, integrity); | ||
@@ -85,4 +85,4 @@ return { checkedAt, integrity }; | ||
// to the final file directly. | ||
const temp = path_temp_1.default(path_1.default.dirname(fileDest)); | ||
await writeFile_1.default(temp, buffer, mode); | ||
const temp = (0, path_temp_1.default)(path_1.default.dirname(fileDest)); | ||
await (0, writeFile_1.default)(temp, buffer, mode); | ||
// Unfortunately, "birth time" (time of file creation) is available not on all filesystems. | ||
@@ -92,3 +92,3 @@ // We log the creation time ourselves and save it in the package index file. | ||
const birthtimeMs = Date.now(); | ||
await rename_overwrite_1.default(temp, fileDest); | ||
await (0, rename_overwrite_1.default)(temp, fileDest); | ||
return birthtimeMs; | ||
@@ -107,3 +107,3 @@ })(); | ||
} | ||
return checkFilesIntegrity_1.verifyFileIntegrity(filename, { | ||
return (0, checkFilesIntegrity_1.verifyFileIntegrity)(filename, { | ||
size: existingFile.size, | ||
@@ -110,0 +110,0 @@ integrity, |
@@ -11,5 +11,5 @@ "use strict"; | ||
try { | ||
deferred.resolve(JSON.parse(strip_bom_1.default(buffer.toString()))); | ||
deferred.resolve(JSON.parse((0, strip_bom_1.default)(buffer.toString()))); | ||
} | ||
catch (err) { | ||
catch (err) { // eslint-disable-line | ||
deferred.reject(err); | ||
@@ -20,5 +20,5 @@ } | ||
function parseJsonStream(stream, deferred) { | ||
stream.pipe(concat_stream_1.default((buffer) => parseJsonBuffer(buffer, deferred))); | ||
stream.pipe((0, concat_stream_1.default)((buffer) => parseJsonBuffer(buffer, deferred))); | ||
} | ||
exports.parseJsonStream = parseJsonStream; | ||
//# sourceMappingURL=parseJson.js.map |
{ | ||
"name": "@pnpm/cafs", | ||
"version": "3.0.7", | ||
"version": "3.0.8", | ||
"description": "A content-addressable filesystem for the packages storage", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"keywords": [], | ||
"keywords": [ | ||
"pnpm6" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"@pnpm/fetcher-base": "11.0.3", | ||
"@pnpm/fetcher-base": "11.1.0", | ||
"@pnpm/graceful-fs": "1.0.0", | ||
"@pnpm/store-controller-types": "11.0.5", | ||
"@pnpm/store-controller-types": "11.0.6", | ||
"@zkochan/rimraf": "^2.1.1", | ||
@@ -45,3 +47,3 @@ "concat-stream": "^2.0.0", | ||
"scripts": { | ||
"lint": "eslint -c ../../eslint.json src/**/*.ts test/**/*.ts", | ||
"lint": "eslint src/**/*.ts test/**/*.ts", | ||
"_test": "jest", | ||
@@ -48,0 +50,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
34927
1
+ Added@pnpm/fetcher-base@11.1.0(transitive)
+ Added@pnpm/resolver-base@8.1.0(transitive)
+ Added@pnpm/store-controller-types@11.0.6(transitive)
+ Added@pnpm/types@7.5.0(transitive)
- Removed@pnpm/fetcher-base@11.0.3(transitive)
- Removed@pnpm/resolver-base@8.0.4(transitive)
- Removed@pnpm/store-controller-types@11.0.5(transitive)
- Removed@pnpm/types@7.4.0(transitive)
Updated@pnpm/fetcher-base@11.1.0