valaxy 0.0.8 → 0.1.1

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 (41) hide show
  1. package/bin/valaxy.js +1 -1
  2. package/dist/build-VGAF4K5S.js +1 -0
  3. package/dist/build-Y5F7AZ2V.mjs +1 -0
  4. package/dist/chunk-5KQ3UFYI.js +1 -0
  5. package/dist/{chunk-MWP3FN5Q.mjs → chunk-ESCOXVP6.mjs} +40 -40
  6. package/dist/chunk-JWA76JND.mjs +1 -0
  7. package/dist/chunk-WYCH73X6.js +83 -0
  8. package/dist/{node/cli.d.ts → cli.d.ts} +0 -0
  9. package/dist/cli.js +6 -0
  10. package/dist/cli.mjs +6 -0
  11. package/dist/index.d.ts +152 -299
  12. package/dist/index.js +1 -1
  13. package/dist/index.mjs +1 -1
  14. package/package.json +7 -3
  15. package/src/client/components/PostList.vue +2 -2
  16. package/src/client/components/ValaxyCopyright.vue +1 -1
  17. package/src/client/components/ValaxyFooter.vue +1 -1
  18. package/src/client/components/ValaxyPagination.vue +2 -3
  19. package/src/client/components/ValaxyRightSidebar.vue +2 -2
  20. package/src/client/modules/valaxy.ts +9 -5
  21. package/src/client/styles/common/markdown.scss +3 -0
  22. package/src/client/styles/global/reset.scss +1 -0
  23. package/src/client/styles/palette.scss +3 -2
  24. package/src/client/utils/time.ts +6 -0
  25. package/src/node/plugins/extendConfig.ts +3 -2
  26. package/src/node/plugins/preset.ts +3 -2
  27. package/src/node/vite.ts +3 -2
  28. package/tsup.config.ts +2 -1
  29. package/dist/build-RREYJOHF.mjs +0 -1
  30. package/dist/build-TIU2KH77.js +0 -1
  31. package/dist/chunk-44DGW27S.js +0 -1
  32. package/dist/chunk-CSMXFOVS.mjs +0 -1
  33. package/dist/chunk-EM2KSV5V.js +0 -83
  34. package/dist/chunk-HUI4MBPM.js +0 -1
  35. package/dist/chunk-RKUUEWDF.mjs +0 -1
  36. package/dist/config-d6527c8c.d.ts +0 -174
  37. package/dist/node/cli.js +0 -6
  38. package/dist/node/cli.mjs +0 -6
  39. package/dist/node/index.d.ts +0 -45
  40. package/dist/node/index.js +0 -1
  41. package/dist/node/index.mjs +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy",
3
- "version": "0.0.8",
3
+ "version": "0.1.1",
4
4
  "description": "📄 Vite & Vue powered static blog generator.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,6 +9,10 @@
9
9
  "vue",
10
10
  "blog"
11
11
  ],
12
+ "exports": {
13
+ ".": "./src/index.ts",
14
+ "./*": "./*"
15
+ },
12
16
  "bin": {
13
17
  "vala": "./bin/valaxy.js",
14
18
  "valaxy": "./bin/valaxy.js"
@@ -78,8 +82,8 @@
78
82
  "vite-ssg-sitemap": "^0.2.0"
79
83
  },
80
84
  "scripts": {
81
- "build": "tsup",
82
- "dev": "tsup --watch",
85
+ "build": "tsup --splitting",
86
+ "dev": "tsup --watch --splitting",
83
87
  "lint": "eslint \"**/*.{vue,ts,js}\"",
84
88
  "preview": "vite preview",
85
89
  "preview-https": "serve dist",
@@ -19,7 +19,7 @@ const displayedPosts = computed(() => posts.value.slice((props.curPage - 1) * pa
19
19
  </script>
20
20
 
21
21
  <template>
22
- <ul w="full" p="x-4 lt-sm:0">
22
+ <div w="full" p="x-4 lt-sm:0">
23
23
  <template v-if="!displayedPosts.length">
24
24
  <div py2 op50>
25
25
  博主还什么都没写哦~
@@ -29,7 +29,7 @@ const displayedPosts = computed(() => posts.value.slice((props.curPage - 1) * pa
29
29
  <Transition v-for="route, i in displayedPosts" :key="i" name="fade">
30
30
  <PostCard :post="route" />
31
31
  </Transition>
32
- </ul>
32
+ </div>
33
33
 
34
34
  <ValaxyPagination :cur-page="curPage" :page-size="pageSize" :total="posts.length" />
35
35
  </template>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy'
3
2
  import { computed } from 'vue'
4
3
  import { useI18n } from 'vue-i18n'
4
+ import { useConfig } from '../config'
5
5
 
6
6
  const { t, locale } = useI18n()
7
7
 
@@ -21,7 +21,7 @@ const poweredHtml = computed(() => t('footer.powered', [`<a href="${pkg.reposito
21
21
  </script>
22
22
 
23
23
  <template>
24
- <footer class="val-footer p-4 opacity-80" text="center sm">
24
+ <footer class="val-footer p-4" text="center sm" style="color:var(--yun-c-text-light)">
25
25
  <div v-if="themeConfig.footer.beian.enable && themeConfig.footer.beian.icp" class="beian" m="y-2">
26
26
  <a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
27
27
  {{ themeConfig.footer.beian.icp }}
@@ -44,7 +44,7 @@ const jumpTo = (page: number) => {
44
44
 
45
45
  <template>
46
46
  <nav class="pagination">
47
- <router-link v-if="curPage !== 1" class="page-number" :to="jumpTo(curPage - 1)">
47
+ <router-link v-if="curPage !== 1" class="page-number" :to="jumpTo(curPage - 1)" aria-label="prev">
48
48
  <div i-ri-arrow-left-s-line />
49
49
  </router-link>
50
50
 
@@ -60,7 +60,7 @@ const jumpTo = (page: number) => {
60
60
  </span>
61
61
  </template>
62
62
 
63
- <router-link v-if="curPage !== totalPages" class="page-number" :to="jumpTo(curPage + 1)">
63
+ <router-link v-if="curPage !== totalPages" class="page-number" :to="jumpTo(curPage + 1)" aria-label="next">
64
64
  <div i-ri-arrow-right-s-line />
65
65
  </router-link>
66
66
  </nav>
@@ -118,5 +118,4 @@ const jumpTo = (page: number) => {
118
118
  }
119
119
  }
120
120
  }
121
-
122
121
  </style>
@@ -8,12 +8,12 @@ defineProps<{ frontmatter: Post }>()
8
8
 
9
9
  <template>
10
10
  <aside class="right-sidebar val-card relative" m="l-4" text="center">
11
- <h2 v-if="frontmatter.toc" m="t-6 b-2" font="serif black">
11
+ <h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
12
12
  {{ t('sidebar.toc') }}
13
13
  </h2>
14
14
 
15
15
  <div class="right-sidebar-container sticky">
16
- <ValaxyToc v-if="frontmatter.toc" />
16
+ <ValaxyToc v-if="frontmatter.toc !== false" />
17
17
 
18
18
  <div v-if="$slots.custom" class="custom-container">
19
19
  <slot name="custom" />
@@ -1,5 +1,6 @@
1
1
  import { createI18n } from 'vue-i18n'
2
- import { initConfig, valaxyConfigSymbol } from 'valaxy'
2
+ import { initConfig, valaxyConfigSymbol } from '../config'
3
+ import { isDev } from '..'
3
4
  import type { UserModule } from '~/types'
4
5
 
5
6
  // Import i18n resources
@@ -35,8 +36,11 @@ export const install: UserModule = ({ app, router }) => {
35
36
  })
36
37
  app.use(i18n)
37
38
 
38
- import.meta.hot!.on('valaxy:pageHeaders', (payload) => {
39
- if (shouldHotReload(payload))
40
- router.currentRoute.value.meta.headers = payload.pageHeaders
41
- })
39
+ // for dev
40
+ if (isDev) {
41
+ import.meta.hot!.on('valaxy:pageHeaders', (payload) => {
42
+ if (shouldHotReload(payload))
43
+ router.currentRoute.value.meta.headers = payload.pageHeaders
44
+ })
45
+ }
42
46
  }
@@ -21,6 +21,7 @@ h5:hover .header-anchor,
21
21
  h5:focus .header-anchor,
22
22
  h6:hover .header-anchor,
23
23
  h6:focus .header-anchor {
24
+ visibility: visible;
24
25
  opacity: 1;
25
26
  }
26
27
 
@@ -30,7 +31,9 @@ a.header-anchor {
30
31
  margin-left: -0.87em;
31
32
  padding-right: 0.23em;
32
33
  font-size: 0.85em;
34
+ visibility: hidden;
33
35
  opacity: 0;
36
+ transition: opacity var(--yun-transition-duration);
34
37
 
35
38
  &::before {
36
39
  content: none;
@@ -8,6 +8,7 @@ html {
8
8
 
9
9
  a {
10
10
  color: var(--yun-c-link);
11
+ font-weight: 500;
11
12
  }
12
13
 
13
14
  * {
@@ -21,6 +21,7 @@ $c-primary: map.get($colors, 'primary');
21
21
  $colors: map.merge((
22
22
  'primary-light': lighten($c-primary, 15%),
23
23
  'primary-lighter': lighten($c-primary, 30%),
24
+ 'primary-dark': darken($c-primary, 5%),
24
25
  ), $colors);
25
26
 
26
27
 
@@ -38,9 +39,9 @@ $light: map.merge((
38
39
 
39
40
  'c-primary-rgb': #{red($c-primary), green($c-primary), blue($c-primary)},
40
41
 
41
- 'c-link': $c-primary,
42
+ 'c-link': get-css-var('c-primary-dark'),
42
43
 
43
- 'sidebar-bg-color': #{get-css-var('c-bg-light')}
44
+ 'sidebar-bg-color': get-css-var('c-bg-light')
44
45
  ), $light);
45
46
 
46
47
  $dark: () !default;
@@ -1,6 +1,12 @@
1
1
  import dayjs from 'dayjs'
2
2
  import type { Post } from '../../types'
3
3
 
4
+ /**
5
+ * use dayjs format date
6
+ * @param date
7
+ * @param template
8
+ * @returns
9
+ */
4
10
  export function formatDate(date: string | number | Date, template = 'YYYY-MM-DD') {
5
11
  const today = dayjs(date)
6
12
  return today.format(template)
@@ -16,9 +16,10 @@ 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
20
  'valaxy': toAtFS(resolve(options.clientRoot, '../index.ts')),
20
- '@valaxyjs/core': toAtFS(resolve(options.clientRoot, '../core')),
21
- [`valaxy-theme-${options.theme}`]: `${toAtFS(resolve(options.themeRoot))}/`,
21
+ [`valaxy-theme-${options.theme}/`]: `${toAtFS(resolve(options.themeRoot))}/`,
22
+ [`valaxy-theme-${options.theme}`]: `${toAtFS(resolve(options.themeRoot))}`,
22
23
  },
23
24
  },
24
25
 
@@ -82,7 +82,7 @@ export function ViteValaxyPlugins(
82
82
  path = pagePath
83
83
  })
84
84
  const md = fs.readFileSync(path, 'utf-8')
85
- const { data, excerpt } = matter(md, { excerpt_separator })
85
+ const { data, excerpt, content } = matter(md, { excerpt_separator })
86
86
 
87
87
  // warn for post frontmatter
88
88
  if (route.path.startsWith('/posts/')) {
@@ -98,7 +98,7 @@ export function ViteValaxyPlugins(
98
98
 
99
99
  // to refactor
100
100
  // get active header by runtime query head, not render
101
- mdIt.render(md)
101
+ mdIt.render(content)
102
102
  route.meta.headers = _md.__data?.headers
103
103
 
104
104
  // set default updated
@@ -124,6 +124,7 @@ export function ViteValaxyPlugins(
124
124
 
125
125
  // allow auto import and register components used in markdown
126
126
  include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
127
+ exclude: [],
127
128
 
128
129
  // allow override
129
130
  allowOverrides: true,
package/src/node/vite.ts CHANGED
@@ -30,9 +30,10 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
30
30
  server: {
31
31
  fs: {
32
32
  allow: [
33
- searchForWorkspaceRoot(options.clientRoot),
33
+ // not need to search workspace root
34
+ options.clientRoot,
35
+ options.themeRoot,
34
36
  searchForWorkspaceRoot(options.userRoot),
35
- searchForWorkspaceRoot(options.themeRoot),
36
37
  ],
37
38
  },
38
39
  },
package/tsup.config.ts CHANGED
@@ -5,8 +5,9 @@ export default defineConfig((options) => {
5
5
  entry: [
6
6
  'src/node/index.ts',
7
7
  'src/node/cli.ts',
8
- 'src/index.ts',
9
8
  ],
9
+ // https://tsup.egoist.sh/#code-splitting
10
+ // Code splitting currently only works with the esm output format, and it's enabled by default. If you want code splitting for cjs output format as well, try using --splitting flag which is an experimental feature to get rid of the limitation in esbuild.
10
11
  splitting: true,
11
12
  clean: true,
12
13
  dts: true,
@@ -1 +0,0 @@
1
- import{f as o}from"./chunk-MWP3FN5Q.mjs";import{f as i}from"./chunk-RKUUEWDF.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 _chunkEM2KSV5Vjs = require('./chunk-EM2KSV5V.js');var _chunk44DGW27Sjs = require('./chunk-44DGW27S.js');_chunk44DGW27Sjs.f.call(void 0, );var _vite = require('vite');async function a(n,e={}){let t=_vite.mergeConfig.call(void 0, e,_chunkEM2KSV5Vjs.f.call(void 0, n));await _vite.build.call(void 0, t)}exports.build = a;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var c=Object.create;var a=Object.defineProperty,p=Object.defineProperties,m=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,y=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,b=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,x= 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))b.call(n,t)&&l(e,t,n[t]);return e},k= exports.b =(e,n)=>p(e,d(n));var w=(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 f=(e,n)=>()=>(e&&(n=e(e=0)),n);var C=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var h=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!g.call(e,i)&&i!==t&&a(e,i,{get:()=>n[i],enumerable:!(r=m(n,i))||r.enumerable});return e};var V=(e,n,t)=>(t=e!=null?c(y(e)):{},h(n||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e));var o=f(()=>{});o();var Y={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();o();exports.a = x; exports.b = k; exports.c = w; exports.d = C; exports.e = V; exports.f = o; exports.g = Y;
@@ -1 +0,0 @@
1
- import{f as r}from"./chunk-MWP3FN5Q.mjs";import{f as e}from"./chunk-RKUUEWDF.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};