| 1029 | modifyFile = function node_apps_build_libraries_modifyFile(file:string, fileFlag:string):void { |
| 1030 | node.fs.readFile(file, "utf8", function node_apps_build_libraries_modifyFile_read(err:Error, data:string):void { |
| 1031 | const modify = function node_apps_build_libraries_modifyFile_read_modify(ops:modifyOps):void { |
| 1032 | const start:number = (function node_apps_build_libraries_modifyFile_read_modify_startBuild():number { |
| 1033 | const len = (ops.start.indexOf("//") === 0) |
| 1034 | ? (function node_apps_build_libraries_modifyFile_read_modify_startBuild_lineStart():number { |
| 1035 | data = data.replace(new RegExp(ops.start + "\\s+"), ops.start + "\n"); |
| 1036 | return ops.start.length + 1; |
| 1037 | }()) |
| 1038 | : ops.start.length; |
| 1039 | return data.indexOf(ops.start) + len; |
| 1040 | }()), |
| 1041 | end:number = data.indexOf(ops.end); |
| 1042 | if (start < 0) { |
| 1043 | apps.errout([ |
| 1044 | "The injection start is missing from the file:", |
| 1045 | `Injection start: ${ops.start}`, |
| 1046 | `File flag: ${fileFlag}` |
| 1047 | ]); |
| 1048 | return; |
| 1049 | } |
| 1050 | if (end < start) { |
| 1051 | apps.errout([ |
| 1052 | "The injection end is missing from the file:", |
| 1053 | `Injection end: ${ops.end}`, |
| 1054 | `File flag: ${fileFlag}` |
| 1055 | ]); |
| 1056 | return; |
| 1057 | } |
| 1058 | if (ops.end.indexOf("//") === 0) { |
| 1059 | data = data.replace(new RegExp(ops.end + "\\s+"), ops.end + "\n"); |
| 1060 | } |
| 1061 | data = [data.slice(0, start), ops.injectFlag + "\n", data.slice(end)].join(""); |
| 1062 | }, |
| 1063 | buildDocumentation = function node_apps_build_libraries_modifyFile_read_buildDocumentation():string { |
| 1064 | const allOptions:string[] = []; |
| 1065 | let a:number = 0, |