@mintlify/common 1.0.411 → 1.0.413

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/index.d.ts CHANGED
@@ -17,3 +17,4 @@ export * from './schema/common.js';
17
17
  export * from './camelToSentenceCase.js';
18
18
  export * from './asyncapi/index.js';
19
19
  export * from './isAbsoluteUrl.js';
20
+ export * from './rss/index.js';
package/dist/index.js CHANGED
@@ -17,3 +17,4 @@ export * from './schema/common.js';
17
17
  export * from './camelToSentenceCase.js';
18
18
  export * from './asyncapi/index.js';
19
19
  export * from './isAbsoluteUrl.js';
20
+ export * from './rss/index.js';
@@ -0,0 +1,6 @@
1
+ import type { FrontmatterContent, Root, RootContent } from 'mdast';
2
+ import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
3
+ export declare const isFrontmatter: (node: RootContent | undefined) => node is FrontmatterContent;
4
+ export declare const isUpdate: (node: RootContent | undefined) => node is MdxJsxFlowElement;
5
+ export declare const containsUpdates: (tree: Root) => boolean;
6
+ export declare const getTags: (node: MdxJsxFlowElement) => string[];
@@ -0,0 +1,33 @@
1
+ export const isFrontmatter = (node) => {
2
+ return (node === null || node === void 0 ? void 0 : node.type) === 'yaml';
3
+ };
4
+ export const isUpdate = (node) => {
5
+ return (node === null || node === void 0 ? void 0 : node.type) === 'mdxJsxFlowElement' && node.name === 'Update';
6
+ };
7
+ export const containsUpdates = (tree) => {
8
+ return tree.children.some((child) => isUpdate(child));
9
+ };
10
+ export const getTags = (node) => {
11
+ var _a, _b;
12
+ let tags = [];
13
+ const tagsAttribute = node.attributes.find((attr) => 'name' in attr && attr.name === 'tags');
14
+ if (!tagsAttribute || !tagsAttribute.value || typeof tagsAttribute.value !== 'object') {
15
+ return tags;
16
+ }
17
+ try {
18
+ tags = JSON.parse(tagsAttribute.value.value);
19
+ }
20
+ catch (_c) {
21
+ if (((_b = (_a = tagsAttribute.value.data) === null || _a === void 0 ? void 0 : _a.estree) === null || _b === void 0 ? void 0 : _b.body.length) === 1) {
22
+ const body = tagsAttribute.value.data.estree.body[0];
23
+ if ((body === null || body === void 0 ? void 0 : body.type) === 'ExpressionStatement' && body.expression.type === 'ArrayExpression') {
24
+ body.expression.elements.map((element) => {
25
+ if ((element === null || element === void 0 ? void 0 : element.type) === 'Literal' && typeof element.value === 'string') {
26
+ tags.push(element.value);
27
+ }
28
+ });
29
+ }
30
+ }
31
+ }
32
+ return tags;
33
+ };