@jsenv/plugin-supervisor 1.3.5 → 1.3.7
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
CHANGED
|
@@ -696,7 +696,12 @@ window.__supervisor__ = (() => {
|
|
|
696
696
|
return stack;
|
|
697
697
|
};
|
|
698
698
|
const resolveFileUrl = url => {
|
|
699
|
-
let urlObject
|
|
699
|
+
let urlObject;
|
|
700
|
+
try {
|
|
701
|
+
urlObject = new URL(url, window.origin);
|
|
702
|
+
} catch (e) {
|
|
703
|
+
return url;
|
|
704
|
+
}
|
|
700
705
|
if (urlObject.origin === window.origin) {
|
|
701
706
|
urlObject = new URL("".concat(urlObject.pathname.slice(1)).concat(urlObject.search), rootDirectoryUrl);
|
|
702
707
|
}
|
|
@@ -1043,9 +1043,11 @@ const jsenvPluginSupervisor = ({
|
|
|
1043
1043
|
body: "Missing file in url"
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
|
+
const fileUrl = new URL(file, serveInfo.rootDirectoryUrl);
|
|
1047
|
+
const filePath = fileURLToPath(fileUrl);
|
|
1046
1048
|
const require = createRequire(import.meta.url);
|
|
1047
1049
|
const launch = require("launch-editor");
|
|
1048
|
-
launch(
|
|
1050
|
+
launch(filePath, () => {
|
|
1049
1051
|
// ignore error for now
|
|
1050
1052
|
});
|
|
1051
1053
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-supervisor",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
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": "5.1
|
|
29
|
+
"@jsenv/ast": "5.2.1",
|
|
30
30
|
"@jsenv/urls": "2.2.1",
|
|
31
|
-
"@jsenv/sourcemap": "1.2.
|
|
31
|
+
"@jsenv/sourcemap": "1.2.4",
|
|
32
32
|
"launch-editor": "2.6.1"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
package/src/client/supervisor.js
CHANGED
|
@@ -662,7 +662,12 @@ window.__supervisor__ = (() => {
|
|
|
662
662
|
};
|
|
663
663
|
|
|
664
664
|
const resolveFileUrl = (url) => {
|
|
665
|
-
let urlObject
|
|
665
|
+
let urlObject;
|
|
666
|
+
try {
|
|
667
|
+
urlObject = new URL(url, window.origin);
|
|
668
|
+
} catch (e) {
|
|
669
|
+
return url;
|
|
670
|
+
}
|
|
666
671
|
if (urlObject.origin === window.origin) {
|
|
667
672
|
urlObject = new URL(
|
|
668
673
|
`${urlObject.pathname.slice(1)}${urlObject.search}`,
|
|
@@ -144,15 +144,18 @@ export const jsenvPluginSupervisor = ({
|
|
|
144
144
|
"/__open_in_editor__/".length,
|
|
145
145
|
);
|
|
146
146
|
file = decodeURIComponent(file);
|
|
147
|
+
|
|
147
148
|
if (!file) {
|
|
148
149
|
return {
|
|
149
150
|
status: 400,
|
|
150
151
|
body: "Missing file in url",
|
|
151
152
|
};
|
|
152
153
|
}
|
|
154
|
+
const fileUrl = new URL(file, serveInfo.rootDirectoryUrl);
|
|
155
|
+
const filePath = fileURLToPath(fileUrl);
|
|
153
156
|
const require = createRequire(import.meta.url);
|
|
154
157
|
const launch = require("launch-editor");
|
|
155
|
-
launch(
|
|
158
|
+
launch(filePath, () => {
|
|
156
159
|
// ignore error for now
|
|
157
160
|
});
|
|
158
161
|
return {
|