{"name":"libnpmpublish","version":"12.0.0","description":"Programmatic API for the bits behind npm publish and unpublish","author":{"name":"GitHub Inc."},"main":"lib/index.js","contributors":[{"name":"Kat Marchán","email":"kzm@zkat.tech"},{"name":"Claudia Hernández","email":"claudia@npmjs.com"}],"license":"ISC","scripts":{"lint":"npm run eslint","lintfix":"npm run eslint -- --fix","test":"tap","posttest":"npm run lint","postlint":"template-oss-check","snap":"tap","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"devDependencies":{"@npmcli/eslint-config":"^5.0.1","@npmcli/mock-globals":"^1.0.0","@npmcli/mock-registry":"^1.0.0","@npmcli/template-oss":"5.1.1","tap":"^16.3.8"},"repository":{"type":"git","url":"git+https://github.com/npm/cli.git","directory":"workspaces/libnpmpublish"},"bugs":{"url":"https://github.com/npm/cli/issues"},"homepage":"https://npmjs.com/package/libnpmpublish","dependencies":{"@npmcli/package-json":"^8.0.0","ci-info":"^4.0.0","npm-package-arg":"^14.0.0","npm-registry-fetch":"^20.0.1","proc-log":"^7.0.0","semver":"^7.3.7","sigstore":"^5.0.0","ssri":"^14.0.0"},"engines":{"node":"^22.22.2 || ^24.15.0 || >=26.0.0"},"templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"5.1.1","content":"../../scripts/template-oss/index.js"},"tap":{"node-arg":["--require","../../scripts/disable-agent-for-tests.js"],"nyc-arg":["--exclude","tap-snapshots/**"]},"gitHead":"aec197bf5594f0714f3e058415bb98414beab7c0","_id":"libnpmpublish@12.0.0","_nodeVersion":"26.0.0","_npmVersion":"12.0.0","dist":{"integrity":"sha512-F1KmLf5pmAGmOTR/NalClhPRqyLlrrdl270ZYg2xf9yk6w3oE21uF4QS9ph7hm+f4InB52AfG+UWeuFoFoqdeA==","shasum":"0eddc7192a767792380a797d4f4caf8d6fea8bbc","tarball":"http://registry-npm.ywwl.com/libnpmpublish/download/libnpmpublish-12.0.0.tgz","fileCount":7,"unpackedSize":28756,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHz1ARs/OV1xJMlSri9I1AWuCxEVl+9ukN6kq0Z9qZ51AiEA7DXdTS3bg5cAErCcnznkrN7v8JchmsflSuDx6e1ClHA="}],"size":9406,"noattachment":false,"key":"/libnpmpublish/-/libnpmpublish-12.0.0.tgz"},"_npmUser":{"name":"reggi","email":"reggi@github.com"},"directories":{},"maintainers":[{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"reggi","email":"reggi@github.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/libnpmpublish_12.0.0_1783544742047_0.15639874644427998"},"_hasShrinkwrap":false,"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":1783544742184,"_cnpm_publish_time":1783544742184,"dist-tags":{"backport":"11.2.1","latest":"12.0.1","prerelease":"12.0.0-pre.0"}}