upd: replace mfm with sfm

This commit is contained in:
Marie 2023-12-18 03:03:05 +01:00
parent 24ba0d1fff
commit c92c2d065f
27 changed files with 49 additions and 111 deletions

View File

@ -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",

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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[] {

View File

@ -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[] {

View File

@ -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: 重複を削除

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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', () => {

View File

@ -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",

View File

@ -165,7 +165,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, inject, onMounted, ref, shallowRef, Ref, defineAsyncComponent, watch, provide } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import MkNoteSub from '@/components/MkNoteSub.vue';
import MkNoteHeader from '@/components/MkNoteHeader.vue';

View File

@ -221,7 +221,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, inject, onMounted, provide, ref, shallowRef, watch } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import MkNoteSub from '@/components/MkNoteSub.vue';
import MkNoteSimple from '@/components/MkNoteSimple.vue';

View File

@ -100,7 +100,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor';
import { toASCII } from 'punycode/';

View File

@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { } from 'vue';
import * as Misskey from 'misskey-js';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import MkMediaList from '@/components/MkMediaList.vue';
import MkPoll from '@/components/MkPoll.vue';
import MkButton from '@/components/MkButton.vue';

View File

@ -167,7 +167,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, inject, onMounted, ref, shallowRef, Ref, defineAsyncComponent, watch, provide } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import SkNoteSub from '@/components/SkNoteSub.vue';
import SkNoteHeader from '@/components/SkNoteHeader.vue';

View File

@ -229,7 +229,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, inject, onMounted, provide, ref, shallowRef, watch } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import SkNoteSub from '@/components/SkNoteSub.vue';
import SkNoteSimple from '@/components/SkNoteSimple.vue';

View File

@ -77,7 +77,7 @@
<script lang="ts" setup>
import { inject, onMounted, ref, shallowRef } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
import MkMediaList from '@/components/MkMediaList.vue';

View File

@ -4,7 +4,7 @@
*/
import { VNode, h } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import MkUrl from '@/components/global/MkUrl.vue';
import MkTime from '@/components/global/MkTime.vue';

View File

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import { TextBlock } from './block.type';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';

View File

@ -1,4 +1,4 @@
import * as mfm from 'mfm-js';
import * as mfm from '@sharkey/sfm-js';
export function checkAnimationFromMfm(nodes: mfm.MfmNode[]): boolean {
const animatedNodes = mfm.extract(nodes, (node) => {

View File

@ -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: 重複を削除

View File

@ -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 '@/scripts/array.js';
// unique without hash

View File

@ -106,6 +106,9 @@ importers:
'@peertube/http-signature':
specifier: 1.7.0
version: 1.7.0
'@sharkey/sfm-js':
specifier: 0.23.3
version: 0.23.3
'@simplewebauthn/server':
specifier: 8.3.5
version: 8.3.5
@ -244,9 +247,6 @@ importers:
meilisearch:
specifier: 0.35.0
version: 0.35.0
mfm-js:
specifier: 0.23.3
version: 0.23.3
microformats-parser:
specifier: 1.5.2
version: 1.5.2
@ -669,6 +669,9 @@ importers:
'@rollup/pluginutils':
specifier: 5.0.5
version: 5.0.5(rollup@4.4.1)
'@sharkey/sfm-js':
specifier: ^0.23.3
version: 0.23.3
'@syuilo/aiscript':
specifier: 0.16.0
version: 0.16.0
@ -756,9 +759,6 @@ importers:
matter-js:
specifier: 0.19.0
version: 0.19.0
mfm-js:
specifier: 0.23.3
version: 0.23.3
misskey-js:
specifier: workspace:*
version: link:../misskey-js
@ -1081,7 +1081,7 @@ importers:
version: 9.0.0(eslint@8.54.0)
jest:
specifier: ^29.7.0
version: 29.7.0
version: 29.7.0(@types/node@20.9.1)
jest-worker:
specifier: ^29.7.0
version: 29.7.0
@ -5733,6 +5733,12 @@ packages:
string-argv: 0.3.1
dev: true
/@sharkey/sfm-js@0.23.3:
resolution: {integrity: sha512-j4VxSmZIA438RKCe16kxaqhl2g+69w89x49ebm22XwRwH/KvYIC6uVQdcBhOovyN7l2xCCLdsPM1+bu8wZIP2A==, tarball: https://git.joinsharkey.org/api/packages/Sharkey/npm/%40sharkey%2Fsfm-js/-/0.23.3/sfm-js-0.23.3.tgz}
dependencies:
twemoji-parser: 14.0.0
dev: false
/@sideway/address@4.1.4:
resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==}
dependencies:
@ -7285,7 +7291,7 @@ packages:
ts-dedent: 2.2.0
type-fest: 2.19.0
vue: 3.3.8(typescript@5.2.2)
vue-component-type-helpers: 1.8.24
vue-component-type-helpers: 1.8.25
transitivePeerDependencies:
- encoding
- supports-color
@ -7297,7 +7303,7 @@ packages:
hasBin: true
peerDependencies:
'@swc/core': ^1.2.66
chokidar: ^3.5.1
chokidar: 3.5.3
peerDependenciesMeta:
chokidar:
optional: true
@ -13857,34 +13863,6 @@ packages:
- supports-color
dev: true
/jest-cli@29.7.0:
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
peerDependencies:
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
peerDependenciesMeta:
node-notifier:
optional: true
dependencies:
'@jest/core': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
create-jest: 29.7.0(@types/node@20.9.1)
exit: 0.1.2
import-local: 3.1.0
jest-config: 29.7.0(@types/node@20.9.1)
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
- supports-color
- ts-node
dev: true
/jest-cli@29.7.0(@types/node@20.9.1):
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -14330,27 +14308,6 @@ packages:
supports-color: 8.1.1
dev: true
/jest@29.7.0:
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
peerDependencies:
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
peerDependenciesMeta:
node-notifier:
optional: true
dependencies:
'@jest/core': 29.7.0
'@jest/types': 29.6.3
import-local: 3.1.0
jest-cli: 29.7.0
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
- supports-color
- ts-node
dev: true
/jest@29.7.0(@types/node@20.9.1):
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -15118,12 +15075,6 @@ packages:
resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
engines: {node: '>= 0.6'}
/mfm-js@0.23.3:
resolution: {integrity: sha512-o8scYmbey6rMUmWAlT3k3ntt6khaCLdxlmHhAWV5wTTMj2OK1atQvZfRUq0SIVm1Jig08qlZg/ps71xUqrScNA==}
dependencies:
twemoji-parser: 14.0.0
dev: false
/microformats-parser@1.5.2:
resolution: {integrity: sha512-EcHm8zxEm3CggOLgILfxCo2wDiJEOnACzpV/FXWGLaRk24ECei+JkoWNdKdo2vzo/Pww9EvrQNeQsdv4JuHy7Q==}
engines: {node: '>=14'}
@ -19088,7 +19039,7 @@ packages:
'@babel/core': 7.23.3
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest: 29.7.0
jest: 29.7.0(@types/node@20.9.1)
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
@ -19859,8 +19810,8 @@ packages:
/vscode-textmate@8.0.0:
resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==}
/vue-component-type-helpers@1.8.24:
resolution: {integrity: sha512-lqWs/7fdRXoSBAlbouHBX+LNuaY6gI9xWW34m/ZIz9zVPYHEyw0b2/zaCBwlKx0NtKTeF/6pOpvrxVkh7nhIYg==}
/vue-component-type-helpers@1.8.25:
resolution: {integrity: sha512-NCA6sekiJIMnMs4DdORxATXD+/NRkQpS32UC+I1KQJUasx+Z7MZUb3Y+MsKsFmX+PgyTYSteb73JW77AibaCCw==}
dev: true
/vue-component-type-helpers@1.8.4:
@ -20365,19 +20316,6 @@ packages:
y18n: 5.0.8
yargs-parser: 21.1.1
/yargs@17.7.2:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
dependencies:
cliui: 8.0.1
escalade: 3.1.1
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
dev: true
/yauzl@2.10.0:
resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==}
dependencies: