mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
优化loader
This commit is contained in:
1 parent
61c4d38521
commit
32a6d2de13
4 files changed
+17
-8
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
|
import { argv } from 'yargs';
|
||||||
|
|
||||||
export const builtinLib = [
|
export const builtinLib = [
|
||||||
'jwt', 'download', 'i18n', 'mail', 'useragent',
|
'jwt', 'download', 'i18n', 'mail', 'useragent',
|
||||||
@@ -53,6 +54,7 @@ export async function handler(pending: string[], fail: string[]) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Handler Load Fail: ${i}`);
|
console.error(`Handler Load Fail: ${i}`);
|
||||||
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,6 +77,7 @@ export async function locale(pending: string[], fail: string[]) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Locale Load Fail: ${i}`);
|
console.error(`Locale Load Fail: ${i}`);
|
||||||
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,6 +107,7 @@ export async function setting(pending: string[], fail: string[], modelSetting: t
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Config Load Fail: ${i}`);
|
console.error(`Config Load Fail: ${i}`);
|
||||||
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,6 +129,7 @@ export async function template(pending: string[], fail: string[]) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Template Load Fail: ${i}`);
|
console.error(`Template Load Fail: ${i}`);
|
||||||
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,6 +160,7 @@ export async function model(pending: string[], fail: string[]) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Model Load Fail: ${i}`);
|
console.error(`Model Load Fail: ${i}`);
|
||||||
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +178,7 @@ export async function lib(pending: string[], fail: string[]) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Lib Load Fail: ${i}`);
|
console.error(`Lib Load Fail: ${i}`);
|
||||||
console.error(e);
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,7 +196,7 @@ export async function service(pending: string[], fail: string[]) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Service Load Fail: ${i}`);
|
console.error(`Service Load Fail: ${i}`);
|
||||||
console.error(e);
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +213,7 @@ export async function script(pending: string[], fail: string[], active: string[]
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
fail.push(i);
|
fail.push(i);
|
||||||
console.error(`Script Load Fail: ${i}`);
|
console.error(`Script Load Fail: ${i}`);
|
||||||
console.error(e);
|
if (argv.debug) console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
active.push(i);
|
active.push(i);
|
||||||
|
|||||||
+6
-4
@@ -12,7 +12,8 @@ import AdmZip from 'adm-zip';
|
|||||||
|
|
||||||
export * from './interface';
|
export * from './interface';
|
||||||
|
|
||||||
global.Hydro = {
|
if (!global.Hydro) {
|
||||||
|
global.Hydro = {
|
||||||
stat: { reqCount: 0 },
|
stat: { reqCount: 0 },
|
||||||
handler: {},
|
handler: {},
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -31,9 +32,10 @@ global.Hydro = {
|
|||||||
error: {},
|
error: {},
|
||||||
locales: {},
|
locales: {},
|
||||||
postInit: [],
|
postInit: [],
|
||||||
};
|
};
|
||||||
global.onDestory = [];
|
global.onDestory = [];
|
||||||
global.addons = [];
|
global.addons = [];
|
||||||
|
}
|
||||||
|
|
||||||
if (argv.debug) {
|
if (argv.debug) {
|
||||||
console.log(process.argv);
|
console.log(process.argv);
|
||||||
|
|||||||
@@ -524,6 +524,7 @@ Problem Solution: 题解列表
|
|||||||
Problem Tags Visibility: 题目标签可见性
|
Problem Tags Visibility: 题目标签可见性
|
||||||
problem_create: 创建题目
|
problem_create: 创建题目
|
||||||
problem_detail: 题目详情
|
problem_detail: 题目详情
|
||||||
|
problem_detail: 题目详情
|
||||||
problem_edit: 编辑题目
|
problem_edit: 编辑题目
|
||||||
problem_import: 导入题目
|
problem_import: 导入题目
|
||||||
problem_main: 题库
|
problem_main: 题库
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.11.8",
|
"version": "2.11.9",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
Reference in new issue
Block a user