{"name":"libnpmpublish","version":"11.2.0","author":{"name":"GitHub Inc."},"license":"ISC","_id":"libnpmpublish@11.2.0","maintainers":[{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"reggi","email":"reggi@github.com"},{"name":"owlstronaut","email":"owlstronaut@github.com"}],"contributors":[{"name":"Kat Marchán","email":"kzm@zkat.tech"},{"name":"Claudia Hernández","email":"claudia@npmjs.com"}],"homepage":"https://npmjs.com/package/libnpmpublish","bugs":{"url":"https://github.com/npm/cli/issues"},"tap":{"nyc-arg":["--exclude","tap-snapshots/**"]},"dist":{"shasum":"871e7c5746d613ffc218abc7ce42742c7f809d03","tarball":"http://registry-npm.ywwl.com/libnpmpublish/download/libnpmpublish-11.2.0.tgz","fileCount":7,"integrity":"sha512-fAEts7UCM2r1xhI82Dv9PK4gFGZoyD7Z5sfIwBQKoO/f67VNVDC0DeH3uH1Yi+T4kwt5iBuCKkZ5XcpxfvsGHQ==","signatures":[{"sig":"MEYCIQDRN0GzCQ8hySXqYxBteoGQXP2X5dtckwctXmUICabzQwIhAI0nBjEDet5VWJxKiPUoh9pU0dnSo8Hk9DZ1+O62gxeO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27859,"size":9120,"noattachment":false,"key":"/libnpmpublish/-/libnpmpublish-11.2.0.tgz"},"main":"lib/index.js","engines":{"node":"^20.17.0 || >=22.9.0"},"gitHead":"c79f6e59ecec42825cebbe8f5f44747d76c0c6fb","scripts":{"lint":"npm run eslint","snap":"tap","test":"tap","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","lintfix":"npm run eslint -- --fix","postlint":"template-oss-check","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"_npmUser":{"name":"owlstronaut","email":"owlstronaut@github.com"},"repository":{"url":"git+https://github.com/npm/cli.git","type":"git","directory":"workspaces/libnpmpublish"},"_npmVersion":"11.15.0","description":"Programmatic API for the bits behind npm publish and unpublish","directories":{},"templateOSS":{"content":"../../scripts/template-oss/index.js","version":"4.29.0","//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten."},"_nodeVersion":"24.15.0","dependencies":{"ssri":"^13.0.0","semver":"^7.3.7","ci-info":"^4.0.0","proc-log":"^6.0.0","sigstore":"^4.0.0","npm-package-arg":"^13.0.0","npm-registry-fetch":"^19.0.0","@npmcli/package-json":"^7.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^16.3.8","@npmcli/mock-globals":"^1.0.0","@npmcli/template-oss":"4.29.0","@npmcli/eslint-config":"^5.0.1","@npmcli/mock-registry":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/libnpmpublish_11.2.0_1779308878920_0.10628477026609207","host":"s3://npm-registry-packages-npm-production"},"readme":"# libnpmpublish\n\n[![npm version](https://img.shields.io/npm/v/libnpmpublish.svg)](https://npm.im/libnpmpublish)\n[![license](https://img.shields.io/npm/l/libnpmpublish.svg)](https://npm.im/libnpmpublish)\n[![CI - libnpmpublish](https://github.com/npm/cli/actions/workflows/ci-libnpmpublish.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmpublish.yml)\n\n[`libnpmpublish`](https://github.com/npm/libnpmpublish) is a Node.js\nlibrary for programmatically publishing and unpublishing npm packages. Give\nit a manifest as an object and a tarball as a Buffer, and it'll put them on\nthe registry for you.\n\n## Table of Contents\n\n* [Example](#example)\n* [Install](#install)\n* [API](#api)\n  * [publish/unpublish opts](#opts)\n  * [`publish()`](#publish)\n  * [`unpublish()`](#unpublish)\n\n## Example\n\n```js\nconst { publish, unpublish } = require('libnpmpublish')\n```\n\n## Install\n\n`$ npm install libnpmpublish`\n\n### API\n\n#### <a name=\"opts\"></a> `opts` for `libnpmpublish` commands\n\n`libnpmpublish` uses\n[`npm-registry-fetch`](https://npm.im/npm-registry-fetch).  Most options\nare passed through directly to that library, so please refer to [its own\n`opts` documentation](http://npm.im/npm-registry-fetch#fetch-options) for\noptions that can be passed in.\n\nA couple of options of note:\n\n* `opts.defaultTag` - registers the published package with the given tag,\n  defaults to `latest`.\n\n* `opts.access` - tells the registry whether this package should be\n  published as `'public'` or `'restricted'`. May also be `null`, which\n  preserves the existing access level on already-published packages and\n  defers to the registry's default for new packages (the registry treats\n  scoped packages as `restricted` and unscoped packages as `public` by\n  default). Only `'restricted'` and `null` are meaningful for scoped\n  packages; `'restricted'` is rejected for unscoped packages. Defaults to\n  `null`.\n\n* `opts.token` - can be passed in and will be used as the authentication\n  token for the registry. For other ways to pass in auth details, see the\n  n-r-f docs.\n\n* `opts.provenance` - when running in a supported CI environment, will trigger\n  the generation of a signed provenance statement to be published alongside\n  the package. Mutually exclusive with the `provenanceFile` option.\n\n* `opts.provenanceFile` - specifies the path to an externally-generated\n  provenance statement to be published alongside the package. Mutually\n  exclusive with the `provenance` option. The specified file should be a\n  [Sigstore Bundle](https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto)\n  containing a [DSSE](https://github.com/secure-systems-lab/dsse)-packaged\n  provenance statement.\n\n* `opts.stage` - when `true`, publishes the package to a staging area instead\n  of making it immediately available. The registry response will include a\n  `stageId` (UUID) that can be used to approve or reject the staged version\n  later. Changes the request method to `POST` and the endpoint to\n  `/-/stage/package/<name>`. The returned Response object will have a\n  `stageId` property.\n\n#### <a name=\"publish\"></a> `> libpub.publish(manifest, tarData, [opts]) -> Promise`\n\nSends the package represented by the `manifest` and `tarData` to the\nconfigured registry.\n\n`manifest` should be the parsed `package.json` for the package being\npublished (which can also be the manifest pulled from a packument, a git\nrepo, tarball, etc.)\n\n`tarData` is a `Buffer` of the tarball being published.\n\nIf `opts.npmVersion` is passed in, it will be used as the `_npmVersion`\nfield in the outgoing packument.  You may put your own user-agent string in\nthere to identify your publishes.\n\nIf `opts.algorithms` is passed in, it should be an array of hashing\nalgorithms to generate `integrity` hashes for. The default is `['sha512']`,\nwhich means you end up with `dist.integrity = 'sha512-deadbeefbadc0ffee'`.\nAny algorithm supported by your current node version is allowed -- npm\nclients that do not support those algorithms will simply ignore the\nunsupported hashes.\n\n##### Example\n\n```js\n// note that pacote.manifest() and pacote.tarball() can also take\n// any spec that npm can install.  a folder shown here, since that's\n// far and away the most common use case.\nconst path = '/a/path/to/your/source/code'\nconst pacote = require('pacote') // see: http://npm.im/pacote\nconst manifest = await pacote.manifest(path)\nconst tarData = await pacote.tarball(path)\nawait libpub.publish(manifest, tarData, {\n  npmVersion: 'my-pub-script@1.0.2',\n  token: 'my-auth-token-here'\n}, opts)\n// Package has been published to the npm registry.\n```\n\n#### <a name=\"unpublish\"></a> `> libpub.unpublish(spec, [opts]) -> Promise`\n\nUnpublishes `spec` from the appropriate registry. The registry in question may\nhave its own limitations on unpublishing.\n\n`spec` should be either a string, or a valid\n[`npm-package-arg`](https://npm.im/npm-package-arg) parsed spec object. For\nlegacy compatibility reasons, only `tag` and `version` specs will work as\nexpected. `range` specs will fail silently in most cases.\n\n##### Example\n\n```js\nawait libpub.unpublish('lodash', { token: 'i-am-the-worst'})\n//\n// `lodash` has now been unpublished, along with all its versions\n```\n","publish_time":1779308879064,"_cnpm_publish_time":1779308879064,"dist-tags":{"backport":"11.2.1","latest":"12.0.1","prerelease":"12.0.0-pre.0"}}