@qualcomm-ui/mdx-vite 2.7.0 → 2.8.0

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/cli.js CHANGED
@@ -3604,6 +3604,7 @@ function defined(value) {
3604
3604
  }
3605
3605
  var frontmatterSchema = implement().with({
3606
3606
  categories: z3.string().array().optional(),
3607
+ description: z3.string().optional(),
3607
3608
  group: z3.string().optional(),
3608
3609
  hidden: z3.boolean().optional(),
3609
3610
  hideBreadcrumbs: z3.boolean().optional(),
@@ -5036,6 +5037,7 @@ var SearchIndexer = class {
5036
5037
  this.metaJson,
5037
5038
  routeMeta?.title || frontmatter.title || ""
5038
5039
  ),
5040
+ description: frontmatter.description,
5039
5041
  hidden: defined(routeMeta.hidden) ? routeMeta.hidden : frontmatter.hidden,
5040
5042
  hideBreadcrumbs: defined(routeMeta.hideBreadcrumbs) ? routeMeta.hideBreadcrumbs : frontmatter.hideBreadcrumbs,
5041
5043
  hideFromSearch: defined(routeMeta.hideFromSearch) ? routeMeta.hideFromSearch : frontmatter.hideFromSearch,
@@ -5628,7 +5630,7 @@ import remarkParse4 from "remark-parse";
5628
5630
  import remarkParseFrontmatter2 from "remark-parse-frontmatter";
5629
5631
  import remarkStringify3 from "remark-stringify";
5630
5632
  import { unified as unified4 } from "unified";
5631
- import { visit as visit7 } from "unist-util-visit";
5633
+ import { visit as visit8 } from "unist-util-visit";
5632
5634
  import { kebabCase } from "@qualcomm-ui/utils/change-case";
5633
5635
 
5634
5636
  // src/docs-plugin/docs-plugin.ts
@@ -5795,9 +5797,12 @@ import { headingRank as headingRank2 } from "hast-util-heading-rank";
5795
5797
  // src/docs-plugin/remark/remark-code-tabs.ts
5796
5798
  import { visit as visit4 } from "unist-util-visit";
5797
5799
 
5800
+ // src/docs-plugin/remark/remark-frontmatter-description.ts
5801
+ import { visit as visit5 } from "unist-util-visit";
5802
+
5798
5803
  // src/docs-plugin/remark/remark-self-link-headings.ts
5799
5804
  import { toString as toString2 } from "mdast-util-to-string";
5800
- import { visit as visit5 } from "unist-util-visit";
5805
+ import { visit as visit6 } from "unist-util-visit";
5801
5806
  var emptyOptions2 = {};
5802
5807
  function remarkSelfLinkHeadings(baseUrl = "", options) {
5803
5808
  if (!baseUrl) {
@@ -5825,7 +5830,7 @@ function remarkSelfLinkHeadings(baseUrl = "", options) {
5825
5830
  }
5826
5831
  return (tree) => {
5827
5832
  seenIds.clear();
5828
- visit5(tree, "heading", (node) => {
5833
+ visit6(tree, "heading", (node) => {
5829
5834
  if (allowedLevels.has(node.depth)) {
5830
5835
  const text = toString2(node);
5831
5836
  const slug = prefix + createSlug(text);
@@ -5842,7 +5847,7 @@ function remarkSelfLinkHeadings(baseUrl = "", options) {
5842
5847
  }
5843
5848
 
5844
5849
  // src/docs-plugin/remark/remark-spoilers.ts
5845
- import { visit as visit6 } from "unist-util-visit";
5850
+ import { visit as visit7 } from "unist-util-visit";
5846
5851
 
5847
5852
  // src/docs-plugin/shiki/shiki-transformer-preview-block.ts
5848
5853
  import { dedent } from "@qualcomm-ui/utils/dedent";
@@ -5954,7 +5959,7 @@ function extractMetadata(metadata) {
5954
5959
  }
5955
5960
  var replaceNpmInstallTabs = () => {
5956
5961
  return (tree, _file, done) => {
5957
- visit7(tree, "mdxJsxFlowElement", (node) => {
5962
+ visit8(tree, "mdxJsxFlowElement", (node) => {
5958
5963
  if (node?.name === "NpmInstallTabs") {
5959
5964
  const packages = node.attributes?.find(
5960
5965
  (attr) => attr.type === "mdxJsxAttribute" && attr.name === "packages"
@@ -6270,7 +6275,7 @@ ${codeText}
6270
6275
  }
6271
6276
  };
6272
6277
  return () => (tree, _file, done) => {
6273
- visit7(tree, "mdxJsxFlowElement", (node) => {
6278
+ visit8(tree, "mdxJsxFlowElement", (node) => {
6274
6279
  const handler = node.name && handlers[node.name];
6275
6280
  if (!handler) {
6276
6281
  return;
@@ -6310,7 +6315,7 @@ ${codeText}
6310
6315
  */
6311
6316
  replaceTypeDocProps() {
6312
6317
  return () => (tree, _file, done) => {
6313
- visit7(
6318
+ visit8(
6314
6319
  tree,
6315
6320
  "mdxJsxFlowElement",
6316
6321
  (node, index, parent) => {
@@ -6371,7 +6376,7 @@ ${codeText}
6371
6376
  replaceDemos(demosFolder, demoFiles) {
6372
6377
  return () => async (tree) => {
6373
6378
  const promises = [];
6374
- visit7(
6379
+ visit8(
6375
6380
  tree,
6376
6381
  "mdxJsxFlowElement",
6377
6382
  (node, index, parent) => {
@@ -6459,11 +6464,32 @@ ${codeText}
6459
6464
  await Promise.all(promises);
6460
6465
  };
6461
6466
  }
6467
+ replaceFrontmatterDescription(frontmatter) {
6468
+ return () => (tree) => {
6469
+ visit8(
6470
+ tree,
6471
+ "mdxFlowExpression",
6472
+ (node, index, parent) => {
6473
+ if (node.value.trim() !== "frontmatter.description" || index === void 0 || !parent) {
6474
+ return;
6475
+ }
6476
+ if (frontmatter.description) {
6477
+ parent.children.splice(index, 1, {
6478
+ children: [{ type: "text", value: frontmatter.description }],
6479
+ type: "paragraph"
6480
+ });
6481
+ } else {
6482
+ parent.children.splice(index, 1);
6483
+ }
6484
+ }
6485
+ );
6486
+ };
6487
+ }
6462
6488
  /**
6463
6489
  * Processes MDX content by transforming JSX elements (TypeDocProps, demos)
6464
6490
  * into markdown, resolving relative links, and cleaning up formatting.
6465
6491
  */
6466
- async processMdxContent(mdxContent, pageUrl, demosFolder) {
6492
+ async processMdxContent(mdxContent, pageUrl, demosFolder, frontmatter) {
6467
6493
  const demoFiles = [];
6468
6494
  let processedContent = mdxContent;
6469
6495
  const lines = processedContent.split("\n");
@@ -6473,7 +6499,7 @@ ${codeText}
6473
6499
  /\[([^\]]+)\]\(\.\/#([^)]+)\)/g,
6474
6500
  (_, text, anchor) => pageUrl && this.config.outputMode === "per-page" ? `[${text}](${pageUrl}#${anchor})` : text
6475
6501
  );
6476
- const processor = unified4().use(remarkParse4).use(remarkMdx3).use(this.replaceTypeDocProps()).use(await this.replaceThemeNodes()).use(this.replaceDemos(demosFolder, demoFiles)).use(remarkStringify3);
6502
+ const processor = unified4().use(remarkParse4).use(remarkMdx3).use(this.replaceTypeDocProps()).use(this.replaceFrontmatterDescription(frontmatter)).use(await this.replaceThemeNodes()).use(this.replaceDemos(demosFolder, demoFiles)).use(remarkStringify3);
6477
6503
  const processed = await processor.process(processedContent);
6478
6504
  processedContent = String(processed);
6479
6505
  processedContent = processedContent.replace(/\n\s*\n\s*\n/g, "\n\n");
@@ -6495,7 +6521,8 @@ ${codeText}
6495
6521
  const { content: processedContent, demoFiles } = await this.processMdxContent(
6496
6522
  String(parsed),
6497
6523
  component.url,
6498
- component.demosFolder
6524
+ component.demosFolder,
6525
+ frontmatter
6499
6526
  );
6500
6527
  const removeJsxProcessor = unified4().use(remarkParse4).use(remarkMdx3).use(remarkRemoveJsx).use(remarkStringify3);
6501
6528
  const removedJsx = String(