1+ import { readFile } from "fs/promises" ;
12import { v4 as uuidv4 } from "uuid" ;
23
34import { DocsDefinitionResolver , filterOssWorkspaces } from "@fern-api/docs-resolver" ;
45import {
56 APIV1Read ,
67 APIV1Write ,
7- convertAPIDefinitionToDb ,
8- convertDbAPIDefinitionToRead ,
9- convertDbDocsConfigToRead ,
10- convertDocsDefinitionToDb ,
118 DocsV1Read ,
129 FdrAPI ,
1310 FernNavigation ,
1411 SDKSnippetHolder ,
12+ convertAPIDefinitionToDb ,
13+ convertDbAPIDefinitionToRead ,
14+ convertDbDocsConfigToRead ,
15+ convertDocsDefinitionToDb
1516} from "@fern-api/fdr-sdk" ;
1617import { AbsoluteFilePath , convertToFernHostAbsoluteFilePath , relative } from "@fern-api/fs-utils" ;
1718import { IntermediateRepresentation } from "@fern-api/ir-sdk" ;
1819import { Project } from "@fern-api/project-loader" ;
1920import { convertIrToFdrApi } from "@fern-api/register" ;
2021import { TaskContext } from "@fern-api/task-context" ;
21- import { readFile } from "fs/promises" ;
22+
2223import { replaceReferencedMarkdown } from "../../docs-markdown-utils/src" ;
2324
2425export async function getPreviewDocsDefinition ( {
@@ -34,7 +35,6 @@ export async function getPreviewDocsDefinition({
3435 previousDocsDefinition ?: DocsV1Read . DocsDefinition ;
3536 editedAbsoluteFilepaths ?: AbsoluteFilePath [ ] ;
3637} ) : Promise < DocsV1Read . DocsDefinition > {
37-
3838 const docsWorkspace = project . docsWorkspaces ;
3939 const apiWorkspaces = project . apiWorkspaces ;
4040 if ( docsWorkspace == null ) {
@@ -43,7 +43,7 @@ export async function getPreviewDocsDefinition({
4343
4444 if ( editedAbsoluteFilepaths != null && previousDocsDefinition != null ) {
4545 const allMarkdownFiles = editedAbsoluteFilepaths . every (
46- ( filepath ) => filepath . endsWith ( ' .mdx' ) || filepath . endsWith ( ' .md' )
46+ ( filepath ) => filepath . endsWith ( " .mdx" ) || filepath . endsWith ( " .md" )
4747 ) ;
4848 for ( const absoluteFilePath of editedAbsoluteFilepaths ) {
4949 const relativePath = relative ( docsWorkspace . absoluteFilePath , absoluteFilePath ) ;
@@ -52,18 +52,18 @@ export async function getPreviewDocsDefinition({
5252 markdown,
5353 absolutePathToFernFolder : docsWorkspace . absoluteFilePath ,
5454 absolutePathToMarkdownFile : absoluteFilePath ,
55- context,
55+ context
5656 } ) ;
57-
57+
5858 const previousValue = previousDocsDefinition . pages [ FdrAPI . PageId ( relativePath ) ] ;
5959 if ( previousValue == null ) {
6060 continue ;
6161 }
6262
6363 previousDocsDefinition . pages [ FdrAPI . PageId ( relativePath ) ] = {
6464 markdown : processedMarkdown ,
65- editThisPageUrl : previousValue . editThisPageUrl ,
66- }
65+ editThisPageUrl : previousValue . editThisPageUrl
66+ } ;
6767 }
6868
6969 if ( allMarkdownFiles ) {
0 commit comments