Commit graph

21 commits

Author SHA1 Message Date
Travis Ralston
23e5333935 Introduce babel's export-default-from plugin to fix build errors
We do a lot of default exporting, so we kinda need this. It even asks for it to be installed when it is missing.
2019-12-22 21:36:56 -07:00
Travis Ralston
38e75aaae0
Merge pull request #3722 from matrix-org/travis/babel7
[BREAKING] Refactor the entire build process for babel@7 and TypeScript (chunk 1 of many)
2019-12-17 10:44:20 -07:00
Travis Ralston
b8faaa23c1 Remove irrelevant targets 2019-12-16 16:06:43 -07:00
Travis Ralston
20a615396b Implementation of new potential skinning mechanism
With a switch to Only One Webpack™ we need a way to help developers generate the component index without a concurrent watch task. The best way to do this is to have developers import their components, but how do they do that when we support skins? The answer in this commit is to change skinning.

Skinning now expects to receive your list of overrides instead of the react-sdk+branded components. For Riot this means we send over *only* the Vector components and not Vector+react-sdk. 

Components can then be annotated with the `replaceComponent` decorator to have them be skinnable. The decorator must take a string with the dot path of the component because we can't reliably calculate it ourselves, sadly. 

The decorator does a call to `getComponent` which is where the important part of the branded components not including the react-sdk is important: if the branded app includes the react-sdk then the decorator gets executed before the skin has finished loading, leading to all kinds of fun errors. This is also why the skinner lazily loads the react-sdk components to avoid importing them too early, breaking the app.

The decorator will end up receiving null for a component because of the getComponent loop mentioned: the require() call is still in progress when the decorator is called, therefore we can't error out. All usages of getComponent() within the app are safe to not need such an error (the return won't be null, and developers shouldn't use getComponent() after this commit anyways).

The AuthPage, being a prominent component, has been converted to demonstrate this working. Changes to riot-web are required to have this work.

The reskindex script has also been altered to reflect these skinning changes - it no longer should set the react-sdk as a parent. The eventual end goal is to get rid of `getComponent()` entirely as it'll be easily replaced by imports.
2019-12-12 19:48:45 -07:00
Travis Ralston
97af0403e5 Upgrade to babel@7 and support typescript
This breaks the tests
2019-12-12 14:37:14 -07:00
Michael Telatynski
d4d51dc61f Rip out the remainder of Bluebird 2019-11-18 10:03:05 +00:00
J. Ryan Stinnett
328f0cd6bf Notify user when crypto data is missing
If we have account data in local storage but nothing in the crypto store, it
generally means the browser has evicted IndexedDB out from under us. This adds a
modal to explain the situation and offer to completely clear storage to get
things back to normal.

Fixes https://github.com/vector-im/riot-web/issues/9109
2019-03-29 16:06:08 +00:00
David Baker
985966f8be Update async dialog interface to use promises
Hopefully makes the syntax a bit nicer. Also uses ES6 async import
rather than require.ensure which is now deprecated. Also also
displays an error if the component fails to load rather than falling
over in a heap, which is nice.
2018-11-21 16:56:44 +00:00
Richard van der Hoff
4d83150855 Transform async functions to bluebird promises
It turns out that the assertion made in
https://github.com/matrix-org/matrix-react-sdk/pull/1213 about `async`
functions returning bluebird promises was only correct when babel used an
inline version of the `asyncToGenerator` helper; in react-sdk we are using
`babel-transform-runtime` which means that we use a separate
`babel-runtime/helpers/asyncToGenerator`, which returns a native (or core-js)
Promise.

This meant that we were still in the situation where some methods returned
native Promises, and some bluebird ones, which is exactly the situation I
wanted to resolve by switching to bluebird in the first place: in short,
unless/until we get rid of all code which assumes Promises have a `done` method
etc, we need to make sure that everything returns a bluebird promise.

(Aside: there was debate over whether in the long term we should be trying to
wean ourselves off bluebird promises by assuming all promises are native. The
conclusion was that the complexity hit involved in doing so outweighed any
benefit of a potential future migration away from bluebird).
2017-07-13 17:10:08 +01:00
David Baker
2faf5702c9 Add plugin that makes babel 6 not break everything
Also transform-runtime here because we seem to need it here too
2016-10-17 16:24:19 +01:00
David Baker
f9ef6ba871 Replace stage & es2017 with the specific plugins 2016-10-17 16:24:19 +01:00
David Baker
7436883704 Remove transform-runtime
We use instance methods (or at least, draft.js does) so we need
babel-polyfill instead.
2016-10-17 16:24:12 +01:00
David Baker
eb9f884b53 Stage 0 is a little much 2016-10-17 16:23:26 +01:00
Aviral Dasgupta
022eb575d9 Upgrade to babel6 and enable some presets. 2016-10-17 16:23:25 +01:00
David Baker
5b4b81f7dc Revert "Switch to babel 6" 2016-10-14 18:49:52 +01:00
David Baker
8a0f6a0c6e Revert 09d2b2a36c
as babel 6 appears to break sending messages with the non RTE
editor
2016-10-14 18:48:41 +01:00
David Baker
09d2b2a36c Try adding transform-runtime in react-sdk
as it seems the runtime is undefined on the /develop, even though
it works just fine for me locally.
2016-10-14 18:32:52 +01:00
David Baker
4f261a0e96 Replace stage & es2017 with the specific plugins 2016-10-14 18:02:26 +01:00
David Baker
8b175880bb Remove transform-runtime
We use instance methods (or at least, draft.js does) so we need
babel-polyfill instead.
2016-10-13 10:55:58 +01:00
David Baker
5801bf60aa Stage 0 is a little much 2016-10-12 17:26:43 +01:00
Aviral Dasgupta
2d173d83b9 Upgrade to babel6 and enable some presets. 2016-10-02 17:27:45 +05:30