valaxy 0.9.2 → 0.10.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.
@@ -1,16 +1,23 @@
1
1
  import { ViteSSGOptions } from 'vite-ssg';
2
+ import * as vite from 'vite';
3
+ import { UserConfig as UserConfig$1, InlineConfig } from 'vite';
4
+ import { D as DefaultThemeConfig, U as UserSiteConfig, P as PartialDeep, S as SiteConfig } from '../config-1d500fb4.js';
2
5
  import Vue from '@vitejs/plugin-vue';
3
6
  import Components from 'unplugin-vue-components/vite';
4
7
  import { VitePluginConfig } from 'unocss/vite';
5
8
  import Pages from 'vite-plugin-pages';
6
- import * as vite from 'vite';
7
- import { UserConfig, InlineConfig } from 'vite';
8
9
  import { presetUno, presetAttributify, presetIcons, presetTypography } from 'unocss';
9
- import { V as ValaxyConfig, U as UserConfig$1, P as PartialDeep, a as ValaxyThemeConfig } from '../config-1d2e9ebd.js';
10
10
  import MarkdownIt from 'markdown-it';
11
11
  import { Theme } from 'shiki';
12
12
  import Anchor from 'markdown-it-anchor';
13
13
  import { KatexOptions } from 'katex';
14
+ import { Awaitable } from '@antfu/utils';
15
+
16
+ declare module 'vite' {
17
+ interface UserConfig {
18
+ ssgOptions?: ViteSSGOptions;
19
+ }
20
+ }
14
21
 
15
22
  interface BlockItem {
16
23
  text?: string;
@@ -62,14 +69,10 @@ interface MarkdownOptions {
62
69
  blocks?: Blocks;
63
70
  }
64
71
 
65
- interface ValaxyEntryOptions {
66
- /**
67
- * theme name
68
- */
69
- theme?: string;
70
- userRoot?: string;
71
- }
72
- interface ValaxyPluginOptions {
72
+ declare type ValaxyConfig<ThemeConfig = DefaultThemeConfig> = UserSiteConfig<ThemeConfig> & ValaxyExtendConfig;
73
+ declare type UserConfig<ThemeConfig = DefaultThemeConfig> = ValaxyConfig<ThemeConfig>;
74
+ interface ValaxyExtendConfig {
75
+ vite?: UserConfig$1;
73
76
  vue?: Parameters<typeof Vue>[0];
74
77
  components?: Parameters<typeof Components>[0];
75
78
  unocss?: VitePluginConfig;
@@ -93,11 +96,33 @@ interface ValaxyPluginOptions {
93
96
  excerpt?: string;
94
97
  path: string;
95
98
  }) => void;
99
+ addons?: ValaxyAddonOptions;
100
+ }
101
+ interface ValaxyAddon {
102
+ global?: boolean;
103
+ props?: Record<string, any>;
104
+ options?: Record<string, any>;
96
105
  }
97
- interface ValaxyThemePlugin extends ValaxyPluginOptions {
98
- vite?: Omit<UserConfig, 'valaxy'>;
106
+ declare type ValaxyAddonLike = ValaxyAddon | false | null | undefined;
107
+ declare type ValaxyAddonOptions = ([string, ValaxyAddonLike] | string)[] | Record<string, ValaxyAddonLike>;
108
+ interface ValaxyAddonResolver {
109
+ name: string;
110
+ root: string;
111
+ enable: boolean;
112
+ global: boolean;
113
+ props: Record<string, any>;
114
+ options: Record<string, any>;
115
+ configFile?: string;
99
116
  }
100
- interface ResolvedValaxyOptions {
117
+
118
+ interface ValaxyEntryOptions {
119
+ /**
120
+ * theme name
121
+ */
122
+ theme?: string;
123
+ userRoot?: string;
124
+ }
125
+ interface ResolvedValaxyOptions<ThemeConfig = DefaultThemeConfig> {
101
126
  mode: 'dev' | 'build';
102
127
  /**
103
128
  * package.json root
@@ -117,6 +142,10 @@ interface ResolvedValaxyOptions {
117
142
  * Theme root path
118
143
  */
119
144
  themeRoot: string;
145
+ /**
146
+ * Addon root path
147
+ */
148
+ addonRoots: string[];
120
149
  /**
121
150
  * Theme name
122
151
  */
@@ -125,55 +154,52 @@ interface ResolvedValaxyOptions {
125
154
  /**
126
155
  * Valaxy Config
127
156
  */
128
- config: ValaxyConfig;
157
+ config: ValaxyConfig<ThemeConfig>;
129
158
  /**
130
159
  * config file path
131
160
  */
132
161
  configFile: string;
133
162
  pages: string[];
163
+ /**
164
+ * all addons
165
+ * Record<package-name, OptionResolver>
166
+ */
167
+ addons: ValaxyAddonResolver[];
134
168
  }
135
169
  interface ValaxyServerOptions {
136
170
  onConfigReload?: (newConfig: ValaxyConfig, config: ValaxyConfig, force?: boolean) => void;
137
171
  }
138
- declare function isPath(name: string): boolean;
139
- /**
140
- * get theme roots
141
- * @param name
142
- * @param entry
143
- * @returns
144
- */
145
- declare function getThemeRoot(name: string, entry: string): string;
146
- declare function resolveOptions(options: ValaxyEntryOptions, mode?: ResolvedValaxyOptions['mode']): Promise<ResolvedValaxyOptions>;
172
+ declare function resolveOptions(options: ValaxyEntryOptions, mode?: ResolvedValaxyOptions['mode']): Promise<ResolvedValaxyOptions<DefaultThemeConfig>>;
147
173
 
148
- declare module 'vite' {
149
- interface UserConfig {
150
- /**
151
- * Custom internal plugin options for Valaxy (advanced)
152
- *
153
- * @see ./options.ts'
154
- */
155
- valaxy?: ValaxyPluginOptions;
156
- ssgOptions?: ViteSSGOptions;
157
- }
158
- }
174
+ declare function mergeViteConfigs({ userRoot, themeRoot }: ResolvedValaxyOptions, command: 'serve' | 'build'): Promise<InlineConfig>;
175
+ declare function getIndexHtml({ clientRoot, themeRoot, userRoot, config }: ResolvedValaxyOptions): Promise<string>;
176
+
177
+ declare function build(options: ResolvedValaxyOptions, viteConfig?: InlineConfig): Promise<void>;
178
+ declare function ssgBuild(options: ResolvedValaxyOptions, viteConfig?: InlineConfig): Promise<void>;
159
179
 
160
180
  /**
161
- * Type config helper
181
+ * Type site helper
162
182
  */
163
- declare function defineConfig<ThemeConfig>(config: UserConfig$1<ThemeConfig>): PartialDeep<ValaxyConfig<ThemeConfig>>;
183
+ declare function defineSite<ThemeConfig>(config: UserSiteConfig<ThemeConfig>): PartialDeep<SiteConfig<ThemeConfig>>;
164
184
  /**
165
- * Type config helper for custom theme config
185
+ * Type site helper for custom theme site
166
186
  */
167
- declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig$1<ThemeConfig>): PartialDeep<ValaxyConfig<ThemeConfig>>;
168
- declare function resolveConfig(options?: ValaxyEntryOptions): Promise<{
169
- config: ValaxyConfig<ValaxyThemeConfig>;
170
- configFile: string;
171
- theme: string;
172
- }>;
173
- declare type ThemeConfigExport = ValaxyThemePlugin | Promise<ValaxyThemePlugin> | ThemeConfigFn;
174
- declare type ThemeConfigFn = (options: ResolvedValaxyOptions) => ValaxyThemePlugin | Promise<ValaxyThemePlugin>;
175
- declare function defineThemePlugin(config: ThemeConfigExport): ThemeConfigExport;
187
+ declare function defineSiteWithTheme<ThemeConfig>(config: UserSiteConfig<ThemeConfig>): PartialDeep<SiteConfig<ThemeConfig>>;
188
+ /**
189
+ * Type valaxy config helper
190
+ */
191
+ declare function defineConfig<ThemeConfig>(config: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
192
+ declare type ValaxyConfigExtendKey = 'vite' | 'vue' | 'unocss' | 'unocssPresets' | 'markdown' | 'extendMd';
193
+ declare type ValaxyPickConfig = Pick<ValaxyConfig, ValaxyConfigExtendKey>;
194
+ declare type ValaxyTheme<ThemeConfig = DefaultThemeConfig> = ValaxyPickConfig & {
195
+ themeConfig?: ThemeConfig;
196
+ };
197
+ declare function defineTheme<ThemeConfig = DefaultThemeConfig>(theme: ValaxyTheme<ThemeConfig> | ((options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyTheme<ThemeConfig>)): ValaxyTheme<ThemeConfig> | ((options: ResolvedValaxyOptions<ThemeConfig>) => ValaxyTheme<ThemeConfig>);
198
+ declare function defineAddon(addon: ValaxyPickConfig | ((addonOptions: ValaxyAddonResolver, valaxyOptions: ResolvedValaxyOptions) => ValaxyPickConfig)): ValaxyPickConfig | ((addonOptions: ValaxyAddonResolver, valaxyOptions: ResolvedValaxyOptions) => ValaxyPickConfig);
199
+ declare const defaultSiteConfig: SiteConfig;
200
+ declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
201
+ declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
176
202
 
177
203
  declare function createServer(options: ResolvedValaxyOptions, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<vite.ViteDevServer>;
178
204
 
179
- export { ResolvedValaxyOptions, ThemeConfigExport, ThemeConfigFn, ValaxyEntryOptions, ValaxyPluginOptions, ValaxyServerOptions, ValaxyThemePlugin, createServer, defineConfig, defineConfigWithTheme, defineThemePlugin, getThemeRoot, isPath, resolveConfig, resolveOptions };
205
+ export { ResolvedValaxyOptions, UnoSetup, ValaxyConfigExtendKey, ValaxyEntryOptions, ValaxyPickConfig, ValaxyServerOptions, ValaxyTheme, build, createServer, defaultSiteConfig, defineAddon, defineConfig, defineSite, defineSiteWithTheme, defineTheme, defineUnoSetup, getIndexHtml, mergeViteConfigs, resolveOptions, ssgBuild };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV4YNXOMIjs = require('../chunk-V4YNXOMI.js');require('../chunk-KRHFRLOW.js');exports.createServer = _chunkV4YNXOMIjs.p; exports.defineConfig = _chunkV4YNXOMIjs.b; exports.defineConfigWithTheme = _chunkV4YNXOMIjs.c; exports.defineThemePlugin = _chunkV4YNXOMIjs.e; exports.getThemeRoot = _chunkV4YNXOMIjs.i; exports.isPath = _chunkV4YNXOMIjs.h; exports.resolveConfig = _chunkV4YNXOMIjs.d; exports.resolveOptions = _chunkV4YNXOMIjs.j;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZTROIOLHjs = require('../chunk-ZTROIOLH.js');exports.build = _chunkZTROIOLHjs.q; exports.createServer = _chunkZTROIOLHjs.s; exports.defaultSiteConfig = _chunkZTROIOLHjs.n; exports.defineAddon = _chunkZTROIOLHjs.m; exports.defineConfig = _chunkZTROIOLHjs.k; exports.defineSite = _chunkZTROIOLHjs.i; exports.defineSiteWithTheme = _chunkZTROIOLHjs.j; exports.defineTheme = _chunkZTROIOLHjs.l; exports.defineUnoSetup = _chunkZTROIOLHjs.o; exports.getIndexHtml = _chunkZTROIOLHjs.f; exports.mergeViteConfigs = _chunkZTROIOLHjs.e; exports.resolveOptions = _chunkZTROIOLHjs.p; exports.ssgBuild = _chunkZTROIOLHjs.r;
@@ -1 +1 @@
1
- import{b as o,c as r,d as m,e as p,h as t,i as e,j as f,p as x}from"../chunk-LHTMHTJP.mjs";import"../chunk-B2L4QLCB.mjs";export{x as createServer,o as defineConfig,r as defineConfigWithTheme,p as defineThemePlugin,e as getThemeRoot,t as isPath,m as resolveConfig,f as resolveOptions};
1
+ import{e as o,f as r,i as m,j as p,k as t,l as e,m as f,n as x,o as i,p as a,q as b,r as c,s as d}from"../chunk-LPNZDKS7.mjs";export{b as build,d as createServer,x as defaultSiteConfig,f as defineAddon,t as defineConfig,m as defineSite,p as defineSiteWithTheme,e as defineTheme,i as defineUnoSetup,r as getIndexHtml,o as mergeViteConfigs,a as resolveOptions,c as ssgBuild};
@@ -1,6 +1,4 @@
1
- export { A as AlgoliaSearchOptions, P as PartialDeep, S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig } from '../config-1d2e9ebd.js';
2
- import { VitePluginConfig } from 'unocss/vite';
3
- import { Awaitable } from '@antfu/utils';
1
+ export { A as AlgoliaSearchOptions, D as DefaultThemeConfig, P as PartialDeep, S as SiteConfig, a as SocialLink, U as UserSiteConfig } from '../config-1d500fb4.js';
4
2
 
5
3
  interface Post extends Record<string, any> {
6
4
  /**
@@ -153,7 +151,4 @@ interface PageDataPayload {
153
151
  }
154
152
  declare type HeadConfig = [string, Record<string, string>] | [string, Record<string, string>, string];
155
153
 
156
- declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
157
- declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
158
-
159
- export { HeadConfig, Header, PageData, PageDataPayload, Post, UnoSetup, defineUnoSetup };
154
+ export { HeadConfig, Header, PageData, PageDataPayload, Post };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-KRHFRLOW.js');function t(o){return o}exports.defineUnoSetup = t;
1
+ "use strict";
@@ -1 +0,0 @@
1
- import"../chunk-B2L4QLCB.mjs";function t(o){return o}export{t as defineUnoSetup};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy",
3
- "version": "0.9.2",
3
+ "version": "0.10.1",
4
4
  "description": "📄 Vite & Vue powered static blog generator.",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
@@ -57,14 +57,14 @@
57
57
  "@ctrl/tinycolor": "^3.4.1",
58
58
  "@iconify-json/carbon": "^1.1.6",
59
59
  "@iconify-json/ri": "^1.1.3",
60
- "@intlify/vite-plugin-vue-i18n": "^3.4.0",
60
+ "@intlify/vite-plugin-vue-i18n": "^5.0.0",
61
61
  "@vitejs/plugin-vue": "^2.3.3",
62
- "@vueuse/core": "^8.9.2",
62
+ "@vueuse/core": "^8.9.4",
63
63
  "@vueuse/head": "^0.7.6",
64
64
  "consola": "^2.15.3",
65
65
  "critters": "^0.0.16",
66
66
  "cross-spawn": "^7.0.3",
67
- "dayjs": "^1.11.3",
67
+ "dayjs": "^1.11.4",
68
68
  "ejs": "^3.1.8",
69
69
  "escape-html": "^1.0.3",
70
70
  "feed": "^4.2.2",
@@ -73,7 +73,7 @@
73
73
  "is-installed-globally": "^0.4.0",
74
74
  "katex": "^0.16.0",
75
75
  "kolorist": "^1.5.1",
76
- "lru-cache": "^7.13.0",
76
+ "lru-cache": "^7.13.1",
77
77
  "markdown-it": "^13.0.1",
78
78
  "markdown-it-anchor": "^8.6.4",
79
79
  "markdown-it-attrs": "^4.1.4",
@@ -84,12 +84,13 @@
84
84
  "markdown-it-task-lists": "^2.1.1",
85
85
  "nprogress": "^0.2.0",
86
86
  "open": "^8.4.0",
87
+ "pascal-case": "^3.1.2",
87
88
  "pinia": "^2.0.16",
88
89
  "sass": "^1.53.0",
89
90
  "shiki": "^0.10.1",
90
91
  "star-markdown-css": "^0.4.0",
91
92
  "unconfig": "^0.3.5",
92
- "unocss": "^0.44.2",
93
+ "unocss": "^0.44.5",
93
94
  "unplugin-vue-components": "^0.21.1",
94
95
  "vite": "^2.9.14",
95
96
  "vite-plugin-pages": "^0.25.0",
package/types/config.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type ValaxyThemeConfig = Record<string, any>
1
+ export type DefaultThemeConfig = Record<string, any>
2
2
 
3
3
  export interface SocialLink {
4
4
  /**
@@ -25,8 +25,8 @@ export interface AlgoliaSearchOptions {
25
25
  initialQuery?: string
26
26
  }
27
27
 
28
- // packages/valaxy/node/config.ts
29
- export interface ValaxyConfig<T = ValaxyThemeConfig> {
28
+ // shared with valaxy node and client
29
+ export interface SiteConfig<T = DefaultThemeConfig> {
30
30
  /**
31
31
  * enable auto (light/dark mode)
32
32
  * @default 'auto'
@@ -226,5 +226,4 @@ export type PartialDeep<T> = {
226
226
  * Valaxy User Config
227
227
  * @description Valaxy 用户配置
228
228
  */
229
- export type UserConfig<ThemeConfig = ValaxyThemeConfig> = PartialDeep<ValaxyConfig<ThemeConfig>>
230
-
229
+ export type UserSiteConfig<ThemeConfig = DefaultThemeConfig> = PartialDeep<SiteConfig<ThemeConfig>>
package/types/index.ts CHANGED
@@ -1,4 +1,4 @@
1
+ // do not export node type here
1
2
  export * from './config'
2
3
  export * from './data'
3
4
  export * from './posts'
4
- export * from './setups'
@@ -1 +0,0 @@
1
- var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));exports.a = m; exports.b = n; exports.c = o;
package/types/setups.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { VitePluginConfig as UnoCssConfig } from 'unocss/vite'
2
- import type { Awaitable } from '@antfu/utils'
3
-
4
- export type UnoSetup = () => Awaitable<Partial<UnoCssConfig> | undefined>
5
-
6
- export function defineUnoSetup(fn: UnoSetup) {
7
- return fn
8
- }