@cedarjs/tui 5.0.4-next.167 → 5.0.4
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/index.d.ts +10 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -21
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import stream from 'stream';
|
|
2
2
|
import type { AnsiColors } from 'ansis';
|
|
3
|
-
import
|
|
4
|
-
declare const enquirerPrompt: typeof Enquirer.prompt;
|
|
3
|
+
import { prompt as enquirerPrompt } from 'enquirer';
|
|
5
4
|
/**
|
|
6
5
|
* A default set of styling for the TUI, designed for a cohesive look and feel around the Redwood CLI, CRWA and vairous plugins
|
|
7
6
|
*/
|
|
8
7
|
export declare const RedwoodStyling: {
|
|
9
|
-
error: import("ansis").Ansis;
|
|
10
|
-
warning: import("ansis").Ansis;
|
|
11
|
-
success: import("ansis").Ansis;
|
|
12
|
-
info: import("ansis").Ansis;
|
|
13
|
-
header: import("ansis").Ansis;
|
|
14
|
-
cmd: import("ansis").Ansis;
|
|
15
|
-
redwood: import("ansis").Ansis;
|
|
16
|
-
love: import("ansis").Ansis;
|
|
17
|
-
green: import("ansis").Ansis;
|
|
8
|
+
error: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
9
|
+
warning: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
10
|
+
success: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
11
|
+
info: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
12
|
+
header: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
13
|
+
cmd: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
14
|
+
redwood: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
15
|
+
love: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
16
|
+
green: import("ansis", { with: { "resolution-mode": "import" } }).Ansis;
|
|
18
17
|
};
|
|
19
18
|
/**
|
|
20
19
|
* An object used to describe a "reactive" TUI element, that is an element that is updated a number of times per second
|
|
@@ -144,5 +143,4 @@ export declare class RedwoodTUI {
|
|
|
144
143
|
*/
|
|
145
144
|
displayWarning(title: string, message: string): void;
|
|
146
145
|
}
|
|
147
|
-
export {};
|
|
148
146
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAGnD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;CAY1B,CAAA;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAiB;IAEnC,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAGd;IACD,OAAO,CAAC,aAAa,CAAQ;IAI7B,OAAO,CAAC,YAAY,CAAI;gBAEZ,OAAO,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;QACxB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,EAAE,OAAO,CAAA;YACjB,UAAU,C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;IAIpD;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM;IAKrB;;;;;;OAMG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,EACrB,SAAS,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC,CAAC,CAAC;IAYb;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAYhE;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAM3C;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK9C"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
ReactiveTUIContent: () => ReactiveTUIContent,
|
|
32
|
+
RedwoodStyling: () => RedwoodStyling,
|
|
33
|
+
RedwoodTUI: () => RedwoodTUI
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_stream = __toESM(require("stream"));
|
|
37
|
+
var import_ansis = __toESM(require("ansis"));
|
|
38
|
+
var import_enquirer = require("enquirer");
|
|
39
|
+
var import_stdout_update = require("stdout-update");
|
|
6
40
|
const RedwoodStyling = {
|
|
7
|
-
error:
|
|
8
|
-
warning:
|
|
9
|
-
success:
|
|
10
|
-
info:
|
|
11
|
-
header:
|
|
12
|
-
cmd:
|
|
13
|
-
redwood:
|
|
14
|
-
love:
|
|
15
|
-
green:
|
|
41
|
+
error: import_ansis.default.bold.red,
|
|
42
|
+
warning: import_ansis.default.hex("#ffa500"),
|
|
43
|
+
success: import_ansis.default.greenBright,
|
|
44
|
+
info: import_ansis.default.gray,
|
|
45
|
+
header: import_ansis.default.bold.underline.hex("#e8e8e8"),
|
|
46
|
+
cmd: import_ansis.default.hex("#808080"),
|
|
47
|
+
redwood: import_ansis.default.hex("#ff845e"),
|
|
48
|
+
love: import_ansis.default.redBright,
|
|
49
|
+
green: import_ansis.default.green
|
|
16
50
|
};
|
|
17
51
|
class ReactiveTUIContent {
|
|
18
52
|
outStream;
|
|
@@ -80,7 +114,7 @@ class ReactiveTUIContent {
|
|
|
80
114
|
}
|
|
81
115
|
}
|
|
82
116
|
setOutStream(out) {
|
|
83
|
-
this.outStream = new
|
|
117
|
+
this.outStream = new import_stream.default.Writable({
|
|
84
118
|
write: (chunk, _encoding, next) => {
|
|
85
119
|
if (this.content === "stream") {
|
|
86
120
|
this.content += chunk.toString("utf-8");
|
|
@@ -123,7 +157,7 @@ class RedwoodTUI {
|
|
|
123
157
|
constructor({ out, err } = {}) {
|
|
124
158
|
this.outStream = out || process.stdout;
|
|
125
159
|
this.errStream = err || process.stderr;
|
|
126
|
-
this.manager = UpdateManager.getInstance(this.outStream, this.errStream);
|
|
160
|
+
this.manager = import_stdout_update.UpdateManager.getInstance(this.outStream, this.errStream);
|
|
127
161
|
process.on("exit", () => {
|
|
128
162
|
this.stopReactive();
|
|
129
163
|
});
|
|
@@ -225,7 +259,7 @@ class RedwoodTUI {
|
|
|
225
259
|
if (wasReactive) {
|
|
226
260
|
this.stopReactive();
|
|
227
261
|
}
|
|
228
|
-
const result = await
|
|
262
|
+
const result = await (0, import_enquirer.prompt)(questions);
|
|
229
263
|
if (wasReactive) {
|
|
230
264
|
this.startReactive();
|
|
231
265
|
}
|
|
@@ -239,10 +273,10 @@ class RedwoodTUI {
|
|
|
239
273
|
drawFencedText(color, title, message) {
|
|
240
274
|
const width = Math.min(80, (this.outStream.columns || 80) - 2);
|
|
241
275
|
const headerText = `\u2500\u2500\u2500\u2500 ${title} `;
|
|
242
|
-
const header =
|
|
276
|
+
const header = import_ansis.default[color](
|
|
243
277
|
headerText + "\u2500".repeat(Math.max(0, width - headerText.length))
|
|
244
278
|
);
|
|
245
|
-
const line =
|
|
279
|
+
const line = import_ansis.default[color]("\u2500".repeat(width));
|
|
246
280
|
this.outStream.write(`
|
|
247
281
|
${header}
|
|
248
282
|
${line}
|
|
@@ -273,8 +307,9 @@ ${line}
|
|
|
273
307
|
this.drawFencedText("yellow", headerText, message);
|
|
274
308
|
}
|
|
275
309
|
}
|
|
276
|
-
export
|
|
310
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
311
|
+
0 && (module.exports = {
|
|
277
312
|
ReactiveTUIContent,
|
|
278
313
|
RedwoodStyling,
|
|
279
314
|
RedwoodTUI
|
|
280
|
-
};
|
|
315
|
+
});
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/tui",
|
|
3
|
-
"version": "5.0.4
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
7
7
|
"directory": "packages/tui"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"type": "
|
|
10
|
+
"type": "commonjs",
|
|
11
11
|
"main": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "node ./build.mts",
|
|
17
|
+
"build": "node ./build.mts && yarn build:types",
|
|
18
18
|
"build:pack": "yarn pack -o cedarjs-tui.tgz",
|
|
19
|
-
"build:types": "tsc --build --verbose
|
|
19
|
+
"build:types": "tsc --build --verbose",
|
|
20
20
|
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
|
|
21
21
|
"prepublishOnly": "NODE_ENV=production yarn build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"ansis": "4.
|
|
24
|
+
"ansis": "4.2.0",
|
|
25
25
|
"enquirer": "2.4.1",
|
|
26
26
|
"stdout-update": "1.6.8"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cedarjs/framework-tools": "5.0.4
|
|
29
|
+
"@cedarjs/framework-tools": "5.0.4",
|
|
30
30
|
"typescript": "5.9.3"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|