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,266 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __commonJS = (cb, mod) => function __require() {
5
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
- };
7
-
8
- // src/shared.ts
9
- import { stdout } from "supports-color";
10
- import { Time } from "cosmokit";
11
- var require_shared = __commonJS({
12
- "src/shared.ts"(exports, module) {
13
- var c16 = [6, 2, 3, 4, 5, 1];
14
- var c256 = [
15
- 20,
16
- 21,
17
- 26,
18
- 27,
19
- 32,
20
- 33,
21
- 38,
22
- 39,
23
- 40,
24
- 41,
25
- 42,
26
- 43,
27
- 44,
28
- 45,
29
- 56,
30
- 57,
31
- 62,
32
- 63,
33
- 68,
34
- 69,
35
- 74,
36
- 75,
37
- 76,
38
- 77,
39
- 78,
40
- 79,
41
- 80,
42
- 81,
43
- 92,
44
- 93,
45
- 98,
46
- 99,
47
- 112,
48
- 113,
49
- 129,
50
- 134,
51
- 135,
52
- 148,
53
- 149,
54
- 160,
55
- 161,
56
- 162,
57
- 163,
58
- 164,
59
- 165,
60
- 166,
61
- 167,
62
- 168,
63
- 169,
64
- 170,
65
- 171,
66
- 172,
67
- 173,
68
- 178,
69
- 179,
70
- 184,
71
- 185,
72
- 196,
73
- 197,
74
- 198,
75
- 199,
76
- 200,
77
- 201,
78
- 202,
79
- 203,
80
- 204,
81
- 205,
82
- 206,
83
- 207,
84
- 208,
85
- 209,
86
- 214,
87
- 215,
88
- 220,
89
- 221
90
- ];
91
- function isAggregateError(error) {
92
- return error instanceof Error && Array.isArray(error["errors"]);
93
- }
94
- __name(isAggregateError, "isAggregateError");
95
- var Logger = class _Logger {
96
- constructor(name, meta) {
97
- this.name = name;
98
- this.meta = meta;
99
- this.createMethod("success", _Logger.SUCCESS);
100
- this.createMethod("error", _Logger.ERROR);
101
- this.createMethod("info", _Logger.INFO);
102
- this.createMethod("warn", _Logger.WARN);
103
- this.createMethod("debug", _Logger.DEBUG);
104
- }
105
- static {
106
- __name(this, "Logger");
107
- }
108
- // log levels
109
- static SILENT = 0;
110
- static SUCCESS = 1;
111
- static ERROR = 1;
112
- static INFO = 2;
113
- static WARN = 2;
114
- static DEBUG = 3;
115
- // global config
116
- static id = 0;
117
- static targets = [{
118
- colors: stdout && stdout.level,
119
- print(text) {
120
- console.log(text);
121
- }
122
- }];
123
- // global registry
124
- static formatters = /* @__PURE__ */ Object.create(null);
125
- static format(name, formatter) {
126
- this.formatters[name] = formatter;
127
- }
128
- static levels = {
129
- base: 2
130
- };
131
- static color(target, code, value, decoration = "") {
132
- if (!target.colors) return "" + value;
133
- return `\x1B[3${code < 8 ? code : "8;5;" + code}${target.colors >= 2 ? decoration : ""}m${value}\x1B[0m`;
134
- }
135
- static code(name, target) {
136
- let hash = 0;
137
- for (let i = 0; i < name.length; i++) {
138
- hash = (hash << 3) - hash + name.charCodeAt(i) + 13;
139
- hash |= 0;
140
- }
141
- const colors = !target.colors ? [] : target.colors >= 2 ? c256 : c16;
142
- return colors[Math.abs(hash) % colors.length];
143
- }
144
- static render(target, record) {
145
- const prefix = `[${record.type[0].toUpperCase()}]`;
146
- const space = " ".repeat(target.label?.margin ?? 1);
147
- let indent = 3 + space.length, output = "";
148
- if (target.showTime) {
149
- indent += target.showTime.length + space.length;
150
- output += _Logger.color(target, 8, Time.template(target.showTime)) + space;
151
- }
152
- const code = _Logger.code(record.name, target);
153
- const label = _Logger.color(target, code, record.name, ";1");
154
- const padLength = (target.label?.width ?? 0) + label.length - record.name.length;
155
- if (target.label?.align === "right") {
156
- output += label.padStart(padLength) + space + prefix + space;
157
- indent += (target.label.width ?? 0) + space.length;
158
- } else {
159
- output += prefix + space + label.padEnd(padLength) + space;
160
- }
161
- output += record.content.replace(/\n/g, "\n" + " ".repeat(indent));
162
- if (target.showDiff && target.timestamp) {
163
- const diff = record.timestamp - target.timestamp;
164
- output += _Logger.color(target, code, " +" + Time.format(diff));
165
- }
166
- return output;
167
- }
168
- extend = /* @__PURE__ */ __name((namespace) => {
169
- return new _Logger(`${this.name}:${namespace}`, this.meta);
170
- }, "extend");
171
- warning = /* @__PURE__ */ __name((format, ...args) => {
172
- this.warn(format, ...args);
173
- }, "warning");
174
- createMethod(type, level) {
175
- this[type] = (...args) => {
176
- if (args.length === 1 && args[0] instanceof Error) {
177
- if (args[0].cause) {
178
- this[type](args[0].cause);
179
- } else if (isAggregateError(args[0])) {
180
- args[0].errors.forEach((error) => this[type](error));
181
- return;
182
- }
183
- }
184
- const id = ++_Logger.id;
185
- const timestamp = Date.now();
186
- for (const target of _Logger.targets) {
187
- if (this.getLevel(target) < level) continue;
188
- const content = this.format(target, ...args);
189
- const record = { id, type, level, name: this.name, meta: this.meta, content, timestamp };
190
- if (target.record) {
191
- target.record(record);
192
- } else {
193
- const { print = console.log } = target;
194
- print(_Logger.render(target, record));
195
- }
196
- target.timestamp = timestamp;
197
- }
198
- };
199
- }
200
- format(target, ...args) {
201
- if (args[0] instanceof Error) {
202
- args[0] = args[0].stack || args[0].message;
203
- args.unshift("%s");
204
- } else if (typeof args[0] !== "string") {
205
- args.unshift("%o");
206
- }
207
- let format = args.shift();
208
- format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
209
- if (match === "%%") return "%";
210
- const formatter = _Logger.formatters[char];
211
- if (typeof formatter === "function") {
212
- const value = args.shift();
213
- return formatter(value, target, this);
214
- }
215
- return match;
216
- });
217
- for (let arg of args) {
218
- if (typeof arg === "object" && arg) {
219
- arg = _Logger.formatters["o"](arg, target, this);
220
- }
221
- format += " " + arg;
222
- }
223
- const { maxLength = 10240 } = target;
224
- return format.split(/\r?\n/g).map((line) => {
225
- return line.slice(0, maxLength) + (line.length > maxLength ? "..." : "");
226
- }).join("\n");
227
- }
228
- getLevel(target) {
229
- const paths = this.name.split(":");
230
- let config = target?.levels || _Logger.levels;
231
- do {
232
- config = config[paths.shift()] ?? config["base"];
233
- } while (paths.length && typeof config === "object");
234
- return config;
235
- }
236
- get level() {
237
- return this.getLevel();
238
- }
239
- set level(value) {
240
- const paths = this.name.split(":");
241
- let config = _Logger.levels;
242
- while (paths.length > 1) {
243
- const name = paths.shift();
244
- const value2 = config[name];
245
- if (typeof value2 === "object") {
246
- config = value2;
247
- } else {
248
- config = config[name] = { base: value2 ?? config.base };
249
- }
250
- }
251
- config[paths[0]] = value;
252
- }
253
- };
254
- Logger.format("s", (value) => value);
255
- Logger.format("d", (value) => +value);
256
- Logger.format("j", (value) => JSON.stringify(value));
257
- Logger.format("c", (value, target, logger) => {
258
- return Logger.color(target, Logger.code(logger.name, target), value);
259
- });
260
- Logger.format("C", (value, target) => {
261
- return Logger.color(target, 15, value, ";1");
262
- });
263
- module.exports = Logger;
264
- }
265
- });
266
- export default require_shared();
@@ -1,8 +0,0 @@
1
- import inspect from 'object-inspect'
2
- import Logger from './shared'
3
-
4
- Logger.format('o', (value, target) => {
5
- return inspect(value, { depth: Infinity }).replace(/\s*\n\s*/g, ' ')
6
- })
7
-
8
- export = Logger
@@ -1,3 +0,0 @@
1
- import Logger from './node'
2
-
3
- export = Logger
@@ -1,8 +0,0 @@
1
- import { inspect } from 'util'
2
- import Logger from './shared'
3
-
4
- Logger.format('o', (value, target) => {
5
- return inspect(value, { colors: !!target.colors, depth: Infinity }).replace(/\s*\n\s*/g, ' ')
6
- })
7
-
8
- export = Logger
@@ -1,249 +0,0 @@
1
- import { stdout } from 'supports-color'
2
- import { Time } from 'cosmokit'
3
-
4
- const c16 = [6, 2, 3, 4, 5, 1]
5
- const c256 = [
6
- 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62,
7
- 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113,
8
- 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168,
9
- 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200,
10
- 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221,
11
- ]
12
-
13
- function isAggregateError(error: any): error is Error & { errors: Error[] } {
14
- return error instanceof Error && Array.isArray((error as any)['errors'])
15
- }
16
-
17
- namespace Logger {
18
- export interface LevelConfig {
19
- base: number
20
- [K: string]: Level
21
- }
22
-
23
- export type Level = number | LevelConfig
24
- export type Function = (format: any, ...param: any[]) => void
25
- export type Type = 'success' | 'error' | 'info' | 'warn' | 'debug'
26
- export type Formatter = (value: any, target: Target, logger: Logger) => any
27
-
28
- export interface LabelStyle {
29
- width?: number
30
- margin?: number
31
- align?: 'left' | 'right'
32
- }
33
-
34
- export interface Record {
35
- id: number
36
- meta: any
37
- name: string
38
- type: Type
39
- level: number
40
- content: string
41
- timestamp: number
42
- }
43
-
44
- export interface Target {
45
- /**
46
- * - 0: no color support
47
- * - 1: 16 color support
48
- * - 2: 256 color support
49
- * - 3: truecolor support
50
- */
51
- colors?: false | number
52
- showDiff?: boolean
53
- showTime?: string
54
- label?: LabelStyle
55
- maxLength?: number
56
- record?(record: Record): void
57
- print?(text: string): void
58
- levels?: LevelConfig
59
- timestamp?: number
60
- }
61
- }
62
-
63
- interface Logger extends Record<Logger.Type, Logger.Function> {}
64
-
65
- class Logger {
66
- // log levels
67
- static readonly SILENT = 0
68
- static readonly SUCCESS = 1
69
- static readonly ERROR = 1
70
- static readonly INFO = 2
71
- static readonly WARN = 2
72
- static readonly DEBUG = 3
73
-
74
- // global config
75
- static id = 0
76
- static targets: Logger.Target[] = [{
77
- colors: stdout && stdout.level,
78
- print(text) {
79
- console.log(text)
80
- },
81
- }]
82
-
83
- // global registry
84
- static formatters: Record<string, Logger.Formatter> = Object.create(null)
85
-
86
- static format(name: string, formatter: Logger.Formatter) {
87
- this.formatters[name] = formatter
88
- }
89
-
90
- static levels: Logger.LevelConfig = {
91
- base: 2,
92
- }
93
-
94
- static color(target: Logger.Target, code: number, value: any, decoration = '') {
95
- if (!target.colors) return '' + value
96
- return `\u001b[3${code < 8 ? code : '8;5;' + code}${target.colors >= 2 ? decoration : ''}m${value}\u001b[0m`
97
- }
98
-
99
- static code(name: string, target: Logger.Target) {
100
- let hash = 0
101
- for (let i = 0; i < name.length; i++) {
102
- hash = ((hash << 3) - hash) + name.charCodeAt(i) + 13
103
- hash |= 0
104
- }
105
- const colors = !target.colors ? [] : target.colors >= 2 ? c256 : c16
106
- return colors[Math.abs(hash) % colors.length]
107
- }
108
-
109
- static render(target: Logger.Target, record: Logger.Record) {
110
- const prefix = `[${record.type[0].toUpperCase()}]`
111
- const space = ' '.repeat(target.label?.margin ?? 1)
112
- let indent = 3 + space.length, output = ''
113
- if (target.showTime) {
114
- indent += target.showTime.length + space.length
115
- output += Logger.color(target, 8, Time.template(target.showTime)) + space
116
- }
117
- const code = Logger.code(record.name, target)
118
- const label = Logger.color(target, code, record.name, ';1')
119
- const padLength = (target.label?.width ?? 0) + label.length - record.name.length
120
- if (target.label?.align === 'right') {
121
- output += label.padStart(padLength) + space + prefix + space
122
- indent += (target.label.width ?? 0) + space.length
123
- } else {
124
- output += prefix + space + label.padEnd(padLength) + space
125
- }
126
- output += record.content.replace(/\n/g, '\n' + ' '.repeat(indent))
127
- if (target.showDiff && target.timestamp) {
128
- const diff = record.timestamp - target.timestamp
129
- output += Logger.color(target, code, ' +' + Time.format(diff))
130
- }
131
- return output
132
- }
133
-
134
- constructor(public name: string, public meta?: any) {
135
- this.createMethod('success', Logger.SUCCESS)
136
- this.createMethod('error', Logger.ERROR)
137
- this.createMethod('info', Logger.INFO)
138
- this.createMethod('warn', Logger.WARN)
139
- this.createMethod('debug', Logger.DEBUG)
140
- }
141
-
142
- extend = (namespace: string) => {
143
- return new Logger(`${this.name}:${namespace}`, this.meta)
144
- }
145
-
146
- warning = (format: any, ...args: any[]) => {
147
- this.warn(format, ...args)
148
- }
149
-
150
- createMethod(type: Logger.Type, level: number) {
151
- this[type] = (...args) => {
152
- if (args.length === 1 && args[0] instanceof Error) {
153
- if (args[0].cause) {
154
- this[type](args[0].cause)
155
- } else if (isAggregateError(args[0])) {
156
- args[0].errors.forEach(error => this[type](error))
157
- return
158
- }
159
- }
160
-
161
- const id = ++Logger.id
162
- const timestamp = Date.now()
163
- for (const target of Logger.targets) {
164
- if (this.getLevel(target) < level) continue
165
- const content = this.format(target, ...args)
166
- const record: Logger.Record = { id, type, level, name: this.name, meta: this.meta, content, timestamp }
167
- if (target.record) {
168
- target.record(record)
169
- } else {
170
- const { print = console.log } = target
171
- print(Logger.render(target, record))
172
- }
173
- target.timestamp = timestamp
174
- }
175
- }
176
- }
177
-
178
- private format(target: Logger.Target, ...args: any[]) {
179
- if (args[0] instanceof Error) {
180
- args[0] = args[0].stack || args[0].message
181
- args.unshift('%s')
182
- } else if (typeof args[0] !== 'string') {
183
- args.unshift('%o')
184
- }
185
-
186
- let format: string = args.shift()
187
- format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
188
- if (match === '%%') return '%'
189
- const formatter = Logger.formatters[char]
190
- if (typeof formatter === 'function') {
191
- const value = args.shift()
192
- return formatter(value, target, this)
193
- }
194
- return match
195
- })
196
-
197
- for (let arg of args) {
198
- if (typeof arg === 'object' && arg) {
199
- arg = Logger.formatters['o'](arg, target, this)
200
- }
201
- format += ' ' + arg
202
- }
203
-
204
- const { maxLength = 10240 } = target
205
- return format.split(/\r?\n/g).map(line => {
206
- return line.slice(0, maxLength) + (line.length > maxLength ? '...' : '')
207
- }).join('\n')
208
- }
209
-
210
- getLevel(target?: Logger.Target) {
211
- const paths = this.name.split(':')
212
- let config: Logger.Level = target?.levels || Logger.levels
213
- do {
214
- config = config[paths.shift()!] ?? config['base']
215
- } while (paths.length && typeof config === 'object')
216
- return config as number
217
- }
218
-
219
- get level() {
220
- return this.getLevel()
221
- }
222
-
223
- set level(value) {
224
- const paths = this.name.split(':')
225
- let config = Logger.levels
226
- while (paths.length > 1) {
227
- const name = paths.shift()!
228
- const value = config[name]
229
- if (typeof value === 'object') {
230
- config = value
231
- } else {
232
- config = config[name] = { base: value ?? config.base }
233
- }
234
- }
235
- config[paths[0]] = value
236
- }
237
- }
238
-
239
- Logger.format('s', (value) => value)
240
- Logger.format('d', (value) => +value)
241
- Logger.format('j', (value) => JSON.stringify(value))
242
- Logger.format('c', (value, target, logger) => {
243
- return Logger.color(target, Logger.code(logger.name, target), value)
244
- })
245
- Logger.format('C', (value, target) => {
246
- return Logger.color(target, 15, value, ';1')
247
- })
248
-
249
- export = Logger