@pnpm/exe 11.0.0-beta.1 → 11.0.0-beta.3

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 (79) hide show
  1. package/dist/node_modules/@gar/promise-retry/LICENSE +1 -0
  2. package/dist/node_modules/@gar/promise-retry/lib/index.js +43 -9
  3. package/dist/node_modules/@gar/promise-retry/lib/retry.js +109 -0
  4. package/dist/node_modules/@gar/promise-retry/package.json +1 -4
  5. package/dist/node_modules/@npmcli/redact/LICENSE +21 -0
  6. package/dist/node_modules/@npmcli/redact/lib/deep-map.js +71 -0
  7. package/dist/node_modules/@npmcli/redact/lib/error.js +28 -0
  8. package/dist/node_modules/@npmcli/redact/lib/index.js +44 -0
  9. package/dist/node_modules/@npmcli/redact/lib/matchers.js +88 -0
  10. package/dist/node_modules/@npmcli/redact/lib/server.js +59 -0
  11. package/dist/node_modules/@npmcli/redact/lib/utils.js +202 -0
  12. package/dist/node_modules/{unique-slug → @npmcli/redact}/package.json +21 -18
  13. package/dist/node_modules/brace-expansion/dist/commonjs/index.js +3 -1
  14. package/dist/node_modules/brace-expansion/dist/esm/index.js +3 -1
  15. package/dist/node_modules/brace-expansion/package.json +1 -1
  16. package/dist/node_modules/cacache/lib/content/write.js +2 -2
  17. package/dist/node_modules/cacache/lib/entry-index.js +2 -2
  18. package/dist/node_modules/cacache/lib/util/tmp.js +6 -0
  19. package/dist/node_modules/cacache/package.json +4 -5
  20. package/dist/node_modules/make-fetch-happen/lib/remote.js +4 -2
  21. package/dist/node_modules/make-fetch-happen/package.json +2 -1
  22. package/dist/node_modules/picomatch/lib/constants.js +4 -0
  23. package/dist/node_modules/picomatch/lib/parse.js +301 -0
  24. package/dist/node_modules/picomatch/lib/picomatch.js +11 -3
  25. package/dist/node_modules/picomatch/package.json +2 -3
  26. package/dist/node_modules/tar/dist/commonjs/create.js +3 -4
  27. package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +7 -4
  28. package/dist/node_modules/tar/dist/commonjs/header.js +14 -27
  29. package/dist/node_modules/tar/dist/commonjs/index.min.js +3 -3
  30. package/dist/node_modules/tar/dist/commonjs/list.js +2 -7
  31. package/dist/node_modules/tar/dist/commonjs/make-command.js +3 -12
  32. package/dist/node_modules/tar/dist/commonjs/mkdir.js +5 -6
  33. package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +1 -1
  34. package/dist/node_modules/tar/dist/commonjs/pack.js +3 -8
  35. package/dist/node_modules/tar/dist/commonjs/parse.js +12 -22
  36. package/dist/node_modules/tar/dist/commonjs/path-reservations.js +2 -2
  37. package/dist/node_modules/tar/dist/commonjs/read-entry.js +2 -6
  38. package/dist/node_modules/tar/dist/commonjs/replace.js +5 -10
  39. package/dist/node_modules/tar/dist/commonjs/unpack.js +38 -63
  40. package/dist/node_modules/tar/dist/commonjs/winchars.js +1 -1
  41. package/dist/node_modules/tar/dist/commonjs/write-entry.js +12 -13
  42. package/dist/node_modules/tar/dist/esm/create.js +3 -4
  43. package/dist/node_modules/tar/dist/esm/get-write-flag.js +7 -4
  44. package/dist/node_modules/tar/dist/esm/header.js +14 -27
  45. package/dist/node_modules/tar/dist/esm/index.min.js +3 -3
  46. package/dist/node_modules/tar/dist/esm/list.js +2 -7
  47. package/dist/node_modules/tar/dist/esm/make-command.js +3 -12
  48. package/dist/node_modules/tar/dist/esm/mkdir.js +5 -6
  49. package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +1 -1
  50. package/dist/node_modules/tar/dist/esm/pack.js +4 -9
  51. package/dist/node_modules/tar/dist/esm/parse.js +13 -23
  52. package/dist/node_modules/tar/dist/esm/path-reservations.js +2 -2
  53. package/dist/node_modules/tar/dist/esm/read-entry.js +2 -6
  54. package/dist/node_modules/tar/dist/esm/replace.js +6 -11
  55. package/dist/node_modules/tar/dist/esm/unpack.js +38 -63
  56. package/dist/node_modules/tar/dist/esm/winchars.js +1 -1
  57. package/dist/node_modules/tar/dist/esm/write-entry.js +14 -15
  58. package/dist/node_modules/tar/package.json +9 -4
  59. package/dist/pnpm.mjs +7603 -6593
  60. package/dist/worker.js +140 -50
  61. package/package.json +12 -9
  62. package/pn +1 -0
  63. package/pnpx +1 -0
  64. package/pnx +1 -0
  65. package/prepare.js +12 -3
  66. package/setup.js +28 -1
  67. package/dist/node_modules/imurmurhash/imurmurhash.js +0 -138
  68. package/dist/node_modules/imurmurhash/imurmurhash.min.js +0 -12
  69. package/dist/node_modules/imurmurhash/package.json +0 -40
  70. package/dist/node_modules/retry/License +0 -21
  71. package/dist/node_modules/retry/index.js +0 -1
  72. package/dist/node_modules/retry/lib/retry.js +0 -100
  73. package/dist/node_modules/retry/lib/retry_operation.js +0 -162
  74. package/dist/node_modules/retry/package.json +0 -36
  75. package/dist/node_modules/unique-filename/LICENSE +0 -5
  76. package/dist/node_modules/unique-filename/lib/index.js +0 -7
  77. package/dist/node_modules/unique-filename/package.json +0 -53
  78. package/dist/node_modules/unique-slug/LICENSE +0 -15
  79. package/dist/node_modules/unique-slug/lib/index.js +0 -11
package/dist/worker.js CHANGED
@@ -4794,21 +4794,26 @@ var require_truncate_utf8_bytes = __commonJS({
4794
4794
  }
4795
4795
  });
4796
4796
 
4797
- // ../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/sanitize-filename/1.6.3/e044c323e17ea38e8fba3ce857b267931ac1bdd681197ca4a3504ce0ce53ddc0/node_modules/sanitize-filename/index.js
4797
+ // ../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/sanitize-filename/1.6.4/5f553bde92425a76e0b51eddf2a9a22faa7626146298aecdcafaf8de748aa2e6/node_modules/sanitize-filename/index.js
4798
4798
  var require_sanitize_filename = __commonJS({
4799
- "../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/sanitize-filename/1.6.3/e044c323e17ea38e8fba3ce857b267931ac1bdd681197ca4a3504ce0ce53ddc0/node_modules/sanitize-filename/index.js"(exports, module) {
4799
+ "../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/sanitize-filename/1.6.4/5f553bde92425a76e0b51eddf2a9a22faa7626146298aecdcafaf8de748aa2e6/node_modules/sanitize-filename/index.js"(exports, module) {
4800
4800
  "use strict";
4801
4801
  var truncate = require_truncate_utf8_bytes();
4802
4802
  var illegalRe = /[\/\?<>\\:\*\|"]/g;
4803
4803
  var controlRe = /[\x00-\x1f\x80-\x9f]/g;
4804
4804
  var reservedRe = /^\.+$/;
4805
4805
  var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
4806
- var windowsTrailingRe = /[\. ]+$/;
4806
+ function replaceTrailingDotsAndSpaces(str, replacement) {
4807
+ var end = str.length;
4808
+ while (end > 0 && (str[end - 1] === "." || str[end - 1] === " ")) end--;
4809
+ return end < str.length ? str.slice(0, end) + replacement : str;
4810
+ }
4807
4811
  function sanitize(input, replacement) {
4808
4812
  if (typeof input !== "string") {
4809
4813
  throw new Error("Input must be string");
4810
4814
  }
4811
- var sanitized = input.replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement).replace(windowsTrailingRe, replacement);
4815
+ var sanitized = input.replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement);
4816
+ sanitized = replaceTrailingDotsAndSpaces(sanitized, replacement);
4812
4817
  return truncate(sanitized, 255);
4813
4818
  }
4814
4819
  module.exports = function(input, options) {
@@ -5428,7 +5433,7 @@ var PnpmError = class extends Error {
5428
5433
  prefix;
5429
5434
  pkgsStack;
5430
5435
  constructor(code, message, opts2) {
5431
- super(message);
5436
+ super(message, { cause: opts2?.cause });
5432
5437
  this.code = code.startsWith("ERR_PNPM_") ? code : `ERR_PNPM_${code}`;
5433
5438
  this.hint = opts2?.hint;
5434
5439
  this.attempts = opts2?.attempts;
@@ -6475,7 +6480,7 @@ function clamp(index, len, defaultValue) {
6475
6480
  // ../store/cafs/lib/addFilesFromTarball.js
6476
6481
  function addFilesFromTarball(addBufferToCafs2, _ignore, tarballBuffer, readManifest) {
6477
6482
  const ignore = _ignore ?? (() => false);
6478
- const tarContent = (0, import_is_gzip.default)(tarballBuffer) ? gunzipSync(tarballBuffer) : Buffer.isBuffer(tarballBuffer) ? tarballBuffer : Buffer.from(tarballBuffer);
6483
+ const tarContent = (0, import_is_gzip.default)(tarballBuffer) ? gunzipSync(tarballBuffer, { chunkSize: 128 * 1024 }) : Buffer.isBuffer(tarballBuffer) ? tarballBuffer : Buffer.from(tarballBuffer);
6479
6484
  const { files } = parseTarball(tarContent);
6480
6485
  const filesIndex = /* @__PURE__ */ new Map();
6481
6486
  let manifestBuffer;
@@ -6505,13 +6510,14 @@ import util4 from "node:util";
6505
6510
 
6506
6511
  // ../store/cafs/lib/getFilePathInCafs.js
6507
6512
  import path9 from "node:path";
6513
+ var SEP = path9.sep;
6508
6514
  var modeIsExecutable = (mode) => (mode & 73) !== 0;
6509
6515
  function getFilePathByModeInCafs(storeDir, hexDigest, mode) {
6510
6516
  const fileType = modeIsExecutable(mode) ? "exec" : "nonexec";
6511
- return path9.join(storeDir, contentPathFromHex(fileType, hexDigest));
6517
+ return `${storeDir}${SEP}${contentPathFromHex(fileType, hexDigest)}`;
6512
6518
  }
6513
6519
  function contentPathFromHex(fileType, hex) {
6514
- const p = path9.join("files", hex.slice(0, 2), hex.slice(2));
6520
+ const p = `files${SEP}${hex.slice(0, 2)}${SEP}${hex.slice(2)}`;
6515
6521
  switch (fileType) {
6516
6522
  case "exec":
6517
6523
  return `${p}-exec`;
@@ -6610,7 +6616,11 @@ function verifyFile(filename, fstat, algorithm) {
6610
6616
  rimrafSync(filename);
6611
6617
  return false;
6612
6618
  }
6613
- return verifyFileIntegrity(filename, { digest: fstat.digest, algorithm });
6619
+ const passed = verifyFileIntegrity(filename, { digest: fstat.digest, algorithm });
6620
+ if (!passed) {
6621
+ lib_default.unlinkSync(filename);
6622
+ }
6623
+ return passed;
6614
6624
  }
6615
6625
  return true;
6616
6626
  }
@@ -6625,17 +6635,11 @@ function verifyFileIntegrity(filename, integrity) {
6625
6635
  }
6626
6636
  throw err;
6627
6637
  }
6628
- let computedDigest;
6629
6638
  try {
6630
- computedDigest = crypto3.hash(integrity.algorithm, data, "hex");
6639
+ return crypto3.hash(integrity.algorithm, data, "hex") === integrity.digest;
6631
6640
  } catch {
6632
6641
  return false;
6633
6642
  }
6634
- const passed = computedDigest === integrity.digest;
6635
- if (!passed) {
6636
- lib_default.unlinkSync(filename);
6637
- }
6638
- return passed;
6639
6643
  }
6640
6644
  function checkFile(filename, checkedAt) {
6641
6645
  try {
@@ -6711,6 +6715,10 @@ function writeFile(fileDest, buffer, mode) {
6711
6715
  makeDirForFile(fileDest);
6712
6716
  lib_default.writeFileSync(fileDest, buffer, { mode });
6713
6717
  }
6718
+ function writeFileExclusive(fileDest, buffer, mode) {
6719
+ makeDirForFile(fileDest);
6720
+ lib_default.writeFileSync(fileDest, buffer, { mode, flag: "wx" });
6721
+ }
6714
6722
  function makeDirForFile(fileDest) {
6715
6723
  const dir = path10.dirname(fileDest);
6716
6724
  if (!dirs.has(dir)) {
@@ -6728,21 +6736,39 @@ function writeBufferToCafs(locker, storeDir, buffer, fileDest, mode, integrity)
6728
6736
  filePath: fileDest
6729
6737
  };
6730
6738
  }
6731
- if (existsSame(fileDest, integrity)) {
6732
- return {
6733
- checkedAt: Date.now(),
6734
- filePath: fileDest
6735
- };
6739
+ const checkedAt = writeOrCheck(fileDest, buffer, mode, integrity);
6740
+ locker.set(fileDest, checkedAt);
6741
+ return {
6742
+ checkedAt,
6743
+ filePath: fileDest
6744
+ };
6745
+ }
6746
+ function writeOrCheck(fileDest, buffer, mode, integrity) {
6747
+ const existingFile = fs7.statSync(fileDest, { throwIfNoEntry: false });
6748
+ if (existingFile) {
6749
+ if (verifyFileIntegrity(fileDest, integrity)) {
6750
+ return Date.now();
6751
+ }
6752
+ return writeFileAtomic(fileDest, buffer, mode);
6753
+ }
6754
+ try {
6755
+ writeFileExclusive(fileDest, buffer, mode);
6756
+ } catch (err) {
6757
+ if (util5.types.isNativeError(err) && "code" in err && err.code === "EEXIST") {
6758
+ if (verifyFileIntegrity(fileDest, integrity)) {
6759
+ return Date.now();
6760
+ }
6761
+ return writeFileAtomic(fileDest, buffer, mode);
6762
+ }
6763
+ throw err;
6736
6764
  }
6765
+ return Date.now();
6766
+ }
6767
+ function writeFileAtomic(fileDest, buffer, mode) {
6737
6768
  const temp = pathTemp2(fileDest);
6738
6769
  writeFile(temp, buffer, mode);
6739
- const birthtimeMs = Date.now();
6740
6770
  optimisticRenameOverwrite(temp, fileDest);
6741
- locker.set(fileDest, birthtimeMs);
6742
- return {
6743
- checkedAt: birthtimeMs,
6744
- filePath: fileDest
6745
- };
6771
+ return Date.now();
6746
6772
  }
6747
6773
  function optimisticRenameOverwrite(temp, fileDest) {
6748
6774
  try {
@@ -6766,12 +6792,6 @@ function removeSuffix(filePath) {
6766
6792
  }
6767
6793
  return withoutSuffix;
6768
6794
  }
6769
- function existsSame(filename, integrity) {
6770
- const existingFile = fs7.statSync(filename, { throwIfNoEntry: false });
6771
- if (!existingFile)
6772
- return false;
6773
- return verifyFileIntegrity(filename, integrity);
6774
- }
6775
6795
 
6776
6796
  // ../core/types/lib/misc.js
6777
6797
  var DEPENDENCIES_FIELDS = [
@@ -6848,10 +6868,31 @@ function removeContentsOfDirSync(dir) {
6848
6868
  // ../fs/indexed-pkg-importer/lib/importIndexedDir.js
6849
6869
  var import_sanitize_filename = __toESM(require_sanitize_filename(), 1);
6850
6870
  var filenameConflictsLogger = logger("_filename-conflicts");
6851
- function importIndexedDir(importFile, newDir, filenames, opts2) {
6871
+ function importIndexedDir(importer, newDir, filenames, opts2) {
6872
+ if (!opts2.keepModulesDir)
6873
+ try {
6874
+ if (opts2.safeToSkip) {
6875
+ fs9.mkdirSync(newDir, { recursive: true });
6876
+ } else {
6877
+ makeEmptyDirSync(newDir, { recursive: true });
6878
+ }
6879
+ tryImportIndexedDir(importer, newDir, filenames);
6880
+ return;
6881
+ } catch (err) {
6882
+ if (util6.types.isNativeError(err) && "code" in err && err.code === "EEXIST") {
6883
+ if (allFilesMatch(newDir, filenames))
6884
+ return;
6885
+ } else {
6886
+ try {
6887
+ rimrafSync(newDir);
6888
+ } catch {
6889
+ }
6890
+ }
6891
+ }
6852
6892
  const stage = fastPathTemp(newDir);
6853
6893
  try {
6854
- tryImportIndexedDir(importFile, stage, filenames);
6894
+ makeEmptyDirSync(stage, { recursive: true });
6895
+ tryImportIndexedDir({ importFile: importer.importFile, importFileAtomic: importer.importFile }, stage, filenames);
6855
6896
  if (opts2.keepModulesDir) {
6856
6897
  moveOrMergeModulesDirs(path13.join(newDir, "node_modules"), path13.join(stage, "node_modules"));
6857
6898
  }
@@ -6869,16 +6910,13 @@ function importIndexedDir(importFile, newDir, filenames, opts2) {
6869
6910
  writingTo: newDir
6870
6911
  });
6871
6912
  globalWarn(`Not all files were linked to "${path13.relative(process.cwd(), newDir)}". Some of the files have equal names in different case, which is an issue on case-insensitive filesystems. The conflicting file names are: ${JSON.stringify(Object.fromEntries(conflictingFileNames))}`);
6872
- importIndexedDir(importFile, newDir, uniqueFileMap, opts2);
6913
+ importIndexedDir(importer, newDir, uniqueFileMap, opts2);
6873
6914
  return;
6874
6915
  }
6875
6916
  if (util6.types.isNativeError(err) && "code" in err && err.code === "ENOENT") {
6876
- const { sanitizedFilenames, invalidFilenames } = sanitizeFilenames(filenames);
6877
- if (invalidFilenames.length === 0)
6878
- throw err;
6879
- globalWarn(`The package linked to "${path13.relative(process.cwd(), newDir)}" had files with invalid names: ${invalidFilenames.join(", ")}. They were renamed.`);
6880
- importIndexedDir(importFile, newDir, sanitizedFilenames, opts2);
6881
- return;
6917
+ if (retryWithSanitizedFilenames(importer, newDir, filenames, opts2))
6918
+ return;
6919
+ throw err;
6882
6920
  }
6883
6921
  throw err;
6884
6922
  }
@@ -6931,6 +6969,14 @@ function allFilesMatch(dir, filenames) {
6931
6969
  }
6932
6970
  return true;
6933
6971
  }
6972
+ function retryWithSanitizedFilenames(importer, newDir, filenames, opts2) {
6973
+ const { sanitizedFilenames, invalidFilenames } = sanitizeFilenames(filenames);
6974
+ if (invalidFilenames.length === 0)
6975
+ return false;
6976
+ globalWarn(`The package linked to "${path13.relative(process.cwd(), newDir)}" had files with invalid names: ${invalidFilenames.join(", ")}. They were renamed.`);
6977
+ importIndexedDir(importer, newDir, sanitizedFilenames, opts2);
6978
+ return true;
6979
+ }
6934
6980
  function sanitizeFilenames(filenames) {
6935
6981
  const sanitizedFilenames = /* @__PURE__ */ new Map();
6936
6982
  const invalidFilenames = [];
@@ -6943,8 +6989,7 @@ function sanitizeFilenames(filenames) {
6943
6989
  }
6944
6990
  return { sanitizedFilenames, invalidFilenames };
6945
6991
  }
6946
- function tryImportIndexedDir(importFile, newDir, filenames) {
6947
- makeEmptyDirSync(newDir, { recursive: true });
6992
+ function tryImportIndexedDir({ importFile, importFileAtomic }, newDir, filenames) {
6948
6993
  const allDirs = /* @__PURE__ */ new Set();
6949
6994
  for (const f of filenames.keys()) {
6950
6995
  const dir = path13.dirname(f);
@@ -6953,9 +6998,16 @@ function tryImportIndexedDir(importFile, newDir, filenames) {
6953
6998
  allDirs.add(dir);
6954
6999
  }
6955
7000
  Array.from(allDirs).sort((d1, d2) => d1.length - d2.length).forEach((dir) => fs9.mkdirSync(path13.join(newDir, dir), { recursive: true }));
7001
+ let packageJsonSrc;
6956
7002
  for (const [f, src2] of filenames) {
6957
- const dest = path13.join(newDir, f);
6958
- importFile(src2, dest);
7003
+ if (f === "package.json") {
7004
+ packageJsonSrc = src2;
7005
+ continue;
7006
+ }
7007
+ importFile(src2, path13.join(newDir, f));
7008
+ }
7009
+ if (packageJsonSrc !== void 0) {
7010
+ importFileAtomic(packageJsonSrc, path13.join(newDir, "package.json"));
6959
7011
  }
6960
7012
  }
6961
7013
  function getUniqueFileMap(fileMap) {
@@ -7091,7 +7143,7 @@ function createCloneOrCopyImporter() {
7091
7143
  }
7092
7144
  function clonePkg(clone, to, opts2) {
7093
7145
  if (opts2.resolvedFrom !== "store" || opts2.force || !pkgExistsAtTargetDir(to, opts2.filesMap)) {
7094
- importIndexedDir(clone, to, opts2.filesMap, opts2);
7146
+ importIndexedDir({ importFile: clone, importFileAtomic: clone }, to, opts2.filesMap, opts2);
7095
7147
  return "clone";
7096
7148
  }
7097
7149
  return void 0;
@@ -7131,7 +7183,7 @@ function createCloneFunction() {
7131
7183
  }
7132
7184
  function hardlinkPkg(importFile, to, opts2) {
7133
7185
  if (opts2.force || shouldRelinkPkg(to, opts2)) {
7134
- importIndexedDir(importFile, to, opts2.filesMap, opts2);
7186
+ importIndexedDir({ importFile, importFileAtomic: importFile }, to, opts2.filesMap, opts2);
7135
7187
  return "hardlink";
7136
7188
  }
7137
7189
  return void 0;
@@ -7153,7 +7205,19 @@ function linkOrCopy2(existingPath, newPath) {
7153
7205
  } catch (err) {
7154
7206
  if (util7.types.isNativeError(err) && "code" in err && err.code === "EEXIST")
7155
7207
  return;
7156
- lib_default.copyFileSync(existingPath, newPath);
7208
+ resilientCopyFileSync(existingPath, newPath);
7209
+ }
7210
+ }
7211
+ function resilientCopyFileSync(src2, dest) {
7212
+ try {
7213
+ lib_default.copyFileSync(src2, dest);
7214
+ } catch (err) {
7215
+ if (util7.types.isNativeError(err) && "code" in err && err.code === "ENOTSUP") {
7216
+ const srcMode = lib_default.statSync(src2).mode;
7217
+ lib_default.writeFileSync(dest, lib_default.readFileSync(src2), { mode: srcMode });
7218
+ } else {
7219
+ throw err;
7220
+ }
7157
7221
  }
7158
7222
  }
7159
7223
  function pkgLinkedToStore(filesMap, linkedPkgDir) {
@@ -7174,11 +7238,24 @@ function pkgLinkedToStore(filesMap, linkedPkgDir) {
7174
7238
  }
7175
7239
  function copyPkg(to, opts2) {
7176
7240
  if (opts2.resolvedFrom !== "store" || opts2.force || !pkgExistsAtTargetDir(to, opts2.filesMap)) {
7177
- importIndexedDir(lib_default.copyFileSync, to, opts2.filesMap, opts2);
7241
+ importIndexedDir({ importFile: resilientCopyFileSync, importFileAtomic: atomicCopyFileSync }, to, opts2.filesMap, opts2);
7178
7242
  return "copy";
7179
7243
  }
7180
7244
  return void 0;
7181
7245
  }
7246
+ function atomicCopyFileSync(src2, dest) {
7247
+ const tmp = fastPathTemp(dest);
7248
+ try {
7249
+ resilientCopyFileSync(src2, tmp);
7250
+ } catch (err) {
7251
+ try {
7252
+ lib_default.unlinkSync(tmp);
7253
+ } catch {
7254
+ }
7255
+ throw err;
7256
+ }
7257
+ renameOverwriteSync(tmp, dest);
7258
+ }
7182
7259
 
7183
7260
  // ../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/mimic-function/5.0.1/42ffd44e2cba19e8e133b2bdc7d5939811fa14bc8061d1a5739a299c53ffa2b6/node_modules/mimic-function/index.js
7184
7261
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
@@ -10651,6 +10728,8 @@ function addTarballToStore({ buffer, storeDir, integrity, filesIndexFile, append
10651
10728
  if (appendManifest && manifest == null) {
10652
10729
  manifest = appendManifest;
10653
10730
  addManifestToCafs(cafs, filesIndex, appendManifest);
10731
+ } else if (!filesIndex.has("package.json")) {
10732
+ addPlaceholderPackageJsonToCafs(cafs, filesIndex);
10654
10733
  }
10655
10734
  const { filesIntegrity, filesMap } = processFilesIndex(filesIndex);
10656
10735
  const bundledManifest = manifest != null ? normalizeBundledManifest(manifest) : void 0;
@@ -10715,6 +10794,8 @@ function addFilesFromDir2({ appendManifest, dir, files, filesIndexFile, includeN
10715
10794
  if (appendManifest && manifest == null) {
10716
10795
  manifest = appendManifest;
10717
10796
  addManifestToCafs(cafs, filesIndex, appendManifest);
10797
+ } else if (!filesIndex.has("package.json")) {
10798
+ addPlaceholderPackageJsonToCafs(cafs, filesIndex);
10718
10799
  }
10719
10800
  const { filesIntegrity, filesMap } = processFilesIndex(filesIndex);
10720
10801
  const bundledManifest = manifest != null ? normalizeBundledManifest(manifest) : void 0;
@@ -10766,6 +10847,15 @@ function addManifestToCafs(cafs, filesIndex, manifest) {
10766
10847
  ...cafs.addFile(fileBuffer, mode)
10767
10848
  });
10768
10849
  }
10850
+ var PLACEHOLDER_PACKAGE_JSON = Buffer.from(JSON.stringify({ _pnpmPlaceholder: "This file was generated by pnpm. The original package did not contain a package.json." }), "utf8");
10851
+ function addPlaceholderPackageJsonToCafs(cafs, filesIndex) {
10852
+ const mode = 420;
10853
+ filesIndex.set("package.json", {
10854
+ mode,
10855
+ size: PLACEHOLDER_PACKAGE_JSON.length,
10856
+ ...cafs.addFile(PLACEHOLDER_PACKAGE_JSON, mode)
10857
+ });
10858
+ }
10769
10859
  function calculateDiff(baseFiles, sideEffectsFiles) {
10770
10860
  const deleted = [];
10771
10861
  const added = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/exe",
3
- "version": "11.0.0-beta.1",
3
+ "version": "11.0.0-beta.3",
4
4
  "description": "Fast, disk space efficient package manager",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -24,17 +24,17 @@
24
24
  "@reflink/reflink": "0.1.19"
25
25
  },
26
26
  "optionalDependencies": {
27
- "@pnpm/linux-arm64": "11.0.0-beta.1",
28
- "@pnpm/linux-x64": "11.0.0-beta.1",
29
- "@pnpm/macos-x64": "11.0.0-beta.1",
30
- "@pnpm/macos-arm64": "11.0.0-beta.1",
31
- "@pnpm/win-arm64": "11.0.0-beta.1",
32
- "@pnpm/win-x64": "11.0.0-beta.1"
27
+ "@pnpm/linux-arm64": "11.0.0-beta.3",
28
+ "@pnpm/linux-x64": "11.0.0-beta.3",
29
+ "@pnpm/macos-x64": "11.0.0-beta.3",
30
+ "@pnpm/win-arm64": "11.0.0-beta.3",
31
+ "@pnpm/win-x64": "11.0.0-beta.3",
32
+ "@pnpm/macos-arm64": "11.0.0-beta.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "execa": "npm:safe-execa@0.3.0",
36
36
  "tar": "^7.5.10",
37
- "@pnpm/exe": "11.0.0-beta.1"
37
+ "@pnpm/exe": "11.0.0-beta.3"
38
38
  },
39
39
  "preferGlobal": true,
40
40
  "publishConfig": {
@@ -44,6 +44,9 @@
44
44
  "preinstall": "node setup.js"
45
45
  },
46
46
  "bin": {
47
- "pnpm": "pnpm"
47
+ "pnpm": "pnpm",
48
+ "pn": "pn",
49
+ "pnpx": "pnpx",
50
+ "pnx": "pnx"
48
51
  }
49
52
  }
package/pn ADDED
@@ -0,0 +1 @@
1
+ This file intentionally left blank
package/pnpx ADDED
@@ -0,0 +1 @@
1
+ This file intentionally left blank
package/pnx ADDED
@@ -0,0 +1 @@
1
+ This file intentionally left blank
package/prepare.js CHANGED
@@ -1,6 +1,15 @@
1
1
  import fs from 'fs'
2
2
  import path from 'path'
3
3
 
4
- const pnpmCli = path.join(import.meta.dirname, 'pnpm')
5
- fs.unlinkSync(pnpmCli)
6
- fs.writeFileSync(pnpmCli, 'This file intentionally left blank', 'utf8')
4
+ const ownDir = import.meta.dirname
5
+ const placeholder = 'This file intentionally left blank'
6
+
7
+ for (const name of ['pnpm', 'pn', 'pnpx', 'pnx']) {
8
+ const file = path.join(ownDir, name)
9
+ try {
10
+ fs.unlinkSync(file)
11
+ } catch (e) {
12
+ if (e.code !== 'ENOENT') throw e
13
+ }
14
+ fs.writeFileSync(file, placeholder, 'utf8')
15
+ }
package/setup.js CHANGED
@@ -21,11 +21,29 @@ if (!fs.existsSync(bin)) process.exit(0)
21
21
 
22
22
  linkSync(bin, path.resolve(ownDir, executable))
23
23
 
24
+ // Create pn alias (hardlink to the same binary)
25
+ const pnExecutable = platform === 'win' ? 'pn.exe' : 'pn'
26
+ linkSync(bin, path.resolve(ownDir, pnExecutable))
27
+
28
+ // Create pnpx and pnx scripts
29
+ createShellScript(ownDir, 'pnpx', 'pnpm dlx')
30
+ createShellScript(ownDir, 'pnx', 'pnpm dlx')
31
+
24
32
  if (platform === 'win') {
33
+ // On Windows, also hardlink the binary as 'pnpm' and 'pn' (no .exe
34
+ // extension). npm's bin shims point to the name from publishConfig.bin,
35
+ // and npm does NOT re-read package.json after preinstall, so rewriting
36
+ // the bin entry has no effect on the shims. The file at the original
37
+ // name must be the real binary so the shim can execute it.
38
+ linkSync(bin, path.resolve(ownDir, 'pnpm'))
39
+ linkSync(bin, path.resolve(ownDir, 'pn'))
40
+
25
41
  const pkgJsonPath = path.resolve(ownDir, 'package.json')
26
42
  const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))
27
- fs.writeFileSync(path.resolve(ownDir, 'pnpm'), 'This file intentionally left blank')
28
43
  pkg.bin.pnpm = 'pnpm.exe'
44
+ pkg.bin.pn = 'pn.exe'
45
+ pkg.bin.pnpx = 'pnpx.cmd'
46
+ pkg.bin.pnx = 'pnx.cmd'
29
47
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2))
30
48
  }
31
49
 
@@ -39,3 +57,12 @@ function linkSync(src, dest) {
39
57
  }
40
58
  return fs.linkSync(src, dest)
41
59
  }
60
+
61
+ function createShellScript(dir, name, command) {
62
+ fs.writeFileSync(path.resolve(dir, name), `#!/bin/sh\nexec ${command} "$@"\n`, { mode: 0o755 })
63
+
64
+ if (platform === 'win') {
65
+ fs.writeFileSync(path.resolve(dir, name + '.cmd'), `@echo off\n${command} %*\n`)
66
+ fs.writeFileSync(path.resolve(dir, name + '.ps1'), `${command} @args\n`)
67
+ }
68
+ }
@@ -1,138 +0,0 @@
1
- /**
2
- * @preserve
3
- * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
4
- *
5
- * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
6
- * @see http://github.com/homebrewing/brauhaus-diff
7
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
8
- * @see http://github.com/garycourt/murmurhash-js
9
- * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
10
- * @see http://sites.google.com/site/murmurhash/
11
- */
12
- (function(){
13
- var cache;
14
-
15
- // Call this function without `new` to use the cached object (good for
16
- // single-threaded environments), or with `new` to create a new object.
17
- //
18
- // @param {string} key A UTF-16 or ASCII string
19
- // @param {number} seed An optional positive integer
20
- // @return {object} A MurmurHash3 object for incremental hashing
21
- function MurmurHash3(key, seed) {
22
- var m = this instanceof MurmurHash3 ? this : cache;
23
- m.reset(seed)
24
- if (typeof key === 'string' && key.length > 0) {
25
- m.hash(key);
26
- }
27
-
28
- if (m !== this) {
29
- return m;
30
- }
31
- };
32
-
33
- // Incrementally add a string to this hash
34
- //
35
- // @param {string} key A UTF-16 or ASCII string
36
- // @return {object} this
37
- MurmurHash3.prototype.hash = function(key) {
38
- var h1, k1, i, top, len;
39
-
40
- len = key.length;
41
- this.len += len;
42
-
43
- k1 = this.k1;
44
- i = 0;
45
- switch (this.rem) {
46
- case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0;
47
- case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0;
48
- case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0;
49
- case 3:
50
- k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0;
51
- k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0;
52
- }
53
-
54
- this.rem = (len + this.rem) & 3; // & 3 is same as % 4
55
- len -= this.rem;
56
- if (len > 0) {
57
- h1 = this.h1;
58
- while (1) {
59
- k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff;
60
- k1 = (k1 << 15) | (k1 >>> 17);
61
- k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff;
62
-
63
- h1 ^= k1;
64
- h1 = (h1 << 13) | (h1 >>> 19);
65
- h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff;
66
-
67
- if (i >= len) {
68
- break;
69
- }
70
-
71
- k1 = ((key.charCodeAt(i++) & 0xffff)) ^
72
- ((key.charCodeAt(i++) & 0xffff) << 8) ^
73
- ((key.charCodeAt(i++) & 0xffff) << 16);
74
- top = key.charCodeAt(i++);
75
- k1 ^= ((top & 0xff) << 24) ^
76
- ((top & 0xff00) >> 8);
77
- }
78
-
79
- k1 = 0;
80
- switch (this.rem) {
81
- case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16;
82
- case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8;
83
- case 1: k1 ^= (key.charCodeAt(i) & 0xffff);
84
- }
85
-
86
- this.h1 = h1;
87
- }
88
-
89
- this.k1 = k1;
90
- return this;
91
- };
92
-
93
- // Get the result of this hash
94
- //
95
- // @return {number} The 32-bit hash
96
- MurmurHash3.prototype.result = function() {
97
- var k1, h1;
98
-
99
- k1 = this.k1;
100
- h1 = this.h1;
101
-
102
- if (k1 > 0) {
103
- k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff;
104
- k1 = (k1 << 15) | (k1 >>> 17);
105
- k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff;
106
- h1 ^= k1;
107
- }
108
-
109
- h1 ^= this.len;
110
-
111
- h1 ^= h1 >>> 16;
112
- h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff;
113
- h1 ^= h1 >>> 13;
114
- h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff;
115
- h1 ^= h1 >>> 16;
116
-
117
- return h1 >>> 0;
118
- };
119
-
120
- // Reset the hash object for reuse
121
- //
122
- // @param {number} seed An optional positive integer
123
- MurmurHash3.prototype.reset = function(seed) {
124
- this.h1 = typeof seed === 'number' ? seed : 0;
125
- this.rem = this.k1 = this.len = 0;
126
- return this;
127
- };
128
-
129
- // A cached object to use. This can be safely used if you're in a single-
130
- // threaded environment, otherwise you need to create new hashes to use.
131
- cache = new MurmurHash3();
132
-
133
- if (typeof(module) != 'undefined') {
134
- module.exports = MurmurHash3;
135
- } else {
136
- this.MurmurHash3 = MurmurHash3;
137
- }
138
- }());
@@ -1,12 +0,0 @@
1
- /**
2
- * @preserve
3
- * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
4
- *
5
- * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
6
- * @see http://github.com/homebrewing/brauhaus-diff
7
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
8
- * @see http://github.com/garycourt/murmurhash-js
9
- * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
10
- * @see http://sites.google.com/site/murmurhash/
11
- */
12
- !function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}();
@@ -1,40 +0,0 @@
1
- {
2
- "name": "imurmurhash",
3
- "version": "0.1.4",
4
- "description": "An incremental implementation of MurmurHash3",
5
- "homepage": "https://github.com/jensyt/imurmurhash-js",
6
- "main": "imurmurhash.js",
7
- "files": [
8
- "imurmurhash.js",
9
- "imurmurhash.min.js",
10
- "package.json",
11
- "README.md"
12
- ],
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/jensyt/imurmurhash-js"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/jensyt/imurmurhash-js/issues"
19
- },
20
- "keywords": [
21
- "murmur",
22
- "murmurhash",
23
- "murmurhash3",
24
- "hash",
25
- "incremental"
26
- ],
27
- "author": {
28
- "name": "Jens Taylor",
29
- "email": "jensyt@gmail.com",
30
- "url": "https://github.com/homebrewing"
31
- },
32
- "license": "MIT",
33
- "dependencies": {
34
- },
35
- "devDependencies": {
36
- },
37
- "engines": {
38
- "node": ">=0.8.19"
39
- }
40
- }