@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.
- package/CHANGELOG.md +19 -0
- package/dist/cli.js +114 -32
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +35 -37
- package/dist/constants.js.map +1 -1
- package/dist/shadow-npm-bin.js +6 -6
- package/dist/shadow-npm-bin.js.map +1 -1
- package/dist/shadow-pnpm-bin.js +3 -5
- package/dist/shadow-pnpm-bin.js.map +1 -1
- package/dist/shadow-yarn-bin.js +2 -2
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/env-helpers.d.mts +13 -0
- package/dist/types/commands/fix/env-helpers.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/optimize/apply-optimization.d.mts.map +1 -1
- package/dist/types/commands/optimize/update-lockfile.d.mts.map +1 -1
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
- package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
- package/dist/types/constants.d.mts +15 -19
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
- package/dist/types/utils/agent.d.mts.map +1 -1
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/types/utils/path-resolve.d.mts.map +1 -1
- package/dist/utils.js +70 -29
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +514 -517
- package/external/@socketsecurity/registry/external/@inquirer/confirm.js +45 -205
- package/external/@socketsecurity/registry/external/@inquirer/input.js +45 -205
- package/external/@socketsecurity/registry/external/@inquirer/password.js +181 -205
- package/external/@socketsecurity/registry/external/@inquirer/search.js +47 -207
- package/external/@socketsecurity/registry/external/@inquirer/select.js +183 -207
- package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +388 -2280
- package/external/@socketsecurity/registry/external/browserslist.js +11534 -567
- package/external/@socketsecurity/registry/external/cacache.js +2575 -4914
- package/external/@socketsecurity/registry/external/libnpmpack.js +64667 -166061
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +384 -4044
- package/external/@socketsecurity/registry/external/normalize-package-data.js +30 -278
- package/external/@socketsecurity/registry/external/npm-package-arg.js +28 -9
- package/external/@socketsecurity/registry/external/pacote.js +46680 -66482
- package/external/@socketsecurity/registry/external/spdx-correct.js +19 -0
- package/external/@socketsecurity/registry/external/spdx-expression-parse.js +19 -0
- package/external/@socketsecurity/registry/lib/agent.js +390 -0
- package/external/@socketsecurity/registry/lib/arrays.js +31 -0
- package/external/@socketsecurity/registry/lib/bin.js +650 -0
- package/external/@socketsecurity/registry/lib/constants/bun-lock.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/bun.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/empty-value.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/env.js +17 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/ext-yml.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/index.js +20 -11
- package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +2 -2
- package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +1 -1
- package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +5 -0
- package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/unknown-error.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/unknown-value.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/vlt.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +3 -0
- package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +5 -0
- package/external/@socketsecurity/registry/lib/constants/yarn.js +3 -0
- package/external/@socketsecurity/registry/lib/debug.js +53 -0
- package/external/@socketsecurity/registry/lib/env.js +18 -0
- package/external/@socketsecurity/registry/lib/fs.js +218 -2
- package/external/@socketsecurity/registry/lib/functions.js +5 -0
- package/external/@socketsecurity/registry/lib/globs.js +22 -1
- package/external/@socketsecurity/registry/lib/json.js +16 -0
- package/external/@socketsecurity/registry/lib/logger.js +157 -0
- package/external/@socketsecurity/registry/lib/objects.js +103 -0
- package/external/@socketsecurity/registry/lib/packages.js +88 -0
- package/external/@socketsecurity/registry/lib/path.js +51 -1
- package/external/@socketsecurity/registry/lib/promises.js +55 -0
- package/external/@socketsecurity/registry/lib/regexps.js +5 -0
- package/external/@socketsecurity/registry/lib/sorts.js +17 -0
- package/external/@socketsecurity/registry/lib/spawn.js +105 -7
- package/external/@socketsecurity/registry/lib/streams.js +26 -0
- package/external/@socketsecurity/registry/lib/strings.js +123 -9
- package/external/@socketsecurity/registry/lib/url.js +21 -0
- package/external/@socketsecurity/registry/lib/words.js +16 -0
- package/external/@socketsecurity/registry/manifest.json +5 -4
- package/package.json +5 -4
- package/external/@socketsecurity/registry/external/ansi-regex.js +0 -13
- package/external/@socketsecurity/registry/lib/constants/node-workspaces.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/parse-args-config.js +0 -14
- package/external/@socketsecurity/registry/lib/constants/skip-tests-by-ecosystem.js +0 -43
- package/external/@socketsecurity/registry/lib/constants/template-cjs-browser.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-cjs-esm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-cjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-es-shim-constructor.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-es-shim-prototype-method.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/template-es-shim-static-method.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/win32-ensure-tests-by-ecosystem.js +0 -3
- package/external/@socketsecurity/registry/lib/npm.js +0 -404
- /package/external/@socketsecurity/registry/lib/constants/{hidden-package-lock-json.js → dot-package-lock-json.js} +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true })
|
|
4
4
|
|
|
5
|
-
const require$$0
|
|
5
|
+
const require$$0 = require('tty')
|
|
6
6
|
const process$2 = require('process')
|
|
7
7
|
const readline$1 = require('readline')
|
|
8
8
|
const async_hooks = require('async_hooks')
|
|
9
|
-
const require$$0$
|
|
9
|
+
const require$$0$2 = require('stream')
|
|
10
10
|
const util = require('util')
|
|
11
|
-
const require$$0$
|
|
11
|
+
const require$$0$1 = require('tty')
|
|
12
12
|
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
14
14
|
const n = Object.create(null)
|
|
@@ -212,45 +212,6 @@ function useEffect(cb, depArray) {
|
|
|
212
212
|
})
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
function getAugmentedNamespace(n) {
|
|
216
|
-
if (Object.prototype.hasOwnProperty.call(n, '__esModule')) {
|
|
217
|
-
return n
|
|
218
|
-
}
|
|
219
|
-
const f = n.default
|
|
220
|
-
if (typeof f == 'function') {
|
|
221
|
-
var a = function a() {
|
|
222
|
-
let isInstance = false
|
|
223
|
-
try {
|
|
224
|
-
isInstance = this instanceof a
|
|
225
|
-
} catch {}
|
|
226
|
-
if (isInstance) {
|
|
227
|
-
return Reflect.construct(f, arguments, this.constructor)
|
|
228
|
-
}
|
|
229
|
-
return f.apply(this, arguments)
|
|
230
|
-
}
|
|
231
|
-
a.prototype = f.prototype
|
|
232
|
-
} else {
|
|
233
|
-
a = {}
|
|
234
|
-
}
|
|
235
|
-
Object.defineProperty(a, '__esModule', { value: true })
|
|
236
|
-
Object.keys(n).forEach(function (k) {
|
|
237
|
-
const d = Object.getOwnPropertyDescriptor(n, k)
|
|
238
|
-
Object.defineProperty(
|
|
239
|
-
a,
|
|
240
|
-
k,
|
|
241
|
-
d.get
|
|
242
|
-
? d
|
|
243
|
-
: {
|
|
244
|
-
enumerable: true,
|
|
245
|
-
get: function () {
|
|
246
|
-
return n[k]
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
)
|
|
250
|
-
})
|
|
251
|
-
return a
|
|
252
|
-
}
|
|
253
|
-
|
|
254
215
|
let yoctocolorsCjs
|
|
255
216
|
let hasRequiredYoctocolorsCjs
|
|
256
217
|
function requireYoctocolorsCjs() {
|
|
@@ -258,7 +219,7 @@ function requireYoctocolorsCjs() {
|
|
|
258
219
|
return yoctocolorsCjs
|
|
259
220
|
}
|
|
260
221
|
hasRequiredYoctocolorsCjs = 1
|
|
261
|
-
const tty = require$$0
|
|
222
|
+
const tty = require$$0 // eslint-disable-line unicorn/prefer-module
|
|
262
223
|
|
|
263
224
|
// eslint-disable-next-line no-warning-comments
|
|
264
225
|
// TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
|
|
@@ -791,7 +752,7 @@ function requireCliWidth() {
|
|
|
791
752
|
const defaultOpts = {
|
|
792
753
|
defaultWidth: 0,
|
|
793
754
|
output: process.stdout,
|
|
794
|
-
tty: require$$0$
|
|
755
|
+
tty: require$$0$1
|
|
795
756
|
}
|
|
796
757
|
if (!options) {
|
|
797
758
|
return defaultOpts
|
|
@@ -829,23 +790,23 @@ const cliWidthExports = requireCliWidth()
|
|
|
829
790
|
|
|
830
791
|
const stringWidth = { exports: {} }
|
|
831
792
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
793
|
+
let ansiRegex
|
|
794
|
+
let hasRequiredAnsiRegex
|
|
795
|
+
function requireAnsiRegex() {
|
|
796
|
+
if (hasRequiredAnsiRegex) {
|
|
797
|
+
return ansiRegex
|
|
798
|
+
}
|
|
799
|
+
hasRequiredAnsiRegex = 1
|
|
800
|
+
ansiRegex = ({ onlyFirst = false } = {}) => {
|
|
801
|
+
const pattern = [
|
|
802
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
803
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
|
804
|
+
].join('|')
|
|
805
|
+
return new RegExp(pattern, onlyFirst ? undefined : 'g')
|
|
806
|
+
}
|
|
807
|
+
return ansiRegex
|
|
840
808
|
}
|
|
841
809
|
|
|
842
|
-
const ansiRegex$1 = /*#__PURE__*/ Object.freeze({
|
|
843
|
-
__proto__: null,
|
|
844
|
-
default: ansiRegex
|
|
845
|
-
})
|
|
846
|
-
|
|
847
|
-
const require$$0 = /*@__PURE__*/ getAugmentedNamespace(ansiRegex$1)
|
|
848
|
-
|
|
849
810
|
let stripAnsi
|
|
850
811
|
let hasRequiredStripAnsi
|
|
851
812
|
function requireStripAnsi() {
|
|
@@ -853,7 +814,7 @@ function requireStripAnsi() {
|
|
|
853
814
|
return stripAnsi
|
|
854
815
|
}
|
|
855
816
|
hasRequiredStripAnsi = 1
|
|
856
|
-
const ansiRegex =
|
|
817
|
+
const ansiRegex = requireAnsiRegex()
|
|
857
818
|
stripAnsi = string =>
|
|
858
819
|
typeof string === 'string' ? string.replace(ansiRegex(), '') : string
|
|
859
820
|
return stripAnsi
|
|
@@ -2632,7 +2593,7 @@ function requireLib() {
|
|
|
2632
2593
|
return lib
|
|
2633
2594
|
}
|
|
2634
2595
|
hasRequiredLib = 1
|
|
2635
|
-
const Stream = require$$0$
|
|
2596
|
+
const Stream = require$$0$2
|
|
2636
2597
|
class MuteStream extends Stream {
|
|
2637
2598
|
#isTTY = null
|
|
2638
2599
|
constructor(opts = {}) {
|
|
@@ -3077,147 +3038,28 @@ const {
|
|
|
3077
3038
|
processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback()
|
|
3078
3039
|
)
|
|
3079
3040
|
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
throw new TypeError('The `x` argument is required')
|
|
3100
|
-
}
|
|
3101
|
-
if (typeof y !== 'number') {
|
|
3102
|
-
return ESC + (x + 1) + 'G'
|
|
3103
|
-
}
|
|
3104
|
-
return ESC + (y + 1) + ';' + (x + 1) + 'H'
|
|
3105
|
-
}
|
|
3106
|
-
ansiEscapes.cursorMove = (x, y) => {
|
|
3107
|
-
if (typeof x !== 'number') {
|
|
3108
|
-
throw new TypeError('The `x` argument is required')
|
|
3109
|
-
}
|
|
3110
|
-
let ret = ''
|
|
3111
|
-
if (x < 0) {
|
|
3112
|
-
ret += ESC + -x + 'D'
|
|
3113
|
-
} else if (x > 0) {
|
|
3114
|
-
ret += ESC + x + 'C'
|
|
3115
|
-
}
|
|
3116
|
-
if (y < 0) {
|
|
3117
|
-
ret += ESC + -y + 'A'
|
|
3118
|
-
} else if (y > 0) {
|
|
3119
|
-
ret += ESC + y + 'B'
|
|
3120
|
-
}
|
|
3121
|
-
return ret
|
|
3122
|
-
}
|
|
3123
|
-
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'
|
|
3124
|
-
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'
|
|
3125
|
-
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'
|
|
3126
|
-
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'
|
|
3127
|
-
ansiEscapes.cursorLeft = ESC + 'G'
|
|
3128
|
-
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'
|
|
3129
|
-
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'
|
|
3130
|
-
ansiEscapes.cursorGetPosition = ESC + '6n'
|
|
3131
|
-
ansiEscapes.cursorNextLine = ESC + 'E'
|
|
3132
|
-
ansiEscapes.cursorPrevLine = ESC + 'F'
|
|
3133
|
-
ansiEscapes.cursorHide = ESC + '?25l'
|
|
3134
|
-
ansiEscapes.cursorShow = ESC + '?25h'
|
|
3135
|
-
ansiEscapes.eraseLines = count => {
|
|
3136
|
-
let clear = ''
|
|
3137
|
-
for (let i = 0; i < count; i++) {
|
|
3138
|
-
clear +=
|
|
3139
|
-
ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '')
|
|
3140
|
-
}
|
|
3141
|
-
if (count) {
|
|
3142
|
-
clear += ansiEscapes.cursorLeft
|
|
3143
|
-
}
|
|
3144
|
-
return clear
|
|
3145
|
-
}
|
|
3146
|
-
ansiEscapes.eraseEndLine = ESC + 'K'
|
|
3147
|
-
ansiEscapes.eraseStartLine = ESC + '1K'
|
|
3148
|
-
ansiEscapes.eraseLine = ESC + '2K'
|
|
3149
|
-
ansiEscapes.eraseDown = ESC + 'J'
|
|
3150
|
-
ansiEscapes.eraseUp = ESC + '1J'
|
|
3151
|
-
ansiEscapes.eraseScreen = ESC + '2J'
|
|
3152
|
-
ansiEscapes.scrollUp = ESC + 'S'
|
|
3153
|
-
ansiEscapes.scrollDown = ESC + 'T'
|
|
3154
|
-
ansiEscapes.clearScreen = '\u001Bc'
|
|
3155
|
-
ansiEscapes.clearTerminal =
|
|
3156
|
-
process.platform === 'win32'
|
|
3157
|
-
? `${ansiEscapes.eraseScreen}${ESC}0f`
|
|
3158
|
-
: // 1. Erases the screen (Only done in case `2` is not supported)
|
|
3159
|
-
// 2. Erases the whole screen including scrollback buffer
|
|
3160
|
-
// 3. Moves cursor to the top-left position
|
|
3161
|
-
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
3162
|
-
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
|
|
3163
|
-
ansiEscapes.beep = BEL
|
|
3164
|
-
ansiEscapes.link = (text, url) => {
|
|
3165
|
-
return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join(
|
|
3166
|
-
''
|
|
3167
|
-
)
|
|
3168
|
-
}
|
|
3169
|
-
ansiEscapes.image = (buffer, options = {}) => {
|
|
3170
|
-
let ret = `${OSC}1337;File=inline=1`
|
|
3171
|
-
if (options.width) {
|
|
3172
|
-
ret += `;width=${options.width}`
|
|
3173
|
-
}
|
|
3174
|
-
if (options.height) {
|
|
3175
|
-
ret += `;height=${options.height}`
|
|
3176
|
-
}
|
|
3177
|
-
if (options.preserveAspectRatio === false) {
|
|
3178
|
-
ret += ';preserveAspectRatio=0'
|
|
3179
|
-
}
|
|
3180
|
-
return ret + ':' + buffer.toString('base64') + BEL
|
|
3181
|
-
}
|
|
3182
|
-
ansiEscapes.iTerm = {
|
|
3183
|
-
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
3184
|
-
annotation: (message, options = {}) => {
|
|
3185
|
-
let ret = `${OSC}1337;`
|
|
3186
|
-
const hasX = typeof options.x !== 'undefined'
|
|
3187
|
-
const hasY = typeof options.y !== 'undefined'
|
|
3188
|
-
if (
|
|
3189
|
-
(hasX || hasY) &&
|
|
3190
|
-
!(hasX && hasY && typeof options.length !== 'undefined')
|
|
3191
|
-
) {
|
|
3192
|
-
throw new Error(
|
|
3193
|
-
'`x`, `y` and `length` must be defined when `x` or `y` is defined'
|
|
3194
|
-
)
|
|
3195
|
-
}
|
|
3196
|
-
message = message.replace(/\|/g, '')
|
|
3197
|
-
ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='
|
|
3198
|
-
if (options.length > 0) {
|
|
3199
|
-
ret += (
|
|
3200
|
-
hasX
|
|
3201
|
-
? [message, options.length, options.x, options.y]
|
|
3202
|
-
: [options.length, message]
|
|
3203
|
-
).join('|')
|
|
3204
|
-
} else {
|
|
3205
|
-
ret += message
|
|
3206
|
-
}
|
|
3207
|
-
return ret + BEL
|
|
3208
|
-
}
|
|
3209
|
-
}
|
|
3210
|
-
})(ansiEscapes)
|
|
3211
|
-
return ansiEscapes.exports
|
|
3212
|
-
}
|
|
3213
|
-
|
|
3214
|
-
const ansiEscapesExports = requireAnsiEscapes()
|
|
3041
|
+
const ESC = '\u001B['
|
|
3042
|
+
/** Move cursor to first column */
|
|
3043
|
+
const cursorLeft = ESC + 'G'
|
|
3044
|
+
/** Show the cursor */
|
|
3045
|
+
const cursorShow = ESC + '?25h'
|
|
3046
|
+
/** Move cursor up by count rows */
|
|
3047
|
+
const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '')
|
|
3048
|
+
/** Move cursor down by count rows */
|
|
3049
|
+
const cursorDown = (rows = 1) => (rows > 0 ? `${ESC}${rows}B` : '')
|
|
3050
|
+
/** Move cursor to position (x, y) */
|
|
3051
|
+
const cursorTo = (x, y) => {
|
|
3052
|
+
return `${ESC}${x + 1}G`
|
|
3053
|
+
}
|
|
3054
|
+
const eraseLine = ESC + '2K'
|
|
3055
|
+
/** Erase the specified number of lines above the cursor */
|
|
3056
|
+
const eraseLines = lines =>
|
|
3057
|
+
lines > 0
|
|
3058
|
+
? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft
|
|
3059
|
+
: ''
|
|
3215
3060
|
|
|
3216
3061
|
const height = content => content.split('\n').length
|
|
3217
3062
|
const lastLine = content => content.split('\n').pop() ?? ''
|
|
3218
|
-
function cursorDown(n) {
|
|
3219
|
-
return n > 0 ? ansiEscapesExports.cursorDown(n) : ''
|
|
3220
|
-
}
|
|
3221
3063
|
class ScreenManager {
|
|
3222
3064
|
// These variables are keeping information to allow correct prompt re-rendering
|
|
3223
3065
|
height = 0
|
|
@@ -3268,17 +3110,15 @@ class ScreenManager {
|
|
|
3268
3110
|
promptLineUpDiff + (bottomContent ? height(bottomContent) : 0)
|
|
3269
3111
|
// Return cursor to the input position (on top of the bottomContent)
|
|
3270
3112
|
if (bottomContentHeight > 0) {
|
|
3271
|
-
output +=
|
|
3113
|
+
output += cursorUp(bottomContentHeight)
|
|
3272
3114
|
}
|
|
3273
3115
|
// Return cursor to the initial left offset.
|
|
3274
|
-
output +=
|
|
3116
|
+
output += cursorTo(this.cursorPos.cols)
|
|
3275
3117
|
/**
|
|
3276
3118
|
* Render and store state for future re-rendering
|
|
3277
3119
|
*/
|
|
3278
3120
|
this.write(
|
|
3279
|
-
cursorDown(this.extraLinesUnderPrompt) +
|
|
3280
|
-
ansiEscapesExports.eraseLines(this.height) +
|
|
3281
|
-
output
|
|
3121
|
+
cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output
|
|
3282
3122
|
)
|
|
3283
3123
|
this.extraLinesUnderPrompt = bottomContentHeight
|
|
3284
3124
|
this.height = height(output)
|
|
@@ -3286,15 +3126,15 @@ class ScreenManager {
|
|
|
3286
3126
|
checkCursorPos() {
|
|
3287
3127
|
const cursorPos = this.rl.getCursorPos()
|
|
3288
3128
|
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
3289
|
-
this.write(
|
|
3129
|
+
this.write(cursorTo(cursorPos.cols))
|
|
3290
3130
|
this.cursorPos = cursorPos
|
|
3291
3131
|
}
|
|
3292
3132
|
}
|
|
3293
3133
|
done({ clearContent }) {
|
|
3294
3134
|
this.rl.setPrompt('')
|
|
3295
3135
|
let output = cursorDown(this.extraLinesUnderPrompt)
|
|
3296
|
-
output += clearContent ?
|
|
3297
|
-
output +=
|
|
3136
|
+
output += clearContent ? eraseLines(this.height) : '\n'
|
|
3137
|
+
output += cursorShow
|
|
3298
3138
|
this.write(output)
|
|
3299
3139
|
this.rl.close()
|
|
3300
3140
|
}
|