|
44 | 44 | /* 0 */ |
45 | 45 | /***/ function(module, exports, __webpack_require__) { |
46 | 46 |
|
47 | | - module.exports = __webpack_require__(7); |
| 47 | + module.exports = __webpack_require__(1); |
| 48 | + |
| 49 | + |
| 50 | +/***/ }, |
| 51 | +/* 1 */ |
| 52 | +/***/ function(module, exports, __webpack_require__) { |
| 53 | + |
| 54 | + "use strict"; |
| 55 | + // Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive, |
| 56 | + // but simplifies things for the consumer of this module. |
| 57 | + __webpack_require__(2); |
| 58 | + var net = __webpack_require__(3); |
| 59 | + var path = __webpack_require__(4); |
| 60 | + var readline = __webpack_require__(5); |
| 61 | + var ArgsUtil_1 = __webpack_require__(6); |
| 62 | + var ExitWhenParentExits_1 = __webpack_require__(7); |
| 63 | + var virtualConnectionServer = __webpack_require__(8); |
| 64 | + // Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct |
| 65 | + // reference to Node's runtime 'require' function. |
| 66 | + var dynamicRequire = eval('require'); |
| 67 | + // Signal to the .NET side when we're ready to accept invocations |
| 68 | + var server = net.createServer().on('listening', function () { |
| 69 | + console.log('[Microsoft.AspNetCore.NodeServices:Listening]'); |
| 70 | + }); |
| 71 | + // Each virtual connection represents a separate invocation |
| 72 | + virtualConnectionServer.createInterface(server).on('connection', function (connection) { |
| 73 | + readline.createInterface(connection, null).on('line', function (line) { |
| 74 | + try { |
| 75 | + // Get a reference to the function to invoke |
| 76 | + var invocation = JSON.parse(line); |
| 77 | + var invokedModule = dynamicRequire(path.resolve(process.cwd(), invocation.moduleName)); |
| 78 | + var invokedFunction = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule; |
| 79 | + // Prepare a callback for accepting non-streamed JSON responses |
| 80 | + var hasInvokedCallback_1 = false; |
| 81 | + var invocationCallback = function (errorValue, successValue) { |
| 82 | + if (hasInvokedCallback_1) { |
| 83 | + throw new Error('Cannot supply more than one result. The callback has already been invoked,' |
| 84 | + + ' or the result stream has already been accessed'); |
| 85 | + } |
| 86 | + hasInvokedCallback_1 = true; |
| 87 | + connection.end(JSON.stringify({ |
| 88 | + result: successValue, |
| 89 | + errorMessage: errorValue && (errorValue.message || errorValue), |
| 90 | + errorDetails: errorValue && (errorValue.stack || null) |
| 91 | + })); |
| 92 | + }; |
| 93 | + // Also support streamed binary responses |
| 94 | + Object.defineProperty(invocationCallback, 'stream', { |
| 95 | + enumerable: true, |
| 96 | + get: function () { |
| 97 | + hasInvokedCallback_1 = true; |
| 98 | + return connection; |
| 99 | + } |
| 100 | + }); |
| 101 | + // Actually invoke it, passing through any supplied args |
| 102 | + invokedFunction.apply(null, [invocationCallback].concat(invocation.args)); |
| 103 | + } |
| 104 | + catch (ex) { |
| 105 | + connection.end(JSON.stringify({ |
| 106 | + errorMessage: ex.message, |
| 107 | + errorDetails: ex.stack |
| 108 | + })); |
| 109 | + } |
| 110 | + }); |
| 111 | + }); |
| 112 | + // Begin listening now. The underlying transport varies according to the runtime platform. |
| 113 | + // On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets. |
| 114 | + var useWindowsNamedPipes = /^win/.test(process.platform); |
| 115 | + var parsedArgs = ArgsUtil_1.parseArgs(process.argv); |
| 116 | + var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress; |
| 117 | + server.listen(listenAddress); |
| 118 | + ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid)); |
48 | 119 |
|
49 | 120 |
|
50 | 121 | /***/ }, |
51 | | -/* 1 */, |
52 | 122 | /* 2 */ |
53 | 123 | /***/ function(module, exports) { |
54 | 124 |
|
|
90 | 160 |
|
91 | 161 |
|
92 | 162 | /***/ }, |
93 | | -/* 3 */, |
| 163 | +/* 3 */ |
| 164 | +/***/ function(module, exports) { |
| 165 | + |
| 166 | + module.exports = require("net"); |
| 167 | + |
| 168 | +/***/ }, |
94 | 169 | /* 4 */ |
95 | 170 | /***/ function(module, exports) { |
96 | 171 |
|
97 | 172 | module.exports = require("path"); |
98 | 173 |
|
99 | 174 | /***/ }, |
100 | 175 | /* 5 */ |
| 176 | +/***/ function(module, exports) { |
| 177 | + |
| 178 | + module.exports = require("readline"); |
| 179 | + |
| 180 | +/***/ }, |
| 181 | +/* 6 */ |
101 | 182 | /***/ function(module, exports) { |
102 | 183 |
|
103 | 184 | "use strict"; |
|
123 | 204 |
|
124 | 205 |
|
125 | 206 | /***/ }, |
126 | | -/* 6 */ |
| 207 | +/* 7 */ |
127 | 208 | /***/ function(module, exports) { |
128 | 209 |
|
129 | 210 | /* |
|
189 | 270 | } |
190 | 271 |
|
191 | 272 |
|
192 | | -/***/ }, |
193 | | -/* 7 */ |
194 | | -/***/ function(module, exports, __webpack_require__) { |
195 | | - |
196 | | - "use strict"; |
197 | | - // Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive, |
198 | | - // but simplifies things for the consumer of this module. |
199 | | - __webpack_require__(2); |
200 | | - var net = __webpack_require__(8); |
201 | | - var path = __webpack_require__(4); |
202 | | - var readline = __webpack_require__(9); |
203 | | - var ArgsUtil_1 = __webpack_require__(5); |
204 | | - var ExitWhenParentExits_1 = __webpack_require__(6); |
205 | | - var virtualConnectionServer = __webpack_require__(10); |
206 | | - // Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct |
207 | | - // reference to Node's runtime 'require' function. |
208 | | - var dynamicRequire = eval('require'); |
209 | | - // Signal to the .NET side when we're ready to accept invocations |
210 | | - var server = net.createServer().on('listening', function () { |
211 | | - console.log('[Microsoft.AspNetCore.NodeServices:Listening]'); |
212 | | - }); |
213 | | - // Each virtual connection represents a separate invocation |
214 | | - virtualConnectionServer.createInterface(server).on('connection', function (connection) { |
215 | | - readline.createInterface(connection, null).on('line', function (line) { |
216 | | - try { |
217 | | - // Get a reference to the function to invoke |
218 | | - var invocation = JSON.parse(line); |
219 | | - var invokedModule = dynamicRequire(path.resolve(process.cwd(), invocation.moduleName)); |
220 | | - var invokedFunction = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule; |
221 | | - // Prepare a callback for accepting non-streamed JSON responses |
222 | | - var hasInvokedCallback_1 = false; |
223 | | - var invocationCallback = function (errorValue, successValue) { |
224 | | - if (hasInvokedCallback_1) { |
225 | | - throw new Error('Cannot supply more than one result. The callback has already been invoked,' |
226 | | - + ' or the result stream has already been accessed'); |
227 | | - } |
228 | | - hasInvokedCallback_1 = true; |
229 | | - connection.end(JSON.stringify({ |
230 | | - result: successValue, |
231 | | - errorMessage: errorValue && (errorValue.message || errorValue), |
232 | | - errorDetails: errorValue && (errorValue.stack || null) |
233 | | - })); |
234 | | - }; |
235 | | - // Also support streamed binary responses |
236 | | - Object.defineProperty(invocationCallback, 'stream', { |
237 | | - enumerable: true, |
238 | | - get: function () { |
239 | | - hasInvokedCallback_1 = true; |
240 | | - return connection; |
241 | | - } |
242 | | - }); |
243 | | - // Actually invoke it, passing through any supplied args |
244 | | - invokedFunction.apply(null, [invocationCallback].concat(invocation.args)); |
245 | | - } |
246 | | - catch (ex) { |
247 | | - connection.end(JSON.stringify({ |
248 | | - errorMessage: ex.message, |
249 | | - errorDetails: ex.stack |
250 | | - })); |
251 | | - } |
252 | | - }); |
253 | | - }); |
254 | | - // Begin listening now. The underlying transport varies according to the runtime platform. |
255 | | - // On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets. |
256 | | - var useWindowsNamedPipes = /^win/.test(process.platform); |
257 | | - var parsedArgs = ArgsUtil_1.parseArgs(process.argv); |
258 | | - var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress; |
259 | | - server.listen(listenAddress); |
260 | | - ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid)); |
261 | | - |
262 | | - |
263 | 273 | /***/ }, |
264 | 274 | /* 8 */ |
265 | | -/***/ function(module, exports) { |
266 | | - |
267 | | - module.exports = require("net"); |
268 | | - |
269 | | -/***/ }, |
270 | | -/* 9 */ |
271 | | -/***/ function(module, exports) { |
272 | | - |
273 | | - module.exports = require("readline"); |
274 | | - |
275 | | -/***/ }, |
276 | | -/* 10 */ |
277 | 275 | /***/ function(module, exports, __webpack_require__) { |
278 | 276 |
|
279 | 277 | "use strict"; |
280 | | - var events_1 = __webpack_require__(11); |
281 | | - var VirtualConnection_1 = __webpack_require__(12); |
| 278 | + var events_1 = __webpack_require__(9); |
| 279 | + var VirtualConnection_1 = __webpack_require__(10); |
282 | 280 | // Keep this in sync with the equivalent constant in the .NET code. Both sides split up their transmissions into frames with this max length, |
283 | 281 | // and both will reject longer frames. |
284 | 282 | var MaxFrameBodyLength = 16 * 1024; |
|
460 | 458 |
|
461 | 459 |
|
462 | 460 | /***/ }, |
463 | | -/* 11 */ |
| 461 | +/* 9 */ |
464 | 462 | /***/ function(module, exports) { |
465 | 463 |
|
466 | 464 | module.exports = require("events"); |
467 | 465 |
|
468 | 466 | /***/ }, |
469 | | -/* 12 */ |
| 467 | +/* 10 */ |
470 | 468 | /***/ function(module, exports, __webpack_require__) { |
471 | 469 |
|
472 | 470 | "use strict"; |
|
475 | 473 | function __() { this.constructor = d; } |
476 | 474 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
477 | 475 | }; |
478 | | - var stream_1 = __webpack_require__(13); |
| 476 | + var stream_1 = __webpack_require__(11); |
479 | 477 | /** |
480 | 478 | * Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection. |
481 | 479 | */ |
482 | 480 | var VirtualConnection = (function (_super) { |
483 | 481 | __extends(VirtualConnection, _super); |
484 | 482 | function VirtualConnection(_beginWriteCallback) { |
485 | | - _super.call(this); |
486 | | - this._beginWriteCallback = _beginWriteCallback; |
487 | | - this._flowing = false; |
488 | | - this._receivedDataQueue = []; |
| 483 | + var _this = _super.call(this) || this; |
| 484 | + _this._beginWriteCallback = _beginWriteCallback; |
| 485 | + _this._flowing = false; |
| 486 | + _this._receivedDataQueue = []; |
| 487 | + return _this; |
489 | 488 | } |
490 | 489 | VirtualConnection.prototype._read = function () { |
491 | 490 | this._flowing = true; |
|
516 | 515 |
|
517 | 516 |
|
518 | 517 | /***/ }, |
519 | | -/* 13 */ |
| 518 | +/* 11 */ |
520 | 519 | /***/ function(module, exports) { |
521 | 520 |
|
522 | 521 | module.exports = require("stream"); |
|
0 commit comments