xto-fronted 0.4.97 → 0.4.98

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xto-fronted",
3
- "version": "0.4.97",
3
+ "version": "0.4.98",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "XTO 前端应用框架",
@@ -9,10 +9,13 @@
9
9
  "types": "dist/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
- "import": "./dist/index.es.js",
13
- "require": "./dist/index.umd.js",
12
+ "import": "./dist/index.js",
14
13
  "types": "./dist/index.d.ts"
15
14
  },
15
+ "./api": {
16
+ "import": "./dist/api/index.js",
17
+ "types": "./dist/api/index.d.ts"
18
+ },
16
19
  "./style.css": "./dist/style.css",
17
20
  "./style.scss": "./src/style.scss"
18
21
  },
@@ -0,0 +1,7 @@
1
+ /**
2
+ * API 统一导出
3
+ */
4
+
5
+ export * from './auth'
6
+ export * from './system'
7
+ export * from './user'
package/vite.config.ts CHANGED
@@ -1,136 +1,139 @@
1
- import { defineConfig, loadEnv } from 'vite'
2
- import vue from '@vitejs/plugin-vue'
3
- import dts from 'vite-plugin-dts'
4
- import { resolve } from 'path'
5
-
6
- export default defineConfig(({ mode }) => {
7
- const env = loadEnv(mode, process.cwd())
8
- const isLib = mode === 'lib'
9
-
10
- return {
11
- plugins: [
12
- vue(),
13
- ...(isLib ? [dts({ insertTypesEntry: true, outDir: 'dist' })] : [])
14
- ],
15
- resolve: {
16
- alias: {
17
- '@': resolve(__dirname, 'src'),
18
- '@xto/base/es/style.css': resolve(__dirname, 'node_modules/@xto/base/es/style.css'),
19
- '@xto/form/es/style.css': resolve(__dirname, 'node_modules/@xto/form/es/style.css'),
20
- '@xto/data/es/style.css': resolve(__dirname, 'node_modules/@xto/data/es/style.css'),
21
- '@xto/feedback/es/style.css': resolve(__dirname, 'node_modules/@xto/feedback/es/style.css'),
22
- '@xto/navigation/es/style.css': resolve(__dirname, 'node_modules/@xto/navigation/es/style.css'),
23
- '@xto/layout/es/style.css': resolve(__dirname, 'node_modules/@xto/layout/es/style.css'),
24
- '@xto/business/es/style.css': resolve(__dirname, 'node_modules/@xto/business/es/style.css'),
25
- }
26
- },
27
- // 开发模式优化
28
- optimizeDeps: {
29
- include: [
30
- 'vue',
31
- 'vue-router',
32
- 'pinia',
33
- 'axios'
34
- ],
35
- exclude: [
36
- '@xto/core',
37
- '@xto/base',
38
- '@xto/form',
39
- '@xto/data',
40
- '@xto/feedback',
41
- '@xto/navigation',
42
- '@xto/layout',
43
- '@xto/business'
44
- ]
45
- },
46
- server: {
47
- host: '0.0.0.0',
48
- port: 3000,
49
- open: true,
50
- proxy: {
51
- '/api': {
52
- target: env.VITE_API_BASE_URL || 'http://localhost:8080',
53
- changeOrigin: true,
54
- rewrite: (path) => path.replace(/^\/api/, '')
55
- }
56
- }
57
- },
58
- build: {
59
- outDir: 'dist',
60
- sourcemap: false,
61
- chunkSizeWarningLimit: 1500,
62
- // 库模式配置
63
- lib: isLib ? {
64
- entry: resolve(__dirname, 'src/index.ts'),
65
- name: 'XtoFronted',
66
- fileName: (format: string) => `index.${format === 'es' ? 'es.js' : 'umd.js'}`,
67
- formats: ['es', 'umd']
68
- } : undefined,
69
- rollupOptions: {
70
- // 库模式下排除外部依赖
71
- external: isLib ? [
72
- 'vue',
73
- 'vue-router',
74
- 'pinia',
75
- 'axios',
76
- /^@xto\//
77
- ] : undefined,
78
- output: isLib ? {
79
- globals: {
80
- vue: 'Vue',
81
- 'vue-router': 'VueRouter',
82
- pinia: 'Pinia',
83
- axios: 'axios'
84
- },
85
- exports: 'named'
86
- } : {
87
- manualChunks(id) {
88
- // Vue 全家桶单独打包
89
- if (id.includes('node_modules/vue/') ||
90
- id.includes('node_modules/@vue/') ||
91
- id.includes('node_modules/vue-router/') ||
92
- id.includes('node_modules/pinia/')) {
93
- return 'vue-vendor'
94
- }
95
- // 组件库按包分割,实现按需加载
96
- if (id.includes('@xto/core')) {
97
- return 'xto-core'
98
- }
99
- if (id.includes('@xto/base')) {
100
- return 'xto-base'
101
- }
102
- if (id.includes('@xto/form')) {
103
- return 'xto-form'
104
- }
105
- if (id.includes('@xto/data')) {
106
- return 'xto-data'
107
- }
108
- if (id.includes('@xto/feedback')) {
109
- return 'xto-feedback'
110
- }
111
- if (id.includes('@xto/navigation')) {
112
- return 'xto-navigation'
113
- }
114
- if (id.includes('@xto/layout')) {
115
- return 'xto-layout'
116
- }
117
- if (id.includes('@xto/business')) {
118
- return 'xto-business'
119
- }
120
- // 其他第三方库
121
- if (id.includes('node_modules/')) {
122
- return 'vendor'
123
- }
124
- }
125
- }
126
- }
127
- },
128
- css: {
129
- preprocessorOptions: {
130
- scss: {
131
- api: 'modern-compiler'
132
- }
133
- }
134
- }
135
- }
136
- })
1
+ import { defineConfig, loadEnv } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import dts from 'vite-plugin-dts'
4
+ import { resolve } from 'path'
5
+
6
+ export default defineConfig(({ mode }) => {
7
+ const env = loadEnv(mode, process.cwd())
8
+ const isLib = mode === 'lib'
9
+
10
+ return {
11
+ plugins: [
12
+ vue(),
13
+ ...(isLib ? [dts({ insertTypesEntry: true, outDir: 'dist' })] : [])
14
+ ],
15
+ resolve: {
16
+ alias: {
17
+ '@': resolve(__dirname, 'src'),
18
+ '@xto/base/es/style.css': resolve(__dirname, 'node_modules/@xto/base/es/style.css'),
19
+ '@xto/form/es/style.css': resolve(__dirname, 'node_modules/@xto/form/es/style.css'),
20
+ '@xto/data/es/style.css': resolve(__dirname, 'node_modules/@xto/data/es/style.css'),
21
+ '@xto/feedback/es/style.css': resolve(__dirname, 'node_modules/@xto/feedback/es/style.css'),
22
+ '@xto/navigation/es/style.css': resolve(__dirname, 'node_modules/@xto/navigation/es/style.css'),
23
+ '@xto/layout/es/style.css': resolve(__dirname, 'node_modules/@xto/layout/es/style.css'),
24
+ '@xto/business/es/style.css': resolve(__dirname, 'node_modules/@xto/business/es/style.css'),
25
+ }
26
+ },
27
+ // 开发模式优化
28
+ optimizeDeps: {
29
+ include: [
30
+ 'vue',
31
+ 'vue-router',
32
+ 'pinia',
33
+ 'axios'
34
+ ],
35
+ exclude: [
36
+ '@xto/core',
37
+ '@xto/base',
38
+ '@xto/form',
39
+ '@xto/data',
40
+ '@xto/feedback',
41
+ '@xto/navigation',
42
+ '@xto/layout',
43
+ '@xto/business'
44
+ ]
45
+ },
46
+ server: {
47
+ host: '0.0.0.0',
48
+ port: 3000,
49
+ open: true,
50
+ proxy: {
51
+ '/api': {
52
+ target: env.VITE_API_BASE_URL || 'http://localhost:8080',
53
+ changeOrigin: true,
54
+ rewrite: (path) => path.replace(/^\/api/, '')
55
+ }
56
+ }
57
+ },
58
+ build: {
59
+ outDir: 'dist',
60
+ sourcemap: false,
61
+ chunkSizeWarningLimit: 1500,
62
+ // 库模式配置 - 多入口构建
63
+ lib: isLib ? {
64
+ entry: {
65
+ index: resolve(__dirname, 'src/index.ts'),
66
+ api: resolve(__dirname, 'src/api/index.ts')
67
+ },
68
+ name: 'XtoFronted',
69
+ formats: ['es']
70
+ } : undefined,
71
+ rollupOptions: {
72
+ // 库模式下排除外部依赖
73
+ external: isLib ? [
74
+ 'vue',
75
+ 'vue-router',
76
+ 'pinia',
77
+ 'axios',
78
+ /^@xto\//
79
+ ] : undefined,
80
+ output: isLib ? {
81
+ exports: 'named',
82
+ // 自定义输出文件名
83
+ entryFileNames: (chunkInfo) => {
84
+ if (chunkInfo.name === 'api') {
85
+ return 'api/index.js'
86
+ }
87
+ return 'index.js'
88
+ }
89
+ } : {
90
+ manualChunks(id) {
91
+ // Vue 全家桶单独打包
92
+ if (id.includes('node_modules/vue/') ||
93
+ id.includes('node_modules/@vue/') ||
94
+ id.includes('node_modules/vue-router/') ||
95
+ id.includes('node_modules/pinia/')) {
96
+ return 'vue-vendor'
97
+ }
98
+ // 组件库按包分割,实现按需加载
99
+ if (id.includes('@xto/core')) {
100
+ return 'xto-core'
101
+ }
102
+ if (id.includes('@xto/base')) {
103
+ return 'xto-base'
104
+ }
105
+ if (id.includes('@xto/form')) {
106
+ return 'xto-form'
107
+ }
108
+ if (id.includes('@xto/data')) {
109
+ return 'xto-data'
110
+ }
111
+ if (id.includes('@xto/feedback')) {
112
+ return 'xto-feedback'
113
+ }
114
+ if (id.includes('@xto/navigation')) {
115
+ return 'xto-navigation'
116
+ }
117
+ if (id.includes('@xto/layout')) {
118
+ return 'xto-layout'
119
+ }
120
+ if (id.includes('@xto/business')) {
121
+ return 'xto-business'
122
+ }
123
+ // 其他第三方库
124
+ if (id.includes('node_modules/')) {
125
+ return 'vendor'
126
+ }
127
+ }
128
+ }
129
+ }
130
+ },
131
+ css: {
132
+ preprocessorOptions: {
133
+ scss: {
134
+ api: 'modern-compiler'
135
+ }
136
+ }
137
+ }
138
+ }
139
+ })