From efa2abef85a3059c483824064a61e0ed99a5c3bc Mon Sep 17 00:00:00 2001 From: NoriDev Date: Wed, 7 Jun 2023 20:26:12 +0900 Subject: [PATCH] refactor(server): mfm-js to cherrypick-mfm-js --- CHANGELOG_CHERRYPICK.md | 3 +++ packages/backend/package.json | 2 +- packages/backend/src/core/MfmService.ts | 2 +- .../backend/src/core/NoteCreateService.ts | 2 +- .../src/core/activitypub/ApMfmService.ts | 2 +- .../src/core/activitypub/ApRendererService.ts | 2 +- .../src/core/entities/NoteEntityService.ts | 2 +- .../misc/extract-custom-emojis-from-mfm.ts | 2 +- packages/backend/src/misc/extract-hashtags.ts | 2 +- packages/backend/src/misc/extract-mentions.ts | 2 +- .../src/server/api/endpoints/i/update.ts | 2 +- packages/backend/test/unit/MfmService.ts | 2 +- .../backend/test/unit/extract-mentions.ts | 2 +- packages/frontend/package.json | 2 +- packages/frontend/src/components/MkNote.vue | 2 +- .../src/components/MkNoteDetailed.vue | 2 +- .../frontend/src/components/MkPostForm.vue | 2 +- .../global/MkMisskeyFlavoredMarkdown.ts | 2 +- .../src/components/page/page.text.vue | 2 +- .../messaging/messaging-room.message.vue | 2 +- .../frontend/src/scripts/extract-mentions.ts | 2 +- .../src/scripts/extract-url-from-mfm.ts | 2 +- pnpm-lock.yaml | 24 +++++++++---------- 23 files changed, 36 insertions(+), 33 deletions(-) diff --git a/CHANGELOG_CHERRYPICK.md b/CHANGELOG_CHERRYPICK.md index c843ff07dc..dd00a7475c 100644 --- a/CHANGELOG_CHERRYPICK.md +++ b/CHANGELOG_CHERRYPICK.md @@ -36,6 +36,9 @@ - Fix: (Friendly) 타임라인이 변경되었을 때 네비게이션 바의 인디케이터가 사라지지 않는 문제 - Fix: 네트워크 트래픽이 10MB/s를 초과하면 네트워크 통계 위젯의 그래프가 잘못 출력되는 문제 +### Server +- mfm-js를 cherrypick-mfm-js로 변경 + --- ## 13.13.1-cp-4.0.0 diff --git a/packages/backend/package.json b/packages/backend/package.json index db7c4a8905..13e242a058 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -109,7 +109,7 @@ "jsonld": "8.2.0", "jsrsasign": "10.8.6", "meilisearch": "0.32.5", - "mfm-js": "0.23.3", + "cherrypick-mfm-js": "0.23.3-cp-1.0.0", "mime-types": "2.1.35", "misskey-js": "workspace:*", "ms": "3.0.0-canary.1", diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index dffee16e08..96abe1f11a 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -8,7 +8,7 @@ import { intersperse } from '@/misc/prelude/array.js'; import type { IMentionedRemoteUsers } from '@/models/entities/Note.js'; import { bindThis } from '@/decorators.js'; import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js'; -import type * as mfm from 'mfm-js'; +import type * as mfm from 'cherrypick-mfm-js'; const treeAdapter = TreeAdapter.defaultTreeAdapter; diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 6fdd76d644..a6b72793dd 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -1,5 +1,5 @@ import { setImmediate } from 'node:timers/promises'; -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { In, DataSource } from 'typeorm'; import * as Redis from 'ioredis'; import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; diff --git a/packages/backend/src/core/activitypub/ApMfmService.ts b/packages/backend/src/core/activitypub/ApMfmService.ts index 6116822f7a..66a7845a51 100644 --- a/packages/backend/src/core/activitypub/ApMfmService.ts +++ b/packages/backend/src/core/activitypub/ApMfmService.ts @@ -1,5 +1,5 @@ import { Inject, Injectable } from '@nestjs/common'; -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { MfmService } from '@/core/MfmService.js'; diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index c049d47678..be68a92908 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -2,7 +2,7 @@ import { createPublicKey } from 'node:crypto'; import { Inject, Injectable } from '@nestjs/common'; import { In, IsNull } from 'typeorm'; import { v4 as uuid } from 'uuid'; -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import type { PartialLocalUser, LocalUser, PartialRemoteUser, RemoteUser, User } from '@/models/entities/User.js'; diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 0bc0387666..dbffebe8b7 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -1,6 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { DataSource, In } from 'typeorm'; -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; import type { Packed } from '@/misc/json-schema.js'; diff --git a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts index 14c25922ad..dfdcd675a7 100644 --- a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts +++ b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts @@ -1,4 +1,4 @@ -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { unique } from '@/misc/prelude/array.js'; export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { diff --git a/packages/backend/src/misc/extract-hashtags.ts b/packages/backend/src/misc/extract-hashtags.ts index d293fd7f52..44479c605d 100644 --- a/packages/backend/src/misc/extract-hashtags.ts +++ b/packages/backend/src/misc/extract-hashtags.ts @@ -1,4 +1,4 @@ -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { unique } from '@/misc/prelude/array.js'; export function extractHashtags(nodes: mfm.MfmNode[]): string[] { diff --git a/packages/backend/src/misc/extract-mentions.ts b/packages/backend/src/misc/extract-mentions.ts index c8762e797b..706b278c83 100644 --- a/packages/backend/src/misc/extract-mentions.ts +++ b/packages/backend/src/misc/extract-mentions.ts @@ -1,6 +1,6 @@ // test is located in test/extract-mentions -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; export function extractMentions(nodes: mfm.MfmNode[]): mfm.MfmMention['props'][] { // TODO: 重複を削除 diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 8f5e6177c2..8a82994d3b 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -1,5 +1,5 @@ import RE2 from 're2'; -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { Inject, Injectable } from '@nestjs/common'; import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; import { extractHashtags } from '@/misc/extract-hashtags.js'; diff --git a/packages/backend/test/unit/MfmService.ts b/packages/backend/test/unit/MfmService.ts index 5496738778..d444e8754c 100644 --- a/packages/backend/test/unit/MfmService.ts +++ b/packages/backend/test/unit/MfmService.ts @@ -1,5 +1,5 @@ import * as assert from 'assert'; -import * as mfm from 'mfm-js'; +import * as mfm from 'cherrypick-mfm-js'; import { Test } from '@nestjs/testing'; import { CoreModule } from '@/core/CoreModule.js'; diff --git a/packages/backend/test/unit/extract-mentions.ts b/packages/backend/test/unit/extract-mentions.ts index 66d32be1c5..fdb33a78d2 100644 --- a/packages/backend/test/unit/extract-mentions.ts +++ b/packages/backend/test/unit/extract-mentions.ts @@ -1,6 +1,6 @@ import * as assert from 'assert'; -import { parse } from 'mfm-js'; +import { parse } from 'cherrypick-mfm-js'; import { extractMentions } from '@/misc/extract-mentions.js'; describe('Extract mentions', () => { diff --git a/packages/frontend/package.json b/packages/frontend/package.json index c056d134f9..82ddb32954 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -48,7 +48,7 @@ "is-file-animated": "1.0.2", "json5": "2.2.3", "matter-js": "0.19.0", - "mfm-js": "0.23.3", + "cherrypick-mfm-js": "0.23.3-cp-1.0.0", "misskey-js": "workspace:*", "photoswipe": "5.3.7", "prismjs": "1.29.0", diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index adb26c6db7..d857651c6c 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -139,7 +139,7 @@