@mintlify/common 1.0.612 → 1.0.613

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,4 +1,4 @@
1
- export type PotentialFileCategory = 'page' | 'snippet' | 'mintConfig' | 'potentialYamlOpenApiSpec' | 'potentialJsonOpenApiSpec' | 'staticFile' | 'snippet-v2' | 'css' | 'js' | 'docsConfig' | 'generatedStaticFile' | null;
1
+ export type PotentialFileCategory = 'page' | 'snippet' | 'mintConfig' | 'potentialYamlOpenApiSpec' | 'potentialJsonOpenApiSpec' | 'staticFile' | 'snippet-v2' | 'css' | 'js' | 'docsConfig' | 'generatedStaticFile' | 'mintIgnore' | null;
2
2
  export type FileCategory = Omit<PotentialFileCategory, 'potentialYamlOpenApiSpec' | 'potentialJsonOpenApiSpec'> | 'openApi' | null;
3
3
  export declare const generatedStaticFiles: readonly ["llms.txt", "robots.txt", "sitemap.xml", "llms-full.txt"];
4
4
  export type GeneratedStaticFile = (typeof generatedStaticFiles)[number];
@@ -82,6 +82,9 @@ export const getFileCategory = (filePath) => {
82
82
  if (parsed.base === 'docs.json') {
83
83
  return 'docsConfig';
84
84
  }
85
+ if (parsed.base === '.mintignore') {
86
+ return 'mintIgnore';
87
+ }
85
88
  const fileName = parsed.name;
86
89
  const extension = parsed.ext;
87
90
  if (generatedStaticFiles.includes(parsed.base)) {
package/dist/index.d.ts CHANGED
@@ -24,3 +24,4 @@ export * from './slugify.js';
24
24
  export * from './services/aws.js';
25
25
  export * from './truncateAtWordBoundary.js';
26
26
  export * from './api-reference/parseApiTargetFromMetadata.js';
27
+ export * from './mintIgnore.js';
package/dist/index.js CHANGED
@@ -24,3 +24,4 @@ export * from './slugify.js';
24
24
  export * from './services/aws.js';
25
25
  export * from './truncateAtWordBoundary.js';
26
26
  export * from './api-reference/parseApiTargetFromMetadata.js';
27
+ export * from './mintIgnore.js';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Default patterns that Mintlify always ignores, regardless of .mintignore configuration.
3
+ * These directories are typically version control, IDE configs, or dependencies.
4
+ */
5
+ export declare const DEFAULT_MINT_IGNORES: string[];
6
+ /**
7
+ * Processes the contents of a .mintignore file and returns an array of relevant patterns.
8
+ * The ignore package automatically handles comments (lines starting with #) and empty lines.
9
+ *
10
+ * @param mintIgnoreContent The content of the .mintignore file.
11
+ * @returns An array of glob patterns.
12
+ */
13
+ export declare function processMintIgnoreString(mintIgnoreContent: string): string[];
14
+ /**
15
+ * Checks if a file path is ignored based on the provided glob patterns and default ignores.
16
+ * Always includes DEFAULT_MINT_IGNORES in addition to any custom patterns provided.
17
+ *
18
+ * @param filePath The path of the file to check.
19
+ * @param globs An array of custom glob patterns (output from processMintIgnoreString).
20
+ * @returns True if the file matches any of the ignore patterns (default or custom), false otherwise.
21
+ */
22
+ export declare function isMintIgnored(filePath: string, globs?: string[]): boolean;
@@ -0,0 +1,36 @@
1
+ import ignore from 'ignore';
2
+ /**
3
+ * Default patterns that Mintlify always ignores, regardless of .mintignore configuration.
4
+ * These directories are typically version control, IDE configs, or dependencies.
5
+ */
6
+ export const DEFAULT_MINT_IGNORES = [
7
+ '.git',
8
+ '.github',
9
+ '.claude',
10
+ '.agents',
11
+ '.idea',
12
+ 'node_modules',
13
+ ];
14
+ /**
15
+ * Processes the contents of a .mintignore file and returns an array of relevant patterns.
16
+ * The ignore package automatically handles comments (lines starting with #) and empty lines.
17
+ *
18
+ * @param mintIgnoreContent The content of the .mintignore file.
19
+ * @returns An array of glob patterns.
20
+ */
21
+ export function processMintIgnoreString(mintIgnoreContent) {
22
+ return mintIgnoreContent.split(/\r?\n/).map((line) => line.trim());
23
+ }
24
+ /**
25
+ * Checks if a file path is ignored based on the provided glob patterns and default ignores.
26
+ * Always includes DEFAULT_MINT_IGNORES in addition to any custom patterns provided.
27
+ *
28
+ * @param filePath The path of the file to check.
29
+ * @param globs An array of custom glob patterns (output from processMintIgnoreString).
30
+ * @returns True if the file matches any of the ignore patterns (default or custom), false otherwise.
31
+ */
32
+ export function isMintIgnored(filePath, globs = []) {
33
+ const allPatterns = Array.from(new Set([...DEFAULT_MINT_IGNORES, ...globs]));
34
+ const ig = ignore().add(allPatterns);
35
+ return ig.ignores(filePath);
36
+ }