llonebot-dist 7.11.3 → 7.12.0

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 (43) hide show
  1. package/llbot.js +25478 -22920
  2. package/llbot.js.map +1 -1
  3. package/node_modules/file-type/package.json +2 -1
  4. package/node_modules/file-type/source/index.js +7 -2
  5. package/node_modules/reggol/lib/browser.d.ts +1 -0
  6. package/node_modules/reggol/lib/browser.js +255 -0
  7. package/node_modules/reggol/lib/node.d.ts +1 -0
  8. package/node_modules/reggol/lib/node.js +251 -27
  9. package/node_modules/reggol/lib/shared.d.ts +78 -0
  10. package/node_modules/reggol/package.json +10 -14
  11. package/node_modules/supports-color/browser.d.ts +1 -0
  12. package/node_modules/supports-color/browser.js +25 -14
  13. package/node_modules/supports-color/index.d.ts +55 -0
  14. package/node_modules/supports-color/index.js +88 -38
  15. package/node_modules/supports-color/package.json +21 -15
  16. package/node_modules/supports-color/readme.md +20 -22
  17. package/package.json +1 -1
  18. package/webui/assets/index-As4y32b7.js +37 -0
  19. package/webui/assets/index-CW4srXaj.css +2 -0
  20. package/webui/index.html +2 -2
  21. package//346/233/264/346/226/260/346/227/245/345/277/227.txt +19 -0
  22. package/default_config.json +0 -85
  23. package/node_modules/@minatojs/sql.js/LICENSE +0 -44
  24. package/node_modules/@minatojs/sql.js/README.md +0 -357
  25. package/node_modules/@minatojs/sql.js/dist/sql-wasm.d.ts +0 -316
  26. package/node_modules/@minatojs/sql.js/dist/sql-wasm.js +0 -225
  27. package/node_modules/@minatojs/sql.js/dist/sql-wasm.wasm +0 -0
  28. package/node_modules/@minatojs/sql.js/package.json +0 -58
  29. package/node_modules/has-flag/index.d.ts +0 -39
  30. package/node_modules/has-flag/index.js +0 -8
  31. package/node_modules/has-flag/license +0 -9
  32. package/node_modules/has-flag/package.json +0 -46
  33. package/node_modules/has-flag/readme.md +0 -89
  34. package/node_modules/reggol/index.d.ts +0 -79
  35. package/node_modules/reggol/lib/browser.mjs +0 -299
  36. package/node_modules/reggol/lib/shared.js +0 -258
  37. package/node_modules/reggol/lib/shared.mjs +0 -266
  38. package/node_modules/reggol/src/browser.ts +0 -8
  39. package/node_modules/reggol/src/index.ts +0 -3
  40. package/node_modules/reggol/src/node.ts +0 -8
  41. package/node_modules/reggol/src/shared.ts +0 -249
  42. package/webui/assets/index-DEXb-chN.js +0 -37
  43. package/webui/assets/index-DsGxgscs.css +0 -2
@@ -1,26 +1,22 @@
1
1
  {
2
2
  "name": "reggol",
3
3
  "description": "Logger for professionals",
4
- "version": "1.7.1",
4
+ "version": "2.1.0",
5
5
  "sideEffects": false,
6
+ "type": "module",
6
7
  "main": "lib/node.js",
7
- "types": "index.d.ts",
8
+ "types": "lib/shared.d.ts",
8
9
  "exports": {
9
10
  ".": {
11
+ "types": "./lib/shared.d.ts",
10
12
  "node": "./lib/node.js",
11
- "browser": "./lib/browser.mjs",
12
- "types": "./index.d.ts"
13
- },
14
- "./shared": {
15
- "require": "./lib/shared.js",
16
- "import": "./lib/shared.mjs"
13
+ "default": "./lib/browser.js"
17
14
  },
15
+ "./src/*": "./src/*",
18
16
  "./package.json": "./package.json"
19
17
  },
20
18
  "files": [
21
- "lib",
22
- "src",
23
- "index.d.ts"
19
+ "lib"
24
20
  ],
25
21
  "repository": {
26
22
  "type": "git",
@@ -58,8 +54,8 @@
58
54
  "typescript": "^5.5.3"
59
55
  },
60
56
  "dependencies": {
61
- "cosmokit": "^1.6.3",
62
- "object-inspect": "^1.13.1",
63
- "supports-color": "^8.1.1"
57
+ "cosmokit": "^1.7.3",
58
+ "object-inspect": "^1.13.4",
59
+ "supports-color": "^10.0.0"
64
60
  }
65
61
  }
@@ -0,0 +1 @@
1
+ export {default} from './index.js';
@@ -1,24 +1,35 @@
1
1
  /* eslint-env browser */
2
- 'use strict';
2
+ /* eslint-disable n/no-unsupported-features/node-builtins */
3
3
 
4
- function getChromeVersion() {
5
- const matches = /(Chrome|Chromium)\/(?<chromeVersion>\d+)\./.exec(navigator.userAgent);
4
+ const level = (() => {
5
+ if (!('navigator' in globalThis)) {
6
+ return 0;
7
+ }
8
+
9
+ if (globalThis.navigator.userAgentData) {
10
+ const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
11
+ if (brand?.version > 93) {
12
+ return 3;
13
+ }
14
+ }
6
15
 
7
- if (!matches) {
8
- return;
16
+ if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
17
+ return 1;
9
18
  }
10
19
 
11
- return Number.parseInt(matches.groups.chromeVersion, 10);
12
- }
20
+ return 0;
21
+ })();
13
22
 
14
- const colorSupport = getChromeVersion() >= 69 ? {
15
- level: 1,
23
+ const colorSupport = level !== 0 && {
24
+ level,
16
25
  hasBasic: true,
17
- has256: false,
18
- has16m: false
19
- } : false;
26
+ has256: level >= 2,
27
+ has16m: level >= 3,
28
+ };
20
29
 
21
- module.exports = {
30
+ const supportsColor = {
22
31
  stdout: colorSupport,
23
- stderr: colorSupport
32
+ stderr: colorSupport,
24
33
  };
34
+
35
+ export default supportsColor;
@@ -0,0 +1,55 @@
1
+ import type {WriteStream} from 'node:tty';
2
+
3
+ export type Options = {
4
+ /**
5
+ Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.
6
+
7
+ @default true
8
+ */
9
+ readonly sniffFlags?: boolean;
10
+ };
11
+
12
+ /**
13
+ Levels:
14
+ - `0` - All colors disabled.
15
+ - `1` - Basic 16 colors support.
16
+ - `2` - ANSI 256 colors support.
17
+ - `3` - Truecolor 16 million colors support.
18
+ */
19
+ export type ColorSupportLevel = 0 | 1 | 2 | 3;
20
+
21
+ /**
22
+ Detect whether the terminal supports color.
23
+ */
24
+ export type ColorSupport = {
25
+ /**
26
+ The color level.
27
+ */
28
+ level: ColorSupportLevel;
29
+
30
+ /**
31
+ Whether basic 16 colors are supported.
32
+ */
33
+ hasBasic: boolean;
34
+
35
+ /**
36
+ Whether ANSI 256 colors are supported.
37
+ */
38
+ has256: boolean;
39
+
40
+ /**
41
+ Whether Truecolor 16 million colors are supported.
42
+ */
43
+ has16m: boolean;
44
+ };
45
+
46
+ export type ColorInfo = ColorSupport | false;
47
+
48
+ export function createSupportsColor(stream?: WriteStream, options?: Options): ColorInfo;
49
+
50
+ declare const supportsColor: {
51
+ stdout: ColorInfo;
52
+ stderr: ColorInfo;
53
+ };
54
+
55
+ export default supportsColor;
@@ -1,35 +1,59 @@
1
- 'use strict';
2
- const os = require('os');
3
- const tty = require('tty');
4
- const hasFlag = require('has-flag');
1
+ import process from 'node:process';
2
+ import os from 'node:os';
3
+ import tty from 'node:tty';
4
+
5
+ // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
6
+ /// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
7
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
8
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
9
+ const position = argv.indexOf(prefix + flag);
10
+ const terminatorPosition = argv.indexOf('--');
11
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
12
+ }
5
13
 
6
14
  const {env} = process;
7
15
 
8
16
  let flagForceColor;
9
- if (hasFlag('no-color') ||
10
- hasFlag('no-colors') ||
11
- hasFlag('color=false') ||
12
- hasFlag('color=never')) {
17
+ if (
18
+ hasFlag('no-color')
19
+ || hasFlag('no-colors')
20
+ || hasFlag('color=false')
21
+ || hasFlag('color=never')
22
+ ) {
13
23
  flagForceColor = 0;
14
- } else if (hasFlag('color') ||
15
- hasFlag('colors') ||
16
- hasFlag('color=true') ||
17
- hasFlag('color=always')) {
24
+ } else if (
25
+ hasFlag('color')
26
+ || hasFlag('colors')
27
+ || hasFlag('color=true')
28
+ || hasFlag('color=always')
29
+ ) {
18
30
  flagForceColor = 1;
19
31
  }
20
32
 
21
33
  function envForceColor() {
22
- if ('FORCE_COLOR' in env) {
23
- if (env.FORCE_COLOR === 'true') {
24
- return 1;
25
- }
34
+ if (!('FORCE_COLOR' in env)) {
35
+ return;
36
+ }
26
37
 
27
- if (env.FORCE_COLOR === 'false') {
28
- return 0;
29
- }
38
+ if (env.FORCE_COLOR === 'true') {
39
+ return 1;
40
+ }
41
+
42
+ if (env.FORCE_COLOR === 'false') {
43
+ return 0;
44
+ }
45
+
46
+ if (env.FORCE_COLOR.length === 0) {
47
+ return 1;
48
+ }
49
+
50
+ const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
30
51
 
31
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
52
+ if (![0, 1, 2, 3].includes(level)) {
53
+ return;
32
54
  }
55
+
56
+ return level;
33
57
  }
34
58
 
35
59
  function translateLevel(level) {
@@ -41,11 +65,11 @@ function translateLevel(level) {
41
65
  level,
42
66
  hasBasic: true,
43
67
  has256: level >= 2,
44
- has16m: level >= 3
68
+ has16m: level >= 3,
45
69
  };
46
70
  }
47
71
 
48
- function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
72
+ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
49
73
  const noFlagForceColor = envForceColor();
50
74
  if (noFlagForceColor !== undefined) {
51
75
  flagForceColor = noFlagForceColor;
@@ -58,9 +82,9 @@ function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
58
82
  }
59
83
 
60
84
  if (sniffFlags) {
61
- if (hasFlag('color=16m') ||
62
- hasFlag('color=full') ||
63
- hasFlag('color=truecolor')) {
85
+ if (hasFlag('color=16m')
86
+ || hasFlag('color=full')
87
+ || hasFlag('color=truecolor')) {
64
88
  return 3;
65
89
  }
66
90
 
@@ -69,6 +93,12 @@ function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
69
93
  }
70
94
  }
71
95
 
96
+ // Check for Azure DevOps pipelines.
97
+ // Has to be above the `!streamIsTTY` check.
98
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
99
+ return 1;
100
+ }
101
+
72
102
  if (haveStream && !streamIsTTY && forceColor === undefined) {
73
103
  return 0;
74
104
  }
@@ -84,17 +114,21 @@ function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
84
114
  // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
85
115
  const osRelease = os.release().split('.');
86
116
  if (
87
- Number(osRelease[0]) >= 10 &&
88
- Number(osRelease[2]) >= 10586
117
+ Number(osRelease[0]) >= 10
118
+ && Number(osRelease[2]) >= 10_586
89
119
  ) {
90
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
120
+ return Number(osRelease[2]) >= 14_931 ? 3 : 2;
91
121
  }
92
122
 
93
123
  return 1;
94
124
  }
95
125
 
96
126
  if ('CI' in env) {
97
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
127
+ if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
128
+ return 3;
129
+ }
130
+
131
+ if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
98
132
  return 1;
99
133
  }
100
134
 
@@ -109,14 +143,29 @@ function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
109
143
  return 3;
110
144
  }
111
145
 
146
+ if (env.TERM === 'xterm-kitty') {
147
+ return 3;
148
+ }
149
+
150
+ if (env.TERM === 'xterm-ghostty') {
151
+ return 3;
152
+ }
153
+
154
+ if (env.TERM === 'wezterm') {
155
+ return 3;
156
+ }
157
+
112
158
  if ('TERM_PROGRAM' in env) {
113
159
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
114
160
 
115
161
  switch (env.TERM_PROGRAM) {
116
- case 'iTerm.app':
162
+ case 'iTerm.app': {
117
163
  return version >= 3 ? 3 : 2;
118
- case 'Apple_Terminal':
164
+ }
165
+
166
+ case 'Apple_Terminal': {
119
167
  return 2;
168
+ }
120
169
  // No default
121
170
  }
122
171
  }
@@ -136,17 +185,18 @@ function supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
136
185
  return min;
137
186
  }
138
187
 
139
- function getSupportLevel(stream, options = {}) {
140
- const level = supportsColor(stream, {
188
+ export function createSupportsColor(stream, options = {}) {
189
+ const level = _supportsColor(stream, {
141
190
  streamIsTTY: stream && stream.isTTY,
142
- ...options
191
+ ...options,
143
192
  });
144
193
 
145
194
  return translateLevel(level);
146
195
  }
147
196
 
148
- module.exports = {
149
- supportsColor: getSupportLevel,
150
- stdout: getSupportLevel({isTTY: tty.isatty(1)}),
151
- stderr: getSupportLevel({isTTY: tty.isatty(2)})
197
+ const supportsColor = {
198
+ stdout: createSupportsColor({isTTY: tty.isatty(1)}),
199
+ stderr: createSupportsColor({isTTY: tty.isatty(2)}),
152
200
  };
201
+
202
+ export default supportsColor;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supports-color",
3
- "version": "8.1.1",
3
+ "version": "10.2.2",
4
4
  "description": "Detect whether a terminal supports color",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/supports-color",
@@ -10,20 +10,25 @@
10
10
  "email": "sindresorhus@gmail.com",
11
11
  "url": "https://sindresorhus.com"
12
12
  },
13
+ "type": "module",
14
+ "exports": {
15
+ "types": "./index.d.ts",
16
+ "node": "./index.js",
17
+ "default": "./browser.js"
18
+ },
19
+ "sideEffects": false,
13
20
  "engines": {
14
- "node": ">=10"
21
+ "node": ">=18"
15
22
  },
16
23
  "scripts": {
17
- "test": "xo && ava"
24
+ "test": "xo && ava && tsd"
18
25
  },
19
26
  "files": [
20
27
  "index.js",
21
- "browser.js"
28
+ "index.d.ts",
29
+ "browser.js",
30
+ "browser.d.ts"
22
31
  ],
23
- "exports": {
24
- "node": "./index.js",
25
- "default": "./browser.js"
26
- },
27
32
  "keywords": [
28
33
  "color",
29
34
  "colour",
@@ -46,13 +51,14 @@
46
51
  "truecolor",
47
52
  "16m"
48
53
  ],
49
- "dependencies": {
50
- "has-flag": "^4.0.0"
51
- },
52
54
  "devDependencies": {
53
- "ava": "^2.4.0",
54
- "import-fresh": "^3.2.2",
55
- "xo": "^0.35.0"
55
+ "@types/node": "^22.10.2",
56
+ "ava": "^6.2.0",
57
+ "tsd": "^0.31.2",
58
+ "xo": "^0.60.0"
56
59
  },
57
- "browser": "browser.js"
60
+ "ava": {
61
+ "serial": true,
62
+ "workerThreads": false
63
+ }
58
64
  }
@@ -4,14 +4,14 @@
4
4
 
5
5
  ## Install
6
6
 
7
- ```
8
- $ npm install supports-color
7
+ ```sh
8
+ npm install supports-color
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
13
  ```js
14
- const supportsColor = require('supports-color');
14
+ import supportsColor from 'supports-color';
15
15
 
16
16
  if (supportsColor.stdout) {
17
17
  console.log('Terminal stdout supports color');
@@ -28,7 +28,7 @@ if (supportsColor.stderr.has16m) {
28
28
 
29
29
  ## API
30
30
 
31
- Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
31
+ Returns an `object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
32
32
 
33
33
  The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
34
34
 
@@ -36,13 +36,23 @@ The `stdout`/`stderr` objects specifies a level of support for color through a `
36
36
  - `.level = 2` and `.has256 = true`: 256 color support
37
37
  - `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
38
38
 
39
- ### `require('supports-color').supportsColor(stream, options?)`
39
+ ### Custom instance
40
+
41
+ The package also exposes the named export `createSupportColor` function that takes an arbitrary write stream (for example, `process.stdout`) and an optional options object to (re-)evaluate color support for an arbitrary stream.
40
42
 
41
- Additionally, `supports-color` exposes the `.supportsColor()` function that takes an arbitrary write stream (e.g. `process.stdout`) and an optional options object to (re-)evaluate color support for an arbitrary stream.
43
+ ```js
44
+ import {createSupportsColor} from 'supports-color';
42
45
 
43
- For example, `require('supports-color').stdout` is the equivalent of `require('supports-color').supportsColor(process.stdout)`.
46
+ const stdoutSupportsColor = createSupportsColor(process.stdout);
44
47
 
45
- The options object supports a single boolean property `sniffFlags`. By default it is `true`, which instructs `supportsColor()` to sniff `process.argv` for the multitude of `--color` flags (see _Info_ below). If `false`, then `process.argv` is not considered when determining color support.
48
+ if (stdoutSupportsColor) {
49
+ console.log('Terminal stdout supports color');
50
+ }
51
+
52
+ // `stdoutSupportsColor` is the same as `supportsColor.stdout`
53
+ ```
54
+
55
+ The options object supports a single boolean property `sniffFlags`. By default it is `true`, which instructs the detection to sniff `process.argv` for the multitude of `--color` flags (see _Info_ below). If `false`, then `process.argv` is not considered when determining color support.
46
56
 
47
57
  ## Info
48
58
 
@@ -56,22 +66,10 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
56
66
 
57
67
  - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
58
68
  - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
69
+ - [is-unicode-supported](https://github.com/sindresorhus/is-unicode-supported) - Detect whether the terminal supports Unicode
70
+ - [is-interactive](https://github.com/sindresorhus/is-interactive) - Check if stdout or stderr is interactive
59
71
 
60
72
  ## Maintainers
61
73
 
62
74
  - [Sindre Sorhus](https://github.com/sindresorhus)
63
75
  - [Josh Junon](https://github.com/qix-)
64
-
65
- ---
66
-
67
- <div align="center">
68
- <b>
69
- <a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
70
- </b>
71
- <br>
72
- <sub>
73
- Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
74
- </sub>
75
- </div>
76
-
77
- ---
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"llonebot-dist","version":"7.11.3","type":"module","description":"","main":"llbot.js","author":"linyuchen","repository":{"type":"git","url":"https://github.com/LLOneBot/LuckyLilliaBot"}}
1
+ {"name":"llonebot-dist","version":"7.12.0","type":"module","description":"","main":"llbot.js","author":"linyuchen","repository":{"type":"git","url":"https://github.com/LLOneBot/LuckyLilliaBot"}}