mirror of https://github.com/zulip/zulip.git
js: Convert static/js/blueslip.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
b0ceaa1ea0
commit
3ef6f6e2e2
|
@ -107,7 +107,6 @@
|
|||
{
|
||||
"files": ["frontend_tests/node_tests/**"],
|
||||
"globals": {
|
||||
"blueslip": false,
|
||||
"current_msg_list": false,
|
||||
"home_msg_list": false,
|
||||
"i18n": false,
|
||||
|
@ -126,7 +125,6 @@
|
|||
{
|
||||
"files": ["static/js/**"],
|
||||
"globals": {
|
||||
"blueslip": false,
|
||||
"csrf_token": false,
|
||||
"current_msg_list": true,
|
||||
"home_msg_list": false,
|
||||
|
|
|
@ -127,7 +127,8 @@ new feature hard to miss.
|
|||
* Blueslip keeps a log of all the notices it has received during a
|
||||
browser session, and includes them in reports to the server, so that
|
||||
one can see cases where exceptions chained together. You can print
|
||||
this log from the browser console using `blueslip.get_log()`.
|
||||
this log from the browser console using `blueslip =
|
||||
require("./static/js/blueslip"); blueslip.get_log()`.
|
||||
|
||||
Blueslip supports several error levels:
|
||||
* `throw new Error(…)`: For fatal errors that cannot be easily
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -6,6 +6,7 @@ const _ = require("lodash");
|
|||
|
||||
const {mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ const _ = require("lodash");
|
|||
|
||||
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -6,6 +6,7 @@ const _ = require("lodash");
|
|||
|
||||
const {mock_cjs, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
set_global("setTimeout", (f, delay) => {
|
||||
assert.equal(delay, 0);
|
||||
|
|
|
@ -8,6 +8,7 @@ const MockDate = require("mockdate");
|
|||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
|||
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {make_stub} = require("../zjsunit/stub");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const events = require("./lib/events");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
set_global("document", {});
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const {LazySet} = zrequire("lazy_set");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const {ListCursor} = zrequire("list_cursor");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
// We need these stubs to get by instanceof checks.
|
||||
// The ListWidget library allows you to insert objects
|
||||
|
|
|
@ -6,6 +6,7 @@ const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_c
|
|||
const markdown_assert = require("../zjsunit/markdown_assert");
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
set_global("location", {
|
||||
origin: "http://zulip.zulipdev.com",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
set_global("page_params", {});
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
|||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {make_stub} = require("../zjsunit/stub");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
// These unit tests for static/js/message_list.js emphasize the model-ish
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
set_global("page_params", {});
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
|||
const {mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {make_stub} = require("../zjsunit/stub");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const message_store = mock_esm("../../static/js/message_store");
|
||||
mock_esm("../../static/js/muting", {
|
||||
|
|
|
@ -10,6 +10,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const peer_data = zrequire("peer_data");
|
||||
const people = zrequire("people");
|
||||
|
|
|
@ -8,6 +8,7 @@ const MockDate = require("mockdate");
|
|||
|
||||
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const message_store = mock_esm("../../static/js/message_store");
|
||||
const page_params = set_global("page_params", {});
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const reload_state = mock_esm("../../static/js/reload_state", {
|
||||
is_in_progress: () => false,
|
||||
|
|
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
|||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {mock_cjs, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const reload_state = mock_esm("../../static/js/reload_state", {
|
||||
is_in_progress: () => false,
|
||||
|
|
|
@ -6,6 +6,7 @@ const {stub_templates} = require("../zjsunit/handlebars");
|
|||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {make_stub} = require("../zjsunit/stub");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const alice_user_id = 5;
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
|||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -7,6 +7,7 @@ const _ = require("lodash");
|
|||
const {stub_templates} = require("../zjsunit/handlebars");
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -6,6 +6,7 @@ const _ = require("lodash");
|
|||
|
||||
const {set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
let page_params;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
|
|||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {make_stub} = require("../zjsunit/stub");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const user_groups = zrequire("user_groups");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const channel = mock_esm("../../static/js/channel");
|
||||
const user_status = zrequire("user_status");
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
const vdom = zrequire("vdom");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {mock_cjs, mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
mock_cjs("jquery", $);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
const {strict: assert} = require("assert");
|
||||
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const blueslip = require("../zjsunit/zblueslip");
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const handlebars = require("./handlebars");
|
|||
const stub_i18n = require("./i18n");
|
||||
const namespace = require("./namespace");
|
||||
const test = require("./test");
|
||||
const {make_zblueslip} = require("./zblueslip");
|
||||
const blueslip = require("./zblueslip");
|
||||
const zjquery = require("./zjquery");
|
||||
|
||||
require("@babel/register")({
|
||||
|
@ -93,7 +93,8 @@ try {
|
|||
_.throttle = immediate;
|
||||
_.debounce = immediate;
|
||||
|
||||
const blueslip = namespace.set_global("blueslip", make_zblueslip());
|
||||
namespace.mock_esm("../../static/js/blueslip", blueslip);
|
||||
require("../../static/js/blueslip");
|
||||
namespace.set_global("i18n", stub_i18n);
|
||||
|
||||
run_one_module(file);
|
||||
|
|
|
@ -120,9 +120,7 @@ const templatesPath = staticPath + "templates" + path.sep;
|
|||
exports.complain_about_unused_mocks = function () {
|
||||
for (const filename of module_mocks.keys()) {
|
||||
if (!used_module_mocks.has(filename)) {
|
||||
throw new Error(
|
||||
`You asked to mock ${filename} but we never saw it during compilation.`,
|
||||
);
|
||||
console.error(`You asked to mock ${filename} but we never saw it during compilation.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const namespace = require("./namespace");
|
||||
const zblueslip = require("./zblueslip");
|
||||
const $ = require("./zjquery");
|
||||
|
||||
let current_file_name;
|
||||
|
@ -34,5 +35,5 @@ exports.run_test = (label, f, opts) => {
|
|||
throw error;
|
||||
}
|
||||
// defensively reset blueslip after each test.
|
||||
window.blueslip.reset();
|
||||
zblueslip.reset();
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
exports.make_zblueslip = function () {
|
||||
function make_zblueslip() {
|
||||
const lib = {};
|
||||
|
||||
const opts = {
|
||||
|
@ -124,4 +124,6 @@ exports.make_zblueslip = function () {
|
|||
lib.preview_node = (node) => "node:" + node;
|
||||
|
||||
return lib;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = make_zblueslip();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as buddy_data from "./buddy_data";
|
||||
import {buddy_list} from "./buddy_list";
|
||||
import * as channel from "./channel";
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
// System documented in https://zulip.readthedocs.io/en/latest/subsystems/logging.html
|
||||
|
@ -8,10 +6,10 @@
|
|||
// in order to be able to report exceptions that occur during their
|
||||
// execution.
|
||||
|
||||
const $ = require("jquery");
|
||||
import $ from "jquery";
|
||||
|
||||
const blueslip_stacktrace = require("./blueslip_stacktrace");
|
||||
const ui_report = require("./ui_report");
|
||||
import * as blueslip_stacktrace from "./blueslip_stacktrace";
|
||||
import * as ui_report from "./ui_report";
|
||||
|
||||
if (Error.stackTraceLimit !== undefined) {
|
||||
Error.stackTraceLimit = 100000;
|
||||
|
@ -70,9 +68,9 @@ for (const name of ["debug", "log", "info", "warn", "error"]) {
|
|||
|
||||
const logger = new Logger();
|
||||
|
||||
exports.get_log = function blueslip_get_log() {
|
||||
export function get_log() {
|
||||
return logger.get_log();
|
||||
};
|
||||
}
|
||||
|
||||
const reported_errors = new Set();
|
||||
const last_report_attempt = new Map();
|
||||
|
@ -185,7 +183,7 @@ class BlueslipError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
exports.exception_msg = function blueslip_exception_msg(ex) {
|
||||
export function exception_msg(ex) {
|
||||
let message = ex.message;
|
||||
if (ex.fileName !== undefined) {
|
||||
message += " at " + ex.fileName;
|
||||
|
@ -194,14 +192,14 @@ exports.exception_msg = function blueslip_exception_msg(ex) {
|
|||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
}
|
||||
|
||||
$(window).on("error", (event) => {
|
||||
const ex = event.originalEvent.error;
|
||||
if (!ex || ex instanceof BlueslipError) {
|
||||
return;
|
||||
}
|
||||
const message = exports.exception_msg(ex);
|
||||
const message = exception_msg(ex);
|
||||
report_error(message, ex.stack);
|
||||
});
|
||||
|
||||
|
@ -213,30 +211,30 @@ function build_arg_list(msg, more_info) {
|
|||
return args;
|
||||
}
|
||||
|
||||
exports.debug = function blueslip_debug(msg, more_info) {
|
||||
export function debug(msg, more_info) {
|
||||
const args = build_arg_list(msg, more_info);
|
||||
logger.debug(...args);
|
||||
};
|
||||
}
|
||||
|
||||
exports.log = function blueslip_log(msg, more_info) {
|
||||
export function log(msg, more_info) {
|
||||
const args = build_arg_list(msg, more_info);
|
||||
logger.log(...args);
|
||||
};
|
||||
}
|
||||
|
||||
exports.info = function blueslip_info(msg, more_info) {
|
||||
export function info(msg, more_info) {
|
||||
const args = build_arg_list(msg, more_info);
|
||||
logger.info(...args);
|
||||
};
|
||||
}
|
||||
|
||||
exports.warn = function blueslip_warn(msg, more_info) {
|
||||
export function warn(msg, more_info) {
|
||||
const args = build_arg_list(msg, more_info);
|
||||
logger.warn(...args);
|
||||
if (page_params.debug_mode) {
|
||||
console.trace();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.error = function blueslip_error(msg, more_info, stack) {
|
||||
export function error(msg, more_info, stack) {
|
||||
if (stack === undefined) {
|
||||
stack = new Error("dummy").stack;
|
||||
}
|
||||
|
@ -250,24 +248,24 @@ exports.error = function blueslip_error(msg, more_info, stack) {
|
|||
|
||||
// This function returns to its caller in production! To raise a
|
||||
// fatal error even in production, use throw new Error(…) instead.
|
||||
};
|
||||
}
|
||||
|
||||
exports.timings = new Map();
|
||||
export const timings = new Map();
|
||||
|
||||
exports.measure_time = function (label, f) {
|
||||
export function measure_time(label, f) {
|
||||
const t1 = performance.now();
|
||||
const ret = f();
|
||||
const t2 = performance.now();
|
||||
const elapsed = t2 - t1;
|
||||
exports.timings.set(label, elapsed);
|
||||
timings.set(label, elapsed);
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
// Produces an easy-to-read preview on an HTML element. Currently
|
||||
// only used for including in error report emails; be sure to discuss
|
||||
// with other developers before using it in a user-facing context
|
||||
// because it is not XSS-safe.
|
||||
exports.preview_node = function (node) {
|
||||
export function preview_node(node) {
|
||||
if (node instanceof $) {
|
||||
node = node[0];
|
||||
}
|
||||
|
@ -286,6 +284,4 @@ exports.preview_node = function (node) {
|
|||
">";
|
||||
|
||||
return node_preview;
|
||||
};
|
||||
|
||||
window.blueslip = exports;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
import * as hash_util from "./hash_util";
|
||||
import * as people from "./people";
|
||||
|
|
|
@ -3,6 +3,7 @@ import $ from "jquery";
|
|||
import render_user_presence_row from "../templates/user_presence_row.hbs";
|
||||
import render_user_presence_rows from "../templates/user_presence_rows.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as buddy_data from "./buddy_data";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as padded_widget from "./padded_widget";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as reload_state from "./reload_state";
|
||||
|
||||
const pending_requests = [];
|
||||
|
|
|
@ -8,6 +8,7 @@ import render_buddy_list_tooltip from "../templates/buddy_list_tooltip.hbs";
|
|||
import render_buddy_list_tooltip_content from "../templates/buddy_list_tooltip_content.hbs";
|
||||
|
||||
import * as activity from "./activity";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as buddy_data from "./buddy_data";
|
||||
import * as channel from "./channel";
|
||||
import * as compose from "./compose";
|
||||
|
|
|
@ -8,6 +8,7 @@ import render_compose_invite_users from "../templates/compose_invite_users.hbs";
|
|||
import render_compose_not_subscribed from "../templates/compose_not_subscribed.hbs";
|
||||
import render_compose_private_stream_alert from "../templates/compose_private_stream_alert.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as common from "./common";
|
||||
import * as compose_actions from "./compose_actions";
|
||||
|
|
|
@ -2,6 +2,7 @@ import $ from "jquery";
|
|||
|
||||
import render_confirm_dialog from "../templates/confirm_dialog.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as overlays from "./overlays";
|
||||
|
||||
/*
|
||||
|
|
|
@ -4,6 +4,7 @@ import $ from "jquery";
|
|||
|
||||
import render_draft_table_body from "../templates/draft_table_body.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_actions from "./compose_actions";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
|
|
|
@ -2,6 +2,7 @@ import $ from "jquery";
|
|||
|
||||
import render_dropdown_list from "../templates/settings/dropdown_list.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as ListWidget from "./list_widget";
|
||||
|
||||
export const DropdownListWidget = function (opts) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as alert_words from "./alert_words";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose from "./compose";
|
||||
import * as local_message from "./local_message";
|
||||
import * as markdown from "./markdown";
|
||||
|
|
|
@ -8,6 +8,7 @@ import render_emoji_popover_content from "../templates/emoji_popover_content.hbs
|
|||
import render_emoji_popover_search_results from "../templates/emoji_popover_search_results.hbs";
|
||||
import render_emoji_showcase from "../templates/emoji_showcase.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose_ui from "./compose_ui";
|
||||
import * as message_store from "./message_store";
|
||||
import * as popovers from "./popovers";
|
||||
|
|
|
@ -2,6 +2,8 @@ import $ from "jquery";
|
|||
|
||||
import render_feedback_container from "../templates/feedback_container.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
|
||||
/*
|
||||
|
||||
This code lets you show something like this:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as message_store from "./message_store";
|
||||
import * as rows from "./rows";
|
||||
import * as timerender from "./timerender";
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// remove each declaration when the corresponding module is migrated
|
||||
// to TS.
|
||||
|
||||
declare let blueslip: any;
|
||||
declare let csrf_token: any;
|
||||
declare let current_msg_list: any;
|
||||
declare let home_msg_list: any;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as admin from "./admin";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as drafts from "./drafts";
|
||||
import * as floating_recipient_bar from "./floating_recipient_bar";
|
||||
import * as hash_util from "./hash_util";
|
||||
|
|
|
@ -5,6 +5,7 @@ import render_hotspot_icon from "../templates/hotspot_icon.hbs";
|
|||
import render_hotspot_overlay from "../templates/hotspot_overlay.hbs";
|
||||
import render_intro_reply_hotspot from "../templates/intro_reply_hotspot.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as popovers from "./popovers";
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import $ from "jquery";
|
|||
|
||||
import render_input_pill from "../templates/input_pill.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as ui_util from "./ui_util";
|
||||
|
||||
// See https://zulip.readthedocs.io/en/latest/subsystems/input-pills.html
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
|
||||
export class LazySet {
|
||||
/*
|
||||
This class is optimized for a very
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {LightboxCanvas} from "./lightbox_canvas";
|
||||
import * as message_store from "./message_store";
|
||||
import * as overlays from "./overlays";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import * as overlays from "./overlays";
|
||||
|
||||
const funcs = {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as scroll_util from "./scroll_util";
|
||||
|
||||
export class ListCursor {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as ui from "./ui";
|
||||
|
||||
const DEFAULTS = {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import * as message_events from "./message_events";
|
||||
import * as message_list from "./message_list";
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
|
||||
const ls = {
|
||||
// parse JSON without throwing an error.
|
||||
parseJSON(str) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import * as emoji from "../shared/js/emoji";
|
|||
import * as fenced_code from "../shared/js/fenced_code";
|
||||
import marked from "../third/marked/lib/marked";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as message_store from "./message_store";
|
||||
|
||||
// This contains zulip's frontend Markdown implementation; see
|
||||
|
|
|
@ -4,6 +4,7 @@ import $ from "jquery";
|
|||
import render_message_edit_form from "../templates/message_edit_form.hbs";
|
||||
import render_topic_edit_form from "../templates/topic_edit_form.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_actions from "./compose_actions";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import autosize from "autosize";
|
||||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {MessageListData} from "./message_list_data";
|
||||
import {MessageListView} from "./message_list_view";
|
||||
import * as narrow from "./narrow";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import _ from "lodash";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {FetchStatus} from "./fetch_status";
|
||||
import {Filter} from "./filter";
|
||||
import * as muting from "./muting";
|
||||
|
|
|
@ -8,6 +8,7 @@ import render_recipient_row from "../templates/recipient_row.hbs";
|
|||
import render_single_message from "../templates/single_message.hbs";
|
||||
|
||||
import * as activity from "./activity";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
import * as condense from "./condense";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as alert_words from "./alert_words";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as message_list from "./message_list";
|
||||
import * as people from "./people";
|
||||
import * as pm_conversations from "./pm_conversations";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {media_breakpoints} from "./css_variables";
|
||||
import * as message_scroll from "./message_scroll";
|
||||
import * as rows from "./rows";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import {FoldDict} from "./fold_dict";
|
||||
import * as stream_data from "./stream_data";
|
||||
import * as timerender from "./timerender";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_actions from "./compose_actions";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import {Filter} from "./filter";
|
||||
import * as people from "./people";
|
||||
import * as stream_data from "./stream_data";
|
||||
|
|
|
@ -5,6 +5,7 @@ import render_compose_notification from "../templates/compose_notification.hbs";
|
|||
import render_notification from "../templates/notification.hbs";
|
||||
|
||||
import * as alert_words from "./alert_words";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as favicon from "./favicon";
|
||||
import * as message_store from "./message_store";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as hashchange from "./hashchange";
|
||||
import * as popovers from "./popovers";
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import {LazySet} from "./lazy_set";
|
||||
import * as people from "./people";
|
||||
import * as stream_data from "./stream_data";
|
||||
|
|
|
@ -4,6 +4,7 @@ import _ from "lodash";
|
|||
|
||||
import * as typeahead from "../shared/js/typeahead";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import {FoldDict} from "./fold_dict";
|
||||
import * as message_store from "./message_store";
|
||||
import * as reload_state from "./reload_state";
|
||||
|
|
|
@ -3,6 +3,7 @@ import $ from "jquery";
|
|||
import render_widgets_poll_widget from "../templates/widgets/poll_widget.hbs";
|
||||
import render_widgets_poll_widget_results from "../templates/widgets/poll_widget_results.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as people from "./people";
|
||||
|
||||
export class PollData {
|
||||
|
|
|
@ -15,6 +15,7 @@ import render_user_info_popover_content from "../templates/user_info_popover_con
|
|||
import render_user_info_popover_title from "../templates/user_info_popover_title.hbs";
|
||||
import render_user_profile_modal from "../templates/user_profile_modal.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as buddy_data from "./buddy_data";
|
||||
import * as compose_actions from "./compose_actions";
|
||||
import * as compose_state from "./compose_state";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import * as people from "./people";
|
||||
import * as reload_state from "./reload_state";
|
||||
import * as server_events from "./server_events";
|
||||
|
|
|
@ -4,6 +4,7 @@ import _ from "lodash";
|
|||
import * as emoji from "../shared/js/emoji";
|
||||
import render_message_reaction from "../templates/message_reaction.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as emoji_picker from "./emoji_picker";
|
||||
import * as message_store from "./message_store";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as activity from "./activity";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_actions from "./compose_actions";
|
||||
import * as compose_state from "./compose_state";
|
||||
|
|
|
@ -6,6 +6,7 @@ import copy_code_button from "../templates/copy_code_button.hbs";
|
|||
import render_markdown_timestamp from "../templates/markdown_timestamp.hbs";
|
||||
import view_code_in_playground from "../templates/view_code_in_playground.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as people from "./people";
|
||||
import * as rtl from "./rtl";
|
||||
import * as settings_config from "./settings_config";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import autosize from "autosize";
|
||||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as condense from "./condense";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as navigate from "./navigate";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as message_store from "./message_store";
|
||||
// We don't need an andSelf() here because we already know
|
||||
// that our next element is *not* a message_row, so this
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as server_events from "./server_events";
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import $ from "jquery";
|
||||
import _ from "lodash";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as echo from "./echo";
|
||||
import * as message_events from "./message_events";
|
||||
|
|
|
@ -6,6 +6,7 @@ import * as activity from "./activity";
|
|||
import * as alert_words from "./alert_words";
|
||||
import * as alert_words_ui from "./alert_words_ui";
|
||||
import * as attachments_ui from "./attachments_ui";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as bot_data from "./bot_data";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
|
|
|
@ -4,6 +4,7 @@ import timezones from "../generated/timezones.json";
|
|||
import render_settings_tab from "../templates/settings_tab.hbs";
|
||||
|
||||
import * as admin from "./admin";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as overlays from "./overlays";
|
||||
import * as people from "./people";
|
||||
import * as settings_account from "./settings_account";
|
||||
|
|
|
@ -6,6 +6,7 @@ import render_settings_custom_user_profile_field from "../templates/settings/cus
|
|||
import render_settings_dev_env_email_access from "../templates/settings/dev_env_email_access.hbs";
|
||||
|
||||
import * as avatar from "./avatar";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as common from "./common";
|
||||
import * as overlays from "./overlays";
|
||||
|
|
|
@ -3,6 +3,7 @@ import $ from "jquery";
|
|||
import render_admin_invites_list from "../templates/admin_invites_list.hbs";
|
||||
import render_settings_revoke_invite_modal from "../templates/settings/revoke_invite_modal.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import * as ListWidget from "./list_widget";
|
||||
import * as loading from "./loading";
|
||||
|
|
|
@ -4,6 +4,7 @@ import pygments_data from "../generated/pygments_data.json";
|
|||
import render_settings_admin_auth_methods_list from "../templates/settings/admin_auth_methods_list.hbs";
|
||||
import render_settings_admin_realm_domains_list from "../templates/settings/admin_realm_domains_list.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
|
||||
import * as loading from "./loading";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as alert_words_ui from "./alert_words_ui";
|
||||
import * as attachments_ui from "./attachments_ui";
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as settings_account from "./settings_account";
|
||||
import * as settings_bots from "./settings_bots";
|
||||
import * as settings_display from "./settings_display";
|
||||
|
|
|
@ -4,6 +4,7 @@ import render_admin_bot_form from "../templates/admin_bot_form.hbs";
|
|||
import render_admin_human_form from "../templates/admin_human_form.hbs";
|
||||
import render_admin_user_list from "../templates/admin_user_list.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as bot_data from "./bot_data";
|
||||
import * as channel from "./channel";
|
||||
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue