valaxy 0.0.7 → 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/chunk-5S6S3FLN.mjs +83 -0
- 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/{config-d6527c8c.d.ts → index.d.ts} +37 -8
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +9 -5
- package/src/client/components/ValaxyCopyright.vue +1 -1
- package/src/client/composables/category.ts +2 -2
- package/src/client/composables/common.ts +3 -2
- package/src/client/composables/post.ts +2 -2
- package/src/client/composables/tag.ts +2 -1
- package/src/{core → client}/config.ts +1 -1
- package/src/client/index.ts +4 -0
- package/src/client/modules/valaxy.ts +1 -1
- package/src/client/utils/index.ts +2 -0
- package/src/client/utils/time.ts +7 -1
- package/src/index.ts +1 -1
- package/src/node/plugins/extendConfig.ts +20 -3
- package/src/node/plugins/preset.ts +10 -1
- package/src/node/vite.ts +4 -34
- package/tsup.config.ts +8 -4
- package/dist/build-OOT6HK6S.js +0 -1
- package/dist/build-SG32QSQ3.mjs +0 -1
- package/dist/chunk-7JDYOPID.js +0 -1
- package/dist/chunk-JJEBEWGI.mjs +0 -1
- package/dist/chunk-L3EDI35I.js +0 -1
- package/dist/chunk-L5SNNWFJ.js +0 -78
- package/dist/chunk-MVJUGWXR.mjs +0 -1
- package/dist/chunk-QI435Q25.mjs +0 -78
- package/dist/node/cli.js +0 -6
- package/dist/node/cli.mjs +0 -6
- package/dist/node/index.d.ts +0 -45
- package/dist/node/index.js +0 -1
- package/dist/node/index.mjs +0 -1
- package/dist/types/index.d.ts +0 -110
- package/dist/types/index.js +0 -1
- package/dist/types/index.mjs +0 -1
- package/src/core/index.ts +0 -5
- package/src/core/utils.ts +0 -1
|
@@ -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};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { InlineConfig } from 'vite';
|
|
2
3
|
import { VitePluginConfig } from 'unocss/vite';
|
|
3
4
|
import MarkdownIt from 'markdown-it';
|
|
4
5
|
import Anchor from 'markdown-it-anchor';
|
|
@@ -164,11 +165,39 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
|
164
165
|
markdown: ViteMdOptions;
|
|
165
166
|
markdownIt: MarkdownOptions;
|
|
166
167
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Valaxy User Config
|
|
169
|
-
* @description Valaxy 用户配置
|
|
170
|
-
*/
|
|
171
|
-
declare type UserConfig<T = ValaxyThemeConfig> = PartialDeep<ValaxyConfig<T>>;
|
|
172
|
-
declare const defaultValaxyConfig: ValaxyConfig;
|
|
173
168
|
|
|
174
|
-
|
|
169
|
+
interface ResolvedValaxyOptions {
|
|
170
|
+
/**
|
|
171
|
+
* Client root path
|
|
172
|
+
* @default 'valaxy/src/client'
|
|
173
|
+
*/
|
|
174
|
+
clientRoot: string;
|
|
175
|
+
/**
|
|
176
|
+
* User root path
|
|
177
|
+
* @default process.cwd()
|
|
178
|
+
*/
|
|
179
|
+
userRoot: string;
|
|
180
|
+
/**
|
|
181
|
+
* Theme root path
|
|
182
|
+
*/
|
|
183
|
+
themeRoot: string;
|
|
184
|
+
/**
|
|
185
|
+
* Theme name
|
|
186
|
+
*/
|
|
187
|
+
theme: string;
|
|
188
|
+
/**
|
|
189
|
+
* Valaxy Config
|
|
190
|
+
*/
|
|
191
|
+
config: ValaxyConfig;
|
|
192
|
+
/**
|
|
193
|
+
* config file path
|
|
194
|
+
*/
|
|
195
|
+
configFile: string;
|
|
196
|
+
}
|
|
197
|
+
interface ValaxyServerOptions {
|
|
198
|
+
onConfigReload?: (newConfig: ValaxyConfig, config: ValaxyConfig) => void;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare function createServer(options: ResolvedValaxyOptions, viteConfig?: InlineConfig, serverOptions?: ValaxyServerOptions): Promise<vite.ViteDevServer>;
|
|
202
|
+
|
|
203
|
+
export { createServer };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-JORQSKHF.mjs";import{d as o}from"./chunk-5S6S3FLN.mjs";o();export{r as createServer};
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "dist/
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"vite",
|
|
9
9
|
"vue",
|
|
10
10
|
"blog"
|
|
11
11
|
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./src/index.ts",
|
|
14
|
+
"./*": "./*"
|
|
15
|
+
},
|
|
12
16
|
"bin": {
|
|
13
17
|
"vala": "./bin/valaxy.js",
|
|
14
18
|
"valaxy": "./bin/valaxy.js"
|
|
@@ -78,8 +82,8 @@
|
|
|
78
82
|
"vite-ssg-sitemap": "^0.2.0"
|
|
79
83
|
},
|
|
80
84
|
"scripts": {
|
|
81
|
-
"build": "tsup",
|
|
82
|
-
"dev": "tsup --watch",
|
|
85
|
+
"build": "tsup --splitting",
|
|
86
|
+
"dev": "tsup --watch --splitting",
|
|
83
87
|
"lint": "eslint \"**/*.{vue,ts,js}\"",
|
|
84
88
|
"preview": "vite preview",
|
|
85
89
|
"preview-https": "serve dist",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Post } from '
|
|
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
|
|
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 '
|
|
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
|
/**
|
package/src/client/utils/time.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import dayjs from 'dayjs'
|
|
2
|
-
import type { Post } from '
|
|
2
|
+
import type { Post } from '../../types'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* use dayjs format date
|
|
6
|
+
* @param date
|
|
7
|
+
* @param template
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
4
10
|
export function formatDate(date: string | number | Date, template = 'YYYY-MM-DD') {
|
|
5
11
|
const today = dayjs(date)
|
|
6
12
|
return today.format(template)
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './client'
|
|
2
2
|
export * from './types'
|
|
@@ -16,11 +16,28 @@ export function createConfigPlugin(options: ResolvedValaxyOptions): Plugin {
|
|
|
16
16
|
'@valaxyjs/client': `${toAtFS(options.clientRoot)}/`,
|
|
17
17
|
'@valaxyjs/config': '/@valaxyjs/config',
|
|
18
18
|
'valaxy/package.json': toAtFS(resolve(options.clientRoot, '../../package.json')),
|
|
19
|
-
'valaxy': toAtFS(resolve(options.clientRoot, '
|
|
20
|
-
'
|
|
21
|
-
[`valaxy-theme-${options.theme}
|
|
19
|
+
'valaxy/': `${toAtFS(resolve(options.clientRoot, '../..'))}/`,
|
|
20
|
+
'valaxy': toAtFS(resolve(options.clientRoot, '../index.ts')),
|
|
21
|
+
[`valaxy-theme-${options.theme}/`]: `${toAtFS(resolve(options.themeRoot))}/`,
|
|
22
|
+
[`valaxy-theme-${options.theme}`]: `${toAtFS(resolve(options.themeRoot))}`,
|
|
22
23
|
},
|
|
23
24
|
},
|
|
25
|
+
|
|
26
|
+
optimizeDeps: {
|
|
27
|
+
entries: [resolve(options.clientRoot, 'main.ts'), options.configFile],
|
|
28
|
+
|
|
29
|
+
include: [
|
|
30
|
+
'vue',
|
|
31
|
+
'vue-router',
|
|
32
|
+
'@vueuse/core',
|
|
33
|
+
'@vueuse/head',
|
|
34
|
+
'dayjs',
|
|
35
|
+
'nprogress',
|
|
36
|
+
],
|
|
37
|
+
exclude: [
|
|
38
|
+
'vue-demi',
|
|
39
|
+
],
|
|
40
|
+
},
|
|
24
41
|
}
|
|
25
42
|
return mergeConfig(config, injection)
|
|
26
43
|
},
|
|
@@ -24,9 +24,14 @@ import { createUnocssPlugin } from './unocss'
|
|
|
24
24
|
import { createConfigPlugin } from './extendConfig'
|
|
25
25
|
import { createValaxyPlugin } from '.'
|
|
26
26
|
|
|
27
|
+
export interface ValaxyPluginOptions {
|
|
28
|
+
components?: Parameters<typeof Components>[0]
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
export function ViteValaxyPlugins(
|
|
28
32
|
options: ResolvedValaxyOptions,
|
|
29
33
|
serverOptions: ValaxyServerOptions = {},
|
|
34
|
+
pluginOptions: ValaxyPluginOptions = {},
|
|
30
35
|
mode: Mode = 'dev',
|
|
31
36
|
): (PluginOption | PluginOption[])[] | undefined {
|
|
32
37
|
const { clientRoot, themeRoot, userRoot } = options
|
|
@@ -40,6 +45,7 @@ export function ViteValaxyPlugins(
|
|
|
40
45
|
const _md = setupMarkdownPlugins(mdIt, options.config.markdownIt)
|
|
41
46
|
|
|
42
47
|
const roots = [clientRoot, themeRoot, userRoot]
|
|
48
|
+
|
|
43
49
|
return [
|
|
44
50
|
Vue({
|
|
45
51
|
include: [/\.vue$/, /\.md$/],
|
|
@@ -118,13 +124,16 @@ export function ViteValaxyPlugins(
|
|
|
118
124
|
|
|
119
125
|
// allow auto import and register components used in markdown
|
|
120
126
|
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
|
|
127
|
+
exclude: [],
|
|
121
128
|
|
|
122
129
|
// allow override
|
|
123
130
|
allowOverrides: true,
|
|
124
131
|
// override: user -> theme -> client
|
|
125
132
|
// latter override former
|
|
126
|
-
dirs: roots.map(root => `${root}/components`),
|
|
133
|
+
dirs: roots.map(root => `${root}/components`).concat(['src/components', 'components']),
|
|
127
134
|
dts: `${options.userRoot}/components.d.ts`,
|
|
135
|
+
|
|
136
|
+
...pluginOptions,
|
|
128
137
|
}),
|
|
129
138
|
|
|
130
139
|
// 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,48 +21,23 @@ 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: {
|
|
50
32
|
allow: [
|
|
51
|
-
|
|
33
|
+
// not need to search workspace root
|
|
34
|
+
options.clientRoot,
|
|
35
|
+
options.themeRoot,
|
|
52
36
|
searchForWorkspaceRoot(options.userRoot),
|
|
53
|
-
searchForWorkspaceRoot(options.themeRoot),
|
|
54
37
|
],
|
|
55
38
|
},
|
|
56
39
|
},
|
|
57
40
|
|
|
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
41
|
}
|
|
72
42
|
|
|
73
43
|
if (mode === 'build') {
|
package/tsup.config.ts
CHANGED
|
@@ -2,16 +2,20 @@ import { defineConfig } from 'tsup'
|
|
|
2
2
|
|
|
3
3
|
export default defineConfig((options) => {
|
|
4
4
|
return {
|
|
5
|
-
entry: [
|
|
5
|
+
entry: [
|
|
6
|
+
'src/node/index.ts',
|
|
7
|
+
'src/node/cli.ts',
|
|
8
|
+
],
|
|
9
|
+
// https://tsup.egoist.sh/#code-splitting
|
|
10
|
+
// Code splitting currently only works with the esm output format, and it's enabled by default. If you want code splitting for cjs output format as well, try using --splitting flag which is an experimental feature to get rid of the limitation in esbuild.
|
|
6
11
|
splitting: true,
|
|
7
12
|
clean: true,
|
|
8
13
|
dts: true,
|
|
9
14
|
format: ['cjs', 'esm'],
|
|
10
15
|
minify: !options.watch,
|
|
11
16
|
external: [
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'chalk',
|
|
17
|
+
'@valaxyjs/config',
|
|
18
|
+
'valaxy-theme-yun',
|
|
15
19
|
],
|
|
16
20
|
}
|
|
17
21
|
})
|
package/dist/build-OOT6HK6S.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkL5SNNWFJjs = require('./chunk-L5SNNWFJ.js');var _chunkL3EDI35Ijs = require('./chunk-L3EDI35I.js');_chunkL3EDI35Ijs.e.call(void 0, );var _vite = require('vite');async function a(n,e={}){let t=_vite.mergeConfig.call(void 0, e,_chunkL5SNNWFJjs.d.call(void 0, n));await _vite.build.call(void 0, t)}exports.build = a;
|
package/dist/build-SG32QSQ3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as o}from"./chunk-QI435Q25.mjs";import{e as i}from"./chunk-MVJUGWXR.mjs";i();import{mergeConfig as r,build as f}from"vite";async function a(n,e={}){let t=r(e,o(n));await f(t)}export{a as build};
|
package/dist/chunk-7JDYOPID.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkL5SNNWFJjs = require('./chunk-L5SNNWFJ.js');var _chunkL3EDI35Ijs = require('./chunk-L3EDI35I.js');_chunkL3EDI35Ijs.e.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,_chunkL5SNNWFJjs.d.call(void 0, o,i)))}exports.a = c;
|
package/dist/chunk-JJEBEWGI.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as r}from"./chunk-QI435Q25.mjs";import{e}from"./chunk-MVJUGWXR.mjs";e();import{createServer as n,mergeConfig as a}from"vite";async function c(o,t={},i={}){return process.env.EDITOR=process.env.EDITOR||"code",await n(a(t,r(o,i)))}export{c as a};
|
package/dist/chunk-L3EDI35I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var c=Object.create;var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,d=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var l=(e,n,t)=>n in e?a(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,f= exports.a =(e,n)=>{for(var t in n||(n={}))g.call(n,t)&&l(e,t,n[t]);if(s)for(var t of s(n))u.call(n,t)&&l(e,t,n[t]);return e};var h=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(n,t)=>(typeof require!="undefined"?require:n)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var y=(e,n)=>()=>(e&&(n=e(e=0)),n);var x=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var b=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of m(n))!g.call(e,i)&&i!==t&&a(e,i,{get:()=>n[i],enumerable:!(r=p(n,i))||r.enumerable});return e};var k=(e,n,t)=>(t=e!=null?c(d(e)):{},b(n||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e));var o=y(()=>{});o();o();var V={url:"",lang:"en",title:"Valaxy Blog",subtitle:"Next Generation Static Blog Framework.",author:{avatar:"https://cdn.jsdelivr.net/gh/YunYouJun/yun/images/meme/yun-good-with-bg.jpg",name:"YunYouJun",status:{emoji:"\u{1F60A}",message:"All at sea."}},social:[],description:"A blog generated by Valaxy.",license:{enabled:!0,language:"",type:"by-nc-sa"},sponsor:{enable:!0,title:"\u6211\u5F88\u53EF\u7231\uFF0C\u8BF7\u7ED9\u6211\u94B1",methods:[{name:"\u652F\u4ED8\u5B9D",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/alipay-qrcode.jpg",color:"#00A3EE",icon:"i-ri-alipay-line"},{name:"QQ \u652F\u4ED8",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/qqpay-qrcode.png",color:"#12B7F5",icon:"i-ri-qq-line"},{name:"\u5FAE\u4FE1\u652F\u4ED8",url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/donate/wechatpay-qrcode.jpg",color:"#2DC100",icon:"i-ri-wechat-pay-line"}]},search:{algolia:{enable:!1,appId:"",apiKey:"",indexName:"",chunkSize:5e3}},comment:{waline:{enable:!1,serverURL:""}},theme:"yun",themeConfig:{},unocss:{},markdown:{excerpt:"<!-- more -->"},markdownIt:{toc:{listType:"ol"},katex:{}}};o();exports.a = f; exports.b = h; exports.c = x; exports.d = k; exports.e = o; exports.f = V;
|