This commit is contained in:
2025-08-18 23:06:34 +08:00
parent 0bc04fb659
commit ed18af0cad
1926 changed files with 275098 additions and 0 deletions

13
package/node_modules/libnpmpack/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright npm, Inc
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

55
package/node_modules/libnpmpack/README.md generated vendored Normal file
View File

@@ -0,0 +1,55 @@
# libnpmpack
[![npm version](https://img.shields.io/npm/v/libnpmpack.svg)](https://npm.im/libnpmpack)
[![license](https://img.shields.io/npm/l/libnpmpack.svg)](https://npm.im/libnpmpack)
[![CI - libnpmpack](https://github.com/npm/cli/actions/workflows/ci-libnpmpack.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmpack.yml)
[`libnpmpack`](https://github.com/npm/libnpmpack) is a Node.js library for
programmatically packing tarballs from a local directory or from a registry or github spec. If packing from a local source, `libnpmpack` will also run the `prepack` and `postpack` lifecycles.
## Table of Contents
* [Example](#example)
* [Install](#install)
* [API](#api)
* [`pack()`](#pack)
## Example
```js
const pack = require('libnpmpack')
```
## Install
`$ npm install libnpmpack`
### API
#### <a name="pack"></a> `> pack(spec, [opts]) -> Promise`
Packs a tarball from a local directory or from a registry or github spec and returns a Promise that resolves to the tarball data Buffer, with from, resolved, and integrity fields attached.
If no options are passed, the tarball file will be saved on the same directory from which `pack` was called in.
`libnpmpack` uses [`pacote`](https://npm.im/pacote).
Most options are passed through directly to that library, so please refer to
[its own `opts`
documentation](https://www.npmjs.com/package/pacote#options)
for options that can be passed in.
##### Examples
```javascript
// packs from cwd
const tarball = await pack()
// packs from a local directory
const localTar = await pack('/Users/claudiahdz/projects/my-cool-pkg')
// packs from a registry spec
const registryTar = await pack('abbrev@1.0.3')
// packs from a github spec
const githubTar = await pack('isaacs/rimraf#PR-192')
```

62
package/node_modules/libnpmpack/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
'use strict'
const pacote = require('pacote')
const npa = require('npm-package-arg')
const runScript = require('@npmcli/run-script')
const path = require('node:path')
const Arborist = require('@npmcli/arborist')
const { writeFile } = require('node:fs/promises')
module.exports = pack
async function pack (spec = 'file:.', opts = {}) {
// gets spec
spec = npa(spec)
const manifest = await pacote.manifest(spec, opts)
const stdio = opts.foregroundScripts ? 'inherit' : 'pipe'
if (spec.type === 'directory' && !opts.ignoreScripts) {
// prepack
await runScript({
...opts,
event: 'prepack',
path: spec.fetchSpec,
stdio,
pkg: manifest,
})
}
// packs tarball
const tarball = await pacote.tarball(manifest._resolved, {
...opts,
Arborist,
integrity: manifest._integrity,
})
// check for explicit `false` so the default behavior is to skip writing to disk
if (opts.dryRun === false) {
const filename = `${manifest.name}-${manifest.version}.tgz`
.replace(/^@/, '').replace(/\//, '-')
const destination = path.resolve(opts.packDestination, filename)
await writeFile(destination, tarball)
}
if (spec.type === 'directory' && !opts.ignoreScripts) {
// postpack
await runScript({
...opts,
event: 'postpack',
path: spec.fetchSpec,
stdio,
pkg: manifest,
env: {
npm_package_from: tarball.from,
npm_package_resolved: tarball.resolved,
npm_package_integrity: tarball.integrity,
},
})
}
return tarball
}

58
package/node_modules/libnpmpack/package.json generated vendored Normal file
View File

@@ -0,0 +1,58 @@
{
"name": "libnpmpack",
"version": "7.0.4",
"description": "Programmatic API for the bits behind npm pack",
"author": "GitHub Inc.",
"main": "lib/index.js",
"contributors": [
"Claudia Hernández <claudia@npmjs.com>"
],
"files": [
"bin/",
"lib/"
],
"license": "ISC",
"scripts": {
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"test": "tap",
"posttest": "npm run lint",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"template-oss-apply": "template-oss-apply --force"
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.22.0",
"nock": "^13.3.3",
"spawk": "^1.7.1",
"tap": "^16.3.8"
},
"repository": {
"type": "git",
"url": "git+https://github.com/npm/cli.git",
"directory": "workspaces/libnpmpack"
},
"bugs": "https://github.com/npm/libnpmpack/issues",
"homepage": "https://npmjs.com/package/libnpmpack",
"dependencies": {
"@npmcli/arborist": "^7.5.4",
"@npmcli/run-script": "^8.1.0",
"npm-package-arg": "^11.0.2",
"pacote": "^18.0.6"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.22.0",
"content": "../../scripts/template-oss/index.js"
},
"tap": {
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
}
}