@x-wave/blog 2.7.2 → 2.7.4
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/cli/index.js +7 -4
- package/index.js +3972 -3972
- package/package.json +1 -1
- package/styles/index.css +1 -1
- package/types/frontmatter.d.ts +12 -0
- package/types/frontmatter.d.ts.map +1 -0
- package/types/frontmatter.js +63 -0
- package/types/frontmatter.js.map +1 -0
- package/types/index.d.ts +34 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +2 -0
- package/types/index.js.map +1 -0
- package/vite-config/blog-discovery.d.ts.map +1 -1
- package/vite-config/blog-discovery.js +2 -54
- package/vite-config/blog-discovery.js.map +1 -1
- package/types/index.ts +0 -40
package/cli/index.js
CHANGED
|
@@ -43,7 +43,10 @@ function parseArgs(argv) {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Parse YAML frontmatter from MDX content.
|
|
46
|
-
* Supports string, boolean, and array values.
|
|
46
|
+
* Supports string (with optional double quotes), boolean, and array values.
|
|
47
|
+
*
|
|
48
|
+
* NOTE: This mirrors the canonical `parseFrontmatter` in the `types` package.
|
|
49
|
+
* Kept as a local copy because this CLI runs as plain .mjs without a build step.
|
|
47
50
|
*/
|
|
48
51
|
function parseFrontmatter(content) {
|
|
49
52
|
const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/)
|
|
@@ -67,7 +70,7 @@ function parseFrontmatter(content) {
|
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
// If we were in array context and hit a non-array line, save the array
|
|
70
|
-
if (isArrayContext
|
|
73
|
+
if (isArrayContext) {
|
|
71
74
|
frontmatter[currentKey] = arrayValues.slice()
|
|
72
75
|
arrayValues.length = 0
|
|
73
76
|
isArrayContext = false
|
|
@@ -80,7 +83,7 @@ function parseFrontmatter(content) {
|
|
|
80
83
|
const value = trimmed.substring(colonIndex + 1).trim()
|
|
81
84
|
currentKey = key
|
|
82
85
|
|
|
83
|
-
// Empty value
|
|
86
|
+
// Empty value means an array follows on subsequent lines
|
|
84
87
|
if (value === '') {
|
|
85
88
|
isArrayContext = true
|
|
86
89
|
continue
|
|
@@ -88,7 +91,7 @@ function parseFrontmatter(content) {
|
|
|
88
91
|
|
|
89
92
|
if (value === 'true') frontmatter[currentKey] = true
|
|
90
93
|
else if (value === 'false') frontmatter[currentKey] = false
|
|
91
|
-
else frontmatter[currentKey] = value
|
|
94
|
+
else frontmatter[currentKey] = value.replace(/^"(.*)"$/, '$1')
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
|