From c7afe7a3de5f14f2ce35f791112c7ad9fc7bfc21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Fri, 1 Feb 2019 19:41:13 +0900 Subject: [PATCH] Module 'parse5' as import syntax (#4015) --- package.json | 1 + src/mfm/fromHtml.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 121ecec2a..7f23d033a 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@types/nodemailer": "4.6.5", "@types/nprogress": "0.0.29", "@types/oauth": "0.9.1", + "@types/parse5": "5.0.0", "@types/parsimmon": "1.10.0", "@types/portscanner": "2.1.0", "@types/pug": "2.0.4", diff --git a/src/mfm/fromHtml.ts b/src/mfm/fromHtml.ts index b6e0546bc..2adaf0137 100644 --- a/src/mfm/fromHtml.ts +++ b/src/mfm/fromHtml.ts @@ -1,10 +1,10 @@ -const parse5 = require('parse5'); +import { parseFragment, DefaultTreeDocumentFragment } from 'parse5'; import { URL } from 'url'; export function fromHtml(html: string): string { if (html == null) return null; - const dom = parse5.parseFragment(html); + const dom = parseFragment(html) as DefaultTreeDocumentFragment; let text = '';