From 591dbd31c00ac54aa0381a85eed375c25f6bd829 Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 25 Jul 2026 11:25:38 +0000 Subject: [PATCH] core: fix js-yaml options --- framework/framework/package.json | 6 +++--- framework/utils/package.json | 6 +++--- package.json | 2 +- packages/components/package.json | 4 ++-- packages/hydrooj/package.json | 6 +++--- packages/hydrooj/src/commands/diagnosis.ts | 4 ++-- packages/hydrooj/src/service/monitor.ts | 8 ++------ .../components/problemconfig/ProblemConfigEditor.tsx | 6 +++--- packages/ui-default/package.json | 12 ++++++------ 9 files changed, 25 insertions(+), 29 deletions(-) diff --git a/framework/framework/package.json b/framework/framework/package.json index a184ce0f4..f5ba8ab0b 100644 --- a/framework/framework/package.json +++ b/framework/framework/package.json @@ -10,12 +10,12 @@ "dependencies": { "@hydrooj/utils": "workspace:^", "@koa/router": "^15.7.0", - "@mongodb-js/saslprep": "^1.4.12", + "@mongodb-js/saslprep": "^1.4.13", "emoji-regex": "^10.6.0", - "fs-extra": "^11.3.6", + "fs-extra": "^11.4.0", "koa": "^3.2.1", "koa-body": "^8.0.0", - "koa-compress": "5.2.1", + "koa-compress": "5.2.2", "path-to-regexp": "^8.4.2", "sanitize-filename": "^1.6.4", "schemastery": "^3.18.0", diff --git a/framework/utils/package.json b/framework/utils/package.json index c7ac33d4c..02d92ccb2 100644 --- a/framework/utils/package.json +++ b/framework/utils/package.json @@ -15,11 +15,11 @@ "dependencies": { "@hydrooj/register": "workspace:^", "cac": "^7.0.0", - "fs-extra": "^11.3.6", - "js-yaml": "^5.2.1", + "fs-extra": "^11.4.0", + "js-yaml": "^5.2.2", "reggol": "^2.1.0", "search-query-parser": "^1.6.0", - "systeminformation": "^5.33.0" + "systeminformation": "^5.33.1" }, "devDependencies": { "@types/fs-extra": "^11.0.4" diff --git a/package.json b/package.json index d2cf294c8..abddd4bb9 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "eslint": "^9.39.5", "eslint-import-resolver-typescript": "^4.4.5", "eslint-import-resolver-webpack": "^0.13.11", - "fs-extra": "^11.3.6", + "fs-extra": "^11.4.0", "globals": "^17.7.0", "globby": "~14.0.2", "inspectpack": "^4.7.1", diff --git a/packages/components/package.json b/packages/components/package.json index 1d3fad2d2..038f44661 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -10,7 +10,7 @@ "dependencies": { "allotment": "^1.20.5", "diff": "^9.0.0", - "js-yaml": "^5.2.1", + "js-yaml": "^5.2.2", "lodash": "^4.18.1", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", @@ -21,7 +21,7 @@ "@types/diff": "^8.0.0", "@types/js-yaml": "^4.0.9", "@types/lodash": "^4.17.24", - "sass": "^1.101.4" + "sass": "^1.101.7" }, "peerDependencies": { "react": "*", diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 37511570a..2895a0103 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -22,7 +22,7 @@ "@hydrooj/common": "workspace:^", "@hydrooj/framework": "workspace:^", "@hydrooj/utils": "workspace:^", - "@mongodb-js/saslprep": "^1.4.12", + "@mongodb-js/saslprep": "^1.4.13", "@simplewebauthn/server": "13.2.2", "@undefined-moe/require-resolve-hook": "^1.1.0", "@zip.js/zip.js": "^2.8.34", @@ -32,8 +32,8 @@ "csv-stringify": "^6.8.1", "emoji-regex": "^10.6.0", "emojis-list": "2.1.0", - "fs-extra": "^11.3.6", - "js-yaml": "^5.2.1", + "fs-extra": "^11.4.0", + "js-yaml": "^5.2.2", "koa-proxies": "^0.12.4", "koa-static-cache": "^5.1.4", "lodash": "^4.18.1", diff --git a/packages/hydrooj/src/commands/diagnosis.ts b/packages/hydrooj/src/commands/diagnosis.ts index 8bee00e34..22538d267 100644 --- a/packages/hydrooj/src/commands/diagnosis.ts +++ b/packages/hydrooj/src/commands/diagnosis.ts @@ -113,10 +113,10 @@ ${padEnd(formatSeconds(Math.floor((Date.now() - i.pm2_env.pm_uptime) / 1000), fa infoDetails['now'] = new Date().toISOString(); infos['now'] = new Date().toISOString(); logger.info('System info:'); - console.log(yaml.dump(infos, { noCompatMode: true, noArrayIndent: true, lineWidth: process.stdout.columns || 80 })); + console.log(yaml.dump(infos, { schema: yaml.CORE_SCHEMA, seqNoIndent: true, lineWidth: process.stdout.columns || 80 })); logger.info('Uploading detail to pastebin...'); const tmpFile = path.join(tmpdir(), 'report.yaml'); - fs.writeFileSync(tmpFile, yaml.dump(infoDetails, { noArrayIndent: true, lineWidth: 300 })); + fs.writeFileSync(tmpFile, yaml.dump(infoDetails, { seqNoIndent: true, lineWidth: 300 })); if (process.env.VSCODE_INJECTION) { try { child.exec(`code ${tmpFile}`); diff --git a/packages/hydrooj/src/service/monitor.ts b/packages/hydrooj/src/service/monitor.ts index 82c240a7c..cb2ac5d07 100644 --- a/packages/hydrooj/src/service/monitor.ts +++ b/packages/hydrooj/src/service/monitor.ts @@ -1,4 +1,5 @@ import { dump } from 'js-yaml'; +import { cloneDeepWith } from 'lodash'; import superagent from 'superagent'; import type { StatusUpdate } from '@hydrooj/utils/lib/sysinfo'; import * as sysinfo from '@hydrooj/utils/lib/sysinfo'; @@ -55,12 +56,7 @@ export async function feedback(): Promise<[string, StatusUpdate]> { info.dbVersion = status.version; } catch (e) { } await bus.serial('monitor/collect', info); - const payload = dump(info, { - replacer: (key, value) => { - if (typeof value === 'function') return ''; - return value; - }, - }); + const payload = dump(cloneDeepWith(info, (value) => typeof value === 'function' ? '' : undefined)); if (process.env.CI) return [mid, $update]; superagent.post(`${system.get('server.center')}/report`) .send({ installId, payload }) diff --git a/packages/ui-default/components/problemconfig/ProblemConfigEditor.tsx b/packages/ui-default/components/problemconfig/ProblemConfigEditor.tsx index ca8672358..28322ece8 100644 --- a/packages/ui-default/components/problemconfig/ProblemConfigEditor.tsx +++ b/packages/ui-default/components/problemconfig/ProblemConfigEditor.tsx @@ -98,7 +98,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e async componentDidMount() { const { monaco } = await load(['yaml']); const uri = monaco.Uri.parse('hydro://problem/file/config.yaml'); - this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config), { noArrayIndent: true }), 'yaml', uri); + this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config), { seqNoIndent: true }), 'yaml', uri); this.vjEditor = Editor.getOrConstruct($(this.containerElement), { language: 'yaml', model: this.model, @@ -114,7 +114,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e componentDidUpdate(prevProps) { if (this.__preventUpdate || !this.model || !this.props.config.__valid) return; - if (yaml.dump(prevProps.config, { noArrayIndent: true }) === yaml.dump(this.props.config, { noArrayIndent: true })) return; + if (yaml.dump(prevProps.config, { seqNoIndent: true }) === yaml.dump(this.props.config, { seqNoIndent: true })) return; const curValue = this.model.getValue(); const pending = configYamlFormat(this.props.config); try { @@ -122,7 +122,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e if (isEqual(curConfig, pending)) return; } catch { } this.__preventFormat = true; - const diff = diffLines(curValue, yaml.dump(pending, { noArrayIndent: true })); + const diff = diffLines(curValue, yaml.dump(pending, { seqNoIndent: true })); const ops = []; let cursor = 1; for (const line of diff) { diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index f8a8e2138..955f30139 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -23,7 +23,7 @@ "@mantine/core": "^9.4.2", "@mantine/hooks": "^9.4.2", "@mantine/notifications": "^9.4.2", - "@sentry/browser": "^10.67.0", + "@sentry/browser": "^10.68.0", "@sentry/webpack-plugin": "^5.4.0", "@simplewebauthn/browser": "13.2.2", "@svgr/webpack": "^8.1.0", @@ -60,7 +60,7 @@ "echarts": "^6.1.0", "emojis-keywords": "2.0.0", "emojis-list": "2.1.0", - "esbuild-loader": "^4.4.3", + "esbuild-loader": "^4.5.0", "flatpickr": "^4.6.13", "idb": "^8.0.3", "jquery": "^3.7.1", @@ -99,7 +99,7 @@ "redux-promise-middleware": "^6.2.0", "redux-thunk": "^3.1.0", "rupture": "^0.7.1", - "sass": "^1.101.4", + "sass": "^1.101.7", "sass-loader": "^16.0.8", "schemastery": "^3.18.0", "shorty.js": "^1.0.1", @@ -114,7 +114,7 @@ "timeago.js": "^4.0.2", "ts-loader": "^9.6.2", "web-streams-polyfill": "^4.3.0", - "webpack": "^5.108.4", + "webpack": "^5.109.0", "webpack-bundle-analyzer": "^5.3.1", "webpack-dev-server": "^6.0.0", "webpack-manifest-plugin": "^6.0.1", @@ -125,9 +125,9 @@ "ansi_up": "^6.0.6", "cssfilter": "^0.0.11", "esbuild": "0.25.2", - "fs-extra": "^11.3.6", + "fs-extra": "^11.4.0", "html-to-text": "^10.0.0", - "js-yaml": "^5.2.1", + "js-yaml": "^5.2.2", "jsesc": "^3.1.0", "katex": "^0.18.1", "lodash": "^4.18.1",