refactor: move vite-plugin-inspect from internal to user

This commit is contained in:
YunYouJun 2022-07-12 01:02:35 +08:00
parent 2e6c4ca208
commit b2b1c581d7
10 changed files with 1846 additions and 82 deletions

View File

@ -14,6 +14,8 @@
},
"devDependencies": {
"@waline/client": "^2.6.1",
"nodemon": "^2.0.19"
"nodemon": "^2.0.19",
"vite-plugin-inspect": "^0.5.1",
"vite-plugin-pwa": "^0.12.3"
}
}

View File

@ -1,5 +1,6 @@
import { defineConfig } from 'vite'
// import { VitePWA } from 'vite-plugin-pwa'
import Inspect from 'vite-plugin-inspect'
const safelist = [
'i-ri-home-line',
@ -7,12 +8,16 @@ const safelist = [
export default defineConfig({
plugins: [
// https://github.com/antfu/vite-plugin-inspect
// Visit http://localhost:3333/__inspect/ to see the inspector
Inspect(),
// VitePWA({
// registerType: 'autoUpdate',
// includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
// manifest: {
// name: valaxyConfig.title || 'Theme Yun',
// short_name: valaxyConfig.title || 'Yun',
// name: 'Theme Yun',
// short_name: 'Yun',
// theme_color: '#ffffff',
// icons: [
// {

View File

@ -2,4 +2,6 @@
title: Hello Theme Press
---
Temp Docs: [yun.valaxy.site/docs](https://yun.valaxy.site/docs)
Hello Valaxy Theme Press

View File

@ -11,6 +11,8 @@ export const defaultThemeConfig: ThemeConfig = {
colors: {
primary: '#0078E7',
},
nav: [],
}
export default defaultThemeConfig

View File

@ -20,6 +20,11 @@ export interface ThemeConfig {
*/
primary: string
}
nav: {
link: string
text: string
}[]
}
export type ThemeUserConfig = Partial<ThemeConfig>

View File

@ -5,7 +5,7 @@ import { uniq } from '@antfu/utils'
import { loadConfigFromFile, mergeConfig } from 'vite'
import type { ResolvedValaxyOptions } from './options'
export async function mergeViteConfigs({ userRoot, themeRoot }: ResolvedValaxyOptions, command: 'serve' | 'build') {
export async function mergeViteConfigs({ themeRoot }: ResolvedValaxyOptions, command: 'serve' | 'build') {
const configEnv: ConfigEnv = {
mode: 'development',
command,
@ -13,8 +13,9 @@ export async function mergeViteConfigs({ userRoot, themeRoot }: ResolvedValaxyOp
let resolvedConfig: InlineConfig = {}
// userRoot vite.config.ts had been auto loaded by vite
const files = uniq([
userRoot,
// userRoot,
themeRoot,
]).map(i => join(i, 'vite.config.ts'))

View File

@ -12,7 +12,6 @@ import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts'
import Components from 'unplugin-vue-components/vite'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import Inspect from 'vite-plugin-inspect'
import { dim, yellow } from 'kolorist'
import type { ResolvedValaxyOptions, ValaxyPluginOptions, ValaxyServerOptions } from '../options'
@ -203,10 +202,6 @@ export async function ViteValaxyPlugins(
include: roots.map(root => `${root}/locales/**`),
}),
// https://github.com/antfu/vite-plugin-inspect
// Visit http://localhost:3333/__inspect/ to see the inspector
options.mode === 'dev' && Inspect(),
splitVendorChunkPlugin(),
]
}

View File

@ -5,6 +5,11 @@ import type { PluginOption } from 'vite'
import type { ResolvedValaxyOptions } from '../options'
import { toAtFS } from '../utils'
/**
* setup client for defineAppSetup
* @param param
* @returns
*/
export function createClientSetupPlugin({ clientRoot, themeRoot, userRoot }: ResolvedValaxyOptions): PluginOption {
const setupEntry = slash(resolve(clientRoot, 'setup'))

View File

@ -99,7 +99,6 @@
"unocss": "^0.44.0",
"unplugin-vue-components": "^0.21.1",
"vite": "^2.9.14",
"vite-plugin-inspect": "^0.5.1",
"vite-plugin-pages": "^0.25.0",
"vite-plugin-vue-layouts": "^0.6.0",
"vite-ssg": "0.19.2",

File diff suppressed because it is too large Load Diff