vite-uni-dev-tool 0.0.48 → 1.0.0
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/README.md +20 -0
- package/dist/const.cjs +1 -0
- package/dist/const.d.ts +78 -161
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +1 -47
- package/dist/core-shared.d.ts +44 -0
- package/dist/core-shared.d.ts.map +1 -0
- package/dist/core-shared.js +1 -0
- package/dist/core.d.ts +2 -40
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +4 -159
- package/dist/i18n/index.cjs +1 -0
- package/dist/i18n/index.d.ts +9 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/instance.cjs +1 -0
- package/dist/i18n/instance.d.ts +15 -0
- package/dist/i18n/instance.d.ts.map +1 -0
- package/dist/i18n/instance.js +1 -0
- package/dist/i18n/locales/en.cjs +1 -0
- package/dist/i18n/locales/en.d.ts +470 -0
- package/dist/i18n/locales/en.d.ts.map +1 -0
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/zh-Hans.cjs +1 -0
- package/dist/i18n/locales/zh-Hans.d.ts +476 -0
- package/dist/i18n/locales/zh-Hans.d.ts.map +1 -0
- package/dist/i18n/locales/zh-Hans.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/devConsole/index.cjs +4 -0
- package/dist/{devConsole → modules/devConsole}/index.d.ts +1 -1
- package/dist/modules/devConsole/index.d.ts.map +1 -0
- package/dist/modules/devConsole/index.js +4 -0
- package/dist/modules/devEvent/index.cjs +5 -0
- package/dist/modules/devEvent/index.d.ts +115 -0
- package/dist/modules/devEvent/index.d.ts.map +1 -0
- package/dist/modules/devEvent/index.js +5 -0
- package/dist/modules/devIntercept/index.cjs +13 -0
- package/dist/modules/devIntercept/index.d.ts +71 -0
- package/dist/modules/devIntercept/index.d.ts.map +1 -0
- package/dist/modules/devIntercept/index.js +13 -0
- package/dist/modules/devStore/index.cjs +1 -0
- package/dist/modules/devStore/index.d.ts +159 -0
- package/dist/modules/devStore/index.d.ts.map +1 -0
- package/dist/modules/devStore/index.js +1 -0
- package/dist/modules/devToolInfo/index.cjs +1 -0
- package/dist/modules/devToolInfo/index.d.ts +27 -0
- package/dist/modules/devToolInfo/index.d.ts.map +1 -0
- package/dist/modules/devToolInfo/index.js +1 -0
- package/dist/plugins/uniDevTool/transform/transformApp.cjs +44 -0
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformApp.js +17 -17
- package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
- package/dist/plugins/uniDevTool/transform/transformVue.cjs +41 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +1 -2
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformVue.js +32 -19
- package/dist/plugins/uniDevTool/uniDevTool.cjs +5 -0
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -11
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.cjs +19 -0
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +1 -1
- package/dist/plugins/uniGlobalComponents/uniGlobalComponents.js +11 -19
- package/dist/plugins/uniParseStock/index.d.ts +10 -0
- package/dist/plugins/uniParseStock/index.d.ts.map +1 -0
- package/dist/plugins/utils/index.cjs +2 -0
- package/dist/plugins/utils/index.d.ts +1 -3
- package/dist/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +2 -2
- package/dist/shims-uni.d.ts +140 -0
- package/dist/type.d.ts +174 -16
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/array.cjs +1 -0
- package/dist/utils/array.d.ts.map +1 -1
- package/dist/utils/array.js +1 -12
- package/dist/utils/date.cjs +1 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +1 -59
- package/dist/utils/file.cjs +1 -0
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +1 -85
- package/dist/utils/function.cjs +1 -0
- package/dist/utils/function.d.ts +13 -0
- package/dist/utils/function.d.ts.map +1 -1
- package/dist/utils/function.js +1 -68
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -63
- package/dist/utils/ip.cjs +1 -0
- package/dist/utils/ip.d.ts +1 -1
- package/dist/utils/ip.d.ts.map +1 -1
- package/dist/utils/ip.js +1 -45
- package/dist/utils/language.cjs +1 -0
- package/dist/utils/language.d.ts +2 -1
- package/dist/utils/language.d.ts.map +1 -1
- package/dist/utils/language.js +1 -63
- package/dist/utils/object.cjs +1 -0
- package/dist/utils/object.d.ts +4 -5
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +1 -136
- package/dist/utils/openLink.cjs +1 -0
- package/dist/utils/openLink.d.ts.map +1 -1
- package/dist/utils/openLink.js +1 -28
- package/dist/utils/page.cjs +1 -0
- package/dist/utils/page.d.ts.map +1 -1
- package/dist/utils/page.js +1 -7
- package/dist/utils/platform.cjs +1 -0
- package/dist/utils/platform.d.ts.map +1 -1
- package/dist/utils/platform.js +1 -17
- package/dist/utils/string.cjs +1 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +1 -114
- package/dist/utils/utils.cjs +1 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +1 -126
- package/dist/v3/AppTransition/index.vue +170 -0
- package/dist/v3/AutoSizer/index.vue +4 -5
- package/dist/v3/AutoSizer/index1.vue +4 -6
- package/dist/v3/AutoSizer/utils.ts +1 -1
- package/dist/v3/CaptureScreen/index.vue +19 -8
- package/dist/v3/CircularButton/index.vue +64 -13
- package/dist/v3/ConsoleList/ConsoleItem.vue +56 -5
- package/dist/v3/ConsoleList/RunJSInput.vue +10 -6
- package/dist/v3/ConsoleList/index.vue +51 -35
- package/dist/v3/CustomSwiper/CustomSwiperItem.vue +49 -0
- package/dist/v3/CustomSwiper/index.vue +104 -0
- package/dist/v3/DevTool/fps-collector.render.ts +148 -0
- package/dist/v3/DevTool/index.vue +209 -102
- package/dist/v3/DevToolButton/index.vue +40 -59
- package/dist/v3/DevToolTitle/index.vue +4 -1
- package/dist/v3/DevToolWindow/DevToolOverlay.vue +182 -0
- package/dist/v3/DevToolWindow/const.ts +47 -69
- package/dist/v3/DevToolWindow/hooks/dataUtils.ts +48 -0
- package/dist/v3/DevToolWindow/hooks/useDevToolData.ts +338 -0
- package/dist/v3/DevToolWindow/hooks/useDevToolHandlers.ts +549 -0
- package/dist/v3/DevToolWindow/hooks/useDevToolOverlay.ts +184 -0
- package/dist/v3/DevToolWindow/index.css +89 -0
- package/dist/v3/DevToolWindow/index.vue +800 -1450
- package/dist/v3/DraggableContainer/index.vue +456 -0
- package/dist/v3/ElEvent/ElEventItem.vue +4 -3
- package/dist/v3/ElEvent/index.vue +26 -9
- package/dist/v3/Empty/index.vue +1 -0
- package/dist/v3/FilterInput/index.vue +8 -22
- package/dist/v3/FilterSelect/index.vue +37 -24
- package/dist/v3/Instance/components/InstanceTreeNode.vue +265 -0
- package/dist/v3/Instance/flatten.ts +226 -0
- package/dist/v3/Instance/index.vue +94 -0
- package/dist/v3/Instance/registry.ts +49 -0
- package/dist/v3/Instance/transformTree.ts +375 -0
- package/dist/v3/Instance/transformTreeCtx.ts +268 -0
- package/dist/v3/{InstanceTree → Instance}/typing.d.ts +15 -2
- package/dist/v3/InstanceDetail/index.vue +433 -44
- package/dist/v3/JsonDetail/index.vue +12 -8
- package/dist/v3/JsonPretty/components/Brackets/index.vue +1 -0
- package/dist/v3/JsonPretty/components/Carets/index.vue +2 -1
- package/dist/v3/JsonPretty/components/CheckController/index.vue +26 -15
- package/dist/v3/JsonPretty/components/TreeNode/index.vue +42 -20
- package/dist/v3/JsonPretty/index.vue +60 -37
- package/dist/v3/JsonPretty/utils/index.ts +41 -44
- package/dist/v3/MovableContainer/index.vue +89 -0
- package/dist/v3/NFCList/NFCItem.vue +14 -14
- package/dist/v3/NFCList/NFCTool.vue +99 -81
- package/dist/v3/NFCList/index.vue +14 -10
- package/dist/v3/NetworkList/InterceptConfig.vue +154 -364
- package/dist/v3/NetworkList/InterceptItem.vue +14 -6
- package/dist/v3/NetworkList/NetworkDetail.vue +34 -29
- package/dist/v3/NetworkList/NetworkIntercept.vue +11 -8
- package/dist/v3/NetworkList/NetworkItem.vue +27 -11
- package/dist/v3/NetworkList/NetworkSend.vue +132 -290
- package/dist/v3/NetworkList/hooks/useNetworkForm.ts +86 -0
- package/dist/v3/NetworkList/index.vue +32 -24
- package/dist/v3/NetworkList/utils.ts +101 -0
- package/dist/v3/Performance/index.vue +495 -0
- package/dist/v3/Performance/modules/PerformanceMetrics.vue +153 -0
- package/dist/v3/Performance/modules/PerformanceWidget.vue +249 -0
- package/dist/v3/Performance/modules/usePerformanceChart.ts +460 -0
- package/dist/v3/Performance/modules/usePerformanceData.ts +258 -0
- package/dist/v3/Pick/index.vue +322 -0
- package/dist/v3/PiniaList/index.vue +38 -17
- package/dist/v3/RouteList/index.vue +32 -15
- package/dist/v3/RunJS/index.vue +30 -10
- package/dist/v3/ScanCodeList/ScanCodeItem.vue +2 -9
- package/dist/v3/ScanCodeList/index.vue +12 -9
- package/dist/v3/SettingButton/index.vue +45 -0
- package/dist/v3/SettingList/index.css +120 -0
- package/dist/v3/SettingList/index.vue +96 -537
- package/dist/v3/SettingList/modules/SettingDevTool.vue +208 -0
- package/dist/v3/SettingList/modules/SettingInfo.vue +119 -0
- package/dist/v3/SettingList/modules/SettingLanguage.vue +74 -0
- package/dist/v3/SettingList/modules/SettingLog.vue +230 -0
- package/dist/v3/SettingList/modules/SettingNetwork.vue +120 -0
- package/dist/v3/SettingList/modules/SettingTheme.vue +312 -0
- package/dist/v3/SourceCode/Line.vue +15 -2
- package/dist/v3/SourceCode/index.vue +25 -24
- package/dist/v3/SourceCode/parseCode.ts +114 -56
- package/dist/v3/StorageList/index.vue +33 -33
- package/dist/v3/Tabs/index.vue +31 -28
- package/dist/v3/Tag/index.vue +39 -20
- package/dist/v3/TransferList/TransferDetail.vue +268 -0
- package/dist/v3/TransferList/TransferItem.vue +125 -0
- package/dist/v3/TransferList/index.vue +181 -0
- package/dist/v3/UniEvent/UniEventItem.vue +1 -0
- package/dist/v3/UniEvent/index.vue +28 -29
- package/dist/v3/{VirtualListPro → VirtualList}/AutoSize.vue +1 -1
- package/dist/v3/VirtualList/index.vue +382 -82
- package/dist/v3/VuexList/index.vue +38 -17
- package/dist/v3/WebSocket/WebSocketDetail.vue +142 -80
- package/dist/v3/WebSocket/WebSocketItem.vue +10 -4
- package/dist/v3/WebSocket/index.vue +44 -30
- package/dist/v3/hooks/useNFC/index.ts +6 -6
- package/dist/v3/hooks/useNFC/typing.d.ts +2 -2
- package/dist/v3/hooks/useNFC/useNFCAndroid.ts +215 -626
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +54 -85
- package/dist/v3/hooks/useNFC/utils.ts +3 -3
- package/dist/v3/hooks/useRequest/index.ts +2 -2
- package/dist/v3/hooks/useScanCode/index.ts +10 -8
- package/dist/v3/styles/theme.css +290 -0
- package/dist/v3/styles/theme.ts +12 -0
- package/package.json +25 -5
- package/dist/devConsole/index.d.ts.map +0 -1
- package/dist/devConsole/index.js +0 -273
- package/dist/devEvent/index.d.ts +0 -328
- package/dist/devEvent/index.d.ts.map +0 -1
- package/dist/devEvent/index.js +0 -697
- package/dist/devEventBus/index.d.ts +0 -42
- package/dist/devEventBus/index.d.ts.map +0 -1
- package/dist/devEventBus/index.js +0 -70
- package/dist/devIntercept/index.d.ts +0 -281
- package/dist/devIntercept/index.d.ts.map +0 -1
- package/dist/devIntercept/index.js +0 -949
- package/dist/devRunJS/index.d.ts +0 -67
- package/dist/devRunJS/index.d.ts.map +0 -1
- package/dist/devStore/index.d.ts +0 -199
- package/dist/devStore/index.d.ts.map +0 -1
- package/dist/devStore/index.js +0 -562
- package/dist/devToolInfo/index.d.ts +0 -17
- package/dist/devToolInfo/index.d.ts.map +0 -1
- package/dist/devToolInfo/index.js +0 -15
- package/dist/v3/AutoSizer/utils.d.ts +0 -5
- package/dist/v3/AutoSizer/utils.d.ts.map +0 -1
- package/dist/v3/ConsoleList/staticTips.d.ts +0 -13
- package/dist/v3/ConsoleList/staticTips.d.ts.map +0 -1
- package/dist/v3/DevToolWindow/const.d.ts +0 -46
- package/dist/v3/DevToolWindow/const.d.ts.map +0 -1
- package/dist/v3/InstanceTree/components/InstanceTreeNode.vue +0 -81
- package/dist/v3/InstanceTree/flatten.d.ts +0 -10
- package/dist/v3/InstanceTree/flatten.d.ts.map +0 -1
- package/dist/v3/InstanceTree/flatten.ts +0 -75
- package/dist/v3/InstanceTree/index.vue +0 -51
- package/dist/v3/InstanceTree/transformTree.d.ts +0 -17
- package/dist/v3/InstanceTree/transformTree.d.ts.map +0 -1
- package/dist/v3/InstanceTree/transformTree.ts +0 -237
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +0 -4
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +0 -1
- package/dist/v3/JsonPretty/hooks/useError.d.ts +0 -8
- package/dist/v3/JsonPretty/hooks/useError.d.ts.map +0 -1
- package/dist/v3/JsonPretty/type.d.ts +0 -94
- package/dist/v3/JsonPretty/type.d.ts.map +0 -1
- package/dist/v3/JsonPretty/utils/index.d.ts +0 -10
- package/dist/v3/JsonPretty/utils/index.d.ts.map +0 -1
- package/dist/v3/NFCList/const.d.ts +0 -13
- package/dist/v3/NFCList/const.d.ts.map +0 -1
- package/dist/v3/NetworkList/const.d.ts +0 -5
- package/dist/v3/NetworkList/const.d.ts.map +0 -1
- package/dist/v3/SourceCode/parseCode.d.ts +0 -27
- package/dist/v3/SourceCode/parseCode.d.ts.map +0 -1
- package/dist/v3/UploadList/UploadDetail.vue +0 -255
- package/dist/v3/UploadList/UploadItem.vue +0 -122
- package/dist/v3/UploadList/index.vue +0 -125
- package/dist/v3/VirtualListPro/index.vue +0 -229
- package/dist/v3/hooks/useContainerStyle.d.ts +0 -15
- package/dist/v3/hooks/useContainerStyle.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/index.d.ts +0 -5
- package/dist/v3/hooks/useNFC/index.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts +0 -2
- package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts +0 -2
- package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts.map +0 -1
- package/dist/v3/hooks/useNFC/utils.d.ts +0 -95
- package/dist/v3/hooks/useNFC/utils.d.ts.map +0 -1
- package/dist/v3/hooks/useRequest/index.d.ts +0 -126
- package/dist/v3/hooks/useRequest/index.d.ts.map +0 -1
- package/dist/v3/hooks/useRequest/utils.d.ts +0 -35
- package/dist/v3/hooks/useRequest/utils.d.ts.map +0 -1
- package/dist/v3/hooks/useScanCode/index.d.ts +0 -36
- package/dist/v3/hooks/useScanCode/index.d.ts.map +0 -1
- /package/dist/v3/{VirtualListPro → VirtualList}/readme.md +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/devToolInfo/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,QAOvD;AAED;;GAEG;AACH,wBAAgB,cAAc,wBAG7B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,QAKhE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,0BAIpC;AACD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,QAKhE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,0BAIpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEV_TOOL_INFO as t}from"../../const.js";const o="dev-tool-network-list",i="dev-tool-console-list";function r(e){if(typeof uni>"u")return;const n=uni.getStorageSync(t)||{};uni.setStorageSync(t,{...n,...e})}function f(){return typeof uni>"u"?{}:uni.getStorageSync(t)}function c(e){if(typeof uni>"u")return;const n=e.slice(-200);uni.setStorageSync(o,n)}function s(){return typeof uni>"u"?[]:uni.getStorageSync(o)||[]}function S(e){if(typeof uni>"u")return;const n=e.slice(-200);uni.setStorageSync(i,n)}function d(){return typeof uni>"u"?[]:uni.getStorageSync(i)||[]}export{d as getDevToolConsoleList,f as getDevToolInfo,s as getDevToolNetworkList,S as setDevToolConsoleList,r as setDevToolInfo,c as setDevToolNetworkList};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../utils/index.cjs");function v(s){const{lines:n,importConsole:u,netWorkInfo:p,sourceFileServers:l,reset:a}=s,i=n.join(`
|
|
2
|
+
`),c=o.hasImportCurrentInstance(i),m=o.hasImportOnLaunch(i),d=o.hasImportOnExit(i);c||n.unshift("import { getCurrentInstance } from 'vue';");const t=[];m||t.push("onLaunch"),d||t.push("onExit"),t.length&&n.unshift(`import { ${t.join(", ")} } from '@dcloudio/uni-app';`),n.unshift(`import { initDevTool, uploadAbnormal${u?", console":""} } from 'vite-uni-dev-tool/dist/core';`,"import pagesJson from './pages.json';");const e=`
|
|
3
|
+
const vueInstance = getCurrentInstance();
|
|
4
|
+
initDevTool({
|
|
5
|
+
pagesJson,
|
|
6
|
+
vueInstance,
|
|
7
|
+
mode: import.meta.env.MODE,
|
|
8
|
+
sourceFileServers: [
|
|
9
|
+
${[...p.urls??[],...l??[]].map(I=>`'${I}'`).join(`,
|
|
10
|
+
`)}
|
|
11
|
+
],
|
|
12
|
+
...${JSON.stringify(a)},
|
|
13
|
+
});`,f=o.findInsertionIndex(n,I=>I.includes("onLaunch("));f!==-1?n.splice(f,0,e):n.push(`
|
|
14
|
+
onLaunch(() => {
|
|
15
|
+
${e}
|
|
16
|
+
});`);const h=o.findInsertionIndex(n,I=>I.includes("onExit("));return h!==-1?n.splice(h,0,`
|
|
17
|
+
uploadAbnormal({ immediately: true });
|
|
18
|
+
`):n.push(`
|
|
19
|
+
onExit(() => {
|
|
20
|
+
uploadAbnormal({ immediately: true });
|
|
21
|
+
});
|
|
22
|
+
`),n}function x(s){const{lines:n,netWorkInfo:u,sourceFileServers:p,importConsole:l,reset:a}=s,i=n.join(`
|
|
23
|
+
`);o.hasImportVue(i)||n.unshift("import Vue from 'vue';"),n.unshift(`import { initDevTool, uploadAbnormal${l?", console":""} } from 'vite-uni-dev-tool/dist/core';`,"import pagesJson from './pages.json';");const d=`
|
|
24
|
+
initDevTool({
|
|
25
|
+
pagesJson,
|
|
26
|
+
vueInstance: Vue,
|
|
27
|
+
mode: import.meta.env.MODE,
|
|
28
|
+
sourceFileServers: [
|
|
29
|
+
${[...u.urls??[],...p??[]].map(e=>`'${e}'`).join(`,
|
|
30
|
+
`)}
|
|
31
|
+
],
|
|
32
|
+
...${JSON.stringify(a)},
|
|
33
|
+
});`,t=o.findInsertionIndex(n,e=>e.includes("onLaunch(")||e.includes("onLaunch:"));if(t!==-1)n.splice(t+1,0,d);else{const e=o.findInsertionIndex(n,f=>f.includes("export default"));e!==-1&&n.splice(e+1,0,`
|
|
34
|
+
onLaunch: function() {
|
|
35
|
+
${d}
|
|
36
|
+
},`)}const r=o.findInsertionIndex(n,e=>e.includes("onExit(")||e.includes("onExit:"));return r!==-1?n.splice(r+1,0,`
|
|
37
|
+
uploadAbnormal({ immediately: true });
|
|
38
|
+
`):n.push(`
|
|
39
|
+
onExit: function() {
|
|
40
|
+
uploadAbnormal({ immediately: true });
|
|
41
|
+
},
|
|
42
|
+
`),n}const g=({code:s,isSetup:n,importConsole:u,scriptRow:p,netWorkInfo:l,sourceFileServers:a,reset:i})=>{const c=s.match(o.regScript);if(!c||!c[1])return{code:s,map:null};try{const t={lines:c[1].trim().split(`
|
|
43
|
+
`),isSetup:n,importConsole:u,netWorkInfo:l,sourceFileServers:a,reset:i},r=n?v(t):x(t);r.unshift(p),r.push("<\/script>");const e=r.join(`
|
|
44
|
+
`);return{code:s.replace(o.regScript,()=>e),map:null}}catch(m){return console.error("[DevTool] 转换 App.vue 文件时出错:",m),{code:s,map:null}}};exports.transformApp=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformApp.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"transformApp.d.ts","sourceRoot":"","sources":["../../../../src/plugins/uniDevTool/transform/transformApp.ts"],"names":[],"mappings":"AAUA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAClD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC;CACZ;AAwMD;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,YAAY,wFAQtB,mBAAmB;UAAW,MAAM;SAAO,GAAG;CA4ChD,CAAC"}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
`),
|
|
1
|
+
import{hasImportCurrentInstance as x,hasImportOnLaunch as L,hasImportOnExit as g,findInsertionIndex as h,hasImportVue as C,regScript as I}from"../../utils/index.js";function E(t){const{lines:n,importConsole:c,netWorkInfo:u,sourceFileServers:p,reset:l}=t,s=n.join(`
|
|
2
|
+
`),i=x(s),a=L(s),m=g(s);i||n.unshift("import { getCurrentInstance } from 'vue';");const o=[];a||o.push("onLaunch"),m||o.push("onExit"),o.length&&n.unshift(`import { ${o.join(", ")} } from '@dcloudio/uni-app';`),n.unshift(`import { initDevTool, uploadAbnormal${c?", console":""} } from 'vite-uni-dev-tool/dist/core';`,"import pagesJson from './pages.json';");const e=`
|
|
3
3
|
const vueInstance = getCurrentInstance();
|
|
4
4
|
initDevTool({
|
|
5
5
|
pagesJson,
|
|
6
6
|
vueInstance,
|
|
7
7
|
mode: import.meta.env.MODE,
|
|
8
8
|
sourceFileServers: [
|
|
9
|
-
${[...
|
|
9
|
+
${[...u.urls??[],...p??[]].map(d=>`'${d}'`).join(`,
|
|
10
10
|
`)}
|
|
11
11
|
],
|
|
12
|
-
...${JSON.stringify(
|
|
13
|
-
});`,f=
|
|
12
|
+
...${JSON.stringify(l)},
|
|
13
|
+
});`,f=h(n,d=>d.includes("onLaunch("));f!==-1?n.splice(f,0,e):n.push(`
|
|
14
14
|
onLaunch(() => {
|
|
15
15
|
${e}
|
|
16
|
-
});`);const h
|
|
16
|
+
});`);const v=h(n,d=>d.includes("onExit("));return v!==-1?n.splice(v,0,`
|
|
17
17
|
uploadAbnormal({ immediately: true });
|
|
18
18
|
`):n.push(`
|
|
19
19
|
onExit(() => {
|
|
20
20
|
uploadAbnormal({ immediately: true });
|
|
21
21
|
});
|
|
22
|
-
`),n}function
|
|
23
|
-
`);
|
|
22
|
+
`),n}function S(t){const{lines:n,netWorkInfo:c,sourceFileServers:u,importConsole:p,reset:l}=t,s=n.join(`
|
|
23
|
+
`);C(s)||n.unshift("import Vue from 'vue';"),n.unshift(`import { initDevTool, uploadAbnormal${p?", console":""} } from 'vite-uni-dev-tool/dist/core';`,"import pagesJson from './pages.json';");const m=`
|
|
24
24
|
initDevTool({
|
|
25
25
|
pagesJson,
|
|
26
26
|
vueInstance: Vue,
|
|
27
27
|
mode: import.meta.env.MODE,
|
|
28
28
|
sourceFileServers: [
|
|
29
|
-
${[...
|
|
29
|
+
${[...c.urls??[],...u??[]].map(e=>`'${e}'`).join(`,
|
|
30
30
|
`)}
|
|
31
31
|
],
|
|
32
|
-
...${JSON.stringify(
|
|
33
|
-
});`,
|
|
32
|
+
...${JSON.stringify(l)},
|
|
33
|
+
});`,o=h(n,e=>e.includes("onLaunch(")||e.includes("onLaunch:"));if(o!==-1)n.splice(o+1,0,m);else{const e=h(n,f=>f.includes("export default"));e!==-1&&n.splice(e+1,0,`
|
|
34
34
|
onLaunch: function() {
|
|
35
|
-
${
|
|
36
|
-
},`)}const r=
|
|
35
|
+
${m}
|
|
36
|
+
},`)}const r=h(n,e=>e.includes("onExit(")||e.includes("onExit:"));return r!==-1?n.splice(r+1,0,`
|
|
37
37
|
uploadAbnormal({ immediately: true });
|
|
38
38
|
`):n.push(`
|
|
39
39
|
onExit: function() {
|
|
40
40
|
uploadAbnormal({ immediately: true });
|
|
41
|
-
}
|
|
42
|
-
`),n}const
|
|
43
|
-
`),isSetup:n,importConsole:
|
|
44
|
-
`);return{code:
|
|
41
|
+
},
|
|
42
|
+
`),n}const j=({code:t,isSetup:n,importConsole:c,scriptRow:u,netWorkInfo:p,sourceFileServers:l,reset:s})=>{const i=t.match(I);if(!i||!i[1])return{code:t,map:null};try{const o={lines:i[1].trim().split(`
|
|
43
|
+
`),isSetup:n,importConsole:c,netWorkInfo:p,sourceFileServers:l,reset:s},r=n?E(o):S(o);r.unshift(u),r.push("<\/script>");const e=r.join(`
|
|
44
|
+
`);return{code:t.replace(I,()=>e),map:null}}catch(a){return console.error("[DevTool] 转换 App.vue 文件时出错:",a),{code:t,map:null}}};export{j as transformApp};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../utils/index.cjs");function c(i){const{lines:e}=i,n=[...e],t=s.findInsertionIndex(n,o=>o.trim().startsWith("import")||o.trim().startsWith("export"));t!==-1&&n.splice(t,0,"import DevTool from 'vite-uni-dev-tool/dist/v3/DevTool/index.vue';","import { recordInstance } from 'vite-uni-dev-tool/dist/v3/Instance/registry';");const r=s.findInsertionIndex(n,o=>o.includes("const app = createSSRApp(App)"));return r!==-1&&n.splice(r+1,0," app.mixin({ "," mounted() { recordInstance(this.$); },"," updated() { recordInstance(this.$); }"," });"," app.component('DevTool', DevTool);"),n}const p=({code:i})=>{try{const e=i.split(`
|
|
2
|
+
`),t=c({lines:e});return t.length===e.length&&t.every((r,o)=>r===e[o])?{code:i,map:null}:{code:t.join(`
|
|
3
|
+
`),map:null}}catch(e){return console.error("[DevTool] 转换 main 文件时出错:",e),{code:i,map:null}}};exports.transformMain=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformMain.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"transformMain.d.ts","sourceRoot":"","sources":["../../../../src/plugins/uniDevTool/transform/transformMain.ts"],"names":[],"mappings":"AAEA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAqFD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,cAEvB,oBAAoB;UACf,MAAM;SACP,GAAG;CA6BT,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`),
|
|
3
|
-
`),map:null}}catch(
|
|
1
|
+
import{findInsertionIndex as s}from"../../utils/index.js";function c(i){const{lines:t}=i,e=[...t],o=s(e,n=>n.trim().startsWith("import")||n.trim().startsWith("export"));o!==-1&&e.splice(o,0,"import DevTool from 'vite-uni-dev-tool/dist/v3/DevTool/index.vue';","import { recordInstance } from 'vite-uni-dev-tool/dist/v3/Instance/registry';");const r=s(e,n=>n.includes("const app = createSSRApp(App)"));return r!==-1&&e.splice(r+1,0," app.mixin({ "," mounted() { recordInstance(this.$); },"," updated() { recordInstance(this.$); }"," });"," app.component('DevTool', DevTool);"),e}const l=({code:i})=>{try{const t=i.split(`
|
|
2
|
+
`),o=c({lines:t});return o.length===t.length&&o.every((r,n)=>r===t[n])?{code:i,map:null}:{code:o.join(`
|
|
3
|
+
`),map:null}}catch(t){return console.error("[DevTool] 转换 main 文件时出错:",t),{code:i,map:null}}};export{l as transformMain};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../utils/index.cjs");function v(e,t){var c;const r=t.pages.some(o=>e.includes(o.path)),n=((c=t.subPackages)==null?void 0:c.some(o=>o.pages.some(u=>e.includes(`${o.root}/${u.path}`))))??!1;return{isPage:r,isSubPage:n}}function m(e,t,r,n){return{shouldInjectConsole:!!n,hasExistingConsoleImport:i.hasImportConsole(e),usesConsole:i.hasUseConsole(e),isExcludedFromConsole:!i.hasDirOrFile(t,r)}}function d(e,t,r,n){const{isPage:c,isSubPage:o}=v(e,r);return{isPageOrSubPage:c||o,hasTemplate:t.includes("<template>"),isExcludedFromDevTool:!i.hasDirOrFile(e,n)}}function h(e,t,r){const n=e.match(i.regScript);if(!n||!n[1])return e;const c=n[1];let o="";r&&(o="import { console } from 'vite-uni-dev-tool/dist/core';");const u=`
|
|
2
|
+
${o}
|
|
3
|
+
${c}
|
|
4
|
+
`.trim();return e.replace(i.regScript,()=>`${t}
|
|
5
|
+
${u}
|
|
6
|
+
<\/script>`)}function C(e,t){const r=e.match(i.regScript);if(!r||!r[1])return e;const n=r[1];if(n.includes("devCaptureTapEvent"))return e;const o=t.includes('lang="ts"')||t.includes('lang="typescript"')?": any":"",u=`
|
|
7
|
+
function devCaptureTapEvent(e${o}) {
|
|
8
|
+
uni?.$emit('dev-capture-tap-event', e);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function devCaptureTouchStartEvent(e${o}) {
|
|
12
|
+
uni?.$emit('dev-capture-touch-start-event', e);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function devCaptureTouchMoveEvent(e${o}) {
|
|
16
|
+
uni?.$emit('dev-capture-touch-move-event', e);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function devCaptureTouchEndEvent(e${o}) {
|
|
20
|
+
uni?.$emit('dev-capture-touch-end-event', e);
|
|
21
|
+
}
|
|
22
|
+
`,s=`
|
|
23
|
+
${n}
|
|
24
|
+
${u}
|
|
25
|
+
`.trim();return e.replace(i.regScript,()=>`${t}
|
|
26
|
+
${s}
|
|
27
|
+
<\/script>`)}function f(e){const t=i.getTemplateContent(e);if(!t)return e;const{pageMetas:r,resetContent:n}=i.extractTopLevelPageMeta(t),c=`
|
|
28
|
+
${r}
|
|
29
|
+
<view data-dev-page>
|
|
30
|
+
<view
|
|
31
|
+
data-dev-capture
|
|
32
|
+
@tap.capture="devCaptureTapEvent"
|
|
33
|
+
@touchstart.capture="devCaptureTouchStartEvent"
|
|
34
|
+
@touchmove.capture="devCaptureTouchMoveEvent"
|
|
35
|
+
@touchend.capture="devCaptureTouchEndEvent"
|
|
36
|
+
>
|
|
37
|
+
${n}
|
|
38
|
+
</view>
|
|
39
|
+
<DevTool />
|
|
40
|
+
</view>
|
|
41
|
+
`;return e.replace(t,()=>c)}const g=({id:e,code:t,pages:r,scriptRow:n,importConsole:c,excludeImportConsole:o,excludeImportDevTool:u})=>{try{let s=t;const a=m(t,e,o,c),l=a.shouldInjectConsole&&!a.hasExistingConsoleImport&&a.usesConsole&&a.isExcludedFromConsole;l&&(s=h(s,n,l));const p=d(e,t,r,u);return p.isPageOrSubPage&&p.hasTemplate&&p.isExcludedFromDevTool&&(s=f(s),s=C(s,n)),{code:s,map:null}}catch(s){return console.error("[DevTool] 转换 Vue 文件时出错:",s),{code:t,map:null}}};exports.transformVue=g;
|
|
@@ -14,7 +14,6 @@ interface TransformVueOptions {
|
|
|
14
14
|
};
|
|
15
15
|
scriptRow: string;
|
|
16
16
|
importConsole?: boolean;
|
|
17
|
-
importEventBus?: boolean;
|
|
18
17
|
excludeImportConsole: string[];
|
|
19
18
|
excludeImportDevTool: string[];
|
|
20
19
|
}
|
|
@@ -34,7 +33,7 @@ interface TransformVueOptions {
|
|
|
34
33
|
* }
|
|
35
34
|
* @return {*} {{ code: string; map: any }}
|
|
36
35
|
*/
|
|
37
|
-
export declare const transformVue: ({ id, code, pages, scriptRow, importConsole,
|
|
36
|
+
export declare const transformVue: ({ id, code, pages, scriptRow, importConsole, excludeImportConsole, excludeImportDevTool, }: TransformVueOptions) => {
|
|
38
37
|
code: string;
|
|
39
38
|
map: any;
|
|
40
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformVue.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"transformVue.d.ts","sourceRoot":"","sources":["../../../../src/plugins/uniDevTool/transform/transformVue.ts"],"names":[],"mappings":"AASA,UAAU,mBAAmB;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1B,WAAW,CAAC,EAAE;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,EAAE,CAAC;SAC3B,EAAE,CAAC;KACL,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAmND;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,YAAY,+FAQtB,mBAAmB;UAAW,MAAM;SAAO,GAAG;CAiDhD,CAAC"}
|
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
${l}
|
|
3
|
-
${u}
|
|
4
|
-
`.trim();return e.replace(r.regScript,`${t}
|
|
5
|
-
${c}
|
|
6
|
-
<\/script>`)}function f(e){const t=r.getTemplateContent(e);if(!t)return e;const{pageMetas:o,resetContent:n}=r.extractTopLevelPageMeta(t),s=`
|
|
1
|
+
import{hasDirOrFile as v,hasUseConsole as m,hasImportConsole as d,regScript as i,getTemplateContent as h,extractTopLevelPageMeta as C}from"../../utils/index.js";function f(e,t){var c;const r=t.pages.some(o=>e.includes(o.path)),n=((c=t.subPackages)==null?void 0:c.some(o=>o.pages.some(u=>e.includes(`${o.root}/${u.path}`))))??!1;return{isPage:r,isSubPage:n}}function T(e,t,r,n){return{shouldInjectConsole:!!n,hasExistingConsoleImport:d(e),usesConsole:m(e),isExcludedFromConsole:!v(t,r)}}function $(e,t,r,n){const{isPage:c,isSubPage:o}=f(e,r);return{isPageOrSubPage:c||o,hasTemplate:t.includes("<template>"),isExcludedFromDevTool:!v(e,n)}}function g(e,t,r){const n=e.match(i);if(!n||!n[1])return e;const c=n[1];let o="";r&&(o="import { console } from 'vite-uni-dev-tool/dist/core';");const u=`
|
|
7
2
|
${o}
|
|
3
|
+
${c}
|
|
4
|
+
`.trim();return e.replace(i,()=>`${t}
|
|
5
|
+
${u}
|
|
6
|
+
<\/script>`)}function E(e,t){const r=e.match(i);if(!r||!r[1])return e;const n=r[1];if(n.includes("devCaptureTapEvent"))return e;const o=t.includes('lang="ts"')||t.includes('lang="typescript"')?": any":"",u=`
|
|
7
|
+
function devCaptureTapEvent(e${o}) {
|
|
8
|
+
uni?.$emit('dev-capture-tap-event', e);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function devCaptureTouchStartEvent(e${o}) {
|
|
12
|
+
uni?.$emit('dev-capture-touch-start-event', e);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function devCaptureTouchMoveEvent(e${o}) {
|
|
16
|
+
uni?.$emit('dev-capture-touch-move-event', e);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function devCaptureTouchEndEvent(e${o}) {
|
|
20
|
+
uni?.$emit('dev-capture-touch-end-event', e);
|
|
21
|
+
}
|
|
22
|
+
`,s=`
|
|
23
|
+
${n}
|
|
24
|
+
${u}
|
|
25
|
+
`.trim();return e.replace(i,()=>`${t}
|
|
26
|
+
${s}
|
|
27
|
+
<\/script>`)}function S(e){const t=h(e);if(!t)return e;const{pageMetas:r,resetContent:n}=C(t),c=`
|
|
28
|
+
${r}
|
|
8
29
|
<view data-dev-page>
|
|
9
30
|
<view
|
|
10
31
|
data-dev-capture
|
|
11
|
-
@tap.capture="
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@
|
|
15
|
-
devToolEventBus?.emit?.('dev-capture-touch-start-event', e);
|
|
16
|
-
}"
|
|
17
|
-
@touchmove.capture="(e)=>{
|
|
18
|
-
devToolEventBus?.emit?.('dev-capture-touch-move-event', e);
|
|
19
|
-
}"
|
|
20
|
-
@touchend.capture="(e)=>{
|
|
21
|
-
devToolEventBus?.emit?.('dev-capture-touch-end-event', e);
|
|
22
|
-
}"
|
|
32
|
+
@tap.capture="devCaptureTapEvent"
|
|
33
|
+
@touchstart.capture="devCaptureTouchStartEvent"
|
|
34
|
+
@touchmove.capture="devCaptureTouchMoveEvent"
|
|
35
|
+
@touchend.capture="devCaptureTouchEndEvent"
|
|
23
36
|
>
|
|
24
37
|
${n}
|
|
25
38
|
</view>
|
|
26
39
|
<DevTool />
|
|
27
40
|
</view>
|
|
28
|
-
`;return e.replace(t,
|
|
41
|
+
`;return e.replace(t,()=>c)}const x=({id:e,code:t,pages:r,scriptRow:n,importConsole:c,excludeImportConsole:o,excludeImportDevTool:u})=>{try{let s=t;const a=T(t,e,o,c),l=a.shouldInjectConsole&&!a.hasExistingConsoleImport&&a.usesConsole&&a.isExcludedFromConsole;l&&(s=g(s,n,l));const p=$(e,t,r,u);return p.isPageOrSubPage&&p.hasTemplate&&p.isExcludedFromDevTool&&(s=S(s),s=E(s,n)),{code:s,map:null}}catch(s){return console.error("[DevTool] 转换 Vue 文件时出错:",s),{code:t,map:null}}};export{x as transformVue};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const j=require("path"),b=require("fs"),o=require("../utils/index.cjs"),q=require("./transform/transformMain.cjs"),w=require("./transform/transformApp.cjs"),A=require("./transform/transformVue.cjs");function d(i){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const u in i)if(u!=="default"){const f=Object.getOwnPropertyDescriptor(i,u);Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>i[u]})}}return a.default=i,Object.freeze(a)}const T=d(j),L=d(b),p={isReady:!1,urls:[]};function O({pages:i,sourceFileServers:a,importConsole:u,excludeImportConsole:f=["uni_modules","node_modules","src/App.vue"],excludeImportDevTool:S=["uni_modules","node_modules"],captureList:v=[],injectDevTool:h=!0,..._}){return{name:"vite-uni-dev-tool",enforce:"pre",configureServer(t){var c;t.middlewares.use((n,s,r)=>{const{originalUrl:e}=n;if(_.useDevSource&&(e!=null&&e.includes("__dev_sourcefile__"))){const l=e.replace("/__dev_sourcefile__","");try{const m=t.config.root,g=T.join(m,l),y=L.readFileSync(g,"utf-8");s.setHeader("Content-Type",o.getContentType(g)),s.end(y)}catch{r()}}else r()}),(c=t.httpServer)==null||c.once("listening",()=>{var r;const n=(r=t.httpServer)==null?void 0:r.address(),s=o.getLocalIPs();if(n&&!Array.isArray(n)&&typeof n!="string"){const e=s.map(l=>`http://${l}:${n.port}/__dev_sourcefile__`);p.isReady=!0,p.urls=e,console.warn(`
|
|
2
|
+
⚡️ vite-uni-dev-tool source file server running at:
|
|
3
|
+
${s.map(l=>`➜ Source File Network: http://${l}:${n==null?void 0:n.port}/__dev_sourcefile__`).join(`
|
|
4
|
+
`)}
|
|
5
|
+
`)}})},transform(t,c){if(h){const n=o.hasLangTS(t),s=o.hasLangJS(t),r=o.hasSetup(t);let e="<script>";if(n&&r?e='<script lang="ts" setup>':s&&r?e='<script lang="js" setup>':s?e='<script lang="js">':n?e='<script lang="ts">':r&&(e="<script setup>"),o.isMainFile(c))return q.transformMain({code:t});if(o.isAppVue(c))return w.transformApp({code:t,isSetup:r,importConsole:u,scriptRow:e,netWorkInfo:p,sourceFileServers:a,reset:{..._,captureList:v}});if(o.isVueFile(c))return A.transformVue({id:c,code:t,pages:i,scriptRow:e,importConsole:u,excludeImportConsole:f,excludeImportDevTool:S})}return{code:t,map:null}}}}module.exports=O;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
|
|
3
|
-
export type CaptureList = readonly ('tap' | 'touchstart' | 'touchmove' | 'touchend')[]
|
|
3
|
+
export type CaptureList = readonly ('tap' | 'touchstart' | 'touchmove' | 'touchend')[];
|
|
4
4
|
type UploadAbnormalUV = {
|
|
5
5
|
/** 上传地址 */
|
|
6
6
|
url: string;
|
|
@@ -62,16 +62,6 @@ export default function uniDevTool({ pages, sourceFileServers, importConsole, ex
|
|
|
62
62
|
eventListMaxSize?: number;
|
|
63
63
|
/** 最大截屏记录条数 */
|
|
64
64
|
captureScreenMaxSize?: number;
|
|
65
|
-
/** 按钮大小 */
|
|
66
|
-
buttonSize?: number;
|
|
67
|
-
/** 按钮文本 */
|
|
68
|
-
buttonText?: string;
|
|
69
|
-
/** 按钮文本颜色 */
|
|
70
|
-
buttonColor?: string;
|
|
71
|
-
/** 按钮字体大小 */
|
|
72
|
-
buttonFontSize?: string;
|
|
73
|
-
/** 按钮背景颜色 */
|
|
74
|
-
buttonBackgroundColor?: string;
|
|
75
65
|
/** 初始化时是否显示调试按钮,默认显示 */
|
|
76
66
|
initShowDevTool?: boolean;
|
|
77
67
|
/** 调试弹窗层级默认 998 */
|
|
@@ -116,6 +106,8 @@ export default function uniDevTool({ pages, sourceFileServers, importConsole, ex
|
|
|
116
106
|
injectDevTool?: boolean;
|
|
117
107
|
/** 异常上报 */
|
|
118
108
|
uploadAbnormalUV?: UploadAbnormalUV;
|
|
109
|
+
/** 环境模式 */
|
|
110
|
+
mode?: string;
|
|
119
111
|
}): Plugin;
|
|
120
112
|
export {};
|
|
121
113
|
//# sourceMappingURL=uniDevTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["../../../src/plugins/uniDevTool/uniDevTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAsBnC,MAAM,MAAM,WAAW,GAAG,SAAS,CAC/B,KAAK,GACL,YAAY,GACZ,WAAW,GACX,UAAU,CACb,EAAE,CAAC;AAEJ,KAAK,gBAAgB,GAAG;IACtB,WAAW;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU;IACV,MAAM,CAAC,EAAE;QACP,kBAAkB,CAAC,EAAE,GAAG,CAAC;QACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE;QACR,uBAAuB;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,iBAAiB,EACjB,aAAa,EACb,oBAAqE,EACrE,oBAAsD,EACtD,WAAgB,EAChB,aAAoB,EACpB,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,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,8CAA8C;IAC9C,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;IACF,wBAAwB;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,+DAA+D;IAC/D,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,qDAAqD;IACrD,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW;IACX,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CA2GT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import*as h from"path";import*as y from"fs";import{hasLangTS as w,hasLangJS as A,hasSetup as L,isMainFile as T,isAppVue as $,isVueFile as j,getContentType as F,getLocalIPs as P}from"../utils/index.js";import{transformMain as R}from"./transform/transformMain.js";import{transformApp as V}from"./transform/transformApp.js";import{transformVue as k}from"./transform/transformVue.js";const u={isReady:!1,urls:[]};function M({pages:c,sourceFileServers:_,importConsole:a,excludeImportConsole:m=["uni_modules","node_modules","src/App.vue"],excludeImportDevTool:g=["uni_modules","node_modules"],captureList:d=[],injectDevTool:v=!0,...p}){return{name:"vite-uni-dev-tool",enforce:"pre",configureServer(t){var o;t.middlewares.use((r,n,s)=>{const{originalUrl:e}=r;if(p.useDevSource&&(e!=null&&e.includes("__dev_sourcefile__"))){const i=e.replace("/__dev_sourcefile__","");try{const l=t.config.root,f=h.join(l,i),S=y.readFileSync(f,"utf-8");n.setHeader("Content-Type",F(f)),n.end(S)}catch{s()}}else s()}),(o=t.httpServer)==null||o.once("listening",()=>{var s;const r=(s=t.httpServer)==null?void 0:s.address(),n=P();if(r&&!Array.isArray(r)&&typeof r!="string"){const e=n.map(i=>`http://${i}:${r.port}/__dev_sourcefile__`);u.isReady=!0,u.urls=e,console.warn(`
|
|
2
2
|
⚡️ vite-uni-dev-tool source file server running at:
|
|
3
|
-
${
|
|
3
|
+
${n.map(i=>`➜ Source File Network: http://${i}:${r==null?void 0:r.port}/__dev_sourcefile__`).join(`
|
|
4
4
|
`)}
|
|
5
|
-
`)}})},transform(t,
|
|
5
|
+
`)}})},transform(t,o){if(v){const r=w(t),n=A(t),s=L(t);let e="<script>";if(r&&s?e='<script lang="ts" setup>':n&&s?e='<script lang="js" setup>':n?e='<script lang="js">':r?e='<script lang="ts">':s&&(e="<script setup>"),T(o))return R({code:t});if($(o))return V({code:t,isSetup:s,importConsole:a,scriptRow:e,netWorkInfo:u,sourceFileServers:_,reset:{...p,captureList:d}});if(j(o))return k({id:o,code:t,pages:c,scriptRow:e,importConsole:a,excludeImportConsole:m,excludeImportDevTool:g})}return{code:t,map:null}}}}export{M as default};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";const _=require("path"),m=require("fs"),l=require("../utils/index.cjs");function v(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,o.get?o:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const g=v(_),h=v(m),f={isReady:!1,urls:[]};function C({pages:r,components:i}){return{name:"uni-global-components",enforce:"pre",configureServer(e){var o;e.middlewares.use((n,a,c)=>{const{originalUrl:s}=n;if(s!=null&&s.includes("__dev_sourcefile__")){const t=s.replace("/__dev_sourcefile__","");try{const u=e.config.root,p=g.join(u,t),d=h.readFileSync(p,"utf-8");a.setHeader("Content-Type",l.getContentType(p)),a.end(d)}catch{c()}}else c()}),(o=e.httpServer)==null||o.once("listening",()=>{var c;const n=(c=e.httpServer)==null?void 0:c.address(),a=l.getLocalIPs();if(n&&!Array.isArray(n)&&typeof n!="string"){const s=a.map(t=>`http://${t}:${n.port}/__dev_sourcefile__`);f.isReady=!0,f.urls=s,console.warn(`
|
|
2
|
+
⚡️ vite-uni-dev-tool source file server running at:
|
|
3
|
+
${a.map(t=>`➜ Source File Network: http://${t}:${n==null?void 0:n.port}/__dev_sourcefile__`).join(`
|
|
4
|
+
`)}
|
|
5
|
+
`)}})},transform(e,o){var n;if(o.endsWith(".vue")){const a=e.includes("<template>"),c=r.pages.some(t=>o.includes(t.path)),s=(n=r.subPackages)==null?void 0:n.some(t=>t.pages.some(u=>o.includes(`${t.root}/${u.path}`)));if((c||s)&&a){const t=l.getTemplateContent(e),{pageMetas:u,resetContent:p}=l.extractTopLevelPageMeta(t);if(t){const d=`
|
|
6
|
+
${u}
|
|
7
|
+
<view data-dev-page>
|
|
8
|
+
<view
|
|
9
|
+
data-dev-capture
|
|
10
|
+
@tap.capture="devCaptureTapEvent"
|
|
11
|
+
@touchstart.capture="devCaptureTouchStartEvent"
|
|
12
|
+
@touchmove.capture="devCaptureTouchMoveEvent"
|
|
13
|
+
@touchend.capture="devCaptureTouchEndEvent"
|
|
14
|
+
>
|
|
15
|
+
${p}
|
|
16
|
+
</view>
|
|
17
|
+
${i.join(`
|
|
18
|
+
`)}
|
|
19
|
+
</view>`;return{code:e.replace(t,d),map:null}}}}return{code:e,map:null}}}}module.exports=C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniGlobalComponents.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"uniGlobalComponents.d.ts","sourceRoot":"","sources":["../../../src/plugins/uniGlobalComponents/uniGlobalComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAkBnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,KAAK,EACL,UAAU,GACX,EAAE;IACD,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;IACF,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,GAAG,MAAM,CA6FT"}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import*as f from"path";import*as v from"fs";import{getTemplateContent as m,extractTopLevelPageMeta as _,getContentType as h,getLocalIPs as g}from"../utils/index.js";const l={isReady:!1,urls:[]};function $({pages:p,components:d}){return{name:"uni-global-components",enforce:"pre",configureServer(n){var s;n.middlewares.use((t,r,a)=>{const{originalUrl:o}=t;if(o!=null&&o.includes("__dev_sourcefile__")){const e=o.replace("/__dev_sourcefile__","");try{const c=n.config.root,i=f.join(c,e),u=v.readFileSync(i,"utf-8");r.setHeader("Content-Type",h(i)),r.end(u)}catch{a()}}else a()}),(s=n.httpServer)==null||s.once("listening",()=>{var a;const t=(a=n.httpServer)==null?void 0:a.address(),r=g();if(t&&!Array.isArray(t)&&typeof t!="string"){const o=r.map(e=>`http://${e}:${t.port}/__dev_sourcefile__`);l.isReady=!0,l.urls=o,console.warn(`
|
|
2
2
|
⚡️ vite-uni-dev-tool source file server running at:
|
|
3
|
-
${
|
|
3
|
+
${r.map(e=>`➜ Source File Network: http://${e}:${t==null?void 0:t.port}/__dev_sourcefile__`).join(`
|
|
4
4
|
`)}
|
|
5
|
-
`)
|
|
6
|
-
${
|
|
5
|
+
`)}})},transform(n,s){var t;if(s.endsWith(".vue")){const r=n.includes("<template>"),a=p.pages.some(e=>s.includes(e.path)),o=(t=p.subPackages)==null?void 0:t.some(e=>e.pages.some(c=>s.includes(`${e.root}/${c.path}`)));if((a||o)&&r){const e=m(n),{pageMetas:c,resetContent:i}=_(e);if(e){const u=`
|
|
6
|
+
${c}
|
|
7
7
|
<view data-dev-page>
|
|
8
8
|
<view
|
|
9
9
|
data-dev-capture
|
|
10
|
-
@tap.capture="
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@
|
|
14
|
-
devToolEventBus?.emit?.('dev-capture-touch-start-event', e);
|
|
15
|
-
}"
|
|
16
|
-
@touchmove.capture="(e)=>{
|
|
17
|
-
devToolEventBus?.emit?.('dev-capture-touch-move-event', e);
|
|
18
|
-
}"
|
|
19
|
-
@touchend.capture="(e)=>{
|
|
20
|
-
devToolEventBus?.emit?.('dev-capture-touch-end-event', e);
|
|
21
|
-
}"
|
|
10
|
+
@tap.capture="devCaptureTapEvent"
|
|
11
|
+
@touchstart.capture="devCaptureTouchStartEvent"
|
|
12
|
+
@touchmove.capture="devCaptureTouchMoveEvent"
|
|
13
|
+
@touchend.capture="devCaptureTouchEndEvent"
|
|
22
14
|
>
|
|
23
|
-
${
|
|
15
|
+
${i}
|
|
24
16
|
</view>
|
|
25
|
-
${
|
|
17
|
+
${d.join(`
|
|
26
18
|
`)}
|
|
27
|
-
</view>`;return{code:
|
|
19
|
+
</view>`;return{code:n.replace(e,u),map:null}}}}return{code:n,map:null}}}}export{$ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/uniParseStock/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAcnC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,MAAM,CAoL9C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("path"),S=require("os");function h(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const b=h(x),I=h(S),T=/<script[^>]*>([\s\S]*?)<\/script>/;function M(t,n){for(let e=0;e<t.length;e++)if(n(t[e]))return e+1;return-1}function C(t){const n=b.extname(t).toLowerCase();return{".html":"text/html",".js":"text/javascript",".css":"text/css",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".woff":"font/woff",".woff2":"font/woff2"}[n]||"text/plain"}function L(){const t=I.networkInterfaces(),n=[];return Object.keys(t).forEach(e=>{var r;t!=null&&t[e]&&Array.isArray(t==null?void 0:t[e])&&((r=t==null?void 0:t[e])==null||r.forEach(s=>{s.family==="IPv4"&&!s.internal&&n.push(s.address)}))}),n.push("localhost"),n}const v=/import\s*\{[^}]*Vue[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function j(t){return v.test(t)}const P=/import\s*\{[^}]*onLaunch[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function R(t){return P.test(t)}const w=/import\s*\{[^}]*onExit[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function O(t){return w.test(t)}const y=/import\s*\{[^}]*getCurrentInstance[^}]*\}\s*from\s+['"]vue['"];?/;function k(t){return y.test(t)}const E=/import\s*\{[^}]*console[^}]*\}\s*from\s+['"]vite-uni-dev-tool['"];?/;function U(t){return E.test(t)}const z=/console\.\w+\(/;function A(t){return z.test(t)}const p=/<script[^>]*>/;function V(t){const n=t.match(p);if(!n)return!1;const e=n[0];return/lang=['"]ts['"]/.test(e)}function D(t){const n=t.match(p);if(!n)return!1;const e=n[0];return/lang=['"]js['"]/.test(e)}function F(t){const n=t.match(p);if(!n)return!1;const e=n[0];return/\ssetup(?=\s|>)/.test(e)}const W=/at\s(.*)?\((.*?):(\d+):?(\d+)?(\)?)$/;function N(t){const n=t.match(W);return{info:(n==null?void 0:n[1])??"",path:(n==null?void 0:n[2])??"",row:n!=null&&n[3]?parseInt(n==null?void 0:n[3]):-1,col:n!=null&&n[4]?parseInt(n==null?void 0:n[4]):-1}}const m=/https?:\/\/[^/]+(\/[^:]+)/;function _(t){const n=t.match(m);return n?n[0]:""}function J(t){const n=t.match(m);return n?n[1]:""}const Q=/(?:\/\/[@#][ \t]+sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,)([^\s'"]+)|(?:\/\*[@#][ \t]+sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,)([^\s*]+)(?:\*\/)/;function B(t){const n=t.match(Q);return n?n[1]||n[2]:""}function $(t){const n={};if(!t)return n;t.startsWith("?")&&(t=t.substring(1));const e=t.split("&");for(const r of e){const[s,i]=r.split("=").map(decodeURIComponent);s&&(n[s]!==void 0?n[s]=Array.isArray(n[s])?[...n[s],i]:[n[s],i]:n[s]=i)}return n}function G(t){const n=/<template(\s[^>]*)?>/g,e=/<\/template>/g;let r=0,s=-1,i=0,o=0;for(;;){n.lastIndex=i,e.lastIndex=o;const a=n.exec(t),c=e.exec(t);if(!a&&!c)break;if(a&&(!c||a.index<c.index))r===0&&(s=a.index+a[0].length),r++,i=a.index+a[0].length,o=i;else if(c){if(r--,o=c.index+c[0].length,i=c.index+c[0].length,r===0&&s!==-1)return t.substring(s,c.index).trim();r<0&&(r=0,s=-1)}}return""}function H(t){const n=/<page-meta(?:\s+[\s\S]*?)?>/gi,e=nt(t),r=[];let s;for(;(s=n.exec(t))!==null;){if(st(s.index,e))continue;const u=K(t,s.index);r.push({content:u.tag,start:s.index,end:s.index+u.length})}const i=[],o=[];let a=0;for(const u of r){const d=X(t,u.start),f=t.substring(a,u.start);f.trim()&&o.push(f),d?i.push(u.content):o.push(u.content),a=u.end}const c=t.substring(a);c.trim()&&o.push(c);const g=i.join(`
|
|
2
|
+
`).trim(),l=o.join("").trim();return{pageMetas:g,resetContent:l}}function K(t,n){let e=n;if(t[e]!=="<")return{tag:"",length:0};let r=-1,s=!1,i="";for(;e<t.length;){if(e<t.length-1&&t[e]==="/"&&t[e+1]===">"){r=e+1,s=!0,i+="/>";break}else if(t[e]===">"){r=e,i+=">";break}i+=t[e],e++}if(r===-1)return{tag:"",length:0};const o=i.split(/\s/)[0].substring(1);if(s)return{tag:i,length:r+1-n};const a=o;let c=1;e=r+1;let g=t.substring(n,e);for(;e<t.length&&c>0;)if(t[e]==="<")if(e<t.length-1&&t[e+1]==="/"){const l=t.indexOf(">",e);if(l!==-1){if(t.substring(e+2,l).split(/\s/)[0]===a&&c--,c===0){g+=t.substring(e,l+1),e=l+1;break}e=l+1}else e++}else{const l=t.indexOf(">",e);l!==-1?(t.substring(e+1,l).split(/\s/)[0]===a&&c++,e=l+1):e++}else g+=t[e],e++;return{tag:g,length:e-n}}function X(t,n){const e=t.substring(0,n),r=[];let s=0;for(;s<e.length;)if(e[s]==="<")if(s+1<e.length&&e[s+1]==="/"){const i=e.indexOf(">",s);if(i!==-1){const o=e.substring(s+2,i).trim().split(/\s/)[0];r.length>0&&r[r.length-1]===o&&r.pop()}s=i!==-1?i+1:s+1}else{const i=Y(e,s);if(i!==-1){const o=e.substring(s+1,i),a=o.split(/\s/)[0];!(o.endsWith("/")||s+o.length<e.length-1&&e[s+o.length+1]==="/")&&!a.startsWith("!")&&r.push(a),s=i+1}else s++}else s++;return r.length===0}function Y(t,n){let e=n;if(t[e]!=="<")return-1;for(e++;e<t.length;){if(t[e]===">")return e;if(e<t.length-1&&t[e]==="/"&&t[e+1]===">")return e+1;e++}return-1}function Z(t,n){const e=t.replace(/\\/g,"/");return e.split("/").filter(i=>i.length>0).some(i=>n.some(o=>{const a=o.replace(/\\/g,"/");return a.includes("/")?e.endsWith(a):a===i}))?!0:n.some(i=>{const o=i.replace(/\\/g,"/");return o.includes("/")?e.includes(o):!1})}const q=t=>t.replace(/\\/g,"/").endsWith("/src/App.vue"),tt=t=>{const n=t.replace(/\\/g,"/");return n.includes("/src/main.ts")||n.includes("/src/main.js")},et=t=>t.endsWith(".vue");function nt(t){const n=/<!--[\s\S]*?-->/g,e=[];let r;for(;(r=n.exec(t))!==null;)e.push({start:r.index,end:r.index+r[0].length});return e}function st(t,n){return n.some(e=>t>=e.start&&t<e.end)}exports.extractPath=J;exports.extractSourceMap=B;exports.extractTopLevelPageMeta=H;exports.extractUrl=_;exports.findInsertionIndex=M;exports.getContentType=C;exports.getLocalIPs=L;exports.getTemplateContent=G;exports.hasDirOrFile=Z;exports.hasImportConsole=U;exports.hasImportCurrentInstance=k;exports.hasImportOnExit=O;exports.hasImportOnLaunch=R;exports.hasImportVue=j;exports.hasLangJS=D;exports.hasLangTS=V;exports.hasSetup=F;exports.hasUseConsole=A;exports.isAppVue=q;exports.isMainFile=tt;exports.isVueFile=et;exports.parseQueryString=$;exports.parseStock=N;exports.regScript=T;
|
|
@@ -7,9 +7,7 @@ export declare function hasImportOnLaunch(str: string): boolean;
|
|
|
7
7
|
export declare function hasImportOnExit(str: string): boolean;
|
|
8
8
|
export declare function hasImportCurrentInstance(str: string): boolean;
|
|
9
9
|
export declare function hasImportConsole(str: string): boolean;
|
|
10
|
-
export declare function hasImportDevToolEventBus(str: string): boolean;
|
|
11
10
|
export declare function hasUseConsole(str: string): boolean;
|
|
12
|
-
export declare function hasUseDevToolEventBus(str: string): boolean;
|
|
13
11
|
export declare function hasLangTS(code: string): boolean;
|
|
14
12
|
export declare function hasLangJS(code: string): boolean;
|
|
15
13
|
export declare function hasSetup(code: string): boolean;
|
|
@@ -72,7 +70,7 @@ export declare function getTemplateContent(code: string): string;
|
|
|
72
70
|
* 将 page-meta 标签和其他标签返回
|
|
73
71
|
*
|
|
74
72
|
* 例如 :
|
|
75
|
-
*
|
|
73
|
+
* <!-- <page-meta page-style="background-color: #87CEEB" /> -->
|
|
76
74
|
* <page-meta
|
|
77
75
|
* page-style="background-color: #87CEEB"
|
|
78
76
|
* />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/utils/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,QAAsC,CAAC;AAE7D,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,CAOR;AAGD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,UAe9C;AAGD,wBAAgB,WAAW,aAiB1B;AAKD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAKD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAID,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAKD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7D;AAID,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,WAarC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,WAWrC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,WAYpC;AAID;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM;;;;;EAQvC;AAGD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,UAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAGvC;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,UAG5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,OA4BnD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqDvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM;;;EA6DnD;AAoKD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAkCxD;AAED;;;;;GAKG;AAEH,eAAO,MAAM,QAAQ,OAAQ,MAAM,YAGlC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,OAAQ,MAAM,YAMpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,OAAQ,MAAM,YAEnC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`).trim(),
|
|
1
|
+
import*as d from"path";import*as x from"os";const k=/<script[^>]*>([\s\S]*?)<\/script>/;function y(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n+1;return-1}function O(t){const e=d.extname(t).toLowerCase();return{".html":"text/html",".js":"text/javascript",".css":"text/css",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".woff":"font/woff",".woff2":"font/woff2"}[e]||"text/plain"}function z(){const t=x.networkInterfaces(),e=[];return Object.keys(t).forEach(n=>{var i;t!=null&&t[n]&&Array.isArray(t==null?void 0:t[n])&&((i=t==null?void 0:t[n])==null||i.forEach(s=>{s.family==="IPv4"&&!s.internal&&e.push(s.address)}))}),e.push("localhost"),e}const T=/import\s*\{[^}]*Vue[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function A(t){return T.test(t)}const b=/import\s*\{[^}]*onLaunch[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function U(t){return b.test(t)}const S=/import\s*\{[^}]*onExit[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function W(t){return S.test(t)}const I=/import\s*\{[^}]*getCurrentInstance[^}]*\}\s*from\s+['"]vue['"];?/;function N(t){return I.test(t)}const M=/import\s*\{[^}]*console[^}]*\}\s*from\s+['"]vite-uni-dev-tool['"];?/;function V(t){return M.test(t)}const C=/console\.\w+\(/;function D(t){return C.test(t)}const p=/<script[^>]*>/;function F(t){const e=t.match(p);if(!e)return!1;const n=e[0];return/lang=['"]ts['"]/.test(n)}function J(t){const e=t.match(p);if(!e)return!1;const n=e[0];return/lang=['"]js['"]/.test(n)}function B(t){const e=t.match(p);if(!e)return!1;const n=e[0];return/\ssetup(?=\s|>)/.test(n)}const L=/at\s(.*)?\((.*?):(\d+):?(\d+)?(\)?)$/;function Q(t){const e=t.match(L);return{info:(e==null?void 0:e[1])??"",path:(e==null?void 0:e[2])??"",row:e!=null&&e[3]?parseInt(e==null?void 0:e[3]):-1,col:e!=null&&e[4]?parseInt(e==null?void 0:e[4]):-1}}const h=/https?:\/\/[^/]+(\/[^:]+)/;function $(t){const e=t.match(h);return e?e[0]:""}function G(t){const e=t.match(h);return e?e[1]:""}const R=/(?:\/\/[@#][ \t]+sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,)([^\s'"]+)|(?:\/\*[@#][ \t]+sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,)([^\s*]+)(?:\*\/)/;function H(t){const e=t.match(R);return e?e[1]||e[2]:""}function K(t){const e={};if(!t)return e;t.startsWith("?")&&(t=t.substring(1));const n=t.split("&");for(const i of n){const[s,r]=i.split("=").map(decodeURIComponent);s&&(e[s]!==void 0?e[s]=Array.isArray(e[s])?[...e[s],r]:[e[s],r]:e[s]=r)}return e}function X(t){const e=/<template(\s[^>]*)?>/g,n=/<\/template>/g;let i=0,s=-1,r=0,o=0;for(;;){e.lastIndex=r,n.lastIndex=o;const a=e.exec(t),c=n.exec(t);if(!a&&!c)break;if(a&&(!c||a.index<c.index))i===0&&(s=a.index+a[0].length),i++,r=a.index+a[0].length,o=r;else if(c){if(i--,o=c.index+c[0].length,r=c.index+c[0].length,i===0&&s!==-1)return t.substring(s,c.index).trim();i<0&&(i=0,s=-1)}}return""}function Y(t){const e=/<page-meta(?:\s+[\s\S]*?)?>/gi,n=E(t),i=[];let s;for(;(s=e.exec(t))!==null;){if(P(s.index,n))continue;const u=v(t,s.index);i.push({content:u.tag,start:s.index,end:s.index+u.length})}const r=[],o=[];let a=0;for(const u of i){const m=w(t,u.start),f=t.substring(a,u.start);f.trim()&&o.push(f),m?r.push(u.content):o.push(u.content),a=u.end}const c=t.substring(a);c.trim()&&o.push(c);const g=r.join(`
|
|
2
|
+
`).trim(),l=o.join("").trim();return{pageMetas:g,resetContent:l}}function v(t,e){let n=e;if(t[n]!=="<")return{tag:"",length:0};let i=-1,s=!1,r="";for(;n<t.length;){if(n<t.length-1&&t[n]==="/"&&t[n+1]===">"){i=n+1,s=!0,r+="/>";break}else if(t[n]===">"){i=n,r+=">";break}r+=t[n],n++}if(i===-1)return{tag:"",length:0};const o=r.split(/\s/)[0].substring(1);if(s)return{tag:r,length:i+1-e};const a=o;let c=1;n=i+1;let g=t.substring(e,n);for(;n<t.length&&c>0;)if(t[n]==="<")if(n<t.length-1&&t[n+1]==="/"){const l=t.indexOf(">",n);if(l!==-1){if(t.substring(n+2,l).split(/\s/)[0]===a&&c--,c===0){g+=t.substring(n,l+1),n=l+1;break}n=l+1}else n++}else{const l=t.indexOf(">",n);l!==-1?(t.substring(n+1,l).split(/\s/)[0]===a&&c++,n=l+1):n++}else g+=t[n],n++;return{tag:g,length:n-e}}function w(t,e){const n=t.substring(0,e),i=[];let s=0;for(;s<n.length;)if(n[s]==="<")if(s+1<n.length&&n[s+1]==="/"){const r=n.indexOf(">",s);if(r!==-1){const o=n.substring(s+2,r).trim().split(/\s/)[0];i.length>0&&i[i.length-1]===o&&i.pop()}s=r!==-1?r+1:s+1}else{const r=j(n,s);if(r!==-1){const o=n.substring(s+1,r),a=o.split(/\s/)[0];!(o.endsWith("/")||s+o.length<n.length-1&&n[s+o.length+1]==="/")&&!a.startsWith("!")&&i.push(a),s=r+1}else s++}else s++;return i.length===0}function j(t,e){let n=e;if(t[n]!=="<")return-1;for(n++;n<t.length;){if(t[n]===">")return n;if(n<t.length-1&&t[n]==="/"&&t[n+1]===">")return n+1;n++}return-1}function Z(t,e){const n=t.replace(/\\/g,"/");return n.split("/").filter(r=>r.length>0).some(r=>e.some(o=>{const a=o.replace(/\\/g,"/");return a.includes("/")?n.endsWith(a):a===r}))?!0:e.some(r=>{const o=r.replace(/\\/g,"/");return o.includes("/")?n.includes(o):!1})}const _=t=>t.replace(/\\/g,"/").endsWith("/src/App.vue"),q=t=>{const e=t.replace(/\\/g,"/");return e.includes("/src/main.ts")||e.includes("/src/main.js")},tt=t=>t.endsWith(".vue");function E(t){const e=/<!--[\s\S]*?-->/g,n=[];let i;for(;(i=e.exec(t))!==null;)n.push({start:i.index,end:i.index+i[0].length});return n}function P(t,e){return e.some(n=>t>=n.start&&t<n.end)}export{G as extractPath,H as extractSourceMap,Y as extractTopLevelPageMeta,$ as extractUrl,y as findInsertionIndex,O as getContentType,z as getLocalIPs,X as getTemplateContent,Z as hasDirOrFile,V as hasImportConsole,N as hasImportCurrentInstance,W as hasImportOnExit,U as hasImportOnLaunch,A as hasImportVue,J as hasLangJS,F as hasLangTS,B as hasSetup,D as hasUseConsole,_ as isAppVue,q as isMainFile,tt as isVueFile,K as parseQueryString,Q as parseStock,k as regScript};
|