veryfront 0.1.369 → 0.1.370
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/esm/cli/commands/build/command.d.ts.map +1 -1
- package/esm/cli/commands/build/command.js +2 -0
- package/esm/cli/shared/ensure-content-transformer.d.ts +10 -0
- package/esm/cli/shared/ensure-content-transformer.d.ts.map +1 -0
- package/esm/cli/shared/ensure-content-transformer.js +16 -0
- package/esm/cli/shared/server-startup.d.ts.map +1 -1
- package/esm/cli/shared/server-startup.js +10 -3
- package/esm/deno.js +2 -1
- package/esm/extensions/ext-mdx/src/compiler/markdown-compile.d.ts +3 -0
- package/esm/extensions/ext-mdx/src/compiler/markdown-compile.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/compiler/markdown-compile.js +99 -0
- package/esm/extensions/ext-mdx/src/compiler/mdx-compile.d.ts +3 -0
- package/esm/extensions/ext-mdx/src/compiler/mdx-compile.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/compiler/mdx-compile.js +47 -0
- package/esm/extensions/ext-mdx/src/index.d.ts +30 -0
- package/esm/extensions/ext-mdx/src/index.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/index.js +52 -0
- package/esm/extensions/ext-mdx/src/plugins/plugin-loader.d.ts +4 -0
- package/esm/extensions/ext-mdx/src/plugins/plugin-loader.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/plugins/plugin-loader.js +18 -0
- package/esm/extensions/ext-mdx/src/plugins/rehype-node-positions.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/plugins/remark-headings.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/plugins/remark-mdx-utils.d.ts.map +1 -0
- package/esm/src/agent/fork-runtime-stream.d.ts +4 -4
- package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/content-transformer.d.ts +75 -24
- package/esm/src/extensions/interfaces/content-transformer.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/content-transformer.js +13 -0
- package/esm/src/extensions/interfaces/index.d.ts +1 -1
- package/esm/src/extensions/interfaces/index.d.ts.map +1 -1
- package/esm/src/integrations/schema.d.ts +4 -4
- package/esm/src/transforms/md/compiler/md-compiler.d.ts +2 -2
- package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
- package/esm/src/transforms/md/compiler/md-compiler.js +11 -106
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts +1 -1
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/index.d.ts +3 -3
- package/esm/src/transforms/mdx/compiler/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts +2 -2
- package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.js +10 -52
- package/esm/src/transforms/plugins/plugin-loader.d.ts +15 -0
- package/esm/src/transforms/plugins/plugin-loader.d.ts.map +1 -1
- package/esm/src/transforms/plugins/plugin-loader.js +20 -14
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/cli/commands/build/command.ts +2 -0
- package/src/cli/shared/ensure-content-transformer.ts +17 -0
- package/src/cli/shared/server-startup.ts +10 -3
- package/src/deno.js +2 -1
- package/src/extensions/ext-mdx/src/compiler/markdown-compile.ts +127 -0
- package/src/extensions/ext-mdx/src/compiler/mdx-compile.ts +73 -0
- package/src/extensions/ext-mdx/src/index.ts +63 -0
- package/src/extensions/ext-mdx/src/plugins/plugin-loader.ts +21 -0
- package/src/src/agent/fork-runtime-stream.ts +9 -4
- package/src/src/extensions/interfaces/content-transformer.ts +74 -20
- package/src/src/extensions/interfaces/index.ts +5 -2
- package/src/src/transforms/md/compiler/md-compiler.ts +17 -137
- package/src/src/transforms/mdx/compiler/import-rewriter.ts +1 -1
- package/src/src/transforms/mdx/compiler/index.ts +11 -3
- package/src/src/transforms/mdx/compiler/mdx-compiler.ts +15 -70
- package/src/src/transforms/plugins/plugin-loader.ts +22 -24
- package/src/src/utils/version-constant.ts +1 -1
- package/esm/src/transforms/mdx/compiler/types.d.ts +0 -16
- package/esm/src/transforms/mdx/compiler/types.d.ts.map +0 -1
- package/esm/src/transforms/mdx/compiler/types.js +0 -1
- package/esm/src/transforms/plugins/rehype-node-positions.d.ts.map +0 -1
- package/esm/src/transforms/plugins/remark-headings.d.ts.map +0 -1
- package/esm/src/transforms/plugins/remark-mdx-utils.d.ts.map +0 -1
- package/src/src/transforms/mdx/compiler/types.ts +0 -12
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/rehype-node-positions.d.ts +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/rehype-node-positions.js +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-headings.d.ts +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-headings.js +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-mdx-utils.d.ts +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-mdx-utils.js +0 -0
- /package/src/{src/transforms → extensions/ext-mdx/src}/plugins/rehype-node-positions.ts +0 -0
- /package/src/{src/transforms → extensions/ext-mdx/src}/plugins/remark-headings.ts +0 -0
- /package/src/{src/transforms → extensions/ext-mdx/src}/plugins/remark-mdx-utils.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFjE"}
|
|
@@ -7,6 +7,7 @@ import { displayBuildConfig, displayBuildStart } from "./config-display.js";
|
|
|
7
7
|
import { handleBuildError } from "./error-handler.js";
|
|
8
8
|
import { displayBuildSuccess } from "./stats-display.js";
|
|
9
9
|
import { isJsonMode, streamJsonLine } from "../../shared/json-output.js";
|
|
10
|
+
import { ensureBuiltinContentTransformer } from "../../shared/ensure-content-transformer.js";
|
|
10
11
|
export function buildCommand(options) {
|
|
11
12
|
return withSpan("cli.command.build", async () => {
|
|
12
13
|
const outputDir = options.outputDir ?? join(options.projectDir, "dist");
|
|
@@ -21,6 +22,7 @@ export function buildCommand(options) {
|
|
|
21
22
|
}
|
|
22
23
|
const adapter = await runtime.get();
|
|
23
24
|
await getConfig(options.projectDir, adapter);
|
|
25
|
+
ensureBuiltinContentTransformer();
|
|
24
26
|
if (isJsonMode()) {
|
|
25
27
|
streamJsonLine({ type: "step", name: "config", status: "completed" });
|
|
26
28
|
streamJsonLine({ type: "step", name: "build", status: "started" });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI ships ext-mdx baked in so the compiled binary can render MDX/Markdown
|
|
3
|
+
* pages out of the box. Library consumers (programmatic `startProductionServer`)
|
|
4
|
+
* still opt in via `veryfront.config.ts` extensions. Bootstrap's
|
|
5
|
+
* `setupAll → teardownAll → reset()` clears the contract registry, so this
|
|
6
|
+
* must run *after* the server-start (or `getConfig`) call returns. We skip
|
|
7
|
+
* registration when a user-provided extension already supplied the contract.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureBuiltinContentTransformer(): void;
|
|
10
|
+
//# sourceMappingURL=ensure-content-transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-content-transformer.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/ensure-content-transformer.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAGtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tryResolve } from "../../src/extensions/index.js";
|
|
2
|
+
import { register } from "../../src/extensions/contracts.js";
|
|
3
|
+
import { MdxContentTransformer } from "../../extensions/ext-mdx/src/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* The CLI ships ext-mdx baked in so the compiled binary can render MDX/Markdown
|
|
6
|
+
* pages out of the box. Library consumers (programmatic `startProductionServer`)
|
|
7
|
+
* still opt in via `veryfront.config.ts` extensions. Bootstrap's
|
|
8
|
+
* `setupAll → teardownAll → reset()` clears the contract registry, so this
|
|
9
|
+
* must run *after* the server-start (or `getConfig`) call returns. We skip
|
|
10
|
+
* registration when a user-provided extension already supplied the contract.
|
|
11
|
+
*/
|
|
12
|
+
export function ensureBuiltinContentTransformer() {
|
|
13
|
+
if (tryResolve("ContentTransformer"))
|
|
14
|
+
return;
|
|
15
|
+
register("ContentTransformer", new MdxContentTransformer());
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-startup.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/server-startup.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,cAAc,EACd,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"server-startup.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/server-startup.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,cAAc,EACd,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAcD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAsB5D;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAWrD;AAED,MAAM,WAAW,+BAA+B;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAuB5D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getEnv, runtime, setEnv } from "../../src/platform/index.js";
|
|
2
2
|
import { startDevServer, startProductionServer, } from "../../src/server/index.js";
|
|
3
|
+
import { ensureBuiltinContentTransformer } from "./ensure-content-transformer.js";
|
|
3
4
|
function buildDiscoveryConfig(options) {
|
|
4
5
|
const token = getEnv("VERYFRONT_API_TOKEN") ?? "";
|
|
5
6
|
const slug = getEnv("VERYFRONT_PROJECT_SLUG") ?? options.fallbackProjectSlug ?? "";
|
|
@@ -19,7 +20,7 @@ export async function startCliProxyModeServer(options) {
|
|
|
19
20
|
if (!getEnv("NODE_ENV") && !getEnv("DENO_ENV")) {
|
|
20
21
|
setEnv("NODE_ENV", "development");
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
const result = await startProductionServer({
|
|
23
24
|
port: options.port,
|
|
24
25
|
projectDir: options.projectDir,
|
|
25
26
|
signal: options.signal,
|
|
@@ -28,6 +29,8 @@ export async function startCliProxyModeServer(options) {
|
|
|
28
29
|
defaultProjectId: options.defaultProjectId,
|
|
29
30
|
discoveryConfig: buildDiscoveryConfig(options),
|
|
30
31
|
});
|
|
32
|
+
ensureBuiltinContentTransformer();
|
|
33
|
+
return result;
|
|
31
34
|
}
|
|
32
35
|
export async function startCliDevServer(options) {
|
|
33
36
|
const devOptions = {
|
|
@@ -37,7 +40,9 @@ export async function startCliDevServer(options) {
|
|
|
37
40
|
enableFastRefresh: options.enableFastRefresh,
|
|
38
41
|
signal: options.signal,
|
|
39
42
|
};
|
|
40
|
-
|
|
43
|
+
const result = await startDevServer(devOptions);
|
|
44
|
+
ensureBuiltinContentTransformer();
|
|
45
|
+
return result;
|
|
41
46
|
}
|
|
42
47
|
export async function startCliProductionServer(options) {
|
|
43
48
|
const adapter = options.adapter ?? (await runtime.get());
|
|
@@ -59,5 +64,7 @@ export async function startCliProductionServer(options) {
|
|
|
59
64
|
// through `/_veryfront/rsc/module?` for non-local deployments, so no
|
|
60
65
|
// `localProjects` entry is required for the compiled binary to work.
|
|
61
66
|
};
|
|
62
|
-
|
|
67
|
+
const result = await startProductionServer(serverOptions);
|
|
68
|
+
ensureBuiltinContentTransformer();
|
|
69
|
+
return result;
|
|
63
70
|
}
|
package/esm/deno.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.370",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"workspace": [
|
|
7
7
|
"./extensions/ext-anthropic",
|
|
8
8
|
"./extensions/ext-babel",
|
|
9
9
|
"./extensions/ext-jwt",
|
|
10
|
+
"./extensions/ext-mdx",
|
|
10
11
|
"./extensions/ext-node-compat",
|
|
11
12
|
"./extensions/ext-openai",
|
|
12
13
|
"./extensions/ext-opentelemetry",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-compile.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/compiler/markdown-compile.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAkDlH,wBAAsB,eAAe,CACnC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA4D/B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { unified } from "unified";
|
|
2
|
+
import remarkParse from "remark-parse";
|
|
3
|
+
import remarkGfm from "remark-gfm";
|
|
4
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
5
|
+
import remarkRehype from "remark-rehype";
|
|
6
|
+
import rehypeStarryNight from "rehype-starry-night";
|
|
7
|
+
import rehypeSlug from "rehype-slug";
|
|
8
|
+
import rehypeRaw from "rehype-raw";
|
|
9
|
+
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
|
|
10
|
+
import rehypeStringify from "rehype-stringify";
|
|
11
|
+
import { visit } from "unist-util-visit";
|
|
12
|
+
import { toString } from "mdast-util-to-string";
|
|
13
|
+
import Slugger from "github-slugger";
|
|
14
|
+
import { extractFrontmatter } from "../../../../src/transforms/mdx/compiler/frontmatter-extractor.js";
|
|
15
|
+
import { isMarkdownPreview } from "../../../../src/transforms/md/utils.js";
|
|
16
|
+
import { rehypeNodePositions } from "../plugins/rehype-node-positions.js";
|
|
17
|
+
function remarkExtractHeadings(headings) {
|
|
18
|
+
const slugger = new Slugger();
|
|
19
|
+
return (tree) => {
|
|
20
|
+
visit(tree, "heading", (node) => {
|
|
21
|
+
const text = toString(node);
|
|
22
|
+
const id = slugger.slug(text);
|
|
23
|
+
headings.push({ id, text, level: node.depth });
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function escapeForJsString(str) {
|
|
28
|
+
return str.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
29
|
+
}
|
|
30
|
+
function createCompiledCode(escapedHtml, isPreview) {
|
|
31
|
+
const injector = `dangerouslySetInnerHTML: { __html: \`${escapedHtml}\` }`;
|
|
32
|
+
if (isPreview) {
|
|
33
|
+
return `import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
|
+
export default function MDContent({ components, params, ...props }) {
|
|
35
|
+
return _jsx("div", {
|
|
36
|
+
className: "markdown-body",
|
|
37
|
+
${injector}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
return `import { jsx as _jsx } from "react/jsx-runtime";
|
|
43
|
+
export default function MDContent({ components, params, className, ...props }) {
|
|
44
|
+
return _jsx("div", {
|
|
45
|
+
className,
|
|
46
|
+
${injector}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
export async function compileMarkdown(options) {
|
|
52
|
+
const { content, frontmatter: providedFrontmatter, filePath, studioEmbed } = options;
|
|
53
|
+
const { body, frontmatter: extractedFrontmatter } = extractFrontmatter(content, providedFrontmatter);
|
|
54
|
+
const headings = [];
|
|
55
|
+
const pipeline = unified()
|
|
56
|
+
.use(remarkParse)
|
|
57
|
+
.use(remarkGfm)
|
|
58
|
+
.use(remarkFrontmatter)
|
|
59
|
+
.use(remarkExtractHeadings, headings)
|
|
60
|
+
.use(remarkRehype, { allowDangerousHtml: true })
|
|
61
|
+
.use(rehypeStarryNight)
|
|
62
|
+
.use(rehypeSlug);
|
|
63
|
+
pipeline.use(rehypeRaw);
|
|
64
|
+
if (studioEmbed && filePath) {
|
|
65
|
+
pipeline.use(rehypeNodePositions, { filePath });
|
|
66
|
+
}
|
|
67
|
+
const sanitizeSchema = studioEmbed
|
|
68
|
+
? {
|
|
69
|
+
...defaultSchema,
|
|
70
|
+
attributes: {
|
|
71
|
+
...defaultSchema.attributes,
|
|
72
|
+
"*": [
|
|
73
|
+
...(defaultSchema.attributes?.["*"] ?? []),
|
|
74
|
+
"data-node-file",
|
|
75
|
+
"data-node-name",
|
|
76
|
+
"data-node-line",
|
|
77
|
+
"data-node-column",
|
|
78
|
+
"data-node-source",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
: defaultSchema;
|
|
83
|
+
const result = await pipeline
|
|
84
|
+
.use(rehypeSanitize, sanitizeSchema)
|
|
85
|
+
.use(rehypeStringify)
|
|
86
|
+
.process(body);
|
|
87
|
+
const html = String(result);
|
|
88
|
+
const escapedHtml = escapeForJsString(html);
|
|
89
|
+
const isPreview = isMarkdownPreview(filePath, extractedFrontmatter);
|
|
90
|
+
const compiledCode = createCompiledCode(escapedHtml, isPreview);
|
|
91
|
+
return {
|
|
92
|
+
compiledCode,
|
|
93
|
+
frontmatter: extractedFrontmatter,
|
|
94
|
+
globals: {},
|
|
95
|
+
headings,
|
|
96
|
+
nodeMap: new Map(),
|
|
97
|
+
rawHtml: html,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-compile.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/compiler/mdx-compile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAQlH,wBAAsB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8D9F"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { compile } from "@mdx-js/mdx";
|
|
2
|
+
import { extractFrontmatter } from "../../../../src/transforms/mdx/compiler/frontmatter-extractor.js";
|
|
3
|
+
import { rewriteBodyImports, rewriteCompiledImports } from "../../../../src/transforms/mdx/compiler/import-rewriter.js";
|
|
4
|
+
import { getRehypePlugins, getRemarkPlugins } from "../plugins/plugin-loader.js";
|
|
5
|
+
import { rehypeNodePositions } from "../plugins/rehype-node-positions.js";
|
|
6
|
+
export async function compileMdx(options) {
|
|
7
|
+
const { projectDir, content, frontmatter: providedFrontmatter, filePath, target = "server", baseUrl, studioEmbed, } = options;
|
|
8
|
+
const remarkPlugins = getRemarkPlugins();
|
|
9
|
+
const rehypePlugins = getRehypePlugins();
|
|
10
|
+
if (studioEmbed && filePath) {
|
|
11
|
+
rehypePlugins.push([rehypeNodePositions, { filePath }]);
|
|
12
|
+
}
|
|
13
|
+
const { body: extractedBody, frontmatter: extractedFrontmatter } = extractFrontmatter(content, providedFrontmatter);
|
|
14
|
+
const shouldRewriteImports = Boolean(filePath) &&
|
|
15
|
+
(target === "browser" || target === "server");
|
|
16
|
+
const body = shouldRewriteImports
|
|
17
|
+
? rewriteBodyImports(extractedBody, { filePath: filePath, target, baseUrl, projectDir })
|
|
18
|
+
: extractedBody;
|
|
19
|
+
const compiled = await compile(body, {
|
|
20
|
+
outputFormat: "program",
|
|
21
|
+
// Always false: @mdx-js/mdx development mode emits extra JSX
|
|
22
|
+
// transforms that break the existing rendering pipeline.
|
|
23
|
+
development: false,
|
|
24
|
+
remarkPlugins,
|
|
25
|
+
rehypePlugins,
|
|
26
|
+
providerImportSource: undefined,
|
|
27
|
+
jsxImportSource: "react",
|
|
28
|
+
});
|
|
29
|
+
const headings = compiled.data?.headings ??
|
|
30
|
+
[];
|
|
31
|
+
const compiledString = String(compiled);
|
|
32
|
+
const compiledCode = shouldRewriteImports
|
|
33
|
+
? rewriteCompiledImports(compiledString, {
|
|
34
|
+
filePath: filePath,
|
|
35
|
+
target,
|
|
36
|
+
baseUrl,
|
|
37
|
+
projectDir,
|
|
38
|
+
})
|
|
39
|
+
: compiledString;
|
|
40
|
+
return {
|
|
41
|
+
compiledCode,
|
|
42
|
+
frontmatter: extractedFrontmatter,
|
|
43
|
+
globals: {},
|
|
44
|
+
headings,
|
|
45
|
+
nodeMap: new Map(),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-mdx — ContentTransformer implementation backed by MDX + remark/rehype.
|
|
3
|
+
*
|
|
4
|
+
* Provides the `ContentTransformer` contract:
|
|
5
|
+
* - `compileMdx(options)` — runs @mdx-js/mdx through veryfront's remark +
|
|
6
|
+
* rehype plugin stack and returns compiled ESM plus extracted headings
|
|
7
|
+
* and frontmatter.
|
|
8
|
+
* - `compileMarkdown(options)` — runs a unified markdown pipeline
|
|
9
|
+
* (remark-parse → remark-rehype → rehype-sanitize → rehype-stringify)
|
|
10
|
+
* producing sanitized HTML wrapped in a React component.
|
|
11
|
+
*
|
|
12
|
+
* Core's `src/transforms/md/compiler` and `src/transforms/mdx/compiler`
|
|
13
|
+
* resolve this contract at call time. When the extension is not installed,
|
|
14
|
+
* core throws an actionable install message (see
|
|
15
|
+
* `src/extensions/recommendations.ts`).
|
|
16
|
+
*
|
|
17
|
+
* @module extensions/ext-mdx
|
|
18
|
+
*/
|
|
19
|
+
import type { ExtensionFactory } from "../../../src/extensions/index.js";
|
|
20
|
+
import type { ContentCompileOptions, ContentPlugin, ContentRuntimeBundle, ContentTransformer } from "../../../src/extensions/interfaces/index.js";
|
|
21
|
+
declare class MdxContentTransformer implements ContentTransformer {
|
|
22
|
+
compileMdx(options: ContentCompileOptions): Promise<ContentRuntimeBundle>;
|
|
23
|
+
compileMarkdown(options: ContentCompileOptions): Promise<ContentRuntimeBundle>;
|
|
24
|
+
getRemarkPlugins(): ContentPlugin[];
|
|
25
|
+
getRehypePlugins(): ContentPlugin[];
|
|
26
|
+
}
|
|
27
|
+
declare const extMdx: ExtensionFactory;
|
|
28
|
+
export default extMdx;
|
|
29
|
+
export { MdxContentTransformer };
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-mdx/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAKrD,cAAM,qBAAsB,YAAW,kBAAkB;IACvD,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAGzE,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAG9E,gBAAgB,IAAI,aAAa,EAAE;IAGnC,gBAAgB,IAAI,aAAa,EAAE;CAGpC;AAED,QAAA,MAAM,MAAM,EAAE,gBAcb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-mdx — ContentTransformer implementation backed by MDX + remark/rehype.
|
|
3
|
+
*
|
|
4
|
+
* Provides the `ContentTransformer` contract:
|
|
5
|
+
* - `compileMdx(options)` — runs @mdx-js/mdx through veryfront's remark +
|
|
6
|
+
* rehype plugin stack and returns compiled ESM plus extracted headings
|
|
7
|
+
* and frontmatter.
|
|
8
|
+
* - `compileMarkdown(options)` — runs a unified markdown pipeline
|
|
9
|
+
* (remark-parse → remark-rehype → rehype-sanitize → rehype-stringify)
|
|
10
|
+
* producing sanitized HTML wrapped in a React component.
|
|
11
|
+
*
|
|
12
|
+
* Core's `src/transforms/md/compiler` and `src/transforms/mdx/compiler`
|
|
13
|
+
* resolve this contract at call time. When the extension is not installed,
|
|
14
|
+
* core throws an actionable install message (see
|
|
15
|
+
* `src/extensions/recommendations.ts`).
|
|
16
|
+
*
|
|
17
|
+
* @module extensions/ext-mdx
|
|
18
|
+
*/
|
|
19
|
+
import { compileMdx } from "./compiler/mdx-compile.js";
|
|
20
|
+
import { compileMarkdown } from "./compiler/markdown-compile.js";
|
|
21
|
+
import { getRehypePlugins, getRemarkPlugins } from "./plugins/plugin-loader.js";
|
|
22
|
+
class MdxContentTransformer {
|
|
23
|
+
compileMdx(options) {
|
|
24
|
+
return compileMdx(options);
|
|
25
|
+
}
|
|
26
|
+
compileMarkdown(options) {
|
|
27
|
+
return compileMarkdown(options);
|
|
28
|
+
}
|
|
29
|
+
getRemarkPlugins() {
|
|
30
|
+
return getRemarkPlugins();
|
|
31
|
+
}
|
|
32
|
+
getRehypePlugins() {
|
|
33
|
+
return getRehypePlugins();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const extMdx = () => {
|
|
37
|
+
const impl = new MdxContentTransformer();
|
|
38
|
+
return {
|
|
39
|
+
name: "ext-mdx",
|
|
40
|
+
version: "0.1.0",
|
|
41
|
+
capabilities: [{ type: "contract", name: "ContentTransformer" }],
|
|
42
|
+
setup(ctx) {
|
|
43
|
+
ctx.provide("ContentTransformer", impl);
|
|
44
|
+
ctx.logger.info("[ext-mdx] ContentTransformer registered");
|
|
45
|
+
},
|
|
46
|
+
teardown() {
|
|
47
|
+
// No resources to release.
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default extMdx;
|
|
52
|
+
export { MdxContentTransformer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQzC,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAQ9C;AAED,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAE9C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import rehypeHighlight from "rehype-highlight";
|
|
2
|
+
import rehypeSlug from "rehype-slug";
|
|
3
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
4
|
+
import remarkGfm from "remark-gfm";
|
|
5
|
+
import { remarkMdxHeadings } from "./remark-headings.js";
|
|
6
|
+
import { remarkCodeBlocks, remarkMdxRemoveParagraphs } from "./remark-mdx-utils.js";
|
|
7
|
+
export function getRemarkPlugins() {
|
|
8
|
+
return [
|
|
9
|
+
remarkGfm,
|
|
10
|
+
remarkFrontmatter,
|
|
11
|
+
remarkMdxHeadings,
|
|
12
|
+
remarkMdxRemoveParagraphs,
|
|
13
|
+
remarkCodeBlocks,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
export function getRehypePlugins() {
|
|
17
|
+
return [rehypeHighlight, rehypeSlug];
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-node-positions.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/rehype-node-positions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,aAAa,CAAC;AAGjD,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAoCtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-headings.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/remark-headings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AA0BnC,wBAAgB,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CA8DrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-mdx-utils.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/remark-mdx-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAoGnC;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CA6EhE;AAYD,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAmBvD;AAQD,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAmBpE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HostToolSet, type Tool, type TraceHostToolsOptions } from "../tool/index.js";
|
|
1
|
+
import { type HostToolSet, type HostToolTraceAttributes, type Tool, type TraceHostToolsOptions } from "../tool/index.js";
|
|
2
2
|
import type { AgUiRuntimeStreamEvent } from "./ag-ui-browser-encoder.js";
|
|
3
3
|
import type { AgentResponse, Message as AgentMessage } from "./schemas/index.js";
|
|
4
4
|
interface ForkStreamPart {
|
|
@@ -146,13 +146,13 @@ export type StartAgentRuntimeForkInput = {
|
|
|
146
146
|
prepareStep?: ForkRuntimeStepPreparer;
|
|
147
147
|
runStep?: AgentRuntimeForkStepRunner;
|
|
148
148
|
};
|
|
149
|
-
export type StartAgentRuntimeForkWithHostToolsInput = Omit<StartAgentRuntimeForkInput, "forkToolNames" | "model" | "runtimeTools"> & {
|
|
149
|
+
export type StartAgentRuntimeForkWithHostToolsInput<TAttributes extends HostToolTraceAttributes = HostToolTraceAttributes> = Omit<StartAgentRuntimeForkInput, "forkToolNames" | "model" | "runtimeTools"> & {
|
|
150
150
|
provider: string;
|
|
151
151
|
forkModel: string;
|
|
152
152
|
forkTools: HostToolSet;
|
|
153
|
-
traceTools?: TraceHostToolsOptions
|
|
153
|
+
traceTools?: TraceHostToolsOptions<TAttributes>;
|
|
154
154
|
};
|
|
155
|
-
export declare function startAgentRuntimeForkWithHostTools(input: StartAgentRuntimeForkWithHostToolsInput): {
|
|
155
|
+
export declare function startAgentRuntimeForkWithHostTools<TAttributes extends HostToolTraceAttributes = HostToolTraceAttributes>(input: StartAgentRuntimeForkWithHostToolsInput<TAttributes>): {
|
|
156
156
|
streamResult: ForkRuntimeStreamResult;
|
|
157
157
|
forkToolNames: string[];
|
|
158
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork-runtime-stream.d.ts","sourceRoot":"","sources":["../../../src/src/agent/fork-runtime-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,IAAI,EAET,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAazE,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjF,UAAU,cAAc;IACtB,IAAI,EAAE,iBAAiB,GAAG,YAAY,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB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
6
|
+
* Implementations compile MDX / Markdown source into renderable JavaScript
|
|
7
|
+
* modules. Core's `src/transforms/md/compiler` and
|
|
8
|
+
* `src/transforms/mdx/compiler` delegate to the registered implementation;
|
|
9
|
+
* when none is registered, the compile paths throw an actionable install
|
|
10
|
+
* message pointing at `@veryfront/ext-mdx`.
|
|
11
|
+
*
|
|
12
|
+
* The two compile methods have the same option shape on purpose so a single
|
|
13
|
+
* dispatcher (see `src/transforms/mdx/compiler/index.ts::compileContent`)
|
|
14
|
+
* can route on file extension. Options match the long-standing
|
|
15
|
+
* `compileMDXRuntime` / `compileMarkdownRuntime` signatures — option order
|
|
16
|
+
* and defaults are preserved so the extension boundary is a pure refactor,
|
|
17
|
+
* not a behavior change.
|
|
18
|
+
*
|
|
6
19
|
* @module extensions/interfaces/content-transformer
|
|
7
20
|
*/
|
|
8
|
-
/**
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
21
|
+
/** Compilation mode — dev surfaces extra diagnostics. */
|
|
22
|
+
export type CompilationMode = "development" | "production";
|
|
23
|
+
/** Where the output is destined — server-side RSC or browser bundle. */
|
|
24
|
+
export type CompilationTarget = "browser" | "server";
|
|
25
|
+
/** Runtime bundle returned by the compilation pipeline. */
|
|
26
|
+
export interface ContentRuntimeBundle {
|
|
27
|
+
/** Compiled ESM source containing the default MDX/MD component export. */
|
|
28
|
+
compiledCode: string;
|
|
29
|
+
/** Front-matter extracted from the source document. */
|
|
30
|
+
frontmatter: Record<string, unknown>;
|
|
31
|
+
/** Globals injected into the module scope (MDX imports, shims). */
|
|
32
|
+
globals: Record<string, unknown>;
|
|
33
|
+
/** Extracted TOC headings, when the pipeline collected them. */
|
|
34
|
+
headings?: {
|
|
35
|
+
id: string;
|
|
36
|
+
text: string;
|
|
37
|
+
level: number;
|
|
38
|
+
}[];
|
|
39
|
+
/** Source-map-adjacent line/column data keyed by node ordinal. */
|
|
40
|
+
nodeMap?: Map<number, unknown>;
|
|
41
|
+
/** Raw HTML (markdown preview path only). */
|
|
42
|
+
rawHtml?: string;
|
|
16
43
|
}
|
|
17
|
-
/**
|
|
18
|
-
export interface
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/**
|
|
44
|
+
/** Options for {@link ContentTransformer.compileMdx} and {@link ContentTransformer.compileMarkdown}. */
|
|
45
|
+
export interface ContentCompileOptions {
|
|
46
|
+
/** Compilation mode — defaults to "production" when omitted. */
|
|
47
|
+
mode?: CompilationMode;
|
|
48
|
+
/** Absolute project root (used for resolving relative import rewrites). */
|
|
49
|
+
projectDir: string;
|
|
50
|
+
/** Source document content. */
|
|
51
|
+
content: string;
|
|
52
|
+
/** Optional frontmatter pre-seed merged with in-body frontmatter. */
|
|
22
53
|
frontmatter?: Record<string, unknown>;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
54
|
+
/** Source file path hint (used in error messages + import resolution). */
|
|
55
|
+
filePath?: string;
|
|
56
|
+
/** Compile target — defaults to "server". */
|
|
57
|
+
target?: CompilationTarget;
|
|
58
|
+
/** Base URL used when rewriting bare-specifier imports. */
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
/** When true, preserves node-position metadata for studio overlays. */
|
|
61
|
+
studioEmbed?: boolean;
|
|
29
62
|
}
|
|
30
63
|
/**
|
|
31
|
-
*
|
|
64
|
+
* Opaque unified-compatible plugin entry. Kept as `unknown[] | unknown` so
|
|
65
|
+
* the contract surface doesn't require consumers to depend on the `unified`
|
|
66
|
+
* package directly — callers cast to the plugin-list shape they need.
|
|
67
|
+
*/
|
|
68
|
+
export type ContentPlugin = unknown | [unknown, ...unknown[]];
|
|
69
|
+
/**
|
|
70
|
+
* ContentTransformer contract — compiles MDX/Markdown to runtime-ready JS.
|
|
71
|
+
*
|
|
72
|
+
* Implementations own the entire pipeline (parser, remark/rehype plugins,
|
|
73
|
+
* MDX compile step, sanitization, HTML wrapping). Core only dispatches by
|
|
74
|
+
* file extension and post-processes the returned bundle.
|
|
32
75
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
76
|
+
* `getRemarkPlugins()` / `getRehypePlugins()` are exposed so build-time MDX
|
|
77
|
+
* compilers (which run their own @mdx-js/mdx invocations) can borrow the
|
|
78
|
+
* canonical plugin list without duplicating it. Runtime compile paths
|
|
79
|
+
* should prefer `compileMdx` / `compileMarkdown`.
|
|
35
80
|
*/
|
|
36
81
|
export interface ContentTransformer {
|
|
37
|
-
/**
|
|
38
|
-
|
|
82
|
+
/** Compile MDX source into a runtime bundle. */
|
|
83
|
+
compileMdx(options: ContentCompileOptions): Promise<ContentRuntimeBundle>;
|
|
84
|
+
/** Compile plain Markdown into a runtime bundle. */
|
|
85
|
+
compileMarkdown(options: ContentCompileOptions): Promise<ContentRuntimeBundle>;
|
|
86
|
+
/** Return the canonical remark plugin list. */
|
|
87
|
+
getRemarkPlugins(): ContentPlugin[];
|
|
88
|
+
/** Return the canonical rehype plugin list. */
|
|
89
|
+
getRehypePlugins(): ContentPlugin[];
|
|
39
90
|
}
|
|
40
91
|
//# sourceMappingURL=content-transformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-transformer.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/interfaces/content-transformer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"content-transformer.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/interfaces/content-transformer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,YAAY,CAAC;AAE3D,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErD,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB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AoB,CAAC,CAAC;IAC/E,+CAA+C;IAC/C,gBAAgB,IAAI,aAAa,EAAE,CAAC;IACpC,+CAA+C;IAC/C,gBAAgB,IAAI,aAAa,EAAE,CAAC;CACrC"}
|
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Default implementation: `@veryfront/ext-mdx`
|
|
5
5
|
*
|
|
6
|
+
* Implementations compile MDX / Markdown source into renderable JavaScript
|
|
7
|
+
* modules. Core's `src/transforms/md/compiler` and
|
|
8
|
+
* `src/transforms/mdx/compiler` delegate to the registered implementation;
|
|
9
|
+
* when none is registered, the compile paths throw an actionable install
|
|
10
|
+
* message pointing at `@veryfront/ext-mdx`.
|
|
11
|
+
*
|
|
12
|
+
* The two compile methods have the same option shape on purpose so a single
|
|
13
|
+
* dispatcher (see `src/transforms/mdx/compiler/index.ts::compileContent`)
|
|
14
|
+
* can route on file extension. Options match the long-standing
|
|
15
|
+
* `compileMDXRuntime` / `compileMarkdownRuntime` signatures — option order
|
|
16
|
+
* and defaults are preserved so the extension boundary is a pure refactor,
|
|
17
|
+
* not a behavior change.
|
|
18
|
+
*
|
|
6
19
|
* @module extensions/interfaces/content-transformer
|
|
7
20
|
*/
|
|
8
21
|
export {};
|