Convert ANSI escape codes to HTML on error page

This commit is contained in:
Christian Klaussner
2019-08-18 16:38:16 +02:00
parent 43db8ed1c9
commit c112077ac2
3 changed files with 5 additions and 21 deletions

2
meteor
View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
BUNDLE_VERSION=8.16.2.2
BUNDLE_VERSION=8.16.2.3
# OS Check. Put here because here is where we download the precompiled
# bundles that are arch specific.

View File

@@ -60,7 +60,8 @@ var packageJson = {
// version constraint imposed by optimism/package.json.
optimism: "0.11.3",
"@wry/context": "0.4.4",
'lru-cache': '4.1.3'
'lru-cache': '4.1.3',
"anser": "1.4.8"
}
};

View File

@@ -1,3 +1,4 @@
var Anser = require("anser");
var _ = require('underscore');
var runLog = require('./run-log.js');
@@ -251,7 +252,7 @@ function showErrorPage(res) {
<pre>`);
_.each(runLog.getLog(), function (item) {
res.write(escapeEntities(item.message) + "\n");
res.write(Anser.ansiToHtml(Anser.escapeForHtml(item.message)) + "\n");
});
res.write(`</pre>
@@ -261,22 +262,4 @@ function showErrorPage(res) {
res.end();
}
// Copied from packages/blaze/preamble.js
function escapeEntities(str) {
const escapeMap = {
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;", /* IE allows backtick-delimited attributes?? */
"&": "&amp;"
};
const escapeChar = function(c) {
return escapeMap[c];
};
return str.replace(/[&<>"'`]/g, escapeChar);
}
exports.Proxy = Proxy;