utilitas 2001.1.114 → 2001.1.116

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/index.mjs CHANGED
@@ -7,7 +7,6 @@ import _ from './lib/horizon.mjs'
7
7
  import * as alan from './lib/alan.mjs';
8
8
  import * as bee from './lib/bee.mjs';
9
9
  import * as bot from './lib/bot.mjs';
10
- import * as boxes from './lib/boxes.json' with { type: 'json' };
11
10
  import * as cache from './lib/cache.mjs';
12
11
  import * as callosum from './lib/callosum.mjs';
13
12
  import * as dbio from './lib/dbio.mjs';
@@ -38,14 +37,14 @@ export {
38
37
  // dependencies
39
38
  fileType, math, uuid,
40
39
  // features
41
- alan, bee, bot, boxes, cache, callosum, color, dbio, email, rag, encryption,
42
- event, manifest, media, memory, network, sentinel, shell, sms, speech, ssl,
40
+ alan, bee, bot, cache, callosum, color, dbio, email, rag, encryption, event,
41
+ manifest, media, memory, network, sentinel, shell, sms, speech, ssl,
43
42
  storage, tape, uoid, utilitas, vision, web
44
43
  };
45
44
 
46
45
  if (utilitas.inBrowser() && !globalThis.utilitas) {
47
46
  globalThis.utilitas = {
48
- boxes, color, encryption, event, manifest, math, speech, storage, uoid,
47
+ color, encryption, event, manifest, math, speech, storage, uoid,
49
48
  utilitas, uuid,
50
49
  };
51
50
  // top-level await workaround
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2001.1.114",
4
+ "version": "2001.1.116",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/shell.mjs CHANGED
@@ -13,7 +13,7 @@ const exec = async (command, options = {}) => {
13
13
  const child = (spawn || vF)(command, { ...options || {}, shell: true });
14
14
  const buf = { stdout: { lines: [], p: '' }, stderr: { lines: [], p: '' } };
15
15
  const collect = (k, d) => {
16
- if (options?.stream) { options.stream(d); }
16
+ if (options?.stream) { options.stream(d.toString()); }
17
17
  const p = (buf[k].p + d).split(/\r?\n/);
18
18
  buf[k].p = p.pop();
19
19
  buf[k].lines = buf[k].lines.concat(p);
package/lib/utilitas.mjs CHANGED
@@ -2,7 +2,6 @@ import { fileURLToPath } from 'node:url';
2
2
  import { basename as _basename, dirname, join, sep } from 'path';
3
3
  import { promisify } from 'util';
4
4
  import { validate as verifyUuid } from 'uuid';
5
- import boxes from './boxes.json' with { type: 'json' };
6
5
  import color from './color.mjs';
7
6
  import { assertPath, decodeBase64DataURL, readJson } from './storage.mjs';
8
7
 
@@ -618,10 +617,12 @@ const renderText = (text, options) => {
618
617
 
619
618
  const renderBox = (content, options) => {
620
619
  const [minWidth, defWidth, maxWidth, output, style]
621
- = [10, 80, 1024 * 2, [], boxes[options?.style || 'round']];
620
+ = [10, 80, 1024 * 2, [], options?.style || {
621
+ topLeft: '╭', top: '─', topRight: '╮', right: '│',
622
+ bottomRight: '╯', bottom: '─', bottomLeft: '╰', left: '│',
623
+ }];
622
624
  let [width, title] = [~~options?.width, options?.title || ''];
623
625
  assert(content.length, 'Content must not be empty.');
624
- assert(style, `Style must be one of ${Object.keys(boxes).join(', ')}.`);
625
626
  assert(
626
627
  !width || (width >= minWidth && width <= maxWidth),
627
628
  `Width must be between ${minWidth} and ${maxWidth}.`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "2001.1.114",
4
+ "version": "2001.1.116",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -13,7 +13,7 @@
13
13
  "start": "node index.mjs",
14
14
  "debug": "node --inspect --trace-warnings debug.mjs",
15
15
  "test": "node test.mjs",
16
- "updep": "npx npm-check-updates -u && npm install && wget https://raw.githubusercontent.com/Marak/colors.js/master/lib/styles.js -O ./lib/style.cjs && wget https://raw.githubusercontent.com/sindresorhus/cli-boxes/refs/heads/main/boxes.json -O ./lib/boxes.json",
16
+ "updep": "npx npm-check-updates -u && npm install && wget https://raw.githubusercontent.com/Marak/colors.js/master/lib/styles.js -O ./lib/style.cjs",
17
17
  "gitsync": "( git commit -am \"Released @ `date`\" || true ) && git pull && git push",
18
18
  "pack": "./node_modules/.bin/webpack-cli --config webpack.config.mjs",
19
19
  "build": "npm run updep && ( git commit -am 'update dependencies' || true ) && node build.mjs && npm run pack",
package/lib/boxes.json DELETED
@@ -1,82 +0,0 @@
1
- {
2
- "single": {
3
- "topLeft": "┌",
4
- "top": "─",
5
- "topRight": "┐",
6
- "right": "│",
7
- "bottomRight": "┘",
8
- "bottom": "─",
9
- "bottomLeft": "└",
10
- "left": "│"
11
- },
12
- "double": {
13
- "topLeft": "╔",
14
- "top": "═",
15
- "topRight": "╗",
16
- "right": "║",
17
- "bottomRight": "╝",
18
- "bottom": "═",
19
- "bottomLeft": "╚",
20
- "left": "║"
21
- },
22
- "round": {
23
- "topLeft": "╭",
24
- "top": "─",
25
- "topRight": "╮",
26
- "right": "│",
27
- "bottomRight": "╯",
28
- "bottom": "─",
29
- "bottomLeft": "╰",
30
- "left": "│"
31
- },
32
- "bold": {
33
- "topLeft": "┏",
34
- "top": "━",
35
- "topRight": "┓",
36
- "right": "┃",
37
- "bottomRight": "┛",
38
- "bottom": "━",
39
- "bottomLeft": "┗",
40
- "left": "┃"
41
- },
42
- "singleDouble": {
43
- "topLeft": "╓",
44
- "top": "─",
45
- "topRight": "╖",
46
- "right": "║",
47
- "bottomRight": "╜",
48
- "bottom": "─",
49
- "bottomLeft": "╙",
50
- "left": "║"
51
- },
52
- "doubleSingle": {
53
- "topLeft": "╒",
54
- "top": "═",
55
- "topRight": "╕",
56
- "right": "│",
57
- "bottomRight": "╛",
58
- "bottom": "═",
59
- "bottomLeft": "╘",
60
- "left": "│"
61
- },
62
- "classic": {
63
- "topLeft": "+",
64
- "top": "-",
65
- "topRight": "+",
66
- "right": "|",
67
- "bottomRight": "+",
68
- "bottom": "-",
69
- "bottomLeft": "+",
70
- "left": "|"
71
- },
72
- "arrow": {
73
- "topLeft": "↘",
74
- "top": "↓",
75
- "topRight": "↙",
76
- "right": "←",
77
- "bottomRight": "↖",
78
- "bottom": "↑",
79
- "bottomLeft": "↗",
80
- "left": "→"
81
- }
82
- }
package/lib/boxes.mjs DELETED
@@ -1,102 +0,0 @@
1
- // Based on: https://github.com/sindresorhus/cli-boxes
2
- // Repackaged to ESM by: @Leask
3
-
4
- const single = {
5
- "topLeft": "┌",
6
- "top": "─",
7
- "topRight": "┐",
8
- "right": "│",
9
- "bottomRight": "┘",
10
- "bottom": "─",
11
- "bottomLeft": "└",
12
- "left": "│"
13
- };
14
-
15
- const double = {
16
- "topLeft": "╔",
17
- "top": "═",
18
- "topRight": "╗",
19
- "right": "║",
20
- "bottomRight": "╝",
21
- "bottom": "═",
22
- "bottomLeft": "╚",
23
- "left": "║"
24
- };
25
-
26
- const round = {
27
- "topLeft": "╭",
28
- "top": "─",
29
- "topRight": "╮",
30
- "right": "│",
31
- "bottomRight": "╯",
32
- "bottom": "─",
33
- "bottomLeft": "╰",
34
- "left": "│"
35
- };
36
-
37
- const bold = {
38
- "topLeft": "┏",
39
- "top": "━",
40
- "topRight": "┓",
41
- "right": "┃",
42
- "bottomRight": "┛",
43
- "bottom": "━",
44
- "bottomLeft": "┗",
45
- "left": "┃"
46
- };
47
-
48
- const singleDouble = {
49
- "topLeft": "╓",
50
- "top": "─",
51
- "topRight": "╖",
52
- "right": "║",
53
- "bottomRight": "╜",
54
- "bottom": "─",
55
- "bottomLeft": "╙",
56
- "left": "║"
57
- };
58
-
59
- const doubleSingle = {
60
- "topLeft": "╒",
61
- "top": "═",
62
- "topRight": "╕",
63
- "right": "│",
64
- "bottomRight": "╛",
65
- "bottom": "═",
66
- "bottomLeft": "╘",
67
- "left": "│"
68
- };
69
-
70
- const classic = {
71
- "topLeft": "+",
72
- "top": "-",
73
- "topRight": "+",
74
- "right": "|",
75
- "bottomRight": "+",
76
- "bottom": "-",
77
- "bottomLeft": "+",
78
- "left": "|"
79
- };
80
-
81
- const arrow = {
82
- "topLeft": "↘",
83
- "top": "↓",
84
- "topRight": "↙",
85
- "right": "←",
86
- "bottomRight": "↖",
87
- "bottom": "↑",
88
- "bottomLeft": "↗",
89
- "left": "→"
90
- };
91
-
92
- export default round;
93
- export {
94
- single,
95
- double,
96
- round,
97
- bold,
98
- singleDouble,
99
- doubleSingle,
100
- classic,
101
- arrow,
102
- };