jamdesk 1.1.196 → 1.1.197
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/dist/lib/frontmatter-utils.d.ts.map +1 -1
- package/dist/lib/frontmatter-utils.js +56 -2
- package/dist/lib/frontmatter-utils.js.map +1 -1
- package/package.json +1 -1
- package/vendored/lib/frontmatter-utils.ts +52 -2
- package/vendored/lib/mdx.ts +2 -1
- package/vendored/lib/remark-style-string-to-object.ts +482 -0
- package/vendored/lib/render-doc-page.tsx +2 -0
- package/vendored/lib/snippet-loader-isr.ts +13 -1
- package/vendored/scripts/build-search-index.cjs +38 -2
- package/vendored/workspace-package-lock.json +200 -200
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter-utils.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"frontmatter-utils.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkE7D;AAmED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG;IAExD,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAIA;AAMD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -24,10 +24,15 @@ export function preprocessFrontmatter(content) {
|
|
|
24
24
|
const body = content.slice(frontmatterEnd);
|
|
25
25
|
// Process each line of frontmatter
|
|
26
26
|
const lines = frontmatter.split('\n');
|
|
27
|
+
// Lines belonging to a previous key's multi-line value are VALUE TEXT, not
|
|
28
|
+
// key/value pairs, and must be left exactly as written.
|
|
29
|
+
const isContinuation = markContinuationLines(lines);
|
|
27
30
|
const fixedLines = lines.map((line, i) => {
|
|
28
31
|
// Skip empty lines and comments
|
|
29
32
|
if (!line.trim() || line.trim().startsWith('#'))
|
|
30
33
|
return line;
|
|
34
|
+
if (isContinuation[i])
|
|
35
|
+
return line;
|
|
31
36
|
// Match key: value pattern (simple single-line values only).
|
|
32
37
|
// The key may contain colon-segments (e.g. `og:title`, `twitter:card`,
|
|
33
38
|
// `article:published_time`) so we split on the FIRST colon followed by
|
|
@@ -35,13 +40,13 @@ export function preprocessFrontmatter(content) {
|
|
|
35
40
|
// A plain `[a-zA-Z_][a-zA-Z0-9_]*` key class stopped at the first colon,
|
|
36
41
|
// misparsing `og:title: Social` as key=`og`, value=`title: Social`, then
|
|
37
42
|
// quote-wrapping it into `og: "title: Social"` and destroying `og:title`.
|
|
38
|
-
const match = line.match(
|
|
43
|
+
const match = line.match(KEY_LINE);
|
|
39
44
|
if (!match)
|
|
40
45
|
return line;
|
|
41
46
|
const [, indent, key, value] = match;
|
|
42
47
|
// Skip if value is empty, already quoted, or is a multi-line indicator
|
|
43
48
|
// Multi-line indicators: | (literal), > (folded), with optional modifiers: |- |+ >- >+
|
|
44
|
-
if (!value || value.startsWith('"') || value.startsWith("'") ||
|
|
49
|
+
if (!value || value.startsWith('"') || value.startsWith("'") || isBlockScalar(value)) {
|
|
45
50
|
return line;
|
|
46
51
|
}
|
|
47
52
|
// Skip if value looks like a nested object or array
|
|
@@ -69,6 +74,55 @@ export function preprocessFrontmatter(content) {
|
|
|
69
74
|
// `---<Info>` and tripping MDX's "expected closing tag" validator.
|
|
70
75
|
return '---\n' + fixedLines.join('\n') + endMatch[0] + body;
|
|
71
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* A `key:` line. Shared with `markContinuationLines` so the two cannot disagree
|
|
79
|
+
* about what counts as a key — if they did, a line would be rewritten as a key
|
|
80
|
+
* by one and treated as value text by the other.
|
|
81
|
+
*/
|
|
82
|
+
const KEY_LINE = /^(\s*)([a-zA-Z_][a-zA-Z0-9_.-]*(?::[a-zA-Z0-9_.-]+)*):\s*(.*)$/;
|
|
83
|
+
/** `|`, `>`, `|-`, `>+`, `|2` … — the value is the indented block below. */
|
|
84
|
+
function isBlockScalar(value) {
|
|
85
|
+
return /^[|>][-+]?\d*$/.test(value.trim());
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Mark every line that is part of a PREVIOUS key's multi-line value.
|
|
89
|
+
*
|
|
90
|
+
* Those lines are value text. Running the key/value rewrite over them is how a
|
|
91
|
+
* Swedish changelog's continuation line ` Kotlin-SDK:er, Afterpay…` was
|
|
92
|
+
* rebuilt as ` Kotlin-SDK: er, …`: the reconstruction always emits `key: value`
|
|
93
|
+
* with a space, which turned plain prose into what YAML reads as a nested
|
|
94
|
+
* mapping entry, and js-yaml rejected the whole file — so a page lost its
|
|
95
|
+
* frontmatter entirely to a preprocessor whose only job is to RESCUE files.
|
|
96
|
+
*
|
|
97
|
+
* Inside a block scalar the same rewrite does not throw, which is worse: the
|
|
98
|
+
* injected space lands silently in the description text and ships to the page.
|
|
99
|
+
*/
|
|
100
|
+
function markContinuationLines(lines) {
|
|
101
|
+
const out = new Array(lines.length).fill(false);
|
|
102
|
+
for (let i = 0; i < lines.length; i++) {
|
|
103
|
+
if (out[i])
|
|
104
|
+
continue;
|
|
105
|
+
const match = lines[i].match(KEY_LINE);
|
|
106
|
+
if (!match)
|
|
107
|
+
continue;
|
|
108
|
+
const [, indent, , value] = match;
|
|
109
|
+
// A block scalar always has a body; a plain value only sometimes wraps.
|
|
110
|
+
if (!isBlockScalar(value) && !hasFoldedContinuation(lines, i))
|
|
111
|
+
continue;
|
|
112
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
113
|
+
// A blank line inside a block scalar is part of it; one at the end is
|
|
114
|
+
// harmless to mark, since the mapper skips blank lines anyway.
|
|
115
|
+
if (!lines[j].trim()) {
|
|
116
|
+
out[j] = true;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (lines[j].search(/\S/) <= indent.length)
|
|
120
|
+
break;
|
|
121
|
+
out[j] = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
72
126
|
/**
|
|
73
127
|
* True if the value on `lines[i]` continues onto a subsequent indented line
|
|
74
128
|
* (a YAML folded scalar without an explicit `|` or `>` indicator). The next
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter-utils.js","sourceRoot":"","sources":["../../src/lib/frontmatter-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,mCAAmC;IACnC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAE/C,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1D,IAAI,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC;IAE9B,MAAM,cAAc,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAE3C,mCAAmC;IACnC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,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E,2EAA2E;AAC3E,8EAA8E;AAC9E,wEAAwE;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jamdesk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.197",
|
|
4
4
|
"description": "CLI for Jamdesk — build, preview, and deploy documentation sites from MDX. Dev server with hot reload, 50+ components, OpenAPI support, AI search, and Mintlify migration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jamdesk",
|
|
@@ -28,9 +28,13 @@ export function preprocessFrontmatter(content: string): string {
|
|
|
28
28
|
|
|
29
29
|
// Process each line of frontmatter
|
|
30
30
|
const lines = frontmatter.split('\n');
|
|
31
|
+
// Lines belonging to a previous key's multi-line value are VALUE TEXT, not
|
|
32
|
+
// key/value pairs, and must be left exactly as written.
|
|
33
|
+
const isContinuation = markContinuationLines(lines);
|
|
31
34
|
const fixedLines = lines.map((line, i) => {
|
|
32
35
|
// Skip empty lines and comments
|
|
33
36
|
if (!line.trim() || line.trim().startsWith('#')) return line;
|
|
37
|
+
if (isContinuation[i]) return line;
|
|
34
38
|
|
|
35
39
|
// Match key: value pattern (simple single-line values only).
|
|
36
40
|
// The key may contain colon-segments (e.g. `og:title`, `twitter:card`,
|
|
@@ -39,14 +43,14 @@ export function preprocessFrontmatter(content: string): string {
|
|
|
39
43
|
// A plain `[a-zA-Z_][a-zA-Z0-9_]*` key class stopped at the first colon,
|
|
40
44
|
// misparsing `og:title: Social` as key=`og`, value=`title: Social`, then
|
|
41
45
|
// quote-wrapping it into `og: "title: Social"` and destroying `og:title`.
|
|
42
|
-
const match = line.match(
|
|
46
|
+
const match = line.match(KEY_LINE);
|
|
43
47
|
if (!match) return line;
|
|
44
48
|
|
|
45
49
|
const [, indent, key, value] = match;
|
|
46
50
|
|
|
47
51
|
// Skip if value is empty, already quoted, or is a multi-line indicator
|
|
48
52
|
// Multi-line indicators: | (literal), > (folded), with optional modifiers: |- |+ >- >+
|
|
49
|
-
if (!value || value.startsWith('"') || value.startsWith("'") ||
|
|
53
|
+
if (!value || value.startsWith('"') || value.startsWith("'") || isBlockScalar(value)) {
|
|
50
54
|
return line;
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -79,6 +83,52 @@ export function preprocessFrontmatter(content: string): string {
|
|
|
79
83
|
return '---\n' + fixedLines.join('\n') + endMatch[0] + body;
|
|
80
84
|
}
|
|
81
85
|
|
|
86
|
+
/**
|
|
87
|
+
* A `key:` line. Shared with `markContinuationLines` so the two cannot disagree
|
|
88
|
+
* about what counts as a key — if they did, a line would be rewritten as a key
|
|
89
|
+
* by one and treated as value text by the other.
|
|
90
|
+
*/
|
|
91
|
+
const KEY_LINE =
|
|
92
|
+
/^(\s*)([a-zA-Z_][a-zA-Z0-9_.-]*(?::[a-zA-Z0-9_.-]+)*):\s*(.*)$/;
|
|
93
|
+
|
|
94
|
+
/** `|`, `>`, `|-`, `>+`, `|2` … — the value is the indented block below. */
|
|
95
|
+
function isBlockScalar(value: string): boolean {
|
|
96
|
+
return /^[|>][-+]?\d*$/.test(value.trim());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Mark every line that is part of a PREVIOUS key's multi-line value.
|
|
101
|
+
*
|
|
102
|
+
* Those lines are value text. Running the key/value rewrite over them is how a
|
|
103
|
+
* Swedish changelog's continuation line ` Kotlin-SDK:er, Afterpay…` was
|
|
104
|
+
* rebuilt as ` Kotlin-SDK: er, …`: the reconstruction always emits `key: value`
|
|
105
|
+
* with a space, which turned plain prose into what YAML reads as a nested
|
|
106
|
+
* mapping entry, and js-yaml rejected the whole file — so a page lost its
|
|
107
|
+
* frontmatter entirely to a preprocessor whose only job is to RESCUE files.
|
|
108
|
+
*
|
|
109
|
+
* Inside a block scalar the same rewrite does not throw, which is worse: the
|
|
110
|
+
* injected space lands silently in the description text and ships to the page.
|
|
111
|
+
*/
|
|
112
|
+
function markContinuationLines(lines: string[]): boolean[] {
|
|
113
|
+
const out = new Array<boolean>(lines.length).fill(false);
|
|
114
|
+
for (let i = 0; i < lines.length; i++) {
|
|
115
|
+
if (out[i]) continue;
|
|
116
|
+
const match = lines[i].match(KEY_LINE);
|
|
117
|
+
if (!match) continue;
|
|
118
|
+
const [, indent, , value] = match;
|
|
119
|
+
// A block scalar always has a body; a plain value only sometimes wraps.
|
|
120
|
+
if (!isBlockScalar(value) && !hasFoldedContinuation(lines, i)) continue;
|
|
121
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
122
|
+
// A blank line inside a block scalar is part of it; one at the end is
|
|
123
|
+
// harmless to mark, since the mapper skips blank lines anyway.
|
|
124
|
+
if (!lines[j].trim()) { out[j] = true; continue; }
|
|
125
|
+
if (lines[j].search(/\S/) <= indent.length) break;
|
|
126
|
+
out[j] = true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
|
|
82
132
|
/**
|
|
83
133
|
* True if the value on `lines[i]` continues onto a subsequent indented line
|
|
84
134
|
* (a YAML folded scalar without an explicit `|` or `>` indicator). The next
|
package/vendored/lib/mdx.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { getContentDir } from './docs';
|
|
|
9
9
|
import { injectPromptSources } from './inject-prompt-source';
|
|
10
10
|
import { mdxSecurityOptions } from './mdx-security-options';
|
|
11
11
|
import { remarkSvgNamespaceAttrs } from './remark-svg-namespace-attrs';
|
|
12
|
+
import { remarkStyleStringToObject } from './remark-style-string-to-object';
|
|
12
13
|
import { getShikiOptions } from './shiki-config';
|
|
13
14
|
|
|
14
15
|
export interface DocFrontmatter {
|
|
@@ -46,7 +47,7 @@ export async function getDocContent(slug: string[]): Promise<DocContent | null>
|
|
|
46
47
|
// Keep expression props (e.g. cols={2}) compatible under next-mdx-remote v6.
|
|
47
48
|
...mdxSecurityOptions,
|
|
48
49
|
mdxOptions: {
|
|
49
|
-
remarkPlugins: [remarkGfm, remarkSvgNamespaceAttrs],
|
|
50
|
+
remarkPlugins: [remarkGfm, remarkSvgNamespaceAttrs, remarkStyleStringToObject],
|
|
50
51
|
rehypePlugins: [[rehypeShiki, shikiOptions]],
|
|
51
52
|
},
|
|
52
53
|
scope: data,
|