switch to sharkey's mfm-js fork in order to support usernames with dots

Signed-off-by: limepotato <limepot@protonmail.ch>
This commit is contained in:
ShittyKopper 2024-05-06 01:57:30 +03:00 committed by limepotato
parent 2d37e445d0
commit 14797cbcff
35 changed files with 74 additions and 59 deletions

33
.pnp.cjs generated
View file

@ -3580,6 +3580,16 @@ const RAW_RUNTIME_STATE =
"linkType": "HARD"\
}]\
]],\
["@transfem-org/sfm-js", [\
["npm:0.24.5::__archiveUrl=https%3A%2F%2Factivitypub.software%2Fapi%2Fv4%2Fprojects%2F2%2Fpackages%2Fnpm%2F%40transfem-org%2Fsfm-js%2F-%2F%40transfem-org%2Fsfm-js-0.24.5.tgz", {\
"packageLocation": "./.yarn/cache/@transfem-org-sfm-js-npm-0.24.5-39d514f4c8-a763056dbd.zip/node_modules/@transfem-org/sfm-js/",\
"packageDependencies": [\
["@transfem-org/sfm-js", "npm:0.24.5::__archiveUrl=https%3A%2F%2Factivitypub.software%2Fapi%2Fv4%2Fprojects%2F2%2Fpackages%2Fnpm%2F%40transfem-org%2Fsfm-js%2F-%2F%40transfem-org%2Fsfm-js-0.24.5.tgz"],\
["@twemoji/parser", "npm:15.0.0"]\
],\
"linkType": "HARD"\
}]\
]],\
["@tsconfig/node10", [\
["npm:1.0.9", {\
"packageLocation": "./.yarn/cache/@tsconfig-node10-npm-1.0.9-f2e2d20feb-a33ae4dc2a.zip/node_modules/@tsconfig/node10/",\
@ -3625,6 +3635,15 @@ const RAW_RUNTIME_STATE =
"linkType": "HARD"\
}]\
]],\
["@twemoji/parser", [\
["npm:15.0.0", {\
"packageLocation": "./.yarn/cache/@twemoji-parser-npm-15.0.0-33f6b3da89-6d9679cb45.zip/node_modules/@twemoji/parser/",\
"packageDependencies": [\
["@twemoji/parser", "npm:15.0.0"]\
],\
"linkType": "HARD"\
}]\
]],\
["@types/accepts", [\
["npm:1.3.5", {\
"packageLocation": "./.yarn/cache/@types-accepts-npm-1.3.5-1d59cd2a7a-3984edd631.zip/node_modules/@types/accepts/",\
@ -6952,6 +6971,7 @@ const RAW_RUNTIME_STATE =
["@swc/core", "virtual:21a30884d94fbf67bcf4a1714713cc91d32809a34424c4ce678841dfdc63b58647c5e18570d56e36b3c762ee72f81c251599477127a715978fa6e1d8b9e5d952#npm:1.3.71"],\
["@swc/core-android-arm64", "npm:1.3.11"],\
["@syuilo/aiscript", "npm:0.11.1"],\
["@transfem-org/sfm-js", "npm:0.24.5::__archiveUrl=https%3A%2F%2Factivitypub.software%2Fapi%2Fv4%2Fprojects%2F2%2Fpackages%2Fnpm%2F%40transfem-org%2Fsfm-js%2F-%2F%40transfem-org%2Fsfm-js-0.24.5.tgz"],\
["@types/adm-zip", "npm:0.5.0"],\
["@types/async-lock", "npm:1.4.0"],\
["@types/bcryptjs", "npm:2.4.2"],\
@ -7055,7 +7075,6 @@ const RAW_RUNTIME_STATE =
["koa-send", "npm:5.0.1"],\
["koa-slow", "npm:2.1.0"],\
["koa-views", "virtual:aa59773ac87791c4813d53447077fcf8a847d6de5a301d34dc31286584b1dbb26d30d3adb5b4c41c1e8aea04371e926fda05c09c6253647c432e11d872a304ba#npm:7.0.2"],\
["mfm-js", "npm:0.23.3"],\
["mime-types", "npm:2.1.35"],\
["mocha", "npm:10.2.0"],\
["msgpackr", "npm:1.9.5"],\
@ -8340,6 +8359,7 @@ const RAW_RUNTIME_STATE =
["@rollup/plugin-json", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:6.0.1"],\
["@rollup/pluginutils", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:5.1.0"],\
["@syuilo/aiscript", "npm:0.11.1"],\
["@transfem-org/sfm-js", "npm:0.24.5::__archiveUrl=https%3A%2F%2Factivitypub.software%2Fapi%2Fv4%2Fprojects%2F2%2Fpackages%2Fnpm%2F%40transfem-org%2Fsfm-js%2F-%2F%40transfem-org%2Fsfm-js-0.24.5.tgz"],\
["@types/escape-regexp", "npm:0.0.1"],\
["@types/glob", "npm:8.1.0"],\
["@types/gulp", "npm:4.0.13"],\
@ -8385,7 +8405,6 @@ const RAW_RUNTIME_STATE =
["json5", "npm:2.2.3"],\
["katex", "npm:0.16.8"],\
["matter-js", "npm:0.18.0"],\
["mfm-js", "npm:0.23.3"],\
["paralint", "npm:1.2.1"],\
["photoswipe", "npm:5.3.8"],\
["prettier", "npm:3.0.0"],\
@ -17552,16 +17571,6 @@ const RAW_RUNTIME_STATE =
"linkType": "HARD"\
}]\
]],\
["mfm-js", [\
["npm:0.23.3", {\
"packageLocation": "./.yarn/cache/mfm-js-npm-0.23.3-b63f178b12-427b44b337.zip/node_modules/mfm-js/",\
"packageDependencies": [\
["mfm-js", "npm:0.23.3"],\
["twemoji-parser", "npm:14.0.0"]\
],\
"linkType": "HARD"\
}]\
]],\
["micromark", [\
["npm:2.11.4", {\
"packageLocation": "./.yarn/cache/micromark-npm-2.11.4-f7ec94840a-cd3bcbc4c1.zip/node_modules/micromark/",\

BIN
.yarn/cache/mfm-js-npm-0.23.3-b63f178b12-427b44b337.zip (Stored with Git LFS) vendored

Binary file not shown.

View file

@ -9,6 +9,8 @@ nodeLinker: pnp
npmScopes:
iceshrimp:
npmRegistryServer: "https://iceshrimp.dev/api/packages/iceshrimp/npm/"
transfem-org:
npmRegistryServer: "https://activitypub.software/api/v4/packages/npm/"
packageExtensions:
consolidate@^0.16.0:

View file

@ -35,6 +35,7 @@
"@redocly/openapi-core": "1.0.0-beta.131",
"@sinonjs/fake-timers": "9.1.2",
"@syuilo/aiscript": "0.11.1",
"@transfem-org/sfm-js": "^0.24.5",
"adm-zip": "^0.5.10",
"ajv": "8.12.0",
"archiver": "5.3.1",
@ -88,7 +89,6 @@
"koa-send": "5.0.1",
"koa-slow": "2.1.0",
"koa-views": "7.0.2",
"mfm-js": "0.23.3",
"mime-types": "2.1.35",
"msgpackr": "1.9.5",
"multer": "1.4.4-lts.1",

View file

@ -1,5 +1,5 @@
import { Window as HappyDom } from "happy-dom";
import type * as mfm from "mfm-js";
import type * as mfm from "@transfem-org/sfm-js";
import config from "@/config/index.js";
import { intersperse } from "@/prelude/array.js";
import type { IMentionedRemoteUsers } from "@/models/entities/note.js";

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { unique } from "@/prelude/array.js";
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { unique } from "@/prelude/array.js";
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {

View file

@ -1,6 +1,6 @@
// test is located in test/extract-mentions
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
export function extractMentions(
nodes: mfm.MfmNode[],
@ -10,4 +10,4 @@ export function extractMentions(
const mentions = mentionNodes.map((x) => x.props);
return mentions;
}
}

View file

@ -1,5 +1,5 @@
import { In } from "typeorm";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { Note } from "@/models/entities/note.js";
import type { User } from "@/models/entities/user.js";
import {

View file

@ -1,6 +1,6 @@
import { db } from "@/db/postgre.js";
import { UserProfile } from "@/models/entities/user-profile.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
import { extractMentions } from "@/misc/extract-mentions.js";
import { resolveMentionToUserAndProfile } from "@/remote/resolve-user.js";
import { IMentionedRemoteUsers } from "@/models/entities/note.js";
@ -60,4 +60,4 @@ export class RecursionLimiter {
return this.counter-- > 0;
});
}
}
}

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import type { Note } from "@/models/entities/note.js";
import { toHtml } from "../../../mfm/to-html.js";

View file

@ -1,5 +1,5 @@
import promiseLimit from "promise-limit";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import config from "@/config/index.js";
import Resolver from "../resolver.js";
import post from "@/services/note/create.js";

View file

@ -1,5 +1,5 @@
import { URL } from "node:url";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import config from "@/config/index.js";
import type { ILocalUser } from "@/models/entities/user.js";
import { DriveFiles, UserProfiles } from "@/models/index.js";

View file

@ -1,5 +1,5 @@
import RE2 from "re2";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { publishMainStream, publishUserEvent } from "@/services/stream.js";
import acceptAllFollowRequests from "@/services/following/requests/accept-all.js";
import { publishToFollowers, updateUserProfileData } from "@/services/i/update.js";

View file

@ -1,6 +1,6 @@
import { Announcement } from "@/models/entities/announcement.js";
import { MfmHelpers } from "@/server/api/mastodon/helpers/mfm.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
export class AnnouncementConverter {
public static async encode(announcement: Announcement, isRead: boolean): Promise<MastodonEntity.Announcement> {

View file

@ -2,7 +2,7 @@ import { ILocalUser, User } from "@/models/entities/user.js";
import { getNote } from "@/server/api/common/getters.js";
import { Note } from "@/models/entities/note.js";
import config from "@/config/index.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
import { UserConverter } from "@/server/api/mastodon/converters/user.js";
import { VisibilityConverter } from "@/server/api/mastodon/converters/visibility.js";
import { escapeMFM } from "@/server/api/mastodon/converters/mfm.js";

View file

@ -4,7 +4,7 @@ import { DriveFiles, Followings, HtmlUserCacheEntries, UserProfiles, Users } fro
import { EmojiConverter } from "@/server/api/mastodon/converters/emoji.js";
import { populateEmojis } from "@/misc/populate-emojis.js";
import { escapeMFM } from "@/server/api/mastodon/converters/mfm.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
import { awaitAll } from "@/prelude/await-all.js";
import { AccountCache, UserHelpers } from "@/server/api/mastodon/helpers/user.js";
import { MfmHelpers } from "@/server/api/mastodon/helpers/mfm.js";

View file

@ -2,7 +2,7 @@ import { IMentionedRemoteUsers } from "@/models/entities/note.js";
import { Window as HappyDom } from "happy-dom";
import config from "@/config/index.js";
import { intersperse } from "@/prelude/array.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
import { resolveMentionFromCache } from "@/remote/resolve-user.js";
export class MfmHelpers {

View file

@ -19,7 +19,7 @@ import { addPinned, removePinned } from "@/services/i/pin.js";
import { NoteConverter } from "@/server/api/mastodon/converters/note.js";
import { awaitAll } from "@/prelude/await-all.js";
import { VisibilityConverter } from "@/server/api/mastodon/converters/visibility.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
import { FileConverter } from "@/server/api/mastodon/converters/file.js";
import { MfmHelpers } from "@/server/api/mastodon/helpers/mfm.js";
import { toArray, unique } from "@/prelude/array.js";

View file

@ -12,7 +12,7 @@ import { updateUsertags } from "@/services/update-hashtag.js";
import { publishMainStream, publishUserEvent } from "@/services/stream.js";
import acceptAllFollowRequests from "@/services/following/requests/accept-all.js";
import { UserProfile } from "@/models/entities/user-profile.js";
import mfm from "mfm-js";
import mfm from "@transfem-org/sfm-js";
import { promiseEarlyReturn } from "@/prelude/promise.js";
import { UserConverter } from "@/server/api/mastodon/converters/user.js";

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import {
publishMainStream,
publishNotesStream,

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import {
publishNoteStream, publishNoteUpdatesStream,
} from "@/services/stream.js";

View file

@ -1,6 +1,6 @@
import * as assert from "assert";
import { parse } from "mfm-js";
import { parse } from "@transfem-org/sfm-js";
import { extractMentions } from "../src/misc/extract-mentions.js";
describe("Extract mentions", () => {

View file

@ -1,5 +1,5 @@
import * as assert from "assert";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { toHtml } from "../src/mfm/to-html.js";
import { fromHtml } from "../src/mfm/from-html.js";

View file

@ -18,6 +18,7 @@
"@rollup/plugin-json": "^6.0.1",
"@rollup/pluginutils": "^5.1.0",
"@syuilo/aiscript": "0.11.1",
"@transfem-org/sfm-js": "^0.24.5",
"@types/escape-regexp": "0.0.1",
"@types/glob": "8.1.0",
"@types/gulp": "4.0.13",
@ -62,7 +63,6 @@
"json5": "2.2.3",
"katex": "0.16.8",
"matter-js": "0.18.0",
"mfm-js": "0.23.3",
"paralint": "^1.2.1",
"photoswipe": "5.3.8",
"prettier": "3.0.0",

View file

@ -258,7 +258,7 @@
<script lang="ts" setup>
import { computed, inject, onMounted, onUnmounted, reactive, ref } from "vue";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import type { Ref } from "vue";
import type * as misskey from "iceshrimp-js";
import MkNoteSub from "@/components/MkNoteSub.vue";

View file

@ -235,7 +235,7 @@
<script lang="ts" setup>
import { inject, watch, nextTick, onMounted, defineAsyncComponent } from "vue";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import * as misskey from "iceshrimp-js";
import insertTextAtCursor from "insert-text-at-cursor";
import { length } from "stringz";

View file

@ -203,7 +203,7 @@
<script lang="ts" setup>
import { computed, ref } from "vue";
import * as misskey from "iceshrimp-js";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import * as os from "@/os";
import XNoteSimple from "@/components/MkNoteSimple.vue";
import XMediaList from "@/components/MkMediaList.vue";

View file

@ -1,5 +1,5 @@
import { defineComponent, h } from "vue";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import type { VNode } from "vue";
import MkUrl from "@/components/global/MkUrl.vue";
import MkLink from "@/components/MkLink.vue";

View file

@ -9,7 +9,7 @@
import { TextBlock } from "@/scripts/hpml/block";
import { Hpml } from "@/scripts/hpml/evaluator";
import { defineAsyncComponent, defineComponent, PropType } from "vue";
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { extractUrlFromMfm } from "@/scripts/extract-url-from-mfm";
export default defineComponent({
components: {

View file

@ -1,6 +1,6 @@
// test is located in test/extract-mentions
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
export function extractMentions(
nodes: mfm.MfmNode[],

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
const animatedMfm = [
"tada",

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { unique } from "@/scripts/array";
// unique without hash

View file

@ -1,4 +1,4 @@
import * as mfm from "mfm-js";
import * as mfm from "@transfem-org/sfm-js";
import { defaultStore } from "@/store";
import { expandKaTeXMacro } from "@/scripts/katex-macro";

View file

@ -2547,6 +2547,15 @@ __metadata:
languageName: node
linkType: hard
"@transfem-org/sfm-js@npm:^0.24.5":
version: 0.24.5
resolution: "@transfem-org/sfm-js@npm:0.24.5::__archiveUrl=https%3A%2F%2Factivitypub.software%2Fapi%2Fv4%2Fprojects%2F2%2Fpackages%2Fnpm%2F%40transfem-org%2Fsfm-js%2F-%2F%40transfem-org%2Fsfm-js-0.24.5.tgz"
dependencies:
"@twemoji/parser": "npm:15.0.0"
checksum: 10/a763056dbd1d65d39fc0c09e569cf438fdc5782540f4fb6d9146470a271d5ce66ba86d9d53cce2a8741f00407e95fccdbca97a9bdf8c7eb4d6c9082416d8007b
languageName: node
linkType: hard
"@tsconfig/node10@npm:^1.0.7":
version: 1.0.9
resolution: "@tsconfig/node10@npm:1.0.9"
@ -2582,6 +2591,13 @@ __metadata:
languageName: node
linkType: hard
"@twemoji/parser@npm:15.0.0":
version: 15.0.0
resolution: "@twemoji/parser@npm:15.0.0"
checksum: 10/6d9679cb45ff8f4e487b57316757a426f66e9ef306bd228f13624347be2c97c62169552b5f13480d70878e8a163523edb56f6bc354cf2bd18d93f6289c6eb7d1
languageName: node
linkType: hard
"@types/accepts@npm:*":
version: 1.3.5
resolution: "@types/accepts@npm:1.3.5"
@ -5267,6 +5283,7 @@ __metadata:
"@swc/core": "npm:^1.3.68"
"@swc/core-android-arm64": "npm:1.3.11"
"@syuilo/aiscript": "npm:0.11.1"
"@transfem-org/sfm-js": "npm:^0.24.5"
"@types/adm-zip": "npm:^0.5.0"
"@types/async-lock": "npm:1.4.0"
"@types/bcryptjs": "npm:2.4.2"
@ -5370,7 +5387,6 @@ __metadata:
koa-send: "npm:5.0.1"
koa-slow: "npm:2.1.0"
koa-views: "npm:7.0.2"
mfm-js: "npm:0.23.3"
mime-types: "npm:2.1.35"
mocha: "npm:10.2.0"
msgpackr: "npm:1.9.5"
@ -6493,6 +6509,7 @@ __metadata:
"@rollup/plugin-json": "npm:^6.0.1"
"@rollup/pluginutils": "npm:^5.1.0"
"@syuilo/aiscript": "npm:0.11.1"
"@transfem-org/sfm-js": "npm:^0.24.5"
"@types/escape-regexp": "npm:0.0.1"
"@types/glob": "npm:8.1.0"
"@types/gulp": "npm:4.0.13"
@ -6538,7 +6555,6 @@ __metadata:
json5: "npm:2.2.3"
katex: "npm:0.16.8"
matter-js: "npm:0.18.0"
mfm-js: "npm:0.23.3"
paralint: "npm:^1.2.1"
photoswipe: "npm:5.3.8"
prettier: "npm:3.0.0"
@ -14428,15 +14444,6 @@ __metadata:
languageName: node
linkType: hard
"mfm-js@npm:0.23.3":
version: 0.23.3
resolution: "mfm-js@npm:0.23.3"
dependencies:
twemoji-parser: "npm:14.0.0"
checksum: 10/427b44b337a1dd7bc324c03f2b4f66b0fe31aff8de054a155598389e997198d4ab9ba6e5ba726896c81e682cd264c5d9428d641e06536b4d98a0c3136a5271d5
languageName: node
linkType: hard
"micromark@npm:~2.11.0":
version: 2.11.4
resolution: "micromark@npm:2.11.4"