@jsenv/plugin-supervisor 1.5.15 → 1.5.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/supervisor.js +20 -1
- package/package.json +3 -3
- package/src/client/supervisor.js +29 -1
package/dist/js/supervisor.js
CHANGED
|
@@ -481,6 +481,7 @@ window.__supervisor__ = (() => {
|
|
|
481
481
|
column
|
|
482
482
|
} = {}) => {
|
|
483
483
|
const exception = {
|
|
484
|
+
runtime: "browser",
|
|
484
485
|
reason,
|
|
485
486
|
isException: true,
|
|
486
487
|
isError: false,
|
|
@@ -919,7 +920,25 @@ window.__supervisor__ = (() => {
|
|
|
919
920
|
document.querySelectorAll(JSENV_ERROR_OVERLAY_TAGNAME).forEach(node => {
|
|
920
921
|
node.parentNode.removeChild(node);
|
|
921
922
|
});
|
|
922
|
-
|
|
923
|
+
const appendIntoRespectingLineBreaksAndIndentation = (node, parentNode, {
|
|
924
|
+
indent = 2
|
|
925
|
+
} = {}) => {
|
|
926
|
+
const indentMinusOne = " ".repeat(indent - 1);
|
|
927
|
+
const desiredIndent = " ".repeat(indent);
|
|
928
|
+
const previousSibling = parentNode.childNodes[parentNode.childNodes.length - 1];
|
|
929
|
+
if (previousSibling && previousSibling.nodeName === "#text") {
|
|
930
|
+
if (previousSibling.nodeValue === "\n".concat(indentMinusOne)) {
|
|
931
|
+
previousSibling.nodeValue = "\n".concat(desiredIndent);
|
|
932
|
+
}
|
|
933
|
+
if (previousSibling.nodeValue !== "\n".concat(desiredIndent)) {
|
|
934
|
+
previousSibling.nodeValue = "\n".concat(desiredIndent);
|
|
935
|
+
}
|
|
936
|
+
} else {
|
|
937
|
+
parentNode.appendChild(document.createTextNode("\n".concat(desiredIndent)));
|
|
938
|
+
}
|
|
939
|
+
parentNode.appendChild(node);
|
|
940
|
+
};
|
|
941
|
+
appendIntoRespectingLineBreaksAndIndentation(jsenvErrorOverlay, document.body);
|
|
923
942
|
const removeErrorOverlay = () => {
|
|
924
943
|
if (jsenvErrorOverlay && jsenvErrorOverlay.parentNode) {
|
|
925
944
|
document.body.removeChild(jsenvErrorOverlay);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-supervisor",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"/dist/"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jsenv/ast": "6.2.
|
|
29
|
+
"@jsenv/ast": "6.2.16",
|
|
30
30
|
"@jsenv/urls": "2.5.2",
|
|
31
|
-
"@jsenv/sourcemap": "1.2.
|
|
31
|
+
"@jsenv/sourcemap": "1.2.23",
|
|
32
32
|
"launch-editor": "2.8.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
package/src/client/supervisor.js
CHANGED
|
@@ -439,6 +439,7 @@ window.__supervisor__ = (() => {
|
|
|
439
439
|
{ message, reportedBy, url, line, column } = {},
|
|
440
440
|
) => {
|
|
441
441
|
const exception = {
|
|
442
|
+
runtime: "browser",
|
|
442
443
|
reason,
|
|
443
444
|
isException: true,
|
|
444
445
|
isError: false, // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw
|
|
@@ -900,7 +901,34 @@ window.__supervisor__ = (() => {
|
|
|
900
901
|
.forEach((node) => {
|
|
901
902
|
node.parentNode.removeChild(node);
|
|
902
903
|
});
|
|
903
|
-
|
|
904
|
+
|
|
905
|
+
const appendIntoRespectingLineBreaksAndIndentation = (
|
|
906
|
+
node,
|
|
907
|
+
parentNode,
|
|
908
|
+
{ indent = 2 } = {},
|
|
909
|
+
) => {
|
|
910
|
+
const indentMinusOne = " ".repeat(indent - 1);
|
|
911
|
+
const desiredIndent = " ".repeat(indent);
|
|
912
|
+
const previousSibling =
|
|
913
|
+
parentNode.childNodes[parentNode.childNodes.length - 1];
|
|
914
|
+
if (previousSibling && previousSibling.nodeName === "#text") {
|
|
915
|
+
if (previousSibling.nodeValue === `\n${indentMinusOne}`) {
|
|
916
|
+
previousSibling.nodeValue = `\n${desiredIndent}`;
|
|
917
|
+
}
|
|
918
|
+
if (previousSibling.nodeValue !== `\n${desiredIndent}`) {
|
|
919
|
+
previousSibling.nodeValue = `\n${desiredIndent}`;
|
|
920
|
+
}
|
|
921
|
+
} else {
|
|
922
|
+
parentNode.appendChild(
|
|
923
|
+
document.createTextNode(`\n${desiredIndent}`),
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
parentNode.appendChild(node);
|
|
927
|
+
};
|
|
928
|
+
appendIntoRespectingLineBreaksAndIndentation(
|
|
929
|
+
jsenvErrorOverlay,
|
|
930
|
+
document.body,
|
|
931
|
+
);
|
|
904
932
|
const removeErrorOverlay = () => {
|
|
905
933
|
if (jsenvErrorOverlay && jsenvErrorOverlay.parentNode) {
|
|
906
934
|
document.body.removeChild(jsenvErrorOverlay);
|