|
44 | 44 | /* 0 */ |
45 | 45 | /***/ function(module, exports, __webpack_require__) { |
46 | 46 |
|
47 | | - module.exports = __webpack_require__(5); |
| 47 | + module.exports = __webpack_require__(6); |
48 | 48 |
|
49 | 49 |
|
50 | 50 | /***/ }, |
51 | 51 | /* 1 */, |
52 | | -/* 2 */, |
53 | | -/* 3 */ |
| 52 | +/* 2 */ |
54 | 53 | /***/ function(module, exports) { |
55 | 54 |
|
56 | | - module.exports = require("path"); |
| 55 | + // When Node writes to stdout/strerr, we capture that and convert the lines into calls on the |
| 56 | + // active .NET ILogger. But by default, stdout/stderr don't have any way of distinguishing |
| 57 | + // linebreaks inside log messages from the linebreaks that delimit separate log messages, |
| 58 | + // so multiline strings will end up being written to the ILogger as multiple independent |
| 59 | + // log messages. This makes them very hard to make sense of, especially when they represent |
| 60 | + // something like stack traces. |
| 61 | + // |
| 62 | + // To fix this, we intercept stdout/stderr writes, and replace internal linebreaks with a |
| 63 | + // marker token. When .NET receives the lines, it converts the marker tokens back to regular |
| 64 | + // linebreaks within the logged messages. |
| 65 | + // |
| 66 | + // Note that it's better to do the interception at the stdout/stderr level, rather than at |
| 67 | + // the console.log/console.error (etc.) level, because this takes place after any native |
| 68 | + // message formatting has taken place (e.g., inserting values for % placeholders). |
| 69 | + var findInternalNewlinesRegex = /\n(?!$)/g; |
| 70 | + var encodedNewline = '__ns_newline__'; |
| 71 | + encodeNewlinesWrittenToStream(process.stdout); |
| 72 | + encodeNewlinesWrittenToStream(process.stderr); |
| 73 | + function encodeNewlinesWrittenToStream(outputStream) { |
| 74 | + var origWriteFunction = outputStream.write; |
| 75 | + outputStream.write = function (value) { |
| 76 | + // Only interfere with the write if it's definitely a string |
| 77 | + if (typeof value === 'string') { |
| 78 | + var argsClone = Array.prototype.slice.call(arguments, 0); |
| 79 | + argsClone[0] = encodeNewlinesInString(value); |
| 80 | + origWriteFunction.apply(this, argsClone); |
| 81 | + } |
| 82 | + else { |
| 83 | + origWriteFunction.apply(this, arguments); |
| 84 | + } |
| 85 | + }; |
| 86 | + } |
| 87 | + function encodeNewlinesInString(str) { |
| 88 | + return str.replace(findInternalNewlinesRegex, encodedNewline); |
| 89 | + } |
| 90 | + |
57 | 91 |
|
58 | 92 | /***/ }, |
| 93 | +/* 3 */, |
59 | 94 | /* 4 */ |
| 95 | +/***/ function(module, exports) { |
| 96 | + |
| 97 | + module.exports = require("path"); |
| 98 | + |
| 99 | +/***/ }, |
| 100 | +/* 5 */ |
60 | 101 | /***/ function(module, exports) { |
61 | 102 |
|
62 | 103 | "use strict"; |
|
82 | 123 |
|
83 | 124 |
|
84 | 125 | /***/ }, |
85 | | -/* 5 */ |
| 126 | +/* 6 */ |
86 | 127 | /***/ function(module, exports, __webpack_require__) { |
87 | 128 |
|
88 | 129 | "use strict"; |
89 | 130 | // Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive, |
90 | 131 | // but simplifies things for the consumer of this module. |
91 | | - var net = __webpack_require__(6); |
92 | | - var path = __webpack_require__(3); |
93 | | - var readline = __webpack_require__(7); |
94 | | - var ArgsUtil_1 = __webpack_require__(4); |
95 | | - var virtualConnectionServer = __webpack_require__(8); |
| 132 | + __webpack_require__(2); |
| 133 | + var net = __webpack_require__(7); |
| 134 | + var path = __webpack_require__(4); |
| 135 | + var readline = __webpack_require__(8); |
| 136 | + var ArgsUtil_1 = __webpack_require__(5); |
| 137 | + var virtualConnectionServer = __webpack_require__(9); |
96 | 138 | // Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct |
97 | 139 | // reference to Node's runtime 'require' function. |
98 | 140 | var dynamicRequire = eval('require'); |
|
150 | 192 |
|
151 | 193 |
|
152 | 194 | /***/ }, |
153 | | -/* 6 */ |
| 195 | +/* 7 */ |
154 | 196 | /***/ function(module, exports) { |
155 | 197 |
|
156 | 198 | module.exports = require("net"); |
157 | 199 |
|
158 | 200 | /***/ }, |
159 | | -/* 7 */ |
| 201 | +/* 8 */ |
160 | 202 | /***/ function(module, exports) { |
161 | 203 |
|
162 | 204 | module.exports = require("readline"); |
163 | 205 |
|
164 | 206 | /***/ }, |
165 | | -/* 8 */ |
| 207 | +/* 9 */ |
166 | 208 | /***/ function(module, exports, __webpack_require__) { |
167 | 209 |
|
168 | 210 | "use strict"; |
169 | | - var events_1 = __webpack_require__(9); |
170 | | - var VirtualConnection_1 = __webpack_require__(10); |
| 211 | + var events_1 = __webpack_require__(10); |
| 212 | + var VirtualConnection_1 = __webpack_require__(11); |
171 | 213 | // Keep this in sync with the equivalent constant in the .NET code. Both sides split up their transmissions into frames with this max length, |
172 | 214 | // and both will reject longer frames. |
173 | 215 | var MaxFrameBodyLength = 16 * 1024; |
|
348 | 390 |
|
349 | 391 |
|
350 | 392 | /***/ }, |
351 | | -/* 9 */ |
| 393 | +/* 10 */ |
352 | 394 | /***/ function(module, exports) { |
353 | 395 |
|
354 | 396 | module.exports = require("events"); |
355 | 397 |
|
356 | 398 | /***/ }, |
357 | | -/* 10 */ |
| 399 | +/* 11 */ |
358 | 400 | /***/ function(module, exports, __webpack_require__) { |
359 | 401 |
|
360 | 402 | "use strict"; |
|
363 | 405 | function __() { this.constructor = d; } |
364 | 406 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
365 | 407 | }; |
366 | | - var stream_1 = __webpack_require__(11); |
| 408 | + var stream_1 = __webpack_require__(12); |
367 | 409 | /** |
368 | 410 | * Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection. |
369 | 411 | */ |
|
404 | 446 |
|
405 | 447 |
|
406 | 448 | /***/ }, |
407 | | -/* 11 */ |
| 449 | +/* 12 */ |
408 | 450 | /***/ function(module, exports) { |
409 | 451 |
|
410 | 452 | module.exports = require("stream"); |
|
0 commit comments