import MagicString from 'magic-string' ; import parseChunks = require ( './parse-chunks' ) ; import ParseHelper = require ( './parse-helper' ) ; import Parser = require ( './parser' ) ; import Jscc from '../index' ; param source param props const parseBuffer = function _parseBuffer ( source , props ) { props . magicStr = new MagicString ( source ) ; const helper = new ParseHelper ( source , props ) ; const changes = parseChunks ( new Parser ( props ) , source , helper ) ; const result = { code : changes ? props . magicStr . toString ( ) : source , } ; if ( props . sourceMap ) { result . map = changes ? props . magicStr . generateMap ( { source : props . values . _FILE || undefined , includeContent : props . mapContent , hires : props . mapHires , } ) : null ; } return result ; } ; export = parseBuffer ;