1313 * const file = await RiveFileFactory.fromSource(gameRiv); // TypedRiveFile<GameSchema> — T inferred
1414 */
1515
16- import { readFileSync , writeFileSync , mkdirSync , readdirSync , statSync } from 'fs' ;
16+ import {
17+ readFileSync ,
18+ writeFileSync ,
19+ mkdirSync ,
20+ readdirSync ,
21+ statSync ,
22+ } from 'fs' ;
1723import { dirname , resolve , basename , extname } from 'path' ;
1824import { fileURLToPath } from 'url' ;
1925import { RuntimeLoader } from '@rive-app/canvas' ;
@@ -72,9 +78,10 @@ async function getRuntime(): Promise<any> {
7278}
7379
7480async function extractSchema ( input : string ) : Promise < Schema > {
75- const bytes = input . startsWith ( 'http://' ) || input . startsWith ( 'https://' )
76- ? new Uint8Array ( await ( await fetch ( input ) ) . arrayBuffer ( ) )
77- : new Uint8Array ( readFileSync ( input ) ) ;
81+ const bytes =
82+ input . startsWith ( 'http://' ) || input . startsWith ( 'https://' )
83+ ? new Uint8Array ( await ( await fetch ( input ) ) . arrayBuffer ( ) )
84+ : new Uint8Array ( readFileSync ( input ) ) ;
7885
7986 const runtime = await getRuntime ( ) ;
8087
@@ -105,7 +112,10 @@ async function extractSchema(input: string): Promise<Schema> {
105112 const vmCount = ( riveFile as any ) . viewModelCount ( ) as number ;
106113 for ( let i = 0 ; i < vmCount ; i ++ ) {
107114 const vm = ( riveFile as any ) . viewModelByIndex ( i ) ;
108- const properties = vm . getProperties ( ) as Array < { name : string ; type : string } > ;
115+ const properties = vm . getProperties ( ) as Array < {
116+ name : string ;
117+ type : string ;
118+ } > ;
109119 const inst = vm . instance ?.( ) as any ;
110120 const props : Record < string , string > = { } ;
111121 for ( const p of properties ) {
@@ -121,7 +131,8 @@ async function extractSchema(input: string): Promise<Schema> {
121131 try {
122132 const ep = inst . enum ?.( p . name ) ;
123133 const values : string [ ] = ep ?. values ?? [ ] ;
124- props [ p . name ] = values . length > 0 ? `enum:${ values . join ( '|' ) } ` : 'enum' ;
134+ props [ p . name ] =
135+ values . length > 0 ? `enum:${ values . join ( '|' ) } ` : 'enum' ;
125136 } catch {
126137 props [ p . name ] = 'enum' ;
127138 }
@@ -132,7 +143,12 @@ async function extractSchema(input: string): Promise<Schema> {
132143 viewModels [ vm . name ] = props ;
133144 }
134145
135- return { artboards, defaultArtboard : artboards [ 0 ] ?? '' , stateMachines, viewModels } ;
146+ return {
147+ artboards,
148+ defaultArtboard : artboards [ 0 ] ?? '' ,
149+ stateMachines,
150+ viewModels,
151+ } ;
136152}
137153
138154// With prettier quoteProps:"consistent", if any key in an object needs quotes, all get quotes.
0 commit comments