mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	build(projects): add vite plugin @soybeanjs/router-page
This commit is contained in:
		@@ -1,2 +1,3 @@
 | 
			
		||||
!.env-config.ts
 | 
			
		||||
components.d.ts
 | 
			
		||||
router-page.d.ts
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -30,5 +30,6 @@ stats.html
 | 
			
		||||
*.sw?
 | 
			
		||||
 | 
			
		||||
/src/typings/components.d.ts
 | 
			
		||||
/src/typings/router-page.d.ts
 | 
			
		||||
package-lock.json
 | 
			
		||||
yarn.lock
 | 
			
		||||
 
 | 
			
		||||
@@ -9,13 +9,24 @@ import unplugin from './unplugin';
 | 
			
		||||
import mock from './mock';
 | 
			
		||||
import visualizer from './visualizer';
 | 
			
		||||
import compress from './compress';
 | 
			
		||||
import soybeanjs from './soybeanjs';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * vite插件
 | 
			
		||||
 * @param viteEnv - 环境变量配置
 | 
			
		||||
 */
 | 
			
		||||
export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | PluginOption[])[] {
 | 
			
		||||
  const plugins = [vue(), vueJsx(), VitePWA(), html(viteEnv), ...unplugin(viteEnv), unocss(), mock, progress()];
 | 
			
		||||
  const plugins = [
 | 
			
		||||
    vue(),
 | 
			
		||||
    vueJsx(),
 | 
			
		||||
    VitePWA(),
 | 
			
		||||
    html(viteEnv),
 | 
			
		||||
    ...unplugin(viteEnv),
 | 
			
		||||
    unocss(),
 | 
			
		||||
    mock,
 | 
			
		||||
    progress(),
 | 
			
		||||
    soybeanjs()
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  if (viteEnv.VITE_VISUALIZER === 'Y') {
 | 
			
		||||
    plugins.push(visualizer as PluginOption);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								build/plugins/soybeanjs.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								build/plugins/soybeanjs.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
import routerPage from '@soybeanjs/router-page';
 | 
			
		||||
 | 
			
		||||
export default function createSoybeanjsPlugin() {
 | 
			
		||||
  return routerPage({
 | 
			
		||||
    pagesFormatter: names => {
 | 
			
		||||
      /** 系统的内置路由,该文件夹名称不作为RouteKey */
 | 
			
		||||
      const SYSTEM_VIEW = 'system-view';
 | 
			
		||||
 | 
			
		||||
      const result = names
 | 
			
		||||
        .filter(name => name !== SYSTEM_VIEW)
 | 
			
		||||
        .map(name => {
 | 
			
		||||
          return name.replace(`${SYSTEM_VIEW}_`, '');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
      return result;
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
@@ -86,6 +86,7 @@
 | 
			
		||||
    "@iconify/json": "^2.1.133",
 | 
			
		||||
    "@iconify/vue": "^4.0.0",
 | 
			
		||||
    "@soybeanjs/cli": "^0.1.2",
 | 
			
		||||
    "@soybeanjs/router-page": "0.2.0",
 | 
			
		||||
    "@tauri-apps/cli": "^1.1.1",
 | 
			
		||||
    "@types/bmapgl": "^0.0.5",
 | 
			
		||||
    "@types/crypto-js": "^4.1.1",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							@@ -13,6 +13,7 @@ specifiers:
 | 
			
		||||
  '@iconify/json': ^2.1.133
 | 
			
		||||
  '@iconify/vue': ^4.0.0
 | 
			
		||||
  '@soybeanjs/cli': ^0.1.2
 | 
			
		||||
  '@soybeanjs/router-page': 0.2.0
 | 
			
		||||
  '@soybeanjs/vue-admin-layout': ^1.1.1
 | 
			
		||||
  '@soybeanjs/vue-admin-tab': ^1.0.5
 | 
			
		||||
  '@tauri-apps/cli': ^1.1.1
 | 
			
		||||
@@ -107,6 +108,7 @@ devDependencies:
 | 
			
		||||
  '@iconify/json': 2.1.133
 | 
			
		||||
  '@iconify/vue': 4.0.0_vue@3.2.41
 | 
			
		||||
  '@soybeanjs/cli': 0.1.2
 | 
			
		||||
  '@soybeanjs/router-page': 0.2.0
 | 
			
		||||
  '@tauri-apps/cli': 1.1.1
 | 
			
		||||
  '@types/bmapgl': 0.0.5
 | 
			
		||||
  '@types/crypto-js': 4.1.1
 | 
			
		||||
@@ -2014,6 +2016,12 @@ packages:
 | 
			
		||||
      prompts: 2.4.2
 | 
			
		||||
    dev: true
 | 
			
		||||
 | 
			
		||||
  /@soybeanjs/router-page/0.2.0:
 | 
			
		||||
    resolution: {integrity: sha512-3vZlw3o+AzPS2TrL2zRSxEeNMOXVW48y8VO1RK74d3uG8/6XXxJDhlOFmNqgk/EQ5qDDwW5ofnbj7S3oYGBcFQ==}
 | 
			
		||||
    dependencies:
 | 
			
		||||
      fast-glob: 3.2.12
 | 
			
		||||
    dev: true
 | 
			
		||||
 | 
			
		||||
  /@soybeanjs/vue-admin-layout/1.1.1_vue@3.2.41:
 | 
			
		||||
    resolution: {integrity: sha512-cWbHsjuDB7QkDuYnxfQETmDxlN19JCffrssz6gab4UMP8fw1WL9qukKE/eWLzZoWFCaVJXE/ODEZb4QQLuMuUw==}
 | 
			
		||||
    peerDependencies:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user