@pnpm/exe 11.0.0-rc.3 → 11.0.0-rc.4

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/dist/worker.js CHANGED
@@ -485,7 +485,7 @@ var require_graceful_fs = __commonJS({
485
485
  var polyfills = require_polyfills();
486
486
  var legacy = require_legacy_streams();
487
487
  var clone = require_clone();
488
- var util8 = __require("util");
488
+ var util9 = __require("util");
489
489
  var gracefulQueue;
490
490
  var previousSymbol;
491
491
  if (typeof Symbol === "function" && typeof Symbol.for === "function") {
@@ -505,11 +505,11 @@ var require_graceful_fs = __commonJS({
505
505
  });
506
506
  }
507
507
  var debug = noop;
508
- if (util8.debuglog)
509
- debug = util8.debuglog("gfs4");
508
+ if (util9.debuglog)
509
+ debug = util9.debuglog("gfs4");
510
510
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
511
511
  debug = function() {
512
- var m = util8.format.apply(util8, arguments);
512
+ var m = util9.format.apply(util9, arguments);
513
513
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
514
514
  console.error(m);
515
515
  };
@@ -3423,14 +3423,13 @@ var init_parseTarball = __esm({
3423
3423
 
3424
3424
  // ../store/cafs/lib/addFilesFromTarball.js
3425
3425
  import { gunzipSync } from "node:zlib";
3426
- function addFilesFromTarball(addBufferToCafs2, _ignore, tarballBuffer, readManifest) {
3427
- const ignore = _ignore ?? (() => false);
3426
+ function addFilesFromTarball(addBufferToCafs2, tarballBuffer, readManifest, ignore) {
3428
3427
  const tarContent = (0, import_is_gzip.default)(tarballBuffer) ? gunzipSync(tarballBuffer, { chunkSize: 128 * 1024 }) : Buffer.isBuffer(tarballBuffer) ? tarballBuffer : Buffer.from(tarballBuffer);
3429
3428
  const { files } = parseTarball(tarContent);
3430
3429
  const filesIndex = /* @__PURE__ */ new Map();
3431
3430
  let manifestBuffer;
3432
3431
  for (const [relativePath, { mode, offset, size }] of files) {
3433
- if (ignore(relativePath))
3432
+ if (ignore?.(relativePath))
3434
3433
  continue;
3435
3434
  const fileBuffer = tarContent.subarray(offset, offset + size);
3436
3435
  if (readManifest && relativePath === "package.json") {
@@ -5791,11 +5790,18 @@ function createCafs(storeDir, { ignoreFile, cafsLocker: cafsLocker2 } = {}) {
5791
5790
  const addBuffer = addBufferToCafs.bind(null, _writeBufferToCafs);
5792
5791
  return {
5793
5792
  addFilesFromDir: addFilesFromDir.bind(null, addBuffer),
5794
- addFilesFromTarball: addFilesFromTarball.bind(null, addBuffer, ignoreFile ?? null),
5793
+ addFilesFromTarball: (tarballBuffer, readManifest, callIgnore) => addFilesFromTarball(addBuffer, tarballBuffer, readManifest, combineIgnore(ignoreFile, callIgnore)),
5795
5794
  addFile: addBuffer,
5796
5795
  getFilePathByModeInCafs: getFilePathByModeInCafs.bind(null, storeDir)
5797
5796
  };
5798
5797
  }
5798
+ function combineIgnore(a, b) {
5799
+ if (!a)
5800
+ return b;
5801
+ if (!b)
5802
+ return a;
5803
+ return (filename) => a(filename) || b(filename);
5804
+ }
5799
5805
  function addBufferToCafs(writeBufferToCafs2, buffer, mode) {
5800
5806
  const digest = crypto4.hash(HASH_ALGORITHM, buffer, "hex");
5801
5807
  const isExecutable = modeIsExecutable(mode);
@@ -6472,6 +6478,7 @@ var require_msgpackr_extract = __commonJS({
6472
6478
  import crypto5 from "node:crypto";
6473
6479
  import fs12 from "node:fs";
6474
6480
  import path16 from "node:path";
6481
+ import util8 from "node:util";
6475
6482
  import { parentPort } from "node:worker_threads";
6476
6483
 
6477
6484
  // ../building/pkg-requires-build/lib/index.js
@@ -10958,7 +10965,7 @@ If you want to ignore this issue, set strictStorePkgContentCheck to false in you
10958
10965
  });
10959
10966
  }
10960
10967
  }
10961
- function addTarballToStore({ buffer, storeDir, integrity, filesIndexFile, appendManifest }) {
10968
+ function addTarballToStore({ buffer, storeDir, integrity, filesIndexFile, appendManifest, ignoreFilePattern }) {
10962
10969
  if (integrity) {
10963
10970
  const { algorithm, hexDigest } = parseIntegrity(integrity);
10964
10971
  const calculatedHash = crypto5.hash(algorithm, buffer, "hex");
@@ -10978,7 +10985,8 @@ function addTarballToStore({ buffer, storeDir, integrity, filesIndexFile, append
10978
10985
  cafsCache.set(storeDir, createCafs(storeDir));
10979
10986
  }
10980
10987
  const cafs = cafsCache.get(storeDir);
10981
- let { filesIndex, manifest } = cafs.addFilesFromTarball(buffer, true);
10988
+ const ignore = ignoreFilePattern ? makeIgnoreFromPattern(ignoreFilePattern) : void 0;
10989
+ let { filesIndex, manifest } = cafs.addFilesFromTarball(buffer, true, ignore);
10982
10990
  if (appendManifest && manifest == null) {
10983
10991
  manifest = appendManifest;
10984
10992
  addManifestToCafs(cafs, filesIndex, appendManifest);
@@ -11009,6 +11017,16 @@ function calcIntegrity(buffer) {
11009
11017
  const calculatedHash = crypto5.hash("sha512", buffer, "hex");
11010
11018
  return formatIntegrity("sha512", calculatedHash);
11011
11019
  }
11020
+ function makeIgnoreFromPattern(pattern) {
11021
+ let regex;
11022
+ try {
11023
+ regex = new RegExp(pattern);
11024
+ } catch (err) {
11025
+ const detail = util8.types.isNativeError(err) ? `: ${err.message}` : "";
11026
+ throw new PnpmError("INVALID_IGNORE_FILE_PATTERN", `Invalid ignoreFilePattern regex${detail}: ${pattern}`);
11027
+ }
11028
+ return (filename) => regex.test(filename);
11029
+ }
11012
11030
  function packToShared(data) {
11013
11031
  const packed = packForStorage(data);
11014
11032
  const shared = new SharedArrayBuffer(packed.byteLength);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/exe",
3
- "version": "11.0.0-rc.3",
3
+ "version": "11.0.0-rc.4",
4
4
  "description": "Fast, disk space efficient package manager",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -32,21 +32,20 @@
32
32
  "detect-libc": "^2.0.3"
33
33
  },
34
34
  "optionalDependencies": {
35
- "@pnpm/exe.darwin-arm64": "11.0.0-rc.3",
36
- "@pnpm/exe.darwin-x64": "11.0.0-rc.3",
37
- "@pnpm/exe.linux-arm64": "11.0.0-rc.3",
38
- "@pnpm/exe.linux-x64": "11.0.0-rc.3",
39
- "@pnpm/exe.linux-arm64-musl": "11.0.0-rc.3",
40
- "@pnpm/exe.linux-x64-musl": "11.0.0-rc.3",
41
- "@pnpm/exe.win32-arm64": "11.0.0-rc.3",
42
- "@pnpm/exe.win32-x64": "11.0.0-rc.3"
35
+ "@pnpm/linux-arm64": "11.0.0-rc.4",
36
+ "@pnpm/linux-x64": "11.0.0-rc.4",
37
+ "@pnpm/linuxstatic-arm64": "11.0.0-rc.4",
38
+ "@pnpm/linuxstatic-x64": "11.0.0-rc.4",
39
+ "@pnpm/macos-arm64": "11.0.0-rc.4",
40
+ "@pnpm/macos-x64": "11.0.0-rc.4",
41
+ "@pnpm/win-arm64": "11.0.0-rc.4",
42
+ "@pnpm/win-x64": "11.0.0-rc.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@jest/globals": "30.3.0",
46
46
  "execa": "npm:safe-execa@0.3.0",
47
- "tar": "^7.5.10",
48
- "@pnpm/exe": "11.0.0-rc.3",
49
- "@pnpm/jest-config": "1100.0.2"
47
+ "@pnpm/jest-config": "1100.0.3",
48
+ "@pnpm/exe": "11.0.0-rc.4"
50
49
  },
51
50
  "jest": {
52
51
  "preset": "@pnpm/jest-config"
@@ -56,7 +55,8 @@
56
55
  "tag": "next-10"
57
56
  },
58
57
  "scripts": {
59
- "preinstall": "node setup.js"
58
+ "preinstall": "node setup.js",
59
+ "build-artifacts": "pn --filter=pnpm prepublishOnly && node ./scripts/build-artifacts.ts"
60
60
  },
61
61
  "bin": {
62
62
  "pnpm": "pnpm",
@@ -1,9 +1,18 @@
1
1
  // Shared between setup.js (preinstall hook) and the test suite.
2
2
  // Computes the npm package name of the matching @pnpm/exe platform child for a
3
- // given host: `@pnpm/exe.<platform>-<arch>[-musl]`. Pure no I/O, no detect-libc
4
- // call so the musl branch is unit-testable without mocking.
3
+ // given host. Returns `@pnpm/<os>-<arch>`, where <os> is `macos` (darwin),
4
+ // `win` (win32), `linux` (glibc), or `linuxstatic` (musl). Pure no I/O, no
5
+ // detect-libc call — so the musl branch is unit-testable without mocking.
5
6
  export function exePlatformPkgName(platform, arch, libcFamily) {
6
7
  const normalizedArch = platform === 'win32' && arch === 'ia32' ? 'x86' : arch
7
- const libcSuffix = platform === 'linux' && libcFamily === 'musl' ? '-musl' : ''
8
- return `@pnpm/exe.${platform}-${normalizedArch}${libcSuffix}`
8
+ return `@pnpm/${legacyOsSegment(platform, libcFamily)}-${normalizedArch}`
9
+ }
10
+
11
+ function legacyOsSegment(platform, libcFamily) {
12
+ switch (platform) {
13
+ case 'darwin': return 'macos'
14
+ case 'win32': return 'win'
15
+ case 'linux': return libcFamily === 'musl' ? 'linuxstatic' : 'linux'
16
+ default: return platform
17
+ }
9
18
  }
package/setup.js CHANGED
@@ -4,11 +4,14 @@ import fs from 'fs'
4
4
  import { familySync } from 'detect-libc'
5
5
  import { exePlatformPkgName } from './platform-pkg-name.js'
6
6
 
7
- // Platform names match process.platform (linux | darwin | win32). On linux,
8
- // add a `-musl` libc suffix when detect-libc reports musl, matching the
9
- // @pnpm/exe.linux-<arch>-musl optional-dep naming. The name computation lives
10
- // in platform-pkg-name.js so it can be unit-tested without triggering the
11
- // side effects of this preinstall script.
7
+ // Platform package names use the legacy scheme: `@pnpm/macos-<arch>` (darwin),
8
+ // `@pnpm/win-<arch>` (win32), `@pnpm/linux-<arch>` (glibc), and
9
+ // `@pnpm/linuxstatic-<arch>` (musl Linux, detected via detect-libc). This is
10
+ // the naming published on npm, even though the workspace directories use the
11
+ // newer `<os>-<arch>[-musl]` scheme. Keeping these names lets `pnpm
12
+ // self-update` from older majors continue to resolve the right platform child.
13
+ // The name computation lives in platform-pkg-name.js so it can be unit-tested
14
+ // without triggering the side effects of this preinstall script.
12
15
  const platform = process.platform
13
16
  const pkgName = exePlatformPkgName(platform, process.arch, familySync())
14
17
  const pkgJson = fileURLToPath(import.meta.resolve(`${pkgName}/package.json`))