Skip to content

Commit

Permalink
app: Prepare JS files for consumption by webpack.
Browse files Browse the repository at this point in the history
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
  • Loading branch information
armaanahluwalia authored and timabbott committed Jul 5, 2018
1 parent b10822e commit 6d255ef
Show file tree
Hide file tree
Showing 163 changed files with 180 additions and 1 deletion.
1 change: 1 addition & 0 deletions static/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = activity;
}
window.activity = activity;
1 change: 1 addition & 0 deletions static/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = admin;
}
window.admin = admin;
1 change: 1 addition & 0 deletions static/js/admin_sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = admin_sections;
}
window.admin_sections = admin_sections;
1 change: 1 addition & 0 deletions static/js/alert_words.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = alert_words;
}
window.alert_words = alert_words;
1 change: 1 addition & 0 deletions static/js/alert_words_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = alert_words_ui;
}
window.alert_words_ui = alert_words_ui;
1 change: 1 addition & 0 deletions static/js/attachments_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = attachments_ui;
}
window.attachments_ui = attachments_ui;
1 change: 1 addition & 0 deletions static/js/avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = avatar;
}
window.avatar = avatar;
1 change: 1 addition & 0 deletions static/js/blueslip.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = blueslip;
}
window.blueslip = blueslip;
1 change: 1 addition & 0 deletions static/js/bot_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ var bot_data = (function () {
if (typeof module !== 'undefined') {
module.exports = bot_data;
}
window.bot_data = bot_data;
1 change: 1 addition & 0 deletions static/js/buddy_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = buddy_data;
}
window.buddy_data = buddy_data;
1 change: 1 addition & 0 deletions static/js/buddy_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ if (typeof module !== 'undefined') {
module.exports = buddy_list;
}

window.buddy_list = buddy_list;
1 change: 1 addition & 0 deletions static/js/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = channel;
}
window.channel = channel;
1 change: 1 addition & 0 deletions static/js/click_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,3 +741,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = click_handlers;
}
window.click_handlers = click_handlers;
1 change: 1 addition & 0 deletions static/js/colorspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = colorspace;
}
window.colorspace = colorspace;
1 change: 1 addition & 0 deletions static/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = common;
}
window.common = common;
1 change: 1 addition & 0 deletions static/js/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = components;
}
window.components = components;
1 change: 1 addition & 0 deletions static/js/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,3 +987,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = compose;
}
window.compose = compose;
1 change: 1 addition & 0 deletions static/js/compose_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = compose_actions;
}
window.compose_actions = compose_actions;
1 change: 1 addition & 0 deletions static/js/compose_fade.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = compose_fade;
}
window.compose_fade = compose_fade;
1 change: 1 addition & 0 deletions static/js/compose_pm_pill.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = compose_pm_pill;
}
window.compose_pm_pill = compose_pm_pill;
1 change: 1 addition & 0 deletions static/js/compose_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = compose_state;
}
window.compose_state = compose_state;
1 change: 1 addition & 0 deletions static/js/compose_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = compose_ui;
}
window.compose_ui = compose_ui;
1 change: 1 addition & 0 deletions static/js/composebox_typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = composebox_typeahead;
}
window.composebox_typeahead = composebox_typeahead;
1 change: 1 addition & 0 deletions static/js/condense.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = condense;
}
window.condense = condense;
1 change: 1 addition & 0 deletions static/js/copy_and_paste.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = copy_and_paste;
}
window.copy_and_paste = copy_and_paste;
1 change: 1 addition & 0 deletions static/js/dict.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@ Dict.prototype = {
if (typeof module !== 'undefined') {
module.exports = Dict;
}
window.Dict = Dict;
1 change: 1 addition & 0 deletions static/js/drafts.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = drafts;
}
window.drafts = drafts;
1 change: 1 addition & 0 deletions static/js/echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = echo;
}
window.echo = echo;
1 change: 1 addition & 0 deletions static/js/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = emoji;
}
window.emoji = emoji;
1 change: 1 addition & 0 deletions static/js/emoji_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,3 +736,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = emoji_picker;
}
window.emoji_picker = emoji_picker;
1 change: 1 addition & 0 deletions static/js/favicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = favicon;
}
window.favicon = favicon;
1 change: 1 addition & 0 deletions static/js/feature_flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = feature_flags;
}
window.feature_flags = feature_flags;
1 change: 1 addition & 0 deletions static/js/fenced_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = fenced_code;
}
window.fenced_code = fenced_code;
1 change: 1 addition & 0 deletions static/js/fetch_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ var FetchStatus = function () {
if (typeof module !== 'undefined') {
module.exports = FetchStatus;
}
window.FetchStatus = FetchStatus;
2 changes: 2 additions & 0 deletions static/js/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,3 +652,5 @@ return Filter;
if (typeof module !== 'undefined') {
module.exports = Filter;
}

window.Filter = Filter;
1 change: 1 addition & 0 deletions static/js/floating_recipient_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = floating_recipient_bar;
}
window.floating_recipient_bar = floating_recipient_bar;
1 change: 1 addition & 0 deletions static/js/gear_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = gear_menu;
}
window.gear_menu = gear_menu;
1 change: 1 addition & 0 deletions static/js/hash_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = hash_util;
}
window.hash_util = hash_util;
1 change: 1 addition & 0 deletions static/js/hashchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = hashchange;
}
window.hashchange = hashchange;
1 change: 1 addition & 0 deletions static/js/hotkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = hotkeys;
}
window.hotkey = hotkeys;
1 change: 1 addition & 0 deletions static/js/hotspots.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = hotspots;
}
window.hotspots = hotspots;
1 change: 1 addition & 0 deletions static/js/info_overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = info_overlay;
}
window.info_overlay = info_overlay;
1 change: 1 addition & 0 deletions static/js/input_pill.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,3 +429,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = input_pill;
}
window.input_pill = input_pill;
1 change: 1 addition & 0 deletions static/js/integration_bot_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = integration_bot_widget;
}
window.integration_bot_widget = integration_bot_widget;
1 change: 1 addition & 0 deletions static/js/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = invite;
}
window.invite = invite;
1 change: 1 addition & 0 deletions static/js/keydown_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = keydown_util;
}
window.keydown_util = keydown_util;
1 change: 1 addition & 0 deletions static/js/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = lightbox;
}
window.lightbox = lightbox;
1 change: 1 addition & 0 deletions static/js/lightbox_canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,4 @@ var LightboxCanvas = (function () {
if (typeof module !== 'undefined') {
module.exports = LightboxCanvas;
}
window.lightbox_canvas = LightboxCanvas;
1 change: 1 addition & 0 deletions static/js/list_cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ var list_cursor = function (opts) {
if (typeof module !== 'undefined') {
module.exports = list_cursor;
}
window.list_cursor = list_cursor;
2 changes: 2 additions & 0 deletions static/js/list_render.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,5 @@ var list_render = (function () {
if (typeof module !== 'undefined') {
module.exports = list_render;
}

window.list_render = list_render;
1 change: 1 addition & 0 deletions static/js/list_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = list_util;
}
window.list_util = list_util;
1 change: 1 addition & 0 deletions static/js/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = loading;
}
window.loading = loading;
2 changes: 2 additions & 0 deletions static/js/local_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = local_message;
}

window.local_message = local_message;
1 change: 1 addition & 0 deletions static/js/localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = localstorage;
}
window.localstorage = localstorage;
1 change: 1 addition & 0 deletions static/js/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = markdown;
}
window.markdown = markdown;
1 change: 1 addition & 0 deletions static/js/message_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,3 +594,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_edit;
}
window.message_edit = message_edit;
1 change: 1 addition & 0 deletions static/js/message_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_events;
}
window.message_events = message_events;
1 change: 1 addition & 0 deletions static/js/message_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_fetch;
}
window.message_fetch = message_fetch;
1 change: 1 addition & 0 deletions static/js/message_flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_flags;
}
window.message_flags = message_flags;
1 change: 1 addition & 0 deletions static/js/message_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_list;
}
window.message_list = message_list;
2 changes: 2 additions & 0 deletions static/js/message_list_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,5 @@ MessageListData.prototype = {
if (typeof module !== 'undefined') {
module.exports = MessageListData;
}

window.MessageListData = MessageListData;
1 change: 1 addition & 0 deletions static/js/message_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,3 +1035,4 @@ MessageListView.prototype = {
if (typeof module !== 'undefined') {
module.exports = MessageListView;
}
window.MessageListView = MessageListView;
1 change: 1 addition & 0 deletions static/js/message_live_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ if (typeof module !== 'undefined') {
module.exports = message_live_update;
}

window.message_live_update = message_live_update;
1 change: 1 addition & 0 deletions static/js/message_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_scroll;
}
window.message_scroll = message_scroll;
1 change: 1 addition & 0 deletions static/js/message_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_store;
}
window.message_store = message_store;
1 change: 1 addition & 0 deletions static/js/message_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_util;
}
window.message_util = message_util;
1 change: 1 addition & 0 deletions static/js/message_viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = message_viewport;
}
window.message_viewport = message_viewport;
1 change: 1 addition & 0 deletions static/js/muting.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = muting;
}
window.muting = muting;
1 change: 1 addition & 0 deletions static/js/muting_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = muting_ui;
}
window.muting_ui = muting_ui;
1 change: 1 addition & 0 deletions static/js/narrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -820,3 +820,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = narrow;
}
window.narrow = narrow;
1 change: 1 addition & 0 deletions static/js/narrow_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = narrow_state;
}
window.narrow_state = narrow_state;
1 change: 1 addition & 0 deletions static/js/navigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = navigate;
}
window.navigate = navigate;
1 change: 1 addition & 0 deletions static/js/night_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = night_mode;
}
window.night_mode = night_mode;
1 change: 1 addition & 0 deletions static/js/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = notifications;
}
window.notifications = notifications;
1 change: 1 addition & 0 deletions static/js/overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = overlays;
}
window.overlays = overlays;
1 change: 1 addition & 0 deletions static/js/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = panels;
}
window.panels = panels;
1 change: 1 addition & 0 deletions static/js/people.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,3 +931,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = people;
}
window.people = people;
1 change: 1 addition & 0 deletions static/js/pm_conversations.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ return exports;
if (typeof module !== 'undefined') {
module.exports = pm_conversations;
}
window.pm_conversations = pm_conversations;
1 change: 1 addition & 0 deletions static/js/pm_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,4 @@ if (typeof module !== 'undefined') {
module.exports = pm_list;
}

window.pm_list = pm_list;
Loading

0 comments on commit 6d255ef

Please sign in to comment.