-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
263 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/lib/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const util = require('util') | ||
const fs = require('fs') | ||
const { stat } = fs.promises || { stat: util.promisify(fs.stat) } | ||
|
||
async function isNodeGypPackage (path) { | ||
return await stat(`${path}/binding.gyp`) | ||
.then(st => st.isFile()) | ||
.catch(() => false) | ||
} | ||
|
||
module.exports = { | ||
isNodeGypPackage, | ||
defaultGypInstallScript: 'node-gyp rebuild', | ||
} |
45 changes: 45 additions & 0 deletions
45
node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "@npmcli/node-gyp", | ||
"version": "2.0.0", | ||
"description": "Tools for dealing with node-gyp packages", | ||
"scripts": { | ||
"test": "tap", | ||
"preversion": "npm test", | ||
"postversion": "npm publish", | ||
"prepublishOnly": "git push origin --follow-tags", | ||
"lint": "eslint \"**/*.js\"", | ||
"postlint": "template-oss-check", | ||
"template-oss-apply": "template-oss-apply --force", | ||
"lintfix": "npm run lint -- --fix", | ||
"snap": "tap", | ||
"posttest": "npm run lint" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/npm/node-gyp.git" | ||
}, | ||
"keywords": [ | ||
"npm", | ||
"cli", | ||
"node-gyp" | ||
], | ||
"files": [ | ||
"bin/", | ||
"lib/" | ||
], | ||
"main": "lib/index.js", | ||
"author": "GitHub Inc.", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.2.2", | ||
"tap": "^16.0.1" | ||
}, | ||
"engines": { | ||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" | ||
}, | ||
"templateOSS": { | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "3.2.2" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
The ISC License | ||
|
||
Copyright (c) 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 NPM DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE NPM 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. |
75 changes: 75 additions & 0 deletions
75
node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
const { spawn } = require('child_process') | ||
const inferOwner = require('infer-owner') | ||
|
||
const isPipe = (stdio = 'pipe', fd) => | ||
stdio === 'pipe' || stdio === null ? true | ||
: Array.isArray(stdio) ? isPipe(stdio[fd], fd) | ||
: false | ||
|
||
// 'extra' object is for decorating the error a bit more | ||
const promiseSpawn = (cmd, args, opts = {}, extra = {}) => { | ||
const cwd = opts.cwd || process.cwd() | ||
const isRoot = process.getuid && process.getuid() === 0 | ||
const { uid, gid } = isRoot ? inferOwner.sync(cwd) : {} | ||
return promiseSpawnUid(cmd, args, { | ||
...opts, | ||
cwd, | ||
uid, | ||
gid, | ||
}, extra) | ||
} | ||
|
||
const stdioResult = (stdout, stderr, { stdioString, stdio }) => | ||
stdioString ? { | ||
stdout: isPipe(stdio, 1) ? Buffer.concat(stdout).toString() : null, | ||
stderr: isPipe(stdio, 2) ? Buffer.concat(stderr).toString() : null, | ||
} | ||
: { | ||
stdout: isPipe(stdio, 1) ? Buffer.concat(stdout) : null, | ||
stderr: isPipe(stdio, 2) ? Buffer.concat(stderr) : null, | ||
} | ||
|
||
const promiseSpawnUid = (cmd, args, opts, extra) => { | ||
let proc | ||
const p = new Promise((res, rej) => { | ||
proc = spawn(cmd, args, opts) | ||
const stdout = [] | ||
const stderr = [] | ||
const reject = er => rej(Object.assign(er, { | ||
cmd, | ||
args, | ||
...stdioResult(stdout, stderr, opts), | ||
...extra, | ||
})) | ||
proc.on('error', reject) | ||
if (proc.stdout) { | ||
proc.stdout.on('data', c => stdout.push(c)).on('error', reject) | ||
proc.stdout.on('error', er => reject(er)) | ||
} | ||
if (proc.stderr) { | ||
proc.stderr.on('data', c => stderr.push(c)).on('error', reject) | ||
proc.stderr.on('error', er => reject(er)) | ||
} | ||
proc.on('close', (code, signal) => { | ||
const result = { | ||
cmd, | ||
args, | ||
code, | ||
signal, | ||
...stdioResult(stdout, stderr, opts), | ||
...extra, | ||
} | ||
if (code || signal) { | ||
rej(Object.assign(new Error('command failed'), result)) | ||
} else { | ||
res(result) | ||
} | ||
}) | ||
}) | ||
|
||
p.stdin = proc.stdin | ||
p.process = proc | ||
return p | ||
} | ||
|
||
module.exports = promiseSpawn |
48 changes: 48 additions & 0 deletions
48
node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "@npmcli/promise-spawn", | ||
"version": "3.0.0", | ||
"files": [ | ||
"bin/", | ||
"lib/" | ||
], | ||
"main": "./lib/index.js", | ||
"description": "spawn processes the way the npm cli likes to do", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/npm/promise-spawn.git" | ||
}, | ||
"author": "GitHub Inc.", | ||
"license": "ISC", | ||
"scripts": { | ||
"test": "tap", | ||
"snap": "tap", | ||
"preversion": "npm test", | ||
"postversion": "npm publish", | ||
"prepublishOnly": "git push origin --follow-tags", | ||
"lint": "eslint \"**/*.js\"", | ||
"lintfix": "npm run lint -- --fix", | ||
"posttest": "npm run lint", | ||
"postsnap": "npm run lintfix --", | ||
"postlint": "template-oss-check", | ||
"template-oss-apply": "template-oss-apply --force" | ||
}, | ||
"tap": { | ||
"check-coverage": true | ||
}, | ||
"devDependencies": { | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.2.2", | ||
"minipass": "^3.1.1", | ||
"tap": "^16.0.1" | ||
}, | ||
"engines": { | ||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" | ||
}, | ||
"templateOSS": { | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "3.2.2" | ||
}, | ||
"dependencies": { | ||
"infer-owner": "^1.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters