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
@@ -0,0 +1 @@
1
+ var p=Object.create;var i=Object.defineProperty,m=Object.defineProperties,c=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?i(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,x=(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=(e,n)=>m(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 h=(e,n)=>()=>(e&&(n=e(e=0)),n);var C=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var f=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of u(n))!g.call(e,a)&&a!==t&&i(e,a,{get:()=>n[a],enumerable:!(r=c(n,a))||r.enumerable});return e};var V=(e,n,t)=>(t=e!=null?p(y(e)):{},f(n||!e||!e.__esModule?i(t,"default",{value:e,enumerable:!0}):t,e));var o=h(()=>{});o();var j={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();export{x as a,k as b,w as c,C as d,V as e,o as f,j as g};
@@ -0,0 +1,350 @@
1
+ import * as vue from 'vue';
2
+ import { InjectionKey, ComputedRef, StyleValue, Ref } from 'vue';
3
+ import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-d6527c8c.js';
4
+ export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-d6527c8c.js';
5
+ import 'type-fest';
6
+ import 'unocss/vite';
7
+ import 'markdown-it';
8
+ import 'markdown-it-anchor';
9
+ import 'katex';
10
+ import 'vite-plugin-md';
11
+
12
+ interface Post {
13
+ /**
14
+ * Path of post
15
+ * route.path
16
+ * @description 路径
17
+ */
18
+ path?: string;
19
+ /**
20
+ * Title
21
+ * @description 文章标题
22
+ */
23
+ title?: string;
24
+ date?: string | number | Date;
25
+ /**
26
+ * Updated Time
27
+ */
28
+ updated?: string | number | Date;
29
+ lang?: string;
30
+ /**
31
+ * TODO
32
+ * Read Time
33
+ * @description 阅读时长
34
+ */
35
+ duration?: string;
36
+ /**
37
+ * post card type, can be bilibili/yuque/...
38
+ */
39
+ type?: string;
40
+ /**
41
+ * override url, and jump directly
42
+ */
43
+ url?: string;
44
+ /**
45
+ * @description 摘要
46
+ */
47
+ excerpt?: string;
48
+ /**
49
+ * Display sponsor info
50
+ * @description 是否开启赞助
51
+ */
52
+ sponsor?: boolean;
53
+ /**
54
+ * Copyright
55
+ * @description 是否显示文章底部版权信息
56
+ */
57
+ copyright?: boolean;
58
+ /**
59
+ * Category
60
+ * @description 分类,若为数组,则按顺序代表多层文件夹
61
+ */
62
+ categories?: string | string[];
63
+ /**
64
+ * Tags
65
+ * @description 标签,可以有多个
66
+ */
67
+ tags?: string[];
68
+ /**
69
+ * display prev next
70
+ * @description 是否显示前一篇、后一篇导航
71
+ */
72
+ nav?: boolean;
73
+ /**
74
+ * icon before title
75
+ */
76
+ icon?: string;
77
+ /**
78
+ * title color
79
+ */
80
+ color?: string;
81
+ /**
82
+ * display comment
83
+ */
84
+ comment?: boolean;
85
+ /**
86
+ * post is end
87
+ * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
88
+ */
89
+ end?: boolean;
90
+ /**
91
+ * use aplayer
92
+ */
93
+ aplayer?: boolean;
94
+ /**
95
+ * use katex
96
+ */
97
+ katex?: boolean;
98
+ /**
99
+ * use codepen
100
+ */
101
+ codepen?: boolean;
102
+ /**
103
+ * 置顶
104
+ */
105
+ top?: number;
106
+ /**
107
+ * display toc
108
+ * @description 是否显示目录
109
+ */
110
+ toc?: boolean;
111
+ }
112
+
113
+ /**
114
+ * Theme Config
115
+ */
116
+ interface ThemeConfig {
117
+ /**
118
+ * 首页标语
119
+ */
120
+ banner: {
121
+ enable: boolean;
122
+ /**
123
+ * 标题
124
+ */
125
+ title: string;
126
+ };
127
+ bg_image: {
128
+ enable: boolean;
129
+ url: string;
130
+ dark?: string;
131
+ opacity: number;
132
+ };
133
+ /**
134
+ * say something
135
+ * https://say.elpsy.cn
136
+ */
137
+ say: {
138
+ enable: boolean;
139
+ api: string;
140
+ hitokoto: {
141
+ enable: boolean;
142
+ api: string;
143
+ };
144
+ };
145
+ pages: {
146
+ name: string;
147
+ url: string;
148
+ icon: string;
149
+ color: string;
150
+ }[];
151
+ /**
152
+ * footer
153
+ */
154
+ footer: {
155
+ /**
156
+ * 建站于
157
+ */
158
+ since: number;
159
+ /**
160
+ * Icon between year and copyright info.
161
+ */
162
+ icon: {
163
+ /**
164
+ * icon name, i-xxx
165
+ */
166
+ name: string;
167
+ animated: boolean;
168
+ color: string;
169
+ url: string;
170
+ title: string;
171
+ };
172
+ /**
173
+ * Powered by valaxy & valaxy-theme-${name}, default is yun
174
+ */
175
+ powered: boolean;
176
+ /**
177
+ * Chinese Users | 中国用户
178
+ * 备案 ICP
179
+ * 国内用户需要在网站页脚展示备案 ICP 号
180
+ * https://beian.miit.gov.cn/
181
+ */
182
+ beian: {
183
+ enable: boolean;
184
+ /**
185
+ * 苏ICP备xxxxxxxx号
186
+ */
187
+ icp: string;
188
+ };
189
+ };
190
+ /**
191
+ * post card types
192
+ */
193
+ types: Record<string, {
194
+ color: string;
195
+ icon: string;
196
+ }>;
197
+ }
198
+
199
+ declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
200
+ declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
201
+ declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
202
+ declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
203
+ /**
204
+ * getThemeConfig
205
+ * @returns
206
+ */
207
+ declare function useThemeConfig(): ComputedRef<ThemeConfig>;
208
+
209
+ interface ParentCategory {
210
+ total: number;
211
+ children: Categories;
212
+ }
213
+ interface PostCategory {
214
+ total: number;
215
+ posts: Post[];
216
+ }
217
+ declare type Category = ParentCategory | PostCategory;
218
+ declare type Categories = Map<string, Category>;
219
+ /**
220
+ * get categories from posts
221
+ * @returns
222
+ */
223
+ declare function useCategory(): ParentCategory;
224
+
225
+ /**
226
+ * get post list
227
+ * todo: use vue provide/inject to global
228
+ * @param params
229
+ * @returns
230
+ */
231
+ declare function usePostList(params?: {
232
+ type?: string;
233
+ }): vue.ComputedRef<Post[]>;
234
+ /**
235
+ * get prev and next post
236
+ * @param path
237
+ * @returns
238
+ */
239
+ declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
240
+ /**
241
+ * get type card property
242
+ * todo: test reactive
243
+ */
244
+ declare function usePostProperty(type?: string): {
245
+ color: string;
246
+ icon: string;
247
+ styles: {};
248
+ } | {
249
+ color: string;
250
+ icon: string;
251
+ styles: vue.ComputedRef<StyleValue>;
252
+ };
253
+
254
+ declare type Tags = Map<string, {
255
+ count: number;
256
+ }>;
257
+ /**
258
+ * get utils about tags
259
+ */
260
+ declare function useTags(): {
261
+ tags: Tags;
262
+ getTagStyle: (count: number) => {
263
+ '--yun-tag-color': string;
264
+ fontSize: string;
265
+ };
266
+ };
267
+ /**
268
+ * get tag map
269
+ * @returns
270
+ */
271
+ declare function useTag(): Tags;
272
+
273
+ declare function useFrontmatter(): vue.ComputedRef<Post>;
274
+ /**
275
+ * get full url
276
+ */
277
+ declare function useFullUrl(): vue.ComputedRef<string>;
278
+
279
+ /**
280
+ * use katex css cdn
281
+ */
282
+ declare function useKatex(): void;
283
+
284
+ /**
285
+ * trigger show invisible element
286
+ * @param target
287
+ * @returns
288
+ */
289
+ declare function useInvisibleElement(target: Ref<HTMLElement>): {
290
+ show: () => void;
291
+ };
292
+
293
+ declare const isDark: vue.WritableComputedRef<boolean>;
294
+ declare const toggleDark: (value?: boolean | undefined) => boolean;
295
+
296
+ declare function useLayout(layout: string): vue.ComputedRef<boolean>;
297
+
298
+ /**
299
+ * use MetingJS and Aplayer
300
+ * https://github.com/MoePlayer/APlayer
301
+ * https://github.com/metowolf/MetingJS
302
+ */
303
+ declare function useAplayer(): void;
304
+
305
+ /**
306
+ * You can use href="#" to back to top
307
+ * @description 你可以使用它来编写自己的 backToTop
308
+ */
309
+ declare function useBackToTop(options?: {
310
+ /**
311
+ * show backToTop button, when height > offset
312
+ */
313
+ offset: number;
314
+ }): {
315
+ percentage: vue.ComputedRef<number>;
316
+ show: vue.ComputedRef<boolean>;
317
+ };
318
+
319
+ declare function useCodePen(): void;
320
+
321
+ declare function useActiveSidebarLinks(): void;
322
+
323
+ declare function useWaline(options?: {}): void;
324
+
325
+ /**
326
+ * 生成介于 min 与 max 之间的随机数
327
+ * @returns
328
+ */
329
+ declare function random(min: number, max: number): number;
330
+ /**
331
+ * wrap node
332
+ * @param className
333
+ */
334
+ declare function wrap(el: HTMLElement, className: string): void;
335
+ /**
336
+ * 包裹表格,添加 class 以控制 table 样式
337
+ */
338
+ declare const wrapTable: (container?: HTMLElement | Document) => void;
339
+
340
+ declare function formatDate(date: string | number | Date, template?: string): string;
341
+ /**
342
+ * sort posts by date
343
+ * @param posts
344
+ * @param desc
345
+ */
346
+ declare function sortByDate(posts: Post[], desc?: boolean): Post[];
347
+
348
+ declare const isDev: boolean;
349
+
350
+ export { Categories, Category, ParentCategory, Post, PostCategory, Tags, formatDate, initConfig, isDark, isDev, random, sortByDate, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useKatex, useLayout, usePostList, usePostProperty, usePrevNext, useTag, useTags, useThemeConfig, useWaline, valaxyConfigRef, valaxyConfigSymbol, wrap, wrapTable };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk44DGW27Sjs = require('./chunk-44DGW27S.js');_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _vue = require('vue');function w(t){let e=JSON.parse(t);return import.meta.env.DEV?_vue.readonly.call(void 0, e):e}var U=Symbol("valaxy:config"),T= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, w(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=w(t.default)});function ht(){return _vue.computed.call(void 0, ()=>T.value)}function g(){let t=_vue.inject.call(void 0, U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function b(){let t=g();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );var _vuerouter = require('vue-router');_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );function yt(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var xt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};_chunk44DGW27Sjs.f.call(void 0, );var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function wt(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function y(t,e=!0){return t.sort((o,s)=>{let i=+new Date(o.date||""),n=+new Date(s.date||"");return e?n-i:i-n})}var L=import.meta.env.DEV===!0;function h(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(n=>n.path.startsWith("/posts")&&n.meta.frontmatter&&n.meta.frontmatter.date).filter(n=>!n.path.endsWith(".html")).filter(n=>!t.type||n.meta.frontmatter.type===t.type).map(n=>Object.assign({path:n.path,excerpt:n.meta.excerpt},n.meta.frontmatter)),s=y(o.filter(n=>n.top)).sort((n,a)=>a.top-n.top),i=y(o.filter(n=>!n.top));return s.concat(i)})}function St(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),s=h(),i=_vue.computed.call(void 0, ()=>{let c=-1;return s.value.find((u,m)=>u.path===o.value?(c=m,!0):!1),c}),n=_vue.computed.call(void 0, ()=>i.value-1>=0?s.value[i.value-1]:null),a=_vue.computed.call(void 0, ()=>i.value+1<s.value.length?s.value[i.value+1]:null);return[n,a]}function kt(t){if(!t)return{color:"",icon:"",styles:{}};let e=b();t in e.value.types||(t="link");let o=e.value.types[t].color,s=e.value.types[t].icon,i=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:s,styles:i}}function Rt(){var s;let t=h(),e={total:t.value.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},o=e.children.get("Uncategorized");return t.value.forEach(i=>{if(i.categories)if(Array.isArray(i.categories)){let n=i.categories.length,a=e;i.categories.forEach((c,u)=>{var m,d,p;if(u===n-1)if(a.children.has(c)){let l=a.children.get(c);l.posts&&(l.total+=1,l.posts.push(i))}else(m=a.children)==null||m.set(c,{total:1,posts:[i]});else if((d=a.children)!=null&&d.has(c)){let l=a.children.get(c);l.total+=1,a=l}else{let l={total:1,children:new Map};(p=a.children)==null||p.set(c,l),a=l}})}else{let n=i.categories;if(e.children.has(n)){let a=e.children.get(n);a.total+=1,a.posts.push(i)}else e.children.set(n,{total:1,posts:[i]})}else o.total+=1,o.posts.push(i)}),o.total===0&&((s=e.children)==null||s.delete("Uncategorized")),e}_chunk44DGW27Sjs.f.call(void 0, );var _tinycolor = require('@ctrl/tinycolor');function It(){let t=W(),e=new (0, _tinycolor.TinyColor)("#999999"),o=new (0, _tinycolor.TinyColor)(getComputedStyle(document.documentElement).getPropertyValue("--yun-c-primary"));return{tags:t,getTagStyle:i=>{let n=Array.from(t).map(([d,p])=>p.count),a=Math.max(...n),c=Math.min(...n),u=a-c,m=(i-c)/u;return{"--yun-tag-color":e.mix(o,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){let t=h(),e=new Map;return t.value.forEach(o=>{if(o.tags){let s;typeof o.tags=="string"?s=[o.tags]:s=o.tags,s.forEach(i=>{if(e.has(i)){let n=e.get(i);e.set(i,_chunk44DGW27Sjs.b.call(void 0, _chunk44DGW27Sjs.a.call(void 0, {},n),{count:n.count+1}))}else e.set(i,{count:1})})}}),e}_chunk44DGW27Sjs.f.call(void 0, );function Yt(){let t=_vuerouter.useRoute.call(void 0, ),e=_vue.computed.call(void 0, ()=>t.meta.frontmatter);return L&&console.log(e.value),e}function Kt(){let t=g(),e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>(t.value.url||(window==null?void 0:window.location.origin))+e.path)}_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );var _head = require('@vueuse/head');function Jt(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}_chunk44DGW27Sjs.f.call(void 0, );var _core = require('@vueuse/core');function te(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}_chunk44DGW27Sjs.f.call(void 0, );var J=_core.useDark.call(void 0, ),re= exports.toggleDark =_core.useToggle.call(void 0, J);_chunk44DGW27Sjs.f.call(void 0, );function ae(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );function me(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}_chunk44DGW27Sjs.f.call(void 0, );function he(t={offset:100}){let{y:e}=_core.useWindowScroll.call(void 0, ),o=_vue.computed.call(void 0, ()=>e.value/document.body.clientHeight),s=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:s}}_chunk44DGW27Sjs.f.call(void 0, );function xe(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}_chunk44DGW27Sjs.f.call(void 0, );function Ee(){let t=null,e=null,o=it(s,200);function s(){let a=rt(),c=nt(a);for(let u=0;u<c.length;u++){let m=c[u],d=c[u+1],[p,l]=st(u,m,d);if(p){history.replaceState(null,document.title,l||" "),i(l);return}}}function i(a){if(n(e),n(t),e=document.querySelector(`.val-toc a[href="${a}"]`),!e)return;e.classList.add("active");let c=e.closest(".right-sidebar-container > ul > li");c&&c!==e.parentElement?(t=c.querySelector("a"),t&&t.classList.add("active")):t=null}function n(a){a&&a.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{s(),window.addEventListener("scroll",o)}),_vue.onUpdated.call(void 0, ()=>{i(decodeURIComponent(location.hash))}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function rt(){return[].slice.call(document.querySelectorAll(".val-toc a.toc-link-item"))}function nt(t){return[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>t.some(o=>o.hash===e.hash))}function S(t){return t.parentElement.offsetTop-50}function st(t,e,o){let s=window.scrollY;return t===0&&s===0?[!0,null]:s<S(e)?[!1,null]:!o||s<S(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function it(t,e){let o,s=!1;return()=>{o&&clearTimeout(o),s?o=setTimeout(t,e):(t(),s=!0,setTimeout(()=>{s=!1},e))}}_chunk44DGW27Sjs.f.call(void 0, );_chunk44DGW27Sjs.f.call(void 0, );var _vuei18n = require('vue-i18n');function ke(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),s;function i(n={}){if(!_core.isClient)return;let a={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},c=Object.assign(a,n);return window.Waline(c)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client",()=>{s=i(t)}),_vue.watch.call(void 0, ()=>e.path,n=>{!s||s.update({path:n})}),_vue.watch.call(void 0, o,n=>{!s||s.update({lang:n})}),_vue.onUnmounted.call(void 0, ()=>{!s||s.destroy()})}exports.defaultValaxyConfig = _chunk44DGW27Sjs.g; exports.formatDate = wt; exports.initConfig = ht; exports.isDark = J; exports.isDev = L; exports.random = yt; exports.sortByDate = y; exports.toggleDark = re; exports.useActiveSidebarLinks = Ee; exports.useAplayer = me; exports.useBackToTop = he; exports.useCategory = Rt; exports.useCodePen = xe; exports.useConfig = g; exports.useFrontmatter = Yt; exports.useFullUrl = Kt; exports.useInvisibleElement = te; exports.useKatex = Jt; exports.useLayout = ae; exports.usePostList = h; exports.usePostProperty = kt; exports.usePrevNext = St; exports.useTag = W; exports.useTags = It; exports.useThemeConfig = b; exports.useWaline = ke; exports.valaxyConfigRef = T; exports.valaxyConfigSymbol = U; exports.wrap = q; exports.wrapTable = xt;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{a as x,b as v,f as r,g as pt}from"./chunk-RKUUEWDF.mjs";r();r();r();import D from"@valaxyjs/config";import{computed as C,inject as H,readonly as R,shallowRef as V}from"vue";function w(t){let e=JSON.parse(t);return import.meta.env.DEV?R(e):e}var U=Symbol("valaxy:config"),T=V(w(D));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=w(t.default)});function ht(){return C(()=>T.value)}function g(){let t=H(U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function b(){let t=g();return C(()=>t.value.themeConfig)}r();r();r();import{computed as f}from"vue";import{useRoute as N,useRouter as O}from"vue-router";r();r();function yt(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var xt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};r();import I from"dayjs";function wt(t,e="YYYY-MM-DD"){return I(t).format(e)}function y(t,e=!0){return t.sort((o,s)=>{let i=+new Date(o.date||""),n=+new Date(s.date||"");return e?n-i:i-n})}var L=import.meta.env.DEV===!0;function h(t={}){let e=O();return f(()=>{let o=e.getRoutes().filter(n=>n.path.startsWith("/posts")&&n.meta.frontmatter&&n.meta.frontmatter.date).filter(n=>!n.path.endsWith(".html")).filter(n=>!t.type||n.meta.frontmatter.type===t.type).map(n=>Object.assign({path:n.path,excerpt:n.meta.excerpt},n.meta.frontmatter)),s=y(o.filter(n=>n.top)).sort((n,a)=>a.top-n.top),i=y(o.filter(n=>!n.top));return s.concat(i)})}function St(t){let e=N(),o=f(()=>t||e.path),s=h(),i=f(()=>{let c=-1;return s.value.find((u,m)=>u.path===o.value?(c=m,!0):!1),c}),n=f(()=>i.value-1>=0?s.value[i.value-1]:null),a=f(()=>i.value+1<s.value.length?s.value[i.value+1]:null);return[n,a]}function kt(t){if(!t)return{color:"",icon:"",styles:{}};let e=b();t in e.value.types||(t="link");let o=e.value.types[t].color,s=e.value.types[t].icon,i=f(()=>({"--card-c-primary":t&&o}));return{color:o,icon:s,styles:i}}function Rt(){var s;let t=h(),e={total:t.value.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},o=e.children.get("Uncategorized");return t.value.forEach(i=>{if(i.categories)if(Array.isArray(i.categories)){let n=i.categories.length,a=e;i.categories.forEach((c,u)=>{var m,d,p;if(u===n-1)if(a.children.has(c)){let l=a.children.get(c);l.posts&&(l.total+=1,l.posts.push(i))}else(m=a.children)==null||m.set(c,{total:1,posts:[i]});else if((d=a.children)!=null&&d.has(c)){let l=a.children.get(c);l.total+=1,a=l}else{let l={total:1,children:new Map};(p=a.children)==null||p.set(c,l),a=l}})}else{let n=i.categories;if(e.children.has(n)){let a=e.children.get(n);a.total+=1,a.posts.push(i)}else e.children.set(n,{total:1,posts:[i]})}else o.total+=1,o.posts.push(i)}),o.total===0&&((s=e.children)==null||s.delete("Uncategorized")),e}r();import{TinyColor as E}from"@ctrl/tinycolor";function It(){let t=W(),e=new E("#999999"),o=new E(getComputedStyle(document.documentElement).getPropertyValue("--yun-c-primary"));return{tags:t,getTagStyle:i=>{let n=Array.from(t).map(([d,p])=>p.count),a=Math.max(...n),c=Math.min(...n),u=a-c,m=(i-c)/u;return{"--yun-tag-color":e.mix(o,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){let t=h(),e=new Map;return t.value.forEach(o=>{if(o.tags){let s;typeof o.tags=="string"?s=[o.tags]:s=o.tags,s.forEach(i=>{if(e.has(i)){let n=e.get(i);e.set(i,v(x({},n),{count:n.count+1}))}else e.set(i,{count:1})})}}),e}r();import{useRoute as P}from"vue-router";import{computed as A}from"vue";function Yt(){let t=P(),e=A(()=>t.meta.frontmatter);return L&&console.log(e.value),e}function Kt(){let t=g(),e=P();return A(()=>(t.value.url||(window==null?void 0:window.location.origin))+e.path)}r();r();import{useHead as z}from"@vueuse/head";function Jt(){z({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}r();import{useElementBounding as B,useIntersectionObserver as Y}from"@vueuse/core";import{ref as K}from"vue";function te(t){let e=K(!1),{top:o}=B(t);return Y(t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}r();import{useDark as F,useToggle as $}from"@vueuse/core";var J=F(),re=$(J);r();import{computed as _}from"vue";import{useRoute as G}from"vue-router";function ae(t){let e=G();return _(()=>e.meta.layout===t)}r();r();import{useScriptTag as M}from"@vueuse/core";import{useHead as Q}from"@vueuse/head";function me(){Q({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),M("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{M("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}r();import{useWindowScroll as X}from"@vueuse/core";import{computed as j}from"vue";function he(t={offset:100}){let{y:e}=X(),o=j(()=>e.value/document.body.clientHeight),s=j(()=>e.value>t.offset);return{percentage:o,show:s}}r();import{useHead as Z}from"@vueuse/head";function xe(){Z({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}r();import{onMounted as tt,onUnmounted as et,onUpdated as ot}from"vue";function Ee(){let t=null,e=null,o=it(s,200);function s(){let a=rt(),c=nt(a);for(let u=0;u<c.length;u++){let m=c[u],d=c[u+1],[p,l]=st(u,m,d);if(p){history.replaceState(null,document.title,l||" "),i(l);return}}}function i(a){if(n(e),n(t),e=document.querySelector(`.val-toc a[href="${a}"]`),!e)return;e.classList.add("active");let c=e.closest(".right-sidebar-container > ul > li");c&&c!==e.parentElement?(t=c.querySelector("a"),t&&t.classList.add("active")):t=null}function n(a){a&&a.classList.remove("active")}tt(()=>{s(),window.addEventListener("scroll",o)}),ot(()=>{i(decodeURIComponent(location.hash))}),et(()=>{window.removeEventListener("scroll",o)})}function rt(){return[].slice.call(document.querySelectorAll(".val-toc a.toc-link-item"))}function nt(t){return[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>t.some(o=>o.hash===e.hash))}function S(t){return t.parentElement.offsetTop-50}function st(t,e,o){let s=window.scrollY;return t===0&&s===0?[!0,null]:s<S(e)?[!1,null]:!o||s<S(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function it(t,e){let o,s=!1;return()=>{o&&clearTimeout(o),s?o=setTimeout(t,e):(t(),s=!0,setTimeout(()=>{s=!1},e))}}r();r();import{isClient as at,useScriptTag as ct}from"@vueuse/core";import{onUnmounted as lt,watch as k}from"vue";import{useI18n as ut}from"vue-i18n";import{useRoute as mt}from"vue-router";function ke(t={}){let e=mt(),{locale:o}=ut(),s;function i(n={}){if(!at)return;let a={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},c=Object.assign(a,n);return window.Waline(c)}ct("//cdn.jsdelivr.net/npm/@waline/client",()=>{s=i(t)}),k(()=>e.path,n=>{!s||s.update({path:n})}),k(o,n=>{!s||s.update({lang:n})}),lt(()=>{!s||s.destroy()})}export{pt as defaultValaxyConfig,wt as formatDate,ht as initConfig,J as isDark,L as isDev,yt as random,y as sortByDate,re as toggleDark,Ee as useActiveSidebarLinks,me as useAplayer,he as useBackToTop,Rt as useCategory,xe as useCodePen,g as useConfig,Yt as useFrontmatter,Kt as useFullUrl,te as useInvisibleElement,Jt as useKatex,ae as useLayout,h as usePostList,kt as usePostProperty,St as usePrevNext,W as useTag,It as useTags,b as useThemeConfig,ke as useWaline,T as valaxyConfigRef,U as valaxyConfigSymbol,q as wrap,xt as wrapTable};
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk7JDYOPIDjs = require('../chunk-7JDYOPID.js');var _chunkL5SNNWFJjs = require('../chunk-L5SNNWFJ.js');var _chunkL3EDI35Ijs = require('../chunk-L3EDI35I.js');var re=_chunkL3EDI35Ijs.c.call(void 0, (st,oe)=>{_chunkL3EDI35Ijs.e.call(void 0, );var x=1e3,O=x*60,R=O*60,F=R*24,Oe=F*7,Re=F*365.25;oe.exports=function(e,o){o=o||{};var t=typeof e;if(t==="string"&&e.length>0)return Ee(e);if(t==="number"&&isFinite(e))return o.long?$e(e):Ie(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Ee(e){if(e=String(e),!(e.length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!o){var t=parseFloat(o[1]),r=(o[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Re;case"weeks":case"week":case"w":return t*Oe;case"days":case"day":case"d":return t*F;case"hours":case"hour":case"hrs":case"hr":case"h":return t*R;case"minutes":case"minute":case"mins":case"min":case"m":return t*O;case"seconds":case"second":case"secs":case"sec":case"s":return t*x;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Ie(e){var o=Math.abs(e);return o>=F?Math.round(e/F)+"d":o>=R?Math.round(e/R)+"h":o>=O?Math.round(e/O)+"m":o>=x?Math.round(e/x)+"s":e+"ms"}function $e(e){var o=Math.abs(e);return o>=F?T(e,o,F,"day"):o>=R?T(e,o,R,"hour"):o>=O?T(e,o,O,"minute"):o>=x?T(e,o,x,"second"):e+" ms"}function T(e,o,t,r){var s=o>=t*1.5;return Math.round(e/t)+" "+r+(s?"s":"")}});var P=_chunkL3EDI35Ijs.c.call(void 0, (it,ne)=>{_chunkL3EDI35Ijs.e.call(void 0, );function ke(e){t.debug=t,t.default=t,t.coerce=I,t.disable=c,t.enable=s,t.enabled=h,t.humanize=re(),t.destroy=ve,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function o(n){let i=0;for(let u=0;u<n.length;u++)i=(i<<5)-i+n.charCodeAt(u),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=o;function t(n){let i,u=null,$,K;function y(...m){if(!y.enabled)return;let b=y,k=Number(new Date),be=k-(i||k);b.diff=be,b.prev=i,b.curr=k,i=k,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let A=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(D,we)=>{if(D==="%%")return"%";A++;let Z=t.formatters[we];if(typeof Z=="function"){let Fe=m[A];D=Z.call(b,Fe),m.splice(A,1),A--}return D}),t.formatArgs.call(b,m),(b.log||t.log).apply(b,m)}return y.namespace=n,y.useColors=t.useColors(),y.color=t.selectColor(n),y.extend=r,y.destroy=t.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:($!==t.namespaces&&($=t.namespaces,K=t.enabled(n)),K),set:m=>{u=m}}),typeof t.init=="function"&&t.init(y),y}function r(n,i){let u=t(this.namespace+(typeof i>"u"?":":i)+n);return u.log=this.log,u}function s(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let i,u=(typeof n=="string"?n:"").split(/[\s,]+/),$=u.length;for(i=0;i<$;i++)!u[i]||(n=u[i].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function c(){let n=[...t.names.map(C),...t.skips.map(C).map(i=>"-"+i)].join(",");return t.enable(""),n}function h(n){if(n[n.length-1]==="*")return!0;let i,u;for(i=0,u=t.skips.length;i<u;i++)if(t.skips[i].test(n))return!1;for(i=0,u=t.names.length;i<u;i++)if(t.names[i].test(n))return!0;return!1}function C(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function I(n){return n instanceof Error?n.stack||n.message:n}function ve(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ne.exports=ke});var se=_chunkL3EDI35Ijs.c.call(void 0, (d,j)=>{_chunkL3EDI35Ijs.e.call(void 0, );d.formatArgs=Se;d.save=Te;d.load=je;d.useColors=Ae;d.storage=Me();d.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();d.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ae(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Se(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+j.exports.humanize(this.diff),!this.useColors)return;let o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),e.splice(r,0,o)}d.log=console.debug||console.log||(()=>{});function Te(e){try{e?d.storage.setItem("debug",e):d.storage.removeItem("debug")}catch (e2){}}function je(){let e;try{e=d.storage.getItem("debug")}catch (e3){}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Me(){try{return localStorage}catch (e4){}}j.exports=P()(d);var{formatters:Le}=j.exports;Le.j=function(e){try{return JSON.stringify(e)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}});var ae=_chunkL3EDI35Ijs.c.call(void 0, (at,ie)=>{"use strict";_chunkL3EDI35Ijs.e.call(void 0, );ie.exports=(e,o=process.argv)=>{let t=e.startsWith("-")?"":e.length===1?"-":"--",r=o.indexOf(t+e),s=o.indexOf("--");return r!==-1&&(s===-1||r<s)}});var ue=_chunkL3EDI35Ijs.c.call(void 0, (ct,le)=>{"use strict";_chunkL3EDI35Ijs.e.call(void 0, );var Ve=_chunkL3EDI35Ijs.b.call(void 0, "os"),ce=_chunkL3EDI35Ijs.b.call(void 0, "tty"),g=ae(),{env:p}=process,v;g("no-color")||g("no-colors")||g("color=false")||g("color=never")?v=0:(g("color")||g("colors")||g("color=true")||g("color=always"))&&(v=1);"FORCE_COLOR"in p&&(p.FORCE_COLOR==="true"?v=1:p.FORCE_COLOR==="false"?v=0:v=p.FORCE_COLOR.length===0?1:Math.min(parseInt(p.FORCE_COLOR,10),3));function q(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function U(e,o){if(v===0)return 0;if(g("color=16m")||g("color=full")||g("color=truecolor"))return 3;if(g("color=256"))return 2;if(e&&!o&&v===void 0)return 0;let t=v||0;if(p.TERM==="dumb")return t;if(process.platform==="win32"){let r=Ve.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in p)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in p)||p.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in p)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(p.TEAMCITY_VERSION)?1:0;if(p.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in p){let r=parseInt((p.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(p.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(p.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(p.TERM)||"COLORTERM"in p?1:t}function _e(e){let o=U(e,e&&e.isTTY);return q(o)}le.exports={supportsColor:_e,stdout:q(U(!0,ce.isatty(1))),stderr:q(U(!0,ce.isatty(2)))}});var fe=_chunkL3EDI35Ijs.c.call(void 0, (f,L)=>{_chunkL3EDI35Ijs.e.call(void 0, );var Ne=_chunkL3EDI35Ijs.b.call(void 0, "tty"),M=_chunkL3EDI35Ijs.b.call(void 0, "util");f.init=Ye;f.log=qe;f.formatArgs=Be;f.save=Ue;f.load=Ge;f.useColors=De;f.destroy=M.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");f.colors=[6,2,3,4,5,1];try{let e=ue();e&&(e.stderr||e).level>=2&&(f.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch (e5){}f.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,o)=>{let t=o.substring(6).toLowerCase().replace(/_([a-z])/g,(s,c)=>c.toUpperCase()),r=process.env[o];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),e[t]=r,e},{});function De(){return"colors"in f.inspectOpts?Boolean(f.inspectOpts.colors):Ne.isatty(process.stderr.fd)}function Be(e){let{namespace:o,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),c=` ${s};1m${o} \x1B[0m`;e[0]=c+e[0].split(`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkHUI4MBPMjs = require('../chunk-HUI4MBPM.js');var _chunkEM2KSV5Vjs = require('../chunk-EM2KSV5V.js');var _chunk44DGW27Sjs = require('../chunk-44DGW27S.js');var Q=_chunk44DGW27Sjs.d.call(void 0, (We,K)=>{_chunk44DGW27Sjs.f.call(void 0, );var v=1e3,b=v*60,w=b*60,h=w*24,Ce=h*7,ye=h*365.25;K.exports=function(e,o){o=o||{};var t=typeof e;if(t==="string"&&e.length>0)return he(e);if(t==="number"&&isFinite(e))return o.long?be(e):ve(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function he(e){if(e=String(e),!(e.length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!o){var t=parseFloat(o[1]),r=(o[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*ye;case"weeks":case"week":case"w":return t*Ce;case"days":case"day":case"d":return t*h;case"hours":case"hour":case"hrs":case"hr":case"h":return t*w;case"minutes":case"minute":case"mins":case"min":case"m":return t*b;case"seconds":case"second":case"secs":case"sec":case"s":return t*v;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function ve(e){var o=Math.abs(e);return o>=h?Math.round(e/h)+"d":o>=w?Math.round(e/w)+"h":o>=b?Math.round(e/b)+"m":o>=v?Math.round(e/v)+"s":e+"ms"}function be(e){var o=Math.abs(e);return o>=h?j(e,o,h,"day"):o>=w?j(e,o,w,"hour"):o>=b?j(e,o,b,"minute"):o>=v?j(e,o,v,"second"):e+" ms"}function j(e,o,t,r){var s=o>=t*1.5;return Math.round(e/t)+" "+r+(s?"s":"")}});var q=_chunk44DGW27Sjs.d.call(void 0, (Ze,X)=>{_chunk44DGW27Sjs.f.call(void 0, );function we(e){t.debug=t,t.default=t,t.coerce=x,t.disable=c,t.enable=s,t.enabled=g,t.humanize=Q(),t.destroy=le,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function o(n){let i=0;for(let l=0;l<n.length;l++)i=(i<<5)-i+n.charCodeAt(l),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=o;function t(n){let i,l=null,O,Y;function C(...d){if(!C.enabled)return;let y=C,$=Number(new Date),ue=$-(i||$);y.diff=ue,y.prev=i,y.curr=$,i=$,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let k=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(N,pe)=>{if(N==="%%")return"%";k++;let G=t.formatters[pe];if(typeof G=="function"){let fe=d[k];N=G.call(y,fe),d.splice(k,1),k--}return N}),t.formatArgs.call(y,d),(y.log||t.log).apply(y,d)}return C.namespace=n,C.useColors=t.useColors(),C.color=t.selectColor(n),C.extend=r,C.destroy=t.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(O!==t.namespaces&&(O=t.namespaces,Y=t.enabled(n)),Y),set:d=>{l=d}}),typeof t.init=="function"&&t.init(C),C}function r(n,i){let l=t(this.namespace+(typeof i>"u"?":":i)+n);return l.log=this.log,l}function s(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let i,l=(typeof n=="string"?n:"").split(/[\s,]+/),O=l.length;for(i=0;i<O;i++)!l[i]||(n=l[i].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function c(){let n=[...t.names.map(m),...t.skips.map(m).map(i=>"-"+i)].join(",");return t.enable(""),n}function g(n){if(n[n.length-1]==="*")return!0;let i,l;for(i=0,l=t.skips.length;i<l;i++)if(t.skips[i].test(n))return!1;for(i=0,l=t.names.length;i<l;i++)if(t.names[i].test(n))return!0;return!1}function m(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function x(n){return n instanceof Error?n.stack||n.message:n}function le(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=we});var ee=_chunk44DGW27Sjs.d.call(void 0, (f,S)=>{_chunk44DGW27Sjs.f.call(void 0, );f.formatArgs=xe;f.save=Oe;f.load=$e;f.useColors=Fe;f.storage=ke();f.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();f.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fe(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function xe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+S.exports.humanize(this.diff),!this.useColors)return;let o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),e.splice(r,0,o)}f.log=console.debug||console.log||(()=>{});function Oe(e){try{e?f.storage.setItem("debug",e):f.storage.removeItem("debug")}catch (e2){}}function $e(){let e;try{e=f.storage.getItem("debug")}catch (e3){}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function ke(){try{return localStorage}catch (e4){}}S.exports=q()(f);var{formatters:Re}=S.exports;Re.j=function(e){try{return JSON.stringify(e)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}});var oe=_chunk44DGW27Sjs.d.call(void 0, (u,E)=>{_chunk44DGW27Sjs.f.call(void 0, );var je=_chunk44DGW27Sjs.c.call(void 0, "tty"),I=_chunk44DGW27Sjs.c.call(void 0, "util");u.init=Ne;u.log=Ae;u.formatArgs=Ie;u.save=Ve;u.load=De;u.useColors=Se;u.destroy=I.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");u.colors=[6,2,3,4,5,1];try{let e=_chunkEM2KSV5Vjs.a.call(void 0, );e&&(e.stderr||e).level>=2&&(u.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch (e5){}u.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,o)=>{let t=o.substring(6).toLowerCase().replace(/_([a-z])/g,(s,c)=>c.toUpperCase()),r=process.env[o];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),e[t]=r,e},{});function Se(){return"colors"in u.inspectOpts?Boolean(u.inspectOpts.colors):je.isatty(process.stderr.fd)}function Ie(e){let{namespace:o,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),c=` ${s};1m${o} \x1B[0m`;e[0]=c+e[0].split(`
2
2
  `).join(`
3
- `+c),e.push(s+"m+"+L.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Pe()+o+" "+e[0]}function Pe(){return f.inspectOpts.hideDate?"":new Date().toISOString()+" "}function qe(...e){return process.stderr.write(M.format(...e)+`
4
- `)}function Ue(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Ge(){return process.env.DEBUG}function Ye(e){e.inspectOpts={};let o=Object.keys(f.inspectOpts);for(let t=0;t<o.length;t++)e.inspectOpts[o[t]]=f.inspectOpts[o[t]]}L.exports=P()(f);var{formatters:pe}=L.exports;pe.o=function(e){return this.inspectOpts.colors=this.useColors,M.inspect(e,this.inspectOpts).split(`
5
- `).map(o=>o.trim()).join(" ")};pe.O=function(e){return this.inspectOpts.colors=this.useColors,M.inspect(e,this.inspectOpts)}});var de=_chunkL3EDI35Ijs.c.call(void 0, (lt,G)=>{_chunkL3EDI35Ijs.e.call(void 0, );typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?G.exports=se():G.exports=fe()});_chunkL3EDI35Ijs.e.call(void 0, );var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var _path = require('path'); var _path2 = _interopRequireDefault(_path);var _child_process = require('child_process');var _yargs = require('yargs'); var _yargs2 = _interopRequireDefault(_yargs);var _open = require('open'); var _open2 = _interopRequireDefault(_open);var _node = require('vite-ssg/node');var _consola = require('consola'); var _consola2 = _interopRequireDefault(_consola);var S="0.0.7";_chunkL3EDI35Ijs.e.call(void 0, );var me=_chunkL3EDI35Ijs.d.call(void 0, de());var Je=(0,me.default)("valaxy:options");function He(e){return e.startsWith("/")||/^\.\.?[\/\\]/.test(e)}function We(e,o){return e?He(e)?_path.resolve.call(void 0, _path.dirname.call(void 0, o),e):_chunkL5SNNWFJjs.a.call(void 0, `valaxy-theme-${e}/package.json`):""}async function z(e){let o=_path.resolve.call(void 0, _chunkL5SNNWFJjs.a.call(void 0, "valaxy/package.json"),"src/client"),t=_path.resolve.call(void 0, e.userRoot||process.cwd()),{config:r,configFile:s,theme:c}=await _chunkL5SNNWFJjs.c.call(void 0, e),h=We(c,t),C={clientRoot:o,userRoot:t,themeRoot:h,theme:c,config:r,configFile:s||""};return Je(C),C}_chunkL3EDI35Ijs.e.call(void 0, );var _readline = require('readline'); var ge = _interopRequireWildcard(_readline);var _os = require('os'); var _os2 = _interopRequireDefault(_os);var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);var _;function J(e,o,t){console.log(),console.log(` ${_chalk2.default.bold("\u{1F30C} Valaxy")} ${_chalk2.default.blue(`v${S}`)}`),console.log(),console.log(`${_chalk2.default.dim(" \u{1FA90} theme ")} > ${e.theme?_chalk2.default.green(e.theme):_chalk2.default.gray("none")}`),console.log(` ${_chalk2.default.dim("\u{1F4C1}")} ${_chalk2.default.dim(_path2.default.resolve(e.userRoot))}`),o&&(console.log(),console.log(`${_chalk2.default.dim(" Preview ")} > ${_chalk2.default.cyan(`http://localhost:${_chalk2.default.bold(o)}/`)}`),t&&Object.values(_os2.default.networkInterfaces()).forEach(r=>(r||[]).filter(s=>s.family==="IPv4"&&!s.address.includes("127.0.0.1")).forEach(({address:s})=>{console.log(`${_chalk2.default.dim(" Network ")} > ${_chalk2.default.blue(`http://${s}:${_chalk2.default.bold(o)}/`)}`)})),console.log(),console.log(`${_chalk2.default.dim(" shortcuts ")} > ${_chalk2.default.underline("r")}${_chalk2.default.dim("estart | ")}${_chalk2.default.underline("o")}${_chalk2.default.dim("pen | ")}${_chalk2.default.underline("e")}${_chalk2.default.dim("dit")}`)),console.log()}async function N(e,o){_&&await _.close();try{let t=_chunkL5SNNWFJjs.b.call(void 0, e.config).concat(e.config.unocss.safelist||[]);_=await _chunk7JDYOPIDjs.a.call(void 0, e,o,{onConfigReload(r,s){let c=!1;r.social.some((C,I)=>!t.includes(C.icon)&&C.icon!==s.social[I].icon)&&(_consola2.default.info("Find new icon, reload server..."),_consola2.default.info(`If you do not want to reload it, write icon name in ${_chalk2.default.green("config.unocss.safelist")}.`),_consola2.default.info('For example: ["i-ri-cloud-line"]'),console.log(),c=!0),c&&N(e,o)}}),await _.listen()}catch(t){_consola2.default.error(`failed to start server. error:
6
- `),console.error(t),process.exit(1)}}function Ce(e){process.stdin.resume(),process.stdin.setEncoding("utf8"),ge.emitKeypressEvents(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.on("keypress",(o,t)=>{if(t.ctrl&&t.name==="c")process.exit();else{let[r]=e.filter(s=>s.name===o);if(r)try{r.action()}catch(s){console.error(`Failed to execute shortcut ${r.fullName}`,s)}}})}var W=_yargs2.default.scriptName("valaxy").usage("$0 [args]").version(S).showHelpOnFail(!1).alias("h","help").alias("v","version");W.command("* [root]","Start a local server for Valaxy",e=>ye(e).option("port",{alias:"p",type:"number",describe:"port"}).option("open",{alias:"o",default:!1,type:"boolean",describe:"open in browser"}).option("remote",{default:!0,type:"boolean",describe:"listen public host and enable remote control"}).option("log",{default:"warn",type:"string",choices:["error","warn","info","silent"],describe:"log level"}).strict().help(),async({root:e,port:o,open:t,remote:r,log:s})=>{_fs2.default.existsSync(_path2.default.resolve(e,"pages"))||process.exit(0);let c=o||4859,h=await z({userRoot:e}),C={server:{watch:{ignored:[`!${h.themeRoot}/**`,`${h.userRoot}/**.md`]},port:c,strictPort:!0,open:t,host:r?"0.0.0.0":"localhost"},logLevel:s};await N(h,C),J(h,c,r),Ce([{name:"r",fullName:"restart",action(){N(h,C)}},{name:"o",fullName:"open",action(){_open2.default.call(void 0, `http://localhost:${c}`)}},{name:"e",fullName:"edit",action(){_child_process.exec.call(void 0, `code "${e}"`)}}])});W.command("build [root]","build your blog to static content",e=>ye(e).option("ssg",{alias:"s",type:"boolean",default:!1,describe:"static site generate"}).option("output",{alias:"o",type:"string",default:"dist",describe:"output dir"}).option("base",{type:"string",describe:"output base"}).strict().help(),async({ssg:e,root:o,base:t,output:r})=>{let s=await z({userRoot:o});if(J(s),e){_consola2.default.info("use vite-ssg to do ssg build...");try{await _node.build.call(void 0, {mode:"production"})}catch(c){_consola2.default.error("[vite-ssg] An internal error occurred."),console.log(c)}}else{let{build:c}=await Promise.resolve().then(()=>_chunkL3EDI35Ijs.d.call(void 0, _chunkL3EDI35Ijs.b.call(void 0, "../build-OOT6HK6S.js")));_consola2.default.info("use vite do spa build..."),await c(s,{base:t,build:{emptyOutDir:!0,outDir:_path2.default.resolve(s.userRoot,r)}})}});function ye(e){return e.positional("root",{default:".",type:"string",describe:"root folder of your source files"})}function Tt(){W.help().parse()}exports.run = Tt;
3
+ `+c),e.push(s+"m+"+E.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Ee()+o+" "+e[0]}function Ee(){return u.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ae(...e){return process.stderr.write(I.format(...e)+`
4
+ `)}function Ve(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function De(){return process.env.DEBUG}function Ne(e){e.inspectOpts={};let o=Object.keys(u.inspectOpts);for(let t=0;t<o.length;t++)e.inspectOpts[o[t]]=u.inspectOpts[o[t]]}E.exports=q()(u);var{formatters:te}=E.exports;te.o=function(e){return this.inspectOpts.colors=this.useColors,I.inspect(e,this.inspectOpts).split(`
5
+ `).map(o=>o.trim()).join(" ")};te.O=function(e){return this.inspectOpts.colors=this.useColors,I.inspect(e,this.inspectOpts)}});var re=_chunk44DGW27Sjs.d.call(void 0, (Ke,T)=>{_chunk44DGW27Sjs.f.call(void 0, );typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?T.exports=ee():T.exports=oe()});_chunk44DGW27Sjs.f.call(void 0, );var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var _path = require('path'); var _path2 = _interopRequireDefault(_path);var _child_process = require('child_process');var _yargs = require('yargs'); var _yargs2 = _interopRequireDefault(_yargs);var _open = require('open'); var _open2 = _interopRequireDefault(_open);var _node = require('vite-ssg/node');var _consola = require('consola'); var _consola2 = _interopRequireDefault(_consola);var R="0.0.8";_chunk44DGW27Sjs.f.call(void 0, );var ne=_chunk44DGW27Sjs.e.call(void 0, re());var Be=(0,ne.default)("valaxy:options");function Me(e){return e.startsWith("/")||/^\.\.?[\/\\]/.test(e)}function qe(e,o){return e?Me(e)?_path.resolve.call(void 0, _path.dirname.call(void 0, o),e):_chunkEM2KSV5Vjs.c.call(void 0, `valaxy-theme-${e}/package.json`):""}async function U(e){let o=_path.resolve.call(void 0, _chunkEM2KSV5Vjs.c.call(void 0, "valaxy/package.json"),"src/client"),t=_path.resolve.call(void 0, e.userRoot||process.cwd()),{config:r,configFile:s,theme:c}=await _chunkEM2KSV5Vjs.e.call(void 0, e),g=qe(c,t),m={clientRoot:o,userRoot:t,themeRoot:g,theme:c,config:r,configFile:s||""};return Be(m),m}_chunk44DGW27Sjs.f.call(void 0, );var a=_chunk44DGW27Sjs.e.call(void 0, _chunkEM2KSV5Vjs.b.call(void 0, ));var _readline = require('readline'); var se = _interopRequireWildcard(_readline);var _os = require('os'); var _os2 = _interopRequireDefault(_os);var V;function _(e,o,t){console.log(),console.log(` ${a.default.bold("\u{1F30C} Valaxy")} ${a.default.blue(`v${R}`)}`),console.log(),console.log(`${a.default.dim(" \u{1FA90} theme ")} > ${e.theme?a.default.green(e.theme):a.default.gray("none")}`),console.log(` ${a.default.dim("\u{1F4C1}")} ${a.default.dim(_path2.default.resolve(e.userRoot))}`),o&&(console.log(),console.log(`${a.default.dim(" Preview ")} > ${a.default.cyan(`http://localhost:${a.default.bold(o)}/`)}`),t&&Object.values(_os2.default.networkInterfaces()).forEach(r=>(r||[]).filter(s=>s.family==="IPv4"&&!s.address.includes("127.0.0.1")).forEach(({address:s})=>{console.log(`${a.default.dim(" Network ")} > ${a.default.blue(`http://${s}:${a.default.bold(o)}/`)}`)})),console.log(),console.log(`${a.default.dim(" shortcuts ")} > ${a.default.underline("r")}${a.default.dim("estart | ")}${a.default.underline("o")}${a.default.dim("pen | ")}${a.default.underline("e")}${a.default.dim("dit")}`)),console.log()}async function D(e,o){V&&await V.close();try{let t=_chunkEM2KSV5Vjs.d.call(void 0, e.config).concat(e.config.unocss.safelist||[]);V=await _chunkHUI4MBPMjs.a.call(void 0, e,o,{onConfigReload(r,s){let c=!1;r.social.some((m,x)=>!t.includes(m.icon)&&m.icon!==s.social[x].icon)&&(_consola2.default.info("Find new icon, reload server..."),_consola2.default.info(`If you do not want to reload it, write icon name in ${a.default.green("config.unocss.safelist")}.`),_consola2.default.info('For example: ["i-ri-cloud-line"]'),console.log(),c=!0),c&&D(e,o)}}),await V.listen()}catch(t){_consola2.default.error(`failed to start server. error:
6
+ `),console.error(t),process.exit(1)}}function ie(e){process.stdin.resume(),process.stdin.setEncoding("utf8"),se.emitKeypressEvents(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.on("keypress",(o,t)=>{if(t.ctrl&&t.name==="c")process.exit();else{let[r]=e.filter(s=>s.name===o);if(r)try{r.action()}catch(s){console.error(`Failed to execute shortcut ${r.fullName}`,s)}}})}var J=_yargs2.default.scriptName("valaxy").usage("$0 [args]").version(R).showHelpOnFail(!1).alias("h","help").alias("v","version");J.command("* [root]","Start a local server for Valaxy",e=>ce(e).option("port",{alias:"p",type:"number",describe:"port"}).option("open",{alias:"o",default:!1,type:"boolean",describe:"open in browser"}).option("remote",{default:!0,type:"boolean",describe:"listen public host and enable remote control"}).option("log",{default:"warn",type:"string",choices:["error","warn","info","silent"],describe:"log level"}).strict().help(),async({root:e,port:o,open:t,remote:r,log:s})=>{_fs2.default.existsSync(_path2.default.resolve(e,"pages"))||process.exit(0);let c=o||4859,g=await U({userRoot:e}),m={server:{watch:{ignored:[`!${g.themeRoot}/**`,`${g.userRoot}/**.md`]},port:c,strictPort:!0,open:t,host:r?"0.0.0.0":"localhost"},logLevel:s};await D(g,m),_(g,c,r),ie([{name:"r",fullName:"restart",action(){D(g,m)}},{name:"o",fullName:"open",action(){_open2.default.call(void 0, `http://localhost:${c}`)}},{name:"e",fullName:"edit",action(){_child_process.exec.call(void 0, `code "${e}"`)}}])});J.command("build [root]","build your blog to static content",e=>ce(e).option("ssg",{alias:"s",type:"boolean",default:!1,describe:"static site generate"}).option("output",{alias:"o",type:"string",default:"dist",describe:"output dir"}).option("base",{type:"string",describe:"output base"}).strict().help(),async({ssg:e,root:o,base:t,output:r})=>{let s=await U({userRoot:o});if(_(s),e){_consola2.default.info("use vite-ssg to do ssg build...");try{await _node.build.call(void 0, {mode:"production"})}catch(c){_consola2.default.error("[vite-ssg] An internal error occurred."),console.log(c)}}else{let{build:c}=await Promise.resolve().then(()=>_chunk44DGW27Sjs.e.call(void 0, _chunk44DGW27Sjs.c.call(void 0, "../build-TIU2KH77.js")));_consola2.default.info("use vite do spa build..."),await c(s,{base:t,build:{emptyOutDir:!0,outDir:_path2.default.resolve(s.userRoot,r)}})}});function ce(e){return e.positional("root",{default:".",type:"string",describe:"root folder of your source files"})}function vt(){J.help().parse()}exports.run = vt;
package/dist/node/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import{a as te}from"../chunk-JJEBEWGI.mjs";import{a as B,b as X,c as ee}from"../chunk-QI435Q25.mjs";import{b as E,c as w,d as Q,e as l}from"../chunk-MVJUGWXR.mjs";var re=w((st,oe)=>{l();var x=1e3,O=x*60,R=O*60,F=R*24,Oe=F*7,Re=F*365.25;oe.exports=function(e,o){o=o||{};var t=typeof e;if(t==="string"&&e.length>0)return Ee(e);if(t==="number"&&isFinite(e))return o.long?$e(e):Ie(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Ee(e){if(e=String(e),!(e.length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!o){var t=parseFloat(o[1]),r=(o[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Re;case"weeks":case"week":case"w":return t*Oe;case"days":case"day":case"d":return t*F;case"hours":case"hour":case"hrs":case"hr":case"h":return t*R;case"minutes":case"minute":case"mins":case"min":case"m":return t*O;case"seconds":case"second":case"secs":case"sec":case"s":return t*x;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Ie(e){var o=Math.abs(e);return o>=F?Math.round(e/F)+"d":o>=R?Math.round(e/R)+"h":o>=O?Math.round(e/O)+"m":o>=x?Math.round(e/x)+"s":e+"ms"}function $e(e){var o=Math.abs(e);return o>=F?T(e,o,F,"day"):o>=R?T(e,o,R,"hour"):o>=O?T(e,o,O,"minute"):o>=x?T(e,o,x,"second"):e+" ms"}function T(e,o,t,r){var s=o>=t*1.5;return Math.round(e/t)+" "+r+(s?"s":"")}});var P=w((it,ne)=>{l();function ke(e){t.debug=t,t.default=t,t.coerce=I,t.disable=c,t.enable=s,t.enabled=h,t.humanize=re(),t.destroy=ve,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function o(n){let i=0;for(let u=0;u<n.length;u++)i=(i<<5)-i+n.charCodeAt(u),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=o;function t(n){let i,u=null,$,K;function y(...m){if(!y.enabled)return;let b=y,k=Number(new Date),be=k-(i||k);b.diff=be,b.prev=i,b.curr=k,i=k,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let A=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(D,we)=>{if(D==="%%")return"%";A++;let Z=t.formatters[we];if(typeof Z=="function"){let Fe=m[A];D=Z.call(b,Fe),m.splice(A,1),A--}return D}),t.formatArgs.call(b,m),(b.log||t.log).apply(b,m)}return y.namespace=n,y.useColors=t.useColors(),y.color=t.selectColor(n),y.extend=r,y.destroy=t.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:($!==t.namespaces&&($=t.namespaces,K=t.enabled(n)),K),set:m=>{u=m}}),typeof t.init=="function"&&t.init(y),y}function r(n,i){let u=t(this.namespace+(typeof i>"u"?":":i)+n);return u.log=this.log,u}function s(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let i,u=(typeof n=="string"?n:"").split(/[\s,]+/),$=u.length;for(i=0;i<$;i++)!u[i]||(n=u[i].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function c(){let n=[...t.names.map(C),...t.skips.map(C).map(i=>"-"+i)].join(",");return t.enable(""),n}function h(n){if(n[n.length-1]==="*")return!0;let i,u;for(i=0,u=t.skips.length;i<u;i++)if(t.skips[i].test(n))return!1;for(i=0,u=t.names.length;i<u;i++)if(t.names[i].test(n))return!0;return!1}function C(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function I(n){return n instanceof Error?n.stack||n.message:n}function ve(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ne.exports=ke});var se=w((d,j)=>{l();d.formatArgs=Se;d.save=Te;d.load=je;d.useColors=Ae;d.storage=Me();d.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();d.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ae(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Se(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+j.exports.humanize(this.diff),!this.useColors)return;let o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),e.splice(r,0,o)}d.log=console.debug||console.log||(()=>{});function Te(e){try{e?d.storage.setItem("debug",e):d.storage.removeItem("debug")}catch{}}function je(){let e;try{e=d.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Me(){try{return localStorage}catch{}}j.exports=P()(d);var{formatters:Le}=j.exports;Le.j=function(e){try{return JSON.stringify(e)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}});var ae=w((at,ie)=>{"use strict";l();ie.exports=(e,o=process.argv)=>{let t=e.startsWith("-")?"":e.length===1?"-":"--",r=o.indexOf(t+e),s=o.indexOf("--");return r!==-1&&(s===-1||r<s)}});var ue=w((ct,le)=>{"use strict";l();var Ve=E("os"),ce=E("tty"),g=ae(),{env:p}=process,v;g("no-color")||g("no-colors")||g("color=false")||g("color=never")?v=0:(g("color")||g("colors")||g("color=true")||g("color=always"))&&(v=1);"FORCE_COLOR"in p&&(p.FORCE_COLOR==="true"?v=1:p.FORCE_COLOR==="false"?v=0:v=p.FORCE_COLOR.length===0?1:Math.min(parseInt(p.FORCE_COLOR,10),3));function q(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function U(e,o){if(v===0)return 0;if(g("color=16m")||g("color=full")||g("color=truecolor"))return 3;if(g("color=256"))return 2;if(e&&!o&&v===void 0)return 0;let t=v||0;if(p.TERM==="dumb")return t;if(process.platform==="win32"){let r=Ve.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in p)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in p)||p.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in p)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(p.TEAMCITY_VERSION)?1:0;if(p.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in p){let r=parseInt((p.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(p.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(p.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(p.TERM)||"COLORTERM"in p?1:t}function _e(e){let o=U(e,e&&e.isTTY);return q(o)}le.exports={supportsColor:_e,stdout:q(U(!0,ce.isatty(1))),stderr:q(U(!0,ce.isatty(2)))}});var fe=w((f,L)=>{l();var Ne=E("tty"),M=E("util");f.init=Ye;f.log=qe;f.formatArgs=Be;f.save=Ue;f.load=Ge;f.useColors=De;f.destroy=M.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");f.colors=[6,2,3,4,5,1];try{let e=ue();e&&(e.stderr||e).level>=2&&(f.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}f.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,o)=>{let t=o.substring(6).toLowerCase().replace(/_([a-z])/g,(s,c)=>c.toUpperCase()),r=process.env[o];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),e[t]=r,e},{});function De(){return"colors"in f.inspectOpts?Boolean(f.inspectOpts.colors):Ne.isatty(process.stderr.fd)}function Be(e){let{namespace:o,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),c=` ${s};1m${o} \x1B[0m`;e[0]=c+e[0].split(`
1
+ import{a as Z}from"../chunk-CSMXFOVS.mjs";import{a as de,b as me,c as M,d as H,e as W}from"../chunk-MWP3FN5Q.mjs";import{c as L,d as F,e as B,f as p}from"../chunk-RKUUEWDF.mjs";var Q=F((We,K)=>{p();var v=1e3,b=v*60,w=b*60,h=w*24,Ce=h*7,ye=h*365.25;K.exports=function(e,o){o=o||{};var t=typeof e;if(t==="string"&&e.length>0)return he(e);if(t==="number"&&isFinite(e))return o.long?be(e):ve(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function he(e){if(e=String(e),!(e.length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!o){var t=parseFloat(o[1]),r=(o[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*ye;case"weeks":case"week":case"w":return t*Ce;case"days":case"day":case"d":return t*h;case"hours":case"hour":case"hrs":case"hr":case"h":return t*w;case"minutes":case"minute":case"mins":case"min":case"m":return t*b;case"seconds":case"second":case"secs":case"sec":case"s":return t*v;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function ve(e){var o=Math.abs(e);return o>=h?Math.round(e/h)+"d":o>=w?Math.round(e/w)+"h":o>=b?Math.round(e/b)+"m":o>=v?Math.round(e/v)+"s":e+"ms"}function be(e){var o=Math.abs(e);return o>=h?j(e,o,h,"day"):o>=w?j(e,o,w,"hour"):o>=b?j(e,o,b,"minute"):o>=v?j(e,o,v,"second"):e+" ms"}function j(e,o,t,r){var s=o>=t*1.5;return Math.round(e/t)+" "+r+(s?"s":"")}});var q=F((Ze,X)=>{p();function we(e){t.debug=t,t.default=t,t.coerce=x,t.disable=c,t.enable=s,t.enabled=g,t.humanize=Q(),t.destroy=le,Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={};function o(n){let i=0;for(let l=0;l<n.length;l++)i=(i<<5)-i+n.charCodeAt(l),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=o;function t(n){let i,l=null,O,Y;function C(...d){if(!C.enabled)return;let y=C,$=Number(new Date),ue=$-(i||$);y.diff=ue,y.prev=i,y.curr=$,i=$,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let k=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(N,pe)=>{if(N==="%%")return"%";k++;let G=t.formatters[pe];if(typeof G=="function"){let fe=d[k];N=G.call(y,fe),d.splice(k,1),k--}return N}),t.formatArgs.call(y,d),(y.log||t.log).apply(y,d)}return C.namespace=n,C.useColors=t.useColors(),C.color=t.selectColor(n),C.extend=r,C.destroy=t.destroy,Object.defineProperty(C,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(O!==t.namespaces&&(O=t.namespaces,Y=t.enabled(n)),Y),set:d=>{l=d}}),typeof t.init=="function"&&t.init(C),C}function r(n,i){let l=t(this.namespace+(typeof i>"u"?":":i)+n);return l.log=this.log,l}function s(n){t.save(n),t.namespaces=n,t.names=[],t.skips=[];let i,l=(typeof n=="string"?n:"").split(/[\s,]+/),O=l.length;for(i=0;i<O;i++)!l[i]||(n=l[i].replace(/\*/g,".*?"),n[0]==="-"?t.skips.push(new RegExp("^"+n.slice(1)+"$")):t.names.push(new RegExp("^"+n+"$")))}function c(){let n=[...t.names.map(m),...t.skips.map(m).map(i=>"-"+i)].join(",");return t.enable(""),n}function g(n){if(n[n.length-1]==="*")return!0;let i,l;for(i=0,l=t.skips.length;i<l;i++)if(t.skips[i].test(n))return!1;for(i=0,l=t.names.length;i<l;i++)if(t.names[i].test(n))return!0;return!1}function m(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}function x(n){return n instanceof Error?n.stack||n.message:n}function le(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=we});var ee=F((f,S)=>{p();f.formatArgs=xe;f.save=Oe;f.load=$e;f.useColors=Fe;f.storage=ke();f.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();f.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fe(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function xe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+S.exports.humanize(this.diff),!this.useColors)return;let o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),e.splice(r,0,o)}f.log=console.debug||console.log||(()=>{});function Oe(e){try{e?f.storage.setItem("debug",e):f.storage.removeItem("debug")}catch{}}function $e(){let e;try{e=f.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function ke(){try{return localStorage}catch{}}S.exports=q()(f);var{formatters:Re}=S.exports;Re.j=function(e){try{return JSON.stringify(e)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}});var oe=F((u,E)=>{p();var je=L("tty"),I=L("util");u.init=Ne;u.log=Ae;u.formatArgs=Ie;u.save=Ve;u.load=De;u.useColors=Se;u.destroy=I.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");u.colors=[6,2,3,4,5,1];try{let e=de();e&&(e.stderr||e).level>=2&&(u.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}u.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,o)=>{let t=o.substring(6).toLowerCase().replace(/_([a-z])/g,(s,c)=>c.toUpperCase()),r=process.env[o];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),e[t]=r,e},{});function Se(){return"colors"in u.inspectOpts?Boolean(u.inspectOpts.colors):je.isatty(process.stderr.fd)}function Ie(e){let{namespace:o,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),c=` ${s};1m${o} \x1B[0m`;e[0]=c+e[0].split(`
2
2
  `).join(`
3
- `+c),e.push(s+"m+"+L.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Pe()+o+" "+e[0]}function Pe(){return f.inspectOpts.hideDate?"":new Date().toISOString()+" "}function qe(...e){return process.stderr.write(M.format(...e)+`
4
- `)}function Ue(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Ge(){return process.env.DEBUG}function Ye(e){e.inspectOpts={};let o=Object.keys(f.inspectOpts);for(let t=0;t<o.length;t++)e.inspectOpts[o[t]]=f.inspectOpts[o[t]]}L.exports=P()(f);var{formatters:pe}=L.exports;pe.o=function(e){return this.inspectOpts.colors=this.useColors,M.inspect(e,this.inspectOpts).split(`
5
- `).map(o=>o.trim()).join(" ")};pe.O=function(e){return this.inspectOpts.colors=this.useColors,M.inspect(e,this.inspectOpts)}});var de=w((lt,G)=>{l();typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?G.exports=se():G.exports=fe()});l();import Qe from"fs";import he from"path";import{exec as Xe}from"child_process";import et from"yargs";import tt from"open";import{build as ot}from"vite-ssg/node";import H from"consola";var S="0.0.7";l();var me=Q(de());import{dirname as ze,resolve as Y}from"path";var Je=(0,me.default)("valaxy:options");function He(e){return e.startsWith("/")||/^\.\.?[\/\\]/.test(e)}function We(e,o){return e?He(e)?Y(ze(o),e):B(`valaxy-theme-${e}/package.json`):""}async function z(e){let o=Y(B("valaxy/package.json"),"src/client"),t=Y(e.userRoot||process.cwd()),{config:r,configFile:s,theme:c}=await ee(e),h=We(c,t),C={clientRoot:o,userRoot:t,themeRoot:h,theme:c,config:r,configFile:s||""};return Je(C),C}l();import*as ge from"readline";import Ke from"path";import Ze from"os";import a from"chalk";import V from"consola";var _;function J(e,o,t){console.log(),console.log(` ${a.bold("\u{1F30C} Valaxy")} ${a.blue(`v${S}`)}`),console.log(),console.log(`${a.dim(" \u{1FA90} theme ")} > ${e.theme?a.green(e.theme):a.gray("none")}`),console.log(` ${a.dim("\u{1F4C1}")} ${a.dim(Ke.resolve(e.userRoot))}`),o&&(console.log(),console.log(`${a.dim(" Preview ")} > ${a.cyan(`http://localhost:${a.bold(o)}/`)}`),t&&Object.values(Ze.networkInterfaces()).forEach(r=>(r||[]).filter(s=>s.family==="IPv4"&&!s.address.includes("127.0.0.1")).forEach(({address:s})=>{console.log(`${a.dim(" Network ")} > ${a.blue(`http://${s}:${a.bold(o)}/`)}`)})),console.log(),console.log(`${a.dim(" shortcuts ")} > ${a.underline("r")}${a.dim("estart | ")}${a.underline("o")}${a.dim("pen | ")}${a.underline("e")}${a.dim("dit")}`)),console.log()}async function N(e,o){_&&await _.close();try{let t=X(e.config).concat(e.config.unocss.safelist||[]);_=await te(e,o,{onConfigReload(r,s){let c=!1;r.social.some((C,I)=>!t.includes(C.icon)&&C.icon!==s.social[I].icon)&&(V.info("Find new icon, reload server..."),V.info(`If you do not want to reload it, write icon name in ${a.green("config.unocss.safelist")}.`),V.info('For example: ["i-ri-cloud-line"]'),console.log(),c=!0),c&&N(e,o)}}),await _.listen()}catch(t){V.error(`failed to start server. error:
6
- `),console.error(t),process.exit(1)}}function Ce(e){process.stdin.resume(),process.stdin.setEncoding("utf8"),ge.emitKeypressEvents(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.on("keypress",(o,t)=>{if(t.ctrl&&t.name==="c")process.exit();else{let[r]=e.filter(s=>s.name===o);if(r)try{r.action()}catch(s){console.error(`Failed to execute shortcut ${r.fullName}`,s)}}})}var W=et.scriptName("valaxy").usage("$0 [args]").version(S).showHelpOnFail(!1).alias("h","help").alias("v","version");W.command("* [root]","Start a local server for Valaxy",e=>ye(e).option("port",{alias:"p",type:"number",describe:"port"}).option("open",{alias:"o",default:!1,type:"boolean",describe:"open in browser"}).option("remote",{default:!0,type:"boolean",describe:"listen public host and enable remote control"}).option("log",{default:"warn",type:"string",choices:["error","warn","info","silent"],describe:"log level"}).strict().help(),async({root:e,port:o,open:t,remote:r,log:s})=>{Qe.existsSync(he.resolve(e,"pages"))||process.exit(0);let c=o||4859,h=await z({userRoot:e}),C={server:{watch:{ignored:[`!${h.themeRoot}/**`,`${h.userRoot}/**.md`]},port:c,strictPort:!0,open:t,host:r?"0.0.0.0":"localhost"},logLevel:s};await N(h,C),J(h,c,r),Ce([{name:"r",fullName:"restart",action(){N(h,C)}},{name:"o",fullName:"open",action(){tt(`http://localhost:${c}`)}},{name:"e",fullName:"edit",action(){Xe(`code "${e}"`)}}])});W.command("build [root]","build your blog to static content",e=>ye(e).option("ssg",{alias:"s",type:"boolean",default:!1,describe:"static site generate"}).option("output",{alias:"o",type:"string",default:"dist",describe:"output dir"}).option("base",{type:"string",describe:"output base"}).strict().help(),async({ssg:e,root:o,base:t,output:r})=>{let s=await z({userRoot:o});if(J(s),e){H.info("use vite-ssg to do ssg build...");try{await ot({mode:"production"})}catch(c){H.error("[vite-ssg] An internal error occurred."),console.log(c)}}else{let{build:c}=await Promise.resolve().then(()=>Q(E("../build-SG32QSQ3.mjs")));H.info("use vite do spa build..."),await c(s,{base:t,build:{emptyOutDir:!0,outDir:he.resolve(s.userRoot,r)}})}});function ye(e){return e.positional("root",{default:".",type:"string",describe:"root folder of your source files"})}function Tt(){W.help().parse()}export{Tt as run};
3
+ `+c),e.push(s+"m+"+E.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Ee()+o+" "+e[0]}function Ee(){return u.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ae(...e){return process.stderr.write(I.format(...e)+`
4
+ `)}function Ve(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function De(){return process.env.DEBUG}function Ne(e){e.inspectOpts={};let o=Object.keys(u.inspectOpts);for(let t=0;t<o.length;t++)e.inspectOpts[o[t]]=u.inspectOpts[o[t]]}E.exports=q()(u);var{formatters:te}=E.exports;te.o=function(e){return this.inspectOpts.colors=this.useColors,I.inspect(e,this.inspectOpts).split(`
5
+ `).map(o=>o.trim()).join(" ")};te.O=function(e){return this.inspectOpts.colors=this.useColors,I.inspect(e,this.inspectOpts)}});var re=F((Ke,T)=>{p();typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?T.exports=ee():T.exports=oe()});p();import Ue from"fs";import ae from"path";import{exec as _e}from"child_process";import ze from"yargs";import Je from"open";import{build as Ye}from"vite-ssg/node";import z from"consola";var R="0.0.8";p();var ne=B(re());import{dirname as Le,resolve as P}from"path";var Be=(0,ne.default)("valaxy:options");function Me(e){return e.startsWith("/")||/^\.\.?[\/\\]/.test(e)}function qe(e,o){return e?Me(e)?P(Le(o),e):M(`valaxy-theme-${e}/package.json`):""}async function U(e){let o=P(M("valaxy/package.json"),"src/client"),t=P(e.userRoot||process.cwd()),{config:r,configFile:s,theme:c}=await W(e),g=qe(c,t),m={clientRoot:o,userRoot:t,themeRoot:g,theme:c,config:r,configFile:s||""};return Be(m),m}p();var a=B(me());import*as se from"readline";import Te from"path";import Pe from"os";import A from"consola";var V;function _(e,o,t){console.log(),console.log(` ${a.default.bold("\u{1F30C} Valaxy")} ${a.default.blue(`v${R}`)}`),console.log(),console.log(`${a.default.dim(" \u{1FA90} theme ")} > ${e.theme?a.default.green(e.theme):a.default.gray("none")}`),console.log(` ${a.default.dim("\u{1F4C1}")} ${a.default.dim(Te.resolve(e.userRoot))}`),o&&(console.log(),console.log(`${a.default.dim(" Preview ")} > ${a.default.cyan(`http://localhost:${a.default.bold(o)}/`)}`),t&&Object.values(Pe.networkInterfaces()).forEach(r=>(r||[]).filter(s=>s.family==="IPv4"&&!s.address.includes("127.0.0.1")).forEach(({address:s})=>{console.log(`${a.default.dim(" Network ")} > ${a.default.blue(`http://${s}:${a.default.bold(o)}/`)}`)})),console.log(),console.log(`${a.default.dim(" shortcuts ")} > ${a.default.underline("r")}${a.default.dim("estart | ")}${a.default.underline("o")}${a.default.dim("pen | ")}${a.default.underline("e")}${a.default.dim("dit")}`)),console.log()}async function D(e,o){V&&await V.close();try{let t=H(e.config).concat(e.config.unocss.safelist||[]);V=await Z(e,o,{onConfigReload(r,s){let c=!1;r.social.some((m,x)=>!t.includes(m.icon)&&m.icon!==s.social[x].icon)&&(A.info("Find new icon, reload server..."),A.info(`If you do not want to reload it, write icon name in ${a.default.green("config.unocss.safelist")}.`),A.info('For example: ["i-ri-cloud-line"]'),console.log(),c=!0),c&&D(e,o)}}),await V.listen()}catch(t){A.error(`failed to start server. error:
6
+ `),console.error(t),process.exit(1)}}function ie(e){process.stdin.resume(),process.stdin.setEncoding("utf8"),se.emitKeypressEvents(process.stdin),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.on("keypress",(o,t)=>{if(t.ctrl&&t.name==="c")process.exit();else{let[r]=e.filter(s=>s.name===o);if(r)try{r.action()}catch(s){console.error(`Failed to execute shortcut ${r.fullName}`,s)}}})}var J=ze.scriptName("valaxy").usage("$0 [args]").version(R).showHelpOnFail(!1).alias("h","help").alias("v","version");J.command("* [root]","Start a local server for Valaxy",e=>ce(e).option("port",{alias:"p",type:"number",describe:"port"}).option("open",{alias:"o",default:!1,type:"boolean",describe:"open in browser"}).option("remote",{default:!0,type:"boolean",describe:"listen public host and enable remote control"}).option("log",{default:"warn",type:"string",choices:["error","warn","info","silent"],describe:"log level"}).strict().help(),async({root:e,port:o,open:t,remote:r,log:s})=>{Ue.existsSync(ae.resolve(e,"pages"))||process.exit(0);let c=o||4859,g=await U({userRoot:e}),m={server:{watch:{ignored:[`!${g.themeRoot}/**`,`${g.userRoot}/**.md`]},port:c,strictPort:!0,open:t,host:r?"0.0.0.0":"localhost"},logLevel:s};await D(g,m),_(g,c,r),ie([{name:"r",fullName:"restart",action(){D(g,m)}},{name:"o",fullName:"open",action(){Je(`http://localhost:${c}`)}},{name:"e",fullName:"edit",action(){_e(`code "${e}"`)}}])});J.command("build [root]","build your blog to static content",e=>ce(e).option("ssg",{alias:"s",type:"boolean",default:!1,describe:"static site generate"}).option("output",{alias:"o",type:"string",default:"dist",describe:"output dir"}).option("base",{type:"string",describe:"output base"}).strict().help(),async({ssg:e,root:o,base:t,output:r})=>{let s=await U({userRoot:o});if(_(s),e){z.info("use vite-ssg to do ssg build...");try{await Ye({mode:"production"})}catch(c){z.error("[vite-ssg] An internal error occurred."),console.log(c)}}else{let{build:c}=await Promise.resolve().then(()=>B(L("../build-RREYJOHF.mjs")));z.info("use vite do spa build..."),await c(s,{base:t,build:{emptyOutDir:!0,outDir:ae.resolve(s.userRoot,r)}})}});function ce(e){return e.positional("root",{default:".",type:"string",describe:"root folder of your source files"})}function vt(){J.help().parse()}export{vt as run};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7JDYOPIDjs = require('../chunk-7JDYOPID.js');require('../chunk-L5SNNWFJ.js');var _chunkL3EDI35Ijs = require('../chunk-L3EDI35I.js');_chunkL3EDI35Ijs.e.call(void 0, );exports.createServer = _chunk7JDYOPIDjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHUI4MBPMjs = require('../chunk-HUI4MBPM.js');require('../chunk-EM2KSV5V.js');var _chunk44DGW27Sjs = require('../chunk-44DGW27S.js');_chunk44DGW27Sjs.f.call(void 0, );exports.createServer = _chunkHUI4MBPMjs.a;
@@ -1 +1 @@
1
- import{a as r}from"../chunk-JJEBEWGI.mjs";import"../chunk-QI435Q25.mjs";import{e as o}from"../chunk-MVJUGWXR.mjs";o();export{r as createServer};
1
+ import{a as r}from"../chunk-CSMXFOVS.mjs";import"../chunk-MWP3FN5Q.mjs";import{f as o}from"../chunk-RKUUEWDF.mjs";o();export{r as createServer};