From 709ede799cc9820acadaf22aa84f0fe6dd2be319 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 17 Jan 2018 03:30:04 -0800 Subject: [PATCH] Upgrade connect dependency Reviewed By: cpojer Differential Revision: D6732727 fbshipit-source-id: 80181ef184c90e3312789579034d70e2c3bcbf98 --- local-cli/server/runServer.js | 15 ++++++++------- package.json | 6 +++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index 8680de5b0..e092f685a 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -21,9 +21,7 @@ const HmrServer = require('metro/src/HmrServer'); const {Terminal} = require('metro-core'); const attachWebsocketServer = require('./util/attachWebsocketServer'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ +const compression = require('compression'); const connect = require('connect'); const copyToClipBoardMiddleware = require('./middleware/copyToClipBoardMiddleware'); const defaultAssetExts = Metro.defaults.assetExts; @@ -34,6 +32,7 @@ const defaultPlatforms = Metro.defaults.platforms; * run Flow. */ const defaultProvidesModuleNodeModules = Metro.defaults.providesModuleNodeModules; +const errorhandler = require('errorhandler'); const fs = require('fs'); const getDevToolsMiddleware = require('./middleware/getDevToolsMiddleware'); const http = require('http'); @@ -41,8 +40,10 @@ const https = require('https'); const indexPageMiddleware = require('./middleware/indexPage'); const loadRawBodyMiddleware = require('./middleware/loadRawBodyMiddleware'); const messageSocket = require('./util/messageSocket.js'); +const morgan = require('morgan'); const openStackFrameInEditorMiddleware = require('./middleware/openStackFrameInEditorMiddleware'); const path = require('path'); +const serveStatic = require('serve-static'); const statusPageMiddleware = require('./middleware/statusPageMiddleware.js'); const systraceProfileMiddleware = require('./middleware/systraceProfileMiddleware.js'); const webSocketProxy = require('./util/webSocketProxy.js'); @@ -92,10 +93,10 @@ function runServer( const app = connect() .use(loadRawBodyMiddleware) - .use(connect.compress()) + .use(compression()) .use( '/debugger-ui', - connect.static(path.join(__dirname, 'util', 'debugger-ui')), + serveStatic(path.join(__dirname, 'util', 'debugger-ui')), ) .use( getDevToolsMiddleware(args, () => wsProxy && wsProxy.isChromeConnected()), @@ -108,9 +109,9 @@ function runServer( .use(indexPageMiddleware) .use(packagerServer.processRequest.bind(packagerServer)); - args.projectRoots.forEach(root => app.use(connect.static(root))); + args.projectRoots.forEach(root => app.use(serveStatic(root))); - app.use(connect.logger()).use(connect.errorHandler()); + app.use(morgan('combined')).use(errorhandler()); if (args.https && (!args.key || !args.cert)) { throw new Error('Cannot use https without specifying key and cert options'); diff --git a/package.json b/package.json index 0b846be4b..4aa05d006 100644 --- a/package.json +++ b/package.json @@ -159,11 +159,13 @@ "base64-js": "^1.1.2", "chalk": "^1.1.1", "commander": "^2.9.0", - "connect": "^2.8.3", + "compression": "^1.7.1", + "connect": "^3.6.5", "create-react-class": "^15.5.2", "debug": "^2.2.0", "denodeify": "^1.2.1", "envinfo": "^3.0.0", + "errorhandler": "^1.5.0", "event-target-shim": "^1.0.5", "fbjs": "^0.8.14", "fbjs-scripts": "^0.8.1", @@ -177,6 +179,7 @@ "mime": "^1.3.4", "minimist": "^1.2.0", "mkdirp": "^0.5.1", + "morgan": "^1.9.0", "node-fetch": "^1.3.3", "node-notifier": "^5.1.2", "npmlog": "^2.0.4", @@ -192,6 +195,7 @@ "regenerator-runtime": "^0.11.0", "rimraf": "^2.5.4", "semver": "^5.0.3", + "serve-static": "^1.13.1", "shell-quote": "1.6.1", "stacktrace-parser": "^0.1.3", "whatwg-fetch": "^1.0.0",