@mintlify/prebuild 1.0.834 → 1.0.841
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/generate.js +5 -2
- package/dist/prebuild/categorizeFilePaths.js +5 -1
- package/dist/prebuild/index.js +5 -0
- package/dist/prebuild/update/ConfigUpdater.d.ts +182 -14
- package/dist/prebuild/update/index.d.ts +182 -14
- package/dist/prebuild/update/resolveImportsAndWriteFiles.js +3 -0
- package/dist/prebuild/warnings.d.ts +7 -0
- package/dist/prebuild/warnings.js +14 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
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
|
+
import { addWarning } from '../warnings.js';
|
|
4
5
|
export const resolveImportsAndWriteFiles = async ({ openApiFiles, asyncApiFiles, pagesAcc, snippetsV2, filesWithImports, }) => {
|
|
5
6
|
const snippetsWithResolvedImports = await resolveImportsInSnippets(snippetsV2);
|
|
6
7
|
const writeSnippetsWithImportsPromises = await writeSnippets(snippetsWithResolvedImports);
|
|
@@ -35,6 +36,7 @@ const resolveImportsInSnippets = async (snippetsV2) => {
|
|
|
35
36
|
snippetWithImports.tree = await resolveAllImports({
|
|
36
37
|
snippets: orderedSnippetsWithImports,
|
|
37
38
|
fileWithImports: snippetWithImports,
|
|
39
|
+
onWarning: addWarning,
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
}
|
|
@@ -51,6 +53,7 @@ const resolveImportsInPages = async ({ openApiFiles, asyncApiFiles, snippetsWith
|
|
|
51
53
|
const tree = await resolveAllImports({
|
|
52
54
|
snippets: snippetsWithResolvedImports,
|
|
53
55
|
fileWithImports,
|
|
56
|
+
onWarning: addWarning,
|
|
54
57
|
});
|
|
55
58
|
const contentStr = stringifyTree(tree);
|
|
56
59
|
const { slug, pageMetadata } = getDecoratedNavPageAndSlug(fileWithImports.filename, contentStr, openApiFiles, asyncApiFiles);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Warning = {
|
|
2
|
+
type: 'missing-file' | 'missing-nav-page' | 'openapi' | 'invalid-import-path' | 'import-resolution-error';
|
|
3
|
+
message: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const clearWarnings: () => void;
|
|
6
|
+
export declare const addWarning: (warning: Warning) => void;
|
|
7
|
+
export declare const checkStrictMode: (strict?: boolean) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
let warnings = [];
|
|
3
|
+
export const clearWarnings = () => {
|
|
4
|
+
warnings = [];
|
|
5
|
+
};
|
|
6
|
+
export const addWarning = (warning) => {
|
|
7
|
+
warnings.push(warning);
|
|
8
|
+
console.log(chalk.yellow.bold('warning') + ' - ' + warning.message);
|
|
9
|
+
};
|
|
10
|
+
export const checkStrictMode = (strict) => {
|
|
11
|
+
if (strict && warnings.length > 0) {
|
|
12
|
+
throw new Error(`Build validation failed with ${warnings.length} warning(s). See above for details.`);
|
|
13
|
+
}
|
|
14
|
+
};
|