mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix build errors
This commit is contained in:
1 parent
1608b4b9aa
commit
7f96f602ce
11 files changed
+22
-16
No files matched your search
+4
-1
@@ -40,10 +40,13 @@ const configFlat = (name) => (name === 'packages/ui-default' ? {
|
|||||||
exclude: [
|
exclude: [
|
||||||
'./public',
|
'./public',
|
||||||
],
|
],
|
||||||
|
include: ['**/*.ts'],
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
|
experimentalDecorators: true,
|
||||||
resolveJsonModule: true,
|
resolveJsonModule: true,
|
||||||
jsx: 'react',
|
jsx: 'react',
|
||||||
module: 'es2020',
|
module: 'commonjs',
|
||||||
|
skipLibCheck: true,
|
||||||
allowSyntheticDefaultImports: true,
|
allowSyntheticDefaultImports: true,
|
||||||
target: 'es2020',
|
target: 'es2020',
|
||||||
baseUrl: '.',
|
baseUrl: '.',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|||||||
import WebpackBar from 'webpackbar';
|
import WebpackBar from 'webpackbar';
|
||||||
import root from '../utils/root';
|
import root from '../utils/root';
|
||||||
|
|
||||||
export default function (env: { production?: boolean, measure?: boolean } = {}) {
|
export default function (env: { watch?: boolean, production?: boolean, measure?: boolean } = {}) {
|
||||||
function esbuildLoader() {
|
function esbuildLoader() {
|
||||||
return {
|
return {
|
||||||
loader: 'esbuild-loader',
|
loader: 'esbuild-loader',
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export const config = {
|
|||||||
theme: {
|
theme: {
|
||||||
// eslint-disable-next-line no-template-curly-in-string
|
// eslint-disable-next-line no-template-curly-in-string
|
||||||
path: `${UiContext.cdn_prefix}vditor/dist/css/content-theme`,
|
path: `${UiContext.cdn_prefix}vditor/dist/css/content-theme`,
|
||||||
|
current: 'light',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ const endpoint = url.toString().replace('http', 'ws');
|
|||||||
|
|
||||||
const initWorkerMode = () => {
|
const initWorkerMode = () => {
|
||||||
console.log('Messages: using SharedWorker');
|
console.log('Messages: using SharedWorker');
|
||||||
|
// @ts-ignore
|
||||||
const worker = new SharedWorker(new URL('./worker?inline', import.meta.url), { name: 'HydroMessagesWorker' });
|
const worker = new SharedWorker(new URL('./worker?inline', import.meta.url), { name: 'HydroMessagesWorker' });
|
||||||
worker.port.start();
|
worker.port.start();
|
||||||
window.addEventListener('beforeunload', () => {
|
window.addEventListener('beforeunload', () => {
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ function ExtraFilesConfig() {
|
|||||||
|
|
||||||
function LangConfig() {
|
function LangConfig() {
|
||||||
const langs = useSelector((state: RootState) => state.config.langs) || [];
|
const langs = useSelector((state: RootState) => state.config.langs) || [];
|
||||||
const prefixes = new Set(Object.keys(LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
const prefixes = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||||
const data = Object.keys(LANGS).filter((i) => !prefixes.has(i))
|
const data = Object.keys(window.LANGS).filter((i) => !prefixes.has(i))
|
||||||
.map((i) => ({ name: LANGS[i].display, _id: i }));
|
.map((i) => ({ name: window.LANGS[i].display, _id: i }));
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const ref = React.useRef<any>();
|
const ref = React.useRef<any>();
|
||||||
const selectedKeys = langs.filter((i) => !prefixes.has(i));
|
const selectedKeys = langs.filter((i) => !prefixes.has(i));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Card, NumericInput, Tag } from '@blueprintjs/core';
|
import { Card, NumericInput, Tag } from '@blueprintjs/core';
|
||||||
import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common';
|
import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common';
|
||||||
import { SubtaskConfig } from 'hydrooj/src/interface';
|
import type { SubtaskConfig } from 'hydrooj/src/interface';
|
||||||
import { isEqual, pick } from 'lodash';
|
import { isEqual, pick } from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ declare module 'hydrooj' {
|
|||||||
'ui-default.nav_logo_dark_2x': string;
|
'ui-default.nav_logo_dark_2x': string;
|
||||||
}
|
}
|
||||||
interface UiContextBase {
|
interface UiContextBase {
|
||||||
nav_logo_dark: string;
|
nav_logo_dark?: string;
|
||||||
nav_logo_dark_2x: string;
|
nav_logo_dark_2x?: string;
|
||||||
constantVersion: string;
|
constantVersion?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"@types/redux-logger": "^3.0.9",
|
"@types/redux-logger": "^3.0.9",
|
||||||
"@types/serviceworker": "^0.0.51",
|
"@types/serviceworker": "^0.0.51",
|
||||||
"@types/sharedworker": "^0.0.80",
|
"@types/sharedworker": "^0.0.80",
|
||||||
|
"@types/webpack-env": "^1.18.0",
|
||||||
"@vscode/codicons": "^0.0.32",
|
"@vscode/codicons": "^0.0.32",
|
||||||
"autoprefixer": "^10.4.8",
|
"autoprefixer": "^10.4.8",
|
||||||
"browser-update": "^3.3.40",
|
"browser-update": "^3.3.40",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { normalizeSubtasks, readSubtasksFromFiles, size } from '@hydrooj/utils/lib/common';
|
import { normalizeSubtasks, readSubtasksFromFiles, size } from '@hydrooj/utils/lib/common';
|
||||||
import { SubtaskType } from 'hydrooj/src/interface';
|
import type { SubtaskType } from 'hydrooj/src/interface';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const target = [
|
|||||||
'https://us.hydro.ac',
|
'https://us.hydro.ac',
|
||||||
];
|
];
|
||||||
|
|
||||||
this.addEventListener('install', () => {
|
(this as any).addEventListener('install', () => {
|
||||||
console.log('Service Worker installing');
|
console.log('Service Worker installing');
|
||||||
});
|
});
|
||||||
async function get(url) {
|
async function get(url) {
|
||||||
@@ -23,7 +23,7 @@ async function get(url) {
|
|||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
this.addEventListener('fetch', (event) => {
|
(this as any).addEventListener('fetch', (event) => {
|
||||||
// eslint-disable-next-line no-restricted-globals
|
// eslint-disable-next-line no-restricted-globals
|
||||||
if (new URL(event.request.url).origin !== location.origin) return;
|
if (new URL(event.request.url).origin !== location.origin) return;
|
||||||
event.respondWith(get(event.request.url));
|
event.respondWith(get(event.request.url));
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
const prefixes = new Set(Object.keys(LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
const prefixes = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||||
|
|
||||||
export default function getAvailableLangs(langsList?: string[]) {
|
export default function getAvailableLangs(langsList?: string[]) {
|
||||||
const Langs = {};
|
const Langs = {};
|
||||||
for (const key in LANGS) {
|
for (const key in window.LANGS) {
|
||||||
if (prefixes.has(key)) continue;
|
if (prefixes.has(key)) continue;
|
||||||
if (langsList && langsList.length && langsList.join('') && !langsList.includes(key)) continue;
|
if (langsList && langsList.length && langsList.join('') && !langsList.includes(key)) continue;
|
||||||
else if (LANGS[key].hidden && !langsList?.includes(key)) continue;
|
else if (window.LANGS[key].hidden && !langsList?.includes(key)) continue;
|
||||||
Langs[key] = LANGS[key];
|
Langs[key] = window.LANGS[key];
|
||||||
}
|
}
|
||||||
return Langs;
|
return Langs;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user