diff --git a/src/@types/IComment.ts b/src/@types/IComment.ts index d6d57549..e37d2421 100755 --- a/src/@types/IComment.ts +++ b/src/@types/IComment.ts @@ -1,5 +1,9 @@ -import type { CommentLoc, FormattedCommentWithSize, Position } from "@/@types/"; -import type { IRenderer } from "@/@types/renderer"; +import type { + CommentLoc, + FormattedCommentWithSize, + IRenderer, + Position, +} from "@/@types/"; export interface IComment { comment: FormattedCommentWithSize; diff --git a/src/@types/IPlugins.ts b/src/@types/IPlugins.ts index 3f54e157..767c50e4 100755 --- a/src/@types/IPlugins.ts +++ b/src/@types/IPlugins.ts @@ -1,5 +1,4 @@ -import type { IComment } from "@/@types/"; -import type { IRenderer } from "@/@types/renderer"; +import type { IComment, IRenderer } from "@/@types/"; export interface IPluginConstructor { id: string; diff --git a/src/@types/index.ts b/src/@types/index.ts index 67dd24ae..2ef55587 100644 --- a/src/@types/index.ts +++ b/src/@types/index.ts @@ -9,6 +9,7 @@ export * from "./format.formatted"; export * from "./format.legacy"; export * from "./format.owner"; export * from "./format.v1"; +export * from "./format.xml2js"; export * from "./IComment"; export * from "./input-parser"; export * from "./IPlugins"; diff --git a/src/@types/input-parser.ts b/src/@types/input-parser.ts index 57cf8473..74e3cea1 100644 --- a/src/@types/input-parser.ts +++ b/src/@types/input-parser.ts @@ -1,4 +1,4 @@ -import type { FormattedComment } from "@/@types/format.formatted"; +import type { FormattedComment } from "@/@types/"; export interface InputParser { key: string[]; diff --git a/src/@types/options.ts b/src/@types/options.ts index 0087ba76..3cfae1be 100755 --- a/src/@types/options.ts +++ b/src/@types/options.ts @@ -8,8 +8,8 @@ import type { OwnerComment, RawApiResponse, V1Thread, + Xml2jsPacket, } from "@/@types/"; -import type { Xml2jsPacket } from "@/@types/format.xml2js"; export const ZInputFormatType = union([ literal("XMLDocument"), diff --git a/src/comments/BaseComment.ts b/src/comments/BaseComment.ts index 8d0d4bfa..b8ed7c2d 100755 --- a/src/comments/BaseComment.ts +++ b/src/comments/BaseComment.ts @@ -3,12 +3,12 @@ import type { FormattedCommentWithFont, FormattedCommentWithSize, IComment, + IRenderer, MeasureTextInput, MeasureTextResult, ParseContentResult, Position, } from "@/@types/"; -import type { IRenderer } from "@/@types/renderer"; import { imageCache } from "@/contexts"; import { isDebug } from "@/contexts/debug"; import { config } from "@/definition/config"; diff --git a/src/comments/FlashComment.ts b/src/comments/FlashComment.ts index 0d9f2a39..da236e92 100755 --- a/src/comments/FlashComment.ts +++ b/src/comments/FlashComment.ts @@ -5,11 +5,11 @@ import type { FormattedComment, FormattedCommentWithFont, FormattedCommentWithSize, + IRenderer, MeasureTextInput, MeasureTextResult, Position, } from "@/@types/"; -import type { IRenderer } from "@/@types/renderer"; import { config, options } from "@/definition/config"; import { TypeGuardError } from "@/errors/TypeGuardError"; import typeGuard from "@/typeGuard"; diff --git a/src/comments/HTML5Comment.ts b/src/comments/HTML5Comment.ts index e9ed0c37..8084f812 100755 --- a/src/comments/HTML5Comment.ts +++ b/src/comments/HTML5Comment.ts @@ -4,10 +4,10 @@ import type { FormattedCommentWithFont, FormattedCommentWithSize, HTML5Fonts, + IRenderer, MeasureTextInput, MeasureTextResult, } from "@/@types/"; -import type { IRenderer } from "@/@types/renderer"; import { config, options } from "@/definition/config"; import { TypeGuardError } from "@/errors/TypeGuardError"; import typeGuard from "@/typeGuard"; diff --git a/src/contexts/cache.ts b/src/contexts/cache.ts index 652b64ec..fc84b459 100755 --- a/src/contexts/cache.ts +++ b/src/contexts/cache.ts @@ -1,4 +1,4 @@ -import type { IRenderer } from "@/@types/renderer"; +import type { IRenderer } from "@/@types/"; let imageCache: { [key: string]: { image: IRenderer; timeout: number }; diff --git a/src/input/xml2js.ts b/src/input/xml2js.ts index 932aa36f..043c47d6 100644 --- a/src/input/xml2js.ts +++ b/src/input/xml2js.ts @@ -1,8 +1,7 @@ import { parse } from "valibot"; -import type { FormattedComment, InputParser } from "@/@types"; -import type { Xml2jsPacket } from "@/@types/format.xml2js"; -import { ZXml2jsPacket } from "@/@types/format.xml2js"; +import type { FormattedComment, InputParser, Xml2jsPacket } from "@/@types"; +import { ZXml2jsPacket } from "@/@types/"; export const Xml2jsParser: InputParser = { key: ["xml2js"], diff --git a/src/main.ts b/src/main.ts index c92ba61a..2e8c70a8 100755 --- a/src/main.ts +++ b/src/main.ts @@ -5,11 +5,11 @@ import type { IComment, InputFormat, IPluginList, + IRenderer, Options, Position, Timeline, } from "@/@types/"; -import type { IRenderer } from "@/@types/renderer"; import { FlashComment } from "@/comments/"; import { plugins, diff --git a/src/renderer/canvas.ts b/src/renderer/canvas.ts index 6176741a..4350b951 100644 --- a/src/renderer/canvas.ts +++ b/src/renderer/canvas.ts @@ -1,4 +1,4 @@ -import type { IRenderer } from "@/@types/renderer"; +import type { IRenderer } from "@/@types/"; import { CanvasRenderingContext2DError } from "@/errors"; /** diff --git a/src/typeGuard.ts b/src/typeGuard.ts index d88f17ae..2aff244b 100755 --- a/src/typeGuard.ts +++ b/src/typeGuard.ts @@ -34,6 +34,9 @@ import type { RawApiResponse, V1Comment, V1Thread, + Xml2jsChat, + Xml2jsChatItem, + Xml2jsPacket, } from "@/@types/"; import { ZApiChat, @@ -58,6 +61,9 @@ import { ZRawApiResponse, ZV1Comment, ZV1Thread, + ZXml2jsChat, + ZXml2jsChatItem, + ZXml2jsPacket, } from "@/@types/"; import { colors } from "@/definition/colors"; @@ -117,6 +123,11 @@ const typeGuard = { } return true; }, + xml2js: { + packet: (i: unknown): i is Xml2jsPacket => is(ZXml2jsPacket, i), + chat: (i: unknown): i is Xml2jsChat => is(ZXml2jsChat, i), + chatItem: (i: unknown): i is Xml2jsChatItem => is(ZXml2jsChatItem, i), + }, legacyOwner: { comments: (i: unknown): i is string => is( diff --git a/src/utils/border.ts b/src/utils/border.ts index 424f34ac..04e7386a 100644 --- a/src/utils/border.ts +++ b/src/utils/border.ts @@ -1,4 +1,4 @@ -import type { IRenderer } from "@/@types/renderer"; +import type { IRenderer } from "@/@types/"; /** * ボタンの左端枠を描画する diff --git a/src/utils/niconico.ts b/src/utils/niconico.ts index b5d6173d..842ead95 100755 --- a/src/utils/niconico.ts +++ b/src/utils/niconico.ts @@ -2,9 +2,9 @@ import type { CommentContentItem, CommentHTML5Font, CommentSize, + IRenderer, MeasureInput, } from "@/@types"; -import type { IRenderer } from "@/@types/renderer"; import { config } from "@/definition/config"; import { TypeGuardError } from "@/errors/TypeGuardError"; diff --git a/src/utils/plugins.ts b/src/utils/plugins.ts index 64c0f3e3..561dde8d 100755 --- a/src/utils/plugins.ts +++ b/src/utils/plugins.ts @@ -1,5 +1,4 @@ -import type { FormattedComment } from "@/@types"; -import type { IRenderer } from "@/@types/renderer"; +import type { FormattedComment, IRenderer } from "@/@types"; import { HTML5Comment } from "@/comments"; import { config } from "@/definition/config";