valaxy 0.1.0 → 0.2.0

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 (86) hide show
  1. package/bin/valaxy.js +1 -1
  2. package/dist/chunk-4LP5LOFC.js +86 -0
  3. package/dist/chunk-BDKTP6RW.js +1 -0
  4. package/dist/chunk-UVMBC7I3.mjs +1 -0
  5. package/dist/chunk-VLZSM7W4.mjs +86 -0
  6. package/dist/config-24b4f209.d.ts +188 -0
  7. package/dist/index.d.ts +316 -151
  8. package/dist/index.js +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/{cli.d.ts → node/cli.d.ts} +0 -0
  11. package/dist/node/cli.js +45 -0
  12. package/dist/node/cli.mjs +45 -0
  13. package/dist/node/index.d.ts +46 -0
  14. package/dist/node/index.js +1 -0
  15. package/dist/node/index.mjs +1 -0
  16. package/package.json +22 -18
  17. package/src/client/components/PostCard.vue +1 -1
  18. package/src/client/components/PostList.vue +5 -5
  19. package/src/client/components/ValaxyCopyright.vue +1 -1
  20. package/src/client/components/ValaxyFooter.vue +1 -1
  21. package/src/client/components/ValaxyOverlay.vue +4 -4
  22. package/src/client/components/ValaxyPagination.vue +16 -14
  23. package/src/client/components/ValaxyRightSidebar.vue +4 -4
  24. package/src/client/components/ValaxySidebar.vue +4 -8
  25. package/src/client/components/ValaxyToc.vue +11 -9
  26. package/src/client/composables/comments/index.ts +1 -0
  27. package/src/client/composables/comments/twikoo.ts +37 -0
  28. package/src/client/composables/comments/waline.ts +8 -5
  29. package/src/client/composables/common.ts +3 -4
  30. package/src/client/composables/search/algolia.ts +2 -1
  31. package/src/client/composables/sidebar.ts +2 -2
  32. package/src/client/composables/tag.ts +9 -2
  33. package/src/client/composables/widgets/backToTop.ts +10 -4
  34. package/src/client/main.ts +1 -8
  35. package/src/client/modules/valaxy.ts +36 -15
  36. package/src/client/shims.d.ts +5 -5
  37. package/src/client/styles/common/button.scss +3 -5
  38. package/src/client/styles/common/code.scss +157 -0
  39. package/src/client/styles/common/hamburger.scss +2 -2
  40. package/src/client/styles/common/markdown.scss +6 -5
  41. package/src/client/styles/common/sidebar.scss +3 -3
  42. package/src/client/styles/common/transition.scss +2 -2
  43. package/src/client/styles/css-vars.scss +39 -0
  44. package/src/client/styles/global/helper.scss +2 -2
  45. package/src/client/styles/global/index.scss +1 -1
  46. package/src/client/styles/global/nprogress.scss +1 -1
  47. package/src/client/styles/global/reset.scss +2 -1
  48. package/src/client/styles/index.scss +12 -1
  49. package/src/client/styles/mixins/config.scss +1 -1
  50. package/src/client/styles/mixins/index.scss +1 -0
  51. package/src/client/styles/palette.scss +6 -8
  52. package/src/client/styles/vars.scss +1 -13
  53. package/src/client/styles/widgets/banner.scss +2 -2
  54. package/src/client/utils/index.ts +0 -2
  55. package/src/node/build.ts +20 -1
  56. package/src/node/cli.ts +32 -19
  57. package/src/node/markdown/highlight.ts +50 -0
  58. package/src/node/markdown/highlightLines.ts +96 -0
  59. package/src/node/markdown/index.ts +22 -11
  60. package/src/node/markdown/markdown-it-katex.ts +20 -10
  61. package/src/node/markdown/parseHeader.ts +4 -2
  62. package/src/node/options.ts +3 -1
  63. package/src/node/plugins/index.ts +53 -24
  64. package/src/node/plugins/markdown.ts +1 -1
  65. package/src/node/plugins/preset.ts +46 -10
  66. package/src/node/plugins/unocss.ts +12 -7
  67. package/src/node/rss.ts +121 -0
  68. package/src/node/server.ts +1 -1
  69. package/src/node/shims.d.ts +15 -0
  70. package/src/node/utils/cli.ts +0 -1
  71. package/src/node/vite.ts +7 -15
  72. package/src/types/config.ts +27 -2
  73. package/tsup.config.ts +1 -0
  74. package/dist/build-CLF7GOPQ.mjs +0 -1
  75. package/dist/build-F47TGGER.js +0 -1
  76. package/dist/chunk-5S6S3FLN.mjs +0 -83
  77. package/dist/chunk-JORQSKHF.mjs +0 -1
  78. package/dist/chunk-TOMJSB6R.js +0 -83
  79. package/dist/chunk-VJNIZVTJ.js +0 -1
  80. package/dist/cli.js +0 -6
  81. package/dist/cli.mjs +0 -6
  82. package/src/client/pages/about/index.md +0 -5
  83. package/src/client/pages/posts/index.md +0 -5
  84. package/src/client/styles/css-vars/dark.scss +0 -17
  85. package/src/client/styles/css-vars/index.scss +0 -18
  86. package/src/client/styles/css-vars/light.scss +0 -9
@@ -14,7 +14,7 @@ export async function createServer(
14
14
 
15
15
  const server = await createViteServer(mergeConfig(
16
16
  viteConfig,
17
- createViteConfig(options, serverOptions),
17
+ await createViteConfig(options, serverOptions),
18
18
  ))
19
19
 
20
20
  return server
@@ -1,3 +1,13 @@
1
+ declare module 'escape-html' {
2
+ const def: (str: string) => string
3
+ export default def
4
+ }
5
+
6
+ declare module 'prismjs' {
7
+ const def: any
8
+ export default def
9
+ }
10
+
1
11
  declare module 'markdown-it-attrs' {
2
12
  const def: any
3
13
  export default def
@@ -18,6 +28,11 @@ declare module 'markdown-it-container' {
18
28
  export default def
19
29
  }
20
30
 
31
+ declare module 'markdown-it-task-lists' {
32
+ const def: any
33
+ export default def
34
+ }
35
+
21
36
  declare module 'diacritics' {
22
37
  export const remove: (str: string) => string
23
38
  }
@@ -1,4 +1,3 @@
1
-
2
1
  import * as readline from 'readline'
3
2
  import path from 'path'
4
3
  import os from 'os'
package/src/node/vite.ts CHANGED
@@ -1,4 +1,3 @@
1
- import generateSitemap from 'vite-ssg-sitemap'
2
1
  import type { InlineConfig } from 'vite'
3
2
  import { searchForWorkspaceRoot } from 'vite'
4
3
  import type { ResolvedValaxyOptions, ValaxyServerOptions } from './options'
@@ -7,7 +6,7 @@ import { ViteValaxyPlugins } from './plugins/preset'
7
6
 
8
7
  export type Mode = 'dev' | 'build'
9
8
 
10
- export function createViteConfig(options: ResolvedValaxyOptions, serverOptions: ValaxyServerOptions = {}, mode: Mode = 'dev'): InlineConfig {
9
+ export async function createViteConfig(options: ResolvedValaxyOptions, serverOptions: ValaxyServerOptions = {}): Promise<InlineConfig> {
11
10
  const viteConfig: InlineConfig = {
12
11
  // remove vue-i18n warnings
13
12
  // https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags
@@ -21,11 +20,14 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
21
20
  // __VUE_I18N_LEGACY_API__: 'false',
22
21
  // },
23
22
 
23
+ // always string
24
+ define: {
25
+ __DEV__: options.mode === 'dev' ? 'true' : 'false',
26
+ },
27
+
24
28
  root: options.clientRoot,
25
- // todo user base
26
- // base: '/',
27
29
 
28
- plugins: ViteValaxyPlugins(options, serverOptions, {}, mode),
30
+ plugins: await ViteValaxyPlugins(options, serverOptions, {}),
29
31
 
30
32
  server: {
31
33
  fs: {
@@ -37,16 +39,6 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
37
39
  ],
38
40
  },
39
41
  },
40
-
41
- }
42
-
43
- if (mode === 'build') {
44
- // https://github.com/antfu/vite-ssg
45
- viteConfig.ssgOptions = {
46
- script: 'async',
47
- formatting: 'minify',
48
- onFinished() { generateSitemap() },
49
- }
50
42
  }
51
43
 
52
44
  return viteConfig
@@ -27,8 +27,8 @@ export interface ValaxyConfig<T = ValaxyThemeConfig> {
27
27
  */
28
28
  lang: string
29
29
  /**
30
- * You site url in web, required for ssg, do not add / in end
31
- * @description 站点的 URL,SSG 需要(譬如生成版权处文章永久链接),不要在末尾添加 /
30
+ * You site url in web, required for ssg & rss
31
+ * @description 站点的 URL,SSG & RSS 需要(譬如生成版权处文章永久链接)
32
32
  */
33
33
  url: string
34
34
  /**
@@ -54,6 +54,8 @@ export interface ValaxyConfig<T = ValaxyThemeConfig> {
54
54
  * @description 你的名字
55
55
  */
56
56
  name: string
57
+ email: string
58
+ link: string
57
59
  avatar: string
58
60
  /**
59
61
  * The status of you
@@ -69,6 +71,15 @@ export interface ValaxyConfig<T = ValaxyThemeConfig> {
69
71
  }
70
72
  }
71
73
 
74
+ feed: {
75
+ /**
76
+ * name: feed -> feed.xml / feed.atom / feed.json
77
+ * @default '' -> feed.xml / atom.xml / feed.json
78
+ */
79
+ name: string
80
+ favicon: string
81
+ }
82
+
72
83
  /**
73
84
  * 社交链接
74
85
  */
@@ -95,6 +106,10 @@ export interface ValaxyConfig<T = ValaxyThemeConfig> {
95
106
  enable: boolean
96
107
  serverURL: string
97
108
  }
109
+ twikoo: {
110
+ enable: boolean
111
+ envId: string
112
+ }
98
113
  }
99
114
 
100
115
  /**
@@ -175,12 +190,18 @@ export const defaultValaxyConfig: ValaxyConfig = {
175
190
  subtitle: 'Next Generation Static Blog Framework.',
176
191
  author: {
177
192
  avatar: 'https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-with-bg.jpg',
193
+ email: 'me@yunyoujun.cn',
194
+ link: 'https://www.yunyoujun.cn',
178
195
  name: 'YunYouJun',
179
196
  status: {
180
197
  emoji: '😊',
181
198
  message: 'All at sea.',
182
199
  },
183
200
  },
201
+ feed: {
202
+ name: '',
203
+ favicon: 'favicon.png',
204
+ },
184
205
  social: [],
185
206
  description: 'A blog generated by Valaxy.',
186
207
 
@@ -231,6 +252,10 @@ export const defaultValaxyConfig: ValaxyConfig = {
231
252
  enable: false,
232
253
  serverURL: '',
233
254
  },
255
+ twikoo: {
256
+ enable: false,
257
+ envId: 'https://twikoo.vercel.app',
258
+ },
234
259
  },
235
260
 
236
261
  theme: 'yun',
package/tsup.config.ts CHANGED
@@ -5,6 +5,7 @@ export default defineConfig((options) => {
5
5
  entry: [
6
6
  'src/node/index.ts',
7
7
  'src/node/cli.ts',
8
+ 'src/index.ts',
8
9
  ],
9
10
  // https://tsup.egoist.sh/#code-splitting
10
11
  // 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.
@@ -1 +0,0 @@
1
- import{d as i,j as o}from"./chunk-5S6S3FLN.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 _chunkTOMJSB6Rjs = require('./chunk-TOMJSB6R.js');_chunkTOMJSB6Rjs.d.call(void 0, );var _vite = require('vite');async function a(n,e={}){let t=_vite.mergeConfig.call(void 0, e,_chunkTOMJSB6Rjs.j.call(void 0, n));await _vite.build.call(void 0, t)}exports.build = a;