@mintlify/prebuild 1.0.771 → 1.0.773

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,6 +1,6 @@
1
1
  import { AsyncAPIFile } from '@mintlify/common';
2
2
  import { OpenApiFile } from '@mintlify/models';
3
- export declare const categorizeFilePaths: (contentDirectoryPath: string, mintIgnore?: string[], disableOpenApi?: boolean, snippetPatterns?: string[]) => Promise<{
3
+ export declare const categorizeFilePaths: (contentDirectoryPath: string, mintIgnore?: string[], disableOpenApi?: boolean) => Promise<{
4
4
  contentFilenames: string[];
5
5
  staticFilenames: string[];
6
6
  openApiFiles: OpenApiFile[];
@@ -1,11 +1,11 @@
1
- import { openApiCheck, isSnippetPath } from '@mintlify/common';
1
+ import { openApiCheck } from '@mintlify/common';
2
2
  import { validateAsyncApi } from '@mintlify/common';
3
3
  import { readFile } from 'fs/promises';
4
4
  import yaml from 'js-yaml';
5
5
  import * as path from 'path';
6
6
  import { getFileList } from '../fs/index.js';
7
7
  import { getFileExtension } from '../utils.js';
8
- export const categorizeFilePaths = async (contentDirectoryPath, mintIgnore = [], disableOpenApi, snippetPatterns) => {
8
+ export const categorizeFilePaths = async (contentDirectoryPath, mintIgnore = [], disableOpenApi) => {
9
9
  const allFilesInCmdExecutionPath = getFileList(contentDirectoryPath, contentDirectoryPath, mintIgnore);
10
10
  const contentFilenames = [];
11
11
  const staticFilenames = [];
@@ -23,7 +23,7 @@ export const categorizeFilePaths = async (contentDirectoryPath, mintIgnore = [],
23
23
  snippets.push(filename);
24
24
  break;
25
25
  }
26
- if (isSnippetPath(filename, snippetPatterns)) {
26
+ if (filename.startsWith('/snippets/')) {
27
27
  snippetsV2.push(filename);
28
28
  break;
29
29
  }
@@ -1,4 +1,4 @@
1
- import { getConfigPath, getMintIgnore, getSnippetPatterns } from '../utils.js';
1
+ import { getConfigPath, getMintIgnore } from '../utils.js';
2
2
  import { categorizeFilePaths } from './categorizeFilePaths.js';
3
3
  import { update } from './update/index.js';
4
4
  export const prebuild = async (contentDirectoryPath, { localSchema, groups, disableOpenApi, } = {}) => {
@@ -11,11 +11,8 @@ export const prebuild = async (contentDirectoryPath, { localSchema, groups, disa
11
11
  if (mintConfigPath == null && docsConfigPath == null) {
12
12
  throw Error('must be run in a directory where a docs.json file exists.');
13
13
  }
14
- const [mintIgnore, snippetPatterns] = await Promise.all([
15
- getMintIgnore(contentDirectoryPath),
16
- getSnippetPatterns(contentDirectoryPath),
17
- ]);
18
- const { contentFilenames, staticFilenames, openApiFiles, asyncApiFiles, snippets, snippetsV2 } = await categorizeFilePaths(contentDirectoryPath, mintIgnore, disableOpenApi, snippetPatterns);
14
+ const mintIgnore = await getMintIgnore(contentDirectoryPath);
15
+ const { contentFilenames, staticFilenames, openApiFiles, asyncApiFiles, snippets, snippetsV2 } = await categorizeFilePaths(contentDirectoryPath, mintIgnore, disableOpenApi);
19
16
  await update({
20
17
  contentDirectoryPath,
21
18
  staticFilenames,
@@ -29,7 +26,6 @@ export const prebuild = async (contentDirectoryPath, { localSchema, groups, disa
29
26
  groups,
30
27
  mintIgnore,
31
28
  disableOpenApi,
32
- snippetPatterns,
33
29
  });
34
30
  };
35
31
  export * from './categorizeFilePaths.js';
@@ -343,7 +343,6 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
343
343
  interaction?: {
344
344
  drilldown?: boolean | undefined;
345
345
  } | undefined;
346
- snippets?: string[] | undefined;
347
346
  } | {
348
347
  name: string;
349
348
  $schema: string;
@@ -667,7 +666,6 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
667
666
  interaction?: {
668
667
  drilldown?: boolean | undefined;
669
668
  } | undefined;
670
- snippets?: string[] | undefined;
671
669
  } | {
672
670
  name: string;
673
671
  $schema: string;
@@ -991,7 +989,6 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
991
989
  interaction?: {
992
990
  drilldown?: boolean | undefined;
993
991
  } | undefined;
994
- snippets?: string[] | undefined;
995
992
  } | {
996
993
  name: string;
997
994
  $schema: string;
@@ -1315,7 +1312,6 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1315
1312
  interaction?: {
1316
1313
  drilldown?: boolean | undefined;
1317
1314
  } | undefined;
1318
- snippets?: string[] | undefined;
1319
1315
  } | {
1320
1316
  name: string;
1321
1317
  $schema: string;
@@ -1639,7 +1635,6 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1639
1635
  interaction?: {
1640
1636
  drilldown?: boolean | undefined;
1641
1637
  } | undefined;
1642
- snippets?: string[] | undefined;
1643
1638
  } | {
1644
1639
  name: string;
1645
1640
  $schema: string;
@@ -1963,7 +1958,6 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
1963
1958
  interaction?: {
1964
1959
  drilldown?: boolean | undefined;
1965
1960
  } | undefined;
1966
- snippets?: string[] | undefined;
1967
1961
  } | {
1968
1962
  name: string;
1969
1963
  $schema: string;
@@ -2287,5 +2281,4 @@ export declare const DocsConfigUpdater: ConfigUpdater<{
2287
2281
  interaction?: {
2288
2282
  drilldown?: boolean | undefined;
2289
2283
  } | undefined;
2290
- snippets?: string[] | undefined;
2291
2284
  }>;
@@ -14,9 +14,8 @@ type UpdateArgs = {
14
14
  groups?: string[];
15
15
  mintIgnore?: string[];
16
16
  disableOpenApi?: boolean;
17
- snippetPatterns?: string[];
18
17
  };
19
- export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, disableOpenApi, snippetPatterns, }: UpdateArgs) => Promise<{
18
+ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, disableOpenApi, }: UpdateArgs) => Promise<{
20
19
  name: string;
21
20
  $schema: string;
22
21
  theme: "mint";
@@ -339,7 +338,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
339
338
  interaction?: {
340
339
  drilldown?: boolean | undefined;
341
340
  } | undefined;
342
- snippets?: string[] | undefined;
343
341
  } | {
344
342
  name: string;
345
343
  $schema: string;
@@ -663,7 +661,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
663
661
  interaction?: {
664
662
  drilldown?: boolean | undefined;
665
663
  } | undefined;
666
- snippets?: string[] | undefined;
667
664
  } | {
668
665
  name: string;
669
666
  $schema: string;
@@ -987,7 +984,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
987
984
  interaction?: {
988
985
  drilldown?: boolean | undefined;
989
986
  } | undefined;
990
- snippets?: string[] | undefined;
991
987
  } | {
992
988
  name: string;
993
989
  $schema: string;
@@ -1311,7 +1307,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
1311
1307
  interaction?: {
1312
1308
  drilldown?: boolean | undefined;
1313
1309
  } | undefined;
1314
- snippets?: string[] | undefined;
1315
1310
  } | {
1316
1311
  name: string;
1317
1312
  $schema: string;
@@ -1635,7 +1630,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
1635
1630
  interaction?: {
1636
1631
  drilldown?: boolean | undefined;
1637
1632
  } | undefined;
1638
- snippets?: string[] | undefined;
1639
1633
  } | {
1640
1634
  name: string;
1641
1635
  $schema: string;
@@ -1959,7 +1953,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
1959
1953
  interaction?: {
1960
1954
  drilldown?: boolean | undefined;
1961
1955
  } | undefined;
1962
- snippets?: string[] | undefined;
1963
1956
  } | {
1964
1957
  name: string;
1965
1958
  $schema: string;
@@ -2283,7 +2276,6 @@ export declare const update: ({ contentDirectoryPath, staticFilenames, openApiFi
2283
2276
  interaction?: {
2284
2277
  drilldown?: boolean | undefined;
2285
2278
  } | undefined;
2286
- snippets?: string[] | undefined;
2287
2279
  }>;
2288
2280
  export declare const writeMdxFilesWithNoImports: (mdxFilesWithNoImports: {
2289
2281
  targetPath: string;
@@ -11,7 +11,7 @@ import { writeAsyncApiFiles } from './write/writeAsyncApiFiles.js';
11
11
  import { writeFiles, writeFile } from './write/writeFiles.js';
12
12
  import { writeOpenApiData } from './write/writeOpenApiData.js';
13
13
  import { writeRssFiles } from './write/writeRssFiles.js';
14
- export const update = async ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, disableOpenApi, snippetPatterns, }) => {
14
+ export const update = async ({ contentDirectoryPath, staticFilenames, openApiFiles, asyncApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath, localSchema, groups, mintIgnore, disableOpenApi, }) => {
15
15
  const mintConfigResult = await updateMintConfigFile(contentDirectoryPath, openApiFiles, localSchema);
16
16
  // we used the original mint config without openapi pages injected
17
17
  // because we will do it in `updateDocsConfigFile`, this will avoid duplicated openapi pages
@@ -54,7 +54,6 @@ export const update = async ({ contentDirectoryPath, staticFilenames, openApiFil
54
54
  pagesAcc,
55
55
  snippetsV2: snippetV2Contents,
56
56
  filesWithImports,
57
- snippetPatterns,
58
57
  }),
59
58
  writeFile(newOpenApiFiles, 'src/_props/openApiFiles.json'),
60
59
  writeFile(customLanguages, 'src/_props/customLanguages.json'),
@@ -7,7 +7,6 @@ type ResolveImportsAndWriteFilesArgs = {
7
7
  pagesAcc: Record<string, DecoratedNavigationPage>;
8
8
  snippetsV2: FileType[];
9
9
  filesWithImports: FileWithImports[];
10
- snippetPatterns?: string[];
11
10
  };
12
- export declare const resolveImportsAndWriteFiles: ({ openApiFiles, asyncApiFiles, pagesAcc, snippetsV2, filesWithImports, snippetPatterns, }: ResolveImportsAndWriteFilesArgs) => Promise<void>;
11
+ export declare const resolveImportsAndWriteFiles: ({ openApiFiles, asyncApiFiles, pagesAcc, snippetsV2, filesWithImports, }: ResolveImportsAndWriteFilesArgs) => Promise<void>;
13
12
  export {};
@@ -1,8 +1,8 @@
1
1
  import { resolveAllImports, hasImports, findAndRemoveImports, getDecoratedNavPageAndSlug, topologicalSort, stringifyTree, } from '@mintlify/common';
2
2
  import { outputFile } from 'fs-extra';
3
3
  import { join } from 'path';
4
- export const resolveImportsAndWriteFiles = async ({ openApiFiles, asyncApiFiles, pagesAcc, snippetsV2, filesWithImports, snippetPatterns, }) => {
5
- const snippetsWithResolvedImports = await resolveImportsInSnippets(snippetsV2, snippetPatterns);
4
+ export const resolveImportsAndWriteFiles = async ({ openApiFiles, asyncApiFiles, pagesAcc, snippetsV2, filesWithImports, }) => {
5
+ const snippetsWithResolvedImports = await resolveImportsInSnippets(snippetsV2);
6
6
  const writeSnippetsWithImportsPromises = await writeSnippets(snippetsWithResolvedImports);
7
7
  const pagesWithResolvedImports = await resolveImportsInPages({
8
8
  openApiFiles,
@@ -10,12 +10,11 @@ export const resolveImportsAndWriteFiles = async ({ openApiFiles, asyncApiFiles,
10
10
  snippetsWithResolvedImports,
11
11
  filesWithImports,
12
12
  pagesAcc,
13
- snippetPatterns,
14
13
  });
15
14
  const writePagesPromise = writePages(pagesWithResolvedImports);
16
15
  await Promise.all([...writeSnippetsWithImportsPromises, ...writePagesPromise]);
17
16
  };
18
- const resolveImportsInSnippets = async (snippetsV2, snippetPatterns) => {
17
+ const resolveImportsInSnippets = async (snippetsV2) => {
19
18
  const snippetsWithImportsPromises = snippetsV2.map(async (snippet) => ({
20
19
  ...(await findAndRemoveImports(snippet.tree)),
21
20
  filename: snippet.filename,
@@ -36,7 +35,6 @@ const resolveImportsInSnippets = async (snippetsV2, snippetPatterns) => {
36
35
  snippetWithImports.tree = await resolveAllImports({
37
36
  snippets: orderedSnippetsWithImports,
38
37
  fileWithImports: snippetWithImports,
39
- snippetPatterns,
40
38
  });
41
39
  }
42
40
  }
@@ -48,12 +46,11 @@ const writeSnippets = async (snippetsWithImports) => snippetsWithImports.map(asy
48
46
  flag: 'w',
49
47
  });
50
48
  });
51
- const resolveImportsInPages = async ({ openApiFiles, asyncApiFiles, snippetsWithResolvedImports, filesWithImports, pagesAcc, snippetPatterns, }) => {
49
+ const resolveImportsInPages = async ({ openApiFiles, asyncApiFiles, snippetsWithResolvedImports, filesWithImports, pagesAcc, }) => {
52
50
  const filesWithResolvedImportsPromises = filesWithImports.map(async (fileWithImports) => {
53
51
  const tree = await resolveAllImports({
54
52
  snippets: snippetsWithResolvedImports,
55
53
  fileWithImports,
56
- snippetPatterns,
57
54
  });
58
55
  const contentStr = stringifyTree(tree);
59
56
  const { slug, pageMetadata } = getDecoratedNavPageAndSlug(fileWithImports.filename, contentStr, openApiFiles, asyncApiFiles);