[MM-21184] Enabled Hermes (#3814)
* Enable Hermes * Don't sort emojis in selector * No need for transformer * Remove unnecessary packager files
This commit is contained in:
parent
bae91c9945
commit
6879388d04
8 changed files with 4 additions and 2235 deletions
|
|
@ -75,7 +75,7 @@ import com.android.build.OutputFile
|
|||
project.ext.react = [
|
||||
entryFile: "index.js",
|
||||
bundleConfig: "metro.config.js",
|
||||
enableHermes: false,
|
||||
enableHermes: true,
|
||||
]
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import AutocompleteDivider from 'app/components/autocomplete/autocomplete_divide
|
|||
import Emoji from 'app/components/emoji';
|
||||
import TouchableWithFeedback from 'app/components/touchable_with_feedback';
|
||||
import {BuiltInEmojis} from 'app/utils/emojis';
|
||||
import {getEmojiByName} from 'app/utils/emoji_utils';
|
||||
import {getEmojiByName, compareEmojis} from 'app/utils/emoji_utils';
|
||||
import {makeStyleSheetFromTheme} from 'app/utils/theme';
|
||||
|
||||
const EMOJI_REGEX = /(^|\s|^\+|^-)(:([^:\s]*))$/i;
|
||||
|
|
@ -100,7 +100,7 @@ export default class EmojiSuggestion extends PureComponent {
|
|||
setEmojiData = (data) => {
|
||||
this.setState({
|
||||
active: data.length > 0,
|
||||
dataSource: data,
|
||||
dataSource: data.sort(compareEmojis),
|
||||
});
|
||||
|
||||
this.props.onResultCountChange(data.length);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import {autocompleteCustomEmojis} from 'mattermost-redux/actions/emojis';
|
|||
import {addReactionToLatestPost} from 'app/actions/views/emoji';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {EmojiIndicesByAlias} from 'app/utils/emojis';
|
||||
import {compareEmojis} from 'app/utils/emoji_utils';
|
||||
|
||||
import EmojiSuggestion from './emoji_suggestion';
|
||||
import Fuse from 'fuse.js';
|
||||
|
|
@ -24,7 +23,7 @@ const getEmojisByName = createSelector(
|
|||
emoticons.add(key);
|
||||
}
|
||||
|
||||
return Array.from(emoticons).sort(compareEmojis);
|
||||
return Array.from(emoticons);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +1,7 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
/* eslint-disable no-console */
|
||||
const modulePaths = require('./packager/modulePaths');
|
||||
const resolve = require('path').resolve;
|
||||
const fs = require('fs');
|
||||
|
||||
const platformRegex = /\.(android\.js|ios\.js)/g;
|
||||
const modulesRegex = /\/(node_modules)/;
|
||||
|
||||
// This script will let the react native packager what modules to include
|
||||
// in the main bundle and what modules to blacklist from the inline requires
|
||||
// this modules are taken from the modulePaths.js file
|
||||
|
||||
const config = {
|
||||
transformer: {
|
||||
getTransformOptions: (entryFile, {platform}) => {
|
||||
console.log('BUILDING MODULES FOR', platform);
|
||||
const moduleMap = {};
|
||||
modulePaths.forEach((path) => {
|
||||
let realPath = path;
|
||||
if (platform && platformRegex.test(realPath)) {
|
||||
realPath = path.replace(platformRegex, `.${platform}.js`);
|
||||
}
|
||||
|
||||
let fsFile = realPath;
|
||||
if (path.match(modulesRegex).length > 1) {
|
||||
fsFile = path.replace(modulesRegex, '');
|
||||
}
|
||||
|
||||
if (fs.existsSync(fsFile)) {
|
||||
moduleMap[resolve(realPath)] = true;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
preloadedModules: moduleMap,
|
||||
transform: {},
|
||||
};
|
||||
},
|
||||
},
|
||||
maxWorkers: 4,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
### Steps to update the moduleNames.js and modulePaths.js
|
||||
|
||||
1. Uncomment the code snippet in index.js
|
||||
2. Run the app on an Android device/simulator in development mode
|
||||
3. Open the App, enable the JavaScript debugger from the debug menu, and open the debugger
|
||||
4. Copy the console output starting with `module.exports =` into `packager/moduleNames.js`
|
||||
4. Run `node packager/generateModulePaths.js`
|
||||
5. Run `./node_modules/.bin/eslint --fix packager/module*`
|
||||
6. Open modulePaths.js
|
||||
7. Remove entries for files that don't need to exist on app load:
|
||||
- announcement_banner
|
||||
- options_context
|
||||
- remove_markdown
|
||||
- retry_bar_indicator
|
||||
- search_bar
|
||||
- sidebars
|
||||
- swiper
|
||||
- team_icon
|
||||
- react-deep-force-update
|
||||
- react-devtools-core
|
||||
- react-native-video
|
||||
- react-native/Libraries/Core/Devtools
|
||||
- react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev
|
||||
- react-native/Libraries/YellowBox
|
||||
- redux-devtools-instrument
|
||||
- remove-redux-devtools
|
||||
- remotedev-utils
|
||||
- socketcluster-client
|
||||
- stacktrace-parser
|
||||
- react-navigation
|
||||
8. Change development versions of certain files to production ones:
|
||||
- configureStore.dev.js -> configureStore.prod.js
|
||||
- react/cjs/react.development.js -> react/cjs/react.production.min.js
|
||||
- schedule/cjs/scheduler-tracing.development.js -> schedule/cjs/scheduler-tracing.production.min.js
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
/* eslint-disable no-console */
|
||||
const execSync = require('child_process').execSync;
|
||||
const fs = require('fs');
|
||||
const moduleNames = require('./moduleNames');
|
||||
|
||||
const pjson = require('../package.json');
|
||||
const localPrefix = `${pjson.name}/`;
|
||||
|
||||
// Transforming to Module Paths
|
||||
// This script will convert the module names found in moduleNames.js
|
||||
// to the absolute module path that we need.
|
||||
const modulePaths = moduleNames.map((moduleName) => {
|
||||
if (moduleName.startsWith(localPrefix)) {
|
||||
return `./${moduleName.substring(localPrefix.length)}`;
|
||||
}
|
||||
if (moduleName.endsWith('.js')) {
|
||||
return `./node_modules/${moduleName}`;
|
||||
}
|
||||
try {
|
||||
const result = execSync(
|
||||
`grep "@providesModule ${moduleName}" $(find . -name ${moduleName}\\\\.js) -l`
|
||||
).toString().trim().split('\n')[0];
|
||||
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
const paths = modulePaths.filter((path) => path != null).map((path) => `'${path}'`).join(',\n');
|
||||
|
||||
const fileData = `module.exports = [${paths}];`;
|
||||
|
||||
fs.writeFile('./packager/modulePaths.js', fileData, (err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
console.log('Done');
|
||||
});
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue