mirror of https://github.com/status-im/metro.git
Unify oss and internal version of stack trace editor opener
Reviewed By: @vjeux Differential Revision: D2519344 fb-gh-sync-id: 022d8865cd8eea3b0b51f9070c000f15c464dc6a
This commit is contained in:
parent
e5296785bf
commit
e742683859
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const launchEditor = require('./launchEditor');
|
||||
|
||||
module.exports = function(req, res, next) {
|
||||
if (req.url === '/open-stack-frame') {
|
||||
var frame = JSON.parse(req.rawBody);
|
||||
launchEditor(frame.file, frame.lineNumber);
|
||||
res.end('OK');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
};
|
14
packager.js
14
packager.js
|
@ -20,7 +20,7 @@ const checkNodeVersion = require('./checkNodeVersion');
|
|||
const connect = require('connect');
|
||||
const formatBanner = require('./formatBanner');
|
||||
const getDevToolsMiddleware = require('./getDevToolsMiddleware');
|
||||
const launchEditor = require('./launchEditor.js');
|
||||
const openStackFrameInEditorMiddleware = require('./openStackFrameInEditorMiddleware');
|
||||
const parseCommandLine = require('./parseCommandLine.js');
|
||||
const ReactPackager = require('./react-packager');
|
||||
const webSocketProxy = require('./webSocketProxy.js');
|
||||
|
@ -167,16 +167,6 @@ function loadRawBody(req, res, next) {
|
|||
});
|
||||
}
|
||||
|
||||
function openStackFrameInEditor(req, res, next) {
|
||||
if (req.url === '/open-stack-frame') {
|
||||
var frame = JSON.parse(req.rawBody);
|
||||
launchEditor(frame.file, frame.lineNumber);
|
||||
res.end('OK');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
// A status page so the React/project.pbxproj build script
|
||||
// can verify that packager is running on 8081 and not
|
||||
// another program / service.
|
||||
|
@ -279,8 +269,8 @@ function runServer(
|
|||
) {
|
||||
var app = connect()
|
||||
.use(loadRawBody)
|
||||
.use(openStackFrameInEditor)
|
||||
.use(getDevToolsMiddleware(options))
|
||||
.use(openStackFrameInEditorMiddleware)
|
||||
.use(statusPageMiddleware)
|
||||
.use(systraceProfileMiddleware)
|
||||
.use(cpuProfileMiddleware)
|
||||
|
|
Loading…
Reference in New Issue