@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.
Files changed (232) hide show
  1. package/components/metadata.js +2 -1
  2. package/lib/ci/build-types/test_build.js +3 -3
  3. package/lib/ci/failure_aggregator.js +2 -2
  4. package/lib/ci/run_ci.js +3 -2
  5. package/lib/cli.js +6 -6
  6. package/lib/figures.js +6 -6
  7. package/lib/prepare_security.js +20 -21
  8. package/lib/request.js +1 -1
  9. package/lib/update-v8/backport.js +3 -4
  10. package/lib/utils.js +4 -2
  11. package/lib/verbosity.js +2 -4
  12. package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/README.md +4 -4
  13. package/node_modules/@listr2/prompt-adapter-inquirer/dist/index.d.mts +21 -0
  14. package/node_modules/@listr2/prompt-adapter-inquirer/dist/index.mjs +46 -0
  15. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/LICENSE +22 -0
  16. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/index.d.ts +2 -0
  17. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/index.js +2 -0
  18. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/inquirer.d.ts +35 -0
  19. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/inquirer.js +1 -0
  20. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/utils.d.ts +34 -0
  21. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/dist/utils.js +2 -0
  22. package/node_modules/@listr2/prompt-adapter-inquirer/node_modules/@inquirer/type/package.json +88 -0
  23. package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/package.json +25 -20
  24. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/base.d.ts +48 -3
  25. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/base.js +58 -19
  26. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/package.json +1 -1
  27. package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/readme.md +36 -1
  28. package/node_modules/ansi-regex/index.js +9 -4
  29. package/node_modules/ansi-regex/package.json +1 -1
  30. package/node_modules/ansi-regex/readme.md +6 -0
  31. package/node_modules/ansi-styles/index.d.ts +12 -12
  32. package/node_modules/ansi-styles/index.js +3 -3
  33. package/node_modules/ansi-styles/package.json +4 -4
  34. package/node_modules/cli-truncate/index.d.ts +3 -3
  35. package/node_modules/cli-truncate/index.js +40 -14
  36. package/node_modules/cli-truncate/node_modules/string-width/index.js +133 -15
  37. package/node_modules/cli-truncate/node_modules/string-width/package.json +4 -4
  38. package/node_modules/cli-truncate/node_modules/string-width/readme.md +1 -1
  39. package/node_modules/cli-truncate/package.json +7 -7
  40. package/node_modules/cli-truncate/readme.md +2 -3
  41. package/node_modules/ghauth/.github/dependabot.yml +11 -3
  42. package/node_modules/ghauth/.github/workflows/depsound.yml +33 -0
  43. package/node_modules/ghauth/.github/workflows/test-and-release.yml +4 -4
  44. package/node_modules/ghauth/CHANGELOG.md +60 -0
  45. package/node_modules/ghauth/package.json +30 -6
  46. package/node_modules/js-yaml/README.md +20 -187
  47. package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs +1008 -946
  48. package/node_modules/js-yaml/dist/browser/js-yaml.esm.min.mjs.map +1 -1
  49. package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js +29 -23
  50. package/node_modules/js-yaml/dist/browser/js-yaml.umd.min.js.map +1 -1
  51. package/node_modules/js-yaml/dist/js-yaml.cjs.js +1043 -583
  52. package/node_modules/js-yaml/dist/js-yaml.cjs.js.map +1 -1
  53. package/node_modules/js-yaml/dist/js-yaml.d.ts +877 -133
  54. package/node_modules/js-yaml/dist/js-yaml.mjs +995 -556
  55. package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
  56. package/node_modules/js-yaml/package.json +8 -7
  57. package/node_modules/listr2/dist/{index.d.cts → index.d.mts} +90 -60
  58. package/node_modules/listr2/dist/{index.js → index.mjs} +496 -373
  59. package/node_modules/listr2/node_modules/string-width/index.d.ts +39 -0
  60. package/node_modules/listr2/node_modules/string-width/index.js +207 -0
  61. package/node_modules/listr2/node_modules/string-width/package.json +65 -0
  62. package/node_modules/listr2/node_modules/string-width/readme.md +66 -0
  63. package/node_modules/listr2/node_modules/wrap-ansi/index.d.ts +1 -1
  64. package/node_modules/listr2/node_modules/wrap-ansi/index.js +544 -116
  65. package/node_modules/listr2/node_modules/wrap-ansi/package.json +10 -13
  66. package/node_modules/listr2/node_modules/wrap-ansi/readme.md +2 -0
  67. package/node_modules/listr2/package.json +16 -19
  68. package/node_modules/log-update/index.d.ts +64 -1
  69. package/node_modules/log-update/index.js +268 -18
  70. package/node_modules/log-update/node_modules/string-width/index.d.ts +39 -0
  71. package/node_modules/log-update/node_modules/string-width/index.js +207 -0
  72. package/node_modules/log-update/node_modules/string-width/package.json +65 -0
  73. package/node_modules/log-update/node_modules/string-width/readme.md +66 -0
  74. package/node_modules/log-update/node_modules/wrap-ansi/index.d.ts +1 -1
  75. package/node_modules/log-update/node_modules/wrap-ansi/index.js +544 -116
  76. package/node_modules/log-update/node_modules/wrap-ansi/package.json +10 -13
  77. package/node_modules/log-update/node_modules/wrap-ansi/readme.md +2 -0
  78. package/node_modules/log-update/package.json +14 -12
  79. package/node_modules/log-update/readme.md +61 -0
  80. package/node_modules/slice-ansi/index.d.ts +2 -2
  81. package/node_modules/slice-ansi/index.js +260 -112
  82. package/node_modules/slice-ansi/package.json +10 -9
  83. package/node_modules/slice-ansi/readme.md +3 -2
  84. package/node_modules/slice-ansi/tokenize-ansi.js +752 -0
  85. package/node_modules/smol-toml/README.md +205 -191
  86. package/node_modules/smol-toml/dist/date.d.ts +0 -1
  87. package/node_modules/smol-toml/dist/date.js +0 -1
  88. package/node_modules/smol-toml/dist/error.d.ts +0 -1
  89. package/node_modules/smol-toml/dist/error.js +0 -1
  90. package/node_modules/smol-toml/dist/extract.js +32 -65
  91. package/node_modules/smol-toml/dist/index.cjs +302 -288
  92. package/node_modules/smol-toml/dist/index.d.ts +0 -1
  93. package/node_modules/smol-toml/dist/index.js +0 -1
  94. package/node_modules/smol-toml/dist/parse.d.ts +1 -3
  95. package/node_modules/smol-toml/dist/parse.js +22 -21
  96. package/node_modules/smol-toml/dist/primitive.js +75 -76
  97. package/node_modules/smol-toml/dist/stringify.d.ts +0 -1
  98. package/node_modules/smol-toml/dist/stringify.js +43 -30
  99. package/node_modules/smol-toml/dist/struct.js +90 -93
  100. package/node_modules/smol-toml/dist/util.d.ts +1 -1
  101. package/node_modules/smol-toml/dist/util.js +36 -39
  102. package/node_modules/smol-toml/package.json +6 -6
  103. package/node_modules/strip-ansi/index.js +5 -0
  104. package/node_modules/strip-ansi/package.json +5 -5
  105. package/package.json +3 -9
  106. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.cjs +0 -127
  107. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.d.cts +0 -152
  108. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.d.ts +0 -152
  109. package/node_modules/@listr2/prompt-adapter-enquirer/dist/index.js +0 -92
  110. package/node_modules/chalk/package.json +0 -92
  111. package/node_modules/chalk/readme.md +0 -331
  112. package/node_modules/chalk/source/index.d.ts +0 -437
  113. package/node_modules/chalk/source/index.js +0 -261
  114. package/node_modules/chalk/source/utilities.js +0 -33
  115. package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -299
  116. package/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -261
  117. package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
  118. package/node_modules/chalk/source/vendor/supports-color/browser.js +0 -32
  119. package/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
  120. package/node_modules/chalk/source/vendor/supports-color/index.js +0 -206
  121. package/node_modules/colorette/LICENSE.md +0 -7
  122. package/node_modules/colorette/README.md +0 -134
  123. package/node_modules/colorette/index.cjs +0 -218
  124. package/node_modules/colorette/index.d.ts +0 -93
  125. package/node_modules/colorette/index.js +0 -150
  126. package/node_modules/colorette/package.json +0 -40
  127. package/node_modules/eventemitter3/LICENSE +0 -21
  128. package/node_modules/eventemitter3/README.md +0 -94
  129. package/node_modules/eventemitter3/dist/eventemitter3.esm.js +0 -347
  130. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +0 -1
  131. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +0 -1
  132. package/node_modules/eventemitter3/dist/eventemitter3.umd.js +0 -355
  133. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +0 -1
  134. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +0 -1
  135. package/node_modules/eventemitter3/index.d.ts +0 -135
  136. package/node_modules/eventemitter3/index.js +0 -336
  137. package/node_modules/eventemitter3/index.mjs +0 -4
  138. package/node_modules/eventemitter3/package.json +0 -67
  139. package/node_modules/figures/index.d.ts +0 -279
  140. package/node_modules/figures/index.js +0 -292
  141. package/node_modules/figures/package.json +0 -49
  142. package/node_modules/figures/readme.md +0 -337
  143. package/node_modules/isexe/LICENSE.md +0 -55
  144. package/node_modules/isexe/README.md +0 -80
  145. package/node_modules/isexe/dist/commonjs/index.d.ts +0 -14
  146. package/node_modules/isexe/dist/commonjs/index.d.ts.map +0 -1
  147. package/node_modules/isexe/dist/commonjs/index.js +0 -56
  148. package/node_modules/isexe/dist/commonjs/index.js.map +0 -1
  149. package/node_modules/isexe/dist/commonjs/index.min.js +0 -2
  150. package/node_modules/isexe/dist/commonjs/index.min.js.map +0 -7
  151. package/node_modules/isexe/dist/commonjs/options.d.ts +0 -32
  152. package/node_modules/isexe/dist/commonjs/options.d.ts.map +0 -1
  153. package/node_modules/isexe/dist/commonjs/options.js +0 -3
  154. package/node_modules/isexe/dist/commonjs/options.js.map +0 -1
  155. package/node_modules/isexe/dist/commonjs/package.json +0 -3
  156. package/node_modules/isexe/dist/commonjs/posix.d.ts +0 -18
  157. package/node_modules/isexe/dist/commonjs/posix.d.ts.map +0 -1
  158. package/node_modules/isexe/dist/commonjs/posix.js +0 -67
  159. package/node_modules/isexe/dist/commonjs/posix.js.map +0 -1
  160. package/node_modules/isexe/dist/commonjs/win32.d.ts +0 -18
  161. package/node_modules/isexe/dist/commonjs/win32.d.ts.map +0 -1
  162. package/node_modules/isexe/dist/commonjs/win32.js +0 -63
  163. package/node_modules/isexe/dist/commonjs/win32.js.map +0 -1
  164. package/node_modules/isexe/dist/esm/index.d.ts +0 -14
  165. package/node_modules/isexe/dist/esm/index.d.ts.map +0 -1
  166. package/node_modules/isexe/dist/esm/index.js +0 -16
  167. package/node_modules/isexe/dist/esm/index.js.map +0 -1
  168. package/node_modules/isexe/dist/esm/index.min.js +0 -2
  169. package/node_modules/isexe/dist/esm/index.min.js.map +0 -7
  170. package/node_modules/isexe/dist/esm/options.d.ts +0 -32
  171. package/node_modules/isexe/dist/esm/options.d.ts.map +0 -1
  172. package/node_modules/isexe/dist/esm/options.js +0 -2
  173. package/node_modules/isexe/dist/esm/options.js.map +0 -1
  174. package/node_modules/isexe/dist/esm/package.json +0 -3
  175. package/node_modules/isexe/dist/esm/posix.d.ts +0 -18
  176. package/node_modules/isexe/dist/esm/posix.d.ts.map +0 -1
  177. package/node_modules/isexe/dist/esm/posix.js +0 -62
  178. package/node_modules/isexe/dist/esm/posix.js.map +0 -1
  179. package/node_modules/isexe/dist/esm/win32.d.ts +0 -18
  180. package/node_modules/isexe/dist/esm/win32.d.ts.map +0 -1
  181. package/node_modules/isexe/dist/esm/win32.js +0 -58
  182. package/node_modules/isexe/dist/esm/win32.js.map +0 -1
  183. package/node_modules/isexe/package.json +0 -78
  184. package/node_modules/listr2/dist/index.cjs +0 -2189
  185. package/node_modules/listr2/dist/index.d.ts +0 -1528
  186. package/node_modules/rfdc/.github/workflows/ci.yml +0 -21
  187. package/node_modules/rfdc/LICENSE +0 -15
  188. package/node_modules/rfdc/default.js +0 -3
  189. package/node_modules/rfdc/index.d.ts +0 -13
  190. package/node_modules/rfdc/index.js +0 -198
  191. package/node_modules/rfdc/index.test-d.ts +0 -13
  192. package/node_modules/rfdc/package.json +0 -73
  193. package/node_modules/rfdc/readme.md +0 -181
  194. package/node_modules/rfdc/test/index.js +0 -306
  195. package/node_modules/smol-toml/dist/date.d.ts.map +0 -1
  196. package/node_modules/smol-toml/dist/date.js.map +0 -1
  197. package/node_modules/smol-toml/dist/error.d.ts.map +0 -1
  198. package/node_modules/smol-toml/dist/error.js.map +0 -1
  199. package/node_modules/smol-toml/dist/extract.js.map +0 -1
  200. package/node_modules/smol-toml/dist/index.cjs.map +0 -1
  201. package/node_modules/smol-toml/dist/index.d.ts.map +0 -1
  202. package/node_modules/smol-toml/dist/index.js.map +0 -1
  203. package/node_modules/smol-toml/dist/parse.d.ts.map +0 -1
  204. package/node_modules/smol-toml/dist/parse.js.map +0 -1
  205. package/node_modules/smol-toml/dist/primitive.d.ts +0 -29
  206. package/node_modules/smol-toml/dist/primitive.d.ts.map +0 -1
  207. package/node_modules/smol-toml/dist/primitive.js.map +0 -1
  208. package/node_modules/smol-toml/dist/stringify.d.ts.map +0 -1
  209. package/node_modules/smol-toml/dist/stringify.js.map +0 -1
  210. package/node_modules/smol-toml/dist/struct.js.map +0 -1
  211. package/node_modules/smol-toml/dist/util.d.ts.map +0 -1
  212. package/node_modules/smol-toml/dist/util.js.map +0 -1
  213. package/node_modules/smol-toml/src/date.ts +0 -152
  214. package/node_modules/smol-toml/src/error.ts +0 -77
  215. package/node_modules/smol-toml/src/extract.ts +0 -113
  216. package/node_modules/smol-toml/src/index.ts +0 -42
  217. package/node_modules/smol-toml/src/parse.ts +0 -184
  218. package/node_modules/smol-toml/src/primitive.ts +0 -249
  219. package/node_modules/smol-toml/src/stringify.ts +0 -191
  220. package/node_modules/smol-toml/src/struct.ts +0 -202
  221. package/node_modules/smol-toml/src/util.ts +0 -106
  222. package/node_modules/which/LICENSE +0 -15
  223. package/node_modules/which/README.md +0 -51
  224. package/node_modules/which/bin/which.js +0 -52
  225. package/node_modules/which/lib/index.js +0 -111
  226. package/node_modules/which/package.json +0 -52
  227. /package/node_modules/@listr2/{prompt-adapter-enquirer → prompt-adapter-inquirer}/LICENSE +0 -0
  228. /package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/index.d.ts +0 -0
  229. /package/node_modules/{log-update/node_modules/ansi-escapes → ansi-escapes}/index.js +0 -0
  230. /package/node_modules/{chalk → ansi-escapes}/license +0 -0
  231. /package/node_modules/{figures → listr2/node_modules/string-width}/license +0 -0
  232. /package/node_modules/log-update/node_modules/{ansi-escapes → string-width}/license +0 -0
@@ -61,7 +61,8 @@ export function formatMetadataResult({ status, data, metadata, checker }) {
61
61
  owner: data.owner,
62
62
  repo: data.repo,
63
63
  number: data.prid,
64
- url: data.pr.url
64
+ url: data.pr.url,
65
+ labels: data.pr.labels.nodes.map(({ name }) => name)
65
66
  },
66
67
  metadata,
67
68
  reasonCodes,
@@ -1,4 +1,4 @@
1
- import chalk from 'chalk';
1
+ import { styleText } from 'node:util';
2
2
 
3
3
  import { shortSha } from '../../utils.js';
4
4
  import {
@@ -119,11 +119,11 @@ export class TestBuild extends Job {
119
119
  cli.table('Built On', failure.builtOn);
120
120
  }
121
121
  if (!reason.includes('\n') && reason.length < 40) {
122
- cli.table('Reason', chalk.red(reason));
122
+ cli.table('Reason', styleText('red', reason));
123
123
  } else {
124
124
  cli.table('Reason', '');
125
125
  const lines = reason.split('\n');
126
- cli.log(` ${chalk.red(lines[0])}`);
126
+ cli.log(` ${styleText('red', lines[0])}`);
127
127
  for (let i = 1; i < lines.length; ++i) {
128
128
  cli.log(` ${lines[i]}`);
129
129
  }
@@ -1,4 +1,4 @@
1
- import chalk from 'chalk';
1
+ import { styleText } from 'node:util';
2
2
 
3
3
  import { getMachineUrl, parsePRFromURL } from '../links.js';
4
4
  import CIFailureParser from './ci_failure_parser.js';
@@ -140,7 +140,7 @@ export class FailureAggregator {
140
140
  cli.table('First CI', `${prs[0].upstream}`);
141
141
  }
142
142
  cli.table('Last CI', `${prs[prs.length - 1].upstream}`);
143
- cli.log('\n' + chalk.bold('Example: ') + `${failures[0].url}\n`);
143
+ cli.log('\n' + styleText('bold', 'Example: ') + `${failures[0].url}\n`);
144
144
  const example = failures[0].reason;
145
145
  cli.log(example.length > 512 ? example.slice(0, 512) + '...' : example);
146
146
  cli.separator();
package/lib/ci/run_ci.js CHANGED
@@ -73,9 +73,10 @@ export class RunPRJob {
73
73
  }
74
74
 
75
75
  async start() {
76
- const { cli, request, certifySafe, checkForDuplicates } = this;
76
+ const { cli, request, checkForDuplicates } = this;
77
+ const certifySafe = await this.certifySafe;
77
78
 
78
- if (!(await certifySafe)) {
79
+ if (!certifySafe) {
79
80
  cli.error('Refusing to run CI on potentially unsafe PR');
80
81
  return false;
81
82
  }
package/lib/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import ora from 'ora';
2
- import chalk from 'chalk';
2
+ import { styleText } from 'node:util';
3
3
  import * as inquirer from '@inquirer/prompts';
4
4
 
5
5
  import { warning, error, info, success } from './figures.js';
@@ -22,7 +22,7 @@ const QUESTION_TYPE = {
22
22
  const formatter = new Intl.ListFormat('en', { type: 'disjunction' });
23
23
 
24
24
  function head(text, length = 11) {
25
- return chalk.bold(text.padEnd(length));
25
+ return styleText('bold', text.padEnd(length));
26
26
  }
27
27
 
28
28
  export default class CLI {
@@ -180,9 +180,9 @@ export default class CLI {
180
180
  const rest = (length - text.length - 2);
181
181
  const half = sep.repeat(Math.abs(Math.floor(rest / 2)));
182
182
  if (rest % 2 === 0) {
183
- this.log(`${half} ${chalk.bold(text)} ${half}`);
183
+ this.log(`${half} ${styleText('bold', text)} ${half}`);
184
184
  } else {
185
- this.log(`${half} ${chalk.bold(text)} ${sep}${half}`);
185
+ this.log(`${half} ${styleText('bold', text)} ${sep}${half}`);
186
186
  }
187
187
  }
188
188
 
@@ -193,7 +193,7 @@ export default class CLI {
193
193
 
194
194
  warn(text, options = {}) {
195
195
  const prefix = options.newline ? this.eolIndent : this.figureIndent;
196
- this.log(prefix + chalk.bold(`${warning} ${text}`));
196
+ this.log(prefix + styleText('bold', `${warning} ${text}`));
197
197
  }
198
198
 
199
199
  info(text, options = {}) {
@@ -210,7 +210,7 @@ export default class CLI {
210
210
  this.log(JSON.stringify(obj.data, null, 2));
211
211
  }
212
212
  } else {
213
- this.log(prefix + chalk.bold(`${error} ${obj}`));
213
+ this.log(prefix + styleText('bold', `${error} ${obj}`));
214
214
  }
215
215
  }
216
216
 
package/lib/figures.js CHANGED
@@ -1,7 +1,7 @@
1
- import chalk from 'chalk';
2
- import figures from 'figures';
1
+ import { figures } from 'listr2';
2
+ import { styleText } from 'node:util';
3
3
 
4
- export const warning = chalk.yellow(figures.warning);
5
- export const error = chalk.red(figures.cross);
6
- export const info = chalk.blue(figures.info);
7
- export const success = chalk.green(figures.tick);
4
+ export const warning = styleText('yellow', figures.warning);
5
+ export const error = styleText('red', figures.cross);
6
+ export const info = styleText('blue', figures.info);
7
+ export const success = styleText('green', figures.tick);
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import auth from './auth.js';
4
4
  import Request from './request.js';
5
+ import { parsePRFromURL } from './links.js';
5
6
  import {
6
7
  NEXT_SECURITY_RELEASE_BRANCH,
7
8
  NEXT_SECURITY_RELEASE_FOLDER,
@@ -196,8 +197,7 @@ export default class PrepareSecurityRelease extends SecurityRelease {
196
197
  await this.closeAndRequestDisclosure(vulnerabilityJSON.reports);
197
198
 
198
199
  this.cli.info('Closing pull requests');
199
- // For now, close the ones with Security Release label
200
- await this.closePRWithLabel('Security Release');
200
+ await this.closePullRequests(vulnerabilityJSON);
201
201
 
202
202
  if (vulnerabilityJSON.buildIssue) {
203
203
  this.cli.info('Commenting on nodejs/build issue');
@@ -637,26 +637,25 @@ export default class PrepareSecurityRelease extends SecurityRelease {
637
637
  this.cli.stopSpinner('Done closing H1 Reports and requesting disclosure');
638
638
  }
639
639
 
640
- async closePRWithLabel(labels) {
641
- if (typeof labels === 'string') {
642
- labels = [labels];
643
- }
644
-
645
- const url = 'https://github.com/nodejs-private/node-private/pull';
640
+ async closePullRequests(vulnerabilityJSON) {
646
641
  this.cli.startSpinner('Closing GitHub Pull Requests...');
647
- // At this point, GitHub does not provide filters through their REST API
648
- const prs = await this.req.getPullRequest(url);
649
- for (const pr of prs) {
650
- if (pr.labels.some((l) => labels.includes(l.name))) {
651
- this.cli.updateSpinner(`Closing Pull Request: ${pr.number}`);
652
- await confirmSecurityStep(
653
- this.cli,
654
- `close GitHub pull request \`nodejs-private/node-private#${pr.number}\``,
655
- 'This closes a pull request labeled for the security release.'
656
- );
657
- await this.req.closePullRequest(pr.number,
658
- { owner: 'nodejs-private', repo: 'node-private' });
659
- }
642
+ const entries = [
643
+ ...vulnerabilityJSON.reports,
644
+ ...Object.values(vulnerabilityJSON.dependencies ?? {})
645
+ ];
646
+ const urls = new Set(entries.flatMap(
647
+ ({ affectedVersions }) => Object.values(affectedVersions)));
648
+
649
+ for (const url of urls) {
650
+ const { owner, repo, prid } = parsePRFromURL(url);
651
+ const name = `${owner}/${repo}#${prid}`;
652
+ this.cli.updateSpinner(`Closing Pull Request: ${name}`);
653
+ await confirmSecurityStep(
654
+ this.cli,
655
+ `close GitHub pull request \`${name}\``,
656
+ 'This closes a pull request listed in vulnerabilities.json.'
657
+ );
658
+ await this.req.closePullRequest(prid, { owner, repo });
660
659
  }
661
660
  this.cli.stopSpinner('Closed GitHub Pull Requests.');
662
661
  }
package/lib/request.js CHANGED
@@ -158,7 +158,7 @@ export default class Request {
158
158
  async closePullRequest(id, { owner, repo }) {
159
159
  const url = `/repos/${owner}/${repo}/pulls/${id}`;
160
160
  const options = {
161
- method: 'POST',
161
+ method: 'PATCH',
162
162
  headers: {
163
163
  'Content-Type': 'application/json'
164
164
  },
@@ -3,8 +3,8 @@ import {
3
3
  promises as fs
4
4
  } from 'node:fs';
5
5
 
6
- import { confirm } from '@inquirer/prompts';
7
- import { ListrEnquirerPromptAdapter } from '@listr2/prompt-adapter-enquirer';
6
+ import { confirm, input } from '@inquirer/prompts';
7
+ import { ListrInquirerPromptAdapter } from '@listr2/prompt-adapter-inquirer';
8
8
 
9
9
  import { shortSha } from '../utils.js';
10
10
 
@@ -263,8 +263,7 @@ async function applyPatch(ctx, task, patch, method = 'apply') {
263
263
  );
264
264
  } catch {
265
265
  patch.hadConflicts = true;
266
- return task.prompt(ListrEnquirerPromptAdapter).run({
267
- type: 'input',
266
+ return task.prompt(ListrInquirerPromptAdapter).run(input, {
268
267
  message: "Resolve merge conflicts and enter 'RESOLVED'",
269
268
  validate: value => value.toUpperCase() === 'RESOLVED'
270
269
  });
package/lib/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { platform } from 'node:os';
2
- import which from 'which';
2
+ import { spawnSync } from 'node:child_process';
3
3
 
4
4
  import { forceRunAsync } from './run.js';
5
5
 
@@ -32,7 +32,9 @@ export function shortSha(sha) {
32
32
  let isGhAvailableCache;
33
33
  export function isGhAvailable() {
34
34
  if (isGhAvailableCache === undefined) {
35
- isGhAvailableCache = which.sync('gh', { nothrow: true }) !== null;
35
+ isGhAvailableCache = spawnSync(
36
+ 'gh', ['--version'], { stdio: 'ignore' }
37
+ ).status === 0;
36
38
  }
37
39
  return isGhAvailableCache;
38
40
  }
package/lib/verbosity.js CHANGED
@@ -1,6 +1,4 @@
1
- import util from 'node:util';
2
-
3
- import chalk from 'chalk';
1
+ import { format, styleText } from 'node:util';
4
2
 
5
3
  const VERBOSITY = {
6
4
  NONE: 0,
@@ -25,5 +23,5 @@ export function setVerbosityFromEnv() {
25
23
 
26
24
  export function debuglog(...args) {
27
25
  // Prepend a line break in case it's logged while the spinner is running
28
- console.error(chalk.green(util.format('\n[DEBUG]', ...args)));
26
+ console.error('\n' + styleText('green', format('[DEBUG]', ...args)));
29
27
  }
@@ -1,6 +1,6 @@
1
- # @listr2/prompt-adapter-enquirer
1
+ # @listr2/prompt-adapter-inquirer
2
2
 
3
- [![Pipeline](https://gitlab.kilic.dev/libraries/listr2/badges/master/pipeline.svg?style=flat-square&ignore_skipped=true)](https://gitlab.kilic.dev/libraries/listr2/-/commits/master) [![Version](https://img.shields.io/npm/v/%40listr2/prompt-adapter-enquirer.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-enquirer?activeTab=versions) [![Downloads](https://img.shields.io/npm/dm/%40listr2/prompt-adapter-enquirer.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-enquirer) [![Size](https://img.shields.io/bundlephobia/min/%40listr2/prompt-adapter-enquirer?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-enquirer) [![Dependencies](https://img.shields.io/librariesio/release/npm/%40listr2/prompt-adapter-enquirer?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-enquirer?activeTab=dependencies)
3
+ [![Pipeline](https://gitlab.kilic.dev/libraries/listr2/badges/master/pipeline.svg?style=flat-square&ignore_skipped=true)](https://gitlab.kilic.dev/libraries/listr2/-/commits/master) [![Version](https://img.shields.io/npm/v/%40listr2/prompt-adapter-inquirer.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-inquirer?activeTab=versions) [![Downloads](https://img.shields.io/npm/dm/%40listr2/prompt-adapter-inquirer.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-inquirer) [![Size](https://img.shields.io/bundlephobia/min/%40listr2/prompt-adapter-inquirer?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-inquirer) [![Dependencies](https://img.shields.io/librariesio/release/npm/%40listr2/prompt-adapter-inquirer?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40listr2/prompt-adapter-inquirer?activeTab=dependencies)
4
4
 
5
5
  [![github sponsors](https://img.shields.io/github/sponsors/cenk1cenk2?style=flat-square&logo=github)](https://github.com/sponsors/cenk1cenk2) [![opencollective](https://img.shields.io/opencollective/sponsors/listr2?label=open%20collective&logo=opencollective)](https://opencollective.com/listr2)
6
6
 
@@ -10,6 +10,6 @@
10
10
 
11
11
  ## Documentation
12
12
 
13
- This is an extension to [`listr2`](https://listr2.kilic.dev/) to create prompts with [`enquirer`](https://github.com/enquirer/enquirer).
13
+ This is an extension to [`listr2`](https://listr2.kilic.dev/) to create prompts with [`@inquirer/prompts`](https://github.com/SBoudrias/Inquirer.js/blob/master/packages/prompts/README.md).
14
14
 
15
- **[Read the documentation...](https://listr2.kilic.dev/task/prompts.html#enquirer)**
15
+ **[Read the documentation...](https://listr2.kilic.dev/task/prompts.html#inquirer)**
@@ -0,0 +1,21 @@
1
+ import { ListrPromptAdapter } from "listr2";
2
+ import { Prompt } from "@inquirer/type";
3
+ //#region src/prompt.d.ts
4
+ declare class ListrInquirerPromptAdapter extends ListrPromptAdapter {
5
+ private prompt;
6
+ private signal;
7
+ /**
8
+ * Get the current running instance of `inquirer`.
9
+ */
10
+ get instance(): Promise<any>;
11
+ /**
12
+ * Create a new prompt with `inquirer`.
13
+ */
14
+ run<T extends Prompt<any, any> = Prompt<any, any>>(prompt: T, ...[config, context]: Parameters<T>): Promise<ReturnType<T>>;
15
+ /**
16
+ * Cancel the ongoing prompt.
17
+ */
18
+ cancel(): void;
19
+ }
20
+ //#endregion
21
+ export { ListrInquirerPromptAdapter };
@@ -0,0 +1,46 @@
1
+ import { ListrPromptAdapter, ListrTaskEventType, ListrTaskState } from "listr2";
2
+
3
+ //#region src/prompt.ts
4
+ var ListrInquirerPromptAdapter = class extends ListrPromptAdapter {
5
+ prompt;
6
+ signal = new AbortController();
7
+ /**
8
+ * Get the current running instance of `inquirer`.
9
+ */
10
+ get instance() {
11
+ return this.prompt;
12
+ }
13
+ /**
14
+ * Create a new prompt with `inquirer`.
15
+ */
16
+ async run(prompt, ...[config, context]) {
17
+ context ??= {};
18
+ context.output ??= this.wrapper.stdout(ListrTaskEventType.PROMPT);
19
+ context.signal ??= this.signal.signal;
20
+ this.reportStarted();
21
+ this.task.on(ListrTaskEventType.STATE, (event) => {
22
+ if (event === ListrTaskState.SKIPPED && this.prompt) this.cancel();
23
+ });
24
+ this.prompt = prompt(config, context);
25
+ let result;
26
+ try {
27
+ result = await this.prompt;
28
+ this.reportCompleted();
29
+ } catch (e) {
30
+ this.reportFailed();
31
+ throw e;
32
+ }
33
+ return result;
34
+ }
35
+ /**
36
+ * Cancel the ongoing prompt.
37
+ */
38
+ cancel() {
39
+ if (!this.prompt) return;
40
+ this.reportFailed();
41
+ this.signal.abort("Prompt was cancelled");
42
+ }
43
+ };
44
+
45
+ //#endregion
46
+ export { ListrInquirerPromptAdapter };
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2025 Simon Boudrias
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export * from './inquirer.ts';
2
+ export * from './utils.ts';
@@ -0,0 +1,2 @@
1
+ export * from "./inquirer.js";
2
+ export * from "./utils.js";
@@ -0,0 +1,35 @@
1
+ import { Duplex } from 'node:stream';
2
+ /**
3
+ * `InquirerReadline` is a re-implementation of `readline.Interface` from Node.js.
4
+ * We're reimplementing it because of 3 reasons:
5
+ * 1. The `readline.Interface` API is not complete; it's missing for example `clearLine`.
6
+ * 2. The input/output streams are not generics, meaning they're inexact.
7
+ * 3. Since ReadLine isn't built-in Typescript Global NodeJS type, it'd force us to ship `@types/node` as a dependency to all users.
8
+ */
9
+ export type InquirerReadline = {
10
+ output: Duplex & {
11
+ mute: () => void;
12
+ unmute: () => void;
13
+ };
14
+ input: NodeJS.ReadableStream;
15
+ clearLine: (dir: 0 | 1 | -1) => void;
16
+ getCursorPos: () => {
17
+ rows: number;
18
+ cols: number;
19
+ };
20
+ setPrompt: (prompt: string) => void;
21
+ line: string;
22
+ write: (data: string) => void;
23
+ on: (event: string, listener: (...args: unknown[]) => void) => void;
24
+ removeListener: (event: string, listener: (...args: unknown[]) => void) => void;
25
+ pause: () => void;
26
+ resume: () => void;
27
+ close: () => void;
28
+ };
29
+ export type Context = {
30
+ input?: NodeJS.ReadableStream;
31
+ output?: NodeJS.WritableStream;
32
+ clearPromptOnDone?: boolean;
33
+ signal?: AbortSignal;
34
+ };
35
+ export type Prompt<Value, Config> = (config: Config, context?: Context) => Promise<Value>;
@@ -0,0 +1,34 @@
1
+ type Key = string | number | symbol;
2
+ /**
3
+ * Recursively expand intersections and mapped types for better IDE display,
4
+ * while preserving functions, arrays, primitives, and types with a string
5
+ * index signature (e.g. `Record<string, ...>`) as-is.
6
+ */
7
+ export type Prettify<T> = T extends (...args: never[]) => unknown ? T : T extends ReadonlyArray<unknown> ? T : T extends string | number | boolean | symbol | bigint | null | undefined ? T : T extends object ? string extends keyof T ? T : {
8
+ [K in keyof T]: Prettify<T[K]>;
9
+ } & {} : T;
10
+ export type PartialDeep<T> = T extends object ? {
11
+ [P in keyof T]?: PartialDeep<T[P]>;
12
+ } : T;
13
+ export type LiteralUnion<T extends F, F = string> = T | (F & {});
14
+ export type KeyUnion<T> = LiteralUnion<Extract<keyof T, string>>;
15
+ export type DistributiveMerge<A, B> = A extends any ? Prettify<Omit<A, keyof B> & B> : never;
16
+ export type UnionToIntersection<T> = (T extends any ? (input: T) => void : never) extends (input: infer Intersection) => void ? Intersection : never;
17
+ /**
18
+ * @hidden
19
+ */
20
+ type __Pick<O extends object, K extends keyof O> = {
21
+ [P in K]: O[P];
22
+ } & {};
23
+ /**
24
+ * @hidden
25
+ */
26
+ export type _Pick<O extends object, K extends Key> = __Pick<O, keyof O & K>;
27
+ /**
28
+ * Extract out of `O` the fields of key `K`
29
+ * @param O to extract from
30
+ * @param K to chose fields
31
+ * @returns [[Object]]
32
+ */
33
+ export type Pick<O extends object, K extends Key> = O extends unknown ? _Pick<O, K> : never;
34
+ export {};
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export {};
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@inquirer/type",
3
+ "version": "4.1.0",
4
+ "description": "Inquirer core TS types",
5
+ "keywords": [
6
+ "answer",
7
+ "answers",
8
+ "ask",
9
+ "base",
10
+ "cli",
11
+ "command",
12
+ "command-line",
13
+ "confirm",
14
+ "enquirer",
15
+ "generate",
16
+ "generator",
17
+ "hyper",
18
+ "input",
19
+ "inquire",
20
+ "inquirer",
21
+ "interface",
22
+ "iterm",
23
+ "javascript",
24
+ "menu",
25
+ "node",
26
+ "nodejs",
27
+ "prompt",
28
+ "promptly",
29
+ "prompts",
30
+ "question",
31
+ "readline",
32
+ "scaffold",
33
+ "scaffolder",
34
+ "scaffolding",
35
+ "stdin",
36
+ "stdout",
37
+ "terminal",
38
+ "tty",
39
+ "types",
40
+ "typescript",
41
+ "ui",
42
+ "yeoman",
43
+ "yo",
44
+ "zsh"
45
+ ],
46
+ "license": "MIT",
47
+ "author": "Simon Boudrias <admin@simonboudrias.com>",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/SBoudrias/Inquirer.js.git"
51
+ },
52
+ "files": [
53
+ "dist"
54
+ ],
55
+ "type": "module",
56
+ "sideEffects": false,
57
+ "exports": {
58
+ ".": {
59
+ "types": "./dist/index.d.ts",
60
+ "default": "./dist/index.js"
61
+ },
62
+ "./package.json": "./package.json"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "scripts": {
68
+ "tsc": "tsc"
69
+ },
70
+ "devDependencies": {
71
+ "@repo/tsconfig": "0.0.0",
72
+ "typescript": "^6.0.2"
73
+ },
74
+ "peerDependencies": {
75
+ "@types/node": ">=18"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "@types/node": {
79
+ "optional": true
80
+ }
81
+ },
82
+ "engines": {
83
+ "node": ">=23.5.0 || ^22.13.0 || ^20.17.0"
84
+ },
85
+ "main": "./dist/index.js",
86
+ "types": "./dist/index.d.ts",
87
+ "gitHead": "51ac389603405e8f9f315ce49416153d95c5fefe"
88
+ }
@@ -1,22 +1,22 @@
1
1
  {
2
- "name": "@listr2/prompt-adapter-enquirer",
3
- "version": "2.0.16",
4
- "description": "Listr2 prompt adapter for enquirer.",
2
+ "name": "@listr2/prompt-adapter-inquirer",
3
+ "version": "4.2.7",
4
+ "description": "Listr2 prompt adapter for inquirer.",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/listr2/listr2",
7
7
  "type": "module",
8
- "main": "./dist/index.cjs",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
8
+ "main": "./dist/index.mjs",
9
+ "module": "./dist/index.mjs",
10
+ "types": "./dist/index.d.mts",
11
11
  "exports": {
12
12
  ".": {
13
13
  "require": {
14
- "types": "./dist/index.d.cts",
15
- "default": "./dist/index.cjs"
14
+ "types": "./dist/index.d.mts",
15
+ "default": "./dist/index.mjs"
16
16
  },
17
17
  "import": {
18
- "types": "./dist/index.d.ts",
19
- "default": "./dist/index.js"
18
+ "types": "./dist/index.d.mts",
19
+ "default": "./dist/index.mjs"
20
20
  }
21
21
  },
22
22
  "./package.json": "./package.json"
@@ -30,16 +30,16 @@
30
30
  "access": "public"
31
31
  },
32
32
  "engines": {
33
- "node": ">=18.0.0"
33
+ "node": ">=22.13.0"
34
34
  },
35
35
  "scripts": {
36
- "build": "tsup-node",
37
- "dev:start": "tsup-node --watch",
36
+ "build": "tsdown",
37
+ "dev:start": "tsdown --watch",
38
38
  "format": "prettier --log-level warn --write src/ tests/ && pnpm run lint --fix",
39
- "lint": "eslint --ext .ts,.js,.tsx,.jsx src/ tests/",
40
- "test": "NO_COLOR=1 TS_NODE_PROJECT=tests/tsconfig.json NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules' jest --config tests/jest.config.ts",
39
+ "lint": "eslint src/ tests/",
40
+ "test": "NODE_OPTIONS='--no-warnings --experimental-vm-modules' jest --config tests/jest.config.ts",
41
41
  "test:cov": "pnpm run test --coverage",
42
- "test:dev": "NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules --inspect=0.0.0.0:9229' pnpm run test --verbose --watchAll"
42
+ "test:dev": "NODE_OPTIONS='--no-warnings --experimental-vm-modules --inspect=0.0.0.0:9229' pnpm run test --verbose --watchAll"
43
43
  },
44
44
  "lint-staged": {
45
45
  "{src,tests}/**/*.{ts,js,tsx,jsx,spec.ts}": [
@@ -69,12 +69,17 @@
69
69
  "wait",
70
70
  "idle"
71
71
  ],
72
- "dependencies": {},
72
+ "dependencies": {
73
+ "@inquirer/type": "^4.0.7"
74
+ },
73
75
  "devDependencies": {
74
- "listr2": "8.3.3",
75
- "enquirer": "^2.4.1"
76
+ "@inquirer/core": "^12.0.0",
77
+ "@inquirer/input": "^5.1.2",
78
+ "@inquirer/prompts": "^8.5.2",
79
+ "listr2": "11.1.0"
76
80
  },
77
81
  "peerDependencies": {
78
- "enquirer": ">= 2.3.0 < 3"
82
+ "@inquirer/prompts": ">= 3 < 9",
83
+ "listr2": "11.1.0"
79
84
  }
80
85
  }