@yohs/esbuild-utils 0.2.2 → 0.2.5
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.
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region ../node-utils/src/console/animation.ts
|
|
2
|
+
const spinners = [
|
|
3
|
+
"⠋",
|
|
4
|
+
"⠙",
|
|
5
|
+
"⠹",
|
|
6
|
+
"⠸",
|
|
7
|
+
"⠼",
|
|
8
|
+
"⠴",
|
|
9
|
+
"⠦",
|
|
10
|
+
"⠧",
|
|
11
|
+
"⠇",
|
|
12
|
+
"⠏"
|
|
13
|
+
];
|
|
14
|
+
let spinnerInterval;
|
|
15
|
+
let spinnerIndex = 0;
|
|
16
|
+
let isWatchMode = false;
|
|
17
|
+
let currentStatus = "Ready";
|
|
18
|
+
const nextSpinner = () => {
|
|
19
|
+
const frame = spinners[spinnerIndex];
|
|
20
|
+
spinnerIndex = (spinnerIndex + 1) % spinners.length;
|
|
21
|
+
return frame;
|
|
22
|
+
};
|
|
23
|
+
const startPersistentSpinner = () => {
|
|
24
|
+
if (spinnerInterval) return;
|
|
25
|
+
spinnerInterval = setInterval(() => {
|
|
26
|
+
process.stdout.write("\x1B[s");
|
|
27
|
+
process.stdout.write("\x1B[H");
|
|
28
|
+
process.stdout.write(`\x1b[K${nextSpinner()} ${currentStatus}`);
|
|
29
|
+
process.stdout.write("\x1B[u");
|
|
30
|
+
}, 100);
|
|
31
|
+
};
|
|
32
|
+
const stopPersistentSpinner = () => {
|
|
33
|
+
if (!spinnerInterval) return;
|
|
34
|
+
clearInterval(spinnerInterval);
|
|
35
|
+
spinnerInterval = void 0;
|
|
36
|
+
process.stdout.write("\x1B[s\x1B[H\x1B[K\x1B[u");
|
|
37
|
+
};
|
|
38
|
+
const updateStatus = (status) => {
|
|
39
|
+
currentStatus = status;
|
|
40
|
+
};
|
|
41
|
+
const getWatchMode = () => isWatchMode;
|
|
42
|
+
const startSpinner = (message) => {
|
|
43
|
+
if (spinnerInterval) return;
|
|
44
|
+
spinnerInterval = setInterval(() => {
|
|
45
|
+
process.stdout.write(`\r${nextSpinner()} ${message}`);
|
|
46
|
+
}, 80);
|
|
47
|
+
};
|
|
48
|
+
const stopSpinner = () => {
|
|
49
|
+
if (!spinnerInterval) return;
|
|
50
|
+
clearInterval(spinnerInterval);
|
|
51
|
+
spinnerInterval = void 0;
|
|
52
|
+
process.stdout.write("\r" + " ".repeat(50) + "\r");
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { getWatchMode, startPersistentSpinner, startSpinner, stopPersistentSpinner, stopSpinner, updateStatus };
|
|
57
|
+
//# sourceMappingURL=animation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.mjs","names":["spinnerInterval: NodeJS.Timeout | undefined"],"sources":["../../../../../node-utils/src/console/animation.ts"],"sourcesContent":["const spinners = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']\n\nlet spinnerInterval: NodeJS.Timeout | undefined\nlet spinnerIndex = 0\nlet isWatchMode = false\nlet currentStatus = 'Ready'\n\nconst nextSpinner = (): string => {\n\tconst frame = spinners[spinnerIndex]\n\tspinnerIndex = (spinnerIndex + 1) % spinners.length\n\treturn frame\n}\n\nexport const startPersistentSpinner = (): void => {\n\tif (spinnerInterval) return\n\n\tspinnerInterval = setInterval(() => {\n\t\tprocess.stdout.write('\\x1b[s') // Save cursor position\n\t\tprocess.stdout.write('\\x1b[H') // Move to top-left corner\n\t\tprocess.stdout.write(`\\x1b[K${nextSpinner()} ${currentStatus}`)\n\t\tprocess.stdout.write('\\x1b[u') // Restore cursor position\n\t}, 100)\n}\n\nexport const stopPersistentSpinner = (): void => {\n\tif (!spinnerInterval) return\n\tclearInterval(spinnerInterval)\n\tspinnerInterval = undefined\n\tprocess.stdout.write('\\x1b[s\\x1b[H\\x1b[K\\x1b[u')\n}\n\nexport const updateStatus = (status: string): void => {\n\tcurrentStatus = status\n}\n\nexport const setWatchMode = (watchMode: boolean): void => {\n\tisWatchMode = watchMode\n}\n\nexport const getWatchMode = (): boolean => isWatchMode\n\nexport const startSpinner = (message: string): void => {\n\tif (spinnerInterval) return\n\tspinnerInterval = setInterval(() => {\n\t\tprocess.stdout.write(`\\r${nextSpinner()} ${message}`)\n\t}, 80)\n}\n\nexport const stopSpinner = (): void => {\n\tif (!spinnerInterval) return\n\tclearInterval(spinnerInterval)\n\tspinnerInterval = undefined\n\tprocess.stdout.write('\\r' + ' '.repeat(50) + '\\r')\n}\n\nexport const createProgressBar = (total: number) => {\n\tlet current = 0\n\tconst barLength = 20\n\n\treturn {\n\t\tupdate: (increment: number = 1) => {\n\t\t\tcurrent += increment\n\t\t\tconst progress = Math.min(current / total, 1)\n\t\t\tconst filled = Math.round(barLength * progress)\n\t\t\tconst empty = barLength - filled\n\t\t\tconst bar = '█'.repeat(filled) + '░'.repeat(empty)\n\t\t\tconst percentage = Math.round(progress * 100)\n\t\t\tprocess.stdout.write(`\\r[${bar}] ${percentage}%`)\n\t\t},\n\t\tcomplete: () => {\n\t\t\tprocess.stdout.write('\\r' + ' '.repeat(50) + '\\r')\n\t\t},\n\t}\n}\n\n"],"mappings":";AAAA,MAAM,WAAW;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAI;AAEnE,IAAIA;AACJ,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,gBAAgB;AAEpB,MAAM,oBAA4B;CACjC,MAAM,QAAQ,SAAS;AACvB,iBAAgB,eAAe,KAAK,SAAS;AAC7C,QAAO;;AAGR,MAAa,+BAAqC;AACjD,KAAI,gBAAiB;AAErB,mBAAkB,kBAAkB;AACnC,UAAQ,OAAO,MAAM,SAAS;AAC9B,UAAQ,OAAO,MAAM,SAAS;AAC9B,UAAQ,OAAO,MAAM,SAAS,aAAa,CAAC,GAAG,gBAAgB;AAC/D,UAAQ,OAAO,MAAM,SAAS;IAC5B,IAAI;;AAGR,MAAa,8BAAoC;AAChD,KAAI,CAAC,gBAAiB;AACtB,eAAc,gBAAgB;AAC9B,mBAAkB;AAClB,SAAQ,OAAO,MAAM,2BAA2B;;AAGjD,MAAa,gBAAgB,WAAyB;AACrD,iBAAgB;;AAOjB,MAAa,qBAA8B;AAE3C,MAAa,gBAAgB,YAA0B;AACtD,KAAI,gBAAiB;AACrB,mBAAkB,kBAAkB;AACnC,UAAQ,OAAO,MAAM,KAAK,aAAa,CAAC,GAAG,UAAU;IACnD,GAAG;;AAGP,MAAa,oBAA0B;AACtC,KAAI,CAAC,gBAAiB;AACtB,eAAc,gBAAgB;AAC9B,mBAAkB;AAClB,SAAQ,OAAO,MAAM,OAAO,IAAI,OAAO,GAAG,GAAG,KAAK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getWatchMode, startPersistentSpinner, startSpinner, stopPersistentSpinner, stopSpinner, updateStatus } from "
|
|
1
|
+
import { getWatchMode, startPersistentSpinner, startSpinner, stopPersistentSpinner, stopSpinner, updateStatus } from "../node-utils/src/console/animation.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/custom-logging.ts
|
|
4
4
|
const customLoggingPlugin = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yohs/esbuild-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Reusable esbuild plugins, runners, and CLI helpers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,12 +21,11 @@
|
|
|
21
21
|
],
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"chalk": "^5.6.2"
|
|
25
|
-
"@yohs/node-utils": "0.2.0"
|
|
24
|
+
"chalk": "^5.6.2"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
27
|
+
"@yohs/gcp-utils": "^0.1.5",
|
|
28
|
+
"esbuild": "^0.25"
|
|
30
29
|
},
|
|
31
30
|
"peerDependenciesMeta": {
|
|
32
31
|
"@yohs/gcp-utils": {
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
"rimraf": "^6.1.2",
|
|
39
38
|
"tsdown": "^0.16.6",
|
|
40
39
|
"typescript": "^5.9.3",
|
|
41
|
-
"@yohs/gcp-utils": "0.1.
|
|
40
|
+
"@yohs/gcp-utils": "0.1.5"
|
|
42
41
|
},
|
|
43
42
|
"publishConfig": {
|
|
44
43
|
"access": "public"
|