valaxy 0.23.0 → 0.23.3
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/client/app/data.ts +3 -1
- package/client/composables/common.ts +4 -4
- package/client/modules/valaxy.ts +3 -2
- package/dist/{chunk-FKXWXNZE.js → chunk-OXTCPOR5.js} +134 -103
- package/dist/{config-sM4p56qo.d.ts → config-D40juN_m.d.ts} +12 -0
- package/dist/node/cli/index.d.ts +2 -2
- package/dist/node/cli/index.js +1 -1
- package/dist/node/index.d.ts +4 -3
- package/dist/node/index.js +3 -3
- package/dist/types/index.d.ts +2 -2
- package/package.json +12 -12
- package/types/frontmatter/page.ts +12 -0
package/client/app/data.ts
CHANGED
|
@@ -3,8 +3,9 @@ import type { Router } from 'vue-router'
|
|
|
3
3
|
import type { PageData } from '../../types'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
5
|
|
|
6
|
-
export interface ValaxyData {
|
|
6
|
+
export interface ValaxyData<FM = PageData['frontmatter']> {
|
|
7
7
|
page: Ref<PageData>
|
|
8
|
+
frontmatter: Ref<FM & PageData['frontmatter']>
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -15,5 +16,6 @@ export function initData(router: Router): ValaxyData {
|
|
|
15
16
|
page: computed(() => (router.currentRoute.value as unknown as {
|
|
16
17
|
data: PageData
|
|
17
18
|
}).data),
|
|
19
|
+
frontmatter: computed(() => router.currentRoute.value.meta.frontmatter),
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PostFrontMatter } from '../../types'
|
|
2
2
|
import type { ValaxyData } from '../app/data'
|
|
3
|
-
import { isClient } from '@vueuse/core'
|
|
4
3
|
|
|
4
|
+
import { isClient } from '@vueuse/core'
|
|
5
5
|
import { computed, inject } from 'vue'
|
|
6
6
|
import { useRoute } from 'vue-router'
|
|
7
7
|
import { dataSymbol, useSiteConfig } from '../config'
|
|
@@ -23,11 +23,11 @@ import { dataSymbol, useSiteConfig } from '../config'
|
|
|
23
23
|
* console.log(fm.value.custom)
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export function useFrontmatter<
|
|
26
|
+
export function useFrontmatter<FM extends Record<string, any>>() {
|
|
27
27
|
// inject not in app root
|
|
28
28
|
const route = useRoute()
|
|
29
29
|
const frontmatter = computed(() => {
|
|
30
|
-
return route.meta.frontmatter as Partial<PostFrontMatter &
|
|
30
|
+
return route.meta.frontmatter as Partial<(PostFrontMatter & FM)> || {}
|
|
31
31
|
})
|
|
32
32
|
return frontmatter
|
|
33
33
|
}
|
|
@@ -72,7 +72,7 @@ export function useEncryptedPhotos() {
|
|
|
72
72
|
/**
|
|
73
73
|
* inject pageData
|
|
74
74
|
*/
|
|
75
|
-
export function useData(): ValaxyData {
|
|
75
|
+
export function useData<FM = Record<string, any>>(): ValaxyData<FM> {
|
|
76
76
|
const data = inject(dataSymbol, {} as any)
|
|
77
77
|
if (!data) {
|
|
78
78
|
throw new Error('Valaxy data not properly injected in app')
|
package/client/modules/valaxy.ts
CHANGED
|
@@ -37,8 +37,9 @@ import valaxyMessages from '/@valaxyjs/locales'
|
|
|
37
37
|
// import en from '../../../../../demo/yun/locales/en.yml'
|
|
38
38
|
|
|
39
39
|
function shouldHotReload(payload: PageDataPayload): boolean {
|
|
40
|
-
const payloadPath = payload.path.replace(/(
|
|
41
|
-
const locationPath = location.pathname
|
|
40
|
+
const payloadPath = payload.path.replace(/(?:(^|\/)index)?\.md$/, '$1')
|
|
41
|
+
const locationPath = location.pathname
|
|
42
|
+
.replace(/(?:(^|\/)index)?\.html$/, '')
|
|
42
43
|
return ensureSuffix('/', encodeURI(payloadPath)) === ensureSuffix('/', encodeURI(locationPath))
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// node/cli/index.ts
|
|
2
|
-
import
|
|
2
|
+
import process15 from "node:process";
|
|
3
3
|
import yargs from "yargs";
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.23.
|
|
7
|
+
var version = "0.23.3";
|
|
8
8
|
|
|
9
9
|
// node/modules/fuse.ts
|
|
10
10
|
import path4 from "node:path";
|
|
@@ -1212,7 +1212,6 @@ import { build as viteSsgBuild } from "vite-ssg/node";
|
|
|
1212
1212
|
// node/plugins/preset.ts
|
|
1213
1213
|
import VueI18n from "@intlify/unplugin-vue-i18n/vite";
|
|
1214
1214
|
import UnheadVite from "@unhead/addons/vite";
|
|
1215
|
-
import Vue from "@vitejs/plugin-vue";
|
|
1216
1215
|
import { consola as consola13 } from "consola";
|
|
1217
1216
|
import { resolve as resolve12 } from "pathe";
|
|
1218
1217
|
import Components from "unplugin-vue-components/vite";
|
|
@@ -1337,6 +1336,8 @@ var EXCLUDE = [
|
|
|
1337
1336
|
"meting",
|
|
1338
1337
|
// internal
|
|
1339
1338
|
"valaxy",
|
|
1339
|
+
"virtual:valaxy-addons:empty",
|
|
1340
|
+
"@valaxyjs/devtools",
|
|
1340
1341
|
"/@valaxyjs/config",
|
|
1341
1342
|
"/@valaxyjs/context",
|
|
1342
1343
|
"/@valaxyjs/addons",
|
|
@@ -3432,7 +3433,6 @@ function injectPageDataCode(pageData) {
|
|
|
3432
3433
|
"const route = useRoute()",
|
|
3433
3434
|
// $frontmatter contain runtime added data, will be deleted (for example, $frontmatter.partiallyEncryptedContents)
|
|
3434
3435
|
`const $frontmatter = Object.assign(route.meta.frontmatter || {}, pageData.value?.frontmatter || {})
|
|
3435
|
-
route.meta.frontmatter = $frontmatter
|
|
3436
3436
|
router.currentRoute.value.data = pageData.value
|
|
3437
3437
|
|
|
3438
3438
|
provide('valaxy:frontmatter', $frontmatter)
|
|
@@ -3607,7 +3607,7 @@ function generateAppVue(root) {
|
|
|
3607
3607
|
];
|
|
3608
3608
|
return scripts.join("\n");
|
|
3609
3609
|
}
|
|
3610
|
-
async function
|
|
3610
|
+
async function createValaxyPlugin(options, serverOptions = {}) {
|
|
3611
3611
|
let { config: valaxyConfig } = options;
|
|
3612
3612
|
const valaxyPrefix2 = "/@valaxy";
|
|
3613
3613
|
let hasDeadLinks = false;
|
|
@@ -3625,8 +3625,10 @@ async function createValaxyLoader(options, serverOptions = {}) {
|
|
|
3625
3625
|
);
|
|
3626
3626
|
},
|
|
3627
3627
|
configureServer(server) {
|
|
3628
|
+
if (options.configFile) {
|
|
3629
|
+
server.watcher.add(options.configFile);
|
|
3630
|
+
}
|
|
3628
3631
|
server.watcher.add([
|
|
3629
|
-
options.configFile,
|
|
3630
3632
|
options.clientRoot,
|
|
3631
3633
|
options.themeRoot,
|
|
3632
3634
|
options.userRoot
|
|
@@ -3946,6 +3948,9 @@ async function createRouterPlugin(valaxyApp) {
|
|
|
3946
3948
|
}
|
|
3947
3949
|
await valaxyApp.hooks.callHook("vue-router:extendRoute", route);
|
|
3948
3950
|
return valaxyConfig.router?.extendRoute?.(route);
|
|
3951
|
+
},
|
|
3952
|
+
async beforeWriteFiles(root) {
|
|
3953
|
+
await valaxyApp.hooks.callHook("vue-router:beforeWriteFiles", root);
|
|
3949
3954
|
}
|
|
3950
3955
|
});
|
|
3951
3956
|
}
|
|
@@ -3955,17 +3960,17 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
|
|
|
3955
3960
|
const { options } = valaxyApp;
|
|
3956
3961
|
const { roots, config: valaxyConfig } = options;
|
|
3957
3962
|
const MarkdownPlugin = await createMarkdownPlugin(options);
|
|
3958
|
-
const
|
|
3963
|
+
const ValaxyPlugin = await createValaxyPlugin(options, serverOptions);
|
|
3959
3964
|
const componentsDirs = roots.map((root) => `${root}/components`).concat(["src/components", "components"]);
|
|
3960
|
-
const
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
createClientSetupPlugin(options),
|
|
3964
|
-
Vue({
|
|
3965
|
-
include: [/\.vue$/, /\.md$/],
|
|
3965
|
+
const vuePlugin = await import("@vitejs/plugin-vue").then(
|
|
3966
|
+
(r) => r.default({
|
|
3967
|
+
include: /\.(?:vue|md)$/,
|
|
3966
3968
|
exclude: [],
|
|
3969
|
+
...valaxyConfig.vue,
|
|
3967
3970
|
template: {
|
|
3971
|
+
...valaxyConfig.vue?.template,
|
|
3968
3972
|
compilerOptions: {
|
|
3973
|
+
...valaxyConfig.vue?.template?.compilerOptions,
|
|
3969
3974
|
isCustomElement: (tag) => {
|
|
3970
3975
|
let is = customElements.has(tag);
|
|
3971
3976
|
valaxyConfig.vue?.isCustomElement?.forEach((fn) => {
|
|
@@ -3974,10 +3979,15 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}) {
|
|
|
3974
3979
|
return is;
|
|
3975
3980
|
}
|
|
3976
3981
|
}
|
|
3977
|
-
}
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3982
|
+
}
|
|
3983
|
+
})
|
|
3984
|
+
);
|
|
3985
|
+
const plugins = [
|
|
3986
|
+
MarkdownPlugin,
|
|
3987
|
+
ValaxyPlugin,
|
|
3988
|
+
vuePlugin,
|
|
3989
|
+
createConfigPlugin(options),
|
|
3990
|
+
createClientSetupPlugin(options),
|
|
3981
3991
|
UnheadVite(),
|
|
3982
3992
|
// https://github.com/posva/unplugin-vue-router
|
|
3983
3993
|
await createRouterPlugin(valaxyApp),
|
|
@@ -4195,7 +4205,6 @@ async function createServer(valaxyApp, viteConfig = {}, serverOptions = {}) {
|
|
|
4195
4205
|
import os from "node:os";
|
|
4196
4206
|
import path12 from "node:path";
|
|
4197
4207
|
import process8 from "node:process";
|
|
4198
|
-
import * as readline from "node:readline";
|
|
4199
4208
|
import { consola as consola15 } from "consola";
|
|
4200
4209
|
import { colors as colors14 } from "consola/utils";
|
|
4201
4210
|
import ora4 from "ora";
|
|
@@ -4250,7 +4259,7 @@ async function initServer(valaxyApp, viteConfig) {
|
|
|
4250
4259
|
viteConfig
|
|
4251
4260
|
);
|
|
4252
4261
|
try {
|
|
4253
|
-
|
|
4262
|
+
GLOBAL_STATE.server = await createServer(valaxyApp, viteConfigs, {
|
|
4254
4263
|
async onConfigReload(newConfig, config, force = false) {
|
|
4255
4264
|
if (force) {
|
|
4256
4265
|
vLogger.info(`${colors14.yellow("force")} reload the server`);
|
|
@@ -4263,9 +4272,9 @@ async function initServer(valaxyApp, viteConfig) {
|
|
|
4263
4272
|
initServer(valaxyApp, viteConfig);
|
|
4264
4273
|
}
|
|
4265
4274
|
});
|
|
4275
|
+
const server = GLOBAL_STATE.server;
|
|
4266
4276
|
await server.listen();
|
|
4267
4277
|
serverSpinner.succeed(`${valaxyPrefix} ${colors14.green("server ready.")}`);
|
|
4268
|
-
GLOBAL_STATE.server = server;
|
|
4269
4278
|
return server;
|
|
4270
4279
|
} catch (e) {
|
|
4271
4280
|
consola15.error("failed to start server. error:\n");
|
|
@@ -4273,27 +4282,6 @@ async function initServer(valaxyApp, viteConfig) {
|
|
|
4273
4282
|
process8.exit(1);
|
|
4274
4283
|
}
|
|
4275
4284
|
}
|
|
4276
|
-
function bindShortcut(SHORTCUTS) {
|
|
4277
|
-
process8.stdin.resume();
|
|
4278
|
-
process8.stdin.setEncoding("utf8");
|
|
4279
|
-
readline.emitKeypressEvents(process8.stdin);
|
|
4280
|
-
if (process8.stdin.isTTY)
|
|
4281
|
-
process8.stdin.setRawMode(true);
|
|
4282
|
-
process8.stdin.on("keypress", (str, key) => {
|
|
4283
|
-
if (key.ctrl && key.name === "c") {
|
|
4284
|
-
process8.exit();
|
|
4285
|
-
} else {
|
|
4286
|
-
const [sh] = SHORTCUTS.filter((item) => item.name === str);
|
|
4287
|
-
if (sh) {
|
|
4288
|
-
try {
|
|
4289
|
-
sh.action();
|
|
4290
|
-
} catch (err) {
|
|
4291
|
-
console.error(`Failed to execute shortcut ${sh.fullName}`, err);
|
|
4292
|
-
}
|
|
4293
|
-
}
|
|
4294
|
-
}
|
|
4295
|
-
});
|
|
4296
|
-
}
|
|
4297
4285
|
if (import.meta.hot) {
|
|
4298
4286
|
await import.meta.hot.data.stopping;
|
|
4299
4287
|
let reload = async () => {
|
|
@@ -4509,11 +4497,8 @@ function registerDeployCommand(cli2) {
|
|
|
4509
4497
|
}
|
|
4510
4498
|
|
|
4511
4499
|
// node/cli/dev.ts
|
|
4512
|
-
import { exec } from "node:child_process";
|
|
4513
|
-
import os2 from "node:os";
|
|
4514
4500
|
import path15 from "node:path";
|
|
4515
|
-
import
|
|
4516
|
-
import qrcode from "qrcode";
|
|
4501
|
+
import process13 from "node:process";
|
|
4517
4502
|
import { mergeConfig as mergeConfig5 } from "vite";
|
|
4518
4503
|
|
|
4519
4504
|
// node/utils/net.ts
|
|
@@ -4540,9 +4525,90 @@ function isPortFree(port) {
|
|
|
4540
4525
|
});
|
|
4541
4526
|
}
|
|
4542
4527
|
|
|
4528
|
+
// node/cli/utils/shortcuts.ts
|
|
4529
|
+
import { exec } from "node:child_process";
|
|
4530
|
+
import os2 from "node:os";
|
|
4531
|
+
import process12 from "node:process";
|
|
4532
|
+
import * as readline from "node:readline";
|
|
4533
|
+
import { colors as colors16 } from "consola/utils";
|
|
4534
|
+
import qrcode from "qrcode";
|
|
4535
|
+
var SHORTCUTS = [
|
|
4536
|
+
{
|
|
4537
|
+
key: "r",
|
|
4538
|
+
description: "restart",
|
|
4539
|
+
async action(server, createDevServer) {
|
|
4540
|
+
await server.close();
|
|
4541
|
+
setTimeout(async () => {
|
|
4542
|
+
await createDevServer();
|
|
4543
|
+
}, 100);
|
|
4544
|
+
}
|
|
4545
|
+
},
|
|
4546
|
+
{
|
|
4547
|
+
key: "o",
|
|
4548
|
+
description: "open",
|
|
4549
|
+
async action(server) {
|
|
4550
|
+
const { default: openBrowser } = await import("open");
|
|
4551
|
+
openBrowser(`http://localhost:${server.config.server.port}/`);
|
|
4552
|
+
}
|
|
4553
|
+
},
|
|
4554
|
+
{
|
|
4555
|
+
key: "q",
|
|
4556
|
+
description: "qr",
|
|
4557
|
+
action(server) {
|
|
4558
|
+
const addresses = Object.values(os2.networkInterfaces()).flat().filter((details) => details?.family === "IPv4" && !details.address.includes("127.0.0.1"));
|
|
4559
|
+
const port = server.config.server.port;
|
|
4560
|
+
const remoteUrl = `http://${addresses[0]?.address || "localhost"}:${port}`;
|
|
4561
|
+
qrcode.toString(remoteUrl, { type: "terminal" }, (err, qrCode) => {
|
|
4562
|
+
if (err)
|
|
4563
|
+
throw err;
|
|
4564
|
+
console.log(qrCode);
|
|
4565
|
+
});
|
|
4566
|
+
}
|
|
4567
|
+
},
|
|
4568
|
+
{
|
|
4569
|
+
key: "e",
|
|
4570
|
+
description: "edit",
|
|
4571
|
+
action() {
|
|
4572
|
+
exec(`code "${process12.cwd()}"`, (err) => {
|
|
4573
|
+
if (err)
|
|
4574
|
+
console.error("Failed to open editor", err);
|
|
4575
|
+
});
|
|
4576
|
+
}
|
|
4577
|
+
}
|
|
4578
|
+
];
|
|
4579
|
+
function bindShortcuts(server, createDevServer) {
|
|
4580
|
+
if (!server.httpServer || process12.env.CI) {
|
|
4581
|
+
console.log("restart server to enable shortcuts", server.httpServer, process12.stdin.isTTY, process12.env.CI);
|
|
4582
|
+
return;
|
|
4583
|
+
}
|
|
4584
|
+
process12.stdin.resume();
|
|
4585
|
+
process12.stdin.setEncoding("utf8");
|
|
4586
|
+
readline.emitKeypressEvents(process12.stdin);
|
|
4587
|
+
if (process12.stdin.isTTY)
|
|
4588
|
+
process12.stdin.setRawMode(true);
|
|
4589
|
+
async function onKeyPress(str, key) {
|
|
4590
|
+
if (key.ctrl && key.name === "c") {
|
|
4591
|
+
process12.exit();
|
|
4592
|
+
} else {
|
|
4593
|
+
const shortcut = SHORTCUTS.find((shortcut2) => shortcut2.key === str);
|
|
4594
|
+
if (!shortcut)
|
|
4595
|
+
return;
|
|
4596
|
+
try {
|
|
4597
|
+
await shortcut.action(server, createDevServer);
|
|
4598
|
+
} catch (error) {
|
|
4599
|
+
console.error(colors16.red("Error executing shortcut:"), key, error);
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
process12.stdin.on("keypress", onKeyPress);
|
|
4604
|
+
server.httpServer.on("close", () => {
|
|
4605
|
+
process12.stdin.off("keypress", onKeyPress);
|
|
4606
|
+
});
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4543
4609
|
// node/cli/dev.ts
|
|
4544
4610
|
async function startValaxyDev({
|
|
4545
|
-
root =
|
|
4611
|
+
root = process13.cwd(),
|
|
4546
4612
|
port,
|
|
4547
4613
|
remote,
|
|
4548
4614
|
log,
|
|
@@ -4550,7 +4616,7 @@ async function startValaxyDev({
|
|
|
4550
4616
|
}) {
|
|
4551
4617
|
setEnv();
|
|
4552
4618
|
if (!isPagesDirExist(root))
|
|
4553
|
-
|
|
4619
|
+
process13.exit(0);
|
|
4554
4620
|
port = port || await findFreePort(4859);
|
|
4555
4621
|
const resolvedOptions = await resolveOptions({ userRoot: root });
|
|
4556
4622
|
setTimezone(resolvedOptions.config.siteConfig.timezone);
|
|
@@ -4573,47 +4639,9 @@ async function startValaxyDev({
|
|
|
4573
4639
|
},
|
|
4574
4640
|
logLevel: log
|
|
4575
4641
|
}, resolvedOptions.config.vite || {});
|
|
4576
|
-
await initServer(valaxyApp, viteConfig);
|
|
4642
|
+
const server = await initServer(valaxyApp, viteConfig);
|
|
4577
4643
|
printInfo(resolvedOptions, port, remote);
|
|
4578
|
-
|
|
4579
|
-
{
|
|
4580
|
-
name: "r",
|
|
4581
|
-
fullName: "restart",
|
|
4582
|
-
async action() {
|
|
4583
|
-
await initServer(valaxyApp, viteConfig);
|
|
4584
|
-
printInfo(resolvedOptions, port, remote);
|
|
4585
|
-
}
|
|
4586
|
-
},
|
|
4587
|
-
{
|
|
4588
|
-
name: "o",
|
|
4589
|
-
fullName: "open",
|
|
4590
|
-
async action() {
|
|
4591
|
-
const { default: openBrowser } = await import("open");
|
|
4592
|
-
openBrowser(`http://localhost:${port}`);
|
|
4593
|
-
}
|
|
4594
|
-
},
|
|
4595
|
-
{
|
|
4596
|
-
name: "q",
|
|
4597
|
-
fullName: "qr",
|
|
4598
|
-
action() {
|
|
4599
|
-
const addresses = Object.values(os2.networkInterfaces()).flat().filter((details) => details?.family === "IPv4" && !details.address.includes("127.0.0.1"));
|
|
4600
|
-
const remoteUrl = `http://${addresses[0]?.address || "localhost"}:${port}`;
|
|
4601
|
-
qrcode.toString(remoteUrl, { type: "terminal" }, (err, qrCode) => {
|
|
4602
|
-
if (err)
|
|
4603
|
-
throw err;
|
|
4604
|
-
console.log(qrCode);
|
|
4605
|
-
});
|
|
4606
|
-
}
|
|
4607
|
-
},
|
|
4608
|
-
{
|
|
4609
|
-
name: "e",
|
|
4610
|
-
fullName: "edit",
|
|
4611
|
-
action() {
|
|
4612
|
-
exec(`code "${root}"`);
|
|
4613
|
-
}
|
|
4614
|
-
}
|
|
4615
|
-
];
|
|
4616
|
-
bindShortcut(SHORTCUTS);
|
|
4644
|
+
return server;
|
|
4617
4645
|
}
|
|
4618
4646
|
function registerDevCommand(cli2) {
|
|
4619
4647
|
cli2.command(
|
|
@@ -4639,13 +4667,18 @@ function registerDevCommand(cli2) {
|
|
|
4639
4667
|
describe: "log level"
|
|
4640
4668
|
}).strict().help(),
|
|
4641
4669
|
async ({ root, port, open, remote, log }) => {
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4670
|
+
let server;
|
|
4671
|
+
const createDevServer = async () => {
|
|
4672
|
+
server = await startValaxyDev({
|
|
4673
|
+
root,
|
|
4674
|
+
open,
|
|
4675
|
+
port,
|
|
4676
|
+
remote,
|
|
4677
|
+
log
|
|
4678
|
+
});
|
|
4679
|
+
bindShortcuts(server, createDevServer);
|
|
4680
|
+
};
|
|
4681
|
+
createDevServer();
|
|
4649
4682
|
}
|
|
4650
4683
|
);
|
|
4651
4684
|
}
|
|
@@ -4655,13 +4688,13 @@ import { writeFile as writeFile2 } from "node:fs/promises";
|
|
|
4655
4688
|
import { join as join9, resolve as resolve14 } from "node:path";
|
|
4656
4689
|
import { ensureSuffix as ensureSuffix2 } from "@antfu/utils";
|
|
4657
4690
|
import { consola as consola19 } from "consola";
|
|
4658
|
-
import { colors as
|
|
4691
|
+
import { colors as colors17 } from "consola/utils";
|
|
4659
4692
|
import dayjs2 from "dayjs";
|
|
4660
4693
|
import { render } from "ejs";
|
|
4661
4694
|
|
|
4662
4695
|
// node/cli/utils/constants.ts
|
|
4663
|
-
import
|
|
4664
|
-
var userRoot =
|
|
4696
|
+
import process14 from "node:process";
|
|
4697
|
+
var userRoot = process14.cwd();
|
|
4665
4698
|
var defaultPostTemplate = `---
|
|
4666
4699
|
layout: <%=layout%>
|
|
4667
4700
|
title: <%=title%>
|
|
@@ -4701,11 +4734,11 @@ async function create(data) {
|
|
|
4701
4734
|
const content = await genLayoutTemplate(data);
|
|
4702
4735
|
try {
|
|
4703
4736
|
await writeFile2(destinationPath, content, "utf-8");
|
|
4704
|
-
consola19.success(`[valaxy new]: successfully generated file ${
|
|
4737
|
+
consola19.success(`[valaxy new]: successfully generated file ${colors17.magenta(destinationPath)}`);
|
|
4705
4738
|
} catch (e) {
|
|
4706
4739
|
console.log(e);
|
|
4707
4740
|
consola19.error(`[valaxy new]: failed to write file ${destinationPath}`);
|
|
4708
|
-
consola19.warn(`You should run ${
|
|
4741
|
+
consola19.warn(`You should run ${colors17.green("valaxy new")} in your valaxy project root directory.`);
|
|
4709
4742
|
}
|
|
4710
4743
|
return destinationPath;
|
|
4711
4744
|
}
|
|
@@ -4760,7 +4793,7 @@ function registerNewCommand(cli2) {
|
|
|
4760
4793
|
}
|
|
4761
4794
|
|
|
4762
4795
|
// node/cli/index.ts
|
|
4763
|
-
var cli = yargs(hideBin(
|
|
4796
|
+
var cli = yargs(hideBin(process15.argv)).scriptName("valaxy").usage("$0 [args]").version(version).showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
4764
4797
|
registerDevCommand(cli);
|
|
4765
4798
|
registerBuildCommand(cli);
|
|
4766
4799
|
registerNewCommand(cli);
|
|
@@ -4819,7 +4852,7 @@ export {
|
|
|
4819
4852
|
processValaxyOptions,
|
|
4820
4853
|
resolveOptions,
|
|
4821
4854
|
resolveThemeValaxyConfig,
|
|
4822
|
-
|
|
4855
|
+
createValaxyPlugin,
|
|
4823
4856
|
ViteValaxyPlugins,
|
|
4824
4857
|
build2 as build,
|
|
4825
4858
|
ssgBuild,
|
|
@@ -4835,8 +4868,6 @@ export {
|
|
|
4835
4868
|
/*! Bundled license information:
|
|
4836
4869
|
|
|
4837
4870
|
@mdit-vue/shared/dist/index.mjs:
|
|
4838
|
-
(* istanbul ignore if -- @preserve *)
|
|
4839
|
-
|
|
4840
4871
|
@mdit-vue/plugin-sfc/dist/index.mjs:
|
|
4841
4872
|
(* istanbul ignore if -- @preserve *)
|
|
4842
4873
|
*/
|
|
@@ -92,6 +92,14 @@ interface PageFrontMatter extends Record<string, any> {
|
|
|
92
92
|
* @description 路径
|
|
93
93
|
*/
|
|
94
94
|
path: string;
|
|
95
|
+
/**
|
|
96
|
+
* abbrlink
|
|
97
|
+
*
|
|
98
|
+
* generated by valaxy-addon-abbrlink, do not manually modify
|
|
99
|
+
*
|
|
100
|
+
* just compatible for [hexo-abbrlink](https://github.com/ohroy/hexo-abbrlink)
|
|
101
|
+
*/
|
|
102
|
+
abbrlink: string;
|
|
95
103
|
/**
|
|
96
104
|
* Title
|
|
97
105
|
* @description 文章标题
|
|
@@ -200,6 +208,10 @@ interface PageFrontMatter extends Record<string, any> {
|
|
|
200
208
|
* @description:zh-CN 加密密码
|
|
201
209
|
*/
|
|
202
210
|
password?: string;
|
|
211
|
+
/**
|
|
212
|
+
* @description:zh-CN 密码提示
|
|
213
|
+
*/
|
|
214
|
+
password_hint?: string;
|
|
203
215
|
/**
|
|
204
216
|
* @description:zh-CN 相册密码
|
|
205
217
|
*/
|
package/dist/node/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yargs from 'yargs';
|
|
2
2
|
import { Argv } from 'yargs';
|
|
3
|
-
import { LogLevel } from 'vite';
|
|
3
|
+
import { LogLevel, ViteDevServer } from 'vite';
|
|
4
4
|
|
|
5
5
|
declare function startValaxyDev({ root, port, remote, log, open, }: {
|
|
6
6
|
root?: string;
|
|
@@ -8,7 +8,7 @@ declare function startValaxyDev({ root, port, remote, log, open, }: {
|
|
|
8
8
|
remote?: boolean;
|
|
9
9
|
log?: LogLevel;
|
|
10
10
|
open?: boolean;
|
|
11
|
-
}): Promise<
|
|
11
|
+
}): Promise<ViteDevServer>;
|
|
12
12
|
declare function registerDevCommand(cli: Argv): void;
|
|
13
13
|
|
|
14
14
|
declare const cli: yargs.Argv<{}>;
|
package/dist/node/cli/index.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ViteSSGOptions } from 'vite-ssg';
|
|
|
2
2
|
import * as vite from 'vite';
|
|
3
3
|
import { UserConfig, InlineConfig, PluginOption, Plugin } from 'vite';
|
|
4
4
|
import { MarkdownEnv } from 'unplugin-vue-markdown/types';
|
|
5
|
-
import { S as SiteConfig, D as DefaultTheme, V as ValaxyConfig, a as ValaxyAddon, P as PartialDeep, R as RuntimeConfig, b as RedirectItem, U as UserSiteConfig } from '../config-
|
|
5
|
+
import { S as SiteConfig, D as DefaultTheme, V as ValaxyConfig, a as ValaxyAddon, P as PartialDeep, R as RuntimeConfig, b as RedirectItem, U as UserSiteConfig } from '../config-D40juN_m.js';
|
|
6
6
|
import Vue from '@vitejs/plugin-vue';
|
|
7
7
|
import { Options as Options$3 } from 'beasties';
|
|
8
8
|
import { Hookable } from 'hookable';
|
|
@@ -200,6 +200,7 @@ interface ValaxyHooks {
|
|
|
200
200
|
* @see valaxy/node/plugins/vueRouter.ts extendRoute
|
|
201
201
|
*/
|
|
202
202
|
'vue-router:extendRoute': (route: EditableTreeNode) => HookResult;
|
|
203
|
+
'vue-router:beforeWriteFiles': (root: EditableTreeNode) => HookResult;
|
|
203
204
|
'build:before': () => HookResult;
|
|
204
205
|
'build:after': () => HookResult;
|
|
205
206
|
}
|
|
@@ -627,7 +628,7 @@ declare function ViteValaxyPlugins(valaxyApp: ValaxyNode, serverOptions?: Valaxy
|
|
|
627
628
|
* @param options
|
|
628
629
|
* @param serverOptions
|
|
629
630
|
*/
|
|
630
|
-
declare function
|
|
631
|
+
declare function createValaxyPlugin(options: ResolvedValaxyOptions, serverOptions?: ValaxyServerOptions): Promise<Plugin[]>;
|
|
631
632
|
|
|
632
633
|
/**
|
|
633
634
|
* with valaxyPrefix
|
|
@@ -664,4 +665,4 @@ declare function toAtFS(path: string): string;
|
|
|
664
665
|
declare function resolveImportPath(importName: string, ensure?: true): Promise<string>;
|
|
665
666
|
declare function resolveImportPath(importName: string, ensure?: boolean): Promise<string | undefined>;
|
|
666
667
|
|
|
667
|
-
export { ALL_ROUTE, EXCERPT_SEPARATOR, EXTERNAL_URL_RE, type HookResult, type LoadConfigFromFileOptions, PATHNAME_PROTOCOL_RE, type ResolvedConfig, type ResolvedValaxyOptions, type UnoSetup, type UserInputConfig, type UserValaxyNodeConfig, type ValaxyAddonExport, type ValaxyAddonFn, type ValaxyAddonLike, type ValaxyAddonResolver, type ValaxyAddons, type ValaxyApp, type ValaxyConfigExport, type ValaxyConfigExtendKey, type ValaxyConfigFn, type ValaxyEntryOptions, type ValaxyExtendConfig, type ValaxyHooks, type ValaxyNode, type ValaxyNodeConfig, type ValaxyPickConfig, type ValaxyServerOptions, type ValaxyTheme, ViteValaxyPlugins, build, createServer,
|
|
668
|
+
export { ALL_ROUTE, EXCERPT_SEPARATOR, EXTERNAL_URL_RE, type HookResult, type LoadConfigFromFileOptions, PATHNAME_PROTOCOL_RE, type ResolvedConfig, type ResolvedValaxyOptions, type UnoSetup, type UserInputConfig, type UserValaxyNodeConfig, type ValaxyAddonExport, type ValaxyAddonFn, type ValaxyAddonLike, type ValaxyAddonResolver, type ValaxyAddons, type ValaxyApp, type ValaxyConfigExport, type ValaxyConfigExtendKey, type ValaxyConfigFn, type ValaxyEntryOptions, type ValaxyExtendConfig, type ValaxyHooks, type ValaxyNode, type ValaxyNodeConfig, type ValaxyPickConfig, type ValaxyServerOptions, type ValaxyTheme, ViteValaxyPlugins, build, createServer, createValaxyPlugin, customElements, defaultSiteConfig, defaultValaxyConfig, defaultViteConfig, defineAddon, defineConfig, defineSiteConfig, defineTheme, defineUnoSetup, defineValaxyAddon, defineValaxyConfig, defineValaxyTheme, generateClientRedirects, getGitTimestamp, getIndexHtml, getServerInfoText, isExternal, isInstalledGlobally, isPath, loadConfig, loadConfigFromFile, mergeValaxyConfig, mergeViteConfigs, postProcessForSSG, processValaxyOptions, resolveAddonsConfig, resolveImportPath, resolveImportUrl, resolveOptions, resolveSiteConfig, resolveSiteConfigFromRoot, resolveThemeConfigFromRoot, resolveThemeValaxyConfig, resolveUserThemeConfig, resolveValaxyConfig, resolveValaxyConfigFromRoot, ssgBuild, toAtFS, transformObject };
|
package/dist/node/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
build,
|
|
8
8
|
cli,
|
|
9
9
|
createServer,
|
|
10
|
-
|
|
10
|
+
createValaxyPlugin,
|
|
11
11
|
customElements,
|
|
12
12
|
defaultSiteConfig,
|
|
13
13
|
defaultValaxyConfig,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
startValaxyDev,
|
|
51
51
|
toAtFS,
|
|
52
52
|
transformObject
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-OXTCPOR5.js";
|
|
54
54
|
export {
|
|
55
55
|
ALL_ROUTE,
|
|
56
56
|
EXCERPT_SEPARATOR,
|
|
@@ -60,7 +60,7 @@ export {
|
|
|
60
60
|
build,
|
|
61
61
|
cli,
|
|
62
62
|
createServer,
|
|
63
|
-
|
|
63
|
+
createValaxyPlugin,
|
|
64
64
|
customElements,
|
|
65
65
|
defaultSiteConfig,
|
|
66
66
|
defaultValaxyConfig,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as PostFrontMatter, d as PageFrontMatter } from '../config-
|
|
2
|
-
export { A as Album, D as DefaultTheme, E as ExcerptType, F as FuseListItem, P as PartialDeep, i as Photo, g as Pkg, b as RedirectItem, f as RedirectRule, R as RuntimeConfig, S as SiteConfig, e as SocialLink, U as UserSiteConfig, h as UserValaxyConfig, a as ValaxyAddon, V as ValaxyConfig } from '../config-
|
|
1
|
+
import { c as PostFrontMatter, d as PageFrontMatter } from '../config-D40juN_m.js';
|
|
2
|
+
export { A as Album, D as DefaultTheme, E as ExcerptType, F as FuseListItem, P as PartialDeep, i as Photo, g as Pkg, b as RedirectItem, f as RedirectRule, R as RuntimeConfig, S as SiteConfig, e as SocialLink, U as UserSiteConfig, h as UserValaxyConfig, a as ValaxyAddon, V as ValaxyConfig } from '../config-D40juN_m.js';
|
|
3
3
|
import { Header } from '@valaxyjs/utils';
|
|
4
4
|
import '@vueuse/integrations/useFuse';
|
|
5
5
|
import 'medium-zoom';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.3",
|
|
5
5
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "me@yunyoujun.cn",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@antfu/utils": "^9.2.0",
|
|
57
57
|
"@clack/prompts": "^0.10.1",
|
|
58
58
|
"@iconify-json/ri": "^1.2.5",
|
|
59
|
-
"@intlify/unplugin-vue-i18n": "^6.0.
|
|
60
|
-
"@shikijs/transformers": "^3.
|
|
59
|
+
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
60
|
+
"@shikijs/transformers": "^3.3.0",
|
|
61
61
|
"@types/katex": "^0.16.7",
|
|
62
62
|
"@unhead/addons": "^2.0.8",
|
|
63
63
|
"@unhead/schema-org": "^2.0.8",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@vue/devtools-api": "7.7.2",
|
|
67
67
|
"@vueuse/core": "^13.1.0",
|
|
68
68
|
"@vueuse/integrations": "^13.1.0",
|
|
69
|
-
"beasties": "^0.3.
|
|
69
|
+
"beasties": "^0.3.3",
|
|
70
70
|
"birpc": "^2.3.0",
|
|
71
71
|
"consola": "^3.4.2",
|
|
72
72
|
"cross-spawn": "^7.0.6",
|
|
@@ -110,29 +110,29 @@
|
|
|
110
110
|
"pinia": "^3.0.2",
|
|
111
111
|
"qrcode": "^1.5.4",
|
|
112
112
|
"resolve-global": "^2.0.0",
|
|
113
|
-
"sass": "^1.
|
|
114
|
-
"shiki": "^3.
|
|
113
|
+
"sass": "^1.87.0",
|
|
114
|
+
"shiki": "^3.3.0",
|
|
115
115
|
"star-markdown-css": "^0.5.3",
|
|
116
116
|
"table": "^6.9.0",
|
|
117
117
|
"unhead": "^2.0.8",
|
|
118
|
-
"unocss": "^66.1.0-beta.
|
|
118
|
+
"unocss": "^66.1.0-beta.12",
|
|
119
119
|
"unplugin-vue-components": "28.0.0",
|
|
120
120
|
"unplugin-vue-markdown": "^28.3.1",
|
|
121
121
|
"unplugin-vue-router": "^0.12.0",
|
|
122
122
|
"vanilla-lazyload": "^19.1.3",
|
|
123
|
-
"vite": "^6.3.
|
|
123
|
+
"vite": "^6.3.3",
|
|
124
124
|
"vite-dev-rpc": "^1.0.7",
|
|
125
|
-
"vite-plugin-vue-devtools": "^7.7.
|
|
125
|
+
"vite-plugin-vue-devtools": "^7.7.6",
|
|
126
126
|
"vite-plugin-vue-layouts": "^0.11.0",
|
|
127
127
|
"vite-ssg": "^26.1.1",
|
|
128
128
|
"vite-ssg-sitemap": "^0.8.1",
|
|
129
129
|
"vitepress-plugin-group-icons": "^1.5.2",
|
|
130
130
|
"vue": "^3.5.13",
|
|
131
131
|
"vue-i18n": "^11.1.3",
|
|
132
|
-
"vue-router": "^4.5.
|
|
132
|
+
"vue-router": "^4.5.1",
|
|
133
133
|
"yargs": "^17.7.2",
|
|
134
|
-
"@valaxyjs/devtools": "0.23.
|
|
135
|
-
"@valaxyjs/utils": "0.23.
|
|
134
|
+
"@valaxyjs/devtools": "0.23.3",
|
|
135
|
+
"@valaxyjs/utils": "0.23.3"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
138
|
"@mdit-vue/plugin-component": "^2.1.4",
|
|
@@ -33,6 +33,14 @@ export interface PageFrontMatter extends Record<string, any> {
|
|
|
33
33
|
* @description 路径
|
|
34
34
|
*/
|
|
35
35
|
path: string
|
|
36
|
+
/**
|
|
37
|
+
* abbrlink
|
|
38
|
+
*
|
|
39
|
+
* generated by valaxy-addon-abbrlink, do not manually modify
|
|
40
|
+
*
|
|
41
|
+
* just compatible for [hexo-abbrlink](https://github.com/ohroy/hexo-abbrlink)
|
|
42
|
+
*/
|
|
43
|
+
abbrlink: string
|
|
36
44
|
/**
|
|
37
45
|
* Title
|
|
38
46
|
* @description 文章标题
|
|
@@ -153,6 +161,10 @@ export interface PageFrontMatter extends Record<string, any> {
|
|
|
153
161
|
* @description:zh-CN 加密密码
|
|
154
162
|
*/
|
|
155
163
|
password?: string
|
|
164
|
+
/**
|
|
165
|
+
* @description:zh-CN 密码提示
|
|
166
|
+
*/
|
|
167
|
+
password_hint?: string
|
|
156
168
|
/**
|
|
157
169
|
* @description:zh-CN 相册密码
|
|
158
170
|
*/
|