@peteanderson/ansi 0.3.3 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/ansi.d.ts +28 -37
  2. package/dist/ansi.d.ts.map +1 -0
  3. package/dist/ansi.js +29 -52
  4. package/dist/ansi.js.map +1 -0
  5. package/dist/caret.d.ts +5 -3
  6. package/dist/caret.d.ts.map +1 -0
  7. package/dist/caret.js +6 -8
  8. package/dist/caret.js.map +1 -0
  9. package/dist/erase.d.ts +5 -1
  10. package/dist/erase.d.ts.map +1 -0
  11. package/dist/erase.js +4 -2
  12. package/dist/erase.js.map +1 -0
  13. package/dist/features/build.d.ts +7 -11
  14. package/dist/features/build.d.ts.map +1 -0
  15. package/dist/features/build.js +12 -25
  16. package/dist/features/build.js.map +1 -0
  17. package/dist/features/detect.d.ts +4 -4
  18. package/dist/features/detect.d.ts.map +1 -0
  19. package/dist/features/detect.js +5 -6
  20. package/dist/features/detect.js.map +1 -0
  21. package/dist/features/features.d.ts +4 -4
  22. package/dist/features/features.d.ts.map +1 -0
  23. package/dist/features/features.js +17 -28
  24. package/dist/features/features.js.map +1 -0
  25. package/dist/features/index.d.ts +2 -2
  26. package/dist/features/index.d.ts.map +1 -0
  27. package/dist/features/index.js +17 -1
  28. package/dist/features/index.js.map +1 -0
  29. package/dist/features/types.d.ts +10 -0
  30. package/dist/features/types.d.ts.map +1 -0
  31. package/dist/features/types.js +3 -0
  32. package/dist/features/types.js.map +1 -0
  33. package/dist/index.d.ts +3 -81
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +23 -1
  36. package/dist/index.js.map +1 -0
  37. package/dist/pad.d.ts +3 -4
  38. package/dist/pad.d.ts.map +1 -0
  39. package/dist/pad.js +8 -6
  40. package/dist/pad.js.map +1 -0
  41. package/dist/patterns.d.ts +4 -3
  42. package/dist/patterns.d.ts.map +1 -0
  43. package/dist/patterns.js +6 -4
  44. package/dist/patterns.js.map +1 -0
  45. package/dist/scroll.d.ts +5 -3
  46. package/dist/scroll.d.ts.map +1 -0
  47. package/dist/scroll.js +6 -6
  48. package/dist/scroll.js.map +1 -0
  49. package/dist/sgr/color/color.d.ts +5 -9
  50. package/dist/sgr/color/color.d.ts.map +1 -0
  51. package/dist/sgr/color/color.js +22 -29
  52. package/dist/sgr/color/color.js.map +1 -0
  53. package/dist/sgr/color/index.d.ts +2 -2
  54. package/dist/sgr/color/index.d.ts.map +1 -0
  55. package/dist/sgr/color/index.js +17 -1
  56. package/dist/sgr/color/index.js.map +1 -0
  57. package/dist/sgr/color/types.d.ts +30 -0
  58. package/dist/sgr/color/types.d.ts.map +1 -0
  59. package/dist/sgr/color/types.js +3 -0
  60. package/dist/sgr/color/types.js.map +1 -0
  61. package/dist/sgr/color/utils.d.ts +7 -27
  62. package/dist/sgr/color/utils.d.ts.map +1 -0
  63. package/dist/sgr/color/utils.js +16 -23
  64. package/dist/sgr/color/utils.js.map +1 -0
  65. package/dist/sgr/index.d.ts +4 -9
  66. package/dist/sgr/index.d.ts.map +1 -0
  67. package/dist/sgr/index.js +18 -4
  68. package/dist/sgr/index.js.map +1 -0
  69. package/dist/sgr/reset.d.ts +2 -1
  70. package/dist/sgr/reset.d.ts.map +1 -0
  71. package/dist/sgr/reset.js +4 -1
  72. package/dist/sgr/reset.js.map +1 -0
  73. package/dist/sgr/sgr.d.ts +4 -3
  74. package/dist/sgr/sgr.d.ts.map +1 -0
  75. package/dist/sgr/sgr.js +14 -27
  76. package/dist/sgr/sgr.js.map +1 -0
  77. package/dist/sgr/style.d.ts +3 -1
  78. package/dist/sgr/style.d.ts.map +1 -0
  79. package/dist/sgr/style.js +5 -3
  80. package/dist/sgr/style.js.map +1 -0
  81. package/dist/sgr/utils.d.ts +3 -2
  82. package/dist/sgr/utils.d.ts.map +1 -0
  83. package/dist/sgr/utils.js +3 -3
  84. package/dist/sgr/utils.js.map +1 -0
  85. package/dist/simplify/atom.d.ts +4 -3
  86. package/dist/simplify/atom.d.ts.map +1 -0
  87. package/dist/simplify/atom.js +9 -8
  88. package/dist/simplify/atom.js.map +1 -0
  89. package/dist/simplify/index.d.ts +2 -2
  90. package/dist/simplify/index.d.ts.map +1 -0
  91. package/dist/simplify/index.js +17 -1
  92. package/dist/simplify/index.js.map +1 -0
  93. package/dist/simplify/lookup.d.ts +3 -5
  94. package/dist/simplify/lookup.d.ts.map +1 -0
  95. package/dist/simplify/lookup.js +9 -13
  96. package/dist/simplify/lookup.js.map +1 -0
  97. package/dist/simplify/simplify.d.ts +2 -1
  98. package/dist/simplify/simplify.d.ts.map +1 -0
  99. package/dist/simplify/simplify.js +7 -7
  100. package/dist/simplify/simplify.js.map +1 -0
  101. package/dist/simplify/state.d.ts +3 -8
  102. package/dist/simplify/state.d.ts.map +1 -0
  103. package/dist/simplify/state.js +9 -13
  104. package/dist/simplify/state.js.map +1 -0
  105. package/dist/simplify/types.d.ts +9 -0
  106. package/dist/simplify/types.d.ts.map +1 -0
  107. package/dist/simplify/types.js +3 -0
  108. package/dist/simplify/types.js.map +1 -0
  109. package/dist/simplify/utils.d.ts +3 -2
  110. package/dist/simplify/utils.d.ts.map +1 -0
  111. package/dist/simplify/utils.js +4 -3
  112. package/dist/simplify/utils.js.map +1 -0
  113. package/dist/slice.d.ts +21 -1
  114. package/dist/slice.d.ts.map +1 -0
  115. package/dist/slice.js +10 -21
  116. package/dist/slice.js.map +1 -0
  117. package/dist/strip.d.ts +7 -15
  118. package/dist/strip.d.ts.map +1 -0
  119. package/dist/strip.js +13 -17
  120. package/dist/strip.js.map +1 -0
  121. package/dist/terminal.d.ts +5 -1
  122. package/dist/terminal.d.ts.map +1 -0
  123. package/dist/terminal.js +4 -2
  124. package/dist/terminal.js.map +1 -0
  125. package/package.json +8 -6
  126. package/src/ansi.ts +71 -0
  127. package/src/{caret.js → caret.ts} +9 -15
  128. package/src/{erase.js → erase.ts} +7 -10
  129. package/src/features/build.ts +53 -0
  130. package/src/features/detect.ts +36 -0
  131. package/src/features/{features.js → features.ts} +9 -18
  132. package/src/features/index.ts +1 -0
  133. package/src/index.ts +2 -0
  134. package/src/{pad.js → pad.ts} +4 -10
  135. package/src/{patterns.js → patterns.ts} +3 -5
  136. package/src/scroll.ts +13 -0
  137. package/src/sgr/color/{color.js → color.ts} +26 -35
  138. package/src/sgr/color/index.ts +1 -0
  139. package/src/sgr/color/{types.d.ts → types.ts} +6 -2
  140. package/src/sgr/color/{utils.js → utils.ts} +17 -30
  141. package/src/sgr/index.ts +3 -0
  142. package/src/sgr/reset.ts +1 -0
  143. package/src/sgr/sgr.ts +65 -0
  144. package/src/sgr/{style.js → style.ts} +3 -5
  145. package/src/sgr/{utils.js → utils.ts} +3 -6
  146. package/src/simplify/{atom.js → atom.ts} +5 -11
  147. package/src/simplify/index.ts +1 -0
  148. package/src/simplify/{lookup.js → lookup.ts} +5 -14
  149. package/src/simplify/{simplify.js → simplify.ts} +4 -10
  150. package/src/simplify/state.ts +63 -0
  151. package/src/simplify/{types.d.ts → types.ts} +5 -5
  152. package/src/simplify/{utils.js → utils.ts} +4 -10
  153. package/src/{slice.js → slice.ts} +12 -25
  154. package/src/strip.ts +10 -0
  155. package/src/{terminal.js → terminal.ts} +4 -7
  156. package/src/ansi.js +0 -70
  157. package/src/features/build.js +0 -68
  158. package/src/features/detect.js +0 -40
  159. package/src/features/index.js +0 -1
  160. package/src/index.js +0 -1
  161. package/src/scroll.js +0 -18
  162. package/src/sgr/color/index.js +0 -1
  163. package/src/sgr/index.js +0 -5
  164. package/src/sgr/reset.js +0 -3
  165. package/src/sgr/sgr.js +0 -77
  166. package/src/simplify/index.js +0 -1
  167. package/src/simplify/state.js +0 -73
  168. package/src/strip.js +0 -23
  169. /package/src/features/{types.d.ts → types.ts} +0 -0
package/dist/ansi.d.ts CHANGED
@@ -1,14 +1,21 @@
1
- export = ansi;
2
- declare const ansi: typeof makeAnsi & {
3
- fg: Channel;
4
- bg: Channel;
5
- } & {
6
- caret: ReturnType<typeof makeCaret>;
7
- erase: ReturnType<typeof makeErase>;
8
- scroll: ReturnType<typeof makeScroll>;
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: ReturnType<typeof makeStyle>;
11
- terminal: ReturnType<typeof makeTerminal>;
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: ReturnType<typeof getFeatures>;
26
+ features: Features;
20
27
  };
21
- declare namespace ansi {
22
- export { Args, Ansi };
23
- }
24
- declare function makeAnsi(...args: Args): Ansi;
25
- import { makeCaret } from "./caret";
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: ReturnType<typeof makeStyle>;
45
- terminal: ReturnType<typeof makeTerminal>;
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: ReturnType<typeof getFeatures>;
43
+ features: Features;
54
44
  };
55
- import { makeColor } from "./sgr/color/color";
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,MAAM,EAAC,MAAY,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAU,YAAY,CAAC;AAE7C,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG;IAC1B,KAAK,EAAI,KAAK,CAAC;IACf,KAAK,EAAI,KAAK,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAEhB,KAAK,EAAG,MAAM,CAAC;IACf,KAAK,EAAG,KAAK,CAAC;IAEd,QAAQ,EAAG,QAAQ,CAAC;IAEpB,MAAM,EAAK,OAAO,MAAM,CAAC;IACzB,QAAQ,EAAG,OAAO,QAAQ,CAAC;IAE3B,KAAK,EAAW,OAAO,KAAK,CAAC;IAC7B,aAAa,EAAG,OAAO,aAAa,CAAC;IACrC,QAAQ,EAAQ,OAAO,QAAQ,CAAC;IAChC,KAAK,EAAW,OAAO,KAAK,CAAC;IAC7B,QAAQ,EAAQ,OAAO,QAAQ,CAAC;IAEhC,QAAQ,EAAG,QAAQ,CAAC;CACpB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,CAyB5C;AAED,QAAA,MAAM,IAAI;WAhDA,KAAK;WACL,KAAK;YACL,MAAM;WAEP,MAAM;WACN,KAAK;cAEF,QAAQ;YAER,OAAO,MAAM;cACb,OAAO,QAAQ;WAEV,OAAO,KAAK;mBACZ,OAAO,aAAa;cACpB,OAAO,QAAQ;WACf,OAAO,KAAK;cACZ,OAAO,QAAQ;cAEpB,QAAQ;CA8B4B,CAAC;AAEjD,eAAe,IAAI,CAAC"}
package/dist/ansi.js CHANGED
@@ -1,59 +1,36 @@
1
1
  "use strict";
2
- const { makeCaret } = require("./caret");
3
- const { makeErase } = require("./erase");
4
- const { getFeatures } = require("./features");
5
- const { padEnd, padStart } = require("./pad");
6
- const { makeScroll } = require("./scroll");
7
- const { makeColor, makeReset, makeStyle } = require("./sgr");
8
- const { simplify } = require("./simplify");
9
- const { slice } = require("./slice");
10
- const { sanitize, strip, visibleLength } = require("./strip");
11
- const { makeTerminal } = require("./terminal");
12
- /**
13
- @typedef {import("./features/features").Args} Args
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
- module.exports = ansi;
35
+ exports.default = ansi;
36
+ //# sourceMappingURL=ansi.js.map
@@ -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
- export function makeCaret(enabled?: boolean): {
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
- /** @type {(code: string) => (count?: number) => string} */
3
- const move = code => count => `\x1b[${count === undefined ? "" : count ? count : "?"}${code}`;
4
- /** @type {(count?: number) => string} */
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
- /** @type {(x: number) => string} */
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
- module.exports = { makeCaret };
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,GAAG;IACb,EAAE,EAAS,IAAI,CAAC,GAAG,CAAC;IACpB,IAAI,EAAO,IAAI,CAAC,GAAG,CAAC;IACpB,OAAO,EAAI,IAAI,CAAC,GAAG,CAAC;IACpB,QAAQ,EAAG,IAAI,CAAC,GAAG,CAAC;IACpB,QAAQ,EAAG,IAAI,CAAC,GAAG,CAAC;IACpB,QAAQ,EAAG,IAAI,CAAC,GAAG,CAAC;IAEpB,CAAC,EAAE,CAAC,CAAS,EAAU,EAAE,CAAC,QAAQ,CAAC,GAAG;IAEtC,4FAA4F;IAC5F,+FAA+F;IAC/F,yDAAyD;IACzD,EAAE;IACF,MAAM;IACN,sBAAsB;IACtB,sBAAsB;IACtB,MAAM;IACN,IAAI,EAAM,OAAO;IACjB,OAAO,EAAG,OAAO;IAEjB,IAAI,EAAG,WAAW;IAClB,IAAI,EAAG,WAAW;IAElB,QAAQ,EAAE;QACT,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;KACxD;IAED,KAAK,EAAE;QACN,WAAW,EAAS,UAAU;QAC9B,SAAS,EAAW,UAAU;QAC9B,eAAe,EAAK,UAAU;QAC9B,aAAa,EAAO,UAAU;QAC9B,WAAW,EAAS,UAAU;QAC9B,iBAAiB,EAAG,UAAU;QAC9B,OAAO,EAAa,UAAU;KAC9B;CACD,CAAC;AAIF,MAAM,QAAQ,GAAU;IACvB,EAAE,EAAS,IAAI;IACf,IAAI,EAAO,IAAI;IACf,OAAO,EAAI,IAAI;IACf,QAAQ,EAAG,IAAI;IACf,QAAQ,EAAG,IAAI;IACf,QAAQ,EAAG,IAAI;IAEf,CAAC,EAAE,IAAI;IAEP,IAAI,EAAM,EAAE;IACZ,OAAO,EAAG,EAAE;IAEZ,IAAI,EAAG,EAAE;IACT,IAAI,EAAG,EAAE;IAET,QAAQ,EAAE;QACT,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,IAAI;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
- export function makeErase(enabled?: boolean): {
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
- module.exports = { makeErase };
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"}
@@ -1,11 +1,7 @@
1
- export type ColorDepth = import("./types").ColorDepth;
2
- export type Features = import("./types").Features;
3
- export function build(isTTY: boolean, colorDepth: ColorDepth, style?: boolean, caret?: boolean, erase?: boolean, scroll?: boolean, terminal?: boolean): Features;
4
- /** @type {(isTTY: boolean, enabled: boolean) => Features} */
5
- export const boolean: (isTTY: boolean, enabled: boolean) => Features;
6
- /** @type {(isTTY: boolean, colorDepth: ColorDepth) => Features} */
7
- export const number: (isTTY: boolean, colorDepth: ColorDepth) => Features;
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":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAWlD,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"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const { getColorDepth, detectFeatureSupport } = require("./detect");
3
- /** @typedef {import("./types").ColorDepth} ColorDepth */
4
- /** @typedef {import("./types").Features} Features */
5
- /** @type {(colorDepth: number) => ColorDepth} */
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
- /** @type {(isTTY: boolean, colorDepth: ColorDepth) => Features} */
36
+ exports.boolean = boolean;
51
37
  const number = (isTTY, colorDepth) => build(isTTY, colorDepth);
52
- /** @type {(stream: NodeJS.WriteStream) => Features} */
53
- const tty = stream => build(true, getColorDepth(stream));
54
- /** @type {() => Features} */
55
- const pipe = () => build(false, getColorDepth());
56
- module.exports = { build, boolean, number, tty, pipe };
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":";;;AAaA,sBA2BC;AAxCD,qCAA6D;AAI7D,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,mBAAmB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAC,CAAC;IAE7F,MAAM,OAAO,GAAG,IAAA,6BAAoB,EAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACxD,OAAO;QACN,UAAU,EAAG,mBAAmB,CAAC,UAAU,CAAC;QAC5C,KAAK,EAAQ,KAAK,IAAO,OAAO,CAAC,KAAK;QACtC,KAAK,EAAQ,KAAK,IAAO,OAAO,CAAC,KAAK;QACtC,KAAK,EAAQ,KAAK,IAAO,OAAO,CAAC,KAAK;QACtC,MAAM,EAAO,MAAM,IAAM,OAAO,CAAC,MAAM;QACvC,QAAQ,EAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ;KACzC,CAAC;AACH,CAAC;AAEM,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,OAAgB,EAAY,EAAE,CACrE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AADlB,QAAA,OAAO,WACW;AAExB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,UAAsB,EAAY,EAAE,CAC1E,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AADb,QAAA,MAAM,UACO;AAEnB,MAAM,GAAG,GAAG,CAAC,MAA0B,EAAY,EAAE,CAC3D,KAAK,CAAC,IAAI,EAAE,IAAA,sBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;AADvB,QAAA,GAAG,OACoB;AAE7B,MAAM,IAAI,GAAG,GAAa,EAAE,CAClC,KAAK,CAAC,KAAK,EAAE,IAAA,sBAAa,GAAE,CAAC,CAAC;AADlB,QAAA,IAAI,QACc"}
@@ -1,4 +1,4 @@
1
- export type ColorDepth = import("./types").ColorDepth;
2
- export type Features = import("./types").Features;
3
- export function detectFeatureSupport(isTTY: boolean, colorDepth: ColorDepth): Omit<Features, "colorDepth">;
4
- export function getColorDepth(stream?: NodeJS.WriteStream): ColorDepth;
1
+ 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,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAElD,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,UAAU,CAmBrE;AAED,wBAAgB,oBAAoB,CACnC,KAAK,EAAQ,OAAO,EACpB,UAAU,EAAG,UAAU,GACrB,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAS9B"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- /** @typedef {import("./types").ColorDepth} ColorDepth */
3
- /** @typedef {import("./types").Features} Features */
4
- /** @type {(stream?: NodeJS.WriteStream) => ColorDepth} */
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 /** @type {ColorDepth} */ (stream.getColorDepth());
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
- module.exports = { detectFeatureSupport, getColorDepth };
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,oDAYC;AAjCD,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,CACnC,KAAoB,EACpB,UAAuB;IAEvB,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,EAAC,MAAM,EAAC,MAAiC,UAAU,CAAC;AAK3D,OAAO,KAAK,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAElD,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,CA6BnD"}
@@ -1,39 +1,28 @@
1
1
  "use strict";
2
- const { Socket } = require("node:net");
3
- const { WriteStream } = require("node:tty");
4
- const { build, boolean, number, tty, pipe } = require("./build");
5
- const { getColorDepth } = require("./detect");
6
- /**
7
- @typedef {import("./types").ColorDepth} ColorDepth
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
9
  let [features, stream] = args;
21
10
  if (typeof features === "boolean")
22
- return boolean((stream ?? process.stdout).isTTY, features);
11
+ return (0, build_1.boolean)((stream ?? process.stdout).isTTY, features);
23
12
  if (typeof features === "number")
24
- return number((stream ?? process.stdout).isTTY, features);
13
+ return (0, build_1.number)((stream ?? process.stdout).isTTY, features);
25
14
  if (!features || typeof features !== "object")
26
15
  features = (stream ?? process.stdout);
27
- if (features instanceof WriteStream)
28
- return tty(features);
29
- if (features instanceof Socket)
30
- return pipe();
16
+ if (features instanceof node_tty_1.WriteStream)
17
+ return (0, build_1.tty)(features);
18
+ if (features instanceof node_net_1.Socket)
19
+ return (0, build_1.pipe)();
31
20
  const { colorDepth, style, caret, erase, scroll, terminal } = features;
32
- stream ??= process.stdout;
21
+ stream ?? (stream = process.stdout);
33
22
  if (colorDepth)
34
- build(stream.isTTY, colorDepth, style, caret, erase, scroll, terminal);
23
+ (0, build_1.build)(stream.isTTY, colorDepth, style, caret, erase, scroll, terminal);
35
24
  if (stream.isTTY)
36
- return build(true, getColorDepth(stream), style, caret, erase, scroll, terminal);
37
- return build(false, getColorDepth(), style, caret, erase, scroll, terminal);
25
+ return (0, build_1.build)(true, (0, detect_1.getColorDepth)(stream), style, caret, erase, scroll, terminal);
26
+ return (0, build_1.build)(false, (0, detect_1.getColorDepth)(), style, caret, erase, scroll, terminal);
38
27
  }
39
- module.exports = { getFeatures };
28
+ //# sourceMappingURL=features.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/features/features.ts"],"names":[],"mappings":";;AAcA,kCA6BC;AA3CD,uCAA2D;AAC3D,uCAA2D;AAC3D,mCAA0D;AAC1D,qCAA2D;AAW3D,SAAgB,WAAW,CAAC,GAAG,IAAU;IACxC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE9B,IAAI,OAAO,QAAQ,KAAK,SAAS;QAChC,OAAO,IAAA,eAAO,EAAC,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE5D,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAC/B,OAAO,IAAA,cAAM,EAAC,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE3D,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAC5C,QAAQ,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,IAAI,QAAQ,YAAY,sBAAW;QAClC,OAAO,IAAA,WAAG,EAAC,QAAQ,CAAC,CAAC;IAEtB,IAAI,QAAQ,YAAY,iBAAM;QAC7B,OAAO,IAAA,YAAI,GAAE,CAAC;IAEf,MAAM,EAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAErE,MAAM,KAAN,MAAM,GAAK,OAAO,CAAC,MAAM,EAAC;IAE1B,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"}
@@ -1,2 +1,2 @@
1
- declare const _exports: typeof import("./features");
2
- export = _exports;
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"}
@@ -1,2 +1,18 @@
1
1
  "use strict";
2
- module.exports = require("./features");
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,10 @@
1
+ export type ColorDepth = 1 | 3 | 4 | 8 | 24;
2
+ export interface Features {
3
+ colorDepth: ColorDepth;
4
+ style: boolean;
5
+ caret: boolean;
6
+ erase: boolean;
7
+ scroll: boolean;
8
+ terminal: boolean;
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/features/types.ts"],"names":[],"mappings":""}