mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-16 01:08:15 +00:00
add preval again and fix import issues with build
This commit is contained in:
parent
a030fb77f4
commit
d0ccb030ad
|
@ -1,8 +0,0 @@
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script type="module" src="./application.ts"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="mastodon"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -29,7 +29,7 @@ const shortcodeMap = {};
|
||||||
const shortCodesToEmojiData = {};
|
const shortCodesToEmojiData = {};
|
||||||
const emojisWithoutShortCodes = [];
|
const emojisWithoutShortCodes = [];
|
||||||
|
|
||||||
Object.keys(emojiIndex.emojis).forEach(key => {
|
Object.keys(emojiIndex.emojis).forEach((key) => {
|
||||||
let emoji = emojiIndex.emojis[key];
|
let emoji = emojiIndex.emojis[key];
|
||||||
|
|
||||||
// Emojis with skin tone modifiers are stored like this
|
// Emojis with skin tone modifiers are stored like this
|
||||||
|
@ -40,15 +40,15 @@ Object.keys(emojiIndex.emojis).forEach(key => {
|
||||||
shortcodeMap[emoji.native] = emoji.id;
|
shortcodeMap[emoji.native] = emoji.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const stripModifiers = unicode => {
|
const stripModifiers = (unicode) => {
|
||||||
skinTones.forEach(tone => {
|
skinTones.forEach((tone) => {
|
||||||
unicode = unicode.replace(tone, '');
|
unicode = unicode.replace(tone, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
return unicode;
|
return unicode;
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(emojiMap).forEach(key => {
|
Object.keys(emojiMap).forEach((key) => {
|
||||||
if (excluded.includes(key)) {
|
if (excluded.includes(key)) {
|
||||||
delete emojiMap[key];
|
delete emojiMap[key];
|
||||||
return;
|
return;
|
||||||
|
@ -81,7 +81,7 @@ Object.keys(emojiMap).forEach(key => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(emojiIndex.emojis).forEach(key => {
|
Object.keys(emojiIndex.emojis).forEach((key) => {
|
||||||
let emoji = emojiIndex.emojis[key];
|
let emoji = emojiIndex.emojis[key];
|
||||||
|
|
||||||
// Emojis with skin tone modifiers are stored like this
|
// Emojis with skin tone modifiers are stored like this
|
||||||
|
@ -93,9 +93,11 @@ Object.keys(emojiIndex.emojis).forEach(key => {
|
||||||
let { short_names, search, unified } = emojiMartData.emojis[key];
|
let { short_names, search, unified } = emojiMartData.emojis[key];
|
||||||
|
|
||||||
if (short_names[0] !== key) {
|
if (short_names[0] !== key) {
|
||||||
throw new Error('The compressor expects the first short_code to be the ' +
|
throw new Error(
|
||||||
|
'The compressor expects the first short_code to be the ' +
|
||||||
'key. It may need to be rewritten if the emoji change such that this ' +
|
'key. It may need to be rewritten if the emoji change such that this ' +
|
||||||
'is no longer the case.');
|
'is no longer the case.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
short_names = short_names.slice(1); // first short name can be inferred from the key
|
short_names = short_names.slice(1); // first short name can be inferred from the key
|
|
@ -4,8 +4,8 @@
|
||||||
import type { BaseEmoji } from 'emoji-mart';
|
import type { BaseEmoji } from 'emoji-mart';
|
||||||
import type { Emoji } from 'emoji-mart/dist-es/utils/data';
|
import type { Emoji } from 'emoji-mart/dist-es/utils/data';
|
||||||
|
|
||||||
import type { Search, ShortCodesToEmojiData } from './emoji_compressed';
|
import type { Search, ShortCodesToEmojiData } from './emoji_compressed.mjs';
|
||||||
import emojiCompressed from './emoji_compressed';
|
import emojiCompressed from './emoji_compressed.mjs';
|
||||||
import { unicodeToUnifiedName } from './unicode_to_unified_name';
|
import { unicodeToUnifiedName } from './unicode_to_unified_name';
|
||||||
|
|
||||||
type Emojis = Record<
|
type Emojis = Record<
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
import type {
|
import type {
|
||||||
FilenameData,
|
FilenameData,
|
||||||
ShortCodesToEmojiDataKey,
|
ShortCodesToEmojiDataKey,
|
||||||
} from './emoji_compressed';
|
} from './emoji_compressed.mjs';
|
||||||
import emojiCompressed from './emoji_compressed';
|
import emojiCompressed from './emoji_compressed.mjs';
|
||||||
import { unicodeToFilename } from './unicode_to_filename';
|
import { unicodeToFilename } from './unicode_to_filename';
|
||||||
|
|
||||||
type UnicodeMapping = Record<
|
type UnicodeMapping = Record<
|
||||||
|
|
|
@ -104,7 +104,7 @@ export const config: UserConfigFnPromise = async ({ mode, command }) => {
|
||||||
}),
|
}),
|
||||||
react({
|
react({
|
||||||
babel: {
|
babel: {
|
||||||
plugins: ['formatjs', 'transform-react-remove-prop-types'],
|
plugins: ['formatjs', 'transform-react-remove-prop-types', 'preval'],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
MastodonServiceWorkerLocales(),
|
MastodonServiceWorkerLocales(),
|
||||||
|
@ -132,7 +132,6 @@ export const config: UserConfigFnPromise = async ({ mode, command }) => {
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
svgr(),
|
svgr(),
|
||||||
// manifestSRI(),
|
|
||||||
// Old library types need to be converted
|
// Old library types need to be converted
|
||||||
optimizeLodashImports() as PluginOption,
|
optimizeLodashImports() as PluginOption,
|
||||||
!!process.env.ANALYZE_BUNDLE_SIZE && analyzer({ analyzerMode: 'static' }),
|
!!process.env.ANALYZE_BUNDLE_SIZE && analyzer({ analyzerMode: 'static' }),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user