chore(backend): remove jsdom

This commit is contained in:
syuilo
2025-11-29 19:55:52 +09:00
parent 2732034447
commit 2effd9da6e
3 changed files with 23 additions and 130 deletions

View File

@@ -202,7 +202,6 @@
"@types/http-link-header": "1.0.7",
"@types/jest": "29.5.14",
"@types/js-yaml": "4.0.9",
"@types/jsdom": "21.1.7",
"@types/jsonld": "1.5.15",
"@types/jsrsasign": "10.5.15",
"@types/mime-types": "2.1.4",
@@ -237,7 +236,6 @@
"fkill": "9.0.0",
"jest": "29.7.0",
"jest-mock": "29.7.0",
"jsdom": "26.1.0",
"nodemon": "3.1.11",
"pid-port": "1.0.2",
"simple-oauth2": "5.1.0",

View File

@@ -10,8 +10,8 @@ import { randomUUID } from 'node:crypto';
import { inspect } from 'node:util';
import WebSocket, { ClientOptions } from 'ws';
import fetch, { File, RequestInit, type Headers } from 'node-fetch';
import * as htmlParser from 'node-html-parser';
import { DataSource } from 'typeorm';
import { JSDOM } from 'jsdom';
import { type Response } from 'node-fetch';
import Fastify from 'fastify';
import { entities } from '../src/postgres.js';
@@ -468,7 +468,7 @@ export function makeStreamCatcher<T>(
export type SimpleGetResponse = {
status: number,
body: any | JSDOM | null,
body: any | htmlParser.HTMLElement | null,
type: string | null,
location: string | null
};
@@ -499,7 +499,7 @@ export const simpleGet = async (path: string, accept = '*/*', cookie: any = unde
const body =
jsonTypes.includes(res.headers.get('content-type') ?? '') ? await res.json() :
htmlTypes.includes(res.headers.get('content-type') ?? '') ? new JSDOM(await res.text()) :
htmlTypes.includes(res.headers.get('content-type') ?? '') ? htmlParser.parse(await res.text()) :
await bodyExtractor(res);
return {