pnpm 10.27.0 → 10.28.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.
@@ -17,8 +17,8 @@ hoistedLocations:
17
17
  - node_modules/agent-base
18
18
  ansi-regex@5.0.1:
19
19
  - node_modules/wrap-ansi-cjs/node_modules/ansi-regex
20
- - node_modules/string-width-cjs/node_modules/ansi-regex
21
20
  - node_modules/strip-ansi-cjs/node_modules/ansi-regex
21
+ - node_modules/string-width-cjs/node_modules/ansi-regex
22
22
  ansi-regex@6.2.2:
23
23
  - node_modules/ansi-regex
24
24
  ansi-styles@4.3.0:
@@ -194,9 +194,9 @@ included:
194
194
  injectedDeps: {}
195
195
  layoutVersion: 5
196
196
  nodeLinker: hoisted
197
- packageManager: pnpm@10.26.0
197
+ packageManager: pnpm@10.27.0
198
198
  pendingBuilds: []
199
- prunedAt: Tue, 30 Dec 2025 21:14:00 GMT
199
+ prunedAt: Fri, 09 Jan 2026 23:04:58 GMT
200
200
  publicHoistPattern: []
201
201
  registries:
202
202
  '@jsr': https://npm.jsr.io/
@@ -1,5 +1,5 @@
1
1
  {
2
- "lastValidatedTimestamp": 1767129240557,
2
+ "lastValidatedTimestamp": 1767999898134,
3
3
  "projects": {},
4
4
  "pnpmfiles": [],
5
5
  "settings": {
package/dist/pnpm.cjs CHANGED
@@ -2972,7 +2972,7 @@ var require_lib4 = __commonJS({
2972
2972
  var load_json_file_1 = __importDefault2(require_load_json_file());
2973
2973
  var defaultManifest = {
2974
2974
  name: true ? "pnpm" : "pnpm",
2975
- version: true ? "10.27.0" : "0.0.0"
2975
+ version: true ? "10.28.0" : "0.0.0"
2976
2976
  };
2977
2977
  var pkgJson;
2978
2978
  if (require.main == null) {
@@ -18844,6 +18844,7 @@ var require_getOptionsFromRootManifest = __commonJS({
18844
18844
  "packageExtensions",
18845
18845
  "patchedDependencies",
18846
18846
  "peerDependencyRules",
18847
+ "requiredScripts",
18847
18848
  "supportedArchitectures",
18848
18849
  "updateConfig"
18849
18850
  ], manifest.pnpm ?? {}),
@@ -108776,11 +108777,13 @@ var require_packageRequester = __commonJS({
108776
108777
  });
108777
108778
  const getIndexFilePathInCafs = store_cafs_1.getIndexFilePathInCafs.bind(null, opts.storeDir);
108778
108779
  const fetch = fetcher.bind(null, opts.fetchers, opts.cafs);
108780
+ const getFilePathByModeInCafs = store_cafs_1.getFilePathByModeInCafs.bind(null, opts.storeDir);
108781
+ const readPkgFromCafs = worker_1.readPkgFromCafs.bind(null, opts.storeDir, opts.verifyStoreIntegrity);
108779
108782
  const fetchPackageToStore = fetchToStore.bind(null, {
108780
- readPkgFromCafs: worker_1.readPkgFromCafs.bind(null, opts.storeDir, opts.verifyStoreIntegrity),
108783
+ readPkgFromCafs,
108781
108784
  fetch,
108782
108785
  fetchingLocker: /* @__PURE__ */ new Map(),
108783
- getFilePathByModeInCafs: store_cafs_1.getFilePathByModeInCafs.bind(null, opts.storeDir),
108786
+ getFilePathByModeInCafs,
108784
108787
  getIndexFilePathInCafs,
108785
108788
  requestsQueue: Object.assign(requestsQueue, {
108786
108789
  counter: 0,
@@ -108790,12 +108793,19 @@ var require_packageRequester = __commonJS({
108790
108793
  virtualStoreDirMaxLength: opts.virtualStoreDirMaxLength,
108791
108794
  strictStorePkgContentCheck: opts.strictStorePkgContentCheck
108792
108795
  });
108796
+ const peekPackageFromStore = peekFromStore.bind(null, {
108797
+ getIndexFilePathInCafs,
108798
+ readPkgFromCafs,
108799
+ fetchingLockerForPeek: /* @__PURE__ */ new Map(),
108800
+ strictStorePkgContentCheck: opts.strictStorePkgContentCheck
108801
+ });
108793
108802
  const requestPackage = resolveAndFetch.bind(null, {
108794
108803
  engineStrict: opts.engineStrict,
108795
108804
  nodeVersion: opts.nodeVersion,
108796
108805
  pnpmVersion: opts.pnpmVersion,
108797
108806
  force: opts.force,
108798
108807
  fetchPackageToStore,
108808
+ peekPackageFromStore,
108799
108809
  requestsQueue,
108800
108810
  resolve: opts.resolve,
108801
108811
  storeDir: opts.storeDir
@@ -108822,7 +108832,7 @@ var require_packageRequester = __commonJS({
108822
108832
  let updated = false;
108823
108833
  let resolvedVia;
108824
108834
  let publishedAt;
108825
- if (!skipResolution || options.skipFetch === true || Boolean(pkgId?.startsWith("file:")) || wantedDependency.optional === true) {
108835
+ async function performResolution() {
108826
108836
  const preferredVersions = skipResolution && options.currentPkg?.name != null && options.currentPkg?.version != null ? {
108827
108837
  ...options.preferredVersions,
108828
108838
  [options.currentPkg.name]: { [options.currentPkg.version]: "version" }
@@ -108857,6 +108867,19 @@ var require_packageRequester = __commonJS({
108857
108867
  normalizedBareSpecifier = resolveResult.normalizedBareSpecifier;
108858
108868
  alias = resolveResult.alias;
108859
108869
  }
108870
+ if (!skipResolution || options.skipFetch === true || Boolean(pkgId?.startsWith("file:")) || wantedDependency.optional === true) {
108871
+ if (skipResolution && !pkgId?.startsWith("file:") && wantedDependency.optional !== true && pkgId != null) {
108872
+ const pkg2 = await ctx.peekPackageFromStore({
108873
+ ...options.expectedPkg,
108874
+ id: pkgId,
108875
+ resolution
108876
+ });
108877
+ manifest = pkg2?.bundledManifest;
108878
+ }
108879
+ if (manifest == null) {
108880
+ await performResolution();
108881
+ }
108882
+ }
108860
108883
  const id = pkgId;
108861
108884
  if ("type" in resolution && resolution.type === "directory" && !id.startsWith("file:")) {
108862
108885
  if (manifest == null) {
@@ -109066,23 +109089,7 @@ var require_packageRequester = __commonJS({
109066
109089
  if (!opts.force && (!isLocalTarballDep || await tarballIsUpToDate(opts.pkg.resolution, target, opts.lockfileDir)) && !isLocalPkg) {
109067
109090
  const { verified, pkgFilesIndex, manifest, requiresBuild } = await ctx.readPkgFromCafs(filesIndexFile, opts.fetchRawManifest);
109068
109091
  if (verified) {
109069
- if (pkgFilesIndex.name != null && opts.pkg?.name != null && pkgFilesIndex.name.toLowerCase() !== opts.pkg.name.toLowerCase() || pkgFilesIndex.version != null && opts.pkg?.version != null && // We used to not normalize the package versions before writing them to the lockfile and store.
109070
- // So it may happen that the version will be in different formats.
109071
- // For instance, v1.0.0 and 1.0.0
109072
- // Hence, we need to use semver.eq() to compare them.
109073
- !(0, equalOrSemverEqual_js_1.equalOrSemverEqual)(pkgFilesIndex.version, opts.pkg.version)) {
109074
- const msg = `Package name mismatch found while reading ${JSON.stringify(opts.pkg.resolution)} from the store.`;
109075
- const hint = `This means that either the lockfile is broken or the package metadata (name and version) inside the package's package.json file doesn't match the metadata in the registry. Expected package: ${opts.pkg.name}@${opts.pkg.version}. Actual package in the store with the given integrity: ${pkgFilesIndex.name}@${pkgFilesIndex.version}.`;
109076
- if (ctx.strictStorePkgContentCheck ?? true) {
109077
- throw new error_1.PnpmError("UNEXPECTED_PKG_CONTENT_IN_STORE", msg, {
109078
- hint: `${hint}
109079
-
109080
- If you want to ignore this issue, set the strict-store-pkg-content-check to false.`
109081
- });
109082
- } else {
109083
- (0, logger_1.globalWarn)(`${msg} ${hint}`);
109084
- }
109085
- }
109092
+ checkPackageMismatch({ pkgFilesIndex, pkg: opts.pkg, strictStorePkgContentCheck: ctx.strictStorePkgContentCheck });
109086
109093
  fetching.resolve({
109087
109094
  files: {
109088
109095
  unprocessed: true,
@@ -109148,9 +109155,56 @@ If you want to ignore this issue, set the strict-store-pkg-content-check to fals
109148
109155
  }
109149
109156
  }
109150
109157
  }
109158
+ async function peekFromStore(ctx, pkg) {
109159
+ if (pkg.resolution.type != null || pkg.resolution.integrity == null) {
109160
+ return void 0;
109161
+ }
109162
+ const indexFilePathInCafs = ctx.getIndexFilePathInCafs(pkg.resolution.integrity, pkg.id);
109163
+ const existingRequest = ctx.fetchingLockerForPeek.get(indexFilePathInCafs);
109164
+ if (existingRequest != null) {
109165
+ return existingRequest;
109166
+ }
109167
+ const request = ctx.readPkgFromCafs(indexFilePathInCafs, true).then(({ pkgFilesIndex, manifest, requiresBuild, verified }) => {
109168
+ if (!verified) {
109169
+ return void 0;
109170
+ }
109171
+ checkPackageMismatch({ pkgFilesIndex, pkg, strictStorePkgContentCheck: ctx.strictStorePkgContentCheck });
109172
+ return {
109173
+ files: {
109174
+ unprocessed: true,
109175
+ resolvedFrom: "store",
109176
+ filesIndex: pkgFilesIndex.files,
109177
+ sideEffects: pkgFilesIndex.sideEffects,
109178
+ requiresBuild
109179
+ },
109180
+ bundledManifest: manifest == null ? manifest : normalizeBundledManifest(manifest)
109181
+ };
109182
+ });
109183
+ ctx.fetchingLockerForPeek.set(indexFilePathInCafs, request);
109184
+ return request;
109185
+ }
109151
109186
  async function readBundledManifest(pkgJsonPath) {
109152
109187
  return pickBundledManifest(await (0, read_package_json_1.readPackageJson)(pkgJsonPath));
109153
109188
  }
109189
+ function checkPackageMismatch({ pkgFilesIndex, pkg, strictStorePkgContentCheck }) {
109190
+ if (pkgFilesIndex.name != null && pkg?.name != null && pkgFilesIndex.name.toLowerCase() !== pkg.name.toLowerCase() || pkgFilesIndex.version != null && pkg?.version != null && // We used to not normalize the package versions before writing them to the lockfile and store.
109191
+ // So it may happen that the version will be in different formats.
109192
+ // For instance, v1.0.0 and 1.0.0
109193
+ // Hence, we need to use semver.eq() to compare them.
109194
+ !(0, equalOrSemverEqual_js_1.equalOrSemverEqual)(pkgFilesIndex.version, pkg.version)) {
109195
+ const msg = `Package name mismatch found while reading ${JSON.stringify(pkg.resolution)} from the store.`;
109196
+ const hint = `This means that either the lockfile is broken or the package metadata (name and version) inside the package's package.json file doesn't match the metadata in the registry. Expected package: ${pkg.name}@${pkg.version}. Actual package in the store with the given integrity: ${pkgFilesIndex.name}@${pkgFilesIndex.version}.`;
109197
+ if (strictStorePkgContentCheck ?? true) {
109198
+ throw new error_1.PnpmError("UNEXPECTED_PKG_CONTENT_IN_STORE", msg, {
109199
+ hint: `${hint}
109200
+
109201
+ If you want to ignore this issue, set the strict-store-pkg-content-check to false.`
109202
+ });
109203
+ } else {
109204
+ (0, logger_1.globalWarn)(`${msg} ${hint}`);
109205
+ }
109206
+ }
109207
+ }
109154
109208
  async function tarballIsUpToDate(resolution, pkgInStoreLocation, lockfileDir) {
109155
109209
  let currentIntegrity;
109156
109210
  try {
@@ -109214,11 +109268,15 @@ var require_projectRegistry = __commonJS({
109214
109268
  var error_1 = require_lib6();
109215
109269
  var logger_1 = require_lib();
109216
109270
  var symlink_dir_1 = __importDefault2(require_dist18());
109271
+ var is_subdir_1 = __importDefault2(require_is_subdir());
109217
109272
  var PROJECTS_DIR = "projects";
109218
109273
  function getProjectsRegistryDir(storeDir) {
109219
109274
  return path_1.default.join(storeDir, PROJECTS_DIR);
109220
109275
  }
109221
109276
  async function registerProject(storeDir, projectDir) {
109277
+ if ((0, is_subdir_1.default)(projectDir, storeDir)) {
109278
+ return;
109279
+ }
109222
109280
  const registryDir = getProjectsRegistryDir(storeDir);
109223
109281
  await fs_1.promises.mkdir(registryDir, { recursive: true });
109224
109282
  const linkPath = path_1.default.join(registryDir, (0, crypto_hash_1.createShortHash)(projectDir));
@@ -110862,6 +110920,9 @@ var require_requirePnpmfile = __commonJS({
110862
110920
  }
110863
110921
  return newPkg;
110864
110922
  };
110923
+ if (pnpmfile?.hooks?.beforePacking && typeof pnpmfile.hooks.beforePacking !== "function") {
110924
+ throw new TypeError("hooks.beforePacking should be a function");
110925
+ }
110865
110926
  }
110866
110927
  return { pnpmfileModule: pnpmfile };
110867
110928
  } catch (err) {
@@ -110944,6 +111005,7 @@ var require_requireHooks = __commonJS({
110944
111005
  const mergedFinders = {};
110945
111006
  const cookedHooks = {
110946
111007
  readPackage: [],
111008
+ beforePacking: [],
110947
111009
  preResolution: [],
110948
111010
  afterAllResolved: [],
110949
111011
  filterLog: [],
@@ -110983,6 +111045,11 @@ var require_requireHooks = __commonJS({
110983
111045
  cookedHooks[hookName].push((pkg) => fn(pkg, context));
110984
111046
  }
110985
111047
  }
111048
+ if (fileHooks.beforePacking) {
111049
+ const fn = fileHooks.beforePacking;
111050
+ const context = createReadPackageHookContext(file, prefix, "beforePacking");
111051
+ cookedHooks.beforePacking.push((pkg, dir) => fn(pkg, dir, context));
111052
+ }
110986
111053
  if (fileHooks.filterLog) {
110987
111054
  cookedHooks.filterLog.push(fileHooks.filterLog);
110988
111055
  }
@@ -179895,7 +179962,7 @@ var require_lib187 = __commonJS({
179895
179962
  "postpublish"
179896
179963
  ];
179897
179964
  async function createExportableManifest(dir, originalManifest, opts) {
179898
- const publishManifest = (0, omit_1.default)(["pnpm", "scripts", "packageManager"], originalManifest);
179965
+ let publishManifest = (0, omit_1.default)(["pnpm", "scripts", "packageManager"], originalManifest);
179899
179966
  if (originalManifest.scripts != null) {
179900
179967
  publishManifest.scripts = (0, omit_1.default)(PREPUBLISH_SCRIPTS, originalManifest.scripts);
179901
179968
  }
@@ -179923,6 +179990,9 @@ var require_lib187 = __commonJS({
179923
179990
  if (opts?.readmeFile) {
179924
179991
  publishManifest.readme ??= opts.readmeFile;
179925
179992
  }
179993
+ for (const hook of opts?.hooks?.beforePacking ?? []) {
179994
+ publishManifest = await hook(publishManifest, dir) ?? publishManifest;
179995
+ }
179926
179996
  return publishManifest;
179927
179997
  }
179928
179998
  function combineConverters(...converters) {
@@ -181790,7 +181860,8 @@ ${filename}`).join("\n\n");
181790
181860
  modulesDir: path_1.default.join(opts.dir, "node_modules"),
181791
181861
  manifest,
181792
181862
  embedReadme: opts.embedReadme,
181793
- catalogs: opts.catalogs ?? {}
181863
+ catalogs: opts.catalogs ?? {},
181864
+ hooks: opts.hooks
181794
181865
  });
181795
181866
  const files = await (0, fs_packlist_1.packlist)(dir, {
181796
181867
  packageJsonCache: {
@@ -181876,10 +181947,11 @@ ${filename}`).join("\n\n");
181876
181947
  });
181877
181948
  }
181878
181949
  async function createPublishManifest(opts) {
181879
- const { projectDir, embedReadme, modulesDir, manifest, catalogs } = opts;
181950
+ const { projectDir, embedReadme, modulesDir, manifest, catalogs, hooks } = opts;
181880
181951
  const readmeFile = embedReadme ? await readReadmeFile(projectDir) : void 0;
181881
181952
  return (0, exportable_manifest_1.createExportableManifest)(projectDir, manifest, {
181882
181953
  catalogs,
181954
+ hooks,
181883
181955
  readmeFile,
181884
181956
  modulesDir
181885
181957
  });
@@ -183720,7 +183792,7 @@ var require_runRecursive = __commonJS({
183720
183792
  const stdio = !opts.stream && (opts.workspaceConcurrency === 1 || packageChunks.length === 1 && packageChunks[0].length === 1) ? "inherit" : "pipe";
183721
183793
  const existsPnp = existsInDir_js_1.existsInDir.bind(null, ".pnp.cjs");
183722
183794
  const workspacePnpPath = opts.workspaceDir && existsPnp(opts.workspaceDir);
183723
- const requiredScripts = opts.rootProjectManifest?.pnpm?.requiredScripts ?? [];
183795
+ const requiredScripts = opts.requiredScripts ?? [];
183724
183796
  if (requiredScripts.includes(scriptName)) {
183725
183797
  const missingScriptPackages = packageChunks.flat().map((prefix) => opts.selectedProjectsGraph[prefix]).filter((pkg) => getSpecifiedScripts(pkg.package.manifest.scripts ?? {}, scriptName).length < 1).map((pkg) => pkg.package.manifest.name ?? pkg.package.rootDir);
183726
183798
  if (missingScriptPackages.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pnpm",
3
- "version": "10.27.0",
3
+ "version": "10.28.0",
4
4
  "description": "Fast, disk space efficient package manager",
5
5
  "keywords": [
6
6
  "pnpm",