@socketsecurity/cli-with-sentry 1.1.15 → 1.1.18
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 +15 -0
- package/dist/cli.js +14 -15
- 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/coana-fix.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/patch/cmd-patch.d.mts.map +1 -1
- package/dist/types/commands/patch/handle-patch.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/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 +65 -27
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +522 -524
- 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 +6 -5
- 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)
|
|
@@ -213,45 +213,6 @@ function useEffect(cb, depArray) {
|
|
|
213
213
|
})
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
function getAugmentedNamespace(n) {
|
|
217
|
-
if (Object.prototype.hasOwnProperty.call(n, '__esModule')) {
|
|
218
|
-
return n
|
|
219
|
-
}
|
|
220
|
-
const f = n.default
|
|
221
|
-
if (typeof f == 'function') {
|
|
222
|
-
var a = function a() {
|
|
223
|
-
let isInstance = false
|
|
224
|
-
try {
|
|
225
|
-
isInstance = this instanceof a
|
|
226
|
-
} catch {}
|
|
227
|
-
if (isInstance) {
|
|
228
|
-
return Reflect.construct(f, arguments, this.constructor)
|
|
229
|
-
}
|
|
230
|
-
return f.apply(this, arguments)
|
|
231
|
-
}
|
|
232
|
-
a.prototype = f.prototype
|
|
233
|
-
} else {
|
|
234
|
-
a = {}
|
|
235
|
-
}
|
|
236
|
-
Object.defineProperty(a, '__esModule', { value: true })
|
|
237
|
-
Object.keys(n).forEach(function (k) {
|
|
238
|
-
const d = Object.getOwnPropertyDescriptor(n, k)
|
|
239
|
-
Object.defineProperty(
|
|
240
|
-
a,
|
|
241
|
-
k,
|
|
242
|
-
d.get
|
|
243
|
-
? d
|
|
244
|
-
: {
|
|
245
|
-
enumerable: true,
|
|
246
|
-
get: function () {
|
|
247
|
-
return n[k]
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
})
|
|
252
|
-
return a
|
|
253
|
-
}
|
|
254
|
-
|
|
255
216
|
let yoctocolorsCjs
|
|
256
217
|
let hasRequiredYoctocolorsCjs
|
|
257
218
|
function requireYoctocolorsCjs() {
|
|
@@ -259,7 +220,7 @@ function requireYoctocolorsCjs() {
|
|
|
259
220
|
return yoctocolorsCjs
|
|
260
221
|
}
|
|
261
222
|
hasRequiredYoctocolorsCjs = 1
|
|
262
|
-
const tty = require$$0
|
|
223
|
+
const tty = require$$0 // eslint-disable-line unicorn/prefer-module
|
|
263
224
|
|
|
264
225
|
// eslint-disable-next-line no-warning-comments
|
|
265
226
|
// TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
|
|
@@ -792,7 +753,7 @@ function requireCliWidth() {
|
|
|
792
753
|
const defaultOpts = {
|
|
793
754
|
defaultWidth: 0,
|
|
794
755
|
output: process.stdout,
|
|
795
|
-
tty: require$$0$
|
|
756
|
+
tty: require$$0$1
|
|
796
757
|
}
|
|
797
758
|
if (!options) {
|
|
798
759
|
return defaultOpts
|
|
@@ -830,23 +791,23 @@ const cliWidthExports = requireCliWidth()
|
|
|
830
791
|
|
|
831
792
|
const stringWidth = { exports: {} }
|
|
832
793
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
794
|
+
let ansiRegex
|
|
795
|
+
let hasRequiredAnsiRegex
|
|
796
|
+
function requireAnsiRegex() {
|
|
797
|
+
if (hasRequiredAnsiRegex) {
|
|
798
|
+
return ansiRegex
|
|
799
|
+
}
|
|
800
|
+
hasRequiredAnsiRegex = 1
|
|
801
|
+
ansiRegex = ({ onlyFirst = false } = {}) => {
|
|
802
|
+
const pattern = [
|
|
803
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
804
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
|
805
|
+
].join('|')
|
|
806
|
+
return new RegExp(pattern, onlyFirst ? undefined : 'g')
|
|
807
|
+
}
|
|
808
|
+
return ansiRegex
|
|
841
809
|
}
|
|
842
810
|
|
|
843
|
-
const ansiRegex$1 = /*#__PURE__*/ Object.freeze({
|
|
844
|
-
__proto__: null,
|
|
845
|
-
default: ansiRegex
|
|
846
|
-
})
|
|
847
|
-
|
|
848
|
-
const require$$0 = /*@__PURE__*/ getAugmentedNamespace(ansiRegex$1)
|
|
849
|
-
|
|
850
811
|
let stripAnsi
|
|
851
812
|
let hasRequiredStripAnsi
|
|
852
813
|
function requireStripAnsi() {
|
|
@@ -854,7 +815,7 @@ function requireStripAnsi() {
|
|
|
854
815
|
return stripAnsi
|
|
855
816
|
}
|
|
856
817
|
hasRequiredStripAnsi = 1
|
|
857
|
-
const ansiRegex =
|
|
818
|
+
const ansiRegex = requireAnsiRegex()
|
|
858
819
|
stripAnsi = string =>
|
|
859
820
|
typeof string === 'string' ? string.replace(ansiRegex(), '') : string
|
|
860
821
|
return stripAnsi
|
|
@@ -2633,7 +2594,7 @@ function requireLib() {
|
|
|
2633
2594
|
return lib
|
|
2634
2595
|
}
|
|
2635
2596
|
hasRequiredLib = 1
|
|
2636
|
-
const Stream = require$$0$
|
|
2597
|
+
const Stream = require$$0$2
|
|
2637
2598
|
class MuteStream extends Stream {
|
|
2638
2599
|
#isTTY = null
|
|
2639
2600
|
constructor(opts = {}) {
|
|
@@ -3078,147 +3039,28 @@ const {
|
|
|
3078
3039
|
processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback()
|
|
3079
3040
|
)
|
|
3080
3041
|
|
|
3081
|
-
const
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
throw new TypeError('The `x` argument is required')
|
|
3101
|
-
}
|
|
3102
|
-
if (typeof y !== 'number') {
|
|
3103
|
-
return ESC + (x + 1) + 'G'
|
|
3104
|
-
}
|
|
3105
|
-
return ESC + (y + 1) + ';' + (x + 1) + 'H'
|
|
3106
|
-
}
|
|
3107
|
-
ansiEscapes.cursorMove = (x, y) => {
|
|
3108
|
-
if (typeof x !== 'number') {
|
|
3109
|
-
throw new TypeError('The `x` argument is required')
|
|
3110
|
-
}
|
|
3111
|
-
let ret = ''
|
|
3112
|
-
if (x < 0) {
|
|
3113
|
-
ret += ESC + -x + 'D'
|
|
3114
|
-
} else if (x > 0) {
|
|
3115
|
-
ret += ESC + x + 'C'
|
|
3116
|
-
}
|
|
3117
|
-
if (y < 0) {
|
|
3118
|
-
ret += ESC + -y + 'A'
|
|
3119
|
-
} else if (y > 0) {
|
|
3120
|
-
ret += ESC + y + 'B'
|
|
3121
|
-
}
|
|
3122
|
-
return ret
|
|
3123
|
-
}
|
|
3124
|
-
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'
|
|
3125
|
-
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'
|
|
3126
|
-
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'
|
|
3127
|
-
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'
|
|
3128
|
-
ansiEscapes.cursorLeft = ESC + 'G'
|
|
3129
|
-
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'
|
|
3130
|
-
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'
|
|
3131
|
-
ansiEscapes.cursorGetPosition = ESC + '6n'
|
|
3132
|
-
ansiEscapes.cursorNextLine = ESC + 'E'
|
|
3133
|
-
ansiEscapes.cursorPrevLine = ESC + 'F'
|
|
3134
|
-
ansiEscapes.cursorHide = ESC + '?25l'
|
|
3135
|
-
ansiEscapes.cursorShow = ESC + '?25h'
|
|
3136
|
-
ansiEscapes.eraseLines = count => {
|
|
3137
|
-
let clear = ''
|
|
3138
|
-
for (let i = 0; i < count; i++) {
|
|
3139
|
-
clear +=
|
|
3140
|
-
ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '')
|
|
3141
|
-
}
|
|
3142
|
-
if (count) {
|
|
3143
|
-
clear += ansiEscapes.cursorLeft
|
|
3144
|
-
}
|
|
3145
|
-
return clear
|
|
3146
|
-
}
|
|
3147
|
-
ansiEscapes.eraseEndLine = ESC + 'K'
|
|
3148
|
-
ansiEscapes.eraseStartLine = ESC + '1K'
|
|
3149
|
-
ansiEscapes.eraseLine = ESC + '2K'
|
|
3150
|
-
ansiEscapes.eraseDown = ESC + 'J'
|
|
3151
|
-
ansiEscapes.eraseUp = ESC + '1J'
|
|
3152
|
-
ansiEscapes.eraseScreen = ESC + '2J'
|
|
3153
|
-
ansiEscapes.scrollUp = ESC + 'S'
|
|
3154
|
-
ansiEscapes.scrollDown = ESC + 'T'
|
|
3155
|
-
ansiEscapes.clearScreen = '\u001Bc'
|
|
3156
|
-
ansiEscapes.clearTerminal =
|
|
3157
|
-
process.platform === 'win32'
|
|
3158
|
-
? `${ansiEscapes.eraseScreen}${ESC}0f`
|
|
3159
|
-
: // 1. Erases the screen (Only done in case `2` is not supported)
|
|
3160
|
-
// 2. Erases the whole screen including scrollback buffer
|
|
3161
|
-
// 3. Moves cursor to the top-left position
|
|
3162
|
-
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
3163
|
-
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
|
|
3164
|
-
ansiEscapes.beep = BEL
|
|
3165
|
-
ansiEscapes.link = (text, url) => {
|
|
3166
|
-
return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join(
|
|
3167
|
-
''
|
|
3168
|
-
)
|
|
3169
|
-
}
|
|
3170
|
-
ansiEscapes.image = (buffer, options = {}) => {
|
|
3171
|
-
let ret = `${OSC}1337;File=inline=1`
|
|
3172
|
-
if (options.width) {
|
|
3173
|
-
ret += `;width=${options.width}`
|
|
3174
|
-
}
|
|
3175
|
-
if (options.height) {
|
|
3176
|
-
ret += `;height=${options.height}`
|
|
3177
|
-
}
|
|
3178
|
-
if (options.preserveAspectRatio === false) {
|
|
3179
|
-
ret += ';preserveAspectRatio=0'
|
|
3180
|
-
}
|
|
3181
|
-
return ret + ':' + buffer.toString('base64') + BEL
|
|
3182
|
-
}
|
|
3183
|
-
ansiEscapes.iTerm = {
|
|
3184
|
-
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
3185
|
-
annotation: (message, options = {}) => {
|
|
3186
|
-
let ret = `${OSC}1337;`
|
|
3187
|
-
const hasX = typeof options.x !== 'undefined'
|
|
3188
|
-
const hasY = typeof options.y !== 'undefined'
|
|
3189
|
-
if (
|
|
3190
|
-
(hasX || hasY) &&
|
|
3191
|
-
!(hasX && hasY && typeof options.length !== 'undefined')
|
|
3192
|
-
) {
|
|
3193
|
-
throw new Error(
|
|
3194
|
-
'`x`, `y` and `length` must be defined when `x` or `y` is defined'
|
|
3195
|
-
)
|
|
3196
|
-
}
|
|
3197
|
-
message = message.replace(/\|/g, '')
|
|
3198
|
-
ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='
|
|
3199
|
-
if (options.length > 0) {
|
|
3200
|
-
ret += (
|
|
3201
|
-
hasX
|
|
3202
|
-
? [message, options.length, options.x, options.y]
|
|
3203
|
-
: [options.length, message]
|
|
3204
|
-
).join('|')
|
|
3205
|
-
} else {
|
|
3206
|
-
ret += message
|
|
3207
|
-
}
|
|
3208
|
-
return ret + BEL
|
|
3209
|
-
}
|
|
3210
|
-
}
|
|
3211
|
-
})(ansiEscapes)
|
|
3212
|
-
return ansiEscapes.exports
|
|
3213
|
-
}
|
|
3214
|
-
|
|
3215
|
-
const ansiEscapesExports = requireAnsiEscapes()
|
|
3042
|
+
const ESC = '\u001B['
|
|
3043
|
+
/** Move cursor to first column */
|
|
3044
|
+
const cursorLeft = ESC + 'G'
|
|
3045
|
+
/** Show the cursor */
|
|
3046
|
+
const cursorShow = ESC + '?25h'
|
|
3047
|
+
/** Move cursor up by count rows */
|
|
3048
|
+
const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : '')
|
|
3049
|
+
/** Move cursor down by count rows */
|
|
3050
|
+
const cursorDown = (rows = 1) => (rows > 0 ? `${ESC}${rows}B` : '')
|
|
3051
|
+
/** Move cursor to position (x, y) */
|
|
3052
|
+
const cursorTo = (x, y) => {
|
|
3053
|
+
return `${ESC}${x + 1}G`
|
|
3054
|
+
}
|
|
3055
|
+
const eraseLine = ESC + '2K'
|
|
3056
|
+
/** Erase the specified number of lines above the cursor */
|
|
3057
|
+
const eraseLines = lines =>
|
|
3058
|
+
lines > 0
|
|
3059
|
+
? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft
|
|
3060
|
+
: ''
|
|
3216
3061
|
|
|
3217
3062
|
const height = content => content.split('\n').length
|
|
3218
3063
|
const lastLine = content => content.split('\n').pop() ?? ''
|
|
3219
|
-
function cursorDown(n) {
|
|
3220
|
-
return n > 0 ? ansiEscapesExports.cursorDown(n) : ''
|
|
3221
|
-
}
|
|
3222
3064
|
class ScreenManager {
|
|
3223
3065
|
// These variables are keeping information to allow correct prompt re-rendering
|
|
3224
3066
|
height = 0
|
|
@@ -3269,17 +3111,15 @@ class ScreenManager {
|
|
|
3269
3111
|
promptLineUpDiff + (bottomContent ? height(bottomContent) : 0)
|
|
3270
3112
|
// Return cursor to the input position (on top of the bottomContent)
|
|
3271
3113
|
if (bottomContentHeight > 0) {
|
|
3272
|
-
output +=
|
|
3114
|
+
output += cursorUp(bottomContentHeight)
|
|
3273
3115
|
}
|
|
3274
3116
|
// Return cursor to the initial left offset.
|
|
3275
|
-
output +=
|
|
3117
|
+
output += cursorTo(this.cursorPos.cols)
|
|
3276
3118
|
/**
|
|
3277
3119
|
* Render and store state for future re-rendering
|
|
3278
3120
|
*/
|
|
3279
3121
|
this.write(
|
|
3280
|
-
cursorDown(this.extraLinesUnderPrompt) +
|
|
3281
|
-
ansiEscapesExports.eraseLines(this.height) +
|
|
3282
|
-
output
|
|
3122
|
+
cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output
|
|
3283
3123
|
)
|
|
3284
3124
|
this.extraLinesUnderPrompt = bottomContentHeight
|
|
3285
3125
|
this.height = height(output)
|
|
@@ -3287,15 +3127,15 @@ class ScreenManager {
|
|
|
3287
3127
|
checkCursorPos() {
|
|
3288
3128
|
const cursorPos = this.rl.getCursorPos()
|
|
3289
3129
|
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
3290
|
-
this.write(
|
|
3130
|
+
this.write(cursorTo(cursorPos.cols))
|
|
3291
3131
|
this.cursorPos = cursorPos
|
|
3292
3132
|
}
|
|
3293
3133
|
}
|
|
3294
3134
|
done({ clearContent }) {
|
|
3295
3135
|
this.rl.setPrompt('')
|
|
3296
3136
|
let output = cursorDown(this.extraLinesUnderPrompt)
|
|
3297
|
-
output += clearContent ?
|
|
3298
|
-
output +=
|
|
3137
|
+
output += clearContent ? eraseLines(this.height) : '\n'
|
|
3138
|
+
output += cursorShow
|
|
3299
3139
|
this.write(output)
|
|
3300
3140
|
this.rl.close()
|
|
3301
3141
|
}
|
|
@@ -3483,6 +3323,142 @@ class Separator {
|
|
|
3483
3323
|
}
|
|
3484
3324
|
}
|
|
3485
3325
|
|
|
3326
|
+
const ansiEscapes = { exports: {} }
|
|
3327
|
+
|
|
3328
|
+
let hasRequiredAnsiEscapes
|
|
3329
|
+
function requireAnsiEscapes() {
|
|
3330
|
+
if (hasRequiredAnsiEscapes) {
|
|
3331
|
+
return ansiEscapes.exports
|
|
3332
|
+
}
|
|
3333
|
+
hasRequiredAnsiEscapes = 1
|
|
3334
|
+
;(function (module) {
|
|
3335
|
+
const ansiEscapes = module.exports
|
|
3336
|
+
// TODO: remove this in the next major version
|
|
3337
|
+
module.exports.default = ansiEscapes
|
|
3338
|
+
const ESC = '\u001B['
|
|
3339
|
+
const OSC = '\u001B]'
|
|
3340
|
+
const BEL = '\u0007'
|
|
3341
|
+
const SEP = ';'
|
|
3342
|
+
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'
|
|
3343
|
+
ansiEscapes.cursorTo = (x, y) => {
|
|
3344
|
+
if (typeof x !== 'number') {
|
|
3345
|
+
throw new TypeError('The `x` argument is required')
|
|
3346
|
+
}
|
|
3347
|
+
if (typeof y !== 'number') {
|
|
3348
|
+
return ESC + (x + 1) + 'G'
|
|
3349
|
+
}
|
|
3350
|
+
return ESC + (y + 1) + ';' + (x + 1) + 'H'
|
|
3351
|
+
}
|
|
3352
|
+
ansiEscapes.cursorMove = (x, y) => {
|
|
3353
|
+
if (typeof x !== 'number') {
|
|
3354
|
+
throw new TypeError('The `x` argument is required')
|
|
3355
|
+
}
|
|
3356
|
+
let ret = ''
|
|
3357
|
+
if (x < 0) {
|
|
3358
|
+
ret += ESC + -x + 'D'
|
|
3359
|
+
} else if (x > 0) {
|
|
3360
|
+
ret += ESC + x + 'C'
|
|
3361
|
+
}
|
|
3362
|
+
if (y < 0) {
|
|
3363
|
+
ret += ESC + -y + 'A'
|
|
3364
|
+
} else if (y > 0) {
|
|
3365
|
+
ret += ESC + y + 'B'
|
|
3366
|
+
}
|
|
3367
|
+
return ret
|
|
3368
|
+
}
|
|
3369
|
+
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'
|
|
3370
|
+
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'
|
|
3371
|
+
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'
|
|
3372
|
+
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'
|
|
3373
|
+
ansiEscapes.cursorLeft = ESC + 'G'
|
|
3374
|
+
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'
|
|
3375
|
+
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'
|
|
3376
|
+
ansiEscapes.cursorGetPosition = ESC + '6n'
|
|
3377
|
+
ansiEscapes.cursorNextLine = ESC + 'E'
|
|
3378
|
+
ansiEscapes.cursorPrevLine = ESC + 'F'
|
|
3379
|
+
ansiEscapes.cursorHide = ESC + '?25l'
|
|
3380
|
+
ansiEscapes.cursorShow = ESC + '?25h'
|
|
3381
|
+
ansiEscapes.eraseLines = count => {
|
|
3382
|
+
let clear = ''
|
|
3383
|
+
for (let i = 0; i < count; i++) {
|
|
3384
|
+
clear +=
|
|
3385
|
+
ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '')
|
|
3386
|
+
}
|
|
3387
|
+
if (count) {
|
|
3388
|
+
clear += ansiEscapes.cursorLeft
|
|
3389
|
+
}
|
|
3390
|
+
return clear
|
|
3391
|
+
}
|
|
3392
|
+
ansiEscapes.eraseEndLine = ESC + 'K'
|
|
3393
|
+
ansiEscapes.eraseStartLine = ESC + '1K'
|
|
3394
|
+
ansiEscapes.eraseLine = ESC + '2K'
|
|
3395
|
+
ansiEscapes.eraseDown = ESC + 'J'
|
|
3396
|
+
ansiEscapes.eraseUp = ESC + '1J'
|
|
3397
|
+
ansiEscapes.eraseScreen = ESC + '2J'
|
|
3398
|
+
ansiEscapes.scrollUp = ESC + 'S'
|
|
3399
|
+
ansiEscapes.scrollDown = ESC + 'T'
|
|
3400
|
+
ansiEscapes.clearScreen = '\u001Bc'
|
|
3401
|
+
ansiEscapes.clearTerminal =
|
|
3402
|
+
process.platform === 'win32'
|
|
3403
|
+
? `${ansiEscapes.eraseScreen}${ESC}0f`
|
|
3404
|
+
: // 1. Erases the screen (Only done in case `2` is not supported)
|
|
3405
|
+
// 2. Erases the whole screen including scrollback buffer
|
|
3406
|
+
// 3. Moves cursor to the top-left position
|
|
3407
|
+
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
3408
|
+
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
|
|
3409
|
+
ansiEscapes.beep = BEL
|
|
3410
|
+
ansiEscapes.link = (text, url) => {
|
|
3411
|
+
return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join(
|
|
3412
|
+
''
|
|
3413
|
+
)
|
|
3414
|
+
}
|
|
3415
|
+
ansiEscapes.image = (buffer, options = {}) => {
|
|
3416
|
+
let ret = `${OSC}1337;File=inline=1`
|
|
3417
|
+
if (options.width) {
|
|
3418
|
+
ret += `;width=${options.width}`
|
|
3419
|
+
}
|
|
3420
|
+
if (options.height) {
|
|
3421
|
+
ret += `;height=${options.height}`
|
|
3422
|
+
}
|
|
3423
|
+
if (options.preserveAspectRatio === false) {
|
|
3424
|
+
ret += ';preserveAspectRatio=0'
|
|
3425
|
+
}
|
|
3426
|
+
return ret + ':' + buffer.toString('base64') + BEL
|
|
3427
|
+
}
|
|
3428
|
+
ansiEscapes.iTerm = {
|
|
3429
|
+
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
3430
|
+
annotation: (message, options = {}) => {
|
|
3431
|
+
let ret = `${OSC}1337;`
|
|
3432
|
+
const hasX = typeof options.x !== 'undefined'
|
|
3433
|
+
const hasY = typeof options.y !== 'undefined'
|
|
3434
|
+
if (
|
|
3435
|
+
(hasX || hasY) &&
|
|
3436
|
+
!(hasX && hasY && typeof options.length !== 'undefined')
|
|
3437
|
+
) {
|
|
3438
|
+
throw new Error(
|
|
3439
|
+
'`x`, `y` and `length` must be defined when `x` or `y` is defined'
|
|
3440
|
+
)
|
|
3441
|
+
}
|
|
3442
|
+
message = message.replace(/\|/g, '')
|
|
3443
|
+
ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='
|
|
3444
|
+
if (options.length > 0) {
|
|
3445
|
+
ret += (
|
|
3446
|
+
hasX
|
|
3447
|
+
? [message, options.length, options.x, options.y]
|
|
3448
|
+
: [options.length, message]
|
|
3449
|
+
).join('|')
|
|
3450
|
+
} else {
|
|
3451
|
+
ret += message
|
|
3452
|
+
}
|
|
3453
|
+
return ret + BEL
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
})(ansiEscapes)
|
|
3457
|
+
return ansiEscapes.exports
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
const ansiEscapesExports = requireAnsiEscapes()
|
|
3461
|
+
|
|
3486
3462
|
const selectTheme = {
|
|
3487
3463
|
icon: {
|
|
3488
3464
|
cursor: figures.pointer
|