mirror of https://github.com/YunYouJun/valaxy
chore: fix details & esmResolve for jiti
This commit is contained in:
parent
fb96ab3d6b
commit
bd82a0f194
|
@ -27,7 +27,6 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.0.3",
|
||||
"vite-plugin-inspect": "^0.8.1",
|
||||
"vite-plugin-pwa": "^0.17.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ const safelist = [
|
|||
]
|
||||
|
||||
export default defineValaxyConfig<ThemeConfig>({
|
||||
devtools: false,
|
||||
// site config see site.config.ts or write in siteConfig
|
||||
// siteConfig: {},
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ So you can use it like this:
|
|||
import { defineValaxyConfig } from 'valaxy'
|
||||
import type { ThemeConfig } from 'valaxy-theme-yun'
|
||||
import { addonComponents } from 'valaxy-addon-components'
|
||||
import Inspect from 'vite-plugin-inspect'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
const safelist = [
|
||||
'i-ri-home-line',
|
||||
|
|
|
@ -41,7 +41,7 @@ For example:
|
|||
import { defineValaxyConfig } from 'valaxy'
|
||||
import type { ThemeConfig } from 'valaxy-theme-yun'
|
||||
import { addonComponents } from 'valaxy-addon-components'
|
||||
import Inspect from 'vite-plugin-inspect'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
const safelist = [
|
||||
'i-ri-home-line',
|
||||
|
@ -60,9 +60,8 @@ export default defineValaxyConfig<ThemeConfig>({
|
|||
},
|
||||
|
||||
vite: {
|
||||
// https://github.com/antfu/vite-plugin-inspect
|
||||
// Visit http://localhost:3333/__inspect/ to see the inspector
|
||||
plugins: [Inspect()],
|
||||
// https://vite-pwa-org.netlify.app/
|
||||
plugins: [VitePWA()],
|
||||
},
|
||||
|
||||
unocss: {
|
||||
|
@ -209,6 +208,7 @@ export default defineSiteConfig({
|
|||
}
|
||||
})
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: en
|
||||
|
@ -231,6 +231,7 @@ export default defineSiteConfig({
|
|||
}
|
||||
})
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### 社交图标 {lang="zh-CN"}
|
||||
|
@ -509,10 +510,12 @@ export default defineSiteConfig({
|
|||
```
|
||||
|
||||
::: zh-CN
|
||||
|
||||
- 加密整篇文章
|
||||
:::
|
||||
|
||||
::: en
|
||||
|
||||
- encrypt the entire article
|
||||
:::
|
||||
|
||||
|
@ -531,10 +534,12 @@ password: your_password
|
|||
```
|
||||
|
||||
::: zh-CN
|
||||
|
||||
- 加密部分内容
|
||||
:::
|
||||
|
||||
::: en
|
||||
|
||||
- encrypt partial content
|
||||
:::
|
||||
|
||||
|
@ -648,6 +653,7 @@ Valaxy has built-in [medium-zoom](https://github.com/francoischalifour/medium-zo
|
|||
- `enable`: Set to true to enable it
|
||||
- `selector`: Custom CSS selector
|
||||
- `options`: Refer to [options | medium-zoom](https://github.com/francoischalifour/medium-zoom#options)
|
||||
|
||||
>>>>>>> a2bbd86 (docs: update vanillaLazyLoad)
|
||||
:::
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ import { VitePWA } from 'vite-plugin-pwa'
|
|||
export default defineValaxyConfig<ThemeConfig>({
|
||||
vite: {
|
||||
plugins: [
|
||||
// https://vite-pwa-org.netlify.app/
|
||||
VitePWA(),
|
||||
Inspect(),
|
||||
],
|
||||
},
|
||||
})
|
||||
|
|
|
@ -115,7 +115,7 @@ import { defineTheme } from 'valaxy'
|
|||
|
||||
export default defineTheme({
|
||||
vueRouter: {
|
||||
extendRoutes(route) {
|
||||
extendRoute(route) {
|
||||
// want to get component absolute paths?
|
||||
// const path = route.components.get('default')
|
||||
console.log(route)
|
||||
|
|
|
@ -12,6 +12,7 @@ import type { PageDataPayload } from '../../types'
|
|||
*/
|
||||
export const useSiteStore = defineStore('site', () => {
|
||||
const reload = ref(1)
|
||||
// for dev hot reload
|
||||
const postList = computed(() => {
|
||||
if (reload.value)
|
||||
return usePostList().value
|
||||
|
@ -19,6 +20,8 @@ export const useSiteStore = defineStore('site', () => {
|
|||
return usePostList().value
|
||||
})
|
||||
|
||||
// const postList = usePostList()
|
||||
|
||||
const router = useRouter()
|
||||
if (router) {
|
||||
router.isReady().then(() => {
|
||||
|
|
|
@ -36,6 +36,7 @@ export function loadConfig<T extends UserInputConfig = UserInputConfig>(options:
|
|||
data = jiti(fileURLToPath(import.meta.url), {
|
||||
interopDefault: true,
|
||||
requireCache: false,
|
||||
esmResolve: true,
|
||||
})(filePath)
|
||||
}
|
||||
catch (e) { }
|
||||
|
|
|
@ -23,7 +23,9 @@ export async function loadSetups<T, R extends object>(roots: string[], name: str
|
|||
for (const root of roots) {
|
||||
const path = resolve(root, 'setup', name)
|
||||
if (fs.existsSync(path)) {
|
||||
const { default: setup } = jiti(fileURLToPath(import.meta.url))(path)
|
||||
const { default: setup } = jiti(fileURLToPath(import.meta.url), {
|
||||
esmResolve: true,
|
||||
})(path)
|
||||
const result = await setup(arg)
|
||||
if (result !== null) {
|
||||
returns = merge
|
||||
|
|
|
@ -125,6 +125,9 @@ export async function createUnocssPlugin(options: ResolvedValaxyOptions) {
|
|||
if (existsSync(configFile)) {
|
||||
let uConfig: UnoCSSConfig | { default: UnoCSSConfig } = jiti(
|
||||
fileURLToPath(import.meta.url),
|
||||
{
|
||||
esmResolve: true,
|
||||
},
|
||||
)(configFile) as UnoCSSConfig | { default: UnoCSSConfig }
|
||||
if ('default' in uConfig)
|
||||
uConfig = uConfig.default
|
||||
|
|
|
@ -9,6 +9,7 @@ import type { Plugin, ResolvedConfig } from 'vite'
|
|||
import { defu } from 'defu'
|
||||
import pascalCase from 'pascalcase'
|
||||
import type { DefaultTheme, PageDataPayload, Pkg, SiteConfig } from 'valaxy/types'
|
||||
import { yellow } from 'kolorist'
|
||||
import { defaultSiteConfig, mergeValaxyConfig, resolveSiteConfig, resolveUserThemeConfig } from '../config'
|
||||
import type { ResolvedValaxyOptions, ValaxyServerOptions } from '../options'
|
||||
import { processValaxyOptions, resolveOptions, resolveThemeValaxyConfig } from '../options'
|
||||
|
@ -16,6 +17,7 @@ import { resolveImportPath, slash, toAtFS } from '../utils'
|
|||
import { createMarkdownToVueRenderFn } from '../markdown/markdownToVue'
|
||||
import type { ValaxyNodeConfig } from '../types'
|
||||
import { checkMd } from '../markdown/check'
|
||||
import { vLogger } from '../logger'
|
||||
|
||||
/**
|
||||
* for /@valaxyjs/styles
|
||||
|
@ -301,6 +303,9 @@ export function createValaxyPlugin(options: ResolvedValaxyOptions, serverOptions
|
|||
|
||||
// overwrite src so vue plugin can handle the HMR
|
||||
ctx.read = () => vueSrc
|
||||
vLogger.success(`${yellow('[HMR]')} ${path}`)
|
||||
|
||||
return []
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ export interface ValaxyExtendConfig {
|
|||
/**
|
||||
* @experimental
|
||||
* Enable Vue Devtools & Valaxy Devtools
|
||||
* @see https://devtools-next.vuejs.org/
|
||||
*/
|
||||
devtools?: boolean
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue