chore(backend/dev): remove cli-highlight dependency to reduce memory usage

This commit is contained in:
syuilo 2025-11-24 11:01:00 +09:00
parent 70fa621e22
commit 015e680133
4 changed files with 47 additions and 109 deletions

View File

@ -11,6 +11,7 @@
### Server
- Enhance: `clips/my-favorites` APIがページネーションに対応しました
- Enhance: メモリ使用量を削減しました
## 2025.11.0

View File

@ -110,7 +110,6 @@
"chalk": "5.6.2",
"chalk-template": "1.1.2",
"chokidar": "4.0.3",
"cli-highlight": "2.1.11",
"color-convert": "2.0.1",
"content-disposition": "0.5.4",
"date-fns": "2.30.0",
@ -171,8 +170,8 @@
"rxjs": "7.8.2",
"sanitize-html": "2.17.0",
"secure-json-parse": "3.0.2",
"sharp": "0.33.5",
"semver": "7.7.3",
"sharp": "0.33.5",
"slacc": "0.0.10",
"strict-event-emitter-types": "2.0.0",
"stringz": "2.1.0",

View File

@ -6,7 +6,6 @@
// https://github.com/typeorm/typeorm/issues/2400
import pg from 'pg';
import { DataSource, Logger, type QueryRunner } from 'typeorm';
import * as highlight from 'cli-highlight';
import { entities as charts } from '@/core/chart/entities.js';
import { Config } from '@/config.js';
import MisskeyLogger from '@/logger.js';
@ -25,7 +24,7 @@ import { MiAuthSession } from '@/models/AuthSession.js';
import { MiBlocking } from '@/models/Blocking.js';
import { MiChannelFollowing } from '@/models/ChannelFollowing.js';
import { MiChannelFavorite } from '@/models/ChannelFavorite.js';
import { MiChannelMuting } from "@/models/ChannelMuting.js";
import { MiChannelMuting } from '@/models/ChannelMuting.js';
import { MiClip } from '@/models/Clip.js';
import { MiClipNote } from '@/models/ClipNote.js';
import { MiClipFavorite } from '@/models/ClipFavorite.js';
@ -101,12 +100,6 @@ export type LoggerProps = {
printReplicationMode?: boolean,
};
function highlightSql(sql: string) {
return highlight.highlight(sql, {
language: 'sql', ignoreIllegals: true,
});
}
function truncateSql(sql: string) {
return sql.length > 100 ? `${sql.substring(0, 100)}...` : sql;
}
@ -132,7 +125,7 @@ class MyCustomLogger implements Logger {
modded = truncateSql(modded);
}
return highlightSql(modded);
return modded;
}
@bindThis

View File

@ -213,9 +213,6 @@ importers:
chokidar:
specifier: 4.0.3
version: 4.0.3
cli-highlight:
specifier: 2.1.11
version: 2.1.11
color-convert:
specifier: 2.0.1
version: 2.0.1
@ -5062,9 +5059,6 @@ packages:
resolution: {integrity: sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==}
engines: {node: '>=14'}
any-promise@1.3.0:
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
anymatch@3.1.3:
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
engines: {node: '>= 8'}
@ -5597,11 +5591,6 @@ packages:
resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==}
engines: {node: '>=8'}
cli-highlight@2.1.11:
resolution: {integrity: sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==}
engines: {node: '>=8.0.0', npm: '>=5.0.0'}
hasBin: true
cli-table3@0.6.1:
resolution: {integrity: sha512-w0q/enDHhPLq44ovMGdQeeDLvwxwavsJX7oQGYt/LrBlYsyaxyDnp6z3QzFut/6kLLKnlcUVJLrpB7KBfgG/RA==}
engines: {node: 10.* || >= 12.*}
@ -6963,9 +6952,6 @@ packages:
headers-polyfill@4.0.3:
resolution: {integrity: sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==}
highlight.js@10.7.3:
resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}
highlight.js@11.10.0:
resolution: {integrity: sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==}
engines: {node: '>=12.0.0'}
@ -8273,9 +8259,6 @@ packages:
resolution: {integrity: sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==}
engines: {node: '>=12.0.0'}
mz@2.7.0:
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
nan@2.22.2:
resolution: {integrity: sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==}
@ -8644,21 +8627,12 @@ packages:
parse-srcset@1.0.2:
resolution: {integrity: sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==}
parse5-htmlparser2-tree-adapter@6.0.1:
resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==}
parse5-htmlparser2-tree-adapter@7.1.0:
resolution: {integrity: sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==}
parse5-parser-stream@7.1.2:
resolution: {integrity: sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==}
parse5@5.1.1:
resolution: {integrity: sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==}
parse5@6.0.1:
resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==}
parse5@7.3.0:
resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
@ -10150,13 +10124,6 @@ packages:
textarea-caret@3.1.0:
resolution: {integrity: sha512-cXAvzO9pP5CGa6NKx0WYHl+8CHKZs8byMkt3PCJBCmq2a34YA9pO1NrQET5pzeqnBjBdToF5No4rrmkDUgQC2Q==}
thenify-all@1.6.0:
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
thenify@3.3.1:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
thread-stream@3.1.0:
resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==}
@ -11125,7 +11092,7 @@ snapshots:
'@apm-js-collab/tracing-hooks@0.3.1':
dependencies:
'@apm-js-collab/code-transformer': 0.8.2
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
module-details-from-path: 1.0.4
transitivePeerDependencies:
- supports-color
@ -11959,7 +11926,7 @@ snapshots:
'@babel/types': 7.28.4
'@jridgewell/remapping': 2.3.5
convert-source-map: 2.0.0
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@ -12103,7 +12070,7 @@ snapshots:
'@babel/parser': 7.28.4
'@babel/template': 7.27.2
'@babel/types': 7.28.4
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
transitivePeerDependencies:
- supports-color
@ -12346,7 +12313,7 @@ snapshots:
'@eslint/config-array@0.21.1':
dependencies:
'@eslint/object-schema': 2.1.7
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@ -12362,7 +12329,7 @@ snapshots:
'@eslint/eslintrc@3.3.1':
dependencies:
ajv: 6.12.6
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
espree: 10.4.0
globals: 14.0.0
ignore: 5.3.2
@ -13123,7 +13090,7 @@ snapshots:
dependencies:
agent-base: 7.1.3
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.6(supports-color@10.2.2)
https-proxy-agent: 7.0.6
lru-cache: 10.4.3
socks-proxy-agent: 8.0.5
transitivePeerDependencies:
@ -14792,7 +14759,7 @@ snapshots:
'@tokenizer/inflate@0.2.7':
dependencies:
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
fflate: 0.8.2
token-types: 6.0.0
transitivePeerDependencies:
@ -15191,7 +15158,7 @@ snapshots:
'@typescript-eslint/types': 8.46.2
'@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3)
'@typescript-eslint/visitor-keys': 8.46.2
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
eslint: 9.39.0
typescript: 5.9.3
transitivePeerDependencies:
@ -15201,7 +15168,7 @@ snapshots:
dependencies:
'@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3)
'@typescript-eslint/types': 8.46.2
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
typescript: 5.9.3
transitivePeerDependencies:
- supports-color
@ -15220,7 +15187,7 @@ snapshots:
'@typescript-eslint/types': 8.46.2
'@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3)
'@typescript-eslint/utils': 8.46.2(eslint@9.39.0)(typescript@5.9.3)
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
eslint: 9.39.0
ts-api-utils: 2.1.0(typescript@5.9.3)
typescript: 5.9.3
@ -15235,7 +15202,7 @@ snapshots:
'@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3)
'@typescript-eslint/types': 8.46.2
'@typescript-eslint/visitor-keys': 8.46.2
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
fast-glob: 3.3.3
is-glob: 4.0.3
minimatch: 9.0.5
@ -15589,7 +15556,7 @@ snapshots:
agent-base@6.0.2:
dependencies:
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
transitivePeerDependencies:
- supports-color
optional: true
@ -15691,8 +15658,6 @@ snapshots:
ansis@3.17.0: {}
any-promise@1.3.0: {}
anymatch@3.1.3:
dependencies:
normalize-path: 3.0.0
@ -15885,7 +15850,7 @@ snapshots:
axios@0.24.0:
dependencies:
follow-redirects: 1.15.9(debug@4.4.3)
follow-redirects: 1.15.9
transitivePeerDependencies:
- debug
@ -16329,15 +16294,6 @@ snapshots:
dependencies:
restore-cursor: 3.1.0
cli-highlight@2.1.11:
dependencies:
chalk: 4.1.2
highlight.js: 10.7.3
mz: 2.7.0
parse5: 5.1.1
parse5-htmlparser2-tree-adapter: 6.0.1
yargs: 16.2.0
cli-table3@0.6.1:
dependencies:
string-width: 4.2.3
@ -16714,6 +16670,10 @@ snapshots:
dependencies:
ms: 2.0.0
debug@3.2.7:
dependencies:
ms: 2.1.3
debug@3.2.7(supports-color@8.1.1):
dependencies:
ms: 2.1.3
@ -17173,7 +17133,7 @@ snapshots:
eslint-import-resolver-node@0.3.9:
dependencies:
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
is-core-module: 2.16.1
resolve: 1.22.10
transitivePeerDependencies:
@ -17181,7 +17141,7 @@ snapshots:
eslint-module-utils@2.12.1(@typescript-eslint/parser@8.46.2(eslint@9.39.0)(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint@9.39.0):
dependencies:
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.46.2(eslint@9.39.0)(typescript@5.9.3)
eslint: 9.39.0
@ -17196,7 +17156,7 @@ snapshots:
array.prototype.findlastindex: 1.2.6
array.prototype.flat: 1.3.3
array.prototype.flatmap: 1.3.3
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
doctrine: 2.1.0
eslint: 9.39.0
eslint-import-resolver-node: 0.3.9
@ -17260,7 +17220,7 @@ snapshots:
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.6
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
escape-string-regexp: 4.0.0
eslint-scope: 8.4.0
eslint-visitor-keys: 4.2.1
@ -17683,6 +17643,8 @@ snapshots:
async: 0.2.10
which: 1.3.1
follow-redirects@1.15.9: {}
follow-redirects@1.15.9(debug@4.4.3):
optionalDependencies:
debug: 4.4.3(supports-color@10.2.2)
@ -18021,8 +17983,6 @@ snapshots:
headers-polyfill@4.0.3: {}
highlight.js@10.7.3: {}
highlight.js@11.10.0: {}
hosted-git-info@2.8.9: {}
@ -18088,7 +18048,7 @@ snapshots:
http-proxy-agent@7.0.2:
dependencies:
agent-base: 7.1.3
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
transitivePeerDependencies:
- supports-color
@ -18108,7 +18068,7 @@ snapshots:
https-proxy-agent@2.2.4:
dependencies:
agent-base: 4.3.0
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
transitivePeerDependencies:
- supports-color
optional: true
@ -18116,11 +18076,18 @@ snapshots:
https-proxy-agent@5.0.1:
dependencies:
agent-base: 6.0.2
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
transitivePeerDependencies:
- supports-color
optional: true
https-proxy-agent@7.0.6:
dependencies:
agent-base: 7.1.3
debug: 4.4.3(supports-color@5.5.0)
transitivePeerDependencies:
- supports-color
https-proxy-agent@7.0.6(supports-color@10.2.2):
dependencies:
agent-base: 7.1.3
@ -18224,7 +18191,7 @@ snapshots:
dependencies:
'@ioredis/commands': 1.4.0
cluster-key-slot: 1.1.2
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
denque: 2.1.0
lodash.defaults: 4.2.0
lodash.isarguments: 3.1.0
@ -18458,7 +18425,7 @@ snapshots:
istanbul-lib-source-maps@4.0.1:
dependencies:
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
istanbul-lib-coverage: 3.2.2
source-map: 0.6.1
transitivePeerDependencies:
@ -18856,7 +18823,7 @@ snapshots:
decimal.js: 10.5.0
html-encoding-sniffer: 4.0.0
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.6(supports-color@10.2.2)
https-proxy-agent: 7.0.6
is-potential-custom-element-name: 1.0.1
nwsapi: 2.2.16
parse5: 7.3.0
@ -19701,12 +19668,6 @@ snapshots:
mylas@2.1.13: {}
mz@2.7.0:
dependencies:
any-promise: 1.3.0
object-assign: 4.1.1
thenify-all: 1.6.0
nan@2.22.2: {}
nanoid@3.3.11: {}
@ -19722,7 +19683,7 @@ snapshots:
needle@2.9.1:
dependencies:
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
iconv-lite: 0.4.24
sax: 1.4.1
transitivePeerDependencies:
@ -20086,10 +20047,6 @@ snapshots:
parse-srcset@1.0.2: {}
parse5-htmlparser2-tree-adapter@6.0.1:
dependencies:
parse5: 6.0.1
parse5-htmlparser2-tree-adapter@7.1.0:
dependencies:
domhandler: 5.0.3
@ -20099,10 +20056,6 @@ snapshots:
dependencies:
parse5: 7.3.0
parse5@5.1.1: {}
parse5@6.0.1: {}
parse5@7.3.0:
dependencies:
entities: 6.0.1
@ -20884,7 +20837,7 @@ snapshots:
require-in-the-middle@7.3.0:
dependencies:
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
module-details-from-path: 1.0.4
resolve: 1.22.10
transitivePeerDependencies:
@ -21228,7 +21181,7 @@ snapshots:
dependencies:
'@hapi/hoek': 11.0.7
'@hapi/wreck': 18.0.1
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
joi: 17.13.3
transitivePeerDependencies:
- supports-color
@ -21328,7 +21281,7 @@ snapshots:
socks-proxy-agent@8.0.5:
dependencies:
agent-base: 7.1.3
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
socks: 2.8.4
transitivePeerDependencies:
- supports-color
@ -21628,7 +21581,7 @@ snapshots:
dependencies:
component-emitter: 1.3.1
cookiejar: 2.1.4
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
fast-safe-stringify: 2.1.1
form-data: 4.0.4
formidable: 3.5.4
@ -21748,14 +21701,6 @@ snapshots:
textarea-caret@3.1.0: {}
thenify-all@1.6.0:
dependencies:
thenify: 3.3.1
thenify@3.3.1:
dependencies:
any-promise: 1.3.0
thread-stream@3.1.0:
dependencies:
real-require: 0.2.0
@ -21984,7 +21929,7 @@ snapshots:
app-root-path: 3.1.0
buffer: 6.0.3
dayjs: 1.11.18
debug: 4.4.3(supports-color@10.2.2)
debug: 4.4.3(supports-color@5.5.0)
dedent: 1.6.0
dotenv: 16.4.7
glob: 10.4.5
@ -22390,7 +22335,7 @@ snapshots:
dependencies:
asn1.js: 5.4.1
http_ece: 1.2.0
https-proxy-agent: 7.0.6(supports-color@10.2.2)
https-proxy-agent: 7.0.6
jws: 4.0.0
minimist: 1.2.8
transitivePeerDependencies: