@kotori-bot/loader 1.6.1 → 1.6.2
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/lib/class/loader.js +2 -2
- package/lib/class/runner.d.ts +2 -3
- package/lib/class/runner.js +5 -7
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +2 -6
- package/lib/decorators/index.js +2 -2
- package/lib/decorators/plugin.js +2 -2
- package/lib/decorators/utils.js +2 -2
- package/lib/index.js +2 -2
- package/lib/service/adapter.js +2 -2
- package/lib/service/database.js +2 -2
- package/lib/service/file.js +2 -2
- package/lib/service/server.js +2 -2
- package/lib/types/index.js +2 -2
- package/lib/types/internal.js +2 -2
- package/lib/types/server.js +2 -2
- package/lib/utils/log.js +2 -2
- package/lib/utils/logger.js +2 -2
- package/package.json +3 -3
package/lib/class/loader.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/class/runner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, LocaleType, ModuleConfig, Symbols } from '@kotori-bot/core';
|
|
2
|
-
import { BUILD_MODE, DEV_MODE
|
|
2
|
+
import { BUILD_MODE, DEV_MODE } from '../constants';
|
|
3
3
|
import '../types/internal';
|
|
4
4
|
import './loader';
|
|
5
5
|
interface BaseDir {
|
|
@@ -10,7 +10,7 @@ interface BaseDir {
|
|
|
10
10
|
config: string;
|
|
11
11
|
}
|
|
12
12
|
interface Options {
|
|
13
|
-
mode: typeof BUILD_MODE | typeof DEV_MODE
|
|
13
|
+
mode: typeof BUILD_MODE | typeof DEV_MODE;
|
|
14
14
|
}
|
|
15
15
|
interface RunnerConfig {
|
|
16
16
|
baseDir: BaseDir;
|
|
@@ -47,7 +47,6 @@ export declare class Runner {
|
|
|
47
47
|
readonly options: Options;
|
|
48
48
|
private readonly ctx;
|
|
49
49
|
private readonly isDev;
|
|
50
|
-
private readonly isSourceDev;
|
|
51
50
|
readonly [Symbols.modules]: Map<string, [ModuleMeta, ModuleConfig]>;
|
|
52
51
|
constructor(ctx: Context, config: RunnerConfig);
|
|
53
52
|
private getDirFiles;
|
package/lib/class/runner.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
|
@@ -92,14 +92,12 @@ class Runner {
|
|
|
92
92
|
options;
|
|
93
93
|
ctx;
|
|
94
94
|
isDev;
|
|
95
|
-
isSourceDev;
|
|
96
95
|
[import_core.Symbols.modules] = /* @__PURE__ */ new Map();
|
|
97
96
|
constructor(ctx, config) {
|
|
98
97
|
this.ctx = ctx;
|
|
99
98
|
this.baseDir = config.baseDir;
|
|
100
99
|
this.options = config.options;
|
|
101
|
-
this.isDev = this.options.mode
|
|
102
|
-
this.isSourceDev = this.options.mode === import_constants.DEV_SOURCE_MODE;
|
|
100
|
+
this.isDev = this.options.mode === import_constants.DEV_MODE;
|
|
103
101
|
const loggerOptions = {
|
|
104
102
|
level: this.ctx.config.global.level ?? config.level,
|
|
105
103
|
label: [],
|
|
@@ -122,7 +120,7 @@ class Runner {
|
|
|
122
120
|
if (import_node_fs.default.statSync(file).isDirectory()) {
|
|
123
121
|
list.push(...this.getDirFiles(file));
|
|
124
122
|
}
|
|
125
|
-
if (import_node_path.default.parse(file).ext !== (this.
|
|
123
|
+
if (import_node_path.default.parse(file).ext !== (this.isDev ? import_constants.DEV_FILE : import_constants.BUILD_FILE)) return;
|
|
126
124
|
list.push(import_node_path.default.resolve(file));
|
|
127
125
|
});
|
|
128
126
|
return list;
|
|
@@ -155,7 +153,7 @@ class Runner {
|
|
|
155
153
|
throw new import_core.DevError(this.ctx.format("error.dev.package.missing", [packagePath, result.error.message]));
|
|
156
154
|
}
|
|
157
155
|
pkg = result.data;
|
|
158
|
-
const devMode = this.
|
|
156
|
+
const devMode = this.isDev && (0, import_node_fs.existsSync)(import_node_path.default.resolve(dir, import_constants.DEV_IMPORT));
|
|
159
157
|
const main = import_node_path.default.resolve(dir, devMode ? import_constants.DEV_IMPORT : pkg.main);
|
|
160
158
|
if (!import_node_fs.default.existsSync(main)) throw new import_core.DevError(this.ctx.format("error.dev.main_file", [main]));
|
|
161
159
|
const dirs = import_node_path.default.join(dir, devMode ? import_constants.DEV_CODE_DIRS : import_node_path.default.dirname(pkg.main));
|
package/lib/constants.d.ts
CHANGED
|
@@ -9,5 +9,4 @@ export declare const SUPPORTS_VERSION: RegExp;
|
|
|
9
9
|
export declare const SUPPORTS_HALF_VERSION: RegExp;
|
|
10
10
|
export declare const BUILD_MODE: "build";
|
|
11
11
|
export declare const DEV_MODE: "dev";
|
|
12
|
-
export declare const DEV_SOURCE_MODE: "dev-source";
|
|
13
12
|
export declare const CORE_MODULES: string[];
|
package/lib/constants.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
|
@@ -39,7 +39,6 @@ __export(constants_exports, {
|
|
|
39
39
|
DEV_FILE: () => DEV_FILE,
|
|
40
40
|
DEV_IMPORT: () => DEV_IMPORT,
|
|
41
41
|
DEV_MODE: () => DEV_MODE,
|
|
42
|
-
DEV_SOURCE_MODE: () => DEV_SOURCE_MODE,
|
|
43
42
|
SUPPORTS_HALF_VERSION: () => SUPPORTS_HALF_VERSION,
|
|
44
43
|
SUPPORTS_VERSION: () => SUPPORTS_VERSION
|
|
45
44
|
});
|
|
@@ -55,10 +54,8 @@ const SUPPORTS_VERSION = /(1\.1\.0)|(1\.2\.0)|(1\.3\.(.*))|(1\.4\.(.*))/;
|
|
|
55
54
|
const SUPPORTS_HALF_VERSION = /(x\.x\.(.*?))/;
|
|
56
55
|
const BUILD_MODE = "build";
|
|
57
56
|
const DEV_MODE = "dev";
|
|
58
|
-
const DEV_SOURCE_MODE = "dev-source";
|
|
59
57
|
const CORE_MODULES = [
|
|
60
58
|
"@kotori-bot/kotori-plugin-core",
|
|
61
|
-
"@kotori-bot/kotori-plugin-i18n-command",
|
|
62
59
|
"@kotori-bot/kotori-plugin-filter"
|
|
63
60
|
// '@kotori-bot/kotori-plugin-webui'
|
|
64
61
|
];
|
|
@@ -74,7 +71,6 @@ const CORE_MODULES = [
|
|
|
74
71
|
DEV_FILE,
|
|
75
72
|
DEV_IMPORT,
|
|
76
73
|
DEV_MODE,
|
|
77
|
-
DEV_SOURCE_MODE,
|
|
78
74
|
SUPPORTS_HALF_VERSION,
|
|
79
75
|
SUPPORTS_VERSION
|
|
80
76
|
});
|
package/lib/decorators/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/decorators/plugin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/decorators/utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/service/adapter.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/service/database.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/service/file.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/service/server.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/types/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/types/internal.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/types/server.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/utils/log.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/lib/utils/logger.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package @kotori-bot/loader
|
|
4
|
-
* @Version 1.6.
|
|
4
|
+
* @Version 1.6.2
|
|
5
5
|
* @Author Hotaru <biyuehuya@gmail.com>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/6/7 11:
|
|
9
|
+
* @Date 2024/6/7 11:53:11
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kotori-bot/loader",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "Loader For KotoriBot",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"express": "^4.18.2",
|
|
29
29
|
"path-to-regexp": "^6.2.2",
|
|
30
30
|
"ws": "^8.14.2",
|
|
31
|
-
"@kotori-bot/
|
|
32
|
-
"@kotori-bot/
|
|
31
|
+
"@kotori-bot/logger": "^1.3.1",
|
|
32
|
+
"@kotori-bot/core": "^1.5.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/express": "^4.17.21",
|