valaxy 0.0.5 → 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 (43) hide show
  1. package/bin/valaxy.js +1 -1
  2. package/dist/build-RREYJOHF.mjs +1 -0
  3. package/dist/build-TIU2KH77.js +1 -0
  4. package/dist/chunk-44DGW27S.js +1 -0
  5. package/dist/chunk-CSMXFOVS.mjs +1 -0
  6. package/dist/chunk-EM2KSV5V.js +83 -0
  7. package/dist/chunk-HUI4MBPM.js +1 -0
  8. package/dist/chunk-MWP3FN5Q.mjs +83 -0
  9. package/dist/chunk-RKUUEWDF.mjs +1 -0
  10. package/dist/config-d6527c8c.d.ts +174 -0
  11. package/dist/index.d.ts +299 -152
  12. package/dist/index.js +1 -1
  13. package/dist/index.mjs +1 -1
  14. package/dist/{cli.d.ts → node/cli.d.ts} +0 -0
  15. package/dist/node/cli.js +6 -0
  16. package/dist/node/cli.mjs +6 -0
  17. package/dist/node/index.d.ts +45 -0
  18. package/dist/node/index.js +1 -0
  19. package/dist/node/index.mjs +1 -0
  20. package/package.json +35 -35
  21. package/src/client/composables/category.ts +2 -2
  22. package/src/client/composables/common.ts +3 -2
  23. package/src/client/composables/post.ts +2 -2
  24. package/src/client/composables/tag.ts +2 -1
  25. package/src/{core → client}/config.ts +1 -1
  26. package/src/client/index.ts +4 -0
  27. package/src/client/utils/index.ts +2 -0
  28. package/src/client/utils/time.ts +1 -1
  29. package/src/index.ts +1 -1
  30. package/src/node/plugins/extendConfig.ts +44 -0
  31. package/src/node/plugins/preset.ts +12 -1
  32. package/src/node/vite.ts +1 -32
  33. package/tsup.config.ts +7 -4
  34. package/dist/build-LSWX3GTV.mjs +0 -1
  35. package/dist/build-QCHURQKL.js +0 -1
  36. package/dist/chunk-7NQGUR4O.mjs +0 -1
  37. package/dist/chunk-DEKAH6ZE.js +0 -1
  38. package/dist/chunk-TIPISWPV.mjs +0 -10
  39. package/dist/chunk-ZX4FV7OA.js +0 -10
  40. package/dist/cli.js +0 -2
  41. package/dist/cli.mjs +0 -2
  42. package/src/core/index.ts +0 -5
  43. package/src/core/utils.ts +0 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDEKAH6ZEjs = require('./chunk-DEKAH6ZE.js');require('./chunk-ZX4FV7OA.js');exports.createServer = _chunkDEKAH6ZEjs.a;
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 CHANGED
@@ -1 +1 @@
1
- import{a as o}from"./chunk-7NQGUR4O.mjs";import"./chunk-TIPISWPV.mjs";export{o as createServer};
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};
File without changes
@@ -0,0 +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 _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
+ `).join(`
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;
@@ -0,0 +1,6 @@
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
+ `).join(`
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};
@@ -0,0 +1,45 @@
1
+ import * as vite from 'vite';
2
+ import { InlineConfig } from 'vite';
3
+ import { V as ValaxyConfig } from '../config-d6527c8c.js';
4
+ import 'type-fest';
5
+ import 'unocss/vite';
6
+ import 'markdown-it';
7
+ import 'markdown-it-anchor';
8
+ import 'katex';
9
+ import 'vite-plugin-md';
10
+
11
+ interface ResolvedValaxyOptions {
12
+ /**
13
+ * Client root path
14
+ * @default 'valaxy/src/client'
15
+ */
16
+ clientRoot: string;
17
+ /**
18
+ * User root path
19
+ * @default process.cwd()
20
+ */
21
+ userRoot: string;
22
+ /**
23
+ * Theme root path
24
+ */
25
+ themeRoot: string;
26
+ /**
27
+ * Theme name
28
+ */
29
+ theme: string;
30
+ /**
31
+ * Valaxy Config
32
+ */
33
+ config: ValaxyConfig;
34
+ /**
35
+ * config file path
36
+ */
37
+ configFile: string;
38
+ }
39
+ interface ValaxyServerOptions {
40
+ onConfigReload?: (newConfig: ValaxyConfig, config: ValaxyConfig) => void;
41
+ }
42
+
43
+ declare function createServer(options: ResolvedValaxyOptions, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<vite.ViteDevServer>;
44
+
45
+ export { createServer };
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "📄 Vite & Vue powered static blog generator.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,6 +9,10 @@
9
9
  "vue",
10
10
  "blog"
11
11
  ],
12
+ "bin": {
13
+ "vala": "./bin/valaxy.js",
14
+ "valaxy": "./bin/valaxy.js"
15
+ },
12
16
  "author": {
13
17
  "email": "me@yunyoujun.cn",
14
18
  "name": "YunYouJun",
@@ -17,28 +21,32 @@
17
21
  "license": "MIT",
18
22
  "homepage": "https://valaxy.yyj.moe",
19
23
  "repository": "https://github.com/YunYouJun/valaxy",
20
- "bin": {
21
- "vala": "./bin/valaxy.js",
22
- "valaxy": "./bin/valaxy.js"
23
- },
24
24
  "devDependencies": {
25
- "@ctrl/tinycolor": "^3.4.0",
26
- "@iconify-json/carbon": "^1.1.1",
27
- "@iconify-json/ri": "^1.1.1",
28
- "@intlify/vite-plugin-vue-i18n": "^3.3.1",
29
25
  "@types/katex": "^0.14.0",
30
26
  "@types/markdown-it-link-attributes": "^3.0.1",
31
27
  "@types/nprogress": "^0.2.0",
32
28
  "@types/yargs": "^17.0.10",
33
- "@unocss/reset": "^0.30.8",
34
- "@vitejs/plugin-vue": "^2.3.1",
35
29
  "chalk": "4",
36
- "consola": "^2.15.3",
37
- "critters": "^0.0.16",
38
30
  "cross-env": "^7.0.3",
39
31
  "debug": "^4.3.4",
40
32
  "diacritics": "^1.3.0",
41
33
  "https-localhost": "^4.7.1",
34
+ "type-fest": "^2.12.2",
35
+ "vue-tsc": "^0.33.9"
36
+ },
37
+ "dependencies": {
38
+ "@ctrl/tinycolor": "^3.4.0",
39
+ "@iconify-json/carbon": "^1.1.1",
40
+ "@iconify-json/ri": "^1.1.1",
41
+ "@intlify/vite-plugin-vue-i18n": "^3.3.1",
42
+ "@unocss/reset": "^0.30.8",
43
+ "@vitejs/plugin-vue": "^2.3.1",
44
+ "@vueuse/core": "^8.2.3",
45
+ "@vueuse/head": "^0.7.5",
46
+ "consola": "^2.15.3",
47
+ "critters": "^0.0.16",
48
+ "dayjs": "^1.11.0",
49
+ "fast-deep-equal": "^3.1.3",
42
50
  "katex": "^0.15.3",
43
51
  "markdown-it-anchor": "^8.4.1",
44
52
  "markdown-it-container": "^3.0.0",
@@ -46,40 +54,32 @@
46
54
  "markdown-it-link-attributes": "^4.0.0",
47
55
  "markdown-it-prism": "^2.2.3",
48
56
  "markdown-it-table-of-contents": "^0.6.0",
57
+ "nprogress": "^0.2.0",
49
58
  "open": "^8.4.0",
59
+ "pinia": "^2.0.13",
60
+ "prism-theme-vars": "^0.2.2",
50
61
  "sass": "^1.49.10",
51
62
  "star-markdown-css": "^0.3.0",
52
- "type-fest": "^2.12.2",
63
+ "unconfig": "^0.3.2",
64
+ "vue": "^3.2.31",
65
+ "vue-demi": "^0.12.5",
66
+ "vue-i18n": "^9.1.9",
67
+ "vue-router": "^4.0.14",
68
+ "yargs": "^17.4.0",
53
69
  "unocss": "^0.30.8",
54
70
  "unplugin-vue-components": "^0.18.5",
55
71
  "vite": "^2.9.1",
56
- "vite-plugin-inspect": "^0.4.3",
72
+ "vite-ssg": "^0.19.0",
57
73
  "vite-plugin-md": "^0.12.4",
58
74
  "vite-plugin-pages": "^0.22.0",
75
+ "vite-plugin-inspect": "^0.4.3",
59
76
  "vite-plugin-pwa": "^0.11.13",
60
77
  "vite-plugin-vue-layouts": "^0.6.0",
61
- "vite-ssg": "^0.19.0",
62
- "vite-ssg-sitemap": "^0.2.0",
63
- "vue-tsc": "^0.33.9"
64
- },
65
- "dependencies": {
66
- "@vueuse/core": "^8.2.3",
67
- "@vueuse/head": "^0.7.5",
68
- "dayjs": "^1.11.0",
69
- "fast-deep-equal": "^3.1.3",
70
- "nprogress": "^0.2.0",
71
- "pinia": "^2.0.13",
72
- "prism-theme-vars": "^0.2.2",
73
- "unconfig": "^0.3.2",
74
- "vue": "^3.2.31",
75
- "vue-demi": "^0.12.5",
76
- "vue-i18n": "^9.1.9",
77
- "vue-router": "^4.0.14",
78
- "yargs": "^17.4.0"
78
+ "vite-ssg-sitemap": "^0.2.0"
79
79
  },
80
80
  "scripts": {
81
- "build": "tsup-node",
82
- "dev": "tsup-node --watch",
81
+ "build": "tsup",
82
+ "dev": "tsup --watch",
83
83
  "lint": "eslint \"**/*.{vue,ts,js}\"",
84
84
  "preview": "vite preview",
85
85
  "preview-https": "serve dist",
@@ -1,4 +1,4 @@
1
- import type { Post } from 'valaxy'
1
+ import type { Post } from '../../types'
2
2
  import { usePostList } from './post'
3
3
 
4
4
  export interface ParentCategory {
@@ -32,7 +32,7 @@ export function useCategory() {
32
32
 
33
33
  const uncategorized = categoryMap.children.get('Uncategorized') as PostCategory
34
34
 
35
- posts.value.forEach((post) => {
35
+ posts.value.forEach((post: Post) => {
36
36
  if (post.categories) {
37
37
  if (Array.isArray(post.categories)) {
38
38
  const len = post.categories.length
@@ -1,8 +1,9 @@
1
1
  import { useRoute } from 'vue-router'
2
- import type { Post } from 'valaxy'
3
2
  import { computed } from 'vue'
4
3
 
5
- import { isDev, useConfig } from 'valaxy'
4
+ import { isDev } from '../..'
5
+ import type { Post } from '../../types'
6
+ import { useConfig } from '../config'
6
7
 
7
8
  export function useFrontmatter() {
8
9
  const route = useRoute()
@@ -1,8 +1,8 @@
1
- import { sortByDate } from 'valaxy'
2
1
  import type { StyleValue } from 'vue'
3
2
  import { computed } from 'vue'
4
3
  import { useRoute, useRouter } from 'vue-router'
5
- import { useThemeConfig } from '../../core/config'
4
+ import { useThemeConfig } from '../config'
5
+ import { sortByDate } from '../utils'
6
6
 
7
7
  /**
8
8
  * get post list
@@ -1,4 +1,5 @@
1
1
  import { TinyColor } from '@ctrl/tinycolor'
2
+ import type { Post } from '../../types'
2
3
  import { usePostList } from './post'
3
4
 
4
5
  export type Tags = Map<string, {
@@ -41,7 +42,7 @@ export function useTag() {
41
42
 
42
43
  const tagMap: Tags = new Map()
43
44
 
44
- posts.value.forEach((post) => {
45
+ posts.value.forEach((post: Post) => {
45
46
  if (post.tags) {
46
47
  let tags: string[]
47
48
  if (typeof post.tags === 'string')
@@ -2,7 +2,7 @@
2
2
  import valaxyConfig from '@valaxyjs/config'
3
3
  import type { ComputedRef, InjectionKey } from 'vue'
4
4
  import { computed, inject, readonly, shallowRef } from 'vue'
5
- import type { ThemeConfig } from 'valaxy-theme-yun'
5
+ import type { ThemeConfig } from '../../../valaxy-theme-yun'
6
6
  import type { ValaxyConfig } from '../types'
7
7
 
8
8
  /**
@@ -0,0 +1,4 @@
1
+ export * from './config'
2
+
3
+ export * from './composables'
4
+ export * from './utils'
@@ -1,2 +1,4 @@
1
1
  export * from './helper'
2
2
  export * from './time'
3
+
4
+ export const isDev = import.meta.env.DEV === true
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs'
2
- import type { Post } from 'valaxy'
2
+ import type { Post } from '../../types'
3
3
 
4
4
  export function formatDate(date: string | number | Date, template = 'YYYY-MM-DD') {
5
5
  const today = dayjs(date)
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './core'
1
+ export * from './client'
2
2
  export * from './types'
@@ -0,0 +1,44 @@
1
+ import { resolve } from 'path'
2
+ import type { InlineConfig, Plugin } from 'vite'
3
+ import { mergeConfig } from 'vite'
4
+ import type { ResolvedValaxyOptions } from '../options'
5
+ import { toAtFS } from '../utils'
6
+
7
+ export function createConfigPlugin(options: ResolvedValaxyOptions): Plugin {
8
+ return {
9
+ name: 'valaxy:config',
10
+ config(config) {
11
+ const injection: InlineConfig = {
12
+ resolve: {
13
+ alias: {
14
+ '@/': `${toAtFS(options.userRoot)}/`,
15
+ '~/': `${toAtFS(options.clientRoot)}/`,
16
+ '@valaxyjs/client': `${toAtFS(options.clientRoot)}/`,
17
+ '@valaxyjs/config': '/@valaxyjs/config',
18
+ 'valaxy/package.json': toAtFS(resolve(options.clientRoot, '../../package.json')),
19
+ 'valaxy': toAtFS(resolve(options.clientRoot, '../index.ts')),
20
+ '@valaxyjs/core': toAtFS(resolve(options.clientRoot, '../core')),
21
+ [`valaxy-theme-${options.theme}`]: `${toAtFS(resolve(options.themeRoot))}/`,
22
+ },
23
+ },
24
+
25
+ optimizeDeps: {
26
+ entries: [resolve(options.clientRoot, 'main.ts'), options.configFile],
27
+
28
+ include: [
29
+ 'vue',
30
+ 'vue-router',
31
+ '@vueuse/core',
32
+ '@vueuse/head',
33
+ 'dayjs',
34
+ 'nprogress',
35
+ ],
36
+ exclude: [
37
+ 'vue-demi',
38
+ ],
39
+ },
40
+ }
41
+ return mergeConfig(config, injection)
42
+ },
43
+ }
44
+ }
@@ -21,11 +21,17 @@ import type { Mode } from '../vite'
21
21
  import { setupMarkdownPlugins } from '../markdown'
22
22
  import { createMarkdownPlugin, excerpt_separator } from './markdown'
23
23
  import { createUnocssPlugin } from './unocss'
24
+ import { createConfigPlugin } from './extendConfig'
24
25
  import { createValaxyPlugin } from '.'
25
26
 
27
+ export interface ValaxyPluginOptions {
28
+ components?: Parameters<typeof Components>[0]
29
+ }
30
+
26
31
  export function ViteValaxyPlugins(
27
32
  options: ResolvedValaxyOptions,
28
33
  serverOptions: ValaxyServerOptions = {},
34
+ pluginOptions: ValaxyPluginOptions = {},
29
35
  mode: Mode = 'dev',
30
36
  ): (PluginOption | PluginOption[])[] | undefined {
31
37
  const { clientRoot, themeRoot, userRoot } = options
@@ -39,6 +45,7 @@ export function ViteValaxyPlugins(
39
45
  const _md = setupMarkdownPlugins(mdIt, options.config.markdownIt)
40
46
 
41
47
  const roots = [clientRoot, themeRoot, userRoot]
48
+
42
49
  return [
43
50
  Vue({
44
51
  include: [/\.vue$/, /\.md$/],
@@ -53,6 +60,7 @@ export function ViteValaxyPlugins(
53
60
 
54
61
  ValaxyPlugin,
55
62
  MarkdownPlugin,
63
+ createConfigPlugin(options),
56
64
 
57
65
  // https://github.com/hannoeru/vite-plugin-pages
58
66
  Pages({
@@ -121,7 +129,10 @@ export function ViteValaxyPlugins(
121
129
  allowOverrides: true,
122
130
  // override: user -> theme -> client
123
131
  // latter override former
124
- dirs: roots.map(root => `${root}/components`),
132
+ dirs: roots.map(root => `${root}/components`).concat(['src/components', 'components']),
133
+ dts: `${options.userRoot}/components.d.ts`,
134
+
135
+ ...pluginOptions,
125
136
  }),
126
137
 
127
138
  // https://github.com/antfu/unocss
package/src/node/vite.ts CHANGED
@@ -1,18 +1,13 @@
1
- import path from 'path'
2
-
3
1
  import generateSitemap from 'vite-ssg-sitemap'
4
2
  import type { InlineConfig } from 'vite'
5
3
  import { searchForWorkspaceRoot } from 'vite'
6
4
  import type { ResolvedValaxyOptions, ValaxyServerOptions } from './options'
7
5
 
8
6
  import { ViteValaxyPlugins } from './plugins/preset'
9
- import { VALAXY_CONFIG_ID } from './plugins/valaxy'
10
7
 
11
8
  export type Mode = 'dev' | 'build'
12
9
 
13
10
  export function createViteConfig(options: ResolvedValaxyOptions, serverOptions: ValaxyServerOptions = {}, mode: Mode = 'dev'): InlineConfig {
14
- const { configFile } = options
15
-
16
11
  const viteConfig: InlineConfig = {
17
12
  // remove vue-i18n warnings
18
13
  // https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags
@@ -26,24 +21,11 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
26
21
  // __VUE_I18N_LEGACY_API__: 'false',
27
22
  // },
28
23
 
29
- resolve: {
30
- alias: {
31
- '@/': `${options.userRoot}/`,
32
- '~/': `${options.clientRoot}/`,
33
- '@valaxyjs/client': `${options.clientRoot}/`,
34
- 'valaxy/package.json': `${path.resolve(options.clientRoot, '../../package.json')}`,
35
- 'valaxy': `${path.resolve(options.clientRoot, '..')}`,
36
- [VALAXY_CONFIG_ID]: `/${VALAXY_CONFIG_ID}`,
37
- '@valaxyjs/core': `${path.resolve(options.clientRoot, '../core')}`,
38
- [`valaxy-theme-${options.theme}`]: `${path.resolve(options.themeRoot)}/`,
39
- },
40
- },
41
-
42
24
  root: options.clientRoot,
43
25
  // todo user base
44
26
  // base: '/',
45
27
 
46
- plugins: ViteValaxyPlugins(options, serverOptions, mode),
28
+ plugins: ViteValaxyPlugins(options, serverOptions, {}, mode),
47
29
 
48
30
  server: {
49
31
  fs: {
@@ -55,19 +37,6 @@ export function createViteConfig(options: ResolvedValaxyOptions, serverOptions:
55
37
  },
56
38
  },
57
39
 
58
- optimizeDeps: {
59
- entries: [path.resolve(options.clientRoot, 'main.ts'), configFile],
60
-
61
- include: [
62
- 'vue',
63
- 'vue-router',
64
- '@vueuse/core',
65
- '@vueuse/head',
66
- ],
67
- exclude: [
68
- 'vue-demi',
69
- ],
70
- },
71
40
  }
72
41
 
73
42
  if (mode === 'build') {
package/tsup.config.ts CHANGED
@@ -2,16 +2,19 @@ import { defineConfig } from 'tsup'
2
2
 
3
3
  export default defineConfig((options) => {
4
4
  return {
5
- entry: ['src/node/index.ts', 'src/node/cli.ts'],
5
+ entry: [
6
+ 'src/node/index.ts',
7
+ 'src/node/cli.ts',
8
+ 'src/index.ts',
9
+ ],
6
10
  splitting: true,
7
11
  clean: true,
8
12
  dts: true,
9
13
  format: ['cjs', 'esm'],
10
14
  minify: !options.watch,
11
15
  external: [
12
- 'vite',
13
- 'sass',
14
- 'chalk',
16
+ '@valaxyjs/config',
17
+ 'valaxy-theme-yun',
15
18
  ],
16
19
  }
17
20
  })
@@ -1 +0,0 @@
1
- import{f as i}from"./chunk-TIPISWPV.mjs";import{mergeConfig as t,build as r}from"vite";async function m(o,n={}){let e=t(n,i(o));await r(e)}export{m as build};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZX4FV7OAjs = require('./chunk-ZX4FV7OA.js');var _vite = require('vite');async function a(o,n={}){let e=_vite.mergeConfig.call(void 0, n,_chunkZX4FV7OAjs.f.call(void 0, o));await _vite.build.call(void 0, e)}exports.build = a;
@@ -1 +0,0 @@
1
- import{f as e}from"./chunk-TIPISWPV.mjs";import{createServer as i,mergeConfig as n}from"vite";async function f(r,o={},t={}){return process.env.EDITOR=process.env.EDITOR||"code",await i(n(o,e(r,t)))}export{f as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZX4FV7OAjs = require('./chunk-ZX4FV7OA.js');var _vite = require('vite');async function c(r,o={},t={}){return process.env.EDITOR=process.env.EDITOR||"code",await _vite.createServer.call(void 0, _vite.mergeConfig.call(void 0, o,_chunkZX4FV7OAjs.f.call(void 0, r,t)))}exports.a = c;