@mintlify/previewing 4.0.808 → 4.0.810
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,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { findAndRemoveImports, hasImports, getFileCategory, openApiCheck, stringifyTree, processMintIgnoreString, isMintIgnored,
|
|
2
|
+
import { findAndRemoveImports, hasImports, getFileCategory, openApiCheck, stringifyTree, processMintIgnoreString, isMintIgnored, } from '@mintlify/common';
|
|
3
3
|
import { createPage, MintConfigUpdater, DocsConfigUpdater, preparseMdxTree, prebuild, } from '@mintlify/prebuild';
|
|
4
4
|
import Chalk from 'chalk';
|
|
5
5
|
import chokidar from 'chokidar';
|
|
@@ -19,25 +19,34 @@ import { updateCustomLanguages, updateGeneratedNav, updateOpenApiFiles, upsertOp
|
|
|
19
19
|
import { isFileSizeValid, shouldRegenerateNavForPage } from './utils.js';
|
|
20
20
|
const { readFile } = _promises;
|
|
21
21
|
const frontmatterHashes = new Map();
|
|
22
|
+
const getMintIgnoreGlobs = () => {
|
|
23
|
+
const mintIgnorePath = pathUtil.join(CMD_EXEC_PATH, '.mintignore');
|
|
24
|
+
if (fse.existsSync(mintIgnorePath)) {
|
|
25
|
+
const content = fse.readFileSync(mintIgnorePath, 'utf8');
|
|
26
|
+
return processMintIgnoreString(content);
|
|
27
|
+
}
|
|
28
|
+
return [];
|
|
29
|
+
};
|
|
22
30
|
const listener = (callback, options = {}) => {
|
|
31
|
+
const mintIgnoreGlobs = getMintIgnoreGlobs();
|
|
23
32
|
chokidar
|
|
24
33
|
.watch(CMD_EXEC_PATH, {
|
|
25
34
|
ignoreInitial: true,
|
|
26
|
-
ignored:
|
|
35
|
+
ignored: (filePath) => {
|
|
36
|
+
const relativePath = pathUtil.isAbsolute(filePath)
|
|
37
|
+
? pathUtil.relative(CMD_EXEC_PATH, filePath)
|
|
38
|
+
: filePath;
|
|
39
|
+
if (!relativePath) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return isMintIgnored(relativePath, mintIgnoreGlobs);
|
|
43
|
+
},
|
|
27
44
|
cwd: CMD_EXEC_PATH,
|
|
28
45
|
})
|
|
29
46
|
.on('add', (filename) => onAddEvent(filename, callback, options))
|
|
30
47
|
.on('change', (filename) => onChangeEvent(filename, callback, options))
|
|
31
48
|
.on('unlink', (filename) => onUnlinkEvent(filename, options));
|
|
32
49
|
};
|
|
33
|
-
const getMintIgnoreGlobs = () => {
|
|
34
|
-
const mintIgnorePath = pathUtil.join(CMD_EXEC_PATH, '.mintignore');
|
|
35
|
-
if (fse.existsSync(mintIgnorePath)) {
|
|
36
|
-
const content = fse.readFileSync(mintIgnorePath, 'utf8');
|
|
37
|
-
return processMintIgnoreString(content);
|
|
38
|
-
}
|
|
39
|
-
return [];
|
|
40
|
-
};
|
|
41
50
|
const onAddEvent = async (filename, callback, options) => {
|
|
42
51
|
if (isMintIgnored(filename, getMintIgnoreGlobs())) {
|
|
43
52
|
return;
|