valaxy 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/valaxy.js +1 -1
- package/dist/build-CLF7GOPQ.mjs +1 -0
- package/dist/build-F47TGGER.js +1 -0
- package/dist/{node/index.mjs → chunk-5S6S3FLN.mjs} +36 -36
- package/dist/chunk-JORQSKHF.mjs +1 -0
- package/dist/chunk-TOMJSB6R.js +83 -0
- package/dist/chunk-VJNIZVTJ.js +1 -0
- package/dist/{node/cli.d.ts → cli.d.ts} +0 -0
- package/dist/cli.js +6 -0
- package/dist/cli.mjs +6 -0
- package/dist/index.d.ts +152 -305
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/src/node/plugins/preset.ts +1 -0
- package/src/node/vite.ts +3 -2
- package/tsup.config.ts +3 -3
- package/dist/config-d6527c8c.d.ts +0 -174
- package/dist/node/cli.js +0 -88
- package/dist/node/cli.mjs +0 -88
- package/dist/node/index.d.ts +0 -45
- package/dist/node/index.js +0 -83
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTOMJSB6Rjs = require('./chunk-TOMJSB6R.js');_chunkTOMJSB6Rjs.d.call(void 0, );var _vite = require('vite');async function c(o,t={},i={}){return process.env.EDITOR=process.env.EDITOR||"code",await _vite.createServer.call(void 0, _vite.mergeConfig.call(void 0, t,_chunkTOMJSB6Rjs.j.call(void 0, o,i)))}exports.a = c;
|
|
File without changes
|
package/dist/cli.js
ADDED
|
@@ -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 _chunkVJNIZVTJjs = require('./chunk-VJNIZVTJ.js');var _chunkTOMJSB6Rjs = require('./chunk-TOMJSB6R.js');var Q=_chunkTOMJSB6Rjs.b.call(void 0, (We,K)=>{_chunkTOMJSB6Rjs.d.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=_chunkTOMJSB6Rjs.b.call(void 0, (Ze,X)=>{_chunkTOMJSB6Rjs.d.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=_chunkTOMJSB6Rjs.b.call(void 0, (f,S)=>{_chunkTOMJSB6Rjs.d.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=_chunkTOMJSB6Rjs.b.call(void 0, (u,E)=>{_chunkTOMJSB6Rjs.d.call(void 0, );var je=_chunkTOMJSB6Rjs.a.call(void 0, "tty"),I=_chunkTOMJSB6Rjs.a.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=_chunkTOMJSB6Rjs.e.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=_chunkTOMJSB6Rjs.b.call(void 0, (Ke,T)=>{_chunkTOMJSB6Rjs.d.call(void 0, );typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?T.exports=ee():T.exports=oe()});_chunkTOMJSB6Rjs.d.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.1.0";_chunkTOMJSB6Rjs.d.call(void 0, );var ne=_chunkTOMJSB6Rjs.c.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):_chunkTOMJSB6Rjs.g.call(void 0, `valaxy-theme-${e}/package.json`):""}async function U(e){let o=_path.resolve.call(void 0, _chunkTOMJSB6Rjs.g.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 _chunkTOMJSB6Rjs.i.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}_chunkTOMJSB6Rjs.d.call(void 0, );var a=_chunkTOMJSB6Rjs.c.call(void 0, _chunkTOMJSB6Rjs.f.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=_chunkTOMJSB6Rjs.h.call(void 0, e.config).concat(e.config.unocss.safelist||[]);V=await _chunkVJNIZVTJjs.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(()=>_chunkTOMJSB6Rjs.c.call(void 0, _chunkTOMJSB6Rjs.a.call(void 0, "./build-F47TGGER.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/cli.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as Z}from"./chunk-JORQSKHF.mjs";import{a as L,b as F,c as B,d as p,e as de,f as me,g as M,h as H,i as W}from"./chunk-5S6S3FLN.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.1.0";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-CLF7GOPQ.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};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,356 +1,203 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { InlineConfig } from 'vite';
|
|
3
|
+
import { VitePluginConfig } from 'unocss/vite';
|
|
4
|
+
import MarkdownIt from 'markdown-it';
|
|
5
|
+
import Anchor from 'markdown-it-anchor';
|
|
6
|
+
import { KatexOptions } from 'katex';
|
|
7
|
+
import Markdown from 'vite-plugin-md';
|
|
8
|
+
|
|
9
|
+
interface MarkdownOptions extends MarkdownIt.Options {
|
|
10
|
+
config?: (md: MarkdownIt) => void;
|
|
11
|
+
anchor?: {
|
|
12
|
+
permalink?: Anchor.AnchorOptions['permalink'];
|
|
13
|
+
};
|
|
14
|
+
toc?: any;
|
|
15
|
+
katex?: KatexOptions;
|
|
16
|
+
}
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
declare type ViteMdOptions = Parameters<typeof Markdown>[0];
|
|
19
|
+
|
|
20
|
+
declare type ValaxyThemeConfig = Record<string, any>;
|
|
21
|
+
interface SocialLink {
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
15
|
-
* route.path
|
|
16
|
-
* @description 路径
|
|
23
|
+
* The title of your link
|
|
17
24
|
*/
|
|
18
|
-
|
|
25
|
+
name: string;
|
|
26
|
+
link: string;
|
|
19
27
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
28
|
+
* 图标名称
|
|
29
|
+
* https://icones.js.org/
|
|
22
30
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
icon: string;
|
|
32
|
+
color: string;
|
|
33
|
+
}
|
|
34
|
+
interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
25
35
|
/**
|
|
26
|
-
*
|
|
36
|
+
* Default language
|
|
37
|
+
* @description 默认语言
|
|
38
|
+
* @default 'en'
|
|
27
39
|
*/
|
|
28
|
-
|
|
29
|
-
lang?: string;
|
|
40
|
+
lang: string;
|
|
30
41
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @description 阅读时长
|
|
42
|
+
* You site url in web, required for ssg, do not add / in end
|
|
43
|
+
* @description 站点的 URL,SSG 需要(譬如生成版权处文章永久链接),不要在末尾添加 /
|
|
34
44
|
*/
|
|
35
|
-
|
|
45
|
+
url: string;
|
|
36
46
|
/**
|
|
37
|
-
*
|
|
47
|
+
* Site title
|
|
48
|
+
* @description 站点标题
|
|
38
49
|
*/
|
|
39
|
-
|
|
50
|
+
title: string;
|
|
40
51
|
/**
|
|
41
|
-
*
|
|
52
|
+
* 副标题
|
|
42
53
|
*/
|
|
43
|
-
|
|
54
|
+
subtitle: string;
|
|
44
55
|
/**
|
|
45
|
-
*
|
|
56
|
+
* 站点描述
|
|
46
57
|
*/
|
|
47
|
-
|
|
58
|
+
description: string;
|
|
48
59
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @description
|
|
60
|
+
* The owner of this blog
|
|
61
|
+
* @description 博客作者
|
|
51
62
|
*/
|
|
52
|
-
|
|
63
|
+
author: {
|
|
64
|
+
/**
|
|
65
|
+
* Your name
|
|
66
|
+
* @description 你的名字
|
|
67
|
+
*/
|
|
68
|
+
name: string;
|
|
69
|
+
avatar: string;
|
|
70
|
+
/**
|
|
71
|
+
* The status of you
|
|
72
|
+
* @description 状态
|
|
73
|
+
*/
|
|
74
|
+
status: {
|
|
75
|
+
emoji: string;
|
|
76
|
+
/**
|
|
77
|
+
* show when hover emoji
|
|
78
|
+
* @description 当鼠标悬浮在图标上时显示
|
|
79
|
+
*/
|
|
80
|
+
message: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
53
83
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @description 是否显示文章底部版权信息
|
|
84
|
+
* 社交链接
|
|
56
85
|
*/
|
|
57
|
-
|
|
86
|
+
social: SocialLink[];
|
|
58
87
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @description 分类,若为数组,则按顺序代表多层文件夹
|
|
88
|
+
* search
|
|
61
89
|
*/
|
|
62
|
-
|
|
90
|
+
search: {
|
|
91
|
+
algolia: {
|
|
92
|
+
enable: boolean;
|
|
93
|
+
appId: string;
|
|
94
|
+
apiKey: string;
|
|
95
|
+
indexName: string;
|
|
96
|
+
chunkSize: number;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
63
99
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @description 标签,可以有多个
|
|
100
|
+
* comment: waline/...
|
|
66
101
|
*/
|
|
67
|
-
|
|
102
|
+
comment: {
|
|
103
|
+
waline: {
|
|
104
|
+
enable: boolean;
|
|
105
|
+
serverURL: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
68
108
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @description
|
|
109
|
+
* The name of theme
|
|
110
|
+
* @description 主题名称
|
|
71
111
|
*/
|
|
72
|
-
|
|
112
|
+
theme: string;
|
|
73
113
|
/**
|
|
74
|
-
*
|
|
114
|
+
* The config of theme
|
|
115
|
+
* @description 主题配置
|
|
75
116
|
*/
|
|
76
|
-
|
|
117
|
+
themeConfig: T;
|
|
77
118
|
/**
|
|
78
|
-
*
|
|
119
|
+
* Unocss Config
|
|
79
120
|
*/
|
|
80
|
-
|
|
121
|
+
unocss: VitePluginConfig;
|
|
81
122
|
/**
|
|
82
|
-
*
|
|
123
|
+
* The license of your posts
|
|
124
|
+
* @description 文章所使用的协议,默认使用 Creative Commons
|
|
125
|
+
* @default https://creativecommons.org/licenses/
|
|
83
126
|
*/
|
|
84
|
-
|
|
127
|
+
license: {
|
|
128
|
+
/**
|
|
129
|
+
* Whether to show at the bottom of the article
|
|
130
|
+
* @description 是否显示在文章底部
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
133
|
+
enabled: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Creative License Language, same with your config.lang
|
|
136
|
+
* when lang === 'zh-CN', use 'zh'
|
|
137
|
+
* @description 默认与站点语言相同
|
|
138
|
+
* @default 'en'
|
|
139
|
+
*/
|
|
140
|
+
language: string;
|
|
141
|
+
/**
|
|
142
|
+
* Type of license
|
|
143
|
+
* @description 证书类型
|
|
144
|
+
* @default 'by-nc-sa'
|
|
145
|
+
*/
|
|
146
|
+
type: 'zero' | 'by-sa' | 'by-nd' | 'by-nc' | 'by-nc-sa' | 'by-nc-nd';
|
|
147
|
+
};
|
|
85
148
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @description
|
|
149
|
+
* donate for author
|
|
150
|
+
* @description 打赏/赞助
|
|
88
151
|
*/
|
|
89
|
-
|
|
152
|
+
sponsor: {
|
|
153
|
+
enable: boolean;
|
|
154
|
+
title: string;
|
|
155
|
+
methods: {
|
|
156
|
+
name: string;
|
|
157
|
+
url: string;
|
|
158
|
+
color: string;
|
|
159
|
+
icon: string;
|
|
160
|
+
}[];
|
|
161
|
+
};
|
|
90
162
|
/**
|
|
91
|
-
*
|
|
163
|
+
* for markdown
|
|
92
164
|
*/
|
|
93
|
-
|
|
165
|
+
markdown: ViteMdOptions;
|
|
166
|
+
markdownIt: MarkdownOptions;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface ResolvedValaxyOptions {
|
|
94
170
|
/**
|
|
95
|
-
*
|
|
171
|
+
* Client root path
|
|
172
|
+
* @default 'valaxy/src/client'
|
|
96
173
|
*/
|
|
97
|
-
|
|
174
|
+
clientRoot: string;
|
|
98
175
|
/**
|
|
99
|
-
*
|
|
176
|
+
* User root path
|
|
177
|
+
* @default process.cwd()
|
|
100
178
|
*/
|
|
101
|
-
|
|
179
|
+
userRoot: string;
|
|
102
180
|
/**
|
|
103
|
-
*
|
|
181
|
+
* Theme root path
|
|
104
182
|
*/
|
|
105
|
-
|
|
183
|
+
themeRoot: string;
|
|
106
184
|
/**
|
|
107
|
-
*
|
|
108
|
-
* @description 是否显示目录
|
|
185
|
+
* Theme name
|
|
109
186
|
*/
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Theme Config
|
|
115
|
-
*/
|
|
116
|
-
interface ThemeConfig {
|
|
187
|
+
theme: string;
|
|
117
188
|
/**
|
|
118
|
-
*
|
|
189
|
+
* Valaxy Config
|
|
119
190
|
*/
|
|
120
|
-
|
|
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
|
-
};
|
|
191
|
+
config: ValaxyConfig;
|
|
133
192
|
/**
|
|
134
|
-
*
|
|
135
|
-
* https://say.elpsy.cn
|
|
193
|
+
* config file path
|
|
136
194
|
*/
|
|
137
|
-
|
|
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
|
-
}>;
|
|
195
|
+
configFile: string;
|
|
197
196
|
}
|
|
198
|
-
|
|
199
|
-
|
|
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[];
|
|
197
|
+
interface ValaxyServerOptions {
|
|
198
|
+
onConfigReload?: (newConfig: ValaxyConfig, config: ValaxyConfig) => void;
|
|
216
199
|
}
|
|
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
|
-
/**
|
|
341
|
-
* use dayjs format date
|
|
342
|
-
* @param date
|
|
343
|
-
* @param template
|
|
344
|
-
* @returns
|
|
345
|
-
*/
|
|
346
|
-
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
347
|
-
/**
|
|
348
|
-
* sort posts by date
|
|
349
|
-
* @param posts
|
|
350
|
-
* @param desc
|
|
351
|
-
*/
|
|
352
|
-
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
353
200
|
|
|
354
|
-
declare
|
|
201
|
+
declare function createServer(options: ResolvedValaxyOptions, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<vite.ViteDevServer>;
|
|
355
202
|
|
|
356
|
-
export {
|
|
203
|
+
export { createServer };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ie=Object.create;var x=Object.defineProperty,se=Object.defineProperties,ae=Object.getOwnPropertyDescriptor,le=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols,ue=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var q=(e,t,o)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,U=(e,t)=>{for(var o in t||(t={}))Y.call(t,o)&&q(e,o,t[o]);if(R)for(var o of R(t))me.call(t,o)&&q(e,o,t[o]);return e},I=(e,t)=>se(e,le(t));var pe=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},O=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ce(t))!Y.call(e,i)&&i!==o&&x(e,i,{get:()=>t[i],enumerable:!(n=ae(t,i))||n.enumerable});return e};var N=(e,t,o)=>(o=e!=null?ie(ue(e)):{},O(t||!e||!e.__esModule?x(o,"default",{value:e,enumerable:!0}):o,e)),fe=e=>O(x({},"__esModule",{value:!0}),e);var Ie={};pe(Ie,{defaultValaxyConfig:()=>Ue,formatDate:()=>ye,initConfig:()=>ge,isDark:()=>G,isDev:()=>A,random:()=>de,sortByDate:()=>C,toggleDark:()=>Pe,useActiveSidebarLinks:()=>Ve,useAplayer:()=>Ae,useBackToTop:()=>Me,useCategory:()=>Ce,useCodePen:()=>Se,useConfig:()=>b,useFrontmatter:()=>Te,useFullUrl:()=>Le,useInvisibleElement:()=>ke,useKatex:()=>je,useLayout:()=>Ee,usePostList:()=>d,usePostProperty:()=>be,usePrevNext:()=>ve,useTag:()=>F,useTags:()=>we,useThemeConfig:()=>E,useWaline:()=>Ye,valaxyConfigRef:()=>P,valaxyConfigSymbol:()=>J,wrap:()=>W,wrapTable:()=>he});module.exports=fe(Ie);var z=N(require("@valaxyjs/config")),p=require("vue"),k={};function B(e){let t=JSON.parse(e);return k.env.DEV?(0,p.readonly)(t):t}var J=Symbol("valaxy:config"),P=(0,p.shallowRef)(B(z.default));k.hot&&k.hot.accept("/@valaxyjs/config",e=>{P.value=B(e.default)});function ge(){return(0,p.computed)(()=>P.value)}function b(){let e=(0,p.inject)(J);if(!e)throw new Error("[Valaxy] config not properly injected in qpp");return e}function E(){let e=b();return(0,p.computed)(()=>e.value.themeConfig)}var f=require("vue"),w=require("vue-router");function de(e,t){return Math.random()*(t-e)+e}function W(e,t){let o=document.createElement("div");o.className=t,e.parentNode.insertBefore(o,e),e.parentNode.removeChild(e),o.appendChild(e)}var he=(e=document)=>{e.querySelectorAll("table").forEach(t=>{let o=document.createElement("div");o.className="table-container",W(t,"table-container")})};var K=N(require("dayjs"));function ye(e,t="YYYY-MM-DD"){return(0,K.default)(e).format(t)}function C(e,t=!0){return e.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return t?r-i:i-r})}var xe={},A=xe.env.DEV===!0;function d(e={}){let t=(0,w.useRouter)();return(0,f.computed)(()=>{let o=t.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!e.type||r.meta.frontmatter.type===e.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=C(o.filter(r=>r.top)).sort((r,s)=>s.top-r.top),i=C(o.filter(r=>!r.top));return n.concat(i)})}function ve(e){let t=(0,w.useRoute)(),o=(0,f.computed)(()=>e||t.path),n=d(),i=(0,f.computed)(()=>{let l=-1;return n.value.find((u,m)=>u.path===o.value?(l=m,!0):!1),l}),r=(0,f.computed)(()=>i.value-1>=0?n.value[i.value-1]:null),s=(0,f.computed)(()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,s]}function be(e){if(!e)return{color:"",icon:"",styles:{}};let t=E();e in t.value.types||(e="link");let o=t.value.types[e].color,n=t.value.types[e].icon,i=(0,f.computed)(()=>({"--card-c-primary":e&&o}));return{color:o,icon:n,styles:i}}function Ce(){var n;let e=d(),t={total:e.value.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},o=t.children.get("Uncategorized");return e.value.forEach(i=>{if(i.categories)if(Array.isArray(i.categories)){let r=i.categories.length,s=t;i.categories.forEach((l,u)=>{var m,y,g;if(u===r-1)if(s.children.has(l)){let c=s.children.get(l);c.posts&&(c.total+=1,c.posts.push(i))}else(m=s.children)==null||m.set(l,{total:1,posts:[i]});else if((y=s.children)!=null&&y.has(l)){let c=s.children.get(l);c.total+=1,s=c}else{let c={total:1,children:new Map};(g=s.children)==null||g.set(l,c),s=c}})}else{let r=i.categories;if(t.children.has(r)){let s=t.children.get(r);s.total+=1,s.posts.push(i)}else t.children.set(r,{total:1,posts:[i]})}else o.total+=1,o.posts.push(i)}),o.total===0&&((n=t.children)==null||n.delete("Uncategorized")),t}var M=require("@ctrl/tinycolor");function we(){let e=F(),t=new M.TinyColor("#999999"),o=new M.TinyColor(getComputedStyle(document.documentElement).getPropertyValue("--yun-c-primary"));return{tags:e,getTagStyle:i=>{let r=Array.from(e).map(([y,g])=>g.count),s=Math.max(...r),l=Math.min(...r),u=s-l,m=(i-l)/u;return{"--yun-tag-color":t.mix(o,m*100).toString(),fontSize:`${m*36+12}px`}}}}function F(){let e=d(),t=new Map;return e.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(t.has(i)){let r=t.get(i);t.set(i,I(U({},r),{count:r.count+1}))}else t.set(i,{count:1})})}}),t}var S=require("vue-router"),V=require("vue");function Te(){let e=(0,S.useRoute)(),t=(0,V.computed)(()=>e.meta.frontmatter);return A&&console.log(t.value),t}function Le(){let e=b(),t=(0,S.useRoute)();return(0,V.computed)(()=>(e.value.url||(window==null?void 0:window.location.origin))+t.path)}var Q=require("@vueuse/head");function je(){(0,Q.useHead)({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}var T=require("@vueuse/core"),$=require("vue");function ke(e){let t=(0,$.ref)(!1),{top:o}=(0,T.useElementBounding)(e);return(0,T.useIntersectionObserver)(e,([{isIntersecting:i}])=>{t.value=i}),{show:()=>{t.value||window.scrollTo(0,o.value)}}}var L=require("@vueuse/core"),G=(0,L.useDark)(),Pe=(0,L.useToggle)(G);var _=require("vue"),X=require("vue-router");function Ee(e){let t=(0,X.useRoute)();return(0,_.computed)(()=>t.meta.layout===e)}var D=require("@vueuse/core"),Z=require("@vueuse/head");function Ae(){(0,Z.useHead)({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),(0,D.useScriptTag)("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{(0,D.useScriptTag)("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}var ee=require("@vueuse/core"),H=require("vue");function Me(e={offset:100}){let{y:t}=(0,ee.useWindowScroll)(),o=(0,H.computed)(()=>t.value/document.body.clientHeight),n=(0,H.computed)(()=>t.value>e.offset);return{percentage:o,show:n}}var te=require("@vueuse/head");function Se(){(0,te.useHead)({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}var h=require("vue");function Ve(){let e=null,t=null,o=qe(n,200);function n(){let s=De(),l=He(s);for(let u=0;u<l.length;u++){let m=l[u],y=l[u+1],[g,c]=Re(u,m,y);if(g){history.replaceState(null,document.title,c||" "),i(c);return}}}function i(s){if(r(t),r(e),t=document.querySelector(`.val-toc a[href="${s}"]`),!t)return;t.classList.add("active");let l=t.closest(".right-sidebar-container > ul > li");l&&l!==t.parentElement?(e=l.querySelector("a"),e&&e.classList.add("active")):e=null}function r(s){s&&s.classList.remove("active")}(0,h.onMounted)(()=>{n(),window.addEventListener("scroll",o)}),(0,h.onUpdated)(()=>{i(decodeURIComponent(location.hash))}),(0,h.onUnmounted)(()=>{window.removeEventListener("scroll",o)})}function De(){return[].slice.call(document.querySelectorAll(".val-toc a.toc-link-item"))}function He(e){return[].slice.call(document.querySelectorAll(".header-anchor")).filter(t=>e.some(o=>o.hash===t.hash))}function oe(e){return e.parentElement.offsetTop-50}function Re(e,t,o){let n=window.scrollY;return e===0&&n===0?[!0,null]:n<oe(t)?[!1,null]:!o||n<oe(o)?[!0,decodeURIComponent(t.hash)]:[!1,null]}function qe(e,t){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(e,t):(e(),n=!0,setTimeout(()=>{n=!1},t))}}var j=require("@vueuse/core"),v=require("vue"),ne=require("vue-i18n"),re=require("vue-router");function Ye(e={}){let t=(0,re.useRoute)(),{locale:o}=(0,ne.useI18n)(),n;function i(r={}){if(!j.isClient)return;let s={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:t.path},l=Object.assign(s,r);return window.Waline(l)}(0,j.useScriptTag)("//cdn.jsdelivr.net/npm/@waline/client",()=>{n=i(e)}),(0,v.watch)(()=>t.path,r=>{!n||n.update({path:r})}),(0,v.watch)(o,r=>{!n||n.update({lang:r})}),(0,v.onUnmounted)(()=>{!n||n.destroy()})}var Ue={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:{}}};0&&(module.exports={defaultValaxyConfig,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});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVJNIZVTJjs = require('./chunk-VJNIZVTJ.js');var _chunkTOMJSB6Rjs = require('./chunk-TOMJSB6R.js');_chunkTOMJSB6Rjs.d.call(void 0, );exports.createServer = _chunkVJNIZVTJjs.a;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{a as r}from"./chunk-JORQSKHF.mjs";import{d as o}from"./chunk-5S6S3FLN.mjs";o();export{r as createServer};
|