@pnpm/exe 11.22.0 → 11.24.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.
Files changed (3) hide show
  1. package/dist/pnpm.mjs +9230 -7674
  2. package/dist/worker.js +40 -8
  3. package/package.json +9 -9
package/dist/worker.js CHANGED
@@ -6904,7 +6904,7 @@ function filesIncludeInstallScripts(filesIndex) {
6904
6904
  var LOCKFILE_MAJOR_VERSION = "9";
6905
6905
  var LOCKFILE_VERSION = `${LOCKFILE_MAJOR_VERSION}.0`;
6906
6906
  var ENGINE_NAME = `${process.platform};${process.arch};node${process.version.split(".")[0].substring(1)}`;
6907
- var BUILTIN_NAMED_REGISTRIES = Object.freeze({
6907
+ var BUILTIN_REGISTRIES_BY_PREFIX = Object.freeze({
6908
6908
  gh: "https://npm.pkg.github.com/",
6909
6909
  npmjs: "https://registry.npmjs.org/"
6910
6910
  });
@@ -8040,7 +8040,12 @@ function contentPathFromHex(fileType, hex) {
8040
8040
  }
8041
8041
 
8042
8042
  // ../store/cafs/lib/checkPkgFilesIntegrity.js
8043
- global["verifiedFileIntegrity"] = 0;
8043
+ var verifiedFileIntegrity = { files: 0, ms: 0 };
8044
+ function takeVerifiedFileIntegrity() {
8045
+ const taken = verifiedFileIntegrity;
8046
+ verifiedFileIntegrity = { files: 0, ms: 0 };
8047
+ return taken;
8048
+ }
8044
8049
  function checkPkgFilesIntegrity(storeDir, pkgIndex) {
8045
8050
  const verifiedFilesCache = /* @__PURE__ */ new Set();
8046
8051
  const _checkFilesIntegrity = checkFilesIntegrity.bind(null, verifiedFilesCache, storeDir, pkgIndex.algo);
@@ -8129,7 +8134,7 @@ function verifyFile(filename, fstat, algorithm) {
8129
8134
  rimrafSync(filename);
8130
8135
  return false;
8131
8136
  }
8132
- const passed = verifyFileIntegrity(filename, { digest: fstat.digest, algorithm });
8137
+ const passed = tallyVerifyFileIntegrity(filename, { digest: fstat.digest, algorithm });
8133
8138
  if (!passed) {
8134
8139
  lib_default.unlinkSync(filename);
8135
8140
  }
@@ -8137,21 +8142,39 @@ function verifyFile(filename, fstat, algorithm) {
8137
8142
  }
8138
8143
  return true;
8139
8144
  }
8145
+ function tallyVerifyFileIntegrity(filename, integrity) {
8146
+ const startedAt = performance.now();
8147
+ const data = readFileForIntegrity(filename);
8148
+ if (data == null)
8149
+ return false;
8150
+ const passed = hashMatches(data, integrity);
8151
+ if (passed == null)
8152
+ return false;
8153
+ verifiedFileIntegrity.files++;
8154
+ verifiedFileIntegrity.ms += performance.now() - startedAt;
8155
+ return passed;
8156
+ }
8140
8157
  function verifyFileIntegrity(filename, integrity) {
8141
- global["verifiedFileIntegrity"]++;
8142
- let data;
8158
+ const data = readFileForIntegrity(filename);
8159
+ if (data == null)
8160
+ return false;
8161
+ return hashMatches(data, integrity) ?? false;
8162
+ }
8163
+ function readFileForIntegrity(filename) {
8143
8164
  try {
8144
- data = lib_default.readFileSync(filename);
8165
+ return lib_default.readFileSync(filename);
8145
8166
  } catch (err) {
8146
8167
  if (util4.types.isNativeError(err) && "code" in err && err.code === "ENOENT") {
8147
- return false;
8168
+ return null;
8148
8169
  }
8149
8170
  throw err;
8150
8171
  }
8172
+ }
8173
+ function hashMatches(data, integrity) {
8151
8174
  try {
8152
8175
  return crypto3.hash(integrity.algorithm, data, "hex") === integrity.digest;
8153
8176
  } catch {
8154
- return false;
8177
+ return null;
8155
8178
  }
8156
8179
  }
8157
8180
  function checkFile(filename, checkedAt) {
@@ -11811,6 +11834,7 @@ async function handleMessage(message) {
11811
11834
  if (!pkgFilesIndex) {
11812
11835
  parentPort.postMessage({
11813
11836
  status: "success",
11837
+ verifiedFileIntegrity: takeVerifiedFileIntegrity(),
11814
11838
  value: {
11815
11839
  verified: false,
11816
11840
  pkgFilesIndex: null
@@ -11845,6 +11869,10 @@ If you want to ignore this issue, set strictStorePkgContentCheck to false in you
11845
11869
  parentPort.postMessage({
11846
11870
  status: "success",
11847
11871
  warnings,
11872
+ // Store verification happens here, in the worker, but the
11873
+ // install reports it from the main thread. Hand this worker's
11874
+ // share back with the answer it belongs to.
11875
+ verifiedFileIntegrity: takeVerifiedFileIntegrity(),
11848
11876
  value: {
11849
11877
  verified: verifyResult.passed,
11850
11878
  bundledManifest,
@@ -11871,6 +11899,10 @@ If you want to ignore this issue, set strictStorePkgContentCheck to false in you
11871
11899
  } catch (e) {
11872
11900
  parentPort.postMessage({
11873
11901
  status: "error",
11902
+ // Drained here too: a request that hashed and then threw would
11903
+ // otherwise leave its share in this worker, to be handed to
11904
+ // whichever install asks next.
11905
+ verifiedFileIntegrity: takeVerifiedFileIntegrity(),
11874
11906
  error: {
11875
11907
  code: e.code,
11876
11908
  message: e.message ?? e.toString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/exe",
3
- "version": "11.22.0",
3
+ "version": "11.24.0",
4
4
  "description": "Fast, disk space efficient package manager",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -35,17 +35,17 @@
35
35
  "detect-libc": "^2.1.2"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@pnpm/linux-arm64": "11.22.0",
39
- "@pnpm/linux-x64": "11.22.0",
40
- "@pnpm/linuxstatic-arm64": "11.22.0",
41
- "@pnpm/linuxstatic-x64": "11.22.0",
42
- "@pnpm/macos-arm64": "11.22.0",
43
- "@pnpm/win-arm64": "11.22.0",
44
- "@pnpm/win-x64": "11.22.0"
38
+ "@pnpm/linux-arm64": "11.24.0",
39
+ "@pnpm/linux-x64": "11.24.0",
40
+ "@pnpm/linuxstatic-arm64": "11.24.0",
41
+ "@pnpm/linuxstatic-x64": "11.24.0",
42
+ "@pnpm/macos-arm64": "11.24.0",
43
+ "@pnpm/win-arm64": "11.24.0",
44
+ "@pnpm/win-x64": "11.24.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jest/globals": "30.4.1",
48
- "@pnpm/exe": "11.22.0",
48
+ "@pnpm/exe": "11.24.0",
49
49
  "@pnpm/jest-config": "1100.0.22",
50
50
  "@zkochan/cmd-shim": "^9.0.7",
51
51
  "execa": "npm:safe-execa@0.3.0"