@mintlify/prebuild 1.0.536 → 1.0.538

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.
@@ -1,3 +1,2 @@
1
- import { RSSItem } from '@mintlify/common';
2
- import { Root } from 'mdast';
3
- export declare const mdxToRssUpdates: (tree: Root, existingUpdates: RSSItem[]) => RSSItem[];
1
+ import { RSSItem, UpdateMDXComponent } from '@mintlify/common';
2
+ export declare const mdxToRssUpdates: (mdxUpdates: UpdateMDXComponent[]) => RSSItem[];
@@ -1,30 +1,22 @@
1
- import { getTags, isUpdate } from '@mintlify/common';
2
- export const mdxToRssUpdates = (tree, existingUpdates) => {
3
- let updates = [];
4
- const updateComponents = tree.children.filter((child) => isUpdate(child));
5
- for (const updateComponent of updateComponents) {
6
- const attributes = updateComponent.attributes;
7
- const label = attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'label')?.value;
8
- const description = attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'description')?.value;
1
+ import { getTags, getUpdateDescription, getUpdateTitle, getRssPropsData, } from '@mintlify/common';
2
+ export const mdxToRssUpdates = (mdxUpdates) => {
3
+ const updates = [];
4
+ for (const updateComponent of mdxUpdates) {
5
+ const date = new Date().toISOString();
6
+ const { rssTitle, rssDescription } = getRssPropsData(updateComponent);
7
+ const label = getUpdateTitle(updateComponent);
8
+ const title = rssTitle || label;
9
+ const description = rssDescription || getUpdateDescription(updateComponent);
9
10
  const tags = getTags(updateComponent);
10
- const validTitle = label?.toString() || undefined;
11
- const validDescription = description?.toString() || '';
12
- const validTags = tags.length > 0 ? tags : undefined;
13
- const existingUpdate = existingUpdates.find((update) => update.title === validTitle);
14
- if (existingUpdate && existingUpdate.date) {
15
- updates.push(existingUpdate);
16
- }
17
- else if (validTitle) {
11
+ if (label && title) {
18
12
  updates.push({
19
- title: validTitle,
20
- date: new Date().toISOString(),
21
- description: validDescription,
22
- categories: validTags,
13
+ title,
14
+ anchor: label,
15
+ date,
16
+ description,
17
+ categories: tags,
23
18
  });
24
19
  }
25
20
  }
26
- if (updates.length > 15) {
27
- updates = updates.slice(0, 15);
28
- }
29
21
  return updates;
30
22
  };
@@ -1,3 +1,4 @@
1
+ import { isUpdate, UPDATE_MAX } from '@mintlify/common';
1
2
  import fse from 'fs-extra';
2
3
  import { docsConfigToRss } from '../rss/docsConfigToRss.js';
3
4
  import { mdxToRssUpdates } from '../rss/mdxToRssUpdates.js';
@@ -10,14 +11,16 @@ export const writeRssFiles = async (docsConfig, rssPages) => {
10
11
  const { targetPath, tree } = page;
11
12
  const { title, description } = pageToRss(tree);
12
13
  const rssPath = pathToRss(targetPath);
13
- const updates = mdxToRssUpdates(tree, []);
14
+ const pageUpdates = tree.children.filter((child) => isUpdate(child));
15
+ const updates = mdxToRssUpdates(pageUpdates);
16
+ const trimmedUpdates = updates.slice(0, UPDATE_MAX);
14
17
  return {
15
18
  rssPath,
16
19
  orgName,
17
20
  orgDescription,
18
21
  title,
19
22
  description,
20
- updates,
23
+ updates: trimmedUpdates,
21
24
  };
22
25
  });
23
26
  await fse.remove(rssTargetPath);