@melt-js/comps-art 2026.11.8 → 2026.11.16

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.
@@ -1 +0,0 @@
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;;;;;;;"}
@@ -1 +0,0 @@
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;;"}
@@ -1,20 +0,0 @@
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)
package/scripts/check.mjs DELETED
@@ -1,18 +0,0 @@
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 })
@@ -1,129 +0,0 @@
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(', '))
package/scripts/meta.mjs DELETED
@@ -1,28 +0,0 @@
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
- }
@@ -1,42 +0,0 @@
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
- }