@jsenv/plugin-supervisor 1.5.15 → 1.5.16
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 +19 -1
- package/package.json +3 -3
- package/src/client/supervisor.js +28 -1
package/dist/js/supervisor.js
CHANGED
|
@@ -919,7 +919,25 @@ window.__supervisor__ = (() => {
|
|
|
919
919
|
document.querySelectorAll(JSENV_ERROR_OVERLAY_TAGNAME).forEach(node => {
|
|
920
920
|
node.parentNode.removeChild(node);
|
|
921
921
|
});
|
|
922
|
-
|
|
922
|
+
const appendIntoRespectingLineBreaksAndIndentation = (node, parentNode, {
|
|
923
|
+
indent = 2
|
|
924
|
+
} = {}) => {
|
|
925
|
+
const indentMinusOne = " ".repeat(indent - 1);
|
|
926
|
+
const desiredIndent = " ".repeat(indent);
|
|
927
|
+
const previousSibling = parentNode.childNodes[parentNode.childNodes.length - 1];
|
|
928
|
+
if (previousSibling && previousSibling.nodeName === "#text") {
|
|
929
|
+
if (previousSibling.nodeValue === "\n".concat(indentMinusOne)) {
|
|
930
|
+
previousSibling.nodeValue = "\n".concat(desiredIndent);
|
|
931
|
+
}
|
|
932
|
+
if (previousSibling.nodeValue !== "\n".concat(desiredIndent)) {
|
|
933
|
+
previousSibling.nodeValue = "\n".concat(desiredIndent);
|
|
934
|
+
}
|
|
935
|
+
} else {
|
|
936
|
+
parentNode.appendChild(document.createTextNode("\n".concat(desiredIndent)));
|
|
937
|
+
}
|
|
938
|
+
parentNode.appendChild(node);
|
|
939
|
+
};
|
|
940
|
+
appendIntoRespectingLineBreaksAndIndentation(jsenvErrorOverlay, document.body);
|
|
923
941
|
const removeErrorOverlay = () => {
|
|
924
942
|
if (jsenvErrorOverlay && jsenvErrorOverlay.parentNode) {
|
|
925
943
|
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.16",
|
|
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.15",
|
|
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
|
@@ -900,7 +900,34 @@ window.__supervisor__ = (() => {
|
|
|
900
900
|
.forEach((node) => {
|
|
901
901
|
node.parentNode.removeChild(node);
|
|
902
902
|
});
|
|
903
|
-
|
|
903
|
+
|
|
904
|
+
const appendIntoRespectingLineBreaksAndIndentation = (
|
|
905
|
+
node,
|
|
906
|
+
parentNode,
|
|
907
|
+
{ indent = 2 } = {},
|
|
908
|
+
) => {
|
|
909
|
+
const indentMinusOne = " ".repeat(indent - 1);
|
|
910
|
+
const desiredIndent = " ".repeat(indent);
|
|
911
|
+
const previousSibling =
|
|
912
|
+
parentNode.childNodes[parentNode.childNodes.length - 1];
|
|
913
|
+
if (previousSibling && previousSibling.nodeName === "#text") {
|
|
914
|
+
if (previousSibling.nodeValue === `\n${indentMinusOne}`) {
|
|
915
|
+
previousSibling.nodeValue = `\n${desiredIndent}`;
|
|
916
|
+
}
|
|
917
|
+
if (previousSibling.nodeValue !== `\n${desiredIndent}`) {
|
|
918
|
+
previousSibling.nodeValue = `\n${desiredIndent}`;
|
|
919
|
+
}
|
|
920
|
+
} else {
|
|
921
|
+
parentNode.appendChild(
|
|
922
|
+
document.createTextNode(`\n${desiredIndent}`),
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
parentNode.appendChild(node);
|
|
926
|
+
};
|
|
927
|
+
appendIntoRespectingLineBreaksAndIndentation(
|
|
928
|
+
jsenvErrorOverlay,
|
|
929
|
+
document.body,
|
|
930
|
+
);
|
|
904
931
|
const removeErrorOverlay = () => {
|
|
905
932
|
if (jsenvErrorOverlay && jsenvErrorOverlay.parentNode) {
|
|
906
933
|
document.body.removeChild(jsenvErrorOverlay);
|