@tanstack/devtools-vite 0.2.11 → 0.2.13
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/esm/editor.js +7 -3
- package/dist/esm/editor.js.map +1 -1
- package/package.json +3 -2
- package/src/editor.ts +7 -3
package/dist/esm/editor.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
const DEFAULT_EDITOR_CONFIG = {
|
|
2
2
|
name: "VSCode",
|
|
3
3
|
open: async (path, lineNumber, columnNumber) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const launch = (await import("launch-editor")).default;
|
|
5
|
+
launch(
|
|
6
|
+
`${path.replaceAll("$", "\\$")}${lineNumber ? `:${lineNumber}` : ""}${columnNumber ? `:${columnNumber}` : ""}`,
|
|
7
|
+
void 0,
|
|
8
|
+
(filename, err) => {
|
|
9
|
+
console.warn(`Failed to open ${filename} in editor: ${err}`);
|
|
10
|
+
}
|
|
7
11
|
);
|
|
8
12
|
}
|
|
9
13
|
};
|
package/dist/esm/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sources":["../../src/editor.ts"],"sourcesContent":["type OpenSourceData = {\n type: 'open-source'\n data: {\n /** The source file to open */\n source?: string\n /** The react router route ID, usually discovered via the hook useMatches */\n routeID?: string\n /** The line number in the source file */\n line?: number\n /** The column number in the source file */\n column?: number\n }\n}\n\nexport type EditorConfig = {\n /** The name of the editor, used for debugging purposes */\n name: string\n /** Callback to open a file in the editor */\n open: (\n path: string,\n lineNumber: string | undefined,\n columnNumber?: string,\n ) => Promise<void>\n}\n\nexport const DEFAULT_EDITOR_CONFIG: EditorConfig = {\n name: 'VSCode',\n open: async (path, lineNumber, columnNumber) => {\n const
|
|
1
|
+
{"version":3,"file":"editor.js","sources":["../../src/editor.ts"],"sourcesContent":["type OpenSourceData = {\n type: 'open-source'\n data: {\n /** The source file to open */\n source?: string\n /** The react router route ID, usually discovered via the hook useMatches */\n routeID?: string\n /** The line number in the source file */\n line?: number\n /** The column number in the source file */\n column?: number\n }\n}\n\nexport type EditorConfig = {\n /** The name of the editor, used for debugging purposes */\n name: string\n /** Callback to open a file in the editor */\n open: (\n path: string,\n lineNumber: string | undefined,\n columnNumber?: string,\n ) => Promise<void>\n}\n\nexport const DEFAULT_EDITOR_CONFIG: EditorConfig = {\n name: 'VSCode',\n open: async (path, lineNumber, columnNumber) => {\n const launch = (await import('launch-editor')).default\n launch(\n `${path.replaceAll('$', '\\\\$')}${lineNumber ? `:${lineNumber}` : ''}${columnNumber ? `:${columnNumber}` : ''}`,\n undefined,\n (filename, err) => {\n console.warn(`Failed to open ${filename} in editor: ${err}`)\n },\n )\n },\n}\n\nexport const handleOpenSource = async ({\n data,\n openInEditor,\n}: {\n data: OpenSourceData\n openInEditor: EditorConfig['open']\n}) => {\n const { source, line, column } = data.data\n const lineNum = line ? `${line}` : undefined\n const columnNum = column ? `${column}` : undefined\n if (source) {\n return openInEditor(source, lineNum, columnNum)\n }\n}\n"],"names":[],"mappings":"AAyBO,MAAM,wBAAsC;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,OAAO,MAAM,YAAY,iBAAiB;AAC9C,UAAM,UAAU,MAAM,OAAO,eAAe,GAAG;AAC/C;AAAA,MACE,GAAG,KAAK,WAAW,KAAK,KAAK,CAAC,GAAG,aAAa,IAAI,UAAU,KAAK,EAAE,GAAG,eAAe,IAAI,YAAY,KAAK,EAAE;AAAA,MAC5G;AAAA,MACA,CAAC,UAAU,QAAQ;AACjB,gBAAQ,KAAK,kBAAkB,QAAQ,eAAe,GAAG,EAAE;AAAA,MAC7D;AAAA,IAAA;AAAA,EAEJ;AACF;AAEO,MAAM,mBAAmB,OAAO;AAAA,EACrC;AAAA,EACA;AACF,MAGM;AACJ,QAAM,EAAE,QAAQ,MAAM,OAAA,IAAW,KAAK;AACtC,QAAM,UAAU,OAAO,GAAG,IAAI,KAAK;AACnC,QAAM,YAAY,SAAS,GAAG,MAAM,KAAK;AACzC,MAAI,QAAQ;AACV,WAAO,aAAa,QAAQ,SAAS,SAAS;AAAA,EAChD;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/devtools-vite",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "TanStack Vite plugin used to enhance the core devtools with additional functionalities",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"@babel/traverse": "^7.28.3",
|
|
48
48
|
"@babel/types": "^7.28.2",
|
|
49
49
|
"chalk": "^5.6.0",
|
|
50
|
-
"
|
|
50
|
+
"launch-editor": "^2.11.1",
|
|
51
|
+
"@tanstack/devtools-event-bus": "0.3.2"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/babel__core": "^7.20.5",
|
package/src/editor.ts
CHANGED
|
@@ -26,9 +26,13 @@ export type EditorConfig = {
|
|
|
26
26
|
export const DEFAULT_EDITOR_CONFIG: EditorConfig = {
|
|
27
27
|
name: 'VSCode',
|
|
28
28
|
open: async (path, lineNumber, columnNumber) => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const launch = (await import('launch-editor')).default
|
|
30
|
+
launch(
|
|
31
|
+
`${path.replaceAll('$', '\\$')}${lineNumber ? `:${lineNumber}` : ''}${columnNumber ? `:${columnNumber}` : ''}`,
|
|
32
|
+
undefined,
|
|
33
|
+
(filename, err) => {
|
|
34
|
+
console.warn(`Failed to open ${filename} in editor: ${err}`)
|
|
35
|
+
},
|
|
32
36
|
)
|
|
33
37
|
},
|
|
34
38
|
}
|