king-design-analyzer 2.1.5 → 2.1.7
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-D6QDTSMN.js → chunk-6QS5IGS6.js} +7 -7
- package/dist/{chunk-32HIMGM4.js → chunk-D3Y6FGWA.js} +22 -3
- package/dist/{chunk-UV564QXV.mjs → chunk-DSWKLUIX.mjs} +1 -1
- package/dist/{chunk-CVJFFX7X.mjs → chunk-FVSQ6BU6.mjs} +3 -3
- package/dist/{chunk-UYVGHUC5.mjs → chunk-HDV7ETXE.mjs} +30 -2
- package/dist/{chunk-2FV6BC3K.js → chunk-HPAUCD5I.js} +24 -3
- package/dist/{chunk-JAICJP7Q.mjs → chunk-L4DS3EXI.mjs} +24 -3
- package/dist/{chunk-KWZGUEDK.mjs → chunk-NZ6TLWMD.mjs} +21 -2
- package/dist/{chunk-XKMKIWYX.js → chunk-WYSRJVX4.js} +2 -2
- package/dist/{chunk-GW5YOUB7.js → chunk-YWY3D4J7.js} +32 -4
- package/dist/full/index.js +6 -6
- package/dist/full/index.mjs +4 -4
- package/dist/index.js +13 -13
- package/dist/index.mjs +5 -5
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/index.mjs +2 -2
- package/dist/static/index.js +5 -5
- package/dist/static/index.mjs +2 -2
- package/package.json +1 -1
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 chunkYWY3D4J7_js = require('../chunk-YWY3D4J7.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 chunkYWY3D4J7_js.analyzeCodeWithAST; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "componentRegistry", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkYWY3D4J7_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-HDV7ETXE.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkYWY3D4J7_js = require('./chunk-YWY3D4J7.js');
|
|
4
|
+
var chunkD3Y6FGWA_js = require('./chunk-D3Y6FGWA.js');
|
|
5
|
+
var chunkHPAUCD5I_js = require('./chunk-HPAUCD5I.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 =
|
|
44
|
+
const result = chunkHPAUCD5I_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
|
|
67
|
+
const violations = await chunkYWY3D4J7_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 =
|
|
113
|
+
const runtimeResult = chunkD3Y6FGWA_js.validateRuntimePrecheck(code);
|
|
114
114
|
if (!runtimeResult.passed) {
|
|
115
115
|
return {
|
|
116
116
|
passed: false,
|
|
@@ -144,7 +144,7 @@ function validateCodeSync(code) {
|
|
|
144
144
|
summary: `\u274C \u7F16\u8BD1\u5931\u8D25: ${compilationResult.errors[0]}`
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
const runtimeResult =
|
|
147
|
+
const runtimeResult = chunkD3Y6FGWA_js.validateRuntimePrecheck(code);
|
|
148
148
|
return {
|
|
149
149
|
passed: runtimeResult.passed,
|
|
150
150
|
layers: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHPAUCD5I_js = require('./chunk-HPAUCD5I.js');
|
|
4
4
|
|
|
5
5
|
// src/runtime/index.ts
|
|
6
6
|
var scopeIdCounter = 0;
|
|
@@ -82,11 +82,30 @@ var MOCK_VUE_CONTEXT = {
|
|
|
82
82
|
// @ksyun-internal/versatile Hooks
|
|
83
83
|
// =========================================================================
|
|
84
84
|
useToState: (_props, _key, _emit, defaultValue) => ({ value: defaultValue ?? void 0 }),
|
|
85
|
-
useIdEntity: () => ({ value: void 0 })
|
|
85
|
+
useIdEntity: () => ({ value: void 0 }),
|
|
86
|
+
// =========================================================================
|
|
87
|
+
// Module Mocking
|
|
88
|
+
// =========================================================================
|
|
89
|
+
__mockModule: (modulePath) => {
|
|
90
|
+
const createMockProxy = (path) => {
|
|
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
|
+
}
|
|
86
105
|
};
|
|
87
106
|
function validateRuntimePrecheck(code) {
|
|
88
107
|
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
89
|
-
const { script, bindings, strippedImports, error } =
|
|
108
|
+
const { script, bindings, strippedImports, error } = chunkHPAUCD5I_js.compileSFC(code, scopeId);
|
|
90
109
|
if (error) {
|
|
91
110
|
return {
|
|
92
111
|
name: "\u8FD0\u884C\u65F6\u9884\u68C0\u67E5",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { analyzeCodeWithAST } from './chunk-
|
|
2
|
-
import { validateRuntimePrecheck } from './chunk-
|
|
3
|
-
import { compileSFC } from './chunk-
|
|
1
|
+
import { analyzeCodeWithAST } from './chunk-HDV7ETXE.mjs';
|
|
2
|
+
import { validateRuntimePrecheck } from './chunk-NZ6TLWMD.mjs';
|
|
3
|
+
import { compileSFC } from './chunk-L4DS3EXI.mjs';
|
|
4
4
|
|
|
5
5
|
// src/tools/unifiedValidator.ts
|
|
6
6
|
function validateCompilation(code) {
|
|
@@ -510,6 +510,15 @@ var NATIVE_HTML_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
510
510
|
"aria-controls",
|
|
511
511
|
"aria-haspopup"
|
|
512
512
|
]);
|
|
513
|
+
var STRICT_CHECK_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
514
|
+
"required",
|
|
515
|
+
"disabled",
|
|
516
|
+
"readonly",
|
|
517
|
+
"value",
|
|
518
|
+
"name",
|
|
519
|
+
"checked",
|
|
520
|
+
"selected"
|
|
521
|
+
]);
|
|
513
522
|
var VERSATILE_COMPONENTS = /* @__PURE__ */ new Set([
|
|
514
523
|
"BillTypes",
|
|
515
524
|
"Region",
|
|
@@ -900,6 +909,23 @@ function checkComponentSpecificRules(tagName, node, violations) {
|
|
|
900
909
|
}
|
|
901
910
|
});
|
|
902
911
|
}
|
|
912
|
+
if (tagName === "TableColumn") {
|
|
913
|
+
node.children?.forEach((child) => {
|
|
914
|
+
if (child.type === 1 && child.tag === "template") {
|
|
915
|
+
const slotProp = child.props?.find((p) => p.type === 7 && p.name === "slot");
|
|
916
|
+
if (slotProp && slotProp.exp && slotProp.exp.content) {
|
|
917
|
+
const exp = slotProp.exp.content.trim();
|
|
918
|
+
if (exp.startsWith("{") && exp.endsWith("}")) {
|
|
919
|
+
violations.push({
|
|
920
|
+
rule: "TableColumn \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u6570\u7EC4\u7ED3\u6784",
|
|
921
|
+
match: exp,
|
|
922
|
+
suggestion: `King Design \u8868\u683C\u63D2\u69FD\u53C2\u6570\u4E3A\u6570\u7EC4\u987A\u5E8F\u4F20\u9012\uFF0C\u8BF7\u5C06 ${exp} \u6539\u4E3A [row]`
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
}
|
|
903
929
|
}
|
|
904
930
|
function checkProps(tagName, node, metadata, violations) {
|
|
905
931
|
let customTagName = null;
|
|
@@ -923,10 +949,12 @@ function checkProps(tagName, node, metadata, violations) {
|
|
|
923
949
|
const isDynamicallyAllowed = dynamicAllowedProps.includes(propName);
|
|
924
950
|
const isBuiltinProp = ["class", "style", "key", "ref"].includes(propName) || propName.startsWith("data-");
|
|
925
951
|
const isNativeHtmlAttr = NATIVE_HTML_ATTRIBUTES.has(propName) || propName.startsWith("aria-");
|
|
926
|
-
|
|
952
|
+
const isStrictAttr = STRICT_CHECK_ATTRIBUTES.has(propName);
|
|
953
|
+
const isNativeIgnored = isNativeHtmlAttr && isStrictAttr && metadata.props;
|
|
954
|
+
if (!isPropValid && !isDynamicallyAllowed && !isBuiltinProp && (!isNativeHtmlAttr || isNativeIgnored)) {
|
|
927
955
|
if (metadata.props && metadata.props.length > 0) {
|
|
928
956
|
violations.push({
|
|
929
|
-
rule: `\u5C5E\u6027 ${propName} \u4E0D\u5B58\u5728\u4E8E ${tagName}`,
|
|
957
|
+
rule: `\u5C5E\u6027 ${propName} \u4E0D\u5B58\u5728\u4E8E ${tagName}${isNativeIgnored ? " (\u8BE5\u7EC4\u4EF6\u4E0D\u652F\u6301\u6B64\u539F\u751F\u5C5E\u6027)" : ""}`,
|
|
930
958
|
match: propName,
|
|
931
959
|
suggestion: `\u53EF\u7528\u5C5E\u6027: ${metadata.props.map((p) => p.name).join(", ")}`
|
|
932
960
|
});
|
|
@@ -41,6 +41,27 @@ function scopeStyles(css, scopeClass) {
|
|
|
41
41
|
return `${scopedSelector}${suffix}`;
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
function transformLocalImportToMock(importClause, source) {
|
|
45
|
+
const namespaceMatch = importClause.match(/^\*\s+as\s+(\w+)$/);
|
|
46
|
+
if (namespaceMatch) {
|
|
47
|
+
return `const ${namespaceMatch[1]} = __mockModule('${source}');`;
|
|
48
|
+
}
|
|
49
|
+
const namedMatch = importClause.match(/^\{([^}]+)\}$/);
|
|
50
|
+
if (namedMatch) {
|
|
51
|
+
return `const { ${namedMatch[1]} } = __mockModule('${source}');`;
|
|
52
|
+
}
|
|
53
|
+
const defaultMatch = importClause.match(/^(\w+)/);
|
|
54
|
+
if (defaultMatch) {
|
|
55
|
+
const defaultName = defaultMatch[1];
|
|
56
|
+
const mixedMatch = importClause.match(/^(\w+)\s*,\s*\{([^}]+)\}$/);
|
|
57
|
+
if (mixedMatch) {
|
|
58
|
+
const namedImports = mixedMatch[2];
|
|
59
|
+
return `const _mock_${defaultName} = __mockModule('${source}'); const ${defaultName} = _mock_${defaultName}.default || _mock_${defaultName}; const { ${namedImports} } = _mock_${defaultName};`;
|
|
60
|
+
}
|
|
61
|
+
return `const ${defaultName} = __mockModule('${source}').default || __mockModule('${source}');`;
|
|
62
|
+
}
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
44
65
|
function compileSFC(code, scopeId, options) {
|
|
45
66
|
const whitelist = options?.allowedImports ?? ALLOWED_IMPORT_SOURCES;
|
|
46
67
|
const strippedImports = [];
|
|
@@ -58,8 +79,8 @@ function compileSFC(code, scopeId, options) {
|
|
|
58
79
|
let cleanScript = script;
|
|
59
80
|
cleanScript = cleanScript.replace(/import\s+type\s+[\s\S]*?from\s+['"].*?['"];?/g, "");
|
|
60
81
|
cleanScript = cleanScript.replace(
|
|
61
|
-
/import\s+[\s
|
|
62
|
-
(match, source) => {
|
|
82
|
+
/import\s+([^;]+?)\s+from\s+['"]([^'"]+)['"];?/g,
|
|
83
|
+
(match, importClause, source) => {
|
|
63
84
|
const isWhitelisted = whitelist.some(
|
|
64
85
|
(w) => source === w || source.startsWith(w + "/")
|
|
65
86
|
);
|
|
@@ -69,7 +90,7 @@ function compileSFC(code, scopeId, options) {
|
|
|
69
90
|
}
|
|
70
91
|
if (source.startsWith(".")) {
|
|
71
92
|
strippedImports.push({ source, reason: "relative" });
|
|
72
|
-
return
|
|
93
|
+
return transformLocalImportToMock(importClause.trim(), source);
|
|
73
94
|
}
|
|
74
95
|
strippedImports.push({ source, reason: "unknown" });
|
|
75
96
|
return "";
|
|
@@ -19,6 +19,27 @@ function scopeStyles(css, scopeClass) {
|
|
|
19
19
|
return `${scopedSelector}${suffix}`;
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
function transformLocalImportToMock(importClause, source) {
|
|
23
|
+
const namespaceMatch = importClause.match(/^\*\s+as\s+(\w+)$/);
|
|
24
|
+
if (namespaceMatch) {
|
|
25
|
+
return `const ${namespaceMatch[1]} = __mockModule('${source}');`;
|
|
26
|
+
}
|
|
27
|
+
const namedMatch = importClause.match(/^\{([^}]+)\}$/);
|
|
28
|
+
if (namedMatch) {
|
|
29
|
+
return `const { ${namedMatch[1]} } = __mockModule('${source}');`;
|
|
30
|
+
}
|
|
31
|
+
const defaultMatch = importClause.match(/^(\w+)/);
|
|
32
|
+
if (defaultMatch) {
|
|
33
|
+
const defaultName = defaultMatch[1];
|
|
34
|
+
const mixedMatch = importClause.match(/^(\w+)\s*,\s*\{([^}]+)\}$/);
|
|
35
|
+
if (mixedMatch) {
|
|
36
|
+
const namedImports = mixedMatch[2];
|
|
37
|
+
return `const _mock_${defaultName} = __mockModule('${source}'); const ${defaultName} = _mock_${defaultName}.default || _mock_${defaultName}; const { ${namedImports} } = _mock_${defaultName};`;
|
|
38
|
+
}
|
|
39
|
+
return `const ${defaultName} = __mockModule('${source}').default || __mockModule('${source}');`;
|
|
40
|
+
}
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
22
43
|
function compileSFC(code, scopeId, options) {
|
|
23
44
|
const whitelist = options?.allowedImports ?? ALLOWED_IMPORT_SOURCES;
|
|
24
45
|
const strippedImports = [];
|
|
@@ -36,8 +57,8 @@ function compileSFC(code, scopeId, options) {
|
|
|
36
57
|
let cleanScript = script;
|
|
37
58
|
cleanScript = cleanScript.replace(/import\s+type\s+[\s\S]*?from\s+['"].*?['"];?/g, "");
|
|
38
59
|
cleanScript = cleanScript.replace(
|
|
39
|
-
/import\s+[\s
|
|
40
|
-
(match, source) => {
|
|
60
|
+
/import\s+([^;]+?)\s+from\s+['"]([^'"]+)['"];?/g,
|
|
61
|
+
(match, importClause, source) => {
|
|
41
62
|
const isWhitelisted = whitelist.some(
|
|
42
63
|
(w) => source === w || source.startsWith(w + "/")
|
|
43
64
|
);
|
|
@@ -47,7 +68,7 @@ function compileSFC(code, scopeId, options) {
|
|
|
47
68
|
}
|
|
48
69
|
if (source.startsWith(".")) {
|
|
49
70
|
strippedImports.push({ source, reason: "relative" });
|
|
50
|
-
return
|
|
71
|
+
return transformLocalImportToMock(importClause.trim(), source);
|
|
51
72
|
}
|
|
52
73
|
strippedImports.push({ source, reason: "unknown" });
|
|
53
74
|
return "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compileSFC } from './chunk-
|
|
1
|
+
import { compileSFC } from './chunk-L4DS3EXI.mjs';
|
|
2
2
|
|
|
3
3
|
// src/runtime/index.ts
|
|
4
4
|
var scopeIdCounter = 0;
|
|
@@ -80,7 +80,26 @@ var MOCK_VUE_CONTEXT = {
|
|
|
80
80
|
// @ksyun-internal/versatile Hooks
|
|
81
81
|
// =========================================================================
|
|
82
82
|
useToState: (_props, _key, _emit, defaultValue) => ({ value: defaultValue ?? void 0 }),
|
|
83
|
-
useIdEntity: () => ({ value: void 0 })
|
|
83
|
+
useIdEntity: () => ({ value: void 0 }),
|
|
84
|
+
// =========================================================================
|
|
85
|
+
// Module Mocking
|
|
86
|
+
// =========================================================================
|
|
87
|
+
__mockModule: (modulePath) => {
|
|
88
|
+
const createMockProxy = (path) => {
|
|
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
|
+
}
|
|
84
103
|
};
|
|
85
104
|
function validateRuntimePrecheck(code) {
|
|
86
105
|
const scopeId = `runtime-${Date.now()}-${++scopeIdCounter}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHPAUCD5I_js = require('./chunk-HPAUCD5I.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 =
|
|
47
|
+
const result = chunkHPAUCD5I_js.compileSFC(code, scopeId);
|
|
48
48
|
if (result.error) {
|
|
49
49
|
return {
|
|
50
50
|
name: "\u7F16\u8BD1\u68C0\u67E5",
|
|
@@ -32,7 +32,7 @@ var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
|
32
32
|
var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
|
|
33
33
|
|
|
34
34
|
// src/analysis/componentRegistry.ts
|
|
35
|
-
var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
35
|
+
var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-YWY3D4J7.js', document.baseURI).href)));
|
|
36
36
|
var __dirname$1 = path__namespace.dirname(__filename$1);
|
|
37
37
|
function resolveComponentsPath() {
|
|
38
38
|
const prodPath = path__namespace.join(__dirname$1, "../components");
|
|
@@ -122,7 +122,7 @@ var ComponentRegistry = class {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
var componentRegistry = new ComponentRegistry();
|
|
125
|
-
var __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
125
|
+
var __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-YWY3D4J7.js', document.baseURI).href)));
|
|
126
126
|
var __dirname2 = path__namespace.dirname(__filename2);
|
|
127
127
|
function resolveHooksPath() {
|
|
128
128
|
const prodPath = path__namespace.join(__dirname2, "../hooks");
|
|
@@ -536,6 +536,15 @@ var NATIVE_HTML_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
536
536
|
"aria-controls",
|
|
537
537
|
"aria-haspopup"
|
|
538
538
|
]);
|
|
539
|
+
var STRICT_CHECK_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
540
|
+
"required",
|
|
541
|
+
"disabled",
|
|
542
|
+
"readonly",
|
|
543
|
+
"value",
|
|
544
|
+
"name",
|
|
545
|
+
"checked",
|
|
546
|
+
"selected"
|
|
547
|
+
]);
|
|
539
548
|
var VERSATILE_COMPONENTS = /* @__PURE__ */ new Set([
|
|
540
549
|
"BillTypes",
|
|
541
550
|
"Region",
|
|
@@ -926,6 +935,23 @@ function checkComponentSpecificRules(tagName, node, violations) {
|
|
|
926
935
|
}
|
|
927
936
|
});
|
|
928
937
|
}
|
|
938
|
+
if (tagName === "TableColumn") {
|
|
939
|
+
node.children?.forEach((child) => {
|
|
940
|
+
if (child.type === 1 && child.tag === "template") {
|
|
941
|
+
const slotProp = child.props?.find((p) => p.type === 7 && p.name === "slot");
|
|
942
|
+
if (slotProp && slotProp.exp && slotProp.exp.content) {
|
|
943
|
+
const exp = slotProp.exp.content.trim();
|
|
944
|
+
if (exp.startsWith("{") && exp.endsWith("}")) {
|
|
945
|
+
violations.push({
|
|
946
|
+
rule: "TableColumn \u63D2\u69FD\u53C2\u6570\u5E94\u4E3A\u6570\u7EC4\u7ED3\u6784",
|
|
947
|
+
match: exp,
|
|
948
|
+
suggestion: `King Design \u8868\u683C\u63D2\u69FD\u53C2\u6570\u4E3A\u6570\u7EC4\u987A\u5E8F\u4F20\u9012\uFF0C\u8BF7\u5C06 ${exp} \u6539\u4E3A [row]`
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
}
|
|
929
955
|
}
|
|
930
956
|
function checkProps(tagName, node, metadata, violations) {
|
|
931
957
|
let customTagName = null;
|
|
@@ -949,10 +975,12 @@ function checkProps(tagName, node, metadata, violations) {
|
|
|
949
975
|
const isDynamicallyAllowed = dynamicAllowedProps.includes(propName);
|
|
950
976
|
const isBuiltinProp = ["class", "style", "key", "ref"].includes(propName) || propName.startsWith("data-");
|
|
951
977
|
const isNativeHtmlAttr = NATIVE_HTML_ATTRIBUTES.has(propName) || propName.startsWith("aria-");
|
|
952
|
-
|
|
978
|
+
const isStrictAttr = STRICT_CHECK_ATTRIBUTES.has(propName);
|
|
979
|
+
const isNativeIgnored = isNativeHtmlAttr && isStrictAttr && metadata.props;
|
|
980
|
+
if (!isPropValid && !isDynamicallyAllowed && !isBuiltinProp && (!isNativeHtmlAttr || isNativeIgnored)) {
|
|
953
981
|
if (metadata.props && metadata.props.length > 0) {
|
|
954
982
|
violations.push({
|
|
955
|
-
rule: `\u5C5E\u6027 ${propName} \u4E0D\u5B58\u5728\u4E8E ${tagName}`,
|
|
983
|
+
rule: `\u5C5E\u6027 ${propName} \u4E0D\u5B58\u5728\u4E8E ${tagName}${isNativeIgnored ? " (\u8BE5\u7EC4\u4EF6\u4E0D\u652F\u6301\u6B64\u539F\u751F\u5C5E\u6027)" : ""}`,
|
|
956
984
|
match: propName,
|
|
957
985
|
suggestion: `\u53EF\u7528\u5C5E\u6027: ${metadata.props.map((p) => p.name).join(", ")}`
|
|
958
986
|
});
|
package/dist/full/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk6QS5IGS6_js = require('../chunk-6QS5IGS6.js');
|
|
4
|
+
require('../chunk-YWY3D4J7.js');
|
|
5
|
+
require('../chunk-D3Y6FGWA.js');
|
|
6
|
+
require('../chunk-HPAUCD5I.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "validateCode", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk6QS5IGS6_js.validateCode; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "validateCodeSync", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk6QS5IGS6_js.validateCodeSync; }
|
|
17
17
|
});
|
package/dist/full/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { validateCode, validateCodeSync } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { validateCode, validateCodeSync } from '../chunk-FVSQ6BU6.mjs';
|
|
2
|
+
import '../chunk-HDV7ETXE.mjs';
|
|
3
|
+
import '../chunk-NZ6TLWMD.mjs';
|
|
4
|
+
import '../chunk-L4DS3EXI.mjs';
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWYSRJVX4_js = require('./chunk-WYSRJVX4.js');
|
|
4
4
|
require('./chunk-YTEYDSDW.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var chunk6QS5IGS6_js = require('./chunk-6QS5IGS6.js');
|
|
6
|
+
var chunkYWY3D4J7_js = require('./chunk-YWY3D4J7.js');
|
|
7
|
+
var chunkD3Y6FGWA_js = require('./chunk-D3Y6FGWA.js');
|
|
8
|
+
var chunkHPAUCD5I_js = require('./chunk-HPAUCD5I.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "validateCompilation", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkWYSRJVX4_js.validateCompilation; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "validateCode", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunk6QS5IGS6_js.validateCode; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "validateCodeSync", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunk6QS5IGS6_js.validateCodeSync; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "analyzeCodeWithAST", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkYWY3D4J7_js.analyzeCodeWithAST; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "componentRegistry", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkYWY3D4J7_js.componentRegistry; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "validateRuntimePrecheck", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkD3Y6FGWA_js.validateRuntimePrecheck; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "compileSFC", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkHPAUCD5I_js.compileSFC; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "scopeStyles", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkHPAUCD5I_js.scopeStyles; }
|
|
43
43
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { validateCompilation } from './chunk-
|
|
1
|
+
export { validateCompilation } from './chunk-DSWKLUIX.mjs';
|
|
2
2
|
import './chunk-5H7N2A5X.mjs';
|
|
3
|
-
export { validateCode, validateCodeSync } from './chunk-
|
|
4
|
-
export { analyzeCodeWithAST, componentRegistry } from './chunk-
|
|
5
|
-
export { validateRuntimePrecheck } from './chunk-
|
|
6
|
-
export { compileSFC, scopeStyles } from './chunk-
|
|
3
|
+
export { validateCode, validateCodeSync } from './chunk-FVSQ6BU6.mjs';
|
|
4
|
+
export { analyzeCodeWithAST, componentRegistry } from './chunk-HDV7ETXE.mjs';
|
|
5
|
+
export { validateRuntimePrecheck } from './chunk-NZ6TLWMD.mjs';
|
|
6
|
+
export { compileSFC, scopeStyles } from './chunk-L4DS3EXI.mjs';
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkD3Y6FGWA_js = require('../chunk-D3Y6FGWA.js');
|
|
4
|
+
var chunkHPAUCD5I_js = require('../chunk-HPAUCD5I.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "validateRuntimePrecheck", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkD3Y6FGWA_js.validateRuntimePrecheck; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "compileSFC", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkHPAUCD5I_js.compileSFC; }
|
|
15
15
|
});
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { validateRuntimePrecheck } from '../chunk-
|
|
2
|
-
export { compileSFC } from '../chunk-
|
|
1
|
+
export { validateRuntimePrecheck } from '../chunk-NZ6TLWMD.mjs';
|
|
2
|
+
export { compileSFC } from '../chunk-L4DS3EXI.mjs';
|
package/dist/static/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkWYSRJVX4_js = require('../chunk-WYSRJVX4.js');
|
|
4
|
+
var chunkHPAUCD5I_js = require('../chunk-HPAUCD5I.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "validateCompilation", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkWYSRJVX4_js.validateCompilation; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "compileSFC", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkHPAUCD5I_js.compileSFC; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "scopeStyles", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkHPAUCD5I_js.scopeStyles; }
|
|
19
19
|
});
|
package/dist/static/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { validateCompilation } from '../chunk-
|
|
2
|
-
export { compileSFC, scopeStyles } from '../chunk-
|
|
1
|
+
export { validateCompilation } from '../chunk-DSWKLUIX.mjs';
|
|
2
|
+
export { compileSFC, scopeStyles } from '../chunk-L4DS3EXI.mjs';
|
package/package.json
CHANGED