@node-core/utils 7.1.0 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/metadata.js +2 -1
- package/lib/ci/build-types/test_build.js +3 -3
- package/lib/ci/failure_aggregator.js +2 -2
- package/lib/ci/run_ci.js +3 -2
- package/lib/cli.js +6 -6
- package/lib/figures.js +6 -6
- package/lib/prepare_security.js +20 -21
- package/lib/request.js +1 -1
- package/lib/update-v8/backport.js +3 -4
- package/lib/utils.js +4 -2
- package/lib/verbosity.js +2 -4
- package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/README.md +4 -4
- package/node_modules/@listr2/prompt-adapter-inquirer/dist/index.d.mts +21 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/dist/index.mjs +46 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/LICENSE +22 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/index.d.ts +2 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/index.js +2 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/inquirer.d.ts +35 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/inquirer.js +1 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/utils.d.ts +34 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/utils.js +2 -0
- package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/package.json +88 -0
- package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/package.json +25 -20
- package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/base.d.ts +48 -3
- package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/base.js +58 -19
- package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/package.json +1 -1
- package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/readme.md +36 -1
- package/node_modules/ansi-regex/index.js +9 -4
- package/node_modules/ansi-regex/package.json +1 -1
- package/node_modules/ansi-regex/readme.md +6 -0
- package/node_modules/ansi-styles/index.d.ts +12 -12
- package/node_modules/ansi-styles/index.js +3 -3
- package/node_modules/ansi-styles/package.json +4 -4
- package/node_modules/cli-truncate/index.d.ts +3 -3
- package/node_modules/cli-truncate/index.js +40 -14
- package/node_modules/cli-truncate/node_modules/string-width/index.js +133 -15
- package/node_modules/cli-truncate/node_modules/string-width/package.json +4 -4
- package/node_modules/cli-truncate/node_modules/string-width/readme.md +1 -1
- package/node_modules/cli-truncate/package.json +7 -7
- package/node_modules/cli-truncate/readme.md +2 -3
- package/node_modules/ghauth/.github/dependabot.yml +11 -3
- package/node_modules/ghauth/.github/workflows/depsound.yml +33 -0
- package/node_modules/ghauth/.github/workflows/test-and-release.yml +4 -4
- package/node_modules/ghauth/CHANGELOG.md +60 -0
- package/node_modules/ghauth/package.json +30 -6
- package/node_modules/js-yaml/README.md +20 -187
- package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs +1008 -946
- package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs.map +1 -1
- package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js +29 -23
- package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.cjs.js +1043 -583
- package/node_modules/js-yaml/dist/js-yaml.cjs.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.d.ts +877 -133
- package/node_modules/js-yaml/dist/js-yaml.mjs +995 -556
- package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
- package/node_modules/js-yaml/package.json +8 -7
- package/node_modules/listr2/dist/{index.d.cts → index.d.mts} +90 -60
- package/node_modules/listr2/dist/{index.js → index.mjs} +496 -373
- package/node_modules/listr2/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/listr2/node_modules/string-width/index.js +207 -0
- package/node_modules/listr2/node_modules/string-width/package.json +65 -0
- package/node_modules/listr2/node_modules/string-width/readme.md +66 -0
- package/node_modules/listr2/node_modules/wrap-ansi/index.d.ts +1 -1
- package/node_modules/listr2/node_modules/wrap-ansi/index.js +544 -116
- package/node_modules/listr2/node_modules/wrap-ansi/package.json +10 -13
- package/node_modules/listr2/node_modules/wrap-ansi/readme.md +2 -0
- package/node_modules/listr2/package.json +16 -19
- package/node_modules/log-update/index.d.ts +64 -1
- package/node_modules/log-update/index.js +268 -18
- package/node_modules/log-update/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/log-update/node_modules/string-width/index.js +207 -0
- package/node_modules/log-update/node_modules/string-width/package.json +65 -0
- package/node_modules/log-update/node_modules/string-width/readme.md +66 -0
- package/node_modules/log-update/node_modules/wrap-ansi/index.d.ts +1 -1
- package/node_modules/log-update/node_modules/wrap-ansi/index.js +544 -116
- package/node_modules/log-update/node_modules/wrap-ansi/package.json +10 -13
- package/node_modules/log-update/node_modules/wrap-ansi/readme.md +2 -0
- package/node_modules/log-update/package.json +14 -12
- package/node_modules/log-update/readme.md +61 -0
- package/node_modules/slice-ansi/index.d.ts +2 -2
- package/node_modules/slice-ansi/index.js +260 -112
- package/node_modules/slice-ansi/package.json +10 -9
- package/node_modules/slice-ansi/readme.md +3 -2
- package/node_modules/slice-ansi/tokenize-ansi.js +752 -0
- package/node_modules/smol-toml/README.md +205 -191
- package/node_modules/smol-toml/dist/date.d.ts +0 -1
- package/node_modules/smol-toml/dist/date.js +0 -1
- package/node_modules/smol-toml/dist/error.d.ts +0 -1
- package/node_modules/smol-toml/dist/error.js +0 -1
- package/node_modules/smol-toml/dist/extract.js +32 -65
- package/node_modules/smol-toml/dist/index.cjs +302 -288
- package/node_modules/smol-toml/dist/index.d.ts +0 -1
- package/node_modules/smol-toml/dist/index.js +0 -1
- package/node_modules/smol-toml/dist/parse.d.ts +1 -3
- package/node_modules/smol-toml/dist/parse.js +22 -21
- package/node_modules/smol-toml/dist/primitive.js +75 -76
- package/node_modules/smol-toml/dist/stringify.d.ts +0 -1
- package/node_modules/smol-toml/dist/stringify.js +43 -30
- package/node_modules/smol-toml/dist/struct.js +90 -93
- package/node_modules/smol-toml/dist/util.d.ts +1 -1
- package/node_modules/smol-toml/dist/util.js +36 -39
- package/node_modules/smol-toml/package.json +6 -6
- package/node_modules/strip-ansi/index.js +5 -0
- package/node_modules/strip-ansi/package.json +5 -5
- package/package.json +3 -9
- package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.cjs +0 -127
- package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.d.cts +0 -152
- package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.d.ts +0 -152
- package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.js +0 -92
- package/node_modules/chalk/package.json +0 -92
- package/node_modules/chalk/readme.md +0 -331
- package/node_modules/chalk/source/index.d.ts +0 -437
- package/node_modules/chalk/source/index.js +0 -261
- package/node_modules/chalk/source/utilities.js +0 -33
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -299
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -261
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
- package/node_modules/chalk/source/vendor/supports-color/browser.js +0 -32
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
- package/node_modules/chalk/source/vendor/supports-color/index.js +0 -206
- package/node_modules/colorette/LICENSE.md +0 -7
- package/node_modules/colorette/README.md +0 -134
- package/node_modules/colorette/index.cjs +0 -218
- package/node_modules/colorette/index.d.ts +0 -93
- package/node_modules/colorette/index.js +0 -150
- package/node_modules/colorette/package.json +0 -40
- package/node_modules/eventemitter3/LICENSE +0 -21
- package/node_modules/eventemitter3/README.md +0 -94
- package/node_modules/eventemitter3/dist/eventemitter3.esm.js +0 -347
- package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +0 -1
- package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +0 -1
- package/node_modules/eventemitter3/dist/eventemitter3.umd.js +0 -355
- package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +0 -1
- package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +0 -1
- package/node_modules/eventemitter3/index.d.ts +0 -135
- package/node_modules/eventemitter3/index.js +0 -336
- package/node_modules/eventemitter3/index.mjs +0 -4
- package/node_modules/eventemitter3/package.json +0 -67
- package/node_modules/figures/index.d.ts +0 -279
- package/node_modules/figures/index.js +0 -292
- package/node_modules/figures/package.json +0 -49
- package/node_modules/figures/readme.md +0 -337
- package/node_modules/isexe/LICENSE.md +0 -55
- package/node_modules/isexe/README.md +0 -80
- package/node_modules/isexe/dist/commonjs/index.d.ts +0 -14
- package/node_modules/isexe/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/isexe/dist/commonjs/index.js +0 -56
- package/node_modules/isexe/dist/commonjs/index.js.map +0 -1
- package/node_modules/isexe/dist/commonjs/index.min.js +0 -2
- package/node_modules/isexe/dist/commonjs/index.min.js.map +0 -7
- package/node_modules/isexe/dist/commonjs/options.d.ts +0 -32
- package/node_modules/isexe/dist/commonjs/options.d.ts.map +0 -1
- package/node_modules/isexe/dist/commonjs/options.js +0 -3
- package/node_modules/isexe/dist/commonjs/options.js.map +0 -1
- package/node_modules/isexe/dist/commonjs/package.json +0 -3
- package/node_modules/isexe/dist/commonjs/posix.d.ts +0 -18
- package/node_modules/isexe/dist/commonjs/posix.d.ts.map +0 -1
- package/node_modules/isexe/dist/commonjs/posix.js +0 -67
- package/node_modules/isexe/dist/commonjs/posix.js.map +0 -1
- package/node_modules/isexe/dist/commonjs/win32.d.ts +0 -18
- package/node_modules/isexe/dist/commonjs/win32.d.ts.map +0 -1
- package/node_modules/isexe/dist/commonjs/win32.js +0 -63
- package/node_modules/isexe/dist/commonjs/win32.js.map +0 -1
- package/node_modules/isexe/dist/esm/index.d.ts +0 -14
- package/node_modules/isexe/dist/esm/index.d.ts.map +0 -1
- package/node_modules/isexe/dist/esm/index.js +0 -16
- package/node_modules/isexe/dist/esm/index.js.map +0 -1
- package/node_modules/isexe/dist/esm/index.min.js +0 -2
- package/node_modules/isexe/dist/esm/index.min.js.map +0 -7
- package/node_modules/isexe/dist/esm/options.d.ts +0 -32
- package/node_modules/isexe/dist/esm/options.d.ts.map +0 -1
- package/node_modules/isexe/dist/esm/options.js +0 -2
- package/node_modules/isexe/dist/esm/options.js.map +0 -1
- package/node_modules/isexe/dist/esm/package.json +0 -3
- package/node_modules/isexe/dist/esm/posix.d.ts +0 -18
- package/node_modules/isexe/dist/esm/posix.d.ts.map +0 -1
- package/node_modules/isexe/dist/esm/posix.js +0 -62
- package/node_modules/isexe/dist/esm/posix.js.map +0 -1
- package/node_modules/isexe/dist/esm/win32.d.ts +0 -18
- package/node_modules/isexe/dist/esm/win32.d.ts.map +0 -1
- package/node_modules/isexe/dist/esm/win32.js +0 -58
- package/node_modules/isexe/dist/esm/win32.js.map +0 -1
- package/node_modules/isexe/package.json +0 -78
- package/node_modules/listr2/dist/index.cjs +0 -2189
- package/node_modules/listr2/dist/index.d.ts +0 -1528
- package/node_modules/rfdc/.github/workflows/ci.yml +0 -21
- package/node_modules/rfdc/LICENSE +0 -15
- package/node_modules/rfdc/default.js +0 -3
- package/node_modules/rfdc/index.d.ts +0 -13
- package/node_modules/rfdc/index.js +0 -198
- package/node_modules/rfdc/index.test-d.ts +0 -13
- package/node_modules/rfdc/package.json +0 -73
- package/node_modules/rfdc/readme.md +0 -181
- package/node_modules/rfdc/test/index.js +0 -306
- package/node_modules/smol-toml/dist/date.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/date.js.map +0 -1
- package/node_modules/smol-toml/dist/error.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/error.js.map +0 -1
- package/node_modules/smol-toml/dist/extract.js.map +0 -1
- package/node_modules/smol-toml/dist/index.cjs.map +0 -1
- package/node_modules/smol-toml/dist/index.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/index.js.map +0 -1
- package/node_modules/smol-toml/dist/parse.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/parse.js.map +0 -1
- package/node_modules/smol-toml/dist/primitive.d.ts +0 -29
- package/node_modules/smol-toml/dist/primitive.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/primitive.js.map +0 -1
- package/node_modules/smol-toml/dist/stringify.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/stringify.js.map +0 -1
- package/node_modules/smol-toml/dist/struct.js.map +0 -1
- package/node_modules/smol-toml/dist/util.d.ts.map +0 -1
- package/node_modules/smol-toml/dist/util.js.map +0 -1
- package/node_modules/smol-toml/src/date.ts +0 -152
- package/node_modules/smol-toml/src/error.ts +0 -77
- package/node_modules/smol-toml/src/extract.ts +0 -113
- package/node_modules/smol-toml/src/index.ts +0 -42
- package/node_modules/smol-toml/src/parse.ts +0 -184
- package/node_modules/smol-toml/src/primitive.ts +0 -249
- package/node_modules/smol-toml/src/stringify.ts +0 -191
- package/node_modules/smol-toml/src/struct.ts +0 -202
- package/node_modules/smol-toml/src/util.ts +0 -106
- package/node_modules/which/LICENSE +0 -15
- package/node_modules/which/README.md +0 -51
- package/node_modules/which/bin/which.js +0 -52
- package/node_modules/which/lib/index.js +0 -111
- package/node_modules/which/package.json +0 -52
- /package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/LICENSE +0 -0
- /package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/index.d.ts +0 -0
- /package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/index.js +0 -0
- /package/node_modules/{chalk → ansi-escapes}/license +0 -0
- /package/node_modules/{figures → listr2/node_modules/string-width}/license +0 -0
- /package/node_modules/log-update/node_modules/{ansi-escapes → string-width}/license +0 -0
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
*
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
*
|
|
8
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
* list of conditions and the following disclaimer.
|
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
* this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
* may be used to endorse or promote products derived from this software without
|
|
15
|
-
* specific prior written permission.
|
|
16
|
-
*
|
|
17
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
import type { TomlDate } from './date.js'
|
|
30
|
-
import { TomlError } from './error.js'
|
|
31
|
-
|
|
32
|
-
export type TomlPrimitive = string | number | bigint | boolean | TomlDate
|
|
33
|
-
export type TomlTable = { [key: string]: TomlValue }
|
|
34
|
-
export type TomlValue = TomlPrimitive | TomlValue[] | TomlTable
|
|
35
|
-
|
|
36
|
-
export type TomlTableWithoutBigInt = { [key: string]: TomlValueWithoutBigInt }
|
|
37
|
-
export type TomlValueWithoutBigInt = Exclude<TomlPrimitive, bigint> | TomlValueWithoutBigInt[] | TomlTableWithoutBigInt
|
|
38
|
-
|
|
39
|
-
/** @internal */
|
|
40
|
-
export function indexOfNewline(str: string, start = 0, end = str.length) {
|
|
41
|
-
let idx = str.indexOf('\n', start)
|
|
42
|
-
if (str[idx - 1] === '\r') idx--
|
|
43
|
-
return idx <= end ? idx : -1
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** @internal */
|
|
47
|
-
export function skipComment(str: string, ptr: number) {
|
|
48
|
-
for (let i = ptr; i < str.length; i++) {
|
|
49
|
-
let c = str[i]!
|
|
50
|
-
if (c === '\n')
|
|
51
|
-
return i
|
|
52
|
-
|
|
53
|
-
if (c === '\r' && str[i + 1] === '\n')
|
|
54
|
-
return i + 1
|
|
55
|
-
|
|
56
|
-
if ((c < '\x20' && c !== '\t') || c === '\x7f') {
|
|
57
|
-
throw new TomlError('control characters are not allowed in comments', {
|
|
58
|
-
toml: str,
|
|
59
|
-
ptr: ptr,
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return str.length
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** @internal */
|
|
68
|
-
export function skipVoid(str: string, ptr: number, banNewLines?: boolean, banComments?: boolean): number {
|
|
69
|
-
let c
|
|
70
|
-
while (1) {
|
|
71
|
-
while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || (c === '\r' && str[ptr + 1] === '\n')))) ptr++
|
|
72
|
-
|
|
73
|
-
// Tucking the return statement here would save 5 characters >:)
|
|
74
|
-
// But TypeScript fails to detect there is no way to exit the loop so it complains about the lack of final return
|
|
75
|
-
if (banComments || c !== '#') break
|
|
76
|
-
|
|
77
|
-
ptr = skipComment(str, ptr)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return ptr
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** @internal */
|
|
84
|
-
export function skipUntil(str: string, ptr: number, sep: string, end?: string, banNewLines: boolean = false) {
|
|
85
|
-
if (!end) {
|
|
86
|
-
ptr = indexOfNewline(str, ptr)
|
|
87
|
-
return ptr < 0 ? str.length : ptr
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
for (let i = ptr; i < str.length; i++) {
|
|
91
|
-
let c = str[i]
|
|
92
|
-
if (c === '#') {
|
|
93
|
-
i = indexOfNewline(str, i)
|
|
94
|
-
if (i < 0) break
|
|
95
|
-
} else if (c === sep) {
|
|
96
|
-
return i + 1
|
|
97
|
-
} else if (c === end || (banNewLines && (c === '\n' || (c === '\r' && str[i + 1] === '\n')))) {
|
|
98
|
-
return i
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
throw new TomlError('cannot find end of structure', {
|
|
103
|
-
toml: str,
|
|
104
|
-
ptr: ptr,
|
|
105
|
-
})
|
|
106
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
The ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
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 AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# which
|
|
2
|
-
|
|
3
|
-
Like the unix `which` utility.
|
|
4
|
-
|
|
5
|
-
Finds the first instance of a specified executable in the PATH
|
|
6
|
-
environment variable. Does not cache the results, so `hash -r` is not
|
|
7
|
-
needed when the PATH changes.
|
|
8
|
-
|
|
9
|
-
## USAGE
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
const which = require('which')
|
|
13
|
-
|
|
14
|
-
// async usage
|
|
15
|
-
// rejects if not found
|
|
16
|
-
const resolved = await which('node')
|
|
17
|
-
|
|
18
|
-
// if nothrow option is used, returns null if not found
|
|
19
|
-
const resolvedOrNull = await which('node', { nothrow: true })
|
|
20
|
-
|
|
21
|
-
// sync usage
|
|
22
|
-
// throws if not found
|
|
23
|
-
const resolved = which.sync('node')
|
|
24
|
-
|
|
25
|
-
// if nothrow option is used, returns null if not found
|
|
26
|
-
const resolvedOrNull = which.sync('node', { nothrow: true })
|
|
27
|
-
|
|
28
|
-
// Pass options to override the PATH and PATHEXT environment vars.
|
|
29
|
-
await which('node', { path: someOtherPath, pathExt: somePathExt })
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## CLI USAGE
|
|
33
|
-
|
|
34
|
-
Just like the BSD `which(1)` binary but using `node-which`.
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
usage: node-which [-as] program ...
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
You can learn more about why the binary is `node-which` and not `which`
|
|
41
|
-
[here](https://github.com/npm/node-which/pull/67)
|
|
42
|
-
|
|
43
|
-
## OPTIONS
|
|
44
|
-
|
|
45
|
-
You may pass an options object as the second argument.
|
|
46
|
-
|
|
47
|
-
- `path`: Use instead of the `PATH` environment variable.
|
|
48
|
-
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
|
49
|
-
- `all`: Return all matches, instead of just the first one. Note that
|
|
50
|
-
this means the function returns an array of strings instead of a
|
|
51
|
-
single string.
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const which = require('../lib')
|
|
4
|
-
const argv = process.argv.slice(2)
|
|
5
|
-
|
|
6
|
-
const usage = (err) => {
|
|
7
|
-
if (err) {
|
|
8
|
-
console.error(`which: ${err}`)
|
|
9
|
-
}
|
|
10
|
-
console.error('usage: which [-as] program ...')
|
|
11
|
-
process.exit(1)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (!argv.length) {
|
|
15
|
-
return usage()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let dashdash = false
|
|
19
|
-
const [commands, flags] = argv.reduce((acc, arg) => {
|
|
20
|
-
if (dashdash || arg === '--') {
|
|
21
|
-
dashdash = true
|
|
22
|
-
return acc
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!/^-/.test(arg)) {
|
|
26
|
-
acc[0].push(arg)
|
|
27
|
-
return acc
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (const flag of arg.slice(1).split('')) {
|
|
31
|
-
if (flag === 's') {
|
|
32
|
-
acc[1].silent = true
|
|
33
|
-
} else if (flag === 'a') {
|
|
34
|
-
acc[1].all = true
|
|
35
|
-
} else {
|
|
36
|
-
usage(`illegal option -- ${flag}`)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return acc
|
|
41
|
-
}, [[], {}])
|
|
42
|
-
|
|
43
|
-
for (const command of commands) {
|
|
44
|
-
try {
|
|
45
|
-
const res = which.sync(command, { all: flags.all })
|
|
46
|
-
if (!flags.silent) {
|
|
47
|
-
console.log([].concat(res).join('\n'))
|
|
48
|
-
}
|
|
49
|
-
} catch (err) {
|
|
50
|
-
process.exitCode = 1
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
const { isexe, sync: isexeSync } = require('isexe')
|
|
2
|
-
const { join, delimiter, sep, posix } = require('path')
|
|
3
|
-
|
|
4
|
-
const isWindows = process.platform === 'win32'
|
|
5
|
-
|
|
6
|
-
// used to check for slashed in commands passed in. always checks for the posix
|
|
7
|
-
// seperator on all platforms, and checks for the current separator when not on
|
|
8
|
-
// a posix platform. don't use the isWindows check for this since that is mocked
|
|
9
|
-
// in tests but we still need the code to actually work when called. that is also
|
|
10
|
-
// why it is ignored from coverage.
|
|
11
|
-
/* istanbul ignore next */
|
|
12
|
-
const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? '' : sep}]`.replace(/(\\)/g, '\\$1'))
|
|
13
|
-
const rRel = new RegExp(`^\\.${rSlash.source}`)
|
|
14
|
-
|
|
15
|
-
const getNotFoundError = (cmd) =>
|
|
16
|
-
Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
|
|
17
|
-
|
|
18
|
-
const getPathInfo = (cmd, {
|
|
19
|
-
path: optPath = process.env.PATH,
|
|
20
|
-
pathExt: optPathExt = process.env.PATHEXT,
|
|
21
|
-
delimiter: optDelimiter = delimiter,
|
|
22
|
-
}) => {
|
|
23
|
-
// If it has a slash, then we don't bother searching the pathenv.
|
|
24
|
-
// just check the file itself, and that's it.
|
|
25
|
-
const pathEnv = cmd.match(rSlash) ? [''] : [
|
|
26
|
-
// windows always checks the cwd first
|
|
27
|
-
...(isWindows ? [process.cwd()] : []),
|
|
28
|
-
...(optPath || /* istanbul ignore next: very unusual */ '').split(optDelimiter),
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
if (isWindows) {
|
|
32
|
-
const pathExtExe = optPathExt ||
|
|
33
|
-
['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter)
|
|
34
|
-
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()])
|
|
35
|
-
if (cmd.includes('.') && pathExt[0] !== '') {
|
|
36
|
-
pathExt.unshift('')
|
|
37
|
-
}
|
|
38
|
-
return { pathEnv, pathExt, pathExtExe }
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return { pathEnv, pathExt: [''] }
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const getPathPart = (raw, cmd) => {
|
|
45
|
-
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw
|
|
46
|
-
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ''
|
|
47
|
-
return prefix + join(pathPart, cmd)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const which = async (cmd, opt = {}) => {
|
|
51
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
|
|
52
|
-
const found = []
|
|
53
|
-
|
|
54
|
-
for (const envPart of pathEnv) {
|
|
55
|
-
const p = getPathPart(envPart, cmd)
|
|
56
|
-
|
|
57
|
-
for (const ext of pathExt) {
|
|
58
|
-
const withExt = p + ext
|
|
59
|
-
const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true })
|
|
60
|
-
if (is) {
|
|
61
|
-
if (!opt.all) {
|
|
62
|
-
return withExt
|
|
63
|
-
}
|
|
64
|
-
found.push(withExt)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (opt.all && found.length) {
|
|
70
|
-
return found
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (opt.nothrow) {
|
|
74
|
-
return null
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
throw getNotFoundError(cmd)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const whichSync = (cmd, opt = {}) => {
|
|
81
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
|
|
82
|
-
const found = []
|
|
83
|
-
|
|
84
|
-
for (const pathEnvPart of pathEnv) {
|
|
85
|
-
const p = getPathPart(pathEnvPart, cmd)
|
|
86
|
-
|
|
87
|
-
for (const ext of pathExt) {
|
|
88
|
-
const withExt = p + ext
|
|
89
|
-
const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true })
|
|
90
|
-
if (is) {
|
|
91
|
-
if (!opt.all) {
|
|
92
|
-
return withExt
|
|
93
|
-
}
|
|
94
|
-
found.push(withExt)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (opt.all && found.length) {
|
|
100
|
-
return found
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (opt.nothrow) {
|
|
104
|
-
return null
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
throw getNotFoundError(cmd)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
module.exports = which
|
|
111
|
-
which.sync = whichSync
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "GitHub Inc.",
|
|
3
|
-
"name": "which",
|
|
4
|
-
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
|
5
|
-
"version": "7.0.0",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/npm/node-which.git"
|
|
9
|
-
},
|
|
10
|
-
"main": "lib/index.js",
|
|
11
|
-
"bin": {
|
|
12
|
-
"node-which": "./bin/which.js"
|
|
13
|
-
},
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"isexe": "^4.0.0"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@npmcli/eslint-config": "^6.0.0",
|
|
20
|
-
"@npmcli/template-oss": "5.0.0",
|
|
21
|
-
"tap": "^16.3.0"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"test": "tap",
|
|
25
|
-
"lint": "npm run eslint",
|
|
26
|
-
"postlint": "template-oss-check",
|
|
27
|
-
"template-oss-apply": "template-oss-apply --force",
|
|
28
|
-
"lintfix": "npm run eslint -- --fix",
|
|
29
|
-
"snap": "tap",
|
|
30
|
-
"posttest": "npm run lint",
|
|
31
|
-
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
|
|
32
|
-
},
|
|
33
|
-
"files": [
|
|
34
|
-
"bin/",
|
|
35
|
-
"lib/"
|
|
36
|
-
],
|
|
37
|
-
"tap": {
|
|
38
|
-
"check-coverage": true,
|
|
39
|
-
"nyc-arg": [
|
|
40
|
-
"--exclude",
|
|
41
|
-
"tap-snapshots/**"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
46
|
-
},
|
|
47
|
-
"templateOSS": {
|
|
48
|
-
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
49
|
-
"version": "5.0.0",
|
|
50
|
-
"publish": "true"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|