55 * correctly in Grid3 gridsets.
66 */
77
8- import type { ZipEntry } from './password' ;
98import { openZipFromInput } from '../../utils/zip' ;
109import { getZipEntriesFromAdapter } from './password' ;
1110import { resolveGridsetPasswordFromEnv } from './password' ;
@@ -64,7 +63,7 @@ export async function auditGridsetImages(
6463 const imageExtensions = [ '.png' , '.jpg' , '.jpeg' , '.bmp' , '.gif' , '.emf' , '.wmf' ] ;
6564 for ( const entry of entries ) {
6665 const name = entry . entryName . toLowerCase ( ) ;
67- if ( imageExtensions . some ( ext => name . endsWith ( ext ) ) ) {
66+ if ( imageExtensions . some ( ( ext ) => name . endsWith ( ext ) ) ) {
6867 availableImages . add ( entry . entryName ) ;
6968 }
7069 }
@@ -88,9 +87,7 @@ export async function auditGridsetImages(
8887 const baseDir = gridEntryPath . replace ( / \/ g r i d \. x m l $ / , '/' ) ;
8988
9089 // Check for FileMap.xml
91- const fileMapEntry = entries . find ( ( e ) =>
92- e . entryName === baseDir + 'FileMap.xml'
93- ) ;
90+ const fileMapEntry = entries . find ( ( e ) => e . entryName === baseDir + 'FileMap.xml' ) ;
9491
9592 const dynamicFilesMap = new Map < string , string [ ] > ( ) ;
9693 if ( fileMapEntry ) {
@@ -102,11 +99,16 @@ export async function auditGridsetImages(
10299 const arr = Array . isArray ( fileEntries ) ? fileEntries : [ fileEntries ] ;
103100 for ( const ent of arr ) {
104101 const rawStaticFile = ent [ '@_StaticFile' ] || ent . StaticFile || ent . staticFile ;
105- const staticFile = typeof rawStaticFile === 'string' ? rawStaticFile . replace ( / \\ / g, '/' ) : '' ;
102+ const staticFile =
103+ typeof rawStaticFile === 'string' ? rawStaticFile . replace ( / \\ / g, '/' ) : '' ;
106104 if ( ! staticFile ) continue ;
107105 const df = ent . DynamicFiles || ent . dynamicFiles ;
108106 const candidates = df ?. File || df ?. file || df ?. Files || df ?. files ;
109- const list = Array . isArray ( candidates ) ? candidates : candidates ? [ candidates ] : [ ] ;
107+ const list : string [ ] = Array . isArray ( candidates )
108+ ? candidates
109+ : candidates
110+ ? [ candidates ]
111+ : [ ] ;
110112 dynamicFilesMap . set ( staticFile , list ) ;
111113 }
112114 }
@@ -142,8 +144,9 @@ export async function auditGridsetImages(
142144
143145 // Try to resolve the image
144146 const imageName = String ( imageCandidate ) . trim ( ) ;
145- const imageFound = availableImages . has ( `${ baseDir } ${ imageName } ` ) ||
146- availableImages . has ( `${ baseDir } Images/${ imageName } ` ) ;
147+ const imageFound =
148+ availableImages . has ( `${ baseDir } ${ imageName } ` ) ||
149+ availableImages . has ( `${ baseDir } Images/${ imageName } ` ) ;
147150
148151 if ( imageFound ) {
149152 resolvedImages ++ ;
@@ -165,17 +168,19 @@ export async function auditGridsetImages(
165168 // Check if it's a symbol library reference
166169 if ( imageName . includes ( 'widgit' ) || imageName . includes ( 'Widgit' ) ) {
167170 issue = 'symbol_library' ;
168- suggestion = 'This is a Widgit symbol library reference. These symbols are not stored in the gridset - they require the Widgit Symbols to be installed on the system.' ;
171+ suggestion =
172+ 'This is a Widgit symbol library reference. These symbols are not stored in the gridset - they require the Widgit Symbols to be installed on the system.' ;
169173 } else if ( imageName . includes ( 'grid3x' ) || imageName . includes ( 'Grid3' ) ) {
170174 issue = 'external_reference' ;
171- suggestion = 'This is a built-in Grid3 resource reference. These images are not included in the gridset file.' ;
175+ suggestion =
176+ 'This is a built-in Grid3 resource reference. These images are not included in the gridset file.' ;
172177 } else {
173178 issue = 'symbol_library' ;
174179 suggestion = `External symbol library reference: ${ imageName } . Symbol libraries are not embedded in gridset files.` ;
175180 }
176181 } else {
177182 issue = 'not_found' ;
178- const similarImages = Array . from ( availableImages ) . filter ( img =>
183+ const similarImages = Array . from ( availableImages ) . filter ( ( img ) =>
179184 img . toLowerCase ( ) . includes ( imageName . toLowerCase ( ) . substring ( 0 , 10 ) )
180185 ) ;
181186 if ( similarImages . length > 0 ) {
@@ -242,8 +247,11 @@ export function formatImageAuditSummary(audit: ImageAuditResult): string {
242247
243248 for ( const [ type , issues ] of byType ) {
244249 lines . push ( `\n${ type . toUpperCase ( ) } (${ issues . length } occurrences):` ) ;
245- for ( const issue of issues . slice ( 0 , 5 ) ) { // Show first 5 of each type
246- lines . push ( ` [${ issue . gridName } ] Cell (${ issue . cellX } , ${ issue . cellY } ): ${ issue . declaredImage } ` ) ;
250+ for ( const issue of issues . slice ( 0 , 5 ) ) {
251+ // Show first 5 of each type
252+ lines . push (
253+ ` [${ issue . gridName } ] Cell (${ issue . cellX } , ${ issue . cellY } ): ${ issue . declaredImage } `
254+ ) ;
247255 lines . push ( ` → ${ issue . suggestion } ` ) ;
248256 }
249257 if ( issues . length > 5 ) {
0 commit comments