yuang-framework-ui-pc 1.1.91 → 1.1.92

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.
@@ -19,9 +19,6 @@ function getStylePath(namePath, packageName, path = "/es") {
19
19
  }
20
20
  const componentDependencyMap = {
21
21
  YuFrameworkAttachmentUpload: ["EleUploadList"]
22
- // 可继续添加其他依赖:
23
- // EleTable: ['EleTableColumn'],
24
- // EleForm: ['EleFormItem', 'EleInput']
25
22
  };
26
23
  const allNeedResolveComponents = /* @__PURE__ */ new Set();
27
24
  Object.keys(componentDependencyMap).forEach((parent) => allNeedResolveComponents.add(parent));
@@ -29,10 +26,7 @@ Object.values(componentDependencyMap).forEach((children) => {
29
26
  children.forEach((child) => allNeedResolveComponents.add(child));
30
27
  });
31
28
  function generateComponentResolveConfig(name, options) {
32
- const {
33
- path = "/es",
34
- exclude = []
35
- } = 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(" ").filter(Boolean).join("-").toLowerCase() || name.toLowerCase();
38
32
  const stylePath = getStylePath(namePath, packageName, path);
@@ -42,23 +36,18 @@ function generateComponentResolveConfig(name, options) {
42
36
  } else {
43
37
  fromPath = `${packageName}${path.startsWith("/") ? path : "/" + path}/${namePath}/index`;
44
38
  }
45
- console.log(`[组件解析调试]
46
- 组件名: ${name}
47
- path参数: ${path} (类型: ${typeof path})
48
- namePath: ${namePath}
49
- stylePath: ${stylePath}
50
- fromPath: ${fromPath}
51
- packageName: ${packageName}`);
39
+ fromPath = fromPath.replace("undefined", "").replace(/\/+/g, "/");
40
+ if (!fromPath || fromPath === packageName) {
41
+ fromPath = `${packageName}/es/${namePath}`;
42
+ }
52
43
  const config = {
53
44
  name: name || "",
54
- // 组件名兜底
55
- from: fromPath || `${packageName}/es`,
56
- // from路径终极兜底
45
+ from: fromPath,
57
46
  sideEffects: getSideEffects(stylePath, options)
58
- // 样式路径允许undefined
59
47
  };
60
- if (config.from.includes("undefined")) {
61
- console.error(`[严重错误] from路径包含undefined: ${config.from},组件名: ${name}`);
48
+ if (config.from.includes("undefined") || !config.from) {
49
+ console.error(`[配置修复] 组件${name}的from路径异常,强制兜底为: ${packageName}/es/${namePath}`);
50
+ config.from = `${packageName}/es/${namePath}`;
62
51
  }
63
52
  return config;
64
53
  }
@@ -76,15 +65,12 @@ function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: tru
76
65
  }
77
66
  const dependencyList = componentDependencyMap[name];
78
67
  if (dependencyList && dependencyList.length) {
79
- const dependencyConfigs = dependencyList.map((depName) => {
80
- const depConfig = generateComponentResolveConfig(depName, options);
81
- if (depConfig.from.includes("undefined")) {
82
- console.error(`[依赖组件错误] ${depName} 的from路径异常: ${depConfig.from}`);
83
- }
84
- return depConfig;
85
- });
86
- return [currentConfig, ...dependencyConfigs];
68
+ const dependencyConfigs = dependencyList.map((depName) => generateComponentResolveConfig(depName, options)).filter((config) => !!config && !!config.from);
69
+ const allConfigs = [currentConfig, ...dependencyConfigs].filter(Boolean);
70
+ console.log(`[返回配置] 组件${name}的解析配置:`, JSON.stringify(allConfigs));
71
+ return allConfigs;
87
72
  }
73
+ console.log(`[返回配置] 组件${name}的解析配置:`, JSON.stringify(currentConfig));
88
74
  return currentConfig;
89
75
  }
90
76
  return void 0;
@@ -21,9 +21,6 @@ function getStylePath(namePath, packageName, path = "/es") {
21
21
  }
22
22
  const componentDependencyMap = {
23
23
  YuFrameworkAttachmentUpload: ["EleUploadList"]
24
- // 可继续添加其他依赖:
25
- // EleTable: ['EleTableColumn'],
26
- // EleForm: ['EleFormItem', 'EleInput']
27
24
  };
28
25
  const allNeedResolveComponents = /* @__PURE__ */ new Set();
29
26
  Object.keys(componentDependencyMap).forEach((parent) => allNeedResolveComponents.add(parent));
@@ -31,10 +28,7 @@ Object.values(componentDependencyMap).forEach((children) => {
31
28
  children.forEach((child) => allNeedResolveComponents.add(child));
32
29
  });
33
30
  function generateComponentResolveConfig(name, options) {
34
- const {
35
- path = "/es",
36
- exclude = []
37
- } = 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(" ").filter(Boolean).join("-").toLowerCase() || name.toLowerCase();
40
34
  const stylePath = getStylePath(namePath, packageName, path);
@@ -44,23 +38,18 @@ function generateComponentResolveConfig(name, options) {
44
38
  } else {
45
39
  fromPath = `${packageName}${path.startsWith("/") ? path : "/" + path}/${namePath}/index`;
46
40
  }
47
- console.log(`[组件解析调试]
48
- 组件名: ${name}
49
- path参数: ${path} (类型: ${typeof path})
50
- namePath: ${namePath}
51
- stylePath: ${stylePath}
52
- fromPath: ${fromPath}
53
- packageName: ${packageName}`);
41
+ fromPath = fromPath.replace("undefined", "").replace(/\/+/g, "/");
42
+ if (!fromPath || fromPath === packageName) {
43
+ fromPath = `${packageName}/es/${namePath}`;
44
+ }
54
45
  const config = {
55
46
  name: name || "",
56
- // 组件名兜底
57
- from: fromPath || `${packageName}/es`,
58
- // from路径终极兜底
47
+ from: fromPath,
59
48
  sideEffects: getSideEffects(stylePath, options)
60
- // 样式路径允许undefined
61
49
  };
62
- if (config.from.includes("undefined")) {
63
- console.error(`[严重错误] from路径包含undefined: ${config.from},组件名: ${name}`);
50
+ if (config.from.includes("undefined") || !config.from) {
51
+ console.error(`[配置修复] 组件${name}的from路径异常,强制兜底为: ${packageName}/es/${namePath}`);
52
+ config.from = `${packageName}/es/${namePath}`;
64
53
  }
65
54
  return config;
66
55
  }
@@ -78,15 +67,12 @@ function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: tru
78
67
  }
79
68
  const dependencyList = componentDependencyMap[name];
80
69
  if (dependencyList && dependencyList.length) {
81
- const dependencyConfigs = dependencyList.map((depName) => {
82
- const depConfig = generateComponentResolveConfig(depName, options);
83
- if (depConfig.from.includes("undefined")) {
84
- console.error(`[依赖组件错误] ${depName} 的from路径异常: ${depConfig.from}`);
85
- }
86
- return depConfig;
87
- });
88
- return [currentConfig, ...dependencyConfigs];
70
+ const dependencyConfigs = dependencyList.map((depName) => generateComponentResolveConfig(depName, options)).filter((config) => !!config && !!config.from);
71
+ const allConfigs = [currentConfig, ...dependencyConfigs].filter(Boolean);
72
+ console.log(`[返回配置] 组件${name}的解析配置:`, JSON.stringify(allConfigs));
73
+ return allConfigs;
89
74
  }
75
+ console.log(`[返回配置] 组件${name}的解析配置:`, JSON.stringify(currentConfig));
90
76
  return currentConfig;
91
77
  }
92
78
  return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-pc",
3
- "version": "1.1.91",
3
+ "version": "1.1.92",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite --host --config vite.global.ts --mode dev",