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.
Files changed (154) hide show
  1. package/components/actions.json +8 -0
  2. package/components/advancedset.json +1 -0
  3. package/components/affix.json +1 -0
  4. package/components/anchor.json +220 -0
  5. package/components/anchorlink.json +111 -0
  6. package/components/badge.json +1 -0
  7. package/components/breadcrumb.json +2 -1
  8. package/components/button.json +1 -0
  9. package/components/buttonlink.json +1 -0
  10. package/components/card.json +6 -3
  11. package/components/cardcontent.json +5 -0
  12. package/components/cascader.json +56 -0
  13. package/components/collapse.json +335 -348
  14. package/components/configprovider.json +96 -0
  15. package/components/copyrow.json +1 -0
  16. package/components/descriptions.json +10 -3
  17. package/components/diagram.json +295 -0
  18. package/components/dialog.json +4 -0
  19. package/components/divider.json +1 -0
  20. package/components/drawer.json +32 -0
  21. package/components/dropdown.json +13 -4
  22. package/components/flex.json +1 -0
  23. package/components/form.json +12 -3
  24. package/components/header.json +4 -0
  25. package/components/input.json +8 -4
  26. package/components/layoutcontent.json +9 -0
  27. package/components/layoutlistcontent.json +9 -0
  28. package/components/layoutpermissioncontent.json +1 -0
  29. package/components/layoutstandardlist.json +1 -0
  30. package/components/lazymount.json +1 -0
  31. package/components/lazyteleport.json +1 -0
  32. package/components/menu.json +4 -3
  33. package/components/notification.json +351 -0
  34. package/components/popover.json +23 -0
  35. package/components/protable.json +2 -0
  36. package/components/rate.json +1 -0
  37. package/components/scrollselect.json +140 -0
  38. package/components/select.json +72 -0
  39. package/components/skeleton.json +1 -0
  40. package/components/slider.json +12 -2
  41. package/components/spin.json +2 -1
  42. package/components/spinner.json +422 -428
  43. package/components/split.json +3 -0
  44. package/components/switch.json +4 -2
  45. package/components/table.json +6 -1
  46. package/components/tabs.json +2 -2
  47. package/components/tag.json +8 -5
  48. package/components/timeline.json +3 -1
  49. package/components/tip.json +20 -0
  50. package/components/tooltip.json +8 -0
  51. package/components/tour.json +16 -0
  52. package/components/transfer.json +52 -5
  53. package/components/tree.json +22 -1
  54. package/components/treeselect.json +56 -0
  55. package/components/upload.json +16 -0
  56. package/components/vdialog.json +1 -0
  57. package/components/vdrawer.json +4 -0
  58. package/components/virtuallist.json +9 -0
  59. package/dist/ast/index.d.mts +30 -1
  60. package/dist/ast/index.d.ts +30 -1
  61. package/dist/ast/index.js +3 -3
  62. package/dist/ast/index.mjs +1 -1
  63. package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
  64. package/dist/chunk-6HOIRUQB.mjs +409 -0
  65. package/dist/{chunk-XGPHQHLR.mjs → chunk-BSCASJTV.mjs} +27 -4
  66. package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
  67. package/dist/{chunk-CJGGFVQJ.js → chunk-HARQRI4F.js} +31 -8
  68. package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
  69. package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
  70. package/dist/chunk-V5N65MRP.js +411 -0
  71. package/dist/{chunk-SZYVGYKK.js → chunk-XPHDD6XR.js} +113 -35
  72. package/dist/{chunk-KMIDURUR.mjs → chunk-YRGYDK2I.mjs} +113 -35
  73. package/dist/full/index.d.mts +2 -0
  74. package/dist/full/index.d.ts +2 -0
  75. package/dist/full/index.js +6 -6
  76. package/dist/full/index.mjs +4 -4
  77. package/dist/index.js +13 -13
  78. package/dist/index.mjs +5 -5
  79. package/dist/metadata/index.d.mts +17 -2
  80. package/dist/metadata/index.d.ts +17 -2
  81. package/dist/runtime/index.d.mts +2 -0
  82. package/dist/runtime/index.d.ts +2 -0
  83. package/dist/runtime/index.js +4 -4
  84. package/dist/runtime/index.mjs +2 -2
  85. package/dist/static/index.js +5 -5
  86. package/dist/static/index.mjs +2 -2
  87. package/docs_for_llm/actions.doc.md +11 -1
  88. package/docs_for_llm/advancedset.doc.md +10 -1
  89. package/docs_for_llm/affix.doc.md +5 -0
  90. package/docs_for_llm/anchor.doc.md +155 -0
  91. package/docs_for_llm/anchorlink.doc.md +75 -0
  92. package/docs_for_llm/badge.doc.md +5 -0
  93. package/docs_for_llm/breadcrumb.doc.md +74 -1
  94. package/docs_for_llm/button.doc.md +57 -0
  95. package/docs_for_llm/buttonlink.doc.md +10 -1
  96. package/docs_for_llm/card.doc.md +50 -3
  97. package/docs_for_llm/cardcontent.doc.md +21 -0
  98. package/docs_for_llm/carousel.doc.md +71 -0
  99. package/docs_for_llm/cascader.doc.md +62 -0
  100. package/docs_for_llm/collapse.doc.md +138 -8
  101. package/docs_for_llm/configprovider.doc.md +77 -0
  102. package/docs_for_llm/copyrow.doc.md +10 -1
  103. package/docs_for_llm/datepicker.doc.md +19 -0
  104. package/docs_for_llm/descriptions.doc.md +113 -4
  105. package/docs_for_llm/diagram.doc.md +343 -0
  106. package/docs_for_llm/dialog.doc.md +49 -0
  107. package/docs_for_llm/divider.doc.md +5 -0
  108. package/docs_for_llm/drawer.doc.md +86 -0
  109. package/docs_for_llm/dropdown.doc.md +257 -3
  110. package/docs_for_llm/flex.doc.md +10 -1
  111. package/docs_for_llm/form.doc.md +163 -4
  112. package/docs_for_llm/formitemspinner.doc.md +1 -1
  113. package/docs_for_llm/grid.doc.md +71 -0
  114. package/docs_for_llm/header.doc.md +33 -4
  115. package/docs_for_llm/input.doc.md +109 -2
  116. package/docs_for_llm/layoutcontent.doc.md +37 -0
  117. package/docs_for_llm/layoutlistcontent.doc.md +82 -9
  118. package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
  119. package/docs_for_llm/layoutstandardlist.doc.md +10 -1
  120. package/docs_for_llm/lazymount.doc.md +10 -1
  121. package/docs_for_llm/lazyteleport.doc.md +10 -1
  122. package/docs_for_llm/menu.doc.md +125 -3
  123. package/docs_for_llm/message.doc.md +45 -0
  124. package/docs_for_llm/notification.doc.md +214 -0
  125. package/docs_for_llm/popover.doc.md +34 -0
  126. package/docs_for_llm/protable.doc.md +9 -0
  127. package/docs_for_llm/rate.doc.md +5 -0
  128. package/docs_for_llm/scrollselect.doc.md +90 -0
  129. package/docs_for_llm/select.doc.md +189 -0
  130. package/docs_for_llm/skeleton.doc.md +35 -0
  131. package/docs_for_llm/slider.doc.md +11 -1
  132. package/docs_for_llm/spin.doc.md +10 -1
  133. package/docs_for_llm/spinner.doc.md +1 -1
  134. package/docs_for_llm/split.doc.md +13 -0
  135. package/docs_for_llm/steps.doc.md +71 -0
  136. package/docs_for_llm/switch.doc.md +15 -2
  137. package/docs_for_llm/table.doc.md +199 -4
  138. package/docs_for_llm/tabs.doc.md +98 -2
  139. package/docs_for_llm/tag.doc.md +148 -5
  140. package/docs_for_llm/timeline.doc.md +80 -2
  141. package/docs_for_llm/timepicker.doc.md +19 -0
  142. package/docs_for_llm/tip.doc.md +30 -0
  143. package/docs_for_llm/tooltip.doc.md +46 -0
  144. package/docs_for_llm/tour.doc.md +102 -0
  145. package/docs_for_llm/transfer.doc.md +59 -4
  146. package/docs_for_llm/tree.doc.md +64 -1
  147. package/docs_for_llm/treeselect.doc.md +68 -0
  148. package/docs_for_llm/upload.doc.md +28 -0
  149. package/docs_for_llm/vdialog.doc.md +26 -1
  150. package/docs_for_llm/vdrawer.doc.md +33 -4
  151. package/docs_for_llm/virtuallist.doc.md +165 -0
  152. package/package.json +3 -3
  153. package/dist/chunk-D2SXGGTX.mjs +0 -162
  154. package/dist/chunk-EYKZY2F3.js +0 -164
@@ -0,0 +1,409 @@
1
+ import { compileSFC } from './chunk-4OTQAQ6J.mjs';
2
+
3
+ // src/runtime/index.ts
4
+ var scopeIdCounter = 0;
5
+ var ENVIRONMENT_SENSITIVE_IDENTIFIERS = [
6
+ "window",
7
+ "document",
8
+ "location",
9
+ "navigator"
10
+ ];
11
+ var ENVIRONMENT_SENSITIVE_CALLS = [
12
+ "getCurrentInstance",
13
+ "useRouter",
14
+ "useRoute",
15
+ "onBeforeRouteLeave",
16
+ "onBeforeRouteUpdate"
17
+ ];
18
+ function createMockProxy(path) {
19
+ const target = function mockTarget() {
20
+ };
21
+ return new Proxy(target, {
22
+ get: (_target, prop, receiver) => {
23
+ const existing = Reflect.get(target, prop, receiver);
24
+ if (existing !== void 0) return existing;
25
+ if (prop === Symbol.toPrimitive) return () => 0;
26
+ if (prop === "then") return void 0;
27
+ if (prop === "toString") return () => `[MockProxy ${path}]`;
28
+ if (prop === "valueOf") return () => 0;
29
+ if (prop === "__path") return path;
30
+ return createMockProxy(`${path}.${String(prop)}`);
31
+ },
32
+ apply: () => createMockProxy(`${path}()`),
33
+ construct: () => createMockProxy(`new ${path}()`),
34
+ has: (_target, prop) => Reflect.has(target, prop),
35
+ set: (_target, prop, value, receiver) => Reflect.set(target, prop, value, receiver)
36
+ });
37
+ }
38
+ function createWhitelistedModule(source, context) {
39
+ if (source === "vue" || source.startsWith("@vue/")) {
40
+ return context;
41
+ }
42
+ if (source === "vue-router") {
43
+ return context.__mockVueRouter;
44
+ }
45
+ return new Proxy({}, {
46
+ get: (_target, prop) => {
47
+ if (prop === "default") return createMockProxy(source);
48
+ if (typeof prop === "string" && prop in context) {
49
+ return context[prop];
50
+ }
51
+ return createMockProxy(`${source}.${String(prop)}`);
52
+ }
53
+ });
54
+ }
55
+ function createMockElement(path) {
56
+ const element = createMockProxy(path);
57
+ element.style = {};
58
+ element.classList = {
59
+ add: () => {
60
+ },
61
+ remove: () => {
62
+ },
63
+ contains: () => false
64
+ };
65
+ element.dataset = {};
66
+ element.getBoundingClientRect = () => ({
67
+ x: 0,
68
+ y: 0,
69
+ top: 0,
70
+ left: 0,
71
+ right: 0,
72
+ bottom: 0,
73
+ width: 0,
74
+ height: 0
75
+ });
76
+ return element;
77
+ }
78
+ var MOCK_LOCATION = {
79
+ href: "https://mock.local/",
80
+ pathname: "/",
81
+ search: "",
82
+ hash: "",
83
+ origin: "https://mock.local",
84
+ host: "mock.local",
85
+ hostname: "mock.local",
86
+ port: "",
87
+ protocol: "https:",
88
+ assign: () => {
89
+ },
90
+ replace: () => {
91
+ },
92
+ reload: () => {
93
+ }
94
+ };
95
+ var MOCK_NAVIGATOR = {
96
+ userAgent: "king-design-analyzer-runtime-mock",
97
+ language: "zh-CN",
98
+ languages: ["zh-CN"],
99
+ clipboard: {
100
+ writeText: async () => {
101
+ },
102
+ readText: async () => ""
103
+ }
104
+ };
105
+ var MOCK_DOCUMENT = {
106
+ body: createMockElement("document.body"),
107
+ head: createMockElement("document.head"),
108
+ documentElement: createMockElement("document.documentElement"),
109
+ createElement: (_tag) => createMockElement("document.createElement()"),
110
+ createTextNode: (_text) => createMockElement("document.createTextNode()"),
111
+ getElementById: (_id) => createMockElement("document.getElementById()"),
112
+ querySelector: (_selector) => createMockElement("document.querySelector()"),
113
+ querySelectorAll: () => [],
114
+ addEventListener: () => {
115
+ },
116
+ removeEventListener: () => {
117
+ }
118
+ };
119
+ var MOCK_WINDOW = {
120
+ document: MOCK_DOCUMENT,
121
+ navigator: MOCK_NAVIGATOR,
122
+ location: MOCK_LOCATION,
123
+ innerWidth: 1440,
124
+ innerHeight: 900,
125
+ addEventListener: () => {
126
+ },
127
+ removeEventListener: () => {
128
+ },
129
+ matchMedia: () => ({
130
+ matches: false,
131
+ media: "",
132
+ onchange: null,
133
+ addListener: () => {
134
+ },
135
+ removeListener: () => {
136
+ },
137
+ addEventListener: () => {
138
+ },
139
+ removeEventListener: () => {
140
+ },
141
+ dispatchEvent: () => false
142
+ }),
143
+ requestAnimationFrame: (cb) => {
144
+ cb(0);
145
+ return 0;
146
+ },
147
+ cancelAnimationFrame: () => {
148
+ },
149
+ setTimeout,
150
+ clearTimeout,
151
+ setInterval,
152
+ clearInterval,
153
+ open: () => createMockProxy("window.open()")
154
+ };
155
+ var MOCK_ROUTE = {
156
+ path: "/",
157
+ name: void 0,
158
+ fullPath: "/",
159
+ params: {},
160
+ query: {},
161
+ hash: "",
162
+ meta: {},
163
+ matched: []
164
+ };
165
+ var MOCK_ROUTER = {
166
+ currentRoute: { value: MOCK_ROUTE },
167
+ push: async () => void 0,
168
+ replace: async () => void 0,
169
+ back: () => {
170
+ },
171
+ go: () => {
172
+ },
173
+ forward: () => {
174
+ },
175
+ beforeEach: () => () => {
176
+ },
177
+ afterEach: () => () => {
178
+ }
179
+ };
180
+ function detectEnvironmentSensitivity(code, strippedImports = []) {
181
+ const warnings = [];
182
+ let status = "passed";
183
+ for (const identifier of ENVIRONMENT_SENSITIVE_IDENTIFIERS) {
184
+ if (new RegExp(`\\b${identifier}\\b`).test(code)) {
185
+ warnings.push(`\u68C0\u6D4B\u5230\u6D4F\u89C8\u5668\u73AF\u5883\u5BF9\u8C61 ${identifier}\uFF0C\u8FD0\u884C\u65F6\u7ED3\u679C\u4F9D\u8D56\u5BBF\u4E3B\u73AF\u5883 mock\u3002`);
186
+ status = "env_dependent";
187
+ }
188
+ }
189
+ for (const callee of ENVIRONMENT_SENSITIVE_CALLS) {
190
+ if (new RegExp(`\\b${callee}\\s*\\(`).test(code)) {
191
+ warnings.push(`\u68C0\u6D4B\u5230\u73AF\u5883\u654F\u611F\u8C03\u7528 ${callee}()\uFF0C\u8FD0\u884C\u65F6\u7ED3\u679C\u4F9D\u8D56 mock\u3002`);
192
+ status = "env_dependent";
193
+ }
194
+ }
195
+ const skippedImports = strippedImports.filter(
196
+ (item) => item.reason === "unknown" && !item.source.startsWith(".")
197
+ );
198
+ if (skippedImports.length > 0) {
199
+ status = "runtime_skipped";
200
+ warnings.push(
201
+ `\u68C0\u6D4B\u5230\u7B2C\u4E09\u65B9\u5BFC\u5165 ${skippedImports.map((item) => item.source).join(", ")}\uFF0C\u5DF2\u4F7F\u7528\u6A21\u5757 mock\uFF0C\u8FD0\u884C\u65F6\u7ED3\u679C\u4EC5\u4F9B\u53C2\u8003\u3002`
202
+ );
203
+ }
204
+ return { status, warnings };
205
+ }
206
+ function isEnvironmentRelatedRuntimeError(message) {
207
+ return /(window|document|location|navigator|getCurrentInstance|useRouter|useRoute|route|router)/i.test(message);
208
+ }
209
+ var MOCK_VUE_CONTEXT = {
210
+ // Reactivity
211
+ ref: (v) => ({ value: v }),
212
+ reactive: (v) => v,
213
+ computed: (fn) => ({ value: typeof fn === "function" ? fn() : fn }),
214
+ readonly: (v) => v,
215
+ shallowRef: (v) => ({ value: v }),
216
+ shallowReactive: (v) => v,
217
+ toRef: () => ({ value: void 0 }),
218
+ toRefs: (obj) => Object.fromEntries(
219
+ Object.keys(obj || {}).map((k) => [k, { value: obj[k] }])
220
+ ),
221
+ toRaw: (v) => v,
222
+ markRaw: (v) => v,
223
+ isRef: () => false,
224
+ isReactive: () => false,
225
+ isReadonly: () => false,
226
+ isProxy: () => false,
227
+ triggerRef: () => {
228
+ },
229
+ customRef: (factory) => factory(() => {
230
+ }, () => {
231
+ }),
232
+ // Lifecycle
233
+ onMounted: () => {
234
+ },
235
+ onUnmounted: () => {
236
+ },
237
+ onBeforeMount: () => {
238
+ },
239
+ onBeforeUnmount: () => {
240
+ },
241
+ onUpdated: () => {
242
+ },
243
+ onBeforeUpdate: () => {
244
+ },
245
+ onActivated: () => {
246
+ },
247
+ onDeactivated: () => {
248
+ },
249
+ onErrorCaptured: () => {
250
+ },
251
+ // Watchers
252
+ watch: () => () => {
253
+ },
254
+ watchEffect: () => () => {
255
+ },
256
+ watchPostEffect: () => () => {
257
+ },
258
+ watchSyncEffect: () => () => {
259
+ },
260
+ // Composition API
261
+ defineProps: () => ({}),
262
+ defineEmits: () => () => {
263
+ },
264
+ defineExpose: () => {
265
+ },
266
+ defineOptions: () => {
267
+ },
268
+ defineSlots: () => ({}),
269
+ defineModel: () => ({ value: void 0 }),
270
+ withDefaults: (_props, defaults) => defaults,
271
+ useSlots: () => ({}),
272
+ useAttrs: () => ({}),
273
+ // Dependency Injection
274
+ inject: () => void 0,
275
+ provide: () => {
276
+ },
277
+ // Utilities
278
+ nextTick: () => Promise.resolve(),
279
+ getCurrentInstance: () => ({
280
+ proxy: createMockProxy("instance.proxy"),
281
+ appContext: createMockProxy("instance.appContext"),
282
+ emit: () => {
283
+ },
284
+ attrs: {},
285
+ slots: {}
286
+ }),
287
+ h: () => ({}),
288
+ createVNode: () => ({}),
289
+ resolveComponent: () => ({}),
290
+ // Browser-ish globals
291
+ window: MOCK_WINDOW,
292
+ document: MOCK_DOCUMENT,
293
+ location: MOCK_LOCATION,
294
+ navigator: MOCK_NAVIGATOR,
295
+ self: MOCK_WINDOW,
296
+ globalThis: MOCK_WINDOW,
297
+ // vue-router
298
+ useRouter: () => MOCK_ROUTER,
299
+ useRoute: () => MOCK_ROUTE,
300
+ onBeforeRouteLeave: () => {
301
+ },
302
+ onBeforeRouteUpdate: () => {
303
+ },
304
+ RouterLink: createMockProxy("vue-router.RouterLink"),
305
+ RouterView: createMockProxy("vue-router.RouterView"),
306
+ __mockVueRouter: {
307
+ useRouter: () => MOCK_ROUTER,
308
+ useRoute: () => MOCK_ROUTE,
309
+ onBeforeRouteLeave: () => {
310
+ },
311
+ onBeforeRouteUpdate: () => {
312
+ },
313
+ RouterLink: createMockProxy("vue-router.RouterLink"),
314
+ RouterView: createMockProxy("vue-router.RouterView"),
315
+ createRouter: () => createMockProxy("vue-router.createRouter()"),
316
+ createWebHistory: () => createMockProxy("vue-router.createWebHistory()"),
317
+ createWebHashHistory: () => createMockProxy("vue-router.createWebHashHistory()")
318
+ },
319
+ // =========================================================================
320
+ // @ksyun-internal/versatile Hooks
321
+ // =========================================================================
322
+ useToState: (_props, _key, _emit, defaultValue) => ({ value: defaultValue ?? void 0 }),
323
+ useIdEntity: () => ({ value: void 0 }),
324
+ // =========================================================================
325
+ // Module Mocking
326
+ // =========================================================================
327
+ __mockModule: (modulePath) => createMockProxy(modulePath),
328
+ __getWhitelistedModule: (source) => createWhitelistedModule(source, MOCK_VUE_CONTEXT)
329
+ };
330
+ function validateRuntimePrecheck(code) {
331
+ const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
332
+ const { script, bindings, strippedImports, error } = compileSFC(code, scopeId);
333
+ if (error) {
334
+ return {
335
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
336
+ passed: false,
337
+ status: "failed",
338
+ errors: [error]
339
+ };
340
+ }
341
+ const sensitivity = detectEnvironmentSensitivity(code, strippedImports);
342
+ try {
343
+ const funcBody = `
344
+ "use strict";
345
+ ${script}
346
+ return { ${bindings.join(", ")} };
347
+ `;
348
+ const keys = Object.keys(MOCK_VUE_CONTEXT);
349
+ const values = Object.values(MOCK_VUE_CONTEXT);
350
+ const runner = new Function(...keys, funcBody);
351
+ const result = runner(...values);
352
+ const missingBindings = bindings.filter((binding) => !(binding in result));
353
+ if (missingBindings.length > 0) {
354
+ return {
355
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
356
+ passed: false,
357
+ status: "failed",
358
+ errors: missingBindings.map((b) => `\u53D8\u91CF ${b} \u672A\u6B63\u786E\u5BFC\u51FA`),
359
+ warnings: sensitivity.warnings.length > 0 ? sensitivity.warnings : void 0
360
+ };
361
+ }
362
+ return {
363
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
364
+ passed: true,
365
+ status: sensitivity.status,
366
+ errors: [],
367
+ warnings: sensitivity.warnings.length > 0 ? sensitivity.warnings : void 0
368
+ };
369
+ } catch (e) {
370
+ const errorMessage = e.message || String(e);
371
+ const errorLocation = e.stack?.split("\n")[1]?.trim() || "";
372
+ if (sensitivity.status === "runtime_skipped") {
373
+ return {
374
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
375
+ passed: true,
376
+ status: "runtime_skipped",
377
+ errors: [],
378
+ warnings: [
379
+ ...sensitivity.warnings,
380
+ `\u8FD0\u884C\u65F6\u6267\u884C\u5DF2\u8DF3\u8FC7\u4E25\u683C\u5224\u5B9A: ${errorMessage}`
381
+ ]
382
+ };
383
+ }
384
+ if (sensitivity.status === "env_dependent" && isEnvironmentRelatedRuntimeError(errorMessage)) {
385
+ return {
386
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
387
+ passed: true,
388
+ status: "env_dependent",
389
+ errors: [],
390
+ warnings: [
391
+ ...sensitivity.warnings,
392
+ `\u8FD0\u884C\u65F6\u6267\u884C\u53D7\u5BBF\u4E3B\u73AF\u5883\u5F71\u54CD: ${errorMessage}`
393
+ ]
394
+ };
395
+ }
396
+ return {
397
+ name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
398
+ passed: false,
399
+ status: "failed",
400
+ errors: [
401
+ `JavaScript \u6267\u884C\u9519\u8BEF: ${errorMessage}`,
402
+ ...errorLocation ? [`\u4F4D\u7F6E: ${errorLocation}`] : []
403
+ ],
404
+ warnings: sensitivity.warnings.length > 0 ? sensitivity.warnings : void 0
405
+ };
406
+ }
407
+ }
408
+
409
+ export { validateRuntimePrecheck };
@@ -1,6 +1,6 @@
1
- import { analyzeCodeWithAST } from './chunk-KMIDURUR.mjs';
2
- import { validateRuntimePrecheck } from './chunk-D2SXGGTX.mjs';
3
- import { compileSFC } from './chunk-BI5TIQID.mjs';
1
+ import { analyzeCodeWithAST } from './chunk-YRGYDK2I.mjs';
2
+ import { validateRuntimePrecheck } from './chunk-6HOIRUQB.mjs';
3
+ import { compileSFC } from './chunk-4OTQAQ6J.mjs';
4
4
 
5
5
  // src/tools/unifiedValidator.ts
6
6
  function validateCompilation(code) {
@@ -120,6 +120,28 @@ async function validateCode(code) {
120
120
  summary: `\u274C \u8FD0\u884C\u65F6\u9519\u8BEF: ${runtimeResult.errors[0]}`
121
121
  };
122
122
  }
123
+ if (runtimeResult.status === "env_dependent") {
124
+ return {
125
+ passed: true,
126
+ layers: {
127
+ compilation: compilationResult,
128
+ ast: astResult,
129
+ runtime: runtimeResult
130
+ },
131
+ summary: "\u26A0\uFE0F \u8FD0\u884C\u65F6\u68C0\u67E5\u53D7\u73AF\u5883\u5F71\u54CD\uFF0C\u7ED3\u679C\u4F9D\u8D56 mock"
132
+ };
133
+ }
134
+ if (runtimeResult.status === "runtime_skipped") {
135
+ return {
136
+ passed: true,
137
+ layers: {
138
+ compilation: compilationResult,
139
+ ast: astResult,
140
+ runtime: runtimeResult
141
+ },
142
+ summary: "\u26A0\uFE0F \u8FD0\u884C\u65F6\u68C0\u67E5\u5DF2\u964D\u7EA7\u4E3A\u8DF3\u8FC7\u4E25\u683C\u5224\u5B9A"
143
+ };
144
+ }
123
145
  return {
124
146
  passed: true,
125
147
  layers: {
@@ -143,13 +165,14 @@ function validateCodeSync(code) {
143
165
  };
144
166
  }
145
167
  const runtimeResult = validateRuntimePrecheck(code);
168
+ 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]}`;
146
169
  return {
147
170
  passed: runtimeResult.passed,
148
171
  layers: {
149
172
  compilation: compilationResult,
150
173
  runtime: runtimeResult
151
174
  },
152
- summary: runtimeResult.passed ? "\u2705 \u68C0\u67E5\u901A\u8FC7" : `\u274C ${runtimeResult.errors[0]}`
175
+ summary
153
176
  };
154
177
  }
155
178
 
@@ -28,6 +28,7 @@ var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
28
28
  var ALLOWED_IMPORT_SOURCES = [
29
29
  "vue",
30
30
  "@vue/",
31
+ "vue-router",
31
32
  "@king-design/vue",
32
33
  "@ksyun-internal/versatile"
33
34
  ];
@@ -87,6 +88,16 @@ function getRuntimeInjectedBindingsForSource(source) {
87
88
  if (source === "vue" || source.startsWith("@vue/")) {
88
89
  return VUE_RUNTIME_INJECTED_BINDINGS;
89
90
  }
91
+ if (source === "vue-router") {
92
+ return /* @__PURE__ */ new Set([
93
+ "useRouter",
94
+ "useRoute",
95
+ "onBeforeRouteLeave",
96
+ "onBeforeRouteUpdate",
97
+ "RouterLink",
98
+ "RouterView"
99
+ ]);
100
+ }
90
101
  if (source === "@ksyun-internal/versatile") {
91
102
  return VERSATILE_RUNTIME_INJECTED_BINDINGS;
92
103
  }
@@ -223,7 +234,7 @@ function transformValueImports(scriptContent, whitelist, strippedImports) {
223
234
  if (reason === "relative") {
224
235
  return transformImportToBinding(importClause, `__mockModule('${source}')`);
225
236
  }
226
- return "";
237
+ return transformImportToBinding(importClause, `__mockModule('${source}')`);
227
238
  }
228
239
  );
229
240
  nextScript = nextScript.replace(
@@ -234,7 +245,7 @@ function transformValueImports(scriptContent, whitelist, strippedImports) {
234
245
  if (reason === "relative") {
235
246
  return `__mockModule('${source}');`;
236
247
  }
237
- return "";
248
+ return `__mockModule('${source}');`;
238
249
  }
239
250
  );
240
251
  return nextScript;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkSZYVGYKK_js = require('./chunk-SZYVGYKK.js');
4
- var chunkEYKZY2F3_js = require('./chunk-EYKZY2F3.js');
5
- var chunkCR3GC4H3_js = require('./chunk-CR3GC4H3.js');
3
+ var chunkXPHDD6XR_js = require('./chunk-XPHDD6XR.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) {
@@ -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 = chunkCR3GC4H3_js.compileSFC(code, scopeId);
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 chunkSZYVGYKK_js.analyzeCodeWithAST(code);
67
+ const violations = await chunkXPHDD6XR_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 = chunkEYKZY2F3_js.validateRuntimePrecheck(code);
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 = chunkEYKZY2F3_js.validateRuntimePrecheck(code);
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: runtimeResult.passed ? "\u2705 \u68C0\u67E5\u901A\u8FC7" : `\u274C ${runtimeResult.errors[0]}`
177
+ summary
155
178
  };
156
179
  }
157
180
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkCR3GC4H3_js = require('./chunk-CR3GC4H3.js');
3
+ var chunkDHLWNT53_js = require('./chunk-DHLWNT53.js');
4
4
 
5
5
  // src/static/index.ts
6
6
  var scopeIdCounter = 0;
@@ -44,7 +44,7 @@ function validateCompilation(code) {
44
44
  errors: ["SFC \u7ED3\u6784\u9519\u8BEF: \u7F3A\u5C11 <template> \u6216 <script> \u6807\u7B7E"]
45
45
  };
46
46
  }
47
- const result = chunkCR3GC4H3_js.compileSFC(code, scopeId);
47
+ const result = chunkDHLWNT53_js.compileSFC(code, scopeId);
48
48
  if (result.error) {
49
49
  return {
50
50
  name: "\u7F16\u8BD1\u68C0\u67E5",
@@ -1,4 +1,4 @@
1
- import { compileSFC } from './chunk-BI5TIQID.mjs';
1
+ import { compileSFC } from './chunk-4OTQAQ6J.mjs';
2
2
 
3
3
  // src/static/index.ts
4
4
  var scopeIdCounter = 0;