about summary refs log tree commit diff
path: root/app/javascript/mastodon/emojione_light.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/mastodon/emojione_light.js')
-rw-r--r--app/javascript/mastodon/emojione_light.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/javascript/mastodon/emojione_light.js b/app/javascript/mastodon/emojione_light.js
new file mode 100644
index 000000000..c75e10a98
--- /dev/null
+++ b/app/javascript/mastodon/emojione_light.js
@@ -0,0 +1,11 @@
+// @preval
+// Force tree shaking on emojione by exposing just a subset of its functionality
+
+const emojione = require('emojione');
+
+const mappedUnicode = emojione.mapUnicodeToShort();
+
+module.exports.unicodeToFilename = Object.keys(emojione.jsEscapeMap)
+  .map(unicodeStr => [unicodeStr, mappedUnicode[emojione.jsEscapeMap[unicodeStr]]])
+  .map(([unicodeStr, shortCode]) => ({ [unicodeStr]: emojione.emojioneList[shortCode].fname }))
+  .reduce((x, y) => Object.assign(x, y), { });