@melt-js/comps-art 0.0.0-stage → 2026.11.8

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.
@@ -0,0 +1,41 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('hel-lib-proxy')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'hel-lib-proxy'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["comps-art"] = {}, global.HelLibProxy));
5
+ })(this, (function (exports, helLibProxy) { 'use strict';
6
+
7
+ /*
8
+ |--------------------------------------------------------------------------
9
+ |
10
+ | 对应 package.json / appGroupName
11
+ |
12
+ |--------------------------------------------------------------------------
13
+ */
14
+
15
+ const LIB_NAME = 'comps-art';
16
+
17
+ /*
18
+ |--------------------------------------------------------------------------
19
+ |
20
+ | 组件导出入口,同时也作为 rollup 的打包入口文件。
21
+ | 这里只调用 exposeLib 生成空壳代理,rollup 打包后是一个仅包含 hel-lib-proxy 的代理文件,
22
+ | 对模块使用方的包体构建大小无影响。
23
+ |
24
+ | 模块使用方:通过 npm i 本包后,只要在头文件处执行过 preFetchLib,
25
+ | 则整个项目像使用本地模块一样载入提供方的组件,并且可以点击到 node_modules 查看源码。
26
+ |
27
+ |--------------------------------------------------------------------------
28
+ */
29
+
30
+ /**
31
+ * 将提供给用户的 lib 暴露出去
32
+ */
33
+ const dtlib = helLibProxy.exposeLib(LIB_NAME);
34
+
35
+ exports.default = dtlib;
36
+ exports.dtlib = dtlib;
37
+
38
+ Object.defineProperty(exports, '__esModule', { value: true });
39
+
40
+ }));
41
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1,116 @@
1
+ {
2
+ "app": {
3
+ "name": "comps-art",
4
+ "app_group_name": "comps-art",
5
+ "git_repo_url": "",
6
+ "online_version": "2026.11.8",
7
+ "build_version": "2026.11.8",
8
+ "platform": "unpkg",
9
+ "create_at": "2026-11-08T03:10:49.526Z"
10
+ },
11
+ "version": {
12
+ "plugin_ver": "5.4.3",
13
+ "extract_mode": "build",
14
+ "sub_app_name": "comps-art",
15
+ "sub_app_version": "comps-art@2026.11.8",
16
+ "version_tag": "2026.11.8",
17
+ "src_map": {
18
+ "webDirPath": "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist",
19
+ "htmlIndexSrc": "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/index.html",
20
+ "extractMode": "all",
21
+ "iframeSrc": "",
22
+ "chunkCssSrcList": [
23
+ "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/style-D3nkBDaE.css",
24
+ "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/\\assets\\style-D3nkBDaE.css"
25
+ ],
26
+ "chunkJsSrcList": [
27
+ "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/index-B72ebjhv.js",
28
+ "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/\\assets\\index-B72ebjhv.js"
29
+ ],
30
+ "staticCssSrcList": [
31
+ "https://unpkg.com/element-plus@2.14.7/dist/index.css"
32
+ ],
33
+ "staticJsSrcList": [
34
+ "https://unpkg.com/vue@3.5.45/dist/vue.global.prod.js",
35
+ "https://unpkg.com/element-plus@2.14.7/dist/index.full.min.js",
36
+ "https://unpkg.com/vue-router@4.6.4/dist/vue-router.global.prod.js",
37
+ "https://unpkg.com/pinia@3.0.4/dist/pinia.iife.prod.js",
38
+ "https://unpkg.com/vue-i18n@10.0.8/dist/vue-i18n.global.prod.js"
39
+ ],
40
+ "relativeCssSrcList": [],
41
+ "relativeJsSrcList": [],
42
+ "headAssetList": [
43
+ {
44
+ "tag": "staticScript",
45
+ "append": false,
46
+ "attrs": {
47
+ "src": "https://unpkg.com/vue@3.5.45/dist/vue.global.prod.js"
48
+ }
49
+ },
50
+ {
51
+ "tag": "staticScript",
52
+ "append": false,
53
+ "attrs": {
54
+ "src": "https://unpkg.com/element-plus@2.14.7/dist/index.full.min.js"
55
+ }
56
+ },
57
+ {
58
+ "tag": "staticScript",
59
+ "append": false,
60
+ "attrs": {
61
+ "src": "https://unpkg.com/vue-router@4.6.4/dist/vue-router.global.prod.js"
62
+ }
63
+ },
64
+ {
65
+ "tag": "staticScript",
66
+ "append": false,
67
+ "attrs": {
68
+ "src": "https://unpkg.com/pinia@3.0.4/dist/pinia.iife.prod.js"
69
+ }
70
+ },
71
+ {
72
+ "tag": "staticScript",
73
+ "append": false,
74
+ "attrs": {
75
+ "src": "https://unpkg.com/vue-i18n@10.0.8/dist/vue-i18n.global.prod.js"
76
+ }
77
+ },
78
+ {
79
+ "tag": "staticLink",
80
+ "append": false,
81
+ "attrs": {
82
+ "href": "https://unpkg.com/element-plus@2.14.7/dist/index.css",
83
+ "rel": "stylesheet"
84
+ }
85
+ },
86
+ {
87
+ "tag": "script",
88
+ "append": true,
89
+ "attrs": {
90
+ "src": "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/index-B72ebjhv.js",
91
+ "type": "module",
92
+ "crossorigin": ""
93
+ }
94
+ },
95
+ {
96
+ "tag": "link",
97
+ "append": true,
98
+ "attrs": {
99
+ "href": "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/style-D3nkBDaE.css",
100
+ "rel": "stylesheet",
101
+ "crossorigin": ""
102
+ }
103
+ }
104
+ ],
105
+ "bodyAssetList": [],
106
+ "otherSrcList": [
107
+ "https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/\\index.html"
108
+ ],
109
+ "srvModSrcList": [],
110
+ "srvModSrcIndex": ""
111
+ },
112
+ "html_content": "<!doctype html>\n<!-- hel-standalone:给 src/style.css 里的调试页样式做作用域,避免 hel_dist 把页面级样式注入宿主 -->\n<html lang=\"en\" class=\"hel-standalone\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>comps-art</title>\n <!--\n vue / element-plus / vue-router / pinia / vue-i18n 都被 external 成 window.*,\n 独立访问本页时由这里的 CDN 提供运行时;\n data-helappend=\"0\":宿主通过 hel 解析本页时跳过这些脚本,\n 使用宿主自己在入口注入的那一份,避免双实例(双 vue / 双 router / 双 i18n)。\n -->\n <script data-helappend=\"0\" src=\"https://unpkg.com/vue@3.5.45/dist/vue.global.prod.js\"></script>\n <script\n data-helappend=\"0\"\n src=\"https://unpkg.com/element-plus@2.14.7/dist/index.full.min.js\"\n ></script>\n <script\n data-helappend=\"0\"\n src=\"https://unpkg.com/vue-router@4.6.4/dist/vue-router.global.prod.js\"\n ></script>\n <script data-helappend=\"0\" src=\"https://unpkg.com/pinia@3.0.4/dist/pinia.iife.prod.js\"></script>\n <script\n data-helappend=\"0\"\n src=\"https://unpkg.com/vue-i18n@10.0.8/dist/vue-i18n.global.prod.js\"\n ></script>\n <link\n data-helappend=\"0\"\n rel=\"stylesheet\"\n href=\"https://unpkg.com/element-plus@2.14.7/dist/index.css\"\n />\n <script type=\"module\" crossorigin src=\"https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/index-B72ebjhv.js\"></script>\n <link rel=\"stylesheet\" crossorigin href=\"https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/style-D3nkBDaE.css\">\n </head>\n <body>\n <div id=\"app\"></div>\n </body>\n</html>\n",
113
+ "create_at": "2026-11-08T03:10:49.526Z",
114
+ "desc": "this version meta is created by hel-dev-utils@5.4.3"
115
+ }
116
+ }
@@ -0,0 +1,39 @@
1
+ <!doctype html>
2
+ <!-- hel-standalone:给 src/style.css 里的调试页样式做作用域,避免 hel_dist 把页面级样式注入宿主 -->
3
+ <html lang="en" class="hel-standalone">
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>comps-art</title>
8
+ <!--
9
+ vue / element-plus / vue-router / pinia / vue-i18n 都被 external 成 window.*,
10
+ 独立访问本页时由这里的 CDN 提供运行时;
11
+ data-helappend="0":宿主通过 hel 解析本页时跳过这些脚本,
12
+ 使用宿主自己在入口注入的那一份,避免双实例(双 vue / 双 router / 双 i18n)。
13
+ -->
14
+ <script data-helappend="0" src="https://unpkg.com/vue@3.5.45/dist/vue.global.prod.js"></script>
15
+ <script
16
+ data-helappend="0"
17
+ src="https://unpkg.com/element-plus@2.14.7/dist/index.full.min.js"
18
+ ></script>
19
+ <script
20
+ data-helappend="0"
21
+ src="https://unpkg.com/vue-router@4.6.4/dist/vue-router.global.prod.js"
22
+ ></script>
23
+ <script data-helappend="0" src="https://unpkg.com/pinia@3.0.4/dist/pinia.iife.prod.js"></script>
24
+ <script
25
+ data-helappend="0"
26
+ src="https://unpkg.com/vue-i18n@10.0.8/dist/vue-i18n.global.prod.js"
27
+ ></script>
28
+ <link
29
+ data-helappend="0"
30
+ rel="stylesheet"
31
+ href="https://unpkg.com/element-plus@2.14.7/dist/index.css"
32
+ />
33
+ <script type="module" crossorigin src="https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/index-B72ebjhv.js"></script>
34
+ <link rel="stylesheet" crossorigin href="https://unpkg.com/@melt-js/comps-art@2026.11.8/hel_dist/assets/style-D3nkBDaE.css">
35
+ </head>
36
+ <body>
37
+ <div id="app"></div>
38
+ </body>
39
+ </html>
@@ -0,0 +1,41 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('hel-lib-proxy')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'hel-lib-proxy'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["comps-art"] = {}, global.HelLibProxy));
5
+ })(this, (function (exports, helLibProxy) { 'use strict';
6
+
7
+ /*
8
+ |--------------------------------------------------------------------------
9
+ |
10
+ | 对应 package.json / appGroupName
11
+ |
12
+ |--------------------------------------------------------------------------
13
+ */
14
+
15
+ const LIB_NAME = 'comps-art';
16
+
17
+ /*
18
+ |--------------------------------------------------------------------------
19
+ |
20
+ | 组件导出入口,同时也作为 rollup 的打包入口文件。
21
+ | 这里只调用 exposeLib 生成空壳代理,rollup 打包后是一个仅包含 hel-lib-proxy 的代理文件,
22
+ | 对模块使用方的包体构建大小无影响。
23
+ |
24
+ | 模块使用方:通过 npm i 本包后,只要在头文件处执行过 preFetchLib,
25
+ | 则整个项目像使用本地模块一样载入提供方的组件,并且可以点击到 node_modules 查看源码。
26
+ |
27
+ |--------------------------------------------------------------------------
28
+ */
29
+
30
+ /**
31
+ * 将提供给用户的 lib 暴露出去
32
+ */
33
+ const dtlib = helLibProxy.exposeLib(LIB_NAME);
34
+
35
+ exports.default = dtlib;
36
+ exports.dtlib = dtlib;
37
+
38
+ Object.defineProperty(exports, '__esModule', { value: true });
39
+
40
+ }));
41
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sources":["../src/configs/subApp.js","../src/entrance/libTypes.js"],"sourcesContent":["/*\n|--------------------------------------------------------------------------\n|\n| 对应 package.json / appGroupName\n|\n|--------------------------------------------------------------------------\n*/\n\nexport const LIB_NAME = 'comps-art'\n","/*\n|--------------------------------------------------------------------------\n|\n| 组件导出入口,同时也作为 rollup 的打包入口文件。\n| 这里只调用 exposeLib 生成空壳代理,rollup 打包后是一个仅包含 hel-lib-proxy 的代理文件,\n| 对模块使用方的包体构建大小无影响。\n|\n| 模块使用方:通过 npm i 本包后,只要在头文件处执行过 preFetchLib,\n| 则整个项目像使用本地模块一样载入提供方的组件,并且可以点击到 node_modules 查看源码。\n|\n|--------------------------------------------------------------------------\n*/\nimport { exposeLib } from 'hel-lib-proxy'\nimport { LIB_NAME } from '../configs/subApp'\n\n/**\n * 将提供给用户的 lib 暴露出去\n */\nexport const dtlib = exposeLib(LIB_NAME)\n\nexport default dtlib\n"],"names":["exposeLib"],"mappings":";;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;;CAEO,MAAM,QAAQ,GAAG;;CCRxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;CAIA;CACA;CACA;AACY,OAAC,KAAK,GAAGA,qBAAS,CAAC,QAAQ;;;;;;;"}
@@ -0,0 +1,32 @@
1
+ import { exposeLib } from 'hel-lib-proxy';
2
+
3
+ /*
4
+ |--------------------------------------------------------------------------
5
+ |
6
+ | 对应 package.json / appGroupName
7
+ |
8
+ |--------------------------------------------------------------------------
9
+ */
10
+
11
+ const LIB_NAME = 'comps-art';
12
+
13
+ /*
14
+ |--------------------------------------------------------------------------
15
+ |
16
+ | 组件导出入口,同时也作为 rollup 的打包入口文件。
17
+ | 这里只调用 exposeLib 生成空壳代理,rollup 打包后是一个仅包含 hel-lib-proxy 的代理文件,
18
+ | 对模块使用方的包体构建大小无影响。
19
+ |
20
+ | 模块使用方:通过 npm i 本包后,只要在头文件处执行过 preFetchLib,
21
+ | 则整个项目像使用本地模块一样载入提供方的组件,并且可以点击到 node_modules 查看源码。
22
+ |
23
+ |--------------------------------------------------------------------------
24
+ */
25
+
26
+ /**
27
+ * 将提供给用户的 lib 暴露出去
28
+ */
29
+ const dtlib = exposeLib(LIB_NAME);
30
+
31
+ export { dtlib as default, dtlib };
32
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sources":["../src/configs/subApp.js","../src/entrance/libTypes.js"],"sourcesContent":["/*\n|--------------------------------------------------------------------------\n|\n| 对应 package.json / appGroupName\n|\n|--------------------------------------------------------------------------\n*/\n\nexport const LIB_NAME = 'comps-art'\n","/*\n|--------------------------------------------------------------------------\n|\n| 组件导出入口,同时也作为 rollup 的打包入口文件。\n| 这里只调用 exposeLib 生成空壳代理,rollup 打包后是一个仅包含 hel-lib-proxy 的代理文件,\n| 对模块使用方的包体构建大小无影响。\n|\n| 模块使用方:通过 npm i 本包后,只要在头文件处执行过 preFetchLib,\n| 则整个项目像使用本地模块一样载入提供方的组件,并且可以点击到 node_modules 查看源码。\n|\n|--------------------------------------------------------------------------\n*/\nimport { exposeLib } from 'hel-lib-proxy'\nimport { LIB_NAME } from '../configs/subApp'\n\n/**\n * 将提供给用户的 lib 暴露出去\n */\nexport const dtlib = exposeLib(LIB_NAME)\n\nexport default dtlib\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAM,QAAQ,GAAG;;ACRxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACY,MAAC,KAAK,GAAG,SAAS,CAAC,QAAQ;;"}
package/package.json CHANGED
@@ -1,6 +1,103 @@
1
1
  {
2
2
  "name": "@melt-js/comps-art",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "appGroupName": "comps-art",
4
+ "version": "2026.11.8",
5
+ "type": "module",
6
+ "main": "hel_proxy/entry.js",
7
+ "module": "hel_proxy_es/entry.js",
8
+ "unpkg": "hel_dist/index.html",
9
+ "description": "从 art-design-pro 抽出的 Vue 3 + Element Plus 公共组件远程包(Art 系列表格 / 表单 / 图表 / 卡片 / 布局部件),通过 hel-micro 以远程组件方式被 tpl-vue3-admin-ele-art 引用",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "art-design-pro",
13
+ "element-plus",
14
+ "tailwindcss",
15
+ "hel-micro",
16
+ "vue3",
17
+ "vite"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "registry": "https://registry.npmjs.org",
22
+ "tag": "latest"
23
+ },
24
+ "files": [
25
+ "hel_dist",
26
+ "hel_proxy",
27
+ "hel_proxy_es",
28
+ "scripts",
29
+ "README.md"
30
+ ],
31
+ "scripts": {
32
+ "dev": "vite",
33
+ "build": "pnpm run check_name && pnpm run build_dist && pnpm run build_meta && pnpm run build_proxy",
34
+ "build:local": "cross-env HEL_APP_HOME_PAGE=http://localhost:20080 pnpm run build",
35
+ "build_dist": "vite build",
36
+ "build_meta": "node scripts/meta.mjs",
37
+ "build_proxy": "pnpm run build_proxy_umd && pnpm run build_proxy_es && shx cp ./hel_proxy/entry.js ./hel_dist",
38
+ "build_proxy_umd": "rollup -c",
39
+ "build_proxy_es": "cross-env BUILD_ENV=es rollup -c",
40
+ "check_name": "node scripts/check.mjs",
41
+ "check:tdz": "node scripts/check-tdz.mjs",
42
+ "preview": "vite preview",
43
+ "prepublishOnly": "node scripts/prepublishOnly.mjs",
44
+ "publish:stage": "pnpm run build && npx -y npm@11 stage publish"
45
+ },
46
+ "dependencies": {
47
+ "@element-plus/icons-vue": "2.3.2",
48
+ "@iconify/vue": "4.2.0",
49
+ "@vueuse/core": "11.3.0",
50
+ "@wangeditor/editor": "5.1.23",
51
+ "@wangeditor/editor-for-vue": "next",
52
+ "crypto-js": "4.2.0",
53
+ "file-saver": "2.0.5",
54
+ "hel-iso": "4.4.0",
55
+ "hel-lib-proxy": "4.12.3",
56
+ "mitt": "3.0.1",
57
+ "vue-draggable-plus": "0.6.0",
58
+ "vue-img-cutter": "3.0.5",
59
+ "xgplayer": "3.0.20",
60
+ "xlsx": "0.18.5"
61
+ },
62
+ "peerDependencies": {
63
+ "element-plus": ">=2.11.0",
64
+ "pinia": ">=3.0.0",
65
+ "vue": ">=3.5.0",
66
+ "vue-i18n": ">=9.14.0",
67
+ "vue-router": ">=4.5.0"
68
+ },
69
+ "devDependencies": {
70
+ "@tailwindcss/vite": "4.3.4",
71
+ "@vitejs/plugin-vue": "5.2.4",
72
+ "@vue/compiler-sfc": "3.5.45",
73
+ "cross-env": "7.0.3",
74
+ "echarts": "6.0.0",
75
+ "element-plus": "2.14.7",
76
+ "hel-dev-utils": "5.4.3",
77
+ "javascript-obfuscator": "4.2.2",
78
+ "pinia": "3.0.4",
79
+ "rollup": "4.67.5",
80
+ "sass": "1.107.1",
81
+ "shx": "0.4.0",
82
+ "tailwindcss": "4.3.4",
83
+ "terser": "5.51.2",
84
+ "typescript": "5.9.3",
85
+ "unplugin-auto-import": "20.2.0",
86
+ "unplugin-vue-components": "29.1.0",
87
+ "vite": "6.4.5",
88
+ "vite-plugin-externals": "0.6.2",
89
+ "vite-plugin-bundle-obfuscator": "1.10.0",
90
+ "vue": "3.5.45",
91
+ "vue-i18n": "10.0.8",
92
+ "vue-router": "4.6.4"
93
+ },
94
+ "engines": {
95
+ "node": ">=20.19.0"
96
+ },
97
+ "browserslist": [
98
+ "defaults",
99
+ "not dead",
100
+ "not IE 11",
101
+ "chrome 72"
102
+ ]
103
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ |
4
+ | 构建产物守卫:禁止产物里出现「先引用、后声明」的 let / const / class(TDZ)。
5
+ | 这类代码浏览器加载即抛 `Cannot access xxx before initialization`,
6
+ | 且混淆后变量名是 `_0x...`,很难看出真因。
7
+ |
8
+ | 真正的实现在仓库根 scripts/check-tdz.mjs(多个 comps 包共用一份);
9
+ | 本文件只负责定位它;独立安装本包(脱离 monorepo)时找不到就跳过,不影响构建。
10
+ |
11
+ |--------------------------------------------------------------------------
12
+ */
13
+ import fs from 'node:fs'
14
+
15
+ const shared = new URL('../../scripts/check-tdz.mjs', import.meta.url)
16
+ if (!fs.existsSync(shared)) {
17
+ console.warn('[check-tdz] 未找到仓库根 scripts/check-tdz.mjs,跳过产物检查')
18
+ process.exit(0)
19
+ }
20
+ await import(shared.href)
@@ -0,0 +1,18 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ |
4
+ | 此脚本在流水线上会被触达,用于校验组名是否和应用里的组名保持一致
5
+ |
6
+ |--------------------------------------------------------------------------
7
+ */
8
+ import path from 'node:path'
9
+ import { fileURLToPath } from 'node:url'
10
+ import { createRequire } from 'node:module'
11
+ import helDevUtils from 'hel-dev-utils'
12
+
13
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
14
+ const require = createRequire(import.meta.url)
15
+ const pkg = require('../package.json')
16
+
17
+ const fileFullPath = path.join(__dirname, '../src/configs/subApp')
18
+ helDevUtils.check(pkg, { fileFullPath, checkEnv: false })
@@ -0,0 +1,129 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ |
4
+ | 生成 src/components/index.ts(对外导出清单)
5
+ |
6
+ | art-design-pro 的组件目录是 `components/core/<分类>/art-xxx/index.vue`,
7
+ | 通过 unplugin-vue-components 按目录名自动注册成 <ArtXxx />。
8
+ | 抽成远程包后,需要一份显式导出清单:
9
+ | - hel 的 libProperties 用它组装对外 lib
10
+ | - 宿主用它做全局注册(lib.components 里的每个组件)
11
+ |
12
+ | 规则:
13
+ | - 所有 `index.vue` → 目录名转 PascalCase(art-table → ArtTable)
14
+ | - `core/views/*` 下的独立组件(ArtException / ArtResultPage / LoginLeftView / AuthTopBar)
15
+ | - 其余 widget(ArtUserMenu / SectionTitle ...)是父组件内部实现,不对外导出
16
+ |
17
+ |--------------------------------------------------------------------------
18
+ */
19
+ import fs from 'node:fs'
20
+ import path from 'node:path'
21
+ import { fileURLToPath } from 'node:url'
22
+
23
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
24
+ const componentsRoot = path.join(root, 'src/components')
25
+
26
+ const toPascal = (value) =>
27
+ value
28
+ .split(/[^a-zA-Z0-9]+/)
29
+ .filter(Boolean)
30
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
31
+ .join('')
32
+
33
+ /** 递归收集 index.vue */
34
+ function collectIndexVue(dir, result = []) {
35
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
36
+ const full = path.join(dir, entry.name)
37
+ if (entry.isDirectory()) {
38
+ collectIndexVue(full, result)
39
+ } else if (entry.name === 'index.vue') {
40
+ result.push(full)
41
+ }
42
+ }
43
+ return result
44
+ }
45
+
46
+ /** 对外导出的独立组件(父组件之外也会被宿主视图直接使用) */
47
+ const STANDALONE = [
48
+ 'core/views/exception/ArtException.vue',
49
+ 'core/views/result/ArtResultPage.vue',
50
+ 'core/views/login/LoginLeftView.vue',
51
+ 'core/views/login/AuthTopBar.vue'
52
+ ]
53
+
54
+ const entries = []
55
+
56
+ for (const file of collectIndexVue(componentsRoot)) {
57
+ const dir = path.dirname(file)
58
+ const name = toPascal(path.basename(dir))
59
+ entries.push({ name, file })
60
+ }
61
+
62
+ for (const relative of STANDALONE) {
63
+ const file = path.join(componentsRoot, relative)
64
+ if (!fs.existsSync(file)) {
65
+ throw new Error(`缺少独立组件:${relative}`)
66
+ }
67
+ entries.push({ name: path.basename(file, '.vue'), file })
68
+ }
69
+
70
+ // 按名字排序,保证产物稳定(避免每次生成 diff 抖动)
71
+ entries.sort((a, b) => a.name.localeCompare(b.name))
72
+
73
+ const duplicates = entries.filter(
74
+ (entry, index) => entries.findIndex((item) => item.name === entry.name) !== index
75
+ )
76
+ if (duplicates.length) {
77
+ throw new Error(`组件重名:${duplicates.map((item) => item.name).join(', ')}`)
78
+ }
79
+
80
+ const toImportPath = (file) =>
81
+ './' + path.relative(componentsRoot, file).split(path.sep).join('/')
82
+
83
+ const lines = []
84
+ lines.push('/*')
85
+ lines.push('|--------------------------------------------------------------------------')
86
+ lines.push('|')
87
+ lines.push('| 对外导出的组件清单(由 scripts/gen-components-index.mjs 生成,请勿手改)')
88
+ lines.push('|')
89
+ lines.push('| - `components` 用于宿主全局注册与文档枚举')
90
+ lines.push('| - 具名导出方便宿主按需 app.component(name, lib.ArtTable)')
91
+ lines.push('|')
92
+ lines.push('|--------------------------------------------------------------------------')
93
+ lines.push('*/')
94
+
95
+ for (const entry of entries) {
96
+ lines.push(`import ${entry.name} from '${toImportPath(entry.file)}'`)
97
+ }
98
+
99
+ lines.push('')
100
+ lines.push('export {')
101
+ for (const entry of entries) {
102
+ lines.push(` ${entry.name},`)
103
+ }
104
+ lines.push('}')
105
+ lines.push('')
106
+ lines.push('export const components = {')
107
+ for (const entry of entries) {
108
+ lines.push(` ${entry.name},`)
109
+ }
110
+ lines.push('}')
111
+ lines.push('')
112
+ lines.push('export default components')
113
+ lines.push('')
114
+
115
+ fs.writeFileSync(path.join(componentsRoot, 'index.ts'), lines.join('\n'), 'utf8')
116
+
117
+ // 给宿主工程生成 GlobalComponents 类型声明用的清单
118
+ fs.writeFileSync(
119
+ path.join(root, 'src/components/component-names.json'),
120
+ JSON.stringify(
121
+ entries.map((entry) => entry.name),
122
+ null,
123
+ 2
124
+ ) + '\n',
125
+ 'utf8'
126
+ )
127
+
128
+ console.log(`[comps-art] 已生成 ${entries.length} 个组件导出:`)
129
+ console.log(entries.map((entry) => entry.name).join(', '))
@@ -0,0 +1,28 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ |
4
+ | 生成 hel-meta.json(写入 hel_dist)
5
+ |
6
+ |--------------------------------------------------------------------------
7
+ */
8
+ import path from 'node:path'
9
+ import { fileURLToPath } from 'node:url'
10
+ import { createRequire } from 'node:module'
11
+ import helDevUtils from 'hel-dev-utils'
12
+ import appInfo from '../appInfo.mjs'
13
+
14
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
15
+ const require = createRequire(import.meta.url)
16
+ const pkg = require('../package.json')
17
+
18
+ try {
19
+ await helDevUtils.extractHelMetaJson({
20
+ appInfo,
21
+ buildDirFullPath: path.join(__dirname, '../hel_dist'),
22
+ packageJson: pkg
23
+ })
24
+ console.log('[comps-art] hel-meta.json 生成完成')
25
+ } catch (err) {
26
+ console.error('[comps-art] hel-meta.json 生成失败:', err)
27
+ process.exit(-1)
28
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ |
4
+ | npm publish 前检查:
5
+ | 1 根目录 package.json 的版本号是否和 hel_dist/hel-meta.json 一致
6
+ | 2 hel_dist 是否为发布用构建(资源地址不能是 localhost / 127.0.0.1)
7
+ |
8
+ |--------------------------------------------------------------------------
9
+ */
10
+ import fs from 'node:fs'
11
+ import path from 'node:path'
12
+ import { fileURLToPath } from 'node:url'
13
+ import { createRequire } from 'node:module'
14
+
15
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
16
+ const require = createRequire(import.meta.url)
17
+ const pkg = require('../package.json')
18
+ const helDistPath = path.resolve(__dirname, '../hel_dist/hel-meta.json')
19
+
20
+ // 检查是否执行过 build 打包命令
21
+ if (!fs.existsSync(helDistPath)) {
22
+ console.log("\x1b[31mRun the 'pnpm run build' command first.\n\x1b[0m")
23
+ process.exit(1)
24
+ }
25
+
26
+ const { app, version } = JSON.parse(fs.readFileSync(helDistPath, 'utf-8'))
27
+ // 检查根目录 package.json 的版本号是否和 hel_dist/hel-meta.json 一致
28
+ if (app?.build_version !== pkg.version) {
29
+ console.log(
30
+ '\x1b[31mThe package.json version number and the hel_dist/hel-meta.json version number must be the same.\n\x1b[0m'
31
+ )
32
+ process.exit(1)
33
+ }
34
+
35
+ // 检查产物里的资源地址是否仍是本地联调地址(build:local 的产物不可发布)
36
+ const webDirPath = version?.src_map?.webDirPath || ''
37
+ if (/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?(\/|$)/.test(webDirPath)) {
38
+ console.log(
39
+ `\x1b[31mhel_dist 里的资源地址是本地联调地址(${webDirPath}),请先执行 pnpm run build 生成指向 unpkg 的发布产物。\n\x1b[0m`
40
+ )
41
+ process.exit(1)
42
+ }