king-design-analyzer 2.1.9 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/actions.json +101 -0
- package/components/advancedset.json +127 -0
- package/components/affix.json +7 -0
- package/components/aksk.json +172 -0
- package/components/az.json +15 -2
- package/components/badge.json +7 -0
- package/components/billtypes.json +14 -2
- package/components/breadcrumb.json +7 -0
- package/components/button.json +191 -0
- package/components/buttonlink.json +73 -0
- package/components/card.json +8 -1
- package/components/cardcol.json +142 -0
- package/components/cardcols.json +121 -0
- package/components/cardcontent.json +15 -3
- package/components/cardtabs.json +172 -0
- package/components/carousel.json +7 -0
- package/components/cascader.json +520 -368
- package/components/checkbox.json +51 -4
- package/components/cidrinput.json +140 -0
- package/components/code.json +8 -1
- package/components/collapse.json +7 -0
- package/components/colorpicker.json +217 -0
- package/components/copy.json +7 -0
- package/components/copyhover.json +111 -0
- package/components/copyrow.json +124 -0
- package/components/datepicker.json +656 -524
- package/components/description.json +98 -0
- package/components/dialog.json +522 -455
- package/components/divider.json +8 -1
- package/components/drawer.json +571 -558
- package/components/dropdown.json +464 -384
- package/components/duration.json +125 -0
- package/components/editable.json +66 -0
- package/components/ellipsis.json +34 -1
- package/components/filtertablefieldsdialog.json +128 -0
- package/components/flex.json +151 -0
- package/components/form.json +131 -0
- package/components/formiteminput.json +214 -0
- package/components/formitemspinner.json +213 -0
- package/components/formitemswitch.json +185 -0
- package/components/formitemtableconfigs.json +210 -0
- package/components/grid.json +7 -0
- package/components/header.json +161 -0
- package/components/icon.json +13 -1
- package/components/icontooltip.json +19 -1
- package/components/input.json +188 -4
- package/components/instancelist.json +194 -0
- package/components/instancenum.json +196 -0
- package/components/ipinput.json +117 -0
- package/components/kspstatus.json +205 -0
- package/components/kvcode.json +120 -0
- package/components/layoutcontent.json +15 -3
- package/components/layoutlistcontent.json +148 -0
- package/components/layoutpermissioncontent.json +155 -0
- package/components/layoutstandardlist.json +275 -0
- package/components/layouttabs.json +168 -0
- package/components/lazymount.json +86 -0
- package/components/lazyteleport.json +118 -0
- package/components/menu.json +7 -0
- package/components/pagination.json +12 -0
- package/components/paginationplus.json +30 -3
- package/components/password.json +121 -0
- package/components/popover.json +457 -437
- package/components/projects.json +129 -0
- package/components/protable.json +97 -8
- package/components/queuevisualrange.json +110 -0
- package/components/radio.json +82 -2
- package/components/rate.json +199 -0
- package/components/region.json +14 -2
- package/components/search.json +221 -0
- package/components/searchinput.json +132 -0
- package/components/searchitems.json +215 -0
- package/components/searchselect.json +195 -0
- package/components/select.json +686 -666
- package/components/sidebar.json +198 -0
- package/components/skeleton.json +233 -0
- package/components/spin.json +8 -1
- package/components/split.json +260 -0
- package/components/sshkeys.json +138 -0
- package/components/status.json +60 -3
- package/components/steps.json +7 -0
- package/components/switch.json +8 -1
- package/components/table.json +18 -1
- package/components/tablecolumnid.json +14 -2
- package/components/tabs.json +12 -0
- package/components/timeline.json +213 -0
- package/components/timepicker.json +147 -3
- package/components/timerange.json +262 -0
- package/components/tip.json +7 -0
- package/components/tooltip.json +484 -395
- package/components/tour.json +418 -372
- package/components/transfer.json +27 -3
- package/components/tree.json +6 -4
- package/components/treeselect.json +556 -475
- package/components/upload.json +474 -473
- package/components/vdialog.json +308 -0
- package/components/vdrawer.json +331 -0
- package/components/virtuallist.json +7 -0
- package/dist/ast/index.d.mts +35 -1
- package/dist/ast/index.d.ts +35 -1
- package/dist/ast/index.js +4 -3
- package/dist/ast/index.mjs +2 -1
- package/dist/{chunk-DSWKLUIX.mjs → chunk-3LYQ5XFM.mjs} +1 -1
- package/dist/chunk-BI5TIQID.mjs +330 -0
- package/dist/{chunk-F26GUCGG.js → chunk-CJGGFVQJ.js} +8 -8
- package/dist/chunk-CR3GC4H3.js +353 -0
- package/dist/{chunk-NZ6TLWMD.mjs → chunk-D2SXGGTX.mjs} +28 -17
- package/dist/{chunk-D3Y6FGWA.js → chunk-EYKZY2F3.js} +29 -18
- package/dist/chunk-KF5YBEM5.js +143 -0
- package/dist/{chunk-H2ET6MMM.mjs → chunk-KMIDURUR.mjs} +42 -47
- package/dist/chunk-QC6VTSA3.mjs +117 -0
- package/dist/{chunk-2W6OCG2S.js → chunk-SZYVGYKK.js} +42 -48
- package/dist/{chunk-WYSRJVX4.js → chunk-TA3SV4SP.js} +2 -2
- package/dist/{chunk-OJOHB64C.mjs → chunk-XGPHQHLR.mjs} +4 -4
- package/dist/full/index.js +7 -6
- package/dist/full/index.mjs +5 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -13
- package/dist/index.mjs +6 -5
- package/dist/metadata/index.d.mts +22 -2
- package/dist/metadata/index.d.ts +22 -2
- package/dist/metadata/index.js +26 -16
- package/dist/metadata/index.mjs +26 -15
- package/dist/resolve-BsLBxlBi.d.mts +24 -0
- package/dist/resolve-BsLBxlBi.d.ts +24 -0
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/index.mjs +2 -2
- package/dist/shared/index.d.mts +10 -0
- package/dist/shared/index.d.ts +10 -0
- package/dist/shared/index.js +23 -0
- package/dist/shared/index.mjs +2 -0
- package/dist/static/index.js +5 -5
- package/dist/static/index.mjs +2 -2
- package/docs_for_llm/actions.doc.md +77 -0
- package/docs_for_llm/advancedset.doc.md +89 -0
- package/docs_for_llm/affix.doc.md +15 -7
- package/docs_for_llm/aksk.doc.md +111 -0
- package/docs_for_llm/az.doc.md +17 -11
- package/docs_for_llm/badge.doc.md +6 -5
- package/docs_for_llm/billtypes.doc.md +17 -11
- package/docs_for_llm/breadcrumb.doc.md +6 -3
- package/docs_for_llm/button.doc.md +34 -18
- package/docs_for_llm/buttonlink.doc.md +55 -0
- package/docs_for_llm/card.doc.md +8 -5
- package/docs_for_llm/cardcol.doc.md +78 -0
- package/docs_for_llm/cardcols.doc.md +84 -0
- package/docs_for_llm/cardcontent.doc.md +10 -10
- package/docs_for_llm/cardtabs.doc.md +106 -0
- package/docs_for_llm/carousel.doc.md +8 -7
- package/docs_for_llm/cascader.doc.md +46 -25
- package/docs_for_llm/checkbox.doc.md +25 -13
- package/docs_for_llm/cidrinput.doc.md +83 -0
- package/docs_for_llm/code.doc.md +22 -11
- package/docs_for_llm/collapse.doc.md +9 -6
- package/docs_for_llm/colorpicker.doc.md +104 -0
- package/docs_for_llm/copy.doc.md +15 -13
- package/docs_for_llm/copyhover.doc.md +59 -0
- package/docs_for_llm/copyrow.doc.md +71 -0
- package/docs_for_llm/datepicker.doc.md +51 -39
- package/docs_for_llm/description.doc.md +75 -0
- package/docs_for_llm/descriptions.doc.md +9 -6
- package/docs_for_llm/dialog.doc.md +48 -77
- package/docs_for_llm/divider.doc.md +9 -7
- package/docs_for_llm/drawer.doc.md +43 -84
- package/docs_for_llm/dropdown.doc.md +52 -21
- package/docs_for_llm/duration.doc.md +76 -0
- package/docs_for_llm/editable.doc.md +36 -14
- package/docs_for_llm/ellipsis.doc.md +10 -5
- package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
- package/docs_for_llm/flex.doc.md +74 -0
- package/docs_for_llm/form.doc.md +33 -14
- package/docs_for_llm/formiteminput.doc.md +128 -0
- package/docs_for_llm/formitemspinner.doc.md +105 -0
- package/docs_for_llm/formitemswitch.doc.md +113 -0
- package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
- package/docs_for_llm/grid.doc.md +7 -5
- package/docs_for_llm/header.doc.md +85 -0
- package/docs_for_llm/icon.doc.md +12 -8
- package/docs_for_llm/icontooltip.doc.md +121 -0
- package/docs_for_llm/input.doc.md +90 -39
- package/docs_for_llm/instancelist.doc.md +113 -0
- package/docs_for_llm/instancenum.doc.md +95 -0
- package/docs_for_llm/ipinput.doc.md +77 -0
- package/docs_for_llm/kspstatus.doc.md +82 -0
- package/docs_for_llm/kvcode.doc.md +76 -0
- package/docs_for_llm/layoutcontent.doc.md +17 -17
- package/docs_for_llm/layoutlistcontent.doc.md +95 -0
- package/docs_for_llm/layoutpermissioncontent.doc.md +84 -0
- package/docs_for_llm/layoutstandardlist.doc.md +120 -0
- package/docs_for_llm/layouttabs.doc.md +101 -0
- package/docs_for_llm/lazymount.doc.md +73 -0
- package/docs_for_llm/lazyteleport.doc.md +76 -0
- package/docs_for_llm/menu.doc.md +14 -11
- package/docs_for_llm/message.doc.md +48 -10
- package/docs_for_llm/pagination.doc.md +30 -17
- package/docs_for_llm/paginationplus.doc.md +31 -10
- package/docs_for_llm/password.doc.md +86 -0
- package/docs_for_llm/popover.doc.md +24 -55
- package/docs_for_llm/progress.doc.md +13 -10
- package/docs_for_llm/projects.doc.md +91 -0
- package/docs_for_llm/protable.doc.md +89 -15
- package/docs_for_llm/queuevisualrange.doc.md +78 -0
- package/docs_for_llm/radio.doc.md +23 -8
- package/docs_for_llm/rate.doc.md +122 -0
- package/docs_for_llm/region.doc.md +25 -13
- package/docs_for_llm/search.doc.md +120 -0
- package/docs_for_llm/searchinput.doc.md +111 -0
- package/docs_for_llm/searchitems.doc.md +116 -0
- package/docs_for_llm/searchselect.doc.md +126 -0
- package/docs_for_llm/select.doc.md +40 -55
- package/docs_for_llm/sidebar.doc.md +133 -0
- package/docs_for_llm/skeleton.doc.md +117 -0
- package/docs_for_llm/slider.doc.md +31 -21
- package/docs_for_llm/spin.doc.md +8 -5
- package/docs_for_llm/spinner.doc.md +28 -18
- package/docs_for_llm/split.doc.md +157 -0
- package/docs_for_llm/sshkeys.doc.md +88 -0
- package/docs_for_llm/status.doc.md +14 -9
- package/docs_for_llm/steps.doc.md +10 -7
- package/docs_for_llm/switch.doc.md +17 -14
- package/docs_for_llm/table.doc.md +118 -51
- package/docs_for_llm/tablecolumnid.doc.md +36 -16
- package/docs_for_llm/tabs.doc.md +19 -10
- package/docs_for_llm/tag.doc.md +19 -10
- package/docs_for_llm/timeline.doc.md +109 -0
- package/docs_for_llm/timepicker.doc.md +57 -38
- package/docs_for_llm/timerange.doc.md +157 -0
- package/docs_for_llm/tip.doc.md +20 -11
- package/docs_for_llm/tooltip.doc.md +55 -29
- package/docs_for_llm/tour.doc.md +48 -29
- package/docs_for_llm/transfer.doc.md +40 -29
- package/docs_for_llm/tree.doc.md +65 -23
- package/docs_for_llm/treeselect.doc.md +37 -48
- package/docs_for_llm/upload.doc.md +56 -32
- package/docs_for_llm/useCRUD.doc.md +49 -0
- package/docs_for_llm/useCountdown.doc.md +43 -0
- package/docs_for_llm/useDetail.doc.md +48 -0
- package/docs_for_llm/useDialog.doc.md +46 -0
- package/docs_for_llm/useEntity.doc.md +45 -0
- package/docs_for_llm/useEventListener.doc.md +44 -0
- package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
- package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
- package/docs_for_llm/useGetUserPermission.doc.md +43 -0
- package/docs_for_llm/useGroup.doc.md +48 -0
- package/docs_for_llm/useIdEntities.doc.md +48 -0
- package/docs_for_llm/useIdEntity.doc.md +103 -0
- package/docs_for_llm/useInterval.doc.md +43 -0
- package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
- package/docs_for_llm/useMessage.doc.md +46 -0
- package/docs_for_llm/useModifyCache.doc.md +37 -0
- package/docs_for_llm/useOpenDialog.doc.md +41 -0
- package/docs_for_llm/usePagination.doc.md +60 -0
- package/docs_for_llm/usePersist.doc.md +54 -0
- package/docs_for_llm/usePoll.doc.md +41 -0
- package/docs_for_llm/useRoutePlus.doc.md +34 -0
- package/docs_for_llm/useRouterPlus.doc.md +34 -0
- package/docs_for_llm/useSearch.doc.md +68 -0
- package/docs_for_llm/useShell.doc.md +43 -0
- package/docs_for_llm/useSkip.doc.md +41 -0
- package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
- package/docs_for_llm/useStore.doc.md +34 -0
- package/docs_for_llm/useTable.doc.md +57 -0
- package/docs_for_llm/useTableGroup.doc.md +47 -0
- package/docs_for_llm/useTableSort.doc.md +40 -0
- package/docs_for_llm/useToState.doc.md +112 -0
- package/docs_for_llm/useUser.doc.md +38 -0
- package/docs_for_llm/useValidForm.doc.md +41 -0
- package/docs_for_llm/vdialog.doc.md +129 -0
- package/docs_for_llm/vdrawer.doc.md +119 -0
- package/docs_for_llm/virtuallist.doc.md +6 -3
- package/hooks/useCRUD.json +61 -0
- package/hooks/useCountdown.json +49 -0
- package/hooks/useDetail.json +67 -0
- package/hooks/useDialog.json +49 -0
- package/hooks/useEntity.json +61 -0
- package/hooks/useEventListener.json +61 -0
- package/hooks/useFalseUntilTruthy.json +43 -0
- package/hooks/useGetCopyAuthText.json +36 -0
- package/hooks/useGetUserPermission.json +55 -0
- package/hooks/useGroup.json +49 -0
- package/hooks/useIdEntities.json +61 -0
- package/hooks/useInterval.json +55 -0
- package/hooks/useLayoutStandardList.json +36 -0
- package/hooks/useMessage.json +73 -0
- package/hooks/useModifyCache.json +36 -0
- package/hooks/useOpenDialog.json +43 -0
- package/hooks/usePagination.json +49 -0
- package/hooks/usePersist.json +61 -0
- package/hooks/usePoll.json +43 -0
- package/hooks/useRoutePlus.json +36 -0
- package/hooks/useRouterPlus.json +36 -0
- package/hooks/useSearch.json +56 -0
- package/hooks/useShell.json +49 -0
- package/hooks/useSkip.json +43 -0
- package/hooks/useStorageIdEntity.json +67 -0
- package/hooks/useStore.json +36 -0
- package/hooks/useTable.json +49 -0
- package/hooks/useTableGroup.json +43 -0
- package/hooks/useTableSort.json +43 -0
- package/hooks/useUser.json +36 -0
- package/hooks/useValidForm.json +43 -0
- package/package.json +12 -6
- package/dist/chunk-HPAUCD5I.js +0 -156
- package/dist/chunk-L4DS3EXI.mjs +0 -133
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var compilerSfc = require('@vue/compiler-sfc');
|
|
4
|
+
var sucrase = require('sucrase');
|
|
5
|
+
var ts = require('typescript');
|
|
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 ts__namespace = /*#__PURE__*/_interopNamespace(ts);
|
|
26
|
+
|
|
27
|
+
// src/tools/sfcCompiler.ts
|
|
28
|
+
var ALLOWED_IMPORT_SOURCES = [
|
|
29
|
+
"vue",
|
|
30
|
+
"@vue/",
|
|
31
|
+
"@king-design/vue",
|
|
32
|
+
"@ksyun-internal/versatile"
|
|
33
|
+
];
|
|
34
|
+
var VUE_RUNTIME_INJECTED_BINDINGS = /* @__PURE__ */ new Set([
|
|
35
|
+
"ref",
|
|
36
|
+
"reactive",
|
|
37
|
+
"computed",
|
|
38
|
+
"readonly",
|
|
39
|
+
"shallowRef",
|
|
40
|
+
"shallowReactive",
|
|
41
|
+
"toRef",
|
|
42
|
+
"toRefs",
|
|
43
|
+
"toRaw",
|
|
44
|
+
"markRaw",
|
|
45
|
+
"isRef",
|
|
46
|
+
"isReactive",
|
|
47
|
+
"isReadonly",
|
|
48
|
+
"isProxy",
|
|
49
|
+
"triggerRef",
|
|
50
|
+
"customRef",
|
|
51
|
+
"onMounted",
|
|
52
|
+
"onUnmounted",
|
|
53
|
+
"onBeforeMount",
|
|
54
|
+
"onBeforeUnmount",
|
|
55
|
+
"onUpdated",
|
|
56
|
+
"onBeforeUpdate",
|
|
57
|
+
"onActivated",
|
|
58
|
+
"onDeactivated",
|
|
59
|
+
"onErrorCaptured",
|
|
60
|
+
"watch",
|
|
61
|
+
"watchEffect",
|
|
62
|
+
"watchPostEffect",
|
|
63
|
+
"watchSyncEffect",
|
|
64
|
+
"defineProps",
|
|
65
|
+
"defineEmits",
|
|
66
|
+
"defineExpose",
|
|
67
|
+
"defineOptions",
|
|
68
|
+
"defineSlots",
|
|
69
|
+
"defineModel",
|
|
70
|
+
"withDefaults",
|
|
71
|
+
"useSlots",
|
|
72
|
+
"useAttrs",
|
|
73
|
+
"inject",
|
|
74
|
+
"provide",
|
|
75
|
+
"nextTick",
|
|
76
|
+
"getCurrentInstance",
|
|
77
|
+
"h",
|
|
78
|
+
"createVNode",
|
|
79
|
+
"resolveComponent"
|
|
80
|
+
]);
|
|
81
|
+
var VERSATILE_RUNTIME_INJECTED_BINDINGS = /* @__PURE__ */ new Set([
|
|
82
|
+
"useToState",
|
|
83
|
+
"useIdEntity"
|
|
84
|
+
]);
|
|
85
|
+
var INTERNAL_BINDING_PREFIXES = ["__imported_module_"];
|
|
86
|
+
function getRuntimeInjectedBindingsForSource(source) {
|
|
87
|
+
if (source === "vue" || source.startsWith("@vue/")) {
|
|
88
|
+
return VUE_RUNTIME_INJECTED_BINDINGS;
|
|
89
|
+
}
|
|
90
|
+
if (source === "@ksyun-internal/versatile") {
|
|
91
|
+
return VERSATILE_RUNTIME_INJECTED_BINDINGS;
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ new Set();
|
|
94
|
+
}
|
|
95
|
+
function normalizeNamedImportSpecifiers(specifiers) {
|
|
96
|
+
return specifiers.split(",").map((part) => part.trim()).filter(Boolean).map((part) => {
|
|
97
|
+
const aliasMatch = part.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
98
|
+
if (aliasMatch) {
|
|
99
|
+
return `${aliasMatch[1]}: ${aliasMatch[2]}`;
|
|
100
|
+
}
|
|
101
|
+
return part;
|
|
102
|
+
}).join(", ");
|
|
103
|
+
}
|
|
104
|
+
function shouldUseWhitelist(source, whitelist) {
|
|
105
|
+
return whitelist.some((allowedSource) => source === allowedSource || source.startsWith(`${allowedSource}/`));
|
|
106
|
+
}
|
|
107
|
+
function classifyImportSource(source, whitelist) {
|
|
108
|
+
if (shouldUseWhitelist(source, whitelist)) {
|
|
109
|
+
return "whitelisted";
|
|
110
|
+
}
|
|
111
|
+
if (source.startsWith(".")) {
|
|
112
|
+
return "relative";
|
|
113
|
+
}
|
|
114
|
+
return "unknown";
|
|
115
|
+
}
|
|
116
|
+
function scopeStyles(css, scopeClass) {
|
|
117
|
+
return css.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g, (match, selector, suffix) => {
|
|
118
|
+
if (selector.trim().startsWith("@")) return match;
|
|
119
|
+
const scopedSelector = selector.split(",").map((rawSelector) => {
|
|
120
|
+
const nextSelector = rawSelector.trim();
|
|
121
|
+
if (nextSelector === "body" || nextSelector === "html") return `.${scopeClass}`;
|
|
122
|
+
return `.${scopeClass} ${nextSelector}`;
|
|
123
|
+
}).join(", ");
|
|
124
|
+
return `${scopedSelector}${suffix}`;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function transformImportToBinding(importClause, sourceExpression) {
|
|
128
|
+
const trimmedClause = importClause.trim();
|
|
129
|
+
const namespaceMatch = trimmedClause.match(/^\*\s+as\s+(\w+)$/);
|
|
130
|
+
if (namespaceMatch) {
|
|
131
|
+
return `const ${namespaceMatch[1]} = ${sourceExpression};`;
|
|
132
|
+
}
|
|
133
|
+
const mixedMatch = trimmedClause.match(/^(\w+)\s*,\s*\{([^}]+)\}$/);
|
|
134
|
+
if (mixedMatch) {
|
|
135
|
+
const defaultName = mixedMatch[1];
|
|
136
|
+
const namedImports = normalizeNamedImportSpecifiers(mixedMatch[2]);
|
|
137
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
138
|
+
return `const ${moduleVar} = ${sourceExpression}; const ${defaultName} = ${moduleVar}.default || ${moduleVar}; const { ${namedImports} } = ${moduleVar};`;
|
|
139
|
+
}
|
|
140
|
+
const defaultAndNamespaceMatch = trimmedClause.match(/^(\w+)\s*,\s*\*\s+as\s+(\w+)$/);
|
|
141
|
+
if (defaultAndNamespaceMatch) {
|
|
142
|
+
const defaultName = defaultAndNamespaceMatch[1];
|
|
143
|
+
const namespaceName = defaultAndNamespaceMatch[2];
|
|
144
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
145
|
+
return `const ${moduleVar} = ${sourceExpression}; const ${defaultName} = ${moduleVar}.default || ${moduleVar}; const ${namespaceName} = ${moduleVar};`;
|
|
146
|
+
}
|
|
147
|
+
const namedMatch = trimmedClause.match(/^\{([^}]+)\}$/);
|
|
148
|
+
if (namedMatch) {
|
|
149
|
+
return `const { ${normalizeNamedImportSpecifiers(namedMatch[1])} } = ${sourceExpression};`;
|
|
150
|
+
}
|
|
151
|
+
const defaultMatch = trimmedClause.match(/^(\w+)$/);
|
|
152
|
+
if (defaultMatch) {
|
|
153
|
+
const defaultName = defaultMatch[1];
|
|
154
|
+
return `const ${defaultName} = ${sourceExpression}.default || ${sourceExpression};`;
|
|
155
|
+
}
|
|
156
|
+
return "";
|
|
157
|
+
}
|
|
158
|
+
function transformWhitelistedImport(importClause, source) {
|
|
159
|
+
const trimmedClause = importClause.trim();
|
|
160
|
+
const injectedBindings = getRuntimeInjectedBindingsForSource(source);
|
|
161
|
+
const buildNamedBinding = (specifiers, sourceExpression = `__getWhitelistedModule('${source}')`) => {
|
|
162
|
+
const namedBindings = specifiers.split(",").map((part) => part.trim()).filter(Boolean).map((part) => {
|
|
163
|
+
const aliasMatch = part.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
164
|
+
if (aliasMatch) {
|
|
165
|
+
return `${aliasMatch[1]}: ${aliasMatch[2]}`;
|
|
166
|
+
}
|
|
167
|
+
return injectedBindings.has(part) ? null : part;
|
|
168
|
+
}).filter(Boolean);
|
|
169
|
+
if (namedBindings.length === 0) {
|
|
170
|
+
return "";
|
|
171
|
+
}
|
|
172
|
+
return `const { ${namedBindings.join(", ")} } = ${sourceExpression};`;
|
|
173
|
+
};
|
|
174
|
+
const namespaceMatch = trimmedClause.match(/^\*\s+as\s+(\w+)$/);
|
|
175
|
+
if (namespaceMatch) {
|
|
176
|
+
return `const ${namespaceMatch[1]} = __getWhitelistedModule('${source}');`;
|
|
177
|
+
}
|
|
178
|
+
const mixedMatch = trimmedClause.match(/^(\w+)\s*,\s*\{([^}]+)\}$/);
|
|
179
|
+
if (mixedMatch) {
|
|
180
|
+
const defaultName = mixedMatch[1];
|
|
181
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
182
|
+
const parts = [
|
|
183
|
+
`const ${moduleVar} = __getWhitelistedModule('${source}');`,
|
|
184
|
+
`const ${defaultName} = ${moduleVar}.default || ${moduleVar};`
|
|
185
|
+
];
|
|
186
|
+
const namedBinding = buildNamedBinding(mixedMatch[2], moduleVar);
|
|
187
|
+
if (namedBinding) {
|
|
188
|
+
parts.push(namedBinding);
|
|
189
|
+
}
|
|
190
|
+
return parts.join(" ");
|
|
191
|
+
}
|
|
192
|
+
const defaultAndNamespaceMatch = trimmedClause.match(/^(\w+)\s*,\s*\*\s+as\s+(\w+)$/);
|
|
193
|
+
if (defaultAndNamespaceMatch) {
|
|
194
|
+
const defaultName = defaultAndNamespaceMatch[1];
|
|
195
|
+
const namespaceName = defaultAndNamespaceMatch[2];
|
|
196
|
+
const moduleVar = `__imported_module_${defaultName}`;
|
|
197
|
+
return `const ${moduleVar} = __getWhitelistedModule('${source}'); const ${defaultName} = ${moduleVar}.default || ${moduleVar}; const ${namespaceName} = ${moduleVar};`;
|
|
198
|
+
}
|
|
199
|
+
const namedMatch = trimmedClause.match(/^\{([^}]+)\}$/);
|
|
200
|
+
if (namedMatch) {
|
|
201
|
+
return buildNamedBinding(namedMatch[1]);
|
|
202
|
+
}
|
|
203
|
+
const defaultMatch = trimmedClause.match(/^(\w+)$/);
|
|
204
|
+
if (defaultMatch) {
|
|
205
|
+
const defaultName = defaultMatch[1];
|
|
206
|
+
return `const ${defaultName} = __getWhitelistedModule('${source}').default || __getWhitelistedModule('${source}');`;
|
|
207
|
+
}
|
|
208
|
+
return "";
|
|
209
|
+
}
|
|
210
|
+
function collectRawScript(descriptor) {
|
|
211
|
+
return [descriptor.script?.content, descriptor.scriptSetup?.content].filter((block) => Boolean(block?.trim())).join("\n");
|
|
212
|
+
}
|
|
213
|
+
function transformValueImports(scriptContent, whitelist, strippedImports) {
|
|
214
|
+
let nextScript = scriptContent.replace(/import\s+type\s+[\s\S]*?from\s+['"].*?['"];?/g, "");
|
|
215
|
+
nextScript = nextScript.replace(
|
|
216
|
+
/import\s+([^;]+?)\s+from\s+['"]([^'"]+)['"];?/g,
|
|
217
|
+
(_match, importClause, source) => {
|
|
218
|
+
const reason = classifyImportSource(source, whitelist);
|
|
219
|
+
strippedImports.push({ source, reason });
|
|
220
|
+
if (reason === "whitelisted") {
|
|
221
|
+
return transformWhitelistedImport(importClause, source);
|
|
222
|
+
}
|
|
223
|
+
if (reason === "relative") {
|
|
224
|
+
return transformImportToBinding(importClause, `__mockModule('${source}')`);
|
|
225
|
+
}
|
|
226
|
+
return "";
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
nextScript = nextScript.replace(
|
|
230
|
+
/import\s+['"]([^'"]+)['"];?/g,
|
|
231
|
+
(_match, source) => {
|
|
232
|
+
const reason = classifyImportSource(source, whitelist);
|
|
233
|
+
strippedImports.push({ source, reason });
|
|
234
|
+
if (reason === "relative") {
|
|
235
|
+
return `__mockModule('${source}');`;
|
|
236
|
+
}
|
|
237
|
+
return "";
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
return nextScript;
|
|
241
|
+
}
|
|
242
|
+
function stripExports(scriptContent) {
|
|
243
|
+
let nextScript = scriptContent;
|
|
244
|
+
nextScript = nextScript.replace(/export\s+default\s*\{[\s\S]*?\}\s*;?\s*$/g, "");
|
|
245
|
+
nextScript = nextScript.replace(/export\s+\{[\s\S]*?\}\s*;?/g, "");
|
|
246
|
+
nextScript = nextScript.replace(/export\s+default\s+/g, "");
|
|
247
|
+
nextScript = nextScript.replace(/export\s+(const|let|var|function|class|async\s+function)\s+/g, "$1 ");
|
|
248
|
+
return nextScript;
|
|
249
|
+
}
|
|
250
|
+
function transpileScript(scriptContent) {
|
|
251
|
+
const result = sucrase.transform(scriptContent, {
|
|
252
|
+
transforms: ["typescript"],
|
|
253
|
+
disableESTransforms: true
|
|
254
|
+
});
|
|
255
|
+
return result && typeof result.code === "string" ? result.code : scriptContent;
|
|
256
|
+
}
|
|
257
|
+
function extractBindingsFromScript(scriptContent) {
|
|
258
|
+
const bindings = /* @__PURE__ */ new Set();
|
|
259
|
+
try {
|
|
260
|
+
let extractNames2 = function(name) {
|
|
261
|
+
if (ts__namespace.isIdentifier(name)) {
|
|
262
|
+
bindings.add(name.text);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (ts__namespace.isObjectBindingPattern(name) || ts__namespace.isArrayBindingPattern(name)) {
|
|
266
|
+
name.elements.forEach((element) => {
|
|
267
|
+
if (ts__namespace.isBindingElement(element)) {
|
|
268
|
+
extractNames2(element.name);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}, visit2 = function(node) {
|
|
273
|
+
if (ts__namespace.isVariableStatement(node)) {
|
|
274
|
+
node.declarationList.declarations.forEach((decl) => extractNames2(decl.name));
|
|
275
|
+
} else if (ts__namespace.isFunctionDeclaration(node) && node.name) {
|
|
276
|
+
bindings.add(node.name.text);
|
|
277
|
+
} else if (ts__namespace.isClassDeclaration(node) && node.name) {
|
|
278
|
+
bindings.add(node.name.text);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
var extractNames = extractNames2, visit = visit2;
|
|
282
|
+
const sourceFile = ts__namespace.createSourceFile(
|
|
283
|
+
"temp.ts",
|
|
284
|
+
scriptContent,
|
|
285
|
+
ts__namespace.ScriptTarget.Latest,
|
|
286
|
+
true
|
|
287
|
+
);
|
|
288
|
+
sourceFile.statements.forEach(visit2);
|
|
289
|
+
} catch {
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
292
|
+
return Array.from(bindings).filter(
|
|
293
|
+
(binding) => binding && /^[A-Za-z_$][\w$]*$/.test(binding) && !INTERNAL_BINDING_PREFIXES.some((prefix) => binding.startsWith(prefix))
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
function processExecutableScript(rawScript, whitelist, strippedImports) {
|
|
297
|
+
const withoutImports = transformValueImports(rawScript, whitelist, strippedImports);
|
|
298
|
+
const withoutExports = stripExports(withoutImports);
|
|
299
|
+
return transpileScript(withoutExports);
|
|
300
|
+
}
|
|
301
|
+
function getParseError(result) {
|
|
302
|
+
const firstError = result.errors[0];
|
|
303
|
+
if (!firstError) return void 0;
|
|
304
|
+
return typeof firstError === "string" ? firstError : firstError.message;
|
|
305
|
+
}
|
|
306
|
+
function compileSFC(code, scopeId, options) {
|
|
307
|
+
const whitelist = options?.allowedImports ?? ALLOWED_IMPORT_SOURCES;
|
|
308
|
+
const strippedImports = [];
|
|
309
|
+
try {
|
|
310
|
+
const parseResult = compilerSfc.parse(code, {
|
|
311
|
+
filename: "inline.vue",
|
|
312
|
+
sourceMap: false
|
|
313
|
+
});
|
|
314
|
+
const parseError = getParseError(parseResult);
|
|
315
|
+
if (parseError) {
|
|
316
|
+
return {
|
|
317
|
+
template: "",
|
|
318
|
+
script: "",
|
|
319
|
+
style: "",
|
|
320
|
+
bindings: [],
|
|
321
|
+
error: parseError
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
const { descriptor } = parseResult;
|
|
325
|
+
const template = descriptor.template?.content || "";
|
|
326
|
+
const rawScript = collectRawScript(descriptor);
|
|
327
|
+
const rawStyles = descriptor.styles.map((styleBlock) => styleBlock.content).join("\n");
|
|
328
|
+
const style = rawStyles ? scopeStyles(rawStyles, scopeId) : "";
|
|
329
|
+
if (!template && !rawScript) {
|
|
330
|
+
return { template: "", script: "", style: "", bindings: [] };
|
|
331
|
+
}
|
|
332
|
+
const executableScript = rawScript ? processExecutableScript(rawScript, whitelist, strippedImports) : "";
|
|
333
|
+
const bindings = executableScript ? extractBindingsFromScript(executableScript) : [];
|
|
334
|
+
return {
|
|
335
|
+
template,
|
|
336
|
+
script: executableScript,
|
|
337
|
+
style,
|
|
338
|
+
bindings,
|
|
339
|
+
strippedImports: strippedImports.length > 0 ? strippedImports : void 0
|
|
340
|
+
};
|
|
341
|
+
} catch (error) {
|
|
342
|
+
return {
|
|
343
|
+
template: "",
|
|
344
|
+
script: "",
|
|
345
|
+
style: "",
|
|
346
|
+
bindings: [],
|
|
347
|
+
error: error?.message || String(error)
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
exports.compileSFC = compileSFC;
|
|
353
|
+
exports.scopeStyles = scopeStyles;
|
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
import { compileSFC } from './chunk-
|
|
1
|
+
import { compileSFC } from './chunk-BI5TIQID.mjs';
|
|
2
2
|
|
|
3
3
|
// src/runtime/index.ts
|
|
4
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
|
+
}
|
|
5
30
|
var MOCK_VUE_CONTEXT = {
|
|
6
31
|
// Reactivity
|
|
7
32
|
ref: (v) => ({ value: v }),
|
|
@@ -84,22 +109,8 @@ var MOCK_VUE_CONTEXT = {
|
|
|
84
109
|
// =========================================================================
|
|
85
110
|
// Module Mocking
|
|
86
111
|
// =========================================================================
|
|
87
|
-
__mockModule: (modulePath) =>
|
|
88
|
-
|
|
89
|
-
return new Proxy(() => {
|
|
90
|
-
}, {
|
|
91
|
-
get: (target, prop) => {
|
|
92
|
-
if (prop === Symbol.toPrimitive) return () => 0;
|
|
93
|
-
if (prop === "then") return void 0;
|
|
94
|
-
return createMockProxy();
|
|
95
|
-
},
|
|
96
|
-
apply: (target, thisArg, args) => {
|
|
97
|
-
return createMockProxy();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
return createMockProxy();
|
|
102
|
-
}
|
|
112
|
+
__mockModule: (modulePath) => createMockProxy(),
|
|
113
|
+
__getWhitelistedModule: (source) => createWhitelistedModule(source, MOCK_VUE_CONTEXT)
|
|
103
114
|
};
|
|
104
115
|
function validateRuntimePrecheck(code) {
|
|
105
116
|
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCR3GC4H3_js = require('./chunk-CR3GC4H3.js');
|
|
4
4
|
|
|
5
5
|
// src/runtime/index.ts
|
|
6
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
|
+
}
|
|
7
32
|
var MOCK_VUE_CONTEXT = {
|
|
8
33
|
// Reactivity
|
|
9
34
|
ref: (v) => ({ value: v }),
|
|
@@ -86,26 +111,12 @@ var MOCK_VUE_CONTEXT = {
|
|
|
86
111
|
// =========================================================================
|
|
87
112
|
// Module Mocking
|
|
88
113
|
// =========================================================================
|
|
89
|
-
__mockModule: (modulePath) =>
|
|
90
|
-
|
|
91
|
-
return new Proxy(() => {
|
|
92
|
-
}, {
|
|
93
|
-
get: (target, prop) => {
|
|
94
|
-
if (prop === Symbol.toPrimitive) return () => 0;
|
|
95
|
-
if (prop === "then") return void 0;
|
|
96
|
-
return createMockProxy();
|
|
97
|
-
},
|
|
98
|
-
apply: (target, thisArg, args) => {
|
|
99
|
-
return createMockProxy();
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
return createMockProxy();
|
|
104
|
-
}
|
|
114
|
+
__mockModule: (modulePath) => createMockProxy(),
|
|
115
|
+
__getWhitelistedModule: (source) => createWhitelistedModule(source, MOCK_VUE_CONTEXT)
|
|
105
116
|
};
|
|
106
117
|
function validateRuntimePrecheck(code) {
|
|
107
118
|
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
108
|
-
const { script, bindings, strippedImports, error } =
|
|
119
|
+
const { script, bindings, strippedImports, error } = chunkCR3GC4H3_js.compileSFC(code, scopeId);
|
|
109
120
|
if (error) {
|
|
110
121
|
return {
|
|
111
122
|
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
@@ -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;
|