mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-24 22:53:10 -04:00
Add an opt-in pnpm agent server that resolves dependencies server-side and streams only the files missing from the client's store. Server (@pnpm/agent.server): - Multi-process HTTP server (Node.js cluster, 9 workers) - SQLite-backed metadata cache — resolution in ~1s vs ~3.4s with .jsonl - Streaming NDJSON /v1/install — file digests emitted as packages resolve - Gzip-compressed streaming /v1/files — no buffering on server or worker - Binary protocol with server-provided digests (no client rehashing) Client (@pnpm/agent.client): - Streaming NDJSON parser dispatches worker batches during resolution - Worker-thread streaming HTTP + gzip decompress + CAFS writes - Pre-packed msgpack store index entries written directly to SQLite - Pipelined headless install via wrapped store controller Config: `agent: "http://host:port"` in pnpm-workspace.yaml
@pnpm/npm-resolver
Resolver for npm-hosted packages
Installation
pnpm add @pnpm/npm-resolver
Usage
'use strict'
const createResolveFromNpm = require('@pnpm/npm-resolver').default
const resolveFromNpm = createResolveFromNpm({
store: '.store',
offline: false,
rawConfig: {
registry: 'https://registry.npmjs.org/',
},
})
resolveFromNpm({alias: 'is-positive', bareSpecifier: '1.0.0'}, {
registry: 'https://registry.npmjs.org/',
})
.then(resolveResult => console.log(JSON.stringify(resolveResult, null, 2)))
//> {
// "id": "registry.npmjs.org/is-positive/1.0.0",
// "latest": "3.1.0",
// "package": {
// "name": "is-positive",
// "version": "1.0.0",
// "devDependencies": {
// "ava": "^0.0.4"
// },
// "_hasShrinkwrap": false,
// "directories": {},
// "dist": {
// "shasum": "88009856b64a2f1eb7d8bb0179418424ae0452cb",
// "tarball": "https://registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz"
// },
// "engines": {
// "node": ">=0.10.0"
// }
// },
// "resolution": {
// "integrity": "sha1-iACYVrZKLx632LsBeUGEJK4EUss=",
// "registry": "https://registry.npmjs.org/",
// "tarball": "https://registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz"
// },
// "resolvedVia": "npm-registry"
// }
License
MIT