Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds the ChangesPacquet N-API addon and supporting engine changes
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
Suggested labels: ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12822 +/- ##
==========================================
- Coverage 86.33% 85.80% -0.53%
==========================================
Files 438 448 +10
Lines 68355 69402 +1047
==========================================
+ Hits 59013 59550 +537
- Misses 9342 9852 +510 ☔ 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.05734347558,
"stddev": 0.1345689023633684,
"median": 4.04742817118,
"user": 3.7871572799999997,
"system": 3.4593402999999996,
"min": 3.86931277668,
"max": 4.29776804968,
"times": [
4.21701946368,
3.86931277668,
3.89491797168,
3.9867380266800003,
4.04965974168,
4.29776804968,
3.98713930668,
4.04519660068,
4.14165753268,
4.08402528568
]
},
{
"command": "pacquet@main",
"mean": 4.03063980578,
"stddev": 0.10843896524089566,
"median": 4.01382364418,
"user": 3.8165092799999996,
"system": 3.4524209,
"min": 3.8880071546800004,
"max": 4.23318769468,
"times": [
4.00397968468,
4.04776783768,
4.03753264968,
4.02366760368,
3.9634773826800003,
3.92411328968,
4.19205818068,
4.23318769468,
3.8880071546800004,
3.9926065796800003
]
},
{
"command": "pnpr@HEAD",
"mean": 2.1107243992800004,
"stddev": 0.11560773503110784,
"median": 2.1246834326800004,
"user": 2.6484767799999998,
"system": 2.9547665000000003,
"min": 1.96700337868,
"max": 2.2630599036800003,
"times": [
2.21850553768,
2.2139861836800003,
2.17319105868,
2.00366884568,
2.2050327866800004,
2.01699472168,
2.0761758066800002,
1.96962576968,
2.2630599036800003,
1.96700337868
]
},
{
"command": "pnpr@main",
"mean": 2.1192128179800003,
"stddev": 0.14047291066660358,
"median": 2.08802593418,
"user": 2.70114158,
"system": 2.9451559,
"min": 1.95557095768,
"max": 2.34844477268,
"times": [
1.96695247668,
2.2659177876800003,
1.97879151568,
2.05752580968,
2.16170720168,
2.0825931516800003,
2.34844477268,
2.28116578968,
1.95557095768,
2.0934587166800003
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.63553022692,
"stddev": 0.009063656462178918,
"median": 0.6324075682200001,
"user": 0.37498929999999997,
"system": 1.31071114,
"min": 0.62477620822,
"max": 0.6519325612200001,
"times": [
0.62870090022,
0.63112710522,
0.6387349362200001,
0.63038358922,
0.64231391122,
0.6468006402200001,
0.62684438622,
0.6336880312200001,
0.6519325612200001,
0.62477620822
]
},
{
"command": "pacquet@main",
"mean": 0.65524605302,
"stddev": 0.02595527089886496,
"median": 0.64632139322,
"user": 0.368042,
"system": 1.3257245399999997,
"min": 0.6358120632200001,
"max": 0.7249836542200001,
"times": [
0.64279813222,
0.6626429382200001,
0.65561272522,
0.6358120632200001,
0.6432152272200001,
0.6462720282200001,
0.6569777592200001,
0.7249836542200001,
0.6377752442200001,
0.6463707582200001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6809412267200001,
"stddev": 0.019573691957709357,
"median": 0.67612480572,
"user": 0.3844547,
"system": 1.3387939399999997,
"min": 0.6568155882200001,
"max": 0.7233911752200001,
"times": [
0.6766824382200001,
0.7008326422200001,
0.7233911752200001,
0.6644058592200001,
0.6903448982200001,
0.67424024122,
0.67556717322,
0.6662894782200001,
0.6808427732200001,
0.6568155882200001
]
},
{
"command": "pnpr@main",
"mean": 0.7178216932200001,
"stddev": 0.0785658778512738,
"median": 0.6904137262200001,
"user": 0.40047390000000005,
"system": 1.33769474,
"min": 0.66669970722,
"max": 0.9205901952200001,
"times": [
0.78265355422,
0.67444104122,
0.6670501242200001,
0.66669970722,
0.6861895102200001,
0.6995963502200001,
0.70016899722,
0.69317770022,
0.6876497522200001,
0.9205901952200001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.18663558998,
"stddev": 0.05411648246209384,
"median": 4.17402090308,
"user": 3.6978597800000004,
"system": 3.3281357999999996,
"min": 4.12416036658,
"max": 4.27645982358,
"times": [
4.12416036658,
4.134917962579999,
4.27645982358,
4.14077381958,
4.25333601158,
4.1808103675799995,
4.16723143858,
4.1420341575799995,
4.2174768045799995,
4.22915514758
]
},
{
"command": "pacquet@main",
"mean": 4.192696603180001,
"stddev": 0.04652669829741994,
"median": 4.19480765058,
"user": 3.7156830800000007,
"system": 3.3515856,
"min": 4.1052224075799995,
"max": 4.26307272758,
"times": [
4.23051743158,
4.14026114458,
4.16889296658,
4.22141181758,
4.1052224075799995,
4.26307272758,
4.2013178795799995,
4.18209531358,
4.22587692158,
4.18829742158
]
},
{
"command": "pnpr@HEAD",
"mean": 2.13061360648,
"stddev": 0.045278124759401336,
"median": 2.1378460375799997,
"user": 2.48568448,
"system": 2.8695713999999994,
"min": 2.05443417958,
"max": 2.19980061358,
"times": [
2.09859676058,
2.19980061358,
2.1620117675799997,
2.1407800465799998,
2.0772729815799997,
2.05443417958,
2.1664539285799997,
2.16370060458,
2.1081731535799997,
2.1349120285799996
]
},
{
"command": "pnpr@main",
"mean": 2.19785543368,
"stddev": 0.11925440422687585,
"median": 2.13836338558,
"user": 2.52344358,
"system": 2.8728907,
"min": 2.05142152958,
"max": 2.3512059335799997,
"times": [
2.14593026458,
2.13079650658,
2.10908544558,
2.32990329258,
2.34240672758,
2.30813044558,
2.3512059335799997,
2.1139174115799997,
2.05142152958,
2.09575677958
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.39403483826,
"stddev": 0.011177542901806413,
"median": 1.3943470857600002,
"user": 1.32016714,
"system": 1.76095654,
"min": 1.37230215226,
"max": 1.41298634326,
"times": [
1.40114060426,
1.40186618526,
1.40013541026,
1.38932363826,
1.3890438552600002,
1.3848560222600002,
1.41298634326,
1.37230215226,
1.3968348702600002,
1.39185930126
]
},
{
"command": "pacquet@main",
"mean": 1.3439936619600001,
"stddev": 0.05591085864249957,
"median": 1.3244456902600001,
"user": 1.27624654,
"system": 1.6887020400000001,
"min": 1.31271596226,
"max": 1.4993974312600002,
"times": [
1.32120351926,
1.31581190126,
1.4993974312600002,
1.32834796526,
1.31923150426,
1.3234083012600002,
1.3422961662600001,
1.32548307926,
1.3520407892600002,
1.31271596226
]
},
{
"command": "pnpr@HEAD",
"mean": 0.66642464716,
"stddev": 0.0352614607273923,
"median": 0.66123399126,
"user": 0.34135924000000006,
"system": 1.27681714,
"min": 0.63779733026,
"max": 0.7602331262600001,
"times": [
0.64003192126,
0.63779733026,
0.66233312126,
0.64797179726,
0.66794570026,
0.67538178826,
0.7602331262600001,
0.66585488826,
0.66013486126,
0.64656193726
]
},
{
"command": "pnpr@main",
"mean": 0.65022413206,
"stddev": 0.009306622192104328,
"median": 0.65003818426,
"user": 0.33540594,
"system": 1.2717473400000001,
"min": 0.63662277426,
"max": 0.67010706626,
"times": [
0.65035128726,
0.64972508126,
0.65704448026,
0.65254046126,
0.65056302226,
0.67010706626,
0.64933465526,
0.63662277426,
0.63844449826,
0.64750799426
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.00333344524,
"stddev": 0.06685146316522365,
"median": 2.9750204932399997,
"user": 1.7467357800000003,
"system": 1.9245064399999996,
"min": 2.96556808974,
"max": 3.18300972874,
"times": [
2.97960973174,
2.99602795374,
2.97290579974,
2.96556808974,
2.97322217274,
2.97639654474,
2.97156950174,
3.04138048774,
3.18300972874,
2.97364444174
]
},
{
"command": "pacquet@main",
"mean": 2.97658499584,
"stddev": 0.0230064293360391,
"median": 2.97146157874,
"user": 1.7069619799999998,
"system": 1.9624037400000003,
"min": 2.94891271074,
"max": 3.01422662374,
"times": [
2.99203159074,
2.96495325774,
2.98265480774,
3.01007378374,
2.95718436874,
3.01422662374,
2.96374198674,
2.97796989974,
2.95410092874,
2.94891271074
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6593567690400001,
"stddev": 0.008479247040805705,
"median": 0.6603834552400001,
"user": 0.33814108000000004,
"system": 1.2955933400000001,
"min": 0.6442496777400001,
"max": 0.6714347027400001,
"times": [
0.6590467227400001,
0.6525381247400001,
0.6442496777400001,
0.6714347027400001,
0.6674315287400001,
0.6584018687400001,
0.6651739887400001,
0.6494497387400001,
0.6641211497400001,
0.6617201877400001
]
},
{
"command": "pnpr@main",
"mean": 0.67239194144,
"stddev": 0.08830128566260305,
"median": 0.6462278667400001,
"user": 0.33014917999999993,
"system": 1.2638555399999998,
"min": 0.6338206997400001,
"max": 0.9233845497400001,
"times": [
0.6460890327400001,
0.6473782247400001,
0.6399746277400001,
0.6487697217400001,
0.6460583347400001,
0.6338206997400001,
0.64723262274,
0.64484489974,
0.6463667007400001,
0.9233845497400001
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6196547169400001,
"stddev": 0.006708951188543079,
"median": 0.6206488805400001,
"user": 0.5860257600000001,
"system": 0.1476829,
"min": 0.6046671785400001,
"max": 0.62728117454,
"times": [
0.62519762054,
0.62214457054,
0.62728117454,
0.6046671785400001,
0.6154485725400001,
0.61910378954,
0.61992375854,
0.6151285055400001,
0.62627799654,
0.6213740025400001
]
},
{
"command": "pacquet@main",
"mean": 0.62415632114,
"stddev": 0.007840220097275068,
"median": 0.62219884454,
"user": 0.5882787599999999,
"system": 0.1535174,
"min": 0.6157360015400001,
"max": 0.64066869754,
"times": [
0.61598226854,
0.62237470654,
0.6340736435400001,
0.62557217054,
0.6192972035400001,
0.6157360015400001,
0.64066869754,
0.62090733054,
0.62492820654,
0.62202298254
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10500114790000001,
"stddev": 0.0027138282918882164,
"median": 0.10337601354,
"user": 0.02762,
"system": 0.017826199999999997,
"min": 0.10251142254000001,
"max": 0.11292324354000001,
"times": [
0.10698620354,
0.10449910454000001,
0.10676294354,
0.10286465054,
0.10337601354,
0.10316790554000001,
0.10826106454000001,
0.11292324354000001,
0.10282759154,
0.10301984954,
0.10325220254,
0.10785670154,
0.10351990954000001,
0.10731068354000001,
0.10339557854,
0.10326428454,
0.10815778254000001,
0.10809932354,
0.10773097754000001,
0.10251142254000001,
0.10332295354000001,
0.10299714754,
0.10312317154,
0.10313432254,
0.10266366554
]
},
{
"command": "pnpr@main",
"mean": 0.10340133350296297,
"stddev": 0.0012867605733497074,
"median": 0.10306539354000001,
"user": 0.02589974518518519,
"system": 0.01912738518518518,
"min": 0.10229060054000001,
"max": 0.10791486954,
"times": [
0.10235313854,
0.10326122854,
0.10337170454000001,
0.10229060054000001,
0.10341907354,
0.10253238054000001,
0.10301625254,
0.10401980254000001,
0.10713750154000001,
0.10293343754,
0.10316328654000001,
0.10323581154,
0.10791486954,
0.10247749954,
0.10458766054,
0.10311095954,
0.10266079954,
0.10339696254000001,
0.10291450354000001,
0.10267810354000001,
0.10331557054000001,
0.10293037254000001,
0.10328592554,
0.10306539354000001,
0.10269701754,
0.10302231354000001,
0.10304383454
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.93371765148,
"stddev": 0.20775854683955144,
"median": 6.89478596988,
"user": 3.9452701599999997,
"system": 3.7022436999999995,
"min": 6.62027061438,
"max": 7.31994166238,
"times": [
7.09698608538,
7.31994166238,
6.80805890238,
6.95996713038,
6.62027061438,
6.77336337438,
6.81045245838,
6.97368880238,
6.82960480938,
7.1448426753800005
]
},
{
"command": "pacquet@main",
"mean": 6.8531805640800005,
"stddev": 0.18167745404177602,
"median": 6.83630195288,
"user": 3.9942839599999993,
"system": 3.7423732999999992,
"min": 6.57496316938,
"max": 7.16372589038,
"times": [
6.75566195238,
7.16372589038,
6.81070292638,
6.97178106538,
6.805860543380001,
6.8619009793800005,
7.07960108638,
6.86449224438,
6.64311578338,
6.57496316938
]
},
{
"command": "pnpr@HEAD",
"mean": 4.96338151468,
"stddev": 0.08649939989394992,
"median": 4.94940351588,
"user": 2.72583366,
"system": 3.1891845000000005,
"min": 4.8510920973800005,
"max": 5.13647137138,
"times": [
5.03231712338,
5.13647137138,
4.8995730573800005,
5.03851630538,
4.96392325038,
4.89633248338,
4.8510920973800005,
4.98469696438,
4.93488378138,
4.8960087123800005
]
},
{
"command": "pnpr@main",
"mean": 4.92382904918,
"stddev": 0.0996828083384531,
"median": 4.92749943538,
"user": 2.76827856,
"system": 3.192608800000001,
"min": 4.74273004638,
"max": 5.0972808583800004,
"times": [
4.85383219438,
5.0972808583800004,
4.74273004638,
4.8794370353800005,
4.967950661380001,
4.92161325638,
4.96195748238,
4.93338561438,
5.02852283138,
4.85158051138
]
}
]
} |
|
| Branch | pr/12822 |
| 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,130.61 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 659.36 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 666.42 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 105.00 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,110.72 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,963.38 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 680.94 ms |
460472f to
17e4eed
Compare
Wire the install options the @pnpm/napi binding previously rejected with ERR_PNPM_NAPI_UNSUPPORTED_OPTION through the Rust engine (Closes #12823, stacked on #12822). Only authConfig (use authHeaderByUri) and neverBuiltDependencies remain rejected. - update/depth: update:true selects UpdateSeedPolicy::DropAll (whole-graph re-resolve to highest-in-range) and forces the non-frozen path; depth is a no-op toggle without package selectors. - engineStrict/nodeVersion: two new pacquet_config::Config fields (also parsed from pnpm-workspace.yaml / config.yaml / PNPM_CONFIG_*), threaded into InstallabilityHost on both install paths via a new detect_with. An explicit nodeVersion is authoritative (no node --version probe). Defaults unchanged. - maxSockets: a per-origin concurrent-connection cap on ThrottledClient (with_max_sockets_per_host), mirroring undici's per-origin connections; the global networkConcurrency semaphore stays the outer bound. - enableModulesDir:false maps to the lockfile-only path (no node_modules). - ignorePackageManifest maps to ignore_manifest_check (skip the freshness gate); the project-linking skip (pnpm fetch semantics) is a documented follow-up. - pnpmHomeDir is accepted and ignored (only global flows consult it).
Wire the install options the @pnpm/napi binding previously rejected with ERR_PNPM_NAPI_UNSUPPORTED_OPTION through the Rust engine (Closes #12823, stacked on #12822). Only authConfig (use authHeaderByUri) and neverBuiltDependencies remain rejected. - update/depth: update:true selects UpdateSeedPolicy::DropAll (whole-graph re-resolve to highest-in-range) and forces the non-frozen path; depth is a no-op toggle without package selectors. - engineStrict/nodeVersion: two new pacquet_config::Config fields (also parsed from pnpm-workspace.yaml / config.yaml / PNPM_CONFIG_*), threaded into InstallabilityHost on both install paths via a new detect_with. An explicit nodeVersion is authoritative (no node --version probe). Defaults unchanged. - maxSockets: a per-origin concurrent-connection cap on ThrottledClient (with_max_sockets_per_host), mirroring undici's per-origin connections; the global networkConcurrency semaphore stays the outer bound. - enableModulesDir:false maps to the lockfile-only path (no node_modules). - ignorePackageManifest maps to ignore_manifest_check (skip the freshness gate); the project-linking skip (pnpm fetch semantics) is a documented follow-up. - pnpmHomeDir is accepted and ignored (only global flows consult it).
Add `pacquet-napi`, a napi-rs cdylib crate, plus its `@pnpm/napi` npm wrapper, exposing pacquet's programmatic engine surface to Node.js so programmatic pnpm consumers can drive the Rust engine instead of the TypeScript pnpm packages. Bit is the reference consumer. Exports (all verified end-to-end against a real registry): - `install` — in-memory importers (single project and multi-importer workspaces), a synchronous `readPackage` hook applied per resolved dependency manifest, build-script approval (`allowBuilds` / `dangerouslyAllowAllBuilds` / `strictDepBuilds`), and `depsRequiringBuild` reporting. - `rebuild`, `resolveDependency` (npm registry), `pack`, `parseBareSpecifier`, `engineVersion`. - Auth via `authHeaderByUri` (pre-computed `Authorization` headers keyed by nerf-darted registry URI), applied through `AuthHeaders::from_creds_map`. The install runs on a dedicated 32 MiB-stack worker thread with its own tokio runtime; the napi async fn awaits the result over a oneshot channel, so pacquet's borrowed `State` never crosses the FFI boundary. A reporter bridge forwards the engine's wire-compatible log events to a JS callback, and errors carry pnpm's `ERR_PNPM_*` code and hint through a structured envelope. Engine-core changes are minimal and inert for existing callers: `PackageManifest::from_value` (build an in-memory manifest without disk IO), and two `Option` fields on `Install` — `pnpmfile_hook_override` (an embedder-supplied `readPackage` hook, preferred over the on-disk pnpmfile on the fresh-resolve path) and `workspace_projects_override` (supply importers in memory instead of discovering them from a `pnpm-workspace.yaml`) — both defaulted to `None` at every existing construction site. A new `napi-release` build profile inherits `release` but sets `panic = "unwind"`, since the workspace `release` profile uses `panic = "abort"`, which would abort the host Node process on a panic that unwinds to the FFI boundary. Not yet implemented: `getPeerDependencyIssues` returns `ERR_PNPM_NAPI_UNIMPLEMENTED`; it needs the peer-resolution issue renderer that pacquet's own CLI has not ported yet. Distribution follows the `@pnpm/exe.*` model: `scripts/generate-packages.mjs` builds the per-platform `@pnpm/napi.<target>` prebuilt packages and wires them as the wrapper's optional dependencies.
Wire the install options the `@pnpm/napi` binding previously rejected with ERR_PNPM_NAPI_UNSUPPORTED_OPTION through the Rust engine (Closes #12823, stacked on #12822). Only authConfig (use authHeaderByUri) and neverBuiltDependencies remain rejected. - update/depth: update:true selects UpdateSeedPolicy::DropAll (whole-graph re-resolve to highest-in-range) and forces the non-frozen path; depth is a no-op toggle without package selectors. - engineStrict/nodeVersion: two new pacquet_config::Config fields (also parsed from pnpm-workspace.yaml / config.yaml / PNPM_CONFIG_*), threaded into InstallabilityHost on both install paths via a new detect_with. An explicit nodeVersion is authoritative (no node --version probe). Defaults unchanged. - maxSockets: a per-origin concurrent-connection cap on ThrottledClient (with_max_sockets_per_host), mirroring undici's per-origin connections; the global networkConcurrency semaphore stays the outer bound. - enableModulesDir:false maps to the lockfile-only path (no node_modules). - ignorePackageManifest maps to ignore_manifest_check (skip the freshness gate); the project-linking skip (pnpm fetch semantics) is a documented follow-up. - pnpmHomeDir is accepted and ignored (only global flows consult it).
Code Review by Qodo
1.
|
PR Summary by Qodofeat(pacquet): Add Node API bindings for the Rust engine (
AI Description
Diagram
High-Level Assessment
Files changed (51)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
51 rules 1.
|
PR Code Suggestions ✨Latest suggestions up to 034d839 Warning
Previous suggestionsSuggestions up to commit 6f84945
Suggestions up to commit 1b837f1
Suggestions up to commit 5cbceee
Suggestions up to commit 77d7c19
✅ Suggestions up to commit 2dd141a
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- `invalid_manifest_error` now emits pnpm's canonical `ERR_PNPM_INVALID_PACKAGE_JSON` instead of a bespoke `ERR_PNPM_NAPI_*` code, so consumers translate an invalid project manifest like any other pnpm error. - The `@pnpm/napi` loader now tries both Linux libc variants (ordered by detection) instead of hard-defaulting to glibc when `process.report` is unavailable, so a musl host whose libc cannot be probed still resolves the `-musl` addon rather than failing on the glibc one.
|
Both valid — fixed in
musl detection fell back to glibc — the loader now tries both Linux libc variants (ordered by detection, glibc-first only as a tiebreak) instead of hard-defaulting to glibc when Written by an agent (Claude Code, claude-fable-5), on behalf of @zkochan. |
|
Code review by qodo was updated up to the latest commit 1b837f1 |
|
Code review by qodo was updated up to the latest commit 1b837f1 |
…erride strict Now that the loader tries both Linux libc variants, treat an `ERR_DLOPEN_FAILED` from a wrong-ABI candidate as retryable so it falls through to the other libc variant instead of aborting on a wrong first guess. An explicit `PNPM_NAPI_BINARY` stays strict: a non-.node value is rejected, and a `.node` that exists but fails to load surfaces that error rather than silently falling back to a platform package.
|
Good catch — fixed in Written by an agent (Claude Code, claude-fable-5), on behalf of @zkochan. |
resolveDependency built a fresh multi-thread Tokio runtime per call, spawning a worker-thread pool for a single packument fetch — concurrent resolves in a long-lived host could multiply threads. It already runs on a dedicated worker thread, so a current-thread runtime does the one fetch with no extra threads. The install path keeps its multi-thread runtime, which it needs to fetch packages in parallel.
|
Code review by qodo was updated up to the latest commit 6f84945 |
|
Fixed for On the Written by an agent (Claude Code, claude-fable-5), on behalf of @zkochan. |
|
Code review by qodo was updated up to the latest commit 034d839 |
|
Code review by qodo was updated up to the latest commit 034d839 |
Summary
Adds
@pnpm/napi, napi-rs bindings that expose pacquet's programmaticengine surface to Node.js, so programmatic pnpm consumers can drive the Rust
engine instead of the TypeScript pnpm packages. Bit is the
reference consumer (it drives pnpm entirely through its programmatic API).
The binding is a new
pacquet-napicdylib crate plus an@pnpm/napinpm wrapper. Exports — all verified end-to-end against a real registry:
install— in-memory importers (single project and multi-importerworkspaces), a synchronous
readPackagehook applied per resolveddependency manifest, build-script approval (
allowBuilds/dangerouslyAllowAllBuilds/strictDepBuilds), anddepsRequiringBuild.rebuild,resolveDependency(npm registry),pack,parseBareSpecifier,engineVersion.authHeaderByUri(pre-computedAuthorizationheaders keyed bynerf-darted registry URI), applied through
AuthHeaders::from_creds_map.Engine-core changes are minimal and inert for existing callers:
PackageManifest::from_value(build an in-memory manifest without disk IO),and two
Optionfields onInstall(pnpmfile_hook_override,workspace_projects_override) defaulted toNoneat every existingconstruction site. A new
napi-releaseprofile setspanic = "unwind"— theworkspace
releaseprofile usespanic = "abort", which would abort the hostNode process on a panic that unwinds to the FFI boundary.
getPeerDependencyIssuesis stubbed (ERR_PNPM_NAPI_UNIMPLEMENTED) pendingthe peer-resolution issue renderer that pacquet's CLI has not ported yet.
Opening as a draft: this is the initial binding surface.
getPeerDependencyIssues,the cross-platform prebuild CI, and crate-level tests are follow-ups.
Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting. — Rust-onlyaddition (a Node binding over pacquet); there is no TypeScript-CLI counterpart.
changesets track the TypeScript packages; this adds Rust crates and a new npm
wrapper package, neither of which participates in the changeset flow.
are a follow-up.
pacquet/npm/napi/README.mdand
pacquet/plans/NAPI.md.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
install,rebuild,resolveDependency,pack, and specifier parsing, plusengineVersion.@pnpm/napiwith generated platform wrapper packages and improved native addon loading.engineStrictandnodeVersionare honored during installability checks.maxSockets.@pnpm/napiREADME and TypeScript typings, including structured error details.