befly-vite 1.0.2 → 1.0.4

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/index.js CHANGED
@@ -160,15 +160,6 @@ export function createBeflyViteConfig(options = {}) {
160
160
  }
161
161
  },
162
162
 
163
- css: {
164
- preprocessorOptions: {
165
- scss: {
166
- api: 'modern-compiler',
167
- additionalData: `@use "@/styles/variables.scss" as *;`
168
- }
169
- }
170
- },
171
-
172
163
  optimizeDeps: {
173
164
  include: ['vue', 'vue-router', 'pinia', 'axios', 'tdesign-vue-next']
174
165
  }
@@ -180,9 +171,6 @@ export function createBeflyViteConfig(options = {}) {
180
171
  // 导出 UnoCSS 配置创建函数
181
172
  export { createUnoConfig } from './configs/uno.config.js';
182
173
 
183
- // 导出工具函数
184
- export { scanBeflyAddonViews } from './utils/scanBeflyAddonViews.js';
185
-
186
174
  // 导出所有插件创建函数(供高级用户自定义)
187
175
  export { createVuePlugins } from './plugins/vue.js';
188
176
  export { createRouterPlugin } from './plugins/router.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly-vite",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Befly Vite 配置预设和插件集合",
5
5
  "type": "module",
6
6
  "private": false,
@@ -37,6 +37,7 @@
37
37
  "@unocss/preset-uno": "^66.5.6",
38
38
  "@vitejs/plugin-vue": "^6.0.1",
39
39
  "@vue-macros/reactivity-transform": "^3.1.1",
40
+ "befly-util": "0.1.2",
40
41
  "sass": "^1.94.0",
41
42
  "unocss": "^66.5.6",
42
43
  "unplugin-auto-import": "^20.2.0",
@@ -55,5 +56,5 @@
55
56
  "engines": {
56
57
  "bun": ">=1.3.0"
57
58
  },
58
- "gitHead": "784849eea6ddee5491efbad70a9f829a4b6e77f5"
59
+ "gitHead": "e43aefa3abeda7a35669778793d39b23b4180c4e"
59
60
  }
package/plugins/icons.js CHANGED
@@ -8,6 +8,6 @@ export function createIconsPlugin() {
8
8
  compiler: 'vue3',
9
9
  autoInstall: false,
10
10
  defaultClass: 'icon-befly',
11
- defaultStyle: 'margin-right: 8px; vertical-align: middle;'
11
+ defaultStyle: 'vertical-align: middle;'
12
12
  });
13
13
  }
package/plugins/router.js CHANGED
@@ -7,7 +7,7 @@ export function createRouterPlugin(options = {}) {
7
7
  const { scanViews } = options;
8
8
 
9
9
  return VueRouter({
10
- routesFolder: scanViews ? scanViews() : 'src/views',
10
+ routesFolder: scanViews(),
11
11
  dts: './src/types/typed-router.d.ts',
12
12
  extensions: ['.vue'],
13
13
  importMode: 'async',
@@ -1,43 +0,0 @@
1
- import { readdirSync, existsSync } from 'node:fs';
2
- import { join } from 'node:path';
3
-
4
- /**
5
- * 扫描所有 @befly-addon 包的 views 目录
6
- * 用于 unplugin-vue-router 的 routesFolder 配置
7
- * 注意:此函数只能在 vite.config.js 中使用(Node.js 环境),不能在浏览器中使用
8
- * @returns 路由文件夹配置数组
9
- */
10
- export function scanBeflyAddonViews() {
11
- // 使用绝对路径:基于项目根目录(process.cwd())
12
- const projectRoot = process.cwd();
13
- const addonBasePath = join(projectRoot, 'node_modules', '@befly-addon');
14
- const routesFolders = [];
15
-
16
- if (!existsSync(addonBasePath)) {
17
- return routesFolders;
18
- }
19
-
20
- try {
21
- const addonDirs = readdirSync(addonBasePath);
22
-
23
- for (const addonName of addonDirs) {
24
- const addonPath = join(addonBasePath, addonName);
25
-
26
- // 检查是否为目录(包括符号链接)
27
- if (!existsSync(addonPath)) continue;
28
-
29
- const viewsPath = join(addonPath, 'views');
30
-
31
- if (existsSync(viewsPath)) {
32
- routesFolders.push({
33
- src: viewsPath,
34
- path: `addon/${addonName}/`
35
- });
36
- }
37
- }
38
- } catch (error) {
39
- console.error('扫描 @befly-addon 目录失败:', error);
40
- }
41
-
42
- return routesFolders;
43
- }