@@ -69,7 +69,11 @@ import {
69
69
projectResolveFullMarkdownForFile ,
70
70
projectVarsFile ,
71
71
} from "./project-shared.ts" ;
72
- import { RenderFlags , RenderServices } from "../command/render/types.ts" ;
72
+ import {
73
+ RenderFlags ,
74
+ RenderOptions ,
75
+ RenderServices ,
76
+ } from "../command/render/types.ts" ;
73
77
import { kWebsite } from "./types/website/website-constants.ts" ;
74
78
75
79
import { readAndValidateYamlFromFile } from "../core/schema/validated-yaml.ts" ;
@@ -95,16 +99,18 @@ import { MappedString } from "../core/mapped-text.ts";
95
99
export async function projectContext (
96
100
path : string ,
97
101
notebookContext : NotebookContext ,
98
- flags ?: RenderFlags ,
102
+ renderOptions ?: RenderOptions ,
99
103
force = false ,
100
104
) : Promise < ProjectContext | undefined > {
105
+ const flags = renderOptions ?. flags ;
101
106
let dir = normalizePath (
102
107
Deno . statSync ( path ) . isDirectory ? path : dirname ( path ) ,
103
108
) ;
104
109
const originalDir = dir ;
105
110
106
- // create a shared extension context
107
- const extensionContext = createExtensionContext ( ) ;
111
+ // create an extension context if one doesn't exist
112
+ const extensionContext = renderOptions ?. services . extension ||
113
+ createExtensionContext ( ) ;
108
114
109
115
// first pass uses the config file resolve
110
116
const configSchema = await getProjectConfigSchema ( ) ;
@@ -636,9 +642,9 @@ async function resolveLanguageTranslations(
636
642
export function projectContextForDirectory (
637
643
path : string ,
638
644
notebookContext : NotebookContext ,
639
- flags ?: RenderFlags ,
645
+ renderOptions ?: RenderOptions ,
640
646
) : Promise < ProjectContext > {
641
- return projectContext ( path , notebookContext , flags , true ) as Promise <
647
+ return projectContext ( path , notebookContext , renderOptions , true ) as Promise <
642
648
ProjectContext
643
649
> ;
644
650
}
0 commit comments