king-design-analyzer 1.0.4 → 1.1.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/dist/ast/index.js +3 -3
- package/dist/ast/index.mjs +1 -1
- package/dist/chunk-BJXTWCDK.js +129 -0
- package/dist/{chunk-VVHQZTF5.mjs → chunk-EZD2XOI2.mjs} +1 -1
- package/dist/chunk-FZOV65VR.mjs +771 -0
- package/dist/{chunk-PP2QAR54.js → chunk-KC775NWI.js} +446 -317
- package/dist/{chunk-UWULTWWY.js → chunk-RB7FS3FG.js} +2 -2
- package/dist/{chunk-242F4OP3.js → chunk-REPE4KTQ.js} +10 -5
- package/dist/chunk-X7PYJSHF.mjs +127 -0
- package/dist/{chunk-XNWSQMT6.mjs → chunk-YYKRQHUZ.mjs} +10 -5
- package/dist/full/index.js +4 -4
- package/dist/full/index.mjs +2 -2
- package/dist/index.js +10 -10
- package/dist/index.mjs +4 -4
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/index.mjs +1 -1
- package/dist/static/index.js +2 -2
- package/dist/static/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-Q7NN5FIR.mjs +0 -66
- package/dist/chunk-SR45IYML.js +0 -68
- package/dist/chunk-YNH7FZWF.mjs +0 -642
package/dist/ast/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-YTEYDSDW.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkKC775NWI_js = require('../chunk-KC775NWI.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "analyzeCodeWithAST", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkKC775NWI_js.analyzeCodeWithAST; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "componentRegistry", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkKC775NWI_js.componentRegistry; }
|
|
15
15
|
});
|
package/dist/ast/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '../chunk-5H7N2A5X.mjs';
|
|
2
|
-
export { analyzeCodeWithAST, componentRegistry } from '../chunk-
|
|
2
|
+
export { analyzeCodeWithAST, componentRegistry } from '../chunk-FZOV65VR.mjs';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2L37YJOJ_js = require('./chunk-2L37YJOJ.js');
|
|
4
|
+
|
|
5
|
+
// src/runtime/index.ts
|
|
6
|
+
var scopeIdCounter = 0;
|
|
7
|
+
var MOCK_VUE_CONTEXT = {
|
|
8
|
+
// Reactivity
|
|
9
|
+
ref: (v) => ({ value: v }),
|
|
10
|
+
reactive: (v) => v,
|
|
11
|
+
computed: (fn) => ({ value: typeof fn === "function" ? fn() : fn }),
|
|
12
|
+
readonly: (v) => v,
|
|
13
|
+
shallowRef: (v) => ({ value: v }),
|
|
14
|
+
shallowReactive: (v) => v,
|
|
15
|
+
toRef: () => ({ value: void 0 }),
|
|
16
|
+
toRefs: (obj) => Object.fromEntries(
|
|
17
|
+
Object.keys(obj || {}).map((k) => [k, { value: obj[k] }])
|
|
18
|
+
),
|
|
19
|
+
toRaw: (v) => v,
|
|
20
|
+
markRaw: (v) => v,
|
|
21
|
+
isRef: () => false,
|
|
22
|
+
isReactive: () => false,
|
|
23
|
+
isReadonly: () => false,
|
|
24
|
+
isProxy: () => false,
|
|
25
|
+
triggerRef: () => {
|
|
26
|
+
},
|
|
27
|
+
customRef: (factory) => factory(() => {
|
|
28
|
+
}, () => {
|
|
29
|
+
}),
|
|
30
|
+
// Lifecycle
|
|
31
|
+
onMounted: () => {
|
|
32
|
+
},
|
|
33
|
+
onUnmounted: () => {
|
|
34
|
+
},
|
|
35
|
+
onBeforeMount: () => {
|
|
36
|
+
},
|
|
37
|
+
onBeforeUnmount: () => {
|
|
38
|
+
},
|
|
39
|
+
onUpdated: () => {
|
|
40
|
+
},
|
|
41
|
+
onBeforeUpdate: () => {
|
|
42
|
+
},
|
|
43
|
+
onActivated: () => {
|
|
44
|
+
},
|
|
45
|
+
onDeactivated: () => {
|
|
46
|
+
},
|
|
47
|
+
onErrorCaptured: () => {
|
|
48
|
+
},
|
|
49
|
+
// Watchers
|
|
50
|
+
watch: () => () => {
|
|
51
|
+
},
|
|
52
|
+
watchEffect: () => () => {
|
|
53
|
+
},
|
|
54
|
+
watchPostEffect: () => () => {
|
|
55
|
+
},
|
|
56
|
+
watchSyncEffect: () => () => {
|
|
57
|
+
},
|
|
58
|
+
// Composition API
|
|
59
|
+
defineProps: () => ({}),
|
|
60
|
+
defineEmits: () => () => {
|
|
61
|
+
},
|
|
62
|
+
defineExpose: () => {
|
|
63
|
+
},
|
|
64
|
+
defineOptions: () => {
|
|
65
|
+
},
|
|
66
|
+
defineSlots: () => ({}),
|
|
67
|
+
defineModel: () => ({ value: void 0 }),
|
|
68
|
+
withDefaults: (_props, defaults) => defaults,
|
|
69
|
+
useSlots: () => ({}),
|
|
70
|
+
useAttrs: () => ({}),
|
|
71
|
+
// Dependency Injection
|
|
72
|
+
inject: () => void 0,
|
|
73
|
+
provide: () => {
|
|
74
|
+
},
|
|
75
|
+
// Utilities
|
|
76
|
+
nextTick: () => Promise.resolve(),
|
|
77
|
+
getCurrentInstance: () => null,
|
|
78
|
+
h: () => ({}),
|
|
79
|
+
createVNode: () => ({}),
|
|
80
|
+
resolveComponent: () => ({})
|
|
81
|
+
};
|
|
82
|
+
function validateRuntimePrecheck(code) {
|
|
83
|
+
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
84
|
+
const { script, bindings, error } = chunk2L37YJOJ_js.compileSFC(code, scopeId);
|
|
85
|
+
if (error) {
|
|
86
|
+
return {
|
|
87
|
+
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
88
|
+
passed: false,
|
|
89
|
+
errors: [error]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const funcBody = `
|
|
94
|
+
"use strict";
|
|
95
|
+
${script}
|
|
96
|
+
return { ${bindings.join(", ")} };
|
|
97
|
+
`;
|
|
98
|
+
const keys = Object.keys(MOCK_VUE_CONTEXT);
|
|
99
|
+
const values = Object.values(MOCK_VUE_CONTEXT);
|
|
100
|
+
const runner = new Function(...keys, funcBody);
|
|
101
|
+
const result = runner(...values);
|
|
102
|
+
const missingBindings = bindings.filter((binding) => !(binding in result));
|
|
103
|
+
if (missingBindings.length > 0) {
|
|
104
|
+
return {
|
|
105
|
+
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
106
|
+
passed: false,
|
|
107
|
+
errors: missingBindings.map((b) => `\u53D8\u91CF ${b} \u672A\u6B63\u786E\u5BFC\u51FA`)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
112
|
+
passed: true,
|
|
113
|
+
errors: []
|
|
114
|
+
};
|
|
115
|
+
} catch (e) {
|
|
116
|
+
const errorMessage = e.message || String(e);
|
|
117
|
+
const errorLocation = e.stack?.split("\n")[1]?.trim() || "";
|
|
118
|
+
return {
|
|
119
|
+
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
120
|
+
passed: false,
|
|
121
|
+
errors: [
|
|
122
|
+
`JavaScript \u6267\u884C\u9519\u8BEF: ${errorMessage}`,
|
|
123
|
+
...errorLocation ? [`\u4F4D\u7F6E: ${errorLocation}`] : []
|
|
124
|
+
]
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
exports.validateRuntimePrecheck = validateRuntimePrecheck;
|