mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: lazy-require model
This commit is contained in:
1 parent
a4d7dc4b04
commit
514078132e
4 files changed
+12
-16
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.20.11",
|
||||
"version": "2.20.12",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable max-len */
|
||||
/* eslint-disable func-names */
|
||||
import { isClass } from './utils';
|
||||
import { PERMS } from './model/builtin';
|
||||
|
||||
interface IHydroError {
|
||||
new(...args: any[]): HydroError
|
||||
@@ -78,7 +77,7 @@ export const VerifyPasswordError = Err('VerifyPasswordError', ForbiddenError, "P
|
||||
export const OpcountExceededError = Err('OpcountExceededError', ForbiddenError, 'Too frequent operations of {0} (limit: {2} operations in {1} seconds).');
|
||||
export const PermissionError = Err('PermissionError', ForbiddenError, function () {
|
||||
if (typeof this.params[0] === 'bigint') {
|
||||
this.params[0] = PERMS.find(({ key }) => key === this.params[0])?.desc || this.params[0];
|
||||
this.params[0] = require('./model/builtin').PERMS.find(({ key }) => key === this.params[0])?.desc || this.params[0];
|
||||
}
|
||||
return "You don't have the required permission ({0}) in this domain.";
|
||||
});
|
||||
|
||||
@@ -337,7 +337,7 @@ export interface HistoryDoc {
|
||||
}
|
||||
|
||||
// Discussion
|
||||
export { Ddoc } from './model/discussion';
|
||||
export type { Ddoc } from './model/discussion';
|
||||
declare module './model/discussion' {
|
||||
interface Ddoc {
|
||||
docType: document['TYPE_DISCUSSION'],
|
||||
|
||||
@@ -3,17 +3,6 @@
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable no-eval */
|
||||
import './interface';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import cluster from 'cluster';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import wtfnode from 'wtfnode';
|
||||
import './utils';
|
||||
|
||||
export * from './interface';
|
||||
|
||||
if (!global.Hydro) {
|
||||
global.Hydro = {
|
||||
stat: { reqCount: 0 },
|
||||
@@ -41,11 +30,19 @@ if (!global.Hydro) {
|
||||
};
|
||||
global.addons = [];
|
||||
}
|
||||
|
||||
import './interface';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import cluster from 'cluster';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import wtfnode from 'wtfnode';
|
||||
import './utils';
|
||||
import { Logger } from './logger';
|
||||
import './ui';
|
||||
import * as bus from './service/bus';
|
||||
|
||||
export * from './interface';
|
||||
const logger = new Logger('loader');
|
||||
logger.debug('%o', argv);
|
||||
bus.on('app/exit', () => {
|
||||
|
||||
Reference in new issue
Block a user