deps: @npmcli/run-script@10.0.2 · npm/cli@d6830f4 · GitHub
Skip to content

Commit d6830f4

Browse files
committed
deps: @npmcli/run-script@10.0.2
1 parent bcc7ec8 commit d6830f4

14 files changed

Lines changed: 695 additions & 14 deletions

File tree

node_modules/.gitignore

Lines changed: 7 additions & 0 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ISC License:
2+
3+
Copyright (c) 2023 by GitHub Inc.
4+
5+
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.
6+
7+
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.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const util = require('util')
2+
const fs = require('fs')
3+
const { stat } = fs.promises || { stat: util.promisify(fs.stat) }
4+
5+
async function isNodeGypPackage (path) {
6+
return await stat(`${path}/binding.gyp`)
7+
.then(st => st.isFile())
8+
.catch(() => false)
9+
}
10+
11+
module.exports = {
12+
isNodeGypPackage,
13+
defaultGypInstallScript: 'node-gyp rebuild',
14+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "@npmcli/node-gyp",
3+
"version": "5.0.0",
4+
"description": "Tools for dealing with node-gyp packages",
5+
"scripts": {
6+
"test": "tap",
7+
"lint": "npm run eslint",
8+
"postlint": "template-oss-check",
9+
"template-oss-apply": "template-oss-apply --force",
10+
"lintfix": "npm run eslint -- --fix",
11+
"snap": "tap",
12+
"posttest": "npm run lint",
13+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/npm/node-gyp.git"
18+
},
19+
"keywords": [
20+
"npm",
21+
"cli",
22+
"node-gyp"
23+
],
24+
"files": [
25+
"bin/",
26+
"lib/"
27+
],
28+
"main": "lib/index.js",
29+
"author": "GitHub Inc.",
30+
"license": "ISC",
31+
"devDependencies": {
32+
"@npmcli/eslint-config": "^5.0.0",
33+
"@npmcli/template-oss": "4.27.1",
34+
"tap": "^16.0.1"
35+
},
36+
"engines": {
37+
"node": "^20.17.0 || >=22.9.0"
38+
},
39+
"templateOSS": {
40+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
41+
"version": "4.27.1",
42+
"publish": true
43+
},
44+
"tap": {
45+
"nyc-arg": [
46+
"--exclude",
47+
"tap-snapshots/**"
48+
]
49+
}
50+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The ISC License
2+
3+
Copyright (c) npm, Inc.
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE NPM DISCLAIMS ALL WARRANTIES WITH
10+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11+
FITNESS. IN NO EVENT SHALL THE NPM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
12+
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
13+
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
14+
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
15+
SOFTWARE.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
'use strict'
2+
3+
// this code adapted from: https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
4+
const cmd = (input, doubleEscape) => {
5+
if (!input.length) {
6+
return '""'
7+
}
8+
9+
let result
10+
if (!/[ \t\n\v"]/.test(input)) {
11+
result = input
12+
} else {
13+
result = '"'
14+
for (let i = 0; i <= input.length; ++i) {
15+
let slashCount = 0
16+
while (input[i] === '\\') {
17+
++i
18+
++slashCount
19+
}
20+
21+
if (i === input.length) {
22+
result += '\\'.repeat(slashCount * 2)
23+
break
24+
}
25+
26+
if (input[i] === '"') {
27+
result += '\\'.repeat(slashCount * 2 + 1)
28+
result += input[i]
29+
} else {
30+
result += '\\'.repeat(slashCount)
31+
result += input[i]
32+
}
33+
}
34+
result += '"'
35+
}
36+
37+
// and finally, prefix shell meta chars with a ^
38+
result = result.replace(/[ !%^&()<>|"]/g, '^$&')
39+
if (doubleEscape) {
40+
result = result.replace(/[ !%^&()<>|"]/g, '^$&')
41+
}
42+
43+
return result
44+
}
45+
46+
const sh = (input) => {
47+
if (!input.length) {
48+
return `''`
49+
}
50+
51+
if (!/[\t\n\r "#$&'()*;<>?\\`|~]/.test(input)) {
52+
return input
53+
}
54+
55+
// replace single quotes with '\'' and wrap the whole result in a fresh set of quotes
56+
const result = `'${input.replace(/'/g, `'\\''`)}'`
57+
// if the input string already had single quotes around it, clean those up
58+
.replace(/^(?:'')+(?!$)/, '')
59+
.replace(/\\'''/g, `\\'`)
60+
61+
return result
62+
}
63+
64+
module.exports = {
65+
cmd,
66+
sh,
67+
}
Lines changed: 218 additions & 0 deletions

0 commit comments

Comments
 (0)