From c92c2d065fd7f39eccd77e1780d5631a91d5315c Mon Sep 17 00:00:00 2001 From: Marie Date: Mon, 18 Dec 2023 03:03:05 +0100 Subject: [PATCH] upd: replace mfm with sfm --- packages/backend/package.json | 6 +- packages/backend/src/core/MfmService.ts | 2 +- .../backend/src/core/NoteCreateService.ts | 2 +- packages/backend/src/core/NoteEditService.ts | 2 +- .../src/core/activitypub/ApMfmService.ts | 2 +- .../src/core/activitypub/ApRendererService.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 +- .../src/server/api/mastodon/converters.ts | 2 +- packages/backend/test/unit/MfmService.ts | 2 +- .../backend/test/unit/extract-mentions.ts | 2 +- packages/frontend/package.json | 8 +- packages/frontend/src/components/MkNote.vue | 2 +- .../src/components/MkNoteDetailed.vue | 2 +- .../frontend/src/components/MkPostForm.vue | 2 +- .../src/components/MkSubNoteContent.vue | 2 +- packages/frontend/src/components/SkNote.vue | 2 +- .../src/components/SkNoteDetailed.vue | 2 +- .../src/components/SkOldNoteWindow.vue | 2 +- .../global/MkMisskeyFlavoredMarkdown.ts | 2 +- .../src/components/page/page.text.vue | 2 +- .../src/scripts/check-animated-mfm.ts | 2 +- .../frontend/src/scripts/extract-mentions.ts | 2 +- .../src/scripts/extract-url-from-mfm.ts | 2 +- pnpm-lock.yaml | 98 ++++--------------- 27 files changed, 49 insertions(+), 111 deletions(-) diff --git a/packages/backend/package.json b/packages/backend/package.json index 22030d168..66d841285 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -73,6 +73,7 @@ "@nestjs/core": "10.2.8", "@nestjs/testing": "10.2.8", "@peertube/http-signature": "1.7.0", + "@sharkey/sfm-js": "0.23.3", "@simplewebauthn/server": "8.3.5", "@sinonjs/fake-timers": "11.2.2", "@smithy/node-http-handler": "2.1.5", @@ -97,8 +98,8 @@ "content-disposition": "0.5.4", "date-fns": "2.30.0", "deep-email-validator": "0.1.21", - "fastify-multer": "^2.0.3", "fastify": "4.24.3", + "fastify-multer": "^2.0.3", "fastify-raw-body": "4.3.0", "feed": "4.2.2", "file-type": "18.7.0", @@ -119,7 +120,6 @@ "jsrsasign": "10.8.6", "megalodon": "workspace:*", "meilisearch": "0.35.0", - "mfm-js": "0.23.3", "microformats-parser": "1.5.2", "mime-types": "2.1.35", "misskey-js": "workspace:*", @@ -213,10 +213,10 @@ "@types/sinonjs__fake-timers": "8.1.5", "@types/tinycolor2": "1.4.6", "@types/tmp": "0.2.6", + "@types/uuid": "^9.0.4", "@types/vary": "1.1.3", "@types/web-push": "3.6.3", "@types/ws": "8.5.9", - "@types/uuid": "^9.0.4", "@typescript-eslint/eslint-plugin": "6.11.0", "@typescript-eslint/parser": "6.11.0", "aws-sdk-client-mock": "3.0.0", diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index 178b4cc9a..12f4353ec 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -13,7 +13,7 @@ import { intersperse } from '@/misc/prelude/array.js'; import type { IMentionedRemoteUsers } from '@/models/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 '@sharkey/sfm-js'; const treeAdapter = TreeAdapter.defaultTreeAdapter; diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 837a53cfa..2055a0d21 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -4,7 +4,7 @@ */ import { setImmediate } from 'node:timers/promises'; -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-js'; import { In, DataSource, IsNull, LessThan } from 'typeorm'; import * as Redis from 'ioredis'; import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index e5918e6c2..c4314c65a 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -4,7 +4,7 @@ */ import { setImmediate } from 'node:timers/promises'; -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-js'; import { DataSource, In, IsNull, LessThan } 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 c45c27f86..c19eb310d 100644 --- a/packages/backend/src/core/activitypub/ApMfmService.ts +++ b/packages/backend/src/core/activitypub/ApMfmService.ts @@ -4,7 +4,7 @@ */ import { Injectable } from '@nestjs/common'; -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-js'; import { MfmService } from '@/core/MfmService.js'; import type { MiNote } from '@/models/Note.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index 7464593bb..f4d39d240 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -6,7 +6,7 @@ import { createPublicKey, randomUUID } from 'node:crypto'; import { Inject, Injectable } from '@nestjs/common'; import { In } from 'typeorm'; -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-js'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import type { MiPartialLocalUser, MiLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.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 0b898d47e..0e8dfd21f 100644 --- a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts +++ b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-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 3bd56e98e..3598d9009 100644 --- a/packages/backend/src/misc/extract-hashtags.ts +++ b/packages/backend/src/misc/extract-hashtags.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-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 272eb9219..b0897b05a 100644 --- a/packages/backend/src/misc/extract-mentions.ts +++ b/packages/backend/src/misc/extract-mentions.ts @@ -5,7 +5,7 @@ // test is located in test/extract-mentions -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-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 63f9991b2..aa730716b 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -4,7 +4,7 @@ */ import RE2 from 're2'; -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-js'; import { Inject, Injectable } from '@nestjs/common'; import ms from 'ms'; import { JSDOM } from 'jsdom'; diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 9571e14cb..cce7f798f 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -1,6 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { Entity } from 'megalodon'; -import mfm from 'mfm-js'; +import mfm from '@sharkey/sfm-js'; import { DI } from '@/di-symbols.js'; import { MfmService } from '@/core/MfmService.js'; import type { Config } from '@/config.js'; diff --git a/packages/backend/test/unit/MfmService.ts b/packages/backend/test/unit/MfmService.ts index bb8e6981d..49e84ccec 100644 --- a/packages/backend/test/unit/MfmService.ts +++ b/packages/backend/test/unit/MfmService.ts @@ -4,7 +4,7 @@ */ import * as assert from 'assert'; -import * as mfm from 'mfm-js'; +import * as mfm from '@sharkey/sfm-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 5901f33fd..195e9b819 100644 --- a/packages/backend/test/unit/extract-mentions.ts +++ b/packages/backend/test/unit/extract-mentions.ts @@ -5,7 +5,7 @@ import * as assert from 'assert'; -import { parse } from 'mfm-js'; +import { parse } from '@sharkey/sfm-js'; import { extractMentions } from '@/misc/extract-mentions.js'; describe('Extract mentions', () => { diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 071a8cfa8..69e3406f9 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -18,18 +18,19 @@ "dependencies": { "@discordapp/twemoji": "14.1.2", "@github/webauthn-json": "2.1.1", + "@phosphor-icons/web": "^2.0.3", "@rollup/plugin-alias": "5.0.1", "@rollup/plugin-json": "6.0.1", "@rollup/plugin-replace": "5.0.5", "@rollup/pluginutils": "5.0.5", + "@sharkey/sfm-js": "0.23.3", "@syuilo/aiscript": "0.16.0", - "@phosphor-icons/web": "^2.0.3", "@vitejs/plugin-vue": "4.5.0", "@vue-macros/reactivity-transform": "0.4.0", "@vue/compiler-sfc": "3.3.8", + "aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.6", "astring": "1.8.6", "autosize": "6.0.1", - "aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.6", "broadcast-channel": "6.0.0", "browser-image-resizer": "github:misskey-dev/browser-image-resizer#v2.2.1-misskey.3", "buraha": "0.0.1", @@ -52,15 +53,14 @@ "is-file-animated": "1.0.2", "json5": "2.2.3", "matter-js": "0.19.0", - "mfm-js": "0.23.3", "misskey-js": "workspace:*", "photoswipe": "5.4.2", "punycode": "2.3.1", "querystring": "0.2.1", "rollup": "4.4.1", "sanitize-html": "2.11.0", - "shiki": "^0.14.5", "sass": "1.69.5", + "shiki": "^0.14.5", "strict-event-emitter-types": "2.0.0", "textarea-caret": "3.1.0", "three": "0.158.0", diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index dbbff650e..74edc8903 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -165,7 +165,7 @@ SPDX-License-Identifier: AGPL-3.0-only