Repository navigation
feat(pacquet): expose linkWorkspacePackages in the @pnpm/napi binding - #12844
Conversation
Add `linkWorkspacePackages` (`true` / `false` / `"deep"`) to the `@pnpm/napi` install options, mapping it onto `Config::link_workspace_packages` (reusing the config crate's `Deserialize`). Programmatic consumers need this to opt bare-semver dependencies — including an auto-installed peer that names a sibling workspace package — into workspace-package resolution, matching pnpm's `link-workspace-packages` setting. The default stays `false`, so existing behavior is unchanged.
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require review
Previous review resultsReview updated until commit 6a6154a Results up to commit N/ANew Review StartedThis review has been superseded by a new analysis |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds a new optional ChangeslinkWorkspacePackages N-API Option
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant JS as JS caller
participant BuildOverlay as build_overlay
participant Parser as parse_link_workspace_packages
participant Overlay as ConfigOverlay
participant Config as build_config
JS->>BuildOverlay: InstallOptions.linkWorkspacePackages
BuildOverlay->>Parser: parse_link_workspace_packages(value)
Parser-->>BuildOverlay: LinkWorkspacePackages or napi::Error
BuildOverlay->>Overlay: set link_workspace_packages
Overlay->>Config: apply overlay.link_workspace_packages
Possibly related PRs
Suggested labels: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
pacquet/npm/napi/index.d.tsParsing error: "parserOptions.project" has been provided for 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. Comment |
PR Summary by QodoExpose linkWorkspacePackages in @pnpm/napi install options
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
51 rules 1.
|
PR Code Suggestions ✨Warning
Explore these optional code suggestions:
|
||||||||||||
|
Code review by qodo was updated up to the latest commit 6a6154a |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12844 +/- ##
=======================================
Coverage 85.80% 85.80%
=======================================
Files 448 448
Lines 69402 69420 +18
=======================================
+ Hits 59552 59569 +17
- Misses 9850 9851 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.10874334638,
"stddev": 0.1139441550573829,
"median": 4.083283015879999,
"user": 3.8752317399999994,
"system": 3.56542726,
"min": 3.95737447638,
"max": 4.3523703413799995,
"times": [
4.1064534533799995,
4.12236595138,
4.044743726379999,
4.3523703413799995,
4.24965744138,
4.06321380138,
4.08479580638,
4.08177022538,
4.02468824038,
3.95737447638
]
},
{
"command": "pacquet@main",
"mean": 4.09643720938,
"stddev": 0.11976898726852236,
"median": 4.062686835379999,
"user": 3.9073270399999998,
"system": 3.53538336,
"min": 3.9571350993800003,
"max": 4.30062682138,
"times": [
4.30062682138,
3.9571350993800003,
3.99809046238,
4.12086438438,
3.97964795738,
4.23030797838,
4.097701391379999,
4.22534877938,
4.02767227938,
4.02697694038
]
},
{
"command": "pnpr@HEAD",
"mean": 2.18399596798,
"stddev": 0.1789484540793791,
"median": 2.09588208788,
"user": 2.69191924,
"system": 3.09137706,
"min": 2.01226285738,
"max": 2.56340088638,
"times": [
2.09610004638,
2.0603792583800002,
2.05852718738,
2.01226285738,
2.3817304153800003,
2.20519082338,
2.30306401338,
2.0956641293800002,
2.56340088638,
2.06364006238
]
},
{
"command": "pnpr@main",
"mean": 2.1789382651800002,
"stddev": 0.1150738185507871,
"median": 2.12847519288,
"user": 2.7368862399999996,
"system": 3.11053406,
"min": 2.08296083738,
"max": 2.40448930138,
"times": [
2.40448930138,
2.1250233293800003,
2.10154749338,
2.13192705638,
2.09756059838,
2.13804198838,
2.32191435538,
2.29005819038,
2.08296083738,
2.09585950138
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6723497272000001,
"stddev": 0.016289562669591178,
"median": 0.6709311778,
"user": 0.40166443999999996,
"system": 1.3495544800000001,
"min": 0.6440765078,
"max": 0.7103182208000001,
"times": [
0.6697105848,
0.6781658908,
0.6440765078,
0.6721517708,
0.7103182208000001,
0.6675996308000001,
0.6742044038,
0.6647913908,
0.6680193408,
0.6744595308
]
},
{
"command": "pacquet@main",
"mean": 0.7046748844,
"stddev": 0.06825381873000795,
"median": 0.6884060548,
"user": 0.40558313999999995,
"system": 1.36862638,
"min": 0.6549731308,
"max": 0.8937890858,
"times": [
0.6549731308,
0.6933125768,
0.7030107738,
0.6735930838,
0.6902283788,
0.6865837308,
0.6770123068,
0.6687176698,
0.8937890858,
0.7055281068
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7244423001,
"stddev": 0.0690434105866577,
"median": 0.7045986978000001,
"user": 0.39756944,
"system": 1.36507868,
"min": 0.6680657788000001,
"max": 0.9131719538,
"times": [
0.6880960048,
0.7216603118,
0.6680657788000001,
0.6891420548,
0.7020287668,
0.6985082738,
0.7071686288,
0.9131719538,
0.7320255608,
0.7245556668
]
},
{
"command": "pnpr@main",
"mean": 0.7472431011,
"stddev": 0.06798907199527894,
"median": 0.7312968808,
"user": 0.40056304000000004,
"system": 1.38124168,
"min": 0.6916469738000001,
"max": 0.9327068098,
"times": [
0.7555105188,
0.7295341398,
0.7481722688,
0.6916469738000001,
0.7296403238,
0.7329534378,
0.9327068098,
0.7360810978,
0.7118304018,
0.7043550388
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.38846699758,
"stddev": 0.04479302025830293,
"median": 4.3922741595799994,
"user": 3.90114304,
"system": 3.4972896999999996,
"min": 4.29821982658,
"max": 4.45765165958,
"times": [
4.409727913579999,
4.37051583658,
4.358070479579999,
4.3816347235799995,
4.45765165958,
4.42656575158,
4.36037147258,
4.41899871658,
4.402913595579999,
4.29821982658
]
},
{
"command": "pacquet@main",
"mean": 4.391910082979999,
"stddev": 0.037664513924649305,
"median": 4.3888359350799995,
"user": 3.90604294,
"system": 3.4917216999999994,
"min": 4.34980557158,
"max": 4.47809440958,
"times": [
4.40012278858,
4.39963355258,
4.35697653858,
4.36136860358,
4.34980557158,
4.47809440958,
4.41502574258,
4.40664376558,
4.37803831758,
4.37339153958
]
},
{
"command": "pnpr@HEAD",
"mean": 2.19506536558,
"stddev": 0.11955804210857522,
"median": 2.1610784800800005,
"user": 2.55311284,
"system": 3.0049611,
"min": 2.08199975058,
"max": 2.48049156858,
"times": [
2.48049156858,
2.1745479065800004,
2.14760905358,
2.09246096358,
2.13270502258,
2.2961247425800004,
2.2136689635800004,
2.2155279515800004,
2.1155177325800003,
2.08199975058
]
},
{
"command": "pnpr@main",
"mean": 2.1923739495800003,
"stddev": 0.09111035783574634,
"median": 2.15937339358,
"user": 2.5574149399999997,
"system": 3.0008282,
"min": 2.0978194465800004,
"max": 2.34553660158,
"times": [
2.1640699215800003,
2.34553660158,
2.12480237258,
2.33674134558,
2.1546768655800004,
2.0978194465800004,
2.12352237158,
2.11142543358,
2.22375745158,
2.2413876855800003
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4252668316600001,
"stddev": 0.04841898410554801,
"median": 1.44575026216,
"user": 1.39488878,
"system": 1.7142824599999997,
"min": 1.3542490416600002,
"max": 1.48025806866,
"times": [
1.44116106566,
1.45848323366,
1.47750295166,
1.48025806866,
1.45033945866,
1.4545796536600002,
1.40361100866,
1.3696121836600001,
1.36287165066,
1.3542490416600002
]
},
{
"command": "pacquet@main",
"mean": 1.39867819426,
"stddev": 0.09300192924459157,
"median": 1.37175648266,
"user": 1.31509078,
"system": 1.7172216599999999,
"min": 1.35107930466,
"max": 1.6609077546600002,
"times": [
1.6609077546600002,
1.37939692466,
1.3637181626600001,
1.38063116766,
1.35510240866,
1.36149394466,
1.37999790066,
1.3903383336600001,
1.3641160406600001,
1.35107930466
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6731732724599999,
"stddev": 0.03185814427933291,
"median": 0.6647423476600001,
"user": 0.34326927999999995,
"system": 1.30797026,
"min": 0.63884245166,
"max": 0.75258467566,
"times": [
0.65977825166,
0.64457500166,
0.63884245166,
0.75258467566,
0.68021040666,
0.66018167966,
0.67653192566,
0.68954363666,
0.66222488666,
0.66725980866
]
},
{
"command": "pnpr@main",
"mean": 0.6558593448600002,
"stddev": 0.0068601260770161055,
"median": 0.65694494466,
"user": 0.34373098,
"system": 1.2806022600000002,
"min": 0.64511853866,
"max": 0.6667789106600001,
"times": [
0.65023064466,
0.65899159366,
0.65524565566,
0.6667789106600001,
0.65859189866,
0.66146605066,
0.64650359566,
0.66036856966,
0.65529799066,
0.64511853866
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.030068232,
"stddev": 0.03553619358633245,
"median": 3.0207852626999996,
"user": 1.7542870599999998,
"system": 1.9824057,
"min": 2.9858841782,
"max": 3.1130538322,
"times": [
3.0457687482,
3.0189617392,
3.0054181112,
3.0128844982,
2.9858841782,
3.0226087861999997,
3.0312259652,
3.1130538322,
3.0567853252,
3.0080911362
]
},
{
"command": "pacquet@main",
"mean": 3.0135685232,
"stddev": 0.024030396990877924,
"median": 3.0150343522,
"user": 1.74874376,
"system": 1.9891795,
"min": 2.9570245242,
"max": 3.0500008942,
"times": [
3.0033083702,
3.0142200241999997,
3.0108992251999998,
3.0158486802,
3.0324963892,
3.0250502621999997,
2.9570245242,
3.0500008942,
3.0077421922,
3.0190946702
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6709275282,
"stddev": 0.01063342069487255,
"median": 0.6681080132000001,
"user": 0.33675266,
"system": 1.3186012,
"min": 0.6597616712000001,
"max": 0.6864913732000001,
"times": [
0.6666444852000001,
0.6844596382,
0.6718546432,
0.6623662482,
0.6614847562,
0.6849961352,
0.6695715412000001,
0.6597616712000001,
0.6864913732000001,
0.6616447902
]
},
{
"command": "pnpr@main",
"mean": 0.6806139581999999,
"stddev": 0.061757399917277266,
"median": 0.6615854047,
"user": 0.33614436,
"system": 1.2986970000000002,
"min": 0.6532251052,
"max": 0.8555801152,
"times": [
0.6626190812,
0.6581482612,
0.6532251052,
0.6700629522,
0.6558846372,
0.6706200962000001,
0.6554853532,
0.6605517282000001,
0.8555801152,
0.6639622522
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.63319066302,
"stddev": 0.007525829422810574,
"median": 0.6346917167200001,
"user": 0.60565198,
"system": 0.14956527999999997,
"min": 0.61667126672,
"max": 0.6428844187200001,
"times": [
0.6388820147200001,
0.6375890927200001,
0.61667126672,
0.63833659872,
0.63563457172,
0.6321638057200001,
0.62669433472,
0.6337488617200001,
0.6428844187200001,
0.62930166472
]
},
{
"command": "pacquet@main",
"mean": 0.63770684932,
"stddev": 0.004887651381875211,
"median": 0.6378294607200001,
"user": 0.60398768,
"system": 0.15331457999999995,
"min": 0.6305669327200001,
"max": 0.6453702497200001,
"times": [
0.6376692557200001,
0.6352923997200001,
0.63973506272,
0.6335096117200001,
0.6320475997200001,
0.6305669327200001,
0.63798966572,
0.6430558577200001,
0.6453702497200001,
0.6418318577200001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10804543416000004,
"stddev": 0.0006026201434806083,
"median": 0.10812883572,
"user": 0.027852299999999993,
"system": 0.018211299999999996,
"min": 0.10683578372000001,
"max": 0.10915676772,
"times": [
0.10769829672,
0.10860143372,
0.10812883572,
0.10833960372,
0.10891999472,
0.10683887872,
0.10797531972,
0.10774521572000001,
0.10808754272,
0.10872126972,
0.10742523572,
0.10833833072,
0.10729222472000001,
0.10747328672,
0.10837512072000001,
0.10830314472000001,
0.10798599072000001,
0.10826507772,
0.10768187872,
0.10821247372000001,
0.10758146772,
0.10826900172000001,
0.10888367772,
0.10683578372000001,
0.10915676772
]
},
{
"command": "pnpr@main",
"mean": 0.10786478702769231,
"stddev": 0.0007737446821743585,
"median": 0.10801179522000001,
"user": 0.026564941538461537,
"system": 0.019509603076923072,
"min": 0.10574595572,
"max": 0.10923639872,
"times": [
0.10622177372000001,
0.10771748872,
0.10846363972,
0.10778957572,
0.10864119372,
0.10923639872,
0.10574595572,
0.10788538672,
0.10828828772,
0.10805815272000001,
0.10802555172,
0.10736964272,
0.10849397172,
0.10777883572000001,
0.10816787972,
0.10824000672,
0.10799803872000001,
0.10730319672000001,
0.10838941872,
0.10759142172,
0.10894945572,
0.10726522972000001,
0.10680018572000001,
0.10829445872,
0.10753393272,
0.10823538272000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.83185325578,
"stddev": 0.0718941589348632,
"median": 6.84896079008,
"user": 4.027806399999999,
"system": 3.8110504999999995,
"min": 6.7206434795800005,
"max": 6.91602905458,
"times": [
6.8882482755800005,
6.88524065258,
6.77054160458,
6.75695239058,
6.87192433858,
6.7206434795800005,
6.7713327885800005,
6.9116227315800005,
6.91602905458,
6.82599724158
]
},
{
"command": "pacquet@main",
"mean": 6.98063391068,
"stddev": 0.168985244668443,
"median": 6.96460462558,
"user": 4.0369771,
"system": 3.8077468999999993,
"min": 6.71068867658,
"max": 7.2642619255800005,
"times": [
6.84590428958,
7.18624029658,
6.83935136858,
6.98629935058,
7.2642619255800005,
6.95301317958,
6.92463896058,
6.71068867658,
7.11974498758,
6.97619607158
]
},
{
"command": "pnpr@HEAD",
"mean": 4.96530127208,
"stddev": 0.13099339509185307,
"median": 4.93426205508,
"user": 2.7861531,
"system": 3.251330199999999,
"min": 4.82863586958,
"max": 5.22680594058,
"times": [
5.22680594058,
5.03683972658,
4.83533285458,
4.90800255258,
4.95343109558,
4.99435977458,
4.91509301458,
5.11561530358,
4.83889658858,
4.82863586958
]
},
{
"command": "pnpr@main",
"mean": 4.98331358948,
"stddev": 0.08457220128803022,
"median": 4.98104068258,
"user": 2.7623588999999997,
"system": 3.257930199999999,
"min": 4.87149388858,
"max": 5.16201180758,
"times": [
5.04985426958,
4.92272505958,
5.0006384635800005,
5.00009245258,
5.16201180758,
4.93513419458,
4.90223420258,
5.02696264358,
4.96198891258,
4.87149388858
]
}
]
} |
|
| Branch | pr/12844 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,195.07 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 670.93 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 673.17 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 108.05 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,184.00 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,965.30 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 724.44 ms |
…deep' - @pnpm/napi 12.0.0-alpha.3 -> 12.0.0-alpha.4, which adds the linkWorkspacePackages install option (pnpm/pnpm#12844). - lynx.ts sets linkWorkspacePackages: 'deep' so bare-semver deps on workspace components — including auto-installed peers that name a sibling component — resolve from the workspace instead of 404ing against the registry. Fixes the peer-dependency-component e2e failures.
Summary
Exposes pnpm's
linkWorkspacePackages(true/false/"deep") as aninstall option on the
@pnpm/napibinding (added in #12822), mapping itonto
Config::link_workspace_packagesvia the config crate's existingDeserialize. The default staysfalse, so nothing changes for existingcallers.
Motivation
The binding exposes most install options but was missing
linkWorkspacePackages,so programmatic consumers had no way to opt into it — the engine was pinned to the
Offdefault. This surfaced in a real consumer (Bit): a component whose onlyreference to a sibling workspace component is a
peerDependency, withautoInstallPeers: true, fails to install. The auto-installed peer is abare-semver range, so with
link-workspace-packages: falseit resolves againstthe registry and 404s — exactly as stock pnpm does with the same setting. The
fix on the consumer side is to set
linkWorkspacePackages: 'deep'(as pnpm usersdo), which requires the binding to accept it.
This is a binding-completeness change, not a behavior change:
pacquetwithlinkWorkspacePackagesset behaves identically to the pnpm CLI with the sameconfig; the engine's resolution semantics are untouched.
Verification
linkWorkspacePackagesparsestrue→DirectOnly,false→Off,"deep"→Deep, and rejects anything else.unpublished):
linkWorkspacePackages: 'deep'→ the peer resolves from the workspace.cargo fmt --check,clippy -D warnings,cargo doc -D warnings, andcargo dylintall clean;pacquet-napitests green.Ref: #12822.
Written by an agent (Claude Code, claude-fable-5), on behalf of @zkochan.
Summary by CodeRabbit
New Features
linkWorkspacePackages, includingtrue,false, and"deep"values.Bug Fixes