1+ import { ComponentsManagerBuilder } from 'componentsjs/lib/loading/ComponentsManagerBuilder' ;
2+ import { PrefetchedDocumentLoader } from 'componentsjs/lib/rdf/PrefetchedDocumentLoader' ;
3+ import type { LogLevel } from 'componentsjs/lib/util/LogLevel' ;
14import { ContextParser } from 'jsonld-context-parser' ;
25import { ClassFinder } from '../parse/ClassFinder' ;
36import { ClassIndexer } from '../parse/ClassIndexer' ;
@@ -19,12 +22,14 @@ export class Generator {
1922 private readonly pathDestination : PathDestinationDefinition ;
2023 private readonly fileExtension : string ;
2124 private readonly ignoreClasses : Record < string , boolean > ;
25+ private readonly logLevel : LogLevel ;
2226
2327 public constructor ( args : GeneratorArgs ) {
2428 this . resolutionContext = args . resolutionContext ;
2529 this . pathDestination = args . pathDestination ;
2630 this . fileExtension = args . fileExtension ;
2731 this . ignoreClasses = args . ignoreClasses ;
32+ this . logLevel = args . logLevel ;
2833 }
2934
3035 public async generateComponents ( ) : Promise < void > {
@@ -53,7 +58,12 @@ export class Generator {
5358 pathDestination : this . pathDestination ,
5459 classReferences : classIndex ,
5560 classConstructors : constructors ,
56- contextParser : new ContextParser ( ) ,
61+ contextParser : new ContextParser ( {
62+ documentLoader : new PrefetchedDocumentLoader ( {
63+ contexts : { } ,
64+ logger : ComponentsManagerBuilder . createLogger ( this . logLevel ) ,
65+ } ) ,
66+ } ) ,
5767 } ) ;
5868 const components = await componentConstructor . constructComponents ( ) ;
5969 const componentsIndex = await componentConstructor . constructComponentsIndex ( components , this . fileExtension ) ;
@@ -78,6 +88,6 @@ export interface GeneratorArgs {
7888 resolutionContext : ResolutionContext ;
7989 pathDestination : PathDestinationDefinition ;
8090 fileExtension : string ;
81- level : string ;
8291 ignoreClasses : Record < string , boolean > ;
92+ logLevel : LogLevel ;
8393}
0 commit comments