import assert = require ( "assert" ) ; import process = require ( "process" ) ; import { getLocallyInstalledDefinitelyTyped } from "../get-definitely-typed" ; import { logUncaughtErrors } from "../util/util" ; import { getTypingInfo } from "./definition-parser" ; export const definitionParserWorkerFilename = __filename ; if ( ! module . parent ) { process . on ( "message" , message => { assert ( process . argv . length === 3 ) ; const typesPath = process . argv [ 2 ] ; logUncaughtErrors ( async ( ) => { for ( const packageName of message as ReadonlyArray < string > ) { const data = getTypingInfo ( packageName , getLocallyInstalledDefinitelyTyped ( typesPath ) . subDir ( packageName ) ) ; process . send ! ( { data , packageName } ) ; } } ) ; } ) ; }