valaxy 0.0.7 → 0.0.8

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.
Files changed (42) hide show
  1. package/dist/build-RREYJOHF.mjs +1 -0
  2. package/dist/build-TIU2KH77.js +1 -0
  3. package/dist/chunk-44DGW27S.js +1 -0
  4. package/dist/chunk-CSMXFOVS.mjs +1 -0
  5. package/dist/chunk-EM2KSV5V.js +83 -0
  6. package/dist/chunk-HUI4MBPM.js +1 -0
  7. package/dist/chunk-MWP3FN5Q.mjs +83 -0
  8. package/dist/chunk-RKUUEWDF.mjs +1 -0
  9. package/dist/index.d.ts +350 -0
  10. package/dist/index.js +1 -0
  11. package/dist/index.mjs +1 -0
  12. package/dist/node/cli.js +5 -5
  13. package/dist/node/cli.mjs +5 -5
  14. package/dist/node/index.js +1 -1
  15. package/dist/node/index.mjs +1 -1
  16. package/package.json +3 -3
  17. package/src/client/composables/category.ts +2 -2
  18. package/src/client/composables/common.ts +3 -2
  19. package/src/client/composables/post.ts +2 -2
  20. package/src/client/composables/tag.ts +2 -1
  21. package/src/{core → client}/config.ts +1 -1
  22. package/src/client/index.ts +4 -0
  23. package/src/client/utils/index.ts +2 -0
  24. package/src/client/utils/time.ts +1 -1
  25. package/src/index.ts +1 -1
  26. package/src/node/plugins/extendConfig.ts +17 -1
  27. package/src/node/plugins/preset.ts +9 -1
  28. package/src/node/vite.ts +1 -32
  29. package/tsup.config.ts +7 -4
  30. package/dist/build-OOT6HK6S.js +0 -1
  31. package/dist/build-SG32QSQ3.mjs +0 -1
  32. package/dist/chunk-7JDYOPID.js +0 -1
  33. package/dist/chunk-JJEBEWGI.mjs +0 -1
  34. package/dist/chunk-L3EDI35I.js +0 -1
  35. package/dist/chunk-L5SNNWFJ.js +0 -78
  36. package/dist/chunk-MVJUGWXR.mjs +0 -1
  37. package/dist/chunk-QI435Q25.mjs +0 -78
  38. package/dist/types/index.d.ts +0 -110
  39. package/dist/types/index.js +0 -1
  40. package/dist/types/index.mjs +0 -1
  41. package/src/core/index.ts +0 -5
  42. package/src/core/utils.ts +0 -1
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "valaxy",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "📄 Vite & Vue powered static blog generator.",
5
- "main": "src/index.ts",
6
- "types": "dist/types/index.d.ts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
7
  "keywords": [
8
8
  "vite",
9
9
  "vue",
@@ -1,4 +1,4 @@
1
- import type { Post } from 'valaxy'
1
+ import type { Post } from '../../types'
2
2
  import { usePostList } from './post'
3
3
 
4
4
  export interface ParentCategory {
@@ -32,7 +32,7 @@ export function useCategory() {
32
32
 
33
33
  const uncategorized = categoryMap.children.get('Uncategorized') as PostCategory
34
34
 
35
- posts.value.forEach((post) => {
35
+ posts.value.forEach((post: Post) => {
36
36
  if (post.categories) {
37
37
  if (Array.isArray(post.categories)) {
38
38
  const len = post.categories.length
@@ -1,8 +1,9 @@
1
1
  import { useRoute } from 'vue-router'
2
- import type { Post } from 'valaxy'
3
2
  import { computed } from 'vue'
4
3
 
5
- import { isDev, useConfig } from 'valaxy'
4
+ import { isDev } from '../..'
5
+ import type { Post } from '../../types'
6
+ import { useConfig } from '../config'
6
7
 
7
8
  export function useFrontmatter() {
8
9
  const route = useRoute()
@@ -1,8 +1,8 @@
1
- import { sortByDate } from 'valaxy'
2
1
  import type { StyleValue } from 'vue'
3
2
  import { computed } from 'vue'
4
3
  import { useRoute, useRouter } from 'vue-router'
5
- import { useThemeConfig } from '../../core/config'
4
+ import { useThemeConfig } from '../config'
5
+ import { sortByDate } from '../utils'
6
6
 
7
7
  /**
8
8
  * get post list
@@ -1,4 +1,5 @@
1
1
  import { TinyColor } from '@ctrl/tinycolor'
2
+ import type { Post } from '../../types'
2
3
  import { usePostList } from './post'
3
4
 
4
5
  export type Tags = Map<string, {
@@ -41,7 +42,7 @@ export function useTag() {
41
42
 
42
43
  const tagMap: Tags = new Map()
43
44
 
44
- posts.value.forEach((post) => {
45
+ posts.value.forEach((post: Post) => {
45
46
  if (post.tags) {
46
47
  let tags: string[]
47
48
  if (typeof post.tags === 'string')
@@ -2,7 +2,7 @@
2
2
  import valaxyConfig from '@valaxyjs/config'
3
3
  import type { ComputedRef, InjectionKey } from 'vue'
4
4
  import { computed, inject, readonly, shallowRef } from 'vue'
5
- import type { ThemeConfig } from 'valaxy-theme-yun'
5
+ import type { ThemeConfig } from '../../../valaxy-theme-yun'
6
6
  import type { ValaxyConfig } from '../types'
7
7
 
8
8
  /**
@@ -0,0 +1,4 @@
1
+ export * from './config'
2
+
3
+ export * from './composables'
4
+ export * from './utils'
@@ -1,2 +1,4 @@
1
1
  export * from './helper'
2
2
  export * from './time'
3
+
4
+ export const isDev = import.meta.env.DEV === true
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs'
2
- import type { Post } from 'valaxy'
2
+ import type { Post } from '../../types'
3
3
 
4
4
  export function formatDate(date: string | number | Date, template = 'YYYY-MM-DD') {
5
5
  const today = dayjs(date)
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './core'
1
+ export * from './client'
2
2
  export * from './types'
@@ -16,11 +16,27 @@ export function createConfigPlugin(options: ResolvedValaxyOptions): Plugin {
16
16
  '@valaxyjs/client': `${toAtFS(options.clientRoot)}/`,
17
17
  '@valaxyjs/config': '/@valaxyjs/config',
18
18
  'valaxy/package.json': toAtFS(resolve(options.clientRoot, '../../package.json')),
19
- 'valaxy': toAtFS(resolve(options.clientRoot, '..')),
19
+ 'valaxy': toAtFS(resolve(options.clientRoot, '../index.ts')),
20
20
  '@valaxyjs/core': toAtFS(resolve(options.clientRoot, '../core')),
21
21
  [`valaxy-theme-${options.theme}`]: `${toAtFS(resolve(options.themeRoot))}/`,
22
22
  },
23
23
  },
24
+
25
+ optimizeDeps: {
26
+ entries: [resolve(options.clientRoot, 'main.ts'), options.configFile],
27
+
28
+ include: [
29
+ 'vue',
30
+ 'vue-router',
31
+ '@vueuse/core',
32
+ '@vueuse/head',
33
+ 'dayjs',
34
+ 'nprogress',
35
+ ],
36
+ exclude: [
37
+ 'vue-demi',
38
+ ],
39
+ },
24
40
  }
25
41
  return mergeConfig(config, injection)
26
42
  },
@@ -24,9 +24,14 @@ import { createUnocssPlugin } from './unocss'
24
24
  import { createConfigPlugin } from './extendConfig'
25
25
  import { createValaxyPlugin } from '.'
26
26
 
27
+ export interface ValaxyPluginOptions {
28
+ components?: Parameters<typeof Components>[0]
29
+ }
30
+
27
31
  export function ViteValaxyPlugins(
28
32
  options: ResolvedValaxyOptions,
29
33
  serverOptions: ValaxyServerOptions = {},
34
+ pluginOptions: ValaxyPluginOptions = {},
30
35
  mode: Mode = 'dev',
31
36
  ): (PluginOption | PluginOption[])[] | undefined {
32
37
  const { clientRoot, themeRoot, userRoot } = options
@@ -40,6 +45,7 @@ export function ViteValaxyPlugins(
40
45
  const _md = setupMarkdownPlugins(mdIt, options.config.markdownIt)
41
46
 
42
47
  const roots = [clientRoot, themeRoot, userRoot]
48
+
43
49
  return [
44
50
  Vue({
45
51
  include: [/\.vue$/, /\.md$/],
@@ -123,8 +129,10 @@ export function ViteValaxyPlugins(
123
129
  allowOverrides: true,
124
130
  // override: user -> theme -> client
125
131
  // latter override former
126
- dirs: roots.map(root => `${root}/components`),
132
+ dirs: roots.map(root => `${root}/components`).concat(['src/components', 'components']),
127
133
  dts: `${options.userRoot}/components.d.ts`,
134
+
135
+ ...pluginOptions,
128
136
  }),
129
137
 
130
138
  // https://github.com/antfu/unocss
package/src/node/vite.ts CHANGED
@@ -1,18 +1,13 @@
1
- import path from 'path'
2
-
3
1
  import generateSitemap from 'vite-ssg-sitemap'
4
2
  import type { InlineConfig } from 'vite'
5
3
  import { searchForWorkspaceRoot } from 'vite'
6
4
  import type { ResolvedValaxyOptions, ValaxyServerOptions } from './options'
7
5
 
8
6
  import { ViteValaxyPlugins } from './plugins/preset'
9
- import { VALAXY_CONFIG_ID } from './plugins/valaxy'
10
7
 
11
8
  export type Mode = 'dev' | 'build'
12
9
 
13
10
  export function createViteConfig(options: ResolvedValaxyOptions, serverOptions: ValaxyServerOptions = {}, mode: Mode = 'dev'): InlineConfig {
14
- const { configFile } = options
15
-
16
11
  const viteConfig: InlineConfig = {
17
12
  // remove vue-i18n warnings
18
13
  // https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags
@@ -26,24 +21,11 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
26
21
  // __VUE_I18N_LEGACY_API__: 'false',
27
22
  // },
28
23
 
29
- resolve: {
30
- alias: {
31
- '@/': `${options.userRoot}/`,
32
- '~/': `${options.clientRoot}/`,
33
- '@valaxyjs/client': `${options.clientRoot}/`,
34
- 'valaxy/package.json': `${path.resolve(options.clientRoot, '../../package.json')}`,
35
- 'valaxy': `${path.resolve(options.clientRoot, '..')}`,
36
- [VALAXY_CONFIG_ID]: `/${VALAXY_CONFIG_ID}`,
37
- '@valaxyjs/core': `${path.resolve(options.clientRoot, '../core')}`,
38
- [`valaxy-theme-${options.theme}`]: `${path.resolve(options.themeRoot)}/`,
39
- },
40
- },
41
-
42
24
  root: options.clientRoot,
43
25
  // todo user base
44
26
  // base: '/',
45
27
 
46
- plugins: ViteValaxyPlugins(options, serverOptions, mode),
28
+ plugins: ViteValaxyPlugins(options, serverOptions, {}, mode),
47
29
 
48
30
  server: {
49
31
  fs: {
@@ -55,19 +37,6 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
55
37
  },
56
38
  },
57
39
 
58
- optimizeDeps: {
59
- entries: [path.resolve(options.clientRoot, 'main.ts'), configFile],
60
-
61
- include: [
62
- 'vue',
63
- 'vue-router',
64
- '@vueuse/core',
65
- '@vueuse/head',
66
- ],
67
- exclude: [
68
- 'vue-demi',
69
- ],
70
- },
71
40
  }
72
41
 
73
42
  if (mode === 'build') {
package/tsup.config.ts CHANGED
@@ -2,16 +2,19 @@ import { defineConfig } from 'tsup'
2
2
 
3
3
  export default defineConfig((options) => {
4
4
  return {
5
- entry: ['src/node/index.ts', 'src/node/cli.ts', 'src/types/index.ts'],
5
+ entry: [
6
+ 'src/node/index.ts',
7
+ 'src/node/cli.ts',
8
+ 'src/index.ts',
9
+ ],
6
10
  splitting: true,
7
11
  clean: true,
8
12
  dts: true,
9
13
  format: ['cjs', 'esm'],
10
14
  minify: !options.watch,
11
15
  external: [
12
- 'vite',
13
- 'sass',
14
- 'chalk',
16
+ '@valaxyjs/config',
17
+ 'valaxy-theme-yun',
15
18
  ],
16
19
  }
17
20
  })
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkL5SNNWFJjs = require('./chunk-L5SNNWFJ.js');var _chunkL3EDI35Ijs = require('./chunk-L3EDI35I.js');_chunkL3EDI35Ijs.e.call(void 0, );var _vite = require('vite');async function a(n,e={}){let t=_vite.mergeConfig.call(void 0, e,_chunkL5SNNWFJjs.d.call(void 0, n));await _vite.build.call(void 0, t)}exports.build = a;
@@ -1 +0,0 @@
1
- import{d as o}from"./chunk-QI435Q25.mjs";import{e as i}from"./chunk-MVJUGWXR.mjs";i();import{mergeConfig as r,build as f}from"vite";async function a(n,e={}){let t=r(e,o(n));await f(t)}export{a as build};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkL5SNNWFJjs = require('./chunk-L5SNNWFJ.js');var _chunkL3EDI35Ijs = require('./chunk-L3EDI35I.js');_chunkL3EDI35Ijs.e.call(void 0, );var _vite = require('vite');async function c(o,t={},i={}){return process.env.EDITOR=process.env.EDITOR||"code",await _vite.createServer.call(void 0, _vite.mergeConfig.call(void 0, t,_chunkL5SNNWFJjs.d.call(void 0, o,i)))}exports.a = c;
@@ -1 +0,0 @@
1
- import{d as r}from"./chunk-QI435Q25.mjs";import{e}from"./chunk-MVJUGWXR.mjs";e();import{createServer as n,mergeConfig as a}from"vite";async function c(o,t={},i={}){return process.env.EDITOR=process.env.EDITOR||"code",await n(a(t,r(o,i)))}export{c as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var c=Object.create;var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,d=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var l=(e,n,t)=>n in e?a(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,f= exports.a =(e,n)=>{for(var t in n||(n={}))g.call(n,t)&&l(e,t,n[t]);if(s)for(var t of s(n))u.call(n,t)&&l(e,t,n[t]);return e};var h=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(n,t)=>(typeof require!="undefined"?require:n)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var y=(e,n)=>()=>(e&&(n=e(e=0)),n);var x=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var b=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of m(n))!g.call(e,i)&&i!==t&&a(e,i,{get:()=>n[i],enumerable:!(r=p(n,i))||r.enumerable});return e};var k=(e,n,t)=>(t=e!=null?c(d(e)):{},b(n||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e));var o=y(()=>{});o();o();var V={url:"",lang:"en",title:"Valaxy Blog",subtitle:"Next Generation Static Blog Framework.",author:{avatar:"https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-with-bg.jpg",name:"YunYouJun",status:{emoji:"\u{1F60A}",message:"All at sea."}},social:[],description:"A blog generated by Valaxy.",license:{enabled:!0,language:"",type:"by-nc-sa"},sponsor:{enable:!0,title:"\u6211\u5F88\u53EF\u7231\uFF0C\u8BF7\u7ED9\u6211\u94B1",methods:[{name:"\u652F\u4ED8\u5B9D",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/alipay-qrcode.jpg",color:"#00A3EE",icon:"i-ri-alipay-line"},{name:"QQ \u652F\u4ED8",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/qqpay-qrcode.png",color:"#12B7F5",icon:"i-ri-qq-line"},{name:"\u5FAE\u4FE1\u652F\u4ED8",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/wechatpay-qrcode.jpg",color:"#2DC100",icon:"i-ri-wechat-pay-line"}]},search:{algolia:{enable:!1,appId:"",apiKey:"",indexName:"",chunkSize:5e3}},comment:{waline:{enable:!1,serverURL:""}},theme:"yun",themeConfig:{},unocss:{},markdown:{excerpt:"<!-- more -->"},markdownIt:{toc:{listType:"ol"},katex:{}}};o();exports.a = f; exports.b = h; exports.c = x; exports.d = k; exports.e = o; exports.f = V;