vite-uni-dev-tool 1.0.0 → 1.2.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 +54 -0
- package/dist/const.cjs +1 -1
- package/dist/const.d.ts +13 -0
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +1 -1
- package/dist/core-shared.d.ts +1 -1
- package/dist/core-shared.d.ts.map +1 -1
- package/dist/core-shared.js +1 -1
- package/dist/core.d.ts +10 -3
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +2 -2
- package/dist/i18n/locales/en.cjs +1 -1
- package/dist/i18n/locales/en.d.ts +86 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/zh-Hans.cjs +1 -1
- package/dist/i18n/locales/zh-Hans.d.ts +87 -1
- package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
- package/dist/i18n/locales/zh-Hans.js +1 -1
- package/dist/modules/devConsole/index.cjs +1 -1
- package/dist/modules/devConsole/index.js +3 -3
- package/dist/modules/devEvent/index.cjs +3 -3
- package/dist/modules/devEvent/index.d.ts +1 -0
- package/dist/modules/devEvent/index.d.ts.map +1 -1
- package/dist/modules/devEvent/index.js +3 -3
- package/dist/modules/devIntercept/index.cjs +14 -13
- package/dist/modules/devIntercept/index.d.ts +20 -1
- package/dist/modules/devIntercept/index.d.ts.map +1 -1
- package/dist/modules/devIntercept/index.js +14 -13
- package/dist/modules/devStore/index.cjs +1 -1
- package/dist/modules/devStore/index.d.ts +21 -0
- package/dist/modules/devStore/index.d.ts.map +1 -1
- package/dist/modules/devStore/index.js +1 -1
- package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -3
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts +2 -1
- 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 +31 -25
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +2 -1
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/transform/transformVue.js +30 -24
- package/dist/plugins/uniDevTool/uniDevTool.cjs +3 -3
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -1
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
- package/dist/type.d.ts +50 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/utils/language.cjs +1 -1
- package/dist/utils/language.d.ts.map +1 -1
- package/dist/utils/language.js +1 -1
- package/dist/utils/object.cjs +1 -1
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +1 -1
- package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -0
- package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -0
- package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -0
- package/dist/v3/{CaptureScreen → DevTool/components/CaptureScreen}/index.vue +4 -4
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/ConsoleItem.vue +22 -16
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/RunJSInput.vue +4 -6
- package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/index.vue +21 -10
- package/dist/v3/{DevToolButton → DevTool/components/DevToolButton}/index.vue +7 -4
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/DevToolOverlay.vue +17 -2
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/const.ts +28 -5
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/dataUtils.ts +1 -1
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolData.ts +55 -6
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolHandlers.ts +85 -5
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/hooks/useDevToolOverlay.ts +25 -8
- package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.vue +67 -16
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/ElEventItem.vue +3 -3
- package/dist/v3/{ElEvent → DevTool/components/ElEvent}/index.vue +10 -13
- package/dist/v3/{Instance → DevTool/components/Instance}/index.vue +1 -1
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTree.ts +1 -1
- package/dist/v3/{Instance → DevTool/components/Instance}/transformTreeCtx.ts +1 -1
- package/dist/v3/{InstanceDetail → DevTool/components/InstanceDetail}/index.vue +4 -4
- package/dist/v3/{JsonDetail → DevTool/components/JsonDetail}/index.vue +4 -4
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCItem.vue +4 -5
- package/dist/v3/{NFCList → DevTool/components/NFCList}/NFCTool.vue +33 -57
- package/dist/v3/{NFCList → DevTool/components/NFCList}/index.vue +12 -16
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptConfig.vue +20 -4
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/InterceptItem.vue +3 -3
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkDetail.vue +18 -27
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkIntercept.vue +11 -16
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkItem.vue +10 -14
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/NetworkSend.vue +67 -34
- package/dist/v3/{NetworkList → DevTool/components/NetworkList}/index.vue +8 -8
- package/dist/v3/{Performance → DevTool/components/Performance}/index.vue +7 -4
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceWidget.vue +12 -9
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceChart.ts +1 -1
- package/dist/v3/{Performance → DevTool/components/Performance}/modules/usePerformanceData.ts +2 -2
- package/dist/v3/{PiniaList → DevTool/components/PiniaList}/index.vue +5 -6
- package/dist/v3/{RouteList → DevTool/components/RouteList}/index.vue +21 -24
- package/dist/v3/{RunJS → DevTool/components/RunJS}/index.vue +3 -3
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/ScanCodeItem.vue +3 -4
- package/dist/v3/{ScanCodeList → DevTool/components/ScanCodeList}/index.vue +12 -16
- package/dist/v3/{SettingList → DevTool/components/SettingList}/index.vue +68 -0
- package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -0
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingDevTool.vue +8 -4
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingInfo.vue +47 -9
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLanguage.vue +2 -2
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingLog.vue +2 -2
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingNetwork.vue +3 -3
- package/dist/v3/{SettingList → DevTool/components/SettingList}/modules/SettingTheme.vue +37 -7
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/Line.vue +22 -11
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/index.vue +8 -8
- package/dist/v3/{SourceCode → DevTool/components/SourceCode}/parseCode.ts +136 -228
- package/dist/v3/{StorageList → DevTool/components/StorageList}/index.vue +7 -7
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferDetail.vue +6 -6
- package/dist/v3/{TransferList → DevTool/components/TransferList}/TransferItem.vue +4 -4
- package/dist/v3/{TransferList → DevTool/components/TransferList}/index.vue +8 -8
- package/dist/v3/{UniEvent → DevTool/components/UniEvent}/UniEventItem.vue +6 -7
- package/dist/v3/{UniEvent → DevTool/components/UniEvent}/index.vue +6 -6
- package/dist/v3/{VuexList → DevTool/components/VuexList}/index.vue +3 -3
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketDetail.vue +8 -8
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/WebSocketItem.vue +4 -4
- package/dist/v3/{WebSocket → DevTool/components/WebSocket}/index.vue +8 -8
- package/dist/v3/DevTool/index.vue +179 -4
- package/dist/v3/{AppTransition → components/AppTransition}/index.vue +6 -0
- package/dist/v3/components/Barrage/BarrageItem.vue +137 -0
- package/dist/v3/components/Barrage/index.vue +202 -0
- package/dist/v3/components/DevErrorBoundary/index.vue +380 -0
- package/dist/v3/{DraggableContainer → components/DraggableContainer}/index.vue +1 -1
- package/dist/v3/{FilterInput → components/FilterInput}/index.vue +1 -1
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/CheckController/index.vue +1 -1
- package/dist/v3/{JsonPretty → components/JsonPretty}/components/TreeNode/index.vue +11 -5
- package/dist/v3/{JsonPretty → components/JsonPretty}/index.vue +16 -13
- package/dist/v3/{JsonPretty → components/JsonPretty}/type.ts +1 -0
- package/dist/v3/{JsonPretty → components/JsonPretty}/utils/index.ts +1 -1
- package/dist/v3/{MovableContainer → components/MovableContainer}/index.vue +9 -5
- package/dist/v3/{Pick → components/Pick}/index.vue +1 -1
- package/dist/v3/{Tabs → components/Tabs}/index.vue +30 -4
- package/dist/v3/{VirtualList → components/VirtualList}/AutoSize.vue +1 -1
- package/dist/v3/{VirtualList → components/VirtualList}/index.vue +4 -0
- package/dist/v3/hooks/useBluetooth/index.ts +561 -0
- package/dist/v3/hooks/useRequest/index.ts +33 -20
- package/dist/v3/hooks/useWebsocket/README.md +79 -0
- package/dist/v3/hooks/useWebsocket/index.ts +253 -0
- package/dist/v3/styles/theme.css +17 -10
- package/package.json +67 -64
- package/dist/plugins/uniParseStock/index.d.ts +0 -10
- package/dist/plugins/uniParseStock/index.d.ts.map +0 -1
- /package/dist/v3/{ConsoleList → DevTool/components/ConsoleList}/staticTips.ts +0 -0
- /package/dist/v3/{DevToolTitle → DevTool/components/DevToolTitle}/index.vue +0 -0
- /package/dist/v3/{DevToolWindow → DevTool/components/DevToolWindow}/index.css +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/components/InstanceTreeNode.vue +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/flatten.ts +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/registry.ts +0 -0
- /package/dist/v3/{Instance → DevTool/components/Instance}/typing.d.ts +0 -0
- /package/dist/v3/{NFCList → DevTool/components/NFCList}/const.ts +0 -0
- /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/const.ts +0 -0
- /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/hooks/useNetworkForm.ts +0 -0
- /package/dist/v3/{NetworkList → DevTool/components/NetworkList}/utils.ts +0 -0
- /package/dist/v3/{Performance → DevTool/components/Performance}/modules/PerformanceMetrics.vue +0 -0
- /package/dist/v3/{SettingButton → DevTool/components/SettingButton}/index.vue +0 -0
- /package/dist/v3/{SettingList → DevTool/components/SettingList}/index.css +0 -0
- /package/dist/v3/{SettingList → DevTool/components/SettingList}/typing.d.ts +0 -0
- /package/dist/v3/{AutoSizer → components/AutoSizer}/index.vue +0 -0
- /package/dist/v3/{AutoSizer → components/AutoSizer}/index1.vue +0 -0
- /package/dist/v3/{AutoSizer → components/AutoSizer}/utils.ts +0 -0
- /package/dist/v3/{CircularButton → components/CircularButton}/index.vue +0 -0
- /package/dist/v3/{CustomSwiper → components/CustomSwiper}/CustomSwiperItem.vue +0 -0
- /package/dist/v3/{CustomSwiper → components/CustomSwiper}/index.vue +0 -0
- /package/dist/v3/{Empty → components/Empty}/empty.png +0 -0
- /package/dist/v3/{Empty → components/Empty}/index.vue +0 -0
- /package/dist/v3/{FilterSelect → components/FilterSelect}/index.vue +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/components/Brackets/index.vue +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/components/Carets/index.vue +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useClipboard.ts +0 -0
- /package/dist/v3/{JsonPretty → components/JsonPretty}/hooks/useError.ts +0 -0
- /package/dist/v3/{Tag → components/Tag}/index.vue +0 -0
- /package/dist/v3/{VirtualList → components/VirtualList}/readme.md +0 -0
|
@@ -1,49 +1,6 @@
|
|
|
1
|
-
/** 行前空格匹配 */
|
|
2
|
-
const startSpaceReg = /^(\s*)/;
|
|
3
|
-
|
|
4
|
-
/** 括号 */
|
|
5
|
-
const bracketList = ['<', '>', '(', ')', '{', '}', '[', ']'];
|
|
6
|
-
|
|
7
|
-
/** 引号 */
|
|
8
|
-
const quotationList = ["'", '"', '‘', '’', '`'];
|
|
9
|
-
|
|
10
1
|
/** 操作符 */
|
|
11
2
|
const operatorList = ['+', '-', '*', '/', '%', '=', '!', '&'];
|
|
12
3
|
|
|
13
|
-
/** 符号 */
|
|
14
|
-
const symbolList = [
|
|
15
|
-
' ',
|
|
16
|
-
'<',
|
|
17
|
-
'>',
|
|
18
|
-
'(',
|
|
19
|
-
')',
|
|
20
|
-
'{',
|
|
21
|
-
'}',
|
|
22
|
-
'[',
|
|
23
|
-
']',
|
|
24
|
-
';',
|
|
25
|
-
':',
|
|
26
|
-
',',
|
|
27
|
-
'.',
|
|
28
|
-
'=',
|
|
29
|
-
'?',
|
|
30
|
-
'+',
|
|
31
|
-
'-',
|
|
32
|
-
'*',
|
|
33
|
-
'/',
|
|
34
|
-
'\\',
|
|
35
|
-
"'",
|
|
36
|
-
'"',
|
|
37
|
-
'@',
|
|
38
|
-
'#',
|
|
39
|
-
'$',
|
|
40
|
-
'!',
|
|
41
|
-
'&',
|
|
42
|
-
'|',
|
|
43
|
-
'^',
|
|
44
|
-
'%',
|
|
45
|
-
];
|
|
46
|
-
|
|
47
4
|
/** 关键字 */
|
|
48
5
|
const keywordList = [
|
|
49
6
|
// JavaScript 关键字
|
|
@@ -466,202 +423,137 @@ function getLineIndexType(
|
|
|
466
423
|
}
|
|
467
424
|
|
|
468
425
|
/**
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
* TODO: 属性 , 方法
|
|
472
|
-
*
|
|
473
|
-
* @param {string[]} words
|
|
474
|
-
* @return {*} {Word[]}
|
|
426
|
+
* 将整行代码字符串分词,带有更精细的词法分析,大大减少DOM元素数量
|
|
475
427
|
*/
|
|
476
|
-
function
|
|
477
|
-
let
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
428
|
+
function tokenizeLine(lineStr: string): Word[] {
|
|
429
|
+
let remain = lineStr;
|
|
430
|
+
const words: Word[] = [];
|
|
431
|
+
let prevWord = '';
|
|
432
|
+
|
|
433
|
+
while (remain.length > 0) {
|
|
434
|
+
let match;
|
|
435
|
+
|
|
436
|
+
// Space
|
|
437
|
+
match = remain.match(/^(\s+)/);
|
|
438
|
+
if (match) {
|
|
439
|
+
// Use different class for inline spaces to prevent indent lines appearing in middle of code
|
|
440
|
+
words.push({
|
|
441
|
+
word: match[0],
|
|
484
442
|
type: 'space',
|
|
485
|
-
class: `${preClass}-space`,
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
// 箭头函数
|
|
490
|
-
const isArrow =
|
|
491
|
-
(w === '=' && words?.[index + 1] === '>') ||
|
|
492
|
-
(w === '>' && words?.[index - 1] === '=');
|
|
493
|
-
if (isArrow) {
|
|
494
|
-
return {
|
|
495
|
-
word: w,
|
|
496
|
-
type: 'keyword',
|
|
497
|
-
class: `${preClass}-keyword`,
|
|
498
|
-
};
|
|
443
|
+
class: `${preClass}-space-inline`,
|
|
444
|
+
});
|
|
445
|
+
remain = remain.slice(match[0].length);
|
|
446
|
+
continue;
|
|
499
447
|
}
|
|
500
448
|
|
|
501
|
-
//
|
|
502
|
-
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
class: `${preClass}-bracket`,
|
|
508
|
-
};
|
|
449
|
+
// Comment (inline)
|
|
450
|
+
match = remain.match(/^(\/\/.*)/);
|
|
451
|
+
if (match) {
|
|
452
|
+
words.push({ word: match[0], type: 'symbol', class: `${preClass}-note` });
|
|
453
|
+
remain = remain.slice(match[0].length);
|
|
454
|
+
continue;
|
|
509
455
|
}
|
|
510
456
|
|
|
511
|
-
//
|
|
512
|
-
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
type: 'quotation',
|
|
518
|
-
class: `${preClass}-quotation`,
|
|
519
|
-
};
|
|
457
|
+
// HTML Comment
|
|
458
|
+
match = remain.match(/^(<!--.*?-->|<!--.*|.*-->)/);
|
|
459
|
+
if (match) {
|
|
460
|
+
words.push({ word: match[0], type: 'symbol', class: `${preClass}-note` });
|
|
461
|
+
remain = remain.slice(match[0].length);
|
|
462
|
+
continue;
|
|
520
463
|
}
|
|
521
464
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
465
|
+
// Strings (with escapes)
|
|
466
|
+
match = remain.match(
|
|
467
|
+
/^("[^"\\]*(\\.[^"\\]*)*"|'[^'\\]*(\\.[^'\\]*)*'|`[^`\\]*(\\.[^`\\]*)*`)/,
|
|
468
|
+
);
|
|
469
|
+
if (match) {
|
|
470
|
+
words.push({
|
|
471
|
+
word: match[0],
|
|
525
472
|
type: 'string',
|
|
526
473
|
class: `${preClass}-string`,
|
|
527
|
-
};
|
|
474
|
+
});
|
|
475
|
+
remain = remain.slice(match[0].length);
|
|
476
|
+
prevWord = '""';
|
|
477
|
+
continue;
|
|
528
478
|
}
|
|
529
479
|
|
|
530
|
-
//
|
|
531
|
-
|
|
532
|
-
if (
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
480
|
+
// Identifiers & Keywords
|
|
481
|
+
match = remain.match(/^[a-zA-Z_$@][a-zA-Z0-9_$-]*/);
|
|
482
|
+
if (match) {
|
|
483
|
+
const word = match[0];
|
|
484
|
+
let type: Word['type'] = 'other';
|
|
485
|
+
let cls = `${preClass}-other`;
|
|
486
|
+
|
|
487
|
+
const nextCharMatch = remain.slice(word.length).match(/^\s*(.)/);
|
|
488
|
+
const nextChar = nextCharMatch ? nextCharMatch[1] : '';
|
|
489
|
+
|
|
490
|
+
if (keywordList.includes(word)) {
|
|
491
|
+
type = 'keyword';
|
|
492
|
+
cls = `${preClass}-keyword`;
|
|
493
|
+
} else if (builtInList.includes(word)) {
|
|
494
|
+
type = 'builtin';
|
|
495
|
+
cls = `${preClass}-builtin`;
|
|
496
|
+
} else if (prevWord === '.') {
|
|
497
|
+
type = 'attribute';
|
|
498
|
+
cls = `${preClass}-attribute`;
|
|
499
|
+
} else if (prevWord === '<' || prevWord === '</') {
|
|
500
|
+
type = 'keyword';
|
|
501
|
+
cls = `${preClass}-keyword`; // Tag name
|
|
502
|
+
} else if (nextChar === '(') {
|
|
503
|
+
type = 'function';
|
|
504
|
+
cls = `${preClass}-function`;
|
|
505
|
+
} else if (word.startsWith('v-') || word.startsWith('@')) {
|
|
506
|
+
type = 'keyword';
|
|
507
|
+
cls = `${preClass}-keyword`; // Vue directives
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
words.push({ word, type, class: cls });
|
|
511
|
+
prevWord = word;
|
|
512
|
+
remain = remain.slice(word.length);
|
|
513
|
+
continue;
|
|
538
514
|
}
|
|
539
515
|
|
|
540
|
-
//
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
516
|
+
// Numbers
|
|
517
|
+
match = remain.match(
|
|
518
|
+
/^(0[xX][0-9a-fA-F]+|\d*\.\d+([eE][+-]?\d+)?|\d+([eE][+-]?\d+)?|\d+n)/,
|
|
519
|
+
);
|
|
520
|
+
if (match) {
|
|
521
|
+
words.push({
|
|
522
|
+
word: match[0],
|
|
546
523
|
type: 'number',
|
|
547
524
|
class: `${preClass}-number`,
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
const isFunc =
|
|
553
|
-
(words?.[index - 1] === ' ' && words?.[index - 2] === 'function') ||
|
|
554
|
-
words?.[index + 1] === '(' ||
|
|
555
|
-
(words?.[index + 1] === ' ' && words?.[index + 2] === '(');
|
|
556
|
-
if (isFunc && !keywordList.includes(w)) {
|
|
557
|
-
return {
|
|
558
|
-
word: w,
|
|
559
|
-
type: 'function',
|
|
560
|
-
class: `${preClass}-function`,
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// 属性提取
|
|
565
|
-
const preW = symbolList.includes(words?.[index - 1]);
|
|
566
|
-
const isAttribute =
|
|
567
|
-
(words?.[index + 1] === '.' || (words?.[index - 1] === '.' && !preW)) &&
|
|
568
|
-
!isNumber;
|
|
569
|
-
if (isAttribute) {
|
|
570
|
-
return {
|
|
571
|
-
word: w,
|
|
572
|
-
type: 'attribute',
|
|
573
|
-
class: `${preClass}-attribute`,
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
// 关键字
|
|
578
|
-
const isKeyword = keywordList.includes(w);
|
|
579
|
-
if (isKeyword) {
|
|
580
|
-
return {
|
|
581
|
-
word: w,
|
|
582
|
-
type: 'keyword',
|
|
583
|
-
class: `${preClass}-keyword`,
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// 内置对象
|
|
588
|
-
const isBuiltin = builtInList.includes(w);
|
|
589
|
-
if (isBuiltin) {
|
|
590
|
-
return {
|
|
591
|
-
word: w,
|
|
592
|
-
type: 'builtin',
|
|
593
|
-
class: `${preClass}-builtin`,
|
|
594
|
-
};
|
|
525
|
+
});
|
|
526
|
+
remain = remain.slice(match[0].length);
|
|
527
|
+
prevWord = '0';
|
|
528
|
+
continue;
|
|
595
529
|
}
|
|
596
530
|
|
|
597
|
-
//
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
605
|
-
|
|
531
|
+
// Multi-char symbols and Operators
|
|
532
|
+
match = remain.match(
|
|
533
|
+
/^(===|!==|==|!=|>=|<=|=>|\+\+|--|\+=|-=|\*=|\/=|\|\||&&|\?\.|<\/?|\/>|[{}()[\].,;:?+*/%&|^!=<>~#\\@])/,
|
|
534
|
+
);
|
|
535
|
+
if (match) {
|
|
536
|
+
const word = match[0];
|
|
537
|
+
let cls = `${preClass}-symbol`;
|
|
538
|
+
if (['<', '>', '(', ')', '{', '}', '[', ']'].includes(word[0])) {
|
|
539
|
+
cls = `${preClass}-bracket`;
|
|
540
|
+
} else if (operatorList.includes(word[0]) || word.length > 1) {
|
|
541
|
+
cls = `${preClass}-operator`;
|
|
542
|
+
}
|
|
606
543
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
word: w,
|
|
612
|
-
type: 'symbol',
|
|
613
|
-
class: `${preClass}-symbol`,
|
|
614
|
-
};
|
|
544
|
+
words.push({ word, type: 'symbol', class: cls });
|
|
545
|
+
prevWord = word;
|
|
546
|
+
remain = remain.slice(word.length);
|
|
547
|
+
continue;
|
|
615
548
|
}
|
|
616
549
|
|
|
617
|
-
//
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
};
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* 按符号列表分割字符串
|
|
628
|
-
* @param lineTrim 需要分割的字符串
|
|
629
|
-
* @param symbols 符号列表
|
|
630
|
-
* @returns 分割后的词元数组
|
|
631
|
-
/**
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
* @param {string} lineTrim
|
|
635
|
-
* @param {string[]} symbols
|
|
636
|
-
* @return {*} {string[]}
|
|
637
|
-
*/
|
|
638
|
-
function splitBySymbols(lineTrim: string, symbols: string[]): string[] {
|
|
639
|
-
if (!lineTrim) return [];
|
|
640
|
-
|
|
641
|
-
// 跳过注释行的处理
|
|
642
|
-
if (
|
|
643
|
-
lineTrim.startsWith('/*') ||
|
|
644
|
-
lineTrim.startsWith('*') ||
|
|
645
|
-
lineTrim.startsWith('//') ||
|
|
646
|
-
lineTrim.startsWith('<!--') ||
|
|
647
|
-
lineTrim.startsWith('-->') ||
|
|
648
|
-
lineTrim.length > 5000
|
|
649
|
-
) {
|
|
650
|
-
return [lineTrim];
|
|
550
|
+
// Fallback one char
|
|
551
|
+
const word = remain[0];
|
|
552
|
+
words.push({ word, type: 'other', class: `${preClass}-other` });
|
|
553
|
+
prevWord = word;
|
|
554
|
+
remain = remain.slice(1);
|
|
651
555
|
}
|
|
652
|
-
|
|
653
|
-
// 转义特殊字符并构建正则表达式
|
|
654
|
-
const escapedSymbols = symbols.map((s) =>
|
|
655
|
-
s.replace(/[.*+?^${}()|[\]\\@$]/g, '\\$&'),
|
|
656
|
-
);
|
|
657
|
-
const regexPattern = `(${escapedSymbols.join('|')})`;
|
|
658
|
-
const regex = new RegExp(regexPattern, 'g');
|
|
659
|
-
|
|
660
|
-
// 使用正则表达式分割字符串并保留分隔符
|
|
661
|
-
const parts = lineTrim.split(regex);
|
|
662
|
-
|
|
663
|
-
// 过滤掉空字符串并返回结果
|
|
664
|
-
return parts.filter((part) => part !== '');
|
|
556
|
+
return words;
|
|
665
557
|
}
|
|
666
558
|
|
|
667
559
|
export function parseCode(code: string): LineInfo[] {
|
|
@@ -672,13 +564,7 @@ export function parseCode(code: string): LineInfo[] {
|
|
|
672
564
|
getTagStartAndEndRow(lines);
|
|
673
565
|
|
|
674
566
|
const parseLine = lines.map((line, index) => {
|
|
675
|
-
// 解析行之前的空格
|
|
676
|
-
const space =
|
|
677
|
-
line?.length < 500
|
|
678
|
-
? (line.match(startSpaceReg)?.[1] || '')?.split('')
|
|
679
|
-
: [];
|
|
680
567
|
// 获取行类型
|
|
681
|
-
|
|
682
568
|
const type = getLineIndexType(index, {
|
|
683
569
|
tagRanges,
|
|
684
570
|
scriptRanges,
|
|
@@ -686,12 +572,34 @@ export function parseCode(code: string): LineInfo[] {
|
|
|
686
572
|
noteRanges,
|
|
687
573
|
});
|
|
688
574
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
const
|
|
575
|
+
// 解析行之前的空格,为了保证准确的缩进格式
|
|
576
|
+
const spaceMatch = line.match(/^(\s*)/);
|
|
577
|
+
const spacePrefix = spaceMatch ? spaceMatch[0] : '';
|
|
578
|
+
const lineTrim = line.slice(spacePrefix.length);
|
|
579
|
+
|
|
580
|
+
const words: Word[] = [];
|
|
581
|
+
if (spacePrefix) {
|
|
582
|
+
// Chunk spaces by 2 to add indentation guide lines
|
|
583
|
+
for (let i = 0; i < spacePrefix.length; i += 2) {
|
|
584
|
+
words.push({
|
|
585
|
+
word: spacePrefix.slice(i, i + 2),
|
|
586
|
+
type: 'space',
|
|
587
|
+
class: `${preClass}-space`,
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
693
591
|
|
|
694
|
-
|
|
592
|
+
if (type === 'note') {
|
|
593
|
+
if (lineTrim) {
|
|
594
|
+
words.push({
|
|
595
|
+
word: lineTrim,
|
|
596
|
+
type: 'symbol',
|
|
597
|
+
class: `${preClass}-note`,
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
} else {
|
|
601
|
+
words.push(...tokenizeLine(lineTrim));
|
|
602
|
+
}
|
|
695
603
|
|
|
696
604
|
const lineInfo: LineInfo = { type, words, class: `${preClass}-${type}` };
|
|
697
605
|
return lineInfo;
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
</view>
|
|
47
47
|
</template>
|
|
48
48
|
<script lang="ts" setup>
|
|
49
|
-
import Tag from '
|
|
50
|
-
import JsonPretty from '
|
|
51
|
-
import Empty from '
|
|
52
|
-
import CircularButton from '
|
|
53
|
-
import FilterInput from '
|
|
54
|
-
import type { DevTool } from '
|
|
49
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
50
|
+
import JsonPretty from '../../../components/JsonPretty/index.vue';
|
|
51
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
52
|
+
import CircularButton from '../../../components/CircularButton/index.vue';
|
|
53
|
+
import FilterInput from '../../../components/FilterInput/index.vue';
|
|
54
|
+
import type { DevTool } from '../../../../type';
|
|
55
55
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
56
|
-
import { useI18n } from '
|
|
56
|
+
import { useI18n } from '../../../../i18n';
|
|
57
57
|
import { computed } from 'vue';
|
|
58
58
|
|
|
59
59
|
const { t } = useI18n();
|
|
@@ -104,13 +104,13 @@
|
|
|
104
104
|
</template>
|
|
105
105
|
<script lang="ts" setup>
|
|
106
106
|
import { ref, computed } from 'vue';
|
|
107
|
-
import JsonPretty from '
|
|
108
|
-
import Tag from '
|
|
109
|
-
import Empty from '
|
|
110
|
-
import CircularButton from '
|
|
107
|
+
import JsonPretty from '../../../components/JsonPretty/index.vue';
|
|
108
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
109
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
110
|
+
import CircularButton from '../../../components/CircularButton/index.vue';
|
|
111
111
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
112
|
-
import type { DevTool } from '
|
|
113
|
-
import { useI18n } from '
|
|
112
|
+
import type { DevTool } from '../../../../type';
|
|
113
|
+
import { useI18n } from '../../../../i18n';
|
|
114
114
|
|
|
115
115
|
const { t } = useI18n();
|
|
116
116
|
const props = defineProps<{
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
|
|
55
55
|
<script lang="ts" setup>
|
|
56
56
|
import { computed } from 'vue';
|
|
57
|
-
import Tag from '
|
|
58
|
-
import { formatDate, isMockWX } from '
|
|
59
|
-
import type { DevTool } from '
|
|
60
|
-
import { useI18n } from '
|
|
57
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
58
|
+
import { formatDate, isMockWX } from '../../../../utils';
|
|
59
|
+
import type { DevTool } from '../../../../type';
|
|
60
|
+
import { useI18n } from '../../../../i18n';
|
|
61
61
|
|
|
62
62
|
const { t } = useI18n();
|
|
63
63
|
const props = defineProps<{
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
</template>
|
|
57
57
|
<script lang="ts" setup>
|
|
58
58
|
import { computed } from 'vue';
|
|
59
|
-
import Tag from '
|
|
59
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
60
60
|
import TransferItem from './TransferItem.vue';
|
|
61
|
-
import Empty from '
|
|
62
|
-
import FilterInput from '
|
|
63
|
-
import Pick from '
|
|
64
|
-
import type { DevTool } from '
|
|
65
|
-
import VirtualList from '
|
|
66
|
-
import AutoSize from '
|
|
61
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
62
|
+
import FilterInput from '../../../components/FilterInput/index.vue';
|
|
63
|
+
import Pick from '../../../components/Pick/index.vue';
|
|
64
|
+
import type { DevTool } from '../../../../type';
|
|
65
|
+
import VirtualList from '../../../components/VirtualList/index.vue';
|
|
66
|
+
import AutoSize from '../../../components/VirtualList/AutoSize.vue';
|
|
67
67
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
68
|
-
import { useI18n } from '
|
|
68
|
+
import { useI18n } from '../../../../i18n';
|
|
69
69
|
|
|
70
70
|
const { t } = useI18n();
|
|
71
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="uni-event-item">
|
|
3
|
-
<view class="uni-event-item-row">
|
|
3
|
+
<view class="uni-event-item-row">{{ eventItem.eventName }}</view>
|
|
4
4
|
<view class="uni-event-item-row">
|
|
5
5
|
<Tag mode="info" v-if="eventItem.type == 'on'">
|
|
6
6
|
{{ eventItem.type }}
|
|
@@ -14,22 +14,21 @@
|
|
|
14
14
|
<Tag mode="error" v-if="eventItem.type == 'off'">
|
|
15
15
|
{{ eventItem.type }}
|
|
16
16
|
</Tag>
|
|
17
|
-
<view class="uni-event-item-right">
|
|
17
|
+
<view class="uni-event-item-right">{{ eventItem.timer }}</view>
|
|
18
18
|
</view>
|
|
19
19
|
|
|
20
20
|
<view
|
|
21
21
|
:class="`uni-event-item-right ${isUseDevSource ? 'link' : ''}`"
|
|
22
|
-
@click="emit('openCode', eventItem.stack)"
|
|
23
|
-
>
|
|
22
|
+
@click="emit('openCode', eventItem.stack)">
|
|
24
23
|
{{ eventItem.stack }}
|
|
25
24
|
</view>
|
|
26
25
|
</view>
|
|
27
26
|
</template>
|
|
28
27
|
<script lang="ts" setup>
|
|
29
|
-
import Tag from '
|
|
30
|
-
import type { DevTool } from '
|
|
28
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
29
|
+
import type { DevTool } from '../../../../type';
|
|
31
30
|
import { computed } from 'vue';
|
|
32
|
-
import { isMockWX } from '
|
|
31
|
+
import { isMockWX } from '../../../../utils';
|
|
33
32
|
|
|
34
33
|
const props = defineProps<{
|
|
35
34
|
eventItem: DevTool.UniEventItem;
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
<script lang="ts" setup>
|
|
85
85
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
86
86
|
import UniEventItem from './UniEventItem.vue';
|
|
87
|
-
import Tag from '
|
|
88
|
-
import Empty from '
|
|
89
|
-
import VirtualList from '
|
|
90
|
-
import AutoSize from '
|
|
91
|
-
import type { DevTool } from '
|
|
92
|
-
import { useI18n } from '
|
|
87
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
88
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
89
|
+
import VirtualList from '../../../components/VirtualList/index.vue';
|
|
90
|
+
import AutoSize from '../../../components/VirtualList/AutoSize.vue';
|
|
91
|
+
import type { DevTool } from '../../../../type';
|
|
92
|
+
import { useI18n } from '../../../../i18n';
|
|
93
93
|
|
|
94
94
|
const { t } = useI18n();
|
|
95
95
|
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
</template>
|
|
24
24
|
<script lang="ts" setup>
|
|
25
25
|
import { computed } from 'vue';
|
|
26
|
-
import JsonPretty from '
|
|
27
|
-
import Empty from '
|
|
26
|
+
import JsonPretty from '../../../components/JsonPretty/index.vue';
|
|
27
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
28
28
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
29
|
-
import { useI18n } from '
|
|
29
|
+
import { useI18n } from '../../../../i18n';
|
|
30
30
|
|
|
31
31
|
const { t } = useI18n();
|
|
32
32
|
const props = defineProps<{
|
|
@@ -114,16 +114,16 @@
|
|
|
114
114
|
</template>
|
|
115
115
|
<script setup lang="ts">
|
|
116
116
|
import { ref, computed, watch } from 'vue';
|
|
117
|
-
import Tag from '
|
|
118
|
-
import CircularButton from '
|
|
117
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
118
|
+
import CircularButton from '../../../components/CircularButton/index.vue';
|
|
119
119
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
120
|
-
import Empty from '
|
|
121
|
-
import { formatDate } from '
|
|
122
|
-
import type { DevTool } from '
|
|
123
|
-
import { useI18n } from '
|
|
120
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
121
|
+
import { formatDate } from '../../../../utils/index';
|
|
122
|
+
import type { DevTool } from '../../../../type';
|
|
123
|
+
import { useI18n } from '../../../../i18n';
|
|
124
124
|
import SettingButton from '../SettingButton/index.vue';
|
|
125
|
-
import VirtualList from '
|
|
126
|
-
import AutoSize from '
|
|
125
|
+
import VirtualList from '../../../components/VirtualList/index.vue';
|
|
126
|
+
import AutoSize from '../../../components/VirtualList/AutoSize.vue';
|
|
127
127
|
|
|
128
128
|
const { t } = useI18n();
|
|
129
129
|
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
</view>
|
|
38
38
|
</template>
|
|
39
39
|
<script lang="ts" setup>
|
|
40
|
-
import Tag from '
|
|
41
|
-
import { formatDate } from '
|
|
42
|
-
import type { DevTool } from '
|
|
43
|
-
import { useI18n } from '
|
|
40
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
41
|
+
import { formatDate } from '../../../../utils';
|
|
42
|
+
import type { DevTool } from '../../../../type';
|
|
43
|
+
import { useI18n } from '../../../../i18n';
|
|
44
44
|
|
|
45
45
|
const { t } = useI18n();
|
|
46
46
|
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
<script lang="ts" setup>
|
|
44
44
|
import { computed } from 'vue';
|
|
45
45
|
import WebSocketItem from './WebSocketItem.vue';
|
|
46
|
-
import Tag from '
|
|
47
|
-
import Empty from '
|
|
48
|
-
import FilterInput from '
|
|
49
|
-
import Pick from '
|
|
50
|
-
import type { DevTool } from '
|
|
51
|
-
import VirtualList from '
|
|
52
|
-
import AutoSize from '
|
|
46
|
+
import Tag from '../../../components/Tag/index.vue';
|
|
47
|
+
import Empty from '../../../components/Empty/index.vue';
|
|
48
|
+
import FilterInput from '../../../components/FilterInput/index.vue';
|
|
49
|
+
import Pick from '../../../components/Pick/index.vue'; // Changed from FilterSelect to Pick
|
|
50
|
+
import type { DevTool } from '../../../../type';
|
|
51
|
+
import VirtualList from '../../../components/VirtualList/index.vue';
|
|
52
|
+
import AutoSize from '../../../components/VirtualList/AutoSize.vue';
|
|
53
53
|
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
54
|
-
import { useI18n } from '
|
|
54
|
+
import { useI18n } from '../../../../i18n';
|
|
55
55
|
|
|
56
56
|
const { t } = useI18n();
|
|
57
57
|
|