Skip to content

Commit

Permalink
added -D source-map-content to include hx sources in .js.map (fix loc…
Browse files Browse the repository at this point in the history
…al security and modified file issues)
  • Loading branch information
ncannasse committed Jan 10, 2014
1 parent 7c32242 commit 1b3f377
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ module Define = struct
| ReplaceFiles
| Scriptable
| ShallowExpose
| SourceMapContent
| Swc
| SwfCompressLevel
| SwfDebugPassword
Expand Down Expand Up @@ -277,6 +278,7 @@ module Define = struct
| ReplaceFiles -> ("replace_files","GenCommon internal")
| Scriptable -> ("scriptable","GenCPP internal")
| ShallowExpose -> ("shallow-expose","Expose types to surrounding scope of Haxe generated closure without writing to window object")
| SourceMapContent -> ("source-map-content","Include the hx sources as part of the JS source map")
| Swc -> ("swc","Output a SWC instead of a SWF")
| SwfCompressLevel -> ("swf_compress_level","<level:1-9> Set the amount of compression for the SWF output")
| SwfDebugPassword -> ("swf_debug_password", "Set a password for debugging.")
Expand Down
5 changes: 5 additions & 0 deletions genjs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ let write_mappings ctx =
output_string channel ("\"sources\":[" ^
(String.concat "," (List.map (fun s -> "\"" ^ to_url s ^ "\"") sources)) ^
"],\n");
if Common.defined ctx.com Define.SourceMapContent then begin
output_string channel ("\"sourcesContent\":[" ^
(String.concat "," (List.map (fun s -> "\"" ^ Ast.s_escape (Std.input_file ~bin:true s) ^ "\"") sources)) ^
"],\n");
end;
output_string channel "\"names\":[],\n";
output_string channel "\"mappings\":\"";
Buffer.output_buffer channel ctx.smap.mappings;
Expand Down

0 comments on commit 1b3f377

Please sign in to comment.