vite-uni-dev-tool 0.0.10 → 0.0.12

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.
Files changed (45) hide show
  1. package/README.md +65 -1
  2. package/dev/components/AppInfo/index.vue +36 -0
  3. package/dev/components/CaptureScreen/index.vue +62 -0
  4. package/dev/components/Code/index.vue +7 -4
  5. package/dev/components/ConsoleList/ConsoleItem.vue +24 -3
  6. package/dev/components/ConsoleList/RunJSInput.vue +180 -2
  7. package/dev/components/ConsoleList/index.vue +17 -2
  8. package/dev/components/ConsoleList/staticTips.ts +1145 -0
  9. package/dev/components/DevTool/index.vue +37 -31
  10. package/dev/components/DevToolButton/index.vue +9 -12
  11. package/dev/components/DevToolTitle/index.vue +2 -2
  12. package/dev/components/DevToolWindow/index.vue +230 -112
  13. package/dev/components/JsonPretty/components/Carets/index.vue +10 -14
  14. package/dev/components/JsonPretty/index.vue +2 -0
  15. package/dev/components/NetworkList/NetworkDetail.vue +3 -6
  16. package/dev/components/NetworkList/NetworkItem.vue +21 -8
  17. package/dev/components/NetworkList/index.vue +15 -2
  18. package/dev/components/RouteList/index.vue +12 -1
  19. package/dev/components/SettingList/index.vue +2 -5
  20. package/dev/components/SourceCode/index.vue +231 -0
  21. package/dev/components/Tabs/index.vue +23 -10
  22. package/dev/components/UniEvent/UniEventItem.vue +4 -2
  23. package/dev/components/UniEvent/index.vue +7 -3
  24. package/dev/components/UploadList/UploadDetail.vue +3 -7
  25. package/dev/components/UploadList/UploadItem.vue +7 -1
  26. package/dev/components/UploadList/index.vue +15 -2
  27. package/dev/components/VirtualListPro/index.vue +72 -3
  28. package/dev/components/VuexList/index.vue +2 -2
  29. package/dev/components/WebSocket/WebSocketItem.vue +7 -2
  30. package/dev/components/WebSocket/WebSocketList.vue +3 -6
  31. package/dev/components/WebSocket/index.vue +15 -2
  32. package/dev/const.ts +10 -14
  33. package/dev/devEvent/index.ts +49 -18
  34. package/dev/devIntercept/index.ts +18 -0
  35. package/dev/devStore/index.ts +60 -13
  36. package/dev/devToolInfo/index.ts +26 -0
  37. package/dev/plugins/uniDevTool/uniDevTool.d.ts +9 -1
  38. package/dev/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  39. package/dev/plugins/uniDevTool/uniDevTool.js +36 -36
  40. package/dev/plugins/uniGlobalComponents/uniGlobalComponents.js +7 -7
  41. package/dev/type.ts +34 -0
  42. package/dev/utils/index.ts +5 -0
  43. package/dev/utils/language.ts +8 -3
  44. package/dev/utils/object.ts +10 -2
  45. package/package.json +1 -1
@@ -20,7 +20,7 @@ import { Plugin } from 'vite';
20
20
  * }
21
21
  * @return {*} {Plugin}
22
22
  */
23
- export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
23
+ export default function uniDevTool({ pages, sourceFileServers, importConsole, ...reset }: {
24
24
  /** 是否拦截Promise.reject 最好不要拦截 默认禁用 */
25
25
  enableInterceptPromiseReject?: boolean;
26
26
  /** 打开窗口时隐藏按钮 */
@@ -35,6 +35,10 @@ export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
35
35
  wsDataMaxSize?: number;
36
36
  /** 最大占用缓存空间 bytes */
37
37
  cacheMaxSize?: number;
38
+ /** 最大时间列表条数 */
39
+ eventListMaxSize?: number;
40
+ /** 最大截屏记录条数 */
41
+ captureScreenMaxSize?: number;
38
42
  /** 按钮大小 */
39
43
  buttonSize?: number;
40
44
  /** 按钮文本 */
@@ -47,6 +51,8 @@ export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
47
51
  buttonBackgroundColor?: string;
48
52
  /** 初始化时是否显示调试按钮,默认显示 */
49
53
  initShowDevTool?: boolean;
54
+ /** 调试弹窗层级默认 1000 */
55
+ zIndex?: number;
50
56
  /**
51
57
  * 该属性处于实验当中,谨慎使用
52
58
  * 读取开发环境 source file,source map,默认 禁用
@@ -57,6 +63,8 @@ export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
57
63
  * 开发环境 source file 服务器地址,默认 [] ,配合 useDevSource 使用
58
64
  */
59
65
  sourceFileServers?: string[];
66
+ /** 是否导入 console 默认不导入, 只会捕获error 和 warn , */
67
+ importConsole?: boolean;
60
68
  /** 页面配置 用于读取路由 */
61
69
  pages: {
62
70
  pages: {
@@ -1 +1 @@
1
- {"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["../../../../plugins/src/plugins/uniDevTool/uniDevTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAqBnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE;IACD,qCAAqC;IACrC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gBAAgB;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB;IAClB,KAAK,EAAE;QACL,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1B,WAAW,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,EAAE,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;CACH,GAAG,MAAM,CAyNT"}
1
+ {"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["../../../../plugins/src/plugins/uniDevTool/uniDevTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAqBnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,iBAAiB,EACjB,aAAa,EACb,GAAG,KAAK,EACT,EAAE;IACD,qCAAqC;IACrC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gBAAgB;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB;IAClB,KAAK,EAAE;QACL,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1B,WAAW,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,EAAE,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;CACH,GAAG,MAAM,CAyNT"}
@@ -1,36 +1,36 @@
1
- "use strict";const C=require("path"),I=require("fs"),u=require("../utils/index.js");function _(a){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const l in a)if(l!=="default"){const e=Object.getOwnPropertyDescriptor(a,l);Object.defineProperty(v,l,e.get?e:{enumerable:!0,get:()=>a[l]})}}return v.default=a,Object.freeze(v)}const $=_(C),S=_(I),h=/<script[^>]*>([\s\S]*?)<\/script>/,g={isReady:!1,urls:[]};function D({pages:a,sourceFileServers:v,...l}){return{name:"vite-uni-dev-tool",enforce:"pre",configureServer(e){var p;e.middlewares.use((s,n,t)=>{const{originalUrl:r}=s;if(l.useDevSource&&(r!=null&&r.includes("__dev_sourcefile__"))){const i=r.replace("/__dev_sourcefile__","");try{const c=e.config.root,m=$.join(c,i),o=S.readFileSync(m,"utf-8");n.setHeader("Content-Type",u.getContentType(m)),n.end(o)}catch{t()}}else t()}),(p=e.httpServer)==null||p.once("listening",()=>{var t;const s=(t=e.httpServer)==null?void 0:t.address(),n=u.getLocalIPs();if(s&&!Array.isArray(s)&&typeof s!="string"){const r=n.map(i=>`http://${i}:${s.port}/__dev_sourcefile__`);g.isReady=!0,g.urls=r,console.warn(`
2
- ⚡️ vite-uni-dev-tool source file server running at:
3
- ${n.map(i=>`➜ Source File Network: http://${i}:${s==null?void 0:s.port}/__dev_sourcefile__`).join(`
4
- `)}
5
- `)}})},transform(e,p){var s;if(p.endsWith("/src/main.ts"))try{const n=e.split(`
6
- `);let t=[...n];const r=u.findInsertionIndex(t,c=>c.trim().startsWith("import")||c.trim().startsWith("export"));r!==-1&&t.splice(r,0,"import DevTool from 'vite-uni-dev-tool/dev/components/DevTool/index.vue';");const i=u.findInsertionIndex(t,c=>c.includes(".mount(")||c.includes("createApp("));if(i!==-1&&t.splice(i+1,0," app.component('DevTool', DevTool);"),t.length!==n.length)return{code:t.join(`
7
- `),map:null}}catch(n){return console.error("[DevTool] 转换 main 文件时出错:",n),{code:e,map:null}}if(p.endsWith("/src/App.vue")){const n=e.match(h);if(n&&n[1]){const t=n[1].trim(),r=u.hasImportCurrentInstance(t),i=u.hasImportOnLaunch(t),c=r?"":"import { getCurrentInstance } from 'vue'",m=i?"":"import { onLaunch } from '@dcloudio/uni-app'",o=`
8
- import { initDevTool, console } from 'vite-uni-dev-tool/dev/core';
9
- import pagesJson from './pages.json';
10
- ${t}
11
- onLaunch(() => {
12
- const vue3instance = getCurrentInstance();
13
- initDevTool({
14
- pagesJson,
15
- vue3instance,
16
- mode: import.meta.env.MODE,
17
- sourceFileServers: [
18
- ${[...g.urls??[],...v??[]].map(d=>`'${d}'`)}
19
- ],
20
- useDevSource: ${l.useDevSource},
21
- ...${JSON.stringify(l)},
22
- });
23
- });`;return{code:e.replace(h,`
24
- <script lang="ts" setup>
25
- ${c}
26
- ${m}
27
- ${o}
28
- <\/script>`),map:null}}return{code:e,map:null}}if(p.endsWith(".vue")){const n=e.includes("<template>"),t=a.pages.some(o=>p.includes(o.path)),r=(s=a.subPackages)==null?void 0:s.some(o=>o.pages.some(f=>p.includes(`${o.root}/${f.path}`))),i=["<DevTool />"],c=u.hasImportConsole(e),m=u.hasUseConsole(e);if(!c&&m&&!p.endsWith("/src/App.vue")){const o=e.match(h);if(o&&o[1]){const d=`
29
- import { console } from 'vite-uni-dev-tool/dev/core';
30
- ${o[1]}
31
- `;e=e.replace(h,`
32
- <script lang="ts" setup>
33
- ${d}
34
- <\/script>`)}}if((t||r)&&n){const o=u.getTemplateContent(e);let f=e;if(o){const d=`<view>${o}
35
- ${i.join(`
36
- `)}</view>`;f=e.replace(o,d)}return{code:f,map:null}}}return{code:e,map:null}}}}module.exports=D;
1
+ "use strict";const I=require("path"),C=require("fs"),u=require("../utils/index.js");function $(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const l in a)if(l!=="default"){const f=Object.getOwnPropertyDescriptor(a,l);Object.defineProperty(d,l,f.get?f:{enumerable:!0,get:()=>a[l]})}}return d.default=a,Object.freeze(d)}const S=$(I),D=$(C),g=/<script[^>]*>([\s\S]*?)<\/script>/,_={isReady:!1,urls:[]};function y({pages:a,sourceFileServers:d,importConsole:l,...f}){return{name:"vite-uni-dev-tool",enforce:"pre",configureServer(e){var p;e.middlewares.use((s,n,t)=>{const{originalUrl:r}=s;if(f.useDevSource&&(r!=null&&r.includes("__dev_sourcefile__"))){const i=r.replace("/__dev_sourcefile__","");try{const c=e.config.root,v=S.join(c,i),o=D.readFileSync(v,"utf-8");n.setHeader("Content-Type",u.getContentType(v)),n.end(o)}catch{t()}}else t()}),(p=e.httpServer)==null||p.once("listening",()=>{var t;const s=(t=e.httpServer)==null?void 0:t.address(),n=u.getLocalIPs();if(s&&!Array.isArray(s)&&typeof s!="string"){const r=n.map(i=>`http://${i}:${s.port}/__dev_sourcefile__`);_.isReady=!0,_.urls=r,console.warn(`
2
+ ⚡️ vite-uni-dev-tool source file server running at:
3
+ ${n.map(i=>`➜ Source File Network: http://${i}:${s==null?void 0:s.port}/__dev_sourcefile__`).join(`
4
+ `)}
5
+ `)}})},transform(e,p){var s;if(p.endsWith("/src/main.ts"))try{const n=e.split(`
6
+ `);let t=[...n];const r=u.findInsertionIndex(t,c=>c.trim().startsWith("import")||c.trim().startsWith("export"));r!==-1&&t.splice(r,0,"import DevTool from 'vite-uni-dev-tool/dev/components/DevTool/index.vue';");const i=u.findInsertionIndex(t,c=>c.includes(".mount(")||c.includes("createApp("));if(i!==-1&&t.splice(i+1,0," app.component('DevTool', DevTool);"),t.length!==n.length)return{code:t.join(`
7
+ `),map:null}}catch(n){return console.error("[DevTool] 转换 main 文件时出错:",n),{code:e,map:null}}if(p.endsWith("/src/App.vue")){const n=e.match(g);if(n&&n[1]){const t=n[1].trim(),r=u.hasImportCurrentInstance(t),i=u.hasImportOnLaunch(t),c=r?"":"import { getCurrentInstance } from 'vue'",v=i?"":"import { onLaunch } from '@dcloudio/uni-app'",o=`
8
+ import { initDevTool${l?", console":""} } from 'vite-uni-dev-tool/dev/core';
9
+ import pagesJson from './pages.json';
10
+ ${t}
11
+ onLaunch(() => {
12
+ const vue3instance = getCurrentInstance();
13
+ initDevTool({
14
+ pagesJson,
15
+ vue3instance,
16
+ mode: import.meta.env.MODE,
17
+ sourceFileServers: [
18
+ ${[..._.urls??[],...d??[]].map(h=>`'${h}'`)}
19
+ ],
20
+ useDevSource: ${f.useDevSource},
21
+ ...${JSON.stringify(f)},
22
+ });
23
+ });`;return{code:e.replace(g,`
24
+ <script lang="ts" setup>
25
+ ${c}
26
+ ${v}
27
+ ${o}
28
+ <\/script>`),map:null}}return{code:e,map:null}}if(p.endsWith(".vue")){const n=e.includes("<template>"),t=a.pages.some(o=>p.includes(o.path)),r=(s=a.subPackages)==null?void 0:s.some(o=>o.pages.some(m=>p.includes(`${o.root}/${m.path}`))),i=["<DevTool />"],c=u.hasImportConsole(e),v=u.hasUseConsole(e);if(!c&&v&&!p.endsWith("/src/App.vue")){const o=e.match(g);if(o&&o[1]){const m=o[1],h=`
29
+ ${l?"import { console } from 'vite-uni-dev-tool/dev/core';":""}
30
+ ${m}
31
+ `;e=e.replace(g,`
32
+ <script lang="ts" setup>
33
+ ${h}
34
+ <\/script>`)}}if((t||r)&&n){const o=u.getTemplateContent(e);let m=e;if(o){const h=`<view>${o}
35
+ ${i.join(`
36
+ `)}</view>`;m=e.replace(o,h)}return{code:m,map:null}}}return{code:e,map:null}}}}module.exports=y;
@@ -1,7 +1,7 @@
1
- "use strict";const d=require("path"),m=require("fs"),p=require("../utils/index.js");function f(s){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(u,e,r.get?r:{enumerable:!0,get:()=>s[e]})}}return u.default=s,Object.freeze(u)}const g=f(d),h=f(m);function v({pages:s,components:u}){return{name:"uni-global-components",enforce:"pre",configureServer(e){var r;e.middlewares.use((t,c,i)=>{const{originalUrl:n}=t;if(n!=null&&n.includes("__dev_sourcefile__")){const o=n.replace("/__dev_sourcefile__","");try{const a=e.config.root,l=g.join(a,o),_=h.readFileSync(l,"utf-8");c.setHeader("Content-Type",p.getContentType(l)),c.end(_)}catch{i()}}else i()}),(r=e.httpServer)==null||r.once("listening",()=>{var i;const t=(i=e.httpServer)==null?void 0:i.address(),c=p.getLocalIPs();t&&!Array.isArray(t)&&typeof t!="string"&&(c.map(n=>`http://${n}:${t.port}/__dev_sourcefile__`),console.warn(`
2
- ⚡️ vite-uni-dev-tool source file server running at:
3
- ${c.map(n=>`➜ Source File Network: http://${n}:${t==null?void 0:t.port}/__dev_sourcefile__`).join(`
4
- `)}
5
- `))})},transform(e,r){var t;if(r.endsWith(".vue")){const c=e.includes("<template>"),i=s.pages.some(o=>r.includes(o.path)),n=(t=s.subPackages)==null?void 0:t.some(o=>o.pages.some(a=>r.includes(`${o.root}/${a.path}`)));if((i||n)&&c){const o=p.getTemplateContent(e);if(o){const a=`<view>${o}
6
- ${u.join(`
7
- `)}</view>`;return{code:e.replace(o,a),map:null}}}}return{code:e,map:null}}}}module.exports=v;
1
+ "use strict";const d=require("path"),m=require("fs"),p=require("../utils/index.js");function f(s){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(u,e,r.get?r:{enumerable:!0,get:()=>s[e]})}}return u.default=s,Object.freeze(u)}const g=f(d),h=f(m);function v({pages:s,components:u}){return{name:"uni-global-components",enforce:"pre",configureServer(e){var r;e.middlewares.use((t,c,i)=>{const{originalUrl:n}=t;if(n!=null&&n.includes("__dev_sourcefile__")){const o=n.replace("/__dev_sourcefile__","");try{const a=e.config.root,l=g.join(a,o),_=h.readFileSync(l,"utf-8");c.setHeader("Content-Type",p.getContentType(l)),c.end(_)}catch{i()}}else i()}),(r=e.httpServer)==null||r.once("listening",()=>{var i;const t=(i=e.httpServer)==null?void 0:i.address(),c=p.getLocalIPs();t&&!Array.isArray(t)&&typeof t!="string"&&(c.map(n=>`http://${n}:${t.port}/__dev_sourcefile__`),console.warn(`
2
+ ⚡️ vite-uni-dev-tool source file server running at:
3
+ ${c.map(n=>`➜ Source File Network: http://${n}:${t==null?void 0:t.port}/__dev_sourcefile__`).join(`
4
+ `)}
5
+ `))})},transform(e,r){var t;if(r.endsWith(".vue")){const c=e.includes("<template>"),i=s.pages.some(o=>r.includes(o.path)),n=(t=s.subPackages)==null?void 0:t.some(o=>o.pages.some(a=>r.includes(`${o.root}/${a.path}`)));if((i||n)&&c){const o=p.getTemplateContent(e);if(o){const a=`<view>${o}
6
+ ${u.join(`
7
+ `)}</view>`;return{code:e.replace(o,a),map:null}}}}return{code:e,map:null}}}}module.exports=v;
package/dev/type.ts CHANGED
@@ -60,6 +60,8 @@ export declare namespace DevTool {
60
60
  wsDataMaxSize?: number;
61
61
  /** 最大的时间列表条数 */
62
62
  eventListMaxSize?: number;
63
+ /** 最大截屏记录条数 */
64
+ captureScreenMaxSize?: number;
63
65
  /** 最大占用缓存空间 */
64
66
  cacheMaxSize?: number;
65
67
  /** 所有路由信息 */
@@ -75,6 +77,8 @@ export declare namespace DevTool {
75
77
  * 读取开发环境 source file,source map,默认 禁用
76
78
  */
77
79
  useDevSource?: boolean;
80
+ /** 层级默认 1000 */
81
+ zIndex?: number;
78
82
  } & ButtonOptions;
79
83
 
80
84
  type ButtonOptions = Partial<{
@@ -230,6 +234,11 @@ export declare namespace DevTool {
230
234
  mode?: 'input' | 'output';
231
235
  };
232
236
 
237
+ type CaptureScreenItem = {
238
+ position: string;
239
+ timer: string;
240
+ };
241
+
233
242
  type WindowData = {
234
243
  devToolVisible?: boolean;
235
244
  consoleList?: ConsoleItem[];
@@ -242,16 +251,41 @@ export declare namespace DevTool {
242
251
  deviceInfo?: Record<string, any>;
243
252
  windowInfo?: Record<string, any>;
244
253
  netWorkStatus?: Record<string, any>;
254
+ appInfo?: Record<string, any>;
245
255
  wsList?: WS[];
246
256
  size?: number;
247
257
  sizeFormat?: string;
248
258
  uploadList?: UploadItem[];
249
259
  eventCount?: EventCount;
250
260
  eventList?: EventItem[];
261
+ captureScreenList?: CaptureScreenItem[];
251
262
  };
252
263
 
253
264
  type DevInterceptOptions = {
254
265
  event: DevEvent;
255
266
  enableInterceptPromiseReject?: boolean;
256
267
  };
268
+
269
+ type DevToolInfo = {
270
+ /** 是否销毁 */
271
+ devToolDestroy?: boolean;
272
+ /** 按钮状态 */
273
+ devToolButtonVisible?: boolean;
274
+ /** 窗口状态 */
275
+ devToolWindowVisible?: boolean;
276
+ /** 按钮位置 */
277
+ top?: string;
278
+ /** 按钮位置 */
279
+ left?: string;
280
+ /** 当前活动tab */
281
+ activeTab?: number;
282
+ /** 当前console类型 */
283
+ currentConsoleType?: string;
284
+ /** 当前network类型 */
285
+ currentNetworkType?: string;
286
+ /** 当前websocket类型 */
287
+ currentWebSocketType?: string;
288
+ /** table滚动位置 */
289
+ tabScrollLeft?: number;
290
+ };
257
291
  }
@@ -4,6 +4,11 @@ export {
4
4
  isNumber,
5
5
  isObject,
6
6
  isArray,
7
+ isFunction,
8
+ isString,
9
+ isNull,
10
+ isSymbol,
11
+ isUndefined,
7
12
  getValueType,
8
13
  transformValueToView,
9
14
  } from './language';
@@ -35,6 +35,10 @@ export function isSymbol(value: any): value is symbol {
35
35
  return typeof value === 'symbol';
36
36
  }
37
37
 
38
+ export function isFunction(value: any): value is Function {
39
+ return typeof value === 'function';
40
+ }
41
+
38
42
  /**
39
43
  *
40
44
  *
@@ -61,12 +65,13 @@ export function getValueType(value: any): DevTool.ValueType {
61
65
  * @return {*} {DevTool.ValueType}
62
66
  */
63
67
  export function transformValueToView(value: any): DevTool.ValueType {
64
- if (isNull(value)) return 'string';
65
- if (isUndefined(value)) return 'string';
68
+ if (isNull(value)) return 'null';
69
+ if (isUndefined(value)) return 'undefined';
66
70
  if (isString(value)) return 'string';
67
71
  if (isNumber(value)) return 'number';
72
+ if (isBoolean(value)) return 'boolean';
73
+ if (isSymbol(value)) return 'symbol';
68
74
  if (isArray(value)) return 'array';
69
75
  if (isObject(value)) return 'object';
70
- if (isSymbol(value)) return 'symbol';
71
76
  return 'string';
72
77
  }
@@ -1,4 +1,4 @@
1
- import { isNil, isObject, isString } from './language';
1
+ import { isBoolean, isNil, isObject, isString, isFunction } from './language';
2
2
 
3
3
  /**
4
4
  * 自定义set函数 - 安全地设置嵌套对象属性
@@ -252,7 +252,15 @@ export function parseValue(value: any, deep: number = 6) {
252
252
 
253
253
  function process(value: any, currentDeep: number, path: string[] = []): any {
254
254
  if (isString(value)) {
255
- return `"${value}"`;
255
+ return `${value}`;
256
+ }
257
+
258
+ if (isBoolean(value)) {
259
+ return `${value}`;
260
+ }
261
+
262
+ if (isFunction(value)) {
263
+ return `f(...) { ... }`;
256
264
  }
257
265
 
258
266
  if (isNil(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-uni-dev-tool",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试",
5
5
  "keywords": [
6
6
  "vite",