@@ -13,7 +13,7 @@ export default async function buildLocale(
1313 dist : string ,
1414 namespace : string ,
1515 options : BuildConfig [ "fluent" ] ,
16- ) {
16+ ) : Promise < void > {
1717 const ignores = toArray ( options . ignore ) ;
1818 const localeNames = await getLocales ( dist ) ;
1919 const messageManager = new MessageManager ( ignores ) ;
@@ -81,13 +81,13 @@ export class FluentManager {
8181 constructor ( ) { }
8282
8383 // Parse Fluent source into an AST and extract messages
84- public parse ( source : string ) {
84+ public parse ( source : string ) : void {
8585 this . source = source ;
8686 this . resource = parse ( source , { } ) ;
8787 }
8888
8989 // Read a file, parse its content, and extract messages
90- public async read ( path : string ) {
90+ public async read ( path : string ) : Promise < void > {
9191 const content = await readFile ( path , "utf-8" ) ;
9292 this . parse ( content ) ;
9393 }
@@ -106,7 +106,7 @@ export class FluentManager {
106106 }
107107
108108 // Apply namespace prefix to message IDs in the resource
109- public prefixMessages ( namespace : string ) {
109+ public prefixMessages ( namespace : string ) : void {
110110 if ( ! this . resource ) {
111111 throw new Error ( "Resource must be parsed before applying prefix." ) ;
112112 }
@@ -122,7 +122,7 @@ export class FluentManager {
122122 }
123123
124124 // Write the serialized resource to a file
125- public async write ( path : string ) {
125+ public async write ( path : string ) : Promise < void > {
126126 const result = this . serialize ( ) ;
127127 if ( result !== this . source )
128128 await writeFile ( path , this . serialize ( ) ) ;
@@ -163,7 +163,7 @@ export class MessageManager {
163163 }
164164
165165 // Add a set of messages (FTL or HTML) for a specific locale or for HTML globally
166- addMessages ( target : string | "html" , messages : string [ ] ) {
166+ addMessages ( target : string | "html" , messages : string [ ] ) : void {
167167 if ( target === "html" ) {
168168 messages . forEach ( msg => this . htmlMessages . add ( msg ) ) ;
169169 }
@@ -177,7 +177,7 @@ export class MessageManager {
177177 }
178178 }
179179
180- validateMessages ( ) {
180+ validateMessages ( ) : void {
181181 // Check miss 1: Cross check in diff locale - seems no need
182182 // messagesByLocale.forEach((messageInThisLang, lang) => {
183183 // // Needs Nodejs 22
@@ -223,7 +223,10 @@ export function processHTMLFile(
223223 allMessages : Set < string > ,
224224 ignores : string [ ] ,
225225 filePath : string ,
226- ) {
226+ ) : {
227+ processedContent : string ;
228+ foundMessages : string [ ] ;
229+ } {
227230 const foundMessages = new Set < string > ( ) ;
228231
229232 const L10N_PATTERN = new RegExp ( `(data-l10n-id)="((?!${ namespace } )\\S*)"` , "g" ) ;
0 commit comments