lib/index.js
function main(contents, options) {
    if (options === void 0) { options = { tagNames: [] }; }
    var sourceFile = ts.createSourceFile("file.ts", contents, ts.ScriptTarget.ES2015, 
    /*setParentNodes */ false, ts.ScriptKind.TSX);
    var dm = findMethodCallsWithName(sourceFile, "defineMessages", extractMessagesForDefineMessages);
    // TODO formatMessage might not be the initializer for a VarDecl
    // eg console.log(formatMessage(...))
    var fm = findMethodCallsWithName(sourceFile, "formatMessage", extractMessagesForFormatMessage);
    var results = [];
    var tagNames = ["FormattedMessage"].concat(options.tagNames);
    tagNames.forEach(function (tagName) {
        var elements = findJsxOpeningLikeElementsWithName(sourceFile, tagName);
        // convert JsxOpeningLikeElements to Message maps
        var jsxMessages = getElementsMessages(elements);
        results.push.apply(results, jsxMessages);
    });
    return results.concat(dm).concat(fm);
}
function main(contents, options) {
    if (options === void 0) { options = { tagNames: [] }; }
    var sourceFile = ts.createSourceFile("file.ts", contents, ts.ScriptTarget.ES2015, 
    /*setParentNodes */ false, ts.ScriptKind.TSX);
    var dm = findMethodCallsWithName(sourceFile, "defineMessages", extractMessagesForDefineMessages);
    // TODO formatMessage might not be the initializer for a VarDecl
    // eg console.log(formatMessage(...))
    var fm = findMethodCallsWithName(sourceFile, "formatMessage", extractMessagesForFormatMessage);
    var results = [];
    var tagNames = ["FormattedMessage"].concat(options.tagNames);
    tagNames.forEach(function (tagName) {
        var elements = findJsxOpeningLikeElementsWithName(sourceFile, tagName);
        // convert JsxOpeningLikeElements to Message maps
        var jsxMessages = getElementsMessages(elements);
        results.push.apply(results, jsxMessages);
    });
    return results.concat(dm).concat(fm);
}
function main ( contents , options ) { if ( options === void 0 ) { options = { tagNames : [ ] } ; } var sourceFile = ts . createSourceFile ( "file.ts" , contents , ts . ScriptTarget . ES2015 , /*setParentNodes */ false , ts . ScriptKind . TSX ) ; var dm = findMethodCallsWithName ( sourceFile , "defineMessages" , extractMessagesForDefineMessages ) ; // TODO formatMessage might not be the initializer for a VarDecl // eg console.log(formatMessage(...)) var fm = findMethodCallsWithName ( sourceFile , "formatMessage" , extractMessagesForFormatMessage ) ; var results = [ ] ; var tagNames = [ "FormattedMessage" ] . concat ( options . tagNames ) ; tagNames . forEach ( function ( tagName ) { var elements = findJsxOpeningLikeElementsWithName ( sourceFile , tagName ) ; // convert JsxOpeningLikeElements to Message maps var jsxMessages = getElementsMessages ( elements ) ; results . push . apply ( results , jsxMessages ) ; } ) ; return results . concat ( dm ) . concat ( fm ) ; }
Parse tsx files
Parse tsx files