File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -241,11 +241,12 @@ async function loadSchemaValidator(): Promise<Validator> {
241241 return new Validator ( schemaObject as JsonSchema ) ;
242242}
243243
244- const schemaValidator : Validator = await loadSchemaValidator ( ) ;
244+ let schemaValidator : Validator | undefined = undefined ;
245245
246246async function loadSchema ( path : string ) : Promise < TypeSchema > {
247247 const content = await readFile ( path , { encoding : "utf-8" } ) ;
248248 const schema = parse ( content ) ;
249+ if ( schemaValidator == null ) schemaValidator = await loadSchemaValidator ( ) ;
249250 const result = schemaValidator . validate ( schema ) ;
250251 const errors : SchemaError [ ] = [ ] ;
251252 if ( result . valid ) return schema as TypeSchema ;
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ for await (const file of files) {
1717 path = path . slice ( baseDir . length + SEPARATOR . length ) ;
1818 }
1919 if ( path . startsWith ( `codegen${ SEPARATOR } ` ) ) continue ;
20- else if ( path . endsWith ( `${ SEPARATOR } vocab.test.js` ) ) continue ;
2120 const relPath = `./${ path . replaceAll ( SEPARATOR , "/" ) } ` ;
2221 console . log ( `import "${ relPath } ";` ) ;
2322}
Original file line number Diff line number Diff line change @@ -857,7 +857,10 @@ const sampleValues: Record<string, any> = {
857857 "fedify:units" : "m" ,
858858} ;
859859
860- const types = await loadSchemaFiles ( import . meta. dirname ! ) ;
860+ const types : Record < string , TypeSchema > =
861+ navigator ?. userAgent === "Cloudflare-Workers"
862+ ? { } // FIXME: Cloudflare Workers does not support async I/O within global scope
863+ : await loadSchemaFiles ( import . meta. dirname ! ) ;
861864for ( const typeUri in types ) {
862865 const type = types [ typeUri ] ;
863866 // @ts -ignore: classes are all different
@@ -1252,7 +1255,9 @@ for (const typeUri in types) {
12521255 } ) ;
12531256
12541257 if ( "Deno" in globalThis ) {
1255- const { assertSnapshot } = await import ( "@std/testing/snapshot" ) ;
1258+ const { assertSnapshot } = await import ( "@std/testing/snapshot" ) . catch (
1259+ ( ) => ( { assertSnapshot : ( ) => Promise . resolve ( ) } ) ,
1260+ ) ;
12561261
12571262 test ( `Deno.inspect(${ type . name } ) [auto]` , async ( t ) => {
12581263 const empty = new cls ( { } ) ;
You can’t perform that action at this time.
0 commit comments