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

@pnpm/cafs

Package Overview
Dependencies
Maintainers
3
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/cafs - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

7

CHANGELOG.md
# @pnpm/cafs
## 3.0.2
### Patch Changes
- @pnpm/fetcher-base@10.0.1
- @pnpm/store-controller-types@11.0.1
## 3.0.1

@@ -4,0 +11,0 @@

6

lib/addFilesFromDir.js

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

const parseJson_1 = require("./parseJson");
const limit = (0, p_limit_1.default)(20);
const limit = p_limit_1.default(20);
const MAX_BULK_SIZE = 1 * 1024 * 1024; // 1MB

@@ -34,3 +34,3 @@ async function default_1(cafs, dirname, manifest) {

const buffer = await fs_1.promises.readFile(fullPath);
(0, parseJson_1.parseJsonBuffer)(buffer, deferredManifest);
parseJson_1.parseJsonBuffer(buffer, deferredManifest);
return cafs.addBuffer(buffer, stat.mode);

@@ -42,3 +42,3 @@ }

}
return cafs.addStream((0, fs_1.createReadStream)(fullPath), stat.mode);
return cafs.addStream(fs_1.createReadStream(fullPath), stat.mode);
});

@@ -45,0 +45,0 @@ index[relativePath] = {

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

if (filename === 'package.json' && (manifest != null)) {
(0, parseJson_1.parseJsonStream)(fileStream, manifest);
parseJson_1.parseJsonStream(fileStream, manifest);
}

@@ -44,3 +44,3 @@ const writeResult = addStreamToCafs(fileStream, header.mode);

.on('error', reject)
.pipe((0, decompress_maybe_1.default)())
.pipe(decompress_maybe_1.default())
.on('error', reject).pipe(extract);

@@ -47,0 +47,0 @@ });

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

const parseJson_1 = require("./parseJson");
const limit = (0, p_limit_1.default)(20);
const limit = p_limit_1.default(20);
const MAX_BULK_SIZE = 1 * 1024 * 1024; // 1MB

@@ -24,3 +24,3 @@ async function default_1(cafsDir, pkgIndex, manifest) {

}
if (!await verifyFile((0, getFilePathInCafs_1.getFilePathByModeInCafs)(cafsDir, fstat.integrity, fstat.mode), fstat, f === 'package.json' ? manifest : undefined)) {
if (!await verifyFile(getFilePathInCafs_1.getFilePathByModeInCafs(cafsDir, fstat.integrity, fstat.mode), fstat, f === 'package.json' ? manifest : undefined)) {
verified = false;

@@ -38,3 +38,3 @@ }

if (currentFile.size !== fstat.size) {
await (0, rimraf_1.default)(filename);
await rimraf_1.default(filename);
return false;

@@ -45,3 +45,3 @@ }

if (deferredManifest != null) {
(0, parseJson_1.parseJsonBuffer)(await fs_1.promises.readFile(filename), deferredManifest);
parseJson_1.parseJsonBuffer(await fs_1.promises.readFile(filename), deferredManifest);
}

@@ -55,5 +55,5 @@ // If a file was not edited, we are skipping integrity check.

if (expectedFile.size > MAX_BULK_SIZE && (deferredManifest == null)) {
const ok = Boolean(await ssri_1.default.checkStream((0, fs_1.createReadStream)(filename), expectedFile.integrity));
const ok = Boolean(await ssri_1.default.checkStream(fs_1.createReadStream(filename), expectedFile.integrity));
if (!ok) {
await (0, rimraf_1.default)(filename);
await rimraf_1.default(filename);
}

@@ -65,6 +65,6 @@ return ok;

if (!ok) {
await (0, rimraf_1.default)(filename);
await rimraf_1.default(filename);
}
else if (deferredManifest != null) {
(0, parseJson_1.parseJsonBuffer)(data, deferredManifest);
parseJson_1.parseJsonBuffer(data, deferredManifest);
}

@@ -78,3 +78,3 @@ return ok;

// Broken files are removed from the store
await (0, rimraf_1.default)(filename);
await rimraf_1.default(filename);
return false;

@@ -81,0 +81,0 @@ }

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

function getFilePathByModeInCafs(cafsDir, integrity, mode) {
const fileType = (0, exports.modeIsExecutable)(mode) ? 'exec' : 'nonexec';
const fileType = 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 = (0, getFilePathInCafs_1.modeIsExecutable)(mode);
const fileDest = (0, getFilePathInCafs_1.contentPathFromHex)(isExecutable ? 'exec' : 'nonexec', integrity.hexDigest());
const isExecutable = getFilePathInCafs_1.modeIsExecutable(mode);
const fileDest = 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 = (0, path_temp_1.default)(path_1.default.dirname(fileDest));
await (0, writeFile_1.default)(temp, buffer, mode);
const temp = path_temp_1.default(path_1.default.dirname(fileDest));
await 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 (0, rename_overwrite_1.default)(temp, fileDest);
await rename_overwrite_1.default(temp, fileDest);
return birthtimeMs;

@@ -107,3 +107,3 @@ })();

}
return (0, checkFilesIntegrity_1.verifyFileIntegrity)(filename, {
return checkFilesIntegrity_1.verifyFileIntegrity(filename, {
size: existingFile.size,

@@ -110,0 +110,0 @@ integrity,

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

try {
deferred.resolve(JSON.parse((0, strip_bom_1.default)(buffer.toString())));
deferred.resolve(JSON.parse(strip_bom_1.default(buffer.toString())));
}

@@ -20,5 +20,5 @@ catch (err) {

function parseJsonStream(stream, deferred) {
stream.pipe((0, concat_stream_1.default)((buffer) => parseJsonBuffer(buffer, deferred)));
stream.pipe(concat_stream_1.default((buffer) => parseJsonBuffer(buffer, deferred)));
}
exports.parseJsonStream = parseJsonStream;
//# sourceMappingURL=parseJson.js.map
{
"name": "@pnpm/cafs",
"version": "3.0.1",
"version": "3.0.2",
"description": "A content-addressable filesystem for the packages storage",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"scripts": {
"lint": "eslint -c ../../eslint.json src/**/*.ts test/**/*.ts",
"_test": "jest",
"test": "pnpm run compile && pnpm run _test",
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build && pnpm run lint -- --fix",
"prepublishOnly": "pnpm run compile"
},
"keywords": [],
"license": "MIT",
"dependencies": {
"@pnpm/fetcher-base": "10.0.0",
"@pnpm/store-controller-types": "11.0.0",
"@zkochan/rimraf": "^2.0.0",
"@pnpm/fetcher-base": "10.0.1",
"@pnpm/store-controller-types": "11.0.1",
"@zkochan/rimraf": "^2.1.1",
"concat-stream": "^2.0.0",

@@ -49,3 +42,9 @@ "decompress-maybe": "^1.0.0",

"repository": "https://github.com/pnpm/pnpm/blob/master/packages/cafs",
"funding": "https://opencollective.com/pnpm"
"funding": "https://opencollective.com/pnpm",
"scripts": {
"lint": "eslint -c ../../eslint.json src/**/*.ts test/**/*.ts",
"_test": "jest",
"test": "pnpm run compile && pnpm run _test",
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build && pnpm run lint -- --fix"
}
}
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