From 2d173d83b99b4ff840211ba2d0ac4b30d7535715 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Sun, 2 Oct 2016 17:27:45 +0530 Subject: [PATCH 01/13] Upgrade to babel6 and enable some presets. --- .babelrc | 4 + package.json | 17 +- reskindex.js | 4 +- src/component-index.js | 300 ++++++++++++++++--------- src/components/views/rooms/RoomList.js | 2 +- src/components/views/rooms/RoomTile.js | 2 +- 6 files changed, 221 insertions(+), 108 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000000..841d22c2b4 --- /dev/null +++ b/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["react", "es2015", "es2016", "es2017", "stage-0"], + "plugins": ["transform-runtime"] +} diff --git a/package.json b/package.json index d82ec90c58..2e6bf73113 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ }, "scripts": { "reskindex": "./reskindex.js -h header", - "build": "babel src -d lib --source-maps --stage 1", - "start": "babel src -w -d lib --source-maps --stage 1", + "build": "babel src -d lib --source-maps", + "start": "babel src -w -d lib --source-maps", "lint": "eslint src/", "lintall": "eslint src/ test/", "clean": "rimraf lib", @@ -24,6 +24,7 @@ "test-multi": "karma start $KARMAFLAGS --single-run=false" }, "dependencies": { + "babel-runtime": "^6.11.6", "browser-request": "^0.3.3", "classnames": "^2.1.2", "draft-js": "^0.8.1", @@ -56,11 +57,17 @@ "let's stick with v5 for now." ], "devDependencies": { - "babel": "^5.8.23", - "babel-core": "^5.8.38", + "babel-cli": "^6.5.2", + "babel-core": "^6.14.0", "babel-eslint": "^6.1.0", - "babel-loader": "^5.4.0", + "babel-loader": "^6.2.5", + "babel-plugin-transform-runtime": "^6.15.0", "babel-polyfill": "^6.5.0", + "babel-preset-es2015": "^6.14.0", + "babel-preset-es2016": "^6.11.3", + "babel-preset-es2017": "^6.14.0", + "babel-preset-react": "^6.11.1", + "babel-preset-stage-0": "^6.5.0", "eslint": "^2.13.1", "eslint-plugin-flowtype": "^2.17.0", "eslint-plugin-react": "^6.2.1", diff --git a/reskindex.js b/reskindex.js index 5cf9720373..d6ddffdf3e 100755 --- a/reskindex.js +++ b/reskindex.js @@ -42,8 +42,10 @@ for (var i = 0; i < files.length; ++i) { var file = files[i].replace('.js', ''); var moduleName = (file.replace(/\//g, '.')); + var importName = moduleName.replace(/\./g, "$"); - strm.write("module.exports.components['"+moduleName+"'] = require('./components/"+file+"');"); + strm.write("import " + importName + " from './components/" + file + "';\n"); + strm.write("module.exports.components['"+moduleName+"'] = " + importName + ";"); strm.write('\n'); strm.uncork(); } diff --git a/src/component-index.js b/src/component-index.js index 4122d0a631..8454389e93 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -25,103 +25,203 @@ limitations under the License. */ module.exports.components = {}; -module.exports.components['structures.ContextualMenu'] = require('./components/structures/ContextualMenu'); -module.exports.components['structures.CreateRoom'] = require('./components/structures/CreateRoom'); -module.exports.components['structures.FilePanel'] = require('./components/structures/FilePanel'); -module.exports.components['structures.MatrixChat'] = require('./components/structures/MatrixChat'); -module.exports.components['structures.MessagePanel'] = require('./components/structures/MessagePanel'); -module.exports.components['structures.NotificationPanel'] = require('./components/structures/NotificationPanel'); -module.exports.components['structures.RoomStatusBar'] = require('./components/structures/RoomStatusBar'); -module.exports.components['structures.RoomView'] = require('./components/structures/RoomView'); -module.exports.components['structures.ScrollPanel'] = require('./components/structures/ScrollPanel'); -module.exports.components['structures.TimelinePanel'] = require('./components/structures/TimelinePanel'); -module.exports.components['structures.UploadBar'] = require('./components/structures/UploadBar'); -module.exports.components['structures.UserSettings'] = require('./components/structures/UserSettings'); -module.exports.components['structures.login.ForgotPassword'] = require('./components/structures/login/ForgotPassword'); -module.exports.components['structures.login.Login'] = require('./components/structures/login/Login'); -module.exports.components['structures.login.PostRegistration'] = require('./components/structures/login/PostRegistration'); -module.exports.components['structures.login.Registration'] = require('./components/structures/login/Registration'); -module.exports.components['views.avatars.BaseAvatar'] = require('./components/views/avatars/BaseAvatar'); -module.exports.components['views.avatars.MemberAvatar'] = require('./components/views/avatars/MemberAvatar'); -module.exports.components['views.avatars.RoomAvatar'] = require('./components/views/avatars/RoomAvatar'); -module.exports.components['views.create_room.CreateRoomButton'] = require('./components/views/create_room/CreateRoomButton'); -module.exports.components['views.create_room.Presets'] = require('./components/views/create_room/Presets'); -module.exports.components['views.create_room.RoomAlias'] = require('./components/views/create_room/RoomAlias'); -module.exports.components['views.dialogs.ChatInviteDialog'] = require('./components/views/dialogs/ChatInviteDialog'); -module.exports.components['views.dialogs.DeactivateAccountDialog'] = require('./components/views/dialogs/DeactivateAccountDialog'); -module.exports.components['views.dialogs.EncryptedEventDialog'] = require('./components/views/dialogs/EncryptedEventDialog'); -module.exports.components['views.dialogs.ErrorDialog'] = require('./components/views/dialogs/ErrorDialog'); -module.exports.components['views.dialogs.LogoutPrompt'] = require('./components/views/dialogs/LogoutPrompt'); -module.exports.components['views.dialogs.NeedToRegisterDialog'] = require('./components/views/dialogs/NeedToRegisterDialog'); -module.exports.components['views.dialogs.QuestionDialog'] = require('./components/views/dialogs/QuestionDialog'); -module.exports.components['views.dialogs.SetDisplayNameDialog'] = require('./components/views/dialogs/SetDisplayNameDialog'); -module.exports.components['views.dialogs.TextInputDialog'] = require('./components/views/dialogs/TextInputDialog'); -module.exports.components['views.elements.AddressSelector'] = require('./components/views/elements/AddressSelector'); -module.exports.components['views.elements.AddressTile'] = require('./components/views/elements/AddressTile'); -module.exports.components['views.elements.DeviceVerifyButtons'] = require('./components/views/elements/DeviceVerifyButtons'); -module.exports.components['views.elements.DirectorySearchBox'] = require('./components/views/elements/DirectorySearchBox'); -module.exports.components['views.elements.EditableText'] = require('./components/views/elements/EditableText'); -module.exports.components['views.elements.EditableTextContainer'] = require('./components/views/elements/EditableTextContainer'); -module.exports.components['views.elements.EmojiText'] = require('./components/views/elements/EmojiText'); -module.exports.components['views.elements.PowerSelector'] = require('./components/views/elements/PowerSelector'); -module.exports.components['views.elements.ProgressBar'] = require('./components/views/elements/ProgressBar'); -module.exports.components['views.elements.TintableSvg'] = require('./components/views/elements/TintableSvg'); -module.exports.components['views.elements.TruncatedList'] = require('./components/views/elements/TruncatedList'); -module.exports.components['views.elements.UserSelector'] = require('./components/views/elements/UserSelector'); -module.exports.components['views.login.CaptchaForm'] = require('./components/views/login/CaptchaForm'); -module.exports.components['views.login.CasLogin'] = require('./components/views/login/CasLogin'); -module.exports.components['views.login.CustomServerDialog'] = require('./components/views/login/CustomServerDialog'); -module.exports.components['views.login.LoginFooter'] = require('./components/views/login/LoginFooter'); -module.exports.components['views.login.LoginHeader'] = require('./components/views/login/LoginHeader'); -module.exports.components['views.login.PasswordLogin'] = require('./components/views/login/PasswordLogin'); -module.exports.components['views.login.RegistrationForm'] = require('./components/views/login/RegistrationForm'); -module.exports.components['views.login.ServerConfig'] = require('./components/views/login/ServerConfig'); -module.exports.components['views.messages.MAudioBody'] = require('./components/views/messages/MAudioBody'); -module.exports.components['views.messages.MFileBody'] = require('./components/views/messages/MFileBody'); -module.exports.components['views.messages.MImageBody'] = require('./components/views/messages/MImageBody'); -module.exports.components['views.messages.MVideoBody'] = require('./components/views/messages/MVideoBody'); -module.exports.components['views.messages.MessageEvent'] = require('./components/views/messages/MessageEvent'); -module.exports.components['views.messages.SenderProfile'] = require('./components/views/messages/SenderProfile'); -module.exports.components['views.messages.TextualBody'] = require('./components/views/messages/TextualBody'); -module.exports.components['views.messages.TextualEvent'] = require('./components/views/messages/TextualEvent'); -module.exports.components['views.messages.UnknownBody'] = require('./components/views/messages/UnknownBody'); -module.exports.components['views.room_settings.AliasSettings'] = require('./components/views/room_settings/AliasSettings'); -module.exports.components['views.room_settings.ColorSettings'] = require('./components/views/room_settings/ColorSettings'); -module.exports.components['views.room_settings.UrlPreviewSettings'] = require('./components/views/room_settings/UrlPreviewSettings'); -module.exports.components['views.rooms.Autocomplete'] = require('./components/views/rooms/Autocomplete'); -module.exports.components['views.rooms.AuxPanel'] = require('./components/views/rooms/AuxPanel'); -module.exports.components['views.rooms.EntityTile'] = require('./components/views/rooms/EntityTile'); -module.exports.components['views.rooms.EventTile'] = require('./components/views/rooms/EventTile'); -module.exports.components['views.rooms.LinkPreviewWidget'] = require('./components/views/rooms/LinkPreviewWidget'); -module.exports.components['views.rooms.MemberDeviceInfo'] = require('./components/views/rooms/MemberDeviceInfo'); -module.exports.components['views.rooms.MemberInfo'] = require('./components/views/rooms/MemberInfo'); -module.exports.components['views.rooms.MemberList'] = require('./components/views/rooms/MemberList'); -module.exports.components['views.rooms.MemberTile'] = require('./components/views/rooms/MemberTile'); -module.exports.components['views.rooms.MessageComposer'] = require('./components/views/rooms/MessageComposer'); -module.exports.components['views.rooms.MessageComposerInput'] = require('./components/views/rooms/MessageComposerInput'); -module.exports.components['views.rooms.MessageComposerInputOld'] = require('./components/views/rooms/MessageComposerInputOld'); -module.exports.components['views.rooms.PresenceLabel'] = require('./components/views/rooms/PresenceLabel'); -module.exports.components['views.rooms.ReadReceiptMarker'] = require('./components/views/rooms/ReadReceiptMarker'); -module.exports.components['views.rooms.RoomHeader'] = require('./components/views/rooms/RoomHeader'); -module.exports.components['views.rooms.RoomList'] = require('./components/views/rooms/RoomList'); -module.exports.components['views.rooms.RoomNameEditor'] = require('./components/views/rooms/RoomNameEditor'); -module.exports.components['views.rooms.RoomPreviewBar'] = require('./components/views/rooms/RoomPreviewBar'); -module.exports.components['views.rooms.RoomSettings'] = require('./components/views/rooms/RoomSettings'); -module.exports.components['views.rooms.RoomTile'] = require('./components/views/rooms/RoomTile'); -module.exports.components['views.rooms.RoomTopicEditor'] = require('./components/views/rooms/RoomTopicEditor'); -module.exports.components['views.rooms.SearchResultTile'] = require('./components/views/rooms/SearchResultTile'); -module.exports.components['views.rooms.SearchableEntityList'] = require('./components/views/rooms/SearchableEntityList'); -module.exports.components['views.rooms.SimpleRoomHeader'] = require('./components/views/rooms/SimpleRoomHeader'); -module.exports.components['views.rooms.TabCompleteBar'] = require('./components/views/rooms/TabCompleteBar'); -module.exports.components['views.rooms.TopUnreadMessagesBar'] = require('./components/views/rooms/TopUnreadMessagesBar'); -module.exports.components['views.rooms.UserTile'] = require('./components/views/rooms/UserTile'); -module.exports.components['views.settings.ChangeAvatar'] = require('./components/views/settings/ChangeAvatar'); -module.exports.components['views.settings.ChangeDisplayName'] = require('./components/views/settings/ChangeDisplayName'); -module.exports.components['views.settings.ChangePassword'] = require('./components/views/settings/ChangePassword'); -module.exports.components['views.settings.DevicesPanel'] = require('./components/views/settings/DevicesPanel'); -module.exports.components['views.settings.DevicesPanelEntry'] = require('./components/views/settings/DevicesPanelEntry'); -module.exports.components['views.settings.EnableNotificationsButton'] = require('./components/views/settings/EnableNotificationsButton'); -module.exports.components['views.voip.CallView'] = require('./components/views/voip/CallView'); -module.exports.components['views.voip.IncomingCallBox'] = require('./components/views/voip/IncomingCallBox'); -module.exports.components['views.voip.VideoFeed'] = require('./components/views/voip/VideoFeed'); -module.exports.components['views.voip.VideoView'] = require('./components/views/voip/VideoView'); +import structures$ContextualMenu from './components/structures/ContextualMenu'; +module.exports.components['structures.ContextualMenu'] = structures$ContextualMenu; +import structures$CreateRoom from './components/structures/CreateRoom'; +module.exports.components['structures.CreateRoom'] = structures$CreateRoom; +import structures$FilePanel from './components/structures/FilePanel'; +module.exports.components['structures.FilePanel'] = structures$FilePanel; +import structures$MatrixChat from './components/structures/MatrixChat'; +module.exports.components['structures.MatrixChat'] = structures$MatrixChat; +import structures$MessagePanel from './components/structures/MessagePanel'; +module.exports.components['structures.MessagePanel'] = structures$MessagePanel; +import structures$NotificationPanel from './components/structures/NotificationPanel'; +module.exports.components['structures.NotificationPanel'] = structures$NotificationPanel; +import structures$RoomStatusBar from './components/structures/RoomStatusBar'; +module.exports.components['structures.RoomStatusBar'] = structures$RoomStatusBar; +import structures$RoomView from './components/structures/RoomView'; +module.exports.components['structures.RoomView'] = structures$RoomView; +import structures$ScrollPanel from './components/structures/ScrollPanel'; +module.exports.components['structures.ScrollPanel'] = structures$ScrollPanel; +import structures$TimelinePanel from './components/structures/TimelinePanel'; +module.exports.components['structures.TimelinePanel'] = structures$TimelinePanel; +import structures$UploadBar from './components/structures/UploadBar'; +module.exports.components['structures.UploadBar'] = structures$UploadBar; +import structures$UserSettings from './components/structures/UserSettings'; +module.exports.components['structures.UserSettings'] = structures$UserSettings; +import structures$login$ForgotPassword from './components/structures/login/ForgotPassword'; +module.exports.components['structures.login.ForgotPassword'] = structures$login$ForgotPassword; +import structures$login$Login from './components/structures/login/Login'; +module.exports.components['structures.login.Login'] = structures$login$Login; +import structures$login$PostRegistration from './components/structures/login/PostRegistration'; +module.exports.components['structures.login.PostRegistration'] = structures$login$PostRegistration; +import structures$login$Registration from './components/structures/login/Registration'; +module.exports.components['structures.login.Registration'] = structures$login$Registration; +import views$avatars$BaseAvatar from './components/views/avatars/BaseAvatar'; +module.exports.components['views.avatars.BaseAvatar'] = views$avatars$BaseAvatar; +import views$avatars$MemberAvatar from './components/views/avatars/MemberAvatar'; +module.exports.components['views.avatars.MemberAvatar'] = views$avatars$MemberAvatar; +import views$avatars$RoomAvatar from './components/views/avatars/RoomAvatar'; +module.exports.components['views.avatars.RoomAvatar'] = views$avatars$RoomAvatar; +import views$create_room$CreateRoomButton from './components/views/create_room/CreateRoomButton'; +module.exports.components['views.create_room.CreateRoomButton'] = views$create_room$CreateRoomButton; +import views$create_room$Presets from './components/views/create_room/Presets'; +module.exports.components['views.create_room.Presets'] = views$create_room$Presets; +import views$create_room$RoomAlias from './components/views/create_room/RoomAlias'; +module.exports.components['views.create_room.RoomAlias'] = views$create_room$RoomAlias; +import views$dialogs$ChatInviteDialog from './components/views/dialogs/ChatInviteDialog'; +module.exports.components['views.dialogs.ChatInviteDialog'] = views$dialogs$ChatInviteDialog; +import views$dialogs$DeactivateAccountDialog from './components/views/dialogs/DeactivateAccountDialog'; +module.exports.components['views.dialogs.DeactivateAccountDialog'] = views$dialogs$DeactivateAccountDialog; +import views$dialogs$EncryptedEventDialog from './components/views/dialogs/EncryptedEventDialog'; +module.exports.components['views.dialogs.EncryptedEventDialog'] = views$dialogs$EncryptedEventDialog; +import views$dialogs$ErrorDialog from './components/views/dialogs/ErrorDialog'; +module.exports.components['views.dialogs.ErrorDialog'] = views$dialogs$ErrorDialog; +import views$dialogs$LogoutPrompt from './components/views/dialogs/LogoutPrompt'; +module.exports.components['views.dialogs.LogoutPrompt'] = views$dialogs$LogoutPrompt; +import views$dialogs$NeedToRegisterDialog from './components/views/dialogs/NeedToRegisterDialog'; +module.exports.components['views.dialogs.NeedToRegisterDialog'] = views$dialogs$NeedToRegisterDialog; +import views$dialogs$QuestionDialog from './components/views/dialogs/QuestionDialog'; +module.exports.components['views.dialogs.QuestionDialog'] = views$dialogs$QuestionDialog; +import views$dialogs$SetDisplayNameDialog from './components/views/dialogs/SetDisplayNameDialog'; +module.exports.components['views.dialogs.SetDisplayNameDialog'] = views$dialogs$SetDisplayNameDialog; +import views$dialogs$TextInputDialog from './components/views/dialogs/TextInputDialog'; +module.exports.components['views.dialogs.TextInputDialog'] = views$dialogs$TextInputDialog; +import views$elements$AddressSelector from './components/views/elements/AddressSelector'; +module.exports.components['views.elements.AddressSelector'] = views$elements$AddressSelector; +import views$elements$AddressTile from './components/views/elements/AddressTile'; +module.exports.components['views.elements.AddressTile'] = views$elements$AddressTile; +import views$elements$DeviceVerifyButtons from './components/views/elements/DeviceVerifyButtons'; +module.exports.components['views.elements.DeviceVerifyButtons'] = views$elements$DeviceVerifyButtons; +import views$elements$DirectorySearchBox from './components/views/elements/DirectorySearchBox'; +module.exports.components['views.elements.DirectorySearchBox'] = views$elements$DirectorySearchBox; +import views$elements$EditableText from './components/views/elements/EditableText'; +module.exports.components['views.elements.EditableText'] = views$elements$EditableText; +import views$elements$EditableTextContainer from './components/views/elements/EditableTextContainer'; +module.exports.components['views.elements.EditableTextContainer'] = views$elements$EditableTextContainer; +import views$elements$EmojiText from './components/views/elements/EmojiText'; +module.exports.components['views.elements.EmojiText'] = views$elements$EmojiText; +import views$elements$PowerSelector from './components/views/elements/PowerSelector'; +module.exports.components['views.elements.PowerSelector'] = views$elements$PowerSelector; +import views$elements$ProgressBar from './components/views/elements/ProgressBar'; +module.exports.components['views.elements.ProgressBar'] = views$elements$ProgressBar; +import views$elements$TintableSvg from './components/views/elements/TintableSvg'; +module.exports.components['views.elements.TintableSvg'] = views$elements$TintableSvg; +import views$elements$TruncatedList from './components/views/elements/TruncatedList'; +module.exports.components['views.elements.TruncatedList'] = views$elements$TruncatedList; +import views$elements$UserSelector from './components/views/elements/UserSelector'; +module.exports.components['views.elements.UserSelector'] = views$elements$UserSelector; +import views$login$CaptchaForm from './components/views/login/CaptchaForm'; +module.exports.components['views.login.CaptchaForm'] = views$login$CaptchaForm; +import views$login$CasLogin from './components/views/login/CasLogin'; +module.exports.components['views.login.CasLogin'] = views$login$CasLogin; +import views$login$CustomServerDialog from './components/views/login/CustomServerDialog'; +module.exports.components['views.login.CustomServerDialog'] = views$login$CustomServerDialog; +import views$login$LoginFooter from './components/views/login/LoginFooter'; +module.exports.components['views.login.LoginFooter'] = views$login$LoginFooter; +import views$login$LoginHeader from './components/views/login/LoginHeader'; +module.exports.components['views.login.LoginHeader'] = views$login$LoginHeader; +import views$login$PasswordLogin from './components/views/login/PasswordLogin'; +module.exports.components['views.login.PasswordLogin'] = views$login$PasswordLogin; +import views$login$RegistrationForm from './components/views/login/RegistrationForm'; +module.exports.components['views.login.RegistrationForm'] = views$login$RegistrationForm; +import views$login$ServerConfig from './components/views/login/ServerConfig'; +module.exports.components['views.login.ServerConfig'] = views$login$ServerConfig; +import views$messages$MAudioBody from './components/views/messages/MAudioBody'; +module.exports.components['views.messages.MAudioBody'] = views$messages$MAudioBody; +import views$messages$MFileBody from './components/views/messages/MFileBody'; +module.exports.components['views.messages.MFileBody'] = views$messages$MFileBody; +import views$messages$MImageBody from './components/views/messages/MImageBody'; +module.exports.components['views.messages.MImageBody'] = views$messages$MImageBody; +import views$messages$MVideoBody from './components/views/messages/MVideoBody'; +module.exports.components['views.messages.MVideoBody'] = views$messages$MVideoBody; +import views$messages$MessageEvent from './components/views/messages/MessageEvent'; +module.exports.components['views.messages.MessageEvent'] = views$messages$MessageEvent; +import views$messages$SenderProfile from './components/views/messages/SenderProfile'; +module.exports.components['views.messages.SenderProfile'] = views$messages$SenderProfile; +import views$messages$TextualBody from './components/views/messages/TextualBody'; +module.exports.components['views.messages.TextualBody'] = views$messages$TextualBody; +import views$messages$TextualEvent from './components/views/messages/TextualEvent'; +module.exports.components['views.messages.TextualEvent'] = views$messages$TextualEvent; +import views$messages$UnknownBody from './components/views/messages/UnknownBody'; +module.exports.components['views.messages.UnknownBody'] = views$messages$UnknownBody; +import views$room_settings$AliasSettings from './components/views/room_settings/AliasSettings'; +module.exports.components['views.room_settings.AliasSettings'] = views$room_settings$AliasSettings; +import views$room_settings$ColorSettings from './components/views/room_settings/ColorSettings'; +module.exports.components['views.room_settings.ColorSettings'] = views$room_settings$ColorSettings; +import views$room_settings$UrlPreviewSettings from './components/views/room_settings/UrlPreviewSettings'; +module.exports.components['views.room_settings.UrlPreviewSettings'] = views$room_settings$UrlPreviewSettings; +import views$rooms$Autocomplete from './components/views/rooms/Autocomplete'; +module.exports.components['views.rooms.Autocomplete'] = views$rooms$Autocomplete; +import views$rooms$AuxPanel from './components/views/rooms/AuxPanel'; +module.exports.components['views.rooms.AuxPanel'] = views$rooms$AuxPanel; +import views$rooms$EntityTile from './components/views/rooms/EntityTile'; +module.exports.components['views.rooms.EntityTile'] = views$rooms$EntityTile; +import views$rooms$EventTile from './components/views/rooms/EventTile'; +module.exports.components['views.rooms.EventTile'] = views$rooms$EventTile; +import views$rooms$LinkPreviewWidget from './components/views/rooms/LinkPreviewWidget'; +module.exports.components['views.rooms.LinkPreviewWidget'] = views$rooms$LinkPreviewWidget; +import views$rooms$MemberDeviceInfo from './components/views/rooms/MemberDeviceInfo'; +module.exports.components['views.rooms.MemberDeviceInfo'] = views$rooms$MemberDeviceInfo; +import views$rooms$MemberInfo from './components/views/rooms/MemberInfo'; +module.exports.components['views.rooms.MemberInfo'] = views$rooms$MemberInfo; +import views$rooms$MemberList from './components/views/rooms/MemberList'; +module.exports.components['views.rooms.MemberList'] = views$rooms$MemberList; +import views$rooms$MemberTile from './components/views/rooms/MemberTile'; +module.exports.components['views.rooms.MemberTile'] = views$rooms$MemberTile; +import views$rooms$MessageComposer from './components/views/rooms/MessageComposer'; +module.exports.components['views.rooms.MessageComposer'] = views$rooms$MessageComposer; +import views$rooms$MessageComposerInput from './components/views/rooms/MessageComposerInput'; +module.exports.components['views.rooms.MessageComposerInput'] = views$rooms$MessageComposerInput; +import views$rooms$MessageComposerInputOld from './components/views/rooms/MessageComposerInputOld'; +module.exports.components['views.rooms.MessageComposerInputOld'] = views$rooms$MessageComposerInputOld; +import views$rooms$PresenceLabel from './components/views/rooms/PresenceLabel'; +module.exports.components['views.rooms.PresenceLabel'] = views$rooms$PresenceLabel; +import views$rooms$ReadReceiptMarker from './components/views/rooms/ReadReceiptMarker'; +module.exports.components['views.rooms.ReadReceiptMarker'] = views$rooms$ReadReceiptMarker; +import views$rooms$RoomHeader from './components/views/rooms/RoomHeader'; +module.exports.components['views.rooms.RoomHeader'] = views$rooms$RoomHeader; +import views$rooms$RoomList from './components/views/rooms/RoomList'; +module.exports.components['views.rooms.RoomList'] = views$rooms$RoomList; +import views$rooms$RoomNameEditor from './components/views/rooms/RoomNameEditor'; +module.exports.components['views.rooms.RoomNameEditor'] = views$rooms$RoomNameEditor; +import views$rooms$RoomPreviewBar from './components/views/rooms/RoomPreviewBar'; +module.exports.components['views.rooms.RoomPreviewBar'] = views$rooms$RoomPreviewBar; +import views$rooms$RoomSettings from './components/views/rooms/RoomSettings'; +module.exports.components['views.rooms.RoomSettings'] = views$rooms$RoomSettings; +import views$rooms$RoomTile from './components/views/rooms/RoomTile'; +module.exports.components['views.rooms.RoomTile'] = views$rooms$RoomTile; +import views$rooms$RoomTopicEditor from './components/views/rooms/RoomTopicEditor'; +module.exports.components['views.rooms.RoomTopicEditor'] = views$rooms$RoomTopicEditor; +import views$rooms$SearchResultTile from './components/views/rooms/SearchResultTile'; +module.exports.components['views.rooms.SearchResultTile'] = views$rooms$SearchResultTile; +import views$rooms$SearchableEntityList from './components/views/rooms/SearchableEntityList'; +module.exports.components['views.rooms.SearchableEntityList'] = views$rooms$SearchableEntityList; +import views$rooms$SimpleRoomHeader from './components/views/rooms/SimpleRoomHeader'; +module.exports.components['views.rooms.SimpleRoomHeader'] = views$rooms$SimpleRoomHeader; +import views$rooms$TabCompleteBar from './components/views/rooms/TabCompleteBar'; +module.exports.components['views.rooms.TabCompleteBar'] = views$rooms$TabCompleteBar; +import views$rooms$TopUnreadMessagesBar from './components/views/rooms/TopUnreadMessagesBar'; +module.exports.components['views.rooms.TopUnreadMessagesBar'] = views$rooms$TopUnreadMessagesBar; +import views$rooms$UserTile from './components/views/rooms/UserTile'; +module.exports.components['views.rooms.UserTile'] = views$rooms$UserTile; +import views$settings$ChangeAvatar from './components/views/settings/ChangeAvatar'; +module.exports.components['views.settings.ChangeAvatar'] = views$settings$ChangeAvatar; +import views$settings$ChangeDisplayName from './components/views/settings/ChangeDisplayName'; +module.exports.components['views.settings.ChangeDisplayName'] = views$settings$ChangeDisplayName; +import views$settings$ChangePassword from './components/views/settings/ChangePassword'; +module.exports.components['views.settings.ChangePassword'] = views$settings$ChangePassword; +import views$settings$DevicesPanel from './components/views/settings/DevicesPanel'; +module.exports.components['views.settings.DevicesPanel'] = views$settings$DevicesPanel; +import views$settings$DevicesPanelEntry from './components/views/settings/DevicesPanelEntry'; +module.exports.components['views.settings.DevicesPanelEntry'] = views$settings$DevicesPanelEntry; +import views$settings$EnableNotificationsButton from './components/views/settings/EnableNotificationsButton'; +module.exports.components['views.settings.EnableNotificationsButton'] = views$settings$EnableNotificationsButton; +import views$voip$CallView from './components/views/voip/CallView'; +module.exports.components['views.voip.CallView'] = views$voip$CallView; +import views$voip$IncomingCallBox from './components/views/voip/IncomingCallBox'; +module.exports.components['views.voip.IncomingCallBox'] = views$voip$IncomingCallBox; +import views$voip$VideoFeed from './components/views/voip/VideoFeed'; +module.exports.components['views.voip.VideoFeed'] = views$voip$VideoFeed; +import views$voip$VideoView from './components/views/voip/VideoView'; +module.exports.components['views.voip.VideoView'] = views$voip$VideoView; diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index f26409e489..3ced4102d4 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -26,7 +26,7 @@ var dis = require("../../../dispatcher"); var sdk = require('../../../index'); var rate_limited_func = require('../../../ratelimitedfunc'); var Rooms = require('../../../Rooms'); -var DMRoomMap = require('../../../utils/DMRoomMap'); +import DMRoomMap from '../../../utils/DMRoomMap'; var Receipt = require('../../../utils/Receipt'); var HIDE_CONFERENCE_CHANS = true; diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 1f0338a4de..84916f8ab8 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -21,7 +21,7 @@ var ReactDOM = require("react-dom"); var classNames = require('classnames'); var dis = require("../../../dispatcher"); var MatrixClientPeg = require('../../../MatrixClientPeg'); -var DMRoomMap = require('../../../utils/DMRoomMap'); +import DMRoomMap from '../../../utils/DMRoomMap'; var sdk = require('../../../index'); var ContextualMenu = require('../../structures/ContextualMenu'); var RoomNotifs = require('../../../RoomNotifs'); From 4bea0c0818742908be7d55d9e678201b2d9ba313 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 12 Oct 2016 16:53:07 +0100 Subject: [PATCH 02/13] Add a script to check the version of babel cli Because the package has changed so npm can't just auto-upgrade, so this at least tells people how to fix it when the upgrade breaks it for everybody. --- babelcheck.js | 19 +++++++++++++++++++ package.json | 7 +++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 babelcheck.js diff --git a/babelcheck.js b/babelcheck.js new file mode 100644 index 0000000000..75579b1d3d --- /dev/null +++ b/babelcheck.js @@ -0,0 +1,19 @@ +var exec = require('child_process').exec; + +// Makes sure the babel executable in the path is babel 6 (or greater), not +// babel 5, which it is if you upgrade from an older version of react-sdk and +// run 'npm install' since the package has changed to babel-cli, so 'babel' +// remains installed and the executable in node_modules/.bin remains as babel +// 5. + +exec("babel -V", function (error, stdout, stderr) { + if (parseInt(stdout.substr(0,1), 10) < 6) { + console.log("\033[31m\033[1m"+ + '*****************************************\n'+ + '* matrix-react-sdk has moved to babel 6 *\n'+ + '* Please "rm -rf node_modules && npm i" *\n'+ + '*****************************************\n'+ + "\033[91m"); + process.exit(1); + } +}); diff --git a/package.json b/package.json index c17242b591..5b096821c3 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ }, "scripts": { "reskindex": "./reskindex.js -h header", - "build": "babel src -d lib --source-maps", - "start": "babel src -w -d lib --source-maps", + "build": "node babelcheck.js && babel src -d lib --source-maps", + "start": "node babelcheck.js && babel src -w -d lib --source-maps", "lint": "eslint src/", "lintall": "eslint src/ test/", "clean": "rimraf lib", @@ -89,5 +89,8 @@ "sinon": "^1.17.3", "source-map-loader": "^0.1.5", "webpack": "^1.12.14" + }, + "optionalDependencies": { + "babel": "6.5.2" } } From 5801bf60aa255a7bfdbd1bcb835a12b3e1c5f643 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 12 Oct 2016 17:26:43 +0100 Subject: [PATCH 03/13] Stage 0 is a little much --- .babelrc | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index 841d22c2b4..c30cbe08cb 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,4 @@ { - "presets": ["react", "es2015", "es2016", "es2017", "stage-0"], + "presets": ["react", "es2015", "es2016", "es2017", "stage-2"], "plugins": ["transform-runtime"] } diff --git a/package.json b/package.json index 5b096821c3..1778a44d29 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "babel-preset-es2016": "^6.11.3", "babel-preset-es2017": "^6.14.0", "babel-preset-react": "^6.11.1", - "babel-preset-stage-0": "^6.5.0", + "babel-preset-stage-2": "^6.17.0", "eslint": "^2.13.1", "eslint-plugin-flowtype": "^2.17.0", "eslint-plugin-react": "^6.2.1", From d29e19b1a08a88a6948f4538fb3e029d8edb3da3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 12 Oct 2016 17:45:13 +0100 Subject: [PATCH 04/13] Check return code because sometimes babel can just be completely broken --- babelcheck.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babelcheck.js b/babelcheck.js index 75579b1d3d..ab4077d325 100644 --- a/babelcheck.js +++ b/babelcheck.js @@ -7,7 +7,7 @@ var exec = require('child_process').exec; // 5. exec("babel -V", function (error, stdout, stderr) { - if (parseInt(stdout.substr(0,1), 10) < 6) { + if ((error && error.code) || parseInt(stdout.substr(0,1), 10) < 6) { console.log("\033[31m\033[1m"+ '*****************************************\n'+ '* matrix-react-sdk has moved to babel 6 *\n'+ From 51f6b94c26462d0d5fa1037e8db88575ec8cc22e Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 12 Oct 2016 18:08:13 +0100 Subject: [PATCH 05/13] Reminder to restore package links --- babelcheck.js | 1 + 1 file changed, 1 insertion(+) diff --git a/babelcheck.js b/babelcheck.js index ab4077d325..79648b45c0 100644 --- a/babelcheck.js +++ b/babelcheck.js @@ -12,6 +12,7 @@ exec("babel -V", function (error, stdout, stderr) { '*****************************************\n'+ '* matrix-react-sdk has moved to babel 6 *\n'+ '* Please "rm -rf node_modules && npm i" *\n'+ + '* then restore links as appropriate *\n'+ '*****************************************\n'+ "\033[91m"); process.exit(1); From 445230526fc026c8b80e23707759f2efbc11ec9f Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 09:39:12 +0100 Subject: [PATCH 06/13] Remove accidentally comitted babel updgrade hack Was trying to force it to upgrade babel to the stub babel 6 package rather than leaving the babel 5 ones, but it's too hacky. Also remove the outdated comment. --- package.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/package.json b/package.json index 1778a44d29..3cb23990f3 100644 --- a/package.json +++ b/package.json @@ -51,11 +51,6 @@ "velocity-vector": "vector-im/velocity#059e3b2", "whatwg-fetch": "^1.0.0" }, - "//babelversion": [ - "brief experiments with babel6 seems to show that it generates source ", - "maps which confuse chrome and make setting breakpoints tricky. So ", - "let's stick with v5 for now." - ], "devDependencies": { "babel-cli": "^6.5.2", "babel-core": "^6.14.0", @@ -89,8 +84,5 @@ "sinon": "^1.17.3", "source-map-loader": "^0.1.5", "webpack": "^1.12.14" - }, - "optionalDependencies": { - "babel": "6.5.2" } } From 3ebb8a7fa5dfd46dd771d18a22414eca581aa731 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 09:40:47 +0100 Subject: [PATCH 07/13] shebang --- babelcheck.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/babelcheck.js b/babelcheck.js index 79648b45c0..14e4a28a70 100644 --- a/babelcheck.js +++ b/babelcheck.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + var exec = require('child_process').exec; // Makes sure the babel executable in the path is babel 6 (or greater), not From 89ca18b5566e320bd9136b2d1c3f3c082c493868 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 09:45:07 +0100 Subject: [PATCH 08/13] Move scripts into scripts/ --- package.json | 8 ++++---- babelcheck.js => scripts/babelcheck.js | 0 reskindex.js => scripts/reskindex.js | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename babelcheck.js => scripts/babelcheck.js (100%) rename reskindex.js => scripts/reskindex.js (100%) diff --git a/package.json b/package.json index 3cb23990f3..a08aeb5a21 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,12 @@ "license": "Apache-2.0", "main": "lib/index.js", "bin": { - "reskindex": "./reskindex.js" + "reskindex": "scripts/reskindex.js" }, "scripts": { - "reskindex": "./reskindex.js -h header", - "build": "node babelcheck.js && babel src -d lib --source-maps", - "start": "node babelcheck.js && babel src -w -d lib --source-maps", + "reskindex": "scripts/reskindex.js -h header", + "build": "node scripts/babelcheck.js && babel src -d lib --source-maps", + "start": "node scripts/babelcheck.js && babel src -w -d lib --source-maps", "lint": "eslint src/", "lintall": "eslint src/ test/", "clean": "rimraf lib", diff --git a/babelcheck.js b/scripts/babelcheck.js similarity index 100% rename from babelcheck.js rename to scripts/babelcheck.js diff --git a/reskindex.js b/scripts/reskindex.js similarity index 100% rename from reskindex.js rename to scripts/reskindex.js From 2873541a1fab369a3aee2d575ec3e6350ebf6b0c Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 09:48:07 +0100 Subject: [PATCH 09/13] remove the presets from karma.conf.js as it seems to pick them up from .babelrc --- karma.conf.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index 45f5dd9998..131a03ce79 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -131,13 +131,7 @@ module.exports = function (config) { test: /\.js$/, loader: "babel", include: [path.resolve('./src'), path.resolve('./test'), - ], - query: { - // we're using react 5, for consistency with - // the release build, which doesn't use the - // presets. - // presets: ['react', 'es2015'], - }, + ] }, ], noParse: [ From 1336fe749099c210cd10e750d809bbca83642d68 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 10:36:11 +0100 Subject: [PATCH 10/13] Ignore components with no default export InteractiveAuthEntryComponents is not a single component and doesn't really fit into the structure: ignore it, otherwise we crash when loading the skin. --- scripts/reskindex.js | 2 +- src/component-index.js | 204 ++++++++++++++++++++--------------------- 2 files changed, 103 insertions(+), 103 deletions(-) diff --git a/scripts/reskindex.js b/scripts/reskindex.js index d6ddffdf3e..f9cbc2a711 100755 --- a/scripts/reskindex.js +++ b/scripts/reskindex.js @@ -45,7 +45,7 @@ for (var i = 0; i < files.length; ++i) { var importName = moduleName.replace(/\./g, "$"); strm.write("import " + importName + " from './components/" + file + "';\n"); - strm.write("module.exports.components['"+moduleName+"'] = " + importName + ";"); + strm.write(importName + " && (module.exports.components['"+moduleName+"'] = " + importName + ");"); strm.write('\n'); strm.uncork(); } diff --git a/src/component-index.js b/src/component-index.js index fd89a196fb..8fbf655879 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -26,206 +26,206 @@ limitations under the License. module.exports.components = {}; import structures$ContextualMenu from './components/structures/ContextualMenu'; -module.exports.components['structures.ContextualMenu'] = structures$ContextualMenu; +structures$ContextualMenu && (module.exports.components['structures.ContextualMenu'] = structures$ContextualMenu); import structures$CreateRoom from './components/structures/CreateRoom'; -module.exports.components['structures.CreateRoom'] = structures$CreateRoom; +structures$CreateRoom && (module.exports.components['structures.CreateRoom'] = structures$CreateRoom); import structures$FilePanel from './components/structures/FilePanel'; -module.exports.components['structures.FilePanel'] = structures$FilePanel; +structures$FilePanel && (module.exports.components['structures.FilePanel'] = structures$FilePanel); import structures$MatrixChat from './components/structures/MatrixChat'; -module.exports.components['structures.MatrixChat'] = structures$MatrixChat; +structures$MatrixChat && (module.exports.components['structures.MatrixChat'] = structures$MatrixChat); import structures$MessagePanel from './components/structures/MessagePanel'; -module.exports.components['structures.MessagePanel'] = structures$MessagePanel; +structures$MessagePanel && (module.exports.components['structures.MessagePanel'] = structures$MessagePanel); import structures$NotificationPanel from './components/structures/NotificationPanel'; -module.exports.components['structures.NotificationPanel'] = structures$NotificationPanel; +structures$NotificationPanel && (module.exports.components['structures.NotificationPanel'] = structures$NotificationPanel); import structures$RoomStatusBar from './components/structures/RoomStatusBar'; -module.exports.components['structures.RoomStatusBar'] = structures$RoomStatusBar; +structures$RoomStatusBar && (module.exports.components['structures.RoomStatusBar'] = structures$RoomStatusBar); import structures$RoomView from './components/structures/RoomView'; -module.exports.components['structures.RoomView'] = structures$RoomView; +structures$RoomView && (module.exports.components['structures.RoomView'] = structures$RoomView); import structures$ScrollPanel from './components/structures/ScrollPanel'; -module.exports.components['structures.ScrollPanel'] = structures$ScrollPanel; +structures$ScrollPanel && (module.exports.components['structures.ScrollPanel'] = structures$ScrollPanel); import structures$TimelinePanel from './components/structures/TimelinePanel'; -module.exports.components['structures.TimelinePanel'] = structures$TimelinePanel; +structures$TimelinePanel && (module.exports.components['structures.TimelinePanel'] = structures$TimelinePanel); import structures$UploadBar from './components/structures/UploadBar'; -module.exports.components['structures.UploadBar'] = structures$UploadBar; +structures$UploadBar && (module.exports.components['structures.UploadBar'] = structures$UploadBar); import structures$UserSettings from './components/structures/UserSettings'; -module.exports.components['structures.UserSettings'] = structures$UserSettings; +structures$UserSettings && (module.exports.components['structures.UserSettings'] = structures$UserSettings); import structures$login$ForgotPassword from './components/structures/login/ForgotPassword'; -module.exports.components['structures.login.ForgotPassword'] = structures$login$ForgotPassword; +structures$login$ForgotPassword && (module.exports.components['structures.login.ForgotPassword'] = structures$login$ForgotPassword); import structures$login$Login from './components/structures/login/Login'; -module.exports.components['structures.login.Login'] = structures$login$Login; +structures$login$Login && (module.exports.components['structures.login.Login'] = structures$login$Login); import structures$login$PostRegistration from './components/structures/login/PostRegistration'; -module.exports.components['structures.login.PostRegistration'] = structures$login$PostRegistration; +structures$login$PostRegistration && (module.exports.components['structures.login.PostRegistration'] = structures$login$PostRegistration); import structures$login$Registration from './components/structures/login/Registration'; -module.exports.components['structures.login.Registration'] = structures$login$Registration; +structures$login$Registration && (module.exports.components['structures.login.Registration'] = structures$login$Registration); import views$avatars$BaseAvatar from './components/views/avatars/BaseAvatar'; -module.exports.components['views.avatars.BaseAvatar'] = views$avatars$BaseAvatar; +views$avatars$BaseAvatar && (module.exports.components['views.avatars.BaseAvatar'] = views$avatars$BaseAvatar); import views$avatars$MemberAvatar from './components/views/avatars/MemberAvatar'; -module.exports.components['views.avatars.MemberAvatar'] = views$avatars$MemberAvatar; +views$avatars$MemberAvatar && (module.exports.components['views.avatars.MemberAvatar'] = views$avatars$MemberAvatar); import views$avatars$RoomAvatar from './components/views/avatars/RoomAvatar'; -module.exports.components['views.avatars.RoomAvatar'] = views$avatars$RoomAvatar; +views$avatars$RoomAvatar && (module.exports.components['views.avatars.RoomAvatar'] = views$avatars$RoomAvatar); import views$create_room$CreateRoomButton from './components/views/create_room/CreateRoomButton'; -module.exports.components['views.create_room.CreateRoomButton'] = views$create_room$CreateRoomButton; +views$create_room$CreateRoomButton && (module.exports.components['views.create_room.CreateRoomButton'] = views$create_room$CreateRoomButton); import views$create_room$Presets from './components/views/create_room/Presets'; -module.exports.components['views.create_room.Presets'] = views$create_room$Presets; +views$create_room$Presets && (module.exports.components['views.create_room.Presets'] = views$create_room$Presets); import views$create_room$RoomAlias from './components/views/create_room/RoomAlias'; -module.exports.components['views.create_room.RoomAlias'] = views$create_room$RoomAlias; +views$create_room$RoomAlias && (module.exports.components['views.create_room.RoomAlias'] = views$create_room$RoomAlias); import views$dialogs$ChatInviteDialog from './components/views/dialogs/ChatInviteDialog'; -module.exports.components['views.dialogs.ChatInviteDialog'] = views$dialogs$ChatInviteDialog; +views$dialogs$ChatInviteDialog && (module.exports.components['views.dialogs.ChatInviteDialog'] = views$dialogs$ChatInviteDialog); import views$dialogs$DeactivateAccountDialog from './components/views/dialogs/DeactivateAccountDialog'; -module.exports.components['views.dialogs.DeactivateAccountDialog'] = views$dialogs$DeactivateAccountDialog; +views$dialogs$DeactivateAccountDialog && (module.exports.components['views.dialogs.DeactivateAccountDialog'] = views$dialogs$DeactivateAccountDialog); import views$dialogs$EncryptedEventDialog from './components/views/dialogs/EncryptedEventDialog'; -module.exports.components['views.dialogs.EncryptedEventDialog'] = views$dialogs$EncryptedEventDialog; +views$dialogs$EncryptedEventDialog && (module.exports.components['views.dialogs.EncryptedEventDialog'] = views$dialogs$EncryptedEventDialog); import views$dialogs$ErrorDialog from './components/views/dialogs/ErrorDialog'; -module.exports.components['views.dialogs.ErrorDialog'] = views$dialogs$ErrorDialog; +views$dialogs$ErrorDialog && (module.exports.components['views.dialogs.ErrorDialog'] = views$dialogs$ErrorDialog); import views$dialogs$InteractiveAuthDialog from './components/views/dialogs/InteractiveAuthDialog'; -module.exports.components['views.dialogs.InteractiveAuthDialog'] = views$dialogs$InteractiveAuthDialog; +views$dialogs$InteractiveAuthDialog && (module.exports.components['views.dialogs.InteractiveAuthDialog'] = views$dialogs$InteractiveAuthDialog); import views$dialogs$LogoutPrompt from './components/views/dialogs/LogoutPrompt'; -module.exports.components['views.dialogs.LogoutPrompt'] = views$dialogs$LogoutPrompt; +views$dialogs$LogoutPrompt && (module.exports.components['views.dialogs.LogoutPrompt'] = views$dialogs$LogoutPrompt); import views$dialogs$NeedToRegisterDialog from './components/views/dialogs/NeedToRegisterDialog'; -module.exports.components['views.dialogs.NeedToRegisterDialog'] = views$dialogs$NeedToRegisterDialog; +views$dialogs$NeedToRegisterDialog && (module.exports.components['views.dialogs.NeedToRegisterDialog'] = views$dialogs$NeedToRegisterDialog); import views$dialogs$QuestionDialog from './components/views/dialogs/QuestionDialog'; -module.exports.components['views.dialogs.QuestionDialog'] = views$dialogs$QuestionDialog; +views$dialogs$QuestionDialog && (module.exports.components['views.dialogs.QuestionDialog'] = views$dialogs$QuestionDialog); import views$dialogs$SetDisplayNameDialog from './components/views/dialogs/SetDisplayNameDialog'; -module.exports.components['views.dialogs.SetDisplayNameDialog'] = views$dialogs$SetDisplayNameDialog; +views$dialogs$SetDisplayNameDialog && (module.exports.components['views.dialogs.SetDisplayNameDialog'] = views$dialogs$SetDisplayNameDialog); import views$dialogs$TextInputDialog from './components/views/dialogs/TextInputDialog'; -module.exports.components['views.dialogs.TextInputDialog'] = views$dialogs$TextInputDialog; +views$dialogs$TextInputDialog && (module.exports.components['views.dialogs.TextInputDialog'] = views$dialogs$TextInputDialog); import views$elements$AddressSelector from './components/views/elements/AddressSelector'; -module.exports.components['views.elements.AddressSelector'] = views$elements$AddressSelector; +views$elements$AddressSelector && (module.exports.components['views.elements.AddressSelector'] = views$elements$AddressSelector); import views$elements$AddressTile from './components/views/elements/AddressTile'; -module.exports.components['views.elements.AddressTile'] = views$elements$AddressTile; +views$elements$AddressTile && (module.exports.components['views.elements.AddressTile'] = views$elements$AddressTile); import views$elements$DeviceVerifyButtons from './components/views/elements/DeviceVerifyButtons'; -module.exports.components['views.elements.DeviceVerifyButtons'] = views$elements$DeviceVerifyButtons; +views$elements$DeviceVerifyButtons && (module.exports.components['views.elements.DeviceVerifyButtons'] = views$elements$DeviceVerifyButtons); import views$elements$DirectorySearchBox from './components/views/elements/DirectorySearchBox'; -module.exports.components['views.elements.DirectorySearchBox'] = views$elements$DirectorySearchBox; +views$elements$DirectorySearchBox && (module.exports.components['views.elements.DirectorySearchBox'] = views$elements$DirectorySearchBox); import views$elements$EditableText from './components/views/elements/EditableText'; -module.exports.components['views.elements.EditableText'] = views$elements$EditableText; +views$elements$EditableText && (module.exports.components['views.elements.EditableText'] = views$elements$EditableText); import views$elements$EditableTextContainer from './components/views/elements/EditableTextContainer'; -module.exports.components['views.elements.EditableTextContainer'] = views$elements$EditableTextContainer; +views$elements$EditableTextContainer && (module.exports.components['views.elements.EditableTextContainer'] = views$elements$EditableTextContainer); import views$elements$EmojiText from './components/views/elements/EmojiText'; -module.exports.components['views.elements.EmojiText'] = views$elements$EmojiText; +views$elements$EmojiText && (module.exports.components['views.elements.EmojiText'] = views$elements$EmojiText); import views$elements$PowerSelector from './components/views/elements/PowerSelector'; -module.exports.components['views.elements.PowerSelector'] = views$elements$PowerSelector; +views$elements$PowerSelector && (module.exports.components['views.elements.PowerSelector'] = views$elements$PowerSelector); import views$elements$ProgressBar from './components/views/elements/ProgressBar'; -module.exports.components['views.elements.ProgressBar'] = views$elements$ProgressBar; +views$elements$ProgressBar && (module.exports.components['views.elements.ProgressBar'] = views$elements$ProgressBar); import views$elements$TintableSvg from './components/views/elements/TintableSvg'; -module.exports.components['views.elements.TintableSvg'] = views$elements$TintableSvg; +views$elements$TintableSvg && (module.exports.components['views.elements.TintableSvg'] = views$elements$TintableSvg); import views$elements$TruncatedList from './components/views/elements/TruncatedList'; -module.exports.components['views.elements.TruncatedList'] = views$elements$TruncatedList; +views$elements$TruncatedList && (module.exports.components['views.elements.TruncatedList'] = views$elements$TruncatedList); import views$elements$UserSelector from './components/views/elements/UserSelector'; -module.exports.components['views.elements.UserSelector'] = views$elements$UserSelector; +views$elements$UserSelector && (module.exports.components['views.elements.UserSelector'] = views$elements$UserSelector); import views$login$CaptchaForm from './components/views/login/CaptchaForm'; -module.exports.components['views.login.CaptchaForm'] = views$login$CaptchaForm; +views$login$CaptchaForm && (module.exports.components['views.login.CaptchaForm'] = views$login$CaptchaForm); import views$login$CasLogin from './components/views/login/CasLogin'; -module.exports.components['views.login.CasLogin'] = views$login$CasLogin; +views$login$CasLogin && (module.exports.components['views.login.CasLogin'] = views$login$CasLogin); import views$login$CustomServerDialog from './components/views/login/CustomServerDialog'; -module.exports.components['views.login.CustomServerDialog'] = views$login$CustomServerDialog; +views$login$CustomServerDialog && (module.exports.components['views.login.CustomServerDialog'] = views$login$CustomServerDialog); import views$login$InteractiveAuthEntryComponents from './components/views/login/InteractiveAuthEntryComponents'; -module.exports.components['views.login.InteractiveAuthEntryComponents'] = views$login$InteractiveAuthEntryComponents; +views$login$InteractiveAuthEntryComponents && (module.exports.components['views.login.InteractiveAuthEntryComponents'] = views$login$InteractiveAuthEntryComponents); import views$login$LoginFooter from './components/views/login/LoginFooter'; -module.exports.components['views.login.LoginFooter'] = views$login$LoginFooter; +views$login$LoginFooter && (module.exports.components['views.login.LoginFooter'] = views$login$LoginFooter); import views$login$LoginHeader from './components/views/login/LoginHeader'; -module.exports.components['views.login.LoginHeader'] = views$login$LoginHeader; +views$login$LoginHeader && (module.exports.components['views.login.LoginHeader'] = views$login$LoginHeader); import views$login$PasswordLogin from './components/views/login/PasswordLogin'; -module.exports.components['views.login.PasswordLogin'] = views$login$PasswordLogin; +views$login$PasswordLogin && (module.exports.components['views.login.PasswordLogin'] = views$login$PasswordLogin); import views$login$RegistrationForm from './components/views/login/RegistrationForm'; -module.exports.components['views.login.RegistrationForm'] = views$login$RegistrationForm; +views$login$RegistrationForm && (module.exports.components['views.login.RegistrationForm'] = views$login$RegistrationForm); import views$login$ServerConfig from './components/views/login/ServerConfig'; -module.exports.components['views.login.ServerConfig'] = views$login$ServerConfig; +views$login$ServerConfig && (module.exports.components['views.login.ServerConfig'] = views$login$ServerConfig); import views$messages$MAudioBody from './components/views/messages/MAudioBody'; -module.exports.components['views.messages.MAudioBody'] = views$messages$MAudioBody; +views$messages$MAudioBody && (module.exports.components['views.messages.MAudioBody'] = views$messages$MAudioBody); import views$messages$MFileBody from './components/views/messages/MFileBody'; -module.exports.components['views.messages.MFileBody'] = views$messages$MFileBody; +views$messages$MFileBody && (module.exports.components['views.messages.MFileBody'] = views$messages$MFileBody); import views$messages$MImageBody from './components/views/messages/MImageBody'; -module.exports.components['views.messages.MImageBody'] = views$messages$MImageBody; +views$messages$MImageBody && (module.exports.components['views.messages.MImageBody'] = views$messages$MImageBody); import views$messages$MVideoBody from './components/views/messages/MVideoBody'; -module.exports.components['views.messages.MVideoBody'] = views$messages$MVideoBody; +views$messages$MVideoBody && (module.exports.components['views.messages.MVideoBody'] = views$messages$MVideoBody); import views$messages$MessageEvent from './components/views/messages/MessageEvent'; -module.exports.components['views.messages.MessageEvent'] = views$messages$MessageEvent; +views$messages$MessageEvent && (module.exports.components['views.messages.MessageEvent'] = views$messages$MessageEvent); import views$messages$SenderProfile from './components/views/messages/SenderProfile'; -module.exports.components['views.messages.SenderProfile'] = views$messages$SenderProfile; +views$messages$SenderProfile && (module.exports.components['views.messages.SenderProfile'] = views$messages$SenderProfile); import views$messages$TextualBody from './components/views/messages/TextualBody'; -module.exports.components['views.messages.TextualBody'] = views$messages$TextualBody; +views$messages$TextualBody && (module.exports.components['views.messages.TextualBody'] = views$messages$TextualBody); import views$messages$TextualEvent from './components/views/messages/TextualEvent'; -module.exports.components['views.messages.TextualEvent'] = views$messages$TextualEvent; +views$messages$TextualEvent && (module.exports.components['views.messages.TextualEvent'] = views$messages$TextualEvent); import views$messages$UnknownBody from './components/views/messages/UnknownBody'; -module.exports.components['views.messages.UnknownBody'] = views$messages$UnknownBody; +views$messages$UnknownBody && (module.exports.components['views.messages.UnknownBody'] = views$messages$UnknownBody); import views$room_settings$AliasSettings from './components/views/room_settings/AliasSettings'; -module.exports.components['views.room_settings.AliasSettings'] = views$room_settings$AliasSettings; +views$room_settings$AliasSettings && (module.exports.components['views.room_settings.AliasSettings'] = views$room_settings$AliasSettings); import views$room_settings$ColorSettings from './components/views/room_settings/ColorSettings'; -module.exports.components['views.room_settings.ColorSettings'] = views$room_settings$ColorSettings; +views$room_settings$ColorSettings && (module.exports.components['views.room_settings.ColorSettings'] = views$room_settings$ColorSettings); import views$room_settings$UrlPreviewSettings from './components/views/room_settings/UrlPreviewSettings'; -module.exports.components['views.room_settings.UrlPreviewSettings'] = views$room_settings$UrlPreviewSettings; +views$room_settings$UrlPreviewSettings && (module.exports.components['views.room_settings.UrlPreviewSettings'] = views$room_settings$UrlPreviewSettings); import views$rooms$Autocomplete from './components/views/rooms/Autocomplete'; -module.exports.components['views.rooms.Autocomplete'] = views$rooms$Autocomplete; +views$rooms$Autocomplete && (module.exports.components['views.rooms.Autocomplete'] = views$rooms$Autocomplete); import views$rooms$AuxPanel from './components/views/rooms/AuxPanel'; -module.exports.components['views.rooms.AuxPanel'] = views$rooms$AuxPanel; +views$rooms$AuxPanel && (module.exports.components['views.rooms.AuxPanel'] = views$rooms$AuxPanel); import views$rooms$EntityTile from './components/views/rooms/EntityTile'; -module.exports.components['views.rooms.EntityTile'] = views$rooms$EntityTile; +views$rooms$EntityTile && (module.exports.components['views.rooms.EntityTile'] = views$rooms$EntityTile); import views$rooms$EventTile from './components/views/rooms/EventTile'; -module.exports.components['views.rooms.EventTile'] = views$rooms$EventTile; +views$rooms$EventTile && (module.exports.components['views.rooms.EventTile'] = views$rooms$EventTile); import views$rooms$LinkPreviewWidget from './components/views/rooms/LinkPreviewWidget'; -module.exports.components['views.rooms.LinkPreviewWidget'] = views$rooms$LinkPreviewWidget; +views$rooms$LinkPreviewWidget && (module.exports.components['views.rooms.LinkPreviewWidget'] = views$rooms$LinkPreviewWidget); import views$rooms$MemberDeviceInfo from './components/views/rooms/MemberDeviceInfo'; -module.exports.components['views.rooms.MemberDeviceInfo'] = views$rooms$MemberDeviceInfo; +views$rooms$MemberDeviceInfo && (module.exports.components['views.rooms.MemberDeviceInfo'] = views$rooms$MemberDeviceInfo); import views$rooms$MemberInfo from './components/views/rooms/MemberInfo'; -module.exports.components['views.rooms.MemberInfo'] = views$rooms$MemberInfo; +views$rooms$MemberInfo && (module.exports.components['views.rooms.MemberInfo'] = views$rooms$MemberInfo); import views$rooms$MemberList from './components/views/rooms/MemberList'; -module.exports.components['views.rooms.MemberList'] = views$rooms$MemberList; +views$rooms$MemberList && (module.exports.components['views.rooms.MemberList'] = views$rooms$MemberList); import views$rooms$MemberTile from './components/views/rooms/MemberTile'; -module.exports.components['views.rooms.MemberTile'] = views$rooms$MemberTile; +views$rooms$MemberTile && (module.exports.components['views.rooms.MemberTile'] = views$rooms$MemberTile); import views$rooms$MessageComposer from './components/views/rooms/MessageComposer'; -module.exports.components['views.rooms.MessageComposer'] = views$rooms$MessageComposer; +views$rooms$MessageComposer && (module.exports.components['views.rooms.MessageComposer'] = views$rooms$MessageComposer); import views$rooms$MessageComposerInput from './components/views/rooms/MessageComposerInput'; -module.exports.components['views.rooms.MessageComposerInput'] = views$rooms$MessageComposerInput; +views$rooms$MessageComposerInput && (module.exports.components['views.rooms.MessageComposerInput'] = views$rooms$MessageComposerInput); import views$rooms$MessageComposerInputOld from './components/views/rooms/MessageComposerInputOld'; -module.exports.components['views.rooms.MessageComposerInputOld'] = views$rooms$MessageComposerInputOld; +views$rooms$MessageComposerInputOld && (module.exports.components['views.rooms.MessageComposerInputOld'] = views$rooms$MessageComposerInputOld); import views$rooms$PresenceLabel from './components/views/rooms/PresenceLabel'; -module.exports.components['views.rooms.PresenceLabel'] = views$rooms$PresenceLabel; +views$rooms$PresenceLabel && (module.exports.components['views.rooms.PresenceLabel'] = views$rooms$PresenceLabel); import views$rooms$ReadReceiptMarker from './components/views/rooms/ReadReceiptMarker'; -module.exports.components['views.rooms.ReadReceiptMarker'] = views$rooms$ReadReceiptMarker; +views$rooms$ReadReceiptMarker && (module.exports.components['views.rooms.ReadReceiptMarker'] = views$rooms$ReadReceiptMarker); import views$rooms$RoomHeader from './components/views/rooms/RoomHeader'; -module.exports.components['views.rooms.RoomHeader'] = views$rooms$RoomHeader; +views$rooms$RoomHeader && (module.exports.components['views.rooms.RoomHeader'] = views$rooms$RoomHeader); import views$rooms$RoomList from './components/views/rooms/RoomList'; -module.exports.components['views.rooms.RoomList'] = views$rooms$RoomList; +views$rooms$RoomList && (module.exports.components['views.rooms.RoomList'] = views$rooms$RoomList); import views$rooms$RoomNameEditor from './components/views/rooms/RoomNameEditor'; -module.exports.components['views.rooms.RoomNameEditor'] = views$rooms$RoomNameEditor; +views$rooms$RoomNameEditor && (module.exports.components['views.rooms.RoomNameEditor'] = views$rooms$RoomNameEditor); import views$rooms$RoomPreviewBar from './components/views/rooms/RoomPreviewBar'; -module.exports.components['views.rooms.RoomPreviewBar'] = views$rooms$RoomPreviewBar; +views$rooms$RoomPreviewBar && (module.exports.components['views.rooms.RoomPreviewBar'] = views$rooms$RoomPreviewBar); import views$rooms$RoomSettings from './components/views/rooms/RoomSettings'; -module.exports.components['views.rooms.RoomSettings'] = views$rooms$RoomSettings; +views$rooms$RoomSettings && (module.exports.components['views.rooms.RoomSettings'] = views$rooms$RoomSettings); import views$rooms$RoomTile from './components/views/rooms/RoomTile'; -module.exports.components['views.rooms.RoomTile'] = views$rooms$RoomTile; +views$rooms$RoomTile && (module.exports.components['views.rooms.RoomTile'] = views$rooms$RoomTile); import views$rooms$RoomTopicEditor from './components/views/rooms/RoomTopicEditor'; -module.exports.components['views.rooms.RoomTopicEditor'] = views$rooms$RoomTopicEditor; +views$rooms$RoomTopicEditor && (module.exports.components['views.rooms.RoomTopicEditor'] = views$rooms$RoomTopicEditor); import views$rooms$SearchResultTile from './components/views/rooms/SearchResultTile'; -module.exports.components['views.rooms.SearchResultTile'] = views$rooms$SearchResultTile; +views$rooms$SearchResultTile && (module.exports.components['views.rooms.SearchResultTile'] = views$rooms$SearchResultTile); import views$rooms$SearchableEntityList from './components/views/rooms/SearchableEntityList'; -module.exports.components['views.rooms.SearchableEntityList'] = views$rooms$SearchableEntityList; +views$rooms$SearchableEntityList && (module.exports.components['views.rooms.SearchableEntityList'] = views$rooms$SearchableEntityList); import views$rooms$SimpleRoomHeader from './components/views/rooms/SimpleRoomHeader'; -module.exports.components['views.rooms.SimpleRoomHeader'] = views$rooms$SimpleRoomHeader; +views$rooms$SimpleRoomHeader && (module.exports.components['views.rooms.SimpleRoomHeader'] = views$rooms$SimpleRoomHeader); import views$rooms$TabCompleteBar from './components/views/rooms/TabCompleteBar'; -module.exports.components['views.rooms.TabCompleteBar'] = views$rooms$TabCompleteBar; +views$rooms$TabCompleteBar && (module.exports.components['views.rooms.TabCompleteBar'] = views$rooms$TabCompleteBar); import views$rooms$TopUnreadMessagesBar from './components/views/rooms/TopUnreadMessagesBar'; -module.exports.components['views.rooms.TopUnreadMessagesBar'] = views$rooms$TopUnreadMessagesBar; +views$rooms$TopUnreadMessagesBar && (module.exports.components['views.rooms.TopUnreadMessagesBar'] = views$rooms$TopUnreadMessagesBar); import views$rooms$UserTile from './components/views/rooms/UserTile'; -module.exports.components['views.rooms.UserTile'] = views$rooms$UserTile; +views$rooms$UserTile && (module.exports.components['views.rooms.UserTile'] = views$rooms$UserTile); import views$settings$ChangeAvatar from './components/views/settings/ChangeAvatar'; -module.exports.components['views.settings.ChangeAvatar'] = views$settings$ChangeAvatar; +views$settings$ChangeAvatar && (module.exports.components['views.settings.ChangeAvatar'] = views$settings$ChangeAvatar); import views$settings$ChangeDisplayName from './components/views/settings/ChangeDisplayName'; -module.exports.components['views.settings.ChangeDisplayName'] = views$settings$ChangeDisplayName; +views$settings$ChangeDisplayName && (module.exports.components['views.settings.ChangeDisplayName'] = views$settings$ChangeDisplayName); import views$settings$ChangePassword from './components/views/settings/ChangePassword'; -module.exports.components['views.settings.ChangePassword'] = views$settings$ChangePassword; +views$settings$ChangePassword && (module.exports.components['views.settings.ChangePassword'] = views$settings$ChangePassword); import views$settings$DevicesPanel from './components/views/settings/DevicesPanel'; -module.exports.components['views.settings.DevicesPanel'] = views$settings$DevicesPanel; +views$settings$DevicesPanel && (module.exports.components['views.settings.DevicesPanel'] = views$settings$DevicesPanel); import views$settings$DevicesPanelEntry from './components/views/settings/DevicesPanelEntry'; -module.exports.components['views.settings.DevicesPanelEntry'] = views$settings$DevicesPanelEntry; +views$settings$DevicesPanelEntry && (module.exports.components['views.settings.DevicesPanelEntry'] = views$settings$DevicesPanelEntry); import views$settings$EnableNotificationsButton from './components/views/settings/EnableNotificationsButton'; -module.exports.components['views.settings.EnableNotificationsButton'] = views$settings$EnableNotificationsButton; +views$settings$EnableNotificationsButton && (module.exports.components['views.settings.EnableNotificationsButton'] = views$settings$EnableNotificationsButton); import views$voip$CallView from './components/views/voip/CallView'; -module.exports.components['views.voip.CallView'] = views$voip$CallView; +views$voip$CallView && (module.exports.components['views.voip.CallView'] = views$voip$CallView); import views$voip$IncomingCallBox from './components/views/voip/IncomingCallBox'; -module.exports.components['views.voip.IncomingCallBox'] = views$voip$IncomingCallBox; +views$voip$IncomingCallBox && (module.exports.components['views.voip.IncomingCallBox'] = views$voip$IncomingCallBox); import views$voip$VideoFeed from './components/views/voip/VideoFeed'; -module.exports.components['views.voip.VideoFeed'] = views$voip$VideoFeed; +views$voip$VideoFeed && (module.exports.components['views.voip.VideoFeed'] = views$voip$VideoFeed); import views$voip$VideoView from './components/views/voip/VideoView'; -module.exports.components['views.voip.VideoView'] = views$voip$VideoView; +views$voip$VideoView && (module.exports.components['views.voip.VideoView'] = views$voip$VideoView); From 8b175880bb28c6ed62fc785f18d0fbc484934ff5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 10:55:58 +0100 Subject: [PATCH 11/13] Remove transform-runtime We use instance methods (or at least, draft.js does) so we need babel-polyfill instead. --- .babelrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index c30cbe08cb..fb2f03c450 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,3 @@ { - "presets": ["react", "es2015", "es2016", "es2017", "stage-2"], - "plugins": ["transform-runtime"] + "presets": ["react", "es2015", "es2016", "es2017", "stage-2"] } From 1f21e690e28f03dbd0415ac20a6487d7d5bca6ec Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 13 Oct 2016 11:07:59 +0100 Subject: [PATCH 12/13] retest From 4f261a0e96ee8c2cca0707a4315f110d6ca5d264 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 14 Oct 2016 18:02:26 +0100 Subject: [PATCH 13/13] Replace stage & es2017 with the specific plugins --- .babelrc | 3 ++- package.json | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.babelrc b/.babelrc index fb2f03c450..44f8af571d 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,4 @@ { - "presets": ["react", "es2015", "es2016", "es2017", "stage-2"] + "presets": ["react", "es2015", "es2016"], + "plugins": ["transform-class-properties", "transform-object-rest-spread", "transform-async-to-generator"] } diff --git a/package.json b/package.json index a08aeb5a21..e34066eb16 100644 --- a/package.json +++ b/package.json @@ -56,13 +56,14 @@ "babel-core": "^6.14.0", "babel-eslint": "^6.1.0", "babel-loader": "^6.2.5", - "babel-plugin-transform-runtime": "^6.15.0", + "babel-plugin-transform-async-to-generator": "^6.16.0", + "babel-plugin-transform-class-properties": "^6.16.0", + "babel-plugin-transform-object-rest-spread": "^6.16.0", "babel-polyfill": "^6.5.0", "babel-preset-es2015": "^6.14.0", "babel-preset-es2016": "^6.11.3", "babel-preset-es2017": "^6.14.0", "babel-preset-react": "^6.11.1", - "babel-preset-stage-2": "^6.17.0", "eslint": "^2.13.1", "eslint-plugin-flowtype": "^2.17.0", "eslint-plugin-react": "^6.2.1",