Repository navigation
Conversation
pnpr accepts platform variant archives with a version, checks them against the primary, serves them as dist.pnpr.variants and at <name>@<version>/variants/<tag>. pnpm resolves them into a variations resolution with the primary as fallback, installs the variant selected for the platform, and hashes global virtual store slots by the selected archive. PoC shortcuts: the selected platform reaches the slot hash through a process-global, and the publish body limit is raised so one request can carry every variant. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Same-run syscall checkEach install runs 2 more times per revision, untimed, under
Integrated-Benchmark Report (Linux)Commit: Compared against main at: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.3533359263000007,
"stddev": 0.1513968772006778,
"median": 2.2451949761000005,
"user": 2.0827378399999996,
"system": 1.7126264999999996,
"min": 2.2305309306,
"max": 2.5637462086
},
{
"command": "pacquet@main",
"mean": 2.2972784067000003,
"stddev": 0.08355708113877937,
"median": 2.2574449996,
"user": 1.9931700399999996,
"system": 1.6781879,
"min": 2.2217314256000003,
"max": 2.4465073546
},
{
"command": "pnpr@HEAD",
"mean": 1.4421561781,
"stddev": 0.13897202628716399,
"median": 1.4015272206,
"user": 1.98488924,
"system": 1.6386845,
"min": 1.2884227896,
"max": 1.6575511276
},
{
"command": "pnpr@main",
"mean": 1.4632437307,
"stddev": 0.11680198614641131,
"median": 1.4373440575999998,
"user": 1.8546461400000003,
"system": 1.6492977999999998,
"min": 1.2869149506,
"max": 1.6912395146
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.23788853106,
"stddev": 0.004866387763503721,
"median": 0.23907886796,
"user": 0.29618156,
"system": 0.59470028,
"min": 0.22751048846,
"max": 0.24376949246000001
},
{
"command": "pacquet@main",
"mean": 0.23386778046,
"stddev": 0.010503849599538692,
"median": 0.23186906696,
"user": 0.29068166,
"system": 0.5759510800000001,
"min": 0.21862865946,
"max": 0.25768376446
},
{
"command": "pnpr@HEAD",
"mean": 0.26022069966,
"stddev": 0.008260243607100568,
"median": 0.25945098596000005,
"user": 0.29414256000000005,
"system": 0.60203188,
"min": 0.24692244446,
"max": 0.27419478946
},
{
"command": "pnpr@main",
"mean": 0.25085978325999997,
"stddev": 0.014313490747703118,
"median": 0.25300760495999997,
"user": 0.28533025999999995,
"system": 0.6130650799999999,
"min": 0.23007466446,
"max": 0.27734660246
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.007981973573469381,
"stddev": 0.0003792945345971723,
"median": 0.0078768314,
"user": 0.004556074557823129,
"system": 0.004165839863945578,
"min": 0.007419545900000001,
"max": 0.0105240559
},
{
"command": "pacquet@main",
"mean": 0.00777847139855073,
"stddev": 0.00048651722071923917,
"median": 0.007672301900000001,
"user": 0.004855171304347827,
"system": 0.0036117594202898545,
"min": 0.007235048900000001,
"max": 0.0118089539
},
{
"command": "pnpr@HEAD",
"mean": 0.007759362560818714,
"stddev": 0.0002881965215105722,
"median": 0.007708174900000001,
"user": 0.0049378817543859616,
"system": 0.003510599883040933,
"min": 0.007271016900000001,
"max": 0.0091762699
},
{
"command": "pnpr@main",
"mean": 0.007817142125903608,
"stddev": 0.00038587165576731657,
"median": 0.007718854400000001,
"user": 0.004980170963855419,
"system": 0.0035253904819277098,
"min": 0.0072841609,
"max": 0.0108964569
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.009608230356260168,
"stddev": 0.0005715135340388336,
"median": 0.009502702340000002,
"user": 0.005407986178861788,
"system": 0.004937763414634144,
"min": 0.008159375840000002,
"max": 0.011711193840000002
},
{
"command": "pacquet@main",
"mean": 0.009040622794887217,
"stddev": 0.0007391308211204881,
"median": 0.008983054340000001,
"user": 0.005366393533834585,
"system": 0.004383930827067671,
"min": 0.007837479840000001,
"max": 0.012242141840000002
},
{
"command": "pnpr@HEAD",
"mean": 0.008989778955789476,
"stddev": 0.0005021859564018736,
"median": 0.008997120840000001,
"user": 0.005360781754385964,
"system": 0.004364471929824565,
"min": 0.008096988840000001,
"max": 0.010921659840000002
},
{
"command": "pnpr@main",
"mean": 0.009045721071343285,
"stddev": 0.0004513107404711281,
"median": 0.00896787634,
"user": 0.005166843880597014,
"system": 0.004606977611940296,
"min": 0.00812789784,
"max": 0.01145252784
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.586722133360001,
"stddev": 0.028619508053448046,
"median": 2.58942627006,
"user": 2.6491488399999996,
"system": 1.73396862,
"min": 2.54823444356,
"max": 2.6269870825600004
},
{
"command": "pacquet@main",
"mean": 2.58042544136,
"stddev": 0.026032049198499767,
"median": 2.58708810206,
"user": 2.5343361399999997,
"system": 1.7484252200000001,
"min": 2.5416962185600003,
"max": 2.6182175455600003
},
{
"command": "pnpr@HEAD",
"mean": 1.46481886316,
"stddev": 0.07052354887691395,
"median": 1.4390781535600001,
"user": 2.0717485399999997,
"system": 1.57570832,
"min": 1.40947092356,
"max": 1.61786689956
},
{
"command": "pnpr@main",
"mean": 1.5111365823600003,
"stddev": 0.08085047410926283,
"median": 1.5225324200600001,
"user": 1.9862496399999998,
"system": 1.57187132,
"min": 1.39618866556,
"max": 1.64616659056
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5048013968,
"stddev": 0.015012425589959456,
"median": 0.5059398310000001,
"user": 0.78275884,
"system": 1.0703889400000002,
"min": 0.48364200150000003,
"max": 0.5208245275
},
{
"command": "pacquet@main",
"mean": 0.49351357619999997,
"stddev": 0.017314048541597963,
"median": 0.485124563,
"user": 0.7510497399999998,
"system": 1.0717032400000002,
"min": 0.47469798350000003,
"max": 0.5206501005
},
{
"command": "pnpr@HEAD",
"mean": 0.3025105195,
"stddev": 0.007430108695572803,
"median": 0.306044386,
"user": 0.3135000399999999,
"system": 0.58082144,
"min": 0.2898333895,
"max": 0.3097093995
},
{
"command": "pnpr@main",
"mean": 0.29895346469999995,
"stddev": 0.009927016513267828,
"median": 0.29827001399999997,
"user": 0.31989224,
"system": 0.56169034,
"min": 0.2852967885,
"max": 0.3208186865
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.57580240038,
"stddev": 0.013453128697815364,
"median": 1.5717036816799999,
"user": 0.80247918,
"system": 0.7979015399999999,
"min": 1.55114884268,
"max": 1.59547626068
},
{
"command": "pacquet@main",
"mean": 1.57074192858,
"stddev": 0.017069123265155688,
"median": 1.56909135868,
"user": 0.7585406799999999,
"system": 0.7889185400000001,
"min": 1.5484136686799999,
"max": 1.60372489368
},
{
"command": "pnpr@HEAD",
"mean": 0.26613390168,
"stddev": 0.004969832754587291,
"median": 0.26833908268,
"user": 0.23797767999999997,
"system": 0.5229087399999999,
"min": 0.25711873668,
"max": 0.27129354568
},
{
"command": "pnpr@main",
"mean": 0.26008550178,
"stddev": 0.007100648943973272,
"median": 0.25753447818,
"user": 0.24939488,
"system": 0.50748164,
"min": 0.25283154168,
"max": 0.27127537168
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2352000866145455,
"stddev": 0.013861326017956994,
"median": 0.23503848516000003,
"user": 0.20740094909090906,
"system": 0.24725238000000002,
"min": 0.20954877816000003,
"max": 0.26108412416
},
{
"command": "pacquet@main",
"mean": 0.2295414016215385,
"stddev": 0.01150653893423691,
"median": 0.23067611916000003,
"user": 0.20667027076923075,
"system": 0.26150876461538464,
"min": 0.21033016416000003,
"max": 0.25227775816
},
{
"command": "pnpr@HEAD",
"mean": 0.08774127366,
"stddev": 0.0009943173649563514,
"median": 0.08793626716,
"user": 0.031183665,
"system": 0.017856411250000002,
"min": 0.08533386316,
"max": 0.08987796116
},
{
"command": "pnpr@main",
"mean": 0.08736358212875,
"stddev": 0.001527609949877163,
"median": 0.08759228166,
"user": 0.026661383750000007,
"system": 0.021762493124999997,
"min": 0.08308019316,
"max": 0.09024144316
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.18468053710444446,
"stddev": 0.011145158036231166,
"median": 0.18532893966,
"user": 0.1786121911111111,
"system": 0.048761059999999995,
"min": 0.17336318966,
"max": 0.20420570666
},
{
"command": "pacquet@main",
"mean": 0.1860710855488889,
"stddev": 0.009276302693942227,
"median": 0.18607149966,
"user": 0.1916389688888889,
"system": 0.037334948888888886,
"min": 0.17261640766,
"max": 0.20062299366
},
{
"command": "pnpm@HEAD",
"mean": 3.5882163408822216,
"stddev": 0.20025589832927812,
"median": 3.5086811086600003,
"user": 5.48640419111111,
"system": 0.31852472666666665,
"min": 3.40000250766,
"max": 4.01898139466
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.0887149847875,
"stddev": 0.00439747634810549,
"median": 0.08812569310000001,
"user": 0.083271935,
"system": 0.055627446250000004,
"min": 0.0810754961,
"max": 0.1021414971
},
{
"command": "pacquet@main",
"mean": 0.08620570581875002,
"stddev": 0.0032328222580946813,
"median": 0.08608342260000001,
"user": 0.07882524750000001,
"system": 0.056550571249999994,
"min": 0.08054263610000001,
"max": 0.0934733581
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.07901849926324327,
"stddev": 0.0033943467827725073,
"median": 0.07864522102000002,
"user": 0.02739423675675676,
"system": 0.0579701545945946,
"min": 0.07181006102000001,
"max": 0.08594673702000001
},
{
"command": "pacquet@main",
"mean": 0.07848580007405406,
"stddev": 0.0014506894416745422,
"median": 0.07843248002000001,
"user": 0.027673669189189197,
"system": 0.05704169513513513,
"min": 0.07606955402000001,
"max": 0.08241412002000001
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.437068286419999,
"stddev": 0.13337347683933107,
"median": 4.378001575019999,
"user": 1.8996925400000002,
"system": 1.3344614399999999,
"min": 4.33035264602,
"max": 4.76449717702
},
{
"command": "pacquet@main",
"mean": 4.37884919212,
"stddev": 0.09691098527311501,
"median": 4.34535075152,
"user": 1.80514024,
"system": 1.31450224,
"min": 4.297173948019999,
"max": 4.57579031602
},
{
"command": "pnpr@HEAD",
"mean": 3.56720705832,
"stddev": 0.1525371905731028,
"median": 3.55679163952,
"user": 1.8294618399999998,
"system": 1.2900347399999998,
"min": 3.38530600802,
"max": 3.81778148702
},
{
"command": "pnpr@main",
"mean": 3.47414058662,
"stddev": 0.11656973027974755,
"median": 3.4157221475200004,
"user": 1.7883047400000003,
"system": 1.26426604,
"min": 3.39686386202,
"max": 3.75679044102
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.12920398879789474,
"stddev": 0.003732886004220345,
"median": 0.12786131764,
"user": 0.15731328736842107,
"system": 0.15938210526315788,
"min": 0.12420600064000001,
"max": 0.13598761964
},
{
"command": "pacquet@main",
"mean": 0.12731595644,
"stddev": 0.005222422952299408,
"median": 0.12738983464,
"user": 0.17007838999999997,
"system": 0.14531235,
"min": 0.11869268364,
"max": 0.14130685064
},
{
"command": "pnpr@HEAD",
"mean": 0.14749380134588239,
"stddev": 0.00407391795265439,
"median": 0.14829133064,
"user": 0.17347039882352944,
"system": 0.15940641176470588,
"min": 0.14125733764,
"max": 0.15503223164000002
},
{
"command": "pnpr@main",
"mean": 0.14019373275111113,
"stddev": 0.005950560810195613,
"median": 0.14143301764,
"user": 0.17538489555555556,
"system": 0.14709194444444443,
"min": 0.12744779864,
"max": 0.14990148464
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.1941835633800002,
"stddev": 0.04078767462706282,
"median": 1.19306124868,
"user": 0.54624846,
"system": 0.21470893999999996,
"min": 1.13015608468,
"max": 1.2903292136800002
},
{
"command": "pacquet@main",
"mean": 1.22151228858,
"stddev": 0.04958736450610232,
"median": 1.2063793296800003,
"user": 0.57915106,
"system": 0.23882374,
"min": 1.17424753368,
"max": 1.29500584168
}
]
}Scenario: Cargo: repeat install, hot cache + hot storeFrozen repeat install of a Cargo workspace (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.028312346618823533,
"stddev": 0.0008617289430969387,
"median": 0.028098954560000004,
"user": 0.020331530588235294,
"system": 0.01563125137254902,
"min": 0.027250398560000003,
"max": 0.03237851156
},
{
"command": "pacquet@main",
"mean": 0.02806514266476191,
"stddev": 0.0009323146004003334,
"median": 0.027894068560000002,
"user": 0.019691264761904765,
"system": 0.016289008571428575,
"min": 0.026544922560000003,
"max": 0.031101169560000003
}
]
} |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #17522 +/- ##
==========================================
- Coverage 92.66% 92.61% -0.06%
==========================================
Files 1921 1946 +25
Lines 250916 253401 +2485
==========================================
+ Hits 232523 234675 +2152
- Misses 18393 18726 +333 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Move the lockfile and npm resolver variant code into their own modules, fold both variations fetch arms into one method, and replace single '/' escapes in the PoC scripts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Staying in draft on purpose: this is a prototype for pnpm/rfcs#51, kept as a reference for the RFC discussion rather than for merging. CI was green on 42b0ca8; 1c6494f unifies runtime and package variant selection. What a mergeable version still needs is listed under Not implemented in the description (staged per-archive publishing, the version/ABI fields, the compatibility view for other clients, multi-platform 🤖 Generated with Claude Code (Claude Opus 5.5) |
Runtimes and registry packages now share one variations selection (VariationsResolution::select): the first matching variant, else the fallback. The selected resolution's type, not the presence of a tag or fallback, decides whether it is fetched as a binary archive or a registry tarball. The global virtual store receives the selected platform from the install's config instead of a process-global, and hashes runtime variations by the selected archive too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm now asks for application/vnd.pnpr.install-v2+json. When the abbreviated packument is larger than PNPR_SPLIT_METADATA_THRESHOLD, pnpr moves each version's dist to its immutable version document and marks the version dist.pnpr.details "external". Dist-tag targets and the highest release of each major keep their dist inline, so most picks need no second request. pnpm fetches the version document of a picked version marked external, once per install. Variant integrities do not compress, so this keeps packages with variants from multiplying their packument. bench-split.sh measures cold resolution 33 to 40 percent faster with split packuments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The request-log parity tests classified a request by the media type its Accept header names first, which is now pnpr's split form. Both ask for the abbreviated document. Also cap the benchmark proxy's delays and stop echoing upstream errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The version a pnpm version switch picks goes through pick_package, not the npm resolver, so the external dist is now read there, for every caller. Splitting is off unless PNPR_SPLIT_METADATA_THRESHOLD is set: an older pnpm on PATH that shared the metadata cache read a split document the new one had cached, and moving the cache directory touches the cache commands and many tests. Also validate the benchmark proxy's control input. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ments A split packument now keeps only what picking a version reads (name, version, deprecated, the _npmUser trust flags, provenance, and the marker) for versions that are not likely picks. The version document is served as the abbreviated packument would list the version when the split media type is asked for, and pnpm reads the whole picked version from it. PNPR_SPLIT_DIST_ONLY=1 keeps the earlier shape for comparison. The benchmark now declares the registry as pnpr, so optional dependencies are read from abbreviated documents too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Versions that are not likely picks move from `versions` to pnpr.externalVersions as their publish time, or [time, flags] with their deprecation, trust rank, and selected revision, so a client that does not read the map sees only complete versions. The rest of a version is its release record at <name>/<version>+r<revision>, without deprecation or evidence, and served as immutable; <name>/<version> stays the selected revision. pnpm turns each entry into a version marked external where the document is parsed, fetches the record of a picked one, and keeps the deprecation and trust evidence from the packument. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 30-day window Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Entries and release records list pnpr's facts about the archives (integrity, fileCount, unpackedSize, requiresBuild, bins, variants) at their top level, beside the publisher's manifest. npm's documents no longer carry dist.pnpr or the stored variants, and pnpr's format is served by default. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpr serves its own format by default now, so pnpm sends its media type only to registries declared serverType: pnpr, whose tarball URLs it can rebuild, and caches those documents in v12/metadata-pnpr, where a pnpm release that predates the format never reads them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
npm's documents give a selected revision by its +r<N> tarball URL and integrity, without dist.revision and dist.revisions. pnpr's format marks a revision-aware version with revision, including 0, and serves a release record for every revision in the history. pnpm rebuilds the revision URL, reads a +r<N> override from its record, and treats an unmarked revision URL as an ordinary tarball that answers only for its own revision. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpr answers `Accept: application/vnd.pnpr.install-v2+json` with its own package document: every version has a short entry with its deprecation, trust rank, selected revision, and its publish time when it falls in the publish-time window, and the versions a resolution likely picks keep their manifest and pnpr's facts about the archives. Above the split threshold, every other version's manifest is its release record at `<name>/<version>+r<revision>`, served with immutable caching (or the caller-gated headers). The document is coarsened against the package's last publish rather than the current time, so it changes only when the package does. npm's documents no longer carry `dist.pnpr`, `dist.revision`, or `dist.revisions`: a selected revision appears there by its `+r<N>` tarball URL and integrity. Package documents carry a `pnpr-registry` header. The new `packageDocuments` setting configures the split threshold and a publish-time window of at least 30 days. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e pnpr pnpm asks a registry declared `serverType: pnpr` for pnpr's own package document and turns it into its usual package type where it is parsed. Each version from it is marked with how the document listed it, so a picked version whose manifest the document left out, or a `+r<N>` override of a revision other than the selected one, is read from its release record: once per install, shared between the picks that need it, and cached on disk with no expiry in `v12/metadata-pnpr-records`. The documents themselves are cached in `v12/metadata-pnpr`, which the `pnpm cache` commands now cover. A response in pnpr's format is read only when it was asked for. A registry that sends `pnpr-registry` without being declared gets a warning, once per registry. A `minimumReleaseAge` above 30 days fails with `ERR_PNPM_UNSUPPORTED_MINIMUM_RELEASE_AGE` for a declared registry, since an entry without a publish time is only known to be 30 days older than the package's last publish. npm's documents served by pnpr give a selected revision only by its URL, so an unmarked revision URL is an ordinary tarball that answers only for its own revision. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpr answers `Accept: application/vnd.pnpr.install-v2+json` with its own package document: every version has a short entry with its deprecation, trust rank, selected revision, and its publish time when it falls in the publish-time window, and the versions a resolution likely picks keep their manifest and pnpr's facts about the archives. Above the split threshold, every other version's manifest is its release record at `<name>/<version>+r<revision>`, served with immutable caching (or the caller-gated headers). The document is coarsened against the package's last publish rather than the current time, so it changes only when the package does. npm's documents no longer carry `dist.pnpr`, `dist.revision`, or `dist.revisions`: a selected revision appears there by its `+r<N>` tarball URL and integrity. Package documents carry a `pnpr-registry` header. The new `packageDocuments` setting configures the split threshold and a publish-time window of at least 30 days. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e pnpr pnpm asks a registry declared `serverType: pnpr` for pnpr's own package document and turns it into its usual package type where it is parsed. Each version from it is marked with how the document listed it, so a picked version whose manifest the document left out, or a `+r<N>` override of a revision other than the selected one, is read from its release record: once per install, shared between the picks that need it, and cached on disk with no expiry in `v12/metadata-pnpr-records`. The documents themselves are cached in `v12/metadata-pnpr`, which the `pnpm cache` commands now cover. A response in pnpr's format is read only when it was asked for. A registry that sends `pnpr-registry` without being declared gets a warning, once per registry. A `minimumReleaseAge` above 30 days fails with `ERR_PNPM_UNSUPPORTED_MINIMUM_RELEASE_AGE` for a declared registry, since an entry without a publish time is only known to be 30 days older than the package's last publish. npm's documents served by pnpr give a selected revision only by its URL, so an unmarked revision URL is an ordinary tarball that answers only for its own revision. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`pnpm-platform-variants` parses and writes the platform tags of the platform-variants vocabulary (os, cpu, musl, glibc, macOS and Windows floors, N-API floors, Node.js and Electron ABIs, wasm32), derives a variant's tag from its platforms, and selects the variant that fits a host by the RFC's ranking rule: native above wasm32, then more explicit constraints, then the highest glibc and OS floors, then an exact ABI above an N-API floor. A floor or ABI the host's value is unknown for is not met when linking, and is met when fetching for another platform. pnpr and pnpm share it. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A publish references each variant archive by the integrity of its `.tgz` under `versions[<v>].pnprVariants` and attaches it beside the primary. Each archive declares its platforms in its own `package.json`, and pnpr derives the variant's tag from them. Publication rejects a variant whose name, version, or peer dependencies differ from the version's, that requires a build, that declares `os`, `cpu`, or `libc`, whose `variant` field is missing or does not parse, or that overlaps another variant, and an unreferenced or missing attachment. pnpr's package document and release records list the verified variants; npm's documents do not. Each variant's tar is served at `<name>@<version>/variants/<tag>`, and under the selected revision at `<name>@<version>+r<revision>/variants/<tag>`. The archives travel in one publish body until uploads by integrity land with atomic workspace publication. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in #17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pnpm reads `variants` from pnpr's package document and records the version as a `variations` resolution with the primary as `fallback`, each variant integrity-only with targets that carry the floor and ABI fields, in the byte order of their derived tags, and `revision` for a revision-aware version. A variant with a platform field pnpm does not know is left out. Every archive's dependencies are resolved on every machine; a variant whose resolved snapshot differs from the version's gets `<name>@<version>/variants/<tag>`. At install, the selector ranks every variant's best matching target for the host, independently of the lockfile's order, and falls back to the primary; two equally fitting variants fail the install. Runtimes keep their first-match selection. The installer walks the selected variant's snapshot, fetches the variant from its registry route, and the global virtual store keys a `variations` package by the selected archive's integrity in addition to its graph identity. Ported from the proof of concept in pnpm#17522. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nts) (pnpm#17556) * feat(pnpr): serve a package document of its own and release records pnpr answers `Accept: application/vnd.pnpr.install-v2+json` with its own package document: every version has a short entry with its deprecation, trust rank, selected revision, and its publish time when it falls in the publish-time window, and the versions a resolution likely picks keep their manifest and pnpr's facts about the archives. Above the split threshold, every other version's manifest is its release record at `<name>/<version>+r<revision>`, served with immutable caching (or the caller-gated headers). The document is coarsened against the package's last publish rather than the current time, so it changes only when the package does. npm's documents no longer carry `dist.pnpr`, `dist.revision`, or `dist.revisions`: a selected revision appears there by its `+r<N>` tarball URL and integrity. Package documents carry a `pnpr-registry` header. The new `packageDocuments` setting configures the split threshold and a publish-time window of at least 30 days. Ported from the proof of concept in pnpm#17522. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat: read pnpr's package document from registries declared serverType pnpr pnpm asks a registry declared `serverType: pnpr` for pnpr's own package document and turns it into its usual package type where it is parsed. Each version from it is marked with how the document listed it, so a picked version whose manifest the document left out, or a `+r<N>` override of a revision other than the selected one, is read from its release record: once per install, shared between the picks that need it, and cached on disk with no expiry in `v12/metadata-pnpr-records`. The documents themselves are cached in `v12/metadata-pnpr`, which the `pnpm cache` commands now cover. A response in pnpr's format is read only when it was asked for. A registry that sends `pnpr-registry` without being declared gets a warning, once per registry. A `minimumReleaseAge` above 30 days fails with `ERR_PNPM_UNSUPPORTED_MINIMUM_RELEASE_AGE` for a declared registry, since an entry without a publish time is only known to be 30 days older than the package's last publish. npm's documents served by pnpr give a selected revision only by its URL, so an unmarked revision URL is an ordinary tarball that answers only for its own revision. Ported from the proof of concept in pnpm#17522. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: describe pnpr's package document and its client Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor: fit pnpr's package document code to the lint limits Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: end a multi-line format with a trailing comma Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(pnpr): measure the split threshold on pnpr's own document Decide the split from the document with every manifest inline rather than from npm's abbreviated document, which keeps every publish time. A publish after a long gap advances `timesSince` and drops the publish times of the entries outside the window, so it can take a document back below the threshold. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: box the update-config future of a command's state The state future every command awaits embeds the future that applies a pnpmfile's updateConfig hook. Inline, it passes clippy's large-future threshold on Windows at several command dispatch sites, so box it once where it is built. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(pnpr): serve a release record immutable only once its archive is verified A release record carries what pnpr derives from the archive, and an upstream archive is verified only after its first read, so a record read before that could gain fileCount, unpackedSize, requiresBuild, and bins later. It is now served immutable only once every fact is derived. A revision-aware version's records are made from its revision history alone, so a record's bytes no longer depend on which revision is selected. Adds a test that the document and release records render from SQLite metadata, and that a deprecation changes the document but not the record. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: keep only release records pnpr serves as lasting, and bound their size pnpm keeps a release record on disk only when pnpr serves it immutable, or privately to a caller-gated package's callers. A record larger than 8 MiB is refused instead of buffered. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: lead the changeset with what users get Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: end a multi-line assert with a trailing comma Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(pnpr): address release records by exact version, and build the document once A release record is addressed by an exact version: `latest+r0` named whatever `latest` pointed at, under an immutable cache header. pnpr's document is built once and measured with a counting writer, and a document over the split threshold leaves out the manifests of the unlikely picks in place instead of being built again. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: keep only immutable release records, and trust a record's address A caller-gated record is `private, no-store`, so it is no longer kept on disk. The revision a record describes is the one its address names, a `+r<N>` override of an ordinary version reads no record before the revision check rejects it, and a cached record is read without blocking the runtime. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: honor pnpr's document marker only for a registry declared pnpr A version that pnpr's document listed may leave out its revision history. Another registry could set the same marker in npm's documents and skip the revision checks, so the marker is now honored only for a registry declared `serverType: pnpr`. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: order versions published at the same time by semver in the trust check pnpr's document gives every version published before its publish-time window the same time, so trustPolicy: no-downgrade counted none of them as earlier than another, and a downgrade among them went unnoticed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: describe revision validation and pnpr's document savings accurately Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(pnpr): write pnpr's document once unless it is split Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: assert the revision-history error for an undeclared registry Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Proof of concept for the pnpr platform variants RFC (merged in pnpm/rfcs#51), updated to the merged text: one package version with a primary archive plus platform variant archives, so packages with native binaries no longer need a set of per-platform
optionalDependenciespackages or a postinstall download. Not meant to be merged as is; it exists to test the design end to end. The results are folded into the RFC's "Prototype" section.pnpr
package.json:"variant": { "platforms": ["linux-x64", "linux-x64-musl"] }. Platform tags coveros,cpu, musl, glibc floors (manylinux_2_28), macOS/Windows floors (macos_11_0), N-API (napi8), Node.js/Electron ABIs (node127), andwasm32, parsed by a new shared crate,pnpm-platform-variants; only the canonical form parses. pnpr names the variant by its platforms' tags sorted and joined with+..tgzintegrity its upload is verified against (versions[<v>].pnprVariants: { "<label>": "<integrity>" }, attached as<basename>-<version>~<label>.tgz).name,version, or peers differ from the version's, that requires a build, whosevariantfield is missing or does not parse, that declaresos/cpu/libc, or that lists a platform another variant lists. Dependencies may differ.tag, structuredplatforms, tarintegrity, sizes,bins, and amanifestof the fields that differ from the version's; no URL. npm's documents list none. Variants are served at<name>@<version>/variants/<tag>and at<name>@<version>+r<N>/variants/<tag>for the selected revision.pnpm
variationsresolution with the primary asfallback, best variant first, and the version'srevision. The lockfile stores no tag: pnpm derives it from each variant'stargets, which gain the floor and ABI fields. A variant with a platform field pnpm does not know is left out.wasm32, then the primary; an equal fit fails the install. pnpm probes the host's glibc, macOS, N-API, and ABI once. Runtime archives keep their first-match rule.<name>@<version>/variants/<tag>(<peers>), and the installer wires the selected variant's snapshot before materializing the lockfile.variationsentry, runtime or package, by the selected archive's integrity. On main, runtimevariationsare hashed without integrity, so two projects selecting different Node.js archives of one version share a slot; this fixes that too.Split packuments (pnpm/rfcs#54; variant integrities do not compress, so inline they make a packument several times larger)
serverType: pnprforapplication/vnd.pnpr.install-v2+json(other registries get npm's media types), and pnpr answers in a format of its own (on by default;PNPR_INSTALL_V2=0turns it off): an entry per version with its deprecation, trust rank, selected revision, and its publishtimeonly within 30 days of the package's last publish (timesSince). A complete entry also has pnpr's facts about the archives at its top level (integrity,fileCount,unpackedSize,requiresBuild,bins,variants) and the publisher'smanifest. UnderPNPR_SPLIT_METADATA_THRESHOLD(64 KiB) every entry is complete; above it only dist-tag targets and the highest release of each major (each minor below 1.0) are. npm's documents no longer carrydist.pnpr. pnpm converts the document where it is parsed (parse_install_v2) and records a version without a time as published attimesSince.<name>/<version>+r<revision>(Cache-Control: immutable), withoutdeprecated,_npmUser, signatures, or attestations.<name>/<version>stays the selected revision, which can change.pick_packageonce per install, and keeps the deprecation and trust evidence from the packument.PATHsharingv12/metadataread a split document the new one had cached and failed to switch versions. Moving the cache directory touches the cache commands and many tests, so they are cached inv12/metadata-pnpr, which a pnpm release that predates the format never reads.bench-split.shresolves a 787-package app proxied from npmjs through a CDN-like proxy (gzip, cache, RTT, bandwidth cap), cold cache each run, with the registry declaredserverType: pnpr. Median resolution: 1.35 s → 0.36 s at 10 ms/200 Mbit, 5.07 s → 0.79 s at 40 ms/50 Mbit, 24.7 s → 2.6 s at 100 ms/10 Mbit; a full install at 40 ms/50 Mbit 28.5 s → 24.0 s. Package documents 30.3 MB → 2.5 MB gzipped (14.9 MB with every manifest inline), with 22 release records. The lockfile is identical.pnpr/poc/platform-variants/has the scripts that repackage real npm packages (esbuild, biome, napi-rs packages, lightningcss, rolldown, Tailwind oxide with a wasm primary) and GitHub release binaries as variant packages, plus packages that each break one publish rule.Tested end to end against a local pnpr with
variants.sh, after this update: every publish rejection with its reason; installs from pnpr's format linking the host's variant, repeated frozen and after apnpm add; a dependency only the Linux variant declares, recorded in that variant's own snapshot and linked for it. Before this update (with declared tags and no per-variant dependencies), the PoC also ran Vite 8 and Tailwind 4 builds, Alpine containers, server-side resolution, and frozen installs for glibc/musl/darwin/win32/freebsd/unknown OS; those have not been rerun.Revisions (pnpm/rfcs#55): npm's documents give a selected revision by its
+r<N>tarball URL and integrity only; pnpr's format marks revision-aware versions withrevision(including 0) and serves a release record for every revision in the history. pnpm rebuilds the+r<N>URL, reads a+r<N>override from its record, and treats an unmarked revision URL as an ordinary tarball that answers only for its own revision.revisions.shinstalls an original and a patched revision through both formats, with and without a+r0override, and repeats each install frozen.Not implemented: a version without a primary, and the minimal primary pnpr would generate for npm clients; a name declared by two archives with different specifiers (it resolves once, with the version's specifier);
supportedArchitecturesfetching several variants or linking the one platform it names (materialized dependencies follow the host); relinking when the selection changes;pnpm why/audit/licenses/SBOM visiting variant snapshots; a lockfile marker older pnpm releases reject; uploads by integrity, one provenance statement naming every archive, the compatibility view; rejecting aminimumReleaseAgeabove 30 days, which split packuments rely on; the warning about an undeclared pnpr (pnpm's tests run against one); thepnpm cachecommands forv12/metadata-pnpr. The publish body limit is raised 8x for the PoC.Squash Commit Body
Checklist
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code