mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Update NodeServices/SpaServices/NodeServices.Sockets to build using latest TypeScript and Webpack (#1748)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
4230
src/Microsoft.AspNetCore.NodeServices.Sockets/package-lock.json
generated
Normal file
4230
src/Microsoft.AspNetCore.NodeServices.Sockets/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "./node_modules/.bin/webpack"
|
"build": "webpack --mode production"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^6.0.42",
|
"@types/node": "^10.9.2",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^4.5.0",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^3.0.1",
|
||||||
"webpack": "^1.13.1"
|
"webpack": "^4.17.1",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
externals: ['fs', 'net', 'events', 'readline', 'stream'],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [ '.ts' ]
|
extensions: [ '.ts' ]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{ test: /\.ts$/, loader: 'ts-loader' },
|
{ test: /\.ts$/, use: 'ts-loader' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
@@ -14,7 +15,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs',
|
libraryTarget: 'commonjs',
|
||||||
path: './Content/Node',
|
path: path.join(__dirname, 'Content', 'Node'),
|
||||||
filename: '[name].js'
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,361 +1,416 @@
|
|||||||
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
||||||
/******/ // The module cache
|
/******/ // The module cache
|
||||||
/******/ var installedModules = {};
|
/******/ var installedModules = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ function __webpack_require__(moduleId) {
|
/******/ function __webpack_require__(moduleId) {
|
||||||
|
/******/
|
||||||
/******/ // Check if module is in cache
|
/******/ // Check if module is in cache
|
||||||
/******/ if(installedModules[moduleId])
|
/******/ if(installedModules[moduleId]) {
|
||||||
/******/ return installedModules[moduleId].exports;
|
/******/ return installedModules[moduleId].exports;
|
||||||
|
/******/ }
|
||||||
/******/ // Create a new module (and put it into the cache)
|
/******/ // Create a new module (and put it into the cache)
|
||||||
/******/ var module = installedModules[moduleId] = {
|
/******/ var module = installedModules[moduleId] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ exports: {}
|
||||||
/******/ };
|
/******/ };
|
||||||
|
/******/
|
||||||
/******/ // Execute the module function
|
/******/ // Execute the module function
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // Return the exports of the module
|
/******/ // Return the exports of the module
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/ }
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // expose the modules object (__webpack_modules__)
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) {
|
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if(mode & 8) return value;
|
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||||
|
/******/
|
||||||
/******/ // __webpack_public_path__
|
/******/ // __webpack_public_path__
|
||||||
/******/ __webpack_require__.p = "";
|
/******/ __webpack_require__.p = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(0);
|
/******/ return __webpack_require__(__webpack_require__.s = 1);
|
||||||
/******/ })
|
/******/ })
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ([
|
/******/ ([
|
||||||
/* 0 */
|
/* 0 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = __webpack_require__(1);
|
module.exports = require("path");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/***/ },
|
|
||||||
/* 1 */
|
/* 1 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
module.exports = __webpack_require__(2);
|
||||||
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
|
||||||
// but simplifies things for the consumer of this module.
|
|
||||||
__webpack_require__(2);
|
|
||||||
__webpack_require__(4);
|
|
||||||
var http = __webpack_require__(5);
|
|
||||||
var path = __webpack_require__(3);
|
|
||||||
var ArgsUtil_1 = __webpack_require__(6);
|
|
||||||
var ExitWhenParentExits_1 = __webpack_require__(7);
|
|
||||||
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
|
||||||
// reference to Node's runtime 'require' function.
|
|
||||||
var dynamicRequire = eval('require');
|
|
||||||
var server = http.createServer(function (req, res) {
|
|
||||||
readRequestBodyAsJson(req, function (bodyJson) {
|
|
||||||
var hasSentResult = false;
|
|
||||||
var callback = function (errorValue, successValue) {
|
|
||||||
if (!hasSentResult) {
|
|
||||||
hasSentResult = true;
|
|
||||||
if (errorValue) {
|
|
||||||
respondWithError(res, errorValue);
|
|
||||||
}
|
|
||||||
else if (typeof successValue !== 'string') {
|
|
||||||
// Arbitrary object/number/etc - JSON-serialize it
|
|
||||||
var successValueJson = void 0;
|
|
||||||
try {
|
|
||||||
successValueJson = JSON.stringify(successValue);
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
// JSON serialization error - pass it back to .NET
|
|
||||||
respondWithError(res, ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
res.setHeader('Content-Type', 'application/json');
|
|
||||||
res.end(successValueJson);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// String - can bypass JSON-serialization altogether
|
|
||||||
res.setHeader('Content-Type', 'text/plain');
|
|
||||||
res.end(successValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// Support streamed responses
|
|
||||||
Object.defineProperty(callback, 'stream', {
|
|
||||||
enumerable: true,
|
|
||||||
get: function () {
|
|
||||||
if (!hasSentResult) {
|
|
||||||
hasSentResult = true;
|
|
||||||
res.setHeader('Content-Type', 'application/octet-stream');
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
var resolvedPath = path.resolve(process.cwd(), bodyJson.moduleName);
|
|
||||||
var invokedModule = dynamicRequire(resolvedPath);
|
|
||||||
var func = bodyJson.exportedFunctionName ? invokedModule[bodyJson.exportedFunctionName] : invokedModule;
|
|
||||||
if (!func) {
|
|
||||||
throw new Error('The module "' + resolvedPath + '" has no export named "' + bodyJson.exportedFunctionName + '"');
|
|
||||||
}
|
|
||||||
func.apply(null, [callback].concat(bodyJson.args));
|
|
||||||
}
|
|
||||||
catch (synchronousException) {
|
|
||||||
callback(synchronousException, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
|
||||||
var requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
|
||||||
server.listen(requestedPortOrZero, 'localhost', function () {
|
|
||||||
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + server.address().address + '} port ' + server.address().port + '\]');
|
|
||||||
// Signal to the NodeServices base class that we're ready to accept invocations
|
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
|
||||||
});
|
|
||||||
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
|
|
||||||
function readRequestBodyAsJson(request, callback) {
|
|
||||||
var requestBodyAsString = '';
|
|
||||||
request.on('data', function (chunk) { requestBodyAsString += chunk; });
|
|
||||||
request.on('end', function () { callback(JSON.parse(requestBodyAsString)); });
|
|
||||||
}
|
|
||||||
function respondWithError(res, errorValue) {
|
|
||||||
res.statusCode = 500;
|
|
||||||
res.end(JSON.stringify({
|
|
||||||
errorMessage: errorValue.message || errorValue,
|
|
||||||
errorDetails: errorValue.stack || null
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 2 */
|
/* 2 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var path = __webpack_require__(3);
|
|
||||||
var startsWith = function (str, prefix) { return str.substring(0, prefix.length) === prefix; };
|
exports.__esModule = true;
|
||||||
var appRootDir = process.cwd();
|
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
||||||
function patchedLStat(pathToStatLong, fsReqWrap) {
|
// but simplifies things for the consumer of this module.
|
||||||
try {
|
__webpack_require__(3);
|
||||||
// If the lstat completes without errors, we don't modify its behavior at all
|
__webpack_require__(4);
|
||||||
return origLStat.apply(this, arguments);
|
var http = __webpack_require__(5);
|
||||||
}
|
var path = __webpack_require__(0);
|
||||||
catch (ex) {
|
var ArgsUtil_1 = __webpack_require__(6);
|
||||||
var shouldOverrideError = startsWith(ex.message, 'EPERM') // It's a permissions error
|
var ExitWhenParentExits_1 = __webpack_require__(7);
|
||||||
&& typeof appRootDirLong === 'string'
|
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
||||||
&& startsWith(appRootDirLong, pathToStatLong) // ... for an ancestor directory
|
// reference to Node's runtime 'require' function.
|
||||||
&& ex.stack.indexOf('Object.realpathSync ') >= 0; // ... during symlink resolution
|
var dynamicRequire = eval('require');
|
||||||
if (shouldOverrideError) {
|
var server = http.createServer(function (req, res) {
|
||||||
// Fake the result to give the same result as an 'lstat' on the app root dir.
|
readRequestBodyAsJson(req, function (bodyJson) {
|
||||||
// This stops Node failing to load modules just because it doesn't know whether
|
var hasSentResult = false;
|
||||||
// ancestor directories are symlinks or not. If there's a genuine file
|
var callback = function (errorValue, successValue) {
|
||||||
// permissions issue, it will still surface later when Node actually
|
if (!hasSentResult) {
|
||||||
// tries to read the file.
|
hasSentResult = true;
|
||||||
return origLStat.call(this, appRootDir, fsReqWrap);
|
if (errorValue) {
|
||||||
}
|
respondWithError(res, errorValue);
|
||||||
else {
|
}
|
||||||
// In any other case, preserve the original error
|
else if (typeof successValue !== 'string') {
|
||||||
throw ex;
|
// Arbitrary object/number/etc - JSON-serialize it
|
||||||
}
|
var successValueJson = void 0;
|
||||||
}
|
try {
|
||||||
}
|
successValueJson = JSON.stringify(successValue);
|
||||||
;
|
}
|
||||||
// It's only necessary to apply this workaround on Windows
|
catch (ex) {
|
||||||
var appRootDirLong = null;
|
// JSON serialization error - pass it back to .NET
|
||||||
var origLStat = null;
|
respondWithError(res, ex);
|
||||||
if (/^win/.test(process.platform)) {
|
return;
|
||||||
try {
|
}
|
||||||
// Get the app's root dir in Node's internal "long" format (e.g., \\?\C:\dir\subdir)
|
res.setHeader('Content-Type', 'application/json');
|
||||||
appRootDirLong = path._makeLong(appRootDir);
|
res.end(successValueJson);
|
||||||
// Actually apply the patch, being as defensive as possible
|
}
|
||||||
var bindingFs = process.binding('fs');
|
else {
|
||||||
origLStat = bindingFs.lstat;
|
// String - can bypass JSON-serialization altogether
|
||||||
if (typeof origLStat === 'function') {
|
res.setHeader('Content-Type', 'text/plain');
|
||||||
bindingFs.lstat = patchedLStat;
|
res.end(successValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ex) {
|
};
|
||||||
}
|
// Support streamed responses
|
||||||
}
|
Object.defineProperty(callback, 'stream', {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
if (!hasSentResult) {
|
||||||
|
hasSentResult = true;
|
||||||
|
res.setHeader('Content-Type', 'application/octet-stream');
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
var resolvedPath = path.resolve(process.cwd(), bodyJson.moduleName);
|
||||||
|
var invokedModule = dynamicRequire(resolvedPath);
|
||||||
|
var func = bodyJson.exportedFunctionName ? invokedModule[bodyJson.exportedFunctionName] : invokedModule;
|
||||||
|
if (!func) {
|
||||||
|
throw new Error('The module "' + resolvedPath + '" has no export named "' + bodyJson.exportedFunctionName + '"');
|
||||||
|
}
|
||||||
|
func.apply(null, [callback].concat(bodyJson.args));
|
||||||
|
}
|
||||||
|
catch (synchronousException) {
|
||||||
|
callback(synchronousException, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
||||||
|
var requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
||||||
|
server.listen(requestedPortOrZero, 'localhost', function () {
|
||||||
|
var addressInfo = server.address();
|
||||||
|
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
||||||
|
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + addressInfo.address + '} port ' + addressInfo.port + '\]');
|
||||||
|
// Signal to the NodeServices base class that we're ready to accept invocations
|
||||||
|
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||||
|
});
|
||||||
|
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
|
||||||
|
function readRequestBodyAsJson(request, callback) {
|
||||||
|
var requestBodyAsString = '';
|
||||||
|
request.on('data', function (chunk) { requestBodyAsString += chunk; });
|
||||||
|
request.on('end', function () { callback(JSON.parse(requestBodyAsString)); });
|
||||||
|
}
|
||||||
|
function respondWithError(res, errorValue) {
|
||||||
|
res.statusCode = 500;
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
errorMessage: errorValue.message || errorValue,
|
||||||
|
errorDetails: errorValue.stack || null
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 3 */
|
/* 3 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
module.exports = require("path");
|
"use strict";
|
||||||
|
|
||||||
/***/ },
|
exports.__esModule = true;
|
||||||
|
var path = __webpack_require__(0);
|
||||||
|
var startsWith = function (str, prefix) { return str.substring(0, prefix.length) === prefix; };
|
||||||
|
var appRootDir = process.cwd();
|
||||||
|
function patchedLStat(pathToStatLong, fsReqWrap) {
|
||||||
|
try {
|
||||||
|
// If the lstat completes without errors, we don't modify its behavior at all
|
||||||
|
return origLStat.apply(this, arguments);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
var shouldOverrideError = startsWith(ex.message, 'EPERM') // It's a permissions error
|
||||||
|
&& typeof appRootDirLong === 'string'
|
||||||
|
&& startsWith(appRootDirLong, pathToStatLong) // ... for an ancestor directory
|
||||||
|
&& ex.stack.indexOf('Object.realpathSync ') >= 0; // ... during symlink resolution
|
||||||
|
if (shouldOverrideError) {
|
||||||
|
// Fake the result to give the same result as an 'lstat' on the app root dir.
|
||||||
|
// This stops Node failing to load modules just because it doesn't know whether
|
||||||
|
// ancestor directories are symlinks or not. If there's a genuine file
|
||||||
|
// permissions issue, it will still surface later when Node actually
|
||||||
|
// tries to read the file.
|
||||||
|
return origLStat.call(this, appRootDir, fsReqWrap);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// In any other case, preserve the original error
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
// It's only necessary to apply this workaround on Windows
|
||||||
|
var appRootDirLong = null;
|
||||||
|
var origLStat = null;
|
||||||
|
if (/^win/.test(process.platform)) {
|
||||||
|
try {
|
||||||
|
// Get the app's root dir in Node's internal "long" format (e.g., \\?\C:\dir\subdir)
|
||||||
|
appRootDirLong = path._makeLong(appRootDir);
|
||||||
|
// Actually apply the patch, being as defensive as possible
|
||||||
|
var bindingFs = process.binding('fs');
|
||||||
|
origLStat = bindingFs.lstat;
|
||||||
|
if (typeof origLStat === 'function') {
|
||||||
|
bindingFs.lstat = patchedLStat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
// If some future version of Node throws (e.g., to prevent use of process.binding()),
|
||||||
|
// don't apply the patch, but still let the application run.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/* 4 */
|
/* 4 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
// When Node writes to stdout/strerr, we capture that and convert the lines into calls on the
|
// When Node writes to stdout/strerr, we capture that and convert the lines into calls on the
|
||||||
// active .NET ILogger. But by default, stdout/stderr don't have any way of distinguishing
|
// active .NET ILogger. But by default, stdout/stderr don't have any way of distinguishing
|
||||||
// linebreaks inside log messages from the linebreaks that delimit separate log messages,
|
// linebreaks inside log messages from the linebreaks that delimit separate log messages,
|
||||||
// so multiline strings will end up being written to the ILogger as multiple independent
|
// so multiline strings will end up being written to the ILogger as multiple independent
|
||||||
// log messages. This makes them very hard to make sense of, especially when they represent
|
// log messages. This makes them very hard to make sense of, especially when they represent
|
||||||
// something like stack traces.
|
// something like stack traces.
|
||||||
//
|
//
|
||||||
// To fix this, we intercept stdout/stderr writes, and replace internal linebreaks with a
|
// To fix this, we intercept stdout/stderr writes, and replace internal linebreaks with a
|
||||||
// marker token. When .NET receives the lines, it converts the marker tokens back to regular
|
// marker token. When .NET receives the lines, it converts the marker tokens back to regular
|
||||||
// linebreaks within the logged messages.
|
// linebreaks within the logged messages.
|
||||||
//
|
//
|
||||||
// Note that it's better to do the interception at the stdout/stderr level, rather than at
|
// Note that it's better to do the interception at the stdout/stderr level, rather than at
|
||||||
// the console.log/console.error (etc.) level, because this takes place after any native
|
// the console.log/console.error (etc.) level, because this takes place after any native
|
||||||
// message formatting has taken place (e.g., inserting values for % placeholders).
|
// message formatting has taken place (e.g., inserting values for % placeholders).
|
||||||
var findInternalNewlinesRegex = /\n(?!$)/g;
|
var findInternalNewlinesRegex = /\n(?!$)/g;
|
||||||
var encodedNewline = '__ns_newline__';
|
var encodedNewline = '__ns_newline__';
|
||||||
encodeNewlinesWrittenToStream(process.stdout);
|
encodeNewlinesWrittenToStream(process.stdout);
|
||||||
encodeNewlinesWrittenToStream(process.stderr);
|
encodeNewlinesWrittenToStream(process.stderr);
|
||||||
function encodeNewlinesWrittenToStream(outputStream) {
|
function encodeNewlinesWrittenToStream(outputStream) {
|
||||||
var origWriteFunction = outputStream.write;
|
var origWriteFunction = outputStream.write;
|
||||||
outputStream.write = function (value) {
|
outputStream.write = function (value) {
|
||||||
// Only interfere with the write if it's definitely a string
|
// Only interfere with the write if it's definitely a string
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
var argsClone = Array.prototype.slice.call(arguments, 0);
|
var argsClone = Array.prototype.slice.call(arguments, 0);
|
||||||
argsClone[0] = encodeNewlinesInString(value);
|
argsClone[0] = encodeNewlinesInString(value);
|
||||||
origWriteFunction.apply(this, argsClone);
|
origWriteFunction.apply(this, argsClone);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
origWriteFunction.apply(this, arguments);
|
origWriteFunction.apply(this, arguments);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function encodeNewlinesInString(str) {
|
function encodeNewlinesInString(str) {
|
||||||
return str.replace(findInternalNewlinesRegex, encodedNewline);
|
return str.replace(findInternalNewlinesRegex, encodedNewline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 5 */
|
/* 5 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("http");
|
module.exports = require("http");
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 6 */
|
/* 6 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
function parseArgs(args) {
|
|
||||||
// Very simplistic parsing which is sufficient for the cases needed. We don't want to bring in any external
|
exports.__esModule = true;
|
||||||
// dependencies (such as an args-parsing library) to this file.
|
function parseArgs(args) {
|
||||||
var result = {};
|
// Very simplistic parsing which is sufficient for the cases needed. We don't want to bring in any external
|
||||||
var currentKey = null;
|
// dependencies (such as an args-parsing library) to this file.
|
||||||
args.forEach(function (arg) {
|
var result = {};
|
||||||
if (arg.indexOf('--') === 0) {
|
var currentKey = null;
|
||||||
var argName = arg.substring(2);
|
args.forEach(function (arg) {
|
||||||
result[argName] = undefined;
|
if (arg.indexOf('--') === 0) {
|
||||||
currentKey = argName;
|
var argName = arg.substring(2);
|
||||||
}
|
result[argName] = undefined;
|
||||||
else if (currentKey) {
|
currentKey = argName;
|
||||||
result[currentKey] = arg;
|
}
|
||||||
currentKey = null;
|
else if (currentKey) {
|
||||||
}
|
result[currentKey] = arg;
|
||||||
});
|
currentKey = null;
|
||||||
return result;
|
}
|
||||||
}
|
});
|
||||||
exports.parseArgs = parseArgs;
|
return result;
|
||||||
|
}
|
||||||
|
exports.parseArgs = parseArgs;
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 7 */
|
/* 7 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
/*
|
"use strict";
|
||||||
In general, we want the Node child processes to be terminated as soon as the parent .NET processes exit,
|
|
||||||
because we have no further use for them. If the .NET process shuts down gracefully, it will run its
|
|
||||||
finalizers, one of which (in OutOfProcessNodeInstance.cs) will kill its associated Node process immediately.
|
|
||||||
|
|
||||||
But if the .NET process is terminated forcefully (e.g., on Linux/OSX with 'kill -9'), then it won't have
|
/*
|
||||||
any opportunity to shut down its child processes, and by default they will keep running. In this case, it's
|
In general, we want the Node child processes to be terminated as soon as the parent .NET processes exit,
|
||||||
up to the child process to detect this has happened and terminate itself.
|
because we have no further use for them. If the .NET process shuts down gracefully, it will run its
|
||||||
|
finalizers, one of which (in OutOfProcessNodeInstance.cs) will kill its associated Node process immediately.
|
||||||
|
|
||||||
There are many possible approaches to detecting when a parent process has exited, most of which behave
|
But if the .NET process is terminated forcefully (e.g., on Linux/OSX with 'kill -9'), then it won't have
|
||||||
differently between Windows and Linux/OS X:
|
any opportunity to shut down its child processes, and by default they will keep running. In this case, it's
|
||||||
|
up to the child process to detect this has happened and terminate itself.
|
||||||
|
|
||||||
- On Windows, the parent process can mark its child as being a 'job' that should auto-terminate when
|
There are many possible approaches to detecting when a parent process has exited, most of which behave
|
||||||
the parent does (http://stackoverflow.com/a/4657392). Not cross-platform.
|
differently between Windows and Linux/OS X:
|
||||||
- The child Node process can get a callback when the parent disconnects (process.on('disconnect', ...)).
|
|
||||||
But despite http://stackoverflow.com/a/16487966, no callback fires in any case I've tested (Windows / OS X).
|
|
||||||
- The child Node process can get a callback when its stdin/stdout are disconnected, as described at
|
|
||||||
http://stackoverflow.com/a/15693934. This works well on OS X, but calling stdout.resume() on Windows
|
|
||||||
causes the process to terminate prematurely.
|
|
||||||
- I don't know why, but on Windows, it's enough to invoke process.stdin.resume(). For some reason this causes
|
|
||||||
the child Node process to exit as soon as the parent one does, but I don't see this documented anywhere.
|
|
||||||
- You can poll to see if the parent process, or your stdin/stdout connection to it, is gone
|
|
||||||
- You can directly pass a parent process PID to the child, and then have the child poll to see if it's
|
|
||||||
still running (e.g., using process.kill(pid, 0), which doesn't kill it but just tests whether it exists,
|
|
||||||
as per https://nodejs.org/api/process.html#process_process_kill_pid_signal)
|
|
||||||
- Or, on each poll, you can try writing to process.stdout. If the parent has died, then this will throw.
|
|
||||||
However I don't see this documented anywhere. It would be nice if you could just poll for whether or not
|
|
||||||
process.stdout is still connected (without actually writing to it) but I haven't found any property whose
|
|
||||||
value changes until you actually try to write to it.
|
|
||||||
|
|
||||||
Of these, the only cross-platform approach that is actually documented as a valid strategy is simply polling
|
- On Windows, the parent process can mark its child as being a 'job' that should auto-terminate when
|
||||||
to check whether the parent PID is still running. So that's what we do here.
|
the parent does (http://stackoverflow.com/a/4657392). Not cross-platform.
|
||||||
*/
|
- The child Node process can get a callback when the parent disconnects (process.on('disconnect', ...)).
|
||||||
"use strict";
|
But despite http://stackoverflow.com/a/16487966, no callback fires in any case I've tested (Windows / OS X).
|
||||||
var pollIntervalMs = 1000;
|
- The child Node process can get a callback when its stdin/stdout are disconnected, as described at
|
||||||
function exitWhenParentExits(parentPid, ignoreSigint) {
|
http://stackoverflow.com/a/15693934. This works well on OS X, but calling stdout.resume() on Windows
|
||||||
setInterval(function () {
|
causes the process to terminate prematurely.
|
||||||
if (!processExists(parentPid)) {
|
- I don't know why, but on Windows, it's enough to invoke process.stdin.resume(). For some reason this causes
|
||||||
// Can't log anything at this point, because out stdout was connected to the parent,
|
the child Node process to exit as soon as the parent one does, but I don't see this documented anywhere.
|
||||||
// but the parent is gone.
|
- You can poll to see if the parent process, or your stdin/stdout connection to it, is gone
|
||||||
process.exit();
|
- You can directly pass a parent process PID to the child, and then have the child poll to see if it's
|
||||||
}
|
still running (e.g., using process.kill(pid, 0), which doesn't kill it but just tests whether it exists,
|
||||||
}, pollIntervalMs);
|
as per https://nodejs.org/api/process.html#process_process_kill_pid_signal)
|
||||||
if (ignoreSigint) {
|
- Or, on each poll, you can try writing to process.stdout. If the parent has died, then this will throw.
|
||||||
// Pressing ctrl+c in the terminal sends a SIGINT to all processes in the foreground process tree.
|
However I don't see this documented anywhere. It would be nice if you could just poll for whether or not
|
||||||
// By default, the Node process would then exit before the .NET process, because ASP.NET implements
|
process.stdout is still connected (without actually writing to it) but I haven't found any property whose
|
||||||
// a delayed shutdown to allow ongoing requests to complete.
|
value changes until you actually try to write to it.
|
||||||
//
|
|
||||||
// This is problematic, because if Node exits first, the CopyToAsync code in ConditionalProxyMiddleware
|
Of these, the only cross-platform approach that is actually documented as a valid strategy is simply polling
|
||||||
// will experience a read fault, and logs a huge load of errors. Fortunately, since the Node process is
|
to check whether the parent PID is still running. So that's what we do here.
|
||||||
// already set up to shut itself down if it detects the .NET process is terminated, all we have to do is
|
*/
|
||||||
// ignore the SIGINT. The Node process will then terminate automatically after the .NET process does.
|
exports.__esModule = true;
|
||||||
//
|
var pollIntervalMs = 1000;
|
||||||
// A better solution would be to have WebpackDevMiddleware listen for SIGINT and gracefully close any
|
function exitWhenParentExits(parentPid, ignoreSigint) {
|
||||||
// ongoing EventSource connections before letting the Node process exit, independently of the .NET
|
setInterval(function () {
|
||||||
// process exiting. However, doing this well in general is very nontrivial (see all the discussion at
|
if (!processExists(parentPid)) {
|
||||||
// https://github.com/nodejs/node/issues/2642).
|
// Can't log anything at this point, because out stdout was connected to the parent,
|
||||||
process.on('SIGINT', function () {
|
// but the parent is gone.
|
||||||
console.log('Received SIGINT. Waiting for .NET process to exit...');
|
process.exit();
|
||||||
});
|
}
|
||||||
}
|
}, pollIntervalMs);
|
||||||
}
|
if (ignoreSigint) {
|
||||||
exports.exitWhenParentExits = exitWhenParentExits;
|
// Pressing ctrl+c in the terminal sends a SIGINT to all processes in the foreground process tree.
|
||||||
function processExists(pid) {
|
// By default, the Node process would then exit before the .NET process, because ASP.NET implements
|
||||||
try {
|
// a delayed shutdown to allow ongoing requests to complete.
|
||||||
// Sending signal 0 - on all platforms - tests whether the process exists. As long as it doesn't
|
//
|
||||||
// throw, that means it does exist.
|
// This is problematic, because if Node exits first, the CopyToAsync code in ConditionalProxyMiddleware
|
||||||
process.kill(pid, 0);
|
// will experience a read fault, and logs a huge load of errors. Fortunately, since the Node process is
|
||||||
return true;
|
// already set up to shut itself down if it detects the .NET process is terminated, all we have to do is
|
||||||
}
|
// ignore the SIGINT. The Node process will then terminate automatically after the .NET process does.
|
||||||
catch (ex) {
|
//
|
||||||
// If the reason for the error is that we don't have permission to ask about this process,
|
// A better solution would be to have WebpackDevMiddleware listen for SIGINT and gracefully close any
|
||||||
// report that as a separate problem.
|
// ongoing EventSource connections before letting the Node process exit, independently of the .NET
|
||||||
if (ex.code === 'EPERM') {
|
// process exiting. However, doing this well in general is very nontrivial (see all the discussion at
|
||||||
throw new Error("Attempted to check whether process " + pid + " was running, but got a permissions error.");
|
// https://github.com/nodejs/node/issues/2642).
|
||||||
}
|
process.on('SIGINT', function () {
|
||||||
return false;
|
console.log('Received SIGINT. Waiting for .NET process to exit...');
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
exports.exitWhenParentExits = exitWhenParentExits;
|
||||||
|
function processExists(pid) {
|
||||||
|
try {
|
||||||
|
// Sending signal 0 - on all platforms - tests whether the process exists. As long as it doesn't
|
||||||
|
// throw, that means it does exist.
|
||||||
|
process.kill(pid, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
// If the reason for the error is that we don't have permission to ask about this process,
|
||||||
|
// report that as a separate problem.
|
||||||
|
if (ex.code === 'EPERM') {
|
||||||
|
throw new Error("Attempted to check whether process " + pid + " was running, but got a permissions error.");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }
|
/***/ })
|
||||||
/******/ ])));
|
/******/ ])));
|
||||||
@@ -6,6 +6,7 @@ import * as http from 'http';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { parseArgs } from './Util/ArgsUtil';
|
import { parseArgs } from './Util/ArgsUtil';
|
||||||
import { exitWhenParentExits } from './Util/ExitWhenParentExits';
|
import { exitWhenParentExits } from './Util/ExitWhenParentExits';
|
||||||
|
import { AddressInfo } from 'net';
|
||||||
|
|
||||||
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
||||||
// reference to Node's runtime 'require' function.
|
// reference to Node's runtime 'require' function.
|
||||||
@@ -70,8 +71,10 @@ const server = http.createServer((req, res) => {
|
|||||||
const parsedArgs = parseArgs(process.argv);
|
const parsedArgs = parseArgs(process.argv);
|
||||||
const requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
const requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
||||||
server.listen(requestedPortOrZero, 'localhost', function () {
|
server.listen(requestedPortOrZero, 'localhost', function () {
|
||||||
|
const addressInfo = server.address() as AddressInfo;
|
||||||
|
|
||||||
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + server.address().address + '} port ' + server.address().port + '\]');
|
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + addressInfo.address + '} port ' + addressInfo.port + '\]');
|
||||||
|
|
||||||
// Signal to the NodeServices base class that we're ready to accept invocations
|
// Signal to the NodeServices base class that we're ready to accept invocations
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||||
|
|||||||
4230
src/Microsoft.AspNetCore.NodeServices/package-lock.json
generated
Normal file
4230
src/Microsoft.AspNetCore.NodeServices/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "./node_modules/.bin/webpack"
|
"build": "webpack --mode production"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^6.0.42",
|
"@types/node": "^10.9.2",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^4.5.0",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^3.0.1",
|
||||||
"webpack": "^1.13.1"
|
"webpack": "^4.17.1",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
externals: ['fs', 'net', 'events', 'readline', 'stream'],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [ '.ts' ]
|
extensions: [ '.ts' ]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{ test: /\.ts$/, loader: 'ts-loader' },
|
{ test: /\.ts$/, use: 'ts-loader' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
@@ -14,7 +15,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs',
|
libraryTarget: 'commonjs',
|
||||||
path: './Content/Node',
|
path: path.join(__dirname, 'Content', 'Node'),
|
||||||
filename: '[name].js'
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,178 +1,224 @@
|
|||||||
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
||||||
/******/ // The module cache
|
/******/ // The module cache
|
||||||
/******/ var installedModules = {};
|
/******/ var installedModules = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ function __webpack_require__(moduleId) {
|
/******/ function __webpack_require__(moduleId) {
|
||||||
|
/******/
|
||||||
/******/ // Check if module is in cache
|
/******/ // Check if module is in cache
|
||||||
/******/ if(installedModules[moduleId])
|
/******/ if(installedModules[moduleId]) {
|
||||||
/******/ return installedModules[moduleId].exports;
|
/******/ return installedModules[moduleId].exports;
|
||||||
|
/******/ }
|
||||||
/******/ // Create a new module (and put it into the cache)
|
/******/ // Create a new module (and put it into the cache)
|
||||||
/******/ var module = installedModules[moduleId] = {
|
/******/ var module = installedModules[moduleId] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ exports: {}
|
||||||
/******/ };
|
/******/ };
|
||||||
|
/******/
|
||||||
/******/ // Execute the module function
|
/******/ // Execute the module function
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // Return the exports of the module
|
/******/ // Return the exports of the module
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/ }
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // expose the modules object (__webpack_modules__)
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) {
|
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if(mode & 8) return value;
|
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||||
|
/******/
|
||||||
/******/ // __webpack_public_path__
|
/******/ // __webpack_public_path__
|
||||||
/******/ __webpack_require__.p = "";
|
/******/ __webpack_require__.p = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(0);
|
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||||
/******/ })
|
/******/ })
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ([
|
/******/ ([
|
||||||
/* 0 */
|
/* 0 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
module.exports = __webpack_require__(1);
|
module.exports = __webpack_require__(1);
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 1 */
|
/* 1 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var path = __webpack_require__(2);
|
|
||||||
// Separate declaration and export just to add type checking on function signature
|
exports.__esModule = true;
|
||||||
exports.renderToString = renderToStringImpl;
|
var path = __webpack_require__(2);
|
||||||
// This function is invoked by .NET code (via NodeServices). Its job is to hand off execution to the application's
|
// Separate declaration and export just to add type checking on function signature
|
||||||
// prerendering boot function. It can operate in two modes:
|
exports.renderToString = renderToStringImpl;
|
||||||
// [1] Legacy mode
|
// This function is invoked by .NET code (via NodeServices). Its job is to hand off execution to the application's
|
||||||
// This is for backward compatibility with projects created with templates older than the generator version 0.6.0.
|
// prerendering boot function. It can operate in two modes:
|
||||||
// In this mode, we don't really do anything here - we just load the 'aspnet-prerendering' NPM module (which must
|
// [1] Legacy mode
|
||||||
// exist in node_modules, and must be v1.x (not v2+)), and pass through all the parameters to it. Code in
|
// This is for backward compatibility with projects created with templates older than the generator version 0.6.0.
|
||||||
// 'aspnet-prerendering' v1.x will locate the boot function and invoke it.
|
// In this mode, we don't really do anything here - we just load the 'aspnet-prerendering' NPM module (which must
|
||||||
// The drawback to this mode is that, for it to work, you have to deploy node_modules to production.
|
// exist in node_modules, and must be v1.x (not v2+)), and pass through all the parameters to it. Code in
|
||||||
// [2] Current mode
|
// 'aspnet-prerendering' v1.x will locate the boot function and invoke it.
|
||||||
// This is for projects created with the Yeoman generator 0.6.0+ (or projects manually updated). In this mode,
|
// The drawback to this mode is that, for it to work, you have to deploy node_modules to production.
|
||||||
// we don't invoke 'require' at runtime at all. All our dependencies are bundled into the NuGet package, so you
|
// [2] Current mode
|
||||||
// don't have to deploy node_modules to production.
|
// This is for projects created with the Yeoman generator 0.6.0+ (or projects manually updated). In this mode,
|
||||||
// To determine whether we're in mode [1] or [2], the code locates your prerendering boot function, and checks whether
|
// we don't invoke 'require' at runtime at all. All our dependencies are bundled into the NuGet package, so you
|
||||||
// a certain flag is attached to the function instance.
|
// don't have to deploy node_modules to production.
|
||||||
function renderToStringImpl(callback, applicationBasePath, bootModule, absoluteRequestUrl, requestPathAndQuery, customDataParameter, overrideTimeoutMilliseconds) {
|
// To determine whether we're in mode [1] or [2], the code locates your prerendering boot function, and checks whether
|
||||||
try {
|
// a certain flag is attached to the function instance.
|
||||||
var forceLegacy = isLegacyAspNetPrerendering();
|
function renderToStringImpl(callback, applicationBasePath, bootModule, absoluteRequestUrl, requestPathAndQuery, customDataParameter, overrideTimeoutMilliseconds) {
|
||||||
var renderToStringFunc = !forceLegacy && findRenderToStringFunc(applicationBasePath, bootModule);
|
try {
|
||||||
var isNotLegacyMode = renderToStringFunc && renderToStringFunc['isServerRenderer'];
|
var forceLegacy = isLegacyAspNetPrerendering();
|
||||||
if (isNotLegacyMode) {
|
var renderToStringFunc = !forceLegacy && findRenderToStringFunc(applicationBasePath, bootModule);
|
||||||
// Current (non-legacy) mode - we invoke the exported function directly (instead of going through aspnet-prerendering)
|
var isNotLegacyMode = renderToStringFunc && renderToStringFunc['isServerRenderer'];
|
||||||
// It's type-safe to just apply the incoming args to this function, because we already type-checked that it's a RenderToStringFunc,
|
if (isNotLegacyMode) {
|
||||||
// just like renderToStringImpl itself is.
|
// Current (non-legacy) mode - we invoke the exported function directly (instead of going through aspnet-prerendering)
|
||||||
renderToStringFunc.apply(null, arguments);
|
// It's type-safe to just apply the incoming args to this function, because we already type-checked that it's a RenderToStringFunc,
|
||||||
}
|
// just like renderToStringImpl itself is.
|
||||||
else {
|
renderToStringFunc.apply(null, arguments);
|
||||||
// Legacy mode - just hand off execution to 'aspnet-prerendering' v1.x, which must exist in node_modules at runtime
|
}
|
||||||
var aspNetPrerenderingV1RenderToString = __webpack_require__(3).renderToString;
|
else {
|
||||||
if (aspNetPrerenderingV1RenderToString) {
|
// Legacy mode - just hand off execution to 'aspnet-prerendering' v1.x, which must exist in node_modules at runtime
|
||||||
aspNetPrerenderingV1RenderToString(callback, applicationBasePath, bootModule, absoluteRequestUrl, requestPathAndQuery, customDataParameter, overrideTimeoutMilliseconds);
|
var aspNetPrerenderingV1RenderToString = __webpack_require__(3).renderToString;
|
||||||
}
|
if (aspNetPrerenderingV1RenderToString) {
|
||||||
else {
|
aspNetPrerenderingV1RenderToString(callback, applicationBasePath, bootModule, absoluteRequestUrl, requestPathAndQuery, customDataParameter, overrideTimeoutMilliseconds);
|
||||||
callback('If you use aspnet-prerendering >= 2.0.0, you must update your server-side boot module to call createServerRenderer. '
|
}
|
||||||
+ 'Either update your boot module code, or revert to aspnet-prerendering version 1.x');
|
else {
|
||||||
}
|
callback('If you use aspnet-prerendering >= 2.0.0, you must update your server-side boot module to call createServerRenderer. '
|
||||||
}
|
+ 'Either update your boot module code, or revert to aspnet-prerendering version 1.x');
|
||||||
}
|
}
|
||||||
catch (ex) {
|
}
|
||||||
// Make sure loading errors are reported back to the .NET part of the app
|
}
|
||||||
callback('Prerendering failed because of error: '
|
catch (ex) {
|
||||||
+ ex.stack
|
// Make sure loading errors are reported back to the .NET part of the app
|
||||||
+ '\nCurrent directory is: '
|
callback('Prerendering failed because of error: '
|
||||||
+ process.cwd());
|
+ ex.stack
|
||||||
}
|
+ '\nCurrent directory is: '
|
||||||
}
|
+ process.cwd());
|
||||||
;
|
}
|
||||||
function findBootModule(applicationBasePath, bootModule) {
|
}
|
||||||
var bootModuleNameFullPath = path.resolve(applicationBasePath, bootModule.moduleName);
|
;
|
||||||
if (bootModule.webpackConfig) {
|
function findBootModule(applicationBasePath, bootModule) {
|
||||||
// If you're using asp-prerender-webpack-config, you're definitely in legacy mode
|
var bootModuleNameFullPath = path.resolve(applicationBasePath, bootModule.moduleName);
|
||||||
return null;
|
if (bootModule.webpackConfig) {
|
||||||
}
|
// If you're using asp-prerender-webpack-config, you're definitely in legacy mode
|
||||||
else {
|
return null;
|
||||||
return require(bootModuleNameFullPath);
|
}
|
||||||
}
|
else {
|
||||||
}
|
return require(bootModuleNameFullPath);
|
||||||
function findRenderToStringFunc(applicationBasePath, bootModule) {
|
}
|
||||||
// First try to load the module
|
}
|
||||||
var foundBootModule = findBootModule(applicationBasePath, bootModule);
|
function findRenderToStringFunc(applicationBasePath, bootModule) {
|
||||||
if (foundBootModule === null) {
|
// First try to load the module
|
||||||
return null; // Must be legacy mode
|
var foundBootModule = findBootModule(applicationBasePath, bootModule);
|
||||||
}
|
if (foundBootModule === null) {
|
||||||
// Now try to pick out the function they want us to invoke
|
return null; // Must be legacy mode
|
||||||
var renderToStringFunc;
|
}
|
||||||
if (bootModule.exportName) {
|
// Now try to pick out the function they want us to invoke
|
||||||
// Explicitly-named export
|
var renderToStringFunc;
|
||||||
renderToStringFunc = foundBootModule[bootModule.exportName];
|
if (bootModule.exportName) {
|
||||||
}
|
// Explicitly-named export
|
||||||
else if (typeof foundBootModule !== 'function') {
|
renderToStringFunc = foundBootModule[bootModule.exportName];
|
||||||
// TypeScript-style default export
|
}
|
||||||
renderToStringFunc = foundBootModule.default;
|
else if (typeof foundBootModule !== 'function') {
|
||||||
}
|
// TypeScript-style default export
|
||||||
else {
|
renderToStringFunc = foundBootModule["default"];
|
||||||
// Native default export
|
}
|
||||||
renderToStringFunc = foundBootModule;
|
else {
|
||||||
}
|
// Native default export
|
||||||
// Validate the result
|
renderToStringFunc = foundBootModule;
|
||||||
if (typeof renderToStringFunc !== 'function') {
|
}
|
||||||
if (bootModule.exportName) {
|
// Validate the result
|
||||||
throw new Error("The module at " + bootModule.moduleName + " has no function export named " + bootModule.exportName + ".");
|
if (typeof renderToStringFunc !== 'function') {
|
||||||
}
|
if (bootModule.exportName) {
|
||||||
else {
|
throw new Error("The module at " + bootModule.moduleName + " has no function export named " + bootModule.exportName + ".");
|
||||||
throw new Error("The module at " + bootModule.moduleName + " does not export a default function, and you have not specified which export to invoke.");
|
}
|
||||||
}
|
else {
|
||||||
}
|
throw new Error("The module at " + bootModule.moduleName + " does not export a default function, and you have not specified which export to invoke.");
|
||||||
return renderToStringFunc;
|
}
|
||||||
}
|
}
|
||||||
function isLegacyAspNetPrerendering() {
|
return renderToStringFunc;
|
||||||
var version = getAspNetPrerenderingPackageVersion();
|
}
|
||||||
return version && /^1\./.test(version);
|
function isLegacyAspNetPrerendering() {
|
||||||
}
|
var version = getAspNetPrerenderingPackageVersion();
|
||||||
function getAspNetPrerenderingPackageVersion() {
|
return version && /^1\./.test(version);
|
||||||
try {
|
}
|
||||||
var packageEntryPoint = require.resolve('aspnet-prerendering');
|
function getAspNetPrerenderingPackageVersion() {
|
||||||
var packageDir = path.dirname(packageEntryPoint);
|
try {
|
||||||
var packageJsonPath = path.join(packageDir, 'package.json');
|
var packageEntryPoint = require.resolve('aspnet-prerendering');
|
||||||
var packageJson = require(packageJsonPath);
|
var packageDir = path.dirname(packageEntryPoint);
|
||||||
return packageJson.version.toString();
|
var packageJsonPath = path.join(packageDir, 'package.json');
|
||||||
}
|
var packageJson = require(packageJsonPath);
|
||||||
catch (ex) {
|
return packageJson.version.toString();
|
||||||
// Implies aspnet-prerendering isn't in node_modules at all (or node_modules itself doesn't exist,
|
}
|
||||||
// which will be the case in production based on latest templates).
|
catch (ex) {
|
||||||
return null;
|
// Implies aspnet-prerendering isn't in node_modules at all (or node_modules itself doesn't exist,
|
||||||
}
|
// which will be the case in production based on latest templates).
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 2 */
|
/* 2 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("path");
|
module.exports = require("path");
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 3 */
|
/* 3 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("aspnet-prerendering");
|
module.exports = require("aspnet-prerendering");
|
||||||
|
|
||||||
/***/ }
|
/***/ })
|
||||||
/******/ ])));
|
/******/ ])));
|
||||||
@@ -1,86 +1,133 @@
|
|||||||
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
||||||
/******/ // The module cache
|
/******/ // The module cache
|
||||||
/******/ var installedModules = {};
|
/******/ var installedModules = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ function __webpack_require__(moduleId) {
|
/******/ function __webpack_require__(moduleId) {
|
||||||
|
/******/
|
||||||
/******/ // Check if module is in cache
|
/******/ // Check if module is in cache
|
||||||
/******/ if(installedModules[moduleId])
|
/******/ if(installedModules[moduleId]) {
|
||||||
/******/ return installedModules[moduleId].exports;
|
/******/ return installedModules[moduleId].exports;
|
||||||
|
/******/ }
|
||||||
/******/ // Create a new module (and put it into the cache)
|
/******/ // Create a new module (and put it into the cache)
|
||||||
/******/ var module = installedModules[moduleId] = {
|
/******/ var module = installedModules[moduleId] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ exports: {}
|
||||||
/******/ };
|
/******/ };
|
||||||
|
/******/
|
||||||
/******/ // Execute the module function
|
/******/ // Execute the module function
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // Return the exports of the module
|
/******/ // Return the exports of the module
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/ }
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // expose the modules object (__webpack_modules__)
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) {
|
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if(mode & 8) return value;
|
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||||
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||||
|
/******/
|
||||||
/******/ // __webpack_public_path__
|
/******/ // __webpack_public_path__
|
||||||
/******/ __webpack_require__.p = "";
|
/******/ __webpack_require__.p = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(0);
|
/******/ return __webpack_require__(__webpack_require__.s = 4);
|
||||||
/******/ })
|
/******/ })
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ([
|
/******/ ([
|
||||||
/* 0 */
|
/* 0 */,
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
module.exports = __webpack_require__(4);
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 1 */,
|
/* 1 */,
|
||||||
/* 2 */,
|
/* 2 */,
|
||||||
/* 3 */,
|
/* 3 */,
|
||||||
/* 4 */
|
/* 4 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
module.exports = __webpack_require__(5);
|
||||||
// Pass through the invocation to the 'aspnet-webpack' package, verifying that it can be loaded
|
|
||||||
function createWebpackDevServer(callback) {
|
|
||||||
var aspNetWebpack;
|
|
||||||
try {
|
|
||||||
aspNetWebpack = __webpack_require__(5);
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
// Developers sometimes have trouble with badly-configured Node installations, where it's unable
|
|
||||||
// to find node_modules. Or they accidentally fail to deploy node_modules, or even to run 'npm install'.
|
|
||||||
// Make sure such errors are reported back to the .NET part of the app.
|
|
||||||
callback('Webpack dev middleware failed because of an error while loading \'aspnet-webpack\'. Error was: '
|
|
||||||
+ ex.stack
|
|
||||||
+ '\nCurrent directory is: '
|
|
||||||
+ process.cwd());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return aspNetWebpack.createWebpackDevServer.apply(this, arguments);
|
|
||||||
}
|
|
||||||
exports.createWebpackDevServer = createWebpackDevServer;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 5 */
|
/* 5 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
module.exports = require("aspnet-webpack");
|
"use strict";
|
||||||
|
|
||||||
/***/ }
|
exports.__esModule = true;
|
||||||
|
// Pass through the invocation to the 'aspnet-webpack' package, verifying that it can be loaded
|
||||||
|
function createWebpackDevServer(callback) {
|
||||||
|
var aspNetWebpack;
|
||||||
|
try {
|
||||||
|
aspNetWebpack = __webpack_require__(6);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
// Developers sometimes have trouble with badly-configured Node installations, where it's unable
|
||||||
|
// to find node_modules. Or they accidentally fail to deploy node_modules, or even to run 'npm install'.
|
||||||
|
// Make sure such errors are reported back to the .NET part of the app.
|
||||||
|
callback('Webpack dev middleware failed because of an error while loading \'aspnet-webpack\'. Error was: '
|
||||||
|
+ ex.stack
|
||||||
|
+ '\nCurrent directory is: '
|
||||||
|
+ process.cwd());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return aspNetWebpack.createWebpackDevServer.apply(this, arguments);
|
||||||
|
}
|
||||||
|
exports.createWebpackDevServer = createWebpackDevServer;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
/* 6 */
|
||||||
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
|
module.exports = require("aspnet-webpack");
|
||||||
|
|
||||||
|
/***/ })
|
||||||
/******/ ])));
|
/******/ ])));
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
/// <reference path="../npm/aspnet-prerendering/src/PrerenderingInterfaces.d.ts" />
|
import { BootModuleInfo, RenderToStringFunc, RenderToStringCallback } from '../npm/aspnet-prerendering/src/PrerenderingInterfaces';
|
||||||
import * as url from 'url';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
|
||||||
declare var __non_webpack_require__;
|
declare var __non_webpack_require__;
|
||||||
|
|
||||||
// Separate declaration and export just to add type checking on function signature
|
// Separate declaration and export just to add type checking on function signature
|
||||||
|
|||||||
4230
src/Microsoft.AspNetCore.SpaServices/package-lock.json
generated
Normal file
4230
src/Microsoft.AspNetCore.SpaServices/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "./node_modules/.bin/webpack"
|
"build": "webpack --mode production"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^6.0.42",
|
"@types/node": "^10.9.2",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^4.5.0",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^3.0.1",
|
||||||
"webpack": "^1.13.1"
|
"webpack": "^4.17.1",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
externals: [
|
externals: [
|
||||||
@@ -10,8 +12,8 @@ module.exports = {
|
|||||||
extensions: [ '.ts' ]
|
extensions: [ '.ts' ]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{ test: /\.ts$/, loader: 'ts-loader' },
|
{ test: /\.ts$/, use: 'ts-loader' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
@@ -20,7 +22,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs',
|
libraryTarget: 'commonjs',
|
||||||
path: './Content/Node',
|
path: path.join(__dirname, 'Content', 'Node'),
|
||||||
filename: '[name].js'
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user