diff --git a/.eslintrc.json b/.eslintrc.json index 7c39d5de18..5165996429 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,10 @@ { "env": { - "node": true + "node": true, + "es6": true + }, + "parserOptions": { + "sourceType": "module" }, "globals": { "$": false, diff --git a/package.json b/package.json index 34ae453000..a2d16e7de5 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "main": "", "dependencies": { "clipboard": "1.5.16", + "expose-loader": "0.7.3", "handlebars": "4.0.6", "i18next": "3.4.4", "i18next-browser-languagedetector": "0.3.0", diff --git a/static/js/debug.js b/static/js/debug.js index ace9a6519c..77af761438 100644 --- a/static/js/debug.js +++ b/static/js/debug.js @@ -10,12 +10,12 @@ not put sensitive information here. */ /* - print_elapsed_time("foo", foo) + debug.print_elapsed_time("foo", foo) evaluates to foo() and prints the elapsed time to the console along with the name "foo". */ -function print_elapsed_time(name, fun) { +export function print_elapsed_time(name, fun) { var t0 = new Date().getTime(); var out = fun(); var t1 = new Date().getTime(); @@ -23,7 +23,7 @@ function print_elapsed_time(name, fun) { return out; } -function check_duplicate_ids() { +export function check_duplicate_ids() { var ids = {}; var collisions = []; var total_collisions = 0; @@ -66,7 +66,7 @@ function check_duplicate_ids() { * * Example: * - * var ip = new IterationProfiler(); + * var ip = new debug.IterationProfiler(); * _.each(myarray, function (elem) { * ip.iteration_start(); * @@ -89,7 +89,7 @@ function check_duplicate_ids() { * The _rest_of_iteration section is the region of the iteration body * after section b. */ -function IterationProfiler() { +export function IterationProfiler() { this.sections = {}; this.last_time = window.performance.now(); } diff --git a/templates/zerver/index.html b/templates/zerver/index.html index 2080751e33..51552bb9d2 100644 --- a/templates/zerver/index.html +++ b/templates/zerver/index.html @@ -39,10 +39,6 @@ var page_params = {{ page_params }}; {{ render_bundle('translations') }} -{% if debug %} -{{ minified_js('app_debug')|safe }} -{% endif %} - {% include "zerver/topic_is_muted.html" %} {% endblock %} diff --git a/tools/webpack.config.js b/tools/webpack.config.js index dde7dc87f8..d2c1a40e6a 100644 --- a/tools/webpack.config.js +++ b/tools/webpack.config.js @@ -30,6 +30,13 @@ module.exports = { test: /(min|zxcvbn)\.js/, use: [ 'script-loader' ], }, + // Expose Global variables to webpack + { + test: require.resolve('../static/js/debug.js'), + use: [ + {loader: 'expose-loader', options: 'debug'}, + ], + }, ], }, diff --git a/tools/webpack.dev.config.js b/tools/webpack.dev.config.js index 96c381b0db..9b51916d61 100644 --- a/tools/webpack.dev.config.js +++ b/tools/webpack.dev.config.js @@ -3,7 +3,11 @@ var BundleTracker = require('webpack-bundle-tracker'); // katex should be an array, to inject webpack dependencies in dev config // better to be moved to common.js when common.js is added to assets +// Built webpack dev asset reloader config.entry.katex.unshift('webpack-dev-server/client?/sockjs-node'); +// Out JS debugging tools +config.entry.katex.push('./static/js/debug.js'); + config.devtool = 'eval'; config.output.publicPath = '/webpack/'; config.plugins.push(new BundleTracker({filename: 'static/webpack-bundles/webpack-stats-dev.json'})); diff --git a/version.py b/version.py index b9b033d6b1..bd85660b4e 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ ZULIP_VERSION = "1.6.0+git" -PROVISION_VERSION = '5.6' +PROVISION_VERSION = '5.7' diff --git a/zproject/settings.py b/zproject/settings.py index 4e3fc883b6..b10675b4b7 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -828,10 +828,6 @@ JS_SPECS = { ], 'output_filename': 'min/signup.js' }, - 'app_debug': { - 'source_filenames': ['js/debug.js'], - 'output_filename': 'min/app_debug.js' - }, 'app': { 'source_filenames': [ 'third/bootstrap-notify/js/bootstrap-notify.js',