king-design-analyzer 2.1.9 → 2.2.1
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/components/actions.json +109 -0
- package/components/advancedset.json +128 -0
- package/components/affix.json +8 -0
- package/components/aksk.json +172 -0
- package/components/anchor.json +220 -0
- package/components/anchorlink.json +111 -0
- package/components/az.json +15 -2
- package/components/badge.json +8 -0
- package/components/billtypes.json +14 -2
- package/components/breadcrumb.json +9 -1
- package/components/button.json +192 -0
- package/components/buttonlink.json +74 -0
- package/components/card.json +14 -4
- package/components/cardcol.json +142 -0
- package/components/cardcols.json +121 -0
- package/components/cardcontent.json +20 -3
- package/components/cardtabs.json +172 -0
- package/components/carousel.json +7 -0
- package/components/cascader.json +576 -368
- package/components/checkbox.json +51 -4
- package/components/cidrinput.json +140 -0
- package/components/code.json +8 -1
- package/components/collapse.json +335 -341
- package/components/colorpicker.json +217 -0
- package/components/configprovider.json +96 -0
- package/components/copy.json +7 -0
- package/components/copyhover.json +111 -0
- package/components/copyrow.json +125 -0
- package/components/datepicker.json +656 -524
- package/components/description.json +98 -0
- package/components/descriptions.json +10 -3
- package/components/diagram.json +295 -0
- package/components/dialog.json +526 -455
- package/components/divider.json +9 -1
- package/components/drawer.json +603 -558
- package/components/dropdown.json +464 -384
- package/components/duration.json +125 -0
- package/components/editable.json +66 -0
- package/components/ellipsis.json +34 -1
- package/components/filtertablefieldsdialog.json +128 -0
- package/components/flex.json +152 -0
- package/components/form.json +143 -3
- package/components/formiteminput.json +214 -0
- package/components/formitemspinner.json +213 -0
- package/components/formitemswitch.json +185 -0
- package/components/formitemtableconfigs.json +210 -0
- package/components/grid.json +7 -0
- package/components/header.json +165 -0
- package/components/icon.json +13 -1
- package/components/icontooltip.json +19 -1
- package/components/input.json +196 -8
- package/components/instancelist.json +194 -0
- package/components/instancenum.json +196 -0
- package/components/ipinput.json +117 -0
- package/components/kspstatus.json +205 -0
- package/components/kvcode.json +120 -0
- package/components/layoutcontent.json +24 -3
- package/components/layoutlistcontent.json +157 -0
- package/components/layoutpermissioncontent.json +156 -0
- package/components/layoutstandardlist.json +276 -0
- package/components/layouttabs.json +168 -0
- package/components/lazymount.json +87 -0
- package/components/lazyteleport.json +119 -0
- package/components/menu.json +11 -3
- package/components/notification.json +351 -0
- package/components/pagination.json +12 -0
- package/components/paginationplus.json +30 -3
- package/components/password.json +121 -0
- package/components/popover.json +457 -437
- package/components/projects.json +129 -0
- package/components/protable.json +99 -8
- package/components/queuevisualrange.json +110 -0
- package/components/radio.json +82 -2
- package/components/rate.json +200 -0
- package/components/region.json +14 -2
- package/components/scrollselect.json +140 -0
- package/components/search.json +221 -0
- package/components/searchinput.json +132 -0
- package/components/searchitems.json +215 -0
- package/components/searchselect.json +195 -0
- package/components/select.json +749 -666
- package/components/sidebar.json +198 -0
- package/components/skeleton.json +234 -0
- package/components/slider.json +12 -2
- package/components/spin.json +10 -2
- package/components/spinner.json +419 -429
- package/components/split.json +263 -0
- package/components/sshkeys.json +138 -0
- package/components/status.json +60 -3
- package/components/steps.json +7 -0
- package/components/switch.json +12 -3
- package/components/table.json +24 -2
- package/components/tablecolumnid.json +14 -2
- package/components/tabs.json +14 -2
- package/components/tag.json +8 -5
- package/components/timeline.json +215 -0
- package/components/timepicker.json +147 -3
- package/components/timerange.json +262 -0
- package/components/tip.json +27 -0
- package/components/tooltip.json +492 -395
- package/components/tour.json +418 -372
- package/components/transfer.json +79 -8
- package/components/tree.json +28 -5
- package/components/treeselect.json +612 -475
- package/components/upload.json +474 -473
- package/components/vdialog.json +309 -0
- package/components/vdrawer.json +335 -0
- package/components/virtuallist.json +7 -0
- package/dist/ast/index.d.mts +65 -2
- package/dist/ast/index.d.ts +65 -2
- package/dist/ast/index.js +4 -3
- package/dist/ast/index.mjs +2 -1
- package/dist/chunk-4OTQAQ6J.mjs +341 -0
- package/dist/{chunk-F26GUCGG.js → chunk-4WXOYU2N.js} +32 -9
- package/dist/chunk-6HOIRUQB.mjs +409 -0
- package/dist/chunk-DHLWNT53.js +364 -0
- package/dist/{chunk-H2ET6MMM.mjs → chunk-IPJJMPOO.mjs} +155 -66
- package/dist/{chunk-WYSRJVX4.js → chunk-JJ6AB4ZH.js} +2 -2
- package/dist/{chunk-2W6OCG2S.js → chunk-JNRGUR3O.js} +155 -67
- package/dist/chunk-KF5YBEM5.js +143 -0
- package/dist/{chunk-OJOHB64C.mjs → chunk-LRTDTFFQ.mjs} +28 -5
- package/dist/{chunk-DSWKLUIX.mjs → chunk-NZL6T22V.mjs} +1 -1
- package/dist/chunk-QC6VTSA3.mjs +117 -0
- package/dist/chunk-V5N65MRP.js +411 -0
- package/dist/full/index.d.mts +2 -0
- package/dist/full/index.d.ts +2 -0
- package/dist/full/index.js +7 -6
- package/dist/full/index.mjs +5 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -13
- package/dist/index.mjs +6 -5
- package/dist/metadata/index.d.mts +38 -3
- package/dist/metadata/index.d.ts +38 -3
- package/dist/metadata/index.js +26 -16
- package/dist/metadata/index.mjs +26 -15
- package/dist/resolve-BsLBxlBi.d.mts +24 -0
- package/dist/resolve-BsLBxlBi.d.ts +24 -0
- package/dist/runtime/index.d.mts +2 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/index.mjs +2 -2
- package/dist/shared/index.d.mts +10 -0
- package/dist/shared/index.d.ts +10 -0
- package/dist/shared/index.js +23 -0
- package/dist/shared/index.mjs +2 -0
- package/dist/static/index.js +5 -5
- package/dist/static/index.mjs +2 -2
- package/docs_for_llm/actions.doc.md +87 -0
- package/docs_for_llm/advancedset.doc.md +98 -0
- package/docs_for_llm/affix.doc.md +20 -7
- package/docs_for_llm/aksk.doc.md +111 -0
- package/docs_for_llm/anchor.doc.md +155 -0
- package/docs_for_llm/anchorlink.doc.md +75 -0
- package/docs_for_llm/az.doc.md +17 -11
- package/docs_for_llm/badge.doc.md +11 -5
- package/docs_for_llm/billtypes.doc.md +17 -11
- package/docs_for_llm/breadcrumb.doc.md +80 -4
- package/docs_for_llm/button.doc.md +91 -18
- package/docs_for_llm/buttonlink.doc.md +64 -0
- package/docs_for_llm/card.doc.md +58 -8
- package/docs_for_llm/cardcol.doc.md +78 -0
- package/docs_for_llm/cardcols.doc.md +84 -0
- package/docs_for_llm/cardcontent.doc.md +31 -10
- package/docs_for_llm/cardtabs.doc.md +106 -0
- package/docs_for_llm/carousel.doc.md +79 -7
- package/docs_for_llm/cascader.doc.md +106 -23
- package/docs_for_llm/checkbox.doc.md +25 -13
- package/docs_for_llm/cidrinput.doc.md +83 -0
- package/docs_for_llm/code.doc.md +22 -11
- package/docs_for_llm/collapse.doc.md +147 -14
- package/docs_for_llm/colorpicker.doc.md +104 -0
- package/docs_for_llm/configprovider.doc.md +77 -0
- package/docs_for_llm/copy.doc.md +15 -13
- package/docs_for_llm/copyhover.doc.md +59 -0
- package/docs_for_llm/copyrow.doc.md +80 -0
- package/docs_for_llm/datepicker.doc.md +66 -35
- package/docs_for_llm/description.doc.md +75 -0
- package/docs_for_llm/descriptions.doc.md +122 -10
- package/docs_for_llm/diagram.doc.md +343 -0
- package/docs_for_llm/dialog.doc.md +97 -77
- package/docs_for_llm/divider.doc.md +14 -7
- package/docs_for_llm/drawer.doc.md +114 -69
- package/docs_for_llm/dropdown.doc.md +290 -22
- package/docs_for_llm/duration.doc.md +76 -0
- package/docs_for_llm/editable.doc.md +36 -14
- package/docs_for_llm/ellipsis.doc.md +10 -5
- package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
- package/docs_for_llm/flex.doc.md +83 -0
- package/docs_for_llm/form.doc.md +196 -18
- package/docs_for_llm/formiteminput.doc.md +128 -0
- package/docs_for_llm/formitemspinner.doc.md +105 -0
- package/docs_for_llm/formitemswitch.doc.md +113 -0
- package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
- package/docs_for_llm/grid.doc.md +78 -5
- package/docs_for_llm/header.doc.md +114 -0
- package/docs_for_llm/icon.doc.md +12 -8
- package/docs_for_llm/icontooltip.doc.md +121 -0
- package/docs_for_llm/input.doc.md +199 -41
- package/docs_for_llm/instancelist.doc.md +113 -0
- package/docs_for_llm/instancenum.doc.md +95 -0
- package/docs_for_llm/ipinput.doc.md +77 -0
- package/docs_for_llm/kspstatus.doc.md +82 -0
- package/docs_for_llm/kvcode.doc.md +76 -0
- package/docs_for_llm/layoutcontent.doc.md +54 -17
- package/docs_for_llm/layoutlistcontent.doc.md +168 -0
- package/docs_for_llm/layoutpermissioncontent.doc.md +93 -0
- package/docs_for_llm/layoutstandardlist.doc.md +129 -0
- package/docs_for_llm/layouttabs.doc.md +101 -0
- package/docs_for_llm/lazymount.doc.md +82 -0
- package/docs_for_llm/lazyteleport.doc.md +85 -0
- package/docs_for_llm/menu.doc.md +139 -14
- package/docs_for_llm/message.doc.md +93 -10
- package/docs_for_llm/notification.doc.md +214 -0
- package/docs_for_llm/pagination.doc.md +30 -17
- package/docs_for_llm/paginationplus.doc.md +31 -10
- package/docs_for_llm/password.doc.md +86 -0
- package/docs_for_llm/popover.doc.md +24 -55
- package/docs_for_llm/progress.doc.md +13 -10
- package/docs_for_llm/projects.doc.md +91 -0
- package/docs_for_llm/protable.doc.md +98 -15
- package/docs_for_llm/queuevisualrange.doc.md +78 -0
- package/docs_for_llm/radio.doc.md +23 -8
- package/docs_for_llm/rate.doc.md +127 -0
- package/docs_for_llm/region.doc.md +25 -13
- package/docs_for_llm/scrollselect.doc.md +90 -0
- package/docs_for_llm/search.doc.md +120 -0
- package/docs_for_llm/searchinput.doc.md +111 -0
- package/docs_for_llm/searchitems.doc.md +116 -0
- package/docs_for_llm/searchselect.doc.md +126 -0
- package/docs_for_llm/select.doc.md +208 -49
- package/docs_for_llm/sidebar.doc.md +133 -0
- package/docs_for_llm/skeleton.doc.md +152 -0
- package/docs_for_llm/slider.doc.md +42 -22
- package/docs_for_llm/spin.doc.md +18 -6
- package/docs_for_llm/spinner.doc.md +28 -18
- package/docs_for_llm/split.doc.md +170 -0
- package/docs_for_llm/sshkeys.doc.md +88 -0
- package/docs_for_llm/status.doc.md +14 -9
- package/docs_for_llm/steps.doc.md +81 -7
- package/docs_for_llm/switch.doc.md +32 -16
- package/docs_for_llm/table.doc.md +317 -55
- package/docs_for_llm/tablecolumnid.doc.md +36 -16
- package/docs_for_llm/tabs.doc.md +117 -12
- package/docs_for_llm/tag.doc.md +167 -15
- package/docs_for_llm/timeline.doc.md +187 -0
- package/docs_for_llm/timepicker.doc.md +74 -36
- package/docs_for_llm/timerange.doc.md +157 -0
- package/docs_for_llm/tip.doc.md +50 -11
- package/docs_for_llm/tooltip.doc.md +99 -27
- package/docs_for_llm/tour.doc.md +125 -28
- package/docs_for_llm/transfer.doc.md +99 -33
- package/docs_for_llm/tree.doc.md +129 -24
- package/docs_for_llm/treeselect.doc.md +101 -44
- package/docs_for_llm/upload.doc.md +63 -32
- package/docs_for_llm/useCRUD.doc.md +49 -0
- package/docs_for_llm/useCountdown.doc.md +43 -0
- package/docs_for_llm/useDetail.doc.md +48 -0
- package/docs_for_llm/useDialog.doc.md +46 -0
- package/docs_for_llm/useEntity.doc.md +45 -0
- package/docs_for_llm/useEventListener.doc.md +44 -0
- package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
- package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
- package/docs_for_llm/useGetUserPermission.doc.md +43 -0
- package/docs_for_llm/useGroup.doc.md +48 -0
- package/docs_for_llm/useIdEntities.doc.md +48 -0
- package/docs_for_llm/useIdEntity.doc.md +103 -0
- package/docs_for_llm/useInterval.doc.md +43 -0
- package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
- package/docs_for_llm/useMessage.doc.md +46 -0
- package/docs_for_llm/useModifyCache.doc.md +37 -0
- package/docs_for_llm/useOpenDialog.doc.md +41 -0
- package/docs_for_llm/usePagination.doc.md +60 -0
- package/docs_for_llm/usePersist.doc.md +54 -0
- package/docs_for_llm/usePoll.doc.md +41 -0
- package/docs_for_llm/useRoutePlus.doc.md +34 -0
- package/docs_for_llm/useRouterPlus.doc.md +34 -0
- package/docs_for_llm/useSearch.doc.md +68 -0
- package/docs_for_llm/useShell.doc.md +43 -0
- package/docs_for_llm/useSkip.doc.md +41 -0
- package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
- package/docs_for_llm/useStore.doc.md +34 -0
- package/docs_for_llm/useTable.doc.md +57 -0
- package/docs_for_llm/useTableGroup.doc.md +47 -0
- package/docs_for_llm/useTableSort.doc.md +40 -0
- package/docs_for_llm/useToState.doc.md +112 -0
- package/docs_for_llm/useUser.doc.md +38 -0
- package/docs_for_llm/useValidForm.doc.md +41 -0
- package/docs_for_llm/vdialog.doc.md +154 -0
- package/docs_for_llm/vdrawer.doc.md +148 -0
- package/docs_for_llm/virtuallist.doc.md +157 -3
- package/hooks/useCRUD.json +61 -0
- package/hooks/useCountdown.json +49 -0
- package/hooks/useDetail.json +67 -0
- package/hooks/useDialog.json +49 -0
- package/hooks/useEntity.json +61 -0
- package/hooks/useEventListener.json +61 -0
- package/hooks/useFalseUntilTruthy.json +43 -0
- package/hooks/useGetCopyAuthText.json +36 -0
- package/hooks/useGetUserPermission.json +55 -0
- package/hooks/useGroup.json +49 -0
- package/hooks/useIdEntities.json +61 -0
- package/hooks/useInterval.json +55 -0
- package/hooks/useLayoutStandardList.json +36 -0
- package/hooks/useMessage.json +73 -0
- package/hooks/useModifyCache.json +36 -0
- package/hooks/useOpenDialog.json +43 -0
- package/hooks/usePagination.json +49 -0
- package/hooks/usePersist.json +61 -0
- package/hooks/usePoll.json +43 -0
- package/hooks/useRoutePlus.json +36 -0
- package/hooks/useRouterPlus.json +36 -0
- package/hooks/useSearch.json +56 -0
- package/hooks/useShell.json +49 -0
- package/hooks/useSkip.json +43 -0
- package/hooks/useStorageIdEntity.json +67 -0
- package/hooks/useStore.json +36 -0
- package/hooks/useTable.json +49 -0
- package/hooks/useTableGroup.json +43 -0
- package/hooks/useTableSort.json +43 -0
- package/hooks/useUser.json +36 -0
- package/hooks/useValidForm.json +43 -0
- package/package.json +14 -8
- package/dist/chunk-D3Y6FGWA.js +0 -153
- package/dist/chunk-HPAUCD5I.js +0 -156
- package/dist/chunk-L4DS3EXI.mjs +0 -133
- package/dist/chunk-NZ6TLWMD.mjs +0 -151
package/dist/ast/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { C as ComponentInheritance } from '../resolve-BsLBxlBi.mjs';
|
|
2
|
+
|
|
1
3
|
interface RuleViolation {
|
|
2
4
|
rule: string;
|
|
3
5
|
match: string;
|
|
@@ -23,9 +25,35 @@ interface ComponentProp {
|
|
|
23
25
|
}
|
|
24
26
|
interface ComponentEvent {
|
|
25
27
|
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
vueEventName?: string;
|
|
30
|
+
params?: {
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
optional?: boolean;
|
|
35
|
+
default?: string;
|
|
36
|
+
}[];
|
|
37
|
+
payload?: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
optional?: boolean;
|
|
42
|
+
default?: string;
|
|
43
|
+
}[];
|
|
26
44
|
}
|
|
27
45
|
interface ComponentSlot {
|
|
28
46
|
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
vueTemplate?: string;
|
|
49
|
+
usageExample?: string;
|
|
50
|
+
bindingType?: 'array' | 'object' | 'single' | 'none';
|
|
51
|
+
slotProps?: {
|
|
52
|
+
name: string;
|
|
53
|
+
type?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
destructuringExample?: string;
|
|
56
|
+
}[];
|
|
29
57
|
}
|
|
30
58
|
interface MistakeEntry {
|
|
31
59
|
id: string;
|
|
@@ -34,22 +62,57 @@ interface MistakeEntry {
|
|
|
34
62
|
correctCode: string;
|
|
35
63
|
explanation: string;
|
|
36
64
|
}
|
|
65
|
+
interface ComponentSubComponent {
|
|
66
|
+
name: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
props?: ComponentProp[];
|
|
69
|
+
events?: ComponentEvent[];
|
|
70
|
+
slots?: ComponentSlot[];
|
|
71
|
+
methods?: {
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
params?: {
|
|
75
|
+
name: string;
|
|
76
|
+
type: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
optional?: boolean;
|
|
79
|
+
default?: string;
|
|
80
|
+
}[];
|
|
81
|
+
returnType?: string;
|
|
82
|
+
}[];
|
|
83
|
+
}
|
|
37
84
|
interface ComponentMetadata {
|
|
85
|
+
id?: string;
|
|
38
86
|
name: string;
|
|
39
87
|
props: ComponentProp[];
|
|
40
88
|
events: ComponentEvent[];
|
|
41
89
|
slots: ComponentSlot[];
|
|
42
|
-
|
|
90
|
+
methods?: {
|
|
91
|
+
name: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
params?: {
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
optional?: boolean;
|
|
98
|
+
default?: string;
|
|
99
|
+
}[];
|
|
100
|
+
returnType?: string;
|
|
101
|
+
}[];
|
|
102
|
+
subComponents?: ComponentSubComponent[];
|
|
43
103
|
commonMistakes?: MistakeEntry[];
|
|
44
104
|
importStatement?: string;
|
|
45
105
|
requiredParent?: string;
|
|
106
|
+
inherits?: ComponentInheritance[];
|
|
46
107
|
}
|
|
47
108
|
declare class ComponentRegistry {
|
|
48
109
|
private components;
|
|
49
110
|
private loaded;
|
|
50
111
|
private watcher;
|
|
51
112
|
private metadataPath;
|
|
52
|
-
load(
|
|
113
|
+
load(options?: {
|
|
114
|
+
watch?: boolean;
|
|
115
|
+
}): Promise<void>;
|
|
53
116
|
/**
|
|
54
117
|
* 重新加载所有组件元数据
|
|
55
118
|
*/
|
package/dist/ast/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { C as ComponentInheritance } from '../resolve-BsLBxlBi.js';
|
|
2
|
+
|
|
1
3
|
interface RuleViolation {
|
|
2
4
|
rule: string;
|
|
3
5
|
match: string;
|
|
@@ -23,9 +25,35 @@ interface ComponentProp {
|
|
|
23
25
|
}
|
|
24
26
|
interface ComponentEvent {
|
|
25
27
|
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
vueEventName?: string;
|
|
30
|
+
params?: {
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
optional?: boolean;
|
|
35
|
+
default?: string;
|
|
36
|
+
}[];
|
|
37
|
+
payload?: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
optional?: boolean;
|
|
42
|
+
default?: string;
|
|
43
|
+
}[];
|
|
26
44
|
}
|
|
27
45
|
interface ComponentSlot {
|
|
28
46
|
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
vueTemplate?: string;
|
|
49
|
+
usageExample?: string;
|
|
50
|
+
bindingType?: 'array' | 'object' | 'single' | 'none';
|
|
51
|
+
slotProps?: {
|
|
52
|
+
name: string;
|
|
53
|
+
type?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
destructuringExample?: string;
|
|
56
|
+
}[];
|
|
29
57
|
}
|
|
30
58
|
interface MistakeEntry {
|
|
31
59
|
id: string;
|
|
@@ -34,22 +62,57 @@ interface MistakeEntry {
|
|
|
34
62
|
correctCode: string;
|
|
35
63
|
explanation: string;
|
|
36
64
|
}
|
|
65
|
+
interface ComponentSubComponent {
|
|
66
|
+
name: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
props?: ComponentProp[];
|
|
69
|
+
events?: ComponentEvent[];
|
|
70
|
+
slots?: ComponentSlot[];
|
|
71
|
+
methods?: {
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
params?: {
|
|
75
|
+
name: string;
|
|
76
|
+
type: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
optional?: boolean;
|
|
79
|
+
default?: string;
|
|
80
|
+
}[];
|
|
81
|
+
returnType?: string;
|
|
82
|
+
}[];
|
|
83
|
+
}
|
|
37
84
|
interface ComponentMetadata {
|
|
85
|
+
id?: string;
|
|
38
86
|
name: string;
|
|
39
87
|
props: ComponentProp[];
|
|
40
88
|
events: ComponentEvent[];
|
|
41
89
|
slots: ComponentSlot[];
|
|
42
|
-
|
|
90
|
+
methods?: {
|
|
91
|
+
name: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
params?: {
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
optional?: boolean;
|
|
98
|
+
default?: string;
|
|
99
|
+
}[];
|
|
100
|
+
returnType?: string;
|
|
101
|
+
}[];
|
|
102
|
+
subComponents?: ComponentSubComponent[];
|
|
43
103
|
commonMistakes?: MistakeEntry[];
|
|
44
104
|
importStatement?: string;
|
|
45
105
|
requiredParent?: string;
|
|
106
|
+
inherits?: ComponentInheritance[];
|
|
46
107
|
}
|
|
47
108
|
declare class ComponentRegistry {
|
|
48
109
|
private components;
|
|
49
110
|
private loaded;
|
|
50
111
|
private watcher;
|
|
51
112
|
private metadataPath;
|
|
52
|
-
load(
|
|
113
|
+
load(options?: {
|
|
114
|
+
watch?: boolean;
|
|
115
|
+
}): Promise<void>;
|
|
53
116
|
/**
|
|
54
117
|
* 重新加载所有组件元数据
|
|
55
118
|
*/
|
package/dist/ast/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-YTEYDSDW.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkJNRGUR3O_js = require('../chunk-JNRGUR3O.js');
|
|
5
|
+
require('../chunk-KF5YBEM5.js');
|
|
5
6
|
require('../chunk-JSBRDJBE.js');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
Object.defineProperty(exports, "analyzeCodeWithAST", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkJNRGUR3O_js.analyzeCodeWithAST; }
|
|
12
13
|
});
|
|
13
14
|
Object.defineProperty(exports, "componentRegistry", {
|
|
14
15
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkJNRGUR3O_js.componentRegistry; }
|
|
16
17
|
});
|
package/dist/ast/index.mjs
CHANGED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { parse } from '@vue/compiler-sfc';
|
|
2
|
+
import { transform } from 'sucrase';
|
|
3
|
+
import * as ts from 'typescript';
|
|
4
|
+
|
|
5
|
+
// src/tools/sfcCompiler.ts
|
|
6
|
+
var ALLOWED_IMPORT_SOURCES = [
|
|
7
|
+
"vue",
|
|
8
|
+
"@vue/",
|
|
9
|
+
"vue-router",
|
|
10
|
+
"@king-design/vue",
|
|
11
|
+
"@ksyun-internal/versatile"
|
|
12
|
+
];
|
|
13
|
+
var VUE_RUNTIME_INJECTED_BINDINGS = /* @__PURE__ */ new Set([
|
|
14
|
+
"ref",
|
|
15
|
+
"reactive",
|
|
16
|
+
"computed",
|
|
17
|
+
"readonly",
|
|
18
|
+
"shallowRef",
|
|
19
|
+
"shallowReactive",
|
|
20
|
+
"toRef",
|
|
21
|
+
"toRefs",
|
|
22
|
+
"toRaw",
|
|
23
|
+
"markRaw",
|
|
24
|
+
"isRef",
|
|
25
|
+
"isReactive",
|
|
26
|
+
"isReadonly",
|
|
27
|
+
"isProxy",
|
|
28
|
+
"triggerRef",
|
|
29
|
+
"customRef",
|
|
30
|
+
"onMounted",
|
|
31
|
+
"onUnmounted",
|
|
32
|
+
"onBeforeMount",
|
|
33
|
+
"onBeforeUnmount",
|
|
34
|
+
"onUpdated",
|
|
35
|
+
"onBeforeUpdate",
|
|
36
|
+
"onActivated",
|
|
37
|
+
"onDeactivated",
|
|
38
|
+
"onErrorCaptured",
|
|
39
|
+
"watch",
|
|
40
|
+
"watchEffect",
|
|
41
|
+
"watchPostEffect",
|
|
42
|
+
"watchSyncEffect",
|
|
43
|
+
"defineProps",
|
|
44
|
+
"defineEmits",
|
|
45
|
+
"defineExpose",
|
|
46
|
+
"defineOptions",
|
|
47
|
+
"defineSlots",
|
|
48
|
+
"defineModel",
|
|
49
|
+
"withDefaults",
|
|
50
|
+
"useSlots",
|
|
51
|
+
"useAttrs",
|
|
52
|
+
"inject",
|
|
53
|
+
"provide",
|
|
54
|
+
"nextTick",
|
|
55
|
+
"getCurrentInstance",
|
|
56
|
+
"h",
|
|
57
|
+
"createVNode",
|
|
58
|
+
"resolveComponent"
|
|
59
|
+
]);
|
|
60
|
+
var VERSATILE_RUNTIME_INJECTED_BINDINGS = /* @__PURE__ */ new Set([
|
|
61
|
+
"useToState",
|
|
62
|
+
"useIdEntity"
|
|
63
|
+
]);
|
|
64
|
+
var INTERNAL_BINDING_PREFIXES = ["__imported_module_"];
|
|
65
|
+
function getRuntimeInjectedBindingsForSource(source) {
|
|
66
|
+
if (source === "vue" || source.startsWith("@vue/")) {
|
|
67
|
+
return VUE_RUNTIME_INJECTED_BINDINGS;
|
|
68
|
+
}
|
|
69
|
+
if (source === "vue-router") {
|
|
70
|
+
return /* @__PURE__ */ new Set([
|
|
71
|
+
"useRouter",
|
|
72
|
+
"useRoute",
|
|
73
|
+
"onBeforeRouteLeave",
|
|
74
|
+
"onBeforeRouteUpdate",
|
|
75
|
+
"RouterLink",
|
|
76
|
+
"RouterView"
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
if (source === "@ksyun-internal/versatile") {
|
|
80
|
+
return VERSATILE_RUNTIME_INJECTED_BINDINGS;
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */ new Set();
|
|
83
|
+
}
|
|
84
|
+
function normalizeNamedImportSpecifiers(specifiers) {
|
|
85
|
+
return specifiers.split(",").map((part) => part.trim()).filter(Boolean).map((part) => {
|
|
86
|
+
const aliasMatch = part.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
87
|
+
if (aliasMatch) {
|
|
88
|
+
return `${aliasMatch[1]}: ${aliasMatch[2]}`;
|
|
89
|
+
}
|
|
90
|
+
return part;
|
|
91
|
+
}).join(", ");
|
|
92
|
+
}
|
|
93
|
+
function shouldUseWhitelist(source, whitelist) {
|
|
94
|
+
return whitelist.some((allowedSource) => source === allowedSource || source.startsWith(`${allowedSource}/`));
|
|
95
|
+
}
|
|
96
|
+
function classifyImportSource(source, whitelist) {
|
|
97
|
+
if (shouldUseWhitelist(source, whitelist)) {
|
|
98
|
+
return "whitelisted";
|
|
99
|
+
}
|
|
100
|
+
if (source.startsWith(".")) {
|
|
101
|
+
return "relative";
|
|
102
|
+
}
|
|
103
|
+
return "unknown";
|
|
104
|
+
}
|
|
105
|
+
function scopeStyles(css, scopeClass) {
|
|
106
|
+
return css.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g, (match, selector, suffix) => {
|
|
107
|
+
if (selector.trim().startsWith("@")) return match;
|
|
108
|
+
const scopedSelector = selector.split(",").map((rawSelector) => {
|
|
109
|
+
const nextSelector = rawSelector.trim();
|
|
110
|
+
if (nextSelector === "body" || nextSelector === "html") return `.${scopeClass}`;
|
|
111
|
+
return `.${scopeClass} ${nextSelector}`;
|
|
112
|
+
}).join(", ");
|
|
113
|
+
return `${scopedSelector}${suffix}`;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function transformImportToBinding(importClause, sourceExpression) {
|
|
117
|
+
const trimmedClause = importClause.trim();
|
|
118
|
+
const namespaceMatch = trimmedClause.match(/^\*\s+as\s+(\w+)$/);
|
|
119
|
+
if (namespaceMatch) {
|
|
120
|
+
return `const ${namespaceMatch[1]} = ${sourceExpression};`;
|
|
121
|
+
}
|
|
122
|
+
const mixedMatch = trimmedClause.match(/^(\w+)\s*,\s*\{([^}]+)\}$/);
|
|
123
|
+
if (mixedMatch) {
|
|
124
|
+
const defaultName = mixedMatch[1];
|
|
125
|
+
const namedImports = normalizeNamedImportSpecifiers(mixedMatch[2]);
|
|
126
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
127
|
+
return `const ${moduleVar} = ${sourceExpression}; const ${defaultName} = ${moduleVar}.default || ${moduleVar}; const { ${namedImports} } = ${moduleVar};`;
|
|
128
|
+
}
|
|
129
|
+
const defaultAndNamespaceMatch = trimmedClause.match(/^(\w+)\s*,\s*\*\s+as\s+(\w+)$/);
|
|
130
|
+
if (defaultAndNamespaceMatch) {
|
|
131
|
+
const defaultName = defaultAndNamespaceMatch[1];
|
|
132
|
+
const namespaceName = defaultAndNamespaceMatch[2];
|
|
133
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
134
|
+
return `const ${moduleVar} = ${sourceExpression}; const ${defaultName} = ${moduleVar}.default || ${moduleVar}; const ${namespaceName} = ${moduleVar};`;
|
|
135
|
+
}
|
|
136
|
+
const namedMatch = trimmedClause.match(/^\{([^}]+)\}$/);
|
|
137
|
+
if (namedMatch) {
|
|
138
|
+
return `const { ${normalizeNamedImportSpecifiers(namedMatch[1])} } = ${sourceExpression};`;
|
|
139
|
+
}
|
|
140
|
+
const defaultMatch = trimmedClause.match(/^(\w+)$/);
|
|
141
|
+
if (defaultMatch) {
|
|
142
|
+
const defaultName = defaultMatch[1];
|
|
143
|
+
return `const ${defaultName} = ${sourceExpression}.default || ${sourceExpression};`;
|
|
144
|
+
}
|
|
145
|
+
return "";
|
|
146
|
+
}
|
|
147
|
+
function transformWhitelistedImport(importClause, source) {
|
|
148
|
+
const trimmedClause = importClause.trim();
|
|
149
|
+
const injectedBindings = getRuntimeInjectedBindingsForSource(source);
|
|
150
|
+
const buildNamedBinding = (specifiers, sourceExpression = `__getWhitelistedModule('${source}')`) => {
|
|
151
|
+
const namedBindings = specifiers.split(",").map((part) => part.trim()).filter(Boolean).map((part) => {
|
|
152
|
+
const aliasMatch = part.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
153
|
+
if (aliasMatch) {
|
|
154
|
+
return `${aliasMatch[1]}: ${aliasMatch[2]}`;
|
|
155
|
+
}
|
|
156
|
+
return injectedBindings.has(part) ? null : part;
|
|
157
|
+
}).filter(Boolean);
|
|
158
|
+
if (namedBindings.length === 0) {
|
|
159
|
+
return "";
|
|
160
|
+
}
|
|
161
|
+
return `const { ${namedBindings.join(", ")} } = ${sourceExpression};`;
|
|
162
|
+
};
|
|
163
|
+
const namespaceMatch = trimmedClause.match(/^\*\s+as\s+(\w+)$/);
|
|
164
|
+
if (namespaceMatch) {
|
|
165
|
+
return `const ${namespaceMatch[1]} = __getWhitelistedModule('${source}');`;
|
|
166
|
+
}
|
|
167
|
+
const mixedMatch = trimmedClause.match(/^(\w+)\s*,\s*\{([^}]+)\}$/);
|
|
168
|
+
if (mixedMatch) {
|
|
169
|
+
const defaultName = mixedMatch[1];
|
|
170
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
171
|
+
const parts = [
|
|
172
|
+
`const ${moduleVar} = __getWhitelistedModule('${source}');`,
|
|
173
|
+
`const ${defaultName} = ${moduleVar}.default || ${moduleVar};`
|
|
174
|
+
];
|
|
175
|
+
const namedBinding = buildNamedBinding(mixedMatch[2], moduleVar);
|
|
176
|
+
if (namedBinding) {
|
|
177
|
+
parts.push(namedBinding);
|
|
178
|
+
}
|
|
179
|
+
return parts.join(" ");
|
|
180
|
+
}
|
|
181
|
+
const defaultAndNamespaceMatch = trimmedClause.match(/^(\w+)\s*,\s*\*\s+as\s+(\w+)$/);
|
|
182
|
+
if (defaultAndNamespaceMatch) {
|
|
183
|
+
const defaultName = defaultAndNamespaceMatch[1];
|
|
184
|
+
const namespaceName = defaultAndNamespaceMatch[2];
|
|
185
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
186
|
+
return `const ${moduleVar} = __getWhitelistedModule('${source}'); const ${defaultName} = ${moduleVar}.default || ${moduleVar}; const ${namespaceName} = ${moduleVar};`;
|
|
187
|
+
}
|
|
188
|
+
const namedMatch = trimmedClause.match(/^\{([^}]+)\}$/);
|
|
189
|
+
if (namedMatch) {
|
|
190
|
+
return buildNamedBinding(namedMatch[1]);
|
|
191
|
+
}
|
|
192
|
+
const defaultMatch = trimmedClause.match(/^(\w+)$/);
|
|
193
|
+
if (defaultMatch) {
|
|
194
|
+
const defaultName = defaultMatch[1];
|
|
195
|
+
return `const ${defaultName} = __getWhitelistedModule('${source}').default || __getWhitelistedModule('${source}');`;
|
|
196
|
+
}
|
|
197
|
+
return "";
|
|
198
|
+
}
|
|
199
|
+
function collectRawScript(descriptor) {
|
|
200
|
+
return [descriptor.script?.content, descriptor.scriptSetup?.content].filter((block) => Boolean(block?.trim())).join("\n");
|
|
201
|
+
}
|
|
202
|
+
function transformValueImports(scriptContent, whitelist, strippedImports) {
|
|
203
|
+
let nextScript = scriptContent.replace(/import\s+type\s+[\s\S]*?from\s+['"].*?['"];?/g, "");
|
|
204
|
+
nextScript = nextScript.replace(
|
|
205
|
+
/import\s+([^;]+?)\s+from\s+['"]([^'"]+)['"];?/g,
|
|
206
|
+
(_match, importClause, source) => {
|
|
207
|
+
const reason = classifyImportSource(source, whitelist);
|
|
208
|
+
strippedImports.push({ source, reason });
|
|
209
|
+
if (reason === "whitelisted") {
|
|
210
|
+
return transformWhitelistedImport(importClause, source);
|
|
211
|
+
}
|
|
212
|
+
if (reason === "relative") {
|
|
213
|
+
return transformImportToBinding(importClause, `__mockModule('${source}')`);
|
|
214
|
+
}
|
|
215
|
+
return transformImportToBinding(importClause, `__mockModule('${source}')`);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
nextScript = nextScript.replace(
|
|
219
|
+
/import\s+['"]([^'"]+)['"];?/g,
|
|
220
|
+
(_match, source) => {
|
|
221
|
+
const reason = classifyImportSource(source, whitelist);
|
|
222
|
+
strippedImports.push({ source, reason });
|
|
223
|
+
if (reason === "relative") {
|
|
224
|
+
return `__mockModule('${source}');`;
|
|
225
|
+
}
|
|
226
|
+
return `__mockModule('${source}');`;
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
return nextScript;
|
|
230
|
+
}
|
|
231
|
+
function stripExports(scriptContent) {
|
|
232
|
+
let nextScript = scriptContent;
|
|
233
|
+
nextScript = nextScript.replace(/export\s+default\s*\{[\s\S]*?\}\s*;?\s*$/g, "");
|
|
234
|
+
nextScript = nextScript.replace(/export\s+\{[\s\S]*?\}\s*;?/g, "");
|
|
235
|
+
nextScript = nextScript.replace(/export\s+default\s+/g, "");
|
|
236
|
+
nextScript = nextScript.replace(/export\s+(const|let|var|function|class|async\s+function)\s+/g, "$1 ");
|
|
237
|
+
return nextScript;
|
|
238
|
+
}
|
|
239
|
+
function transpileScript(scriptContent) {
|
|
240
|
+
const result = transform(scriptContent, {
|
|
241
|
+
transforms: ["typescript"],
|
|
242
|
+
disableESTransforms: true
|
|
243
|
+
});
|
|
244
|
+
return result && typeof result.code === "string" ? result.code : scriptContent;
|
|
245
|
+
}
|
|
246
|
+
function extractBindingsFromScript(scriptContent) {
|
|
247
|
+
const bindings = /* @__PURE__ */ new Set();
|
|
248
|
+
try {
|
|
249
|
+
let extractNames2 = function(name) {
|
|
250
|
+
if (ts.isIdentifier(name)) {
|
|
251
|
+
bindings.add(name.text);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (ts.isObjectBindingPattern(name) || ts.isArrayBindingPattern(name)) {
|
|
255
|
+
name.elements.forEach((element) => {
|
|
256
|
+
if (ts.isBindingElement(element)) {
|
|
257
|
+
extractNames2(element.name);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}, visit2 = function(node) {
|
|
262
|
+
if (ts.isVariableStatement(node)) {
|
|
263
|
+
node.declarationList.declarations.forEach((decl) => extractNames2(decl.name));
|
|
264
|
+
} else if (ts.isFunctionDeclaration(node) && node.name) {
|
|
265
|
+
bindings.add(node.name.text);
|
|
266
|
+
} else if (ts.isClassDeclaration(node) && node.name) {
|
|
267
|
+
bindings.add(node.name.text);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
var extractNames = extractNames2, visit = visit2;
|
|
271
|
+
const sourceFile = ts.createSourceFile(
|
|
272
|
+
"temp.ts",
|
|
273
|
+
scriptContent,
|
|
274
|
+
ts.ScriptTarget.Latest,
|
|
275
|
+
true
|
|
276
|
+
);
|
|
277
|
+
sourceFile.statements.forEach(visit2);
|
|
278
|
+
} catch {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
return Array.from(bindings).filter(
|
|
282
|
+
(binding) => binding && /^[A-Za-z_$][\w$]*$/.test(binding) && !INTERNAL_BINDING_PREFIXES.some((prefix) => binding.startsWith(prefix))
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
function processExecutableScript(rawScript, whitelist, strippedImports) {
|
|
286
|
+
const withoutImports = transformValueImports(rawScript, whitelist, strippedImports);
|
|
287
|
+
const withoutExports = stripExports(withoutImports);
|
|
288
|
+
return transpileScript(withoutExports);
|
|
289
|
+
}
|
|
290
|
+
function getParseError(result) {
|
|
291
|
+
const firstError = result.errors[0];
|
|
292
|
+
if (!firstError) return void 0;
|
|
293
|
+
return typeof firstError === "string" ? firstError : firstError.message;
|
|
294
|
+
}
|
|
295
|
+
function compileSFC(code, scopeId, options) {
|
|
296
|
+
const whitelist = options?.allowedImports ?? ALLOWED_IMPORT_SOURCES;
|
|
297
|
+
const strippedImports = [];
|
|
298
|
+
try {
|
|
299
|
+
const parseResult = parse(code, {
|
|
300
|
+
filename: "inline.vue",
|
|
301
|
+
sourceMap: false
|
|
302
|
+
});
|
|
303
|
+
const parseError = getParseError(parseResult);
|
|
304
|
+
if (parseError) {
|
|
305
|
+
return {
|
|
306
|
+
template: "",
|
|
307
|
+
script: "",
|
|
308
|
+
style: "",
|
|
309
|
+
bindings: [],
|
|
310
|
+
error: parseError
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
const { descriptor } = parseResult;
|
|
314
|
+
const template = descriptor.template?.content || "";
|
|
315
|
+
const rawScript = collectRawScript(descriptor);
|
|
316
|
+
const rawStyles = descriptor.styles.map((styleBlock) => styleBlock.content).join("\n");
|
|
317
|
+
const style = rawStyles ? scopeStyles(rawStyles, scopeId) : "";
|
|
318
|
+
if (!template && !rawScript) {
|
|
319
|
+
return { template: "", script: "", style: "", bindings: [] };
|
|
320
|
+
}
|
|
321
|
+
const executableScript = rawScript ? processExecutableScript(rawScript, whitelist, strippedImports) : "";
|
|
322
|
+
const bindings = executableScript ? extractBindingsFromScript(executableScript) : [];
|
|
323
|
+
return {
|
|
324
|
+
template,
|
|
325
|
+
script: executableScript,
|
|
326
|
+
style,
|
|
327
|
+
bindings,
|
|
328
|
+
strippedImports: strippedImports.length > 0 ? strippedImports : void 0
|
|
329
|
+
};
|
|
330
|
+
} catch (error) {
|
|
331
|
+
return {
|
|
332
|
+
template: "",
|
|
333
|
+
script: "",
|
|
334
|
+
style: "",
|
|
335
|
+
bindings: [],
|
|
336
|
+
error: error?.message || String(error)
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export { compileSFC, scopeStyles };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkJNRGUR3O_js = require('./chunk-JNRGUR3O.js');
|
|
4
|
+
var chunkV5N65MRP_js = require('./chunk-V5N65MRP.js');
|
|
5
|
+
var chunkDHLWNT53_js = require('./chunk-DHLWNT53.js');
|
|
6
6
|
|
|
7
7
|
// src/tools/unifiedValidator.ts
|
|
8
8
|
function validateCompilation(code) {
|
|
9
9
|
const scopeId = `validate-${Date.now()}`;
|
|
10
10
|
const scriptOpenCount = (code.match(/<script[\s\S]*?>/g) || []).length;
|
|
11
11
|
const scriptCloseCount = (code.match(/<\/script>/g) || []).length;
|
|
12
|
-
const templateOpenCount = (code.match(/<template
|
|
12
|
+
const templateOpenCount = (code.match(/<template[^>]*>/g) || []).length;
|
|
13
13
|
const templateCloseCount = (code.match(/<\/template>/g) || []).length;
|
|
14
14
|
if (scriptCloseCount > 0 && scriptOpenCount === 0) {
|
|
15
15
|
return {
|
|
@@ -41,7 +41,7 @@ function validateCompilation(code) {
|
|
|
41
41
|
errors: ["SFC \u7ED3\u6784\u9519\u8BEF: \u7F3A\u5C11 <template> \u6216 <script> \u6807\u7B7E"]
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
const result =
|
|
44
|
+
const result = chunkDHLWNT53_js.compileSFC(code, scopeId);
|
|
45
45
|
if (result.error) {
|
|
46
46
|
return {
|
|
47
47
|
name: "\u7F16\u8BD1\u68C0\u67E5",
|
|
@@ -64,7 +64,7 @@ function validateCompilation(code) {
|
|
|
64
64
|
}
|
|
65
65
|
async function validateAST(code) {
|
|
66
66
|
try {
|
|
67
|
-
const violations = await
|
|
67
|
+
const violations = await chunkJNRGUR3O_js.analyzeCodeWithAST(code);
|
|
68
68
|
if (violations.length > 0) {
|
|
69
69
|
return {
|
|
70
70
|
name: "AST\u89C4\u5219\u68C0\u67E5",
|
|
@@ -110,7 +110,7 @@ async function validateCode(code) {
|
|
|
110
110
|
summary: `\u274C AST\u89C4\u5219\u8FDD\u89C4 (${astResult.errors.length}\u9879)`
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
const runtimeResult =
|
|
113
|
+
const runtimeResult = chunkV5N65MRP_js.validateRuntimePrecheck(code);
|
|
114
114
|
if (!runtimeResult.passed) {
|
|
115
115
|
return {
|
|
116
116
|
passed: false,
|
|
@@ -122,6 +122,28 @@ async function validateCode(code) {
|
|
|
122
122
|
summary: `\u274C \u8FD0\u884C\u65F6\u9519\u8BEF: ${runtimeResult.errors[0]}`
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
if (runtimeResult.status === "env_dependent") {
|
|
126
|
+
return {
|
|
127
|
+
passed: true,
|
|
128
|
+
layers: {
|
|
129
|
+
compilation: compilationResult,
|
|
130
|
+
ast: astResult,
|
|
131
|
+
runtime: runtimeResult
|
|
132
|
+
},
|
|
133
|
+
summary: "\u26A0\uFE0F \u8FD0\u884C\u65F6\u68C0\u67E5\u53D7\u73AF\u5883\u5F71\u54CD\uFF0C\u7ED3\u679C\u4F9D\u8D56 mock"
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (runtimeResult.status === "runtime_skipped") {
|
|
137
|
+
return {
|
|
138
|
+
passed: true,
|
|
139
|
+
layers: {
|
|
140
|
+
compilation: compilationResult,
|
|
141
|
+
ast: astResult,
|
|
142
|
+
runtime: runtimeResult
|
|
143
|
+
},
|
|
144
|
+
summary: "\u26A0\uFE0F \u8FD0\u884C\u65F6\u68C0\u67E5\u5DF2\u964D\u7EA7\u4E3A\u8DF3\u8FC7\u4E25\u683C\u5224\u5B9A"
|
|
145
|
+
};
|
|
146
|
+
}
|
|
125
147
|
return {
|
|
126
148
|
passed: true,
|
|
127
149
|
layers: {
|
|
@@ -144,14 +166,15 @@ function validateCodeSync(code) {
|
|
|
144
166
|
summary: `\u274C \u7F16\u8BD1\u5931\u8D25: ${compilationResult.errors[0]}`
|
|
145
167
|
};
|
|
146
168
|
}
|
|
147
|
-
const runtimeResult =
|
|
169
|
+
const runtimeResult = chunkV5N65MRP_js.validateRuntimePrecheck(code);
|
|
170
|
+
const summary = runtimeResult.passed ? runtimeResult.status === "env_dependent" ? "\u26A0\uFE0F \u8FD0\u884C\u65F6\u68C0\u67E5\u53D7\u73AF\u5883\u5F71\u54CD" : runtimeResult.status === "runtime_skipped" ? "\u26A0\uFE0F \u8FD0\u884C\u65F6\u68C0\u67E5\u5DF2\u964D\u7EA7" : "\u2705 \u68C0\u67E5\u901A\u8FC7" : `\u274C ${runtimeResult.errors[0]}`;
|
|
148
171
|
return {
|
|
149
172
|
passed: runtimeResult.passed,
|
|
150
173
|
layers: {
|
|
151
174
|
compilation: compilationResult,
|
|
152
175
|
runtime: runtimeResult
|
|
153
176
|
},
|
|
154
|
-
summary
|
|
177
|
+
summary
|
|
155
178
|
};
|
|
156
179
|
}
|
|
157
180
|
|