@pnpm/crypto.shasums-file 1001.0.4 → 1100.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -12
- package/package.json +11 -11
- package/lib/index.js.map +0 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.fetchShasumsFile = fetchShasumsFile;
|
|
4
|
-
exports.fetchShasumsFileRaw = fetchShasumsFileRaw;
|
|
5
|
-
exports.pickFileChecksumFromShasumsFile = pickFileChecksumFromShasumsFile;
|
|
6
|
-
const error_1 = require("@pnpm/error");
|
|
7
|
-
async function fetchShasumsFile(fetch, shasumsUrl) {
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
export async function fetchShasumsFile(fetch, shasumsUrl) {
|
|
8
3
|
const shasumsFileContent = await fetchShasumsFileRaw(fetch, shasumsUrl);
|
|
9
4
|
const lines = shasumsFileContent.split('\n');
|
|
10
5
|
const items = [];
|
|
@@ -19,23 +14,23 @@ async function fetchShasumsFile(fetch, shasumsUrl) {
|
|
|
19
14
|
}
|
|
20
15
|
return items;
|
|
21
16
|
}
|
|
22
|
-
async function fetchShasumsFileRaw(fetch, shasumsUrl) {
|
|
17
|
+
export async function fetchShasumsFileRaw(fetch, shasumsUrl) {
|
|
23
18
|
const res = await fetch(shasumsUrl);
|
|
24
19
|
if (!res.ok) {
|
|
25
|
-
throw new
|
|
20
|
+
throw new PnpmError('FAILED_DOWNLOAD_SHASUM_FILE', `Failed to fetch integrity file: ${shasumsUrl} (status: ${res.status})`);
|
|
26
21
|
}
|
|
27
22
|
const body = await res.text();
|
|
28
23
|
return body;
|
|
29
24
|
}
|
|
30
25
|
const SHA256_REGEX = /^[a-f0-9]{64}$/;
|
|
31
|
-
function pickFileChecksumFromShasumsFile(body, fileName) {
|
|
26
|
+
export function pickFileChecksumFromShasumsFile(body, fileName) {
|
|
32
27
|
const line = body.split('\n').find(line => line.trim().endsWith(` ${fileName}`));
|
|
33
28
|
if (!line) {
|
|
34
|
-
throw new
|
|
29
|
+
throw new PnpmError('NODE_INTEGRITY_HASH_NOT_FOUND', `SHA-256 hash not found in SHASUMS256.txt for: ${fileName}`);
|
|
35
30
|
}
|
|
36
31
|
const [sha256] = line.trim().split(/\s+/);
|
|
37
32
|
if (!SHA256_REGEX.test(sha256)) {
|
|
38
|
-
throw new
|
|
33
|
+
throw new PnpmError('NODE_MALFORMED_INTEGRITY_HASH', `Malformed SHA-256 for ${fileName}: ${sha256}`);
|
|
39
34
|
}
|
|
40
35
|
const buffer = Buffer.from(sha256, 'hex');
|
|
41
36
|
const base64 = buffer.toString('base64');
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/crypto.shasums-file",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1100.0.0",
|
|
4
4
|
"description": "Utils for working with shasums files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
7
|
-
"
|
|
7
|
+
"pnpm11",
|
|
8
8
|
"crypto",
|
|
9
9
|
"shasums-file"
|
|
10
10
|
],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
17
17
|
},
|
|
18
|
-
"type": "
|
|
18
|
+
"type": "module",
|
|
19
19
|
"main": "lib/index.js",
|
|
20
20
|
"types": "lib/index.d.ts",
|
|
21
21
|
"exports": {
|
|
@@ -26,23 +26,23 @@
|
|
|
26
26
|
"!*.map"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pnpm/crypto.hash": "
|
|
30
|
-
"@pnpm/error": "
|
|
31
|
-
"@pnpm/fetching
|
|
29
|
+
"@pnpm/crypto.hash": "1100.0.0",
|
|
30
|
+
"@pnpm/error": "1100.0.0",
|
|
31
|
+
"@pnpm/fetching.types": "1100.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@pnpm/crypto.shasums-file": "
|
|
34
|
+
"@pnpm/crypto.shasums-file": "1100.0.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">=22.13"
|
|
38
38
|
},
|
|
39
39
|
"jest": {
|
|
40
40
|
"preset": "@pnpm/jest-config"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
44
|
+
"test": "pn compile && pn .test",
|
|
45
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
46
|
+
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAUA,4CAgBC;AAED,kDAaC;AAID,0EAqBC;AAlED,uCAAuC;AAUhC,KAAK,UAAU,gBAAgB,CACpC,KAAwB,EACxB,UAAkB;IAElB,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IACvE,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC5C,MAAM,KAAK,GAAsB,EAAE,CAAA;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI;YAAE,SAAQ;QACnB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK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