valaxy 1.2.1 → 1.2.2
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.mjs +5 -1
- package/dist/node/cli/index.mjs +3 -3
- package/dist/node/index.mjs +3 -3
- package/dist/shared/{valaxy.DvkRJomf.mjs → valaxy.BTmQYjWn.mjs} +5 -3
- package/package.json +4 -4
- package/vendor/README.md +5 -0
- package/vendor/ensure-gray-matter.d.ts +1 -0
- package/vendor/ensure-gray-matter.mjs +23 -0
- package/vendor/redirect-gray-matter.mjs +30 -0
package/bin/valaxy.mjs
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
4
|
import process from 'node:process'
|
|
5
|
-
import {
|
|
5
|
+
import { ensureGrayMatterRedirect } from '../vendor/ensure-gray-matter.mjs'
|
|
6
6
|
|
|
7
7
|
async function main() {
|
|
8
|
+
// gray-matter 4 crashes at import when js-yaml 5 is resolved. Install the
|
|
9
|
+
// redirect before the CLI graph loads @mdit-vue/plugin-frontmatter.
|
|
10
|
+
await ensureGrayMatterRedirect()
|
|
11
|
+
const { run } = await import('../dist/node/cli/index.mjs')
|
|
8
12
|
await run()
|
|
9
13
|
}
|
|
10
14
|
|
package/dist/node/cli/index.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import 'node:path';
|
|
|
2
2
|
import 'node:process';
|
|
3
3
|
import 'yargs';
|
|
4
4
|
import 'yargs/helpers';
|
|
5
|
-
export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand, a2 as run, a4 as startValaxyDev } from '../../shared/valaxy.
|
|
5
|
+
export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand, a2 as run, a4 as startValaxyDev } from '../../shared/valaxy.BTmQYjWn.mjs';
|
|
6
6
|
import 'node:os';
|
|
7
|
+
import '@11ty/gray-matter';
|
|
7
8
|
import 'consola';
|
|
8
9
|
import 'consola/utils';
|
|
9
10
|
import 'fs-extra';
|
|
10
|
-
import 'gray-matter';
|
|
11
11
|
import 'tinyglobby';
|
|
12
12
|
import 'js-yaml';
|
|
13
13
|
import '@antfu/utils';
|
|
@@ -58,7 +58,7 @@ import 'node:url';
|
|
|
58
58
|
import 'markdown-it-container';
|
|
59
59
|
import 'katex';
|
|
60
60
|
import 'katex/contrib/mhchem';
|
|
61
|
-
import '
|
|
61
|
+
import 'valaxy/vendor/ensure-gray-matter.mjs';
|
|
62
62
|
import 'jiti';
|
|
63
63
|
import 'unocss';
|
|
64
64
|
import 'html-to-text';
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as createCli, a as createContentService, d as createMemoryReleasePlugin, e as createServer, f as createValaxyNode, g as createValaxyPlugin, h as customElements, i as defaultSiteConfig, j as defaultValaxyConfig, k as defaultViteConfig, l as defineAddon, m as defineConfig, n as defineSiteConfig, o as defineTheme, p as defineValaxyAddon, q as defineValaxyConfig, r as defineValaxyTheme, s as desktopRuntimeVersion, t as encryptContent, u as execBuild, v as generateClientRedirects, w as getGitTimestamp, x as getIndexHtml, y as getServerInfoText, z as isExternal, B as isInstalledGlobally, C as isKatexEnabled, D as isKatexPluginNeeded, F as isMathJaxEnabled, H as isPath, I as loadAllContent, J as loadConfigFromFile, K as mergeValaxyConfig, L as mergeViteConfigs, M as postProcessForSSG, N as processValaxyOptions, O as registerDevCommand, Q as resolveAddonsConfig, R as resolveFootnoteConfig, T as resolveImportPath, U as resolveImportUrl, W as resolveOptions, X as resolveSiteConfig, Y as resolveSiteConfigFromRoot, Z as resolveThemeConfigFromRoot, _ as resolveThemeValaxyConfig, $ as resolveUserThemeConfig, a0 as resolveValaxyConfig, a1 as resolveValaxyConfigFromRoot, a2 as run, a3 as ssgBuild, a4 as startValaxyDev, a5 as toAtFS, a6 as transformObject, a7 as version } from '../shared/valaxy.
|
|
1
|
+
export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as createCli, a as createContentService, d as createMemoryReleasePlugin, e as createServer, f as createValaxyNode, g as createValaxyPlugin, h as customElements, i as defaultSiteConfig, j as defaultValaxyConfig, k as defaultViteConfig, l as defineAddon, m as defineConfig, n as defineSiteConfig, o as defineTheme, p as defineValaxyAddon, q as defineValaxyConfig, r as defineValaxyTheme, s as desktopRuntimeVersion, t as encryptContent, u as execBuild, v as generateClientRedirects, w as getGitTimestamp, x as getIndexHtml, y as getServerInfoText, z as isExternal, B as isInstalledGlobally, C as isKatexEnabled, D as isKatexPluginNeeded, F as isMathJaxEnabled, H as isPath, I as loadAllContent, J as loadConfigFromFile, K as mergeValaxyConfig, L as mergeViteConfigs, M as postProcessForSSG, N as processValaxyOptions, O as registerDevCommand, Q as resolveAddonsConfig, R as resolveFootnoteConfig, T as resolveImportPath, U as resolveImportUrl, W as resolveOptions, X as resolveSiteConfig, Y as resolveSiteConfigFromRoot, Z as resolveThemeConfigFromRoot, _ as resolveThemeValaxyConfig, $ as resolveUserThemeConfig, a0 as resolveValaxyConfig, a1 as resolveValaxyConfigFromRoot, a2 as run, a3 as ssgBuild, a4 as startValaxyDev, a5 as toAtFS, a6 as transformObject, a7 as version } from '../shared/valaxy.BTmQYjWn.mjs';
|
|
2
2
|
import 'node:path';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'fs-extra';
|
|
@@ -8,7 +8,7 @@ import 'define-config-ts';
|
|
|
8
8
|
import 'yargs';
|
|
9
9
|
import 'yargs/helpers';
|
|
10
10
|
import 'node:os';
|
|
11
|
-
import 'gray-matter';
|
|
11
|
+
import '@11ty/gray-matter';
|
|
12
12
|
import 'tinyglobby';
|
|
13
13
|
import 'js-yaml';
|
|
14
14
|
import '@antfu/utils';
|
|
@@ -58,7 +58,7 @@ import 'node:url';
|
|
|
58
58
|
import 'markdown-it-container';
|
|
59
59
|
import 'katex';
|
|
60
60
|
import 'katex/contrib/mhchem';
|
|
61
|
-
import '
|
|
61
|
+
import 'valaxy/vendor/ensure-gray-matter.mjs';
|
|
62
62
|
import 'jiti';
|
|
63
63
|
import 'unocss';
|
|
64
64
|
import 'html-to-text';
|
|
@@ -3,10 +3,10 @@ import process from 'node:process';
|
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
5
|
import os from 'node:os';
|
|
6
|
+
import matter from '@11ty/gray-matter';
|
|
6
7
|
import { consola } from 'consola';
|
|
7
8
|
import { colors } from 'consola/utils';
|
|
8
9
|
import fs from 'fs-extra';
|
|
9
|
-
import matter from 'gray-matter';
|
|
10
10
|
import { glob, globSync } from 'tinyglobby';
|
|
11
11
|
import * as yaml from 'js-yaml';
|
|
12
12
|
import { dump, load, CORE_SCHEMA } from 'js-yaml';
|
|
@@ -58,7 +58,7 @@ import { URL as URL$1, pathToFileURL } from 'node:url';
|
|
|
58
58
|
import container from 'markdown-it-container';
|
|
59
59
|
import katex from 'katex';
|
|
60
60
|
import 'katex/contrib/mhchem';
|
|
61
|
-
import
|
|
61
|
+
import { ensureGrayMatterRedirect } from 'valaxy/vendor/ensure-gray-matter.mjs';
|
|
62
62
|
import { createJiti } from 'jiti';
|
|
63
63
|
import { transformerDirectives, transformerVariantGroup, presetWind4, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
64
64
|
import { convert } from 'html-to-text';
|
|
@@ -73,7 +73,7 @@ import * as readline from 'node:readline';
|
|
|
73
73
|
import qrcode from 'qrcode';
|
|
74
74
|
import ejs from 'ejs';
|
|
75
75
|
|
|
76
|
-
const version = "1.2.
|
|
76
|
+
const version = "1.2.2";
|
|
77
77
|
|
|
78
78
|
const GLOBAL_STATE = {
|
|
79
79
|
valaxyApp: void 0,
|
|
@@ -5585,6 +5585,8 @@ function disposeMdItInstance() {
|
|
|
5585
5585
|
Valaxy.state.dispose();
|
|
5586
5586
|
}
|
|
5587
5587
|
async function createMarkdownPlugin(options, base, state = Valaxy.state) {
|
|
5588
|
+
await ensureGrayMatterRedirect();
|
|
5589
|
+
const { default: Markdown } = await import('unplugin-vue-markdown/vite');
|
|
5588
5590
|
const mdOptions = options?.config.markdown || {};
|
|
5589
5591
|
const theme = mdOptions.theme ?? defaultCodeTheme;
|
|
5590
5592
|
const transformIncludes = createTransformIncludes(options);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"description": "📄 Vite & Vue powered static blog generator.",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "me@yunyoujun.cn",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"vue-router": "^5.0.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
+
"@11ty/gray-matter": "^3.0.0",
|
|
68
69
|
"@antfu/install-pkg": "^2.1.0",
|
|
69
70
|
"@antfu/utils": "^9.3.0",
|
|
70
71
|
"@clack/prompts": "^1.8.1",
|
|
@@ -75,8 +76,8 @@
|
|
|
75
76
|
"@unhead/bundler": "^3.4.1",
|
|
76
77
|
"@unhead/schema-org": "^3.4.1",
|
|
77
78
|
"@unhead/vue": "^3.4.1",
|
|
78
|
-
"@valaxyjs/devtools": "1.2.
|
|
79
|
-
"@valaxyjs/utils": "1.2.
|
|
79
|
+
"@valaxyjs/devtools": "1.2.2",
|
|
80
|
+
"@valaxyjs/utils": "1.2.2",
|
|
80
81
|
"@vitejs/devtools": "0.8.0",
|
|
81
82
|
"@vitejs/plugin-vue": "^6.0.9",
|
|
82
83
|
"@vueuse/core": "^15.0.0",
|
|
@@ -95,7 +96,6 @@
|
|
|
95
96
|
"floating-vue": "^5.4.0",
|
|
96
97
|
"fs-extra": "^11.4.0",
|
|
97
98
|
"fuse.js": "^7.5.0",
|
|
98
|
-
"gray-matter": "^4.0.3",
|
|
99
99
|
"hookable": "^6.1.2",
|
|
100
100
|
"html-to-text": "^10.0.1",
|
|
101
101
|
"jiti": "^2.7.0",
|
package/vendor/README.md
CHANGED
|
@@ -27,3 +27,8 @@ which keep that plugin's options, layout-name normalization and runtime behavior
|
|
|
27
27
|
|
|
28
28
|
`@intlify/unplugin-vue-i18n` was vendored at 11.2.5 until upstream 11.2.7 adopted
|
|
29
29
|
`tinyglobby` with absolute paths; Valaxy now depends on the npm release directly.
|
|
30
|
+
|
|
31
|
+
`ensure-gray-matter.mjs` and `redirect-gray-matter.mjs` are not upstream snapshots.
|
|
32
|
+
They redirect `@mdit-vue/plugin-frontmatter`'s `gray-matter` import to
|
|
33
|
+
`@11ty/gray-matter` before that module is evaluated, so a hoisted js-yaml 5 does
|
|
34
|
+
not crash on `yaml.safeLoad`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function ensureGrayMatterRedirect(): Promise<void>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as nodeModule from 'node:module'
|
|
2
|
+
import { resolve } from './redirect-gray-matter.mjs'
|
|
3
|
+
|
|
4
|
+
let pending
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Install the gray-matter redirect before markdown plugins are imported.
|
|
8
|
+
* `registerHooks` runs in-process and is the supported API on Node >=22.15.
|
|
9
|
+
* Older 22.12–22.14 releases only have the off-thread `module.register()`.
|
|
10
|
+
*/
|
|
11
|
+
export function ensureGrayMatterRedirect() {
|
|
12
|
+
if (!pending)
|
|
13
|
+
pending = install()
|
|
14
|
+
return pending
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function install() {
|
|
18
|
+
if (typeof nodeModule.registerHooks === 'function') {
|
|
19
|
+
nodeModule.registerHooks({ resolve })
|
|
20
|
+
return Promise.resolve()
|
|
21
|
+
}
|
|
22
|
+
return nodeModule.register(new URL('./redirect-gray-matter.mjs', import.meta.url), import.meta.url)
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'
|
|
2
|
+
import { pathToFileURL } from 'node:url'
|
|
3
|
+
|
|
4
|
+
const require = createRequire(new URL('../package.json', import.meta.url))
|
|
5
|
+
const replacement = pathToFileURL(require.resolve('@11ty/gray-matter')).href
|
|
6
|
+
|
|
7
|
+
function fromFrontmatterPlugin(parentURL = '') {
|
|
8
|
+
let parent = parentURL
|
|
9
|
+
try {
|
|
10
|
+
parent = decodeURIComponent(parentURL)
|
|
11
|
+
}
|
|
12
|
+
catch {}
|
|
13
|
+
return parent.includes('/@mdit-vue/plugin-frontmatter/')
|
|
14
|
+
|| parent.includes('@mdit-vue+plugin-frontmatter')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `@mdit-vue/plugin-frontmatter` imports `gray-matter` while its module is
|
|
19
|
+
* evaluated. gray-matter 4 then calls `yaml.safeLoad.bind`, which throws when
|
|
20
|
+
* js-yaml 5 is the resolved copy. Redirect only that import to the fork.
|
|
21
|
+
*
|
|
22
|
+
* Synchronous on purpose: `module.registerHooks()` calls `nextResolve`
|
|
23
|
+
* synchronously, while `module.register()` may return a promise. Returning
|
|
24
|
+
* `nextResolve()` directly works for both.
|
|
25
|
+
*/
|
|
26
|
+
export function resolve(specifier, context, nextResolve) {
|
|
27
|
+
if (specifier === 'gray-matter' && fromFrontmatterPlugin(context.parentURL))
|
|
28
|
+
return { url: replacement, shortCircuit: true }
|
|
29
|
+
return nextResolve(specifier, context)
|
|
30
|
+
}
|