yuang-framework-ui-pc 1.1.93 → 1.1.94
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/es/utils/resolvers.d.ts +2 -3
- package/es/utils/resolvers.js +20 -60
- package/lib/utils/resolvers.cjs +20 -60
- package/lib/utils/resolvers.d.ts +2 -3
- package/package.json +1 -1
package/es/utils/resolvers.d.ts
CHANGED
|
@@ -5,14 +5,13 @@ import { ComponentResolver } from 'unplugin-vue-components/types';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface EleAdminResolverOptions {
|
|
7
7
|
/** 包路径 */
|
|
8
|
-
path?: string | '
|
|
8
|
+
path?: string | '/es' | '/lib';
|
|
9
9
|
/** 排除的组件名称 */
|
|
10
10
|
exclude?: string[];
|
|
11
11
|
/** 是否导入样式 */
|
|
12
12
|
importStyle?: boolean | 'css' | 'sass';
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param options 参数
|
|
15
|
+
* 极简版组件解析器:仅返回单个配置,避免数组兼容性问题
|
|
17
16
|
*/
|
|
18
17
|
export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
|
package/es/utils/resolvers.js
CHANGED
|
@@ -1,69 +1,29 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
const importStyle = (options == null ? void 0 : options.importStyle) ?? true;
|
|
4
|
-
if (!importStyle) {
|
|
5
|
-
return void 0;
|
|
6
|
-
}
|
|
7
|
-
return importStyle === "css" ? `${path}/style/css` : `${path}/style/index`;
|
|
8
|
-
}
|
|
9
|
-
function getStylePath(namePath, packageName, path = "/es") {
|
|
10
|
-
const safePath = ["", "/es", "/lib", "/es/core", "/lib/core"].includes(path) ? path : "/es";
|
|
11
|
-
if (safePath === "/lib/core") {
|
|
12
|
-
return `${packageName}/lib/${namePath}`;
|
|
13
|
-
}
|
|
14
|
-
return `${packageName}/es/${namePath}`;
|
|
15
|
-
}
|
|
16
|
-
const componentDependencyMap = {
|
|
17
|
-
YuFrameworkAttachmentUpload: ["EleUploadList"]
|
|
18
|
-
// 后续有依赖的组件可继续加:EleTable: ['EleTableColumn']
|
|
19
|
-
};
|
|
20
|
-
function generateComponentResolveConfig(name, options) {
|
|
1
|
+
function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
|
|
2
|
+
const packageName = "yuang-framework-ui-pc";
|
|
21
3
|
const {
|
|
22
4
|
path = "/es",
|
|
23
|
-
exclude = []
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").filter(Boolean).join("-").toLowerCase() || name.toLowerCase();
|
|
27
|
-
const safePath = path || "/es";
|
|
28
|
-
let fromPath = "";
|
|
29
|
-
if (["", "/es/core", "/lib/core"].includes(safePath)) {
|
|
30
|
-
fromPath = `${packageName}/${safePath === "/lib/core" ? "lib" : "es"}`;
|
|
31
|
-
} else if (safePath === "/lib") {
|
|
32
|
-
fromPath = `${packageName}/lib/${namePath}/index`;
|
|
33
|
-
} else {
|
|
34
|
-
fromPath = `${packageName}/es/${namePath}/index`;
|
|
35
|
-
}
|
|
36
|
-
fromPath = fromPath.replace(/undefined/g, "").replace(/\/+/g, "/").replace(/^\/|\/$/g, "");
|
|
37
|
-
if (!fromPath || fromPath === packageName) {
|
|
38
|
-
fromPath = `${packageName}/es/${namePath}`;
|
|
39
|
-
}
|
|
40
|
-
const stylePath = getStylePath(namePath, packageName, safePath);
|
|
41
|
-
const config = {
|
|
42
|
-
name: name.trim(),
|
|
43
|
-
// 组件名去空格
|
|
44
|
-
from: fromPath,
|
|
45
|
-
// 核心路径(绝对合法)
|
|
46
|
-
sideEffects: getSideEffects(stylePath, options)
|
|
47
|
-
// 样式路径(允许undefined)
|
|
48
|
-
};
|
|
49
|
-
console.log(`[组件解析] ${name} -> 路径: ${config.from},样式: ${config.sideEffects}`);
|
|
50
|
-
return config;
|
|
51
|
-
}
|
|
52
|
-
function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
|
|
5
|
+
exclude = [],
|
|
6
|
+
importStyle = true
|
|
7
|
+
} = options;
|
|
53
8
|
return {
|
|
54
9
|
type: "component",
|
|
55
10
|
resolve: (name) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (!isMatch) return void 0;
|
|
60
|
-
const currentConfig = generateComponentResolveConfig(name, options);
|
|
61
|
-
const dependencyList = componentDependencyMap[name];
|
|
62
|
-
if (dependencyList && dependencyList.length) {
|
|
63
|
-
const dependencyConfigs = dependencyList.filter((depName) => !exclude.includes(depName)).map((depName) => generateComponentResolveConfig(depName, options));
|
|
64
|
-
return [currentConfig, ...dependencyConfigs].filter(Boolean);
|
|
11
|
+
if (!/^(Ele|Yu)/.test(name) || exclude.includes(name)) {
|
|
12
|
+
console.log(`[解析跳过] 组件${name}:非Ele/Yu开头或在排除列表`);
|
|
13
|
+
return void 0;
|
|
65
14
|
}
|
|
66
|
-
|
|
15
|
+
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").filter(Boolean).join("-").toLowerCase();
|
|
16
|
+
const basePath = path === "/lib" ? "/lib" : "/es";
|
|
17
|
+
const fromPath = `${packageName}${basePath}/${namePath}/index`;
|
|
18
|
+
const stylePath = `${packageName}${basePath}/${namePath}`;
|
|
19
|
+
const sideEffects = importStyle ? importStyle === "css" ? `${stylePath}/style/css` : `${stylePath}/style/index` : void 0;
|
|
20
|
+
const resolveConfig = {
|
|
21
|
+
name,
|
|
22
|
+
from: fromPath,
|
|
23
|
+
sideEffects
|
|
24
|
+
};
|
|
25
|
+
console.log(`[解析成功] 组件${name} -> 路径: ${fromPath},样式: ${sideEffects}`);
|
|
26
|
+
return resolveConfig;
|
|
67
27
|
}
|
|
68
28
|
};
|
|
69
29
|
}
|
package/lib/utils/resolvers.cjs
CHANGED
|
@@ -1,71 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
const importStyle = (options == null ? void 0 : options.importStyle) ?? true;
|
|
6
|
-
if (!importStyle) {
|
|
7
|
-
return void 0;
|
|
8
|
-
}
|
|
9
|
-
return importStyle === "css" ? `${path}/style/css` : `${path}/style/index`;
|
|
10
|
-
}
|
|
11
|
-
function getStylePath(namePath, packageName, path = "/es") {
|
|
12
|
-
const safePath = ["", "/es", "/lib", "/es/core", "/lib/core"].includes(path) ? path : "/es";
|
|
13
|
-
if (safePath === "/lib/core") {
|
|
14
|
-
return `${packageName}/lib/${namePath}`;
|
|
15
|
-
}
|
|
16
|
-
return `${packageName}/es/${namePath}`;
|
|
17
|
-
}
|
|
18
|
-
const componentDependencyMap = {
|
|
19
|
-
YuFrameworkAttachmentUpload: ["EleUploadList"]
|
|
20
|
-
// 后续有依赖的组件可继续加:EleTable: ['EleTableColumn']
|
|
21
|
-
};
|
|
22
|
-
function generateComponentResolveConfig(name, options) {
|
|
3
|
+
function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
|
|
4
|
+
const packageName = "yuang-framework-ui-pc";
|
|
23
5
|
const {
|
|
24
6
|
path = "/es",
|
|
25
|
-
exclude = []
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").filter(Boolean).join("-").toLowerCase() || name.toLowerCase();
|
|
29
|
-
const safePath = path || "/es";
|
|
30
|
-
let fromPath = "";
|
|
31
|
-
if (["", "/es/core", "/lib/core"].includes(safePath)) {
|
|
32
|
-
fromPath = `${packageName}/${safePath === "/lib/core" ? "lib" : "es"}`;
|
|
33
|
-
} else if (safePath === "/lib") {
|
|
34
|
-
fromPath = `${packageName}/lib/${namePath}/index`;
|
|
35
|
-
} else {
|
|
36
|
-
fromPath = `${packageName}/es/${namePath}/index`;
|
|
37
|
-
}
|
|
38
|
-
fromPath = fromPath.replace(/undefined/g, "").replace(/\/+/g, "/").replace(/^\/|\/$/g, "");
|
|
39
|
-
if (!fromPath || fromPath === packageName) {
|
|
40
|
-
fromPath = `${packageName}/es/${namePath}`;
|
|
41
|
-
}
|
|
42
|
-
const stylePath = getStylePath(namePath, packageName, safePath);
|
|
43
|
-
const config = {
|
|
44
|
-
name: name.trim(),
|
|
45
|
-
// 组件名去空格
|
|
46
|
-
from: fromPath,
|
|
47
|
-
// 核心路径(绝对合法)
|
|
48
|
-
sideEffects: getSideEffects(stylePath, options)
|
|
49
|
-
// 样式路径(允许undefined)
|
|
50
|
-
};
|
|
51
|
-
console.log(`[组件解析] ${name} -> 路径: ${config.from},样式: ${config.sideEffects}`);
|
|
52
|
-
return config;
|
|
53
|
-
}
|
|
54
|
-
function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
|
|
7
|
+
exclude = [],
|
|
8
|
+
importStyle = true
|
|
9
|
+
} = options;
|
|
55
10
|
return {
|
|
56
11
|
type: "component",
|
|
57
12
|
resolve: (name) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!isMatch) return void 0;
|
|
62
|
-
const currentConfig = generateComponentResolveConfig(name, options);
|
|
63
|
-
const dependencyList = componentDependencyMap[name];
|
|
64
|
-
if (dependencyList && dependencyList.length) {
|
|
65
|
-
const dependencyConfigs = dependencyList.filter((depName) => !exclude.includes(depName)).map((depName) => generateComponentResolveConfig(depName, options));
|
|
66
|
-
return [currentConfig, ...dependencyConfigs].filter(Boolean);
|
|
13
|
+
if (!/^(Ele|Yu)/.test(name) || exclude.includes(name)) {
|
|
14
|
+
console.log(`[解析跳过] 组件${name}:非Ele/Yu开头或在排除列表`);
|
|
15
|
+
return void 0;
|
|
67
16
|
}
|
|
68
|
-
|
|
17
|
+
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").filter(Boolean).join("-").toLowerCase();
|
|
18
|
+
const basePath = path === "/lib" ? "/lib" : "/es";
|
|
19
|
+
const fromPath = `${packageName}${basePath}/${namePath}/index`;
|
|
20
|
+
const stylePath = `${packageName}${basePath}/${namePath}`;
|
|
21
|
+
const sideEffects = importStyle ? importStyle === "css" ? `${stylePath}/style/css` : `${stylePath}/style/index` : void 0;
|
|
22
|
+
const resolveConfig = {
|
|
23
|
+
name,
|
|
24
|
+
from: fromPath,
|
|
25
|
+
sideEffects
|
|
26
|
+
};
|
|
27
|
+
console.log(`[解析成功] 组件${name} -> 路径: ${fromPath},样式: ${sideEffects}`);
|
|
28
|
+
return resolveConfig;
|
|
69
29
|
}
|
|
70
30
|
};
|
|
71
31
|
}
|
package/lib/utils/resolvers.d.ts
CHANGED
|
@@ -5,14 +5,13 @@ import { ComponentResolver } from 'unplugin-vue-components/types';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface EleAdminResolverOptions {
|
|
7
7
|
/** 包路径 */
|
|
8
|
-
path?: string | '
|
|
8
|
+
path?: string | '/es' | '/lib';
|
|
9
9
|
/** 排除的组件名称 */
|
|
10
10
|
exclude?: string[];
|
|
11
11
|
/** 是否导入样式 */
|
|
12
12
|
importStyle?: boolean | 'css' | 'sass';
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param options 参数
|
|
15
|
+
* 极简版组件解析器:仅返回单个配置,避免数组兼容性问题
|
|
17
16
|
*/
|
|
18
17
|
export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
|