@@ -20,7 +20,7 @@ import {
2020 resolveFileResources ,
2121 resourcesFromMetadata ,
2222} from "../command/render/resources.ts" ;
23- import { kLocalDevelopment , quartoConfig } from "../core/quarto.ts" ;
23+ import { quartoConfig } from "../core/quarto.ts" ;
2424
2525import { cssFileResourceReferences } from "../core/css.ts" ;
2626import {
@@ -31,7 +31,10 @@ import {
3131} from "../project/project-shared.ts" ;
3232import { normalizePath , safeExistsSync } from "../core/path.ts" ;
3333import { kExtensionDir } from "../extension/constants.ts" ;
34- import { extensionFilesFromDirs } from "../extension/extension.ts" ;
34+ import {
35+ createExtensionContext ,
36+ extensionFilesFromDirs ,
37+ } from "../extension/extension.ts" ;
3538import { withRenderServices } from "../command/render/render-services.ts" ;
3639import { notebookContext } from "../render/notebook/notebook-context.ts" ;
3740import { RenderServices } from "../command/render/types.ts" ;
@@ -88,27 +91,9 @@ const inspectProjectConfig = async (context: ProjectContext) => {
8891 }
8992 const fileInformation : Record < string , InspectedFile > = { } ;
9093 for ( const file of context . files . input ) {
91- const engine = await fileExecutionEngine ( file , undefined , context ) ;
92- const src = await context . resolveFullMarkdownForFile ( engine , file ) ;
93- if ( engine ) {
94- const errors = await validateDocumentFromSource (
95- src ,
96- engine . name ,
97- error ,
98- ) ;
99- if ( errors . length ) {
100- throw new Error ( `${ file } is not a valid Quarto input document` ) ;
101- }
102- }
103- await projectResolveCodeCellsForFile ( context , engine , file ) ;
104- await projectFileMetadata ( context , file ) ;
105- fileInformation [ file ] = {
106- includeMap : context . fileInformationCache . get ( file ) ?. includeMap ??
107- [ ] ,
108- codeCells : context . fileInformationCache . get ( file ) ?. codeCells ?? [ ] ,
109- metadata : context . fileInformationCache . get ( file ) ?. metadata ?? { } ,
110- } ;
94+ await populateFileInformation ( context , fileInformation , file ) ;
11195 }
96+ const extensions = await populateExtensionInformation ( context ) ;
11297 const config : InspectedProjectConfig = {
11398 quarto : {
11499 version : quartoConfig . version ( ) ,
@@ -118,10 +103,50 @@ const inspectProjectConfig = async (context: ProjectContext) => {
118103 config : context . config ,
119104 files : context . files ,
120105 fileInformation,
106+ extensions : extensions ,
121107 } ;
122108 return config ;
123109} ;
124110
111+ const populateExtensionInformation = async (
112+ context : ProjectContext ,
113+ ) => {
114+ const extensionContext = createExtensionContext ( ) ;
115+ return await extensionContext . extensions (
116+ context . dir ,
117+ context . config ,
118+ context . dir ,
119+ { builtIn : false } ,
120+ ) ;
121+ } ;
122+
123+ const populateFileInformation = async (
124+ context : ProjectContext ,
125+ fileInformation : Record < string , InspectedFile > ,
126+ file : string ,
127+ ) => {
128+ const engine = await fileExecutionEngine ( file , undefined , context ) ;
129+ const src = await context . resolveFullMarkdownForFile ( engine , file ) ;
130+ if ( engine ) {
131+ const errors = await validateDocumentFromSource (
132+ src ,
133+ engine . name ,
134+ error ,
135+ ) ;
136+ if ( errors . length ) {
137+ throw new Error ( `${ file } is not a valid Quarto input document` ) ;
138+ }
139+ }
140+ await projectResolveCodeCellsForFile ( context , engine , file ) ;
141+ await projectFileMetadata ( context , file ) ;
142+ fileInformation [ file ] = {
143+ includeMap : context . fileInformationCache . get ( file ) ?. includeMap ??
144+ [ ] ,
145+ codeCells : context . fileInformationCache . get ( file ) ?. codeCells ?? [ ] ,
146+ metadata : context . fileInformationCache . get ( file ) ?. metadata ?? { } ,
147+ } ;
148+ } ;
149+
125150const inspectDocumentConfig = async ( path : string ) => {
126151 const nbContext = notebookContext ( ) ;
127152 const project = await projectContext ( path , nbContext ) ||
0 commit comments