@qualcomm-ui/mdx-vite 2.4.0 → 2.5.1

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
@@ -4979,11 +4979,13 @@ var SearchIndexer = class {
4979
4979
  changed: {},
4980
4980
  filePath
4981
4981
  };
4982
+ let previousPage = void 0;
4982
4983
  if (!cached) {
4983
4984
  const previousData = this.fileCache.readCache(filePath);
4984
4985
  if (previousData) {
4985
4986
  const cachedFm = JSON.stringify(previousData.frontmatter);
4986
4987
  const currentFm = JSON.stringify(frontmatter);
4988
+ previousPage = previousData.page;
4987
4989
  if (cachedFm !== currentFm) {
4988
4990
  metadata.changed.frontmatter = true;
4989
4991
  }
@@ -5011,6 +5013,16 @@ var SearchIndexer = class {
5011
5013
  return { metadata, pageSections: [defaultSection] };
5012
5014
  }
5013
5015
  const { sections, toc } = indexedPage;
5016
+ if (previousPage) {
5017
+ for (let i = 0; i < toc.length; i++) {
5018
+ const previousHeading = previousPage.toc[i];
5019
+ const currentHeading = toc[i];
5020
+ if (previousHeading?.id !== currentHeading.id) {
5021
+ metadata.changed.toc = true;
5022
+ break;
5023
+ }
5024
+ }
5025
+ }
5014
5026
  if (toc.length) {
5015
5027
  this._pageMap[defaultSection.pathname].toc = toc;
5016
5028
  }
@@ -5750,7 +5762,7 @@ function extractProps(props, isPartial) {
5750
5762
  function removePreviewLines(code) {
5751
5763
  return code.split("\n").filter((line) => !isPreviewLine(line.trim())).join("\n");
5752
5764
  }
5753
- function getIntroLines(pages, projectName, description, baseUrl) {
5765
+ function getIntroLines(pages, projectName, description) {
5754
5766
  const lines = [];
5755
5767
  if (projectName) {
5756
5768
  lines.push(`# ${projectName}`);
@@ -5763,25 +5775,13 @@ function getIntroLines(pages, projectName, description, baseUrl) {
5763
5775
  lines.push("## Components and Integrations");
5764
5776
  lines.push("");
5765
5777
  for (const page of pages) {
5766
- const url = baseUrl ? `${baseUrl}/${kebabCase(page.title)}` : `#${kebabCase(page.title)}`;
5767
- if (page.title.includes("Introduction")) {
5768
- lines.push(`- [${page.title}](${url}): introduction and getting started`);
5769
- } else if (page.title.includes("Tailwind")) {
5770
- lines.push(
5771
- `- [${page.title}](${url}): integration documentation and examples`
5772
- );
5773
- } else {
5774
- lines.push(
5775
- `- [${page.title}](${url}): component documentation and examples`
5776
- );
5777
- }
5778
+ const url = page.url ?? `#${kebabCase(page.title)}`;
5779
+ lines.push(`- [${page.title}](${url})`);
5778
5780
  }
5779
5781
  return lines.join("\n");
5780
5782
  }
5781
- async function generateLlmsTxt(pages, projectName, description, baseUrl) {
5782
- const lines = [
5783
- getIntroLines(pages, projectName, description, baseUrl)
5784
- ];
5783
+ async function generateLlmsTxt(pages, projectName, description) {
5784
+ const lines = [getIntroLines(pages, projectName, description)];
5785
5785
  lines.push("");
5786
5786
  for (const page of pages) {
5787
5787
  const content = page.content.split("\n").map((line) => {
@@ -6079,7 +6079,8 @@ async function processComponent(component, docProps, verbose) {
6079
6079
  content: contentWithoutFrontmatter.trim(),
6080
6080
  demoFiles,
6081
6081
  frontmatter,
6082
- title
6082
+ title,
6083
+ url: component.url
6083
6084
  };
6084
6085
  } catch (error) {
6085
6086
  console.error(`Error processing component ${component.name}:`, error);
@@ -6232,8 +6233,7 @@ async function generate({
6232
6233
  const llmsTxtContent = await generateLlmsTxt(
6233
6234
  processedPages,
6234
6235
  name,
6235
- description,
6236
- baseUrl
6236
+ description
6237
6237
  );
6238
6238
  await mkdir2(dirname(outputPath), { recursive: true }).catch();
6239
6239
  await writeFile3(outputPath, llmsTxtContent, "utf-8");