@mintlify/previewing 4.0.1187 → 4.0.1188
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.
|
@@ -45,7 +45,12 @@ const dev = async (argv) => {
|
|
|
45
45
|
process.chdir(CLIENT_PATH);
|
|
46
46
|
let fileImportsMap;
|
|
47
47
|
try {
|
|
48
|
-
const result = await prebuild(CMD_EXEC_PATH, {
|
|
48
|
+
const result = await prebuild(CMD_EXEC_PATH, {
|
|
49
|
+
localSchema,
|
|
50
|
+
groups,
|
|
51
|
+
disableOpenApi,
|
|
52
|
+
allowSourceRefs: true,
|
|
53
|
+
});
|
|
49
54
|
fileImportsMap = result?.fileImportsMap;
|
|
50
55
|
}
|
|
51
56
|
catch (err) {
|
|
@@ -23,7 +23,7 @@ export const getDocsState = async (onError) => {
|
|
|
23
23
|
const docsJsonPath = join(CMD_EXEC_PATH, 'docs.json');
|
|
24
24
|
if (!(await fse.pathExists(docsJsonPath)))
|
|
25
25
|
throw new Error('No config found');
|
|
26
|
-
const docsConfig = await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, onError);
|
|
26
|
+
const docsConfig = await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, onError, { allowSourceRefs: true });
|
|
27
27
|
const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiDivisions(docsConfig, openApiFiles, CLIENT_PATH, undefined, invalidSpecFiles);
|
|
28
28
|
warnInvalidSpecFiles(invalidSpecFiles);
|
|
29
29
|
return { pagesAcc, openApiFiles: newOpenApiFiles, docsConfig: newDocsConfig };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { initializeImportCache } from './importCache.js';
|
|
2
|
-
|
|
2
|
+
type LocalPreviewOptions = {
|
|
3
3
|
localSchema?: boolean;
|
|
4
4
|
groups?: string[];
|
|
5
|
-
|
|
5
|
+
allowSourceRefs?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const listener: (triggerRefresh: () => void, options?: LocalPreviewOptions) => void;
|
|
6
8
|
declare const initializeFrontmatterHashCache: () => Promise<void>;
|
|
7
9
|
declare const initializeDocsConfigHashCache: () => Promise<void>;
|
|
8
10
|
export { initializeDocsConfigHashCache, initializeFrontmatterHashCache, initializeImportCache };
|
|
@@ -34,7 +34,9 @@ const getCurrentDocsConfig = async () => {
|
|
|
34
34
|
}
|
|
35
35
|
catch { }
|
|
36
36
|
const docsJsonPath = pathUtil.join(CMD_EXEC_PATH, 'docs.json');
|
|
37
|
-
return await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, suppressParseError
|
|
37
|
+
return await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, suppressParseError, {
|
|
38
|
+
allowSourceRefs: true,
|
|
39
|
+
});
|
|
38
40
|
};
|
|
39
41
|
const writeDocsConfigWithCurrentNavigation = async (docsConfig) => {
|
|
40
42
|
const propsDocsJsonPath = pathUtil.join(NEXT_PROPS_PATH, 'docs.json');
|
|
@@ -52,7 +54,9 @@ const getCurrentRawDocsConfig = async () => {
|
|
|
52
54
|
return undefined;
|
|
53
55
|
}
|
|
54
56
|
try {
|
|
55
|
-
return await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, suppressParseError
|
|
57
|
+
return await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, suppressParseError, {
|
|
58
|
+
allowSourceRefs: true,
|
|
59
|
+
});
|
|
56
60
|
}
|
|
57
61
|
catch {
|
|
58
62
|
return undefined;
|
|
@@ -78,6 +82,7 @@ const addUpdateTimingLog = (filename, category, durationMs) => {
|
|
|
78
82
|
addChangeLog(_jsx(InfoLog, { message: `processed ${filename} in ${formatElapsedSeconds(durationMs)} (${categoryLabel})` }));
|
|
79
83
|
};
|
|
80
84
|
const listener = (triggerRefresh, options = {}) => {
|
|
85
|
+
const previewOptions = { ...options, allowSourceRefs: true };
|
|
81
86
|
const mintIgnoreGlobs = getMintIgnoreGlobs();
|
|
82
87
|
chokidar
|
|
83
88
|
.watch(CMD_EXEC_PATH, {
|
|
@@ -93,9 +98,9 @@ const listener = (triggerRefresh, options = {}) => {
|
|
|
93
98
|
},
|
|
94
99
|
cwd: CMD_EXEC_PATH,
|
|
95
100
|
})
|
|
96
|
-
.on('add', (filename) => onAddEvent(filename, triggerRefresh,
|
|
97
|
-
.on('change', (filename) => onChangeEvent(filename, triggerRefresh,
|
|
98
|
-
.on('unlink', (filename) => onUnlinkEvent(filename, triggerRefresh,
|
|
101
|
+
.on('add', (filename) => onAddEvent(filename, triggerRefresh, previewOptions))
|
|
102
|
+
.on('change', (filename) => onChangeEvent(filename, triggerRefresh, previewOptions))
|
|
103
|
+
.on('unlink', (filename) => onUnlinkEvent(filename, triggerRefresh, previewOptions));
|
|
99
104
|
};
|
|
100
105
|
const onAddEvent = async (filename, triggerRefresh, options) => {
|
|
101
106
|
if (isMintIgnored(filename, getMintIgnoreGlobs())) {
|
|
@@ -279,7 +284,9 @@ const initializeDocsConfigHashCache = async () => {
|
|
|
279
284
|
const docsJsonPath = pathUtil.join(CMD_EXEC_PATH, 'docs.json');
|
|
280
285
|
try {
|
|
281
286
|
if (await fse.pathExists(docsJsonPath)) {
|
|
282
|
-
const docsConfig = await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, suppressParseError
|
|
287
|
+
const docsConfig = await DocsConfigUpdater.getConfig(docsJsonPath, false, CMD_EXEC_PATH, suppressParseError, {
|
|
288
|
+
allowSourceRefs: true,
|
|
289
|
+
});
|
|
283
290
|
updateDocsConfigHashCache(docsConfig);
|
|
284
291
|
return;
|
|
285
292
|
}
|
|
@@ -383,7 +390,9 @@ const onUpdateEvent = async (filename, triggerRefresh, options = {}) => {
|
|
|
383
390
|
try {
|
|
384
391
|
// Parse the raw config only (cheap) so we can decide what actually
|
|
385
392
|
// needs rebuilding before paying for the expensive OpenAPI/nav work.
|
|
386
|
-
const docsConfig = await DocsConfigUpdater.getConfig(filePath, false, CMD_EXEC_PATH, handleParseError
|
|
393
|
+
const docsConfig = await DocsConfigUpdater.getConfig(filePath, false, CMD_EXEC_PATH, handleParseError, {
|
|
394
|
+
allowSourceRefs: true,
|
|
395
|
+
});
|
|
387
396
|
const newApiHash = getDocsConfigApiHash(docsConfig);
|
|
388
397
|
const apiChanged = hasDocsConfigApiChanged(newApiHash);
|
|
389
398
|
const newNavigationHash = getDocsConfigNavigationHash(docsConfig);
|