mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add server-loader (#816)
This commit is contained in:
1 parent
3302480348
commit
97720efb65
57 files changed
+1328
-1131
No files matched your search
+36
-7
@@ -33,9 +33,11 @@ const config = {
|
||||
compilerOptions: compilerOptionsBase,
|
||||
references: [
|
||||
{ path: 'tsconfig.ui.json' },
|
||||
{ path: 'plugins/tsconfig.json' },
|
||||
],
|
||||
files: [],
|
||||
};
|
||||
const exclude = ['**/public', '**/frontend', '**/node_modules', '**/bin', '**/dist', '**/__mocks__'];
|
||||
const configSrc = (name) => ({
|
||||
compilerOptions: {
|
||||
...compilerOptionsBase,
|
||||
@@ -43,11 +45,7 @@ const configSrc = (name) => ({
|
||||
rootDir: 'src',
|
||||
},
|
||||
include: ['src'],
|
||||
exclude: [
|
||||
'**/__mocks__',
|
||||
'bin',
|
||||
'dist',
|
||||
],
|
||||
exclude,
|
||||
});
|
||||
const configFlat = (name) => ({
|
||||
compilerOptions: {
|
||||
@@ -61,7 +59,7 @@ const configFlat = (name) => ({
|
||||
},
|
||||
},
|
||||
include: ['**/*.ts'],
|
||||
exclude: ['public', 'frontend'],
|
||||
exclude,
|
||||
});
|
||||
|
||||
for (const name of ['plugins', 'modules']) {
|
||||
@@ -74,12 +72,13 @@ for (const name of ['plugins', 'modules']) {
|
||||
|
||||
const modules = [
|
||||
'packages/hydrooj',
|
||||
...['packages', 'plugins', 'modules'].flatMap((i) => fs.readdirSync(path.resolve(process.cwd(), i)).map((j) => `${i}/${j}`)),
|
||||
...['packages', 'framework', 'modules'].flatMap((i) => fs.readdirSync(path.resolve(process.cwd(), i)).map((j) => `${i}/${j}`)),
|
||||
].filter((i) => !i.includes('/.') && !i.includes('ui-default')).filter((i) => fs.statSync(path.resolve(process.cwd(), i)).isDirectory());
|
||||
|
||||
const UIConfig = {
|
||||
exclude: [
|
||||
'packages/ui-default/public',
|
||||
'**/node_modules',
|
||||
],
|
||||
include: ['ts', 'tsx']
|
||||
.flatMap((ext) => ['plugins', 'modules']
|
||||
@@ -114,6 +113,36 @@ try {
|
||||
'dir',
|
||||
);
|
||||
} catch (e) { }
|
||||
|
||||
const pluginsConfig = {
|
||||
include: [
|
||||
'**/*.ts',
|
||||
],
|
||||
exclude,
|
||||
compilerOptions: {
|
||||
target: 'es2020',
|
||||
module: 'commonjs',
|
||||
esModuleInterop: true,
|
||||
moduleResolution: 'node',
|
||||
jsx: 'react',
|
||||
sourceMap: false,
|
||||
composite: true,
|
||||
strictBindCallApply: true,
|
||||
resolveJsonModule: true,
|
||||
experimentalDecorators: true,
|
||||
incremental: true,
|
||||
rootDir: '.',
|
||||
baseUrl: '.',
|
||||
outDir: path.join(baseOutDir, 'plugins'),
|
||||
paths: {
|
||||
'vj/*': [
|
||||
'../packages/ui-default/*',
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
fs.writeFileSync(path.resolve(process.cwd(), 'plugins', 'tsconfig.json'), JSON.stringify(pluginsConfig));
|
||||
|
||||
for (const package of modules) {
|
||||
const basedir = path.resolve(process.cwd(), package);
|
||||
const files = fs.readdirSync(basedir);
|
||||
|
||||
Reference in new issue
Block a user