vite-plugin-vue-insight 0.1.0 → 0.1.2
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/package.json +3 -3
- package/src/vite-plugin.js +15 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vue-insight",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "点击定位源码、高亮 DOM、查看组件状态、分享链接 — Vue 3 + Vite 调试助手",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"preview": "vite preview"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"vite": "
|
|
23
|
-
"vue": "^3.
|
|
22
|
+
"vite": ">=2.0.0",
|
|
23
|
+
"vue": "^3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@vue/compiler-sfc": "^3.2.0"
|
package/src/vite-plugin.js
CHANGED
|
@@ -201,10 +201,12 @@ export function vueInsightPlugin(options = {}) {
|
|
|
201
201
|
return
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
const
|
|
204
|
+
// Windows 绝对路径如 C:/path/to/file.vue:10:1,需从右侧拆分行号列号
|
|
205
|
+
const lastColon = fileParam.lastIndexOf(':')
|
|
206
|
+
const secondLastColon = fileParam.lastIndexOf(':', lastColon - 1)
|
|
207
|
+
const filePath = fileParam.substring(0, secondLastColon)
|
|
208
|
+
const line = fileParam.substring(secondLastColon + 1, lastColon)
|
|
209
|
+
const column = fileParam.substring(lastColon + 1) || '1'
|
|
208
210
|
|
|
209
211
|
const { spawn } = await import('node:child_process')
|
|
210
212
|
|
|
@@ -231,7 +233,15 @@ export function vueInsightPlugin(options = {}) {
|
|
|
231
233
|
break
|
|
232
234
|
}
|
|
233
235
|
|
|
234
|
-
const child = spawn(cmd, args, {
|
|
236
|
+
const child = spawn(cmd, args, {
|
|
237
|
+
stdio: 'ignore',
|
|
238
|
+
detached: true,
|
|
239
|
+
shell: process.platform === 'win32',
|
|
240
|
+
})
|
|
241
|
+
child.on('error', (err) => {
|
|
242
|
+
console.warn('[vue-insight] 无法启动编辑器 (' + cmd + '): ' + err.message)
|
|
243
|
+
console.warn('[vue-insight] 请确认 ' + cmd + ' 已安装且已加入 PATH 环境变量')
|
|
244
|
+
})
|
|
235
245
|
child.unref()
|
|
236
246
|
|
|
237
247
|
res.statusCode = 200
|