fix: ⬆️ switch from twemoji-parser to @twemoji/parser
This commit is contained in:
parent
e8b21b593a
commit
1d870fa78d
@ -39,6 +39,7 @@
|
|||||||
"@redocly/openapi-core": "1.4.1",
|
"@redocly/openapi-core": "1.4.1",
|
||||||
"@sinonjs/fake-timers": "11.2.2",
|
"@sinonjs/fake-timers": "11.2.2",
|
||||||
"@tensorflow/tfjs": "^4.13.0",
|
"@tensorflow/tfjs": "^4.13.0",
|
||||||
|
"@twemoji/parser": "^15.0.0",
|
||||||
"adm-zip": "^0.5.10",
|
"adm-zip": "^0.5.10",
|
||||||
"ajv": "8.12.0",
|
"ajv": "8.12.0",
|
||||||
"archiver": "6.0.1",
|
"archiver": "6.0.1",
|
||||||
@ -128,7 +129,6 @@
|
|||||||
"tinycolor2": "1.6.0",
|
"tinycolor2": "1.6.0",
|
||||||
"tinyld": "^1.3.4",
|
"tinyld": "^1.3.4",
|
||||||
"tmp": "0.2.1",
|
"tmp": "0.2.1",
|
||||||
"twemoji-parser": "14.0.0",
|
|
||||||
"typeorm": "0.3.17",
|
"typeorm": "0.3.17",
|
||||||
"ulid": "2.3.0",
|
"ulid": "2.3.0",
|
||||||
"uuid": "9.0.1",
|
"uuid": "9.0.1",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import twemoji from "twemoji-parser/dist/lib/regex.js";
|
import twemoji from "@twemoji/parser/dist/lib/regex.js";
|
||||||
const twemojiRegex = twemoji.default;
|
const twemojiRegex = twemoji.default;
|
||||||
|
|
||||||
export const emojiRegex = new RegExp(`(${twemojiRegex.source})`);
|
export const emojiRegex = new RegExp(`(${twemojiRegex.source})`);
|
||||||
|
@ -57,47 +57,20 @@ export function addSkinTone(emoji: string, skinTone?: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const unicodeFifteenEmojis = [
|
|
||||||
"🫨",
|
|
||||||
"🩷",
|
|
||||||
"🩵",
|
|
||||||
"🩶",
|
|
||||||
"🫷",
|
|
||||||
"🫸",
|
|
||||||
"🫎",
|
|
||||||
"🫏",
|
|
||||||
"🪽",
|
|
||||||
"🐦⬛",
|
|
||||||
"🪿",
|
|
||||||
"🪼",
|
|
||||||
"🪻",
|
|
||||||
"🫚",
|
|
||||||
"🫛",
|
|
||||||
"🪭",
|
|
||||||
"🪮",
|
|
||||||
"🪇",
|
|
||||||
"🪈",
|
|
||||||
"🪯",
|
|
||||||
"🛜",
|
|
||||||
];
|
|
||||||
|
|
||||||
const newData = {};
|
const newData = {};
|
||||||
|
|
||||||
Object.keys(data).forEach((originalCategory) => {
|
for (const originalCategory of Object.keys(data)) {
|
||||||
const newCategory = categoryMapping[originalCategory];
|
const newCategory = categoryMapping[originalCategory];
|
||||||
if (newCategory) {
|
if (newCategory) {
|
||||||
newData[newCategory] = newData[newCategory] || [];
|
newData[newCategory] = newData[newCategory] || [];
|
||||||
Object.keys(data[originalCategory]).forEach((emojiIndex) => {
|
for (const emojiIndex of Object.keys(data[originalCategory])) {
|
||||||
const emojiObj = { ...data[originalCategory][emojiIndex] };
|
const emojiObj = { ...data[originalCategory][emojiIndex] };
|
||||||
if (unicodeFifteenEmojis.includes(emojiObj.emoji)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emojiObj.category = newCategory;
|
emojiObj.category = newCategory;
|
||||||
emojiObj.keywords = keywordSet[emojiObj.emoji];
|
emojiObj.keywords = keywordSet[emojiObj.emoji];
|
||||||
newData[newCategory].push(emojiObj);
|
newData[newCategory].push(emojiObj);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce(
|
export const emojilist: UnicodeEmojiDef[] = Object.keys(newData).reduce(
|
||||||
(acc, category) => {
|
(acc, category) => {
|
||||||
|
@ -135,6 +135,9 @@ importers:
|
|||||||
'@tensorflow/tfjs':
|
'@tensorflow/tfjs':
|
||||||
specifier: ^4.13.0
|
specifier: ^4.13.0
|
||||||
version: 4.13.0(seedrandom@3.0.5)
|
version: 4.13.0(seedrandom@3.0.5)
|
||||||
|
'@twemoji/parser':
|
||||||
|
specifier: ^15.0.0
|
||||||
|
version: 15.0.0
|
||||||
adm-zip:
|
adm-zip:
|
||||||
specifier: ^0.5.10
|
specifier: ^0.5.10
|
||||||
version: 0.5.10
|
version: 0.5.10
|
||||||
@ -402,9 +405,6 @@ importers:
|
|||||||
tmp:
|
tmp:
|
||||||
specifier: 0.2.1
|
specifier: 0.2.1
|
||||||
version: 0.2.1
|
version: 0.2.1
|
||||||
twemoji-parser:
|
|
||||||
specifier: 14.0.0
|
|
||||||
version: 14.0.0
|
|
||||||
typeorm:
|
typeorm:
|
||||||
specifier: 0.3.17
|
specifier: 0.3.17
|
||||||
version: 0.3.17(ioredis@5.3.2)(pg@8.11.3)(ts-node@10.9.1)
|
version: 0.3.17(ioredis@5.3.2)(pg@8.11.3)(ts-node@10.9.1)
|
||||||
@ -3785,6 +3785,10 @@ packages:
|
|||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@twemoji/parser@15.0.0:
|
||||||
|
resolution: {integrity: sha512-lh9515BNsvKSNvyUqbj5yFu83iIDQ77SwVcsN/SnEGawczhsKU6qWuogewN1GweTi5Imo5ToQ9s+nNTf97IXvg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/accepts@1.3.5:
|
/@types/accepts@1.3.5:
|
||||||
resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==}
|
resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user