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.
Files changed (327) hide show
  1. package/components/actions.json +109 -0
  2. package/components/advancedset.json +128 -0
  3. package/components/affix.json +8 -0
  4. package/components/aksk.json +172 -0
  5. package/components/anchor.json +220 -0
  6. package/components/anchorlink.json +111 -0
  7. package/components/az.json +15 -2
  8. package/components/badge.json +8 -0
  9. package/components/billtypes.json +14 -2
  10. package/components/breadcrumb.json +9 -1
  11. package/components/button.json +192 -0
  12. package/components/buttonlink.json +74 -0
  13. package/components/card.json +14 -4
  14. package/components/cardcol.json +142 -0
  15. package/components/cardcols.json +121 -0
  16. package/components/cardcontent.json +20 -3
  17. package/components/cardtabs.json +172 -0
  18. package/components/carousel.json +7 -0
  19. package/components/cascader.json +576 -368
  20. package/components/checkbox.json +51 -4
  21. package/components/cidrinput.json +140 -0
  22. package/components/code.json +8 -1
  23. package/components/collapse.json +335 -341
  24. package/components/colorpicker.json +217 -0
  25. package/components/configprovider.json +96 -0
  26. package/components/copy.json +7 -0
  27. package/components/copyhover.json +111 -0
  28. package/components/copyrow.json +125 -0
  29. package/components/datepicker.json +656 -524
  30. package/components/description.json +98 -0
  31. package/components/descriptions.json +10 -3
  32. package/components/diagram.json +295 -0
  33. package/components/dialog.json +526 -455
  34. package/components/divider.json +9 -1
  35. package/components/drawer.json +603 -558
  36. package/components/dropdown.json +464 -384
  37. package/components/duration.json +125 -0
  38. package/components/editable.json +66 -0
  39. package/components/ellipsis.json +34 -1
  40. package/components/filtertablefieldsdialog.json +128 -0
  41. package/components/flex.json +152 -0
  42. package/components/form.json +143 -3
  43. package/components/formiteminput.json +214 -0
  44. package/components/formitemspinner.json +213 -0
  45. package/components/formitemswitch.json +185 -0
  46. package/components/formitemtableconfigs.json +210 -0
  47. package/components/grid.json +7 -0
  48. package/components/header.json +165 -0
  49. package/components/icon.json +13 -1
  50. package/components/icontooltip.json +19 -1
  51. package/components/input.json +196 -8
  52. package/components/instancelist.json +194 -0
  53. package/components/instancenum.json +196 -0
  54. package/components/ipinput.json +117 -0
  55. package/components/kspstatus.json +205 -0
  56. package/components/kvcode.json +120 -0
  57. package/components/layoutcontent.json +24 -3
  58. package/components/layoutlistcontent.json +157 -0
  59. package/components/layoutpermissioncontent.json +156 -0
  60. package/components/layoutstandardlist.json +276 -0
  61. package/components/layouttabs.json +168 -0
  62. package/components/lazymount.json +87 -0
  63. package/components/lazyteleport.json +119 -0
  64. package/components/menu.json +11 -3
  65. package/components/notification.json +351 -0
  66. package/components/pagination.json +12 -0
  67. package/components/paginationplus.json +30 -3
  68. package/components/password.json +121 -0
  69. package/components/popover.json +457 -437
  70. package/components/projects.json +129 -0
  71. package/components/protable.json +99 -8
  72. package/components/queuevisualrange.json +110 -0
  73. package/components/radio.json +82 -2
  74. package/components/rate.json +200 -0
  75. package/components/region.json +14 -2
  76. package/components/scrollselect.json +140 -0
  77. package/components/search.json +221 -0
  78. package/components/searchinput.json +132 -0
  79. package/components/searchitems.json +215 -0
  80. package/components/searchselect.json +195 -0
  81. package/components/select.json +749 -666
  82. package/components/sidebar.json +198 -0
  83. package/components/skeleton.json +234 -0
  84. package/components/slider.json +12 -2
  85. package/components/spin.json +10 -2
  86. package/components/spinner.json +419 -429
  87. package/components/split.json +263 -0
  88. package/components/sshkeys.json +138 -0
  89. package/components/status.json +60 -3
  90. package/components/steps.json +7 -0
  91. package/components/switch.json +12 -3
  92. package/components/table.json +24 -2
  93. package/components/tablecolumnid.json +14 -2
  94. package/components/tabs.json +14 -2
  95. package/components/tag.json +8 -5
  96. package/components/timeline.json +215 -0
  97. package/components/timepicker.json +147 -3
  98. package/components/timerange.json +262 -0
  99. package/components/tip.json +27 -0
  100. package/components/tooltip.json +492 -395
  101. package/components/tour.json +418 -372
  102. package/components/transfer.json +79 -8
  103. package/components/tree.json +28 -5
  104. package/components/treeselect.json +612 -475
  105. package/components/upload.json +474 -473
  106. package/components/vdialog.json +309 -0
  107. package/components/vdrawer.json +335 -0
  108. package/components/virtuallist.json +7 -0
  109. package/dist/ast/index.d.mts +65 -2
  110. package/dist/ast/index.d.ts +65 -2
  111. package/dist/ast/index.js +4 -3
  112. package/dist/ast/index.mjs +2 -1
  113. package/dist/chunk-4OTQAQ6J.mjs +341 -0
  114. package/dist/{chunk-F26GUCGG.js → chunk-4WXOYU2N.js} +32 -9
  115. package/dist/chunk-6HOIRUQB.mjs +409 -0
  116. package/dist/chunk-DHLWNT53.js +364 -0
  117. package/dist/{chunk-H2ET6MMM.mjs → chunk-IPJJMPOO.mjs} +155 -66
  118. package/dist/{chunk-WYSRJVX4.js → chunk-JJ6AB4ZH.js} +2 -2
  119. package/dist/{chunk-2W6OCG2S.js → chunk-JNRGUR3O.js} +155 -67
  120. package/dist/chunk-KF5YBEM5.js +143 -0
  121. package/dist/{chunk-OJOHB64C.mjs → chunk-LRTDTFFQ.mjs} +28 -5
  122. package/dist/{chunk-DSWKLUIX.mjs → chunk-NZL6T22V.mjs} +1 -1
  123. package/dist/chunk-QC6VTSA3.mjs +117 -0
  124. package/dist/chunk-V5N65MRP.js +411 -0
  125. package/dist/full/index.d.mts +2 -0
  126. package/dist/full/index.d.ts +2 -0
  127. package/dist/full/index.js +7 -6
  128. package/dist/full/index.mjs +5 -4
  129. package/dist/index.d.mts +1 -0
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.js +14 -13
  132. package/dist/index.mjs +6 -5
  133. package/dist/metadata/index.d.mts +38 -3
  134. package/dist/metadata/index.d.ts +38 -3
  135. package/dist/metadata/index.js +26 -16
  136. package/dist/metadata/index.mjs +26 -15
  137. package/dist/resolve-BsLBxlBi.d.mts +24 -0
  138. package/dist/resolve-BsLBxlBi.d.ts +24 -0
  139. package/dist/runtime/index.d.mts +2 -0
  140. package/dist/runtime/index.d.ts +2 -0
  141. package/dist/runtime/index.js +4 -4
  142. package/dist/runtime/index.mjs +2 -2
  143. package/dist/shared/index.d.mts +10 -0
  144. package/dist/shared/index.d.ts +10 -0
  145. package/dist/shared/index.js +23 -0
  146. package/dist/shared/index.mjs +2 -0
  147. package/dist/static/index.js +5 -5
  148. package/dist/static/index.mjs +2 -2
  149. package/docs_for_llm/actions.doc.md +87 -0
  150. package/docs_for_llm/advancedset.doc.md +98 -0
  151. package/docs_for_llm/affix.doc.md +20 -7
  152. package/docs_for_llm/aksk.doc.md +111 -0
  153. package/docs_for_llm/anchor.doc.md +155 -0
  154. package/docs_for_llm/anchorlink.doc.md +75 -0
  155. package/docs_for_llm/az.doc.md +17 -11
  156. package/docs_for_llm/badge.doc.md +11 -5
  157. package/docs_for_llm/billtypes.doc.md +17 -11
  158. package/docs_for_llm/breadcrumb.doc.md +80 -4
  159. package/docs_for_llm/button.doc.md +91 -18
  160. package/docs_for_llm/buttonlink.doc.md +64 -0
  161. package/docs_for_llm/card.doc.md +58 -8
  162. package/docs_for_llm/cardcol.doc.md +78 -0
  163. package/docs_for_llm/cardcols.doc.md +84 -0
  164. package/docs_for_llm/cardcontent.doc.md +31 -10
  165. package/docs_for_llm/cardtabs.doc.md +106 -0
  166. package/docs_for_llm/carousel.doc.md +79 -7
  167. package/docs_for_llm/cascader.doc.md +106 -23
  168. package/docs_for_llm/checkbox.doc.md +25 -13
  169. package/docs_for_llm/cidrinput.doc.md +83 -0
  170. package/docs_for_llm/code.doc.md +22 -11
  171. package/docs_for_llm/collapse.doc.md +147 -14
  172. package/docs_for_llm/colorpicker.doc.md +104 -0
  173. package/docs_for_llm/configprovider.doc.md +77 -0
  174. package/docs_for_llm/copy.doc.md +15 -13
  175. package/docs_for_llm/copyhover.doc.md +59 -0
  176. package/docs_for_llm/copyrow.doc.md +80 -0
  177. package/docs_for_llm/datepicker.doc.md +66 -35
  178. package/docs_for_llm/description.doc.md +75 -0
  179. package/docs_for_llm/descriptions.doc.md +122 -10
  180. package/docs_for_llm/diagram.doc.md +343 -0
  181. package/docs_for_llm/dialog.doc.md +97 -77
  182. package/docs_for_llm/divider.doc.md +14 -7
  183. package/docs_for_llm/drawer.doc.md +114 -69
  184. package/docs_for_llm/dropdown.doc.md +290 -22
  185. package/docs_for_llm/duration.doc.md +76 -0
  186. package/docs_for_llm/editable.doc.md +36 -14
  187. package/docs_for_llm/ellipsis.doc.md +10 -5
  188. package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
  189. package/docs_for_llm/flex.doc.md +83 -0
  190. package/docs_for_llm/form.doc.md +196 -18
  191. package/docs_for_llm/formiteminput.doc.md +128 -0
  192. package/docs_for_llm/formitemspinner.doc.md +105 -0
  193. package/docs_for_llm/formitemswitch.doc.md +113 -0
  194. package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
  195. package/docs_for_llm/grid.doc.md +78 -5
  196. package/docs_for_llm/header.doc.md +114 -0
  197. package/docs_for_llm/icon.doc.md +12 -8
  198. package/docs_for_llm/icontooltip.doc.md +121 -0
  199. package/docs_for_llm/input.doc.md +199 -41
  200. package/docs_for_llm/instancelist.doc.md +113 -0
  201. package/docs_for_llm/instancenum.doc.md +95 -0
  202. package/docs_for_llm/ipinput.doc.md +77 -0
  203. package/docs_for_llm/kspstatus.doc.md +82 -0
  204. package/docs_for_llm/kvcode.doc.md +76 -0
  205. package/docs_for_llm/layoutcontent.doc.md +54 -17
  206. package/docs_for_llm/layoutlistcontent.doc.md +168 -0
  207. package/docs_for_llm/layoutpermissioncontent.doc.md +93 -0
  208. package/docs_for_llm/layoutstandardlist.doc.md +129 -0
  209. package/docs_for_llm/layouttabs.doc.md +101 -0
  210. package/docs_for_llm/lazymount.doc.md +82 -0
  211. package/docs_for_llm/lazyteleport.doc.md +85 -0
  212. package/docs_for_llm/menu.doc.md +139 -14
  213. package/docs_for_llm/message.doc.md +93 -10
  214. package/docs_for_llm/notification.doc.md +214 -0
  215. package/docs_for_llm/pagination.doc.md +30 -17
  216. package/docs_for_llm/paginationplus.doc.md +31 -10
  217. package/docs_for_llm/password.doc.md +86 -0
  218. package/docs_for_llm/popover.doc.md +24 -55
  219. package/docs_for_llm/progress.doc.md +13 -10
  220. package/docs_for_llm/projects.doc.md +91 -0
  221. package/docs_for_llm/protable.doc.md +98 -15
  222. package/docs_for_llm/queuevisualrange.doc.md +78 -0
  223. package/docs_for_llm/radio.doc.md +23 -8
  224. package/docs_for_llm/rate.doc.md +127 -0
  225. package/docs_for_llm/region.doc.md +25 -13
  226. package/docs_for_llm/scrollselect.doc.md +90 -0
  227. package/docs_for_llm/search.doc.md +120 -0
  228. package/docs_for_llm/searchinput.doc.md +111 -0
  229. package/docs_for_llm/searchitems.doc.md +116 -0
  230. package/docs_for_llm/searchselect.doc.md +126 -0
  231. package/docs_for_llm/select.doc.md +208 -49
  232. package/docs_for_llm/sidebar.doc.md +133 -0
  233. package/docs_for_llm/skeleton.doc.md +152 -0
  234. package/docs_for_llm/slider.doc.md +42 -22
  235. package/docs_for_llm/spin.doc.md +18 -6
  236. package/docs_for_llm/spinner.doc.md +28 -18
  237. package/docs_for_llm/split.doc.md +170 -0
  238. package/docs_for_llm/sshkeys.doc.md +88 -0
  239. package/docs_for_llm/status.doc.md +14 -9
  240. package/docs_for_llm/steps.doc.md +81 -7
  241. package/docs_for_llm/switch.doc.md +32 -16
  242. package/docs_for_llm/table.doc.md +317 -55
  243. package/docs_for_llm/tablecolumnid.doc.md +36 -16
  244. package/docs_for_llm/tabs.doc.md +117 -12
  245. package/docs_for_llm/tag.doc.md +167 -15
  246. package/docs_for_llm/timeline.doc.md +187 -0
  247. package/docs_for_llm/timepicker.doc.md +74 -36
  248. package/docs_for_llm/timerange.doc.md +157 -0
  249. package/docs_for_llm/tip.doc.md +50 -11
  250. package/docs_for_llm/tooltip.doc.md +99 -27
  251. package/docs_for_llm/tour.doc.md +125 -28
  252. package/docs_for_llm/transfer.doc.md +99 -33
  253. package/docs_for_llm/tree.doc.md +129 -24
  254. package/docs_for_llm/treeselect.doc.md +101 -44
  255. package/docs_for_llm/upload.doc.md +63 -32
  256. package/docs_for_llm/useCRUD.doc.md +49 -0
  257. package/docs_for_llm/useCountdown.doc.md +43 -0
  258. package/docs_for_llm/useDetail.doc.md +48 -0
  259. package/docs_for_llm/useDialog.doc.md +46 -0
  260. package/docs_for_llm/useEntity.doc.md +45 -0
  261. package/docs_for_llm/useEventListener.doc.md +44 -0
  262. package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
  263. package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
  264. package/docs_for_llm/useGetUserPermission.doc.md +43 -0
  265. package/docs_for_llm/useGroup.doc.md +48 -0
  266. package/docs_for_llm/useIdEntities.doc.md +48 -0
  267. package/docs_for_llm/useIdEntity.doc.md +103 -0
  268. package/docs_for_llm/useInterval.doc.md +43 -0
  269. package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
  270. package/docs_for_llm/useMessage.doc.md +46 -0
  271. package/docs_for_llm/useModifyCache.doc.md +37 -0
  272. package/docs_for_llm/useOpenDialog.doc.md +41 -0
  273. package/docs_for_llm/usePagination.doc.md +60 -0
  274. package/docs_for_llm/usePersist.doc.md +54 -0
  275. package/docs_for_llm/usePoll.doc.md +41 -0
  276. package/docs_for_llm/useRoutePlus.doc.md +34 -0
  277. package/docs_for_llm/useRouterPlus.doc.md +34 -0
  278. package/docs_for_llm/useSearch.doc.md +68 -0
  279. package/docs_for_llm/useShell.doc.md +43 -0
  280. package/docs_for_llm/useSkip.doc.md +41 -0
  281. package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
  282. package/docs_for_llm/useStore.doc.md +34 -0
  283. package/docs_for_llm/useTable.doc.md +57 -0
  284. package/docs_for_llm/useTableGroup.doc.md +47 -0
  285. package/docs_for_llm/useTableSort.doc.md +40 -0
  286. package/docs_for_llm/useToState.doc.md +112 -0
  287. package/docs_for_llm/useUser.doc.md +38 -0
  288. package/docs_for_llm/useValidForm.doc.md +41 -0
  289. package/docs_for_llm/vdialog.doc.md +154 -0
  290. package/docs_for_llm/vdrawer.doc.md +148 -0
  291. package/docs_for_llm/virtuallist.doc.md +157 -3
  292. package/hooks/useCRUD.json +61 -0
  293. package/hooks/useCountdown.json +49 -0
  294. package/hooks/useDetail.json +67 -0
  295. package/hooks/useDialog.json +49 -0
  296. package/hooks/useEntity.json +61 -0
  297. package/hooks/useEventListener.json +61 -0
  298. package/hooks/useFalseUntilTruthy.json +43 -0
  299. package/hooks/useGetCopyAuthText.json +36 -0
  300. package/hooks/useGetUserPermission.json +55 -0
  301. package/hooks/useGroup.json +49 -0
  302. package/hooks/useIdEntities.json +61 -0
  303. package/hooks/useInterval.json +55 -0
  304. package/hooks/useLayoutStandardList.json +36 -0
  305. package/hooks/useMessage.json +73 -0
  306. package/hooks/useModifyCache.json +36 -0
  307. package/hooks/useOpenDialog.json +43 -0
  308. package/hooks/usePagination.json +49 -0
  309. package/hooks/usePersist.json +61 -0
  310. package/hooks/usePoll.json +43 -0
  311. package/hooks/useRoutePlus.json +36 -0
  312. package/hooks/useRouterPlus.json +36 -0
  313. package/hooks/useSearch.json +56 -0
  314. package/hooks/useShell.json +49 -0
  315. package/hooks/useSkip.json +43 -0
  316. package/hooks/useStorageIdEntity.json +67 -0
  317. package/hooks/useStore.json +36 -0
  318. package/hooks/useTable.json +49 -0
  319. package/hooks/useTableGroup.json +43 -0
  320. package/hooks/useTableSort.json +43 -0
  321. package/hooks/useUser.json +36 -0
  322. package/hooks/useValidForm.json +43 -0
  323. package/package.json +14 -8
  324. package/dist/chunk-D3Y6FGWA.js +0 -153
  325. package/dist/chunk-HPAUCD5I.js +0 -156
  326. package/dist/chunk-L4DS3EXI.mjs +0 -133
  327. package/dist/chunk-NZ6TLWMD.mjs +0 -151
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHPAUCD5I_js = require('./chunk-HPAUCD5I.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 = chunkHPAUCD5I_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,14 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ var chunkKF5YBEM5_js = require('./chunk-KF5YBEM5.js');
3
4
  var chunkJSBRDJBE_js = require('./chunk-JSBRDJBE.js');
4
5
  var fs = require('fs/promises');
5
6
  var fsSync = require('fs');
6
7
  var path = require('path');
7
- var url = require('url');
8
8
  var compilerSfc = require('@vue/compiler-sfc');
9
9
  var ts = require('typescript');
10
10
 
11
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
12
11
  function _interopNamespace(e) {
13
12
  if (e && e.__esModule) return e;
14
13
  var n = Object.create(null);
@@ -32231,14 +32230,8 @@ var require_compiler_core = chunkJSBRDJBE_js.__commonJS({
32231
32230
  }
32232
32231
  }
32233
32232
  });
32234
- var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2W6OCG2S.js', document.baseURI).href)));
32235
- var __dirname$1 = path__namespace.dirname(__filename$1);
32236
32233
  function resolveComponentsPath() {
32237
- const prodPath = path__namespace.join(__dirname$1, "../components");
32238
- if (fsSync__namespace.existsSync(prodPath)) return prodPath;
32239
- const devPath = path__namespace.join(__dirname$1, "../../components");
32240
- if (fsSync__namespace.existsSync(devPath)) return devPath;
32241
- return prodPath;
32234
+ return chunkKF5YBEM5_js.resolvePackageResourceDir("components");
32242
32235
  }
32243
32236
  var ComponentRegistry = class {
32244
32237
  constructor() {
@@ -32248,27 +32241,42 @@ var ComponentRegistry = class {
32248
32241
  // Path to components directory (resolved dynamically for dev/prod compatibility)
32249
32242
  this.metadataPath = resolveComponentsPath();
32250
32243
  }
32251
- async load() {
32252
- if (this.loaded) return;
32253
- await this.reload();
32254
- this.loaded = true;
32255
- this.startWatching();
32244
+ async load(options = {}) {
32245
+ if (!this.loaded) {
32246
+ await this.reload();
32247
+ this.loaded = true;
32248
+ }
32249
+ if (options.watch) {
32250
+ this.startWatching();
32251
+ }
32256
32252
  }
32257
32253
  /**
32258
32254
  * 重新加载所有组件元数据
32259
32255
  */
32260
32256
  async reload() {
32261
32257
  const newComponents = /* @__PURE__ */ new Map();
32258
+ const rawComponents = {};
32262
32259
  try {
32263
32260
  const files = await fs__namespace.readdir(this.metadataPath);
32264
32261
  for (const file of files) {
32265
32262
  if (!file.endsWith(".json")) continue;
32266
32263
  const content = await fs__namespace.readFile(path__namespace.join(this.metadataPath, file), "utf-8");
32267
32264
  const data = JSON.parse(content);
32268
- newComponents.set(data.name, data);
32269
- if (data.subComponents) {
32270
- for (const sub of data.subComponents) {
32271
- newComponents.set(sub.name, sub);
32265
+ rawComponents[data.name] = data;
32266
+ }
32267
+ for (const data of Object.values(rawComponents)) {
32268
+ const resolvedData = chunkKF5YBEM5_js.resolveMetadataInheritance(data, rawComponents);
32269
+ newComponents.set(resolvedData.name, resolvedData);
32270
+ if (resolvedData.subComponents) {
32271
+ for (const sub of resolvedData.subComponents) {
32272
+ newComponents.set(sub.name, {
32273
+ id: sub.name,
32274
+ name: sub.name,
32275
+ props: sub.props || [],
32276
+ events: sub.events || [],
32277
+ slots: sub.slots || [],
32278
+ methods: sub.methods || []
32279
+ });
32272
32280
  }
32273
32281
  }
32274
32282
  }
@@ -32324,14 +32332,8 @@ var componentRegistry = new ComponentRegistry();
32324
32332
 
32325
32333
  // src/analysis/astReviewer.ts
32326
32334
  var import_compiler_core = chunkJSBRDJBE_js.__toESM(require_compiler_core());
32327
- var __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2W6OCG2S.js', document.baseURI).href)));
32328
- var __dirname2 = path__namespace.dirname(__filename2);
32329
32335
  function resolveHooksPath() {
32330
- const prodPath = path__namespace.join(__dirname2, "../hooks");
32331
- if (fsSync__namespace.existsSync(prodPath)) return prodPath;
32332
- const devPath = path__namespace.join(__dirname2, "../../hooks");
32333
- if (fsSync__namespace.existsSync(devPath)) return devPath;
32334
- return prodPath;
32336
+ return chunkKF5YBEM5_js.resolvePackageResourceDir("hooks");
32335
32337
  }
32336
32338
  var HooksRegistry = class {
32337
32339
  constructor() {
@@ -32340,11 +32342,14 @@ var HooksRegistry = class {
32340
32342
  this.watcher = null;
32341
32343
  this.metadataPath = resolveHooksPath();
32342
32344
  }
32343
- async load() {
32344
- if (this.loaded) return;
32345
- await this.reload();
32346
- this.loaded = true;
32347
- this.startWatching();
32345
+ async load(options = {}) {
32346
+ if (!this.loaded) {
32347
+ await this.reload();
32348
+ this.loaded = true;
32349
+ }
32350
+ if (options.watch) {
32351
+ this.startWatching();
32352
+ }
32348
32353
  }
32349
32354
  /**
32350
32355
  * 重新加载所有 hooks 元数据
@@ -32747,24 +32752,10 @@ var STRICT_CHECK_ATTRIBUTES = /* @__PURE__ */ new Set([
32747
32752
  "checked",
32748
32753
  "selected"
32749
32754
  ]);
32750
- var VERSATILE_COMPONENTS = /* @__PURE__ */ new Set([
32751
- "BillTypes",
32752
- "Region",
32753
- "AZ",
32754
- "LayoutContent",
32755
- "CardContent",
32756
- "ProTable",
32757
- "PaginationPlus",
32758
- "Status",
32759
- "TableColumnId",
32760
- "IconTooltip",
32761
- "ButtonLink"
32762
- ]);
32763
32755
  var NESTING_RULES = {
32764
32756
  "DropdownItem": ["DropdownMenu"],
32765
32757
  "DropdownMenu": ["Dropdown"],
32766
32758
  "TableColumn": ["Table", "ProTable"],
32767
- "FormItem": ["Form"],
32768
32759
  "Tab": ["Tabs"],
32769
32760
  "Step": ["Steps"],
32770
32761
  "MenuItem": ["Menu", "SubMenu"],
@@ -33013,6 +33004,16 @@ function isTemplateBuiltin(id) {
33013
33004
  function isJsKeyword(id) {
33014
33005
  return JS_KEYWORDS.has(id);
33015
33006
  }
33007
+ function resolveExpectedImportSource(metadata) {
33008
+ const importStatement = metadata.importStatement || "";
33009
+ if (importStatement.includes("@ksyun-internal/versatile")) {
33010
+ return "@ksyun-internal/versatile";
33011
+ }
33012
+ if (importStatement.includes("@king-design/vue")) {
33013
+ return "@king-design/vue";
33014
+ }
33015
+ return null;
33016
+ }
33016
33017
  function checkImport(node, violations, sourceFile) {
33017
33018
  const moduleSpecifier = node.moduleSpecifier.getText(sourceFile).replace(/['\"]/g, "");
33018
33019
  if (moduleSpecifier === "@king-design/vue" || moduleSpecifier === "@ksyun-internal/versatile") {
@@ -33056,10 +33057,10 @@ function checkImport(node, violations, sourceFile) {
33056
33057
  suggestion: `\u76F4\u63A5\u4F7F\u7528\u539F\u540D: import { ${originalName} } from '${moduleSpecifier}'`
33057
33058
  });
33058
33059
  }
33059
- if (componentRegistry.isKnownComponent(originalName)) {
33060
- const isVersatile = VERSATILE_COMPONENTS.has(originalName);
33061
- const expectedPackage = isVersatile ? "@ksyun-internal/versatile" : "@king-design/vue";
33062
- if (expectedPackage !== moduleSpecifier) {
33060
+ const metadata = componentRegistry.getComponent(originalName);
33061
+ if (metadata) {
33062
+ const expectedPackage = resolveExpectedImportSource(metadata);
33063
+ if (expectedPackage && expectedPackage !== moduleSpecifier) {
33063
33064
  violations.push({
33064
33065
  rule: `\u7EC4\u4EF6 ${originalName} \u5BFC\u5165\u6E90\u9519\u8BEF`,
33065
33066
  match: `import { ... } from '${moduleSpecifier}'`,
@@ -33091,7 +33092,7 @@ function checkNestingRules(tagName, metadata, ancestors, violations) {
33091
33092
  });
33092
33093
  }
33093
33094
  }
33094
- function checkComponentSpecificRules(tagName, node, violations) {
33095
+ function checkComponentSpecificRules(tagName, node, metadata, violations) {
33095
33096
  if (tagName === "Dropdown") {
33096
33097
  node.children?.forEach((child) => {
33097
33098
  if (child.type === 1 && child.tag === "template") {
@@ -33130,23 +33131,110 @@ function checkComponentSpecificRules(tagName, node, violations) {
33130
33131
  }
33131
33132
  });
33132
33133
  }
33133
- if (tagName === "TableColumn") {
33134
- node.children?.forEach((child) => {
33135
- if (child.type === 1 && child.tag === "template") {
33136
- const slotProp = child.props?.find((p) => p.type === 7 && p.name === "slot");
33137
- if (slotProp && slotProp.exp && slotProp.exp.content) {
33138
- const exp = slotProp.exp.content.trim();
33139
- if (exp.startsWith("{") && exp.endsWith("}")) {
33140
- violations.push({
33141
- rule: "TableColumn \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u6570\u7EC4\u7ED3\u6784",
33142
- match: exp,
33143
- suggestion: `King Design \u8868\u683C\u63D2\u69FD\u53C2\u6570\u4E3A\u6570\u7EC4\u987A\u5E8F\u4F20\u9012\uFF0C\u8BF7\u5C06 ${exp} \u6539\u4E3A [row]`
33144
- });
33145
- }
33146
- }
33147
- }
33148
- });
33134
+ if (!metadata?.slots?.length) {
33135
+ return;
33136
+ }
33137
+ const validateSlotBinding = (slotName, expression) => {
33138
+ if (!expression) return;
33139
+ const slot = metadata.slots.find((item) => item.name === slotName);
33140
+ if (!slot) return;
33141
+ const exp = expression.trim();
33142
+ const bindingType = resolveSlotBindingType(slot);
33143
+ if (!bindingType) return;
33144
+ if (bindingType === "none") {
33145
+ violations.push({
33146
+ rule: `${tagName} \u63D2\u69FD #${slotName} \u4E0D\u63D0\u4F9B\u53C2\u6570`,
33147
+ match: exp,
33148
+ suggestion: `\u8BF7\u79FB\u9664 ${slotName} \u63D2\u69FD\u4E0A\u7684\u53C2\u6570\u58F0\u660E`
33149
+ });
33150
+ return;
33151
+ }
33152
+ if (bindingType === "array" && isObjectDestructuringExpression(exp)) {
33153
+ violations.push({
33154
+ rule: `${tagName} \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u6570\u7EC4\u7ED3\u6784`,
33155
+ match: exp,
33156
+ suggestion: `\u8BF7\u5C06 ${exp} \u6539\u4E3A ${getSlotBindingExample(slot, "array")}`
33157
+ });
33158
+ return;
33159
+ }
33160
+ if (bindingType === "object" && isArrayDestructuringExpression(exp)) {
33161
+ violations.push({
33162
+ rule: `${tagName} \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u5BF9\u8C61\u7ED3\u6784`,
33163
+ match: exp,
33164
+ suggestion: `\u8BF7\u5C06 ${exp} \u6539\u4E3A ${getSlotBindingExample(slot, "object")}`
33165
+ });
33166
+ return;
33167
+ }
33168
+ if (bindingType === "single" && (isArrayDestructuringExpression(exp) || isObjectDestructuringExpression(exp))) {
33169
+ violations.push({
33170
+ rule: `${tagName} \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u5355\u503C\u7ED3\u6784`,
33171
+ match: exp,
33172
+ suggestion: `\u8BF7\u5C06 ${exp} \u6539\u4E3A ${getSlotBindingExample(slot, "single")}`
33173
+ });
33174
+ }
33175
+ };
33176
+ node.props.forEach((prop) => {
33177
+ if (prop.type !== 7 || prop.name !== "slot") return;
33178
+ validateSlotBinding(slotNameFromVSlotDirective(prop), getDirectiveExpressionContent(prop.exp));
33179
+ });
33180
+ node.children?.forEach((child) => {
33181
+ if (child.type !== 1 || child.tag !== "template") return;
33182
+ const slotProp = child.props?.find((p) => p.type === 7 && p.name === "slot");
33183
+ if (!slotProp) return;
33184
+ validateSlotBinding(slotNameFromVSlotDirective(slotProp), getDirectiveExpressionContent(slotProp.exp));
33185
+ });
33186
+ }
33187
+ function isArrayDestructuringExpression(expression) {
33188
+ return expression.startsWith("[") && expression.endsWith("]");
33189
+ }
33190
+ function isObjectDestructuringExpression(expression) {
33191
+ return expression.startsWith("{") && expression.endsWith("}");
33192
+ }
33193
+ function extractBindingExpressionFromVueTemplate(vueTemplate) {
33194
+ if (!vueTemplate) return void 0;
33195
+ const match = vueTemplate.match(/=\s*"([^"]+)"/);
33196
+ return match?.[1]?.trim();
33197
+ }
33198
+ function getDirectiveExpressionContent(exp) {
33199
+ if (!exp || !("content" in exp)) return void 0;
33200
+ return typeof exp.content === "string" ? exp.content : void 0;
33201
+ }
33202
+ function resolveSlotBindingType(slot) {
33203
+ if (slot.bindingType) {
33204
+ return slot.bindingType;
33205
+ }
33206
+ const templateExpression = extractBindingExpressionFromVueTemplate(slot.vueTemplate);
33207
+ if (templateExpression) {
33208
+ if (isArrayDestructuringExpression(templateExpression)) return "array";
33209
+ if (isObjectDestructuringExpression(templateExpression)) return "object";
33210
+ }
33211
+ const destructuringExample = slot.slotProps?.find((prop) => prop.destructuringExample)?.destructuringExample?.trim();
33212
+ if (destructuringExample) {
33213
+ if (isArrayDestructuringExpression(destructuringExample)) return "array";
33214
+ if (isObjectDestructuringExpression(destructuringExample)) return "object";
33215
+ }
33216
+ return void 0;
33217
+ }
33218
+ function getSlotBindingExample(slot, fallbackType) {
33219
+ const templateExpression = extractBindingExpressionFromVueTemplate(slot.vueTemplate);
33220
+ if (templateExpression) {
33221
+ return templateExpression;
33222
+ }
33223
+ const destructuringExample = slot.slotProps?.find((prop) => prop.destructuringExample)?.destructuringExample?.trim();
33224
+ if (destructuringExample) {
33225
+ return destructuringExample;
33226
+ }
33227
+ const paramNames = slot.slotProps?.map((prop) => prop.name).filter(Boolean) || [];
33228
+ if (paramNames.length > 0) {
33229
+ if (fallbackType === "single") {
33230
+ return paramNames[0];
33231
+ }
33232
+ return fallbackType === "array" ? `[${paramNames.join(", ")}]` : `{ ${paramNames.join(", ")} }`;
33233
+ }
33234
+ if (fallbackType === "single") {
33235
+ return "slotProp";
33149
33236
  }
33237
+ return fallbackType === "array" ? "[slotProps]" : "{ slotProps }";
33150
33238
  }
33151
33239
  function typeRawAllowsNumber(typeRaw) {
33152
33240
  if (!typeRaw) return false;
@@ -33237,7 +33325,7 @@ function checkEvents(tagName, node, metadata, violations) {
33237
33325
  (e) => e.name === eventName || e.name === camelCaseEvent || e.name.toLowerCase() === eventName.toLowerCase()
33238
33326
  );
33239
33327
  const isNativeEvent = NATIVE_EVENTS.has(eventName);
33240
- if (!isEventValid && !isNativeEvent && metadata.events && metadata.events.length > 0) {
33328
+ if (!isEventValid && !isNativeEvent) {
33241
33329
  violations.push({
33242
33330
  rule: `\u4E8B\u4EF6 @${eventName} \u4E0D\u5B58\u5728\u4E8E ${tagName}`,
33243
33331
  match: `@${eventName}`,
@@ -33312,7 +33400,7 @@ function checkTemplate(node, violations, ancestors) {
33312
33400
  if (metadata) {
33313
33401
  checkNestingRules(displayTag, metadata, ancestors, violations);
33314
33402
  }
33315
- checkComponentSpecificRules(displayTag, elementNode, violations);
33403
+ checkComponentSpecificRules(displayTag, elementNode, metadata, violations);
33316
33404
  if (metadata) {
33317
33405
  checkProps(displayTag, elementNode, metadata, violations);
33318
33406
  checkEvents(displayTag, elementNode, metadata, violations);
@@ -0,0 +1,143 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var path = require('path');
5
+ var module$1 = require('module');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
26
+ var path__namespace = /*#__PURE__*/_interopNamespace(path);
27
+
28
+ // src/metadata/resolve.ts
29
+ function normalizeMetadataName(value) {
30
+ return value.toLowerCase().replace(/[^a-z0-9]/g, "");
31
+ }
32
+ function findMetadata(lookup, componentName) {
33
+ if (lookup[componentName]) return lookup[componentName];
34
+ const normalized = normalizeMetadataName(componentName);
35
+ return Object.values(lookup).find(
36
+ (item) => normalizeMetadataName(item.name) === normalized || normalizeMetadataName(item.id || "") === normalized
37
+ );
38
+ }
39
+ function mergeNamedItems(inheritedItems = [], localItems = [], sourceName, excludeNames, annotateTags = false) {
40
+ const merged = /* @__PURE__ */ new Map();
41
+ const excluded = new Set(excludeNames.map(normalizeMetadataName));
42
+ for (const item of inheritedItems) {
43
+ if (!item?.name || excluded.has(normalizeMetadataName(item.name))) continue;
44
+ const nextItem = annotateTags ? {
45
+ ...item,
46
+ tags: [.../* @__PURE__ */ new Set([...item.tags || [], `inherited:${sourceName}`])]
47
+ } : { ...item };
48
+ merged.set(normalizeMetadataName(item.name), nextItem);
49
+ }
50
+ for (const item of localItems) {
51
+ if (!item?.name) continue;
52
+ merged.set(normalizeMetadataName(item.name), item);
53
+ }
54
+ return Array.from(merged.values());
55
+ }
56
+ function resolveMetadataInheritance(metadata, lookup, visited = /* @__PURE__ */ new Set()) {
57
+ const visitKey = normalizeMetadataName(metadata.name || metadata.id || "");
58
+ if (!visitKey || visited.has(visitKey)) {
59
+ return metadata;
60
+ }
61
+ const nextVisited = new Set(visited);
62
+ nextVisited.add(visitKey);
63
+ let resolvedProps = [...metadata.props || []];
64
+ let resolvedEvents = [...metadata.events || []];
65
+ let resolvedSlots = [...metadata.slots || []];
66
+ let resolvedMethods = [...metadata.methods || []];
67
+ for (const inheritance of metadata.inherits || []) {
68
+ const parent = findMetadata(lookup, inheritance.component);
69
+ if (!parent) continue;
70
+ const resolvedParent = resolveMetadataInheritance(parent, lookup, nextVisited);
71
+ const include = inheritance.include || ["props", "events", "slots", "methods"];
72
+ const exclude = inheritance.exclude || [];
73
+ if (include.includes("props")) {
74
+ resolvedProps = mergeNamedItems(
75
+ resolvedParent.props || [],
76
+ resolvedProps,
77
+ resolvedParent.name,
78
+ exclude,
79
+ true
80
+ );
81
+ }
82
+ if (include.includes("events")) {
83
+ resolvedEvents = mergeNamedItems(
84
+ resolvedParent.events || [],
85
+ resolvedEvents,
86
+ resolvedParent.name,
87
+ exclude
88
+ );
89
+ }
90
+ if (include.includes("slots")) {
91
+ resolvedSlots = mergeNamedItems(
92
+ resolvedParent.slots || [],
93
+ resolvedSlots,
94
+ resolvedParent.name,
95
+ exclude
96
+ );
97
+ }
98
+ if (include.includes("methods")) {
99
+ resolvedMethods = mergeNamedItems(
100
+ resolvedParent.methods || [],
101
+ resolvedMethods,
102
+ resolvedParent.name,
103
+ exclude
104
+ );
105
+ }
106
+ }
107
+ return {
108
+ ...metadata,
109
+ props: resolvedProps,
110
+ events: resolvedEvents,
111
+ slots: resolvedSlots,
112
+ methods: resolvedMethods
113
+ };
114
+ }
115
+ var DEFAULT_PACKAGE_NAME = "king-design-analyzer";
116
+ function createPackageRequire(cwd) {
117
+ return module$1.createRequire(path__namespace.join(cwd, "package.json"));
118
+ }
119
+ function resolvePackageRoot(options = {}) {
120
+ const cwd = options.cwd || process.cwd();
121
+ const packageName = options.packageName || DEFAULT_PACKAGE_NAME;
122
+ try {
123
+ const moduleRequire = createPackageRequire(cwd);
124
+ const packageEntry = moduleRequire.resolve(packageName);
125
+ return path__namespace.resolve(path__namespace.dirname(packageEntry), "..");
126
+ } catch {
127
+ return null;
128
+ }
129
+ }
130
+ function resolvePackageResourceDir(resourceDirName, options = {}) {
131
+ const cwd = options.cwd || process.cwd();
132
+ const packageRoot = resolvePackageRoot(options);
133
+ const candidates = [
134
+ packageRoot ? path__namespace.join(packageRoot, resourceDirName) : null,
135
+ path__namespace.join(cwd, resourceDirName)
136
+ ].filter((candidate) => Boolean(candidate));
137
+ return candidates.find((candidate) => fs__namespace.existsSync(candidate)) || candidates[0];
138
+ }
139
+
140
+ exports.normalizeMetadataName = normalizeMetadataName;
141
+ exports.resolveMetadataInheritance = resolveMetadataInheritance;
142
+ exports.resolvePackageResourceDir = resolvePackageResourceDir;
143
+ exports.resolvePackageRoot = resolvePackageRoot;
@@ -1,13 +1,13 @@
1
- import { analyzeCodeWithAST } from './chunk-H2ET6MMM.mjs';
2
- import { validateRuntimePrecheck } from './chunk-NZ6TLWMD.mjs';
3
- import { compileSFC } from './chunk-L4DS3EXI.mjs';
1
+ import { analyzeCodeWithAST } from './chunk-IPJJMPOO.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) {
7
7
  const scopeId = `validate-${Date.now()}`;
8
8
  const scriptOpenCount = (code.match(/<script[\s\S]*?>/g) || []).length;
9
9
  const scriptCloseCount = (code.match(/<\/script>/g) || []).length;
10
- const templateOpenCount = (code.match(/<template>/g) || []).length;
10
+ const templateOpenCount = (code.match(/<template[^>]*>/g) || []).length;
11
11
  const templateCloseCount = (code.match(/<\/template>/g) || []).length;
12
12
  if (scriptCloseCount > 0 && scriptOpenCount === 0) {
13
13
  return {
@@ -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
 
@@ -1,4 +1,4 @@
1
- import { compileSFC } from './chunk-L4DS3EXI.mjs';
1
+ import { compileSFC } from './chunk-4OTQAQ6J.mjs';
2
2
 
3
3
  // src/static/index.ts
4
4
  var scopeIdCounter = 0;
@@ -0,0 +1,117 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { createRequire } from 'module';
4
+
5
+ // src/metadata/resolve.ts
6
+ function normalizeMetadataName(value) {
7
+ return value.toLowerCase().replace(/[^a-z0-9]/g, "");
8
+ }
9
+ function findMetadata(lookup, componentName) {
10
+ if (lookup[componentName]) return lookup[componentName];
11
+ const normalized = normalizeMetadataName(componentName);
12
+ return Object.values(lookup).find(
13
+ (item) => normalizeMetadataName(item.name) === normalized || normalizeMetadataName(item.id || "") === normalized
14
+ );
15
+ }
16
+ function mergeNamedItems(inheritedItems = [], localItems = [], sourceName, excludeNames, annotateTags = false) {
17
+ const merged = /* @__PURE__ */ new Map();
18
+ const excluded = new Set(excludeNames.map(normalizeMetadataName));
19
+ for (const item of inheritedItems) {
20
+ if (!item?.name || excluded.has(normalizeMetadataName(item.name))) continue;
21
+ const nextItem = annotateTags ? {
22
+ ...item,
23
+ tags: [.../* @__PURE__ */ new Set([...item.tags || [], `inherited:${sourceName}`])]
24
+ } : { ...item };
25
+ merged.set(normalizeMetadataName(item.name), nextItem);
26
+ }
27
+ for (const item of localItems) {
28
+ if (!item?.name) continue;
29
+ merged.set(normalizeMetadataName(item.name), item);
30
+ }
31
+ return Array.from(merged.values());
32
+ }
33
+ function resolveMetadataInheritance(metadata, lookup, visited = /* @__PURE__ */ new Set()) {
34
+ const visitKey = normalizeMetadataName(metadata.name || metadata.id || "");
35
+ if (!visitKey || visited.has(visitKey)) {
36
+ return metadata;
37
+ }
38
+ const nextVisited = new Set(visited);
39
+ nextVisited.add(visitKey);
40
+ let resolvedProps = [...metadata.props || []];
41
+ let resolvedEvents = [...metadata.events || []];
42
+ let resolvedSlots = [...metadata.slots || []];
43
+ let resolvedMethods = [...metadata.methods || []];
44
+ for (const inheritance of metadata.inherits || []) {
45
+ const parent = findMetadata(lookup, inheritance.component);
46
+ if (!parent) continue;
47
+ const resolvedParent = resolveMetadataInheritance(parent, lookup, nextVisited);
48
+ const include = inheritance.include || ["props", "events", "slots", "methods"];
49
+ const exclude = inheritance.exclude || [];
50
+ if (include.includes("props")) {
51
+ resolvedProps = mergeNamedItems(
52
+ resolvedParent.props || [],
53
+ resolvedProps,
54
+ resolvedParent.name,
55
+ exclude,
56
+ true
57
+ );
58
+ }
59
+ if (include.includes("events")) {
60
+ resolvedEvents = mergeNamedItems(
61
+ resolvedParent.events || [],
62
+ resolvedEvents,
63
+ resolvedParent.name,
64
+ exclude
65
+ );
66
+ }
67
+ if (include.includes("slots")) {
68
+ resolvedSlots = mergeNamedItems(
69
+ resolvedParent.slots || [],
70
+ resolvedSlots,
71
+ resolvedParent.name,
72
+ exclude
73
+ );
74
+ }
75
+ if (include.includes("methods")) {
76
+ resolvedMethods = mergeNamedItems(
77
+ resolvedParent.methods || [],
78
+ resolvedMethods,
79
+ resolvedParent.name,
80
+ exclude
81
+ );
82
+ }
83
+ }
84
+ return {
85
+ ...metadata,
86
+ props: resolvedProps,
87
+ events: resolvedEvents,
88
+ slots: resolvedSlots,
89
+ methods: resolvedMethods
90
+ };
91
+ }
92
+ var DEFAULT_PACKAGE_NAME = "king-design-analyzer";
93
+ function createPackageRequire(cwd) {
94
+ return createRequire(path.join(cwd, "package.json"));
95
+ }
96
+ function resolvePackageRoot(options = {}) {
97
+ const cwd = options.cwd || process.cwd();
98
+ const packageName = options.packageName || DEFAULT_PACKAGE_NAME;
99
+ try {
100
+ const moduleRequire = createPackageRequire(cwd);
101
+ const packageEntry = moduleRequire.resolve(packageName);
102
+ return path.resolve(path.dirname(packageEntry), "..");
103
+ } catch {
104
+ return null;
105
+ }
106
+ }
107
+ function resolvePackageResourceDir(resourceDirName, options = {}) {
108
+ const cwd = options.cwd || process.cwd();
109
+ const packageRoot = resolvePackageRoot(options);
110
+ const candidates = [
111
+ packageRoot ? path.join(packageRoot, resourceDirName) : null,
112
+ path.join(cwd, resourceDirName)
113
+ ].filter((candidate) => Boolean(candidate));
114
+ return candidates.find((candidate) => fs.existsSync(candidate)) || candidates[0];
115
+ }
116
+
117
+ export { normalizeMetadataName, resolveMetadataInheritance, resolvePackageResourceDir, resolvePackageRoot };