@peteanderson/ansi 0.3.3 → 1.0.0
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/dist/ansi.d.ts +28 -37
- package/dist/ansi.d.ts.map +1 -0
- package/dist/ansi.js +29 -52
- package/dist/ansi.js.map +1 -0
- package/dist/caret.d.ts +5 -3
- package/dist/caret.d.ts.map +1 -0
- package/dist/caret.js +6 -8
- package/dist/caret.js.map +1 -0
- package/dist/erase.d.ts +5 -1
- package/dist/erase.d.ts.map +1 -0
- package/dist/erase.js +4 -2
- package/dist/erase.js.map +1 -0
- package/dist/features/build.d.ts +7 -11
- package/dist/features/build.d.ts.map +1 -0
- package/dist/features/build.js +12 -25
- package/dist/features/build.js.map +1 -0
- package/dist/features/detect.d.ts +4 -4
- package/dist/features/detect.d.ts.map +1 -0
- package/dist/features/detect.js +5 -6
- package/dist/features/detect.js.map +1 -0
- package/dist/features/features.d.ts +4 -4
- package/dist/features/features.d.ts.map +1 -0
- package/dist/features/features.js +24 -34
- package/dist/features/features.js.map +1 -0
- package/dist/features/index.d.ts +2 -2
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/index.js +17 -1
- package/dist/features/index.js.map +1 -0
- package/dist/features/types.d.ts +10 -0
- package/dist/features/types.d.ts.map +1 -0
- package/dist/features/types.js +3 -0
- package/dist/features/types.js.map +1 -0
- package/dist/index.d.ts +3 -81
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -0
- package/dist/pad.d.ts +3 -12
- package/dist/pad.d.ts.map +1 -0
- package/dist/pad.js +8 -14
- package/dist/pad.js.map +1 -0
- package/dist/patterns.d.ts +4 -3
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +6 -4
- package/dist/patterns.js.map +1 -0
- package/dist/scroll.d.ts +5 -3
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +6 -6
- package/dist/scroll.js.map +1 -0
- package/dist/sgr/color/color.d.ts +5 -9
- package/dist/sgr/color/color.d.ts.map +1 -0
- package/dist/sgr/color/color.js +22 -29
- package/dist/sgr/color/color.js.map +1 -0
- package/dist/sgr/color/index.d.ts +2 -2
- package/dist/sgr/color/index.d.ts.map +1 -0
- package/dist/sgr/color/index.js +17 -1
- package/dist/sgr/color/index.js.map +1 -0
- package/dist/sgr/color/test-rgb.d.ts +3 -0
- package/dist/sgr/color/test-rgb.d.ts.map +1 -0
- package/dist/sgr/color/test-rgb.js +149 -0
- package/dist/sgr/color/test-rgb.js.map +1 -0
- package/dist/sgr/color/types.d.ts +30 -0
- package/dist/sgr/color/types.d.ts.map +1 -0
- package/dist/sgr/color/types.js +3 -0
- package/dist/sgr/color/types.js.map +1 -0
- package/dist/sgr/color/utils.d.ts +7 -27
- package/dist/sgr/color/utils.d.ts.map +1 -0
- package/dist/sgr/color/utils.js +17 -32
- package/dist/sgr/color/utils.js.map +1 -0
- package/dist/sgr/index.d.ts +4 -9
- package/dist/sgr/index.d.ts.map +1 -0
- package/dist/sgr/index.js +18 -4
- package/dist/sgr/index.js.map +1 -0
- package/dist/sgr/reset.d.ts +2 -1
- package/dist/sgr/reset.d.ts.map +1 -0
- package/dist/sgr/reset.js +4 -1
- package/dist/sgr/reset.js.map +1 -0
- package/dist/sgr/sgr.d.ts +4 -3
- package/dist/sgr/sgr.d.ts.map +1 -0
- package/dist/sgr/sgr.js +8 -22
- package/dist/sgr/sgr.js.map +1 -0
- package/dist/sgr/style.d.ts +3 -1
- package/dist/sgr/style.d.ts.map +1 -0
- package/dist/sgr/style.js +5 -3
- package/dist/sgr/style.js.map +1 -0
- package/dist/sgr/utils.d.ts +3 -2
- package/dist/sgr/utils.d.ts.map +1 -0
- package/dist/sgr/utils.js +3 -3
- package/dist/sgr/utils.js.map +1 -0
- package/dist/simplify/atom.d.ts +4 -3
- package/dist/simplify/atom.d.ts.map +1 -0
- package/dist/simplify/atom.js +10 -16
- package/dist/simplify/atom.js.map +1 -0
- package/dist/simplify/index.d.ts +2 -2
- package/dist/simplify/index.d.ts.map +1 -0
- package/dist/simplify/index.js +17 -1
- package/dist/simplify/index.js.map +1 -0
- package/dist/simplify/lookup.d.ts +3 -5
- package/dist/simplify/lookup.d.ts.map +1 -0
- package/dist/simplify/lookup.js +9 -13
- package/dist/simplify/lookup.js.map +1 -0
- package/dist/simplify/simplify.d.ts +2 -1
- package/dist/simplify/simplify.d.ts.map +1 -0
- package/dist/simplify/simplify.js +7 -7
- package/dist/simplify/simplify.js.map +1 -0
- package/dist/simplify/state.d.ts +3 -8
- package/dist/simplify/state.d.ts.map +1 -0
- package/dist/simplify/state.js +9 -13
- package/dist/simplify/state.js.map +1 -0
- package/dist/simplify/test.d.ts +2 -0
- package/dist/simplify/test.d.ts.map +1 -0
- package/dist/simplify/test.js +64 -0
- package/dist/simplify/test.js.map +1 -0
- package/dist/simplify/types.d.ts +9 -0
- package/dist/simplify/types.d.ts.map +1 -0
- package/dist/simplify/types.js +3 -0
- package/dist/simplify/types.js.map +1 -0
- package/dist/simplify/utils.d.ts +3 -2
- package/dist/simplify/utils.d.ts.map +1 -0
- package/dist/simplify/utils.js +4 -3
- package/dist/simplify/utils.js.map +1 -0
- package/dist/slice.d.ts +21 -1
- package/dist/slice.d.ts.map +1 -0
- package/dist/slice.js +10 -22
- package/dist/slice.js.map +1 -0
- package/dist/strip.d.ts +4 -15
- package/dist/strip.d.ts.map +1 -0
- package/dist/strip.js +10 -17
- package/dist/strip.js.map +1 -0
- package/dist/terminal.d.ts +5 -1
- package/dist/terminal.d.ts.map +1 -0
- package/dist/terminal.js +4 -2
- package/dist/terminal.js.map +1 -0
- package/package.json +9 -22
- package/src/ansi.ts +71 -0
- package/src/{caret.js → caret.ts} +9 -15
- package/src/{erase.js → erase.ts} +7 -10
- package/src/features/build.ts +52 -0
- package/src/features/detect.ts +33 -0
- package/src/features/features.ts +48 -0
- package/src/features/index.ts +1 -0
- package/src/features/{types.d.ts → types.ts} +1 -1
- package/src/index.ts +2 -0
- package/src/pad.ts +7 -0
- package/src/{patterns.js → patterns.ts} +3 -5
- package/src/scroll.ts +13 -0
- package/src/sgr/color/{color.js → color.ts} +26 -35
- package/src/sgr/color/index.ts +1 -0
- package/src/sgr/color/{types.d.ts → types.ts} +6 -2
- package/src/sgr/color/utils.ts +58 -0
- package/src/sgr/index.ts +3 -0
- package/src/sgr/reset.ts +1 -0
- package/src/sgr/sgr.ts +68 -0
- package/src/sgr/{style.js → style.ts} +3 -5
- package/src/sgr/{utils.js → utils.ts} +3 -6
- package/src/simplify/atom.ts +32 -0
- package/src/simplify/index.ts +1 -0
- package/src/simplify/{lookup.js → lookup.ts} +5 -14
- package/src/simplify/{simplify.js → simplify.ts} +4 -10
- package/src/simplify/state.ts +63 -0
- package/src/simplify/{types.d.ts → types.ts} +5 -5
- package/src/simplify/{utils.js → utils.ts} +4 -10
- package/src/{slice.js → slice.ts} +12 -26
- package/src/strip.ts +5 -0
- package/src/{terminal.js → terminal.ts} +4 -7
- package/LICENSE +0 -7
- package/README.md +0 -174
- package/src/ansi.js +0 -70
- package/src/features/build.js +0 -68
- package/src/features/detect.js +0 -40
- package/src/features/features.js +0 -53
- package/src/features/index.js +0 -1
- package/src/index.js +0 -1
- package/src/pad.js +0 -21
- package/src/scroll.js +0 -18
- package/src/sgr/color/index.js +0 -1
- package/src/sgr/color/utils.js +0 -81
- package/src/sgr/index.js +0 -5
- package/src/sgr/reset.js +0 -3
- package/src/sgr/sgr.js +0 -77
- package/src/simplify/atom.js +0 -44
- package/src/simplify/index.js +0 -1
- package/src/simplify/state.js +0 -73
- package/src/strip.js +0 -23
package/dist/ansi.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { padEnd, padStart } from "./pad";
|
|
2
|
+
import { simplify } from "./simplify";
|
|
3
|
+
import { slice } from "./slice";
|
|
4
|
+
import { sanitize, strip, visibleLength } from "./strip";
|
|
5
|
+
import type { Args } from "./features/features";
|
|
6
|
+
import type { Caret } from "./caret";
|
|
7
|
+
import type { Erase } from "./erase";
|
|
8
|
+
import type { Features } from "./features/types";
|
|
9
|
+
import type { Scroll } from "./scroll";
|
|
10
|
+
import type { Color, Style } from "./sgr";
|
|
11
|
+
import type { Terminal } from "./terminal";
|
|
12
|
+
export type Ansi = Color & {
|
|
13
|
+
caret: Caret;
|
|
14
|
+
erase: Erase;
|
|
15
|
+
scroll: Scroll;
|
|
9
16
|
reset: string;
|
|
10
|
-
style:
|
|
11
|
-
terminal:
|
|
17
|
+
style: Style;
|
|
18
|
+
terminal: Terminal;
|
|
12
19
|
padEnd: typeof padEnd;
|
|
13
20
|
padStart: typeof padStart;
|
|
14
21
|
strip: typeof strip;
|
|
@@ -16,33 +23,16 @@ declare const ansi: typeof makeAnsi & {
|
|
|
16
23
|
sanitize: typeof sanitize;
|
|
17
24
|
slice: typeof slice;
|
|
18
25
|
simplify: typeof simplify;
|
|
19
|
-
features:
|
|
26
|
+
features: Features;
|
|
20
27
|
};
|
|
21
|
-
declare
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import { makeErase } from "./erase";
|
|
27
|
-
import { makeScroll } from "./scroll";
|
|
28
|
-
import { makeStyle } from "./sgr/style";
|
|
29
|
-
import { makeTerminal } from "./terminal";
|
|
30
|
-
import { padEnd } from "./pad";
|
|
31
|
-
import { padStart } from "./pad";
|
|
32
|
-
import { strip } from "./strip";
|
|
33
|
-
import { visibleLength } from "./strip";
|
|
34
|
-
import { sanitize } from "./strip";
|
|
35
|
-
import { slice } from "./slice";
|
|
36
|
-
import { simplify } from "./simplify/simplify";
|
|
37
|
-
import { getFeatures } from "./features/features";
|
|
38
|
-
type Args = import("./features/features").Args;
|
|
39
|
-
type Ansi = ReturnType<typeof makeColor> & {
|
|
40
|
-
caret: ReturnType<typeof makeCaret>;
|
|
41
|
-
erase: ReturnType<typeof makeErase>;
|
|
42
|
-
scroll: ReturnType<typeof makeScroll>;
|
|
28
|
+
export declare function makeAnsi(...args: Args): Ansi;
|
|
29
|
+
declare const ansi: typeof makeAnsi & Color & {
|
|
30
|
+
caret: Caret;
|
|
31
|
+
erase: Erase;
|
|
32
|
+
scroll: Scroll;
|
|
43
33
|
reset: string;
|
|
44
|
-
style:
|
|
45
|
-
terminal:
|
|
34
|
+
style: Style;
|
|
35
|
+
terminal: Terminal;
|
|
46
36
|
padEnd: typeof padEnd;
|
|
47
37
|
padStart: typeof padStart;
|
|
48
38
|
strip: typeof strip;
|
|
@@ -50,6 +40,7 @@ type Ansi = ReturnType<typeof makeColor> & {
|
|
|
50
40
|
sanitize: typeof sanitize;
|
|
51
41
|
slice: typeof slice;
|
|
52
42
|
simplify: typeof simplify;
|
|
53
|
-
features:
|
|
43
|
+
features: Features;
|
|
54
44
|
};
|
|
55
|
-
|
|
45
|
+
export default ansi;
|
|
46
|
+
//# sourceMappingURL=ansi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../src/ansi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAqB,OAAO,CAAC;AAGtD,OAAO,EAAC,QAAQ,EAAC,MAA6B,YAAY,CAAC;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAgC,SAAS,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAC,MAAO,SAAS,CAAC;AAGxD,OAAO,KAAK,EAAC,IAAI,EAAC,MAAc,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAa,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAa,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAU,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAC,MA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|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@typedef {ReturnType<typeof makeColor> & {
|
|
16
|
-
caret : ReturnType<typeof makeCaret>;
|
|
17
|
-
erase : ReturnType<typeof makeErase>;
|
|
18
|
-
scroll : ReturnType<typeof makeScroll>;
|
|
19
|
-
|
|
20
|
-
reset : string;
|
|
21
|
-
style : ReturnType<typeof makeStyle>;
|
|
22
|
-
|
|
23
|
-
terminal : ReturnType<typeof makeTerminal>;
|
|
24
|
-
|
|
25
|
-
padEnd : typeof padEnd;
|
|
26
|
-
padStart : typeof padStart;
|
|
27
|
-
|
|
28
|
-
strip : typeof strip;
|
|
29
|
-
visibleLength : typeof visibleLength;
|
|
30
|
-
sanitize : typeof sanitize;
|
|
31
|
-
slice : typeof slice;
|
|
32
|
-
simplify : typeof simplify;
|
|
33
|
-
|
|
34
|
-
features : ReturnType<typeof getFeatures>;
|
|
35
|
-
}} Ansi
|
|
36
|
-
*/
|
|
37
|
-
/** @type {(...args: Args) => Ansi}*/
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeAnsi = makeAnsi;
|
|
4
|
+
const caret_1 = require("./caret");
|
|
5
|
+
const erase_1 = require("./erase");
|
|
6
|
+
const features_1 = require("./features");
|
|
7
|
+
const pad_1 = require("./pad");
|
|
8
|
+
const scroll_1 = require("./scroll");
|
|
9
|
+
const sgr_1 = require("./sgr");
|
|
10
|
+
const simplify_1 = require("./simplify");
|
|
11
|
+
const slice_1 = require("./slice");
|
|
12
|
+
const strip_1 = require("./strip");
|
|
13
|
+
const terminal_1 = require("./terminal");
|
|
38
14
|
function makeAnsi(...args) {
|
|
39
|
-
const features = getFeatures(...args);
|
|
15
|
+
const features = (0, features_1.getFeatures)(...args);
|
|
40
16
|
return {
|
|
41
|
-
caret: makeCaret(features.caret),
|
|
42
|
-
erase: makeErase(features.erase),
|
|
43
|
-
scroll: makeScroll(features.scroll),
|
|
44
|
-
reset: makeReset(features.colorDepth > 1),
|
|
45
|
-
style: makeStyle(features.style),
|
|
46
|
-
...makeColor(features.colorDepth),
|
|
47
|
-
terminal: makeTerminal(features.terminal),
|
|
48
|
-
padEnd,
|
|
49
|
-
padStart,
|
|
50
|
-
strip,
|
|
51
|
-
visibleLength,
|
|
52
|
-
sanitize,
|
|
53
|
-
slice,
|
|
54
|
-
simplify,
|
|
17
|
+
caret: (0, caret_1.makeCaret)(features.caret),
|
|
18
|
+
erase: (0, erase_1.makeErase)(features.erase),
|
|
19
|
+
scroll: (0, scroll_1.makeScroll)(features.scroll),
|
|
20
|
+
reset: (0, sgr_1.makeReset)(features.colorDepth > 1),
|
|
21
|
+
style: (0, sgr_1.makeStyle)(features.style),
|
|
22
|
+
...(0, sgr_1.makeColor)(features.colorDepth),
|
|
23
|
+
terminal: (0, terminal_1.makeTerminal)(features.terminal),
|
|
24
|
+
padEnd: pad_1.padEnd,
|
|
25
|
+
padStart: pad_1.padStart,
|
|
26
|
+
strip: strip_1.strip,
|
|
27
|
+
visibleLength: strip_1.visibleLength,
|
|
28
|
+
sanitize: strip_1.sanitize,
|
|
29
|
+
slice: slice_1.slice,
|
|
30
|
+
simplify: simplify_1.simplify,
|
|
55
31
|
features,
|
|
56
32
|
};
|
|
57
33
|
}
|
|
58
34
|
const ansi = Object.assign(makeAnsi, makeAnsi());
|
|
59
|
-
|
|
35
|
+
exports.default = ansi;
|
|
36
|
+
//# sourceMappingURL=ansi.js.map
|
package/dist/ansi.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../src/ansi.ts"],"names":[],"mappings":";;AAyCA,4BAyBC;AAlED,mCAAwD;AACxD,mCAAwD;AACxD,yCAA2D;AAC3D,+BAAsD;AACtD,qCAAyD;AACzD,+BAAsD;AACtD,yCAA2D;AAC3D,mCAAwD;AACxD,mCAAwD;AACxD,yCAA2D;AAgC3D,SAAgB,QAAQ,CAAC,GAAG,IAAU;IACrC,MAAM,QAAQ,GAAG,IAAA,sBAAW,EAAC,GAAG,IAAI,CAAC,CAAC;IAEtC,OAAO;QACN,KAAK,EAAI,IAAA,iBAAS,EAAC,QAAQ,CAAC,KAAK,CAAC;QAClC,KAAK,EAAI,IAAA,iBAAS,EAAC,QAAQ,CAAC,KAAK,CAAC;QAClC,MAAM,EAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC;QAEpC,KAAK,EAAG,IAAA,eAAS,EAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,CAAC;QAC1C,KAAK,EAAG,IAAA,eAAS,EAAC,QAAQ,CAAC,KAAK,CAAC;QACjC,GAAG,IAAA,eAAS,EAAC,QAAQ,CAAC,UAAU,CAAC;QAEjC,QAAQ,EAAE,IAAA,uBAAY,EAAC,QAAQ,CAAC,QAAQ,CAAC;QAEzC,MAAM,EAAN,YAAM;QACN,QAAQ,EAAR,cAAQ;QAER,KAAK,EAAL,aAAK;QACL,aAAa,EAAb,qBAAa;QACb,QAAQ,EAAR,gBAAQ;QACR,KAAK,EAAL,aAAK;QACL,QAAQ,EAAR,mBAAQ;QAER,QAAQ;KACR,CAAC;AACH,CAAC;AAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEjD,kBAAe,IAAI,CAAC"}
|
package/dist/caret.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
declare const caret: {
|
|
2
2
|
up: (count?: number) => string;
|
|
3
3
|
down: (count?: number) => string;
|
|
4
4
|
forward: (count?: number) => string;
|
|
5
5
|
backward: (count?: number) => string;
|
|
6
6
|
nextLine: (count?: number) => string;
|
|
7
7
|
prevLine: (count?: number) => string;
|
|
8
|
-
/** @type {(x: number) => string} */
|
|
9
8
|
x: (x: number) => string;
|
|
10
9
|
save: string;
|
|
11
10
|
restore: string;
|
|
@@ -13,7 +12,6 @@ export function makeCaret(enabled?: boolean): {
|
|
|
13
12
|
show: string;
|
|
14
13
|
position: {
|
|
15
14
|
get: string;
|
|
16
|
-
/** @type {(x: number, y: number) => string} */
|
|
17
15
|
set: (x: number, y: number) => string;
|
|
18
16
|
};
|
|
19
17
|
shape: {
|
|
@@ -26,3 +24,7 @@ export function makeCaret(enabled?: boolean): {
|
|
|
26
24
|
default: string;
|
|
27
25
|
};
|
|
28
26
|
};
|
|
27
|
+
export type Caret = typeof caret;
|
|
28
|
+
export declare const makeCaret: (enabled?: boolean) => Caret;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=caret.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caret.d.ts","sourceRoot":"","sources":["../src/caret.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,KAAK;iBAL6B,MAAM,KAAG,MAAM;mBAAf,MAAM,KAAG,MAAM;sBAAf,MAAM,KAAG,MAAM;uBAAf,MAAM,KAAG,MAAM;uBAAf,MAAM,KAAG,MAAM;uBAAf,MAAM,KAAG,MAAM;WAa/C,MAAM,KAAG,MAAM;;;;;;;iBAkBZ,MAAM,KAAK,MAAM,KAAG,MAAM;;;;;;;;;;;CAYpC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC;AAkCjC,eAAO,MAAM,SAAS,GAAI,iBAAc,KAAG,KAAmC,CAAC"}
|
package/dist/caret.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCaret = void 0;
|
|
4
|
+
const move = (code) => (count) => `\x1b[${count === undefined ? "" : count ? count : "?"}${code}`;
|
|
5
5
|
const noop = () => "";
|
|
6
6
|
const caret = {
|
|
7
7
|
up: move("A"),
|
|
@@ -10,8 +10,7 @@ const caret = {
|
|
|
10
10
|
backward: move("D"),
|
|
11
11
|
nextLine: move("E"),
|
|
12
12
|
prevLine: move("F"),
|
|
13
|
-
|
|
14
|
-
x: x => `\x1b[${x}G`,
|
|
13
|
+
x: (x) => `\x1b[${x}G`,
|
|
15
14
|
// These are the old VT100 codes, but they're widely supported by old and new terminals. The
|
|
16
15
|
// newer VT220 codes are standardized by ECMA and ISO, and are also widely supported, but might
|
|
17
16
|
// not work in some older terminals. The VT220 codes are:
|
|
@@ -26,7 +25,6 @@ const caret = {
|
|
|
26
25
|
show: "\x1b[?25h",
|
|
27
26
|
position: {
|
|
28
27
|
get: "\x1b[6n",
|
|
29
|
-
/** @type {(x: number, y: number) => string} */
|
|
30
28
|
set: (x, y) => `\x1b[${y};${x}H`,
|
|
31
29
|
},
|
|
32
30
|
shape: {
|
|
@@ -39,7 +37,6 @@ const caret = {
|
|
|
39
37
|
default: "\x1b[0 q",
|
|
40
38
|
},
|
|
41
39
|
};
|
|
42
|
-
/** @type {typeof caret} */
|
|
43
40
|
const disabled = {
|
|
44
41
|
up: noop,
|
|
45
42
|
down: noop,
|
|
@@ -67,4 +64,5 @@ const disabled = {
|
|
|
67
64
|
},
|
|
68
65
|
};
|
|
69
66
|
const makeCaret = (enabled = true) => enabled ? caret : disabled;
|
|
70
|
-
|
|
67
|
+
exports.makeCaret = makeCaret;
|
|
68
|
+
//# sourceMappingURL=caret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caret.js","sourceRoot":"","sources":["../src/caret.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,KAAc,EAAU,EAAE,CACzD,QAAQ,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC;AAEjE,MAAM,IAAI,GAAG,GAAW,EAAE,CAAC,EAAE,CAAC;AAE9B,MAAM,KAAK,G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AI;KACT;IAED,KAAK,EAAE;QACN,WAAW,EAAS,EAAE;QACtB,SAAS,EAAW,EAAE;QACtB,eAAe,EAAK,EAAE;QACtB,aAAa,EAAO,EAAE;QACtB,WAAW,EAAS,EAAE;QACtB,iBAAiB,EAAG,EAAE;QACtB,OAAO,EAAa,EAAE;KACtB;CACD,CAAC;AAEK,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,IAAI,EAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAAlE,QAAA,SAAS,aAAyD"}
|
package/dist/erase.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare const erase: {
|
|
2
2
|
line: {
|
|
3
3
|
toStart: string;
|
|
4
4
|
toEnd: string;
|
|
@@ -11,3 +11,7 @@ export function makeErase(enabled?: boolean): {
|
|
|
11
11
|
scrollback: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
export type Erase = typeof erase;
|
|
15
|
+
export declare const makeErase: (enabled?: boolean) => Erase;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=erase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erase.d.ts","sourceRoot":"","sources":["../src/erase.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK;;;;;;;;;;;;CAYV,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC;AAgBjC,eAAO,MAAM,SAAS,GAAI,iBAAc,KAAG,KAAmC,CAAC"}
|
package/dist/erase.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeErase = void 0;
|
|
2
4
|
const erase = {
|
|
3
5
|
line: {
|
|
4
6
|
toStart: "\x1b[1K",
|
|
@@ -12,7 +14,6 @@ const erase = {
|
|
|
12
14
|
scrollback: "\x1b[3J",
|
|
13
15
|
},
|
|
14
16
|
};
|
|
15
|
-
/** @type {typeof erase} */
|
|
16
17
|
const disabled = {
|
|
17
18
|
line: {
|
|
18
19
|
toStart: "",
|
|
@@ -27,4 +28,5 @@ const disabled = {
|
|
|
27
28
|
},
|
|
28
29
|
};
|
|
29
30
|
const makeErase = (enabled = true) => enabled ? erase : disabled;
|
|
30
|
-
|
|
31
|
+
exports.makeErase = makeErase;
|
|
32
|
+
//# sourceMappingURL=erase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erase.js","sourceRoot":"","sources":["../src/erase.ts"],"names":[],"mappings":";;;AAAA,MAAM,KAAK,GAAG;IACb,IAAI,EAAE;QACL,OAAO,EAAG,SAAS;QACnB,KAAK,EAAK,SAAS;QACnB,IAAI,EAAM,SAAS;KACnB;IACD,MAAM,EAAE;QACP,OAAO,EAAM,SAAS;QACtB,KAAK,EAAQ,SAAS;QACtB,IAAI,EAAS,SAAS;QACtB,UAAU,EAAG,SAAS;KACtB;CACD,CAAC;AAIF,MAAM,QAAQ,GAAU;IACvB,IAAI,EAAE;QACL,OAAO,EAAG,EAAE;QACZ,KAAK,EAAK,EAAE;QACZ,IAAI,EAAM,EAAE;KACZ;IACD,MAAM,EAAE;QACP,OAAO,EAAM,EAAE;QACf,KAAK,EAAQ,EAAE;QACf,IAAI,EAAS,EAAE;QACf,UAAU,EAAG,EAAE;KACf;CACD,CAAC;AAEK,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,IAAI,EAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAAlE,QAAA,SAAS,aAAyD"}
|
package/dist/features/build.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** @type {(stream: NodeJS.WriteStream) => Features} */
|
|
9
|
-
export const tty: (stream: NodeJS.WriteStream) => Features;
|
|
10
|
-
/** @type {() => Features} */
|
|
11
|
-
export const pipe: () => Features;
|
|
1
|
+
import type { ColorDepth, Features } from "./types";
|
|
2
|
+
export declare function build(isTTY: boolean, colorDepth: ColorDepth, style?: boolean, caret?: boolean, erase?: boolean, scroll?: boolean, terminal?: boolean): Features;
|
|
3
|
+
export declare const boolean: (isTTY: boolean, enabled: boolean) => Features;
|
|
4
|
+
export declare const number: (isTTY: boolean, colorDepth: ColorDepth) => Features;
|
|
5
|
+
export declare const tty: (stream: NodeJS.WriteStream) => Features;
|
|
6
|
+
export declare const pipe: () => Features;
|
|
7
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/features/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAgB,SAAS,CAAC;AAW9D,wBAAgB,KAAK,CACpB,KAAK,EAAQ,OAAO,EACpB,UAAU,EAAG,UAAU,EACvB,KAAK,CAAC,EAAO,OAAO,EACpB,KAAK,CAAC,EAAO,OAAO,EACpB,KAAK,CAAC,EAAO,OAAO,EACpB,MAAM,CAAC,EAAM,OAAO,EACpB,QAAQ,CAAC,EAAI,OAAO,GAClB,QAAQ,CAmBV;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,EAAE,SAAS,OAAO,KAAG,QAC7B,CAAC;AAE/B,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,EAAE,YAAY,UAAU,KAAG,QACvC,CAAC;AAE1B,eAAO,MAAM,GAAG,GAAI,QAAQ,MAAM,CAAC,WAAW,KAAG,QACd,CAAC;AAEpC,eAAO,MAAM,IAAI,QAAO,QACM,CAAC"}
|
package/dist/features/build.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pipe = exports.tty = exports.number = exports.boolean = void 0;
|
|
4
|
+
exports.build = build;
|
|
5
|
+
const detect_1 = require("./detect");
|
|
6
6
|
function normalizeColorDepth(colorDepth) {
|
|
7
7
|
colorDepth = Math.floor(colorDepth);
|
|
8
8
|
if (colorDepth >= 24)
|
|
@@ -15,19 +15,6 @@ function normalizeColorDepth(colorDepth) {
|
|
|
15
15
|
return 3;
|
|
16
16
|
return 1;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
@type {
|
|
20
|
-
(
|
|
21
|
-
isTTY : boolean,
|
|
22
|
-
colorDepth : ColorDepth,
|
|
23
|
-
style? : boolean,
|
|
24
|
-
caret? : boolean,
|
|
25
|
-
erase? : boolean,
|
|
26
|
-
scroll? : boolean,
|
|
27
|
-
terminal? : boolean,
|
|
28
|
-
) => Features
|
|
29
|
-
}
|
|
30
|
-
*/
|
|
31
18
|
function build(isTTY, colorDepth, style, caret, erase, scroll, terminal) {
|
|
32
19
|
if (style !== undefined &&
|
|
33
20
|
caret !== undefined &&
|
|
@@ -35,7 +22,7 @@ function build(isTTY, colorDepth, style, caret, erase, scroll, terminal) {
|
|
|
35
22
|
scroll !== undefined &&
|
|
36
23
|
terminal !== undefined)
|
|
37
24
|
return { colorDepth: normalizeColorDepth(colorDepth), style, caret, erase, scroll, terminal };
|
|
38
|
-
const support = detectFeatureSupport(isTTY, colorDepth);
|
|
25
|
+
const support = (0, detect_1.detectFeatureSupport)(isTTY, colorDepth);
|
|
39
26
|
return {
|
|
40
27
|
colorDepth: normalizeColorDepth(colorDepth),
|
|
41
28
|
style: style ?? support.style,
|
|
@@ -45,12 +32,12 @@ function build(isTTY, colorDepth, style, caret, erase, scroll, terminal) {
|
|
|
45
32
|
terminal: terminal ?? support.terminal,
|
|
46
33
|
};
|
|
47
34
|
}
|
|
48
|
-
/** @type {(isTTY: boolean, enabled: boolean) => Features} */
|
|
49
35
|
const boolean = (isTTY, enabled) => build(isTTY, enabled ? 4 : 1);
|
|
50
|
-
|
|
36
|
+
exports.boolean = boolean;
|
|
51
37
|
const number = (isTTY, colorDepth) => build(isTTY, colorDepth);
|
|
52
|
-
|
|
53
|
-
const tty = stream => build(true, getColorDepth(stream));
|
|
54
|
-
|
|
55
|
-
const pipe = () => build(false, getColorDepth());
|
|
56
|
-
|
|
38
|
+
exports.number = number;
|
|
39
|
+
const tty = (stream) => build(true, (0, detect_1.getColorDepth)(stream));
|
|
40
|
+
exports.tty = tty;
|
|
41
|
+
const pipe = () => build(false, (0, detect_1.getColorDepth)());
|
|
42
|
+
exports.pipe = pipe;
|
|
43
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/features/build.ts"],"names":[],"mappings":";;;AAYA,sBA2BC;AAvCD,qCAA+D;AAG/D,SAAS,mBAAmB,CAAC,UAAkB;IAC9C,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,UAAU,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC;IAChC,IAAI,UAAU,IAAI,CAAC;QAAG,OAAO,CAAC,CAAC;IAC/B,IAAI,UAAU,IAAI,CAAC;QAAG,OAAO,CAAC,CAAC;IAC/B,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,CAAC;AACV,CAAC;AAED,SAAgB,KAAK,CACpB,KAAoB,EACpB,UAAuB,EACvB,KAAoB,EACpB,KAAoB,EACpB,KAAoB,EACpB,MAAoB,EACpB,QAAoB;IAEpB,IACC,KAAK,KAAQ,SAAS;QACtB,KAAK,KAAQ,SAAS;QACtB,KAAK,KAAQ,SAAS;QACtB,MAAM,KAAO,SAAS;QACtB,QAAQ,KAAK,SAAS;QAEtB,OAAO,EAAC,UAAU,EAAE,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
|
+
import type { ColorDepth, Features } from "./types";
|
|
2
|
+
export declare function getColorDepth(stream?: NodeJS.WriteStream): ColorDepth;
|
|
3
|
+
export declare function detectFeatureSupport(isTTY: boolean, colorDepth: ColorDepth): Omit<Features, "colorDepth">;
|
|
4
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/features/detect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,UAAU,CAmBrE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CASzG"}
|
package/dist/features/detect.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getColorDepth = getColorDepth;
|
|
4
|
+
exports.detectFeatureSupport = detectFeatureSupport;
|
|
5
5
|
function getColorDepth(stream) {
|
|
6
6
|
if (stream?.isTTY)
|
|
7
|
-
return
|
|
7
|
+
return stream.getColorDepth();
|
|
8
8
|
if (process.env.NO_COLOR || process.env.NODE_DISABLE_COLORS)
|
|
9
9
|
return 1;
|
|
10
10
|
switch (process.env.FORCE_COLOR) {
|
|
@@ -20,7 +20,6 @@ function getColorDepth(stream) {
|
|
|
20
20
|
return 1;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
/** @type {(isTTY: boolean, colorDepth: ColorDepth) => Omit<Features, "colorDepth">} */
|
|
24
23
|
function detectFeatureSupport(isTTY, colorDepth) {
|
|
25
24
|
const enabled = process.env.TERM !== "dumb" && isTTY;
|
|
26
25
|
return {
|
|
@@ -31,4 +30,4 @@ function detectFeatureSupport(isTTY, colorDepth) {
|
|
|
31
30
|
terminal: enabled,
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/features/detect.ts"],"names":[],"mappings":";;AAEA,sCAmBC;AAED,oDASC;AA9BD,SAAgB,aAAa,CAAC,MAA2B;IACxD,IAAI,MAAM,EAAE,KAAK;QAChB,OAAO,MAAM,CAAC,aAAa,EAAgB,CAAC;IAE7C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB;QAC1D,OAAO,CAAC,CAAC;IAEV,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;QACjC,KAAK,EAAE,CAAC;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,GAAG;YACP,OAAO,CAAC,CAAC;QACV,KAAK,GAAG;YACP,OAAO,CAAC,CAAC;QACV,KAAK,GAAG;YACP,OAAO,EAAE,CAAC;QACX;YACC,OAAO,CAAC,CAAC;IACX,CAAC;AACF,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAc,EAAE,UAAsB;IAC1E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC;IACrD,OAAO;QACN,KAAK,EAAM,UAAU,GAAG,CAAC;QACzB,KAAK,EAAM,OAAO;QAClB,KAAK,EAAM,OAAO;QAClB,MAAM,EAAK,OAAO;QAClB,QAAQ,EAAG,OAAO;KAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type ColorDepth = import("./types").ColorDepth;
|
|
2
|
-
export type Features = import("./types").Features;
|
|
3
|
-
export type Args = [enabled: boolean, stream?: NodeJS.WriteStream] | [colorDepth: ColorDepth, stream?: NodeJS.WriteStream] | [features: Partial<Features>, stream?: NodeJS.WriteStream] | [socket: Socket] | [stream?: NodeJS.WriteStream];
|
|
4
|
-
export function getFeatures(...args: Args): Features;
|
|
5
1
|
import { Socket } from "node:net";
|
|
2
|
+
import type { ColorDepth, Features } from "./types";
|
|
3
|
+
export type Args = [enabled: boolean, stream?: NodeJS.WriteStream] | [colorDepth: ColorDepth, stream?: NodeJS.WriteStream] | [features: Partial<Features>, stream?: NodeJS.WriteStream] | [socket: Socket] | [stream?: NodeJS.WriteStream];
|
|
4
|
+
export declare function getFeatures(...args: Args): Features;
|
|
5
|
+
//# sourceMappingURL=features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/features/features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAiC,UAAU,CAAC;AAI7D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAc,SAAS,CAAC;AAE5D,MAAM,MAAM,IAAI,GACb,CAAC,OAAO,EAAM,OAAO,EAAY,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,GAC7D,CAAC,UAAU,EAAG,UAAU,EAAS,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,GAC7D,CAAC,QAAQ,EAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,GAC7D,CAAC,MAAM,EAAO,MAAM,CAAC,GACrB,CAAC,MAAM,CAAC,EAAM,MAAM,CAAC,WAAW,CAAC,CAAC;AAErC,wBAAgB,WAAW,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,QAAQ,CAkCnD"}
|
|
@@ -1,39 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@typedef {import("./types").Features} Features
|
|
9
|
-
|
|
10
|
-
@typedef {
|
|
11
|
-
| [enabled : boolean, stream?: NodeJS.WriteStream]
|
|
12
|
-
| [colorDepth : ColorDepth, stream?: NodeJS.WriteStream]
|
|
13
|
-
| [features : Partial<Features>, stream?: NodeJS.WriteStream]
|
|
14
|
-
| [socket : Socket]
|
|
15
|
-
| [stream? : NodeJS.WriteStream]
|
|
16
|
-
} Args
|
|
17
|
-
*/
|
|
18
|
-
/** @type {(...args: Args) => Features} */
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFeatures = getFeatures;
|
|
4
|
+
const node_net_1 = require("node:net");
|
|
5
|
+
const node_tty_1 = require("node:tty");
|
|
6
|
+
const build_1 = require("./build");
|
|
7
|
+
const detect_1 = require("./detect");
|
|
19
8
|
function getFeatures(...args) {
|
|
20
|
-
|
|
21
|
-
if (typeof
|
|
22
|
-
return boolean((
|
|
23
|
-
if (typeof
|
|
24
|
-
return number((
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
const [first, second] = args;
|
|
10
|
+
if (typeof first === "boolean")
|
|
11
|
+
return (0, build_1.boolean)((second ?? process.stdout).isTTY, first);
|
|
12
|
+
if (typeof first === "number")
|
|
13
|
+
return (0, build_1.number)((second ?? process.stdout).isTTY, first);
|
|
14
|
+
let input = !first || typeof first !== "object"
|
|
15
|
+
? second ?? process.stdout
|
|
16
|
+
: first;
|
|
17
|
+
if (input instanceof node_tty_1.WriteStream)
|
|
18
|
+
return (0, build_1.tty)(input);
|
|
19
|
+
if (input instanceof node_net_1.Socket)
|
|
20
|
+
return (0, build_1.pipe)();
|
|
21
|
+
const { colorDepth, style, caret, erase, scroll, terminal } = input;
|
|
22
|
+
const stream = second ?? process.stdout;
|
|
33
23
|
if (colorDepth)
|
|
34
|
-
build(stream.isTTY, colorDepth, style, caret, erase, scroll, terminal);
|
|
24
|
+
(0, build_1.build)(stream.isTTY, colorDepth, style, caret, erase, scroll, terminal);
|
|
35
25
|
if (stream.isTTY)
|
|
36
|
-
return build(true, getColorDepth(stream), style, caret, erase, scroll, terminal);
|
|
37
|
-
return build(false, getColorDepth(), style, caret, erase, scroll, terminal);
|
|
26
|
+
return (0, build_1.build)(true, (0, detect_1.getColorDepth)(stream), style, caret, erase, scroll, terminal);
|
|
27
|
+
return (0, build_1.build)(false, (0, detect_1.getColorDepth)(), style, caret, erase, scroll, terminal);
|
|
38
28
|
}
|
|
39
|
-
|
|
29
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/features/features.ts"],"names":[],"mappings":";;AAaA,kCAkCC;AA/CD,uCAA6D;AAC7D,uCAA6D;AAC7D,mCAA4D;AAC5D,qCAA6D;AAU7D,SAAgB,WAAW,CAAC,GAAG,IAAU;IACxC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAGvB,CAAC;IAEF,IAAI,OAAO,KAAK,KAAK,SAAS;QAC7B,OAAO,IAAA,eAAO,EAAC,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAEzD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC5B,OAAO,IAAA,cAAM,EAAC,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAExD,IAAI,KAAK,GACR,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAClC,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM;QAC1B,CAAC,CAAC,KAAK,CAAC;IAEV,IAAI,KAAK,YAAY,sBAAW;QAC/B,OAAO,IAAA,WAAG,EAAC,KAAK,CAAC,CAAC;IAEnB,IAAI,KAAK,YAAY,iBAAM;QAC1B,OAAO,IAAA,YAAI,GAAE,CAAC;IAEf,MAAM,EAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAC,GAAG,KAA0B,CAAC;IAEvF,MAAM,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAExC,IAAI,UAAU;QACb,IAAA,aAAK,EAAC,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAExE,IAAI,MAAM,CAAC,KAAK;QACf,OAAO,IAAA,aAAK,EAAC,IAAI,EAAE,IAAA,sBAAa,EAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAElF,OAAO,IAAA,aAAK,EAAC,KAAK,EAAE,IAAA,sBAAa,GAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/features/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from "./features";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/features/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
package/dist/features/index.js
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./features"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/features/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/features/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACxB,UAAU,EAAG,UAAU,CAAC;IACxB,KAAK,EAAQ,OAAO,CAAC;IACrB,KAAK,EAAQ,OAAO,CAAC;IACrB,KAAK,EAAQ,OAAO,CAAC;IACrB,MAAM,EAAO,OAAO,CAAC;IACrB,QAAQ,EAAK,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/features/types.ts"],"names":[],"mappings":""}
|