mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: seperate module build
This commit is contained in:
1 parent
90a9fa95f4
commit
c2c85581c4
8 files changed
+57
-36
No files matched your search
@@ -2,6 +2,18 @@
|
||||
require('@hydrooj/utils/lib/register');
|
||||
|
||||
const { default: hook } = require('require-resolve-hook');
|
||||
const { bypass } = hook(/^(hydrooj|@hydrooj\/utils|cordis|schemastery|lodash|js-yaml)/, (id) => bypass(() => require.resolve(id)));
|
||||
const { bypass } = hook(/^(hydrooj|@hydrooj\/utils|cordis|schemastery|lodash|js-yaml)/, (id) => {
|
||||
if (id.startsWith('hydrooj/src')) {
|
||||
console.log('module require via %s is deprecated.', id);
|
||||
if (process.env.DEV) {
|
||||
console.log(
|
||||
new Error().stack.split('\n')
|
||||
.filter((i) => !i.includes('node:internal') && i.startsWith(' '))
|
||||
.join('\n'),
|
||||
);
|
||||
}
|
||||
}
|
||||
return bypass(() => require.resolve(id));
|
||||
});
|
||||
|
||||
require('./commands');
|
||||
@@ -631,7 +631,7 @@ export interface Model {
|
||||
builtin: typeof import('./model/builtin'),
|
||||
contest: typeof import('./model/contest'),
|
||||
DiscussionModel: typeof import('./model/discussion'),
|
||||
document: typeof import('./model/document'),
|
||||
document: Omit<typeof import('./model/document'), 'apply'>,
|
||||
domain: typeof import('./model/domain').default,
|
||||
message: typeof import('./model/message').default,
|
||||
opcount: typeof import('./model/opcount'),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { OpcountExceededError } from '../error';
|
||||
import * as bus from '../service/bus';
|
||||
import db from '../service/db';
|
||||
|
||||
const coll = db.collection('opcount');
|
||||
|
||||
@@ -42,6 +42,7 @@ export { default as paginate } from './lib/paginate';
|
||||
export * from './service/decorators';
|
||||
export { Handler, ConnectionHandler } from './service/server';
|
||||
export { UiContextBase } from './service/layers/base';
|
||||
export * as StorageService from './service/storage';
|
||||
export { EventMap } from './service/bus';
|
||||
export {
|
||||
db, Schema, yaml, fs, AdmZip, superagent,
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import mongodb, { Cursor, Db } from 'mongodb';
|
||||
import {
|
||||
DiscussionModel, DiscussionTailReplyDoc, MessageDoc,
|
||||
RecordDoc, Schema, TestCase, TrainingNode,
|
||||
db as dst,
|
||||
DiscussionModel, DiscussionTailReplyDoc, DocumentModel,
|
||||
MessageDoc, RecordDoc, Schema, TestCase, TrainingNode,
|
||||
} from 'hydrooj';
|
||||
|
||||
const dst = global.Hydro.service.db;
|
||||
const map = {};
|
||||
|
||||
const pid = (id) => {
|
||||
if (map[id.toString()]) return map[id.toString()];
|
||||
return id;
|
||||
@@ -74,7 +73,7 @@ const tasks = {
|
||||
parent_doc_id: {
|
||||
field: 'parentId',
|
||||
processer: (parentId, doc) => {
|
||||
if (doc.parent_doc_type === global.Hydro.model.document.TYPE_PROBLEM) {
|
||||
if (doc.parent_doc_type === DocumentModel.TYPE_PROBLEM) {
|
||||
return pid(parentId);
|
||||
}
|
||||
return parentId;
|
||||
|
||||
@@ -13,7 +13,7 @@ declare module 'hydrooj' {
|
||||
'sonic.auth': string;
|
||||
}
|
||||
interface Context {
|
||||
sonic: SonicService;
|
||||
sonic?: SonicService;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user