mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
build: upgrade to TypeScript 6
This commit is contained in:
1 parent
87f64d60fd
commit
f050b0cc5d
6 files changed
+16
-14
No files matched your search
+4
-4
@@ -13,10 +13,11 @@ const withoutTypes = (data) => ({
|
||||
compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')),
|
||||
});
|
||||
|
||||
/** @type {import('typescript/lib/typescript').CompilerOptions} */
|
||||
/** @type {import('typescript').CompilerOptions} */
|
||||
const compilerOptionsBase = {
|
||||
target: 'es2022',
|
||||
lib: ['esnext'],
|
||||
lib: ['esnext', 'DOM'],
|
||||
types: ['node'],
|
||||
module: 'preserve',
|
||||
esModuleInterop: true,
|
||||
moduleResolution: 'bundler',
|
||||
@@ -103,9 +104,9 @@ const UIConfig = {
|
||||
module: 'ESNext',
|
||||
skipLibCheck: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
baseUrl: '.',
|
||||
jsx: 'react-jsx',
|
||||
outDir: path.join(baseOutDir, 'ui'),
|
||||
types: ['node', 'webpack-env'],
|
||||
|
||||
useDefineForClassFields: true,
|
||||
lib: ['esnext', 'DOM', 'DOM.Iterable'],
|
||||
@@ -187,7 +188,6 @@ const pluginsConfig = {
|
||||
compilerOptions: {
|
||||
...compilerOptionsBase,
|
||||
rootDir: '.',
|
||||
baseUrl: '.',
|
||||
outDir: path.join(baseOutDir, 'plugins'),
|
||||
skipLibCheck: true,
|
||||
paths: {
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
"eslint": ">= 9"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"typescript": "^5.9.3"
|
||||
"typescript": "6.0.3"
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -37,7 +37,7 @@
|
||||
"@types/autocannon": "^7.12.7",
|
||||
"@types/chai": "^5.2.3",
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
"@types/node": "24.10.13",
|
||||
"@types/node": "24.13.3",
|
||||
"@types/semver": "^7.8.0",
|
||||
"autocannon": "^8.0.0",
|
||||
"cac": "^7.0.0",
|
||||
@@ -61,7 +61,7 @@
|
||||
"simple-git": "^3.36.0",
|
||||
"supertest": "^7.2.2",
|
||||
"supports-hyperlinks": "^4.5.0",
|
||||
"typescript": "5.8.3",
|
||||
"typescript": "6.0.3",
|
||||
"wtfnode": "^0.10.1"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* eslint-disable regexp/no-useless-non-capturing-group */
|
||||
/* eslint-disable regexp/optimal-quantifier-concatenation */
|
||||
|
||||
import type MarkdownIt from 'markdown-it';
|
||||
import type { MarkdownIt } from 'markdown-it';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
const allowFullScreen = ' webkitallowfullscreen mozallowfullscreen allowfullscreen';
|
||||
@@ -103,8 +103,8 @@ declare module 'hydrooj' {
|
||||
export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boolean } = {}) {
|
||||
const supported = ['youtube', 'vimeo', 'vine', 'prezi', 'bilibili', 'youku', 'msoffice'];
|
||||
md.renderer.rules.video = function tokenizeReturn(tokens, idx) {
|
||||
const src = tokens[idx].attrGet('src');
|
||||
const service = tokens[idx].attrGet('service').replace(/[^A-Z0-9]/gi, '').toLowerCase();
|
||||
const src = (tokens[idx].attrGet('src') ?? '').toString();
|
||||
const service = (tokens[idx].attrGet('service') ?? '').toString().replace(/[^A-Z0-9]/gi, '').toLowerCase();
|
||||
if (Hydro?.module?.richmedia?.[service]) {
|
||||
const result = Hydro?.module?.richmedia[service].get(service, src, md);
|
||||
if (result) return result;
|
||||
@@ -138,7 +138,7 @@ export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boo
|
||||
return `\
|
||||
<iframe class="embed-responsive-item ${service}-player" type="text/html" \
|
||||
width="100%" style="min-height: 500px" ${allowFullScreen} \
|
||||
src="${md.utils.escapeHtml(resourceUrl(service, src, tokens[idx].attrGet('url')))}"
|
||||
src="${md.utils.escapeHtml(resourceUrl(service, src, (tokens[idx].attrGet('url') ?? '').toString()))}"
|
||||
scrolling="no" border="0" frameborder="no" framespacing="0"></iframe>`;
|
||||
}
|
||||
return `<div data-${service}>${md.utils.escapeHtml(src)}</div>`;
|
||||
|
||||
@@ -119,7 +119,8 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
|
||||
// @ts-ignore
|
||||
.transition(
|
||||
{ opacity: 1 },
|
||||
{ duration: 200, easing: 'easeOutCubic' },
|
||||
200,
|
||||
'easeOutCubic',
|
||||
)
|
||||
.promise();
|
||||
}
|
||||
@@ -129,7 +130,8 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
|
||||
// @ts-ignore
|
||||
.transition(
|
||||
{ opacity: 0 },
|
||||
{ duration: 200, easing: 'easeOutCubic' },
|
||||
200,
|
||||
'easeOutCubic',
|
||||
)
|
||||
.promise();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
declare module 'superagent' {
|
||||
interface Request {
|
||||
proxy: (url: string) => this;
|
||||
proxy(url: string): this;
|
||||
}
|
||||
}
|
||||
export default {};
|
||||
Reference in new issue
Block a user