king-design-analyzer 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/actions.json +8 -0
- package/components/advancedset.json +1 -0
- package/components/affix.json +1 -0
- package/components/anchor.json +220 -0
- package/components/anchorlink.json +111 -0
- package/components/badge.json +1 -0
- package/components/breadcrumb.json +2 -1
- package/components/button.json +1 -0
- package/components/buttonlink.json +1 -0
- package/components/card.json +6 -3
- package/components/cardcontent.json +5 -0
- package/components/cascader.json +56 -0
- package/components/collapse.json +335 -348
- package/components/configprovider.json +96 -0
- package/components/copyrow.json +1 -0
- package/components/descriptions.json +10 -3
- package/components/diagram.json +295 -0
- package/components/dialog.json +4 -0
- package/components/divider.json +1 -0
- package/components/drawer.json +32 -0
- package/components/dropdown.json +13 -4
- package/components/flex.json +1 -0
- package/components/form.json +12 -3
- package/components/header.json +4 -0
- package/components/input.json +8 -4
- package/components/layoutcontent.json +9 -0
- package/components/layoutlistcontent.json +9 -0
- package/components/layoutpermissioncontent.json +1 -0
- package/components/layoutstandardlist.json +1 -0
- package/components/lazymount.json +1 -0
- package/components/lazyteleport.json +1 -0
- package/components/menu.json +4 -3
- package/components/notification.json +351 -0
- package/components/popover.json +23 -0
- package/components/protable.json +2 -0
- package/components/rate.json +1 -0
- package/components/scrollselect.json +140 -0
- package/components/select.json +72 -0
- package/components/skeleton.json +1 -0
- package/components/slider.json +12 -2
- package/components/spin.json +2 -1
- package/components/spinner.json +422 -428
- package/components/split.json +3 -0
- package/components/switch.json +4 -2
- package/components/table.json +6 -1
- package/components/tabs.json +2 -2
- package/components/tag.json +8 -5
- package/components/timeline.json +3 -1
- package/components/tip.json +20 -0
- package/components/tooltip.json +8 -0
- package/components/tour.json +16 -0
- package/components/transfer.json +52 -5
- package/components/tree.json +22 -1
- package/components/treeselect.json +56 -0
- package/components/upload.json +16 -0
- package/components/vdialog.json +1 -0
- package/components/vdrawer.json +4 -0
- package/components/virtuallist.json +9 -0
- package/dist/ast/index.d.mts +30 -1
- package/dist/ast/index.d.ts +30 -1
- package/dist/ast/index.js +3 -3
- package/dist/ast/index.mjs +1 -1
- package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
- package/dist/chunk-6HOIRUQB.mjs +409 -0
- package/dist/{chunk-XGPHQHLR.mjs → chunk-BSCASJTV.mjs} +27 -4
- package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
- package/dist/{chunk-CJGGFVQJ.js → chunk-HARQRI4F.js} +31 -8
- package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
- package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
- package/dist/chunk-V5N65MRP.js +411 -0
- package/dist/{chunk-SZYVGYKK.js → chunk-XPHDD6XR.js} +113 -35
- package/dist/{chunk-KMIDURUR.mjs → chunk-YRGYDK2I.mjs} +113 -35
- package/dist/full/index.d.mts +2 -0
- package/dist/full/index.d.ts +2 -0
- package/dist/full/index.js +6 -6
- package/dist/full/index.mjs +4 -4
- package/dist/index.js +13 -13
- package/dist/index.mjs +5 -5
- package/dist/metadata/index.d.mts +17 -2
- package/dist/metadata/index.d.ts +17 -2
- 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/static/index.js +5 -5
- package/dist/static/index.mjs +2 -2
- package/docs_for_llm/actions.doc.md +11 -1
- package/docs_for_llm/advancedset.doc.md +10 -1
- package/docs_for_llm/affix.doc.md +5 -0
- package/docs_for_llm/anchor.doc.md +155 -0
- package/docs_for_llm/anchorlink.doc.md +75 -0
- package/docs_for_llm/badge.doc.md +5 -0
- package/docs_for_llm/breadcrumb.doc.md +74 -1
- package/docs_for_llm/button.doc.md +57 -0
- package/docs_for_llm/buttonlink.doc.md +10 -1
- package/docs_for_llm/card.doc.md +50 -3
- package/docs_for_llm/cardcontent.doc.md +21 -0
- package/docs_for_llm/carousel.doc.md +71 -0
- package/docs_for_llm/cascader.doc.md +62 -0
- package/docs_for_llm/collapse.doc.md +138 -8
- package/docs_for_llm/configprovider.doc.md +77 -0
- package/docs_for_llm/copyrow.doc.md +10 -1
- package/docs_for_llm/datepicker.doc.md +19 -0
- package/docs_for_llm/descriptions.doc.md +113 -4
- package/docs_for_llm/diagram.doc.md +343 -0
- package/docs_for_llm/dialog.doc.md +49 -0
- package/docs_for_llm/divider.doc.md +5 -0
- package/docs_for_llm/drawer.doc.md +86 -0
- package/docs_for_llm/dropdown.doc.md +257 -3
- package/docs_for_llm/flex.doc.md +10 -1
- package/docs_for_llm/form.doc.md +163 -4
- package/docs_for_llm/formitemspinner.doc.md +1 -1
- package/docs_for_llm/grid.doc.md +71 -0
- package/docs_for_llm/header.doc.md +33 -4
- package/docs_for_llm/input.doc.md +109 -2
- package/docs_for_llm/layoutcontent.doc.md +37 -0
- package/docs_for_llm/layoutlistcontent.doc.md +82 -9
- package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
- package/docs_for_llm/layoutstandardlist.doc.md +10 -1
- package/docs_for_llm/lazymount.doc.md +10 -1
- package/docs_for_llm/lazyteleport.doc.md +10 -1
- package/docs_for_llm/menu.doc.md +125 -3
- package/docs_for_llm/message.doc.md +45 -0
- package/docs_for_llm/notification.doc.md +214 -0
- package/docs_for_llm/popover.doc.md +34 -0
- package/docs_for_llm/protable.doc.md +9 -0
- package/docs_for_llm/rate.doc.md +5 -0
- package/docs_for_llm/scrollselect.doc.md +90 -0
- package/docs_for_llm/select.doc.md +189 -0
- package/docs_for_llm/skeleton.doc.md +35 -0
- package/docs_for_llm/slider.doc.md +11 -1
- package/docs_for_llm/spin.doc.md +10 -1
- package/docs_for_llm/spinner.doc.md +1 -1
- package/docs_for_llm/split.doc.md +13 -0
- package/docs_for_llm/steps.doc.md +71 -0
- package/docs_for_llm/switch.doc.md +15 -2
- package/docs_for_llm/table.doc.md +199 -4
- package/docs_for_llm/tabs.doc.md +98 -2
- package/docs_for_llm/tag.doc.md +148 -5
- package/docs_for_llm/timeline.doc.md +80 -2
- package/docs_for_llm/timepicker.doc.md +19 -0
- package/docs_for_llm/tip.doc.md +30 -0
- package/docs_for_llm/tooltip.doc.md +46 -0
- package/docs_for_llm/tour.doc.md +102 -0
- package/docs_for_llm/transfer.doc.md +59 -4
- package/docs_for_llm/tree.doc.md +64 -1
- package/docs_for_llm/treeselect.doc.md +68 -0
- package/docs_for_llm/upload.doc.md +28 -0
- package/docs_for_llm/vdialog.doc.md +26 -1
- package/docs_for_llm/vdrawer.doc.md +33 -4
- package/docs_for_llm/virtuallist.doc.md +165 -0
- package/package.json +3 -3
- package/dist/chunk-D2SXGGTX.mjs +0 -162
- package/dist/chunk-EYKZY2F3.js +0 -164
|
@@ -50,10 +50,39 @@ import { VDrawer } from '@ksyun-internal/versatile';
|
|
|
50
50
|
## 插槽 (Slots)
|
|
51
51
|
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
52
52
|
| --- | --- | --- | --- |
|
|
53
|
-
| default | 抽屉主体内容区域 | `<VDrawer>...</VDrawer>` |
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
| default | 抽屉主体内容区域 | `<VDrawer>...</VDrawer>` | `<VDrawer>
|
|
54
|
+
<template <VDrawer>...</VDrawer>>
|
|
55
|
+
自定义default内容
|
|
56
|
+
</template>
|
|
57
|
+
</VDrawer>` |
|
|
58
|
+
| header | 自定义抽屉头部 | `<template #header>...</template>` | `<VDrawer>
|
|
59
|
+
<template <template #header>...</template>>头部内容</template>
|
|
60
|
+
</VDrawer>` |
|
|
61
|
+
| footer | 自定义抽屉底部操作区 | `<template #footer>...</template>` | `<VDrawer>
|
|
62
|
+
<template <template #footer>...</template>>底部内容</template>
|
|
63
|
+
</VDrawer>` |
|
|
64
|
+
| trigger | 自定义触发按钮或触发区域 | `<template #trigger>...</template>` | `<VDrawer>
|
|
65
|
+
<template <template #trigger>...</template>>
|
|
66
|
+
自定义trigger内容
|
|
67
|
+
</template>
|
|
68
|
+
</VDrawer>` |
|
|
69
|
+
|
|
70
|
+
### 插槽参数说明
|
|
71
|
+
**default**
|
|
72
|
+
|
|
73
|
+
- 参数结构: 无参数
|
|
74
|
+
|
|
75
|
+
**header**
|
|
76
|
+
|
|
77
|
+
- 参数结构: 无参数
|
|
78
|
+
|
|
79
|
+
**footer**
|
|
80
|
+
|
|
81
|
+
- 参数结构: 无参数
|
|
82
|
+
|
|
83
|
+
**trigger**
|
|
84
|
+
|
|
85
|
+
- 参数结构: 无参数
|
|
57
86
|
|
|
58
87
|
## 使用示例
|
|
59
88
|
### 侧边编辑抽屉
|
|
@@ -16,23 +16,188 @@ import { VirtualList } from '@king-design/vue';
|
|
|
16
16
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
17
|
| disabled | `boolean` | `false` | 否 | 是否禁用虚拟化,禁用后会渲染所有元素 | - | `<VirtualList disabled></VirtualList>` |
|
|
18
18
|
|
|
19
|
+
## 插槽 (Slots)
|
|
20
|
+
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
21
|
+
| --- | --- | --- | --- |
|
|
22
|
+
| default | 列表项渲染内容,通常配合 v-for 渲染大量行。 | `#default` | `<VirtualList style="height: 400px;">
|
|
23
|
+
<template #default>
|
|
24
|
+
<div v-for="item in data" :key="item.value">{{ item.label }}</div>
|
|
25
|
+
</template>
|
|
26
|
+
</VirtualList>` |
|
|
27
|
+
|
|
28
|
+
### 插槽参数说明
|
|
29
|
+
**default**
|
|
30
|
+
|
|
31
|
+
- 参数结构: 无参数
|
|
32
|
+
|
|
19
33
|
## 子组件 (Sub-Components)
|
|
20
34
|
### VirtualListContainer
|
|
21
35
|
虚拟列表容器组件,用于组合式使用
|
|
22
36
|
|
|
37
|
+
#### 组合示例
|
|
38
|
+
##### 组合式使用
|
|
39
|
+
**场景**: 使用子组件进行复杂布局
|
|
40
|
+
|
|
41
|
+
使用子组件进行组合
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { ref, onMounted } from 'vue';
|
|
46
|
+
import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
|
|
47
|
+
|
|
48
|
+
const data = ref<{value: number; label: string}[]>([]);
|
|
49
|
+
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
const arr = [];
|
|
52
|
+
for (let i = 0; i < 10000; i++) {
|
|
53
|
+
arr.push({ value: i, label: `列表项 ${i}` });
|
|
54
|
+
}
|
|
55
|
+
data.value = arr;
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
<template>
|
|
59
|
+
<div style="height: 400px;">
|
|
60
|
+
<VirtualListContainer>
|
|
61
|
+
<VirtualListPhantom />
|
|
62
|
+
<VirtualListWrapper tagName="ul">
|
|
63
|
+
<VirtualListRows>
|
|
64
|
+
<li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
|
|
65
|
+
{{ item.label }}
|
|
66
|
+
</li>
|
|
67
|
+
</VirtualListRows>
|
|
68
|
+
</VirtualListWrapper>
|
|
69
|
+
</VirtualListContainer>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
```
|
|
73
|
+
|
|
23
74
|
### VirtualListWrapper
|
|
24
75
|
虚拟列表包装器组件,可通过 tagName 属性指定标签类型
|
|
25
76
|
|
|
77
|
+
#### 属性 (Props)
|
|
26
78
|
| 属性名 | 类型 | 说明 | 示例 |
|
|
27
79
|
| --- | --- | --- | --- |
|
|
28
80
|
| tagName | `string` | 指定渲染的标签名 | `<VirtualListWrapper tagName="ul"></VirtualListWrapper>` |
|
|
29
81
|
|
|
82
|
+
#### 组合示例
|
|
83
|
+
##### 组合式使用
|
|
84
|
+
**场景**: 使用子组件进行复杂布局
|
|
85
|
+
|
|
86
|
+
使用子组件进行组合
|
|
87
|
+
|
|
88
|
+
**命中的子组件 API**: 属性: tagName
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<script setup lang="ts">
|
|
92
|
+
import { ref, onMounted } from 'vue';
|
|
93
|
+
import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
|
|
94
|
+
|
|
95
|
+
const data = ref<{value: number; label: string}[]>([]);
|
|
96
|
+
|
|
97
|
+
onMounted(() => {
|
|
98
|
+
const arr = [];
|
|
99
|
+
for (let i = 0; i < 10000; i++) {
|
|
100
|
+
arr.push({ value: i, label: `列表项 ${i}` });
|
|
101
|
+
}
|
|
102
|
+
data.value = arr;
|
|
103
|
+
});
|
|
104
|
+
</script>
|
|
105
|
+
<template>
|
|
106
|
+
<div style="height: 400px;">
|
|
107
|
+
<VirtualListContainer>
|
|
108
|
+
<VirtualListPhantom />
|
|
109
|
+
<VirtualListWrapper tagName="ul">
|
|
110
|
+
<VirtualListRows>
|
|
111
|
+
<li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
|
|
112
|
+
{{ item.label }}
|
|
113
|
+
</li>
|
|
114
|
+
</VirtualListRows>
|
|
115
|
+
</VirtualListWrapper>
|
|
116
|
+
</VirtualListContainer>
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
119
|
+
```
|
|
120
|
+
|
|
30
121
|
### VirtualListPhantom
|
|
31
122
|
占位组件,用于撑开滚动高度
|
|
32
123
|
|
|
124
|
+
#### 组合示例
|
|
125
|
+
##### 组合式使用
|
|
126
|
+
**场景**: 使用子组件进行复杂布局
|
|
127
|
+
|
|
128
|
+
使用子组件进行组合
|
|
129
|
+
|
|
130
|
+
```vue
|
|
131
|
+
<script setup lang="ts">
|
|
132
|
+
import { ref, onMounted } from 'vue';
|
|
133
|
+
import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
|
|
134
|
+
|
|
135
|
+
const data = ref<{value: number; label: string}[]>([]);
|
|
136
|
+
|
|
137
|
+
onMounted(() => {
|
|
138
|
+
const arr = [];
|
|
139
|
+
for (let i = 0; i < 10000; i++) {
|
|
140
|
+
arr.push({ value: i, label: `列表项 ${i}` });
|
|
141
|
+
}
|
|
142
|
+
data.value = arr;
|
|
143
|
+
});
|
|
144
|
+
</script>
|
|
145
|
+
<template>
|
|
146
|
+
<div style="height: 400px;">
|
|
147
|
+
<VirtualListContainer>
|
|
148
|
+
<VirtualListPhantom />
|
|
149
|
+
<VirtualListWrapper tagName="ul">
|
|
150
|
+
<VirtualListRows>
|
|
151
|
+
<li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
|
|
152
|
+
{{ item.label }}
|
|
153
|
+
</li>
|
|
154
|
+
</VirtualListRows>
|
|
155
|
+
</VirtualListWrapper>
|
|
156
|
+
</VirtualListContainer>
|
|
157
|
+
</div>
|
|
158
|
+
</template>
|
|
159
|
+
```
|
|
160
|
+
|
|
33
161
|
### VirtualListRows
|
|
34
162
|
行渲染组件,包裹实际渲染的列表项
|
|
35
163
|
|
|
164
|
+
#### 组合示例
|
|
165
|
+
##### 组合式使用
|
|
166
|
+
**场景**: 使用子组件进行复杂布局
|
|
167
|
+
|
|
168
|
+
使用子组件进行组合
|
|
169
|
+
|
|
170
|
+
```vue
|
|
171
|
+
<script setup lang="ts">
|
|
172
|
+
import { ref, onMounted } from 'vue';
|
|
173
|
+
import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
|
|
174
|
+
|
|
175
|
+
const data = ref<{value: number; label: string}[]>([]);
|
|
176
|
+
|
|
177
|
+
onMounted(() => {
|
|
178
|
+
const arr = [];
|
|
179
|
+
for (let i = 0; i < 10000; i++) {
|
|
180
|
+
arr.push({ value: i, label: `列表项 ${i}` });
|
|
181
|
+
}
|
|
182
|
+
data.value = arr;
|
|
183
|
+
});
|
|
184
|
+
</script>
|
|
185
|
+
<template>
|
|
186
|
+
<div style="height: 400px;">
|
|
187
|
+
<VirtualListContainer>
|
|
188
|
+
<VirtualListPhantom />
|
|
189
|
+
<VirtualListWrapper tagName="ul">
|
|
190
|
+
<VirtualListRows>
|
|
191
|
+
<li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
|
|
192
|
+
{{ item.label }}
|
|
193
|
+
</li>
|
|
194
|
+
</VirtualListRows>
|
|
195
|
+
</VirtualListWrapper>
|
|
196
|
+
</VirtualListContainer>
|
|
197
|
+
</div>
|
|
198
|
+
</template>
|
|
199
|
+
```
|
|
200
|
+
|
|
36
201
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
37
202
|
### 容器未设置高度
|
|
38
203
|
> **错误用法**: `<VirtualList> <!-- 没有高度,无法滚动 -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "king-design-analyzer",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "AST-based code analyzer for King Design Vue components with on-demand modular imports",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"audit:versatile": "node scripts/audit_versatile.js",
|
|
65
65
|
"audit:hooks": "node scripts/audit_hooks.js",
|
|
66
66
|
"transform:md": "ts-node -P tsconfig.scripts.json scripts/transform_metadata.ts",
|
|
67
|
-
"test": "vitest run",
|
|
68
|
-
"test:watch": "vitest",
|
|
67
|
+
"test": "node --require ./scripts/vitest-webcrypto.cjs ./node_modules/vitest/vitest.mjs run",
|
|
68
|
+
"test:watch": "node --require ./scripts/vitest-webcrypto.cjs ./node_modules/vitest/vitest.mjs",
|
|
69
69
|
"prepublishOnly": "npm run build",
|
|
70
70
|
"release:patch": "npm version patch && npm publish",
|
|
71
71
|
"release:minor": "npm version minor && npm publish",
|
package/dist/chunk-D2SXGGTX.mjs
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { compileSFC } from './chunk-BI5TIQID.mjs';
|
|
2
|
-
|
|
3
|
-
// src/runtime/index.ts
|
|
4
|
-
var scopeIdCounter = 0;
|
|
5
|
-
function createMockProxy(path) {
|
|
6
|
-
return new Proxy(() => {
|
|
7
|
-
}, {
|
|
8
|
-
get: (_target, prop) => {
|
|
9
|
-
if (prop === Symbol.toPrimitive) return () => 0;
|
|
10
|
-
if (prop === "then") return void 0;
|
|
11
|
-
return createMockProxy();
|
|
12
|
-
},
|
|
13
|
-
apply: () => createMockProxy()
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function createWhitelistedModule(source, context) {
|
|
17
|
-
if (source === "vue" || source.startsWith("@vue/")) {
|
|
18
|
-
return context;
|
|
19
|
-
}
|
|
20
|
-
return new Proxy({}, {
|
|
21
|
-
get: (_target, prop) => {
|
|
22
|
-
if (prop === "default") return createMockProxy();
|
|
23
|
-
if (typeof prop === "string" && prop in context) {
|
|
24
|
-
return context[prop];
|
|
25
|
-
}
|
|
26
|
-
return createMockProxy();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
var MOCK_VUE_CONTEXT = {
|
|
31
|
-
// Reactivity
|
|
32
|
-
ref: (v) => ({ value: v }),
|
|
33
|
-
reactive: (v) => v,
|
|
34
|
-
computed: (fn) => ({ value: typeof fn === "function" ? fn() : fn }),
|
|
35
|
-
readonly: (v) => v,
|
|
36
|
-
shallowRef: (v) => ({ value: v }),
|
|
37
|
-
shallowReactive: (v) => v,
|
|
38
|
-
toRef: () => ({ value: void 0 }),
|
|
39
|
-
toRefs: (obj) => Object.fromEntries(
|
|
40
|
-
Object.keys(obj || {}).map((k) => [k, { value: obj[k] }])
|
|
41
|
-
),
|
|
42
|
-
toRaw: (v) => v,
|
|
43
|
-
markRaw: (v) => v,
|
|
44
|
-
isRef: () => false,
|
|
45
|
-
isReactive: () => false,
|
|
46
|
-
isReadonly: () => false,
|
|
47
|
-
isProxy: () => false,
|
|
48
|
-
triggerRef: () => {
|
|
49
|
-
},
|
|
50
|
-
customRef: (factory) => factory(() => {
|
|
51
|
-
}, () => {
|
|
52
|
-
}),
|
|
53
|
-
// Lifecycle
|
|
54
|
-
onMounted: () => {
|
|
55
|
-
},
|
|
56
|
-
onUnmounted: () => {
|
|
57
|
-
},
|
|
58
|
-
onBeforeMount: () => {
|
|
59
|
-
},
|
|
60
|
-
onBeforeUnmount: () => {
|
|
61
|
-
},
|
|
62
|
-
onUpdated: () => {
|
|
63
|
-
},
|
|
64
|
-
onBeforeUpdate: () => {
|
|
65
|
-
},
|
|
66
|
-
onActivated: () => {
|
|
67
|
-
},
|
|
68
|
-
onDeactivated: () => {
|
|
69
|
-
},
|
|
70
|
-
onErrorCaptured: () => {
|
|
71
|
-
},
|
|
72
|
-
// Watchers
|
|
73
|
-
watch: () => () => {
|
|
74
|
-
},
|
|
75
|
-
watchEffect: () => () => {
|
|
76
|
-
},
|
|
77
|
-
watchPostEffect: () => () => {
|
|
78
|
-
},
|
|
79
|
-
watchSyncEffect: () => () => {
|
|
80
|
-
},
|
|
81
|
-
// Composition API
|
|
82
|
-
defineProps: () => ({}),
|
|
83
|
-
defineEmits: () => () => {
|
|
84
|
-
},
|
|
85
|
-
defineExpose: () => {
|
|
86
|
-
},
|
|
87
|
-
defineOptions: () => {
|
|
88
|
-
},
|
|
89
|
-
defineSlots: () => ({}),
|
|
90
|
-
defineModel: () => ({ value: void 0 }),
|
|
91
|
-
withDefaults: (_props, defaults) => defaults,
|
|
92
|
-
useSlots: () => ({}),
|
|
93
|
-
useAttrs: () => ({}),
|
|
94
|
-
// Dependency Injection
|
|
95
|
-
inject: () => void 0,
|
|
96
|
-
provide: () => {
|
|
97
|
-
},
|
|
98
|
-
// Utilities
|
|
99
|
-
nextTick: () => Promise.resolve(),
|
|
100
|
-
getCurrentInstance: () => null,
|
|
101
|
-
h: () => ({}),
|
|
102
|
-
createVNode: () => ({}),
|
|
103
|
-
resolveComponent: () => ({}),
|
|
104
|
-
// =========================================================================
|
|
105
|
-
// @ksyun-internal/versatile Hooks
|
|
106
|
-
// =========================================================================
|
|
107
|
-
useToState: (_props, _key, _emit, defaultValue) => ({ value: defaultValue ?? void 0 }),
|
|
108
|
-
useIdEntity: () => ({ value: void 0 }),
|
|
109
|
-
// =========================================================================
|
|
110
|
-
// Module Mocking
|
|
111
|
-
// =========================================================================
|
|
112
|
-
__mockModule: (modulePath) => createMockProxy(),
|
|
113
|
-
__getWhitelistedModule: (source) => createWhitelistedModule(source, MOCK_VUE_CONTEXT)
|
|
114
|
-
};
|
|
115
|
-
function validateRuntimePrecheck(code) {
|
|
116
|
-
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
117
|
-
const { script, bindings, strippedImports, error } = compileSFC(code, scopeId);
|
|
118
|
-
if (error) {
|
|
119
|
-
return {
|
|
120
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
121
|
-
passed: false,
|
|
122
|
-
errors: [error]
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
const funcBody = `
|
|
127
|
-
"use strict";
|
|
128
|
-
${script}
|
|
129
|
-
return { ${bindings.join(", ")} };
|
|
130
|
-
`;
|
|
131
|
-
const keys = Object.keys(MOCK_VUE_CONTEXT);
|
|
132
|
-
const values = Object.values(MOCK_VUE_CONTEXT);
|
|
133
|
-
const runner = new Function(...keys, funcBody);
|
|
134
|
-
const result = runner(...values);
|
|
135
|
-
const missingBindings = bindings.filter((binding) => !(binding in result));
|
|
136
|
-
if (missingBindings.length > 0) {
|
|
137
|
-
return {
|
|
138
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
139
|
-
passed: false,
|
|
140
|
-
errors: missingBindings.map((b) => `\u53D8\u91CF ${b} \u672A\u6B63\u786E\u5BFC\u51FA`)
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
145
|
-
passed: true,
|
|
146
|
-
errors: []
|
|
147
|
-
};
|
|
148
|
-
} catch (e) {
|
|
149
|
-
const errorMessage = e.message || String(e);
|
|
150
|
-
const errorLocation = e.stack?.split("\n")[1]?.trim() || "";
|
|
151
|
-
return {
|
|
152
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
153
|
-
passed: false,
|
|
154
|
-
errors: [
|
|
155
|
-
`JavaScript \u6267\u884C\u9519\u8BEF: ${errorMessage}`,
|
|
156
|
-
...errorLocation ? [`\u4F4D\u7F6E: ${errorLocation}`] : []
|
|
157
|
-
]
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export { validateRuntimePrecheck };
|
package/dist/chunk-EYKZY2F3.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkCR3GC4H3_js = require('./chunk-CR3GC4H3.js');
|
|
4
|
-
|
|
5
|
-
// src/runtime/index.ts
|
|
6
|
-
var scopeIdCounter = 0;
|
|
7
|
-
function createMockProxy(path) {
|
|
8
|
-
return new Proxy(() => {
|
|
9
|
-
}, {
|
|
10
|
-
get: (_target, prop) => {
|
|
11
|
-
if (prop === Symbol.toPrimitive) return () => 0;
|
|
12
|
-
if (prop === "then") return void 0;
|
|
13
|
-
return createMockProxy();
|
|
14
|
-
},
|
|
15
|
-
apply: () => createMockProxy()
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function createWhitelistedModule(source, context) {
|
|
19
|
-
if (source === "vue" || source.startsWith("@vue/")) {
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
return new Proxy({}, {
|
|
23
|
-
get: (_target, prop) => {
|
|
24
|
-
if (prop === "default") return createMockProxy();
|
|
25
|
-
if (typeof prop === "string" && prop in context) {
|
|
26
|
-
return context[prop];
|
|
27
|
-
}
|
|
28
|
-
return createMockProxy();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
var MOCK_VUE_CONTEXT = {
|
|
33
|
-
// Reactivity
|
|
34
|
-
ref: (v) => ({ value: v }),
|
|
35
|
-
reactive: (v) => v,
|
|
36
|
-
computed: (fn) => ({ value: typeof fn === "function" ? fn() : fn }),
|
|
37
|
-
readonly: (v) => v,
|
|
38
|
-
shallowRef: (v) => ({ value: v }),
|
|
39
|
-
shallowReactive: (v) => v,
|
|
40
|
-
toRef: () => ({ value: void 0 }),
|
|
41
|
-
toRefs: (obj) => Object.fromEntries(
|
|
42
|
-
Object.keys(obj || {}).map((k) => [k, { value: obj[k] }])
|
|
43
|
-
),
|
|
44
|
-
toRaw: (v) => v,
|
|
45
|
-
markRaw: (v) => v,
|
|
46
|
-
isRef: () => false,
|
|
47
|
-
isReactive: () => false,
|
|
48
|
-
isReadonly: () => false,
|
|
49
|
-
isProxy: () => false,
|
|
50
|
-
triggerRef: () => {
|
|
51
|
-
},
|
|
52
|
-
customRef: (factory) => factory(() => {
|
|
53
|
-
}, () => {
|
|
54
|
-
}),
|
|
55
|
-
// Lifecycle
|
|
56
|
-
onMounted: () => {
|
|
57
|
-
},
|
|
58
|
-
onUnmounted: () => {
|
|
59
|
-
},
|
|
60
|
-
onBeforeMount: () => {
|
|
61
|
-
},
|
|
62
|
-
onBeforeUnmount: () => {
|
|
63
|
-
},
|
|
64
|
-
onUpdated: () => {
|
|
65
|
-
},
|
|
66
|
-
onBeforeUpdate: () => {
|
|
67
|
-
},
|
|
68
|
-
onActivated: () => {
|
|
69
|
-
},
|
|
70
|
-
onDeactivated: () => {
|
|
71
|
-
},
|
|
72
|
-
onErrorCaptured: () => {
|
|
73
|
-
},
|
|
74
|
-
// Watchers
|
|
75
|
-
watch: () => () => {
|
|
76
|
-
},
|
|
77
|
-
watchEffect: () => () => {
|
|
78
|
-
},
|
|
79
|
-
watchPostEffect: () => () => {
|
|
80
|
-
},
|
|
81
|
-
watchSyncEffect: () => () => {
|
|
82
|
-
},
|
|
83
|
-
// Composition API
|
|
84
|
-
defineProps: () => ({}),
|
|
85
|
-
defineEmits: () => () => {
|
|
86
|
-
},
|
|
87
|
-
defineExpose: () => {
|
|
88
|
-
},
|
|
89
|
-
defineOptions: () => {
|
|
90
|
-
},
|
|
91
|
-
defineSlots: () => ({}),
|
|
92
|
-
defineModel: () => ({ value: void 0 }),
|
|
93
|
-
withDefaults: (_props, defaults) => defaults,
|
|
94
|
-
useSlots: () => ({}),
|
|
95
|
-
useAttrs: () => ({}),
|
|
96
|
-
// Dependency Injection
|
|
97
|
-
inject: () => void 0,
|
|
98
|
-
provide: () => {
|
|
99
|
-
},
|
|
100
|
-
// Utilities
|
|
101
|
-
nextTick: () => Promise.resolve(),
|
|
102
|
-
getCurrentInstance: () => null,
|
|
103
|
-
h: () => ({}),
|
|
104
|
-
createVNode: () => ({}),
|
|
105
|
-
resolveComponent: () => ({}),
|
|
106
|
-
// =========================================================================
|
|
107
|
-
// @ksyun-internal/versatile Hooks
|
|
108
|
-
// =========================================================================
|
|
109
|
-
useToState: (_props, _key, _emit, defaultValue) => ({ value: defaultValue ?? void 0 }),
|
|
110
|
-
useIdEntity: () => ({ value: void 0 }),
|
|
111
|
-
// =========================================================================
|
|
112
|
-
// Module Mocking
|
|
113
|
-
// =========================================================================
|
|
114
|
-
__mockModule: (modulePath) => createMockProxy(),
|
|
115
|
-
__getWhitelistedModule: (source) => createWhitelistedModule(source, MOCK_VUE_CONTEXT)
|
|
116
|
-
};
|
|
117
|
-
function validateRuntimePrecheck(code) {
|
|
118
|
-
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
119
|
-
const { script, bindings, strippedImports, error } = chunkCR3GC4H3_js.compileSFC(code, scopeId);
|
|
120
|
-
if (error) {
|
|
121
|
-
return {
|
|
122
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
123
|
-
passed: false,
|
|
124
|
-
errors: [error]
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
try {
|
|
128
|
-
const funcBody = `
|
|
129
|
-
"use strict";
|
|
130
|
-
${script}
|
|
131
|
-
return { ${bindings.join(", ")} };
|
|
132
|
-
`;
|
|
133
|
-
const keys = Object.keys(MOCK_VUE_CONTEXT);
|
|
134
|
-
const values = Object.values(MOCK_VUE_CONTEXT);
|
|
135
|
-
const runner = new Function(...keys, funcBody);
|
|
136
|
-
const result = runner(...values);
|
|
137
|
-
const missingBindings = bindings.filter((binding) => !(binding in result));
|
|
138
|
-
if (missingBindings.length > 0) {
|
|
139
|
-
return {
|
|
140
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
141
|
-
passed: false,
|
|
142
|
-
errors: missingBindings.map((b) => `\u53D8\u91CF ${b} \u672A\u6B63\u786E\u5BFC\u51FA`)
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
147
|
-
passed: true,
|
|
148
|
-
errors: []
|
|
149
|
-
};
|
|
150
|
-
} catch (e) {
|
|
151
|
-
const errorMessage = e.message || String(e);
|
|
152
|
-
const errorLocation = e.stack?.split("\n")[1]?.trim() || "";
|
|
153
|
-
return {
|
|
154
|
-
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
155
|
-
passed: false,
|
|
156
|
-
errors: [
|
|
157
|
-
`JavaScript \u6267\u884C\u9519\u8BEF: ${errorMessage}`,
|
|
158
|
-
...errorLocation ? [`\u4F4D\u7F6E: ${errorLocation}`] : []
|
|
159
|
-
]
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
exports.validateRuntimePrecheck = validateRuntimePrecheck;
|