yuang-framework-ui-pc 1.1.89 → 1.1.90

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.
@@ -12,7 +12,7 @@ export interface EleAdminResolverOptions {
12
12
  importStyle?: boolean | 'css' | 'sass';
13
13
  }
14
14
  /**
15
- * 按需加载插件(修复依赖组件解析问题)
15
+ * 按需加载插件(修复依赖组件解析问题 + 路径undefined问题)
16
16
  * @param options 参数
17
17
  */
18
18
  export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
@@ -8,16 +8,10 @@ function getSideEffects(path, options) {
8
8
  }
9
9
  return `${path}/style/index`;
10
10
  }
11
- function getStylePath(namePath, packageName, path) {
12
- if (!path) {
13
- return `${packageName}/es/${namePath}`;
14
- }
15
- if (path === "/es/core") {
11
+ function getStylePath(namePath, packageName, path = "/es") {
12
+ if (!path || path === "/es/core" || path === "/lib/core") {
16
13
  return `${packageName}/es/${namePath}`;
17
14
  }
18
- if (path === "/lib/core") {
19
- return `${packageName}/lib/${namePath}`;
20
- }
21
15
  return `${packageName}${path}/${namePath}`;
22
16
  }
23
17
  const componentDependencyMap = {
@@ -32,31 +26,33 @@ Object.values(componentDependencyMap).forEach((children) => {
32
26
  children.forEach((child) => allNeedResolveComponents.add(child));
33
27
  });
34
28
  function generateComponentResolveConfig(name, options) {
35
- const { path, exclude } = options || {};
29
+ const { path = "/es", exclude = [] } = options || {};
36
30
  const packageName = "yuang-framework-ui-pc";
37
31
  const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
38
32
  const stylePath = getStylePath(namePath, packageName, path);
39
33
  if (!path || path === "/es/core" || path === "/lib/core") {
40
34
  return {
41
35
  name,
42
- from: `${packageName}${path ?? "/es"}`,
36
+ from: `${packageName}${path}`,
37
+ // path已有默认值,无需??兜底
43
38
  sideEffects: getSideEffects(stylePath, options)
44
39
  };
45
40
  } else {
46
41
  return {
42
+ name,
43
+ // 关键修复:补充name字段,符合解析配置规范
47
44
  from: `${packageName}${path}/${namePath}/index`,
48
45
  sideEffects: getSideEffects(stylePath, options)
49
46
  };
50
47
  }
51
48
  }
52
- function EleAdminResolver(options) {
49
+ function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
53
50
  return {
54
51
  type: "component",
55
52
  resolve: (name) => {
56
- var _a;
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);
59
- console.log("按需加载插件:" + name + ",是否匹配:" + isMatch);
53
+ const { exclude = [] } = options;
54
+ const isMatch = /^(Ele|Yu)/.test(name) && !exclude.includes(name) && allNeedResolveComponents.has(name);
55
+ console.log(`按需加载插件: ${name},是否匹配:${isMatch}`);
60
56
  if (isMatch) {
61
57
  const currentConfig = generateComponentResolveConfig(name, options);
62
58
  const dependencyList = componentDependencyMap[name];
@@ -68,6 +64,7 @@ function EleAdminResolver(options) {
68
64
  }
69
65
  return currentConfig;
70
66
  }
67
+ return void 0;
71
68
  }
72
69
  };
73
70
  }
@@ -10,16 +10,10 @@ function getSideEffects(path, options) {
10
10
  }
11
11
  return `${path}/style/index`;
12
12
  }
13
- function getStylePath(namePath, packageName, path) {
14
- if (!path) {
15
- return `${packageName}/es/${namePath}`;
16
- }
17
- if (path === "/es/core") {
13
+ function getStylePath(namePath, packageName, path = "/es") {
14
+ if (!path || path === "/es/core" || path === "/lib/core") {
18
15
  return `${packageName}/es/${namePath}`;
19
16
  }
20
- if (path === "/lib/core") {
21
- return `${packageName}/lib/${namePath}`;
22
- }
23
17
  return `${packageName}${path}/${namePath}`;
24
18
  }
25
19
  const componentDependencyMap = {
@@ -34,31 +28,33 @@ Object.values(componentDependencyMap).forEach((children) => {
34
28
  children.forEach((child) => allNeedResolveComponents.add(child));
35
29
  });
36
30
  function generateComponentResolveConfig(name, options) {
37
- const { path, exclude } = options || {};
31
+ const { path = "/es", exclude = [] } = options || {};
38
32
  const packageName = "yuang-framework-ui-pc";
39
33
  const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
40
34
  const stylePath = getStylePath(namePath, packageName, path);
41
35
  if (!path || path === "/es/core" || path === "/lib/core") {
42
36
  return {
43
37
  name,
44
- from: `${packageName}${path ?? "/es"}`,
38
+ from: `${packageName}${path}`,
39
+ // path已有默认值,无需??兜底
45
40
  sideEffects: getSideEffects(stylePath, options)
46
41
  };
47
42
  } else {
48
43
  return {
44
+ name,
45
+ // 关键修复:补充name字段,符合解析配置规范
49
46
  from: `${packageName}${path}/${namePath}/index`,
50
47
  sideEffects: getSideEffects(stylePath, options)
51
48
  };
52
49
  }
53
50
  }
54
- function EleAdminResolver(options) {
51
+ function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
55
52
  return {
56
53
  type: "component",
57
54
  resolve: (name) => {
58
- var _a;
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);
61
- console.log("按需加载插件:" + name + ",是否匹配:" + isMatch);
55
+ const { exclude = [] } = options;
56
+ const isMatch = /^(Ele|Yu)/.test(name) && !exclude.includes(name) && allNeedResolveComponents.has(name);
57
+ console.log(`按需加载插件: ${name},是否匹配:${isMatch}`);
62
58
  if (isMatch) {
63
59
  const currentConfig = generateComponentResolveConfig(name, options);
64
60
  const dependencyList = componentDependencyMap[name];
@@ -70,6 +66,7 @@ function EleAdminResolver(options) {
70
66
  }
71
67
  return currentConfig;
72
68
  }
69
+ return void 0;
73
70
  }
74
71
  };
75
72
  }
@@ -12,7 +12,7 @@ export interface EleAdminResolverOptions {
12
12
  importStyle?: boolean | 'css' | 'sass';
13
13
  }
14
14
  /**
15
- * 按需加载插件(修复依赖组件解析问题)
15
+ * 按需加载插件(修复依赖组件解析问题 + 路径undefined问题)
16
16
  * @param options 参数
17
17
  */
18
18
  export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-pc",
3
- "version": "1.1.89",
3
+ "version": "1.1.90",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite --host --config vite.global.ts --mode dev",