@pnpm/resolving.npm-resolver 1101.3.3 → 1101.4.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.
@@ -341,12 +341,23 @@ function projectTrustManifest(manifest) {
341
341
  // reads them; cast away the unsoundness so callers see the same nominal
342
342
  // shape without the per-version dependency graph / scripts / README bulk
343
343
  // carrying through. `_npmUser` is similarly narrowed to just
344
- // `trustedPublisher` — the only sub-field the trust check inspects — so
345
- // we don't keep maintainer name/email PII resident in the cache.
344
+ // `trustedPublisher` and `approver` — the only sub-fields the trust check
345
+ // inspects — so we don't keep maintainer name/email PII resident in the
346
+ // cache.
347
+ const approver = manifest._npmUser?.approver;
346
348
  const trustedPublisher = manifest._npmUser?.trustedPublisher;
347
349
  const provenance = manifest.dist?.attestations?.provenance;
350
+ let npmUser = undefined;
351
+ if (approver) {
352
+ npmUser ||= {};
353
+ npmUser.approver = {};
354
+ }
355
+ if (trustedPublisher) {
356
+ npmUser ||= {};
357
+ npmUser.trustedPublisher = trustedPublisher;
358
+ }
348
359
  return {
349
- _npmUser: trustedPublisher != null ? { trustedPublisher } : undefined,
360
+ _npmUser: npmUser,
350
361
  dist: provenance != null
351
362
  ? { attestations: { provenance } }
352
363
  : undefined,
@@ -201,7 +201,7 @@ export async function pickPackage(ctx, spec, opts) {
201
201
  }
202
202
  }
203
203
  }
204
- if (opts.publishedBy) {
204
+ if (opts.publishedBy && opts.publishedByExclude?.(spec.name) !== true) {
205
205
  const mtime = await limit(async () => getFileMtime(pkgMirror));
206
206
  if (mtime != null && mtime >= opts.publishedBy) {
207
207
  metaCachedInStore = metaCachedInStore ?? await limit(async () => loadMeta(pkgMirror));
@@ -1,6 +1,6 @@
1
1
  import type { PackageInRegistry, PackageMeta } from '@pnpm/resolving.registry.types';
2
2
  import type { PackageVersionPolicy } from '@pnpm/types';
3
- type TrustEvidence = 'provenance' | 'trustedPublisher';
3
+ type TrustEvidence = 'provenance' | 'trustedPublisher' | 'stagedPublish';
4
4
  export declare function failIfTrustDowngraded(meta: PackageMeta, version: string, opts?: {
5
5
  trustPolicyExclude?: PackageVersionPolicy;
6
6
  trustPolicyIgnoreAfter?: number;
@@ -2,6 +2,7 @@ import { PnpmError } from '@pnpm/error';
2
2
  import semver from 'semver';
3
3
  import { assertMetaHasTime } from './pickPackageFromMeta.js';
4
4
  const TRUST_RANK = {
5
+ stagedPublish: 3,
5
6
  trustedPublisher: 2,
6
7
  provenance: 1,
7
8
  };
@@ -51,6 +52,7 @@ export function failIfTrustDowngraded(meta, version, opts) {
51
52
  }
52
53
  function prettyPrintTrustEvidence(trustEvidence) {
53
54
  switch (trustEvidence) {
55
+ case 'stagedPublish': return 'staged publish';
54
56
  case 'trustedPublisher': return 'trusted publisher';
55
57
  case 'provenance': return 'provenance attestation';
56
58
  default: return 'no trust evidence';
@@ -70,14 +72,19 @@ function detectStrongestTrustEvidenceBeforeDate(meta, beforeDate, options) {
70
72
  const trustEvidence = getTrustEvidence(manifest);
71
73
  if (!trustEvidence)
72
74
  continue;
73
- if (trustEvidence === 'trustedPublisher') {
74
- return 'trustedPublisher';
75
+ if (best === undefined || TRUST_RANK[trustEvidence] > TRUST_RANK[best]) {
76
+ best = trustEvidence;
77
+ if (best === 'stagedPublish') {
78
+ return best;
79
+ }
75
80
  }
76
- best ||= 'provenance';
77
81
  }
78
82
  return best;
79
83
  }
80
84
  export function getTrustEvidence(manifest) {
85
+ if (manifest._npmUser?.approver) {
86
+ return 'stagedPublish';
87
+ }
81
88
  if (manifest._npmUser?.trustedPublisher && manifest.dist?.attestations?.provenance) {
82
89
  return 'trustedPublisher';
83
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/resolving.npm-resolver",
3
- "version": "1101.3.3",
3
+ "version": "1101.4.0",
4
4
  "description": "Resolver for npm-hosted packages",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -42,21 +42,21 @@
42
42
  "version-selector-type": "^3.0.0",
43
43
  "@pnpm/config.pick-registry-for-package": "1100.0.6",
44
44
  "@pnpm/constants": "1100.0.0",
45
- "@pnpm/core-loggers": "1100.1.2",
46
- "@pnpm/crypto.hash": "1100.0.1",
47
- "@pnpm/config.version-policy": "1100.1.2",
48
45
  "@pnpm/error": "1100.0.0",
46
+ "@pnpm/crypto.hash": "1100.0.1",
49
47
  "@pnpm/fetching.types": "1100.0.1",
50
- "@pnpm/resolving.registry.pkg-metadata-filter": "1100.0.5",
51
- "@pnpm/resolving.registry.types": "1100.0.5",
52
- "@pnpm/resolving.resolver-base": "1100.3.1",
48
+ "@pnpm/fs.graceful-fs": "1100.1.0",
49
+ "@pnpm/resolving.registry.pkg-metadata-filter": "1100.0.6",
50
+ "@pnpm/resolving.registry.types": "1100.1.0",
51
+ "@pnpm/resolving.jsr-specifier-parser": "1100.0.0",
53
52
  "@pnpm/store.cafs": "1100.1.7",
54
53
  "@pnpm/store.index": "1100.1.0",
55
- "@pnpm/fs.graceful-fs": "1100.1.0",
56
54
  "@pnpm/types": "1101.2.0",
55
+ "@pnpm/workspace.spec-parser": "1100.0.0",
56
+ "@pnpm/resolving.resolver-base": "1100.3.1",
57
57
  "@pnpm/workspace.range-resolver": "1100.0.1",
58
- "@pnpm/resolving.jsr-specifier-parser": "1100.0.0",
59
- "@pnpm/workspace.spec-parser": "1100.0.0"
58
+ "@pnpm/config.version-policy": "1100.1.2",
59
+ "@pnpm/core-loggers": "1100.1.2"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@pnpm/logger": "^1001.0.1",
@@ -71,10 +71,10 @@
71
71
  "load-json-file": "^7.0.1",
72
72
  "tempy": "3.0.0",
73
73
  "@pnpm/logger": "1100.0.0",
74
- "@pnpm/testing.mock-agent": "1100.0.7",
75
- "@pnpm/resolving.npm-resolver": "1101.3.3",
74
+ "@pnpm/network.fetch": "1100.0.8",
76
75
  "@pnpm/test-fixtures": "1100.0.0",
77
- "@pnpm/network.fetch": "1100.0.7"
76
+ "@pnpm/resolving.npm-resolver": "1101.4.0",
77
+ "@pnpm/testing.mock-agent": "1100.0.8"
78
78
  },
79
79
  "engines": {
80
80
  "node": ">=22.13"