yuang-framework-ui-pc 1.1.87 → 1.1.89
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 +1 -1
- package/es/utils/resolvers.js +34 -31
- package/lib/utils/resolvers.cjs +34 -31
- package/lib/utils/resolvers.d.ts +1 -1
- package/package.json +1 -1
package/es/utils/resolvers.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface EleAdminResolverOptions {
|
|
|
12
12
|
importStyle?: boolean | 'css' | 'sass';
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 按需加载插件(修复依赖组件解析问题)
|
|
16
16
|
* @param options 参数
|
|
17
17
|
*/
|
|
18
18
|
export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
|
package/es/utils/resolvers.js
CHANGED
|
@@ -22,48 +22,51 @@ function getStylePath(namePath, packageName, path) {
|
|
|
22
22
|
}
|
|
23
23
|
const componentDependencyMap = {
|
|
24
24
|
YuFrameworkAttachmentUpload: ["EleUploadList"]
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// EleForm: ['
|
|
25
|
+
// 可继续添加其他依赖:
|
|
26
|
+
// EleTable: ['EleTableColumn'],
|
|
27
|
+
// EleForm: ['EleFormItem', 'EleInput']
|
|
28
28
|
};
|
|
29
|
+
const allNeedResolveComponents = /* @__PURE__ */ new Set();
|
|
30
|
+
Object.keys(componentDependencyMap).forEach((parent) => allNeedResolveComponents.add(parent));
|
|
31
|
+
Object.values(componentDependencyMap).forEach((children) => {
|
|
32
|
+
children.forEach((child) => allNeedResolveComponents.add(child));
|
|
33
|
+
});
|
|
34
|
+
function generateComponentResolveConfig(name, options) {
|
|
35
|
+
const { path, exclude } = options || {};
|
|
36
|
+
const packageName = "yuang-framework-ui-pc";
|
|
37
|
+
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
|
|
38
|
+
const stylePath = getStylePath(namePath, packageName, path);
|
|
39
|
+
if (!path || path === "/es/core" || path === "/lib/core") {
|
|
40
|
+
return {
|
|
41
|
+
name,
|
|
42
|
+
from: `${packageName}${path ?? "/es"}`,
|
|
43
|
+
sideEffects: getSideEffects(stylePath, options)
|
|
44
|
+
};
|
|
45
|
+
} else {
|
|
46
|
+
return {
|
|
47
|
+
from: `${packageName}${path}/${namePath}/index`,
|
|
48
|
+
sideEffects: getSideEffects(stylePath, options)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
29
52
|
function EleAdminResolver(options) {
|
|
30
53
|
return {
|
|
31
54
|
type: "component",
|
|
32
55
|
resolve: (name) => {
|
|
33
56
|
var _a;
|
|
34
|
-
const {
|
|
35
|
-
const isMatch = /^(Ele|Yu)/.test(name) && !((_a = exclude == null ? void 0 : exclude.includes) == null ? void 0 : _a.call(exclude, name));
|
|
57
|
+
const { exclude } = options || {};
|
|
58
|
+
const isMatch = /^(Ele|Yu)/.test(name) && !((_a = exclude == null ? void 0 : exclude.includes) == null ? void 0 : _a.call(exclude, name)) && allNeedResolveComponents.has(name);
|
|
36
59
|
console.log("按需加载插件:" + name + ",是否匹配:" + isMatch);
|
|
37
60
|
if (isMatch) {
|
|
38
|
-
const
|
|
39
|
-
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
|
|
40
|
-
const stylePath = getStylePath(namePath, packageName, path);
|
|
41
|
-
let resolveResult;
|
|
42
|
-
if (!path || path === "/es/core" || path === "/lib/core") {
|
|
43
|
-
resolveResult = {
|
|
44
|
-
name,
|
|
45
|
-
from: `${packageName}${path ?? "/es"}`,
|
|
46
|
-
sideEffects: getSideEffects(stylePath, options)
|
|
47
|
-
};
|
|
48
|
-
} else {
|
|
49
|
-
resolveResult = {
|
|
50
|
-
from: `${packageName}${path}/${namePath}/index`,
|
|
51
|
-
sideEffects: getSideEffects(stylePath, options)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
61
|
+
const currentConfig = generateComponentResolveConfig(name, options);
|
|
54
62
|
const dependencyList = componentDependencyMap[name];
|
|
55
63
|
if (dependencyList && dependencyList.length) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
name: depName,
|
|
61
|
-
from: !path || path === "/es/core" || path === "/lib/core" ? `${packageName}${path ?? "/es"}` : `${packageName}${path}/${dependencyPath}/index`,
|
|
62
|
-
sideEffects: getSideEffects(dependencyStylePath, options)
|
|
63
|
-
};
|
|
64
|
-
});
|
|
64
|
+
const dependencyConfigs = dependencyList.map(
|
|
65
|
+
(depName) => generateComponentResolveConfig(depName, options)
|
|
66
|
+
);
|
|
67
|
+
return [currentConfig, ...dependencyConfigs];
|
|
65
68
|
}
|
|
66
|
-
return
|
|
69
|
+
return currentConfig;
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
};
|
package/lib/utils/resolvers.cjs
CHANGED
|
@@ -24,48 +24,51 @@ function getStylePath(namePath, packageName, path) {
|
|
|
24
24
|
}
|
|
25
25
|
const componentDependencyMap = {
|
|
26
26
|
YuFrameworkAttachmentUpload: ["EleUploadList"]
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
// EleForm: ['
|
|
27
|
+
// 可继续添加其他依赖:
|
|
28
|
+
// EleTable: ['EleTableColumn'],
|
|
29
|
+
// EleForm: ['EleFormItem', 'EleInput']
|
|
30
30
|
};
|
|
31
|
+
const allNeedResolveComponents = /* @__PURE__ */ new Set();
|
|
32
|
+
Object.keys(componentDependencyMap).forEach((parent) => allNeedResolveComponents.add(parent));
|
|
33
|
+
Object.values(componentDependencyMap).forEach((children) => {
|
|
34
|
+
children.forEach((child) => allNeedResolveComponents.add(child));
|
|
35
|
+
});
|
|
36
|
+
function generateComponentResolveConfig(name, options) {
|
|
37
|
+
const { path, exclude } = options || {};
|
|
38
|
+
const packageName = "yuang-framework-ui-pc";
|
|
39
|
+
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
|
|
40
|
+
const stylePath = getStylePath(namePath, packageName, path);
|
|
41
|
+
if (!path || path === "/es/core" || path === "/lib/core") {
|
|
42
|
+
return {
|
|
43
|
+
name,
|
|
44
|
+
from: `${packageName}${path ?? "/es"}`,
|
|
45
|
+
sideEffects: getSideEffects(stylePath, options)
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
return {
|
|
49
|
+
from: `${packageName}${path}/${namePath}/index`,
|
|
50
|
+
sideEffects: getSideEffects(stylePath, options)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
31
54
|
function EleAdminResolver(options) {
|
|
32
55
|
return {
|
|
33
56
|
type: "component",
|
|
34
57
|
resolve: (name) => {
|
|
35
58
|
var _a;
|
|
36
|
-
const {
|
|
37
|
-
const isMatch = /^(Ele|Yu)/.test(name) && !((_a = exclude == null ? void 0 : exclude.includes) == null ? void 0 : _a.call(exclude, name));
|
|
59
|
+
const { exclude } = options || {};
|
|
60
|
+
const isMatch = /^(Ele|Yu)/.test(name) && !((_a = exclude == null ? void 0 : exclude.includes) == null ? void 0 : _a.call(exclude, name)) && allNeedResolveComponents.has(name);
|
|
38
61
|
console.log("按需加载插件:" + name + ",是否匹配:" + isMatch);
|
|
39
62
|
if (isMatch) {
|
|
40
|
-
const
|
|
41
|
-
const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
|
|
42
|
-
const stylePath = getStylePath(namePath, packageName, path);
|
|
43
|
-
let resolveResult;
|
|
44
|
-
if (!path || path === "/es/core" || path === "/lib/core") {
|
|
45
|
-
resolveResult = {
|
|
46
|
-
name,
|
|
47
|
-
from: `${packageName}${path ?? "/es"}`,
|
|
48
|
-
sideEffects: getSideEffects(stylePath, options)
|
|
49
|
-
};
|
|
50
|
-
} else {
|
|
51
|
-
resolveResult = {
|
|
52
|
-
from: `${packageName}${path}/${namePath}/index`,
|
|
53
|
-
sideEffects: getSideEffects(stylePath, options)
|
|
54
|
-
};
|
|
55
|
-
}
|
|
63
|
+
const currentConfig = generateComponentResolveConfig(name, options);
|
|
56
64
|
const dependencyList = componentDependencyMap[name];
|
|
57
65
|
if (dependencyList && dependencyList.length) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
name: depName,
|
|
63
|
-
from: !path || path === "/es/core" || path === "/lib/core" ? `${packageName}${path ?? "/es"}` : `${packageName}${path}/${dependencyPath}/index`,
|
|
64
|
-
sideEffects: getSideEffects(dependencyStylePath, options)
|
|
65
|
-
};
|
|
66
|
-
});
|
|
66
|
+
const dependencyConfigs = dependencyList.map(
|
|
67
|
+
(depName) => generateComponentResolveConfig(depName, options)
|
|
68
|
+
);
|
|
69
|
+
return [currentConfig, ...dependencyConfigs];
|
|
67
70
|
}
|
|
68
|
-
return
|
|
71
|
+
return currentConfig;
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
};
|
package/lib/utils/resolvers.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface EleAdminResolverOptions {
|
|
|
12
12
|
importStyle?: boolean | 'css' | 'sass';
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 按需加载插件(修复依赖组件解析问题)
|
|
16
16
|
* @param options 参数
|
|
17
17
|
*/
|
|
18
18
|
export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
|