MCPcopy
hub / github.com/resend/react-email / NonInteractiveSpinner

Class NonInteractiveSpinner

packages/react-email/src/cli/utils/spinner.ts:66–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64};
65
66class NonInteractiveSpinner implements Spinner {
67 running = false;
68
69 private text = '';
70 private prefixText = '';
71 private readonly stream: NodeJS.WriteStream;
72 private lastLoggedLine: string | undefined;
73
74 constructor(display: SpinnerDisplay) {
75 if (typeof display === 'string') {
76 this.text = display;
77 this.stream = process.stdout;
78 } else {
79 this.text = display.text ?? '';
80 this.prefixText = display.prefixText ?? '';
81 this.stream = display.stream ?? process.stdout;
82 }
83 }
84
85 start(): void {
86 this.running = true;
87 this.log();
88 }
89
90 stop(): void {
91 this.running = false;
92 }
93
94 setText(text: string): void {
95 this.text = text;
96 if (this.running) {
97 this.log();
98 }
99 }
100
101 setDisplay(display: DisplayOptions & { symbol?: string }): void {
102 if (typeof display.text === 'string') {
103 this.text = display.text;
104 }
105 const { symbol } = display;
106 this.log(symbol);
107 if (typeof symbol === 'string') {
108 this.running = false;
109 }
110 }
111
112 succeed(display?: string | DisplayOptions): void {
113 this.finish('✔', display);
114 }
115
116 fail(display?: string | DisplayOptions): void {
117 this.finish('✖', display);
118 }
119
120 private finish(symbol: string, display?: string | DisplayOptions): void {
121 if (typeof display === 'string') {
122 this.text = display;
123 } else if (typeof display?.text === 'string') {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…