@leftium/gg 0.0.31 → 0.0.33
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/OpenInEditorLink.svelte +8 -10
- package/dist/OpenInEditorLink.svelte.d.ts +6 -3
- package/dist/eruda/plugin.js +566 -14
- package/dist/eruda/types.d.ts +8 -0
- package/dist/gg-call-sites-plugin.d.ts +6 -6
- package/dist/gg-call-sites-plugin.js +253 -47
- package/dist/gg.d.ts +11 -2
- package/dist/gg.js +68 -75
- package/dist/open-in-editor.js +15 -2
- package/package.json +1 -2
package/dist/open-in-editor.js
CHANGED
|
@@ -16,17 +16,30 @@ export default function openInEditorPlugin(specifiedEditor, srcRoot, onErrorCall
|
|
|
16
16
|
name: 'open-in-editor',
|
|
17
17
|
configureServer(server) {
|
|
18
18
|
server.middlewares.use('/__open-in-editor', (req, res) => {
|
|
19
|
-
const { file } = url.parse(req.url || '', true).query || {};
|
|
19
|
+
const { file, line, col, editor } = url.parse(req.url || '', true).query || {};
|
|
20
20
|
if (!file) {
|
|
21
21
|
res.statusCode = 500;
|
|
22
22
|
res.end(`open-in-editor-plugin: required query param "file" is missing.`);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
res.statusCode = 222;
|
|
26
|
-
launch
|
|
26
|
+
// launch-editor supports file:line:col format for cursor positioning
|
|
27
|
+
let fileArg = path.resolve(srcRoot, file);
|
|
28
|
+
if (line)
|
|
29
|
+
fileArg += `:${line}`;
|
|
30
|
+
if (line && col)
|
|
31
|
+
fileArg += `:${col}`;
|
|
32
|
+
// Use editor from query param if provided, otherwise fall back to plugin config
|
|
33
|
+
const editorToUse = typeof editor === 'string' && editor ? editor : specifiedEditor;
|
|
34
|
+
launch(fileArg, editorToUse, onErrorCallback);
|
|
27
35
|
res.end('<p>You may safely close this window.</p><script>window.close()</script>');
|
|
28
36
|
}
|
|
29
37
|
});
|
|
38
|
+
// Expose project root for client-side $ROOT variable (forward slashes for URI compat)
|
|
39
|
+
server.middlewares.use('/__gg-project-root', (_req, res) => {
|
|
40
|
+
res.setHeader('Content-Type', 'text/plain');
|
|
41
|
+
res.end(srcRoot.replace(/\\/g, '/'));
|
|
42
|
+
});
|
|
30
43
|
}
|
|
31
44
|
};
|
|
32
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leftium/gg",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Leftium/gg.git"
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"dotenv": "^17.2.4",
|
|
71
|
-
"error-stack-parser": "^2.1.4",
|
|
72
71
|
"esm-env": "^1.2.2",
|
|
73
72
|
"launch-editor": "^2.12.0"
|
|
74
73
|
},
|