yuang-framework-ui-pc 1.1.92 → 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.
@@ -5,14 +5,13 @@ import { ComponentResolver } from 'unplugin-vue-components/types';
5
5
  */
6
6
  export interface EleAdminResolverOptions {
7
7
  /** 包路径 */
8
- path?: string | '' | '/es' | '/lib' | '/es/core' | '/lib/core';
8
+ path?: string | '/es' | '/lib';
9
9
  /** 排除的组件名称 */
10
10
  exclude?: string[];
11
11
  /** 是否导入样式 */
12
12
  importStyle?: boolean | 'css' | 'sass';
13
13
  }
14
14
  /**
15
- * 按需加载插件(彻底修复undefined路径问题)
16
- * @param options 参数
15
+ * 极简版组件解析器:仅返回单个配置,避免数组兼容性问题
17
16
  */
18
17
  export declare function EleAdminResolver(options?: EleAdminResolverOptions): ComponentResolver;
@@ -1,79 +1,29 @@
1
- function getSideEffects(path, options) {
2
- if (!path) return void 0;
3
- const importStyle = options == null ? void 0 : options.importStyle;
4
- if (!importStyle) {
5
- return void 0;
6
- }
7
- if (importStyle === "css") {
8
- return `${path}/style/css`;
9
- }
10
- return `${path}/style/index`;
11
- }
12
- function getStylePath(namePath, packageName, path = "/es") {
13
- const safePath = path || "/es";
14
- if (["", "/es/core", "/lib/core"].includes(safePath)) {
15
- return `${packageName}/es/${namePath}`;
16
- }
17
- const finalPath = safePath.startsWith("/") ? safePath : `/${safePath}`;
18
- return `${packageName}${finalPath}/${namePath}`;
19
- }
20
- const componentDependencyMap = {
21
- YuFrameworkAttachmentUpload: ["EleUploadList"]
22
- };
23
- const allNeedResolveComponents = /* @__PURE__ */ new Set();
24
- Object.keys(componentDependencyMap).forEach((parent) => allNeedResolveComponents.add(parent));
25
- Object.values(componentDependencyMap).forEach((children) => {
26
- children.forEach((child) => allNeedResolveComponents.add(child));
27
- });
28
- function generateComponentResolveConfig(name, options) {
29
- const { path = "/es", exclude = [] } = options || {};
30
- const packageName = "yuang-framework-ui-pc";
31
- const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").filter(Boolean).join("-").toLowerCase() || name.toLowerCase();
32
- const stylePath = getStylePath(namePath, packageName, path);
33
- let fromPath = "";
34
- if (["", "/es/core", "/lib/core"].includes(path)) {
35
- fromPath = `${packageName}${path || "/es"}`;
36
- } else {
37
- fromPath = `${packageName}${path.startsWith("/") ? path : "/" + path}/${namePath}/index`;
38
- }
39
- fromPath = fromPath.replace("undefined", "").replace(/\/+/g, "/");
40
- if (!fromPath || fromPath === packageName) {
41
- fromPath = `${packageName}/es/${namePath}`;
42
- }
43
- const config = {
44
- name: name || "",
45
- from: fromPath,
46
- sideEffects: getSideEffects(stylePath, options)
47
- };
48
- if (config.from.includes("undefined") || !config.from) {
49
- console.error(`[配置修复] 组件${name}的from路径异常,强制兜底为: ${packageName}/es/${namePath}`);
50
- config.from = `${packageName}/es/${namePath}`;
51
- }
52
- return config;
53
- }
54
1
  function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
2
+ const packageName = "yuang-framework-ui-pc";
3
+ const {
4
+ path = "/es",
5
+ exclude = [],
6
+ importStyle = true
7
+ } = options;
55
8
  return {
56
9
  type: "component",
57
10
  resolve: (name) => {
58
- const { exclude = [] } = options;
59
- const isMatch = /^(Ele|Yu)/.test(name) && !exclude.includes(name) && allNeedResolveComponents.has(name);
60
- console.log(`[匹配校验] 组件名: ${name},是否匹配: ${isMatch}`);
61
- if (isMatch) {
62
- const currentConfig = generateComponentResolveConfig(name, options);
63
- if (currentConfig.from.includes("undefined")) {
64
- console.error(`[当前组件错误] ${name} 的from路径异常: ${currentConfig.from}`);
65
- }
66
- const dependencyList = componentDependencyMap[name];
67
- if (dependencyList && dependencyList.length) {
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;
72
- }
73
- console.log(`[返回配置] 组件${name}的解析配置:`, JSON.stringify(currentConfig));
74
- return currentConfig;
11
+ if (!/^(Ele|Yu)/.test(name) || exclude.includes(name)) {
12
+ console.log(`[解析跳过] 组件${name}:非Ele/Yu开头或在排除列表`);
13
+ return void 0;
75
14
  }
76
- return void 0;
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;
77
27
  }
78
28
  };
79
29
  }
@@ -1,81 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function getSideEffects(path, options) {
4
- if (!path) return void 0;
5
- const importStyle = options == null ? void 0 : options.importStyle;
6
- if (!importStyle) {
7
- return void 0;
8
- }
9
- if (importStyle === "css") {
10
- return `${path}/style/css`;
11
- }
12
- return `${path}/style/index`;
13
- }
14
- function getStylePath(namePath, packageName, path = "/es") {
15
- const safePath = path || "/es";
16
- if (["", "/es/core", "/lib/core"].includes(safePath)) {
17
- return `${packageName}/es/${namePath}`;
18
- }
19
- const finalPath = safePath.startsWith("/") ? safePath : `/${safePath}`;
20
- return `${packageName}${finalPath}/${namePath}`;
21
- }
22
- const componentDependencyMap = {
23
- YuFrameworkAttachmentUpload: ["EleUploadList"]
24
- };
25
- const allNeedResolveComponents = /* @__PURE__ */ new Set();
26
- Object.keys(componentDependencyMap).forEach((parent) => allNeedResolveComponents.add(parent));
27
- Object.values(componentDependencyMap).forEach((children) => {
28
- children.forEach((child) => allNeedResolveComponents.add(child));
29
- });
30
- function generateComponentResolveConfig(name, options) {
31
- const { path = "/es", exclude = [] } = options || {};
32
- const packageName = "yuang-framework-ui-pc";
33
- const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").filter(Boolean).join("-").toLowerCase() || name.toLowerCase();
34
- const stylePath = getStylePath(namePath, packageName, path);
35
- let fromPath = "";
36
- if (["", "/es/core", "/lib/core"].includes(path)) {
37
- fromPath = `${packageName}${path || "/es"}`;
38
- } else {
39
- fromPath = `${packageName}${path.startsWith("/") ? path : "/" + path}/${namePath}/index`;
40
- }
41
- fromPath = fromPath.replace("undefined", "").replace(/\/+/g, "/");
42
- if (!fromPath || fromPath === packageName) {
43
- fromPath = `${packageName}/es/${namePath}`;
44
- }
45
- const config = {
46
- name: name || "",
47
- from: fromPath,
48
- sideEffects: getSideEffects(stylePath, options)
49
- };
50
- if (config.from.includes("undefined") || !config.from) {
51
- console.error(`[配置修复] 组件${name}的from路径异常,强制兜底为: ${packageName}/es/${namePath}`);
52
- config.from = `${packageName}/es/${namePath}`;
53
- }
54
- return config;
55
- }
56
3
  function EleAdminResolver(options = { path: "/es", exclude: [], importStyle: true }) {
4
+ const packageName = "yuang-framework-ui-pc";
5
+ const {
6
+ path = "/es",
7
+ exclude = [],
8
+ importStyle = true
9
+ } = options;
57
10
  return {
58
11
  type: "component",
59
12
  resolve: (name) => {
60
- const { exclude = [] } = options;
61
- const isMatch = /^(Ele|Yu)/.test(name) && !exclude.includes(name) && allNeedResolveComponents.has(name);
62
- console.log(`[匹配校验] 组件名: ${name},是否匹配: ${isMatch}`);
63
- if (isMatch) {
64
- const currentConfig = generateComponentResolveConfig(name, options);
65
- if (currentConfig.from.includes("undefined")) {
66
- console.error(`[当前组件错误] ${name} 的from路径异常: ${currentConfig.from}`);
67
- }
68
- const dependencyList = componentDependencyMap[name];
69
- if (dependencyList && dependencyList.length) {
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;
74
- }
75
- console.log(`[返回配置] 组件${name}的解析配置:`, JSON.stringify(currentConfig));
76
- return currentConfig;
13
+ if (!/^(Ele|Yu)/.test(name) || exclude.includes(name)) {
14
+ console.log(`[解析跳过] 组件${name}:非Ele/Yu开头或在排除列表`);
15
+ return void 0;
77
16
  }
78
- return void 0;
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;
79
29
  }
80
30
  };
81
31
  }
@@ -5,14 +5,13 @@ import { ComponentResolver } from 'unplugin-vue-components/types';
5
5
  */
6
6
  export interface EleAdminResolverOptions {
7
7
  /** 包路径 */
8
- path?: string | '' | '/es' | '/lib' | '/es/core' | '/lib/core';
8
+ path?: string | '/es' | '/lib';
9
9
  /** 排除的组件名称 */
10
10
  exclude?: string[];
11
11
  /** 是否导入样式 */
12
12
  importStyle?: boolean | 'css' | 'sass';
13
13
  }
14
14
  /**
15
- * 按需加载插件(彻底修复undefined路径问题)
16
- * @param options 参数
15
+ * 极简版组件解析器:仅返回单个配置,避免数组兼容性问题
17
16
  */
18
17
  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.92",
3
+ "version": "1.1.94",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite --host --config vite.global.ts --mode dev",