From 52880a468931d6f7f9973e01ee250e09bbadb645 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 18 Nov 2022 09:32:46 -0800 Subject: [PATCH] chore: update emoji-regex, replace copyright character (#2202) --- package.json | 2 +- src/routes/_utils/emojiRegex.js | 2 +- src/routes/_utils/replaceEmoji.js | 2 +- tests/unit/test-emoji.mjs | 8 ++++---- yarn.lock | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index fad20504..cc2e7f2c 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "css-dedoupe": "^0.1.1", "emoji-picker-element": "^1.13.1", "emoji-picker-element-data": "^1.3.0", - "emoji-regex": "^9.2.2", + "emoji-regex": "^10.2.1", "encoding": "^0.1.13", "es-main": "^1.2.0", "escape-html": "^1.0.3", diff --git a/src/routes/_utils/emojiRegex.js b/src/routes/_utils/emojiRegex.js index ca25ad9e..d8d5d988 100644 --- a/src/routes/_utils/emojiRegex.js +++ b/src/routes/_utils/emojiRegex.js @@ -1,4 +1,4 @@ -import emojiRegex from 'emoji-regex/es2015/text.js' +import emojiRegex from 'emoji-regex' import { thunk } from './thunk.js' export const getEmojiRegex = thunk(emojiRegex) diff --git a/src/routes/_utils/replaceEmoji.js b/src/routes/_utils/replaceEmoji.js index 96a28172..f7de0193 100644 --- a/src/routes/_utils/replaceEmoji.js +++ b/src/routes/_utils/replaceEmoji.js @@ -1,7 +1,7 @@ import { getEmojiRegex } from './emojiRegex.js' // \ufe0f is a variation selector, which seems to appear for some reason in e.g. ™ -const NON_EMOJI_REGEX = /^(?:[0-9#*]|™|®|\ufe0f)+$/ +const NON_EMOJI_REGEX = /^(?:[0-9#*]|™|®|©|\ufe0f)+$/ // replace emoji in HTML with something else, safely skipping HTML tags export function replaceEmoji (string, replacer) { diff --git a/tests/unit/test-emoji.mjs b/tests/unit/test-emoji.mjs index e3f02521..d17d98f1 100644 --- a/tests/unit/test-emoji.mjs +++ b/tests/unit/test-emoji.mjs @@ -67,13 +67,13 @@ describe('test-emoji.js', function () { 'it\'s over #9000' ) assert.strictEqual( - replaceEmoji('woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®', replacer), - 'woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®' + replaceEmoji('woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®©', replacer), + 'woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®©' ) assert.strictEqual( - replaceEmoji('woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®', replacer), - 'woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®' + replaceEmoji('woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®©', replacer), + 'woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®©' ) // hidden VARIATION SELECTOR character is in here diff --git a/yarn.lock b/yarn.lock index 9afcae88..887ec414 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2659,16 +2659,16 @@ emoji-picker-element@^1.13.1: resolved "https://registry.yarnpkg.com/emoji-picker-element/-/emoji-picker-element-1.13.1.tgz#721e2afb72c546f8f0b33766bd792b2dc70e4480" integrity sha512-xOUYg6piwCmnYJw5Uh47rV5F2CwcFZcbfZx5jzU43gELJDbg8hrv6CBsikVe5VJSyiUH+N2QeQHc2f0h+V74PA== +emoji-regex@^10.2.1: + version "10.2.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.2.1.tgz#a41c330d957191efd3d9dfe6e1e8e1e9ab048b3f" + integrity sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - emojis-list@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78"