2
0
Эх сурвалжийг харах

added -D source-map-content to include hx sources in .js.map (fix local security and modified file issues)

Nicolas Cannasse 11 жил өмнө
parent
commit
1b3f3778ff
2 өөрчлөгдсөн 7 нэмэгдсэн , 0 устгасан
  1. 2 0
      common.ml
  2. 5 0
      genjs.ml

+ 2 - 0
common.ml

@@ -209,6 +209,7 @@ module Define = struct
 		| ReplaceFiles
 		| Scriptable
 		| ShallowExpose
+		| SourceMapContent
 		| Swc
 		| SwfCompressLevel
 		| SwfDebugPassword
@@ -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.")

+ 5 - 0
genjs.ml

@@ -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;