@socketsecurity/cli-with-sentry 1.1.14 → 1.1.17

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 (112) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cli.js +114 -32
  3. package/dist/cli.js.map +1 -1
  4. package/dist/constants.js +35 -37
  5. package/dist/constants.js.map +1 -1
  6. package/dist/shadow-npm-bin.js +6 -6
  7. package/dist/shadow-npm-bin.js.map +1 -1
  8. package/dist/shadow-pnpm-bin.js +3 -5
  9. package/dist/shadow-pnpm-bin.js.map +1 -1
  10. package/dist/shadow-yarn-bin.js +2 -2
  11. package/dist/shadow-yarn-bin.js.map +1 -1
  12. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  13. package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
  14. package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
  15. package/dist/types/commands/fix/env-helpers.d.mts +13 -0
  16. package/dist/types/commands/fix/env-helpers.d.mts.map +1 -1
  17. package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
  18. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
  19. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -1
  20. package/dist/types/commands/optimize/apply-optimization.d.mts.map +1 -1
  21. package/dist/types/commands/optimize/update-lockfile.d.mts.map +1 -1
  22. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +1 -1
  23. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  24. package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
  25. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
  26. package/dist/types/commands/yarn/cmd-yarn.d.mts +1 -1
  27. package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
  28. package/dist/types/constants.d.mts +15 -19
  29. package/dist/types/constants.d.mts.map +1 -1
  30. package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
  31. package/dist/types/utils/agent.d.mts.map +1 -1
  32. package/dist/types/utils/api.d.mts.map +1 -1
  33. package/dist/types/utils/dlx.d.mts.map +1 -1
  34. package/dist/types/utils/package-environment.d.mts.map +1 -1
  35. package/dist/types/utils/path-resolve.d.mts.map +1 -1
  36. package/dist/utils.js +70 -29
  37. package/dist/utils.js.map +1 -1
  38. package/dist/vendor.js +514 -517
  39. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +45 -205
  40. package/external/@socketsecurity/registry/external/@inquirer/input.js +45 -205
  41. package/external/@socketsecurity/registry/external/@inquirer/password.js +181 -205
  42. package/external/@socketsecurity/registry/external/@inquirer/search.js +47 -207
  43. package/external/@socketsecurity/registry/external/@inquirer/select.js +183 -207
  44. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +388 -2280
  45. package/external/@socketsecurity/registry/external/browserslist.js +11534 -567
  46. package/external/@socketsecurity/registry/external/cacache.js +2575 -4914
  47. package/external/@socketsecurity/registry/external/libnpmpack.js +64667 -166061
  48. package/external/@socketsecurity/registry/external/make-fetch-happen.js +384 -4044
  49. package/external/@socketsecurity/registry/external/normalize-package-data.js +30 -278
  50. package/external/@socketsecurity/registry/external/npm-package-arg.js +28 -9
  51. package/external/@socketsecurity/registry/external/pacote.js +46680 -66482
  52. package/external/@socketsecurity/registry/external/spdx-correct.js +19 -0
  53. package/external/@socketsecurity/registry/external/spdx-expression-parse.js +19 -0
  54. package/external/@socketsecurity/registry/lib/agent.js +390 -0
  55. package/external/@socketsecurity/registry/lib/arrays.js +31 -0
  56. package/external/@socketsecurity/registry/lib/bin.js +650 -0
  57. package/external/@socketsecurity/registry/lib/constants/bun-lock.js +3 -0
  58. package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +3 -0
  59. package/external/@socketsecurity/registry/lib/constants/bun.js +3 -0
  60. package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +3 -0
  61. package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +3 -0
  62. package/external/@socketsecurity/registry/lib/constants/empty-value.js +3 -0
  63. package/external/@socketsecurity/registry/lib/constants/env.js +17 -3
  64. package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +3 -0
  65. package/external/@socketsecurity/registry/lib/constants/ext-yml.js +3 -0
  66. package/external/@socketsecurity/registry/lib/constants/index.js +20 -11
  67. package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +2 -2
  68. package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +1 -1
  69. package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +3 -0
  70. package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +5 -0
  71. package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +3 -0
  72. package/external/@socketsecurity/registry/lib/constants/unknown-error.js +3 -0
  73. package/external/@socketsecurity/registry/lib/constants/unknown-value.js +3 -0
  74. package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +3 -0
  75. package/external/@socketsecurity/registry/lib/constants/vlt.js +3 -0
  76. package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +3 -0
  77. package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +3 -0
  78. package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +5 -0
  79. package/external/@socketsecurity/registry/lib/constants/yarn.js +3 -0
  80. package/external/@socketsecurity/registry/lib/debug.js +53 -0
  81. package/external/@socketsecurity/registry/lib/env.js +18 -0
  82. package/external/@socketsecurity/registry/lib/fs.js +218 -2
  83. package/external/@socketsecurity/registry/lib/functions.js +5 -0
  84. package/external/@socketsecurity/registry/lib/globs.js +22 -1
  85. package/external/@socketsecurity/registry/lib/json.js +16 -0
  86. package/external/@socketsecurity/registry/lib/logger.js +157 -0
  87. package/external/@socketsecurity/registry/lib/objects.js +103 -0
  88. package/external/@socketsecurity/registry/lib/packages.js +88 -0
  89. package/external/@socketsecurity/registry/lib/path.js +51 -1
  90. package/external/@socketsecurity/registry/lib/promises.js +55 -0
  91. package/external/@socketsecurity/registry/lib/regexps.js +5 -0
  92. package/external/@socketsecurity/registry/lib/sorts.js +17 -0
  93. package/external/@socketsecurity/registry/lib/spawn.js +105 -7
  94. package/external/@socketsecurity/registry/lib/streams.js +26 -0
  95. package/external/@socketsecurity/registry/lib/strings.js +123 -9
  96. package/external/@socketsecurity/registry/lib/url.js +21 -0
  97. package/external/@socketsecurity/registry/lib/words.js +16 -0
  98. package/external/@socketsecurity/registry/manifest.json +5 -4
  99. package/package.json +5 -4
  100. package/external/@socketsecurity/registry/external/ansi-regex.js +0 -13
  101. package/external/@socketsecurity/registry/lib/constants/node-workspaces.js +0 -3
  102. package/external/@socketsecurity/registry/lib/constants/parse-args-config.js +0 -14
  103. package/external/@socketsecurity/registry/lib/constants/skip-tests-by-ecosystem.js +0 -43
  104. package/external/@socketsecurity/registry/lib/constants/template-cjs-browser.js +0 -3
  105. package/external/@socketsecurity/registry/lib/constants/template-cjs-esm.js +0 -3
  106. package/external/@socketsecurity/registry/lib/constants/template-cjs.js +0 -3
  107. package/external/@socketsecurity/registry/lib/constants/template-es-shim-constructor.js +0 -3
  108. package/external/@socketsecurity/registry/lib/constants/template-es-shim-prototype-method.js +0 -3
  109. package/external/@socketsecurity/registry/lib/constants/template-es-shim-static-method.js +0 -3
  110. package/external/@socketsecurity/registry/lib/constants/win32-ensure-tests-by-ecosystem.js +0 -3
  111. package/external/@socketsecurity/registry/lib/npm.js +0 -404
  112. /package/external/@socketsecurity/registry/lib/constants/{hidden-package-lock-json.js → dot-package-lock-json.js} +0 -0
@@ -2,10 +2,10 @@
2
2
 
3
3
  const readline$1 = require('readline')
4
4
  const async_hooks = require('async_hooks')
5
- const require$$0$3 = require('stream')
5
+ const require$$0$2 = require('stream')
6
6
  const util = require('util')
7
- const require$$0$2 = require('tty')
8
7
  const require$$0$1 = require('tty')
8
+ const require$$0 = require('tty')
9
9
  const process$2 = require('process')
10
10
 
11
11
  function _interopNamespaceDefault(e) {
@@ -208,45 +208,6 @@ function useEffect(cb, depArray) {
208
208
  })
209
209
  }
210
210
 
211
- function getAugmentedNamespace(n) {
212
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) {
213
- return n
214
- }
215
- const f = n.default
216
- if (typeof f == 'function') {
217
- var a = function a() {
218
- let isInstance = false
219
- try {
220
- isInstance = this instanceof a
221
- } catch {}
222
- if (isInstance) {
223
- return Reflect.construct(f, arguments, this.constructor)
224
- }
225
- return f.apply(this, arguments)
226
- }
227
- a.prototype = f.prototype
228
- } else {
229
- a = {}
230
- }
231
- Object.defineProperty(a, '__esModule', { value: true })
232
- Object.keys(n).forEach(function (k) {
233
- const d = Object.getOwnPropertyDescriptor(n, k)
234
- Object.defineProperty(
235
- a,
236
- k,
237
- d.get
238
- ? d
239
- : {
240
- enumerable: true,
241
- get: function () {
242
- return n[k]
243
- }
244
- }
245
- )
246
- })
247
- return a
248
- }
249
-
250
211
  let yoctocolorsCjs
251
212
  let hasRequiredYoctocolorsCjs
252
213
  function requireYoctocolorsCjs() {
@@ -254,7 +215,7 @@ function requireYoctocolorsCjs() {
254
215
  return yoctocolorsCjs
255
216
  }
256
217
  hasRequiredYoctocolorsCjs = 1
257
- const tty = require$$0$1 // eslint-disable-line unicorn/prefer-module
218
+ const tty = require$$0 // eslint-disable-line unicorn/prefer-module
258
219
 
259
220
  // eslint-disable-next-line no-warning-comments
260
221
  // TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
@@ -768,7 +729,7 @@ function requireCliWidth() {
768
729
  const defaultOpts = {
769
730
  defaultWidth: 0,
770
731
  output: process.stdout,
771
- tty: require$$0$2
732
+ tty: require$$0$1
772
733
  }
773
734
  if (!options) {
774
735
  return defaultOpts
@@ -806,23 +767,23 @@ const cliWidthExports = requireCliWidth()
806
767
 
807
768
  const stringWidth = { exports: {} }
808
769
 
809
- function ansiRegex({ onlyFirst = false } = {}) {
810
- // Valid string terminator sequences are BEL, ESC\, and 0x9c
811
- const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'
812
- const pattern = [
813
- `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
814
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
815
- ].join('|')
816
- return new RegExp(pattern, onlyFirst ? undefined : 'g')
770
+ let ansiRegex
771
+ let hasRequiredAnsiRegex
772
+ function requireAnsiRegex() {
773
+ if (hasRequiredAnsiRegex) {
774
+ return ansiRegex
775
+ }
776
+ hasRequiredAnsiRegex = 1
777
+ ansiRegex = ({ onlyFirst = false } = {}) => {
778
+ const pattern = [
779
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
780
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
781
+ ].join('|')
782
+ return new RegExp(pattern, onlyFirst ? undefined : 'g')
783
+ }
784
+ return ansiRegex
817
785
  }
818
786
 
819
- const ansiRegex$1 = /*#__PURE__*/ Object.freeze({
820
- __proto__: null,
821
- default: ansiRegex
822
- })
823
-
824
- const require$$0 = /*@__PURE__*/ getAugmentedNamespace(ansiRegex$1)
825
-
826
787
  let stripAnsi
827
788
  let hasRequiredStripAnsi
828
789
  function requireStripAnsi() {
@@ -830,7 +791,7 @@ function requireStripAnsi() {
830
791
  return stripAnsi
831
792
  }
832
793
  hasRequiredStripAnsi = 1
833
- const ansiRegex = require$$0
794
+ const ansiRegex = requireAnsiRegex()
834
795
  stripAnsi = string =>
835
796
  typeof string === 'string' ? string.replace(ansiRegex(), '') : string
836
797
  return stripAnsi
@@ -2448,7 +2409,7 @@ function requireLib() {
2448
2409
  return lib
2449
2410
  }
2450
2411
  hasRequiredLib = 1
2451
- const Stream = require$$0$3
2412
+ const Stream = require$$0$2
2452
2413
  class MuteStream extends Stream {
2453
2414
  #isTTY = null
2454
2415
  constructor(opts = {}) {
@@ -2893,147 +2854,28 @@ const {
2893
2854
  processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback()
2894
2855
  )
2895
2856
 
2896
- const ansiEscapes = { exports: {} }
2897
-
2898
- let hasRequiredAnsiEscapes
2899
- function requireAnsiEscapes() {
2900
- if (hasRequiredAnsiEscapes) {
2901
- return ansiEscapes.exports
2902
- }
2903
- hasRequiredAnsiEscapes = 1
2904
- ;(function (module) {
2905
- const ansiEscapes = module.exports
2906
- // TODO: remove this in the next major version
2907
- module.exports.default = ansiEscapes
2908
- const ESC = '\u001B['
2909
- const OSC = '\u001B]'
2910
- const BEL = '\u0007'
2911
- const SEP = ';'
2912
- const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'
2913
- ansiEscapes.cursorTo = (x, y) => {
2914
- if (typeof x !== 'number') {
2915
- throw new TypeError('The `x` argument is required')
2916
- }
2917
- if (typeof y !== 'number') {
2918
- return ESC + (x + 1) + 'G'
2919
- }
2920
- return ESC + (y + 1) + ';' + (x + 1) + 'H'
2921
- }
2922
- ansiEscapes.cursorMove = (x, y) => {
2923
- if (typeof x !== 'number') {
2924
- throw new TypeError('The `x` argument is required')
2925
- }
2926
- let ret = ''
2927
- if (x < 0) {
2928
- ret += ESC + -x + 'D'
2929
- } else if (x > 0) {
2930
- ret += ESC + x + 'C'
2931
- }
2932
- if (y < 0) {
2933
- ret += ESC + -y + 'A'
2934
- } else if (y > 0) {
2935
- ret += ESC + y + 'B'
2936
- }
2937
- return ret
2938
- }
2939
- ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'
2940
- ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'
2941
- ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'
2942
- ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'
2943
- ansiEscapes.cursorLeft = ESC + 'G'
2944
- ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'
2945
- ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'
2946
- ansiEscapes.cursorGetPosition = ESC + '6n'
2947
- ansiEscapes.cursorNextLine = ESC + 'E'
2948
- ansiEscapes.cursorPrevLine = ESC + 'F'
2949
- ansiEscapes.cursorHide = ESC + '?25l'
2950
- ansiEscapes.cursorShow = ESC + '?25h'
2951
- ansiEscapes.eraseLines = count => {
2952
- let clear = ''
2953
- for (let i = 0; i < count; i++) {
2954
- clear +=
2955
- ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '')
2956
- }
2957
- if (count) {
2958
- clear += ansiEscapes.cursorLeft
2959
- }
2960
- return clear
2961
- }
2962
- ansiEscapes.eraseEndLine = ESC + 'K'
2963
- ansiEscapes.eraseStartLine = ESC + '1K'
2964
- ansiEscapes.eraseLine = ESC + '2K'
2965
- ansiEscapes.eraseDown = ESC + 'J'
2966
- ansiEscapes.eraseUp = ESC + '1J'
2967
- ansiEscapes.eraseScreen = ESC + '2J'
2968
- ansiEscapes.scrollUp = ESC + 'S'
2969
- ansiEscapes.scrollDown = ESC + 'T'
2970
- ansiEscapes.clearScreen = '\u001Bc'
2971
- ansiEscapes.clearTerminal =
2972
- process.platform === 'win32'
2973
- ? `${ansiEscapes.eraseScreen}${ESC}0f`
2974
- : // 1. Erases the screen (Only done in case `2` is not supported)
2975
- // 2. Erases the whole screen including scrollback buffer
2976
- // 3. Moves cursor to the top-left position
2977
- // More info: https://www.real-world-systems.com/docs/ANSIcode.html
2978
- `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
2979
- ansiEscapes.beep = BEL
2980
- ansiEscapes.link = (text, url) => {
2981
- return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join(
2982
- ''
2983
- )
2984
- }
2985
- ansiEscapes.image = (buffer, options = {}) => {
2986
- let ret = `${OSC}1337;File=inline=1`
2987
- if (options.width) {
2988
- ret += `;width=${options.width}`
2989
- }
2990
- if (options.height) {
2991
- ret += `;height=${options.height}`
2992
- }
2993
- if (options.preserveAspectRatio === false) {
2994
- ret += ';preserveAspectRatio=0'
2995
- }
2996
- return ret + ':' + buffer.toString('base64') + BEL
2997
- }
2998
- ansiEscapes.iTerm = {
2999
- setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
3000
- annotation: (message, options = {}) => {
3001
- let ret = `${OSC}1337;`
3002
- const hasX = typeof options.x !== 'undefined'
3003
- const hasY = typeof options.y !== 'undefined'
3004
- if (
3005
- (hasX || hasY) &&
3006
- !(hasX && hasY && typeof options.length !== 'undefined')
3007
- ) {
3008
- throw new Error(
3009
- '`x`, `y` and `length` must be defined when `x` or `y` is defined'
3010
- )
3011
- }
3012
- message = message.replace(/\|/g, '')
3013
- ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='
3014
- if (options.length > 0) {
3015
- ret += (
3016
- hasX
3017
- ? [message, options.length, options.x, options.y]
3018
- : [options.length, message]
3019
- ).join('|')
3020
- } else {
3021
- ret += message
3022
- }
3023
- return ret + BEL
3024
- }
3025
- }
3026
- })(ansiEscapes)
3027
- return ansiEscapes.exports
2857
+ const ESC = '\u001B['
2858
+ /** Move cursor to first column */
2859
+ const cursorLeft = ESC + 'G'
2860
+ /** Show the cursor */
2861
+ const cursorShow = ESC + '?25h'
2862
+ /** Move cursor up by count rows */
2863
+ const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '')
2864
+ /** Move cursor down by count rows */
2865
+ const cursorDown = (rows = 1) => (rows > 0 ? `${ESC}${rows}B` : '')
2866
+ /** Move cursor to position (x, y) */
2867
+ const cursorTo = (x, y) => {
2868
+ return `${ESC}${x + 1}G`
3028
2869
  }
3029
-
3030
- const ansiEscapesExports = requireAnsiEscapes()
2870
+ const eraseLine = ESC + '2K'
2871
+ /** Erase the specified number of lines above the cursor */
2872
+ const eraseLines = lines =>
2873
+ lines > 0
2874
+ ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft
2875
+ : ''
3031
2876
 
3032
2877
  const height = content => content.split('\n').length
3033
2878
  const lastLine = content => content.split('\n').pop() ?? ''
3034
- function cursorDown(n) {
3035
- return n > 0 ? ansiEscapesExports.cursorDown(n) : ''
3036
- }
3037
2879
  class ScreenManager {
3038
2880
  // These variables are keeping information to allow correct prompt re-rendering
3039
2881
  height = 0
@@ -3084,17 +2926,15 @@ class ScreenManager {
3084
2926
  promptLineUpDiff + (bottomContent ? height(bottomContent) : 0)
3085
2927
  // Return cursor to the input position (on top of the bottomContent)
3086
2928
  if (bottomContentHeight > 0) {
3087
- output += ansiEscapesExports.cursorUp(bottomContentHeight)
2929
+ output += cursorUp(bottomContentHeight)
3088
2930
  }
3089
2931
  // Return cursor to the initial left offset.
3090
- output += ansiEscapesExports.cursorTo(this.cursorPos.cols)
2932
+ output += cursorTo(this.cursorPos.cols)
3091
2933
  /**
3092
2934
  * Render and store state for future re-rendering
3093
2935
  */
3094
2936
  this.write(
3095
- cursorDown(this.extraLinesUnderPrompt) +
3096
- ansiEscapesExports.eraseLines(this.height) +
3097
- output
2937
+ cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output
3098
2938
  )
3099
2939
  this.extraLinesUnderPrompt = bottomContentHeight
3100
2940
  this.height = height(output)
@@ -3102,15 +2942,15 @@ class ScreenManager {
3102
2942
  checkCursorPos() {
3103
2943
  const cursorPos = this.rl.getCursorPos()
3104
2944
  if (cursorPos.cols !== this.cursorPos.cols) {
3105
- this.write(ansiEscapesExports.cursorTo(cursorPos.cols))
2945
+ this.write(cursorTo(cursorPos.cols))
3106
2946
  this.cursorPos = cursorPos
3107
2947
  }
3108
2948
  }
3109
2949
  done({ clearContent }) {
3110
2950
  this.rl.setPrompt('')
3111
2951
  let output = cursorDown(this.extraLinesUnderPrompt)
3112
- output += clearContent ? ansiEscapesExports.eraseLines(this.height) : '\n'
3113
- output += ansiEscapesExports.cursorShow
2952
+ output += clearContent ? eraseLines(this.height) : '\n'
2953
+ output += cursorShow
3114
2954
  this.write(output)
3115
2955
  this.rl.close()
3116
2956
  }
@@ -2,10 +2,10 @@
2
2
 
3
3
  const readline$1 = require('readline')
4
4
  const async_hooks = require('async_hooks')
5
- const require$$0$3 = require('stream')
5
+ const require$$0$2 = require('stream')
6
6
  const util = require('util')
7
- const require$$0$2 = require('tty')
8
7
  const require$$0$1 = require('tty')
8
+ const require$$0 = require('tty')
9
9
  const process$2 = require('process')
10
10
 
11
11
  function _interopNamespaceDefault(e) {
@@ -209,45 +209,6 @@ function useEffect(cb, depArray) {
209
209
  })
210
210
  }
211
211
 
212
- function getAugmentedNamespace(n) {
213
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) {
214
- return n
215
- }
216
- const f = n.default
217
- if (typeof f == 'function') {
218
- var a = function a() {
219
- let isInstance = false
220
- try {
221
- isInstance = this instanceof a
222
- } catch {}
223
- if (isInstance) {
224
- return Reflect.construct(f, arguments, this.constructor)
225
- }
226
- return f.apply(this, arguments)
227
- }
228
- a.prototype = f.prototype
229
- } else {
230
- a = {}
231
- }
232
- Object.defineProperty(a, '__esModule', { value: true })
233
- Object.keys(n).forEach(function (k) {
234
- const d = Object.getOwnPropertyDescriptor(n, k)
235
- Object.defineProperty(
236
- a,
237
- k,
238
- d.get
239
- ? d
240
- : {
241
- enumerable: true,
242
- get: function () {
243
- return n[k]
244
- }
245
- }
246
- )
247
- })
248
- return a
249
- }
250
-
251
212
  let yoctocolorsCjs
252
213
  let hasRequiredYoctocolorsCjs
253
214
  function requireYoctocolorsCjs() {
@@ -255,7 +216,7 @@ function requireYoctocolorsCjs() {
255
216
  return yoctocolorsCjs
256
217
  }
257
218
  hasRequiredYoctocolorsCjs = 1
258
- const tty = require$$0$1 // eslint-disable-line unicorn/prefer-module
219
+ const tty = require$$0 // eslint-disable-line unicorn/prefer-module
259
220
 
260
221
  // eslint-disable-next-line no-warning-comments
261
222
  // TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
@@ -769,7 +730,7 @@ function requireCliWidth() {
769
730
  const defaultOpts = {
770
731
  defaultWidth: 0,
771
732
  output: process.stdout,
772
- tty: require$$0$2
733
+ tty: require$$0$1
773
734
  }
774
735
  if (!options) {
775
736
  return defaultOpts
@@ -807,23 +768,23 @@ const cliWidthExports = requireCliWidth()
807
768
 
808
769
  const stringWidth = { exports: {} }
809
770
 
810
- function ansiRegex({ onlyFirst = false } = {}) {
811
- // Valid string terminator sequences are BEL, ESC\, and 0x9c
812
- const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'
813
- const pattern = [
814
- `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
815
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
816
- ].join('|')
817
- return new RegExp(pattern, onlyFirst ? undefined : 'g')
771
+ let ansiRegex
772
+ let hasRequiredAnsiRegex
773
+ function requireAnsiRegex() {
774
+ if (hasRequiredAnsiRegex) {
775
+ return ansiRegex
776
+ }
777
+ hasRequiredAnsiRegex = 1
778
+ ansiRegex = ({ onlyFirst = false } = {}) => {
779
+ const pattern = [
780
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
781
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
782
+ ].join('|')
783
+ return new RegExp(pattern, onlyFirst ? undefined : 'g')
784
+ }
785
+ return ansiRegex
818
786
  }
819
787
 
820
- const ansiRegex$1 = /*#__PURE__*/ Object.freeze({
821
- __proto__: null,
822
- default: ansiRegex
823
- })
824
-
825
- const require$$0 = /*@__PURE__*/ getAugmentedNamespace(ansiRegex$1)
826
-
827
788
  let stripAnsi
828
789
  let hasRequiredStripAnsi
829
790
  function requireStripAnsi() {
@@ -831,7 +792,7 @@ function requireStripAnsi() {
831
792
  return stripAnsi
832
793
  }
833
794
  hasRequiredStripAnsi = 1
834
- const ansiRegex = require$$0
795
+ const ansiRegex = requireAnsiRegex()
835
796
  stripAnsi = string =>
836
797
  typeof string === 'string' ? string.replace(ansiRegex(), '') : string
837
798
  return stripAnsi
@@ -2449,7 +2410,7 @@ function requireLib() {
2449
2410
  return lib
2450
2411
  }
2451
2412
  hasRequiredLib = 1
2452
- const Stream = require$$0$3
2413
+ const Stream = require$$0$2
2453
2414
  class MuteStream extends Stream {
2454
2415
  #isTTY = null
2455
2416
  constructor(opts = {}) {
@@ -2894,147 +2855,28 @@ const {
2894
2855
  processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback()
2895
2856
  )
2896
2857
 
2897
- const ansiEscapes = { exports: {} }
2898
-
2899
- let hasRequiredAnsiEscapes
2900
- function requireAnsiEscapes() {
2901
- if (hasRequiredAnsiEscapes) {
2902
- return ansiEscapes.exports
2903
- }
2904
- hasRequiredAnsiEscapes = 1
2905
- ;(function (module) {
2906
- const ansiEscapes = module.exports
2907
- // TODO: remove this in the next major version
2908
- module.exports.default = ansiEscapes
2909
- const ESC = '\u001B['
2910
- const OSC = '\u001B]'
2911
- const BEL = '\u0007'
2912
- const SEP = ';'
2913
- const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'
2914
- ansiEscapes.cursorTo = (x, y) => {
2915
- if (typeof x !== 'number') {
2916
- throw new TypeError('The `x` argument is required')
2917
- }
2918
- if (typeof y !== 'number') {
2919
- return ESC + (x + 1) + 'G'
2920
- }
2921
- return ESC + (y + 1) + ';' + (x + 1) + 'H'
2922
- }
2923
- ansiEscapes.cursorMove = (x, y) => {
2924
- if (typeof x !== 'number') {
2925
- throw new TypeError('The `x` argument is required')
2926
- }
2927
- let ret = ''
2928
- if (x < 0) {
2929
- ret += ESC + -x + 'D'
2930
- } else if (x > 0) {
2931
- ret += ESC + x + 'C'
2932
- }
2933
- if (y < 0) {
2934
- ret += ESC + -y + 'A'
2935
- } else if (y > 0) {
2936
- ret += ESC + y + 'B'
2937
- }
2938
- return ret
2939
- }
2940
- ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'
2941
- ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'
2942
- ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'
2943
- ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'
2944
- ansiEscapes.cursorLeft = ESC + 'G'
2945
- ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'
2946
- ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'
2947
- ansiEscapes.cursorGetPosition = ESC + '6n'
2948
- ansiEscapes.cursorNextLine = ESC + 'E'
2949
- ansiEscapes.cursorPrevLine = ESC + 'F'
2950
- ansiEscapes.cursorHide = ESC + '?25l'
2951
- ansiEscapes.cursorShow = ESC + '?25h'
2952
- ansiEscapes.eraseLines = count => {
2953
- let clear = ''
2954
- for (let i = 0; i < count; i++) {
2955
- clear +=
2956
- ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '')
2957
- }
2958
- if (count) {
2959
- clear += ansiEscapes.cursorLeft
2960
- }
2961
- return clear
2962
- }
2963
- ansiEscapes.eraseEndLine = ESC + 'K'
2964
- ansiEscapes.eraseStartLine = ESC + '1K'
2965
- ansiEscapes.eraseLine = ESC + '2K'
2966
- ansiEscapes.eraseDown = ESC + 'J'
2967
- ansiEscapes.eraseUp = ESC + '1J'
2968
- ansiEscapes.eraseScreen = ESC + '2J'
2969
- ansiEscapes.scrollUp = ESC + 'S'
2970
- ansiEscapes.scrollDown = ESC + 'T'
2971
- ansiEscapes.clearScreen = '\u001Bc'
2972
- ansiEscapes.clearTerminal =
2973
- process.platform === 'win32'
2974
- ? `${ansiEscapes.eraseScreen}${ESC}0f`
2975
- : // 1. Erases the screen (Only done in case `2` is not supported)
2976
- // 2. Erases the whole screen including scrollback buffer
2977
- // 3. Moves cursor to the top-left position
2978
- // More info: https://www.real-world-systems.com/docs/ANSIcode.html
2979
- `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
2980
- ansiEscapes.beep = BEL
2981
- ansiEscapes.link = (text, url) => {
2982
- return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join(
2983
- ''
2984
- )
2985
- }
2986
- ansiEscapes.image = (buffer, options = {}) => {
2987
- let ret = `${OSC}1337;File=inline=1`
2988
- if (options.width) {
2989
- ret += `;width=${options.width}`
2990
- }
2991
- if (options.height) {
2992
- ret += `;height=${options.height}`
2993
- }
2994
- if (options.preserveAspectRatio === false) {
2995
- ret += ';preserveAspectRatio=0'
2996
- }
2997
- return ret + ':' + buffer.toString('base64') + BEL
2998
- }
2999
- ansiEscapes.iTerm = {
3000
- setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
3001
- annotation: (message, options = {}) => {
3002
- let ret = `${OSC}1337;`
3003
- const hasX = typeof options.x !== 'undefined'
3004
- const hasY = typeof options.y !== 'undefined'
3005
- if (
3006
- (hasX || hasY) &&
3007
- !(hasX && hasY && typeof options.length !== 'undefined')
3008
- ) {
3009
- throw new Error(
3010
- '`x`, `y` and `length` must be defined when `x` or `y` is defined'
3011
- )
3012
- }
3013
- message = message.replace(/\|/g, '')
3014
- ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='
3015
- if (options.length > 0) {
3016
- ret += (
3017
- hasX
3018
- ? [message, options.length, options.x, options.y]
3019
- : [options.length, message]
3020
- ).join('|')
3021
- } else {
3022
- ret += message
3023
- }
3024
- return ret + BEL
3025
- }
3026
- }
3027
- })(ansiEscapes)
3028
- return ansiEscapes.exports
2858
+ const ESC = '\u001B['
2859
+ /** Move cursor to first column */
2860
+ const cursorLeft = ESC + 'G'
2861
+ /** Show the cursor */
2862
+ const cursorShow = ESC + '?25h'
2863
+ /** Move cursor up by count rows */
2864
+ const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '')
2865
+ /** Move cursor down by count rows */
2866
+ const cursorDown = (rows = 1) => (rows > 0 ? `${ESC}${rows}B` : '')
2867
+ /** Move cursor to position (x, y) */
2868
+ const cursorTo = (x, y) => {
2869
+ return `${ESC}${x + 1}G`
3029
2870
  }
3030
-
3031
- const ansiEscapesExports = requireAnsiEscapes()
2871
+ const eraseLine = ESC + '2K'
2872
+ /** Erase the specified number of lines above the cursor */
2873
+ const eraseLines = lines =>
2874
+ lines > 0
2875
+ ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft
2876
+ : ''
3032
2877
 
3033
2878
  const height = content => content.split('\n').length
3034
2879
  const lastLine = content => content.split('\n').pop() ?? ''
3035
- function cursorDown(n) {
3036
- return n > 0 ? ansiEscapesExports.cursorDown(n) : ''
3037
- }
3038
2880
  class ScreenManager {
3039
2881
  // These variables are keeping information to allow correct prompt re-rendering
3040
2882
  height = 0
@@ -3085,17 +2927,15 @@ class ScreenManager {
3085
2927
  promptLineUpDiff + (bottomContent ? height(bottomContent) : 0)
3086
2928
  // Return cursor to the input position (on top of the bottomContent)
3087
2929
  if (bottomContentHeight > 0) {
3088
- output += ansiEscapesExports.cursorUp(bottomContentHeight)
2930
+ output += cursorUp(bottomContentHeight)
3089
2931
  }
3090
2932
  // Return cursor to the initial left offset.
3091
- output += ansiEscapesExports.cursorTo(this.cursorPos.cols)
2933
+ output += cursorTo(this.cursorPos.cols)
3092
2934
  /**
3093
2935
  * Render and store state for future re-rendering
3094
2936
  */
3095
2937
  this.write(
3096
- cursorDown(this.extraLinesUnderPrompt) +
3097
- ansiEscapesExports.eraseLines(this.height) +
3098
- output
2938
+ cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output
3099
2939
  )
3100
2940
  this.extraLinesUnderPrompt = bottomContentHeight
3101
2941
  this.height = height(output)
@@ -3103,15 +2943,15 @@ class ScreenManager {
3103
2943
  checkCursorPos() {
3104
2944
  const cursorPos = this.rl.getCursorPos()
3105
2945
  if (cursorPos.cols !== this.cursorPos.cols) {
3106
- this.write(ansiEscapesExports.cursorTo(cursorPos.cols))
2946
+ this.write(cursorTo(cursorPos.cols))
3107
2947
  this.cursorPos = cursorPos
3108
2948
  }
3109
2949
  }
3110
2950
  done({ clearContent }) {
3111
2951
  this.rl.setPrompt('')
3112
2952
  let output = cursorDown(this.extraLinesUnderPrompt)
3113
- output += clearContent ? ansiEscapesExports.eraseLines(this.height) : '\n'
3114
- output += ansiEscapesExports.cursorShow
2953
+ output += clearContent ? eraseLines(this.height) : '\n'
2954
+ output += cursorShow
3115
2955
  this.write(output)
3116
2956
  this.rl.close()
3117
2957
  }