Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file link_js.ml
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2017 Hugo Heuzard
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)open!StdlibletsourceMappingURL="//# sourceMappingURL="letsourceMappingURL_base64="//# sourceMappingURL=data:application/json;base64,"letkind~resolve_sourcemap_urlfileline=lets=matchString.drop_prefix~prefix:sourceMappingURL_base64linewith|Somebase64->`Json_base64base64|None->(matchString.drop_prefix~prefix:sourceMappingURLlinewith|Someurl->`Urlurl|None->`Other)inmatchswith|`Other->`Other|`Json_base64base64->`Source_map(Source_map_io.of_string(Base64.decode_exnbase64))|`Url_whennotresolve_sourcemap_url->`Drop|`Urlurl->letbase=Filename.dirnamefileinletic=open_in(Filename.concatbaseurl)inletl=in_channel_lengthicinletcontent=really_input_stringiclinclose_inic;`Source_map(Source_map_io.of_stringcontent)letlink~output~files~resolve_sourcemap_url~source_map=letsm=ref[]inletline_offset=ref0inletnew_line()=output_stringoutput"\n";incrline_offsetinletsource_offset=ref0inList.iter~f:(funfile->letic=open_infilein(tryoutput_stringoutput(Printf.sprintf"//# 1 %S"file);new_line();letstart_line=!line_offsetinwhiletruedoletline=input_lineicinmatchkind~resolve_sourcemap_urlfileline,source_mapwith|`Other,_->output_stringoutputline;new_line()|`Drop,_->()|`Source_map_,None->()|`Source_mapx,Some_->source_offset:=List.lengthx.Source_map.sources;sm:=(start_line,file,x)::!smdonewithEnd_of_file->());close_inic;new_line())files;matchsource_mapwith|None->()|Some(file,init_sm)->(matchSource_map.merge((0,"",init_sm)::List.rev!sm)with|None->()|Somesm->(matchfilewith|None->letdata=Source_map_io.to_stringsminlets=sourceMappingURL_base64^Base64.encode_exndatainoutput_stringoutputs|Somefile->Source_map_io.to_filesmfile;lets=sourceMappingURL^Filename.basenamefileinoutput_stringoutputs))