@mintlify/previewing 4.0.1671 → 4.0.1673
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/__tests__/export.test.js +14 -1
- package/dist/__tests__/watcher-native.test.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/local-preview/export.d.ts +2 -0
- package/dist/local-preview/export.js +6 -3
- package/dist/logging-state.d.ts +2 -0
- package/dist/logging-state.js +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import fse from 'fs-extra';
|
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { generatePages } from '../local-preview/export-next.js';
|
|
5
|
-
import { withIndexRouteAliases, writeStaticUserInfo } from '../local-preview/export.js';
|
|
5
|
+
import { getDocsNavRoutes, withIndexRouteAliases, writeStaticUserInfo, } from '../local-preview/export.js';
|
|
6
6
|
import { getGroupFilteredRoutes } from '../local-preview/getGroupFilteredRoutes.js';
|
|
7
7
|
describe('getGroupFilteredRoutes', () => {
|
|
8
8
|
it('prunes routes outside the selected groups', () => {
|
|
@@ -22,6 +22,19 @@ describe('getGroupFilteredRoutes', () => {
|
|
|
22
22
|
expect(routes).toEqual(['/', '/index', '/quickstart', '/authenticated']);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
+
describe('getDocsNavRoutes', () => {
|
|
26
|
+
it('skips openapi endpoint strings', () => {
|
|
27
|
+
expect(getDocsNavRoutes({
|
|
28
|
+
tabs: [
|
|
29
|
+
{
|
|
30
|
+
tab: 'API',
|
|
31
|
+
openapi: 'openapi/api.json',
|
|
32
|
+
pages: ['intro', 'GET /projects/{projectId}/errors', 'openapi.json POST /items'],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
})).toEqual(['/intro']);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
25
38
|
describe('withIndexRouteAliases', () => {
|
|
26
39
|
it('adds the parent route for nested index pages', () => {
|
|
27
40
|
expect(withIndexRouteAliases(['/', '/index', '/agent/index', '/agent/slack'])).toEqual([
|
|
@@ -47,7 +47,7 @@ describe.runIf(['darwin', 'linux', 'win32'].includes(process.platform))('watchTr
|
|
|
47
47
|
await expectSeen('change', 'a.mdx');
|
|
48
48
|
expect(seen).not.toContainEqual(['add', 'a.mdx']);
|
|
49
49
|
});
|
|
50
|
-
it('reports files of a renamed directory', async () => {
|
|
50
|
+
it.skipIf(process.platform === 'win32')('reports files of a renamed directory', async () => {
|
|
51
51
|
await rename(path.join(root, 'guide'), path.join(root, 'guides'));
|
|
52
52
|
await expectSeen('unlink', 'guide/b.mdx');
|
|
53
53
|
await expectSeen('add', 'guides/b.mdx');
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ import { getClientVersion } from './util.js';
|
|
|
8
8
|
export * from './logs.js';
|
|
9
9
|
export * from './logging-state.js';
|
|
10
10
|
export * from './packages/index.js';
|
|
11
|
+
export { createPreviewPathIgnored } from './local-preview/listener/previewPathIgnored.js';
|
|
12
|
+
export { watchTree, type TreeWatcher, type WatchEventType } from './watcher.js';
|
|
11
13
|
export { dev, exportSite, checkBuild, getClientVersion, getLatestClientVersion, downloadTargetMint, getVersionMap, LOCAL_LINKED_CLI_VERSION, };
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,6 @@ import { getClientVersion } from './util.js';
|
|
|
7
7
|
export * from './logs.js';
|
|
8
8
|
export * from './logging-state.js';
|
|
9
9
|
export * from './packages/index.js';
|
|
10
|
+
export { createPreviewPathIgnored } from './local-preview/listener/previewPathIgnored.js';
|
|
11
|
+
export { watchTree } from './watcher.js';
|
|
10
12
|
export { dev, exportSite, checkBuild, getClientVersion, getLatestClientVersion, downloadTargetMint, getVersionMap, LOCAL_LINKED_CLI_VERSION, };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { NavigationConfig } from '@mintlify/validation';
|
|
1
2
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
3
|
export declare const withIndexRouteAliases: (routes: string[]) => string[];
|
|
4
|
+
export declare const getDocsNavRoutes: (navigation: NavigationConfig) => string[];
|
|
3
5
|
export declare function writeStaticUserInfo(tmpDir: string, groups: string[] | undefined): Promise<void>;
|
|
4
6
|
export declare function writeLlmsTxt(tmpDir: string, routes: string[], basePath?: string): Promise<void>;
|
|
5
7
|
export declare const exportSite: (argv: ArgumentsCamelCase) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getAllPathsInDecoratedNav, getAllPathsInDocsNav } from '@mintlify/common';
|
|
2
|
+
import { getAllPathsInDecoratedNav, getAllPathsInDocsNav, potentiallyParseOpenApiString, } from '@mintlify/common';
|
|
3
3
|
import { prebuild } from '@mintlify/prebuild';
|
|
4
4
|
import fse, { pathExists } from 'fs-extra';
|
|
5
5
|
import os from 'os';
|
|
@@ -56,6 +56,9 @@ async function fatal(message) {
|
|
|
56
56
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
57
57
|
process.exit(1);
|
|
58
58
|
}
|
|
59
|
+
export const getDocsNavRoutes = (navigation) => getAllPathsInDocsNav(navigation)
|
|
60
|
+
.filter((navPath) => potentiallyParseOpenApiString(navPath) === undefined)
|
|
61
|
+
.map((navPath) => `/${navPath}`);
|
|
59
62
|
async function collectRoutes(groups) {
|
|
60
63
|
const shouldFilterByGroups = groups !== undefined && groups.length > 0;
|
|
61
64
|
const routes = new Set(shouldFilterByGroups ? [] : ['/']);
|
|
@@ -65,8 +68,8 @@ async function collectRoutes(groups) {
|
|
|
65
68
|
}
|
|
66
69
|
const config = await fse.readJson(docsConfigPath);
|
|
67
70
|
if (!shouldFilterByGroups && config.navigation) {
|
|
68
|
-
for (const
|
|
69
|
-
routes.add(
|
|
71
|
+
for (const route of getDocsNavRoutes(config.navigation)) {
|
|
72
|
+
routes.add(route);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
// Also collect routes from the generated decorated nav, which includes OpenAPI/AsyncAPI
|
package/dist/logging-state.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare const addErrorLog: (log: React.ReactNode) => void;
|
|
|
7
7
|
export declare const addRawErrorLog: (message: string) => void;
|
|
8
8
|
export declare const clearErrorLogs: () => void;
|
|
9
9
|
export declare const removeErrorLogs: (targets: readonly React.ReactNode[]) => void;
|
|
10
|
+
/** Calls the listener after every clearLogs, so a standing line can put itself back. */
|
|
11
|
+
export declare const onLogsCleared: (listener: () => void) => () => void;
|
|
10
12
|
export declare const clearLogs: () => void;
|
|
11
13
|
export declare const removeLastLog: () => void;
|
|
12
14
|
export declare const removeLog: (target: React.ReactNode) => void;
|
package/dist/logging-state.js
CHANGED
|
@@ -52,10 +52,20 @@ export const removeErrorLogs = (targets) => {
|
|
|
52
52
|
currentErrorLogs = currentErrorLogs.filter((log) => !targets.includes(log));
|
|
53
53
|
setErrorLogsCallback?.(currentErrorLogs);
|
|
54
54
|
};
|
|
55
|
+
const clearListeners = new Set();
|
|
56
|
+
/** Calls the listener after every clearLogs, so a standing line can put itself back. */
|
|
57
|
+
export const onLogsCleared = (listener) => {
|
|
58
|
+
clearListeners.add(listener);
|
|
59
|
+
return () => {
|
|
60
|
+
clearListeners.delete(listener);
|
|
61
|
+
};
|
|
62
|
+
};
|
|
55
63
|
export const clearLogs = () => {
|
|
56
64
|
ensureLoggingInstance();
|
|
57
65
|
currentLogs = [];
|
|
58
66
|
setLogsCallback?.(currentLogs);
|
|
67
|
+
for (const listener of clearListeners)
|
|
68
|
+
listener();
|
|
59
69
|
};
|
|
60
70
|
export const removeLastLog = () => {
|
|
61
71
|
ensureLoggingInstance();
|