mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Convert ANSI escape codes to HTML on error page
This commit is contained in:
2
meteor
2
meteor
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'",
|
||||
"`": "`", /* IE allows backtick-delimited attributes?? */
|
||||
"&": "&"
|
||||
};
|
||||
|
||||
const escapeChar = function(c) {
|
||||
return escapeMap[c];
|
||||
};
|
||||
|
||||
return str.replace(/[&<>"'`]/g, escapeChar);
|
||||
}
|
||||
|
||||
exports.Proxy = Proxy;
|
||||
|
||||
Reference in New Issue
Block a user